File diff r23123:aa31147b532e → r23124:8fa6d269005b
src/toolbar_gui.cpp
Show inline comments
 
@@ -1975,22 +1975,26 @@ enum MainToolbarHotkeys {
 
	MTHK_CLIENT_LIST,
 
	MTHK_SIGN_LIST,
 
};
 

	
 
/** Main toolbar. */
 
struct MainToolbarWindow : Window {
 
	int timer;
 

	
 
	MainToolbarWindow(WindowDesc *desc) : Window(desc)
 
	{
 
		this->InitNested(0);
 

	
 
		_last_started_action = CBF_NONE;
 
		CLRBITS(this->flags, WF_WHITE_BORDER);
 
		this->SetWidgetDisabledState(WID_TN_PAUSE, _networking && !_network_server); // if not server, disable pause button
 
		this->SetWidgetDisabledState(WID_TN_FAST_FORWARD, _networking); // if networking, disable fast-forward button
 
		PositionMainToolbar(this);
 
		DoZoomInOutWindow(ZOOM_NONE, this);
 

	
 
		this->timer = MILLISECONDS_PER_TICK;
 
	}
 

	
 
	virtual void FindWindowPlacementAndResize(int def_width, int def_height)
 
	{
 
		Window::FindWindowPlacementAndResize(_toolbar_width, def_height);
 
	}
 
@@ -2089,14 +2093,17 @@ struct MainToolbarWindow : Window {
 

	
 
	virtual void OnPlaceObjectAbort()
 
	{
 
		_last_started_action = CBF_NONE;
 
	}
 

	
 
	virtual void OnTick()
 
	virtual void OnRealtimeTick(uint delta_ms)
 
	{
 
		if (!TimerElapsed(this->timer, delta_ms)) return;
 
		this->timer = MILLISECONDS_PER_TICK;
 

	
 
		if (this->IsWidgetLowered(WID_TN_PAUSE) != !!_pause_mode) {
 
			this->ToggleWidgetLoweredState(WID_TN_PAUSE);
 
			this->SetWidgetDirty(WID_TN_PAUSE);
 
		}
 

	
 
		if (this->IsWidgetLowered(WID_TN_FAST_FORWARD) != !!_fast_forward) {
 
@@ -2307,20 +2314,24 @@ enum MainToolbarEditorHotkeys {
 
	MTEHK_TERRAFORM,
 
	MTEHK_SMALLMAP,
 
	MTEHK_EXTRA_VIEWPORT,
 
};
 

	
 
struct ScenarioEditorToolbarWindow : Window {
 
	int timer;
 

	
 
	ScenarioEditorToolbarWindow(WindowDesc *desc) : Window(desc)
 
	{
 
		this->InitNested(0);
 

	
 
		_last_started_action = CBF_NONE;
 
		CLRBITS(this->flags, WF_WHITE_BORDER);
 
		PositionMainToolbar(this);
 
		DoZoomInOutWindow(ZOOM_NONE, this);
 

	
 
		this->timer = MILLISECONDS_PER_TICK;
 
	}
 

	
 
	virtual void FindWindowPlacementAndResize(int def_width, int def_height)
 
	{
 
		Window::FindWindowPlacementAndResize(_toolbar_width, def_height);
 
	}
 
@@ -2442,14 +2453,17 @@ struct ScenarioEditorToolbarWindow : Win
 
	{
 
		this->SetWidgetsLoweredState(false, WID_TE_DATE_BACKWARD, WID_TE_DATE_FORWARD, WIDGET_LIST_END);
 
		this->SetWidgetDirty(WID_TE_DATE_BACKWARD);
 
		this->SetWidgetDirty(WID_TE_DATE_FORWARD);
 
	}
 

	
 
	virtual void OnTick()
 
	virtual void OnRealtimeTick(uint delta_ms)
 
	{
 
		if (!TimerElapsed(this->timer, delta_ms)) return;
 
		this->timer = MILLISECONDS_PER_TICK;
 

	
 
		if (this->IsWidgetLowered(WID_TE_PAUSE) != !!_pause_mode) {
 
			this->ToggleWidgetLoweredState(WID_TE_PAUSE);
 
			this->SetDirty();
 
		}
 

	
 
		if (this->IsWidgetLowered(WID_TE_FAST_FORWARD) != !!_fast_forward) {