Changeset - r17476:d3b7a183536d
src/ai/ai_gui.cpp
Show inline comments
 
@@ -173,26 +173,32 @@ struct AIListWindow : public Window {
 
				delete this;
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		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);
 

	
 
		/* selected goes from -1 .. length of ai list - 1. */
 
		this->selected = min(this->selected, this->vscroll->GetCount() - 2);
 
	}
 
};
 

	
 
@@ -428,26 +434,32 @@ struct AISettingsWindow : public Window 
 
		this->vscroll->SetCapacity(nwi->current_y / this->line_height);
 
		nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 

	
 
	virtual void OnTick()
 
	{
 
		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[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_MAUVE),
 
		NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_AI_SETTINGS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_MATRIX, COLOUR_MAUVE, AIS_WIDGET_BACKGROUND), SetMinimalSize(188, 182), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x501, STR_NULL), SetScrollbar(AIS_WIDGET_SCROLLBAR),
 
@@ -683,26 +695,32 @@ struct AIConfigWindow : public Window {
 
			case AIC_WIDGET_CONTENT_DOWNLOAD:
 
				if (!_network_available) {
 
					ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
 
				} else {
 
#if defined(ENABLE_NETWORK)
 
					ShowNetworkContentListWindow(NULL, CONTENT_TYPE_AI);
 
#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);
 
		this->SetWidgetDisabledState(AIC_WIDGET_CHANGE, this->selected_slot == INVALID_COMPANY);
 
		this->SetWidgetDisabledState(AIC_WIDGET_CONFIGURE, this->selected_slot == INVALID_COMPANY);
 
		this->SetWidgetDisabledState(AIC_WIDGET_MOVE_UP, this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot - 1)));
 
		this->SetWidgetDisabledState(AIC_WIDGET_MOVE_DOWN, this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot + 1)));
 
	}
 
};
 
@@ -1023,26 +1041,32 @@ struct AIDebugWindow : public QueryStrin
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		EventState state = ES_NOT_HANDLED;
 
		if (this->HandleEditBoxKey(AID_WIDGET_BREAK_STR_EDIT_BOX, key, keycode, state) != HEBR_NOT_FOCUSED) {
 
			/* 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 )*/
 
			if ((_pause_mode & PM_PAUSED_NORMAL) == PM_UNPAUSED && this->highlight_row != -1) {
 
				this->DisableWidget(AID_WIDGET_CONTINUE_BTN);
 
				this->SetWidgetDirty(AID_WIDGET_CONTINUE_BTN);
 
				this->SetWidgetDirty(AID_WIDGET_LOG_PANEL);
 
				this->highlight_row = -1;
 
			}
src/autoreplace_gui.cpp
Show inline comments
 
@@ -482,26 +482,32 @@ public:
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll[0]->SetCapacityFromWidget(this, RVW_WIDGET_LEFT_MATRIX);
 
		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();
 
		}
 
	}
 
};
 

	
 
static const NWidgetPart _nested_replace_rail_vehicle_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, RVW_WIDGET_CAPTION), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -1209,26 +1209,32 @@ struct BuildVehicleWindow : Window {
 
			case BUILD_VEHICLE_WIDGET_RENAME: {
 
				EngineID sel_eng = this->sel_engine;
 
				if (sel_eng != INVALID_ENGINE) {
 
					this->rename_engine = sel_eng;
 
					SetDParam(0, sel_eng);
 
					ShowQueryString(STR_ENGINE_NAME, STR_QUERY_RENAME_TRAIN_TYPE_CAPTION + this->vehicle_type, MAX_LENGTH_ENGINE_NAME_CHARS, MAX_LENGTH_ENGINE_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS);
 
				}
 
				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;
 
		}
 
		this->eng_list.ForceRebuild();
 
	}
 

	
 
	virtual void SetStringParameters(int widget) const
 
	{
src/company_gui.cpp
Show inline comments
 
@@ -791,26 +791,32 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnDropdownSelect(int widget, int index)
 
	{
 
		for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
 
			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)) {
 
					if (_livery_class[scheme] == this->livery_class) current_class_valid = true;
 
					this->EnableWidget(SCLW_WIDGET_CLASS_GENERAL + _livery_class[scheme]);
 
				} else {
 
					ClrBit(this->sel, scheme);
 
				}
 
			}
src/depot_gui.cpp
Show inline comments
 
@@ -626,26 +626,32 @@ struct DepotWindow : Window {
 
				} else {
 
					resize->width = base_width + _base_block_sizes[this->type].width;
 
					size->width = resize->width * (this->type == VEH_ROAD ? 5 : 3);
 
					size->height = resize->height * (this->type == VEH_ROAD ? 5 : 3);
 
				}
 
				fill->width = resize->width;
 
				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) {
 
			/* Generate the vehicle list
 
			 * It's ok to use the wagon pointers for non-trains as they will be ignored */
 
			BuildDepotVehicleList(this->type, this->window_number, &this->vehicle_list, &this->wagon_list);
 
			this->generate_list = false;
 
			DepotSortList(&this->vehicle_list);
 
		}
