Changeset - r9244:dfe988250150
[Not reviewed]
master
0 2 0
rubidium - 16 years ago 2008-05-15 20:52:28
rubidium@openttd.org
(svn r13110) -Fix [FS#2018]: some toolbar buttons not being unpressed properly.
2 files changed with 12 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/viewport.cpp
Show inline comments
 
@@ -2705,17 +2705,24 @@ void SetObjectToPlaceWnd(CursorID icon, 
 
}
 

	
 
#include "table/animcursors.h"
 

	
 
void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, WindowClass window_class, WindowNumber window_num)
 
{
 
	Window *w = NULL;
 

	
 
	/* undo clicking on button and drag & drop */
 
	if (_thd.place_mode != VHM_NONE || _special_mouse_mode == WSM_DRAGDROP) {
 
		w = FindWindowById(_thd.window_class, _thd.window_number);
 
		Window *w = FindWindowById(_thd.window_class, _thd.window_number);
 
		if (w != NULL) {
 
			/* Call the abort function, but set the window class to something
 
			 * that will never be used to avoid infinite loops. Setting it to
 
			 * the 'next' window class must not be done because recursion into
 
			 * this function might in some cases reset the newly set object to
 
			 * place or not properly reset the original selection. */
 
			_thd.window_class = WC_INVALID;
 
			w->OnPlaceObjectAbort();
 
		}
 
	}
 

	
 
	SetTileSelectSize(1, 1);
 

	
 
	_thd.make_square_red = false;
 

	
 
@@ -2736,16 +2743,12 @@ void SetObjectToPlace(CursorID icon, Spr
 
	if ((int)icon < 0) {
 
		SetAnimatedMouseCursor(_animcursors[~icon]);
 
	} else {
 
		SetMouseCursor(icon, pal);
 
	}
 

	
 
	/* Call the abort function only *after* the window class/number
 
	 * are reset so one doesn't get into infinite loops when someone
 
	 * resets the object to place during the abort callback. */
 
	if (w != NULL) w->OnPlaceObjectAbort();
 
}
 

	
 
void ResetObjectToPlace()
 
{
 
	SetObjectToPlace(SPR_CURSOR_MOUSE, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0);
 
}
src/window_type.h
Show inline comments
 
@@ -91,12 +91,14 @@ enum WindowClass {
 
	WC_CONFIRM_POPUP_QUERY,
 
	WC_TRANSPARENCY_TOOLBAR,
 
	WC_VEHICLE_TIMETABLE,
 
	WC_BUILD_SIGNAL,
 
	WC_COMPANY_PASSWORD_WINDOW,
 
	WC_OSK,
 

	
 
	WC_INVALID = 0xFFFF
 
};
 

	
 
struct Window;
 
struct WindowEvent;
 
typedef int32 WindowNumber;
 

	
0 comments (0 inline, 0 general)