Changeset - r17476:d3b7a183536d
src/ai/ai_gui.cpp
Show inline comments
 
@@ -179,14 +179,20 @@ struct AIListWindow : public Window {
 
	{
 
		NWidgetCore *nwi = this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST);
 
		this->vscroll->SetCapacity(nwi->current_y / this->line_height);
 
		nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) {
 
			delete this;
 
			return;
 
		}
 

	
 
		this->vscroll->SetCount((int)this->ai_info_list->size() + 1);
 
@@ -434,14 +440,20 @@ struct AISettingsWindow : public Window 
 
		if (--this->timeout == 0) {
 
			this->clicked_button = -1;
 
			this->SetDirty();
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) delete this;
 
	}
 
};
 

	
 
/** Widgets for the AI settings window. */
 
static const NWidgetPart _nested_ai_settings_widgets[] = {
 
@@ -689,14 +701,20 @@ struct AIConfigWindow : public Window {
 
#endif
 
				}
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (!IsEditable(this->selected_slot)) {
 
			this->selected_slot = INVALID_COMPANY;
 
		}
 

	
 
		this->SetWidgetDisabledState(AIC_WIDGET_DECREASE, GetGameSettings().difficulty.max_no_competitors == 0);
 
		this->SetWidgetDisabledState(AIC_WIDGET_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES - 1);
 
@@ -1029,14 +1047,20 @@ struct AIDebugWindow : public QueryStrin
 
			/* Save the current string to static member so it can be restored next time the window is opened */
 
			strecpy(this->break_string, this->edit_str_buf, lastof(this->break_string));
 
		}
 
		return state;
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (data == -1 || ai_debug_company == data) this->SetDirty();
 

	
 
		if (data == -2) {
 
			/* The continue button should be disabled when the game is unpaused and
 
			 * it was previously paused by the break string ( = a line in the log
 
			 * was highlighted )*/
src/autoreplace_gui.cpp
Show inline comments
 
@@ -488,14 +488,20 @@ public:
 
		this->vscroll[1]->SetCapacityFromWidget(this, RVW_WIDGET_RIGHT_MATRIX);
 

	
 
		this->GetWidget<NWidgetCore>(RVW_WIDGET_LEFT_MATRIX)->widget_data =
 
				this->GetWidget<NWidgetCore>(RVW_WIDGET_RIGHT_MATRIX)->widget_data = (this->vscroll[0]->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (data != 0) {
 
			this->engines[0].ForceRebuild();
 
		} else {
 
			this->engines[1].ForceRebuild();
 
		}
 
	}
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -1215,14 +1215,20 @@ struct BuildVehicleWindow : Window {
 
				}
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* When switching to original acceleration model for road vehicles, clear the selected sort criteria if it is not available now. */
 
		if (this->vehicle_type == VEH_ROAD &&
 
				_settings_game.vehicle.roadveh_acceleration_model == AM_ORIGINAL &&
 
				this->sort_criteria > 7) {
 
			this->sort_criteria = 0;
 
			_last_sort_criteria[VEH_ROAD] = 0;
src/company_gui.cpp
Show inline comments
 
@@ -797,14 +797,20 @@ public:
 
			if (HasBit(this->sel, scheme)) {
 
				DoCommandP(0, scheme | (widget == SCLW_WIDGET_PRI_COL_DROPDOWN ? 0 : 256), index, CMD_SET_COMPANY_COLOUR);
 
			}
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->SetWidgetsDisabledState(true, SCLW_WIDGET_CLASS_RAIL, SCLW_WIDGET_CLASS_ROAD, SCLW_WIDGET_CLASS_SHIP, SCLW_WIDGET_CLASS_AIRCRAFT, WIDGET_LIST_END);
 

	
 
		bool current_class_valid = this->livery_class == LC_OTHER;
 
		if (_settings_client.gui.liveries == LIT_ALL || (_settings_client.gui.liveries == LIT_COMPANY && this->window_number == _local_company)) {
 
			for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
 
				if (HasBit(_loaded_newgrf_features.used_liveries, scheme)) {
src/depot_gui.cpp
Show inline comments
 
@@ -632,14 +632,20 @@ struct DepotWindow : Window {
 
				fill->height = resize->height;
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->generate_list = true;
 
	}
 

	
 
	virtual void OnPaint()
 
	{
 
		if (this->generate_list) {
src/dock_gui.cpp
Show inline comments
 
@@ -116,14 +116,20 @@ struct BuildDocksToolbarWindow : Window 
 

	
 
	~BuildDocksToolbarWindow()
 
	{
 
		if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
 
	}
 

	
 
	void OnInvalidateData(int data = 0)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_SHIP),
 
			DTW_DEPOT,
 
			DTW_STATION,
 
			DTW_BUOY,
 
			WIDGET_LIST_END);
 
	}
src/fios_gui.cpp
Show inline comments
 
@@ -656,14 +656,20 @@ public:
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, SLWW_DRIVES_DIRECTORIES_LIST);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		switch (data) {
 
			case 0:
 
				/* Rescan files */
 
				this->selected = NULL;
 
				_load_check_data.Clear();
 
				BuildFileList();
src/genworld_gui.cpp
Show inline comments
 
@@ -422,14 +422,20 @@ struct GenerateLandscapeWindow : public 
 
					SetDParam(1, this->y);
 
				}
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* Update the climate buttons */
 
		this->SetWidgetLoweredState(GLAND_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE);
 
		this->SetWidgetLoweredState(GLAND_ARCTIC,    _settings_newgame.game_creation.landscape == LT_ARCTIC);
 
		this->SetWidgetLoweredState(GLAND_TROPICAL,  _settings_newgame.game_creation.landscape == LT_TROPIC);
 
		this->SetWidgetLoweredState(GLAND_TOYLAND,   _settings_newgame.game_creation.landscape == LT_TOYLAND);
 

	
src/graph_gui.cpp
Show inline comments
 
@@ -88,14 +88,20 @@ struct GraphLegendWindow : Window {
 
		InvalidateWindowData(WC_OPERATING_PROFIT, 0);
 
		InvalidateWindowData(WC_DELIVERED_CARGO, 0);
 
		InvalidateWindowData(WC_PERFORMANCE_HISTORY, 0);
 
		InvalidateWindowData(WC_COMPANY_VALUE, 0);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (Company::IsValidID(data)) return;
 

	
 
		SetBit(_legend_excluded_companies, data);
 
		this->RaiseWidget(data + GLW_FIRST_COMPANY);
 
	}
 
};
 
@@ -540,14 +546,20 @@ public:
 

	
 
	virtual void OnTick()
 
	{
 
		this->UpdateStatistics(false);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->UpdateStatistics(true);
 
	}
 

	
 
	/**
 
	 * Update the statistics.
 
	 * @param initialize Initialize the data structure.
 
@@ -1010,14 +1022,20 @@ struct PaymentRatesGraphWindow : BaseGra
 

	
 
	virtual void OnTick()
 
	{
 
		/* Override default OnTick */
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->OnHundredthTick();
 
	}
 

	
 
	virtual void OnHundredthTick()
 
	{
 
		this->UpdateExcludedData();
 
@@ -1244,14 +1262,20 @@ public:
 
	{
 
		if (this->companies.NeedResort()) {
 
			this->SetDirty();
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (data == 0) {
 
			this->companies.ForceRebuild();
 
		} else {
 
			this->companies.ForceResort();
 
		}
 
	}
 
@@ -1485,17 +1509,19 @@ struct PerformanceRatingDetailWindow : W
 
			this->UpdateCompanyStats();
 
			this->SetDirty();
 
		}
 
	}
 

	
 
	/**
 
	 * Invalidate the data of this window.
 
	 * Some data on this window has become invalid.
 
	 * @param data the company ID of the company that is going to be removed
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data)
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* Disable the companies who are not active */
 
		for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) {
 
			this->SetWidgetDisabledState(i + PRW_COMPANY_FIRST, !Company::IsValidID(i));
 
		}
 

	
 
		/* Check if the currently selected company is still active. */
