diff options
author | truebrain <truebrain@openttd.org> | 2011-12-16 16:27:45 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2011-12-16 16:27:45 +0000 |
commit | e9f584ac210913a404e246184c8d3c1f52428b63 (patch) | |
tree | dbeb19676245b06fde6921f26e31575ec6979fd2 | |
parent | b90aa80e77e1321bcae2389a014fe7595301e0e2 (diff) | |
download | openttd-e9f584ac210913a404e246184c8d3c1f52428b63.tar.xz |
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
36 files changed, 1722 insertions, 1723 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 4c134bf55..2d6dd8d20 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -59,7 +59,7 @@ struct AIListWindow : public Window { this->ai_info_list = AI::GetUniqueInfoList(); this->CreateNestedTree(desc); - this->vscroll = this->GetScrollbar(AIL_WIDGET_SCROLLBAR); + this->vscroll = this->GetScrollbar(WID_AIL_SCROLLBAR); this->FinishInitNested(desc); // Initializes 'this->line_height' as side effect. this->vscroll->SetCount((int)this->ai_info_list->size() + 1); @@ -80,7 +80,7 @@ struct AIListWindow : public Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget == AIL_WIDGET_LIST) { + if (widget == WID_AIL_LIST) { this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; resize->width = 1; @@ -92,9 +92,9 @@ struct AIListWindow : public Window { virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case AIL_WIDGET_LIST: { + case WID_AIL_LIST: { /* Draw a list of all available AIs. */ - int y = this->GetWidget<NWidgetBase>(AIL_WIDGET_LIST)->pos_y; + int y = this->GetWidget<NWidgetBase>(WID_AIL_LIST)->pos_y; /* First AI in the list is hardcoded to random */ if (this->vscroll->IsVisible(0)) { DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_LEFT, y + WD_MATRIX_TOP, STR_AI_CONFIG_RANDOM_AI, this->selected == -1 ? TC_WHITE : TC_BLACK); @@ -109,7 +109,7 @@ struct AIListWindow : public Window { } break; } - case AIL_WIDGET_INFO_BG: { + case WID_AIL_INFO_BG: { AIInfo *selected_info = NULL; ScriptInfoList::const_iterator it = this->ai_info_list->begin(); for (int i = 1; selected_info == NULL && it != this->ai_info_list->end(); i++, it++) { @@ -155,8 +155,8 @@ struct AIListWindow : public Window { virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case AIL_WIDGET_LIST: { // Select one of the AIs - int sel = this->vscroll->GetScrolledRowFromWidget(pt.y, this, AIL_WIDGET_LIST, 0, this->line_height) - 1; + case WID_AIL_LIST: { // Select one of the AIs + int sel = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_AIL_LIST, 0, this->line_height) - 1; if (sel < (int)this->ai_info_list->size()) { this->selected = sel; this->SetDirty(); @@ -168,13 +168,13 @@ struct AIListWindow : public Window { break; } - case AIL_WIDGET_ACCEPT: { + case WID_AIL_ACCEPT: { this->ChangeAI(); delete this; break; } - case AIL_WIDGET_CANCEL: + case WID_AIL_CANCEL: delete this; break; } @@ -182,7 +182,7 @@ struct AIListWindow : public Window { virtual void OnResize() { - NWidgetCore *nwi = this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST); + NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_AIL_LIST); this->vscroll->SetCapacity(nwi->current_y / this->line_height); nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); } @@ -215,15 +215,15 @@ static const NWidgetPart _nested_ai_list_widgets[] = { NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_AI_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_MATRIX, COLOUR_MAUVE, AIL_WIDGET_LIST), SetMinimalSize(188, 112), SetFill(1, 1), SetResize(1, 1), SetDataTip(0x501, STR_AI_LIST_TOOLTIP), SetScrollbar(AIL_WIDGET_SCROLLBAR), - NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, AIL_WIDGET_SCROLLBAR), + NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIL_LIST), SetMinimalSize(188, 112), SetFill(1, 1), SetResize(1, 1), SetDataTip(0x501, STR_AI_LIST_TOOLTIP), SetScrollbar(WID_AIL_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, WID_AIL_SCROLLBAR), EndContainer(), - NWidget(WWT_PANEL, COLOUR_MAUVE, AIL_WIDGET_INFO_BG), SetMinimalTextLines(8, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM), SetResize(1, 0), + NWidget(WWT_PANEL, COLOUR_MAUVE, WID_AIL_INFO_BG), SetMinimalTextLines(8, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM), SetResize(1, 0), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, AIL_WIDGET_ACCEPT), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_LIST_ACCEPT, STR_AI_LIST_ACCEPT_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, AIL_WIDGET_CANCEL), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_LIST_CANCEL, STR_AI_LIST_CANCEL_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_AIL_ACCEPT), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_LIST_ACCEPT, STR_AI_LIST_ACCEPT_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_AIL_CANCEL), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_LIST_CANCEL, STR_AI_LIST_CANCEL_TOOLTIP), EndContainer(), NWidget(WWT_RESIZEBOX, COLOUR_MAUVE), EndContainer(), @@ -276,10 +276,10 @@ struct AISettingsWindow : public Window { this->RebuildVisibleSettings(); this->CreateNestedTree(desc); - this->vscroll = this->GetScrollbar(AIS_WIDGET_SCROLLBAR); + this->vscroll = this->GetScrollbar(WID_AIS_SCROLLBAR); this->FinishInitNested(desc, slot); // Initializes 'this->line_height' as side effect. - this->SetWidgetDisabledState(AIS_WIDGET_RESET, _game_mode != GM_MENU && Company::IsValidID(this->slot)); + this->SetWidgetDisabledState(WID_AIS_RESET, _game_mode != GM_MENU && Company::IsValidID(this->slot)); this->vscroll->SetCount((int)this->visible_settings.size()); } @@ -304,7 +304,7 @@ struct AISettingsWindow : public Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget == AIS_WIDGET_BACKGROUND) { + if (widget == WID_AIS_BACKGROUND) { this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; resize->width = 1; @@ -315,7 +315,7 @@ struct AISettingsWindow : public Window { virtual void DrawWidget(const Rect &r, int widget) const { - if (widget != AIS_WIDGET_BACKGROUND) return; + if (widget != WID_AIS_BACKGROUND) return; AIConfig *config = this->ai_config; VisibleSettingsList::const_iterator it = this->visible_settings.begin(); @@ -383,8 +383,8 @@ struct AISettingsWindow : public Window { virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case AIS_WIDGET_BACKGROUND: { - const NWidgetBase *wid = this->GetWidget<NWidgetBase>(AIS_WIDGET_BACKGROUND); + case WID_AIS_BACKGROUND: { + const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_AIS_BACKGROUND); int num = (pt.y - wid->pos_y) / this->line_height + this->vscroll->GetPosition(); if (num >= (int)this->visible_settings.size()) break; @@ -433,11 +433,11 @@ struct AISettingsWindow : public Window { break; } - case AIS_WIDGET_ACCEPT: + case WID_AIS_ACCEPT: delete this; break; - case AIS_WIDGET_RESET: + case WID_AIS_RESET: if (_game_mode == GM_MENU || !Company::IsValidID(this->slot)) { this->ai_config->ResetSettings(); this->SetDirty(); @@ -460,7 +460,7 @@ struct AISettingsWindow : public Window { virtual void OnResize() { - NWidgetCore *nwi = this->GetWidget<NWidgetCore>(AIS_WIDGET_BACKGROUND); + NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_AIS_BACKGROUND); this->vscroll->SetCapacity(nwi->current_y / this->line_height); nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); } @@ -495,13 +495,13 @@ static const NWidgetPart _nested_ai_settings_widgets[] = { 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), - NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, AIS_WIDGET_SCROLLBAR), + NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIS_BACKGROUND), SetMinimalSize(188, 182), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x501, STR_NULL), SetScrollbar(WID_AIS_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, WID_AIS_SCROLLBAR), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, AIS_WIDGET_ACCEPT), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_SETTINGS_CLOSE, STR_NULL), - NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, AIS_WIDGET_RESET), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_SETTINGS_RESET, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_AIS_ACCEPT), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_SETTINGS_CLOSE, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_AIS_RESET), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_SETTINGS_RESET, STR_NULL), EndContainer(), NWidget(WWT_RESIZEBOX, COLOUR_MAUVE), EndContainer(), @@ -532,30 +532,30 @@ static const NWidgetPart _nested_ai_config_widgets[] = { NWidget(WWT_CLOSEBOX, COLOUR_MAUVE), NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_AI_CONFIG_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), - NWidget(WWT_PANEL, COLOUR_MAUVE, AIC_WIDGET_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_MAUVE, WID_AIC_BACKGROUND), NWidget(NWID_VERTICAL), SetPIP(4, 4, 4), NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 10), - NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, AIC_WIDGET_DECREASE), SetFill(0, 1), SetDataTip(AWV_DECREASE, STR_NULL), - NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, AIC_WIDGET_INCREASE), SetFill(0, 1), SetDataTip(AWV_INCREASE, STR_NULL), + NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, WID_AIC_DECREASE), SetFill(0, 1), SetDataTip(AWV_DECREASE, STR_NULL), + NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, WID_AIC_INCREASE), SetFill(0, 1), SetDataTip(AWV_INCREASE, STR_NULL), NWidget(NWID_SPACER), SetMinimalSize(6, 0), - NWidget(WWT_TEXT, COLOUR_MAUVE, AIC_WIDGET_NUMBER), SetDataTip(STR_DIFFICULTY_LEVEL_SETTING_MAXIMUM_NO_COMPETITORS, STR_NULL), SetFill(1, 0), SetPadding(1, 0, 0, 0), + NWidget(WWT_TEXT, COLOUR_MAUVE, WID_AIC_NUMBER), SetDataTip(STR_DIFFICULTY_LEVEL_SETTING_MAXIMUM_NO_COMPETITORS, STR_NULL), SetFill(1, 0), SetPadding(1, 0, 0, 0), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 0, 10), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, AIC_WIDGET_MOVE_UP), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_CONFIG_MOVE_UP, STR_AI_CONFIG_MOVE_UP_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, AIC_WIDGET_MOVE_DOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_CONFIG_MOVE_DOWN, STR_AI_CONFIG_MOVE_DOWN_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_MOVE_UP), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_CONFIG_MOVE_UP, STR_AI_CONFIG_MOVE_UP_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_MOVE_DOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_CONFIG_MOVE_DOWN, STR_AI_CONFIG_MOVE_DOWN_TOOLTIP), EndContainer(), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_MATRIX, COLOUR_MAUVE, AIC_WIDGET_LIST), SetMinimalSize(288, 112), SetFill(1, 0), SetDataTip(0x801, STR_AI_CONFIG_LIST_TOOLTIP), SetScrollbar(AIC_WIDGET_SCROLLBAR), - NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, AIC_WIDGET_SCROLLBAR), + NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_LIST), SetMinimalSize(288, 112), SetFill(1, 0), SetDataTip(0x801, STR_AI_CONFIG_LIST_TOOLTIP), SetScrollbar(WID_AIC_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, WID_AIC_SCROLLBAR), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 9), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(5, 0, 5), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, AIC_WIDGET_CHANGE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CHANGE, STR_AI_CONFIG_CHANGE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, AIC_WIDGET_CONFIGURE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, AIC_WIDGET_CLOSE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_SETTINGS_CLOSE, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CHANGE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CHANGE, STR_AI_CONFIG_CHANGE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CONFIGURE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_CONFIG_CONFIGURE, STR_AI_CONFIG_CONFIGURE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CLOSE), SetFill(1, 0), SetMinimalSize(93, 12), SetDataTip(STR_AI_SETTINGS_CLOSE, STR_NULL), EndContainer(), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, AIC_WIDGET_CONTENT_DOWNLOAD), SetFill(1, 0), SetMinimalSize(279, 12), SetPadding(0, 5, 9, 5), SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CONTENT_DOWNLOAD), SetFill(1, 0), SetMinimalSize(279, 12), SetPadding(0, 5, 9, 5), SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT), EndContainer(), }; @@ -578,9 +578,9 @@ struct AIConfigWindow : public Window { AIConfigWindow() : Window() { this->InitNested(&_ai_config_desc); // Initializes 'this->line_height' as a side effect. - this->vscroll = this->GetScrollbar(AIC_WIDGET_SCROLLBAR); + this->vscroll = this->GetScrollbar(WID_AIC_SCROLLBAR); this->selected_slot = INVALID_COMPANY; - NWidgetCore *nwi = this->GetWidget<NWidgetCore>(AIC_WIDGET_LIST); + NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_AIC_LIST); this->vscroll->SetCapacity(nwi->current_y / this->line_height); this->vscroll->SetCount(MAX_COMPANIES); nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); @@ -596,7 +596,7 @@ struct AIConfigWindow : public Window { virtual void SetStringParameters(int widget) const { switch (widget) { - case AIC_WIDGET_NUMBER: + case WID_AIC_NUMBER: SetDParam(0, GetGameSettings().difficulty.max_no_competitors); break; } @@ -605,7 +605,7 @@ struct AIConfigWindow : public Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case AIC_WIDGET_LIST: + case WID_AIC_LIST: this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; size->height = GB(this->GetWidget<NWidgetCore>(widget)->widget_data, MAT_ROW_START, MAT_ROW_BITS) * this->line_height; break; @@ -634,7 +634,7 @@ struct AIConfigWindow : public Window { virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case AIC_WIDGET_LIST: { + case WID_AIC_LIST: { int y = r.top; for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < MAX_COMPANIES; i++) { StringID text; @@ -659,10 +659,10 @@ struct AIConfigWindow : public Window { virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case AIC_WIDGET_DECREASE: - case AIC_WIDGET_INCREASE: { + case WID_AIC_DECREASE: + case WID_AIC_INCREASE: { int new_value; - if (widget == AIC_WIDGET_DECREASE) { + if (widget == WID_AIC_DECREASE) { new_value = max(0, GetGameSettings().difficulty.max_no_competitors - 1); } else { new_value = min(MAX_COMPANIES - 1, GetGameSettings().difficulty.max_no_competitors + 1); @@ -672,14 +672,14 @@ struct AIConfigWindow : public Window { break; } - case AIC_WIDGET_LIST: { // Select a slot + case WID_AIC_LIST: { // Select a slot this->selected_slot = (CompanyID)this->vscroll->GetScrolledRowFromWidget(pt.y, this, widget, 0, this->line_height); this->InvalidateData(); if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot); break; } - case AIC_WIDGET_MOVE_UP: + case WID_AIC_MOVE_UP: if (IsEditable(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot - 1))) { Swap(GetGameSettings().ai_config[this->selected_slot], GetGameSettings().ai_config[this->selected_slot - 1]); this->selected_slot--; @@ -688,7 +688,7 @@ struct AIConfigWindow : public Window { } break; - case AIC_WIDGET_MOVE_DOWN: + case WID_AIC_MOVE_DOWN: if (IsEditable(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot + 1))) { Swap(GetGameSettings().ai_config[this->selected_slot], GetGameSettings().ai_config[this->selected_slot + 1]); this->selected_slot++; @@ -697,19 +697,19 @@ struct AIConfigWindow : public Window { } break; - case AIC_WIDGET_CHANGE: // choose other AI + case WID_AIC_CHANGE: // choose other AI ShowAIListWindow((CompanyID)this->selected_slot); break; - case AIC_WIDGET_CONFIGURE: // change the settings for an AI + case WID_AIC_CONFIGURE: // change the settings for an AI ShowAISettingsWindow((CompanyID)this->selected_slot); break; - case AIC_WIDGET_CLOSE: + case WID_AIC_CLOSE: delete this; break; - case AIC_WIDGET_CONTENT_DOWNLOAD: + case WID_AIC_CONTENT_DOWNLOAD: if (!_network_available) { ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR); } else { @@ -734,12 +734,12 @@ struct AIConfigWindow : public Window { if (!gui_scope) return; - 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))); + this->SetWidgetDisabledState(WID_AIC_DECREASE, GetGameSettings().difficulty.max_no_competitors == 0); + this->SetWidgetDisabledState(WID_AIC_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES - 1); + this->SetWidgetDisabledState(WID_AIC_CHANGE, this->selected_slot == INVALID_COMPANY); + this->SetWidgetDisabledState(WID_AIC_CONFIGURE, this->selected_slot == INVALID_COMPANY); + this->SetWidgetDisabledState(WID_AIC_MOVE_UP, this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot - 1))); + this->SetWidgetDisabledState(WID_AIC_MOVE_DOWN, this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot + 1))); } }; @@ -754,8 +754,8 @@ void ShowAIConfigWindow() * Window with everything an AI prints via ScriptLog. */ struct AIDebugWindow : public QueryStringBaseWindow { - static const int top_offset; ///< Offset of the text at the top of the AID_WIDGET_LOG_PANEL. - static const int bottom_offset; ///< Offset of the text at the bottom of the AID_WIDGET_LOG_PANEL. + static const int top_offset; ///< Offset of the text at the top of the WID_AID_LOG_PANEL. + static const int bottom_offset; ///< Offset of the text at the bottom of the WID_AID_LOG_PANEL. static const unsigned int MAX_BREAK_STR_STRING_LENGTH = 256; ///< Maximum length of the break string. @@ -778,19 +778,19 @@ struct AIDebugWindow : public QueryStringBaseWindow { AIDebugWindow(const WindowDesc *desc, WindowNumber number) : QueryStringBaseWindow(MAX_BREAK_STR_STRING_LENGTH) { this->CreateNestedTree(desc); - this->vscroll = this->GetScrollbar(AID_WIDGET_SCROLLBAR); + this->vscroll = this->GetScrollbar(WID_AID_SCROLLBAR); this->show_break_box = _settings_client.gui.ai_developer_tools; - this->GetWidget<NWidgetStacked>(AID_BREAK_STRING_WIDGETS)->SetDisplayedPlane(this->show_break_box ? 0 : SZSP_HORIZONTAL); + this->GetWidget<NWidgetStacked>(WID_AID_BREAK_STRING_WIDGETS)->SetDisplayedPlane(this->show_break_box ? 0 : SZSP_HORIZONTAL); this->FinishInitNested(desc, number); if (!this->show_break_box) break_check_enabled = false; /* Disable the companies who are not active or not an AI */ for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) { - this->SetWidgetDisabledState(i + AID_WIDGET_COMPANY_BUTTON_START, !Company::IsValidAiID(i)); + this->SetWidgetDisabledState(i + WID_AID_COMPANY_BUTTON_START, !Company::IsValidAiID(i)); } - this->DisableWidget(AID_WIDGET_RELOAD_TOGGLE); - this->DisableWidget(AID_WIDGET_SETTINGS); - this->DisableWidget(AID_WIDGET_CONTINUE_BTN); + this->DisableWidget(WID_AID_RELOAD_TOGGLE); + this->DisableWidget(WID_AID_SETTINGS); + this->DisableWidget(WID_AID_CONTINUE_BTN); this->last_vscroll_pos = 0; this->autoscroll = true; @@ -802,15 +802,15 @@ struct AIDebugWindow : public QueryStringBaseWindow { UpdateTextBufferSize(&this->text); /* Restore button state from static class variables */ - if (ai_debug_company != INVALID_COMPANY) this->LowerWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START); - this->SetWidgetLoweredState(AID_WIDGET_BREAK_STR_ON_OFF_BTN, this->break_check_enabled); - this->SetWidgetLoweredState(AID_WIDGET_MATCH_CASE_BTN, this->case_sensitive_break_check); + if (ai_debug_company != INVALID_COMPANY) this->LowerWidget(ai_debug_company + WID_AID_COMPANY_BUTTON_START); + this->SetWidgetLoweredState(WID_AID_BREAK_STR_ON_OFF_BTN, this->break_check_enabled); + this->SetWidgetLoweredState(WID_AID_MATCH_CASE_BTN, this->case_sensitive_break_check); } virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget == AID_WIDGET_LOG_PANEL) { + if (widget == WID_AID_LOG_PANEL) { resize->height = FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL; size->height = 14 * resize->height + this->top_offset + this->bottom_offset; } @@ -822,7 +822,7 @@ struct AIDebugWindow : public QueryStringBaseWindow { if (ai_debug_company == INVALID_COMPANY || !Company::IsValidAiID(ai_debug_company)) { if (ai_debug_company != INVALID_COMPANY) { /* Raise the widget for the previous selection. */ - this->RaiseWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START); + this->RaiseWidget(ai_debug_company + WID_AID_COMPANY_BUTTON_START); ai_debug_company = INVALID_COMPANY; } @@ -831,7 +831,7 @@ struct AIDebugWindow : public QueryStringBaseWindow { FOR_ALL_COMPANIES(c) { if (c->is_ai) { /* Lower the widget corresponding to this company. */ - this->LowerWidget(c->index + AID_WIDGET_COMPANY_BUTTON_START); + this->LowerWidget(c->index + WID_AID_COMPANY_BUTTON_START); ai_debug_company = c->index; break; @@ -841,8 +841,8 @@ struct AIDebugWindow : public QueryStringBaseWindow { /* Update "Reload AI" and "AI settings" buttons */ this->SetWidgetsDisabledState(ai_debug_company == INVALID_COMPANY, - AID_WIDGET_RELOAD_TOGGLE, - AID_WIDGET_SETTINGS, + WID_AID_RELOAD_TOGGLE, + WID_AID_SETTINGS, WIDGET_LIST_END); /* Draw standard stuff */ @@ -850,11 +850,11 @@ struct AIDebugWindow : public QueryStringBaseWindow { if (this->IsShaded()) return; // Don't draw anything when the window is shaded. - if (this->show_break_box) this->DrawEditBox(AID_WIDGET_BREAK_STR_EDIT_BOX); + if (this->show_break_box) this->DrawEditBox(WID_AID_BREAK_STR_EDIT_BOX); /* Paint the company icons */ for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) { - NWidgetCore *button = this->GetWidget<NWidgetCore>(i + AID_WIDGET_COMPANY_BUTTON_START); + NWidgetCore *button = this->GetWidget<NWidgetCore>(i + WID_AID_COMPANY_BUTTON_START); bool dirty = false; bool valid = Company::IsValidAiID(i); @@ -879,7 +879,7 @@ struct AIDebugWindow : public QueryStringBaseWindow { if (!valid) continue; byte offset = (i == ai_debug_company) ? 1 : 0; - DrawCompanyIcon(i, button->pos_x + button->current_x / 2 - 7 + offset, this->GetWidget<NWidgetBase>(AID_WIDGET_COMPANY_BUTTON_START + i)->pos_y + 2 + offset); + DrawCompanyIcon(i, button->pos_x + button->current_x / 2 - 7 + offset, this->GetWidget<NWidgetBase>(WID_AID_COMPANY_BUTTON_START + i)->pos_y + 2 + offset); } /* If there are no active companies, don't display anything else. */ @@ -892,7 +892,7 @@ struct AIDebugWindow : public QueryStringBaseWindow { this->vscroll->SetCount(scroll_count); /* We need a repaint */ - this->SetWidgetDirty(AID_WIDGET_SCROLLBAR); + this->SetWidgetDirty(WID_AID_SCROLLBAR); } if (log == NULL) return; @@ -908,8 +908,8 @@ struct AIDebugWindow : public QueryStringBaseWindow { this->vscroll->SetPosition(scroll_pos); /* We need a repaint */ - this->SetWidgetDirty(AID_WIDGET_SCROLLBAR); - this->SetWidgetDirty(AID_WIDGET_LOG_PANEL); + this->SetWidgetDirty(WID_AID_SCROLLBAR); + this->SetWidgetDirty(WID_AID_LOG_PANEL); } } this->last_vscroll_pos = this->vscroll->GetPosition(); @@ -918,7 +918,7 @@ struct AIDebugWindow : public QueryStringBaseWindow { virtual void SetStringParameters(int widget) const { switch (widget) { - case AID_WIDGET_NAME_TEXT: + case WID_AID_NAME_TEXT: if (ai_debug_company == INVALID_COMPANY || !Company::IsValidAiID(ai_debug_company)) { SetDParam(0, STR_EMPTY); } else { @@ -937,7 +937,7 @@ struct AIDebugWindow : public QueryStringBaseWindow { if (ai_debug_company == INVALID_COMPANY) return; switch (widget) { - case AID_WIDGET_LOG_PANEL: { + case WID_AID_LOG_PANEL: { ScriptLog::LogData *log = (ScriptLog::LogData *)Company::Get(ai_debug_company)->ai_instance->GetLogPointer(); if (log == NULL) return; @@ -976,13 +976,13 @@ struct AIDebugWindow : public QueryStringBaseWindow { */ void ChangeToAI(CompanyID show_ai) { - this->RaiseWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START); + this->RaiseWidget(ai_debug_company + WID_AID_COMPANY_BUTTON_START); ai_debug_company = show_ai; ScriptLog::LogData *log = (ScriptLog::LogData *)Company::Get(ai_debug_company)->ai_instance->GetLogPointer(); this->vscroll->SetCount((log == NULL) ? 0 : log->used); - this->LowerWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START); + this->LowerWidget(ai_debug_company + WID_AID_COMPANY_BUTTON_START); this->autoscroll = true; this->last_vscroll_pos = this->vscroll->GetPosition(); this->SetDirty(); @@ -993,60 +993,60 @@ struct AIDebugWindow : public QueryStringBaseWindow { virtual void OnClick(Point pt, int widget, int click_count) { /* Check which button is clicked */ - if (IsInsideMM(widget, AID_WIDGET_COMPANY_BUTTON_START, AID_WIDGET_COMPANY_BUTTON_END + 1)) { + if (IsInsideMM(widget, WID_AID_COMPANY_BUTTON_START, WID_AID_COMPANY_BUTTON_END + 1)) { /* Is it no on disable? */ if (!this->IsWidgetDisabled(widget)) { - ChangeToAI((CompanyID)(widget - AID_WIDGET_COMPANY_BUTTON_START)); + ChangeToAI((CompanyID)(widget - WID_AID_COMPANY_BUTTON_START)); } } switch (widget) { - case AID_WIDGET_RELOAD_TOGGLE: + case WID_AID_RELOAD_TOGGLE: /* First kill the company of the AI, then start a new one. This should start the current AI again */ DoCommandP(0, 2 | ai_debug_company << 16, CRR_MANUAL, CMD_COMPANY_CTRL); DoCommandP(0, 1 | ai_debug_company << 16, 0, CMD_COMPANY_CTRL); break; - case AID_WIDGET_SETTINGS: + case WID_AID_SETTINGS: ShowAISettingsWindow(ai_debug_company); break; - case AID_WIDGET_BREAK_STR_ON_OFF_BTN: + case WID_AID_BREAK_STR_ON_OFF_BTN: this->break_check_enabled = !this->break_check_enabled; - this->SetWidgetLoweredState(AID_WIDGET_BREAK_STR_ON_OFF_BTN, this->break_check_enabled); - this->SetWidgetDirty(AID_WIDGET_BREAK_STR_ON_OFF_BTN); + this->SetWidgetLoweredState(WID_AID_BREAK_STR_ON_OFF_BTN, this->break_check_enabled); + this->SetWidgetDirty(WID_AID_BREAK_STR_ON_OFF_BTN); break; - case AID_WIDGET_MATCH_CASE_BTN: + case WID_AID_MATCH_CASE_BTN: this->case_sensitive_break_check = !this->case_sensitive_break_check; - this->SetWidgetLoweredState(AID_WIDGET_MATCH_CASE_BTN, this->case_sensitive_break_check); + this->SetWidgetLoweredState(WID_AID_MATCH_CASE_BTN, this->case_sensitive_break_check); break; - case AID_WIDGET_CONTINUE_BTN: + case WID_AID_CONTINUE_BTN: /* Unpause */ DoCommandP(0, PM_PAUSED_NORMAL, 0, CMD_PAUSE); - this->DisableWidget(AID_WIDGET_CONTINUE_BTN); - this->RaiseWidget(AID_WIDGET_CONTINUE_BTN); // Disabled widgets don't raise themself + this->DisableWidget(WID_AID_CONTINUE_BTN); + this->RaiseWidget(WID_AID_CONTINUE_BTN); // Disabled widgets don't raise themself break; } } virtual void OnTimeout() { - this->RaiseWidget(AID_WIDGET_RELOAD_TOGGLE); - this->RaiseWidget(AID_WIDGET_SETTINGS); + this->RaiseWidget(WID_AID_RELOAD_TOGGLE); + this->RaiseWidget(WID_AID_SETTINGS); this->SetDirty(); } virtual void OnMouseLoop() { - this->HandleEditBox(AID_WIDGET_BREAK_STR_EDIT_BOX); + this->HandleEditBox(WID_AID_BREAK_STR_EDIT_BOX); } 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) { + if (this->HandleEditBoxKey(WID_AID_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)); } @@ -1067,9 +1067,9 @@ struct AIDebugWindow : public QueryStringBaseWindow { * 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->DisableWidget(WID_AID_CONTINUE_BTN); + this->SetWidgetDirty(WID_AID_CONTINUE_BTN); + this->SetWidgetDirty(WID_AID_LOG_PANEL); this->highlight_row = -1; } } @@ -1090,8 +1090,8 @@ struct AIDebugWindow : public QueryStringBaseWindow { } /* Make it possible to click on the continue button */ - this->EnableWidget(AID_WIDGET_CONTINUE_BTN); - this->SetWidgetDirty(AID_WIDGET_CONTINUE_BTN); + this->EnableWidget(WID_AID_CONTINUE_BTN); + this->SetWidgetDirty(WID_AID_CONTINUE_BTN); /* Highlight row that matched */ this->highlight_row = log->pos; @@ -1101,7 +1101,7 @@ struct AIDebugWindow : public QueryStringBaseWindow { virtual void OnResize() { - this->vscroll->SetCapacityFromWidget(this, AID_WIDGET_LOG_PANEL); + this->vscroll->SetCapacityFromWidget(this, WID_AID_LOG_PANEL); } }; @@ -1115,7 +1115,7 @@ bool AIDebugWindow::case_sensitive_break_check = false; /** Make a number of rows with buttons for each company for the AI debug window. */ NWidgetBase *MakeCompanyButtonRowsAIDebug(int *biggest_index) { - return MakeCompanyButtonRows(biggest_index, AID_WIDGET_COMPANY_BUTTON_START, AID_WIDGET_COMPANY_BUTTON_END, 8, STR_AI_DEBUG_SELECT_AI_TOOLTIP); + return MakeCompanyButtonRows(biggest_index, WID_AID_COMPANY_BUTTON_START, WID_AID_COMPANY_BUTTON_END, 8, STR_AI_DEBUG_SELECT_AI_TOOLTIP); } /** Widgets for the AI debug window. */ @@ -1126,36 +1126,36 @@ static const NWidgetPart _nested_ai_debug_widgets[] = { NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_VIEW), + NWidget(WWT_PANEL, COLOUR_GREY, WID_AID_VIEW), NWidgetFunction(MakeCompanyButtonRowsAIDebug), SetPadding(0, 2, 1, 2), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_TEXTBTN, COLOUR_GREY, AID_WIDGET_NAME_TEXT), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_JUST_STRING, STR_AI_DEBUG_NAME_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_SETTINGS), SetMinimalSize(100, 20), SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_RELOAD_TOGGLE), SetMinimalSize(100, 20), SetDataTip(STR_AI_DEBUG_RELOAD, STR_AI_DEBUG_RELOAD_TOOLTIP), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AID_NAME_TEXT), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_JUST_STRING, STR_AI_DEBUG_NAME_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_AID_SETTINGS), SetMinimalSize(100, 20), SetDataTip(STR_AI_DEBUG_SETTINGS, STR_AI_DEBUG_SETTINGS_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_AID_RELOAD_TOGGLE), SetMinimalSize(100, 20), SetDataTip(STR_AI_DEBUG_RELOAD, STR_AI_DEBUG_RELOAD_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(NWID_VERTICAL), /* Log panel */ - NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_LOG_PANEL), SetMinimalSize(287, 180), SetResize(1, 1), SetScrollbar(AID_WIDGET_SCROLLBAR), + NWidget(WWT_PANEL, COLOUR_GREY, WID_AID_LOG_PANEL), SetMinimalSize(287, 180), SetResize(1, 1), SetScrollbar(WID_AID_SCROLLBAR), EndContainer(), /* Break string widgets */ - NWidget(NWID_SELECTION, INVALID_COLOUR, AID_BREAK_STRING_WIDGETS), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_AID_BREAK_STRING_WIDGETS), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN_2, COLOUR_GREY, AID_WIDGET_BREAK_STR_ON_OFF_BTN), SetFill(0, 1), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_AI_DEBUG_BREAK_STR_ON_OFF_TOOLTIP), + NWidget(WWT_IMGBTN_2, COLOUR_GREY, WID_AID_BREAK_STR_ON_OFF_BTN), SetFill(0, 1), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_AI_DEBUG_BREAK_STR_ON_OFF_TOOLTIP), NWidget(WWT_PANEL, COLOUR_GREY), NWidget(NWID_HORIZONTAL), NWidget(WWT_LABEL, COLOUR_GREY), SetPadding(2, 2, 2, 4), SetDataTip(STR_AI_DEBUG_BREAK_ON_LABEL, 0x0), - NWidget(WWT_EDITBOX, COLOUR_WHITE, AID_WIDGET_BREAK_STR_EDIT_BOX), SetFill(1, 1), SetResize(1, 0), SetPadding(2, 2, 2, 2), SetDataTip(STR_AI_DEBUG_BREAK_STR_OSKTITLE, STR_AI_DEBUG_BREAK_STR_TOOLTIP), + NWidget(WWT_EDITBOX, COLOUR_WHITE, WID_AID_BREAK_STR_EDIT_BOX), SetFill(1, 1), SetResize(1, 0), SetPadding(2, 2, 2, 2), SetDataTip(STR_AI_DEBUG_BREAK_STR_OSKTITLE, STR_AI_DEBUG_BREAK_STR_TOOLTIP), EndContainer(), EndContainer(), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_MATCH_CASE_BTN), SetMinimalSize(100, 0), SetFill(0, 1), SetDataTip(STR_AI_DEBUG_MATCH_CASE, STR_AI_DEBUG_MATCH_CASE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_CONTINUE_BTN), SetMinimalSize(100, 0), SetFill(0, 1), SetDataTip(STR_AI_DEBUG_CONTINUE, STR_AI_DEBUG_CONTINUE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_AID_MATCH_CASE_BTN), SetMinimalSize(100, 0), SetFill(0, 1), SetDataTip(STR_AI_DEBUG_MATCH_CASE, STR_AI_DEBUG_MATCH_CASE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_AID_CONTINUE_BTN), SetMinimalSize(100, 0), SetFill(0, 1), SetDataTip(STR_AI_DEBUG_CONTINUE, STR_AI_DEBUG_CONTINUE_TOOLTIP), EndContainer(), EndContainer(), EndContainer(), NWidget(NWID_VERTICAL), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, AID_WIDGET_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_AID_SCROLLBAR), NWidget(WWT_RESIZEBOX, COLOUR_GREY), EndContainer(), EndContainer(), diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index d139c5607..ae53afeab 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -84,15 +84,15 @@ struct BuildAirToolbarWindow : Window { virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case ATW_AIRPORT: - if (HandlePlacePushButton(this, ATW_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT)) { + case WID_AT_AIRPORT: + if (HandlePlacePushButton(this, WID_AT_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT)) { ShowBuildAirportPicker(this); this->last_user_action = widget; } break; - case ATW_DEMOLISH: - HandlePlacePushButton(this, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL); + case WID_AT_DEMOLISH: + HandlePlacePushButton(this, WID_AT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL); this->last_user_action = widget; break; @@ -112,11 +112,11 @@ struct BuildAirToolbarWindow : Window { virtual void OnPlaceObject(Point pt, TileIndex tile) { switch (this->last_user_action) { - case ATW_AIRPORT: + case WID_AT_AIRPORT: PlaceAirport(tile); break; - case ATW_DEMOLISH: + case WID_AT_DEMOLISH: PlaceProc_DemolishArea(tile); break; @@ -148,8 +148,8 @@ struct BuildAirToolbarWindow : Window { }; Hotkey<BuildAirToolbarWindow> BuildAirToolbarWindow::airtoolbar_hotkeys[] = { - Hotkey<BuildAirToolbarWindow>('1', "airport", ATW_AIRPORT), - Hotkey<BuildAirToolbarWindow>('2', "demolish", ATW_DEMOLISH), + Hotkey<BuildAirToolbarWindow>('1', "airport", WID_AT_AIRPORT), + Hotkey<BuildAirToolbarWindow>('2', "demolish", WID_AT_DEMOLISH), HOTKEY_LIST_END(BuildAirToolbarWindow) }; Hotkey<BuildAirToolbarWindow> *_airtoolbar_hotkeys = BuildAirToolbarWindow::airtoolbar_hotkeys; @@ -161,9 +161,9 @@ static const NWidgetPart _nested_air_toolbar_widgets[] = { NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ATW_AIRPORT), SetFill(0, 1), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_AIRPORT, STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_AT_AIRPORT), SetFill(0, 1), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_AIRPORT, STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP), NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(4, 22), SetFill(1, 1), EndContainer(), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ATW_DEMOLISH), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_AT_DEMOLISH), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), EndContainer(), }; @@ -221,14 +221,14 @@ public: { this->CreateNestedTree(desc); - this->vscroll = this->GetScrollbar(BAIRW_SCROLLBAR); + this->vscroll = this->GetScrollbar(WID_AP_SCROLLBAR); this->vscroll->SetCapacity(5); this->vscroll->SetPosition(0); this->FinishInitNested(desc, TRANSPORT_AIR); - this->SetWidgetLoweredState(BAIRW_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage); - this->SetWidgetLoweredState(BAIRW_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage); + this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage); + this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage); this->OnInvalidateData(); this->vscroll->SetCount(AirportClass::GetCount(_selected_airport_class)); @@ -243,11 +243,11 @@ public: virtual void SetStringParameters(int widget) const { switch (widget) { - case BAIRW_CLASS_DROPDOWN: + case WID_AP_CLASS_DROPDOWN: SetDParam(0, AirportClass::GetName(_selected_airport_class)); break; - case BAIRW_LAYOUT_NUM: + case WID_AP_LAYOUT_NUM: SetDParam(0, STR_EMPTY); if (_selected_airport_index != -1) { const AirportSpec *as = AirportClass::Get(_selected_airport_class, _selected_airport_index); @@ -268,7 +268,7 @@ public: virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case BAIRW_CLASS_DROPDOWN: { + case WID_AP_CLASS_DROPDOWN: { Dimension d = {0, 0}; for (uint i = 0; i < AirportClass::GetCount(); i++) { SetDParam(0, AirportClass::GetName((AirportClassID)i)); @@ -280,7 +280,7 @@ public: break; } - case BAIRW_AIRPORT_LIST: { + case WID_AP_AIRPORT_LIST: { for (int i = 0; i < NUM_AIRPORTS; i++) { const AirportSpec *as = AirportSpec::Get(i); if (!as->enabled) continue; @@ -293,7 +293,7 @@ public: break; } - case BAIRW_AIRPORT_SPRITE: + case WID_AP_AIRPORT_SPRITE: for (int i = 0; i < NUM_AIRPORTS; i++) { const AirportSpec *as = AirportSpec::Get(i); if (!as->enabled) continue; @@ -309,7 +309,7 @@ public: } break; - case BAIRW_EXTRA_TEXT: + case WID_AP_EXTRA_TEXT: for (int i = NEW_AIRPORT_OFFSET; i < NUM_AIRPORTS; i++) { const AirportSpec *as = AirportSpec::Get(i); if (!as->enabled) continue; @@ -332,7 +332,7 @@ public: virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case BAIRW_AIRPORT_LIST: { + case WID_AP_AIRPORT_LIST: { int y = r.top; for (uint i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < AirportClass::GetCount(_selected_airport_class); i++) { const AirportSpec *as = AirportClass::Get(_selected_airport_class, i); @@ -345,14 +345,14 @@ public: break; } - case BAIRW_AIRPORT_SPRITE: + case WID_AP_AIRPORT_SPRITE: if (this->preview_sprite != 0) { Dimension d = GetSpriteSize(this->preview_sprite); DrawSprite(this->preview_sprite, COMPANY_SPRITE_COLOUR(_local_company), (r.left + r.right - d.width) / 2, (r.top + r.bottom - d.height) / 2); } break; - case BAIRW_EXTRA_TEXT: + case WID_AP_EXTRA_TEXT: if (_selected_airport_index != -1) { const AirportSpec *as = AirportClass::Get(_selected_airport_class, _selected_airport_index); StringID string = GetAirportTextCallback(as, _selected_airport_layout, CBID_AIRPORT_ADDITIONAL_TEXT); @@ -369,8 +369,8 @@ public: { this->DrawWidgets(); - uint16 top = this->GetWidget<NWidgetBase>(BAIRW_BTN_DOHILIGHT)->pos_y + this->GetWidget<NWidgetBase>(BAIRW_BTN_DOHILIGHT)->current_y + WD_PAR_VSEP_NORMAL; - NWidgetBase *panel_nwi = this->GetWidget<NWidgetBase>(BAIRW_BOTTOMPANEL); + uint16 top = this->GetWidget<NWidgetBase>(WID_AP_BTN_DOHILIGHT)->pos_y + this->GetWidget<NWidgetBase>(WID_AP_BTN_DOHILIGHT)->current_y + WD_PAR_VSEP_NORMAL; + NWidgetBase *panel_nwi = this->GetWidget<NWidgetBase>(WID_AP_BOTTOMPANEL); int right = panel_nwi->pos_x + panel_nwi->current_x; int bottom = panel_nwi->pos_y + panel_nwi->current_y; @@ -411,8 +411,8 @@ public: { if (_selected_airport_index == -1) { SetTileSelectSize(1, 1); - this->DisableWidget(BAIRW_LAYOUT_DECREASE); - this->DisableWidget(BAIRW_LAYOUT_INCREASE); + this->DisableWidget(WID_AP_LAYOUT_DECREASE); + this->DisableWidget(WID_AP_LAYOUT_INCREASE); } else { const AirportSpec *as = AirportClass::Get(_selected_airport_class, _selected_airport_index); int w = as->size_x; @@ -423,8 +423,8 @@ public: this->preview_sprite = GetCustomAirportSprite(as, _selected_airport_layout); - this->SetWidgetDisabledState(BAIRW_LAYOUT_DECREASE, _selected_airport_layout == 0); - this->SetWidgetDisabledState(BAIRW_LAYOUT_INCREASE, _selected_airport_layout + 1 >= as->num_table); + this->SetWidgetDisabledState(WID_AP_LAYOUT_DECREASE, _selected_airport_layout == 0); + this->SetWidgetDisabledState(WID_AP_LAYOUT_INCREASE, _selected_airport_layout + 1 >= as->num_table); int rad = _settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED; if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); @@ -434,11 +434,11 @@ public: virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case BAIRW_CLASS_DROPDOWN: - ShowDropDownList(this, BuildAirportClassDropDown(), _selected_airport_class, BAIRW_CLASS_DROPDOWN); + case WID_AP_CLASS_DROPDOWN: + ShowDropDownList(this, BuildAirportClassDropDown(), _selected_airport_class, WID_AP_CLASS_DROPDOWN); break; - case BAIRW_AIRPORT_LIST: { + case WID_AP_AIRPORT_LIST: { int num_clicked = this->vscroll->GetPosition() + (pt.y - this->nested_array[widget]->pos_y) / this->line_height; if (num_clicked >= this->vscroll->GetCount()) break; const AirportSpec *as = AirportClass::Get(_selected_airport_class, num_clicked); @@ -446,22 +446,22 @@ public: break; } - case BAIRW_BTN_DONTHILIGHT: case BAIRW_BTN_DOHILIGHT: - _settings_client.gui.station_show_coverage = (widget != BAIRW_BTN_DONTHILIGHT); - this->SetWidgetLoweredState(BAIRW_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage); - this->SetWidgetLoweredState(BAIRW_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage); + case WID_AP_BTN_DONTHILIGHT: case WID_AP_BTN_DOHILIGHT: + _settings_client.gui.station_show_coverage = (widget != WID_AP_BTN_DONTHILIGHT); + this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage); + this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage); this->SetDirty(); SndPlayFx(SND_15_BEEP); this->UpdateSelectSize(); break; - case BAIRW_LAYOUT_DECREASE: + case WID_AP_LAYOUT_DECREASE: _selected_airport_layout--; this->UpdateSelectSize(); this->SetDirty(); break; - case BAIRW_LAYOUT_INCREASE: + case WID_AP_LAYOUT_INCREASE: _selected_airport_layout++; this->UpdateSelectSize(); this->SetDirty(); @@ -504,7 +504,7 @@ public: virtual void OnDropdownSelect(int widget, int index) { - assert(widget == BAIRW_CLASS_DROPDOWN); + assert(widget == WID_AP_CLASS_DROPDOWN); _selected_airport_class = (AirportClassID)index; this->vscroll->SetCount(AirportClass::GetCount(_selected_airport_class)); this->SelectFirstAvailableAirport(false); @@ -523,28 +523,28 @@ static const NWidgetPart _nested_build_airport_widgets[] = { EndContainer(), NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 0), SetPIP(2, 0, 2), NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL, STR_NULL), SetFill(1, 0), - NWidget(WWT_DROPDOWN, COLOUR_GREY, BAIRW_CLASS_DROPDOWN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_AIRPORT_TOOLTIP), + NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_AP_CLASS_DROPDOWN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_AIRPORT_TOOLTIP), NWidget(NWID_HORIZONTAL), - NWidget(WWT_MATRIX, COLOUR_GREY, BAIRW_AIRPORT_LIST), SetFill(1, 0), SetDataTip(0x501, STR_STATION_BUILD_AIRPORT_TOOLTIP), SetScrollbar(BAIRW_SCROLLBAR), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, BAIRW_SCROLLBAR), + NWidget(WWT_MATRIX, COLOUR_GREY, WID_AP_AIRPORT_LIST), SetFill(1, 0), SetDataTip(0x501, STR_STATION_BUILD_AIRPORT_TOOLTIP), SetScrollbar(WID_AP_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_AP_SCROLLBAR), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, BAIRW_LAYOUT_DECREASE), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE, STR_NULL), - NWidget(WWT_LABEL, COLOUR_GREY, BAIRW_LAYOUT_NUM), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NULL), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, BAIRW_LAYOUT_INCREASE), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE, STR_NULL), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_DECREASE), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE, STR_NULL), + NWidget(WWT_LABEL, COLOUR_GREY, WID_AP_LAYOUT_NUM), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NULL), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_INCREASE), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE, STR_NULL), EndContainer(), - NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, BAIRW_AIRPORT_SPRITE), SetFill(1, 0), - NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, BAIRW_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0), + NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_AIRPORT_SPRITE), SetFill(1, 0), + NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0), EndContainer(), /* Bottom panel. */ - NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BAIRW_BOTTOMPANEL), SetPIP(2, 2, 2), + NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_AP_BOTTOMPANEL), SetPIP(2, 2, 2), NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetFill(1, 0), NWidget(NWID_HORIZONTAL), NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_TEXTBTN, COLOUR_GREY, BAIRW_BTN_DONTHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DONTHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP), - NWidget(WWT_TEXTBTN, COLOUR_GREY, BAIRW_BTN_DOHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DOHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0), diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 2b34206d5..9456b0f4f 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -202,8 +202,8 @@ public: this->sel_engine[1] = INVALID_ENGINE; this->CreateNestedTree(desc); - this->vscroll[0] = this->GetScrollbar(RVW_WIDGET_LEFT_SCROLLBAR); - this->vscroll[1] = this->GetScrollbar(RVW_WIDGET_RIGHT_SCROLLBAR); + this->vscroll[0] = this->GetScrollbar(WID_RV_LEFT_SCROLLBAR); + this->vscroll[1] = this->GetScrollbar(WID_RV_RIGHT_SCROLLBAR); this->FinishInitNested(desc, vehicletype); this->owner = _local_company; @@ -213,18 +213,18 @@ public: virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case RVW_WIDGET_LEFT_MATRIX: - case RVW_WIDGET_RIGHT_MATRIX: + case WID_RV_LEFT_MATRIX: + case WID_RV_RIGHT_MATRIX: resize->height = GetEngineListHeight((VehicleType)this->window_number); size->height = (this->window_number <= VEH_ROAD ? 8 : 4) * resize->height; break; - case RVW_WIDGET_LEFT_DETAILS: - case RVW_WIDGET_RIGHT_DETAILS: + case WID_RV_LEFT_DETAILS: + case WID_RV_RIGHT_DETAILS: size->height = this->details_height; break; - case RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE: { + case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: { StringID str = this->GetWidget<NWidgetCore>(widget)->widget_data; SetDParam(0, STR_CONFIG_SETTING_ON); Dimension d = GetStringBoundingBox(str); @@ -236,7 +236,7 @@ public: break; } - case RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE: { + case WID_RV_TRAIN_ENGINEWAGON_TOGGLE: { StringID str = this->GetWidget<NWidgetCore>(widget)->widget_data; SetDParam(0, STR_REPLACE_ENGINES); Dimension d = GetStringBoundingBox(str); @@ -248,7 +248,7 @@ public: break; } - case RVW_WIDGET_INFO_TAB: { + case WID_RV_INFO_TAB: { SetDParam(0, STR_REPLACE_NOT_REPLACING); Dimension d = GetStringBoundingBox(STR_BLACK_STRING); SetDParam(0, STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED); @@ -259,7 +259,7 @@ public: break; } - case RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN: { + case WID_RV_TRAIN_RAILTYPE_DROPDOWN: { Dimension d = {0, 0}; for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) { const RailtypeInfo *rti = GetRailTypeInfo(rt); @@ -278,17 +278,17 @@ public: virtual void SetStringParameters(int widget) const { switch (widget) { - case RVW_WIDGET_CAPTION: + case WID_RV_CAPTION: SetDParam(0, STR_REPLACE_VEHICLE_TRAIN + this->window_number); break; - case RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE: { + case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: { const Company *c = Company::Get(_local_company); SetDParam(0, c->settings.renew_keep_length ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF); break; } - case RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE: + case WID_RV_TRAIN_ENGINEWAGON_TOGGLE: SetDParam(0, this->replace_engines ? STR_REPLACE_ENGINES : STR_REPLACE_WAGONS); break; } @@ -297,7 +297,7 @@ public: virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case RVW_WIDGET_INFO_TAB: { + case WID_RV_INFO_TAB: { const Company *c = Company::Get(_local_company); if (this->sel_engine[0] != INVALID_ENGINE) { if (!EngineHasReplacementForCompany(c, this->sel_engine[0], this->sel_group)) { @@ -314,9 +314,9 @@ public: break; } - case RVW_WIDGET_LEFT_MATRIX: - case RVW_WIDGET_RIGHT_MATRIX: { - int side = (widget == RVW_WIDGET_LEFT_MATRIX) ? 0 : 1; + case WID_RV_LEFT_MATRIX: + case WID_RV_RIGHT_MATRIX: { + int side = (widget == WID_RV_LEFT_MATRIX) ? 0 : 1; EngineID start = this->vscroll[side]->GetPosition(); // what is the offset for the start (scrolling) EngineID end = min(this->vscroll[side]->GetCapacity() + start, this->engines[side].Length()); @@ -338,7 +338,7 @@ public: * Either engines list is empty * or The selected replacement engine has a replacement (to prevent loops) * or The right engines list (new replacement) has the existing replacement vehicle selected */ - this->SetWidgetDisabledState(RVW_WIDGET_START_REPLACE, + this->SetWidgetDisabledState(WID_RV_START_REPLACE, this->sel_engine[0] == INVALID_ENGINE || this->sel_engine[1] == INVALID_ENGINE || EngineReplacementForCompany(c, this->sel_engine[1], this->sel_group) != INVALID_ENGINE || @@ -347,7 +347,7 @@ public: /* Disable the "Stop Replacing" button if: * The left engines list (existing vehicle) is empty * or The selected vehicle has no replacement set up */ - this->SetWidgetDisabledState(RVW_WIDGET_STOP_REPLACE, + this->SetWidgetDisabledState(WID_RV_STOP_REPLACE, this->sel_engine[0] == INVALID_ENGINE || !EngineHasReplacementForCompany(c, this->sel_engine[0], this->sel_group)); @@ -356,11 +356,11 @@ public: if (this->window_number == VEH_TRAIN) { /* sets the colour of that art thing */ - this->GetWidget<NWidgetCore>(RVW_WIDGET_TRAIN_FLUFF_LEFT)->colour = _company_colours[_local_company]; - this->GetWidget<NWidgetCore>(RVW_WIDGET_TRAIN_FLUFF_RIGHT)->colour = _company_colours[_local_company]; + this->GetWidget<NWidgetCore>(WID_RV_TRAIN_FLUFF_LEFT)->colour = _company_colours[_local_company]; + this->GetWidget<NWidgetCore>(WID_RV_TRAIN_FLUFF_RIGHT)->colour = _company_colours[_local_company]; /* Show the selected railtype in the pulldown menu */ - this->GetWidget<NWidgetCore>(RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN)->widget_data = GetRailTypeInfo(sel_railtype)->strings.replace_text; + this->GetWidget<NWidgetCore>(WID_RV_TRAIN_RAILTYPE_DROPDOWN)->widget_data = GetRailTypeInfo(sel_railtype)->strings.replace_text; } this->DrawWidgets(); @@ -370,7 +370,7 @@ public: /* Draw details panels. */ for (int side = 0; side < 2; side++) { if (this->sel_engine[side] != INVALID_ENGINE) { - NWidgetBase *nwi = this->GetWidget<NWidgetBase>(side == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS); + NWidgetBase *nwi = this->GetWidget<NWidgetBase>(side == 0 ? WID_RV_LEFT_DETAILS : WID_RV_RIGHT_DETAILS); int text_end = DrawVehiclePurchaseInfo(nwi->pos_x + WD_FRAMETEXT_LEFT, nwi->pos_x + nwi->current_x - WD_FRAMETEXT_RIGHT, nwi->pos_y + WD_FRAMERECT_TOP, this->sel_engine[side]); needed_height = max(needed_height, text_end - (int)nwi->pos_y + WD_FRAMERECT_BOTTOM); @@ -387,22 +387,22 @@ public: virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE: + case WID_RV_TRAIN_ENGINEWAGON_TOGGLE: this->replace_engines = !(this->replace_engines); this->engines[0].ForceRebuild(); this->reset_sel_engine = true; this->SetDirty(); break; - case RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN: // Railtype selection dropdown menu - ShowDropDownList(this, GetRailTypeDropDownList(true), sel_railtype, RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN); + case WID_RV_TRAIN_RAILTYPE_DROPDOWN: // Railtype selection dropdown menu + ShowDropDownList(this, GetRailTypeDropDownList(true), sel_railtype, WID_RV_TRAIN_RAILTYPE_DROPDOWN); break; - case RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE: // toggle renew_keep_length + case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: // toggle renew_keep_length DoCommandP(0, GetCompanySettingIndex("company.renew_keep_length"), Company::Get(_local_company)->settings.renew_keep_length ? 0 : 1, CMD_CHANGE_COMPANY_SETTING); break; - case RVW_WIDGET_START_REPLACE: { // Start replacing + case WID_RV_START_REPLACE: { // Start replacing EngineID veh_from = this->sel_engine[0]; EngineID veh_to = this->sel_engine[1]; DoCommandP(0, this->sel_group << 16, veh_from + (veh_to << 16), CMD_SET_AUTOREPLACE); @@ -410,17 +410,17 @@ public: break; } - case RVW_WIDGET_STOP_REPLACE: { // Stop replacing + case WID_RV_STOP_REPLACE: { // Stop replacing EngineID veh_from = this->sel_engine[0]; DoCommandP(0, this->sel_group << 16, veh_from + (INVALID_ENGINE << 16), CMD_SET_AUTOREPLACE); this->SetDirty(); break; } - case RVW_WIDGET_LEFT_MATRIX: - case RVW_WIDGET_RIGHT_MATRIX: { + case WID_RV_LEFT_MATRIX: + case WID_RV_RIGHT_MATRIX: { byte click_side; - if (widget == RVW_WIDGET_LEFT_MATRIX) { + if (widget == WID_RV_LEFT_MATRIX) { click_side = 0; } else { click_side = 1; @@ -458,11 +458,11 @@ public: virtual void OnResize() { - this->vscroll[0]->SetCapacityFromWidget(this, RVW_WIDGET_LEFT_MATRIX); - this->vscroll[1]->SetCapacityFromWidget(this, RVW_WIDGET_RIGHT_MATRIX); + this->vscroll[0]->SetCapacityFromWidget(this, WID_RV_LEFT_MATRIX); + this->vscroll[1]->SetCapacityFromWidget(this, WID_RV_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); + this->GetWidget<NWidgetCore>(WID_RV_LEFT_MATRIX)->widget_data = + this->GetWidget<NWidgetCore>(WID_RV_RIGHT_MATRIX)->widget_data = (this->vscroll[0]->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); } /** @@ -484,32 +484,32 @@ public: 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), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_RV_CAPTION), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(RVW_WIDGET_LEFT_SCROLLBAR), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, RVW_WIDGET_LEFT_SCROLLBAR), - NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(RVW_WIDGET_RIGHT_SCROLLBAR), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, RVW_WIDGET_RIGHT_SCROLLBAR), + NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_LEFT_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_LEFT_SCROLLBAR), + NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_RIGHT_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_RIGHT_SCROLLBAR), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_LEFT_DETAILS), SetMinimalSize(228, 102), SetResize(1, 0), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_RIGHT_DETAILS), SetMinimalSize(228, 102), SetResize(1, 0), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_LEFT_DETAILS), SetMinimalSize(228, 102), SetResize(1, 0), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_RIGHT_DETAILS), SetMinimalSize(228, 102), SetResize(1, 0), EndContainer(), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, RVW_WIDGET_START_REPLACE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON), - NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_INFO_TAB), SetMinimalSize(167, 12), SetDataTip(0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_START_REPLACE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON), + NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_INFO_TAB), SetMinimalSize(167, 12), SetDataTip(0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB), SetResize(1, 0), EndContainer(), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, RVW_WIDGET_STOP_REPLACE), SetMinimalSize(150, 12), SetDataTip(STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_STOP_REPLACE), SetMinimalSize(150, 12), SetDataTip(STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_ENGINE_WAGON_SELECT, STR_REPLACE_ENGINE_WAGON_SELECT_HELP), - NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_TRAIN_FLUFF_LEFT), SetMinimalSize(15, 12), EndContainer(), - NWidget(WWT_DROPDOWN, COLOUR_GREY, RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN), SetMinimalSize(136, 12), SetDataTip(0x0, STR_REPLACE_HELP_RAILTYPE), SetResize(1, 0), - NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_TRAIN_FLUFF_RIGHT), SetMinimalSize(16, 12), EndContainer(), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE), SetMinimalSize(138, 12), SetDataTip(STR_REPLACE_REMOVE_WAGON, STR_REPLACE_REMOVE_WAGON_HELP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_TRAIN_ENGINEWAGON_TOGGLE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_ENGINE_WAGON_SELECT, STR_REPLACE_ENGINE_WAGON_SELECT_HELP), + NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_TRAIN_FLUFF_LEFT), SetMinimalSize(15, 12), EndContainer(), + NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_TRAIN_RAILTYPE_DROPDOWN), SetMinimalSize(136, 12), SetDataTip(0x0, STR_REPLACE_HELP_RAILTYPE), SetResize(1, 0), + NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_TRAIN_FLUFF_RIGHT), SetMinimalSize(16, 12), EndContainer(), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_TRAIN_WAGONREMOVE_TOGGLE), SetMinimalSize(138, 12), SetDataTip(STR_REPLACE_REMOVE_WAGON, STR_REPLACE_REMOVE_WAGON_HELP), NWidget(WWT_RESIZEBOX, COLOUR_GREY), EndContainer(), }; @@ -524,24 +524,24 @@ static const WindowDesc _replace_rail_vehicle_desc( static const NWidgetPart _nested_replace_vehicle_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, RVW_WIDGET_CAPTION), SetMinimalSize(433, 14), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_RV_CAPTION), SetMinimalSize(433, 14), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(RVW_WIDGET_LEFT_SCROLLBAR), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, RVW_WIDGET_LEFT_SCROLLBAR), - NWidget(WWT_MATRIX, COLOUR_GREY, RVW_WIDGET_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(RVW_WIDGET_RIGHT_SCROLLBAR), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, RVW_WIDGET_RIGHT_SCROLLBAR), + NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_LEFT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_LEFT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_LEFT_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_LEFT_SCROLLBAR), + NWidget(WWT_MATRIX, COLOUR_GREY, WID_RV_RIGHT_MATRIX), SetMinimalSize(216, 0), SetFill(1, 1), SetDataTip(0x1, STR_REPLACE_HELP_RIGHT_ARRAY), SetResize(1, 1), SetScrollbar(WID_RV_RIGHT_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_RV_RIGHT_SCROLLBAR), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_LEFT_DETAILS), SetMinimalSize(228, 92), SetResize(1, 0), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_RIGHT_DETAILS), SetMinimalSize(228, 92), SetResize(1, 0), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_LEFT_DETAILS), SetMinimalSize(228, 92), SetResize(1, 0), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_RIGHT_DETAILS), SetMinimalSize(228, 92), SetResize(1, 0), EndContainer(), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, RVW_WIDGET_START_REPLACE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON), - NWidget(WWT_PANEL, COLOUR_GREY, RVW_WIDGET_INFO_TAB), SetMinimalSize(167, 12), SetDataTip(0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB), SetResize(1, 0), EndContainer(), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, RVW_WIDGET_STOP_REPLACE), SetMinimalSize(138, 12), SetDataTip(STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_START_REPLACE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON), + NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_INFO_TAB), SetMinimalSize(167, 12), SetDataTip(0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB), SetResize(1, 0), EndContainer(), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_STOP_REPLACE), SetMinimalSize(138, 12), SetDataTip(STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON), NWidget(WWT_RESIZEBOX, COLOUR_GREY), EndContainer(), }; diff --git a/src/bootstrap_gui.cpp b/src/bootstrap_gui.cpp index 7a54c558e..ef3d1e69d 100644 --- a/src/bootstrap_gui.cpp +++ b/src/bootstrap_gui.cpp @@ -108,10 +108,10 @@ static const NWidgetPart _bootstrap_query_widgets[] = { NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_MISSING_GRAPHICS_SET_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY), - NWidget(WWT_PANEL, COLOUR_GREY, BAFDW_QUESTION), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BAFD_QUESTION), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BAFDW_YES), SetDataTip(STR_MISSING_GRAPHICS_YES_DOWNLOAD, STR_NULL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BAFDW_NO), SetDataTip(STR_MISSING_GRAPHICS_NO_QUIT, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BAFD_YES), SetDataTip(STR_MISSING_GRAPHICS_YES_DOWNLOAD, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BAFD_NO), SetDataTip(STR_MISSING_GRAPHICS_NO_QUIT, STR_NULL), EndContainer(), EndContainer(), }; @@ -152,14 +152,14 @@ public: } switch (widget) { - case BAFDW_QUESTION: + case WID_BAFD_QUESTION: /* The question is twice as wide as the buttons, and determine the height based on the width. */ size->width = this->button_size.width * 2; size->height = GetStringHeight(STR_MISSING_GRAPHICS_SET_MESSAGE, size->width - WD_FRAMETEXT_LEFT - WD_FRAMETEXT_RIGHT) + WD_FRAMETEXT_BOTTOM + WD_FRAMETEXT_TOP; break; - case BAFDW_YES: - case BAFDW_NO: + case WID_BAFD_YES: + case WID_BAFD_NO: *size = this->button_size; break; } @@ -175,12 +175,12 @@ public: virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case BAFDW_YES: + case WID_BAFD_YES: /* We got permission to connect! Yay! */ _network_content_client.Connect(); break; - case BAFDW_NO: + case WID_BAFD_NO: _exit_game = true; break; diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index e3065d071..88473b71c 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -88,7 +88,7 @@ private: TileIndex end_tile; uint32 type; GUIBridgeList *bridges; - int bridgetext_offset; ///< Horizontal offset of the text describing the bridge properties in #BBSW_BRIDGE_LIST relative to the left edge. + int bridgetext_offset; ///< Horizontal offset of the text describing the bridge properties in #WID_BBS_BRIDGE_LIST relative to the left edge. Scrollbar *vscroll; /** Sort the bridges by their index */ @@ -126,11 +126,11 @@ private: this->bridges->Sort(); /* Display the current sort variant */ - this->GetWidget<NWidgetCore>(BBSW_DROPDOWN_CRITERIA)->widget_data = this->sorter_names[this->bridges->SortType()]; + this->GetWidget<NWidgetCore>(WID_BBS_DROPDOWN_CRITERIA)->widget_data = this->sorter_names[this->bridges->SortType()]; /* Set the modified widgets dirty */ - this->SetWidgetDirty(BBSW_DROPDOWN_CRITERIA); - this->SetWidgetDirty(BBSW_BRIDGE_LIST); + this->SetWidgetDirty(WID_BBS_DROPDOWN_CRITERIA); + this->SetWidgetDirty(WID_BBS_BRIDGE_LIST); } public: @@ -141,9 +141,9 @@ public: bridges(bl) { this->CreateNestedTree(desc); - this->vscroll = this->GetScrollbar(BBSW_SCROLLBAR); + this->vscroll = this->GetScrollbar(WID_BBS_SCROLLBAR); /* Change the data, or the caption of the gui. Set it to road or rail, accordingly. */ - this->GetWidget<NWidgetCore>(BBSW_CAPTION)->widget_data = (GB(this->type, 15, 2) == TRANSPORT_ROAD) ? STR_SELECT_ROAD_BRIDGE_CAPTION : STR_SELECT_RAIL_BRIDGE_CAPTION; + this->GetWidget<NWidgetCore>(WID_BBS_CAPTION)->widget_data = (GB(this->type, 15, 2) == TRANSPORT_ROAD) ? STR_SELECT_ROAD_BRIDGE_CAPTION : STR_SELECT_RAIL_BRIDGE_CAPTION; this->FinishInitNested(desc, GB(br_type, 15, 2)); // Initializes 'this->bridgetext_offset'. this->parent = FindWindowById(WC_BUILD_TOOLBAR, GB(this->type, 15, 2)); @@ -159,7 +159,7 @@ public: if (this->last_size > this->vscroll->GetCapacity()) { ResizeWindow(this, 0, (this->last_size - this->vscroll->GetCapacity()) * this->resize.step_height); } - this->GetWidget<NWidgetCore>(BBSW_BRIDGE_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); + this->GetWidget<NWidgetCore>(WID_BBS_BRIDGE_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); } ~BuildBridgeWindow() @@ -172,14 +172,14 @@ public: virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case BBSW_DROPDOWN_ORDER: { + case WID_BBS_DROPDOWN_ORDER: { Dimension d = GetStringBoundingBox(this->GetWidget<NWidgetCore>(widget)->widget_data); d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better. d.height += padding.height; *size = maxdim(*size, d); break; } - case BBSW_DROPDOWN_CRITERIA: { + case WID_BBS_DROPDOWN_CRITERIA: { Dimension d = {0, 0}; for (const StringID *str = this->sorter_names; *str != INVALID_STRING_ID; str++) { d = maxdim(d, GetStringBoundingBox(*str)); @@ -189,7 +189,7 @@ public: *size = maxdim(*size, d); break; } - case BBSW_BRIDGE_LIST: { + case WID_BBS_BRIDGE_LIST: { Dimension sprite_dim = {0, 0}; // Biggest bridge sprite dimension Dimension text_dim = {0, 0}; // Biggest text dimension for (int i = 0; i < (int)this->bridges->Length(); i++) { @@ -216,7 +216,7 @@ public: virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number) { /* Position the window so hopefully the first bridge from the list is under the mouse pointer. */ - NWidgetBase *list = this->GetWidget<NWidgetBase>(BBSW_BRIDGE_LIST); + NWidgetBase *list = this->GetWidget<NWidgetBase>(WID_BBS_BRIDGE_LIST); Point corner; // point of the top left corner of the window. corner.y = Clamp(_cursor.pos.y - list->pos_y - 5, GetMainViewTop(), GetMainViewBottom() - sm_height); corner.x = Clamp(_cursor.pos.x - list->pos_x - 5, 0, _screen.width - sm_width); @@ -226,11 +226,11 @@ public: virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case BBSW_DROPDOWN_ORDER: + case WID_BBS_DROPDOWN_ORDER: this->DrawSortButtonState(widget, this->bridges->IsDescSortOrder() ? SBS_DOWN : SBS_UP); break; - case BBSW_BRIDGE_LIST: { + case WID_BBS_BRIDGE_LIST: { uint y = r.top; for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < (int)this->bridges->Length(); i++) { const BridgeSpec *b = this->bridges->Get(i)->spec; @@ -265,8 +265,8 @@ public: { switch (widget) { default: break; - case BBSW_BRIDGE_LIST: { - uint i = this->vscroll->GetScrolledRowFromWidget(pt.y, this, BBSW_BRIDGE_LIST); + case WID_BBS_BRIDGE_LIST: { + uint i = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_BBS_BRIDGE_LIST); if (i < this->bridges->Length()) { this->BuildBridge(i); delete this; @@ -274,20 +274,20 @@ public: break; } - case BBSW_DROPDOWN_ORDER: + case WID_BBS_DROPDOWN_ORDER: this->bridges->ToggleSortOrder(); this->SetDirty(); break; - case BBSW_DROPDOWN_CRITERIA: - ShowDropDownMenu(this, this->sorter_names, this->bridges->SortType(), BBSW_DROPDOWN_CRITERIA, 0, 0); + case WID_BBS_DROPDOWN_CRITERIA: + ShowDropDownMenu(this, this->sorter_names, this->bridges->SortType(), WID_BBS_DROPDOWN_CRITERIA, 0, 0); break; } } virtual void OnDropdownSelect(int widget, int index) { - if (widget == BBSW_DROPDOWN_CRITERIA && this->bridges->SortType() != index) { + if (widget == WID_BBS_DROPDOWN_CRITERIA && this->bridges->SortType() != index) { this->bridges->SetSortType(index); this->SortBridgeList(); @@ -296,8 +296,8 @@ public: virtual void OnResize() { - this->vscroll->SetCapacityFromWidget(this, BBSW_BRIDGE_LIST); - this->GetWidget<NWidgetCore>(BBSW_BRIDGE_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); + this->vscroll->SetCapacityFromWidget(this, WID_BBS_BRIDGE_LIST); + this->GetWidget<NWidgetCore>(WID_BBS_BRIDGE_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); this->last_size = max(this->vscroll->GetCapacity(), this->last_size); } @@ -328,23 +328,23 @@ static const NWidgetPart _nested_build_bridge_widgets[] = { /* Header */ NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), - NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, BBSW_CAPTION), SetDataTip(STR_SELECT_RAIL_BRIDGE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_BBS_CAPTION), SetDataTip(STR_SELECT_RAIL_BRIDGE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(NWID_VERTICAL), /* Sort order + criteria buttons */ NWidget(NWID_HORIZONTAL), - NWidget(WWT_TEXTBTN, COLOUR_DARK_GREEN, BBSW_DROPDOWN_ORDER), SetFill(1, 0), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), - NWidget(WWT_DROPDOWN, COLOUR_DARK_GREEN, BBSW_DROPDOWN_CRITERIA), SetFill(1, 0), SetDataTip(0x0, STR_TOOLTIP_SORT_CRITERIA), + NWidget(WWT_TEXTBTN, COLOUR_DARK_GREEN, WID_BBS_DROPDOWN_ORDER), SetFill(1, 0), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), + NWidget(WWT_DROPDOWN, COLOUR_DARK_GREEN, WID_BBS_DROPDOWN_CRITERIA), SetFill(1, 0), SetDataTip(0x0, STR_TOOLTIP_SORT_CRITERIA), EndContainer(), /* Matrix. */ - NWidget(WWT_MATRIX, COLOUR_DARK_GREEN, BBSW_BRIDGE_LIST), SetFill(1, 0), SetResize(0, 22), SetDataTip(0x401, STR_SELECT_BRIDGE_SELECTION_TOOLTIP), SetScrollbar(BBSW_SCROLLBAR), + NWidget(WWT_MATRIX, COLOUR_DARK_GREEN, WID_BBS_BRIDGE_LIST), SetFill(1, 0), SetResize(0, 22), SetDataTip(0x401, STR_SELECT_BRIDGE_SELECTION_TOOLTIP), SetScrollbar(WID_BBS_SCROLLBAR), EndContainer(), /* scrollbar + resize button */ NWidget(NWID_VERTICAL), - NWidget(NWID_VSCROLLBAR, COLOUR_DARK_GREEN, BBSW_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_DARK_GREEN, WID_BBS_SCROLLBAR), NWidget(WWT_RESIZEBOX, COLOUR_DARK_GREEN), EndContainer(), EndContainer(), diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index fa09be23b..11d73a8c7 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -48,35 +48,35 @@ uint GetEngineListHeight(VehicleType type) static const NWidgetPart _nested_build_vehicle_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, BUILD_VEHICLE_WIDGET_CAPTION), SetDataTip(STR_WHITE_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_BV_CAPTION), SetDataTip(STR_WHITE_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY), NWidget(NWID_HORIZONTAL), NWidget(NWID_VERTICAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BV_SORT_ASSENDING_DESCENDING), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), NWidget(NWID_SPACER), SetFill(1, 1), EndContainer(), NWidget(NWID_VERTICAL), - NWidget(WWT_DROPDOWN, COLOUR_GREY, BUILD_VEHICLE_WIDGET_SORT_DROPDOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA), - NWidget(WWT_DROPDOWN, COLOUR_GREY, BUILD_VEHICLE_WIDGET_CARGO_FILTER_DROPDOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_FILTER_CRITERIA), + NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_BV_SORT_DROPDOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA), + NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_BV_CARGO_FILTER_DROPDOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_FILTER_CRITERIA), EndContainer(), EndContainer(), EndContainer(), /* Vehicle list. */ NWidget(NWID_HORIZONTAL), - NWidget(WWT_MATRIX, COLOUR_GREY, BUILD_VEHICLE_WIDGET_LIST), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x101, STR_NULL), SetScrollbar(BUILD_VEHICLE_WIDGET_SCROLLBAR), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, BUILD_VEHICLE_WIDGET_SCROLLBAR), + NWidget(WWT_MATRIX, COLOUR_GREY, WID_BV_LIST), SetResize(1, 1), SetFill(1, 0), SetDataTip(0x101, STR_NULL), SetScrollbar(WID_BV_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_BV_SCROLLBAR), EndContainer(), /* Panel with details. */ - NWidget(WWT_PANEL, COLOUR_GREY, BUILD_VEHICLE_WIDGET_PANEL), SetMinimalSize(240, 122), SetResize(1, 0), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_BV_PANEL), SetMinimalSize(240, 122), SetResize(1, 0), EndContainer(), /* Build/rename buttons, resize button. */ NWidget(NWID_HORIZONTAL), - NWidget(NWID_SELECTION, INVALID_COLOUR, BUILD_VEHICLE_WIDGET_BUILD_SEL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BUILD_VEHICLE_WIDGET_BUILD), SetResize(1, 0), SetFill(1, 0), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BV_BUILD_SEL), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BV_BUILD), SetResize(1, 0), SetFill(1, 0), EndContainer(), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BUILD_VEHICLE_WIDGET_RENAME), SetResize(1, 0), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BV_RENAME), SetResize(1, 0), SetFill(1, 0), NWidget(WWT_RESIZEBOX, COLOUR_GREY), EndContainer(), }; @@ -950,20 +950,20 @@ struct BuildVehicleWindow : Window { this->CreateNestedTree(desc); - this->vscroll = this->GetScrollbar(BUILD_VEHICLE_WIDGET_SCROLLBAR); + this->vscroll = this->GetScrollbar(WID_BV_SCROLLBAR); /* If we are just viewing the list of vehicles, we do not need the Build button. * So we just hide it, and enlarge the Rename buton by the now vacant place. */ - if (this->listview_mode) this->GetWidget<NWidgetStacked>(BUILD_VEHICLE_WIDGET_BUILD_SEL)->SetDisplayedPlane(SZSP_NONE); + if (this->listview_mode) this->GetWidget<NWidgetStacked>(WID_BV_BUILD_SEL)->SetDisplayedPlane(SZSP_NONE); - NWidgetCore *widget = this->GetWidget<NWidgetCore>(BUILD_VEHICLE_WIDGET_LIST); + NWidgetCore *widget = this->GetWidget<NWidgetCore>(WID_BV_LIST); widget->tool_tip = STR_BUY_VEHICLE_TRAIN_LIST_TOOLTIP + type; - widget = this->GetWidget<NWidgetCore>(BUILD_VEHICLE_WIDGET_BUILD); + widget = this->GetWidget<NWidgetCore>(WID_BV_BUILD); widget->widget_data = STR_BUY_VEHICLE_TRAIN_BUY_VEHICLE_BUTTON + type; widget->tool_tip = STR_BUY_VEHICLE_TRAIN_BUY_VEHICLE_TOOLTIP + type; - widget = this->GetWidget<NWidgetCore>(BUILD_VEHICLE_WIDGET_RENAME); + widget = this->GetWidget<NWidgetCore>(WID_BV_RENAME); widget->widget_data = STR_BUY_VEHICLE_TRAIN_RENAME_BUTTON + type; widget->tool_tip = STR_BUY_VEHICLE_TRAIN_RENAME_TOOLTIP + type; @@ -1194,23 +1194,23 @@ struct BuildVehicleWindow : Window { void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING: + case WID_BV_SORT_ASSENDING_DESCENDING: this->descending_sort_order ^= true; _last_sort_order[this->vehicle_type] = this->descending_sort_order; this->eng_list.ForceRebuild(); this->SetDirty(); break; - case BUILD_VEHICLE_WIDGET_LIST: { - uint i = this->vscroll->GetScrolledRowFromWidget(pt.y, this, BUILD_VEHICLE_WIDGET_LIST); + case WID_BV_LIST: { + uint i = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_BV_LIST); size_t num_items = this->eng_list.Length(); this->sel_engine = (i < num_items) ? this->eng_list[i] : INVALID_ENGINE; this->SetDirty(); - if (click_count > 1 && !this->listview_mode) this->OnClick(pt, BUILD_VEHICLE_WIDGET_BUILD, 1); + if (click_count > 1 && !this->listview_mode) this->OnClick(pt, WID_BV_BUILD, 1); break; } - case BUILD_VEHICLE_WIDGET_SORT_DROPDOWN: { // Select sorting criteria dropdown menu + case WID_BV_SORT_DROPDOWN: { // Select sorting criteria dropdown menu uint32 hidden_mask = 0; /* Disable sorting by power or tractive effort when the original acceleration model for road vehicles is being used. */ if (this->vehicle_type == VEH_ROAD && @@ -1224,15 +1224,15 @@ struct BuildVehicleWindow : Window { _settings_game.vehicle.train_acceleration_model == AM_ORIGINAL) { SetBit(hidden_mask, 4); // tractive effort } - ShowDropDownMenu(this, _sort_listing[this->vehicle_type], this->sort_criteria, BUILD_VEHICLE_WIDGET_SORT_DROPDOWN, 0, hidden_mask); + ShowDropDownMenu(this, _sort_listing[this->vehicle_type], this->sort_criteria, WID_BV_SORT_DROPDOWN, 0, hidden_mask); break; } - case BUILD_VEHICLE_WIDGET_CARGO_FILTER_DROPDOWN: // Select cargo filtering criteria dropdown menu - ShowDropDownMenu(this, this->cargo_filter_texts, this->cargo_filter_criteria, BUILD_VEHICLE_WIDGET_CARGO_FILTER_DROPDOWN, 0, 0); + case WID_BV_CARGO_FILTER_DROPDOWN: // Select cargo filtering criteria dropdown menu + ShowDropDownMenu(this, this->cargo_filter_texts, this->cargo_filter_criteria, WID_BV_CARGO_FILTER_DROPDOWN, 0, 0); break; - case BUILD_VEHICLE_WIDGET_BUILD: { + case WID_BV_BUILD: { EngineID sel_eng = this->sel_engine; if (sel_eng != INVALID_ENGINE) { CommandCallback *callback = (this->vehicle_type == VEH_TRAIN && RailVehInfo(sel_eng)->railveh_type == RAILVEH_WAGON) ? CcBuildWagon : CcBuildPrimaryVehicle; @@ -1241,7 +1241,7 @@ struct BuildVehicleWindow : Window { break; } - case BUILD_VEHICLE_WIDGET_RENAME: { + case WID_BV_RENAME: { EngineID sel_eng = this->sel_engine; if (sel_eng != INVALID_ENGINE) { this->rename_engine = sel_eng; @@ -1274,7 +1274,7 @@ struct BuildVehicleWindow : Window { virtual void SetStringParameters(int widget) const { switch (widget) { - case BUILD_VEHICLE_WIDGET_CAPTION: + case WID_BV_CAPTION: if (this->vehicle_type == VEH_TRAIN && !this->listview_mode) { const RailtypeInfo *rti = GetRailTypeInfo(this->filter.railtype); SetDParam(0, rti->strings.build_caption); @@ -1283,11 +1283,11 @@ struct BuildVehicleWindow : Window { } break; - case BUILD_VEHICLE_WIDGET_SORT_DROPDOWN: + case WID_BV_SORT_DROPDOWN: SetDParam(0, _sort_listing[this->vehicle_type][this->sort_criteria]); break; - case BUILD_VEHICLE_WIDGET_CARGO_FILTER_DROPDOWN: + case WID_BV_CARGO_FILTER_DROPDOWN: SetDParam(0, this->cargo_filter_texts[this->cargo_filter_criteria]); } } @@ -1295,16 +1295,16 @@ struct BuildVehicleWindow : Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case BUILD_VEHICLE_WIDGET_LIST: + case WID_BV_LIST: resize->height = GetEngineListHeight(this->vehicle_type); size->height = 3 * resize->height; break; - case BUILD_VEHICLE_WIDGET_PANEL: + case WID_BV_PANEL: size->height = this->details_height; break; - case BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING: { + case WID_BV_SORT_ASSENDING_DESCENDING: { Dimension d = GetStringBoundingBox(this->GetWidget<NWidgetCore>(widget)->widget_data); d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better. d.height += padding.height; @@ -1317,12 +1317,12 @@ struct BuildVehicleWindow : Window { virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case BUILD_VEHICLE_WIDGET_LIST: + case WID_BV_LIST: DrawEngineList(this->vehicle_type, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, &this->eng_list, this->vscroll->GetPosition(), min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->eng_list.Length()), this->sel_engine, false, DEFAULT_GROUP); break; - case BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING: - this->DrawSortButtonState(BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING, this->descending_sort_order ? SBS_DOWN : SBS_UP); + case WID_BV_SORT_ASSENDING_DESCENDING: + this->DrawSortButtonState(WID_BV_SORT_ASSENDING_DESCENDING, this->descending_sort_order ? SBS_DOWN : SBS_UP); break; } } @@ -1338,7 +1338,7 @@ struct BuildVehicleWindow : Window { int needed_height = this->details_height; /* Draw details panels. */ if (this->sel_engine != INVALID_ENGINE) { - NWidgetBase *nwi = this->GetWidget<NWidgetBase>(BUILD_VEHICLE_WIDGET_PANEL); + NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_BV_PANEL); int text_end = DrawVehiclePurchaseInfo(nwi->pos_x + WD_FRAMETEXT_LEFT, nwi->pos_x + nwi->current_x - WD_FRAMETEXT_RIGHT, nwi->pos_y + WD_FRAMERECT_TOP, this->sel_engine); needed_height = max(needed_height, text_end - (int)nwi->pos_y + WD_FRAMERECT_BOTTOM); @@ -1362,7 +1362,7 @@ struct BuildVehicleWindow : Window { virtual void OnDropdownSelect(int widget, int index) { switch (widget) { - case BUILD_VEHICLE_WIDGET_SORT_DROPDOWN: + case WID_BV_SORT_DROPDOWN: if (this->sort_criteria != index) { this->sort_criteria = index; _last_sort_criteria[this->vehicle_type] = this->sort_criteria; @@ -1370,7 +1370,7 @@ struct BuildVehicleWindow : Window { } break; - case BUILD_VEHICLE_WIDGET_CARGO_FILTER_DROPDOWN: // Select a cargo filter criteria + case WID_BV_CARGO_FILTER_DROPDOWN: // Select a cargo filter criteria if (this->cargo_filter_criteria != index) { this->cargo_filter_criteria = index; _last_filter_criteria[this->vehicle_type] = this->cargo_filter[this->cargo_filter_criteria]; @@ -1385,8 +1385,8 @@ struct BuildVehicleWindow : Window { virtual void OnResize() { - this->vscroll->SetCapacityFromWidget(this, BUILD_VEHICLE_WIDGET_LIST); - this->GetWidget<NWidgetCore>(BUILD_VEHICLE_WIDGET_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); + this->vscroll->SetCapacityFromWidget(this, WID_BV_LIST); + this->GetWidget<NWidgetCore>(WID_BV_LIST)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); } }; diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index 093d36b59..5af16a4be 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -187,7 +187,7 @@ static const NWidgetPart _nested_cheat_widgets[] = { NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, CW_PANEL), SetDataTip(0x0, STR_CHEATS_TOOLTIP), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_C_PANEL), SetDataTip(0x0, STR_CHEATS_TOOLTIP), EndContainer(), }; /** GUI for the cheats. */ @@ -202,7 +202,7 @@ struct CheatWindow : Window { virtual void DrawWidget(const Rect &r, int widget) const { - if (widget != CW_PANEL) return; + if (widget != WID_C_PANEL) return; int y = r.top + WD_FRAMERECT_TOP + this->header_height; DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP, y, STR_CHEATS_WARNING, TC_FROMSTRING, SA_CENTER); @@ -265,7 +265,7 @@ struct CheatWindow : Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget != CW_PANEL) return; + if (widget != WID_C_PANEL) return; uint width = 0; for (int i = 0; i != lengthof(_cheats_ui); i++) { @@ -316,7 +316,7 @@ struct CheatWindow : Window { virtual void OnClick(Point pt, int widget, int click_count) { - const NWidgetBase *wid = this->GetWidget<NWidgetBase>(CW_PANEL); + const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_C_PANEL); uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) / (FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL); uint x = pt.x - wid->pos_x; bool rtl = _current_text_dir == TD_RTL; diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 312114fb7..ff6fce62d 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -218,18 +218,18 @@ static void DrawYearColumn(const Rect &r, int year, const Money (*tbl)[EXPENSES_ static const NWidgetPart _nested_company_finances_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, CFW_CAPTION), SetDataTip(STR_FINANCES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), - NWidget(WWT_IMGBTN, COLOUR_GREY, CFW_TOGGLE_SIZE), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_TOOLTIP_TOGGLE_LARGE_SMALL_WINDOW), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_CF_CAPTION), SetDataTip(STR_FINANCES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_CF_TOGGLE_SIZE), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_TOOLTIP_TOGGLE_LARGE_SMALL_WINDOW), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), - NWidget(NWID_SELECTION, INVALID_COLOUR, CFW_SEL_PANEL), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_CF_SEL_PANEL), NWidget(WWT_PANEL, COLOUR_GREY), NWidget(NWID_HORIZONTAL), SetPadding(WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT), SetPIP(0, 9, 0), - NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_CATEGORY), SetMinimalSize(120, 0), SetFill(0, 0), - NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE1), SetMinimalSize(86, 0), SetFill(0, 0), - NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE2), SetMinimalSize(86, 0), SetFill(0, 0), - NWidget(WWT_EMPTY, COLOUR_GREY, CFW_EXPS_PRICE3), SetMinimalSize(86, 0), SetFill(0, 0), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CF_EXPS_CATEGORY), SetMinimalSize(120, 0), SetFill(0, 0), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CF_EXPS_PRICE1), SetMinimalSize(86, 0), SetFill(0, 0), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CF_EXPS_PRICE2), SetMinimalSize(86, 0), SetFill(0, 0), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CF_EXPS_PRICE3), SetMinimalSize(86, 0), SetFill(0, 0), EndContainer(), EndContainer(), EndContainer(), @@ -242,17 +242,17 @@ static const NWidgetPart _nested_company_finances_widgets[] = { EndContainer(), NWidget(NWID_SPACER), SetFill(0, 0), SetMinimalSize(30, 0), NWidget(NWID_VERTICAL), // Vertical column with bank balance amount, loan amount, and total. - NWidget(WWT_TEXT, COLOUR_GREY, CFW_BALANCE_VALUE), SetDataTip(STR_NULL, STR_NULL), - NWidget(WWT_TEXT, COLOUR_GREY, CFW_LOAN_VALUE), SetDataTip(STR_NULL, STR_NULL), - NWidget(WWT_EMPTY, COLOUR_GREY, CFW_LOAN_LINE), SetMinimalSize(0, 2), SetFill(1, 0), - NWidget(WWT_TEXT, COLOUR_GREY, CFW_TOTAL_VALUE), SetDataTip(STR_NULL, STR_NULL), + NWidget(WWT_TEXT, COLOUR_GREY, WID_CF_BALANCE_VALUE), SetDataTip(STR_NULL, STR_NULL), + NWidget(WWT_TEXT, COLOUR_GREY, WID_CF_LOAN_VALUE), SetDataTip(STR_NULL, STR_NULL), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CF_LOAN_LINE), SetMinimalSize(0, 2), SetFill(1, 0), + NWidget(WWT_TEXT, COLOUR_GREY, WID_CF_TOTAL_VALUE), SetDataTip(STR_NULL, STR_NULL), EndContainer(), - NWidget(NWID_SELECTION, INVALID_COLOUR, CFW_SEL_MAXLOAN), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_CF_SEL_MAXLOAN), NWidget(NWID_HORIZONTAL), NWidget(NWID_SPACER), SetFill(0, 1), SetMinimalSize(25, 0), NWidget(NWID_VERTICAL), // Max loan information - NWidget(WWT_EMPTY, COLOUR_GREY, CFW_MAXLOAN_GAP), SetFill(0, 0), - NWidget(WWT_TEXT, COLOUR_GREY, CFW_MAXLOAN_VALUE), SetDataTip(STR_FINANCES_MAX_LOAN, STR_NULL), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CF_MAXLOAN_GAP), SetFill(0, 0), + NWidget(WWT_TEXT, COLOUR_GREY, WID_CF_MAXLOAN_VALUE), SetDataTip(STR_FINANCES_MAX_LOAN, STR_NULL), NWidget(NWID_SPACER), SetFill(0, 1), EndContainer(), EndContainer(), @@ -260,11 +260,11 @@ static const NWidgetPart _nested_company_finances_widgets[] = { NWidget(NWID_SPACER), SetFill(1, 1), EndContainer(), EndContainer(), - NWidget(NWID_SELECTION, INVALID_COLOUR, CFW_SEL_BUTTONS), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_CF_SEL_BUTTONS), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_INCREASE_LOAN), SetFill(1, 0), SetDataTip(STR_FINANCES_BORROW_BUTTON, STR_FINANCES_BORROW_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_REPAY_LOAN), SetFill(1, 0), SetDataTip(STR_FINANCES_REPAY_BUTTON, STR_FINANCES_REPAY_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CFW_INFRASTRUCTURE), SetFill(1, 0), SetDataTip(STR_FINANCES_INFRASTRUCTURE_BUTTON, STR_COMPANY_VIEW_INFRASTRUCTURE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CF_INCREASE_LOAN), SetFill(1, 0), SetDataTip(STR_FINANCES_BORROW_BUTTON, STR_FINANCES_BORROW_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CF_REPAY_LOAN), SetFill(1, 0), SetDataTip(STR_FINANCES_REPAY_BUTTON, STR_FINANCES_REPAY_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CF_INFRASTRUCTURE), SetFill(1, 0), SetDataTip(STR_FINANCES_INFRASTRUCTURE_BUTTON, STR_COMPANY_VIEW_INFRASTRUCTURE_TOOLTIP), EndContainer(), EndContainer(), }; @@ -290,17 +290,17 @@ struct CompanyFinancesWindow : Window { virtual void SetStringParameters(int widget) const { switch (widget) { - case CFW_CAPTION: + case WID_CF_CAPTION: SetDParam(0, (CompanyID)this->window_number); SetDParam(1, (CompanyID)this->window_number); break; - case CFW_MAXLOAN_VALUE: + case WID_CF_MAXLOAN_VALUE: SetDParam(0, _economy.max_loan); break; - case CFW_INCREASE_LOAN: - case CFW_REPAY_LOAN: + case WID_CF_INCREASE_LOAN: + case WID_CF_REPAY_LOAN: SetDParam(0, LOAN_INTERVAL); break; } @@ -310,24 +310,24 @@ struct CompanyFinancesWindow : Window { { int type = _settings_client.gui.expenses_layout; switch (widget) { - case CFW_EXPS_CATEGORY: + case WID_CF_EXPS_CATEGORY: size->width = _expenses_list_types[type].GetCategoriesWidth(); size->height = _expenses_list_types[type].GetHeight(); break; - case CFW_EXPS_PRICE1: - case CFW_EXPS_PRICE2: - case CFW_EXPS_PRICE3: + case WID_CF_EXPS_PRICE1: + case WID_CF_EXPS_PRICE2: + case WID_CF_EXPS_PRICE3: size->height = _expenses_list_types[type].GetHeight(); /* FALL THROUGH */ - case CFW_BALANCE_VALUE: - case CFW_LOAN_VALUE: - case CFW_TOTAL_VALUE: + case WID_CF_BALANCE_VALUE: + case WID_CF_LOAN_VALUE: + case WID_CF_TOTAL_VALUE: SetDParam(0, CompanyFinancesWindow::max_money); size->width = max(GetStringBoundingBox(STR_FINANCES_NEGATIVE_INCOME).width, GetStringBoundingBox(STR_FINANCES_POSITIVE_INCOME).width) + padding.width; break; - case CFW_MAXLOAN_GAP: + case WID_CF_MAXLOAN_GAP: size->height = FONT_HEIGHT_NORMAL; break; } @@ -336,44 +336,44 @@ struct CompanyFinancesWindow : Window { virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case CFW_EXPS_CATEGORY: + case WID_CF_EXPS_CATEGORY: DrawCategories(r); break; - case CFW_EXPS_PRICE1: - case CFW_EXPS_PRICE2: - case CFW_EXPS_PRICE3: { + case WID_CF_EXPS_PRICE1: + case WID_CF_EXPS_PRICE2: + case WID_CF_EXPS_PRICE3: { const Company *c = Company::Get((CompanyID)this->window_number); int age = min(_cur_year - c->inaugurated_year, 2); - int wid_offset = widget - CFW_EXPS_PRICE1; + int wid_offset = widget - WID_CF_EXPS_PRICE1; if (wid_offset <= age) { DrawYearColumn(r, _cur_year - (age - wid_offset), c->yearly_expenses + (age - wid_offset)); } break; } - case CFW_BALANCE_VALUE: { + case WID_CF_BALANCE_VALUE: { const Company *c = Company::Get((CompanyID)this->window_number); SetDParam(0, c->money); DrawString(r.left, r.right, r.top, STR_FINANCES_TOTAL_CURRENCY, TC_FROMSTRING, SA_RIGHT); break; } - case CFW_LOAN_VALUE: { + case WID_CF_LOAN_VALUE: { const Company *c = Company::Get((CompanyID)this->window_number); SetDParam(0, c->current_loan); DrawString(r.left, r.right, r.top, STR_FINANCES_TOTAL_CURRENCY, TC_FROMSTRING, SA_RIGHT); break; } - case CFW_TOTAL_VALUE: { + case WID_CF_TOTAL_VALUE: { const Company *c = Company::Get((CompanyID)this->window_number); SetDParam(0, c->money - c->current_loan); DrawString(r.left, r.right, r.top, STR_FINANCES_TOTAL_CURRENCY, TC_FROMSTRING, SA_RIGHT); break; } - case CFW_LOAN_LINE: + case WID_CF_LOAN_LINE: GfxFillRect(r.left, r.top, r.right, r.top, PC_BLACK); break; } @@ -386,12 +386,12 @@ struct CompanyFinancesWindow : Window { void SetupWidgets() { int plane = this->small ? SZSP_NONE : 0; - this->GetWidget<NWidgetStacked>(CFW_SEL_PANEL)->SetDisplayedPlane(plane); - this->GetWidget<NWidgetStacked>(CFW_SEL_MAXLOAN)->SetDisplayedPlane(plane); + this->GetWidget<NWidgetStacked>(WID_CF_SEL_PANEL)->SetDisplayedPlane(plane); + this->GetWidget<NWidgetStacked>(WID_CF_SEL_MAXLOAN)->SetDisplayedPlane(plane); CompanyID company = (CompanyID)this->window_number; plane = (company != _local_company) ? SZSP_NONE : 0; - this->GetWidget<NWidgetStacked>(CFW_SEL_BUTTONS)->SetDisplayedPlane(plane); + this->GetWidget<NWidgetStacked>(WID_CF_SEL_BUTTONS)->SetDisplayedPlane(plane); } virtual void OnPaint() @@ -400,7 +400,7 @@ struct CompanyFinancesWindow : Window { if (!this->small) { /* Check that the expenses panel height matches the height needed for the layout. */ int type = _settings_client.gui.expenses_layout; - if (_expenses_list_types[type].GetHeight() != this->GetWidget<NWidgetBase>(CFW_EXPS_CATEGORY)->current_y) { + if (_expenses_list_types[type].GetHeight() != this->GetWidget<NWidgetBase>(WID_CF_EXPS_CATEGORY)->current_y) { this->SetupWidgets(); this->ReInit(); return; @@ -410,15 +410,15 @@ struct CompanyFinancesWindow : Window { /* Check that the loan buttons are shown only when the user owns the company. */ CompanyID company = (CompanyID)this->window_number; int req_plane = (company != _local_company) ? SZSP_NONE : 0; - if (req_plane != this->GetWidget<NWidgetStacked>(CFW_SEL_BUTTONS)->shown_plane) { + if (req_plane != this->GetWidget<NWidgetStacked>(WID_CF_SEL_BUTTONS)->shown_plane) { this->SetupWidgets(); this->ReInit(); return; } const Company *c = Company::Get(company); - this->SetWidgetDisabledState(CFW_INCREASE_LOAN, c->current_loan == _economy.max_loan); // Borrow button only shows when there is any more money to loan. - this->SetWidgetDisabledState(CFW_REPAY_LOAN, company != _local_company || c->current_loan == 0); // Repay button only shows when there is any more money to repay. + this->SetWidgetDisabledState(WID_CF_INCREASE_LOAN, c->current_loan == _economy.max_loan); // Borrow button only shows when there is any more money to loan. + this->SetWidgetDisabledState(WID_CF_REPAY_LOAN, company != _local_company || c->current_loan == 0); // Repay button only shows when there is any more money to repay. } this->DrawWidgets(); @@ -427,7 +427,7 @@ struct CompanyFinancesWindow : Window { virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case CFW_TOGGLE_SIZE: // toggle size + case WID_CF_TOGGLE_SIZE: // toggle size this->small = !this->small; this->SetupWidgets(); if (this->IsShaded()) { @@ -439,15 +439,15 @@ struct CompanyFinancesWindow : Window { } break; - case CFW_INCREASE_LOAN: // increase loan + case WID_CF_INCREASE_LOAN: // increase loan DoCommandP(0, 0, _ctrl_pressed, CMD_INCREASE_LOAN | CMD_MSG(STR_ERROR_CAN_T_BORROW_ANY_MORE_MONEY)); break; - case CFW_REPAY_LOAN: // repay loan + case WID_CF_REPAY_LOAN: // repay loan DoCommandP(0, 0, _ctrl_pressed, CMD_DECREASE_LOAN | CMD_MSG(STR_ERROR_CAN_T_REPAY_LOAN)); break; - case CFW_INFRASTRUCTURE: // show infrastructure details + case WID_CF_INFRASTRUCTURE: // show infrastructure details ShowCompanyInfrastructure((CompanyID)this->window_number); break; } @@ -562,7 +562,7 @@ private: LiveryScheme scheme; /* Disallow other company colours for the primary colour */ - if (HasBit(this->sel, LS_DEFAULT) && widget == SCLW_WIDGET_PRI_COL_DROPDOWN) { + if (HasBit(this->sel, LS_DEFAULT) && widget == WID_SCL_PRI_COL_DROPDOWN) { const Company *c; FOR_ALL_COMPANIES(c) { if (c->index != _local_company) SetBit(used_colours, c->colour); @@ -581,7 +581,7 @@ private: list->push_back(new DropDownListColourItem(i, HasBit(used_colours, i))); } - ShowDropDownList(this, list, widget == SCLW_WIDGET_PRI_COL_DROPDOWN ? livery->colour1 : livery->colour2, widget); + ShowDropDownList(this, list, widget == WID_SCL_PRI_COL_DROPDOWN ? livery->colour1 : livery->colour2, widget); } public: @@ -596,14 +596,14 @@ public: this->InitNested(desc, company); this->owner = company; - this->LowerWidget(SCLW_WIDGET_CLASS_GENERAL); + this->LowerWidget(WID_SCL_CLASS_GENERAL); this->InvalidateData(1); } virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case SCLW_WIDGET_SPACER_DROPDOWN: { + case WID_SCL_SPACER_DROPDOWN: { /* The matrix widget below needs enough room to print all the schemes. */ Dimension d = {0, 0}; for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) { @@ -613,7 +613,7 @@ public: break; } - case SCLW_WIDGET_MATRIX: { + case WID_SCL_MATRIX: { uint livery_height = 0; for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) { if (_livery_class[scheme] == this->livery_class && HasBit(_loaded_newgrf_features.used_liveries, scheme)) { @@ -621,17 +621,17 @@ public: } } size->height = livery_height * this->line_height; - this->GetWidget<NWidgetCore>(SCLW_WIDGET_MATRIX)->widget_data = (livery_height << MAT_ROW_START) | (1 << MAT_COL_START); + this->GetWidget<NWidgetCore>(WID_SCL_MATRIX)->widget_data = (livery_height << MAT_ROW_START) | (1 << MAT_COL_START); break; } - case SCLW_WIDGET_SEC_COL_DROPDOWN: + case WID_SCL_SEC_COL_DROPDOWN: if (!_loaded_newgrf_features.has_2CC) { size->width = 0; break; } /* FALL THROUGH */ - case SCLW_WIDGET_PRI_COL_DROPDOWN: { + case WID_SCL_PRI_COL_DROPDOWN: { int padding = this->square.width + NWidgetScrollbar::GetVerticalDimension().width + 10; for (const StringID *id = _colour_dropdown; id != endof(_colour_dropdown); id++) { size->width = max(size->width, GetStringBoundingBox(*id).width + padding); @@ -644,8 +644,8 @@ public: virtual void OnPaint() { /* Disable dropdown controls if no scheme is selected */ - this->SetWidgetDisabledState(SCLW_WIDGET_PRI_COL_DROPDOWN, this->sel == 0); - this->SetWidgetDisabledState(SCLW_WIDGET_SEC_COL_DROPDOWN, this->sel == 0); + this->SetWidgetDisabledState(WID_SCL_PRI_COL_DROPDOWN, this->sel == 0); + this->SetWidgetDisabledState(WID_SCL_SEC_COL_DROPDOWN, this->sel == 0); this->DrawWidgets(); } @@ -653,8 +653,8 @@ public: virtual void SetStringParameters(int widget) const { switch (widget) { - case SCLW_WIDGET_PRI_COL_DROPDOWN: - case SCLW_WIDGET_SEC_COL_DROPDOWN: { + case WID_SCL_PRI_COL_DROPDOWN: + case WID_SCL_SEC_COL_DROPDOWN: { const Company *c = Company::Get((CompanyID)this->window_number); LiveryScheme scheme = LS_DEFAULT; @@ -664,7 +664,7 @@ public: } if (scheme == LS_END) scheme = LS_DEFAULT; } - SetDParam(0, STR_COLOUR_DARK_BLUE + ((widget == SCLW_WIDGET_PRI_COL_DROPDOWN) ? c->livery[scheme].colour1 : c->livery[scheme].colour2)); + SetDParam(0, STR_COLOUR_DARK_BLUE + ((widget == WID_SCL_PRI_COL_DROPDOWN) ? c->livery[scheme].colour1 : c->livery[scheme].colour2)); break; } } @@ -672,20 +672,20 @@ public: virtual void DrawWidget(const Rect &r, int widget) const { - if (widget != SCLW_WIDGET_MATRIX) return; + if (widget != WID_SCL_MATRIX) return; bool rtl = _current_text_dir == TD_RTL; /* Horizontal coordinates of scheme name column. */ - const NWidgetBase *nwi = this->GetWidget<NWidgetBase>(SCLW_WIDGET_SPACER_DROPDOWN); + const NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_SCL_SPACER_DROPDOWN); int sch_left = nwi->pos_x; int sch_right = sch_left + nwi->current_x - 1; /* Horizontal coordinates of first dropdown. */ - nwi = this->GetWidget<NWidgetBase>(SCLW_WIDGET_PRI_COL_DROPDOWN); + nwi = this->GetWidget<NWidgetBase>(WID_SCL_PRI_COL_DROPDOWN); int pri_left = nwi->pos_x; int pri_right = pri_left + nwi->current_x - 1; /* Horizontal coordinates of second dropdown. */ - nwi = this->GetWidget<NWidgetBase>(SCLW_WIDGET_SEC_COL_DROPDOWN); + nwi = this->GetWidget<NWidgetBase>(WID_SCL_SEC_COL_DROPDOWN); int sec_left = nwi->pos_x; int sec_right = sec_left + nwi->current_x - 1; @@ -727,14 +727,14 @@ public: { switch (widget) { /* Livery Class buttons */ - case SCLW_WIDGET_CLASS_GENERAL: - case SCLW_WIDGET_CLASS_RAIL: - case SCLW_WIDGET_CLASS_ROAD: - case SCLW_WIDGET_CLASS_SHIP: - case SCLW_WIDGET_CLASS_AIRCRAFT: - this->RaiseWidget(this->livery_class + SCLW_WIDGET_CLASS_GENERAL); - this->livery_class = (LiveryClass)(widget - SCLW_WIDGET_CLASS_GENERAL); - this->LowerWidget(this->livery_class + SCLW_WIDGET_CLASS_GENERAL); + case WID_SCL_CLASS_GENERAL: + case WID_SCL_CLASS_RAIL: + case WID_SCL_CLASS_ROAD: + case WID_SCL_CLASS_SHIP: + case WID_SCL_CLASS_AIRCRAFT: + this->RaiseWidget(this->livery_class + WID_SCL_CLASS_GENERAL); + this->livery_class = (LiveryClass)(widget - WID_SCL_CLASS_GENERAL); + this->LowerWidget(this->livery_class + WID_SCL_CLASS_GENERAL); /* Select the first item in the list */ this->sel = 0; @@ -748,16 +748,16 @@ public: this->ReInit(); break; - case SCLW_WIDGET_PRI_COL_DROPDOWN: // First colour dropdown - ShowColourDropDownMenu(SCLW_WIDGET_PRI_COL_DROPDOWN); + case WID_SCL_PRI_COL_DROPDOWN: // First colour dropdown + ShowColourDropDownMenu(WID_SCL_PRI_COL_DROPDOWN); break; - case SCLW_WIDGET_SEC_COL_DROPDOWN: // Second colour dropdown - ShowColourDropDownMenu(SCLW_WIDGET_SEC_COL_DROPDOWN); + case WID_SCL_SEC_COL_DROPDOWN: // Second colour dropdown + ShowColourDropDownMenu(WID_SCL_SEC_COL_DROPDOWN); break; - case SCLW_WIDGET_MATRIX: { - const NWidgetBase *wid = this->GetWidget<NWidgetBase>(SCLW_WIDGET_MATRIX); + case WID_SCL_MATRIX: { + const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_SCL_MATRIX); LiveryScheme j = (LiveryScheme)((pt.y - wid->pos_y) / this->line_height); for (LiveryScheme scheme = LS_BEGIN; scheme <= j; scheme++) { @@ -786,7 +786,7 @@ public: { 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); + DoCommandP(0, scheme | (widget == WID_SCL_PRI_COL_DROPDOWN ? 0 : 256), index, CMD_SET_COMPANY_COLOUR); } } } @@ -799,14 +799,14 @@ public: 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); + this->SetWidgetsDisabledState(true, WID_SCL_CLASS_RAIL, WID_SCL_CLASS_ROAD, WID_SCL_CLASS_SHIP, WID_SCL_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]); + this->EnableWidget(WID_SCL_CLASS_GENERAL + _livery_class[scheme]); } else { ClrBit(this->sel, scheme); } @@ -815,7 +815,7 @@ public: if (!current_class_valid) { Point pt = {0, 0}; - this->OnClick(pt, SCLW_WIDGET_CLASS_GENERAL, 1); + this->OnClick(pt, WID_SCL_CLASS_GENERAL, 1); } else if (data == 0) { this->ReInit(); } @@ -825,23 +825,23 @@ public: static const NWidgetPart _nested_select_company_livery_widgets [] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, SCLW_WIDGET_CAPTION), SetDataTip(STR_LIVERY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_SCL_CAPTION), SetDataTip(STR_LIVERY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_GENERAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_COMPANY_GENERAL, STR_LIVERY_GENERAL_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_RAIL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TRAINLIST, STR_LIVERY_TRAIN_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_ROAD), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TRUCKLIST, STR_LIVERY_ROAD_VEHICLE_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_SHIP), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIPLIST, STR_LIVERY_SHIP_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_GREY, SCLW_WIDGET_CLASS_AIRCRAFT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AIRPLANESLIST, STR_LIVERY_AIRCRAFT_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_SCL_CLASS_GENERAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_COMPANY_GENERAL, STR_LIVERY_GENERAL_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_SCL_CLASS_RAIL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TRAINLIST, STR_LIVERY_TRAIN_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_SCL_CLASS_ROAD), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TRUCKLIST, STR_LIVERY_ROAD_VEHICLE_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_SCL_CLASS_SHIP), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIPLIST, STR_LIVERY_SHIP_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_SCL_CLASS_AIRCRAFT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AIRPLANESLIST, STR_LIVERY_AIRCRAFT_TOOLTIP), NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(90, 22), SetFill(1, 1), EndContainer(), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PANEL, COLOUR_GREY, SCLW_WIDGET_SPACER_DROPDOWN), SetMinimalSize(150, 12), SetFill(1, 1), EndContainer(), - NWidget(WWT_DROPDOWN, COLOUR_GREY, SCLW_WIDGET_PRI_COL_DROPDOWN), SetMinimalSize(125, 12), SetFill(0, 1), SetDataTip(STR_BLACK_STRING, STR_LIVERY_PRIMARY_TOOLTIP), - NWidget(WWT_DROPDOWN, COLOUR_GREY, SCLW_WIDGET_SEC_COL_DROPDOWN), SetMinimalSize(125, 12), SetFill(0, 1), + NWidget(WWT_PANEL, COLOUR_GREY, WID_SCL_SPACER_DROPDOWN), SetMinimalSize(150, 12), SetFill(1, 1), EndContainer(), + NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_SCL_PRI_COL_DROPDOWN), SetMinimalSize(125, 12), SetFill(0, 1), SetDataTip(STR_BLACK_STRING, STR_LIVERY_PRIMARY_TOOLTIP), + NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_SCL_SEC_COL_DROPDOWN), SetMinimalSize(125, 12), SetFill(0, 1), SetDataTip(STR_BLACK_STRING, STR_LIVERY_SECONDARY_TOOLTIP), EndContainer(), - NWidget(WWT_MATRIX, COLOUR_GREY, SCLW_WIDGET_MATRIX), SetMinimalSize(275, 15), SetFill(1, 0), SetDataTip((1 << MAT_ROW_START) | (1 << MAT_COL_START), STR_LIVERY_PANEL_TOOLTIP), + NWidget(WWT_MATRIX, COLOUR_GREY, WID_SCL_MATRIX), SetMinimalSize(275, 15), SetFill(1, 0), SetDataTip((1 << MAT_ROW_START) | (1 << MAT_COL_START), STR_LIVERY_PANEL_TOOLTIP), }; static const WindowDesc _select_company_livery_desc( @@ -899,122 +899,122 @@ void DrawCompanyManagerFace(CompanyManagerFace cmf, int colour, int x, int y) static const NWidgetPart _nested_select_company_manager_face_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, SCMFW_WIDGET_CAPTION), SetDataTip(STR_FACE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), - NWidget(WWT_IMGBTN, COLOUR_GREY, SCMFW_WIDGET_TOGGLE_LARGE_SMALL), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_FACE_ADVANCED_TOOLTIP), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_SCMF_CAPTION), SetDataTip(STR_FACE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_SCMF_TOGGLE_LARGE_SMALL), SetDataTip(SPR_LARGE_SMALL_WINDOW, STR_FACE_ADVANCED_TOOLTIP), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, SCMFW_WIDGET_SELECT_FACE), + NWidget(WWT_PANEL, COLOUR_GREY, WID_SCMF_SELECT_FACE), NWidget(NWID_SPACER), SetMinimalSize(0, 2), NWidget(NWID_HORIZONTAL), SetPIP(2, 2, 2), NWidget(NWID_VERTICAL), NWidget(NWID_HORIZONTAL), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_EMPTY, COLOUR_GREY, SCMFM_WIDGET_FACE), SetMinimalSize(92, 119), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_SCMF_FACE), SetMinimalSize(92, 119), NWidget(NWID_SPACER), SetFill(1, 0), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 2), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_RANDOM_NEW_FACE), SetFill(1, 0), SetDataTip(STR_FACE_NEW_FACE_BUTTON, STR_FACE_NEW_FACE_TOOLTIP), - NWidget(NWID_SELECTION, INVALID_COLOUR, SCMFW_WIDGET_SEL_LOADSAVE), // Load/number/save buttons under the portrait in the advanced view. + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_RANDOM_NEW_FACE), SetFill(1, 0), SetDataTip(STR_FACE_NEW_FACE_BUTTON, STR_FACE_NEW_FACE_TOOLTIP), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SCMF_SEL_LOADSAVE), // Load/number/save buttons under the portrait in the advanced view. NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetMinimalSize(0, 5), SetFill(0, 1), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_LOAD), SetFill(1, 0), SetDataTip(STR_FACE_LOAD, STR_FACE_LOAD_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_FACECODE), SetFill(1, 0), SetDataTip(STR_FACE_FACECODE, STR_FACE_FACECODE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_SAVE), SetFill(1, 0), SetDataTip(STR_FACE_SAVE, STR_FACE_SAVE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_LOAD), SetFill(1, 0), SetDataTip(STR_FACE_LOAD, STR_FACE_LOAD_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_FACECODE), SetFill(1, 0), SetDataTip(STR_FACE_FACECODE, STR_FACE_FACECODE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_SAVE), SetFill(1, 0), SetDataTip(STR_FACE_SAVE, STR_FACE_SAVE_TOOLTIP), NWidget(NWID_SPACER), SetMinimalSize(0, 5), SetFill(0, 1), EndContainer(), EndContainer(), EndContainer(), NWidget(NWID_VERTICAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON), SetFill(1, 0), SetDataTip(STR_FACE_ADVANCED, STR_FACE_ADVANCED_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_TOGGLE_LARGE_SMALL_BUTTON), SetFill(1, 0), SetDataTip(STR_FACE_ADVANCED, STR_FACE_ADVANCED_TOOLTIP), NWidget(NWID_SPACER), SetMinimalSize(0, 2), - NWidget(NWID_SELECTION, INVALID_COLOUR, SCMFW_WIDGET_SEL_MALEFEMALE), // Simple male/female face setting. + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SCMF_SEL_MALEFEMALE), // Simple male/female face setting. NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetFill(0, 1), - NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_MALE), SetFill(1, 0), SetDataTip(STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP), - NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_FEMALE), SetFill(1, 0), SetDataTip(STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_MALE), SetFill(1, 0), SetDataTip(STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_FEMALE), SetFill(1, 0), SetDataTip(STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP), NWidget(NWID_SPACER), SetFill(0, 1), EndContainer(), EndContainer(), - NWidget(NWID_SELECTION, INVALID_COLOUR, SCMFW_WIDGET_SEL_PARTS), // Advanced face parts setting. + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SCMF_SEL_PARTS), // Advanced face parts setting. NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetMinimalSize(0, 2), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_MALE2), SetFill(1, 0), SetDataTip(STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP), - NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_FEMALE2), SetFill(1, 0), SetDataTip(STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_MALE2), SetFill(1, 0), SetDataTip(STR_FACE_MALE_BUTTON, STR_FACE_MALE_TOOLTIP), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_FEMALE2), SetFill(1, 0), SetDataTip(STR_FACE_FEMALE_BUTTON, STR_FACE_FEMALE_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 2), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_ETHNICITY_EUR), SetFill(1, 0), SetDataTip(STR_FACE_EUROPEAN, STR_FACE_SELECT_EUROPEAN), - NWidget(WWT_TEXTBTN, COLOUR_GREY, SCMFW_WIDGET_ETHNICITY_AFR), SetFill(1, 0), SetDataTip(STR_FACE_AFRICAN, STR_FACE_SELECT_AFRICAN), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_ETHNICITY_EUR), SetFill(1, 0), SetDataTip(STR_FACE_EUROPEAN, STR_FACE_SELECT_EUROPEAN), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SCMF_ETHNICITY_AFR), SetFill(1, 0), SetDataTip(STR_FACE_AFRICAN, STR_FACE_SELECT_AFRICAN), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 4), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_HAS_MOUSTACHE_EARRING_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_HAS_MOUSTACHE_EARRING), SetDataTip(STR_EMPTY, STR_FACE_MOUSTACHE_EARRING_TOOLTIP), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_HAS_MOUSTACHE_EARRING), SetDataTip(STR_EMPTY, STR_FACE_MOUSTACHE_EARRING_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_HAS_GLASSES_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_HAS_GLASSES), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_HAS_GLASSES_TEXT), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_HAS_GLASSES), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 2), SetFill(1, 0), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_HAIR_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_HAIR_L), SetDataTip(AWV_DECREASE, STR_FACE_HAIR_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_HAIR), SetDataTip(STR_EMPTY, STR_FACE_HAIR_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_HAIR_R), SetDataTip(AWV_INCREASE, STR_FACE_HAIR_TOOLTIP), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_HAIR_TEXT), SetFill(1, 0), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_HAIR_L), SetDataTip(AWV_DECREASE, STR_FACE_HAIR_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_HAIR), SetDataTip(STR_EMPTY, STR_FACE_HAIR_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_HAIR_R), SetDataTip(AWV_INCREASE, STR_FACE_HAIR_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_EYEBROWS_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_EYEBROWS_L), SetDataTip(AWV_DECREASE, STR_FACE_EYEBROWS_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_EYEBROWS), SetDataTip(STR_EMPTY, STR_FACE_EYEBROWS_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_EYEBROWS_R), SetDataTip(AWV_INCREASE, STR_FACE_EYEBROWS_TOOLTIP), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_EYEBROWS_TEXT), SetFill(1, 0), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYEBROWS_L), SetDataTip(AWV_DECREASE, STR_FACE_EYEBROWS_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_EYEBROWS), SetDataTip(STR_EMPTY, STR_FACE_EYEBROWS_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYEBROWS_R), SetDataTip(AWV_INCREASE, STR_FACE_EYEBROWS_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_EYECOLOUR_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_EYECOLOUR_L), SetDataTip(AWV_DECREASE, STR_FACE_EYECOLOUR_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_EYECOLOUR), SetDataTip(STR_EMPTY, STR_FACE_EYECOLOUR_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_EYECOLOUR_R), SetDataTip(AWV_INCREASE, STR_FACE_EYECOLOUR_TOOLTIP), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_EYECOLOUR_TEXT), SetFill(1, 0), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR_L), SetDataTip(AWV_DECREASE, STR_FACE_EYECOLOUR_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR), SetDataTip(STR_EMPTY, STR_FACE_EYECOLOUR_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR_R), SetDataTip(AWV_INCREASE, STR_FACE_EYECOLOUR_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_GLASSES_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_GLASSES_L), SetDataTip(AWV_DECREASE, STR_FACE_GLASSES_TOOLTIP_2), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_GLASSES), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP_2), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_GLASSES_R), SetDataTip(AWV_INCREASE, STR_FACE_GLASSES_TOOLTIP_2), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_GLASSES_TEXT), SetFill(1, 0), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_GLASSES_L), SetDataTip(AWV_DECREASE, STR_FACE_GLASSES_TOOLTIP_2), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_GLASSES), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP_2), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_GLASSES_R), SetDataTip(AWV_INCREASE, STR_FACE_GLASSES_TOOLTIP_2), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_NOSE_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_NOSE_L), SetDataTip(AWV_DECREASE, STR_FACE_NOSE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_NOSE), SetDataTip(STR_EMPTY, STR_FACE_NOSE_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_NOSE_R), SetDataTip(AWV_INCREASE, STR_FACE_NOSE_TOOLTIP), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_NOSE_TEXT), SetFill(1, 0), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_NOSE_L), SetDataTip(AWV_DECREASE, STR_FACE_NOSE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_NOSE), SetDataTip(STR_EMPTY, STR_FACE_NOSE_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_NOSE_R), SetDataTip(AWV_INCREASE, STR_FACE_NOSE_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_LIPS_MOUSTACHE_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_LIPS_MOUSTACHE_L), SetDataTip(AWV_DECREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_LIPS_MOUSTACHE), SetDataTip(STR_EMPTY, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_LIPS_MOUSTACHE_R), SetDataTip(AWV_INCREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_LIPS_MOUSTACHE_TEXT), SetFill(1, 0), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE_L), SetDataTip(AWV_DECREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE), SetDataTip(STR_EMPTY, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE_R), SetDataTip(AWV_INCREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_CHIN_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_CHIN_L), SetDataTip(AWV_DECREASE, STR_FACE_CHIN_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_CHIN), SetDataTip(STR_EMPTY, STR_FACE_CHIN_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_CHIN_R), SetDataTip(AWV_INCREASE, STR_FACE_CHIN_TOOLTIP), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_CHIN_TEXT), SetFill(1, 0), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_CHIN_L), SetDataTip(AWV_DECREASE, STR_FACE_CHIN_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_CHIN), SetDataTip(STR_EMPTY, STR_FACE_CHIN_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_CHIN_R), SetDataTip(AWV_INCREASE, STR_FACE_CHIN_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_JACKET_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_JACKET_L), SetDataTip(AWV_DECREASE, STR_FACE_JACKET_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_JACKET), SetDataTip(STR_EMPTY, STR_FACE_JACKET_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_JACKET_R), SetDataTip(AWV_INCREASE, STR_FACE_JACKET_TOOLTIP), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_JACKET_TEXT), SetFill(1, 0), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_JACKET_L), SetDataTip(AWV_DECREASE, STR_FACE_JACKET_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_JACKET), SetDataTip(STR_EMPTY, STR_FACE_JACKET_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_JACKET_R), SetDataTip(AWV_INCREASE, STR_FACE_JACKET_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_COLLAR_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_COLLAR_L), SetDataTip(AWV_DECREASE, STR_FACE_COLLAR_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_COLLAR), SetDataTip(STR_EMPTY, STR_FACE_COLLAR_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_COLLAR_R), SetDataTip(AWV_INCREASE, STR_FACE_COLLAR_TOOLTIP), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_COLLAR_TEXT), SetFill(1, 0), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_COLLAR_L), SetDataTip(AWV_DECREASE, STR_FACE_COLLAR_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_COLLAR), SetDataTip(STR_EMPTY, STR_FACE_COLLAR_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_COLLAR_R), SetDataTip(AWV_INCREASE, STR_FACE_COLLAR_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, INVALID_COLOUR, SCMFW_WIDGET_TIE_EARRING_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_TIE_EARRING_L), SetDataTip(AWV_DECREASE, STR_FACE_TIE_EARRING_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_TIE_EARRING), SetDataTip(STR_EMPTY, STR_FACE_TIE_EARRING_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, SCMFW_WIDGET_TIE_EARRING_R), SetDataTip(AWV_INCREASE, STR_FACE_TIE_EARRING_TOOLTIP), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_TIE_EARRING_TEXT), SetFill(1, 0), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING_L), SetDataTip(AWV_DECREASE, STR_FACE_TIE_EARRING_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING), SetDataTip(STR_EMPTY, STR_FACE_TIE_EARRING_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING_R), SetDataTip(AWV_INCREASE, STR_FACE_TIE_EARRING_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetFill(0, 1), EndContainer(), @@ -1024,8 +1024,8 @@ static const NWidgetPart _nested_select_company_manager_face_widgets[] = { NWidget(NWID_SPACER), SetMinimalSize(0, 2), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_CANCEL), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_FACE_CANCEL_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SCMFW_WIDGET_ACCEPT), SetFill(1, 0), SetDataTip(STR_BUTTON_OK, STR_FACE_OK_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_CANCEL), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_FACE_CANCEL_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_ACCEPT), SetFill(1, 0), SetDataTip(STR_BUTTON_OK, STR_FACE_OK_TOOLTIP), EndContainer(), }; @@ -1094,17 +1094,17 @@ public: } /** - * Select planes to display to the user with the #NWID_SELECTION widgets #SCMFW_WIDGET_SEL_LOADSAVE, #SCMFW_WIDGET_SEL_MALEFEMALE, and #SCMFW_WIDGET_SEL_PARTS. + * Select planes to display to the user with the #NWID_SELECTION widgets #WID_SCMF_SEL_LOADSAVE, #WID_SCMF_SEL_MALEFEMALE, and #WID_SCMF_SEL_PARTS. * @param advanced Display advanced face management window. */ void SelectDisplayPlanes(bool advanced) { - this->GetWidget<NWidgetStacked>(SCMFW_WIDGET_SEL_LOADSAVE)->SetDisplayedPlane(advanced ? 0 : SZSP_NONE); - this->GetWidget<NWidgetStacked>(SCMFW_WIDGET_SEL_PARTS)->SetDisplayedPlane(advanced ? 0 : SZSP_NONE); - this->GetWidget<NWidgetStacked>(SCMFW_WIDGET_SEL_MALEFEMALE)->SetDisplayedPlane(advanced ? SZSP_NONE : 0); - this->GetWidget<NWidgetCore>(SCMFW_WIDGET_RANDOM_NEW_FACE)->widget_data = advanced ? STR_MAPGEN_RANDOM : STR_FACE_NEW_FACE_BUTTON; + this->GetWidget<NWidgetStacked>(WID_SCMF_SEL_LOADSAVE)->SetDisplayedPlane(advanced ? 0 : SZSP_NONE); + this->GetWidget<NWidgetStacked>(WID_SCMF_SEL_PARTS)->SetDisplayedPlane(advanced ? 0 : SZSP_NONE); + this->GetWidget<NWidgetStacked>(WID_SCMF_SEL_MALEFEMALE)->SetDisplayedPlane(advanced ? SZSP_NONE : 0); + this->GetWidget<NWidgetCore>(WID_SCMF_RANDOM_NEW_FACE)->widget_data = advanced ? STR_MAPGEN_RANDOM : STR_FACE_NEW_FACE_BUTTON; - NWidgetCore *wi = this->GetWidget<NWidgetCore>(SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON); + NWidgetCore *wi = this->GetWidget<NWidgetCore>(WID_SCMF_TOGGLE_LARGE_SMALL_BUTTON); if (advanced) { wi->SetDataTip(STR_FACE_SIMPLE, STR_FACE_SIMPLE_TOOLTIP); } else { @@ -1138,50 +1138,50 @@ public: virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case SCMFW_WIDGET_HAS_MOUSTACHE_EARRING_TEXT: - case SCMFW_WIDGET_TIE_EARRING_TEXT: { - int offset = (widget - SCMFW_WIDGET_HAS_MOUSTACHE_EARRING_TEXT) * 2; + case WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT: + case WID_SCMF_TIE_EARRING_TEXT: { + int offset = (widget - WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT) * 2; *size = maxdim(GetStringBoundingBox(PART_TEXTS_IS_FEMALE[offset]), GetStringBoundingBox(PART_TEXTS_IS_FEMALE[offset + 1])); size->width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; size->height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; break; } - case SCMFW_WIDGET_LIPS_MOUSTACHE_TEXT: + case WID_SCMF_LIPS_MOUSTACHE_TEXT: *size = maxdim(GetStringBoundingBox(STR_FACE_LIPS), GetStringBoundingBox(STR_FACE_MOUSTACHE)); size->width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; size->height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; break; - case SCMFW_WIDGET_HAS_GLASSES_TEXT: - case SCMFW_WIDGET_HAIR_TEXT: - case SCMFW_WIDGET_EYEBROWS_TEXT: - case SCMFW_WIDGET_EYECOLOUR_TEXT: - case SCMFW_WIDGET_GLASSES_TEXT: - case SCMFW_WIDGET_NOSE_TEXT: - case SCMFW_WIDGET_CHIN_TEXT: - case SCMFW_WIDGET_JACKET_TEXT: - case SCMFW_WIDGET_COLLAR_TEXT: - *size = GetStringBoundingBox(PART_TEXTS[widget - SCMFW_WIDGET_HAS_GLASSES_TEXT]); + case WID_SCMF_HAS_GLASSES_TEXT: + case WID_SCMF_HAIR_TEXT: + case WID_SCMF_EYEBROWS_TEXT: + case WID_SCMF_EYECOLOUR_TEXT: + case WID_SCMF_GLASSES_TEXT: + case WID_SCMF_NOSE_TEXT: + case WID_SCMF_CHIN_TEXT: + case WID_SCMF_JACKET_TEXT: + case WID_SCMF_COLLAR_TEXT: + *size = GetStringBoundingBox(PART_TEXTS[widget - WID_SCMF_HAS_GLASSES_TEXT]); size->width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; size->height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; break; - case SCMFW_WIDGET_HAS_MOUSTACHE_EARRING: - case SCMFW_WIDGET_HAS_GLASSES: + case WID_SCMF_HAS_MOUSTACHE_EARRING: + case WID_SCMF_HAS_GLASSES: *size = this->yesno_dim; break; - case SCMFW_WIDGET_EYECOLOUR: - case SCMFW_WIDGET_CHIN: - case SCMFW_WIDGET_EYEBROWS: - case SCMFW_WIDGET_LIPS_MOUSTACHE: - case SCMFW_WIDGET_NOSE: - case SCMFW_WIDGET_HAIR: - case SCMFW_WIDGET_JACKET: - case SCMFW_WIDGET_COLLAR: - case SCMFW_WIDGET_TIE_EARRING: - case SCMFW_WIDGET_GLASSES: + case WID_SCMF_EYECOLOUR: + case WID_SCMF_CHIN: + case WID_SCMF_EYEBROWS: + case WID_SCMF_LIPS_MOUSTACHE: + case WID_SCMF_NOSE: + case WID_SCMF_HAIR: + case WID_SCMF_JACKET: + case WID_SCMF_COLLAR: + case WID_SCMF_TIE_EARRING: + case WID_SCMF_GLASSES: *size = this->number_dim; break; } @@ -1190,14 +1190,14 @@ public: virtual void OnPaint() { /* lower the non-selected gender button */ - this->SetWidgetsLoweredState(!this->is_female, SCMFW_WIDGET_MALE, SCMFW_WIDGET_MALE2, WIDGET_LIST_END); - this->SetWidgetsLoweredState( this->is_female, SCMFW_WIDGET_FEMALE, SCMFW_WIDGET_FEMALE2, WIDGET_LIST_END); + this->SetWidgetsLoweredState(!this->is_female, WID_SCMF_MALE, WID_SCMF_MALE2, WIDGET_LIST_END); + this->SetWidgetsLoweredState( this->is_female, WID_SCMF_FEMALE, WID_SCMF_FEMALE2, WIDGET_LIST_END); /* advanced company manager face selection window */ /* lower the non-selected ethnicity button */ - this->SetWidgetLoweredState(SCMFW_WIDGET_ETHNICITY_EUR, !HasBit(this->ge, ETHNICITY_BLACK)); - this->SetWidgetLoweredState(SCMFW_WIDGET_ETHNICITY_AFR, HasBit(this->ge, ETHNICITY_BLACK)); + this->SetWidgetLoweredState(WID_SCMF_ETHNICITY_EUR, !HasBit(this->ge, ETHNICITY_BLACK)); + this->SetWidgetLoweredState(WID_SCMF_ETHNICITY_AFR, HasBit(this->ge, ETHNICITY_BLACK)); /* Disable dynamically the widgets which CompanyManagerFaceVariable has less than 2 options @@ -1206,44 +1206,44 @@ public: /* Eye colour buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_EYE_COLOUR].valid_values[this->ge] < 2, - SCMFW_WIDGET_EYECOLOUR, SCMFW_WIDGET_EYECOLOUR_L, SCMFW_WIDGET_EYECOLOUR_R, WIDGET_LIST_END); + WID_SCMF_EYECOLOUR, WID_SCMF_EYECOLOUR_L, WID_SCMF_EYECOLOUR_R, WIDGET_LIST_END); /* Chin buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_CHIN].valid_values[this->ge] < 2, - SCMFW_WIDGET_CHIN, SCMFW_WIDGET_CHIN_L, SCMFW_WIDGET_CHIN_R, WIDGET_LIST_END); + WID_SCMF_CHIN, WID_SCMF_CHIN_L, WID_SCMF_CHIN_R, WIDGET_LIST_END); /* Eyebrows buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_EYEBROWS].valid_values[this->ge] < 2, - SCMFW_WIDGET_EYEBROWS, SCMFW_WIDGET_EYEBROWS_L, SCMFW_WIDGET_EYEBROWS_R, WIDGET_LIST_END); + WID_SCMF_EYEBROWS, WID_SCMF_EYEBROWS_L, WID_SCMF_EYEBROWS_R, WIDGET_LIST_END); /* Lips or (if it a male face with a moustache) moustache buttons */ this->SetWidgetsDisabledState(_cmf_info[this->is_moust_male ? CMFV_MOUSTACHE : CMFV_LIPS].valid_values[this->ge] < 2, - SCMFW_WIDGET_LIPS_MOUSTACHE, SCMFW_WIDGET_LIPS_MOUSTACHE_L, SCMFW_WIDGET_LIPS_MOUSTACHE_R, WIDGET_LIST_END); + WID_SCMF_LIPS_MOUSTACHE, WID_SCMF_LIPS_MOUSTACHE_L, WID_SCMF_LIPS_MOUSTACHE_R, WIDGET_LIST_END); /* Nose buttons | male faces with moustache haven't any nose options */ this->SetWidgetsDisabledState(_cmf_info[CMFV_NOSE].valid_values[this->ge] < 2 || this->is_moust_male, - SCMFW_WIDGET_NOSE, SCMFW_WIDGET_NOSE_L, SCMFW_WIDGET_NOSE_R, WIDGET_LIST_END); + WID_SCMF_NOSE, WID_SCMF_NOSE_L, WID_SCMF_NOSE_R, WIDGET_LIST_END); /* Hair buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_HAIR].valid_values[this->ge] < 2, - SCMFW_WIDGET_HAIR, SCMFW_WIDGET_HAIR_L, SCMFW_WIDGET_HAIR_R, WIDGET_LIST_END); + WID_SCMF_HAIR, WID_SCMF_HAIR_L, WID_SCMF_HAIR_R, WIDGET_LIST_END); /* Jacket buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_JACKET].valid_values[this->ge] < 2, - SCMFW_WIDGET_JACKET, SCMFW_WIDGET_JACKET_L, SCMFW_WIDGET_JACKET_R, WIDGET_LIST_END); + WID_SCMF_JACKET, WID_SCMF_JACKET_L, WID_SCMF_JACKET_R, WIDGET_LIST_END); /* Collar buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_COLLAR].valid_values[this->ge] < 2, - SCMFW_WIDGET_COLLAR, SCMFW_WIDGET_COLLAR_L, SCMFW_WIDGET_COLLAR_R, WIDGET_LIST_END); + WID_SCMF_COLLAR, WID_SCMF_COLLAR_L, WID_SCMF_COLLAR_R, WIDGET_LIST_END); /* Tie/earring buttons | female faces without earring haven't any earring options */ this->SetWidgetsDisabledState(_cmf_info[CMFV_TIE_EARRING].valid_values[this->ge] < 2 || (this->is_female && GetCompanyManagerFaceBits(this->face, CMFV_HAS_TIE_EARRING, this->ge) == 0), - SCMFW_WIDGET_TIE_EARRING, SCMFW_WIDGET_TIE_EARRING_L, SCMFW_WIDGET_TIE_EARRING_R, WIDGET_LIST_END); + WID_SCMF_TIE_EARRING, WID_SCMF_TIE_EARRING_L, WID_SCMF_TIE_EARRING_R, WIDGET_LIST_END); /* Glasses buttons | faces without glasses haven't any glasses options */ this->SetWidgetsDisabledState(_cmf_info[CMFV_GLASSES].valid_values[this->ge] < 2 || GetCompanyManagerFaceBits(this->face, CMFV_HAS_GLASSES, this->ge) == 0, - SCMFW_WIDGET_GLASSES, SCMFW_WIDGET_GLASSES_L, SCMFW_WIDGET_GLASSES_R, WIDGET_LIST_END); + WID_SCMF_GLASSES, WID_SCMF_GLASSES_L, WID_SCMF_GLASSES_R, WIDGET_LIST_END); this->DrawWidgets(); } @@ -1251,91 +1251,91 @@ public: virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case SCMFW_WIDGET_HAS_MOUSTACHE_EARRING_TEXT: - case SCMFW_WIDGET_TIE_EARRING_TEXT: { - StringID str = PART_TEXTS_IS_FEMALE[(widget - SCMFW_WIDGET_HAS_MOUSTACHE_EARRING_TEXT) * 2 + this->is_female]; + case WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT: + case WID_SCMF_TIE_EARRING_TEXT: { + StringID str = PART_TEXTS_IS_FEMALE[(widget - WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT) * 2 + this->is_female]; DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_GOLD, SA_RIGHT); break; } - case SCMFW_WIDGET_LIPS_MOUSTACHE_TEXT: + case WID_SCMF_LIPS_MOUSTACHE_TEXT: DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, (this->is_moust_male) ? STR_FACE_MOUSTACHE : STR_FACE_LIPS, TC_GOLD, SA_RIGHT); break; - case SCMFW_WIDGET_HAS_GLASSES_TEXT: - case SCMFW_WIDGET_HAIR_TEXT: - case SCMFW_WIDGET_EYEBROWS_TEXT: - case SCMFW_WIDGET_EYECOLOUR_TEXT: - case SCMFW_WIDGET_GLASSES_TEXT: - case SCMFW_WIDGET_NOSE_TEXT: - case SCMFW_WIDGET_CHIN_TEXT: - case SCMFW_WIDGET_JACKET_TEXT: - case SCMFW_WIDGET_COLLAR_TEXT: - DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, PART_TEXTS[widget - SCMFW_WIDGET_HAS_GLASSES_TEXT], TC_GOLD, SA_RIGHT); + case WID_SCMF_HAS_GLASSES_TEXT: + case WID_SCMF_HAIR_TEXT: + case WID_SCMF_EYEBROWS_TEXT: + case WID_SCMF_EYECOLOUR_TEXT: + case WID_SCMF_GLASSES_TEXT: + case WID_SCMF_NOSE_TEXT: + case WID_SCMF_CHIN_TEXT: + case WID_SCMF_JACKET_TEXT: + case WID_SCMF_COLLAR_TEXT: + DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, PART_TEXTS[widget - WID_SCMF_HAS_GLASSES_TEXT], TC_GOLD, SA_RIGHT); break; - case SCMFW_WIDGET_HAS_MOUSTACHE_EARRING: + case WID_SCMF_HAS_MOUSTACHE_EARRING: if (this->is_female) { // Only for female faces - this->DrawFaceStringLabel(SCMFW_WIDGET_HAS_MOUSTACHE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_HAS_TIE_EARRING, this->ge), true); + this->DrawFaceStringLabel(WID_SCMF_HAS_MOUSTACHE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_HAS_TIE_EARRING, this->ge), true); } else { // Only for male faces - this->DrawFaceStringLabel(SCMFW_WIDGET_HAS_MOUSTACHE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_HAS_MOUSTACHE, this->ge), true); + this->DrawFaceStringLabel(WID_SCMF_HAS_MOUSTACHE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_HAS_MOUSTACHE, this->ge), true); } break; - case SCMFW_WIDGET_TIE_EARRING: + case WID_SCMF_TIE_EARRING: if (this->is_female) { // Only for female faces - this->DrawFaceStringLabel(SCMFW_WIDGET_TIE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_TIE_EARRING, this->ge), false); + this->DrawFaceStringLabel(WID_SCMF_TIE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_TIE_EARRING, this->ge), false); } else { // Only for male faces - this->DrawFaceStringLabel(SCMFW_WIDGET_TIE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_TIE_EARRING, this->ge), false); + this->DrawFaceStringLabel(WID_SCMF_TIE_EARRING, GetCompanyManagerFaceBits(this->face, CMFV_TIE_EARRING, this->ge), false); } break; - case SCMFW_WIDGET_LIPS_MOUSTACHE: + case WID_SCMF_LIPS_MOUSTACHE: if (this->is_moust_male) { // Only for male faces with moustache - this->DrawFaceStringLabel(SCMFW_WIDGET_LIPS_MOUSTACHE, GetCompanyManagerFaceBits(this->face, CMFV_MOUSTACHE, this->ge), false); + this->DrawFaceStringLabel(WID_SCMF_LIPS_MOUSTACHE, GetCompanyManagerFaceBits(this->face, CMFV_MOUSTACHE, this->ge), false); } else { // Only for female faces or male faces without moustache - this->DrawFaceStringLabel(SCMFW_WIDGET_LIPS_MOUSTACHE, GetCompanyManagerFaceBits(this->face, CMFV_LIPS, this->ge), false); + this->DrawFaceStringLabel(WID_SCMF_LIPS_MOUSTACHE, GetCompanyManagerFaceBits(this->face, CMFV_LIPS, this->ge), false); } break; - case SCMFW_WIDGET_HAS_GLASSES: - this->DrawFaceStringLabel(SCMFW_WIDGET_HAS_GLASSES, GetCompanyManagerFaceBits(this->face, CMFV_HAS_GLASSES, this->ge), true ); + case WID_SCMF_HAS_GLASSES: + this->DrawFaceStringLabel(WID_SCMF_HAS_GLASSES, GetCompanyManagerFaceBits(this->face, CMFV_HAS_GLASSES, this->ge), true ); break; - case SCMFW_WIDGET_HAIR: - this->DrawFaceStringLabel(SCMFW_WIDGET_HAIR, GetCompanyManagerFaceBits(this->face, CMFV_HAIR, this->ge), false); + case WID_SCMF_HAIR: + this->DrawFaceStringLabel(WID_SCMF_HAIR, GetCompanyManagerFaceBits(this->face, CMFV_HAIR, this->ge), false); break; - case SCMFW_WIDGET_EYEBROWS: - this->DrawFaceStringLabel(SCMFW_WIDGET_EYEBROWS, GetCompanyManagerFaceBits(this->face, CMFV_EYEBROWS, this->ge), false); + case WID_SCMF_EYEBROWS: + this->DrawFaceStringLabel(WID_SCMF_EYEBROWS, GetCompanyManagerFaceBits(this->face, CMFV_EYEBROWS, this->ge), false); break; - case SCMFW_WIDGET_EYECOLOUR: - this->DrawFaceStringLabel(SCMFW_WIDGET_EYECOLOUR, GetCompanyManagerFaceBits(this->face, CMFV_EYE_COLOUR, this->ge), false); + case WID_SCMF_EYECOLOUR: + this->DrawFaceStringLabel(WID_SCMF_EYECOLOUR, GetCompanyManagerFaceBits(this->face, CMFV_EYE_COLOUR, this->ge), false); break; - case SCMFW_WIDGET_GLASSES: - this->DrawFaceStringLabel(SCMFW_WIDGET_GLASSES, GetCompanyManagerFaceBits(this->face, CMFV_GLASSES, this->ge), false); + case WID_SCMF_GLASSES: + this->DrawFaceStringLabel(WID_SCMF_GLASSES, GetCompanyManagerFaceBits(this->face, CMFV_GLASSES, this->ge), false); break; - case SCMFW_WIDGET_NOSE: - this->DrawFaceStringLabel(SCMFW_WIDGET_NOSE, GetCompanyManagerFaceBits(this->face, CMFV_NOSE, this->ge), false); + case WID_SCMF_NOSE: + this->DrawFaceStringLabel(WID_SCMF_NOSE, GetCompanyManagerFaceBits(this->face, CMFV_NOSE, this->ge), false); break; - case SCMFW_WIDGET_CHIN: - this->DrawFaceStringLabel(SCMFW_WIDGET_CHIN, GetCompanyManagerFaceBits(this->face, CMFV_CHIN, this->ge), false); + case WID_SCMF_CHIN: + this->DrawFaceStringLabel(WID_SCMF_CHIN, GetCompanyManagerFaceBits(this->face, CMFV_CHIN, this->ge), false); break; - case SCMFW_WIDGET_JACKET: - this->DrawFaceStringLabel(SCMFW_WIDGET_JACKET, GetCompanyManagerFaceBits(this->face, CMFV_JACKET, this->ge), false); + case WID_SCMF_JACKET: + this->DrawFaceStringLabel(WID_SCMF_JACKET, GetCompanyManagerFaceBits(this->face, CMFV_JACKET, this->ge), false); break; - case SCMFW_WIDGET_COLLAR: - this->DrawFaceStringLabel(SCMFW_WIDGET_COLLAR, GetCompanyManagerFaceBits(this->face, CMFV_COLLAR, this->ge), false); + case WID_SCMF_COLLAR: + this->DrawFaceStringLabel(WID_SCMF_COLLAR, GetCompanyManagerFaceBits(this->face, CMFV_COLLAR, this->ge), false); break; - case SCMFM_WIDGET_FACE: + case WID_SCMF_FACE: DrawCompanyManagerFace(this->face, Company::Get((CompanyID)this->window_number)->colour, r.left, r.top); break; } @@ -1345,25 +1345,25 @@ public: { switch (widget) { /* Toggle size, advanced/simple face selection */ - case SCMFW_WIDGET_TOGGLE_LARGE_SMALL: - case SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON: + case WID_SCMF_TOGGLE_LARGE_SMALL: + case WID_SCMF_TOGGLE_LARGE_SMALL_BUTTON: this->advanced = !this->advanced; this->SelectDisplayPlanes(this->advanced); this->ReInit(); break; /* OK button */ - case SCMFW_WIDGET_ACCEPT: + case WID_SCMF_ACCEPT: DoCommandP(0, 0, this->face, CMD_SET_COMPANY_MANAGER_FACE); /* FALL THROUGH */ /* Cancel button */ - case SCMFW_WIDGET_CANCEL: + case WID_SCMF_CANCEL: delete this; break; /* Load button */ - case SCMFW_WIDGET_LOAD: + case WID_SCMF_LOAD: this->face = _company_manager_face; ScaleAllCompanyManagerFaceBits(this->face); ShowErrorMessage(STR_FACE_LOAD_DONE, INVALID_STRING_ID, WL_INFO); @@ -1372,54 +1372,54 @@ public: break; /* 'Company manager face number' button, view and/or set company manager face number */ - case SCMFW_WIDGET_FACECODE: + case WID_SCMF_FACECODE: SetDParam(0, this->face); ShowQueryString(STR_JUST_INT, STR_FACE_FACECODE_CAPTION, 10 + 1, this, CS_NUMERAL, QSF_NONE); break; /* Save button */ - case SCMFW_WIDGET_SAVE: + case WID_SCMF_SAVE: _company_manager_face = this->face; ShowErrorMessage(STR_FACE_SAVE_DONE, INVALID_STRING_ID, WL_INFO); break; /* Toggle gender (male/female) button */ - case SCMFW_WIDGET_MALE: - case SCMFW_WIDGET_FEMALE: - case SCMFW_WIDGET_MALE2: - case SCMFW_WIDGET_FEMALE2: - SetCompanyManagerFaceBits(this->face, CMFV_GENDER, this->ge, (widget == SCMFW_WIDGET_FEMALE || widget == SCMFW_WIDGET_FEMALE2)); + case WID_SCMF_MALE: + case WID_SCMF_FEMALE: + case WID_SCMF_MALE2: + case WID_SCMF_FEMALE2: + SetCompanyManagerFaceBits(this->face, CMFV_GENDER, this->ge, (widget == WID_SCMF_FEMALE || widget == WID_SCMF_FEMALE2)); ScaleAllCompanyManagerFaceBits(this->face); this->UpdateData(); this->SetDirty(); break; /* Randomize face button */ - case SCMFW_WIDGET_RANDOM_NEW_FACE: + case WID_SCMF_RANDOM_NEW_FACE: RandomCompanyManagerFaceBits(this->face, this->ge, this->advanced); this->UpdateData(); this->SetDirty(); break; /* Toggle ethnicity (european/african) button */ - case SCMFW_WIDGET_ETHNICITY_EUR: - case SCMFW_WIDGET_ETHNICITY_AFR: - SetCompanyManagerFaceBits(this->face, CMFV_ETHNICITY, this->ge, widget - SCMFW_WIDGET_ETHNICITY_EUR); + case WID_SCMF_ETHNICITY_EUR: + case WID_SCMF_ETHNICITY_AFR: + SetCompanyManagerFaceBits(this->face, CMFV_ETHNICITY, this->ge, widget - WID_SCMF_ETHNICITY_EUR); ScaleAllCompanyManagerFaceBits(this->face); this->UpdateData(); this->SetDirty(); break; default: - /* Here all buttons from SCMFW_WIDGET_HAS_MOUSTACHE_EARRING to SCMFW_WIDGET_GLASSES_R are handled. + /* Here all buttons from WID_SCMF_HAS_MOUSTACHE_EARRING to WID_SCMF_GLASSES_R are handled. * First it checks which CompanyManagerFaceVariable is being changed, and then either * a: invert the value for boolean variables, or * b: it checks inside of IncreaseCompanyManagerFaceBits() if a left (_L) butten is pressed and then decrease else increase the variable */ - if (widget >= SCMFW_WIDGET_HAS_MOUSTACHE_EARRING && widget <= SCMFW_WIDGET_GLASSES_R) { + if (widget >= WID_SCMF_HAS_MOUSTACHE_EARRING && widget <= WID_SCMF_GLASSES_R) { CompanyManagerFaceVariable cmfv; // which CompanyManagerFaceVariable shall be edited - if (widget < SCMFW_WIDGET_EYECOLOUR_L) { // Bool buttons - switch (widget - SCMFW_WIDGET_HAS_MOUSTACHE_EARRING) { + if (widget < WID_SCMF_EYECOLOUR_L) { // Bool buttons + switch (widget - WID_SCMF_HAS_MOUSTACHE_EARRING) { default: NOT_REACHED(); case 0: cmfv = this->is_female ? CMFV_HAS_TIE_EARRING : CMFV_HAS_MOUSTACHE; break; // Has earring/moustache button case 1: cmfv = CMFV_HAS_GLASSES; break; // Has glasses button @@ -1427,7 +1427,7 @@ public: SetCompanyManagerFaceBits(this->face, cmfv, this->ge, !GetCompanyManagerFaceBits(this->face, cmfv, this->ge)); ScaleAllCompanyManagerFaceBits(this->face); } else { // Value buttons - switch ((widget - SCMFW_WIDGET_EYECOLOUR_L) / 3) { + switch ((widget - WID_SCMF_EYECOLOUR_L) / 3) { default: NOT_REACHED(); case 0: cmfv = CMFV_EYE_COLOUR; break; // Eye colour buttons case 1: cmfv = CMFV_CHIN; break; // Chin buttons @@ -1441,7 +1441,7 @@ public: case 9: cmfv = CMFV_GLASSES; break; // Glasses buttons } /* 0 == left (_L), 1 == middle or 2 == right (_R) - button click */ - IncreaseCompanyManagerFaceBits(this->face, cmfv, this->ge, (((widget - SCMFW_WIDGET_EYECOLOUR_L) % 3) != 0) ? 1 : -1); + IncreaseCompanyManagerFaceBits(this->face, cmfv, this->ge, (((widget - WID_SCMF_EYECOLOUR_L) % 3) != 0) ? 1 : -1); } this->UpdateData(); this->SetDirty(); @@ -1468,21 +1468,21 @@ public: /** Both text values of parts of the face that depend on the #is_female boolean value. */ const StringID SelectCompanyManagerFaceWindow::PART_TEXTS_IS_FEMALE[] = { - STR_FACE_MOUSTACHE, STR_FACE_EARRING, // SCMFW_WIDGET_HAS_MOUSTACHE_EARRING_TEXT - STR_FACE_TIE, STR_FACE_EARRING, // SCMFW_WIDGET_TIE_EARRING_TEXT + STR_FACE_MOUSTACHE, STR_FACE_EARRING, // WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT + STR_FACE_TIE, STR_FACE_EARRING, // WID_SCMF_TIE_EARRING_TEXT }; /** Textual names for parts of the face. */ const StringID SelectCompanyManagerFaceWindow::PART_TEXTS[] = { - STR_FACE_GLASSES, // SCMFW_WIDGET_HAS_GLASSES_TEXT - STR_FACE_HAIR, // SCMFW_WIDGET_HAIR_TEXT - STR_FACE_EYEBROWS, // SCMFW_WIDGET_EYEBROWS_TEXT - STR_FACE_EYECOLOUR, // SCMFW_WIDGET_EYECOLOUR_TEXT - STR_FACE_GLASSES, // SCMFW_WIDGET_GLASSES_TEXT - STR_FACE_NOSE, // SCMFW_WIDGET_NOSE_TEXT - STR_FACE_CHIN, // SCMFW_WIDGET_CHIN_TEXT - STR_FACE_JACKET, // SCMFW_WIDGET_JACKET_TEXT - STR_FACE_COLLAR, // SCMFW_WIDGET_COLLAR_TEXT + STR_FACE_GLASSES, // WID_SCMF_HAS_GLASSES_TEXT + STR_FACE_HAIR, // WID_SCMF_HAIR_TEXT + STR_FACE_EYEBROWS, // WID_SCMF_EYEBROWS_TEXT + STR_FACE_EYECOLOUR, // WID_SCMF_EYECOLOUR_TEXT + STR_FACE_GLASSES, // WID_SCMF_GLASSES_TEXT + STR_FACE_NOSE, // WID_SCMF_NOSE_TEXT + STR_FACE_CHIN, // WID_SCMF_CHIN_TEXT + STR_FACE_JACKET, // WID_SCMF_JACKET_TEXT + STR_FACE_COLLAR, // WID_SCMF_COLLAR_TEXT }; /** Company manager face selection window description */ @@ -1512,31 +1512,31 @@ static void DoSelectCompanyManagerFace(Window *parent) static const NWidgetPart _nested_company_infrastructure_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, CIW_WIDGET_CAPTION), SetDataTip(STR_COMPANY_INFRASTRUCTURE_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_CI_CAPTION), SetDataTip(STR_COMPANY_INFRASTRUCTURE_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY), NWidget(NWID_VERTICAL), SetPIP(WD_FRAMERECT_TOP, 4, WD_FRAMETEXT_BOTTOM), NWidget(NWID_HORIZONTAL), SetPIP(2, 4, 2), - NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_RAIL_DESC), SetMinimalTextLines(2, 0), SetFill(1, 0), - NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_RAIL_COUNT), SetMinimalTextLines(2, 0), SetFill(0, 1), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_RAIL_DESC), SetMinimalTextLines(2, 0), SetFill(1, 0), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_RAIL_COUNT), SetMinimalTextLines(2, 0), SetFill(0, 1), EndContainer(), NWidget(NWID_HORIZONTAL), SetPIP(2, 4, 2), - NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_ROAD_DESC), SetMinimalTextLines(2, 0), SetFill(1, 0), - NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_ROAD_COUNT), SetMinimalTextLines(2, 0), SetFill(0, 1), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_ROAD_DESC), SetMinimalTextLines(2, 0), SetFill(1, 0), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_ROAD_COUNT), SetMinimalTextLines(2, 0), SetFill(0, 1), EndContainer(), NWidget(NWID_HORIZONTAL), SetPIP(2, 4, 2), - NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_WATER_DESC), SetMinimalTextLines(2, 0), SetFill(1, 0), - NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_WATER_COUNT), SetMinimalTextLines(2, 0), SetFill(0, 1), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_WATER_DESC), SetMinimalTextLines(2, 0), SetFill(1, 0), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_WATER_COUNT), SetMinimalTextLines(2, 0), SetFill(0, 1), EndContainer(), NWidget(NWID_HORIZONTAL), SetPIP(2, 4, 2), - NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_STATION_DESC), SetMinimalTextLines(3, 0), SetFill(1, 0), - NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_STATION_COUNT), SetMinimalTextLines(3, 0), SetFill(0, 1), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_STATION_DESC), SetMinimalTextLines(3, 0), SetFill(1, 0), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_STATION_COUNT), SetMinimalTextLines(3, 0), SetFill(0, 1), EndContainer(), NWidget(NWID_HORIZONTAL), SetPIP(2, 4, 2), - NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_TOTAL_DESC), SetFill(1, 0), - NWidget(WWT_EMPTY, COLOUR_GREY, CIW_WIDGET_TOTAL), SetFill(0, 1), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_TOTAL_DESC), SetFill(1, 0), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CI_TOTAL), SetFill(0, 1), EndContainer(), EndContainer(), EndContainer(), @@ -1610,7 +1610,7 @@ struct CompanyInfrastructureWindow : Window virtual void SetStringParameters(int widget) const { switch (widget) { - case CIW_WIDGET_CAPTION: + case WID_CI_CAPTION: SetDParam(0, (CompanyID)this->window_number); break; } @@ -1621,7 +1621,7 @@ struct CompanyInfrastructureWindow : Window const Company *c = Company::Get((CompanyID)this->window_number); switch (widget) { - case CIW_WIDGET_RAIL_DESC: { + case WID_CI_RAIL_DESC: { uint lines = 1; size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_RAIL_SECT).width); @@ -1642,7 +1642,7 @@ struct CompanyInfrastructureWindow : Window break; } - case CIW_WIDGET_ROAD_DESC: { + case WID_CI_ROAD_DESC: { uint lines = 1; size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_ROAD_SECT).width); @@ -1660,22 +1660,22 @@ struct CompanyInfrastructureWindow : Window break; } - case CIW_WIDGET_WATER_DESC: + case WID_CI_WATER_DESC: size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_WATER_SECT).width); size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_CANALS).width + WD_FRAMERECT_LEFT); break; - case CIW_WIDGET_STATION_DESC: + case WID_CI_STATION_DESC: size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_STATION_SECT).width); size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_STATIONS).width + WD_FRAMERECT_LEFT); size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_AIRPORTS).width + WD_FRAMERECT_LEFT); break; - case CIW_WIDGET_RAIL_COUNT: - case CIW_WIDGET_ROAD_COUNT: - case CIW_WIDGET_WATER_COUNT: - case CIW_WIDGET_STATION_COUNT: - case CIW_WIDGET_TOTAL: { + case WID_CI_RAIL_COUNT: + case WID_CI_ROAD_COUNT: + case WID_CI_WATER_COUNT: + case WID_CI_STATION_COUNT: + case WID_CI_TOTAL: { /* Find the maximum count that is displayed. */ uint32 max_val = 1000; // Some random number to reserve enough space. Money max_cost = 10000; // Some random number to reserve enough space. @@ -1707,7 +1707,7 @@ struct CompanyInfrastructureWindow : Window } /* Set height of the total line. */ - if (widget == CIW_WIDGET_TOTAL) { + if (widget == WID_CI_TOTAL) { size->height = _settings_game.economy.infrastructure_maintenance ? max(size->height, EXP_LINESPACE + FONT_HEIGHT_NORMAL) : 0; } break; @@ -1724,7 +1724,7 @@ struct CompanyInfrastructureWindow : Window int offs_right = _current_text_dir == TD_LTR ? 0 : WD_FRAMERECT_LEFT; switch (widget) { - case CIW_WIDGET_RAIL_DESC: + case WID_CI_RAIL_DESC: DrawString(r.left, r.right, y, STR_COMPANY_INFRASTRUCTURE_VIEW_RAIL_SECT); if (this->railtypes != RAILTYPES_NONE) { @@ -1743,7 +1743,7 @@ struct CompanyInfrastructureWindow : Window break; - case CIW_WIDGET_RAIL_COUNT: + case WID_CI_RAIL_COUNT: /* Draw infrastructure count for each valid railtype. */ for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) { if (HasBit(this->railtypes, rt)) { @@ -1759,7 +1759,7 @@ struct CompanyInfrastructureWindow : Window } break; - case CIW_WIDGET_ROAD_DESC: + case WID_CI_ROAD_DESC: DrawString(r.left, r.right, y, STR_COMPANY_INFRASTRUCTURE_VIEW_ROAD_SECT); if (this->roadtypes != ROADTYPES_NONE) { @@ -1772,7 +1772,7 @@ struct CompanyInfrastructureWindow : Window break; - case CIW_WIDGET_ROAD_COUNT: + case WID_CI_ROAD_COUNT: if (HasBit(this->roadtypes, ROADTYPE_ROAD)) { SetDParam(0, c->infrastructure.road[ROADTYPE_ROAD]); SetDParam(1, RoadMaintenanceCost(ROADTYPE_ROAD, c->infrastructure.road[ROADTYPE_ROAD]) * 12); // Convert to per year @@ -1785,18 +1785,18 @@ struct CompanyInfrastructureWindow : Window } break; - case CIW_WIDGET_WATER_DESC: + case WID_CI_WATER_DESC: DrawString(r.left, r.right, y, STR_COMPANY_INFRASTRUCTURE_VIEW_WATER_SECT); DrawString(r.left + offs_left, r.right - offs_right, y += FONT_HEIGHT_NORMAL, STR_COMPANY_INFRASTRUCTURE_VIEW_CANALS); break; - case CIW_WIDGET_WATER_COUNT: + case WID_CI_WATER_COUNT: SetDParam(0, c->infrastructure.water); SetDParam(1, CanalMaintenanceCost(c->infrastructure.water) * 12); // Convert to per year DrawString(r.left, r.right, y += FONT_HEIGHT_NORMAL, _settings_game.economy.infrastructure_maintenance ? STR_COMPANY_INFRASTRUCTURE_VIEW_COST : STR_WHITE_COMMA); break; - case CIW_WIDGET_TOTAL: + case WID_CI_TOTAL: if (_settings_game.economy.infrastructure_maintenance) { GfxFillRect(r.left, y, r.left + this->total_width, y, PC_WHITE); y += EXP_LINESPACE; @@ -1805,13 +1805,13 @@ struct CompanyInfrastructureWindow : Window } break; - case CIW_WIDGET_STATION_DESC: + case WID_CI_STATION_DESC: DrawString(r.left, r.right, y, STR_COMPANY_INFRASTRUCTURE_VIEW_STATION_SECT); DrawString(r.left + offs_left, r.right - offs_right, y += FONT_HEIGHT_NORMAL, STR_COMPANY_INFRASTRUCTURE_VIEW_STATIONS); DrawString(r.left + offs_left, r.right - offs_right, y += FONT_HEIGHT_NORMAL, STR_COMPANY_INFRASTRUCTURE_VIEW_AIRPORTS); break; - case CIW_WIDGET_STATION_COUNT: + case WID_CI_STATION_COUNT: SetDParam(0, c->infrastructure.station); SetDParam(1, StationMaintenanceCost(c->infrastructure.station) * 12); // Convert to per year DrawString(r.left, r.right, y += FONT_HEIGHT_NORMAL, _settings_game.economy.infrastructure_maintenance ? STR_COMPANY_INFRASTRUCTURE_VIEW_COST : STR_WHITE_COMMA); @@ -1856,64 +1856,64 @@ static void ShowCompanyInfrastructure(CompanyID company) static const NWidgetPart _nested_company_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, CW_WIDGET_CAPTION), SetDataTip(STR_COMPANY_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_C_CAPTION), SetDataTip(STR_COMPANY_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY), NWidget(NWID_HORIZONTAL), SetPIP(4, 6, 4), NWidget(NWID_VERTICAL), SetPIP(4, 2, 4), - NWidget(WWT_EMPTY, INVALID_COLOUR, CW_WIDGET_FACE), SetMinimalSize(92, 119), SetFill(1, 0), - NWidget(WWT_EMPTY, INVALID_COLOUR, CW_WIDGET_FACE_TITLE), SetFill(1, 1), SetMinimalTextLines(2, 0), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_FACE), SetMinimalSize(92, 119), SetFill(1, 0), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_FACE_TITLE), SetFill(1, 1), SetMinimalTextLines(2, 0), EndContainer(), NWidget(NWID_VERTICAL), NWidget(NWID_HORIZONTAL), NWidget(NWID_VERTICAL), SetPIP(4, 5, 5), - NWidget(WWT_TEXT, COLOUR_GREY, CW_WIDGET_DESC_INAUGURATION), SetDataTip(STR_COMPANY_VIEW_INAUGURATED_TITLE, STR_NULL), SetFill(1, 0), + NWidget(WWT_TEXT, COLOUR_GREY, WID_C_DESC_INAUGURATION), SetDataTip(STR_COMPANY_VIEW_INAUGURATED_TITLE, STR_NULL), SetFill(1, 0), NWidget(NWID_HORIZONTAL), SetPIP(0, 5, 0), - NWidget(WWT_LABEL, COLOUR_GREY, CW_WIDGET_DESC_COLOUR_SCHEME), SetDataTip(STR_COMPANY_VIEW_COLOUR_SCHEME_TITLE, STR_NULL), - NWidget(WWT_EMPTY, INVALID_COLOUR, CW_WIDGET_DESC_COLOUR_SCHEME_EXAMPLE), SetMinimalSize(30, 0), SetFill(0, 1), + NWidget(WWT_LABEL, COLOUR_GREY, WID_C_DESC_COLOUR_SCHEME), SetDataTip(STR_COMPANY_VIEW_COLOUR_SCHEME_TITLE, STR_NULL), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_DESC_COLOUR_SCHEME_EXAMPLE), SetMinimalSize(30, 0), SetFill(0, 1), NWidget(NWID_SPACER), SetFill(1, 0), EndContainer(), NWidget(NWID_HORIZONTAL), SetPIP(0, 4, 0), NWidget(NWID_VERTICAL), - NWidget(WWT_TEXT, COLOUR_GREY, CW_WIDGET_DESC_VEHICLE), SetDataTip(STR_COMPANY_VIEW_VEHICLES_TITLE, STR_NULL), + NWidget(WWT_TEXT, COLOUR_GREY, WID_C_DESC_VEHICLE), SetDataTip(STR_COMPANY_VIEW_VEHICLES_TITLE, STR_NULL), NWidget(NWID_SPACER), SetFill(0, 1), EndContainer(), - NWidget(WWT_EMPTY, INVALID_COLOUR, CW_WIDGET_DESC_VEHICLE_COUNTS), SetMinimalTextLines(4, 0), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_DESC_VEHICLE_COUNTS), SetMinimalTextLines(4, 0), NWidget(NWID_SPACER), SetFill(1, 0), EndContainer(), EndContainer(), NWidget(NWID_VERTICAL), SetPIP(4, 2, 4), - NWidget(NWID_SELECTION, INVALID_COLOUR, CW_WIDGET_SELECT_VIEW_BUILD_HQ), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_VIEW_HQ), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_VIEW_HQ_BUTTON, STR_COMPANY_VIEW_VIEW_HQ_TOOLTIP), - NWidget(WWT_TEXTBTN, COLOUR_GREY, CW_WIDGET_BUILD_HQ), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_BUILD_HQ_BUTTON, STR_COMPANY_VIEW_BUILD_HQ_TOOLTIP), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_C_SELECT_VIEW_BUILD_HQ), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_VIEW_HQ), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_VIEW_HQ_BUTTON, STR_COMPANY_VIEW_VIEW_HQ_TOOLTIP), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_C_BUILD_HQ), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_BUILD_HQ_BUTTON, STR_COMPANY_VIEW_BUILD_HQ_TOOLTIP), EndContainer(), - NWidget(NWID_SELECTION, INVALID_COLOUR, CW_WIDGET_SELECT_RELOCATE), - NWidget(WWT_TEXTBTN, COLOUR_GREY, CW_WIDGET_RELOCATE_HQ), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_RELOCATE_HQ, STR_COMPANY_VIEW_RELOCATE_COMPANY_HEADQUARTERS), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_C_SELECT_RELOCATE), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_C_RELOCATE_HQ), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_RELOCATE_HQ, STR_COMPANY_VIEW_RELOCATE_COMPANY_HEADQUARTERS), NWidget(NWID_SPACER), SetMinimalSize(90, 0), EndContainer(), NWidget(NWID_SPACER), SetFill(0, 1), EndContainer(), EndContainer(), - NWidget(WWT_TEXT, COLOUR_GREY, CW_WIDGET_DESC_COMPANY_VALUE), SetDataTip(STR_COMPANY_VIEW_COMPANY_VALUE, STR_NULL), SetFill(1, 0), + NWidget(WWT_TEXT, COLOUR_GREY, WID_C_DESC_COMPANY_VALUE), SetDataTip(STR_COMPANY_VIEW_COMPANY_VALUE, STR_NULL), SetFill(1, 0), NWidget(NWID_VERTICAL), SetPIP(4, 2, 4), NWidget(NWID_HORIZONTAL), SetPIP(0, 4, 0), NWidget(NWID_VERTICAL), - NWidget(WWT_TEXT, COLOUR_GREY, CW_WIDGET_DESC_INFRASTRUCTURE), SetDataTip(STR_COMPANY_VIEW_INFRASTRUCTURE, STR_NULL), + NWidget(WWT_TEXT, COLOUR_GREY, WID_C_DESC_INFRASTRUCTURE), SetDataTip(STR_COMPANY_VIEW_INFRASTRUCTURE, STR_NULL), NWidget(NWID_SPACER), SetFill(0, 1), EndContainer(), - NWidget(WWT_EMPTY, INVALID_COLOUR, CW_WIDGET_DESC_INFRASTRUCTURE_COUNTS), SetMinimalTextLines(5, 0), SetFill(1, 0), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_DESC_INFRASTRUCTURE_COUNTS), SetMinimalTextLines(5, 0), SetFill(1, 0), NWidget(NWID_VERTICAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_VIEW_INFRASTRUCTURE), SetDataTip(STR_COMPANY_VIEW_INFRASTRUCTURE_BUTTON, STR_COMPANY_VIEW_INFRASTRUCTURE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_VIEW_INFRASTRUCTURE), SetDataTip(STR_COMPANY_VIEW_INFRASTRUCTURE_BUTTON, STR_COMPANY_VIEW_INFRASTRUCTURE_TOOLTIP), NWidget(NWID_SPACER), SetFill(0, 1), SetMinimalSize(90, 0), EndContainer(), EndContainer(), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(NWID_SELECTION, INVALID_COLOUR, CW_WIDGET_SELECT_DESC_OWNERS), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_C_SELECT_DESC_OWNERS), NWidget(NWID_VERTICAL), SetPIP(5, 5, 4), - NWidget(WWT_EMPTY, INVALID_COLOUR, CW_WIDGET_DESC_OWNERS), SetMinimalTextLines(3, 0), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_DESC_OWNERS), SetMinimalTextLines(3, 0), NWidget(NWID_SPACER), SetFill(0, 1), EndContainer(), EndContainer(), @@ -1921,10 +1921,10 @@ static const NWidgetPart _nested_company_widgets[] = { NWidget(NWID_SPACER), SetMinimalSize(90, 0), SetFill(0, 1), /* Multi player buttons. */ NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, COLOUR_GREY, CW_WIDGET_HAS_PASSWORD), - NWidget(NWID_SELECTION, INVALID_COLOUR, CW_WIDGET_SELECT_MULTIPLAYER), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COMPANY_PASSWORD), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_PASSWORD, STR_COMPANY_VIEW_PASSWORD_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COMPANY_JOIN), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_JOIN, STR_COMPANY_VIEW_JOIN_TOOLTIP), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_C_HAS_PASSWORD), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_C_SELECT_MULTIPLAYER), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_COMPANY_PASSWORD), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_PASSWORD, STR_COMPANY_VIEW_PASSWORD_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_COMPANY_JOIN), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_JOIN, STR_COMPANY_VIEW_JOIN_TOOLTIP), EndContainer(), EndContainer(), EndContainer(), @@ -1933,16 +1933,16 @@ static const NWidgetPart _nested_company_widgets[] = { EndContainer(), EndContainer(), /* Button bars at the bottom. */ - NWidget(NWID_SELECTION, INVALID_COLOUR, CW_WIDGET_SELECT_BUTTONS), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_C_SELECT_BUTTONS), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_NEW_FACE), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_NEW_FACE_BUTTON, STR_COMPANY_VIEW_NEW_FACE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COLOUR_SCHEME), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_COLOUR_SCHEME_BUTTON, STR_COMPANY_VIEW_COLOUR_SCHEME_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_PRESIDENT_NAME), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_PRESIDENT_NAME_BUTTON, STR_COMPANY_VIEW_PRESIDENT_NAME_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_COMPANY_NAME), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_COMPANY_NAME_BUTTON, STR_COMPANY_VIEW_COMPANY_NAME_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_NEW_FACE), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_NEW_FACE_BUTTON, STR_COMPANY_VIEW_NEW_FACE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_COLOUR_SCHEME), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_COLOUR_SCHEME_BUTTON, STR_COMPANY_VIEW_COLOUR_SCHEME_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_PRESIDENT_NAME), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_PRESIDENT_NAME_BUTTON, STR_COMPANY_VIEW_PRESIDENT_NAME_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_COMPANY_NAME), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_COMPANY_NAME_BUTTON, STR_COMPANY_VIEW_COMPANY_NAME_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_BUY_SHARE), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_BUY_SHARE_BUTTON, STR_COMPANY_VIEW_BUY_SHARE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, CW_WIDGET_SELL_SHARE), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_SELL_SHARE_BUTTON, STR_COMPANY_VIEW_SELL_SHARE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_BUY_SHARE), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_BUY_SHARE_BUTTON, STR_COMPANY_VIEW_BUY_SHARE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_SELL_SHARE), SetFill(1, 0), SetDataTip(STR_COMPANY_VIEW_SELL_SHARE_BUTTON, STR_COMPANY_VIEW_SELL_SHARE_TOOLTIP), EndContainer(), EndContainer(), }; @@ -1965,23 +1965,23 @@ static const StringID _company_view_vehicle_count_strings[] = { */ struct CompanyWindow : Window { - CompanyWindowWidgets query_widget; + CompanyWidgets query_widget; /** Display planes in the company window. */ enum CompanyWindowPlanes { - /* Display planes of the #CW_WIDGET_SELECT_MULTIPLAYER selection widget. */ + /* Display planes of the #WID_C_SELECT_MULTIPLAYER selection widget. */ CWP_MP_C_PWD = 0, ///< Display the company password button. CWP_MP_C_JOIN, ///< Display the join company button. - /* Display planes of the #CW_WIDGET_SELECT_VIEW_BUILD_HQ selection widget. */ + /* Display planes of the #WID_C_SELECT_VIEW_BUILD_HQ selection widget. */ CWP_VB_VIEW = 0, ///< Display the view button CWP_VB_BUILD, ///< Display the build button - /* Display planes of the #CW_WIDGET_SELECT_RELOCATE selection widget. */ + /* Display planes of the #WID_C_SELECT_RELOCATE selection widget. */ CWP_RELOCATE_SHOW = 0, ///< Show the relocate HQ button. CWP_RELOCATE_HIDE, ///< Hide the relocate HQ button. - /* Display planes of the #CW_WIDGET_SELECT_BUTTONS selection widget. */ + /* Display planes of the #WID_C_SELECT_BUTTONS selection widget. */ CWP_BUTTONS_LOCAL = 0, ///< Buttons of the local company. CWP_BUTTONS_OTHER, ///< Buttons of the other companies. }; @@ -2002,7 +2002,7 @@ struct CompanyWindow : Window /* Button bar selection. */ int plane = local ? CWP_BUTTONS_LOCAL : CWP_BUTTONS_OTHER; - NWidgetStacked *wi = this->GetWidget<NWidgetStacked>(CW_WIDGET_SELECT_BUTTONS); + NWidgetStacked *wi = this->GetWidget<NWidgetStacked>(WID_C_SELECT_BUTTONS); if (plane != wi->shown_plane) { wi->SetDisplayedPlane(plane); this->SetDirty(); @@ -2011,18 +2011,18 @@ struct CompanyWindow : Window /* Build HQ button handling. */ plane = (local && c->location_of_HQ == INVALID_TILE) ? CWP_VB_BUILD : CWP_VB_VIEW; - wi = this->GetWidget<NWidgetStacked>(CW_WIDGET_SELECT_VIEW_BUILD_HQ); + wi = this->GetWidget<NWidgetStacked>(WID_C_SELECT_VIEW_BUILD_HQ); if (plane != wi->shown_plane) { wi->SetDisplayedPlane(plane); this->SetDirty(); return; } - this->SetWidgetDisabledState(CW_WIDGET_VIEW_HQ, c->location_of_HQ == INVALID_TILE); + this->SetWidgetDisabledState(WID_C_VIEW_HQ, c->location_of_HQ == INVALID_TILE); /* Enable/disable 'Relocate HQ' button. */ plane = (!local || c->location_of_HQ == INVALID_TILE) ? CWP_RELOCATE_HIDE : CWP_RELOCATE_SHOW; - wi = this->GetWidget<NWidgetStacked>(CW_WIDGET_SELECT_RELOCATE); + wi = this->GetWidget<NWidgetStacked>(WID_C_SELECT_RELOCATE); if (plane != wi->shown_plane) { wi->SetDisplayedPlane(plane); this->SetDirty(); @@ -2037,7 +2037,7 @@ struct CompanyWindow : Window break; } } - wi = this->GetWidget<NWidgetStacked>(CW_WIDGET_SELECT_DESC_OWNERS); + wi = this->GetWidget<NWidgetStacked>(WID_C_SELECT_DESC_OWNERS); if (plane != wi->shown_plane) { wi->SetDisplayedPlane(plane); reinit = true; @@ -2045,12 +2045,12 @@ struct CompanyWindow : Window /* Multiplayer buttons. */ plane = ((!_networking) ? (int)SZSP_NONE : (int)(local ? CWP_MP_C_PWD : CWP_MP_C_JOIN)); - wi = this->GetWidget<NWidgetStacked>(CW_WIDGET_SELECT_MULTIPLAYER); + wi = this->GetWidget<NWidgetStacked>(WID_C_SELECT_MULTIPLAYER); if (plane != wi->shown_plane) { wi->SetDisplayedPlane(plane); reinit = true; } - this->SetWidgetDisabledState(CW_WIDGET_COMPANY_JOIN, c->is_ai); + this->SetWidgetDisabledState(WID_C_COMPANY_JOIN, c->is_ai); if (reinit) { this->ReInit(); @@ -2061,19 +2061,19 @@ struct CompanyWindow : Window if (!local) { if (_settings_game.economy.allow_shares) { // Shares are allowed /* If all shares are owned by someone (none by nobody), disable buy button */ - this->SetWidgetDisabledState(CW_WIDGET_BUY_SHARE, GetAmountOwnedBy(c, INVALID_OWNER) == 0 || + this->SetWidgetDisabledState(WID_C_BUY_SHARE, GetAmountOwnedBy(c, INVALID_OWNER) == 0 || /* Only 25% left to buy. If the company is human, disable buying it up.. TODO issues! */ (GetAmountOwnedBy(c, INVALID_OWNER) == 1 && !c->is_ai) || /* Spectators cannot do anything of course */ _local_company == COMPANY_SPECTATOR); /* If the company doesn't own any shares, disable sell button */ - this->SetWidgetDisabledState(CW_WIDGET_SELL_SHARE, (GetAmountOwnedBy(c, _local_company) == 0) || + this->SetWidgetDisabledState(WID_C_SELL_SHARE, (GetAmountOwnedBy(c, _local_company) == 0) || /* Spectators cannot do anything of course */ _local_company == COMPANY_SPECTATOR); } else { // Shares are not allowed, disable buy/sell buttons - this->DisableWidget(CW_WIDGET_BUY_SHARE); - this->DisableWidget(CW_WIDGET_SELL_SHARE); + this->DisableWidget(WID_C_BUY_SHARE); + this->DisableWidget(WID_C_SELL_SHARE); } } @@ -2083,7 +2083,7 @@ struct CompanyWindow : Window virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case CW_WIDGET_DESC_COLOUR_SCHEME_EXAMPLE: { + case WID_C_DESC_COLOUR_SCHEME_EXAMPLE: { Point offset; Dimension d = GetSpriteSize(SPR_VEH_BUS_SW_VIEW, &offset); d.width -= offset.x; @@ -2092,19 +2092,19 @@ struct CompanyWindow : Window break; } - case CW_WIDGET_DESC_COMPANY_VALUE: + case WID_C_DESC_COMPANY_VALUE: SetDParam(0, INT64_MAX); // Arguably the maximum company value size->width = GetStringBoundingBox(STR_COMPANY_VIEW_COMPANY_VALUE).width; break; - case CW_WIDGET_DESC_VEHICLE_COUNTS: + case WID_C_DESC_VEHICLE_COUNTS: SetDParam(0, 5000); // Maximum number of vehicles for (uint i = 0; i < lengthof(_company_view_vehicle_count_strings); i++) { size->width = max(size->width, GetStringBoundingBox(_company_view_vehicle_count_strings[i]).width); } break; - case CW_WIDGET_DESC_INFRASTRUCTURE_COUNTS: + case WID_C_DESC_INFRASTRUCTURE_COUNTS: SetDParam(0, UINT_MAX); size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_RAIL).width); size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_ROAD).width); @@ -2114,7 +2114,7 @@ struct CompanyWindow : Window size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_NONE).width); break; - case CW_WIDGET_DESC_OWNERS: { + case WID_C_DESC_OWNERS: { const Company *c2; FOR_ALL_COMPANIES(c2) { @@ -2127,7 +2127,7 @@ struct CompanyWindow : Window } #ifdef ENABLE_NETWORK - case CW_WIDGET_HAS_PASSWORD: + case WID_C_HAS_PASSWORD: *size = maxdim(*size, GetSpriteSize(SPR_LOCK)); break; #endif /* ENABLE_NETWORK */ @@ -2138,16 +2138,16 @@ struct CompanyWindow : Window { const Company *c = Company::Get((CompanyID)this->window_number); switch (widget) { - case CW_WIDGET_FACE: + case WID_C_FACE: DrawCompanyManagerFace(c->face, c->colour, r.left, r.top); break; - case CW_WIDGET_FACE_TITLE: + case WID_C_FACE_TITLE: SetDParam(0, c->index); DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_COMPANY_VIEW_PRESIDENT_MANAGER_TITLE, TC_FROMSTRING, SA_HOR_CENTER); break; - case CW_WIDGET_DESC_COLOUR_SCHEME_EXAMPLE: { + case WID_C_DESC_COLOUR_SCHEME_EXAMPLE: { Point offset; Dimension d = GetSpriteSize(SPR_VEH_BUS_SW_VIEW, &offset); d.height -= offset.y; @@ -2155,7 +2155,7 @@ struct CompanyWindow : Window break; } - case CW_WIDGET_DESC_VEHICLE_COUNTS: { + case WID_C_DESC_VEHICLE_COUNTS: { uint amounts[4]; amounts[0] = c->group_all[VEH_TRAIN].num_vehicle; amounts[1] = c->group_all[VEH_ROAD].num_vehicle; @@ -2179,7 +2179,7 @@ struct CompanyWindow : Window break; } - case CW_WIDGET_DESC_INFRASTRUCTURE_COUNTS: { + case WID_C_DESC_INFRASTRUCTURE_COUNTS: { uint y = r.top; /* Collect rail and road counts. */ @@ -2220,7 +2220,7 @@ struct CompanyWindow : Window break; } - case CW_WIDGET_DESC_OWNERS: { + case WID_C_DESC_OWNERS: { const Company *c2; uint y = r.top; @@ -2238,7 +2238,7 @@ struct CompanyWindow : Window } #ifdef ENABLE_NETWORK - case CW_WIDGET_HAS_PASSWORD: + case WID_C_HAS_PASSWORD: if (_networking && NetworkCompanyIsPassworded(c->index)) { DrawSprite(SPR_LOCK, PAL_NONE, r.left, r.top); } @@ -2250,16 +2250,16 @@ struct CompanyWindow : Window virtual void SetStringParameters(int widget) const { switch (widget) { - case CW_WIDGET_CAPTION: + case WID_C_CAPTION: SetDParam(0, (CompanyID)this->window_number); SetDParam(1, (CompanyID)this->window_number); break; - case CW_WIDGET_DESC_INAUGURATION: + case WID_C_DESC_INAUGURATION: SetDParam(0, Company::Get((CompanyID)this->window_number)->inaugurated_year); break; - case CW_WIDGET_DESC_COMPANY_VALUE: + case WID_C_DESC_COMPANY_VALUE: SetDParam(0, CalculateCompanyValue(Company::Get((CompanyID)this->window_number))); break; } @@ -2268,26 +2268,26 @@ struct CompanyWindow : Window virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case CW_WIDGET_NEW_FACE: DoSelectCompanyManagerFace(this); break; + case WID_C_NEW_FACE: DoSelectCompanyManagerFace(this); break; - case CW_WIDGET_COLOUR_SCHEME: + case WID_C_COLOUR_SCHEME: if (BringWindowToFrontById(WC_COMPANY_COLOUR, this->window_number)) break; new SelectCompanyLiveryWindow(&_select_company_livery_desc, (CompanyID)this->window_number); break; - case CW_WIDGET_PRESIDENT_NAME: - this->query_widget = CW_WIDGET_PRESIDENT_NAME; + case WID_C_PRESIDENT_NAME: + this->query_widget = WID_C_PRESIDENT_NAME; SetDParam(0, this->window_number); ShowQueryString(STR_PRESIDENT_NAME, STR_COMPANY_VIEW_PRESIDENT_S_NAME_QUERY_CAPTION, MAX_LENGTH_PRESIDENT_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); break; - case CW_WIDGET_COMPANY_NAME: - this->query_widget = CW_WIDGET_COMPANY_NAME; + case WID_C_COMPANY_NAME: + this->query_widget = WID_C_COMPANY_NAME; SetDParam(0, this->window_number); ShowQueryString(STR_COMPANY_NAME, STR_COMPANY_VIEW_COMPANY_NAME_QUERY_CAPTION, MAX_LENGTH_COMPANY_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); break; - case CW_WIDGET_VIEW_HQ: { + case WID_C_VIEW_HQ: { TileIndex tile = Company::Get((CompanyID)this->window_number)->location_of_HQ; if (_ctrl_pressed) { ShowExtraViewPortWindow(tile); @@ -2297,50 +2297,50 @@ struct CompanyWindow : Window break; } - case CW_WIDGET_BUILD_HQ: + case WID_C_BUILD_HQ: if ((byte)this->window_number != _local_company) return; - if (this->IsWidgetLowered(CW_WIDGET_BUILD_HQ)) { + if (this->IsWidgetLowered(WID_C_BUILD_HQ)) { ResetObjectToPlace(); this->RaiseButtons(); break; } SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this); SetTileSelectSize(2, 2); - this->LowerWidget(CW_WIDGET_BUILD_HQ); - this->SetWidgetDirty(CW_WIDGET_BUILD_HQ); + this->LowerWidget(WID_C_BUILD_HQ); + this->SetWidgetDirty(WID_C_BUILD_HQ); break; - case CW_WIDGET_RELOCATE_HQ: - if (this->IsWidgetLowered(CW_WIDGET_RELOCATE_HQ)) { + case WID_C_RELOCATE_HQ: + if (this->IsWidgetLowered(WID_C_RELOCATE_HQ)) { ResetObjectToPlace(); this->RaiseButtons(); break; } SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, HT_RECT, this); SetTileSelectSize(2, 2); - this->LowerWidget(CW_WIDGET_RELOCATE_HQ); - this->SetWidgetDirty(CW_WIDGET_RELOCATE_HQ); + this->LowerWidget(WID_C_RELOCATE_HQ); + this->SetWidgetDirty(WID_C_RELOCATE_HQ); break; - case CW_WIDGET_VIEW_INFRASTRUCTURE: + case WID_C_VIEW_INFRASTRUCTURE: ShowCompanyInfrastructure((CompanyID)this->window_number); break; - case CW_WIDGET_BUY_SHARE: + case WID_C_BUY_SHARE: DoCommandP(0, this->window_number, 0, CMD_BUY_SHARE_IN_COMPANY | CMD_MSG(STR_ERROR_CAN_T_BUY_25_SHARE_IN_THIS)); break; - case CW_WIDGET_SELL_SHARE: + case WID_C_SELL_SHARE: DoCommandP(0, this->window_number, 0, CMD_SELL_SHARE_IN_COMPANY | CMD_MSG(STR_ERROR_CAN_T_SELL_25_SHARE_IN)); break; #ifdef ENABLE_NETWORK - case CW_WIDGET_COMPANY_PASSWORD: + case WID_C_COMPANY_PASSWORD: if (this->window_number == _local_company) ShowNetworkCompanyPasswordWindow(this); break; - case CW_WIDGET_COMPANY_JOIN: { - this->query_widget = CW_WIDGET_COMPANY_JOIN; + case WID_C_COMPANY_JOIN: { + this->query_widget = WID_C_COMPANY_JOIN; CompanyID company = (CompanyID)this->window_number; if (_network_server) { NetworkServerDoMove(CLIENT_ID_SERVER, company); @@ -2384,16 +2384,16 @@ struct CompanyWindow : Window switch (this->query_widget) { default: NOT_REACHED(); - case CW_WIDGET_PRESIDENT_NAME: + case WID_C_PRESIDENT_NAME: DoCommandP(0, 0, 0, CMD_RENAME_PRESIDENT | CMD_MSG(STR_ERROR_CAN_T_CHANGE_PRESIDENT), NULL, str); break; - case CW_WIDGET_COMPANY_NAME: + case WID_C_COMPANY_NAME: DoCommandP(0, 0, 0, CMD_RENAME_COMPANY | CMD_MSG(STR_ERROR_CAN_T_CHANGE_COMPANY_NAME), NULL, str); break; #ifdef ENABLE_NETWORK - case CW_WIDGET_COMPANY_JOIN: + case WID_C_COMPANY_JOIN: NetworkClientRequestMove((CompanyID)this->window_number, str); break; #endif /* ENABLE_NETWORK */ @@ -2438,11 +2438,11 @@ struct BuyCompanyWindow : Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case BCW_FACE: + case WID_BC_FACE: *size = GetSpriteSize(SPR_GRADIENT); break; - case BCW_QUESTION: + case WID_BC_QUESTION: const Company *c = Company::Get((CompanyID)this->window_number); SetDParam(0, c->index); SetDParam(1, c->bankrupt_value); @@ -2454,7 +2454,7 @@ struct BuyCompanyWindow : Window { virtual void SetStringParameters(int widget) const { switch (widget) { - case BCW_CAPTION: + case WID_BC_CAPTION: SetDParam(0, STR_COMPANY_NAME); SetDParam(1, Company::Get((CompanyID)this->window_number)->index); break; @@ -2464,13 +2464,13 @@ struct BuyCompanyWindow : Window { virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case BCW_FACE: { + case WID_BC_FACE: { const Company *c = Company::Get((CompanyID)this->window_number); DrawCompanyManagerFace(c->face, c->colour, r.left, r.top); break; } - case BCW_QUESTION: { + case WID_BC_QUESTION: { const Company *c = Company::Get((CompanyID)this->window_number); SetDParam(0, c->index); SetDParam(1, c->bankrupt_value); @@ -2483,11 +2483,11 @@ struct BuyCompanyWindow : Window { virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case BCW_NO: + case WID_BC_NO: delete this; break; - case BCW_YES: + case WID_BC_YES: DoCommandP(0, this->window_number, 0, CMD_BUY_COMPANY | CMD_MSG(STR_ERROR_CAN_T_BUY_COMPANY)); break; } @@ -2497,17 +2497,17 @@ struct BuyCompanyWindow : Window { static const NWidgetPart _nested_buy_company_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), - NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, BCW_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, WID_BC_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE), NWidget(NWID_VERTICAL), SetPIP(8, 8, 8), NWidget(NWID_HORIZONTAL), SetPIP(8, 10, 8), - NWidget(WWT_EMPTY, INVALID_COLOUR, BCW_FACE), SetFill(0, 1), - NWidget(WWT_EMPTY, INVALID_COLOUR, BCW_QUESTION), SetMinimalSize(240, 0), SetFill(1, 1), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_BC_FACE), SetFill(0, 1), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_BC_QUESTION), SetMinimalSize(240, 0), SetFill(1, 1), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(100, 10, 100), - NWidget(WWT_TEXTBTN, COLOUR_LIGHT_BLUE, BCW_NO), SetMinimalSize(60, 12), SetDataTip(STR_QUIT_NO, STR_NULL), SetFill(1, 0), - NWidget(WWT_TEXTBTN, COLOUR_LIGHT_BLUE, BCW_YES), SetMinimalSize(60, 12), SetDataTip(STR_QUIT_YES, STR_NULL), SetFill(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_LIGHT_BLUE, WID_BC_NO), SetMinimalSize(60, 12), SetDataTip(STR_QUIT_NO, STR_NULL), SetFill(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_LIGHT_BLUE, WID_BC_YES), SetMinimalSize(60, 12), SetDataTip(STR_QUIT_YES, STR_NULL), SetFill(1, 0), EndContainer(), EndContainer(), EndContainer(), diff --git a/src/console_gui.cpp b/src/console_gui.cpp index 8dd1f7cd6..a202975a8 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -155,7 +155,7 @@ static const char *IConsoleHistoryAdd(const char *cmd); static void IConsoleHistoryNavigate(int direction); static const struct NWidgetPart _nested_console_window_widgets[] = { - NWidget(WWT_EMPTY, INVALID_COLOUR, CW_BACKGROUND), SetResize(1, 1), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_BACKGROUND), SetResize(1, 1), }; static const WindowDesc _console_window_desc( diff --git a/src/date_gui.cpp b/src/date_gui.cpp index c179641d8..588c04b8e 100644 --- a/src/date_gui.cpp +++ b/src/date_gui.cpp @@ -72,21 +72,21 @@ struct SetDateWindow : Window { switch (widget) { default: NOT_REACHED(); - case SDW_DAY: + case WID_SD_DAY: for (uint i = 0; i < 31; i++) { list->push_back(new DropDownListStringItem(STR_ORDINAL_NUMBER_1ST + i, i + 1, false)); } selected = this->date.day; break; - case SDW_MONTH: + case WID_SD_MONTH: for (uint i = 0; i < 12; i++) { list->push_back(new DropDownListStringItem(STR_MONTH_JAN + i, i, false)); } selected = this->date.month; break; - case SDW_YEAR: + case WID_SD_YEAR: for (Year i = this->min_year; i <= this->max_year; i++) { DropDownListParamStringItem *item = new DropDownListParamStringItem(STR_JUST_INT, i, false); item->SetParam(0, i); @@ -105,19 +105,19 @@ struct SetDateWindow : Window { switch (widget) { default: return; - case SDW_DAY: + case WID_SD_DAY: for (uint i = 0; i < 31; i++) { d = maxdim(d, GetStringBoundingBox(STR_ORDINAL_NUMBER_1ST + i)); } break; - case SDW_MONTH: + case WID_SD_MONTH: for (uint i = 0; i < 12; i++) { d = maxdim(d, GetStringBoundingBox(STR_MONTH_JAN + i)); } break; - case SDW_YEAR: + case WID_SD_YEAR: for (Year i = this->min_year; i <= this->max_year; i++) { SetDParam(0, i); d = maxdim(d, GetStringBoundingBox(STR_JUST_INT)); @@ -133,22 +133,22 @@ struct SetDateWindow : Window { virtual void SetStringParameters(int widget) const { switch (widget) { - case SDW_DAY: SetDParam(0, this->date.day - 1 + STR_ORDINAL_NUMBER_1ST); break; - case SDW_MONTH: SetDParam(0, this->date.month + STR_MONTH_JAN); break; - case SDW_YEAR: SetDParam(0, this->date.year); break; + case WID_SD_DAY: SetDParam(0, this->date.day - 1 + STR_ORDINAL_NUMBER_1ST); break; + case WID_SD_MONTH: SetDParam(0, this->date.month + STR_MONTH_JAN); break; + case WID_SD_YEAR: SetDParam(0, this->date.year); break; } } virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case SDW_DAY: - case SDW_MONTH: - case SDW_YEAR: + case WID_SD_DAY: + case WID_SD_MONTH: + case WID_SD_YEAR: ShowDateDropDown(widget); break; - case SDW_SET_DATE: + case WID_SD_SET_DATE: if (this->callback != NULL) this->callback(this->parent, ConvertYMDToDate(this->date.year, this->date.month, this->date.day)); delete this; break; @@ -158,15 +158,15 @@ struct SetDateWindow : Window { virtual void OnDropdownSelect(int widget, int index) { switch (widget) { - case SDW_DAY: + case WID_SD_DAY: this->date.day = index; break; - case SDW_MONTH: + case WID_SD_MONTH: this->date.month = index; break; - case SDW_YEAR: + case WID_SD_YEAR: this->date.year = index; break; } @@ -183,13 +183,13 @@ static const NWidgetPart _nested_set_date_widgets[] = { NWidget(WWT_PANEL, COLOUR_BROWN), NWidget(NWID_VERTICAL), SetPIP(6, 6, 6), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(6, 6, 6), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, SDW_DAY), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_DATE_DAY_TOOLTIP), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, SDW_MONTH), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_DATE_MONTH_TOOLTIP), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, SDW_YEAR), SetFill(1, 0), SetDataTip(STR_JUST_INT, STR_DATE_YEAR_TOOLTIP), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_SD_DAY), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_DATE_DAY_TOOLTIP), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_SD_MONTH), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_DATE_MONTH_TOOLTIP), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_SD_YEAR), SetFill(1, 0), SetDataTip(STR_JUST_INT, STR_DATE_YEAR_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, SDW_SET_DATE), SetMinimalSize(100, 12), SetDataTip(STR_DATE_SET_DATE, STR_DATE_SET_DATE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_SD_SET_DATE), SetMinimalSize(100, 12), SetDataTip(STR_DATE_SET_DATE, STR_DATE_SET_DATE_TOOLTIP), NWidget(NWID_SPACER), SetFill(1, 0), EndContainer(), EndContainer(), diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 0535347fd..f230269af 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -44,37 +44,37 @@ static const NWidgetPart _nested_train_depot_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, DEPOT_WIDGET_CAPTION), SetDataTip(STR_DEPOT_CAPTION, STR_NULL), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_VD_CAPTION), SetDataTip(STR_DEPOT_CAPTION, STR_NULL), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(NWID_VERTICAL), - NWidget(WWT_MATRIX, COLOUR_GREY, DEPOT_WIDGET_MATRIX), SetDataTip(0x0, STR_NULL), SetResize(1, 1), SetScrollbar(DEPOT_WIDGET_V_SCROLL), - NWidget(NWID_SELECTION, INVALID_COLOUR, DEPOT_WIDGET_SHOW_H_SCROLL), - NWidget(NWID_HSCROLLBAR, COLOUR_GREY, DEPOT_WIDGET_H_SCROLL), + NWidget(WWT_MATRIX, COLOUR_GREY, WID_VD_MATRIX), SetDataTip(0x0, STR_NULL), SetResize(1, 1), SetScrollbar(WID_VD_V_SCROLL), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_VD_SHOW_H_SCROLL), + NWidget(NWID_HSCROLLBAR, COLOUR_GREY, WID_VD_H_SCROLL), EndContainer(), EndContainer(), NWidget(NWID_VERTICAL), - NWidget(WWT_IMGBTN, COLOUR_GREY, DEPOT_WIDGET_SELL), SetDataTip(0x0, STR_NULL), SetResize(0, 1), SetFill(0, 1), - NWidget(NWID_SELECTION, INVALID_COLOUR, DEPOT_WIDGET_SHOW_SELL_CHAIN), - NWidget(WWT_IMGBTN, COLOUR_GREY, DEPOT_WIDGET_SELL_CHAIN), SetDataTip(SPR_SELL_CHAIN_TRAIN, STR_DEPOT_DRAG_WHOLE_TRAIN_TO_SELL_TOOLTIP), SetResize(0, 1), SetFill(0, 1), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_VD_SELL), SetDataTip(0x0, STR_NULL), SetResize(0, 1), SetFill(0, 1), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_VD_SHOW_SELL_CHAIN), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_VD_SELL_CHAIN), SetDataTip(SPR_SELL_CHAIN_TRAIN, STR_DEPOT_DRAG_WHOLE_TRAIN_TO_SELL_TOOLTIP), SetResize(0, 1), SetFill(0, 1), EndContainer(), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, DEPOT_WIDGET_SELL_ALL), SetDataTip(0x0, STR_NULL), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, DEPOT_WIDGET_AUTOREPLACE), SetDataTip(0x0, STR_NULL), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VD_SELL_ALL), SetDataTip(0x0, STR_NULL), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VD_AUTOREPLACE), SetDataTip(0x0, STR_NULL), EndContainer(), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, DEPOT_WIDGET_V_SCROLL), + NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_VD_V_SCROLL), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, DEPOT_WIDGET_BUILD), SetDataTip(0x0, STR_NULL), SetFill(1, 1), SetResize(1, 0), - NWidget(WWT_TEXTBTN, COLOUR_GREY, DEPOT_WIDGET_CLONE), SetDataTip(0x0, STR_NULL), SetFill(1, 1), SetResize(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, DEPOT_WIDGET_LOCATION), SetDataTip(STR_BUTTON_LOCATION, STR_NULL), SetFill(1, 1), SetResize(1, 0), - NWidget(NWID_SELECTION, INVALID_COLOUR, DEPOT_WIDGET_SHOW_RENAME), // rename button - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, DEPOT_WIDGET_RENAME), SetDataTip(STR_BUTTON_RENAME, STR_DEPOT_RENAME_TOOLTIP), SetFill(1, 1), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VD_BUILD), SetDataTip(0x0, STR_NULL), SetFill(1, 1), SetResize(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_VD_CLONE), SetDataTip(0x0, STR_NULL), SetFill(1, 1), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VD_LOCATION), SetDataTip(STR_BUTTON_LOCATION, STR_NULL), SetFill(1, 1), SetResize(1, 0), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_VD_SHOW_RENAME), // rename button + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VD_RENAME), SetDataTip(STR_BUTTON_RENAME, STR_DEPOT_RENAME_TOOLTIP), SetFill(1, 1), SetResize(1, 0), EndContainer(), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, DEPOT_WIDGET_VEHICLE_LIST), SetDataTip(0x0, STR_NULL), SetFill(0, 1), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, DEPOT_WIDGET_STOP_ALL), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_NULL), SetFill(0, 1), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, DEPOT_WIDGET_START_ALL), SetDataTip(SPR_FLAG_VEH_RUNNING, STR_NULL), SetFill(0, 1), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VD_VEHICLE_LIST), SetDataTip(0x0, STR_NULL), SetFill(0, 1), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VD_STOP_ALL), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_NULL), SetFill(0, 1), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VD_START_ALL), SetDataTip(SPR_FLAG_VEH_RUNNING, STR_NULL), SetFill(0, 1), NWidget(WWT_RESIZEBOX, COLOUR_GREY), EndContainer(), }; @@ -144,7 +144,7 @@ static void TrainDepotMoveVehicle(const Vehicle *wagon, VehicleID sel, const Veh } /** - * Array containing the cell size in pixels of the #DEPOT_WIDGET_MATRIX widget for each vehicle type. + * Array containing the cell size in pixels of the #WID_VD_MATRIX widget for each vehicle type. * @note The train vehicle type uses the entire row for each train. */ static Dimension _base_block_sizes[4]; @@ -221,13 +221,13 @@ struct DepotWindow : Window { this->num_columns = 1; // for non-trains this gets set in FinishInitNested() this->CreateNestedTree(desc); - this->hscroll = (this->type == VEH_TRAIN ? this->GetScrollbar(DEPOT_WIDGET_H_SCROLL) : NULL); - this->vscroll = this->GetScrollbar(DEPOT_WIDGET_V_SCROLL); + this->hscroll = (this->type == VEH_TRAIN ? this->GetScrollbar(WID_VD_H_SCROLL) : NULL); + this->vscroll = this->GetScrollbar(WID_VD_V_SCROLL); /* Don't show 'rename button' of aircraft hangar */ - this->GetWidget<NWidgetStacked>(DEPOT_WIDGET_SHOW_RENAME)->SetDisplayedPlane(type == VEH_AIRCRAFT ? SZSP_NONE : 0); + this->GetWidget<NWidgetStacked>(WID_VD_SHOW_RENAME)->SetDisplayedPlane(type == VEH_AIRCRAFT ? SZSP_NONE : 0); /* Only train depots have a horizontal scrollbar and a 'sell chain' button */ - this->GetWidget<NWidgetStacked>(DEPOT_WIDGET_SHOW_H_SCROLL)->SetDisplayedPlane(type == VEH_TRAIN ? 0 : SZSP_HORIZONTAL); - this->GetWidget<NWidgetStacked>(DEPOT_WIDGET_SHOW_SELL_CHAIN)->SetDisplayedPlane(type == VEH_TRAIN ? 0 : SZSP_NONE); + this->GetWidget<NWidgetStacked>(WID_VD_SHOW_H_SCROLL)->SetDisplayedPlane(type == VEH_TRAIN ? 0 : SZSP_HORIZONTAL); + this->GetWidget<NWidgetStacked>(WID_VD_SHOW_SELL_CHAIN)->SetDisplayedPlane(type == VEH_TRAIN ? 0 : SZSP_NONE); this->SetupWidgetData(type); this->FinishInitNested(desc, tile); @@ -310,12 +310,12 @@ struct DepotWindow : Window { void DrawWidget(const Rect &r, int widget) const { - if (widget != DEPOT_WIDGET_MATRIX) return; + if (widget != WID_VD_MATRIX) return; bool rtl = _current_text_dir == TD_RTL; /* Set the row and number of boxes in each row based on the number of boxes drawn in the matrix */ - uint16 mat_data = this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->widget_data; + uint16 mat_data = this->GetWidget<NWidgetCore>(WID_VD_MATRIX)->widget_data; uint16 rows_in_display = GB(mat_data, MAT_ROW_START, MAT_ROW_BITS); uint16 boxes_in_each_row = GB(mat_data, MAT_COL_START, MAT_COL_BITS); @@ -346,7 +346,7 @@ struct DepotWindow : Window { void SetStringParameters(int widget) const { - if (widget != DEPOT_WIDGET_CAPTION) return; + if (widget != WID_VD_CAPTION) return; /* locate the depot struct */ TileIndex tile = this->window_number; @@ -368,7 +368,7 @@ struct DepotWindow : Window { DepotGUIAction GetVehicleFromDepotWndPt(int x, int y, const Vehicle **veh, GetDepotVehiclePtData *d) const { - const NWidgetCore *matrix_widget = this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX); + const NWidgetCore *matrix_widget = this->GetWidget<NWidgetCore>(WID_VD_MATRIX); /* In case of RTL the widgets are swapped as a whole */ if (_current_text_dir == TD_RTL) x = matrix_widget->current_x - x; @@ -514,56 +514,56 @@ struct DepotWindow : Window { */ void SetupWidgetData(VehicleType type) { - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_STOP_ALL)->tool_tip = STR_DEPOT_MASS_STOP_DEPOT_TRAIN_TOOLTIP + type; - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_START_ALL)->tool_tip = STR_DEPOT_MASS_START_DEPOT_TRAIN_TOOLTIP + type; - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL)->tool_tip = STR_DEPOT_TRAIN_SELL_TOOLTIP + type; - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL_ALL)->tool_tip = STR_DEPOT_SELL_ALL_BUTTON_TRAIN_TOOLTIP + type; + this->GetWidget<NWidgetCore>(WID_VD_STOP_ALL)->tool_tip = STR_DEPOT_MASS_STOP_DEPOT_TRAIN_TOOLTIP + type; + this->GetWidget<NWidgetCore>(WID_VD_START_ALL)->tool_tip = STR_DEPOT_MASS_START_DEPOT_TRAIN_TOOLTIP + type; + this->GetWidget<NWidgetCore>(WID_VD_SELL)->tool_tip = STR_DEPOT_TRAIN_SELL_TOOLTIP + type; + this->GetWidget<NWidgetCore>(WID_VD_SELL_ALL)->tool_tip = STR_DEPOT_SELL_ALL_BUTTON_TRAIN_TOOLTIP + type; - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_BUILD)->SetDataTip(STR_DEPOT_TRAIN_NEW_VEHICLES_BUTTON + type, STR_DEPOT_TRAIN_NEW_VEHICLES_TOOLTIP + type); - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_CLONE)->SetDataTip(STR_DEPOT_CLONE_TRAIN + type, STR_DEPOT_CLONE_TRAIN_DEPOT_INFO + type); + this->GetWidget<NWidgetCore>(WID_VD_BUILD)->SetDataTip(STR_DEPOT_TRAIN_NEW_VEHICLES_BUTTON + type, STR_DEPOT_TRAIN_NEW_VEHICLES_TOOLTIP + type); + this->GetWidget<NWidgetCore>(WID_VD_CLONE)->SetDataTip(STR_DEPOT_CLONE_TRAIN + type, STR_DEPOT_CLONE_TRAIN_DEPOT_INFO + type); - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_LOCATION)->tool_tip = STR_DEPOT_TRAIN_LOCATION_TOOLTIP + type; - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_VEHICLE_LIST)->tool_tip = STR_DEPOT_VEHICLE_ORDER_LIST_TRAIN_TOOLTIP + type; - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_AUTOREPLACE)->tool_tip = STR_DEPOT_AUTOREPLACE_TRAIN_TOOLTIP + type; - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->tool_tip = STR_DEPOT_TRAIN_LIST_TOOLTIP + this->type; + this->GetWidget<NWidgetCore>(WID_VD_LOCATION)->tool_tip = STR_DEPOT_TRAIN_LOCATION_TOOLTIP + type; + this->GetWidget<NWidgetCore>(WID_VD_VEHICLE_LIST)->tool_tip = STR_DEPOT_VEHICLE_ORDER_LIST_TRAIN_TOOLTIP + type; + this->GetWidget<NWidgetCore>(WID_VD_AUTOREPLACE)->tool_tip = STR_DEPOT_AUTOREPLACE_TRAIN_TOOLTIP + type; + this->GetWidget<NWidgetCore>(WID_VD_MATRIX)->tool_tip = STR_DEPOT_TRAIN_LIST_TOOLTIP + this->type; switch (type) { default: NOT_REACHED(); case VEH_TRAIN: - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_VEHICLE_LIST)->widget_data = STR_TRAIN; + this->GetWidget<NWidgetCore>(WID_VD_VEHICLE_LIST)->widget_data = STR_TRAIN; /* Sprites */ - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL)->widget_data = SPR_SELL_TRAIN; - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL_ALL)->widget_data = SPR_SELL_ALL_TRAIN; - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_AUTOREPLACE)->widget_data = SPR_REPLACE_TRAIN; + this->GetWidget<NWidgetCore>(WID_VD_SELL)->widget_data = SPR_SELL_TRAIN; + this->GetWidget<NWidgetCore>(WID_VD_SELL_ALL)->widget_data = SPR_SELL_ALL_TRAIN; + this->GetWidget<NWidgetCore>(WID_VD_AUTOREPLACE)->widget_data = SPR_REPLACE_TRAIN; break; case VEH_ROAD: - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_VEHICLE_LIST)->widget_data = STR_LORRY; + this->GetWidget<NWidgetCore>(WID_VD_VEHICLE_LIST)->widget_data = STR_LORRY; /* Sprites */ - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL)->widget_data = SPR_SELL_ROADVEH; - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL_ALL)->widget_data = SPR_SELL_ALL_ROADVEH; - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_AUTOREPLACE)->widget_data = SPR_REPLACE_ROADVEH; + this->GetWidget<NWidgetCore>(WID_VD_SELL)->widget_data = SPR_SELL_ROADVEH; + this->GetWidget<NWidgetCore>(WID_VD_SELL_ALL)->widget_data = SPR_SELL_ALL_ROADVEH; + this->GetWidget<NWidgetCore>(WID_VD_AUTOREPLACE)->widget_data = SPR_REPLACE_ROADVEH; break; case VEH_SHIP: - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_VEHICLE_LIST)->widget_data = STR_SHIP; + this->GetWidget<NWidgetCore>(WID_VD_VEHICLE_LIST)->widget_data = STR_SHIP; /* Sprites */ - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL)->widget_data = SPR_SELL_SHIP; - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL_ALL)->widget_data = SPR_SELL_ALL_SHIP; - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_AUTOREPLACE)->widget_data = SPR_REPLACE_SHIP; + this->GetWidget<NWidgetCore>(WID_VD_SELL)->widget_data = SPR_SELL_SHIP; + this->GetWidget<NWidgetCore>(WID_VD_SELL_ALL)->widget_data = SPR_SELL_ALL_SHIP; + this->GetWidget<NWidgetCore>(WID_VD_AUTOREPLACE)->widget_data = SPR_REPLACE_SHIP; break; case VEH_AIRCRAFT: - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_VEHICLE_LIST)->widget_data = STR_PLANE; + this->GetWidget<NWidgetCore>(WID_VD_VEHICLE_LIST)->widget_data = STR_PLANE; /* Sprites */ - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL)->widget_data = SPR_SELL_AIRCRAFT; - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_SELL_ALL)->widget_data = SPR_SELL_ALL_AIRCRAFT; - this->GetWidget<NWidgetCore>(DEPOT_WIDGET_AUTOREPLACE)->widget_data = SPR_REPLACE_AIRCRAFT; + this->GetWidget<NWidgetCore>(WID_VD_SELL)->widget_data = SPR_SELL_AIRCRAFT; + this->GetWidget<NWidgetCore>(WID_VD_SELL_ALL)->widget_data = SPR_SELL_ALL_AIRCRAFT; + this->GetWidget<NWidgetCore>(WID_VD_AUTOREPLACE)->widget_data = SPR_REPLACE_AIRCRAFT; break; } } @@ -576,7 +576,7 @@ struct DepotWindow : Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case DEPOT_WIDGET_MATRIX: { + case WID_VD_MATRIX: { uint min_height = 0; if (this->type == VEH_TRAIN) { @@ -658,15 +658,15 @@ struct DepotWindow : Window { /* Setup disabled buttons. */ TileIndex tile = this->window_number; this->SetWidgetsDisabledState(!IsTileOwner(tile, _local_company), - DEPOT_WIDGET_STOP_ALL, - DEPOT_WIDGET_START_ALL, - DEPOT_WIDGET_SELL, - DEPOT_WIDGET_SELL_CHAIN, - DEPOT_WIDGET_SELL_ALL, - DEPOT_WIDGET_BUILD, - DEPOT_WIDGET_CLONE, - DEPOT_WIDGET_RENAME, - DEPOT_WIDGET_AUTOREPLACE, + WID_VD_STOP_ALL, + WID_VD_START_ALL, + WID_VD_SELL, + WID_VD_SELL_CHAIN, + WID_VD_SELL_ALL, + WID_VD_BUILD, + WID_VD_CLONE, + WID_VD_RENAME, + WID_VD_AUTOREPLACE, WIDGET_LIST_END); this->DrawWidgets(); @@ -675,22 +675,22 @@ struct DepotWindow : Window { virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case DEPOT_WIDGET_MATRIX: { // List - NWidgetBase *nwi = this->GetWidget<NWidgetBase>(DEPOT_WIDGET_MATRIX); + case WID_VD_MATRIX: { // List + NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_VD_MATRIX); this->DepotClick(pt.x - nwi->pos_x, pt.y - nwi->pos_y); break; } - case DEPOT_WIDGET_BUILD: // Build vehicle + case WID_VD_BUILD: // Build vehicle ResetObjectToPlace(); ShowBuildVehicleWindow(this->window_number, this->type); break; - case DEPOT_WIDGET_CLONE: // Clone button - this->SetWidgetDirty(DEPOT_WIDGET_CLONE); - this->ToggleWidgetLoweredState(DEPOT_WIDGET_CLONE); + case WID_VD_CLONE: // Clone button + this->SetWidgetDirty(WID_VD_CLONE); + this->ToggleWidgetLoweredState(WID_VD_CLONE); - if (this->IsWidgetLowered(DEPOT_WIDGET_CLONE)) { + if (this->IsWidgetLowered(WID_VD_CLONE)) { static const CursorID clone_icons[] = { SPR_CURSOR_CLONE_TRAIN, SPR_CURSOR_CLONE_ROADVEH, SPR_CURSOR_CLONE_SHIP, SPR_CURSOR_CLONE_AIRPLANE @@ -702,7 +702,7 @@ struct DepotWindow : Window { } break; - case DEPOT_WIDGET_LOCATION: + case WID_VD_LOCATION: if (_ctrl_pressed) { ShowExtraViewPortWindow(this->window_number); } else { @@ -710,20 +710,20 @@ struct DepotWindow : Window { } break; - case DEPOT_WIDGET_RENAME: // Rename button + case WID_VD_RENAME: // Rename button SetDParam(0, this->type); SetDParam(1, Depot::GetByTile((TileIndex)this->window_number)->index); ShowQueryString(STR_DEPOT_NAME, STR_DEPOT_RENAME_DEPOT_CAPTION, MAX_LENGTH_DEPOT_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); break; - case DEPOT_WIDGET_STOP_ALL: - case DEPOT_WIDGET_START_ALL: { + case WID_VD_STOP_ALL: + case WID_VD_START_ALL: { VehicleListIdentifier vli(VL_DEPOT_LIST, this->type, this->owner); - DoCommandP(this->window_number, (widget == DEPOT_WIDGET_START_ALL ? (1 << 0) : 0), vli.Pack(), CMD_MASS_START_STOP); + DoCommandP(this->window_number, (widget == WID_VD_START_ALL ? (1 << 0) : 0), vli.Pack(), CMD_MASS_START_STOP); break; } - case DEPOT_WIDGET_SELL_ALL: + case WID_VD_SELL_ALL: /* Only open the confimation window if there are anything to sell */ if (this->vehicle_list.Length() != 0 || this->wagon_list.Length() != 0) { TileIndex tile = this->window_number; @@ -740,11 +740,11 @@ struct DepotWindow : Window { } break; - case DEPOT_WIDGET_VEHICLE_LIST: + case WID_VD_VEHICLE_LIST: ShowVehicleListWindow(GetTileOwner(this->window_number), this->type, (TileIndex)this->window_number); break; - case DEPOT_WIDGET_AUTOREPLACE: + case WID_VD_AUTOREPLACE: DoCommandP(this->window_number, this->type, 0, CMD_DEPOT_MASS_AUTOREPLACE); break; @@ -761,11 +761,11 @@ struct DepotWindow : Window { virtual bool OnRightClick(Point pt, int widget) { - if (widget != DEPOT_WIDGET_MATRIX) return false; + if (widget != WID_VD_MATRIX) return false; GetDepotVehiclePtData gdvp = { NULL, NULL }; const Vehicle *v = NULL; - NWidgetBase *nwi = this->GetWidget<NWidgetBase>(DEPOT_WIDGET_MATRIX); + NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_VD_MATRIX); DepotGUIAction mode = this->GetVehicleFromDepotWndPt(pt.x - nwi->pos_x, pt.y - nwi->pos_y, &v, &gdvp); if (this->type == VEH_TRAIN) v = gdvp.wagon; @@ -831,13 +831,13 @@ struct DepotWindow : Window { virtual void OnPlaceObjectAbort() { /* abort clone */ - this->RaiseWidget(DEPOT_WIDGET_CLONE); - this->SetWidgetDirty(DEPOT_WIDGET_CLONE); + this->RaiseWidget(WID_VD_CLONE); + this->SetWidgetDirty(WID_VD_CLONE); /* abort drag & drop */ this->sel = INVALID_VEHICLE; this->vehicle_over = INVALID_VEHICLE; - this->SetWidgetDirty(DEPOT_WIDGET_MATRIX); + this->SetWidgetDirty(WID_VD_MATRIX); } virtual void OnMouseDrag(Point pt, int widget) @@ -845,10 +845,10 @@ struct DepotWindow : Window { if (this->type != VEH_TRAIN || this->sel == INVALID_VEHICLE) return; /* A rail vehicle is dragged.. */ - if (widget != DEPOT_WIDGET_MATRIX) { // ..outside of the depot matrix. + if (widget != WID_VD_MATRIX) { // ..outside of the depot matrix. if (this->vehicle_over != INVALID_VEHICLE) { this->vehicle_over = INVALID_VEHICLE; - this->SetWidgetDirty(DEPOT_WIDGET_MATRIX); + this->SetWidgetDirty(WID_VD_MATRIX); } return; } @@ -883,14 +883,14 @@ struct DepotWindow : Window { virtual void OnDragDrop(Point pt, int widget) { switch (widget) { - case DEPOT_WIDGET_MATRIX: { + case WID_VD_MATRIX: { const Vehicle *v = NULL; VehicleID sel = this->sel; this->sel = INVALID_VEHICLE; this->SetDirty(); - NWidgetBase *nwi = this->GetWidget<NWidgetBase>(DEPOT_WIDGET_MATRIX); + NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_VD_MATRIX); if (this->type == VEH_TRAIN) { GetDepotVehiclePtData gdvp = { NULL, NULL }; @@ -911,7 +911,7 @@ struct DepotWindow : Window { break; } - case DEPOT_WIDGET_SELL: case DEPOT_WIDGET_SELL_CHAIN: { + case WID_VD_SELL: case WID_VD_SELL_CHAIN: { if (this->IsWidgetDisabled(widget)) return; if (this->sel == INVALID_VEHICLE) return; @@ -921,7 +921,7 @@ struct DepotWindow : Window { this->sel = INVALID_VEHICLE; this->SetDirty(); - int sell_cmd = (v->type == VEH_TRAIN && (widget == DEPOT_WIDGET_SELL_CHAIN || _ctrl_pressed)) ? 1 : 0; + int sell_cmd = (v->type == VEH_TRAIN && (widget == WID_VD_SELL_CHAIN || _ctrl_pressed)) ? 1 : 0; DoCommandP(v->tile, v->index | sell_cmd << 20 | MAKE_ORDER_BACKUP_FLAG, 0, GetCmdSellVeh(v->type)); break; } @@ -935,20 +935,20 @@ struct DepotWindow : Window { virtual void OnTimeout() { - if (!this->IsWidgetDisabled(DEPOT_WIDGET_SELL)) { - this->RaiseWidget(DEPOT_WIDGET_SELL); - this->SetWidgetDirty(DEPOT_WIDGET_SELL); + if (!this->IsWidgetDisabled(WID_VD_SELL)) { + this->RaiseWidget(WID_VD_SELL); + this->SetWidgetDirty(WID_VD_SELL); } - if (this->nested_array[DEPOT_WIDGET_SELL] != NULL && !this->IsWidgetDisabled(DEPOT_WIDGET_SELL_CHAIN)) { - this->RaiseWidget(DEPOT_WIDGET_SELL_CHAIN); - this->SetWidgetDirty(DEPOT_WIDGET_SELL_CHAIN); + if (this->nested_array[WID_VD_SELL] != NULL && !this->IsWidgetDisabled(WID_VD_SELL_CHAIN)) { + this->RaiseWidget(WID_VD_SELL_CHAIN); + this->SetWidgetDirty(WID_VD_SELL_CHAIN); } } virtual void OnResize() { - NWidgetCore *nwi = this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX); - this->vscroll->SetCapacityFromWidget(this, DEPOT_WIDGET_MATRIX); + NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_VD_MATRIX); + this->vscroll->SetCapacityFromWidget(this, WID_VD_MATRIX); if (this->type == VEH_TRAIN) { this->hscroll->SetCapacity(nwi->current_x - this->header_width - this->count_width); nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); @@ -962,7 +962,7 @@ struct DepotWindow : Window { { if (this->sel != INVALID_VEHICLE) { _cursor.vehchain = _ctrl_pressed; - this->SetWidgetDirty(DEPOT_WIDGET_MATRIX); + this->SetWidgetDirty(WID_VD_MATRIX); return ES_HANDLED; } diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 82249a839..9c599a504 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -96,7 +96,7 @@ struct BuildDocksToolbarWindow : Window { BuildDocksToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window() { - this->last_clicked_widget = DTW_END; + this->last_clicked_widget = WID_DT_INVALID; this->InitNested(desc, window_number); this->OnInvalidateData(); if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this); @@ -116,49 +116,49 @@ struct BuildDocksToolbarWindow : Window { { if (!gui_scope) return; this->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_SHIP), - DTW_DEPOT, - DTW_STATION, - DTW_BUOY, + WID_DT_DEPOT, + WID_DT_STATION, + WID_DT_BUOY, WIDGET_LIST_END); } virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case DTW_CANAL: // Build canal button - HandlePlacePushButton(this, DTW_CANAL, SPR_CURSOR_CANAL, HT_RECT); + case WID_DT_CANAL: // Build canal button + HandlePlacePushButton(this, WID_DT_CANAL, SPR_CURSOR_CANAL, HT_RECT); break; - case DTW_LOCK: // Build lock button - HandlePlacePushButton(this, DTW_LOCK, SPR_CURSOR_LOCK, HT_SPECIAL); + case WID_DT_LOCK: // Build lock button + HandlePlacePushButton(this, WID_DT_LOCK, SPR_CURSOR_LOCK, HT_SPECIAL); break; - case DTW_DEMOLISH: // Demolish aka dynamite button - HandlePlacePushButton(this, DTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL); + case WID_DT_DEMOLISH: // Demolish aka dynamite button + HandlePlacePushButton(this, WID_DT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL); break; - case DTW_DEPOT: // Build depot button + case WID_DT_DEPOT: // Build depot button if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return; - if (HandlePlacePushButton(this, DTW_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT)) ShowBuildDocksDepotPicker(this); + if (HandlePlacePushButton(this, WID_DT_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT)) ShowBuildDocksDepotPicker(this); break; - case DTW_STATION: // Build station button + case WID_DT_STATION: // Build station button if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return; - if (HandlePlacePushButton(this, DTW_STATION, SPR_CURSOR_DOCK, HT_SPECIAL)) ShowBuildDockStationPicker(this); + if (HandlePlacePushButton(this, WID_DT_STATION, SPR_CURSOR_DOCK, HT_SPECIAL)) ShowBuildDockStationPicker(this); break; - case DTW_BUOY: // Build buoy button + case WID_DT_BUOY: // Build buoy button if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return; - HandlePlacePushButton(this, DTW_BUOY, SPR_CURSOR_BUOY, HT_RECT); + HandlePlacePushButton(this, WID_DT_BUOY, SPR_CURSOR_BUOY, HT_RECT); break; - case DTW_RIVER: // Build river button (in scenario editor) + case WID_DT_RIVER: // Build river button (in scenario editor) if (_game_mode != GM_EDITOR) return; - HandlePlacePushButton(this, DTW_RIVER, SPR_CURSOR_RIVER, HT_RECT); + HandlePlacePushButton(this, WID_DT_RIVER, SPR_CURSOR_RIVER, HT_RECT); break; - case DTW_BUILD_AQUEDUCT: // Build aqueduct button - HandlePlacePushButton(this, DTW_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_SPECIAL); + case WID_DT_BUILD_AQUEDUCT: // Build aqueduct button + HandlePlacePushButton(this, WID_DT_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_SPECIAL); break; default: return; @@ -177,23 +177,23 @@ struct BuildDocksToolbarWindow : Window { virtual void OnPlaceObject(Point pt, TileIndex tile) { switch (this->last_clicked_widget) { - case DTW_CANAL: // Build canal button + case WID_DT_CANAL: // Build canal button VpStartPlaceSizing(tile, (_game_mode == GM_EDITOR) ? VPM_X_AND_Y : VPM_X_OR_Y, DDSP_CREATE_WATER); break; - case DTW_LOCK: // Build lock button + case WID_DT_LOCK: // Build lock button DoCommandP(tile, 0, 0, CMD_BUILD_LOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_LOCKS), CcBuildDocks); break; - case DTW_DEMOLISH: // Demolish aka dynamite button + case WID_DT_DEMOLISH: // Demolish aka dynamite button PlaceProc_DemolishArea(tile); break; - case DTW_DEPOT: // Build depot button + case WID_DT_DEPOT: // Build depot button DoCommandP(tile, _ship_depot_direction, 0, CMD_BUILD_SHIP_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_SHIP_DEPOT), CcBuildDocks); break; - case DTW_STATION: { // Build station button + case WID_DT_STATION: { // Build station button uint32 p2 = (uint32)INVALID_STATION << 16; // no station to join /* tile is always the land tile, so need to evaluate _thd.pos */ @@ -207,15 +207,15 @@ struct BuildDocksToolbarWindow : Window { break; } - case DTW_BUOY: // Build buoy button + case WID_DT_BUOY: // Build buoy button DoCommandP(tile, 0, 0, CMD_BUILD_BUOY | CMD_MSG(STR_ERROR_CAN_T_POSITION_BUOY_HERE), CcBuildDocks); break; - case DTW_RIVER: // Build river button (in scenario editor) + case WID_DT_RIVER: // Build river button (in scenario editor) VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_RIVER); break; - case DTW_BUILD_AQUEDUCT: // Build aqueduct button + case WID_DT_BUILD_AQUEDUCT: // Build aqueduct button DoCommandP(tile, GetOtherAqueductEnd(tile), TRANSPORT_WATER << 15, CMD_BUILD_BRIDGE | CMD_MSG(STR_ERROR_CAN_T_BUILD_AQUEDUCT_HERE), CcBuildBridge); break; @@ -261,7 +261,7 @@ struct BuildDocksToolbarWindow : Window { { TileIndex tile_to = tile_from; - if (this->last_clicked_widget == DTW_BUILD_AQUEDUCT) { + if (this->last_clicked_widget == WID_DT_BUILD_AQUEDUCT) { GetOtherAqueductEnd(tile_from, &tile_to); } else { DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile_from)); @@ -269,7 +269,7 @@ struct BuildDocksToolbarWindow : Window { /* Locks and docks always select the tile "down" the slope. */ tile_to = TileAddByDiagDir(tile_from, ReverseDiagDir(dir)); /* Locks also select the tile "up" the slope. */ - if (this->last_clicked_widget == DTW_LOCK) tile_from = TileAddByDiagDir(tile_from, dir); + if (this->last_clicked_widget == WID_DT_LOCK) tile_from = TileAddByDiagDir(tile_from, dir); } } @@ -282,21 +282,21 @@ struct BuildDocksToolbarWindow : Window { const uint16 _dockstoolbar_aqueduct_keys[] = {'B', '8', 0}; Hotkey<BuildDocksToolbarWindow> BuildDocksToolbarWindow::dockstoolbar_hotkeys[] = { - Hotkey<BuildDocksToolbarWindow>('1', "canal", DTW_CANAL), - Hotkey<BuildDocksToolbarWindow>('2', "lock", DTW_LOCK), - Hotkey<BuildDocksToolbarWindow>('3', "demolish", DTW_DEMOLISH), - Hotkey<BuildDocksToolbarWindow>('4', "depot", DTW_DEPOT), - Hotkey<BuildDocksToolbarWindow>('5', "dock", DTW_STATION), - Hotkey<BuildDocksToolbarWindow>('6', "buoy", DTW_BUOY), - Hotkey<BuildDocksToolbarWindow>('7', "river", DTW_RIVER), - Hotkey<BuildDocksToolbarWindow>(_dockstoolbar_aqueduct_keys, "aqueduct", DTW_BUILD_AQUEDUCT), + Hotkey<BuildDocksToolbarWindow>('1', "canal", WID_DT_CANAL), + Hotkey<BuildDocksToolbarWindow>('2', "lock", WID_DT_LOCK), + Hotkey<BuildDocksToolbarWindow>('3', "demolish", WID_DT_DEMOLISH), + Hotkey<BuildDocksToolbarWindow>('4', "depot", WID_DT_DEPOT), + Hotkey<BuildDocksToolbarWindow>('5', "dock", WID_DT_STATION), + Hotkey<BuildDocksToolbarWindow>('6', "buoy", WID_DT_BUOY), + Hotkey<BuildDocksToolbarWindow>('7', "river", WID_DT_RIVER), + Hotkey<BuildDocksToolbarWindow>(_dockstoolbar_aqueduct_keys, "aqueduct", WID_DT_BUILD_AQUEDUCT), HOTKEY_LIST_END(BuildDocksToolbarWindow) }; Hotkey<BuildDocksToolbarWindow> *_dockstoolbar_hotkeys = BuildDocksToolbarWindow::dockstoolbar_hotkeys; /** * Nested widget parts of docks toolbar, game version. - * Position of #DTW_RIVER widget has changed. + * Position of #WID_DT_RIVER widget has changed. */ static const NWidgetPart _nested_build_docks_toolbar_widgets[] = { NWidget(NWID_HORIZONTAL), @@ -305,14 +305,14 @@ static const NWidgetPart _nested_build_docks_toolbar_widgets[] = { NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN), EndContainer(), NWidget(NWID_HORIZONTAL_LTR), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_CANAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_CANAL, STR_WATERWAYS_TOOLBAR_BUILD_CANALS_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_LOCK), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_LOCK, STR_WATERWAYS_TOOLBAR_BUILD_LOCKS_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_CANAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_CANAL, STR_WATERWAYS_TOOLBAR_BUILD_CANALS_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_LOCK), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_LOCK, STR_WATERWAYS_TOOLBAR_BUILD_LOCKS_TOOLTIP), NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(5, 22), SetFill(1, 1), EndContainer(), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEPOT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DEPOT, STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_STATION), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DOCK, STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUOY), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUOY, STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUILD_AQUEDUCT), SetMinimalSize(23, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AQUEDUCT, STR_WATERWAYS_TOOLBAR_BUILD_AQUEDUCT_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_DEPOT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DEPOT, STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_STATION), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DOCK, STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_BUOY), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUOY, STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_BUILD_AQUEDUCT), SetMinimalSize(23, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AQUEDUCT, STR_WATERWAYS_TOOLBAR_BUILD_AQUEDUCT_TOOLTIP), EndContainer(), }; @@ -349,7 +349,7 @@ EventState DockToolbarGlobalHotkeys(uint16 key, uint16 keycode) /** * Nested widget parts of docks toolbar, scenario editor version. - * Positions of #DTW_DEPOT, #DTW_STATION, and #DTW_BUOY widgets have changed. + * Positions of #WID_DT_DEPOT, #WID_DT_STATION, and #WID_DT_BUOY widgets have changed. */ static const NWidgetPart _nested_build_docks_scen_toolbar_widgets[] = { NWidget(NWID_HORIZONTAL), @@ -358,12 +358,12 @@ static const NWidgetPart _nested_build_docks_scen_toolbar_widgets[] = { NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_CANAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_CANAL, STR_WATERWAYS_TOOLBAR_CREATE_LAKE_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_LOCK), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_LOCK, STR_WATERWAYS_TOOLBAR_BUILD_LOCKS_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_CANAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_CANAL, STR_WATERWAYS_TOOLBAR_CREATE_LAKE_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_LOCK), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_LOCK, STR_WATERWAYS_TOOLBAR_BUILD_LOCKS_TOOLTIP), NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(5, 22), SetFill(1, 1), EndContainer(), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_RIVER), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_RIVER, STR_WATERWAYS_TOOLBAR_CREATE_RIVER_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUILD_AQUEDUCT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AQUEDUCT, STR_WATERWAYS_TOOLBAR_BUILD_AQUEDUCT_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_RIVER), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_RIVER, STR_WATERWAYS_TOOLBAR_CREATE_RIVER_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_BUILD_AQUEDUCT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AQUEDUCT, STR_WATERWAYS_TOOLBAR_BUILD_AQUEDUCT_TOOLTIP), EndContainer(), }; diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index eb8b6a296..c601c858b 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -50,10 +50,10 @@ static const NWidgetPart _nested_engine_preview_widgets[] = { NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_ENGINE_PREVIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE), - NWidget(WWT_EMPTY, INVALID_COLOUR, EPW_QUESTION), SetMinimalSize(300, 0), SetPadding(8, 8, 8, 8), SetFill(1, 0), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_EP_QUESTION), SetMinimalSize(300, 0), SetPadding(8, 8, 8, 8), SetFill(1, 0), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(85, 10, 85), - NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, EPW_NO), SetDataTip(STR_QUIT_NO, STR_NULL), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, EPW_YES), SetDataTip(STR_QUIT_YES, STR_NULL), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_EP_NO), SetDataTip(STR_QUIT_NO, STR_NULL), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_EP_YES), SetDataTip(STR_QUIT_YES, STR_NULL), SetFill(1, 0), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 8), EndContainer(), @@ -69,7 +69,7 @@ struct EnginePreviewWindow : Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget != EPW_QUESTION) return; + if (widget != WID_EP_QUESTION) return; EngineID engine = this->window_number; SetDParam(0, GetEngineCategoryName(engine)); @@ -80,7 +80,7 @@ struct EnginePreviewWindow : Window { virtual void DrawWidget(const Rect &r, int widget) const { - if (widget != EPW_QUESTION) return; + if (widget != WID_EP_QUESTION) return; EngineID engine = this->window_number; SetDParam(0, GetEngineCategoryName(engine)); @@ -100,10 +100,10 @@ struct EnginePreviewWindow : Window { virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case EPW_YES: + case WID_EP_YES: DoCommandP(0, this->window_number, 0, CMD_WANT_ENGINE_PREVIEW); /* FALL THROUGH */ - case EPW_NO: + case WID_EP_NO: delete this; break; } diff --git a/src/error_gui.cpp b/src/error_gui.cpp index 603f7e80c..47e27f24c 100644 --- a/src/error_gui.cpp +++ b/src/error_gui.cpp @@ -32,10 +32,10 @@ static const NWidgetPart _nested_errmsg_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_RED), - NWidget(WWT_CAPTION, COLOUR_RED, EMW_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION, STR_NULL), + NWidget(WWT_CAPTION, COLOUR_RED, WID_EM_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION, STR_NULL), EndContainer(), NWidget(WWT_PANEL, COLOUR_RED), - NWidget(WWT_EMPTY, COLOUR_RED, EMW_MESSAGE), SetPadding(0, 2, 0, 2), SetMinimalSize(236, 32), + NWidget(WWT_EMPTY, COLOUR_RED, WID_EM_MESSAGE), SetPadding(0, 2, 0, 2), SetMinimalSize(236, 32), EndContainer(), }; @@ -49,12 +49,12 @@ static const WindowDesc _errmsg_desc( static const NWidgetPart _nested_errmsg_face_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_RED), - NWidget(WWT_CAPTION, COLOUR_RED, EMW_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY, STR_NULL), + NWidget(WWT_CAPTION, COLOUR_RED, WID_EM_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY, STR_NULL), EndContainer(), NWidget(WWT_PANEL, COLOUR_RED), NWidget(NWID_HORIZONTAL), SetPIP(2, 1, 2), - NWidget(WWT_EMPTY, COLOUR_RED, EMW_FACE), SetMinimalSize(92, 119), SetFill(0, 1), SetPadding(2, 0, 1, 0), - NWidget(WWT_EMPTY, COLOUR_RED, EMW_MESSAGE), SetFill(0, 1), SetMinimalSize(238, 123), + NWidget(WWT_EMPTY, COLOUR_RED, WID_EM_FACE), SetMinimalSize(92, 119), SetFill(0, 1), SetPadding(2, 0, 1, 0), + NWidget(WWT_EMPTY, COLOUR_RED, WID_EM_MESSAGE), SetFill(0, 1), SetMinimalSize(238, 123), EndContainer(), EndContainer(), }; @@ -141,8 +141,8 @@ bool _window_system_initialized = false; /** Window class for displaying an error message window. */ struct ErrmsgWindow : public Window, ErrorMessageData { private: - uint height_summary; ///< Height of the #summary_msg string in pixels in the #EMW_MESSAGE widget. - uint height_detailed; ///< Height of the #detailed_msg string in pixels in the #EMW_MESSAGE widget. + uint height_summary; ///< Height of the #summary_msg string in pixels in the #WID_EM_MESSAGE widget. + uint height_detailed; ///< Height of the #detailed_msg string in pixels in the #WID_EM_MESSAGE widget. public: ErrmsgWindow(const ErrorMessageData &data) : Window(), ErrorMessageData(data) @@ -152,7 +152,7 @@ public: virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget != EMW_MESSAGE) return; + if (widget != WID_EM_MESSAGE) return; CopyInDParam(0, this->decode_params, lengthof(this->decode_params)); if (this->textref_stack_size > 0) StartTextRefStackUsage(this->textref_stack_size, this->textref_stack); @@ -213,19 +213,19 @@ public: virtual void SetStringParameters(int widget) const { - if (widget == EMW_CAPTION) CopyInDParam(0, this->decode_params, lengthof(this->decode_params)); + if (widget == WID_EM_CAPTION) CopyInDParam(0, this->decode_params, lengthof(this->decode_params)); } virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case EMW_FACE: { + case WID_EM_FACE: { const Company *c = Company::Get(this->face); DrawCompanyManagerFace(c->face, c->colour, r.left, r.top); break; } - case EMW_MESSAGE: + case WID_EM_MESSAGE: CopyInDParam(0, this->decode_params, lengthof(this->decode_params)); if (this->textref_stack_size > 0) StartTextRefStackUsage(this->textref_stack_size, this->textref_stack); diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index 55277a563..3e48c10bb 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -71,37 +71,37 @@ void LoadCheckData::Clear() static const NWidgetPart _nested_load_dialog_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, SLWW_WINDOWTITLE), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_SL_CAPTION), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, SLWW_BACKGROUND), SetFill(1, 0), SetResize(1, 0), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_BACKGROUND), SetFill(1, 0), SetResize(1, 0), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), NWidget(NWID_VERTICAL), NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_SORT_BYNAME), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_SORT_BYDATE), SetDataTip(STR_SORT_BY_CAPTION_DATE, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SORT_BYNAME), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SORT_BYDATE), SetDataTip(STR_SORT_BY_CAPTION_DATE, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0), EndContainer(), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SLWW_HOME_BUTTON), SetMinimalSize(12, 12), SetDataTip(SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SL_HOME_BUTTON), SetMinimalSize(12, 12), SetDataTip(SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, SLWW_FILE_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_FILE_BACKGROUND), NWidget(NWID_HORIZONTAL), - NWidget(WWT_INSET, COLOUR_GREY, SLWW_DRIVES_DIRECTORIES_LIST), SetFill(1, 1), SetPadding(2, 1, 2, 2), - SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(SLWW_SCROLLBAR), EndContainer(), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, SLWW_SCROLLBAR), + NWidget(WWT_INSET, COLOUR_GREY, WID_SL_DRIVES_DIRECTORIES_LIST), SetFill(1, 1), SetPadding(2, 1, 2, 2), + SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(WID_SL_SCROLLBAR), EndContainer(), + NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_SL_SCROLLBAR), EndContainer(), - NWidget(NWID_SELECTION, INVALID_COLOUR, SLWW_CONTENT_DOWNLOAD_SEL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_CONTENT_DOWNLOAD), SetResize(1, 0), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SL_CONTENT_DOWNLOAD_SEL), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_CONTENT_DOWNLOAD), SetResize(1, 0), SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT), EndContainer(), EndContainer(), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY), - NWidget(WWT_EMPTY, INVALID_COLOUR, SLWW_DETAILS), SetResize(1, 1), SetFill(1, 1), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_MISSING_NEWGRFS), SetDataTip(STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_BUTTON, STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_TOOLTIP), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SL_DETAILS), SetResize(1, 1), SetFill(1, 1), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_MISSING_NEWGRFS), SetDataTip(STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_BUTTON, STR_NEWGRF_SETTINGS_FIND_MISSING_CONTENT_TOOLTIP), SetFill(1, 0), SetResize(1, 0), NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_NEWGRF_INFO), SetDataTip(STR_INTRO_NEWGRF_SETTINGS, STR_NULL), SetFill(1, 0), SetResize(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_LOAD_BUTTON), SetDataTip(STR_SAVELOAD_LOAD_BUTTON, STR_SAVELOAD_LOAD_TOOLTIP), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_NEWGRF_INFO), SetDataTip(STR_INTRO_NEWGRF_SETTINGS, STR_NULL), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_LOAD_BUTTON), SetDataTip(STR_SAVELOAD_LOAD_BUTTON, STR_SAVELOAD_LOAD_TOOLTIP), SetFill(1, 0), SetResize(1, 0), EndContainer(), NWidget(WWT_RESIZEBOX, COLOUR_GREY), EndContainer(), @@ -113,25 +113,25 @@ static const NWidgetPart _nested_load_dialog_widgets[] = { static const NWidgetPart _nested_load_heightmap_dialog_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, SLWW_WINDOWTITLE), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_SL_CAPTION), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, SLWW_BACKGROUND), SetFill(1, 0), SetResize(1, 0), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_BACKGROUND), SetFill(1, 0), SetResize(1, 0), EndContainer(), NWidget(NWID_VERTICAL), NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_SORT_BYNAME), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_SORT_BYDATE), SetDataTip(STR_SORT_BY_CAPTION_DATE, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SORT_BYNAME), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SORT_BYDATE), SetDataTip(STR_SORT_BY_CAPTION_DATE, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0), EndContainer(), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SLWW_HOME_BUTTON), SetMinimalSize(12, 12), SetDataTip(SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SL_HOME_BUTTON), SetMinimalSize(12, 12), SetDataTip(SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, SLWW_FILE_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_FILE_BACKGROUND), NWidget(NWID_HORIZONTAL), - NWidget(WWT_INSET, COLOUR_GREY, SLWW_DRIVES_DIRECTORIES_LIST), SetFill(1, 1), SetPadding(2, 1, 2, 2), - SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(SLWW_SCROLLBAR), EndContainer(), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, SLWW_SCROLLBAR), + NWidget(WWT_INSET, COLOUR_GREY, WID_SL_DRIVES_DIRECTORIES_LIST), SetFill(1, 1), SetPadding(2, 1, 2, 2), + SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(WID_SL_SCROLLBAR), EndContainer(), + NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_SL_SCROLLBAR), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_CONTENT_DOWNLOAD), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_CONTENT_DOWNLOAD), SetResize(1, 0), SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT), NWidget(WWT_RESIZEBOX, COLOUR_GREY), EndContainer(), @@ -143,34 +143,34 @@ static const NWidgetPart _nested_load_heightmap_dialog_widgets[] = { static const NWidgetPart _nested_save_dialog_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, SLWW_WINDOWTITLE), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_SL_CAPTION), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, SLWW_BACKGROUND), SetFill(1, 0), SetResize(1, 0), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_BACKGROUND), SetFill(1, 0), SetResize(1, 0), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), NWidget(NWID_VERTICAL), NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_SORT_BYNAME), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_SORT_BYDATE), SetDataTip(STR_SORT_BY_CAPTION_DATE, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SORT_BYNAME), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SORT_BYDATE), SetDataTip(STR_SORT_BY_CAPTION_DATE, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0), SetResize(1, 0), EndContainer(), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, SLWW_HOME_BUTTON), SetMinimalSize(12, 12), SetDataTip(SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SL_HOME_BUTTON), SetMinimalSize(12, 12), SetDataTip(SPR_HOUSE_ICON, STR_SAVELOAD_HOME_BUTTON), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, SLWW_FILE_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_FILE_BACKGROUND), NWidget(NWID_HORIZONTAL), - NWidget(WWT_INSET, COLOUR_GREY, SLWW_DRIVES_DIRECTORIES_LIST), SetPadding(2, 1, 0, 2), - SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(SLWW_SCROLLBAR), EndContainer(), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, SLWW_SCROLLBAR), + NWidget(WWT_INSET, COLOUR_GREY, WID_SL_DRIVES_DIRECTORIES_LIST), SetPadding(2, 1, 0, 2), + SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(WID_SL_SCROLLBAR), EndContainer(), + NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_SL_SCROLLBAR), EndContainer(), - NWidget(WWT_EDITBOX, COLOUR_GREY, SLWW_SAVE_OSK_TITLE), SetPadding(3, 2, 2, 2), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_EDITBOX, COLOUR_GREY, WID_SL_SAVE_OSK_TITLE), SetPadding(3, 2, 2, 2), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_SAVELOAD_OSKTITLE, STR_SAVELOAD_EDITBOX_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_DELETE_SELECTION), SetDataTip(STR_SAVELOAD_DELETE_BUTTON, STR_SAVELOAD_DELETE_TOOLTIP), SetFill(1, 0), SetResize(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLWW_SAVE_GAME), SetDataTip(STR_SAVELOAD_SAVE_BUTTON, STR_SAVELOAD_SAVE_TOOLTIP), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_DELETE_SELECTION), SetDataTip(STR_SAVELOAD_DELETE_BUTTON, STR_SAVELOAD_DELETE_TOOLTIP), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_SAVE_GAME), SetDataTip(STR_SAVELOAD_SAVE_BUTTON, STR_SAVELOAD_SAVE_TOOLTIP), SetFill(1, 0), SetResize(1, 0), EndContainer(), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY), - NWidget(WWT_EMPTY, INVALID_COLOUR, SLWW_DETAILS), SetResize(1, 1), SetFill(1, 1), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SL_DETAILS), SetResize(1, 1), SetFill(1, 1), NWidget(NWID_HORIZONTAL), NWidget(NWID_SPACER), SetResize(1, 0), SetFill(1, 1), NWidget(WWT_RESIZEBOX, COLOUR_GREY), @@ -265,13 +265,13 @@ public: InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size); this->CreateNestedTree(desc, true); - if (mode == SLD_LOAD_GAME) this->GetWidget<NWidgetStacked>(SLWW_CONTENT_DOWNLOAD_SEL)->SetDisplayedPlane(SZSP_HORIZONTAL); - this->GetWidget<NWidgetCore>(SLWW_WINDOWTITLE)->widget_data = saveload_captions[mode]; - this->vscroll = this->GetScrollbar(SLWW_SCROLLBAR); + if (mode == SLD_LOAD_GAME) this->GetWidget<NWidgetStacked>(WID_SL_CONTENT_DOWNLOAD_SEL)->SetDisplayedPlane(SZSP_HORIZONTAL); + this->GetWidget<NWidgetCore>(WID_SL_CAPTION)->widget_data = saveload_captions[mode]; + this->vscroll = this->GetScrollbar(WID_SL_SCROLLBAR); this->FinishInitNested(desc, 0); - this->LowerWidget(SLWW_DRIVES_DIRECTORIES_LIST); + this->LowerWidget(WID_SL_DRIVES_DIRECTORIES_LIST); /* pause is only used in single-player, non-editor mode, non-menu mode. It * will be unpaused in the WE_DESTROY event handler. */ @@ -307,7 +307,7 @@ public: /* Focus the edit box by default in the save windows */ if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO || _saveload_mode == SLD_SAVE_HEIGHTMAP) { - this->SetFocusedWidget(SLWW_SAVE_OSK_TITLE); + this->SetFocusedWidget(WID_SL_SAVE_OSK_TITLE); } } @@ -323,14 +323,14 @@ public: virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case SLWW_SORT_BYNAME: - case SLWW_SORT_BYDATE: - if (((_savegame_sort_order & SORT_BY_NAME) != 0) == (widget == SLWW_SORT_BYNAME)) { + case WID_SL_SORT_BYNAME: + case WID_SL_SORT_BYDATE: + if (((_savegame_sort_order & SORT_BY_NAME) != 0) == (widget == WID_SL_SORT_BYNAME)) { this->DrawSortButtonState(widget, _savegame_sort_order & SORT_DESCENDING ? SBS_DOWN : SBS_UP); } break; - case SLWW_BACKGROUND: { + case WID_SL_BACKGROUND: { static const char *path = NULL; static StringID str = STR_ERROR_UNABLE_TO_READ_DRIVE; static uint64 tot = 0; @@ -346,7 +346,7 @@ public: break; } - case SLWW_DRIVES_DIRECTORIES_LIST: { + case WID_SL_DRIVES_DIRECTORIES_LIST: { GfxFillRect(r.left + 1, r.top + 1, r.right, r.bottom, PC_BLACK); uint y = r.top + WD_FRAMERECT_TOP; @@ -363,7 +363,7 @@ public: break; } - case SLWW_DETAILS: { + case WID_SL_DETAILS: { GfxFillRect(r.left + WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP, r.right - WD_FRAMERECT_RIGHT, r.top + FONT_HEIGHT_NORMAL * 2 + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM, PC_GREY); DrawString(r.left, r.right, r.top + FONT_HEIGHT_NORMAL / 2 + WD_FRAMERECT_TOP, STR_SAVELOAD_DETAIL_CAPTION, TC_FROMSTRING, SA_HOR_CENTER); @@ -462,16 +462,16 @@ public: virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case SLWW_BACKGROUND: + case WID_SL_BACKGROUND: size->height = 2 * FONT_HEIGHT_NORMAL + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; break; - case SLWW_DRIVES_DIRECTORIES_LIST: + case WID_SL_DRIVES_DIRECTORIES_LIST: resize->height = FONT_HEIGHT_NORMAL; size->height = resize->height * 10 + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; break; - case SLWW_SORT_BYNAME: - case SLWW_SORT_BYDATE: { + case WID_SL_SORT_BYNAME: + case WID_SL_SORT_BYDATE: { Dimension d = GetStringBoundingBox(this->GetWidget<NWidgetCore>(widget)->widget_data); d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better. d.height += padding.height; @@ -492,33 +492,33 @@ public: this->DrawWidgets(); if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO || _saveload_mode == SLD_SAVE_HEIGHTMAP) { - this->DrawEditBox(SLWW_SAVE_OSK_TITLE); + this->DrawEditBox(WID_SL_SAVE_OSK_TITLE); } } virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case SLWW_SORT_BYNAME: // Sort save names by name + case WID_SL_SORT_BYNAME: // Sort save names by name _savegame_sort_order = (_savegame_sort_order == SORT_BY_NAME) ? SORT_BY_NAME | SORT_DESCENDING : SORT_BY_NAME; _savegame_sort_dirty = true; this->SetDirty(); break; - case SLWW_SORT_BYDATE: // Sort save names by date + case WID_SL_SORT_BYDATE: // Sort save names by date _savegame_sort_order = (_savegame_sort_order == SORT_BY_DATE) ? SORT_BY_DATE | SORT_DESCENDING : SORT_BY_DATE; _savegame_sort_dirty = true; this->SetDirty(); break; - case SLWW_HOME_BUTTON: // OpenTTD 'button', jumps to OpenTTD directory + case WID_SL_HOME_BUTTON: // OpenTTD 'button', jumps to OpenTTD directory FiosBrowseTo(&o_dir); this->InvalidateData(); break; - case SLWW_LOAD_BUTTON: + case WID_SL_LOAD_BUTTON: if (this->selected != NULL && !_load_check_data.HasErrors() && (_load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs())) { _switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_SCENARIO : SM_LOAD_GAME; @@ -532,13 +532,13 @@ public: } break; - case SLWW_NEWGRF_INFO: + case WID_SL_NEWGRF_INFO: if (_load_check_data.HasNewGrfs()) { ShowNewGRFSettings(false, false, false, &_load_check_data.grfconfig); } break; - case SLWW_MISSING_NEWGRFS: + case WID_SL_MISSING_NEWGRFS: if (!_network_available) { ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR); } else { @@ -548,8 +548,8 @@ public: } break; - case SLWW_DRIVES_DIRECTORIES_LIST: { // Click the listbox - int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, SLWW_DRIVES_DIRECTORIES_LIST, WD_FRAMERECT_TOP); + case WID_SL_DRIVES_DIRECTORIES_LIST: { // Click the listbox + int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_SL_DRIVES_DIRECTORIES_LIST, WD_FRAMERECT_TOP); if (y == INT_MAX) return; const FiosItem *file = _fios_items.Get(y); @@ -571,12 +571,12 @@ public: /* Copy clicked name to editbox */ ttd_strlcpy(this->text.buf, file->title, this->text.max_bytes); UpdateTextBufferSize(&this->text); - this->SetWidgetDirty(SLWW_SAVE_OSK_TITLE); + this->SetWidgetDirty(WID_SL_SAVE_OSK_TITLE); } } else if (!_load_check_data.HasErrors()) { this->selected = file; if (_saveload_mode == SLD_LOAD_GAME || _saveload_mode == SLD_LOAD_SCENARIO) { - this->OnClick(pt, SLWW_LOAD_BUTTON, 1); + this->OnClick(pt, WID_SL_LOAD_BUTTON, 1); } else if (_saveload_mode == SLD_LOAD_HEIGHTMAP) { SetFiosType(file->type); strecpy(_file_to_saveload.name, name, lastof(_file_to_saveload.name)); @@ -593,7 +593,7 @@ public: break; } - case SLWW_CONTENT_DOWNLOAD: + case WID_SL_CONTENT_DOWNLOAD: if (!_network_available) { ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR); } else { @@ -607,7 +607,7 @@ public: } break; - case SLWW_DELETE_SELECTION: case SLWW_SAVE_GAME: // Delete, Save game + case WID_SL_DELETE_SELECTION: case WID_SL_SAVE_GAME: // Delete, Save game break; } } @@ -615,7 +615,7 @@ public: virtual void OnMouseLoop() { if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO || _saveload_mode == SLD_SAVE_HEIGHTMAP) { - this->HandleEditBox(SLWW_SAVE_OSK_TITLE); + this->HandleEditBox(WID_SL_SAVE_OSK_TITLE); } } @@ -628,8 +628,8 @@ public: EventState state = ES_NOT_HANDLED; if ((_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO || _saveload_mode == SLD_SAVE_HEIGHTMAP) && - this->HandleEditBoxKey(SLWW_SAVE_OSK_TITLE, key, keycode, state) == HEBR_CONFIRM) { - this->HandleButtonClick(SLWW_SAVE_GAME); + this->HandleEditBoxKey(WID_SL_SAVE_OSK_TITLE, key, keycode, state) == HEBR_CONFIRM) { + this->HandleButtonClick(WID_SL_SAVE_GAME); } return state; @@ -641,7 +641,7 @@ public: * in those saveload modes. */ if (!(_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO || _saveload_mode == SLD_SAVE_HEIGHTMAP)) return; - if (this->IsWidgetLowered(SLWW_DELETE_SELECTION)) { // Delete button clicked + if (this->IsWidgetLowered(WID_SL_DELETE_SELECTION)) { // Delete button clicked if (!FiosDelete(this->text.buf)) { ShowErrorMessage(STR_ERROR_UNABLE_TO_DELETE_FILE, INVALID_STRING_ID, WL_ERROR); } else { @@ -651,7 +651,7 @@ public: } UpdateTextBufferSize(&this->text); - } else if (this->IsWidgetLowered(SLWW_SAVE_GAME)) { // Save button clicked + } else if (this->IsWidgetLowered(WID_SL_SAVE_GAME)) { // Save button clicked if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) { _switch_mode = SM_SAVE_GAME; FiosMakeSavegameName(_file_to_saveload.name, this->text.buf, sizeof(_file_to_saveload.name)); @@ -667,7 +667,7 @@ public: virtual void OnResize() { - this->vscroll->SetCapacityFromWidget(this, SLWW_DRIVES_DIRECTORIES_LIST); + this->vscroll->SetCapacityFromWidget(this, WID_SL_DRIVES_DIRECTORIES_LIST); } /** @@ -689,11 +689,11 @@ public: /* Selection changes */ if (!gui_scope) break; if (_saveload_mode == SLD_LOAD_GAME || _saveload_mode == SLD_LOAD_SCENARIO) { - this->SetWidgetDisabledState(SLWW_LOAD_BUTTON, + this->SetWidgetDisabledState(WID_SL_LOAD_BUTTON, this->selected == NULL || _load_check_data.HasErrors() || !(_load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs())); - this->SetWidgetDisabledState(SLWW_NEWGRF_INFO, + this->SetWidgetDisabledState(WID_SL_NEWGRF_INFO, !_load_check_data.HasNewGrfs()); - this->SetWidgetDisabledState(SLWW_MISSING_NEWGRFS, + this->SetWidgetDisabledState(WID_SL_MISSING_NEWGRFS, !_load_check_data.HasNewGrfs() || _load_check_data.grf_compatibility == GLC_ALL_GOOD); } break; diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 1ea75fda4..e46fbc466 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -38,6 +38,13 @@ extern void MakeNewgameSettingsLive(); +/** Enum for the modes we can generate in. */ +enum GenenerateLandscapeWindowMode { + GLWM_GENERATE, ///< Generate new game. + GLWM_HEIGHTMAP, ///< Load from heightmap. + GLWM_SCENARIO, ///< Generate flat land. +}; + /** * Changes landscape type and sets genworld window dirty * @param landscape new landscape type @@ -60,13 +67,13 @@ static const NWidgetPart _nested_generate_landscape_widgets[] = { /* Landscape selection. */ NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 10), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_TEMPERATE), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_TEMPERATE), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_ARCTIC), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_ARCTIC), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_TROPICAL), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_TROPICAL), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_TOYLAND), SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_TOYLAND), SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE), NWidget(NWID_SPACER), SetFill(1, 0), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 11), @@ -88,18 +95,18 @@ static const NWidgetPart _nested_generate_landscape_widgets[] = { NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0), /* Mapsize X * Y. */ NWidget(NWID_HORIZONTAL), SetPIP(0, 4, 0), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0), NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BY, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(1, 1), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0), EndContainer(), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_LANDSCAPE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_TOWN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_TERRAIN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), - NWidget(WWT_EDITBOX, COLOUR_WHITE, GLAND_RANDOM_EDITBOX), SetDataTip(STR_MAPGEN_RANDOM_SEED_OSKTITLE, STR_MAPGEN_RANDOM_SEED_HELP), SetFill(1, 1), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_WATER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_TREE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_VARIETY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, GLAND_BORDERS_RANDOM), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_LANDSCAPE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TOWN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TERRAIN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), + NWidget(WWT_EDITBOX, COLOUR_WHITE, WID_GL_RANDOM_EDITBOX), SetDataTip(STR_MAPGEN_RANDOM_SEED_OSKTITLE, STR_MAPGEN_RANDOM_SEED_HELP), SetFill(1, 1), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_WATER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TREE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_VARIETY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_BORDERS_RANDOM), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), EndContainer(), EndContainer(), NWidget(NWID_VERTICAL), SetPIP(0, 4, 0), @@ -113,27 +120,27 @@ static const NWidgetPart _nested_generate_landscape_widgets[] = { NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0), /* Starting date. */ NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_START_DATE_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD), SetFill(0, 1), - NWidget(WWT_TEXTBTN, COLOUR_ORANGE, GLAND_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), SetFill(1, 0), - NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_START_DATE_UP), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD), SetFill(0, 1), + NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD), SetFill(0, 1), + NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), SetFill(1, 0), + NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_UP), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD), SetFill(0, 1), EndContainer(), /* Snow line. */ NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_SNOW_LEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_SNOW_LINE_DOWN), SetFill(0, 1), - NWidget(WWT_TEXTBTN, COLOUR_ORANGE, GLAND_SNOW_LEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0), - NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_SNOW_LEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_SNOW_LINE_UP), SetFill(0, 1), + NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_SNOW_LINE_DOWN), SetFill(0, 1), + NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0), + NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_SNOW_LINE_UP), SetFill(0, 1), EndContainer(), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_INDUSTRY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_SMOOTHNESS_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_INDUSTRY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_SMOOTHNESS_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), EndContainer(), EndContainer(), - NWidget(WWT_TEXTBTN, COLOUR_ORANGE, GLAND_RANDOM_BUTTON), SetDataTip(STR_MAPGEN_RANDOM, STR_MAPGEN_RANDOM_HELP), SetFill(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_RANDOM_BUTTON), SetDataTip(STR_MAPGEN_RANDOM, STR_MAPGEN_RANDOM_HELP), SetFill(1, 0), NWidget(NWID_HORIZONTAL), SetPIP(0, 3, 0), NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_QUANTITY_OF_RIVERS, STR_NULL), SetFill(1, 1), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_RIVER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_RIVER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), EndContainer(), NWidget(NWID_SPACER), SetFill(1, 1), - NWidget(WWT_TEXTBTN, COLOUR_GREEN, GLAND_GENERATE_BUTTON), SetMinimalSize(84, 30), SetDataTip(STR_MAPGEN_GENERATE, STR_NULL), SetFill(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_GREEN, WID_GL_GENERATE_BUTTON), SetMinimalSize(84, 30), SetDataTip(STR_MAPGEN_GENERATE, STR_NULL), SetFill(1, 0), EndContainer(), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 4), @@ -143,8 +150,8 @@ static const NWidgetPart _nested_generate_landscape_widgets[] = { NWidget(NWID_SPACER), SetFill(1, 1), NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NORTHWEST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1), EndContainer(), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, GLAND_WATER_NW), SetDataTip(STR_JUST_STRING, STR_MAPGEN_NORTHWEST), SetFill(1, 1), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, GLAND_WATER_NE), SetDataTip(STR_JUST_STRING, STR_MAPGEN_NORTHEAST), SetFill(1, 1), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_WATER_NW), SetDataTip(STR_JUST_STRING, STR_MAPGEN_NORTHWEST), SetFill(1, 1), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_WATER_NE), SetDataTip(STR_JUST_STRING, STR_MAPGEN_NORTHEAST), SetFill(1, 1), NWidget(NWID_HORIZONTAL), SetPIP(3, 0, 0), NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NORTHEAST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1), NWidget(NWID_SPACER), SetFill(1, 1), @@ -155,8 +162,8 @@ static const NWidgetPart _nested_generate_landscape_widgets[] = { NWidget(NWID_SPACER), SetFill(1, 1), NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SOUTHWEST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1), EndContainer(), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, GLAND_WATER_SW), SetDataTip(STR_JUST_STRING, STR_MAPGEN_SOUTHWEST), SetFill(1, 1), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, GLAND_WATER_SE), SetDataTip(STR_JUST_STRING, STR_MAPGEN_SOUTHEAST), SetFill(1, 1), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_WATER_SW), SetDataTip(STR_JUST_STRING, STR_MAPGEN_SOUTHWEST), SetFill(1, 1), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_WATER_SE), SetDataTip(STR_JUST_STRING, STR_MAPGEN_SOUTHEAST), SetFill(1, 1), NWidget(NWID_HORIZONTAL), SetPIP(3, 0, 0), NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SOUTHEAST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1), NWidget(NWID_SPACER), SetFill(1, 1), @@ -178,13 +185,13 @@ static const NWidgetPart _nested_heightmap_load_widgets[] = { /* Landscape selection. */ NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 10), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_TEMPERATE), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_TEMPERATE), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_ARCTIC), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_ARCTIC), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_TROPICAL), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_TROPICAL), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_TOYLAND), SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_TOYLAND), SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE), NWidget(NWID_SPACER), SetFill(1, 0), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 11), SetFill(0, 1), @@ -202,21 +209,21 @@ static const NWidgetPart _nested_heightmap_load_widgets[] = { EndContainer(), /* Widgets at the right of the labels. */ NWidget(NWID_VERTICAL), SetPIP(0, 4, 0), - NWidget(WWT_EMPTY, COLOUR_ORANGE, GLAND_HEIGHTMAP_NAME_TEXT), SetFill(1, 0), + NWidget(WWT_EMPTY, COLOUR_ORANGE, WID_GL_HEIGHTMAP_NAME_TEXT), SetFill(1, 0), NWidget(NWID_HORIZONTAL), SetPIP(0, 5, 0), NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0), /* Mapsize X * Y. */ NWidget(NWID_HORIZONTAL), SetPIP(0, 4, 0), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0), NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BY, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(1, 1), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0), EndContainer(), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_TOWN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_INDUSTRY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), - NWidget(WWT_EDITBOX, COLOUR_WHITE, GLAND_RANDOM_EDITBOX), SetDataTip(STR_MAPGEN_RANDOM_SEED_OSKTITLE, STR_MAPGEN_RANDOM_SEED_HELP), SetFill(1, 1), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_RIVER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_TREE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_HEIGHTMAP_ROTATION_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TOWN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_INDUSTRY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), + NWidget(WWT_EDITBOX, COLOUR_WHITE, WID_GL_RANDOM_EDITBOX), SetDataTip(STR_MAPGEN_RANDOM_SEED_OSKTITLE, STR_MAPGEN_RANDOM_SEED_HELP), SetFill(1, 1), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_RIVER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TREE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_HEIGHTMAP_ROTATION_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), EndContainer(), NWidget(NWID_VERTICAL), SetPIP(0, 4, 0), NWidget(NWID_HORIZONTAL), SetPIP(0, 3, 0), @@ -226,22 +233,22 @@ static const NWidgetPart _nested_heightmap_load_widgets[] = { NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SNOW_LINE_HEIGHT, STR_NULL), SetFill(1, 1), EndContainer(), NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0), - NWidget(WWT_TEXT, COLOUR_ORANGE, GLAND_HEIGHTMAP_SIZE_TEXT), SetDataTip(STR_MAPGEN_HEIGHTMAP_SIZE, STR_NULL), SetFill(1, 0), + NWidget(WWT_TEXT, COLOUR_ORANGE, WID_GL_HEIGHTMAP_SIZE_TEXT), SetDataTip(STR_MAPGEN_HEIGHTMAP_SIZE, STR_NULL), SetFill(1, 0), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_START_DATE_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD), SetFill(0, 1), - NWidget(WWT_TEXTBTN, COLOUR_ORANGE, GLAND_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), SetFill(1, 0), - NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_START_DATE_UP), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD), SetFill(0, 1), + NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD), SetFill(0, 1), + NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), SetFill(1, 0), + NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_UP), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD), SetFill(0, 1), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_SNOW_LEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_SNOW_LINE_DOWN), SetFill(0, 1), - NWidget(WWT_TEXTBTN, COLOUR_ORANGE, GLAND_SNOW_LEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0), - NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_SNOW_LEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_SNOW_LINE_UP), SetFill(0, 1), + NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_SNOW_LINE_DOWN), SetFill(0, 1), + NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0), + NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_SNOW_LINE_UP), SetFill(0, 1), EndContainer(), EndContainer(), EndContainer(), - NWidget(WWT_TEXTBTN, COLOUR_ORANGE, GLAND_RANDOM_BUTTON), SetDataTip(STR_MAPGEN_RANDOM, STR_MAPGEN_RANDOM_HELP), SetFill(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_RANDOM_BUTTON), SetDataTip(STR_MAPGEN_RANDOM, STR_MAPGEN_RANDOM_HELP), SetFill(1, 0), NWidget(NWID_SPACER), SetFill(1, 1), - NWidget(WWT_TEXTBTN, COLOUR_GREEN, GLAND_GENERATE_BUTTON), SetMinimalSize(84, 30), SetDataTip(STR_MAPGEN_GENERATE, STR_NULL), SetFill(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_GREEN, WID_GL_GENERATE_BUTTON), SetMinimalSize(84, 30), SetDataTip(STR_MAPGEN_GENERATE, STR_NULL), SetFill(1, 0), EndContainer(), EndContainer(), EndContainer(), @@ -310,7 +317,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { { this->InitNested(desc, number); - this->LowerWidget(_settings_newgame.game_creation.landscape + GLAND_TEMPERATE); + this->LowerWidget(_settings_newgame.game_creation.landscape + WID_GL_TEMPERATE); /* snprintf() always outputs trailing '\0', so whole buffer can be used */ snprintf(this->edit_str_buf, this->edit_str_size, "%u", _settings_newgame.game_creation.generation_seed); @@ -321,9 +328,9 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { this->mode = (GenenerateLandscapeWindowMode)this->window_number; /* Disable town, industry and trees in SE */ - this->SetWidgetDisabledState(GLAND_TOWN_PULLDOWN, _game_mode == GM_EDITOR); - this->SetWidgetDisabledState(GLAND_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR); - this->SetWidgetDisabledState(GLAND_TREE_PULLDOWN, _game_mode == GM_EDITOR); + this->SetWidgetDisabledState(WID_GL_TOWN_PULLDOWN, _game_mode == GM_EDITOR); + this->SetWidgetDisabledState(WID_GL_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR); + this->SetWidgetDisabledState(WID_GL_TREE_PULLDOWN, _game_mode == GM_EDITOR); this->OnInvalidateData(); } @@ -332,12 +339,12 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { virtual void SetStringParameters(int widget) const { switch (widget) { - case GLAND_START_DATE_TEXT: SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); break; - case GLAND_MAPSIZE_X_PULLDOWN: SetDParam(0, 1 << _settings_newgame.game_creation.map_x); break; - case GLAND_MAPSIZE_Y_PULLDOWN: SetDParam(0, 1 << _settings_newgame.game_creation.map_y); break; - case GLAND_SNOW_LEVEL_TEXT: SetDParam(0, _settings_newgame.game_creation.snow_line_height); break; + case WID_GL_START_DATE_TEXT: SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); break; + case WID_GL_MAPSIZE_X_PULLDOWN: SetDParam(0, 1 << _settings_newgame.game_creation.map_x); break; + case WID_GL_MAPSIZE_Y_PULLDOWN: SetDParam(0, 1 << _settings_newgame.game_creation.map_y); break; + case WID_GL_SNOW_LEVEL_TEXT: SetDParam(0, _settings_newgame.game_creation.snow_line_height); break; - case GLAND_TOWN_PULLDOWN: + case WID_GL_TOWN_PULLDOWN: if (_game_mode == GM_EDITOR) { SetDParam(0, STR_CONFIG_SETTING_OFF); } else if (_settings_newgame.difficulty.number_towns == CUSTOM_TOWN_NUMBER_DIFFICULTY) { @@ -348,12 +355,12 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { } break; - case GLAND_INDUSTRY_PULLDOWN: SetDParam(0, _game_mode == GM_EDITOR ? STR_CONFIG_SETTING_OFF : _num_inds[_settings_newgame.difficulty.industry_density]); break; - case GLAND_LANDSCAPE_PULLDOWN: SetDParam(0, _landscape[_settings_newgame.game_creation.land_generator]); break; - case GLAND_TREE_PULLDOWN: SetDParam(0, _tree_placer[_settings_newgame.game_creation.tree_placer]); break; - case GLAND_TERRAIN_PULLDOWN: SetDParam(0, _elevations[_settings_newgame.difficulty.terrain_type]); break; + case WID_GL_INDUSTRY_PULLDOWN: SetDParam(0, _game_mode == GM_EDITOR ? STR_CONFIG_SETTING_OFF : _num_inds[_settings_newgame.difficulty.industry_density]); break; + case WID_GL_LANDSCAPE_PULLDOWN: SetDParam(0, _landscape[_settings_newgame.game_creation.land_generator]); break; + case WID_GL_TREE_PULLDOWN: SetDParam(0, _tree_placer[_settings_newgame.game_creation.tree_placer]); break; + case WID_GL_TERRAIN_PULLDOWN: SetDParam(0, _elevations[_settings_newgame.difficulty.terrain_type]); break; - case GLAND_WATER_PULLDOWN: + case WID_GL_WATER_PULLDOWN: if (_settings_newgame.difficulty.quantity_sea_lakes == CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY) { SetDParam(0, STR_SEA_LEVEL_CUSTOM_PERCENTAGE); SetDParam(1, _settings_newgame.game_creation.custom_sea_level); @@ -362,17 +369,17 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { } break; - case GLAND_RIVER_PULLDOWN: SetDParam(0, _rivers[_settings_newgame.game_creation.amount_of_rivers]); break; - case GLAND_SMOOTHNESS_PULLDOWN: SetDParam(0, _smoothness[_settings_newgame.game_creation.tgen_smoothness]); break; - case GLAND_VARIETY_PULLDOWN: SetDParam(0, _variety[_settings_newgame.game_creation.variety]); break; - case GLAND_BORDERS_RANDOM: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOMIZE : STR_MAPGEN_BORDER_MANUAL); break; - case GLAND_WATER_NE: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_NE) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break; - case GLAND_WATER_NW: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_NW) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break; - case GLAND_WATER_SE: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_SE) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break; - case GLAND_WATER_SW: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_SW) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break; - case GLAND_HEIGHTMAP_ROTATION_PULLDOWN: SetDParam(0, _rotation[_settings_newgame.game_creation.heightmap_rotation]); break; + case WID_GL_RIVER_PULLDOWN: SetDParam(0, _rivers[_settings_newgame.game_creation.amount_of_rivers]); break; + case WID_GL_SMOOTHNESS_PULLDOWN: SetDParam(0, _smoothness[_settings_newgame.game_creation.tgen_smoothness]); break; + case WID_GL_VARIETY_PULLDOWN: SetDParam(0, _variety[_settings_newgame.game_creation.variety]); break; + case WID_GL_BORDERS_RANDOM: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOMIZE : STR_MAPGEN_BORDER_MANUAL); break; + case WID_GL_WATER_NE: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_NE) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break; + case WID_GL_WATER_NW: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_NW) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break; + case WID_GL_WATER_SE: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_SE) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break; + case WID_GL_WATER_SW: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_SW) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break; + case WID_GL_HEIGHTMAP_ROTATION_PULLDOWN: SetDParam(0, _rotation[_settings_newgame.game_creation.heightmap_rotation]); break; - case GLAND_HEIGHTMAP_SIZE_TEXT: + case WID_GL_HEIGHTMAP_SIZE_TEXT: if (_settings_newgame.game_creation.heightmap_rotation == HM_CLOCKWISE) { SetDParam(0, this->y); SetDParam(1, this->x); @@ -393,38 +400,38 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { { 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); + this->SetWidgetLoweredState(WID_GL_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE); + this->SetWidgetLoweredState(WID_GL_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC); + this->SetWidgetLoweredState(WID_GL_TROPICAL, _settings_newgame.game_creation.landscape == LT_TROPIC); + this->SetWidgetLoweredState(WID_GL_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->SetWidgetDisabledState(WID_GL_SMOOTHNESS_PULLDOWN, _settings_newgame.game_creation.land_generator == 0); + this->SetWidgetDisabledState(WID_GL_VARIETY_PULLDOWN, _settings_newgame.game_creation.land_generator == 0); + this->SetWidgetDisabledState(WID_GL_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, - GLAND_WATER_NW, GLAND_WATER_NE, GLAND_WATER_SE, GLAND_WATER_SW, WIDGET_LIST_END); + WID_GL_WATER_NW, WID_GL_WATER_NE, WID_GL_WATER_SE, WID_GL_WATER_SW, WIDGET_LIST_END); - this->SetWidgetLoweredState(GLAND_BORDERS_RANDOM, _settings_newgame.game_creation.water_borders == BORDERS_RANDOM); + this->SetWidgetLoweredState(WID_GL_BORDERS_RANDOM, _settings_newgame.game_creation.water_borders == BORDERS_RANDOM); - this->SetWidgetLoweredState(GLAND_WATER_NW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_NW)); - this->SetWidgetLoweredState(GLAND_WATER_NE, HasBit(_settings_newgame.game_creation.water_borders, BORDER_NE)); - this->SetWidgetLoweredState(GLAND_WATER_SE, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SE)); - this->SetWidgetLoweredState(GLAND_WATER_SW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SW)); + this->SetWidgetLoweredState(WID_GL_WATER_NW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_NW)); + this->SetWidgetLoweredState(WID_GL_WATER_NE, HasBit(_settings_newgame.game_creation.water_borders, BORDER_NE)); + this->SetWidgetLoweredState(WID_GL_WATER_SE, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SE)); + this->SetWidgetLoweredState(WID_GL_WATER_SW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SW)); this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == 0 && (_settings_newgame.game_creation.landscape == LT_ARCTIC || _settings_newgame.game_creation.landscape == LT_TROPIC), - GLAND_TERRAIN_PULLDOWN, GLAND_WATER_PULLDOWN, WIDGET_LIST_END); + WID_GL_TERRAIN_PULLDOWN, WID_GL_WATER_PULLDOWN, WIDGET_LIST_END); } /* Disable snowline if not arctic */ - this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_TEXT, _settings_newgame.game_creation.landscape != LT_ARCTIC); + this->SetWidgetDisabledState(WID_GL_SNOW_LEVEL_TEXT, _settings_newgame.game_creation.landscape != LT_ARCTIC); /* Update availability of decreasing / increasing start date and snow level */ - this->SetWidgetDisabledState(GLAND_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR); - this->SetWidgetDisabledState(GLAND_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR); - this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_DOWN, _settings_newgame.game_creation.snow_line_height <= MIN_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC); - this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_UP, _settings_newgame.game_creation.snow_line_height >= MAX_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC); + this->SetWidgetDisabledState(WID_GL_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR); + this->SetWidgetDisabledState(WID_GL_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR); + this->SetWidgetDisabledState(WID_GL_SNOW_LEVEL_DOWN, _settings_newgame.game_creation.snow_line_height <= MIN_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC); + this->SetWidgetDisabledState(WID_GL_SNOW_LEVEL_UP, _settings_newgame.game_creation.snow_line_height >= MAX_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC); /* Do not allow a custom sea level with the original land generator. */ if (_settings_newgame.game_creation.land_generator == 0 && @@ -438,60 +445,60 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { { const StringID *strs = NULL; switch (widget) { - case GLAND_START_DATE_TEXT: + case WID_GL_START_DATE_TEXT: SetDParam(0, ConvertYMDToDate(MAX_YEAR, 0, 1)); *size = GetStringBoundingBox(STR_BLACK_DATE_LONG); break; - case GLAND_MAPSIZE_X_PULLDOWN: - case GLAND_MAPSIZE_Y_PULLDOWN: + case WID_GL_MAPSIZE_X_PULLDOWN: + case WID_GL_MAPSIZE_Y_PULLDOWN: SetDParam(0, MAX_MAP_SIZE); *size = GetStringBoundingBox(STR_JUST_INT); break; - case GLAND_SNOW_LEVEL_TEXT: + case WID_GL_SNOW_LEVEL_TEXT: SetDParam(0, MAX_TILE_HEIGHT); *size = GetStringBoundingBox(STR_JUST_INT); break; - case GLAND_HEIGHTMAP_SIZE_TEXT: + case WID_GL_HEIGHTMAP_SIZE_TEXT: SetDParam(0, this->x); SetDParam(1, this->y); *size = GetStringBoundingBox(STR_MAPGEN_HEIGHTMAP_SIZE); break; - case GLAND_TOWN_PULLDOWN: + case WID_GL_TOWN_PULLDOWN: strs = _num_towns; SetDParam(0, CUSTOM_TOWN_MAX_NUMBER); *size = GetStringBoundingBox(STR_NUM_CUSTOM_NUMBER); break; - case GLAND_INDUSTRY_PULLDOWN: strs = _num_inds; break; - case GLAND_LANDSCAPE_PULLDOWN: strs = _landscape; break; - case GLAND_TREE_PULLDOWN: strs = _tree_placer; break; - case GLAND_TERRAIN_PULLDOWN: strs = _elevations; break; - case GLAND_WATER_PULLDOWN: + case WID_GL_INDUSTRY_PULLDOWN: strs = _num_inds; break; + case WID_GL_LANDSCAPE_PULLDOWN: strs = _landscape; break; + case WID_GL_TREE_PULLDOWN: strs = _tree_placer; break; + case WID_GL_TERRAIN_PULLDOWN: strs = _elevations; break; + case WID_GL_WATER_PULLDOWN: strs = _sea_lakes; SetDParam(0, CUSTOM_SEA_LEVEL_MAX_PERCENTAGE); *size = GetStringBoundingBox(STR_SEA_LEVEL_CUSTOM_PERCENTAGE); break; - case GLAND_RIVER_PULLDOWN: strs = _rivers; break; - case GLAND_SMOOTHNESS_PULLDOWN: strs = _smoothness; break; - case GLAND_VARIETY_PULLDOWN: strs = _variety; break; - case GLAND_HEIGHTMAP_ROTATION_PULLDOWN: strs = _rotation; break; - case GLAND_BORDERS_RANDOM: + case WID_GL_RIVER_PULLDOWN: strs = _rivers; break; + case WID_GL_SMOOTHNESS_PULLDOWN: strs = _smoothness; break; + case WID_GL_VARIETY_PULLDOWN: strs = _variety; break; + case WID_GL_HEIGHTMAP_ROTATION_PULLDOWN: strs = _rotation; break; + case WID_GL_BORDERS_RANDOM: *size = maxdim(GetStringBoundingBox(STR_MAPGEN_BORDER_RANDOMIZE), GetStringBoundingBox(STR_MAPGEN_BORDER_MANUAL)); break; - case GLAND_WATER_NE: - case GLAND_WATER_NW: - case GLAND_WATER_SE: - case GLAND_WATER_SW: + case WID_GL_WATER_NE: + case WID_GL_WATER_NW: + case WID_GL_WATER_SE: + case WID_GL_WATER_SW: *size = maxdim(GetStringBoundingBox(STR_MAPGEN_BORDER_RANDOM), maxdim(GetStringBoundingBox(STR_MAPGEN_BORDER_WATER), GetStringBoundingBox(STR_MAPGEN_BORDER_FREEFORM))); break; - case GLAND_HEIGHTMAP_NAME_TEXT: + case WID_GL_HEIGHTMAP_NAME_TEXT: size->width = 0; break; @@ -510,7 +517,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case GLAND_HEIGHTMAP_NAME_TEXT: { + case WID_GL_HEIGHTMAP_NAME_TEXT: { DrawString(r.left, r.right, r.top, this->name, TC_ORANGE); break; } @@ -520,43 +527,43 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { virtual void OnPaint() { this->DrawWidgets(); - this->DrawEditBox(GLAND_RANDOM_EDITBOX); + this->DrawEditBox(WID_GL_RANDOM_EDITBOX); } virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case GLAND_TEMPERATE: - case GLAND_ARCTIC: - case GLAND_TROPICAL: - case GLAND_TOYLAND: - SetNewLandscapeType(widget - GLAND_TEMPERATE); + case WID_GL_TEMPERATE: + case WID_GL_ARCTIC: + case WID_GL_TROPICAL: + case WID_GL_TOYLAND: + SetNewLandscapeType(widget - WID_GL_TEMPERATE); break; - case GLAND_MAPSIZE_X_PULLDOWN: // Mapsize X - ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_x, GLAND_MAPSIZE_X_PULLDOWN); + case WID_GL_MAPSIZE_X_PULLDOWN: // Mapsize X + ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_x, WID_GL_MAPSIZE_X_PULLDOWN); break; - case GLAND_MAPSIZE_Y_PULLDOWN: // Mapsize Y - ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_y, GLAND_MAPSIZE_Y_PULLDOWN); + case WID_GL_MAPSIZE_Y_PULLDOWN: // Mapsize Y + ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_y, WID_GL_MAPSIZE_Y_PULLDOWN); break; - case GLAND_TOWN_PULLDOWN: // Number of towns - ShowDropDownMenu(this, _num_towns, _settings_newgame.difficulty.number_towns, GLAND_TOWN_PULLDOWN, 0, 0); + case WID_GL_TOWN_PULLDOWN: // Number of towns + ShowDropDownMenu(this, _num_towns, _settings_newgame.difficulty.number_towns, WID_GL_TOWN_PULLDOWN, 0, 0); break; - case GLAND_INDUSTRY_PULLDOWN: // Number of industries - ShowDropDownMenu(this, _num_inds, _settings_newgame.difficulty.industry_density, GLAND_INDUSTRY_PULLDOWN, 0, 0); + case WID_GL_INDUSTRY_PULLDOWN: // Number of industries + ShowDropDownMenu(this, _num_inds, _settings_newgame.difficulty.industry_density, WID_GL_INDUSTRY_PULLDOWN, 0, 0); break; - case GLAND_RANDOM_BUTTON: // Random seed + case WID_GL_RANDOM_BUTTON: // Random seed _settings_newgame.game_creation.generation_seed = InteractiveRandom(); snprintf(this->edit_str_buf, this->edit_str_size, "%u", _settings_newgame.game_creation.generation_seed); UpdateTextBufferSize(&this->text); this->SetDirty(); break; - case GLAND_GENERATE_BUTTON: { // Generate + case WID_GL_GENERATE_BUTTON: { // Generate /* Get rotated map size. */ uint map_x; uint map_y; @@ -583,102 +590,102 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { break; } - case GLAND_START_DATE_DOWN: - case GLAND_START_DATE_UP: // Year buttons + case WID_GL_START_DATE_DOWN: + case WID_GL_START_DATE_UP: // Year buttons /* Don't allow too fast scrolling */ if ((this->flags & WF_TIMEOUT) && this->timeout_timer <= 1) { this->HandleButtonClick(widget); - _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - GLAND_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); + _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - WID_GL_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); this->InvalidateData(); } _left_button_clicked = false; break; - case GLAND_START_DATE_TEXT: // Year text - this->widget_id = GLAND_START_DATE_TEXT; + case WID_GL_START_DATE_TEXT: // Year text + this->widget_id = WID_GL_START_DATE_TEXT; SetDParam(0, _settings_newgame.game_creation.starting_year); ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_ENABLE_DEFAULT); break; - case GLAND_SNOW_LEVEL_DOWN: - case GLAND_SNOW_LEVEL_UP: // Snow line buttons + case WID_GL_SNOW_LEVEL_DOWN: + case WID_GL_SNOW_LEVEL_UP: // Snow line buttons /* Don't allow too fast scrolling */ if ((this->flags & WF_TIMEOUT) && this->timeout_timer <= 1) { this->HandleButtonClick(widget); - _settings_newgame.game_creation.snow_line_height = Clamp(_settings_newgame.game_creation.snow_line_height + widget - GLAND_SNOW_LEVEL_TEXT, MIN_SNOWLINE_HEIGHT, MAX_SNOWLINE_HEIGHT); + _settings_newgame.game_creation.snow_line_height = Clamp(_settings_newgame.game_creation.snow_line_height + widget - WID_GL_SNOW_LEVEL_TEXT, MIN_SNOWLINE_HEIGHT, MAX_SNOWLINE_HEIGHT); this->InvalidateData(); } _left_button_clicked = false; break; - case GLAND_SNOW_LEVEL_TEXT: // Snow line text - this->widget_id = GLAND_SNOW_LEVEL_TEXT; + case WID_GL_SNOW_LEVEL_TEXT: // Snow line text + this->widget_id = WID_GL_SNOW_LEVEL_TEXT; SetDParam(0, _settings_newgame.game_creation.snow_line_height); ShowQueryString(STR_JUST_INT, STR_MAPGEN_SNOW_LINE_QUERY_CAPT, 3, this, CS_NUMERAL, QSF_ENABLE_DEFAULT); break; - case GLAND_TREE_PULLDOWN: // Tree placer - ShowDropDownMenu(this, _tree_placer, _settings_newgame.game_creation.tree_placer, GLAND_TREE_PULLDOWN, 0, 0); + case WID_GL_TREE_PULLDOWN: // Tree placer + ShowDropDownMenu(this, _tree_placer, _settings_newgame.game_creation.tree_placer, WID_GL_TREE_PULLDOWN, 0, 0); break; - case GLAND_LANDSCAPE_PULLDOWN: // Landscape generator - ShowDropDownMenu(this, _landscape, _settings_newgame.game_creation.land_generator, GLAND_LANDSCAPE_PULLDOWN, 0, 0); + case WID_GL_LANDSCAPE_PULLDOWN: // Landscape generator + ShowDropDownMenu(this, _landscape, _settings_newgame.game_creation.land_generator, WID_GL_LANDSCAPE_PULLDOWN, 0, 0); break; - case GLAND_HEIGHTMAP_ROTATION_PULLDOWN: // Heightmap rotation - ShowDropDownMenu(this, _rotation, _settings_newgame.game_creation.heightmap_rotation, GLAND_HEIGHTMAP_ROTATION_PULLDOWN, 0, 0); + case WID_GL_HEIGHTMAP_ROTATION_PULLDOWN: // Heightmap rotation + ShowDropDownMenu(this, _rotation, _settings_newgame.game_creation.heightmap_rotation, WID_GL_HEIGHTMAP_ROTATION_PULLDOWN, 0, 0); break; - case GLAND_TERRAIN_PULLDOWN: // Terrain type - ShowDropDownMenu(this, _elevations, _settings_newgame.difficulty.terrain_type, GLAND_TERRAIN_PULLDOWN, 0, 0); + case WID_GL_TERRAIN_PULLDOWN: // Terrain type + ShowDropDownMenu(this, _elevations, _settings_newgame.difficulty.terrain_type, WID_GL_TERRAIN_PULLDOWN, 0, 0); break; - case GLAND_WATER_PULLDOWN: { // Water quantity + case WID_GL_WATER_PULLDOWN: { // Water quantity uint32 hidden_mask = 0; /* Disable custom water level when the original map generator is active. */ if (_settings_newgame.game_creation.land_generator == 0) { SetBit(hidden_mask, CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY); } - ShowDropDownMenu(this, _sea_lakes, _settings_newgame.difficulty.quantity_sea_lakes, GLAND_WATER_PULLDOWN, 0, hidden_mask); + ShowDropDownMenu(this, _sea_lakes, _settings_newgame.difficulty.quantity_sea_lakes, WID_GL_WATER_PULLDOWN, 0, hidden_mask); break; } - case GLAND_RIVER_PULLDOWN: // Amount of rivers - ShowDropDownMenu(this, _rivers, _settings_newgame.game_creation.amount_of_rivers, GLAND_RIVER_PULLDOWN, 0, 0); + case WID_GL_RIVER_PULLDOWN: // Amount of rivers + ShowDropDownMenu(this, _rivers, _settings_newgame.game_creation.amount_of_rivers, WID_GL_RIVER_PULLDOWN, 0, 0); break; - case GLAND_SMOOTHNESS_PULLDOWN: // Map smoothness - ShowDropDownMenu(this, _smoothness, _settings_newgame.game_creation.tgen_smoothness, GLAND_SMOOTHNESS_PULLDOWN, 0, 0); + case WID_GL_SMOOTHNESS_PULLDOWN: // Map smoothness + ShowDropDownMenu(this, _smoothness, _settings_newgame.game_creation.tgen_smoothness, WID_GL_SMOOTHNESS_PULLDOWN, 0, 0); break; - case GLAND_VARIETY_PULLDOWN: // Map variety - ShowDropDownMenu(this, _variety, _settings_newgame.game_creation.variety, GLAND_VARIETY_PULLDOWN, 0, 0); + case WID_GL_VARIETY_PULLDOWN: // Map variety + ShowDropDownMenu(this, _variety, _settings_newgame.game_creation.variety, WID_GL_VARIETY_PULLDOWN, 0, 0); break; /* Freetype map borders */ - case GLAND_WATER_NW: + case WID_GL_WATER_NW: _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_NW); this->InvalidateData(); break; - case GLAND_WATER_NE: + case WID_GL_WATER_NE: _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_NE); this->InvalidateData(); break; - case GLAND_WATER_SE: + case WID_GL_WATER_SE: _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_SE); this->InvalidateData(); break; - case GLAND_WATER_SW: + case WID_GL_WATER_SW: _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_SW); this->InvalidateData(); break; - case GLAND_BORDERS_RANDOM: + case WID_GL_BORDERS_RANDOM: _settings_newgame.game_creation.water_borders = (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? 0 : BORDERS_RANDOM; this->InvalidateData(); break; @@ -687,7 +694,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { virtual void OnTimeout() { - static const int raise_widgets[] = {GLAND_START_DATE_DOWN, GLAND_START_DATE_UP, GLAND_SNOW_LEVEL_UP, GLAND_SNOW_LEVEL_DOWN, WIDGET_LIST_END}; + static const int raise_widgets[] = {WID_GL_START_DATE_DOWN, WID_GL_START_DATE_UP, WID_GL_SNOW_LEVEL_UP, WID_GL_SNOW_LEVEL_DOWN, WIDGET_LIST_END}; for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) { if (this->IsWidgetLowered(*widget)) { this->RaiseWidget(*widget); @@ -698,13 +705,13 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { virtual void OnMouseLoop() { - this->HandleEditBox(GLAND_RANDOM_EDITBOX); + this->HandleEditBox(WID_GL_RANDOM_EDITBOX); } virtual EventState OnKeyPress(uint16 key, uint16 keycode) { EventState state = ES_NOT_HANDLED; - this->HandleEditBoxKey(GLAND_RANDOM_EDITBOX, key, keycode, state); + this->HandleEditBoxKey(WID_GL_RANDOM_EDITBOX, key, keycode, state); /* the seed is unsigned, therefore atoi cannot be used. * As UINT32_MAX is a 'magic' value (use random seed) it * should not be possible to be entered into the input @@ -716,16 +723,16 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { virtual void OnDropdownSelect(int widget, int index) { switch (widget) { - case GLAND_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break; - case GLAND_MAPSIZE_Y_PULLDOWN: _settings_newgame.game_creation.map_y = index; break; - case GLAND_TREE_PULLDOWN: _settings_newgame.game_creation.tree_placer = index; break; - case GLAND_RIVER_PULLDOWN: _settings_newgame.game_creation.amount_of_rivers = index; break; - case GLAND_SMOOTHNESS_PULLDOWN: _settings_newgame.game_creation.tgen_smoothness = index; break; - case GLAND_VARIETY_PULLDOWN: _settings_newgame.game_creation.variety = index; break; - case GLAND_LANDSCAPE_PULLDOWN: _settings_newgame.game_creation.land_generator = index; break; - case GLAND_HEIGHTMAP_ROTATION_PULLDOWN: _settings_newgame.game_creation.heightmap_rotation = index; break; - - case GLAND_TOWN_PULLDOWN: + case WID_GL_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break; + case WID_GL_MAPSIZE_Y_PULLDOWN: _settings_newgame.game_creation.map_y = index; break; + case WID_GL_TREE_PULLDOWN: _settings_newgame.game_creation.tree_placer = index; break; + case WID_GL_RIVER_PULLDOWN: _settings_newgame.game_creation.amount_of_rivers = index; break; + case WID_GL_SMOOTHNESS_PULLDOWN: _settings_newgame.game_creation.tgen_smoothness = index; break; + case WID_GL_VARIETY_PULLDOWN: _settings_newgame.game_creation.variety = index; break; + case WID_GL_LANDSCAPE_PULLDOWN: _settings_newgame.game_creation.land_generator = index; break; + case WID_GL_HEIGHTMAP_ROTATION_PULLDOWN: _settings_newgame.game_creation.heightmap_rotation = index; break; + + case WID_GL_TOWN_PULLDOWN: if ((uint)index == CUSTOM_TOWN_NUMBER_DIFFICULTY) { this->widget_id = widget; SetDParam(0, _settings_newgame.game_creation.custom_town_number); @@ -734,11 +741,11 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { IConsoleSetSetting("difficulty.number_towns", index); break; - case GLAND_INDUSTRY_PULLDOWN: + case WID_GL_INDUSTRY_PULLDOWN: IConsoleSetSetting("difficulty.industry_density", index); break; - case GLAND_TERRAIN_PULLDOWN: { + case WID_GL_TERRAIN_PULLDOWN: { GameMode old_gm = _game_mode; _game_mode = GM_MENU; IConsoleSetSetting("difficulty.terrain_type", index); @@ -746,7 +753,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { break; } - case GLAND_WATER_PULLDOWN: { + case WID_GL_WATER_PULLDOWN: { if ((uint)index == CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY) { this->widget_id = widget; SetDParam(0, _settings_newgame.game_creation.custom_sea_level); @@ -773,30 +780,30 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { } else { /* An empty string means revert to the default */ switch (this->widget_id) { - case GLAND_START_DATE_TEXT: value = DEF_START_YEAR; break; - case GLAND_SNOW_LEVEL_TEXT: value = DEF_SNOWLINE_HEIGHT; break; - case GLAND_TOWN_PULLDOWN: value = 1; break; - case GLAND_WATER_PULLDOWN: value = CUSTOM_SEA_LEVEL_MIN_PERCENTAGE; break; + case WID_GL_START_DATE_TEXT: value = DEF_START_YEAR; break; + case WID_GL_SNOW_LEVEL_TEXT: value = DEF_SNOWLINE_HEIGHT; break; + case WID_GL_TOWN_PULLDOWN: value = 1; break; + case WID_GL_WATER_PULLDOWN: value = CUSTOM_SEA_LEVEL_MIN_PERCENTAGE; break; default: NOT_REACHED(); } } switch (this->widget_id) { - case GLAND_START_DATE_TEXT: - this->SetWidgetDirty(GLAND_START_DATE_TEXT); + case WID_GL_START_DATE_TEXT: + this->SetWidgetDirty(WID_GL_START_DATE_TEXT); _settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR); break; - case GLAND_SNOW_LEVEL_TEXT: - this->SetWidgetDirty(GLAND_SNOW_LEVEL_TEXT); + case WID_GL_SNOW_LEVEL_TEXT: + this->SetWidgetDirty(WID_GL_SNOW_LEVEL_TEXT); _settings_newgame.game_creation.snow_line_height = Clamp(value, MIN_SNOWLINE_HEIGHT, MAX_SNOWLINE_HEIGHT); break; - case GLAND_TOWN_PULLDOWN: + case WID_GL_TOWN_PULLDOWN: _settings_newgame.game_creation.custom_town_number = Clamp(value, 1, CUSTOM_TOWN_MAX_NUMBER); break; - case GLAND_WATER_PULLDOWN: + case WID_GL_WATER_PULLDOWN: _settings_newgame.game_creation.custom_sea_level = Clamp(value, CUSTOM_SEA_LEVEL_MIN_PERCENTAGE, CUSTOM_SEA_LEVEL_MAX_PERCENTAGE); break; } @@ -882,25 +889,25 @@ struct CreateScenarioWindow : public Window CreateScenarioWindow(const WindowDesc *desc, WindowNumber window_number) : Window() { this->InitNested(desc, window_number); - this->LowerWidget(_settings_newgame.game_creation.landscape + CSCEN_TEMPERATE); + this->LowerWidget(_settings_newgame.game_creation.landscape + WID_CS_TEMPERATE); } virtual void SetStringParameters(int widget) const { switch (widget) { - case CSCEN_START_DATE_TEXT: + case WID_CS_START_DATE_TEXT: SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); break; - case CSCEN_MAPSIZE_X_PULLDOWN: + case WID_CS_MAPSIZE_X_PULLDOWN: SetDParam(0, 1 << _settings_newgame.game_creation.map_x); break; - case CSCEN_MAPSIZE_Y_PULLDOWN: + case WID_CS_MAPSIZE_Y_PULLDOWN: SetDParam(0, 1 << _settings_newgame.game_creation.map_y); break; - case CSCEN_FLAT_LAND_HEIGHT_TEXT: + case WID_CS_FLAT_LAND_HEIGHT_TEXT: SetDParam(0, _settings_newgame.game_creation.se_flat_world_height); break; } @@ -908,15 +915,15 @@ struct CreateScenarioWindow : public Window virtual void OnPaint() { - this->SetWidgetDisabledState(CSCEN_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR); - this->SetWidgetDisabledState(CSCEN_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR); - this->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_DOWN, _settings_newgame.game_creation.se_flat_world_height <= 0); - this->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_UP, _settings_newgame.game_creation.se_flat_world_height >= MAX_TILE_HEIGHT); + this->SetWidgetDisabledState(WID_CS_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR); + this->SetWidgetDisabledState(WID_CS_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR); + this->SetWidgetDisabledState(WID_CS_FLAT_LAND_HEIGHT_DOWN, _settings_newgame.game_creation.se_flat_world_height <= 0); + this->SetWidgetDisabledState(WID_CS_FLAT_LAND_HEIGHT_UP, _settings_newgame.game_creation.se_flat_world_height >= MAX_TILE_HEIGHT); - this->SetWidgetLoweredState(CSCEN_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE); - this->SetWidgetLoweredState(CSCEN_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC); - this->SetWidgetLoweredState(CSCEN_TROPICAL, _settings_newgame.game_creation.landscape == LT_TROPIC); - this->SetWidgetLoweredState(CSCEN_TOYLAND, _settings_newgame.game_creation.landscape == LT_TOYLAND); + this->SetWidgetLoweredState(WID_CS_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE); + this->SetWidgetLoweredState(WID_CS_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC); + this->SetWidgetLoweredState(WID_CS_TROPICAL, _settings_newgame.game_creation.landscape == LT_TROPIC); + this->SetWidgetLoweredState(WID_CS_TOYLAND, _settings_newgame.game_creation.landscape == LT_TOYLAND); this->DrawWidgets(); } @@ -925,17 +932,17 @@ struct CreateScenarioWindow : public Window { StringID str = STR_JUST_INT; switch (widget) { - case CSCEN_START_DATE_TEXT: + case WID_CS_START_DATE_TEXT: SetDParam(0, ConvertYMDToDate(MAX_YEAR, 0, 1)); str = STR_BLACK_DATE_LONG; break; - case CSCEN_MAPSIZE_X_PULLDOWN: - case CSCEN_MAPSIZE_Y_PULLDOWN: + case WID_CS_MAPSIZE_X_PULLDOWN: + case WID_CS_MAPSIZE_Y_PULLDOWN: SetDParam(0, MAX_MAP_SIZE); break; - case CSCEN_FLAT_LAND_HEIGHT_TEXT: + case WID_CS_FLAT_LAND_HEIGHT_TEXT: SetDParam(0, MAX_TILE_HEIGHT); break; @@ -950,62 +957,62 @@ struct CreateScenarioWindow : public Window virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case CSCEN_TEMPERATE: - case CSCEN_ARCTIC: - case CSCEN_TROPICAL: - case CSCEN_TOYLAND: - this->RaiseWidget(_settings_newgame.game_creation.landscape + CSCEN_TEMPERATE); - SetNewLandscapeType(widget - CSCEN_TEMPERATE); + case WID_CS_TEMPERATE: + case WID_CS_ARCTIC: + case WID_CS_TROPICAL: + case WID_CS_TOYLAND: + this->RaiseWidget(_settings_newgame.game_creation.landscape + WID_CS_TEMPERATE); + SetNewLandscapeType(widget - WID_CS_TEMPERATE); break; - case CSCEN_MAPSIZE_X_PULLDOWN: // Mapsize X - ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_x, CSCEN_MAPSIZE_X_PULLDOWN); + case WID_CS_MAPSIZE_X_PULLDOWN: // Mapsize X + ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_x, WID_CS_MAPSIZE_X_PULLDOWN); break; - case CSCEN_MAPSIZE_Y_PULLDOWN: // Mapsize Y - ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_y, CSCEN_MAPSIZE_Y_PULLDOWN); + case WID_CS_MAPSIZE_Y_PULLDOWN: // Mapsize Y + ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_y, WID_CS_MAPSIZE_Y_PULLDOWN); break; - case CSCEN_EMPTY_WORLD: // Empty world / flat world + case WID_CS_EMPTY_WORLD: // Empty world / flat world StartGeneratingLandscape(GLWM_SCENARIO); break; - case CSCEN_RANDOM_WORLD: // Generate + case WID_CS_RANDOM_WORLD: // Generate ShowGenerateLandscape(); break; - case CSCEN_START_DATE_DOWN: - case CSCEN_START_DATE_UP: // Year buttons + case WID_CS_START_DATE_DOWN: + case WID_CS_START_DATE_UP: // Year buttons /* Don't allow too fast scrolling */ if ((this->flags & WF_TIMEOUT) && this->timeout_timer <= 1) { this->HandleButtonClick(widget); this->SetDirty(); - _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - CSCEN_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); + _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - WID_CS_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); } _left_button_clicked = false; break; - case CSCEN_START_DATE_TEXT: // Year text - this->widget_id = CSCEN_START_DATE_TEXT; + case WID_CS_START_DATE_TEXT: // Year text + this->widget_id = WID_CS_START_DATE_TEXT; SetDParam(0, _settings_newgame.game_creation.starting_year); ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_NONE); break; - case CSCEN_FLAT_LAND_HEIGHT_DOWN: - case CSCEN_FLAT_LAND_HEIGHT_UP: // Height level buttons + case WID_CS_FLAT_LAND_HEIGHT_DOWN: + case WID_CS_FLAT_LAND_HEIGHT_UP: // Height level buttons /* Don't allow too fast scrolling */ if ((this->flags & WF_TIMEOUT) && this->timeout_timer <= 1) { this->HandleButtonClick(widget); this->SetDirty(); - _settings_newgame.game_creation.se_flat_world_height = Clamp(_settings_newgame.game_creation.se_flat_world_height + widget - CSCEN_FLAT_LAND_HEIGHT_TEXT, 0, MAX_TILE_HEIGHT); + _settings_newgame.game_creation.se_flat_world_height = Clamp(_settings_newgame.game_creation.se_flat_world_height + widget - WID_CS_FLAT_LAND_HEIGHT_TEXT, 0, MAX_TILE_HEIGHT); } _left_button_clicked = false; break; - case CSCEN_FLAT_LAND_HEIGHT_TEXT: // Height level text - this->widget_id = CSCEN_FLAT_LAND_HEIGHT_TEXT; + case WID_CS_FLAT_LAND_HEIGHT_TEXT: // Height level text + this->widget_id = WID_CS_FLAT_LAND_HEIGHT_TEXT; SetDParam(0, _settings_newgame.game_creation.se_flat_world_height); ShowQueryString(STR_JUST_INT, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_QUERY_CAPT, 3, this, CS_NUMERAL, QSF_NONE); break; @@ -1014,7 +1021,7 @@ struct CreateScenarioWindow : public Window virtual void OnTimeout() { - static const int raise_widgets[] = {CSCEN_START_DATE_DOWN, CSCEN_START_DATE_UP, CSCEN_FLAT_LAND_HEIGHT_DOWN, CSCEN_FLAT_LAND_HEIGHT_UP, WIDGET_LIST_END}; + static const int raise_widgets[] = {WID_CS_START_DATE_DOWN, WID_CS_START_DATE_UP, WID_CS_FLAT_LAND_HEIGHT_DOWN, WID_CS_FLAT_LAND_HEIGHT_UP, WIDGET_LIST_END}; for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) { if (this->IsWidgetLowered(*widget)) { this->RaiseWidget(*widget); @@ -1026,8 +1033,8 @@ struct CreateScenarioWindow : public Window virtual void OnDropdownSelect(int widget, int index) { switch (widget) { - case CSCEN_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break; - case CSCEN_MAPSIZE_Y_PULLDOWN: _settings_newgame.game_creation.map_y = index; break; + case WID_CS_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break; + case WID_CS_MAPSIZE_Y_PULLDOWN: _settings_newgame.game_creation.map_y = index; break; } this->SetDirty(); } @@ -1038,13 +1045,13 @@ struct CreateScenarioWindow : public Window int32 value = atoi(str); switch (this->widget_id) { - case CSCEN_START_DATE_TEXT: - this->SetWidgetDirty(CSCEN_START_DATE_TEXT); + case WID_CS_START_DATE_TEXT: + this->SetWidgetDirty(WID_CS_START_DATE_TEXT); _settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR); break; - case CSCEN_FLAT_LAND_HEIGHT_TEXT: - this->SetWidgetDirty(CSCEN_FLAT_LAND_HEIGHT_TEXT); + case WID_CS_FLAT_LAND_HEIGHT_TEXT: + this->SetWidgetDirty(WID_CS_FLAT_LAND_HEIGHT_TEXT); _settings_newgame.game_creation.se_flat_world_height = Clamp(value, 0, MAX_TILE_HEIGHT); break; } @@ -1063,16 +1070,16 @@ static const NWidgetPart _nested_create_scenario_widgets[] = { NWidget(NWID_SPACER), SetMinimalSize(0, 10), /* Landscape style selection. */ NWidget(NWID_HORIZONTAL), SetPIP(10, 3, 10), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, CSCEN_TEMPERATE), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, CSCEN_ARCTIC), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, CSCEN_TROPICAL), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, CSCEN_TOYLAND), SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_TEMPERATE), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_ARCTIC), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_TROPICAL), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_TOYLAND), SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE), EndContainer(), NWidget(NWID_HORIZONTAL), SetPIP(10, 8, 10), /* Green generation type buttons: 'Flat land' and 'Random land'. */ NWidget(NWID_VERTICAL), SetPIP(10, 6, 10), - NWidget(WWT_TEXTBTN, COLOUR_GREEN, CSCEN_EMPTY_WORLD), SetDataTip(STR_SE_MAPGEN_FLAT_WORLD, STR_SE_MAPGEN_FLAT_WORLD_TOOLTIP), SetFill(1, 1), - NWidget(WWT_TEXTBTN, COLOUR_GREEN, CSCEN_RANDOM_WORLD), SetDataTip(STR_SE_MAPGEN_RANDOM_LAND, STR_TERRAFORM_TOOLTIP_GENERATE_RANDOM_LAND), SetFill(1, 1), + NWidget(WWT_TEXTBTN, COLOUR_GREEN, WID_CS_EMPTY_WORLD), SetDataTip(STR_SE_MAPGEN_FLAT_WORLD, STR_SE_MAPGEN_FLAT_WORLD_TOOLTIP), SetFill(1, 1), + NWidget(WWT_TEXTBTN, COLOUR_GREEN, WID_CS_RANDOM_WORLD), SetDataTip(STR_SE_MAPGEN_RANDOM_LAND, STR_TERRAFORM_TOOLTIP_GENERATE_RANDOM_LAND), SetFill(1, 1), EndContainer(), /* Labels + setting drop-downs */ NWidget(NWID_VERTICAL), SetPIP(10, 6, 10), @@ -1080,26 +1087,26 @@ static const NWidgetPart _nested_create_scenario_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAPSIZE, STR_NULL), SetPadding(1, 0, 0, 0), NWidget(NWID_SPACER), SetMinimalSize(6, 0), SetFill(1, 0), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, CSCEN_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetPadding(0, 4, 0, 0), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_CS_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetPadding(0, 4, 0, 0), NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BY, STR_NULL), SetPadding(1, 2, 0, 0), - NWidget(WWT_DROPDOWN, COLOUR_ORANGE, CSCEN_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), + NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_CS_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), EndContainer(), /* Date. */ NWidget(NWID_HORIZONTAL), NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_DATE, STR_NULL), SetPadding(1, 0, 0, 0), NWidget(NWID_SPACER), SetMinimalSize(6, 0), SetFill(1, 0), - NWidget(WWT_IMGBTN, COLOUR_ORANGE, CSCEN_START_DATE_DOWN), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD), - NWidget(WWT_TEXTBTN, COLOUR_ORANGE, CSCEN_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), - NWidget(WWT_IMGBTN, COLOUR_ORANGE, CSCEN_START_DATE_UP), SetFill(0, 1), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD), + NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_CS_START_DATE_DOWN), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD), + NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_CS_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), + NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_CS_START_DATE_UP), SetFill(0, 1), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD), EndContainer(), /* Flat map height. */ NWidget(NWID_HORIZONTAL), NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_SE_MAPGEN_FLAT_WORLD_HEIGHT, STR_NULL), SetPadding(1, 0, 0, 0), NWidget(NWID_SPACER), SetMinimalSize(6, 0), SetFill(1, 0), - NWidget(WWT_IMGBTN, COLOUR_ORANGE, CSCEN_FLAT_LAND_HEIGHT_DOWN), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_DOWN), - NWidget(WWT_TEXTBTN, COLOUR_ORANGE, CSCEN_FLAT_LAND_HEIGHT_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), - NWidget(WWT_IMGBTN, COLOUR_ORANGE, CSCEN_FLAT_LAND_HEIGHT_UP), SetFill(0, 1), SetDataTip(SPR_ARROW_UP, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_UP), + NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_CS_FLAT_LAND_HEIGHT_DOWN), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_DOWN), + NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_CS_FLAT_LAND_HEIGHT_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), + NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_CS_FLAT_LAND_HEIGHT_UP), SetFill(0, 1), SetDataTip(SPR_ARROW_UP, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_UP), EndContainer(), EndContainer(), EndContainer(), @@ -1125,9 +1132,9 @@ static const NWidgetPart _nested_generate_progress_widgets[] = { NWidget(WWT_PANEL, COLOUR_GREY), NWidget(NWID_HORIZONTAL), SetPIP(20, 0, 20), NWidget(NWID_VERTICAL), SetPIP(11, 8, 11), - NWidget(WWT_EMPTY, INVALID_COLOUR, GPWW_PROGRESS_BAR), SetFill(1, 0), - NWidget(WWT_EMPTY, INVALID_COLOUR, GPWW_PROGRESS_TEXT), SetFill(1, 0), - NWidget(WWT_TEXTBTN, COLOUR_WHITE, GPWW_ABORT), SetDataTip(STR_GENERATION_ABORT, STR_NULL), SetFill(1, 0), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_GP_PROGRESS_BAR), SetFill(1, 0), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_GP_PROGRESS_TEXT), SetFill(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_WHITE, WID_GP_ABORT), SetDataTip(STR_GENERATION_ABORT, STR_NULL), SetFill(1, 0), EndContainer(), EndContainer(), EndContainer(), @@ -1186,7 +1193,7 @@ struct GenerateProgressWindow : public Window { virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case GPWW_ABORT: + case WID_GP_ABORT: if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE, PAL_NONE); ShowQuery( STR_GENERATION_ABORT_CAPTION, @@ -1201,7 +1208,7 @@ struct GenerateProgressWindow : public Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case GPWW_PROGRESS_BAR: { + case WID_GP_PROGRESS_BAR: { SetDParam(0, 100); *size = GetStringBoundingBox(STR_GENERATION_PROGRESS); /* We need some spacing for the 'border' */ @@ -1210,7 +1217,7 @@ struct GenerateProgressWindow : public Window { break; } - case GPWW_PROGRESS_TEXT: + case WID_GP_PROGRESS_TEXT: for (uint i = 0; i < GWP_CLASS_COUNT; i++) { size->width = max(size->width, GetStringBoundingBox(_generation_class_table[i]).width); } @@ -1222,7 +1229,7 @@ struct GenerateProgressWindow : public Window { virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case GPWW_PROGRESS_BAR: + case WID_GP_PROGRESS_BAR: /* Draw the % complete with a bar and a text */ DrawFrameRect(r.left, r.top, r.right, r.bottom, COLOUR_GREY, FR_BORDERONLY); DrawFrameRect(r.left + 1, r.top + 1, (int)((r.right - r.left - 2) * _gws.percent / 100) + r.left + 1, r.bottom - 1, COLOUR_MAUVE, FR_NONE); @@ -1230,7 +1237,7 @@ struct GenerateProgressWindow : public Window { DrawString(r.left, r.right, r.top + 5, STR_GENERATION_PROGRESS, TC_FROMSTRING, SA_HOR_CENTER); break; - case GPWW_PROGRESS_TEXT: + case WID_GP_PROGRESS_TEXT: /* Tell which class we are generating */ DrawString(r.left, r.right, r.top, _gws.cls, TC_FROMSTRING, SA_HOR_CENTER); diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 2ab5d75f8..8cc46b231 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -48,7 +48,7 @@ struct GraphLegendWindow : Window { this->InitNested(desc, window_number); for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) { - if (!HasBit(_legend_excluded_companies, c)) this->LowerWidget(c + GLW_FIRST_COMPANY); + if (!HasBit(_legend_excluded_companies, c)) this->LowerWidget(c + WID_GL_FIRST_COMPANY); this->OnInvalidateData(c); } @@ -56,9 +56,9 @@ struct GraphLegendWindow : Window { virtual void DrawWidget(const Rect &r, int widget) const { - if (!IsInsideMM(widget, GLW_FIRST_COMPANY, MAX_COMPANIES + GLW_FIRST_COMPANY)) return; + if (!IsInsideMM(widget, WID_GL_FIRST_COMPANY, MAX_COMPANIES + WID_GL_FIRST_COMPANY)) return; - CompanyID cid = (CompanyID)(widget - GLW_FIRST_COMPANY); + CompanyID cid = (CompanyID)(widget - WID_GL_FIRST_COMPANY); if (!Company::IsValidID(cid)) return; @@ -74,9 +74,9 @@ struct GraphLegendWindow : Window { virtual void OnClick(Point pt, int widget, int click_count) { - if (!IsInsideMM(widget, GLW_FIRST_COMPANY, MAX_COMPANIES + GLW_FIRST_COMPANY)) return; + if (!IsInsideMM(widget, WID_GL_FIRST_COMPANY, MAX_COMPANIES + WID_GL_FIRST_COMPANY)) return; - ToggleBit(_legend_excluded_companies, widget - GLW_FIRST_COMPANY); + ToggleBit(_legend_excluded_companies, widget - WID_GL_FIRST_COMPANY); this->ToggleWidgetLoweredState(widget); this->SetDirty(); InvalidateWindowData(WC_INCOME_GRAPH, 0); @@ -97,7 +97,7 @@ struct GraphLegendWindow : Window { if (Company::IsValidID(data)) return; SetBit(_legend_excluded_companies, data); - this->RaiseWidget(data + GLW_FIRST_COMPANY); + this->RaiseWidget(data + WID_GL_FIRST_COMPANY); } }; @@ -112,14 +112,14 @@ static NWidgetBase *MakeNWidgetCompanyLines(int *biggest_index) NWidgetVertical *vert = new NWidgetVertical(); uint line_height = max<uint>(GetSpriteSize(SPR_COMPANY_ICON).height, FONT_HEIGHT_NORMAL) + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; - for (int widnum = GLW_FIRST_COMPANY; widnum <= GLW_LAST_COMPANY; widnum++) { + for (int widnum = WID_GL_FIRST_COMPANY; widnum <= WID_GL_LAST_COMPANY; widnum++) { NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, widnum); panel->SetMinimalSize(246, line_height); panel->SetFill(1, 0); panel->SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP); vert->Add(panel); } - *biggest_index = GLW_LAST_COMPANY; + *biggest_index = WID_GL_LAST_COMPANY; return vert; } @@ -130,7 +130,7 @@ static const NWidgetPart _nested_graph_legend_widgets[] = { NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, GLW_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_GREY, WID_GL_BACKGROUND), NWidget(NWID_SPACER), SetMinimalSize(0, 2), NWidget(NWID_HORIZONTAL), NWidget(NWID_SPACER), SetMinimalSize(2, 0), @@ -532,7 +532,7 @@ public: virtual void OnClick(Point pt, int widget, int click_count) { /* Clicked on legend? */ - if (widget == BGW_KEY_BUTTON) ShowGraphLegend(); + if (widget == WID_CV_KEY_BUTTON) ShowGraphLegend(); } virtual void OnTick() @@ -612,7 +612,7 @@ public: struct OperatingProfitGraphWindow : BaseGraphWindow { OperatingProfitGraphWindow(const WindowDesc *desc, WindowNumber window_number) : - BaseGraphWindow(BGW_GRAPH, STR_JUST_CURRENCY_SHORT) + BaseGraphWindow(WID_CV_GRAPH, STR_JUST_CURRENCY_SHORT) { this->InitializeWindow(desc, window_number); } @@ -627,16 +627,16 @@ static const NWidgetPart _nested_operating_profit_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_OPERATING_PROFIT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BGW_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, BGW_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_GREY, WID_CV_BACKGROUND), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, COLOUR_GREY, BGW_GRAPH), SetMinimalSize(576, 160), SetFill(1, 1), SetResize(1, 1), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CV_GRAPH), SetMinimalSize(576, 160), SetFill(1, 1), SetResize(1, 1), NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1), - NWidget(WWT_RESIZEBOX, COLOUR_GREY, BGW_RESIZE), + NWidget(WWT_RESIZEBOX, COLOUR_GREY, WID_CV_RESIZE), EndContainer(), EndContainer(), EndContainer(), @@ -662,7 +662,7 @@ void ShowOperatingProfitGraph() struct IncomeGraphWindow : BaseGraphWindow { IncomeGraphWindow(const WindowDesc *desc, WindowNumber window_number) : - BaseGraphWindow(BGW_GRAPH, STR_JUST_CURRENCY_SHORT) + BaseGraphWindow(WID_CV_GRAPH, STR_JUST_CURRENCY_SHORT) { this->InitializeWindow(desc, window_number); } @@ -677,16 +677,16 @@ static const NWidgetPart _nested_income_graph_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_INCOME_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BGW_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, BGW_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_GREY, WID_CV_BACKGROUND), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, COLOUR_GREY, BGW_GRAPH), SetMinimalSize(576, 128), SetFill(1, 1), SetResize(1, 1), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CV_GRAPH), SetMinimalSize(576, 128), SetFill(1, 1), SetResize(1, 1), NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1), - NWidget(WWT_RESIZEBOX, COLOUR_GREY, BGW_RESIZE), + NWidget(WWT_RESIZEBOX, COLOUR_GREY, WID_CV_RESIZE), EndContainer(), EndContainer(), EndContainer(), @@ -710,7 +710,7 @@ void ShowIncomeGraph() struct DeliveredCargoGraphWindow : BaseGraphWindow { DeliveredCargoGraphWindow(const WindowDesc *desc, WindowNumber window_number) : - BaseGraphWindow(BGW_GRAPH, STR_JUST_COMMA) + BaseGraphWindow(WID_CV_GRAPH, STR_JUST_COMMA) { this->InitializeWindow(desc, window_number); } @@ -725,16 +725,16 @@ static const NWidgetPart _nested_delivered_cargo_graph_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_CARGO_DELIVERED_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BGW_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, BGW_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_GREY, WID_CV_BACKGROUND), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, COLOUR_GREY, BGW_GRAPH), SetMinimalSize(576, 128), SetFill(1, 1), SetResize(1, 1), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CV_GRAPH), SetMinimalSize(576, 128), SetFill(1, 1), SetResize(1, 1), NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1), - NWidget(WWT_RESIZEBOX, COLOUR_GREY, BGW_RESIZE), + NWidget(WWT_RESIZEBOX, COLOUR_GREY, WID_CV_RESIZE), EndContainer(), EndContainer(), EndContainer(), @@ -758,7 +758,7 @@ void ShowDeliveredCargoGraph() struct PerformanceHistoryGraphWindow : BaseGraphWindow { PerformanceHistoryGraphWindow(const WindowDesc *desc, WindowNumber window_number) : - BaseGraphWindow(PHW_GRAPH, STR_JUST_COMMA) + BaseGraphWindow(WID_PHG_GRAPH, STR_JUST_COMMA) { this->InitializeWindow(desc, window_number); } @@ -770,7 +770,7 @@ struct PerformanceHistoryGraphWindow : BaseGraphWindow { virtual void OnClick(Point pt, int widget, int click_count) { - if (widget == PHW_DETAILED_PERFORMANCE) ShowPerformanceRatingDetail(); + if (widget == WID_PHG_DETAILED_PERFORMANCE) ShowPerformanceRatingDetail(); this->BaseGraphWindow::OnClick(pt, widget, click_count); } }; @@ -779,17 +779,17 @@ static const NWidgetPart _nested_performance_history_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_COMPANY_PERFORMANCE_RATINGS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, PHW_DETAILED_PERFORMANCE), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_PERFORMANCE_DETAIL_KEY, STR_GRAPH_PERFORMANCE_DETAIL_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, PHW_KEY), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_PHG_DETAILED_PERFORMANCE), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_PERFORMANCE_DETAIL_KEY, STR_GRAPH_PERFORMANCE_DETAIL_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_PHG_KEY), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, PHW_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_GREY, WID_PHG_BACKGROUND), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, COLOUR_GREY, PHW_GRAPH), SetMinimalSize(576, 224), SetFill(1, 1), SetResize(1, 1), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_PHG_GRAPH), SetMinimalSize(576, 224), SetFill(1, 1), SetResize(1, 1), NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1), - NWidget(WWT_RESIZEBOX, COLOUR_GREY, PHW_RESIZE), + NWidget(WWT_RESIZEBOX, COLOUR_GREY, WID_PHG_RESIZE), EndContainer(), EndContainer(), EndContainer(), @@ -813,7 +813,7 @@ void ShowPerformanceHistoryGraph() struct CompanyValueGraphWindow : BaseGraphWindow { CompanyValueGraphWindow(const WindowDesc *desc, WindowNumber window_number) : - BaseGraphWindow(BGW_GRAPH, STR_JUST_CURRENCY_SHORT) + BaseGraphWindow(WID_CV_GRAPH, STR_JUST_CURRENCY_SHORT) { this->InitializeWindow(desc, window_number); } @@ -828,16 +828,16 @@ static const NWidgetPart _nested_company_value_graph_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_COMPANY_VALUES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BGW_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, BGW_BACKGROUND), + NWidget(WWT_PANEL, COLOUR_GREY, WID_CV_BACKGROUND), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, COLOUR_GREY, BGW_GRAPH), SetMinimalSize(576, 224), SetFill(1, 1), SetResize(1, 1), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CV_GRAPH), SetMinimalSize(576, 224), SetFill(1, 1), SetResize(1, 1), NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1), - NWidget(WWT_RESIZEBOX, COLOUR_GREY, BGW_RESIZE), + NWidget(WWT_RESIZEBOX, COLOUR_GREY, WID_CV_RESIZE), EndContainer(), EndContainer(), EndContainer(), @@ -862,7 +862,7 @@ void ShowCompanyValueGraph() struct PaymentRatesGraphWindow : BaseGraphWindow { bool first_init; ///< This value is true until the first initialization of the window has finished. PaymentRatesGraphWindow(const WindowDesc *desc, WindowNumber window_number) : - BaseGraphWindow(CPW_GRAPH, STR_JUST_CURRENCY_SHORT) + BaseGraphWindow(WID_CPR_GRAPH, STR_JUST_CURRENCY_SHORT) { this->first_init = true; this->num_on_x_axis = 20; @@ -906,18 +906,18 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { void UpdateLoweredWidgets() { for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) { - this->SetWidgetLoweredState(CPW_CARGO_FIRST + i, !HasBit(this->excluded_data, i)); + this->SetWidgetLoweredState(WID_CPR_CARGO_FIRST + i, !HasBit(this->excluded_data, i)); } } virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget < CPW_CARGO_FIRST) { + if (widget < WID_CPR_CARGO_FIRST) { BaseGraphWindow::UpdateWidgetSize(widget, size, padding, fill, resize); return; } - const CargoSpec *cs = _sorted_cargo_specs[widget - CPW_CARGO_FIRST]; + const CargoSpec *cs = _sorted_cargo_specs[widget - WID_CPR_CARGO_FIRST]; SetDParam(0, cs->name); Dimension d = GetStringBoundingBox(STR_GRAPH_CARGO_PAYMENT_CARGO); d.width += 14; // colour field @@ -928,12 +928,12 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { virtual void DrawWidget(const Rect &r, int widget) const { - if (widget < CPW_CARGO_FIRST) { + if (widget < WID_CPR_CARGO_FIRST) { BaseGraphWindow::DrawWidget(r, widget); return; } - const CargoSpec *cs = _sorted_cargo_specs[widget - CPW_CARGO_FIRST]; + const CargoSpec *cs = _sorted_cargo_specs[widget - WID_CPR_CARGO_FIRST]; bool rtl = _current_text_dir == TD_RTL; /* Since the buttons have no text, no images, @@ -955,7 +955,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case CPW_ENABLE_CARGOES: + case WID_CPR_ENABLE_CARGOES: /* Remove all cargoes from the excluded lists. */ _legend_excluded_cargo = 0; this->excluded_data = 0; @@ -963,7 +963,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { this->SetDirty(); break; - case CPW_DISABLE_CARGOES: { + case WID_CPR_DISABLE_CARGOES: { /* Add all cargoes to the excluded lists. */ int i = 0; const CargoSpec *cs; @@ -978,8 +978,8 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { } default: - if (widget >= CPW_CARGO_FIRST) { - int i = widget - CPW_CARGO_FIRST; + if (widget >= WID_CPR_CARGO_FIRST) { + int i = widget - WID_CPR_CARGO_FIRST; ToggleBit(_legend_excluded_cargo, _sorted_cargo_specs[i]->Index()); this->ToggleWidgetLoweredState(widget); this->UpdateExcludedData(); @@ -1028,13 +1028,13 @@ static NWidgetBase *MakeCargoButtons(int *biggest_index) NWidgetVertical *ver = new NWidgetVertical; for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) { - NWidgetBackground *leaf = new NWidgetBackground(WWT_PANEL, COLOUR_ORANGE, CPW_CARGO_FIRST + i, NULL); + NWidgetBackground *leaf = new NWidgetBackground(WWT_PANEL, COLOUR_ORANGE, WID_CPR_CARGO_FIRST + i, NULL); leaf->tool_tip = STR_GRAPH_CARGO_PAYMENT_TOGGLE_CARGO; leaf->SetFill(1, 0); leaf->SetLowered(true); ver->Add(leaf); } - *biggest_index = CPW_CARGO_FIRST + _sorted_standard_cargo_specs_size - 1; + *biggest_index = WID_CPR_CARGO_FIRST + _sorted_standard_cargo_specs_size - 1; return ver; } @@ -1046,18 +1046,18 @@ static const NWidgetPart _nested_cargo_payment_rates_widgets[] = { NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, CPW_BACKGROUND), SetMinimalSize(568, 128), + NWidget(WWT_PANEL, COLOUR_GREY, WID_CPR_BACKGROUND), SetMinimalSize(568, 128), NWidget(NWID_HORIZONTAL), NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0), - NWidget(WWT_TEXT, COLOUR_GREY, CPW_HEADER), SetMinimalSize(0, 6), SetPadding(2, 0, 2, 0), SetDataTip(STR_GRAPH_CARGO_PAYMENT_RATES_TITLE, STR_NULL), + NWidget(WWT_TEXT, COLOUR_GREY, WID_CPR_HEADER), SetMinimalSize(0, 6), SetPadding(2, 0, 2, 0), SetDataTip(STR_GRAPH_CARGO_PAYMENT_RATES_TITLE, STR_NULL), NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_EMPTY, COLOUR_GREY, CPW_GRAPH), SetMinimalSize(495, 0), SetFill(1, 1), SetResize(1, 1), + NWidget(WWT_EMPTY, COLOUR_GREY, WID_CPR_GRAPH), SetMinimalSize(495, 0), SetFill(1, 1), SetResize(1, 1), NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetMinimalSize(0, 24), SetFill(0, 0), SetResize(0, 1), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, CPW_ENABLE_CARGOES), SetDataTip(STR_GRAPH_CARGO_ENABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_ENABLE_ALL), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, CPW_DISABLE_CARGOES), SetDataTip(STR_GRAPH_CARGO_DISABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_DISABLE_ALL), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_CPR_ENABLE_CARGOES), SetDataTip(STR_GRAPH_CARGO_ENABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_ENABLE_ALL), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_CPR_DISABLE_CARGOES), SetDataTip(STR_GRAPH_CARGO_DISABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_DISABLE_ALL), SetFill(1, 0), NWidget(NWID_SPACER), SetMinimalSize(0, 4), NWidgetFunction(MakeCargoButtons), NWidget(NWID_SPACER), SetMinimalSize(0, 24), SetFill(0, 1), SetResize(0, 1), @@ -1066,9 +1066,9 @@ static const NWidgetPart _nested_cargo_payment_rates_widgets[] = { EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(NWID_SPACER), SetMinimalSize(WD_RESIZEBOX_WIDTH, 0), SetFill(1, 0), SetResize(1, 0), - NWidget(WWT_TEXT, COLOUR_GREY, CPW_FOOTER), SetMinimalSize(0, 6), SetPadding(2, 0, 2, 0), SetDataTip(STR_GRAPH_CARGO_PAYMENT_RATES_X_LABEL, STR_NULL), + NWidget(WWT_TEXT, COLOUR_GREY, WID_CPR_FOOTER), SetMinimalSize(0, 6), SetPadding(2, 0, 2, 0), SetDataTip(STR_GRAPH_CARGO_PAYMENT_RATES_X_LABEL, STR_NULL), NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0), - NWidget(WWT_RESIZEBOX, COLOUR_GREY, CPW_RESIZE), + NWidget(WWT_RESIZEBOX, COLOUR_GREY, WID_CPR_RESIZE), EndContainer(), EndContainer(), }; @@ -1164,7 +1164,7 @@ public: virtual void DrawWidget(const Rect &r, int widget) const { - if (widget != CLW_BACKGROUND) return; + if (widget != WID_CL_BACKGROUND) return; int icon_y_offset = 1 + (FONT_HEIGHT_NORMAL - this->line_height) / 2; uint y = r.top + WD_FRAMERECT_TOP - icon_y_offset; @@ -1192,7 +1192,7 @@ public: virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget != CLW_BACKGROUND) return; + if (widget != WID_CL_BACKGROUND) return; this->ordinal_width = 0; for (uint i = 0; i < MAX_COMPANIES; i++) { @@ -1259,7 +1259,7 @@ static const NWidgetPart _nested_company_league_widgets[] = { NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, CLW_BACKGROUND), SetMinimalSize(400, 0), SetMinimalTextLines(15, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM), + NWidget(WWT_PANEL, COLOUR_GREY, WID_CL_BACKGROUND), SetMinimalSize(400, 0), SetMinimalTextLines(15, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM), }; static const WindowDesc _company_league_desc( @@ -1314,7 +1314,7 @@ struct PerformanceRatingDetailWindow : Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case PRW_SCORE_FIRST: + case WID_PRD_SCORE_FIRST: this->bar_height = FONT_HEIGHT_NORMAL + 4; size->height = this->bar_height + 2 * WD_MATRIX_TOP; @@ -1374,18 +1374,18 @@ struct PerformanceRatingDetailWindow : Window { /* No need to draw when there's nothing to draw */ if (this->company == INVALID_COMPANY) return; - if (IsInsideMM(widget, PRW_COMPANY_FIRST, PRW_COMPANY_LAST + 1)) { + if (IsInsideMM(widget, WID_PRD_COMPANY_FIRST, WID_PRD_COMPANY_LAST + 1)) { if (this->IsWidgetDisabled(widget)) return; - CompanyID cid = (CompanyID)(widget - PRW_COMPANY_FIRST); + CompanyID cid = (CompanyID)(widget - WID_PRD_COMPANY_FIRST); int offset = (cid == this->company) ? 1 : 0; Dimension sprite_size = GetSpriteSize(SPR_COMPANY_ICON); DrawCompanyIcon(cid, (r.left + r.right - sprite_size.width) / 2 + offset, (r.top + r.bottom - sprite_size.height) / 2 + offset); return; } - if (!IsInsideMM(widget, PRW_SCORE_FIRST, PRW_SCORE_LAST + 1)) return; + if (!IsInsideMM(widget, WID_PRD_SCORE_FIRST, WID_PRD_SCORE_LAST + 1)) return; - ScoreID score_type = (ScoreID)(widget - PRW_SCORE_FIRST); + ScoreID score_type = (ScoreID)(widget - WID_PRD_SCORE_FIRST); /* The colours used to show how the progress is going */ int colour_done = _colour_gradient[COLOUR_GREEN][4]; @@ -1451,12 +1451,12 @@ struct PerformanceRatingDetailWindow : Window { virtual void OnClick(Point pt, int widget, int click_count) { /* Check which button is clicked */ - if (IsInsideMM(widget, PRW_COMPANY_FIRST, PRW_COMPANY_LAST + 1)) { + if (IsInsideMM(widget, WID_PRD_COMPANY_FIRST, WID_PRD_COMPANY_LAST + 1)) { /* Is it no on disable? */ if (!this->IsWidgetDisabled(widget)) { - this->RaiseWidget(this->company + PRW_COMPANY_FIRST); - this->company = (CompanyID)(widget - PRW_COMPANY_FIRST); - this->LowerWidget(this->company + PRW_COMPANY_FIRST); + this->RaiseWidget(this->company + WID_PRD_COMPANY_FIRST); + this->company = (CompanyID)(widget - WID_PRD_COMPANY_FIRST); + this->LowerWidget(this->company + WID_PRD_COMPANY_FIRST); this->SetDirty(); } } @@ -1483,13 +1483,13 @@ struct PerformanceRatingDetailWindow : Window { 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)); + this->SetWidgetDisabledState(i + WID_PRD_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->RaiseWidget(this->company + WID_PRD_COMPANY_FIRST); this->company = INVALID_COMPANY; } @@ -1502,7 +1502,7 @@ struct PerformanceRatingDetailWindow : Window { } /* Make sure the widget is lowered */ - this->LowerWidget(this->company + PRW_COMPANY_FIRST); + this->LowerWidget(this->company + WID_PRD_COMPANY_FIRST); } }; @@ -1532,20 +1532,20 @@ static NWidgetBase *MakePerformanceDetailPanels(int *biggest_index) assert_compile(lengthof(performance_tips) == SCORE_END - SCORE_BEGIN); NWidgetVertical *vert = new NWidgetVertical(NC_EQUALSIZE); - for (int widnum = PRW_SCORE_FIRST; widnum <= PRW_SCORE_LAST; widnum++) { + for (int widnum = WID_PRD_SCORE_FIRST; widnum <= WID_PRD_SCORE_LAST; widnum++) { NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, widnum); panel->SetFill(1, 1); - panel->SetDataTip(0x0, performance_tips[widnum - PRW_SCORE_FIRST]); + panel->SetDataTip(0x0, performance_tips[widnum - WID_PRD_SCORE_FIRST]); vert->Add(panel); } - *biggest_index = PRW_SCORE_LAST; + *biggest_index = WID_PRD_SCORE_LAST; return vert; } /** Make a number of rows with buttons for each company for the performance rating detail window. */ NWidgetBase *MakeCompanyButtonRowsGraphGUI(int *biggest_index) { - return MakeCompanyButtonRows(biggest_index, PRW_COMPANY_FIRST, PRW_COMPANY_LAST, 8, STR_PERFORMANCE_DETAIL_SELECT_COMPANY_TOOLTIP); + return MakeCompanyButtonRows(biggest_index, WID_PRD_COMPANY_FIRST, WID_PRD_COMPANY_LAST, 8, STR_PERFORMANCE_DETAIL_SELECT_COMPANY_TOOLTIP); } static const NWidgetPart _nested_performance_rating_detail_widgets[] = { diff --git a/src/widgets/ai_widget.h b/src/widgets/ai_widget.h index 51cab3f30..008790d3b 100644 --- a/src/widgets/ai_widget.h +++ b/src/widgets/ai_widget.h @@ -13,53 +13,53 @@ #define WIDGETS_AI_WIDGET_H /** Widgets of the WC_AI_LIST. */ -enum AIListWindowWidgets { - AIL_WIDGET_LIST, ///< The matrix with all available AIs - AIL_WIDGET_SCROLLBAR, ///< Scrollbar next to the AI list - AIL_WIDGET_INFO_BG, ///< Panel to draw some AI information on - AIL_WIDGET_ACCEPT, ///< Accept button - AIL_WIDGET_CANCEL, ///< Cancel button +enum AIListWidgets { + WID_AIL_LIST, ///< The matrix with all available AIs. + WID_AIL_SCROLLBAR, ///< Scrollbar next to the AI list. + WID_AIL_INFO_BG, ///< Panel to draw some AI information on. + WID_AIL_ACCEPT, ///< Accept button. + WID_AIL_CANCEL, ///< Cancel button. }; /** Widgets of the WC_AI_SETTINGS. */ -enum AISettingsWindowWidgets { - AIS_WIDGET_BACKGROUND, ///< Panel to draw the settings on - AIS_WIDGET_SCROLLBAR, ///< Scrollbar to scroll through all settings - AIS_WIDGET_ACCEPT, ///< Accept button - AIS_WIDGET_RESET, ///< Reset button +enum AISettingsWidgets { + WID_AIS_BACKGROUND, ///< Panel to draw the settings on. + WID_AIS_SCROLLBAR, ///< Scrollbar to scroll through all settings. + WID_AIS_ACCEPT, ///< Accept button. + WID_AIS_RESET, ///< Reset button. }; /** Widgets of the WC_GAME_OPTIONS (WC_GAME_OPTIONS is also used in others). */ -enum AIConfigWindowWidgets { - AIC_WIDGET_BACKGROUND, ///< Window background - AIC_WIDGET_DECREASE, ///< Decrease the number of AIs - AIC_WIDGET_INCREASE, ///< Increase the number of AIs - AIC_WIDGET_NUMBER, ///< Number of AIs - AIC_WIDGET_LIST, ///< List with currently selected AIs - AIC_WIDGET_SCROLLBAR, ///< Scrollbar to scroll through the selected AIs - AIC_WIDGET_MOVE_UP, ///< Move up button - AIC_WIDGET_MOVE_DOWN, ///< Move down button - AIC_WIDGET_CHANGE, ///< Select another AI button - AIC_WIDGET_CONFIGURE, ///< Change AI settings button - AIC_WIDGET_CLOSE, ///< Close window button - AIC_WIDGET_CONTENT_DOWNLOAD, ///< Download content button +enum AIConfigWidgets { + WID_AIC_BACKGROUND, ///< Window background. + WID_AIC_DECREASE, ///< Decrease the number of AIs. + WID_AIC_INCREASE, ///< Increase the number of AIs. + WID_AIC_NUMBER, ///< Number of AIs. + WID_AIC_LIST, ///< List with currently selected AIs. + WID_AIC_SCROLLBAR, ///< Scrollbar to scroll through the selected AIs. + WID_AIC_MOVE_UP, ///< Move up button. + WID_AIC_MOVE_DOWN, ///< Move down button. + WID_AIC_CHANGE, ///< Select another AI button. + WID_AIC_CONFIGURE, ///< Change AI settings button. + WID_AIC_CLOSE, ///< Close window button. + WID_AIC_CONTENT_DOWNLOAD, ///< Download content button. }; /** Widgets of the WC_AI_DEBUG. */ -enum AIDebugWindowWidgets { - AID_WIDGET_VIEW, - AID_WIDGET_NAME_TEXT, - AID_WIDGET_SETTINGS, - AID_WIDGET_RELOAD_TOGGLE, - AID_WIDGET_LOG_PANEL, - AID_WIDGET_SCROLLBAR, - AID_WIDGET_COMPANY_BUTTON_START, - AID_WIDGET_COMPANY_BUTTON_END = AID_WIDGET_COMPANY_BUTTON_START + MAX_COMPANIES - 1, - AID_BREAK_STRING_WIDGETS, - AID_WIDGET_BREAK_STR_ON_OFF_BTN, - AID_WIDGET_BREAK_STR_EDIT_BOX, - AID_WIDGET_MATCH_CASE_BTN, - AID_WIDGET_CONTINUE_BTN, +enum AIDebugWidgets { + WID_AID_VIEW, ///< The row of company buttons. + WID_AID_NAME_TEXT, ///< Name of the current selected. + WID_AID_SETTINGS, ///< Settings button. + WID_AID_RELOAD_TOGGLE, ///< Reload button. + WID_AID_LOG_PANEL, ///< Panel where the log is in. + WID_AID_SCROLLBAR, ///< Scrollbar of the log pannel. + WID_AID_COMPANY_BUTTON_START, ///< Buttons in the VIEW. + WID_AID_COMPANY_BUTTON_END = WID_AID_COMPANY_BUTTON_START + MAX_COMPANIES - 1, ///< Last possible button in the VIEW. + WID_AID_BREAK_STRING_WIDGETS, ///< The panel to handle the breaking on string. + WID_AID_BREAK_STR_ON_OFF_BTN, ///< Enable breaking on string. + WID_AID_BREAK_STR_EDIT_BOX, ///< Edit box for the string to break on. + WID_AID_MATCH_CASE_BTN, ///< Checkbox to use match caching or not. + WID_AID_CONTINUE_BTN, ///< Continue button. }; #endif /* WIDGETS_AI_WIDGET_H */ diff --git a/src/widgets/airport_widget.h b/src/widgets/airport_widget.h index 35df2e1a4..76c419738 100644 --- a/src/widgets/airport_widget.h +++ b/src/widgets/airport_widget.h @@ -14,24 +14,24 @@ /** Widgets of the WC_BUILD_TOOLBAR (WC_BUILD_TOOLBAR is also used in others). */ enum AirportToolbarWidgets { - ATW_AIRPORT, - ATW_DEMOLISH, + WID_AT_AIRPORT, ///< Build airport button. + WID_AT_DEMOLISH, ///< Demolish button. }; /** Widgets of the WC_BUILD_STATION (WC_BUILD_STATION is also used in others). */ enum AirportPickerWidgets { - BAIRW_CLASS_DROPDOWN, - BAIRW_AIRPORT_LIST, - BAIRW_SCROLLBAR, - BAIRW_LAYOUT_NUM, - BAIRW_LAYOUT_DECREASE, - BAIRW_LAYOUT_INCREASE, - BAIRW_AIRPORT_SPRITE, - BAIRW_EXTRA_TEXT, - BAIRW_BOTTOMPANEL, - BAIRW_COVERAGE_LABEL, - BAIRW_BTN_DONTHILIGHT, - BAIRW_BTN_DOHILIGHT, + WID_AP_CLASS_DROPDOWN, ///< Dropdown of airport classes. + WID_AP_AIRPORT_LIST, ///< List of airports. + WID_AP_SCROLLBAR, ///< Scrollbar of the list. + WID_AP_LAYOUT_NUM, ///< Current number of the layout. + WID_AP_LAYOUT_DECREASE, ///< Decrease the layout number. + WID_AP_LAYOUT_INCREASE, ///< Increase the layout number. + WID_AP_AIRPORT_SPRITE, ///< A visual display of the airport currently selected. + WID_AP_EXTRA_TEXT, ///< Additional text about the airport. + WID_AP_BOTTOMPANEL, ///< Panel at the bottom. + WID_AP_COVERAGE_LABEL, ///< Label if you want to see the coverage. + WID_AP_BTN_DONTHILIGHT, ///< Don't show the coverage button. + WID_AP_BTN_DOHILIGHT, ///< Show the coverage button. }; #endif /* WIDGETS_AIRPORT_WIDGET_H */ diff --git a/src/widgets/autoreplace_widget.h b/src/widgets/autoreplace_widget.h index 51205a269..f74286f76 100644 --- a/src/widgets/autoreplace_widget.h +++ b/src/widgets/autoreplace_widget.h @@ -13,28 +13,28 @@ #define WIDGETS_AUTOREPLACE_WIDGET_H /** Widgets of the WC_REPLACE_VEHICLE. */ -enum ReplaceVehicleWindowWidgets { - RVW_WIDGET_CAPTION, +enum ReplaceVehicleWidgets { + WID_RV_CAPTION, ///< Caption of the window. /* Left and right matrix + details. */ - RVW_WIDGET_LEFT_MATRIX, - RVW_WIDGET_LEFT_SCROLLBAR, - RVW_WIDGET_RIGHT_MATRIX, - RVW_WIDGET_RIGHT_SCROLLBAR, - RVW_WIDGET_LEFT_DETAILS, - RVW_WIDGET_RIGHT_DETAILS, + WID_RV_LEFT_MATRIX, ///< The matrix on the left. + WID_RV_LEFT_SCROLLBAR, ///< The scrollbar for the matrix on the left. + WID_RV_RIGHT_MATRIX, ///< The matrix on the right. + WID_RV_RIGHT_SCROLLBAR, ///< The scrollbar for the matrxi on the right. + WID_RV_LEFT_DETAILS, ///< Details of the entry on the left. + WID_RV_RIGHT_DETAILS, ///< Details of the entry on the right. /* Button row. */ - RVW_WIDGET_START_REPLACE, - RVW_WIDGET_INFO_TAB, - RVW_WIDGET_STOP_REPLACE, + WID_RV_START_REPLACE, ///< Start Replacing button. + WID_RV_INFO_TAB, ///< Info tab. + WID_RV_STOP_REPLACE, ///< Stop Replacing button. /* Train only widgets. */ - RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE, - RVW_WIDGET_TRAIN_FLUFF_LEFT, - RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN, - RVW_WIDGET_TRAIN_FLUFF_RIGHT, - RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE, + WID_RV_TRAIN_ENGINEWAGON_TOGGLE, ///< Button to toggle engines and/or wagons. + WID_RV_TRAIN_FLUFF_LEFT, ///< The fluff on the left. + WID_RV_TRAIN_RAILTYPE_DROPDOWN, ///< Dropdown menu about the railtype. + WID_RV_TRAIN_FLUFF_RIGHT, ///< The fluff on the right. + WID_RV_TRAIN_WAGONREMOVE_TOGGLE, ///< Button to toggle removing wagons. }; #endif /* WIDGETS_AUTOREPLACE_WIDGET_H */ diff --git a/src/widgets/bootstrap_widget.h b/src/widgets/bootstrap_widget.h index 9fd25d90e..1d3b7617b 100644 --- a/src/widgets/bootstrap_widget.h +++ b/src/widgets/bootstrap_widget.h @@ -14,9 +14,9 @@ /** Widgets of the WC_CONFIRM_POPUP_QUERY (WC_CONFIRM_POPUP_QUERY is also used in QueryWidgets). */ enum BootstrapAskForDownloadWidgets { - BAFDW_QUESTION, ///< The question whether to download. - BAFDW_YES, ///< An affirmative answer to the question. - BAFDW_NO, ///< An negative answer to the question. + WID_BAFD_QUESTION, ///< The question whether to download. + WID_BAFD_YES, ///< An affirmative answer to the question. + WID_BAFD_NO, ///< An negative answer to the question. }; #endif /* WIDGETS_BOOTSTRAP_WIDGET_H */ diff --git a/src/widgets/bridge_widget.h b/src/widgets/bridge_widget.h index aa4a7cd4c..69792695d 100644 --- a/src/widgets/bridge_widget.h +++ b/src/widgets/bridge_widget.h @@ -14,11 +14,11 @@ /** Widgets of the WC_BUILD_BRIDGE. */ enum BuildBridgeSelectionWidgets { - BBSW_CAPTION, - BBSW_DROPDOWN_ORDER, - BBSW_DROPDOWN_CRITERIA, - BBSW_BRIDGE_LIST, - BBSW_SCROLLBAR, + WID_BBS_CAPTION, ///< Caption of the window. + WID_BBS_DROPDOWN_ORDER, ///< Direction of sort dropdown. + WID_BBS_DROPDOWN_CRITERIA, ///< Criteria of sort dropdown. + WID_BBS_BRIDGE_LIST, ///< List of bridges. + WID_BBS_SCROLLBAR, ///< Scrollbar of the list. }; #endif /* WIDGETS_BRIDGE_WIDGET_H */ diff --git a/src/widgets/build_vehicle_widget.h b/src/widgets/build_vehicle_widget.h index 715f47d5c..a3a384227 100644 --- a/src/widgets/build_vehicle_widget.h +++ b/src/widgets/build_vehicle_widget.h @@ -14,17 +14,16 @@ /** Widgets of the WC_BUILD_VEHICLE. */ enum BuildVehicleWidgets { - BUILD_VEHICLE_WIDGET_CAPTION, - BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING, - BUILD_VEHICLE_WIDGET_SORT_DROPDOWN, - BUILD_VEHICLE_WIDGET_CARGO_FILTER_DROPDOWN, - BUILD_VEHICLE_WIDGET_LIST, - BUILD_VEHICLE_WIDGET_SCROLLBAR, - BUILD_VEHICLE_WIDGET_PANEL, - BUILD_VEHICLE_WIDGET_BUILD, - BUILD_VEHICLE_WIDGET_BUILD_SEL, - BUILD_VEHICLE_WIDGET_RENAME, - BUILD_VEHICLE_WIDGET_END + WID_BV_CAPTION, ///< Caption of window. + WID_BV_SORT_ASSENDING_DESCENDING, ///< Sort direction. + WID_BV_SORT_DROPDOWN, ///< Criteria of sorting dropdown. + WID_BV_CARGO_FILTER_DROPDOWN, ///< Cargo filter dropdown. + WID_BV_LIST, ///< List of vehicles. + WID_BV_SCROLLBAR, ///< Scrollbar of list. + WID_BV_PANEL, ///< Button panel. + WID_BV_BUILD, ///< Build panel. + WID_BV_BUILD_SEL, ///< Build button. + WID_BV_RENAME, ///< Rename button. }; #endif /* WIDGETS_BUILD_VEHICLE_WIDGET_H */ diff --git a/src/widgets/cheat_widget.h b/src/widgets/cheat_widget.h index 64ebc588d..ba368dd50 100644 --- a/src/widgets/cheat_widget.h +++ b/src/widgets/cheat_widget.h @@ -14,7 +14,7 @@ /** Widgets of the WC_CHEATS. */ enum CheatWidgets { - CW_PANEL, + WID_C_PANEL, ///< Panel where all cheats are shown in. }; #endif /* WIDGETS_CHEAT_WIDGET_H */ diff --git a/src/widgets/company_widget.h b/src/widgets/company_widget.h index 684df9376..e2cdcd447 100644 --- a/src/widgets/company_widget.h +++ b/src/widgets/company_widget.h @@ -13,179 +13,179 @@ #define WIDGETS_COMPANY_WIDGET_H /** Widgets of the WC_COMPANY. */ -enum CompanyWindowWidgets { - CW_WIDGET_CAPTION, - - CW_WIDGET_FACE, - CW_WIDGET_FACE_TITLE, - - CW_WIDGET_DESC_INAUGURATION, - CW_WIDGET_DESC_COLOUR_SCHEME, - CW_WIDGET_DESC_COLOUR_SCHEME_EXAMPLE, - CW_WIDGET_DESC_VEHICLE, - CW_WIDGET_DESC_VEHICLE_COUNTS, - CW_WIDGET_DESC_COMPANY_VALUE, - CW_WIDGET_DESC_INFRASTRUCTURE, - CW_WIDGET_DESC_INFRASTRUCTURE_COUNTS, - - CW_WIDGET_SELECT_DESC_OWNERS, - CW_WIDGET_DESC_OWNERS, - - CW_WIDGET_SELECT_BUTTONS, ///< Selection widget for the button bar. - CW_WIDGET_NEW_FACE, - CW_WIDGET_COLOUR_SCHEME, - CW_WIDGET_PRESIDENT_NAME, - CW_WIDGET_COMPANY_NAME, - CW_WIDGET_BUY_SHARE, - CW_WIDGET_SELL_SHARE, - - CW_WIDGET_SELECT_VIEW_BUILD_HQ, - CW_WIDGET_VIEW_HQ, - CW_WIDGET_BUILD_HQ, - - CW_WIDGET_SELECT_RELOCATE, ///< View/hide the 'Relocate HQ' button. - CW_WIDGET_RELOCATE_HQ, - - CW_WIDGET_VIEW_INFRASTRUCTURE, - - CW_WIDGET_HAS_PASSWORD, ///< Draw a lock when the company has a password - CW_WIDGET_SELECT_MULTIPLAYER, ///< Multiplayer selection panel. - CW_WIDGET_COMPANY_PASSWORD, - CW_WIDGET_COMPANY_JOIN, +enum CompanyWidgets { + WID_C_CAPTION, ///< Caption of the window. + + WID_C_FACE, ///< View of the face. + WID_C_FACE_TITLE, ///< Title for the face. + + WID_C_DESC_INAUGURATION, ///< Inauguration. + WID_C_DESC_COLOUR_SCHEME, ///< Colour scheme. + WID_C_DESC_COLOUR_SCHEME_EXAMPLE, ///< Colour scheme example. + WID_C_DESC_VEHICLE, ///< Vehicles. + WID_C_DESC_VEHICLE_COUNTS, ///< Vehicle count. + WID_C_DESC_COMPANY_VALUE, ///< Company value. + WID_C_DESC_INFRASTRUCTURE, ///< Infrastructure. + WID_C_DESC_INFRASTRUCTURE_COUNTS, ///< Infrastructure count. + + WID_C_SELECT_DESC_OWNERS, ///< Owners. + WID_C_DESC_OWNERS, ///< Owner in Owners. + + WID_C_SELECT_BUTTONS, ///< Selection widget for the button bar. + WID_C_NEW_FACE, ///< Button to make new face. + WID_C_COLOUR_SCHEME, ///< Button to change colour scheme. + WID_C_PRESIDENT_NAME, ///< Button to change president name. + WID_C_COMPANY_NAME, ///< Button to change company name. + WID_C_BUY_SHARE, ///< Button to buy a share. + WID_C_SELL_SHARE, ///< Button to sell a share. + + WID_C_SELECT_VIEW_BUILD_HQ, ///< Panel about HQ. + WID_C_VIEW_HQ, ///< Button to view the HQ. + WID_C_BUILD_HQ, ///< Button to build the HQ. + + WID_C_SELECT_RELOCATE, ///< Panel about 'Relocate HQ'. + WID_C_RELOCATE_HQ, ///< Button to relocate the HQ. + + WID_C_VIEW_INFRASTRUCTURE, ///< Panel about infrastructure. + + WID_C_HAS_PASSWORD, ///< Has company password lock. + WID_C_SELECT_MULTIPLAYER, ///< Multiplayer selection panel. + WID_C_COMPANY_PASSWORD, ///< Button to set company password. + WID_C_COMPANY_JOIN, ///< Button to join company. }; /** Widgets of the WC_FINANCES. */ -enum CompanyFinancesWindowWidgets { - CFW_CAPTION, ///< Caption of the window - CFW_TOGGLE_SIZE, ///< Toggle windows size - CFW_SEL_PANEL, ///< Select panel or nothing - CFW_EXPS_CATEGORY, ///< Column for expenses category strings - CFW_EXPS_PRICE1, ///< Column for year Y-2 expenses - CFW_EXPS_PRICE2, ///< Column for year Y-1 expenses - CFW_EXPS_PRICE3, ///< Column for year Y expenses - CFW_TOTAL_PANEL, ///< Panel for totals - CFW_SEL_MAXLOAN, ///< Selection of maxloan column - CFW_BALANCE_VALUE, ///< Bank balance value - CFW_LOAN_VALUE, ///< Loan - CFW_LOAN_LINE, ///< Line for summing bank balance and loan - CFW_TOTAL_VALUE, ///< Total - CFW_MAXLOAN_GAP, ///< Gap above max loan widget - CFW_MAXLOAN_VALUE, ///< Max loan widget - CFW_SEL_BUTTONS, ///< Selection of buttons - CFW_INCREASE_LOAN, ///< Increase loan - CFW_REPAY_LOAN, ///< Decrease loan - CFW_INFRASTRUCTURE,///< View company infrastructure +enum CompanyFinancesWidgets { + WID_CF_CAPTION, ///< Caption of the window. + WID_CF_TOGGLE_SIZE, ///< Toggle windows size. + WID_CF_SEL_PANEL, ///< Select panel or nothing. + WID_CF_EXPS_CATEGORY, ///< Column for expenses category strings. + WID_CF_EXPS_PRICE1, ///< Column for year Y-2 expenses. + WID_CF_EXPS_PRICE2, ///< Column for year Y-1 expenses. + WID_CF_EXPS_PRICE3, ///< Column for year Y expenses. + WID_CF_TOTAL_PANEL, ///< Panel for totals. + WID_CF_SEL_MAXLOAN, ///< Selection of maxloan column. + WID_CF_BALANCE_VALUE, ///< Bank balance value. + WID_CF_LOAN_VALUE, ///< Loan. + WID_CF_LOAN_LINE, ///< Line for summing bank balance and loan. + WID_CF_TOTAL_VALUE, ///< Total. + WID_CF_MAXLOAN_GAP, ///< Gap above max loan widget. + WID_CF_MAXLOAN_VALUE, ///< Max loan widget. + WID_CF_SEL_BUTTONS, ///< Selection of buttons. + WID_CF_INCREASE_LOAN, ///< Increase loan. + WID_CF_REPAY_LOAN, ///< Decrease loan.. + WID_CF_INFRASTRUCTURE,///< View company infrastructure. }; /** Widgets of the WC_COMPANY_COLOUR. */ -enum SelectCompanyLiveryWindowWidgets { - SCLW_WIDGET_CAPTION, - SCLW_WIDGET_CLASS_GENERAL, - SCLW_WIDGET_CLASS_RAIL, - SCLW_WIDGET_CLASS_ROAD, - SCLW_WIDGET_CLASS_SHIP, - SCLW_WIDGET_CLASS_AIRCRAFT, - SCLW_WIDGET_SPACER_DROPDOWN, - SCLW_WIDGET_PRI_COL_DROPDOWN, - SCLW_WIDGET_SEC_COL_DROPDOWN, - SCLW_WIDGET_MATRIX, +enum SelectCompanyLiveryWidgets { + WID_SCL_CAPTION, ///< Caption of window. + WID_SCL_CLASS_GENERAL, ///< Class general. + WID_SCL_CLASS_RAIL, ///< Class rail. + WID_SCL_CLASS_ROAD, ///< Class road. + WID_SCL_CLASS_SHIP, ///< Class ship. + WID_SCL_CLASS_AIRCRAFT, ///< Class aircraft. + WID_SCL_SPACER_DROPDOWN, ///< Spacer for dropdown. + WID_SCL_PRI_COL_DROPDOWN, ///< Dropdown for primary colour. + WID_SCL_SEC_COL_DROPDOWN, ///< Dropdown for secondary colour. + WID_SCL_MATRIX, ///< Matrix. }; /** Widgets of the WC_COMPANY_MANAGER_FACE. - * Do not change the order of the widgets from SCMFW_WIDGET_HAS_MOUSTACHE_EARRING to SCMFW_WIDGET_GLASSES_R, + * Do not change the order of the widgets from WID_SCMF_HAS_MOUSTACHE_EARRING to WID_SCMF_GLASSES_R, * this order is needed for the WE_CLICK event of DrawFaceStringLabel(). */ enum SelectCompanyManagerFaceWidgets { - SCMFW_WIDGET_CAPTION, - SCMFW_WIDGET_TOGGLE_LARGE_SMALL, - SCMFW_WIDGET_SELECT_FACE, - SCMFW_WIDGET_CANCEL, - SCMFW_WIDGET_ACCEPT, - SCMFW_WIDGET_MALE, ///< Male button in the simple view. - SCMFW_WIDGET_FEMALE, ///< Female button in the simple view. - SCMFW_WIDGET_MALE2, ///< Male button in the advanced view. - SCMFW_WIDGET_FEMALE2, ///< Female button in the advanced view. - SCMFW_WIDGET_SEL_LOADSAVE, ///< Selection to display the load/save/number buttons in the advanced view. - SCMFW_WIDGET_SEL_MALEFEMALE, ///< Selection to display the male/female buttons in the simple view. - SCMFW_WIDGET_SEL_PARTS, ///< Selection to display the buttons for setting each part of the face in the advanced view. - SCMFW_WIDGET_RANDOM_NEW_FACE, - SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON, - SCMFM_WIDGET_FACE, - SCMFW_WIDGET_LOAD, - SCMFW_WIDGET_FACECODE, - SCMFW_WIDGET_SAVE, - SCMFW_WIDGET_HAS_MOUSTACHE_EARRING_TEXT, - SCMFW_WIDGET_TIE_EARRING_TEXT, - SCMFW_WIDGET_LIPS_MOUSTACHE_TEXT, - SCMFW_WIDGET_HAS_GLASSES_TEXT, - SCMFW_WIDGET_HAIR_TEXT, - SCMFW_WIDGET_EYEBROWS_TEXT, - SCMFW_WIDGET_EYECOLOUR_TEXT, - SCMFW_WIDGET_GLASSES_TEXT, - SCMFW_WIDGET_NOSE_TEXT, - SCMFW_WIDGET_CHIN_TEXT, - SCMFW_WIDGET_JACKET_TEXT, - SCMFW_WIDGET_COLLAR_TEXT, - SCMFW_WIDGET_ETHNICITY_EUR, - SCMFW_WIDGET_ETHNICITY_AFR, - SCMFW_WIDGET_HAS_MOUSTACHE_EARRING, - SCMFW_WIDGET_HAS_GLASSES, - SCMFW_WIDGET_EYECOLOUR_L, - SCMFW_WIDGET_EYECOLOUR, - SCMFW_WIDGET_EYECOLOUR_R, - SCMFW_WIDGET_CHIN_L, - SCMFW_WIDGET_CHIN, - SCMFW_WIDGET_CHIN_R, - SCMFW_WIDGET_EYEBROWS_L, - SCMFW_WIDGET_EYEBROWS, - SCMFW_WIDGET_EYEBROWS_R, - SCMFW_WIDGET_LIPS_MOUSTACHE_L, - SCMFW_WIDGET_LIPS_MOUSTACHE, - SCMFW_WIDGET_LIPS_MOUSTACHE_R, - SCMFW_WIDGET_NOSE_L, - SCMFW_WIDGET_NOSE, - SCMFW_WIDGET_NOSE_R, - SCMFW_WIDGET_HAIR_L, - SCMFW_WIDGET_HAIR, - SCMFW_WIDGET_HAIR_R, - SCMFW_WIDGET_JACKET_L, - SCMFW_WIDGET_JACKET, - SCMFW_WIDGET_JACKET_R, - SCMFW_WIDGET_COLLAR_L, - SCMFW_WIDGET_COLLAR, - SCMFW_WIDGET_COLLAR_R, - SCMFW_WIDGET_TIE_EARRING_L, - SCMFW_WIDGET_TIE_EARRING, - SCMFW_WIDGET_TIE_EARRING_R, - SCMFW_WIDGET_GLASSES_L, - SCMFW_WIDGET_GLASSES, - SCMFW_WIDGET_GLASSES_R, + WID_SCMF_CAPTION, ///< Caption of window. + WID_SCMF_TOGGLE_LARGE_SMALL, ///< Toggle for large or small. + WID_SCMF_SELECT_FACE, ///< Select face. + WID_SCMF_CANCEL, ///< Cancel. + WID_SCMF_ACCEPT, ///< Accept. + WID_SCMF_MALE, ///< Male button in the simple view. + WID_SCMF_FEMALE, ///< Female button in the simple view. + WID_SCMF_MALE2, ///< Male button in the advanced view. + WID_SCMF_FEMALE2, ///< Female button in the advanced view. + WID_SCMF_SEL_LOADSAVE, ///< Selection to display the load/save/number buttons in the advanced view. + WID_SCMF_SEL_MALEFEMALE, ///< Selection to display the male/female buttons in the simple view. + WID_SCMF_SEL_PARTS, ///< Selection to display the buttons for setting each part of the face in the advanced view. + WID_SCMF_RANDOM_NEW_FACE, ///< Create random new face. + WID_SCMF_TOGGLE_LARGE_SMALL_BUTTON, ///< Toggle for large or small. + WID_SCMF_FACE, ///< Current face. + WID_SCMF_LOAD, ///< Load face. + WID_SCMF_FACECODE, ///< Get the face code. + WID_SCMF_SAVE, ///< Save face. + WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT, ///< Text about moustache and earring. + WID_SCMF_TIE_EARRING_TEXT, ///< Text about tie and earring. + WID_SCMF_LIPS_MOUSTACHE_TEXT, ///< Text about lips and moustache. + WID_SCMF_HAS_GLASSES_TEXT, ///< Text about glasses. + WID_SCMF_HAIR_TEXT, ///< Text about hair. + WID_SCMF_EYEBROWS_TEXT, ///< Text about eyebrows. + WID_SCMF_EYECOLOUR_TEXT, ///< Text about eyecolour. + WID_SCMF_GLASSES_TEXT, ///< Text about glasses. + WID_SCMF_NOSE_TEXT, ///< Text about nose. + WID_SCMF_CHIN_TEXT, ///< Text about chin. + WID_SCMF_JACKET_TEXT, ///< Text about jacket. + WID_SCMF_COLLAR_TEXT, ///< Text about collar. + WID_SCMF_ETHNICITY_EUR, ///< Text about ethnicity european. + WID_SCMF_ETHNICITY_AFR, ///< Text about ethnicity african. + WID_SCMF_HAS_MOUSTACHE_EARRING, ///< Has moustache or earring. + WID_SCMF_HAS_GLASSES, ///< Has glasses. + WID_SCMF_EYECOLOUR_L, ///< Eyecolour left. + WID_SCMF_EYECOLOUR, ///< Eyecolour. + WID_SCMF_EYECOLOUR_R, ///< Eyecolour right. + WID_SCMF_CHIN_L, ///< Chin left. + WID_SCMF_CHIN, ///< Chin. + WID_SCMF_CHIN_R, ///< Chin right. + WID_SCMF_EYEBROWS_L, ///< Eyebrows left. + WID_SCMF_EYEBROWS, ///< Eyebrows. + WID_SCMF_EYEBROWS_R, ///< Eyebrows right. + WID_SCMF_LIPS_MOUSTACHE_L, ///< Lips / Moustache left. + WID_SCMF_LIPS_MOUSTACHE, ///< Lips / Moustache. + WID_SCMF_LIPS_MOUSTACHE_R, ///< Lips / Moustache right. + WID_SCMF_NOSE_L, ///< Nose left. + WID_SCMF_NOSE, ///< Nose. + WID_SCMF_NOSE_R, ///< Nose right. + WID_SCMF_HAIR_L, ///< Hair left. + WID_SCMF_HAIR, ///< Hair. + WID_SCMF_HAIR_R, ///< Hair right. + WID_SCMF_JACKET_L, ///< Jacket left. + WID_SCMF_JACKET, ///< Jacket. + WID_SCMF_JACKET_R, ///< Jacket right. + WID_SCMF_COLLAR_L, ///< Collar left. + WID_SCMF_COLLAR, ///< Collar. + WID_SCMF_COLLAR_R, ///< Collar right. + WID_SCMF_TIE_EARRING_L, ///< Tie / Earring left. + WID_SCMF_TIE_EARRING, ///< Tie / Earring. + WID_SCMF_TIE_EARRING_R, ///< Tie / Earring right. + WID_SCMF_GLASSES_L, ///< Glasses left. + WID_SCMF_GLASSES, ///< Glasses. + WID_SCMF_GLASSES_R, ///< Glasses right. }; /** Widgets of the WC_COMPANY_INFRASTRUCTURE. */ -enum CompanyInfrastructureWindowWidgets { - CIW_WIDGET_CAPTION, - CIW_WIDGET_RAIL_DESC, - CIW_WIDGET_RAIL_COUNT, - CIW_WIDGET_ROAD_DESC, - CIW_WIDGET_ROAD_COUNT, - CIW_WIDGET_WATER_DESC, - CIW_WIDGET_WATER_COUNT, - CIW_WIDGET_STATION_DESC, - CIW_WIDGET_STATION_COUNT, - CIW_WIDGET_TOTAL_DESC, - CIW_WIDGET_TOTAL, +enum CompanyInfrastructureWidgets { + WID_CI_CAPTION, ///< Caption of window. + WID_CI_RAIL_DESC, ///< Description of rail. + WID_CI_RAIL_COUNT, ///< Count of rail. + WID_CI_ROAD_DESC, ///< Description of road. + WID_CI_ROAD_COUNT, ///< Count of road. + WID_CI_WATER_DESC, ///< Description of water. + WID_CI_WATER_COUNT, ///< Count of water. + WID_CI_STATION_DESC, ///< Description of station. + WID_CI_STATION_COUNT, ///< Count of station. + WID_CI_TOTAL_DESC, ///< Description of total. + WID_CI_TOTAL, ///< Count of total. }; /** Widgets of the WC_BUY_COMPANY. */ enum BuyCompanyWidgets { - BCW_CAPTION, - BCW_FACE, - BCW_QUESTION, - BCW_NO, - BCW_YES, + WID_BC_CAPTION, ///< Caption of window. + WID_BC_FACE, ///< Face button. + WID_BC_QUESTION, ///< Question text. + WID_BC_NO, ///< No button. + WID_BC_YES, ///< Yes button. }; #endif /* WIDGETS_COMPANY_WIDGET_H */ diff --git a/src/widgets/console_widget.h b/src/widgets/console_widget.h index 773d9d572..53d2b5f93 100644 --- a/src/widgets/console_widget.h +++ b/src/widgets/console_widget.h @@ -14,7 +14,7 @@ /** Widgets of the WC_CONSOLE. */ enum ConsoleWidgets { - CW_BACKGROUND, ///< Background of the console + WID_C_BACKGROUND, ///< Background of the console. }; #endif /* WIDGETS_CONSOLE_WIDGET_H */ diff --git a/src/widgets/date_widget.h b/src/widgets/date_widget.h index 78fd49080..a0b08922b 100644 --- a/src/widgets/date_widget.h +++ b/src/widgets/date_widget.h @@ -14,10 +14,10 @@ /** Widgets of the WC_SET_DATE. */ enum SetDateWidgets { - SDW_DAY, ///< Dropdown for the day - SDW_MONTH, ///< Dropdown for the month - SDW_YEAR, ///< Dropdown for the year - SDW_SET_DATE, ///< Actually set the date + WID_SD_DAY, ///< Dropdown for the day. + WID_SD_MONTH, ///< Dropdown for the month. + WID_SD_YEAR, ///< Dropdown for the year. + WID_SD_SET_DATE, ///< Actually set the date. }; #endif /* WIDGETS_DATE_WIDGET_H */ diff --git a/src/widgets/depot_widget.h b/src/widgets/depot_widget.h index 755a8be57..d849bcd18 100644 --- a/src/widgets/depot_widget.h +++ b/src/widgets/depot_widget.h @@ -13,25 +13,25 @@ #define WIDGETS_DEPOT_WIDGET_H /** Widgets of the WC_VEHICLE_DEPOT. */ -enum DepotWindowWidgets { - DEPOT_WIDGET_CAPTION, - DEPOT_WIDGET_SELL, - DEPOT_WIDGET_SHOW_SELL_CHAIN, - DEPOT_WIDGET_SELL_CHAIN, - DEPOT_WIDGET_SELL_ALL, - DEPOT_WIDGET_AUTOREPLACE, - DEPOT_WIDGET_MATRIX, - DEPOT_WIDGET_V_SCROLL, ///< Vertical scrollbar - DEPOT_WIDGET_SHOW_H_SCROLL, - DEPOT_WIDGET_H_SCROLL, ///< Horizontal scrollbar - DEPOT_WIDGET_BUILD, - DEPOT_WIDGET_CLONE, - DEPOT_WIDGET_LOCATION, - DEPOT_WIDGET_SHOW_RENAME, - DEPOT_WIDGET_RENAME, - DEPOT_WIDGET_VEHICLE_LIST, - DEPOT_WIDGET_STOP_ALL, - DEPOT_WIDGET_START_ALL, +enum VehicleDepotWidgets { + WID_VD_CAPTION, ///< Caption of window. + WID_VD_SELL, ///< Sell button. + WID_VD_SHOW_SELL_CHAIN, ///< Show sell chain panel. + WID_VD_SELL_CHAIN, ///< Sell chain button. + WID_VD_SELL_ALL, ///< Sell all button. + WID_VD_AUTOREPLACE, ///< Autoreplace button. + WID_VD_MATRIX, ///< Matrix of vehicles. + WID_VD_V_SCROLL, ///< Vertical scrollbar. + WID_VD_SHOW_H_SCROLL, ///< Show horizontal scrollbar panel. + WID_VD_H_SCROLL, ///< Horizontal scrollbar. + WID_VD_BUILD, ///< Build button. + WID_VD_CLONE, ///< Clone button. + WID_VD_LOCATION, ///< Location button. + WID_VD_SHOW_RENAME, ///< Show rename panel. + WID_VD_RENAME, ///< Rename button. + WID_VD_VEHICLE_LIST, ///< List of vehicles. + WID_VD_STOP_ALL, ///< Stop all button. + WID_VD_START_ALL, ///< Start all button. }; #endif /* WIDGETS_DEPOT_WIDGET_H */ diff --git a/src/widgets/dock_widget.h b/src/widgets/dock_widget.h index eedd42a25..010addfcc 100644 --- a/src/widgets/dock_widget.h +++ b/src/widgets/dock_widget.h @@ -14,16 +14,16 @@ /** Widgets of the WC_SCEN_BUILD_TOOLBAR / WC_BUILD_TOOLBAR (WC_SCEN_BUILD_TOOLBAR / WC_BUILD_TOOLBAR is also used in others). */ enum DockToolbarWidgets { - DTW_BUTTONS_BEGIN, ///< Begin of clickable buttons (except seperating panel) - DTW_CANAL = DTW_BUTTONS_BEGIN, ///< Build canal button - DTW_LOCK, ///< Build lock button - DTW_DEMOLISH, ///< Demolish aka dynamite button - DTW_DEPOT, ///< Build depot button - DTW_STATION, ///< Build station button - DTW_BUOY, ///< Build buoy button - DTW_RIVER, ///< Build river button (in scenario editor) - DTW_BUILD_AQUEDUCT, ///< Build aqueduct button - DTW_END, ///< End of toolbar widgets + WID_DT_CANAL, ///< Build canal button. + WID_DT_LOCK, ///< Build lock button. + WID_DT_DEMOLISH, ///< Demolish aka dynamite button. + WID_DT_DEPOT, ///< Build depot button. + WID_DT_STATION, ///< Build station button. + WID_DT_BUOY, ///< Build buoy button. + WID_DT_RIVER, ///< Build river button (in scenario editor). + WID_DT_BUILD_AQUEDUCT, ///< Build aqueduct button. + + WID_DT_INVALID, ///< Used to initialize a variable. }; #endif /* WIDGETS_DOCK_WIDGET_H */ diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 54294796d..9c73d3fb3 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -83,9 +83,9 @@ static void DeleteDropDownList(DropDownList *list) static const NWidgetPart _nested_dropdown_menu_widgets[] = { NWidget(NWID_HORIZONTAL), - NWidget(WWT_PANEL, COLOUR_END, DDM_ITEMS), SetMinimalSize(1, 1), SetScrollbar(DDM_SCROLL), EndContainer(), - NWidget(NWID_SELECTION, INVALID_COLOUR, DDM_SHOW_SCROLL), - NWidget(NWID_VSCROLLBAR, COLOUR_END, DDM_SCROLL), + NWidget(WWT_PANEL, COLOUR_END, WID_DM_ITEMS), SetMinimalSize(1, 1), SetScrollbar(WID_DM_SCROLL), EndContainer(), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_DM_SHOW_SCROLL), + NWidget(NWID_VSCROLLBAR, COLOUR_END, WID_DM_SCROLL), EndContainer(), EndContainer(), }; @@ -130,17 +130,17 @@ struct DropdownWindow : Window { this->CreateNestedTree(&_dropdown_desc); - this->vscroll = this->GetScrollbar(DDM_SCROLL); + this->vscroll = this->GetScrollbar(WID_DM_SCROLL); uint items_width = size.width - (scroll ? NWidgetScrollbar::GetVerticalDimension().width : 0); - NWidgetCore *nwi = this->GetWidget<NWidgetCore>(DDM_ITEMS); + NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_DM_ITEMS); nwi->SetMinimalSize(items_width, size.height + 4); nwi->colour = wi_colour; - nwi = this->GetWidget<NWidgetCore>(DDM_SCROLL); + nwi = this->GetWidget<NWidgetCore>(WID_DM_SCROLL); nwi->colour = wi_colour; - this->GetWidget<NWidgetStacked>(DDM_SHOW_SCROLL)->SetDisplayedPlane(scroll ? 0 : SZSP_NONE); + this->GetWidget<NWidgetStacked>(WID_DM_SHOW_SCROLL)->SetDisplayedPlane(scroll ? 0 : SZSP_NONE); this->FinishInitNested(&_dropdown_desc, 0); CLRBITS(this->flags, WF_WHITE_BORDER); @@ -200,7 +200,7 @@ struct DropdownWindow : Window { { if (GetWidgetFromPos(this, _cursor.pos.x - this->left, _cursor.pos.y - this->top) < 0) return false; - NWidgetBase *nwi = this->GetWidget<NWidgetBase>(DDM_ITEMS); + NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_DM_ITEMS); int y = _cursor.pos.y - this->top - nwi->pos_y - 2; int width = nwi->current_x - 4; int pos = this->vscroll->GetPosition(); @@ -228,7 +228,7 @@ struct DropdownWindow : Window { virtual void DrawWidget(const Rect &r, int widget) const { - if (widget != DDM_ITEMS) return; + if (widget != WID_DM_ITEMS) return; TextColour colour = (TextColour)this->GetWidget<NWidgetCore>(widget)->colour; @@ -257,7 +257,7 @@ struct DropdownWindow : Window { virtual void OnClick(Point pt, int widget, int click_count) { - if (widget != DDM_ITEMS) return; + if (widget != WID_DM_ITEMS) return; int item; if (this->GetDropDownItem(item)) { this->click_delay = 4; diff --git a/src/widgets/dropdown_widget.h b/src/widgets/dropdown_widget.h index 58ea586fe..9c5a64702 100644 --- a/src/widgets/dropdown_widget.h +++ b/src/widgets/dropdown_widget.h @@ -14,9 +14,9 @@ /** Widgets of the WC_DROPDOWN_MENU. */ enum DropdownMenuWidgets { - DDM_ITEMS, ///< Panel showing the dropdown items. - DDM_SHOW_SCROLL, ///< Hide scrollbar if too few items. - DDM_SCROLL, ///< Scrollbar. + WID_DM_ITEMS, ///< Panel showing the dropdown items. + WID_DM_SHOW_SCROLL, ///< Hide scrollbar if too few items. + WID_DM_SCROLL, ///< Scrollbar. }; #endif /* WIDGETS_DROPDOWN_WIDGET_H */ diff --git a/src/widgets/engine_widget.h b/src/widgets/engine_widget.h index 32297b432..85b6060f4 100644 --- a/src/widgets/engine_widget.h +++ b/src/widgets/engine_widget.h @@ -14,9 +14,9 @@ /** Widgets of the WC_ENGINE_PREVIEW. */ enum EnginePreviewWidgets { - EPW_QUESTION, ///< The container for the question - EPW_NO, ///< No button - EPW_YES, ///< Yes button + WID_EP_QUESTION, ///< The container for the question. + WID_EP_NO, ///< No button. + WID_EP_YES, ///< Yes button. }; #endif /* WIDGETS_ENGINE_WIDGET_H */ diff --git a/src/widgets/error_widget.h b/src/widgets/error_widget.h index 6a45aa75b..736f25437 100644 --- a/src/widgets/error_widget.h +++ b/src/widgets/error_widget.h @@ -14,9 +14,9 @@ /** Widgets of the WC_ERRMSG. */ enum ErrorMessageWidgets { - EMW_CAPTION, - EMW_FACE, - EMW_MESSAGE, + WID_EM_CAPTION, ///< Caption of the window. + WID_EM_FACE, ///< Error title. + WID_EM_MESSAGE, ///< Error message. }; #endif /* WIDGETS_ERROR_WIDGET_H */ diff --git a/src/widgets/fios_widget.h b/src/widgets/fios_widget.h index 74012abff..f1f066eee 100644 --- a/src/widgets/fios_widget.h +++ b/src/widgets/fios_widget.h @@ -13,24 +13,24 @@ #define WIDGETS_FIOS_WIDGET_H /** Widgets of the WC_SAVELOAD. */ -enum SaveLoadWindowWidgets { - SLWW_WINDOWTITLE, - SLWW_SORT_BYNAME, - SLWW_SORT_BYDATE, - SLWW_BACKGROUND, - SLWW_FILE_BACKGROUND, - SLWW_HOME_BUTTON, - SLWW_DRIVES_DIRECTORIES_LIST, - SLWW_SCROLLBAR, - SLWW_CONTENT_DOWNLOAD, ///< only available for play scenario/heightmap (content download) - SLWW_SAVE_OSK_TITLE, ///< only available for save operations - SLWW_DELETE_SELECTION, ///< same in here - SLWW_SAVE_GAME, ///< not to mention in here too - SLWW_CONTENT_DOWNLOAD_SEL, ///< Selection 'stack' to 'hide' the content download - SLWW_DETAILS, ///< Panel with game details - SLWW_NEWGRF_INFO, ///< Button to open NewGgrf configuration - SLWW_LOAD_BUTTON, ///< Button to load game/scenario - SLWW_MISSING_NEWGRFS, ///< Button to find missing NewGRFs online +enum SaveLoadWidgets { + WID_SL_CAPTION, ///< Caption of the window. + WID_SL_SORT_BYNAME, ///< Sort by name button. + WID_SL_SORT_BYDATE, ///< Sort by date button. + WID_SL_BACKGROUND, ///< Background of window. + WID_SL_FILE_BACKGROUND, ///< Background of file selection. + WID_SL_HOME_BUTTON, ///< Home button. + WID_SL_DRIVES_DIRECTORIES_LIST, ///< Drives list. + WID_SL_SCROLLBAR, ///< Scrollbar of the file list. + WID_SL_CONTENT_DOWNLOAD, ///< Content download button, only available for play scenario/heightmap. + WID_SL_SAVE_OSK_TITLE, ///< Title textbox, only available for save operations. + WID_SL_DELETE_SELECTION, ///< Delete button, only available for save operations. + WID_SL_SAVE_GAME, ///< Save button, only available for save operations. + WID_SL_CONTENT_DOWNLOAD_SEL, ///< Selection 'stack' to 'hide' the content download. + WID_SL_DETAILS, ///< Panel with game details. + WID_SL_NEWGRF_INFO, ///< Button to open NewGgrf configuration. + WID_SL_LOAD_BUTTON, ///< Button to load game/scenario. + WID_SL_MISSING_NEWGRFS, ///< Button to find missing NewGRFs online. }; #endif /* WIDGETS_FIOS_WIDGET_H */ diff --git a/src/widgets/genworld_widget.h b/src/widgets/genworld_widget.h index 7ff0c5423..d6ecf6218 100644 --- a/src/widgets/genworld_widget.h +++ b/src/widgets/genworld_widget.h @@ -12,82 +12,75 @@ #ifndef WIDGETS_GENWORLD_WIDGET_H #define WIDGETS_GENWORLD_WIDGET_H -/** Widgets of the WC_GENERATE_LANDSCAPE (WC_GENERATE_LANDSCAPE is also used in GenerateLandscapeWindowWidgets and CreateScenarioWindowWidgets). */ -enum GenenerateLandscapeWindowMode { - GLWM_GENERATE, ///< Generate new game - GLWM_HEIGHTMAP, ///< Load from heightmap - GLWM_SCENARIO, ///< Generate flat land +/** Widgets of the WC_GENERATE_LANDSCAPE (WC_GENERATE_LANDSCAPE is also used in CreateScenarioWidgets). */ +enum GenerateLandscapeWidgets { + WID_GL_TEMPERATE, ///< Button with icon "Temperate". + WID_GL_ARCTIC, ///< Button with icon "Arctic". + WID_GL_TROPICAL, ///< Button with icon "Tropical". + WID_GL_TOYLAND, ///< Button with icon "Toyland". + + WID_GL_MAPSIZE_X_PULLDOWN, ///< Dropdown 'map X size'. + WID_GL_MAPSIZE_Y_PULLDOWN, ///< Dropdown 'map Y size'. + + WID_GL_TOWN_PULLDOWN, ///< Dropdown 'No. of towns'. + WID_GL_INDUSTRY_PULLDOWN, ///< Dropdown 'No. of industries'. + + WID_GL_RANDOM_EDITBOX, ///< 'Random seed' editbox. + WID_GL_RANDOM_BUTTON, ///< 'Randomise' button. + + WID_GL_GENERATE_BUTTON, ///< 'Generate' button. + + WID_GL_START_DATE_DOWN, ///< Decrease start year. + WID_GL_START_DATE_TEXT, ///< Start year. + WID_GL_START_DATE_UP, ///< Increase start year. + + WID_GL_SNOW_LEVEL_DOWN, ///< Decrease snow level. + WID_GL_SNOW_LEVEL_TEXT, ///< Snow level. + WID_GL_SNOW_LEVEL_UP, ///< Increase snow level. + + WID_GL_TREE_PULLDOWN, ///< Dropdown 'Tree algorithm'. + WID_GL_LANDSCAPE_PULLDOWN, ///< Dropdown 'Land generator'. + + WID_GL_HEIGHTMAP_NAME_TEXT, ///< Heightmap name. + WID_GL_HEIGHTMAP_SIZE_TEXT, ///< Size of heightmap. + WID_GL_HEIGHTMAP_ROTATION_PULLDOWN, ///< Dropdown 'Heightmap rotation'. + + WID_GL_TERRAIN_PULLDOWN, ///< Dropdown 'Terrain type'. + WID_GL_WATER_PULLDOWN, ///< Dropdown 'Sea level'. + WID_GL_RIVER_PULLDOWN, ///< Dropdown 'Rivers'. + WID_GL_SMOOTHNESS_PULLDOWN, ///< Dropdown 'Smoothness'. + WID_GL_VARIETY_PULLDOWN, ///< Dropdown 'Variety distribution'. + + WID_GL_BORDERS_RANDOM, ///< 'Random'/'Manual' borders. + WID_GL_WATER_NW, ///< NW 'Water'/'Freeform'. + WID_GL_WATER_NE, ///< NE 'Water'/'Freeform'. + WID_GL_WATER_SE, ///< SE 'Water'/'Freeform'. + WID_GL_WATER_SW, ///< SW 'Water'/'Freeform'. }; -/** Widgets of the WC_GENERATE_LANDSCAPE (WC_GENERATE_LANDSCAPE is also used in GenenerateLandscapeWindowMode and CreateScenarioWindowWidgets). */ -enum GenerateLandscapeWindowWidgets { - GLAND_TEMPERATE, ///< Button with icon "Temperate" - GLAND_ARCTIC, ///< Button with icon "Arctic" - GLAND_TROPICAL, ///< Button with icon "Tropical" - GLAND_TOYLAND, ///< Button with icon "Toyland" - - GLAND_MAPSIZE_X_PULLDOWN, ///< Dropdown 'map X size' - GLAND_MAPSIZE_Y_PULLDOWN, ///< Dropdown 'map Y size' - - GLAND_TOWN_PULLDOWN, ///< Dropdown 'No. of towns' - GLAND_INDUSTRY_PULLDOWN, ///< Dropdown 'No. of industries' - - GLAND_RANDOM_EDITBOX, ///< 'Random seed' editbox - GLAND_RANDOM_BUTTON, ///< 'Randomise' button - - GLAND_GENERATE_BUTTON, ///< 'Generate' button - - GLAND_START_DATE_DOWN, ///< Decrease start year - GLAND_START_DATE_TEXT, ///< Start year - GLAND_START_DATE_UP, ///< Increase start year - - GLAND_SNOW_LEVEL_DOWN, ///< Decrease snow level - GLAND_SNOW_LEVEL_TEXT, ///< Snow level - GLAND_SNOW_LEVEL_UP, ///< Increase snow level - - GLAND_TREE_PULLDOWN, ///< Dropdown 'Tree algorithm' - GLAND_LANDSCAPE_PULLDOWN, ///< Dropdown 'Land generator' - - GLAND_HEIGHTMAP_NAME_TEXT, ///< Heightmap name - GLAND_HEIGHTMAP_SIZE_TEXT, ///< Size of heightmap - GLAND_HEIGHTMAP_ROTATION_PULLDOWN, ///< Dropdown 'Heightmap rotation' - - GLAND_TERRAIN_PULLDOWN, ///< Dropdown 'Terrain type' - GLAND_WATER_PULLDOWN, ///< Dropdown 'Sea level' - GLAND_RIVER_PULLDOWN, ///< Dropdown 'Rivers' - GLAND_SMOOTHNESS_PULLDOWN, ///< Dropdown 'Smoothness' - GLAND_VARIETY_PULLDOWN, ///< Dropdown 'Variety distribution' - - GLAND_BORDERS_RANDOM, ///< 'Random'/'Manual' borders - GLAND_WATER_NW, ///< NW 'Water'/'Freeform' - GLAND_WATER_NE, ///< NE 'Water'/'Freeform' - GLAND_WATER_SE, ///< SE 'Water'/'Freeform' - GLAND_WATER_SW, ///< SW 'Water'/'Freeform' -}; - -/** Widgets of the WC_GENERATE_LANDSCAPE (WC_GENERATE_LANDSCAPE is also used in GenerateLandscapeWindowWidgets and GenenerateLandscapeWindowMode). */ -enum CreateScenarioWindowWidgets { - CSCEN_TEMPERATE, ///< Select temperate landscape style. - CSCEN_ARCTIC, ///< Select arctic landscape style. - CSCEN_TROPICAL, ///< Select tropical landscape style. - CSCEN_TOYLAND, ///< Select toy-land landscape style. - CSCEN_EMPTY_WORLD, ///< Generate an empty flat world. - CSCEN_RANDOM_WORLD, ///< Generate random land button - CSCEN_MAPSIZE_X_PULLDOWN, ///< Pull-down arrow for x map size. - CSCEN_MAPSIZE_Y_PULLDOWN, ///< Pull-down arrow for y map size. - CSCEN_START_DATE_DOWN, ///< Decrease start year (start earlier). - CSCEN_START_DATE_TEXT, ///< Clickable start date value. - CSCEN_START_DATE_UP, ///< Increase start year (start later). - CSCEN_FLAT_LAND_HEIGHT_DOWN, ///< Decrease flat land height. - CSCEN_FLAT_LAND_HEIGHT_TEXT, ///< Clickable flat land height value. - CSCEN_FLAT_LAND_HEIGHT_UP ///< Increase flat land height. +/** Widgets of the WC_GENERATE_LANDSCAPE (WC_GENERATE_LANDSCAPE is also used in GenerateLandscapeWidgets). */ +enum CreateScenarioWidgets { + WID_CS_TEMPERATE, ///< Select temperate landscape style. + WID_CS_ARCTIC, ///< Select arctic landscape style. + WID_CS_TROPICAL, ///< Select tropical landscape style. + WID_CS_TOYLAND, ///< Select toy-land landscape style. + WID_CS_EMPTY_WORLD, ///< Generate an empty flat world. + WID_CS_RANDOM_WORLD, ///< Generate random land button + WID_CS_MAPSIZE_X_PULLDOWN, ///< Pull-down arrow for x map size. + WID_CS_MAPSIZE_Y_PULLDOWN, ///< Pull-down arrow for y map size. + WID_CS_START_DATE_DOWN, ///< Decrease start year (start earlier). + WID_CS_START_DATE_TEXT, ///< Clickable start date value. + WID_CS_START_DATE_UP, ///< Increase start year (start later). + WID_CS_FLAT_LAND_HEIGHT_DOWN, ///< Decrease flat land height. + WID_CS_FLAT_LAND_HEIGHT_TEXT, ///< Clickable flat land height value. + WID_CS_FLAT_LAND_HEIGHT_UP ///< Increase flat land height. }; -/** Widgets of the WC_MODAL_PROGRESS (WC_MODAL_PROGRESS is also used in ScanProgressWindowWidgets). */ -enum GenerationProgressWindowWidgets { - GPWW_PROGRESS_BAR, - GPWW_PROGRESS_TEXT, - GPWW_ABORT, +/** Widgets of the WC_MODAL_PROGRESS (WC_MODAL_PROGRESS is also used in ScanProgressWidgets). */ +enum GenerationProgressWidgets { + WID_GP_PROGRESS_BAR, ///< Progress bar. + WID_GP_PROGRESS_TEXT, ///< Text with the progress bar. + WID_GP_ABORT, ///< Abort button. }; #endif /* WIDGETS_GENWORLD_WIDGET_H */ diff --git a/src/widgets/graph_widget.h b/src/widgets/graph_widget.h index 66c637086..95a67446f 100644 --- a/src/widgets/graph_widget.h +++ b/src/widgets/graph_widget.h @@ -15,54 +15,54 @@ #include "../economy_type.h" /** Widgets of the WC_GRAPH_LEGEND. */ -enum GraphLegendWidgetNumbers { - GLW_BACKGROUND, +enum GraphLegendWidgets { + WID_GL_BACKGROUND, - GLW_FIRST_COMPANY, - GLW_LAST_COMPANY = GLW_FIRST_COMPANY + MAX_COMPANIES - 1, + WID_GL_FIRST_COMPANY, + WID_GL_LAST_COMPANY = WID_GL_FIRST_COMPANY + MAX_COMPANIES - 1, }; /** Widgets of the WC_OPERATING_PROFIT / WC_DELIVERED_CARGO / WC_COMPANY_VALUE / WC_INCOME_GRAPH. */ enum CompanyValueWidgets { - BGW_KEY_BUTTON, - BGW_BACKGROUND, - BGW_GRAPH, - BGW_RESIZE, + WID_CV_KEY_BUTTON, ///< Key button. + WID_CV_BACKGROUND, ///< Background of the window. + WID_CV_GRAPH, ///< Graph itself. + WID_CV_RESIZE, ///< Resize button. }; /** Widget of the WC_PERFORMANCE_HISTORY. */ enum PerformanceHistoryGraphWidgets { - PHW_KEY, - PHW_DETAILED_PERFORMANCE, - PHW_BACKGROUND, - PHW_GRAPH, - PHW_RESIZE, + WID_PHG_KEY, ///< Key button. + WID_PHG_DETAILED_PERFORMANCE, ///< Detailed performance. + WID_PHG_BACKGROUND, ///< Background of the window. + WID_PHG_GRAPH, ///< Graph itself. + WID_PHG_RESIZE, ///< Resize button. }; /** Widget of the WC_PAYMENT_RATES. */ enum CargoPaymentRatesWidgets { - CPW_BACKGROUND, - CPW_HEADER, - CPW_GRAPH, - CPW_RESIZE, - CPW_FOOTER, - CPW_ENABLE_CARGOES, - CPW_DISABLE_CARGOES, - CPW_CARGO_FIRST, + WID_CPR_BACKGROUND, ///< Background of the window. + WID_CPR_HEADER, ///< Header. + WID_CPR_GRAPH, ///< Graph itself. + WID_CPR_RESIZE, ///< Resize button. + WID_CPR_FOOTER, ///< Footer. + WID_CPR_ENABLE_CARGOES, ///< Enable cargoes button. + WID_CPR_DISABLE_CARGOES, ///< Disable cargoes button. + WID_CPR_CARGO_FIRST, ///< First cargo in the list. }; /** Widget of the WC_COMPANY_LEAGUE. */ enum CompanyLeagueWidgets { - CLW_BACKGROUND, + WID_CL_BACKGROUND, ///< Background of the window. }; /** Widget of the WC_PERFORMANCE_DETAIL. */ enum PerformanceRatingDetailsWidgets { - PRW_SCORE_FIRST, - PRW_SCORE_LAST = PRW_SCORE_FIRST + (SCORE_END - SCORE_BEGIN) - 1, + WID_PRD_SCORE_FIRST, ///< First entry in the score list. + WID_PRD_SCORE_LAST = WID_PRD_SCORE_FIRST + (SCORE_END - SCORE_BEGIN) - 1, ///< Last entry in the score list. - PRW_COMPANY_FIRST, - PRW_COMPANY_LAST = PRW_COMPANY_FIRST + MAX_COMPANIES - 1, + WID_PRD_COMPANY_FIRST, ///< First company. + WID_PRD_COMPANY_LAST = WID_PRD_COMPANY_FIRST + MAX_COMPANIES - 1, ///< Last company. }; #endif /* WIDGETS_GRAPH_WIDGET_H */ |