src/dock_gui.cpp
Show inline comments
 
@@ -110,26 +110,32 @@ struct BuildDocksToolbarWindow : Window 
 
	{
 
		this->last_clicked_widget = DTW_END;
 
		this->InitNested(desc, window_number);
 
		this->OnInvalidateData();
 
		if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 
	}
 

	
 
	~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);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		this->last_clicked_widget = (DockToolbarWidgets)widget;
 
		switch (widget) {
 
			case DTW_CANAL: // Build canal button
src/fios_gui.cpp
Show inline comments
 
@@ -650,26 +650,32 @@ public:
 
			FiosMakeSavegameName(_file_to_saveload.name, this->text.buf, sizeof(_file_to_saveload.name));
 

	
 
			/* In the editor set up the vehicle engines correctly (date might have changed) */
 
			if (_game_mode == GM_EDITOR) StartupEngines();
 
		}
 
	}
 

	
 
	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();
 
				/* FALL THROUGH */
 
			case 1:
 
				/* Selection changes */
 
				if (_saveload_mode == SLD_LOAD_GAME || _saveload_mode == SLD_LOAD_SCENARIO) {
 
					this->SetWidgetDisabledState(SLWW_LOAD_BUTTON,
 
							this->selected == NULL || _load_check_data.HasErrors() || !(_load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs()));
src/genworld_gui.cpp
Show inline comments
 
@@ -416,26 +416,32 @@ struct GenerateLandscapeWindow : public 
 
			case GLAND_HEIGHTMAP_SIZE_TEXT:
 
				if (_settings_newgame.game_creation.heightmap_rotation == HM_CLOCKWISE) {
 
					SetDParam(0, this->y);
 
					SetDParam(1, this->x);
 
				} else {
 
					SetDParam(0, this->x);
 
					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);
 

	
 
		/* You can't select smoothness / non-water borders if not terragenesis */
 
		if (mode == GLWM_GENERATE) {
 
			this->SetWidgetDisabledState(GLAND_SMOOTHNESS_PULLDOWN, _settings_newgame.game_creation.land_generator == 0);
 
			this->SetWidgetDisabledState(GLAND_VARIETY_PULLDOWN, _settings_newgame.game_creation.land_generator == 0);
 
			this->SetWidgetDisabledState(GLAND_BORDERS_RANDOM, _settings_newgame.game_creation.land_generator == 0 || !_settings_newgame.construction.freeform_edges);
 
			this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == 0 || !_settings_newgame.construction.freeform_edges || _settings_newgame.game_creation.water_borders == BORDERS_RANDOM,
src/graph_gui.cpp
Show inline comments
 
@@ -82,26 +82,32 @@ struct GraphLegendWindow : Window {
 
		if (!IsInsideMM(widget, GLW_FIRST_COMPANY, MAX_COMPANIES + GLW_FIRST_COMPANY)) return;
 

	
 
		ToggleBit(_legend_excluded_companies, widget - GLW_FIRST_COMPANY);
 
		this->ToggleWidgetLoweredState(widget);
 
		this->SetDirty();
 
		InvalidateWindowData(WC_INCOME_GRAPH, 0);
 
		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);
 
	}
 
};
 

	
 
/**
 
 * Construct a vertical list of buttons, one for each company.
 
 * @param biggest_index Storage for collecting the biggest index used in the returned tree.
 
 * @return Panel with company buttons.
 
 * @post \c *biggest_index contains the largest used index in the tree.
 
@@ -534,26 +540,32 @@ public:
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		/* Clicked on legend? */
 
		if (widget == BGW_KEY_BUTTON) ShowGraphLegend();
 
	}
 

	
 
	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.
 
	 */
 
	void UpdateStatistics(bool initialize)
 
	{
 
		uint excluded_companies = _legend_excluded_companies;
 

	
 
		/* Exclude the companies which aren't valid */
 
@@ -1004,26 +1016,32 @@ struct PaymentRatesGraphWindow : BaseGra
 
					this->UpdateExcludedData();
 
					this->SetDirty();
 
				}
 
				break;
 
		}
 
	}
 

	
 
	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();
 

	
 
		int i = 0;
 
		const CargoSpec *cs;
 
		FOR_ALL_SORTED_STANDARD_CARGOSPECS(cs) {
 
			this->colours[i] = cs->legend_colour;
 
			for (uint j = 0; j != 20; j++) {
 
@@ -1238,26 +1256,32 @@ public:
 

	
 
		size->width = WD_FRAMERECT_LEFT + this->ordinal_width + WD_FRAMERECT_RIGHT + 16 + WD_FRAMERECT_LEFT + this->text_width + WD_FRAMERECT_RIGHT;
 
	}
 

	
 

	
 
	virtual void OnTick()
 
	{
 
		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();
 
		}
 
	}
 
};
 

	
 