src/group_gui.cpp
Show inline comments
 
@@ -250,14 +250,20 @@ public:
 
				*size = maxdim(*size, d);
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* We can only set the trigger for resorting/rebuilding.
 
		 * We cannot safely resort at this point, as there might be multiple scheduled invalidations,
 
		 * and a rebuild needs to be done first though it is scheduled later. */
 
		if (data == 0) {
 
			this->vehicles.ForceRebuild();
 
			this->groups.ForceRebuild();
src/industry_gui.cpp
Show inline comments
 
@@ -594,14 +594,20 @@ public:
 

	
 
	virtual void OnPlaceObjectAbort()
 
	{
 
		this->RaiseButtons();
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->SetupArrays();
 

	
 
		const IndustrySpec *indsp = (this->selected_type == INVALID_INDUSTRYTYPE) ? NULL : GetIndustrySpec(this->selected_type);
 
		if (indsp == NULL) this->enabled[this->selected_index] = _settings_game.difficulty.industry_density != ID_FUND_ONLY;
 
		this->SetButtons();
 
	}
 
@@ -944,14 +950,20 @@ public:
 
				break;
 
		}
 
		UpdateIndustryProduction(i);
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		const Industry *i = Industry::Get(this->window_number);
 
		if (IsProductionAlterable(i)) {
 
			const IndustrySpec *ind = GetIndustrySpec(i->type);
 
			this->editable = ind->UsesSmoothEconomy() ? EA_RATE : EA_MULTIPLIER;
 
		} else {
 
			this->editable = EA_NONE;
 
@@ -1343,14 +1355,20 @@ public:
 
	virtual void OnHundredthTick()
 
	{
 
		this->industries.ForceResort();
 
		this->BuildSortIndustriesList();
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* We can only set the trigger for resorting/rebuilding.
 
		 * We cannot safely resort at this point, as there might be multiple scheduled invalidations,
 
		 * and a rebuild needs to be done first though it is scheduled later. */
 
		if (data == 0) {
 
			this->industries.ForceRebuild();
 
		} else {
 
@@ -2391,19 +2409,21 @@ struct IndustryCargoesWindow : public Wi
 
		this->vscroll->SetCount(CeilDiv(WD_FRAMETEXT_TOP + WD_FRAMETEXT_BOTTOM + CargoesField::small_height + num_indrows * CargoesField::normal_height, nwp->resize_y));
 
		this->SetDirty();
 
		this->NotifySmallmap();
 
	}
 

	
 
	/**
 
	 * Notify the window about external events.
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * - data = 0 .. NUM_INDUSTRYTYPES - 1: Display the chain around the given industry.
 
	 * - data = NUM_INDUSTRYTYPES: Stop sending updates to the smallmap window.
 
	 * @param data The event.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data)
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (data == NUM_INDUSTRYTYPES) {
 
			if (this->IsWidgetLowered(ICW_NOTIFY)) {
 
				this->RaiseWidget(ICW_NOTIFY);
 
				this->SetWidgetDirty(ICW_NOTIFY);
 
			}
 
			return;
src/intro_gui.cpp
Show inline comments
 
@@ -52,14 +52,20 @@ struct SelectGameWindow : public Window 
 
	SelectGameWindow(const WindowDesc *desc) : Window()
 
	{
 
		this->InitNested(desc);
 
		this->OnInvalidateData();
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->SetWidgetLoweredState(SGI_TEMPERATE_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TEMPERATE);
 
		this->SetWidgetLoweredState(SGI_ARCTIC_LANDSCAPE,    _settings_newgame.game_creation.landscape == LT_ARCTIC);
 
		this->SetWidgetLoweredState(SGI_TROPIC_LANDSCAPE,    _settings_newgame.game_creation.landscape == LT_TROPIC);
 
		this->SetWidgetLoweredState(SGI_TOYLAND_LANDSCAPE,   _settings_newgame.game_creation.landscape == LT_TOYLAND);
 
	}
 

	
src/main_gui.cpp
Show inline comments
 
@@ -429,14 +429,20 @@ struct MainWindow : Window
 
		if (this->viewport != NULL) {
 
			NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(MW_VIEWPORT);
 
			nvp->UpdateViewportCoordinates(this);
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* Forward the message to the appropiate toolbar (ingame or scenario editor) */
 
		InvalidateWindowData(WC_MAIN_TOOLBAR, 0, data, true);
 
	}
 

	
 
	static Hotkey<MainWindow> global_hotkeys[];
 
};
src/misc_gui.cpp
Show inline comments
 
