Changeset - r9293:381d58467a0b
[Not reviewed]
master
0 9 0
rubidium - 16 years ago 2008-05-18 12:40:38
rubidium@openttd.org
(svn r13160) -Codechange: prepare GUIPlaceProcDragXY for the removal of WindowEvent.
9 files changed with 19 insertions and 20 deletions:
0 comments (0 inline, 0 general)
src/airport_gui.cpp
Show inline comments
 
@@ -95,7 +95,7 @@ static void BuildAirToolbWndProc(Window 
 

	
 
		case WE_PLACE_MOUSEUP:
 
			if (e->we.place.pt.x != -1 && e->we.place.select_proc == DDSP_DEMOLISH_AREA) {
 
				GUIPlaceProcDragXY(e);
 
				GUIPlaceProcDragXY(e->we.place.select_proc, e->we.place.starttile, e->we.place.tile);
 
			}
 
			break;
 

	
src/dock_gui.cpp
Show inline comments
 
@@ -162,7 +162,7 @@ static void BuildDocksToolbWndProc(Windo
 
		if (e->we.place.pt.x != -1) {
 
			switch (e->we.place.select_proc) {
 
				case DDSP_DEMOLISH_AREA:
 
					GUIPlaceProcDragXY(e);
 
					GUIPlaceProcDragXY(e->we.place.select_proc, e->we.place.starttile, e->we.place.tile);
 
					break;
 
				case DDSP_CREATE_WATER:
 
					DoCommandP(e->we.place.tile, e->we.place.starttile, 0, CcBuildCanal, CMD_BUILD_CANAL | CMD_MSG(STR_CANT_BUILD_CANALS));
src/rail_gui.cpp
Show inline comments
 
@@ -610,6 +610,7 @@ static void BuildRailToolbWndProc(Window
 
			TileIndex end_tile = e->we.place.tile;
 

	
 
			switch (e->we.place.select_proc) {
 
				default: NOT_REACHED();
 
				case DDSP_BUILD_BRIDGE:
 
					ResetObjectToPlace();
 
					ShowBuildBridgeWindow(start_tile, end_tile, TRANSPORT_RAIL, _cur_railtype);
 
@@ -624,7 +625,7 @@ static void BuildRailToolbWndProc(Window
 
					break;
 

	
 
				case DDSP_DEMOLISH_AREA:
 
					GUIPlaceProcDragXY(e);
 
					GUIPlaceProcDragXY(e->we.place.select_proc, e->we.place.starttile, e->we.place.tile);
 
					break;
 

	
 
				case DDSP_CONVERT_RAIL:
src/road_gui.cpp
Show inline comments
 
@@ -571,7 +571,7 @@ static void BuildRoadToolbWndProc(Window
 
						break;
 

	
 
					case DDSP_DEMOLISH_AREA:
 
						GUIPlaceProcDragXY(e);
 
						GUIPlaceProcDragXY(e->we.place.select_proc, e->we.place.starttile, e->we.place.tile);
 
						break;
 

	
 
					case DDSP_PLACE_ROAD_X_DIR:
src/terraform_gui.cpp
Show inline comments
 
@@ -110,12 +110,9 @@ static void GenerateRockyArea(TileIndex 
 
 * allows for additional implements that are more local. For example X_Y drag
 
 * of convertrail which belongs in rail_gui.cpp and not terraform_gui.cpp
 
 **/
 
bool GUIPlaceProcDragXY(const WindowEvent *e)
 
bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile)
 
{
 
	TileIndex start_tile = e->we.place.starttile;
 
	TileIndex end_tile = e->we.place.tile;
 

	
 
	switch (e->we.place.select_proc) {
 
	switch (proc) {
 
		case DDSP_DEMOLISH_AREA:
 
			DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
 
			break;
 
@@ -267,11 +264,12 @@ static void TerraformToolbWndProc(Window
 
	case WE_PLACE_MOUSEUP:
 
		if (e->we.place.pt.x != -1) {
 
			switch (e->we.place.select_proc) {
 
				default: NOT_REACHED();
 
				case DDSP_DEMOLISH_AREA:
 
				case DDSP_RAISE_AND_LEVEL_AREA:
 
				case DDSP_LOWER_AND_LEVEL_AREA:
 
				case DDSP_LEVEL_AREA:
 
					GUIPlaceProcDragXY(e);
 
					GUIPlaceProcDragXY(e->we.place.select_proc, e->we.place.starttile, e->we.place.tile);
 
					break;
 
			}
 
		}
 
@@ -655,6 +653,7 @@ static void ScenEditLandGenWndProc(Windo
 
		case WE_PLACE_MOUSEUP:
 
			if (e->we.place.pt.x != -1) {
 
				switch (e->we.place.select_proc) {
 
					default: NOT_REACHED();
 
					case DDSP_CREATE_ROCKS:
 
					case DDSP_CREATE_DESERT:
 
					case DDSP_CREATE_WATER:
 
@@ -663,7 +662,7 @@ static void ScenEditLandGenWndProc(Windo
 
					case DDSP_LOWER_AND_LEVEL_AREA:
 
					case DDSP_LEVEL_AREA:
 
					case DDSP_DEMOLISH_AREA:
 
						GUIPlaceProcDragXY(e);
 
						GUIPlaceProcDragXY(e->we.place.select_proc, e->we.place.starttile, e->we.place.tile);
 
						break;
 
				}
 
			}
src/tilehighlight_func.h
Show inline comments
 
@@ -12,7 +12,7 @@
 

	
 
typedef void PlaceProc(TileIndex tile);
 
void PlaceProc_DemolishArea(TileIndex tile);
 
bool GUIPlaceProcDragXY(const WindowEvent *e);
 
bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile);
 

	
 
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc);
 
void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, ViewportHighlightMode mode, Window *w);
src/window.cpp
Show inline comments
 
@@ -178,7 +178,7 @@ void Window::OnPlaceObjectAbort()
 
}
 

	
 

	
 
void Window::OnPlaceDrag(ViewportPlaceMethod select_method, byte select_proc, Point pt)
 
void Window::OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
 
{
 
	WindowEvent e;
 
	e.event = WE_PLACE_DRAG;
 
@@ -188,7 +188,7 @@ void Window::OnPlaceDrag(ViewportPlaceMe
 
	this->HandleWindowEvent(&e);
 
}
 

	
 
void Window::OnPlaceMouseUp(ViewportPlaceMethod select_method, byte select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
 
void Window::OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
 
{
 
	WindowEvent e;
 
	e.event = WE_PLACE_MOUSEUP;
src/window_gui.h
Show inline comments
 
@@ -20,8 +20,6 @@
 
 */
 
static const int MAX_NUMBER_OF_WINDOWS = 25;
 

	
 
typedef void WindowProc(Window *w, WindowEvent *e);
 

	
 
/* How the resize system works:
 
    First, you need to add a WWT_RESIZEBOX to the widgets, and you need
 
     to add the flag WDF_RESIZABLE to the window. Now the window is ready
 
@@ -147,7 +145,7 @@ struct WindowEvent {
 
			TileIndex tile;
 
			TileIndex starttile;
 
			ViewportPlaceMethod select_method;
 
			byte select_proc;
 
			ViewportDragDropSelectionProcess select_proc;
 
		} place;
 

	
 
		struct {
 
@@ -185,6 +183,8 @@ struct WindowEvent {
 
	} we;
 
};
 

	
 
typedef void WindowProc(Window *w, WindowEvent *e);
 

	
 
/**
 
 * High level window description
 
 */
 
@@ -482,7 +482,7 @@ public:
 
	 * @param select_proc   what will be created when the drag is over.
 
	 * @param pt            the exact point on the map where the mouse is.
 
	 */
 
	virtual void OnPlaceDrag(ViewportPlaceMethod select_method, byte select_proc, Point pt);
 
	virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt);
 

	
 
	/**
 
	 * The user has dragged over the map when the tile highlight mode
 
@@ -493,7 +493,7 @@ public:
 
	 * @param start_tile    the begin tile of the drag.
 
	 * @param end_tile      the end tile of the drag.
 
	 */
 
	virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, byte select_proc, Point pt, TileIndex start_tile, TileIndex end_tile);
 
	virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile);
 

	
 
	/**
 
	 * The user moves over the map when a tile highlight mode has been set
src/window_type.h
Show inline comments
 
@@ -99,7 +99,6 @@ enum WindowClass {
 
};
 

	
 
struct Window;
 
struct WindowEvent;
 
typedef int32 WindowNumber;
 

	
 
#endif /* WINDOW_TYPE_H */
0 comments (0 inline, 0 general)