static const NWidgetPart _nested_company_league_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_COMPANY_LEAGUE_TABLE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
@@ -1479,29 +1503,31 @@ struct PerformanceRatingDetailWindow : W
 
	virtual void OnTick()
 
	{
 
		if (_pause_mode != PM_UNPAUSED) return;
 

	
 
		/* Update the company score every 5 days */
 
		if (--this->timeout == 0) {
 
			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. */
 
		if (this->company != INVALID_COMPANY && !Company::IsValidID(this->company)) {
 
			/* Raise the widget for the previous selection. */
 
			this->RaiseWidget(this->company + PRW_COMPANY_FIRST);
 
			this->company = INVALID_COMPANY;
 
		}
 

	
src/group_gui.cpp
Show inline comments
 
@@ -244,26 +244,32 @@ public:
 
				break;
 

	
 
			case GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN: {
 
				Dimension d = this->GetActionDropdownSize(true, true);
 
				d.height += padding.height;
 
				d.width  += padding.width;
 
				*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();
 
		} else {
 
			this->vehicles.ForceResort();
 
			this->groups.ForceResort();
 
		}
 

	
 
		if (this->group_rename != INVALID_GROUP && !Group::IsValidID(this->group_rename)) {
src/industry_gui.cpp
Show inline comments
 
@@ -588,26 +588,32 @@ public:
 
	}
 

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

	
 
	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();
 
	}
 
};
 

	
 
void ShowBuildIndustryWindow()
 
{
 
	if (_game_mode != GM_EDITOR && !Company::IsValidID(_local_company)) return;
 
	if (BringWindowToFrontById(WC_BUILD_INDUSTRY, 0)) return;
 
@@ -938,26 +944,32 @@ public:
 
			case IL_MULTIPLIER:
 
				i->prod_level = ClampU(RoundDivSU(value * PRODLEVEL_DEFAULT, 100), PRODLEVEL_MINIMUM, PRODLEVEL_MAXIMUM);
 
				break;
 

	
 
			default:
 
				i->production_rate[this->editbox_line - IL_RATE1] = ClampU(RoundDivSU(value, 8), 0, 255);
 
				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;
 
		}
 
	}
 

	
 
	virtual bool IsNewGRFInspectable() const
 
	{
 
		return ::IsNewGRFInspectable(GSF_INDUSTRIES, this->window_number);
 
@@ -1337,26 +1349,32 @@ public:
 
	virtual void OnPaint()
 
	{
 
		if (this->industries.NeedRebuild()) this->BuildSortIndustriesList();
 
		this->DrawWidgets();
 
	}
 

	
 
	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 {
 
			this->industries.ForceResort();
 
		}
 
	}
 
};
 

	
 
Listing IndustryDirectoryWindow::last_sorting = {false, 0};
 
@@ -2385,31 +2403,33 @@ struct IndustryCargoesWindow : public Wi
 
			this->PlaceIndustry(1 + cust_count * num_indrows / num_cust, 2, NUM_INDUSTRYTYPES);
 
			cust_count++;
 
		}
 

	
 
		this->ShortenCargoColumn(1, 1, num_indrows);
 
		const NWidgetBase *nwp = this->GetWidget<NWidgetBase>(ICW_PANEL);
 
		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;
 
		}
 

	
 
		assert(data >= 0 && data < NUM_INDUSTRYTYPES);
 
		this->ComputeIndustryDisplay(data);
 
	}
 

	
src/intro_gui.cpp
Show inline comments
 
@@ -46,26 +46,32 @@ enum SelectGameIntroWidgets {
 
	SGI_AI_SETTINGS,
 
	SGI_EXIT,
 
};
 

	
 
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);
 
	}
 

	
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		if (widget == SGI_DIFFICULTIES) SetDParam(0, STR_DIFFICULTY_LEVEL_EASY + _settings_newgame.difficulty.diff_level);
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
src/main_gui.cpp
Show inline comments
 
@@ -423,26 +423,32 @@ struct MainWindow : Window
 
			ZoomInOrOutToCursorWindow(wheel < 0, this);
 
		}
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		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[];
 
};
 

	
 
const uint16 _ghk_quit_keys[] = {'Q' | WKC_CTRL, 'Q' | WKC_META, 0};
 
const uint16 _ghk_abandon_keys[] = {'W' | WKC_CTRL, 'W' | WKC_META, 0};
 
const uint16 _ghk_chat_keys[] = {WKC_RETURN, 'T', 0};
 
const uint16 _ghk_chat_all_keys[] = {WKC_SHIFT | WKC_RETURN, WKC_SHIFT | 'T', 0};
 
const uint16 _ghk_chat_company_keys[] = {WKC_CTRL | WKC_RETURN, WKC_CTRL | 'T', 0};
src/misc_gui.cpp
Show inline comments
 
@@ -323,26 +323,32 @@ public:
 
	}
 

	
 
	virtual bool IsNewGRFInspectable() const
 
	{
 
		return ::IsNewGRFInspectable(GetGrfSpecFeature(this->tile), this->tile);
 
	}
 

	
 
	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;
 
		}
 
	}
 
};
 

	
 