@@ -329,14 +329,20 @@ public:
 

	
 
	virtual void ShowNewGRFInspectWindow() const
 
	{
 
		::ShowNewGRFInspectWindow(GetGrfSpecFeature(this->tile), this->tile);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		switch (data) {
 
			case 1:
 
				/* ReInit, "debug" sprite might have changed */
 
				this->ReInit();
 
				break;
 
		}
 
@@ -636,14 +642,20 @@ public:
 
			pt.x = Clamp(UnScaleByZoom(pt.x - vp->virtual_left, vp->zoom) + vp->left - (sm_width / 2),  0, _screen.width  - sm_width);
 
			pt.y = Clamp(UnScaleByZoom(pt.y - vp->virtual_top,  vp->zoom) + vp->top  - (sm_height / 2), scr_top, scr_bot - sm_height);
 
		}
 
		return pt;
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* If company gets shut down, while displaying an error about it, remove the error message. */
 
		if (this->face != INVALID_COMPANY && !Company::IsValidID(this->face)) delete this;
 
	}
 

	
 
	virtual void SetStringParameters(int widget) const
 
	{
src/music_gui.cpp
Show inline comments
 
@@ -310,14 +310,20 @@ struct MusicTrackSelectionWindow : publi
 
			case MTSW_PLAYLIST:
 
				SetDParam(0, STR_MUSIC_PLAYLIST_ALL + _settings_client.music.playlist);
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		for (int i = 0; i < 6; i++) {
 
			this->SetWidgetLoweredState(MTSW_ALL + i, i == _settings_client.music.playlist);
 
		}
 
		this->SetWidgetDisabledState(MTSW_CLEAR, _settings_client.music.playlist <= 3);
 
		this->SetDirty();
 
	}
 
