Mercurial > hg > openttd
changeset 17486:e7672bafbe1c draft
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
line wrap: on
line diff
--- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -182,8 +182,14 @@ 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; @@ -437,8 +443,14 @@ } } - 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; } }; @@ -692,8 +704,14 @@ } } - 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; } @@ -1032,8 +1050,14 @@ 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) {
--- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -491,8 +491,14 @@ 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 {
--- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1218,8 +1218,14 @@ } } - 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 &&
--- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -800,8 +800,14 @@ } } - 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;
--- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -635,8 +635,14 @@ } } - 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; }
--- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -119,8 +119,14 @@ 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,
--- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -659,8 +659,14 @@ 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 */
--- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -425,8 +425,14 @@ } } - 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);
--- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -91,8 +91,14 @@ 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); @@ -543,8 +549,14 @@ 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); } @@ -1013,8 +1025,14 @@ /* 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(); } @@ -1247,8 +1265,14 @@ } } - 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 { @@ -1488,11 +1512,13 @@ } /** - * 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));
--- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -253,8 +253,14 @@ } } - 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. */
--- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -597,8 +597,14 @@ 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); @@ -947,8 +953,14 @@ 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); @@ -1346,8 +1358,14 @@ 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. */ @@ -2394,13 +2412,15 @@ } /** - * 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);
--- a/src/intro_gui.cpp +++ b/src/intro_gui.cpp @@ -55,8 +55,14 @@ 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);
--- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -432,8 +432,14 @@ } } - 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); }
--- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -332,8 +332,14 @@ ::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 */ @@ -639,8 +645,14 @@ 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; }
--- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -313,8 +313,14 @@ } } - 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); } @@ -638,8 +644,14 @@ } } - 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); }
--- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -531,8 +531,14 @@ 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; } };
--- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -751,8 +751,14 @@ 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 */
--- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -794,8 +794,14 @@ 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;
--- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -772,8 +772,14 @@ 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);
--- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -379,8 +379,14 @@ 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); @@ -1025,15 +1031,18 @@ } /** - * 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:
--- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -498,8 +498,14 @@ 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; @@ -1035,8 +1041,14 @@ } } - 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); } @@ -1201,8 +1213,14 @@ } } - 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];
--- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -805,8 +805,14 @@ } } - 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;
--- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -247,8 +247,14 @@ 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); } };
--- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -1617,8 +1617,14 @@ 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);
--- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -341,8 +341,14 @@ 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,
--- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -460,8 +460,14 @@ } } - 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; @@ -724,8 +730,14 @@ } } - 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++) {
--- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -367,8 +367,14 @@ 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.
--- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -1423,12 +1423,15 @@ } /** - * 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. */
--- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -687,8 +687,14 @@ 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. */ @@ -1451,8 +1457,14 @@ 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();
--- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -183,8 +183,14 @@ } } - 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;
--- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -215,8 +215,14 @@ 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()); } };
--- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -243,8 +243,14 @@ 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 */
--- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -1482,8 +1482,14 @@ } } - 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); } @@ -1792,8 +1798,14 @@ } } - 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); }
--- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -523,8 +523,14 @@ } } - 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(); @@ -863,8 +869,14 @@ 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. */ @@ -1165,8 +1177,14 @@ 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); } };
--- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -125,8 +125,14 @@ 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))); }
--- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -144,8 +144,14 @@ } } - 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]; }
--- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -683,8 +683,14 @@ } } - 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. @@ -1600,8 +1606,14 @@ 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(); @@ -1787,8 +1799,14 @@ 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. @@ -2596,8 +2614,14 @@ } } - 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.
--- a/src/viewport_gui.cpp +++ b/src/viewport_gui.cpp @@ -148,8 +148,14 @@ } } - 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); }
--- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -114,8 +114,14 @@ } } - 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 */
--- a/src/window_gui.h +++ b/src/window_gui.h @@ -651,9 +651,9 @@ /** * 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