/**
 
 * Show land information window.
 
 * @param tile The tile to show information about.
 
@@ -630,26 +636,32 @@ public:
 
			pt.x = (pt.x < (_screen.width >> 1)) ? _screen.width - sm_width - 20 : 20; // Stay 20 pixels away from the edge of the screen.
 

	
 
			/* move y pos to opposite corner */
 
			pt.y = UnScaleByZoom(pt.y - vp->virtual_top, vp->zoom) + vp->top;
 
			pt.y = (pt.y < (_screen.height >> 1)) ? scr_bot - sm_height : scr_top;
 
		} else {
 
			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
 
	{
 
		if (widget == EMW_CAPTION) CopyInDParam(0, this->decode_params, lengthof(this->decode_params));
 
	}
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
src/music_gui.cpp
Show inline comments
 
@@ -304,26 +304,32 @@ struct MusicTrackSelectionWindow : publi
 
		this->LowerWidget(MTSW_ALL + _settings_client.music.playlist);
 
	}
 

	
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		switch (widget) {
 
			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();
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		switch (widget) {
 
			case MTSW_PLAYLIST: {
 
				Dimension d = {0, 0};
 
@@ -629,26 +635,32 @@ struct MusicWindow : public Window {
 
				int x = (volume * (r.right - r.left) / 127);
 
				if (_current_text_dir == TD_RTL) {
 
					x = r.right - x;
 
				} else {
 
					x += r.left;
 
				}
 
				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();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case MW_PREV: // skip to prev
 
				if (!_song_is_active) return;
 
				SkipToPrevSong();
src/network/network_chat_gui.cpp
Show inline comments
 
@@ -522,26 +522,32 @@ struct NetworkChatWindow : public QueryS
 
				case HEBR_CANCEL: delete this; break;
 
				case HEBR_NOT_FOCUSED: break;
 
			}
 
		}
 
		return state;
 
	}
 

	
 
	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),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY, NWCW_CLOSE),
 
		NWidget(WWT_PANEL, COLOUR_GREY, NWCW_BACKGROUND),
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(WWT_TEXT, COLOUR_GREY, NWCW_DESTINATION), SetMinimalSize(62, 12), SetPadding(1, 0, 1, 0), SetDataTip(STR_NULL, STR_NULL),
 
				NWidget(WWT_EDITBOX, COLOUR_GREY, NWCW_TEXTBOX), SetMinimalSize(100, 12), SetPadding(1, 0, 1, 0), SetResize(1, 0),
 
																	SetDataTip(STR_NETWORK_CHAT_OSKTITLE, STR_NULL),
src/network/network_content_gui.cpp
Show inline comments
 
@@ -742,26 +742,32 @@ public:
 

	
 
	virtual void OnConnect(bool success)
 
	{
 
		if (!success) {
 
			ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_CONNECT, INVALID_STRING_ID, WL_ERROR);
 
			delete this;
 
			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;
 
		for (ConstContentIterator iter = this->content.Begin(); iter != this->content.End(); iter++) {
 
			const ContentInfo *ci = *iter;
 
			switch (ci->state) {
 
				case ContentInfo::SELECTED:
 
				case ContentInfo::AUTOSELECTED:
 
					this->filesize_sum += ci->filesize;
src/network/network_gui.cpp
Show inline comments
 
@@ -785,26 +785,32 @@ public:
 
			default:
 
				NOT_REACHED();
 
		}
 

	
 
		this->SetDirty();
 
	}
 

	
 
	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();
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		EventState state = ES_NOT_HANDLED;
 

	
src/newgrf_debug_gui.cpp
Show inline comments
 
@@ -763,26 +763,32 @@ struct SpriteAlignerWindow : Window {
 
	virtual void OnQueryTextFinished(char *str)
 
	{
 
		if (StrEmpty(str)) return;
 

	
 
		this->current_sprite = atoi(str);
 
		if (this->current_sprite >= GetMaxSpriteID()) this->current_sprite = 0;
 
		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());
 
		}
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, SAW_LIST);
 
		this->GetWidget<NWidgetCore>(SAW_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
src/newgrf_gui.cpp
Show inline comments
 
@@ -370,26 +370,32 @@ struct NewGRFParametersWindow : public W
 
		uint32 val = Clamp<uint32>(value, par_info->min_value, par_info->max_value);
 
		par_info->SetValue(this->grf_config, val);
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		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);
 
		if (this->clicked_row != UINT_MAX && this->clicked_row >= this->vscroll->GetCount()) {
 
			this->clicked_row = UINT_MAX;
 
			DeleteChildWindows(WC_QUERY_STRING);
 
		}
 
	}
 

	
 