@@ -635,14 +641,20 @@ struct MusicWindow : public Window {
 
				DrawFrameRect(x, r.top, x + slider_width, r.bottom, COLOUR_GREY, FR_NONE);
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		for (int i = 0; i < 6; i++) {
 
			this->SetWidgetLoweredState(MW_ALL + i, i == _settings_client.music.playlist);
 
		}
 
		this->SetDirty();
 
	}
 

	
src/network/network_chat_gui.cpp
Show inline comments
 
@@ -528,14 +528,20 @@ struct NetworkChatWindow : public QueryS
 

	
 
	virtual void OnOpenOSKWindow(int wid)
 
	{
 
		ShowOnScreenKeyboard(this, wid, NWCW_CLOSE, NWCW_SENDBUTTON);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (data == this->dest) delete this;
 
	}
 
};
 

	
 
static const NWidgetPart _nested_chat_window_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
src/network/network_content_gui.cpp
Show inline comments
 
@@ -748,14 +748,20 @@ public:
 
			return;
 
		}
 

	
 
		this->InvalidateData();
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (this->content.NeedRebuild()) this->BuildContentList();
 

	
 
		/* To sum all the bytes we intend to download */
 
		this->filesize_sum = 0;
 
		bool show_select_all = false;
 
		bool show_select_upgrade = false;
src/network/network_gui.cpp
Show inline comments
 
@@ -791,14 +791,20 @@ public:
 

	
 
	virtual void OnMouseLoop()
 
	{
 
		if (this->field == NGWW_CLIENT) this->HandleEditBox(NGWW_CLIENT);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (data == 1) {
 
			this->server = NULL;
 
			this->list_pos = SLP_INVALID;
 
		}
 
		this->servers.ForceRebuild();
 
		this->SetDirty();
src/newgrf_debug_gui.cpp
Show inline comments
 
@@ -769,14 +769,20 @@ struct SpriteAlignerWindow : Window {
 
		while (GetSpriteType(this->current_sprite) != ST_NORMAL) {
 
			this->current_sprite = (this->current_sprite + 1) % GetMaxSpriteID();
 
		}
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (data == 1) {
 
			/* Sprite picker finished */
 
			this->RaiseWidget(SAW_PICKER);
 
			this->vscroll->SetCount(_newgrf_debug_sprite_picker.sprites.Length());
 
		}
 
	}
src/newgrf_gui.cpp
Show inline comments
 
@@ -376,14 +376,20 @@ struct NewGRFParametersWindow : public W
 
	{
 
		NWidgetCore *nwi = this->GetWidget<NWidgetCore>(GRFPAR_WIDGET_BACKGROUND);
 
		this->vscroll->SetCapacity(nwi->current_y / this->line_height);
 
		nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (!this->action14present) {
 
			this->SetWidgetDisabledState(GRFPAR_WIDGET_NUMPAR_DEC, this->grf_config->num_params == 0);
 
			this->SetWidgetDisabledState(GRFPAR_WIDGET_NUMPAR_INC, this->grf_config->num_params >= this->grf_config->num_valid_params);
 
		}
 

	
 
		this->vscroll->SetCount(this->action14present ? this->grf_config->num_valid_params : this->grf_config->num_params);
 
@@ -1022,21 +1028,24 @@ struct NewGRFWindow : public QueryString
 
		}
 

	
 
		this->InvalidateData();
 
	}
 

	
 
	/**
 
	 * Calback to update internal data.
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 *  - 0: (optionally) build availables, update button status.
 
	 *  - 1: build availables, Add newly found grfs, update button status.
 
	 *  - 2: (optionally) build availables, Reset preset, + 3
 
	 *  - 3: (optionally) build availables, Update active scrollbar, update button status.
 
	 *  - 4: Force a rebuild of the availables, + 2
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0)
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		switch (data) {
 
			default: NOT_REACHED();
 
			case 0:
 
				/* Nothing important to do */
 
				break;
 

	
