2159 Window *w; |
2159 Window *w; |
2160 WindowEvent e; |
2160 WindowEvent e; |
2161 |
2161 |
2162 if (_special_mouse_mode != WSM_SIZING) return true; |
2162 if (_special_mouse_mode != WSM_SIZING) return true; |
2163 |
2163 |
2164 e.place.userdata = _thd.userdata; |
2164 e.we.place.userdata = _thd.userdata; |
2165 |
2165 |
2166 // stop drag mode if the window has been closed |
2166 // stop drag mode if the window has been closed |
2167 w = FindWindowById(_thd.window_class,_thd.window_number); |
2167 w = FindWindowById(_thd.window_class,_thd.window_number); |
2168 if (w == NULL) { |
2168 if (w == NULL) { |
2169 ResetObjectToPlace(); |
2169 ResetObjectToPlace(); |
2171 } |
2171 } |
2172 |
2172 |
2173 // while dragging execute the drag procedure of the corresponding window (mostly VpSelectTilesWithMethod() ) |
2173 // while dragging execute the drag procedure of the corresponding window (mostly VpSelectTilesWithMethod() ) |
2174 if (_left_button_down) { |
2174 if (_left_button_down) { |
2175 e.event = WE_PLACE_DRAG; |
2175 e.event = WE_PLACE_DRAG; |
2176 e.place.pt = GetTileBelowCursor(); |
2176 e.we.place.pt = GetTileBelowCursor(); |
2177 w->wndproc(w, &e); |
2177 w->wndproc(w, &e); |
2178 return false; |
2178 return false; |
2179 } |
2179 } |
2180 |
2180 |
2181 // mouse button released.. |
2181 // mouse button released.. |
2182 // keep the selected tool, but reset it to the original mode. |
2182 // keep the selected tool, but reset it to the original mode. |
2183 _special_mouse_mode = WSM_NONE; |
2183 _special_mouse_mode = WSM_NONE; |
2184 if (_thd.next_drawstyle == HT_RECT) { |
2184 if (_thd.next_drawstyle == HT_RECT) { |
2185 _thd.place_mode = VHM_RECT; |
2185 _thd.place_mode = VHM_RECT; |
2186 } else if ((e.place.userdata & 0xF) == VPM_SIGNALDIRS) { // some might call this a hack... -- Dominik |
2186 } else if ((e.we.place.userdata & 0xF) == VPM_SIGNALDIRS) { // some might call this a hack... -- Dominik |
2187 _thd.place_mode = VHM_RECT; |
2187 _thd.place_mode = VHM_RECT; |
2188 } else if (_thd.next_drawstyle & HT_LINE) { |
2188 } else if (_thd.next_drawstyle & HT_LINE) { |
2189 _thd.place_mode = VHM_RAIL; |
2189 _thd.place_mode = VHM_RAIL; |
2190 } else if (_thd.next_drawstyle & HT_RAIL) { |
2190 } else if (_thd.next_drawstyle & HT_RAIL) { |
2191 _thd.place_mode = VHM_RAIL; |
2191 _thd.place_mode = VHM_RAIL; |
2194 } |
2194 } |
2195 SetTileSelectSize(1, 1); |
2195 SetTileSelectSize(1, 1); |
2196 |
2196 |
2197 // and call the mouseup event. |
2197 // and call the mouseup event. |
2198 e.event = WE_PLACE_MOUSEUP; |
2198 e.event = WE_PLACE_MOUSEUP; |
2199 e.place.pt = _thd.selend; |
2199 e.we.place.pt = _thd.selend; |
2200 e.place.tile = TileVirtXY(e.place.pt.x, e.place.pt.y); |
2200 e.we.place.tile = TileVirtXY(e.we.place.pt.x, e.we.place.pt.y); |
2201 e.place.starttile = TileVirtXY(_thd.selstart.x, _thd.selstart.y); |
2201 e.we.place.starttile = TileVirtXY(_thd.selstart.x, _thd.selstart.y); |
2202 w->wndproc(w, &e); |
2202 w->wndproc(w, &e); |
2203 |
2203 |
2204 return false; |
2204 return false; |
2205 } |
2205 } |
2206 |
2206 |