@@ -1016,33 +1022,36 @@ struct NewGRFWindow : public QueryString
 
		/* Switch to this preset */
 
		for (uint i = 0; i < _grf_preset_list.Length(); i++) {
 
			if (_grf_preset_list[i] != NULL && strcmp(_grf_preset_list[i], str) == 0) {
 
				this->preset = i;
 
				break;
 
			}
 
		}
 

	
 
		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;
 

	
 
			case 1:
 
				/* Search the list for items that are now found and mark them as such. */
 
				for (GRFConfig **l = &this->actives; *l != NULL; l = &(*l)->next) {
 
					GRFConfig *c = *l;
 
					bool compatible = HasBit(c->flags, GCF_COMPATIBLE);
 
					if (c->status != GCS_NOT_FOUND && !compatible) continue;
src/news_gui.cpp
Show inline comments
 
@@ -489,26 +489,32 @@ struct NewsWindow : Window {
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		if (keycode == WKC_SPACE) {
 
			/* Don't continue. */
 
			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);
 
	}
 

	
 
	virtual void OnTick()
 
	{
 
		/* Scroll up newsmessages from the bottom in steps of 4 pixels */
 
		int newtop = max(this->top - 4, _screen.height - this->height - this->status_height - this->chat_height);
 
		this->SetWindowTop(newtop);
 
	}
 
@@ -1026,26 +1032,32 @@ struct MessageHistoryWindow : Window {
 
		for (int n = this->vscroll->GetCapacity(); n > 0; n--) {
 
			SetDParam(0, ni->date);
 
			DrawString(date_left, date_right, y, STR_SHORT_DATE);
 

	
 
			DrawNewsString(news_left, news_right, y, TC_WHITE, ni);
 
			y += this->line_height;
 

	
 
			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) {
 
			NewsItem *ni = _latest_news;
 
			if (ni == NULL) return;
 

	
 
			for (int n = this->vscroll->GetScrolledRowFromWidget(pt.y, this, MHW_BACKGROUND, WD_FRAMERECT_TOP, this->line_height); n > 0; n--) {
 
				ni = ni->prev;
 
				if (ni == NULL) return;
 
@@ -1192,26 +1204,32 @@ struct MessageOptionsWindow : Window {
 
			/* Height is the biggest widget height in a row. */
 
			size->height = FONT_HEIGHT_NORMAL + max(WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM, WD_DROPDOWNTEXT_TOP + WD_DROPDOWNTEXT_BOTTOM);
 

	
 
			if (widget == WIDGET_NEWSOPT_DROP_SUMMARY) {
 
				size->width = this->dim_message_opt.width + padding.width + MOS_BUTTON_SPACE; // A bit extra for better looks.
 
			} else if (widget == WIDGET_NEWSOPT_SOUNDTICKER) {
 
				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);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case WIDGET_NEWSOPT_DROP_SUMMARY: // Dropdown menu for all settings
 
				ShowDropDownMenu(this, this->message_opt, this->state, WIDGET_NEWSOPT_DROP_SUMMARY, 0, 0);
src/order_gui.cpp
Show inline comments
 
@@ -796,26 +796,32 @@ public:
 
				Dimension d = {0, 0};
 
				for (int i = 0; _order_conditional_condition[i] != INVALID_STRING_ID; i++) {
 
					d = maxdim(d, GetStringBoundingBox(_order_conditional_condition[i]));
 
				}
 
				d.width += padding.width;
 
				d.height += padding.height;
 
				*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 */
 
				this->vehicle = Vehicle::Get(this->window_number);
 
				/* This case is _not_ called asynchronously. Get out directly, rest can be done later */
 
				break;
 

	
 
			case -1:
 
				/* Removed / replaced all orders (after deleting / sharing) */
src/osk_gui.cpp
Show inline comments
 
@@ -238,26 +238,32 @@ struct OskWindow : public Window {
 

	
 
		this->SetWidgetDirty(OSK_WIDGET_TEXT);
 
		if (this->parent != NULL) this->parent->SetWidgetDirty(this->text_btn);
 
	}
 

	
 
	virtual void OnMouseLoop()
 
	{
 
		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.
 

	
 
/**
 
 * Add a key widget to a row of the keyboard.
 
 * @param hor     Row container to add key widget to.
 
 * @param height  Height of the key (all keys in a row should have equal height).
 
 * @param num_half Number of 1/2 key widths that this key has.
src/rail_gui.cpp
Show inline comments
 
@@ -1608,26 +1608,32 @@ public:
 
				if (_settings_client.gui.drag_signals_density < 20) {
 
					_settings_client.gui.drag_signals_density++;
 
					SetWindowDirty(WC_GAME_OPTIONS, 0);
 
				}
 
				break;
 

	
 
			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);
 
	}
 
};
 

	
 
/** Nested widget definition of the build signal window */
 
static const NWidgetPart _nested_signal_builder_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
src/road_gui.cpp
Show inline comments
 
@@ -332,26 +332,32 @@ struct BuildRoadToolbarWindow : Window {
 

	
 
		this->OnInvalidateData();
 
		this->last_started_action = WIDGET_LIST_END;
 

	
 
		if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 
	}
 

	
 
	~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);
 
	}
 

	
 
	/**
 
	 * Update the remove button lowered state of the road toolbar
 
	 *
 
	 * @param clicked_widget The widget which the client clicked just now
 
	 */
src/settings_gui.cpp
Show inline comments
 
@@ -451,26 +451,32 @@ struct GameOptionsWindow : Window {
 
				break;
 

	
 
			case GOW_BASE_SFX_DROPDOWN:
 
				this->SetMediaSet<BaseSounds>(index);
 
				break;
 

	
 
			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;
 
		this->GetWidget<NWidgetCore>(GOW_BASE_MUSIC_STATUS)->SetDataTip(missing_files ? STR_EMPTY : STR_GAME_OPTIONS_BASE_MUSIC_STATUS, STR_NULL);
 
	}
 
};
 

	
 
static const NWidgetPart _nested_game_options_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
@@ -715,26 +721,32 @@ public:
 
				 * This way when you load a game, the max loan and interest rate
 
				 * are loaded correctly. */
 
				if (_game_mode == GM_EDITOR) StartupEconomy();
 
				break;
 
			}
 

	
 
			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;
 
			int32 value = (int32)ReadValue(GetVariableAddress(&this->opt_mod_temp, &sd->save), sd->save.conv);
 
			bool disable = (sd->desc.flags & SGF_NEWGAME_ONLY) &&
 
					(_game_mode == GM_NORMAL ||
 
					(_game_mode == GM_EDITOR && (sd->desc.flags & SGF_SCENEDIT_TOO) == 0));
 

	
 
			this->SetWidgetDisabledState(GDW_OPTIONS_START + i * 3 + 0, disable || sdb->min == value);
src/signs_gui.cpp
Show inline comments
 
@@ -358,26 +358,32 @@ struct SignListWindow : QueryStringBaseW
 
			this->vscroll->SetCount(this->signs.Length());
 
			this->SetWidgetDirty(SLW_CAPTION);
 
		}
 
		this->SortSignsList();
 
	}
 

	
 
	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,
 
		 * and a rebuild needs to be done first though it is scheduled later. */
 
		if (data == 0 || !StrEmpty(this->filter_string)) { // New or deleted sign, or there is a filter string
 
			this->signs.ForceRebuild();
 
		} else { // Change of sign contents while there is no filter string
 
			this->signs.ForceResort();
 
		}