src/news_gui.cpp
Show inline comments
 
@@ -495,14 +495,20 @@ struct NewsWindow : Window {
 
			delete this;
 
			return ES_HANDLED;
 
		}
 
		return ES_NOT_HANDLED;
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* The chatbar has notified us that is was either created or closed */
 
		int newtop = this->top + this->chat_height - data;
 
		this->chat_height = data;
 
		this->SetWindowTop(newtop);
 
	}
 

	
 
@@ -1032,14 +1038,20 @@ struct MessageHistoryWindow : Window {
 

	
 
			ni = ni->prev;
 
			if (ni == NULL) return;
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->vscroll->SetCount(_total_news);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget == MHW_BACKGROUND) {
 
@@ -1198,14 +1210,20 @@ struct MessageOptionsWindow : Window {
 
				size->width += MOS_BUTTON_SPACE; // A bit extra for better looks.
 
			}
 
			return;
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* Update the dropdown value for 'set all categories'. */
 
		this->GetWidget<NWidgetCore>(WIDGET_NEWSOPT_DROP_SUMMARY)->widget_data = this->message_opt[this->state];
 

	
 
		/* Update widget to reflect the value of the #_news_ticker_sound variable. */
 
		this->SetWidgetLoweredState(WIDGET_NEWSOPT_SOUNDTICKER, _news_ticker_sound);
 
	}
src/order_gui.cpp
Show inline comments
 
@@ -802,14 +802,20 @@ public:
 
				*size = maxdim(*size, d);
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		VehicleOrderID from = INVALID_VEH_ORDER_ID;
 
		VehicleOrderID to   = INVALID_VEH_ORDER_ID;
 

	
 
		switch (data) {
 
			case -666:
 
				/* Autoreplace replaced the vehicle */
src/osk_gui.cpp
Show inline comments
 
@@ -244,14 +244,20 @@ struct OskWindow : public Window {
 
	{
 
		this->qs->HandleEditBox(this, OSK_WIDGET_TEXT);
 
		/* make the caret of the parent window also blink */
 
		this->parent->SetWidgetDirty(this->text_btn);
 
	}
 

	
 
	virtual void OnInvalidateData(int)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->SetWidgetDirty(OSK_WIDGET_TEXT);
 
	}
 
};
 

	
 
static const int HALF_KEY_WIDTH = 7;  // Width of 1/2 key in pixels.
 
static const int INTER_KEY_SPACE = 2; // Number of pixels between two keys.
src/rail_gui.cpp
Show inline comments
 
@@ -1614,14 +1614,20 @@ public:
 
			default: break;
 
		}
 

	
 
		this->InvalidateData();
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->LowerWidget((_cur_signal_variant == SIG_ELECTRIC ? BSW_ELECTRIC_NORM : BSW_SEMAPHORE_NORM) + _cur_signal_type);
 

	
 
		this->SetWidgetLoweredState(BSW_CONVERT, _convert_signal_button);
 

	
 
		this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_DECREASE, _settings_client.gui.drag_signals_density == 1);
 
		this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_INCREASE, _settings_client.gui.drag_signals_density == 20);