src/smallmap_gui.cpp
Show inline comments
 
@@ -1414,30 +1414,33 @@ public:
 
				this->SetDirty();
 
				break;
 

	
 
			case SM_WIDGET_SHOW_HEIGHT: // Enable/disable showing of heightmap.
 
				_smallmap_show_heightmap = !_smallmap_show_heightmap;
 
				this->SetWidgetLoweredState(SM_WIDGET_SHOW_HEIGHT, _smallmap_show_heightmap);
 
				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;
 

	
 
			case 0: {
 
				extern uint64 _displayed_industries;
 
				if (this->map_type != SMT_INDUSTRY) this->SwitchMapType(SMT_INDUSTRY);
 

	
 
				for (int i = 0; i != _smallmap_industry_count; i++) {
 
					_legend_from_industries[i].show_on_map = HasBit(_displayed_industries, _legend_from_industries[i].type);
src/station_gui.cpp
Show inline comments
 
@@ -678,26 +678,32 @@ public:
 

	
 
	virtual void OnTimeout()
 
	{
 
		this->RaiseWidget(SLW_SORTBY);
 
		this->SetDirty();
 
	}
 

	
 
	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 {
 
			this->stations.ForceResort();
 
		}
 
	}
 
};
 

	
 
Listing CompanyStationsWindow::last_sorting = {false, 0};
 
@@ -1442,26 +1448,32 @@ struct SelectStationWindow : Window {
 
	{
 
		if (_thd.dirty & 2) {
 
			_thd.dirty &= ~2;
 
			this->SetDirty();
 
		}
 
	}
 

	
 
	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();
 
	}
 
};
 

	
 
static const WindowDesc _select_station_desc(
 
	WDP_AUTO, 200, 180,
 
	WC_SELECT_STATION, WC_NONE,
 
	WDF_CONSTRUCTION,
 
	_nested_select_station_widgets, lengthof(_nested_select_station_widgets)
 
);
src/statusbar_gui.cpp
Show inline comments
 
@@ -174,26 +174,32 @@ struct StatusBarWindow : Window {
 
						DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_STATUSBAR_COMPANY_NAME, TC_FROMSTRING, SA_HOR_CENTER);
 
					}
 
				}
 

	
 
				if (this->reminder_timeout > 0) {
 
					Dimension icon_size = GetSpriteSize(SPR_UNREAD_NEWS);
 
					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;
 
			case SBI_NEWS_DELETED:
 
				this->ticker_scroll    =   TICKER_STOP; // reset ticker ...
 
				this->reminder_timeout = REMINDER_STOP; // ... and reminder
 
				break;
 
		}
 
	}
src/subsidy_gui.cpp
Show inline comments
 
@@ -206,26 +206,32 @@ struct SubsidyListWindow : Window {
 

	
 
		if (num == 0) {
 
			if (IsInsideMM(pos, 0, cap)) DrawString(x, right, y + pos * FONT_HEIGHT_NORMAL, STR_SUBSIDIES_NONE);
 
			pos++;
 
		}
 
	}
 

	
 
	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),
 
		NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
 
		NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_SUBSIDIES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_SHADEBOX, COLOUR_BROWN),
 
		NWidget(WWT_STICKYBOX, COLOUR_BROWN),
 
	EndContainer(),
 
	NWidget(NWID_HORIZONTAL),