src/road_gui.cpp
Show inline comments
 
@@ -338,14 +338,20 @@ struct BuildRoadToolbarWindow : Window {
 

	
 
	~BuildRoadToolbarWindow()
 
	{
 
		if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
 
	}
 

	
 
	void OnInvalidateData(int data = 0)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_ROAD),
 
				RTW_DEPOT,
 
				RTW_BUS_STATION,
 
				RTW_TRUCK_STATION,
 
				WIDGET_LIST_END);
 
	}
src/settings_gui.cpp
Show inline comments
 
@@ -457,14 +457,20 @@ struct GameOptionsWindow : Window {
 
			case GOW_BASE_MUSIC_DROPDOWN:
 
				this->SetMediaSet<BaseMusic>(index);
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->SetWidgetLoweredState(GOW_FULLSCREEN_BUTTON, _fullscreen);
 

	
 
		bool missing_files = BaseGraphics::GetUsedSet()->GetNumMissing() == 0;
 
		this->GetWidget<NWidgetCore>(GOW_BASE_GRF_STATUS)->SetDataTip(missing_files ? STR_EMPTY : STR_GAME_OPTIONS_BASE_GRF_STATUS, STR_NULL);
 

	
 
		missing_files = BaseMusic::GetUsedSet()->GetNumInvalid() == 0;
 
@@ -721,14 +727,20 @@ public:
 
			case GDW_CANCEL: // Cancel button - close window, abandon changes
 
				delete this;
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		uint i;
 
		const SettingDesc *sd = GetSettingFromName("difficulty.max_no_competitors", &i);
 
		for (i = 0; i < GAME_DIFFICULTY_NUM; i++, sd++) {
 
			const SettingDescBase *sdb = &sd->desc;
 
			/* skip deprecated difficulty options */
 
			if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue;
src/signs_gui.cpp
Show inline comments
 
@@ -364,14 +364,20 @@ struct SignListWindow : QueryStringBaseW
 
	virtual void OnHundredthTick()
 
	{
 
		this->BuildSortSignList();
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* When there is a filter string, we always need to rebuild the list even if
 
		 * the amount of signs in total is unchanged, as the subset of signs that is
 
		 * accepted by the filter might has changed.
 
		 *
 
		 * We can only set the trigger for resorting/rebuilding.
 
		 * We cannot safely resort at this point, as there might be multiple scheduled invalidations,
src/smallmap_gui.cpp
Show inline comments
 
@@ -1420,18 +1420,21 @@ public:
 
				this->SetDirty();
 
				break;
 
		}
 
	}
 

	
 
	/**
 
	 * Notifications for the smallmap window.
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * - data = 0: Displayed industries at the industry chain window have changed.
 
	 * - data = 1: Companies have changed.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data)
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		switch (data) {
 
			case 1:
 
				/* The owner legend has already been rebuilt. */
 
				this->ReInit();
 
				break;
 

	
src/station_gui.cpp
Show inline comments
 
@@ -684,14 +684,20 @@ public:
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, SLW_LIST, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* We can only set the trigger for resorting/rebuilding.
 
		 * We cannot safely resort at this point, as there might be multiple scheduled invalidations,
 
		 * and a rebuild needs to be done first though it is scheduled later. */
 
		if (data == 0) {
 
			this->stations.ForceRebuild();
 
		} else {
 
@@ -1448,14 +1454,20 @@ struct SelectStationWindow : Window {
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, JSW_PANEL, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		FindStationsNearby<T>(this->area, true);
 
		this->vscroll->SetCount(_stations_nearby_list.Length() + 1);
 
		this->SetDirty();
 
	}
 
};
 

	
src/statusbar_gui.cpp
Show inline comments
 
@@ -180,14 +180,20 @@ struct StatusBarWindow : Window {
 
					DrawSprite(SPR_UNREAD_NEWS, PAL_NONE, r.right - WD_FRAMERECT_RIGHT - icon_size.width, r.top + WD_FRAMERECT_TOP + (int)(FONT_HEIGHT_NORMAL - icon_size.height) / 2);
 
				}
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		switch (data) {
 
			default: NOT_REACHED();
 
			case SBI_SAVELOAD_START:  this->saving = true;  break;
 
			case SBI_SAVELOAD_FINISH: this->saving = false; break;
 
			case SBI_SHOW_TICKER:     this->ticker_scroll = 0; break;
 
			case SBI_SHOW_REMINDER:   this->reminder_timeout = REMINDER_START; break;
src/subsidy_gui.cpp
Show inline comments
 
@@ -212,14 +212,20 @@ struct SubsidyListWindow : Window {
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, SLW_PANEL);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->vscroll->SetCount(this->CountLines());
 
	}
 
};
 

	
 