src/timetable_gui.cpp
Show inline comments
 
@@ -234,26 +234,32 @@ struct TimetableWindow : Window {
 

	
 
	int GetOrderFromTimetableWndPt(int y, const Vehicle *v)
 
	{
 
		int sel = (y - this->GetWidget<NWidgetBase>(TTV_TIMETABLE_PANEL)->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL;
 

	
 
		if ((uint)sel >= this->vscroll->GetCapacity()) return INVALID_ORDER;
 

	
 
		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;
 

	
 
			case -1:
 
				/* Removed / replaced all orders (after deleting / sharing) */
 
				if (this->sel_index == -1) break;
 

	
 
				this->DeleteChildWindows();
src/toolbar_gui.cpp
Show inline comments
 
@@ -1473,26 +1473,32 @@ struct MainToolbarWindow : Window {
 
	virtual void OnTimeout()
 
	{
 
		/* We do not want to automatically raise the pause, fast forward and
 
		 * switchbar buttons; they have to stay down when pressed etc. */
 
		for (uint i = TBN_SETTINGS; i < TBN_SWITCHBAR; i++) {
 
			if (this->IsWidgetLowered(i)) {
 
				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[];
 
};
 

	
 
const uint16 _maintoolbar_pause_keys[] = {WKC_F1, WKC_PAUSE, 0};
 
const uint16 _maintoolbar_zoomin_keys[] = {WKC_NUM_PLUS, WKC_EQUALS, WKC_SHIFT | WKC_EQUALS, WKC_SHIFT | WKC_F5, 0};
 
const uint16 _maintoolbar_zoomout_keys[] = {WKC_NUM_MINUS, WKC_MINUS, WKC_SHIFT | WKC_MINUS, WKC_SHIFT | WKC_F6, 0};
 
const uint16 _maintoolbar_smallmap_keys[] = {WKC_F4, 'M', 0};
 

	
 
Hotkey<MainToolbarWindow> MainToolbarWindow::maintoolbar_hotkeys[] = {
 
@@ -1783,26 +1789,32 @@ struct ScenarioEditorToolbarWindow : Win
 
	{
 
		if (this->IsWidgetLowered(TBSE_PAUSE) != !!_pause_mode) {
 
			this->ToggleWidgetLoweredState(TBSE_PAUSE);
 
			this->SetDirty();
 
		}
 

	
 
		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? */
 
		if (str == NULL) return;
 

	
 
		int32 value;
 
		if (!StrEmpty(str)) {
 
			value = atoi(str);
 
		} else {
src/town_gui.cpp
Show inline comments
 
@@ -514,26 +514,32 @@ public:
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		if (this->viewport != NULL) {
 
			NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(TVW_VIEWPORT);
 
			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)
 
	{
 
		if (str == NULL) return;
 

	
 
		DoCommandP(0, this->window_number, 0, CMD_RENAME_TOWN | CMD_MSG(STR_ERROR_CAN_T_RENAME_TOWN), NULL, str);
 
	}
 
};
 
@@ -854,26 +860,32 @@ public:
 

	
 
	virtual void OnHundredthTick()
 
	{
 
		this->BuildSortTownList();
 
		this->SetDirty();
 
	}
 

	
 
	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 {
 
			this->towns.ForceResort();
 
		}
 
	}
 
};
 

	
 
Listing TownDirectoryWindow::last_sorting = {false, 0};
 
@@ -1156,26 +1168,32 @@ public:
 

	
 
	virtual void OnPlaceObject(Point pt, TileIndex tile)
 
	{
 
		this->ExecuteFoundTownCommand(tile, false, STR_ERROR_CAN_T_FOUND_TOWN_HERE, CcFoundTown);
 
	}
 

	
 
	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,
 
	WC_FOUND_TOWN, WC_NONE,
 
	WDF_CONSTRUCTION,
 
	_nested_found_town_widgets, lengthof(_nested_found_town_widgets)
 
);
 

	
 
void ShowFoundTownWindow()
src/transparency_gui.cpp
Show inline comments
 
@@ -116,26 +116,32 @@ public:
 
				this->SetWidgetDirty(TTW_WIDGET_BUTTONS);
 
			}
 
		}
 
	}
 

	
 
	virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
 
	{
 
		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)));
 
		}
 
	}
 
};
 

	
 
static const NWidgetPart _nested_transparency_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
 
		NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_TRANSPARENCY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
 
	EndContainer(),
src/tree_gui.cpp
Show inline comments
 