static const NWidgetPart _nested_subsidies_list_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
src/timetable_gui.cpp
Show inline comments
 
@@ -240,14 +240,20 @@ struct TimetableWindow : Window {
 

	
 
		sel += this->vscroll->GetPosition();
 

	
 
		return (sel < v->GetNumOrders() * 2 && sel >= 0) ? sel : INVALID_ORDER;
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		switch (data) {
 
			case -666:
 
				/* Autoreplace replaced the vehicle */
 
				this->vehicle = Vehicle::Get(this->window_number);
 
				/* This case is _not_ called asynchronously. Get out directly, rest can be done later */
 
				break;
src/toolbar_gui.cpp
Show inline comments
 
@@ -1479,14 +1479,20 @@ struct MainToolbarWindow : Window {
 
				this->RaiseWidget(i);
 
				this->SetWidgetDirty(i);
 
			}
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, TBN_ZOOMIN, TBN_ZOOMOUT);
 
	}
 

	
 
	static Hotkey<MainToolbarWindow> maintoolbar_hotkeys[];
 
};
 

	
 
@@ -1789,14 +1795,20 @@ struct ScenarioEditorToolbarWindow : Win
 
		if (this->IsWidgetLowered(TBSE_FASTFORWARD) != !!_fast_forward) {
 
			this->ToggleWidgetLoweredState(TBSE_FASTFORWARD);
 
			this->SetDirty();
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, TBSE_ZOOMIN, TBSE_ZOOMOUT);
 
	}
 

	
 
	virtual void OnQueryTextFinished(char *str)
 
	{
 
		/* Was 'cancel' pressed? */
src/town_gui.cpp
Show inline comments
 
@@ -520,14 +520,20 @@ public:
 
			nvp->UpdateViewportCoordinates(this);
 

	
 
			ScrollWindowToTile(this->town->xy, this, true); // Re-center viewport.
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* Called when setting station noise or required cargos have changed, in order to resize the window */
 
		this->SetDirty(); // refresh display for current size. This will allow to avoid glitches when downgrading
 
		this->ResizeWindowAsNeeded();
 
	}
 

	
 
	virtual void OnQueryTextFinished(char *str)
 
@@ -860,14 +866,20 @@ public:
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, TDW_CENTERTOWN);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* We can only set the trigger for resorting/rebuilding.
 
		 * We cannot safely resort at this point, as there might be multiple scheduled invalidations,
 
		 * and a rebuild needs to be done first though it is scheduled later. */
 
		if (data == 0) {
 
			this->towns.ForceRebuild();
 
		} else {
 
@@ -1162,14 +1174,20 @@ public:
 
	virtual void OnPlaceObjectAbort()
 
	{
 
		this->RaiseButtons();
 
		this->UpdateButtons(false);
 
	}
 

	
 
	virtual void OnInvalidateData(int)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->UpdateButtons(true);
 
	}
 
};
 

	
 
static const WindowDesc _found_town_desc(
 
	WDP_AUTO, 160, 162,
src/transparency_gui.cpp
Show inline comments
 
@@ -122,14 +122,20 @@ public:
 
	{
 
		Point pt = GetToolbarAlignedWindowPosition(sm_width);
 
		pt.y += 2 * (sm_height - this->GetWidget<NWidgetBase>(TTW_WIDGET_BUTTONS)->current_y);
 
		return pt;
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		for (uint i = TTW_WIDGET_BEGIN; i < TTW_WIDGET_END; i++) {
 
			this->SetWidgetLoweredState(i, IsTransparencySet((TransparencyOption)(i - TTW_WIDGET_BEGIN)));
 
		}
 
	}
 
};
 

	
src/tree_gui.cpp
Show inline comments
 
@@ -141,14 +141,20 @@ public:
 
		if (pt.x != -1 && select_proc == DDSP_PLANT_TREES) {
 
			DoCommandP(end_tile, this->tree_to_plant, start_tile,
 
				CMD_PLANT_TREE | CMD_MSG(STR_ERROR_CAN_T_PLANT_TREE_HERE));
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		this->base  = _tree_base_by_landscape[_settings_game.game_creation.landscape];
 
		this->count = _tree_count_by_landscape[_settings_game.game_creation.landscape];
 
	}
 

	
 
	virtual void OnTimeout()
 
	{
src/vehicle_gui.cpp
Show inline comments
 
@@ -680,14 +680,20 @@ struct RefitWindow : public Window {
 
					}
 
				}
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		switch (data) {
 
			case -666:
 
				/* Autoreplace replaced the vehicle.
 
				 * Nothing to do though for this window.
 
				 * This case is _not_ called asynchronously. Get out directly, rest can be done later */
 
				break;
 
@@ -1597,14 +1603,20 @@ public:
 
	virtual void OnResize()
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, VLW_WIDGET_LIST);
 
		this->GetWidget<NWidgetCore>(VLW_WIDGET_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (HasBit(data, 31) && this->vli.type == VL_SHARED_ORDERS) {
 
			this->vli.index = GB(data, 0, 20);
 
			this->window_number = this->vli.Pack();
 
			this->vehicles.ForceRebuild();
 
			return;
 
		}
 
@@ -1784,14 +1796,20 @@ struct VehicleDetailsWindow : Window {
 
		this->GetWidget<NWidgetCore>(VLD_WIDGET_RENAME_VEHICLE)->tool_tip = STR_VEHICLE_DETAILS_TRAIN_RENAME + v->type;
 

	
 
		this->owner = v->owner;
 
		this->tab = TDW_TAB_CARGO;
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (data == -666) {
 
			/* Autoreplace replaced the vehicle.
 
			 * Nothing to do for this window though.
 
			 * This case is _not_ called asynchronously. Get out directly, rest can be done later */
 
			return;
 
		}
 
@@ -2593,14 +2611,20 @@ public:
 
				this->SelectPlane(plane);
 
				this->SetWidgetDirty(VVW_WIDGET_SELECT_REFIT_TURN);
 
			}
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (data == -666) {
 
			/* Autoreplace replaced the vehicle.
 
			 * Nothing to do for this window though.
 
			 * This case is _not_ called asynchronously. Get out directly, rest can be done later */
 
			return;
 
		}
src/viewport_gui.cpp
Show inline comments
 
@@ -145,14 +145,20 @@ public:
 
	{
 
		if (_settings_client.gui.scrollwheel_scrolling == 0) {
 
			ZoomInOrOutToCursorWindow(wheel < 0, this);
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* Only handle zoom message if intended for us (msg ZOOM_IN/ZOOM_OUT) */
 
		HandleZoomMessage(this, this->viewport, EVW_ZOOMIN, EVW_ZOOMOUT);
 
	}
 
};
 

	
 
static const WindowDesc _extra_view_port_desc(
src/waypoint_gui.cpp
Show inline comments
 
@@ -111,14 +111,20 @@ public:
 
			case WAYPVW_SHOW_VEHICLES: // show list of vehicles having this waypoint in their orders
 
				ShowVehicleListWindow(this->owner, this->vt, this->wp->index);
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		/* You can only change your own waypoints */
 
		this->SetWidgetDisabledState(WAYPVW_RENAME, !this->wp->IsInUse() || (this->wp->owner != _local_company && this->wp->owner != OWNER_NONE));
 
		/* Disable the widget for waypoints with no use */
 
		this->SetWidgetDisabledState(WAYPVW_SHOW_VEHICLES, !this->wp->IsInUse());
 

	
 
		ScrollWindowToTile(this->GetCenterTile(), this, true);
src/window_gui.h
Show inline comments
 
@@ -648,15 +648,15 @@ public:
 
	 */
 
	virtual void OnQueryTextFinished(char *str) {}
 

	
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	virtual void OnInvalidateData(int data = 0) {}
 

	
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true) {}
 

	
 
	/**
 
	 * The user clicked some place on the map when a tile highlight mode
 
	 * has been set.
 
	 * @param pt   the exact point on the map that has been clicked.
 
	 * @param tile the tile on the map that has been clicked.
0 comments (0 inline, 0 general)