@@ -135,26 +135,32 @@ public:
 
	{
 
		VpSelectTilesWithMethod(pt.x, pt.y, select_method);
 
	}
 

	
 
	virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
 
	{
 
		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()
 
	{
 
		this->RaiseWidget(BTW_MANY_RANDOM);
 
		this->SetWidgetDirty(BTW_MANY_RANDOM);
 
	}
 

	
 
	virtual void OnPlaceObjectAbort()
 
	{
src/vehicle_gui.cpp
Show inline comments
 
@@ -674,26 +674,32 @@ struct RefitWindow : public Window {
 
			case VRW_INFOPANEL:
 
				if (this->cargo != NULL) {
 
					StringID string = this->GetCapacityString(this->cargo);
 
					if (string != INVALID_STRING_ID) {
 
						DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT,
 
								r.top + WD_FRAMERECT_TOP, r.bottom - WD_FRAMERECT_BOTTOM, string);
 
					}
 
				}
 
				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;
 

	
 
			case 0: { // The consist has changed; rebuild the entire list.
 
				/* Clear the selection. */
 
				Vehicle *v = Vehicle::Get(this->window_number);
 
				this->selected_vehicle = v->index;
 
				this->num_vehicles = UINT8_MAX;
 
@@ -1591,26 +1597,32 @@ public:
 

	
 
			DEBUG(misc, 3, "Periodic resort %d list company %d at station %d", this->vli.vtype, this->owner, station);
 
			this->SetDirty();
 
		}
 
	}
 

	
 
	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;
 
		}
 

	
 
		/* 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();
 
@@ -1778,26 +1790,32 @@ struct VehicleDetailsWindow : Window {
 
		const Vehicle *v = Vehicle::Get(window_number);
 

	
 
		this->CreateNestedTree(desc);
 
		this->vscroll = (v->type == VEH_TRAIN ? this->GetScrollbar(VLD_WIDGET_SCROLLBAR) : NULL);
 
		this->FinishInitNested(desc, window_number);
 

	
 
		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;
 
		}
 
		const Vehicle *v = Vehicle::Get(this->window_number);
 
		if (v->type == VEH_ROAD) {
 
			const NWidgetBase *nwid_info = this->GetWidget<NWidgetBase>(VLD_WIDGET_MIDDLE_DETAILS);
 
			uint aimed_height = this->GetRoadVehDetailsHeight(v);
 
			/* If the number of articulated parts changes, the size of the window must change too. */
 
			if (aimed_height != nwid_info->current_y) {
 
@@ -2587,26 +2605,32 @@ public:
 
		}
 
		/* The same system applies to widget VVW_WIDGET_REFIT_VEH and VVW_WIDGET_TURN_AROUND.*/
 
		if (v->IsGroundVehicle()) {
 
			PlaneSelections plane = veh_stopped ? SEL_RT_REFIT : SEL_RT_TURN_AROUND;
 
			NWidgetStacked *nwi = this->GetWidget<NWidgetStacked>(VVW_WIDGET_SELECT_REFIT_TURN);
 
			if (nwi->shown_plane + SEL_RT_BASEPLANE != plane) {
 
				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;
 
		}
 
	}
 

	
 
	virtual bool IsNewGRFInspectable() const
 
	{
 
		return ::IsNewGRFInspectable(GetGrfSpecFeature(Vehicle::Get(this->window_number)->type), this->window_number);
 
	}
src/viewport_gui.cpp
Show inline comments
 
@@ -139,26 +139,32 @@ public:
 
		this->viewport->scrollpos_y += ScaleByZoom(delta.y, this->viewport->zoom);
 
		this->viewport->dest_scrollpos_x = this->viewport->scrollpos_x;
 
		this->viewport->dest_scrollpos_y = this->viewport->scrollpos_y;
 
	}
 

	
 
	virtual void OnMouseWheel(int wheel)
 
	{
 
		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(
 
	WDP_AUTO, 300, 268,
 
	WC_EXTRA_VIEW_PORT, WC_NONE,
 
	WDF_UNCLICK_BUTTONS,
 
	_nested_extra_view_port_widgets, lengthof(_nested_extra_view_port_widgets)
 
);
 

	
src/waypoint_gui.cpp
Show inline comments
 
@@ -105,26 +105,32 @@ public:
 

	
 
			case WAYPVW_RENAME: // rename
 
				SetDParam(0, this->wp->index);
 
				ShowQueryString(STR_WAYPOINT_NAME, STR_EDIT_WAYPOINT_NAME, MAX_LENGTH_STATION_NAME_CHARS, MAX_LENGTH_STATION_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS);
 
				break;
 

	
 
			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);
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		if (this->viewport != NULL) {
 
			NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WAYPVW_VIEWPORT);
src/window_gui.h
Show inline comments
 
@@ -642,27 +642,27 @@ public:
 

	
 
	/**
 
	 * The query window opened from this window has closed.
 
	 * @param str the new value of the string, NULL if the window
 
	 *            was cancelled or an empty string when the default
 
	 *            button was pressed, i.e. StrEmpty(str).
 
	 */
 
	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.
 
	 */
 
	virtual void OnPlaceObject(Point pt, TileIndex tile) {}
 

	
 
	/**
 
	 * The user clicked on a vehicle while HT_VEHICLE has been set.
 
	 * @param v clicked vehicle. It is guaranteed to be v->IsPrimaryVehicle() == true
0 comments (0 inline, 0 general)