From 05af1d176bff01154933da8c3e3ba97784f4b8d6 Mon Sep 17 00:00:00 2001 From: truebrain Date: Fri, 16 Dec 2011 16:49:53 +0000 Subject: (svn r23536) -Codechange: document and rename widgets to be consistent and understandable --- src/intro_gui.cpp | 90 +++++++++++++++++++++++----------------------- src/main_gui.cpp | 6 ++-- src/misc_gui.cpp | 76 +++++++++++++++++++-------------------- src/widgets/intro_widget.h | 38 ++++++++++---------- src/widgets/main_widget.h | 4 +-- src/widgets/misc_widget.h | 26 +++++++------- 6 files changed, 120 insertions(+), 120 deletions(-) diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp index bbfdb4c1f..3f2d96dc7 100644 --- a/src/intro_gui.cpp +++ b/src/intro_gui.cpp @@ -49,27 +49,27 @@ struct SelectGameWindow : public Window { virtual void OnInvalidateData(int data = 0, bool gui_scope = true) { if (!gui_scope) return; - this->SetWidgetLoweredState(SGI_TEMPERATE_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TEMPERATE); - this->SetWidgetLoweredState(SGI_ARCTIC_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_ARCTIC); - this->SetWidgetLoweredState(SGI_TROPIC_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TROPIC); - this->SetWidgetLoweredState(SGI_TOYLAND_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TOYLAND); + this->SetWidgetLoweredState(WID_SGI_TEMPERATE_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TEMPERATE); + this->SetWidgetLoweredState(WID_SGI_ARCTIC_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_ARCTIC); + this->SetWidgetLoweredState(WID_SGI_TROPIC_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TROPIC); + this->SetWidgetLoweredState(WID_SGI_TOYLAND_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TOYLAND); } virtual void SetStringParameters(int widget) const { - if (widget == SGI_DIFFICULTIES) SetDParam(0, STR_DIFFICULTY_LEVEL_EASY + _settings_newgame.difficulty.diff_level); + if (widget == WID_SGI_DIFFICULTIES) SetDParam(0, STR_DIFFICULTY_LEVEL_EASY + _settings_newgame.difficulty.diff_level); } virtual void OnInit() { bool missing = _current_language->missing >= _settings_client.gui.missing_strings_threshold && !IsReleasedVersion(); - this->GetWidget(SGI_TRANSLATION_SELECTION)->SetDisplayedPlane(missing ? 0 : SZSP_NONE); + this->GetWidget(WID_SGI_TRANSLATION_SELECTION)->SetDisplayedPlane(missing ? 0 : SZSP_NONE); } virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case SGI_TRANSLATION: + case WID_SGI_TRANSLATION: SetDParam(0, _current_language->missing); DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_INTRO_TRANSLATION, TC_FROMSTRING, SA_CENTER); break; @@ -79,7 +79,7 @@ struct SelectGameWindow : public Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case SGI_DIFFICULTIES: { + case WID_SGI_DIFFICULTIES: { Dimension textdim = {0, 0}; for (uint i = STR_DIFFICULTY_LEVEL_EASY; i <= STR_DIFFICULTY_LEVEL_CUSTOM; i++) { SetDParam(0, i); @@ -91,7 +91,7 @@ struct SelectGameWindow : public Window { break; } - case SGI_TRANSLATION: { + case WID_SGI_TRANSLATION: { SetDParam(0, _current_language->missing); int height = GetStringHeight(STR_INTRO_TRANSLATION, size->width); if (height > 3 * FONT_HEIGHT_NORMAL) { @@ -113,11 +113,11 @@ struct SelectGameWindow : public Window { #ifdef ENABLE_NETWORK /* Do not create a network server when you (just) have closed one of the game * creation/load windows for the network server. */ - if (IsInsideMM(widget, SGI_GENERATE_GAME, SGI_EDIT_SCENARIO + 1)) _is_network_server = false; + if (IsInsideMM(widget, WID_SGI_GENERATE_GAME, WID_SGI_EDIT_SCENARIO + 1)) _is_network_server = false; #endif /* ENABLE_NETWORK */ switch (widget) { - case SGI_GENERATE_GAME: + case WID_SGI_GENERATE_GAME: if (_ctrl_pressed) { StartNewGameWithoutGUI(GENERATE_NEW_SEED); } else { @@ -125,12 +125,12 @@ struct SelectGameWindow : public Window { } break; - case SGI_LOAD_GAME: ShowSaveLoadDialog(SLD_LOAD_GAME); break; - case SGI_PLAY_SCENARIO: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break; - case SGI_PLAY_HEIGHTMAP: ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break; - case SGI_EDIT_SCENARIO: StartScenarioEditor(); break; + case WID_SGI_LOAD_GAME: ShowSaveLoadDialog(SLD_LOAD_GAME); break; + case WID_SGI_PLAY_SCENARIO: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break; + case WID_SGI_PLAY_HEIGHTMAP: ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break; + case WID_SGI_EDIT_SCENARIO: StartScenarioEditor(); break; - case SGI_PLAY_NETWORK: + case WID_SGI_PLAY_NETWORK: if (!_network_available) { ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR); } else { @@ -138,24 +138,24 @@ struct SelectGameWindow : public Window { } break; - case SGI_TEMPERATE_LANDSCAPE: case SGI_ARCTIC_LANDSCAPE: - case SGI_TROPIC_LANDSCAPE: case SGI_TOYLAND_LANDSCAPE: - SetNewLandscapeType(widget - SGI_TEMPERATE_LANDSCAPE); + case WID_SGI_TEMPERATE_LANDSCAPE: case WID_SGI_ARCTIC_LANDSCAPE: + case WID_SGI_TROPIC_LANDSCAPE: case WID_SGI_TOYLAND_LANDSCAPE: + SetNewLandscapeType(widget - WID_SGI_TEMPERATE_LANDSCAPE); break; - case SGI_OPTIONS: ShowGameOptions(); break; - case SGI_DIFFICULTIES: ShowGameDifficulty(); break; - case SGI_SETTINGS_OPTIONS:ShowGameSettings(); break; - case SGI_GRF_SETTINGS: ShowNewGRFSettings(true, true, false, &_grfconfig_newgame); break; - case SGI_CONTENT_DOWNLOAD: + case WID_SGI_OPTIONS: ShowGameOptions(); break; + case WID_SGI_DIFFICULTIES: ShowGameDifficulty(); break; + case WID_SGI_SETTINGS_OPTIONS:ShowGameSettings(); break; + case WID_SGI_GRF_SETTINGS: ShowNewGRFSettings(true, true, false, &_grfconfig_newgame); break; + case WID_SGI_CONTENT_DOWNLOAD: if (!_network_available) { ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR); } else { ShowNetworkContentListWindow(); } break; - case SGI_AI_SETTINGS: ShowAIConfigWindow(); break; - case SGI_EXIT: HandleExitGameRequest(); break; + case WID_SGI_AI_SETTINGS: ShowAIConfigWindow(); break; + case WID_SGI_EXIT: HandleExitGameRequest(); break; } } }; @@ -167,9 +167,9 @@ static const NWidgetPart _nested_select_game_widgets[] = { /* 'generate game' and 'load game' buttons */ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_GENERATE_GAME), SetMinimalSize(158, 12), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_GENERATE_GAME), SetMinimalSize(158, 12), SetDataTip(STR_INTRO_NEW_GAME, STR_INTRO_TOOLTIP_NEW_GAME), SetPadding(0, 0, 0, 10), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_LOAD_GAME), SetMinimalSize(158, 12), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_LOAD_GAME), SetMinimalSize(158, 12), SetDataTip(STR_INTRO_LOAD_GAME, STR_INTRO_TOOLTIP_LOAD_GAME), SetPadding(0, 10, 0, 0), SetFill(1, 0), EndContainer(), @@ -177,9 +177,9 @@ static const NWidgetPart _nested_select_game_widgets[] = { /* 'play scenario' and 'play heightmap' buttons */ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_PLAY_SCENARIO), SetMinimalSize(158, 12), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_PLAY_SCENARIO), SetMinimalSize(158, 12), SetDataTip(STR_INTRO_PLAY_SCENARIO, STR_INTRO_TOOLTIP_PLAY_SCENARIO), SetPadding(0, 0, 0, 10), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_PLAY_HEIGHTMAP), SetMinimalSize(158, 12), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_PLAY_HEIGHTMAP), SetMinimalSize(158, 12), SetDataTip(STR_INTRO_PLAY_HEIGHTMAP, STR_INTRO_TOOLTIP_PLAY_HEIGHTMAP), SetPadding(0, 10, 0, 0), SetFill(1, 0), EndContainer(), @@ -187,9 +187,9 @@ static const NWidgetPart _nested_select_game_widgets[] = { /* 'edit scenario' and 'play multiplayer' buttons */ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_EDIT_SCENARIO), SetMinimalSize(158, 12), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_EDIT_SCENARIO), SetMinimalSize(158, 12), SetDataTip(STR_INTRO_SCENARIO_EDITOR, STR_INTRO_TOOLTIP_SCENARIO_EDITOR), SetPadding(0, 0, 0, 10), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_PLAY_NETWORK), SetMinimalSize(158, 12), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_PLAY_NETWORK), SetMinimalSize(158, 12), SetDataTip(STR_INTRO_MULTIPLAYER, STR_INTRO_TOOLTIP_MULTIPLAYER), SetPadding(0, 10, 0, 0), SetFill(1, 0), EndContainer(), @@ -198,32 +198,32 @@ static const NWidgetPart _nested_select_game_widgets[] = { /* climate selection buttons */ NWidget(NWID_HORIZONTAL), NWidget(NWID_SPACER), SetMinimalSize(10, 0), SetFill(1, 0), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, SGI_TEMPERATE_LANDSCAPE), SetMinimalSize(77, 55), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_SGI_TEMPERATE_LANDSCAPE), SetMinimalSize(77, 55), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE), NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, SGI_ARCTIC_LANDSCAPE), SetMinimalSize(77, 55), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_SGI_ARCTIC_LANDSCAPE), SetMinimalSize(77, 55), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE), NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, SGI_TROPIC_LANDSCAPE), SetMinimalSize(77, 55), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_SGI_TROPIC_LANDSCAPE), SetMinimalSize(77, 55), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE), NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), - NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, SGI_TOYLAND_LANDSCAPE), SetMinimalSize(77, 55), + NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_SGI_TOYLAND_LANDSCAPE), SetMinimalSize(77, 55), SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE), NWidget(NWID_SPACER), SetMinimalSize(10, 0), SetFill(1, 0), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 7), - NWidget(NWID_SELECTION, INVALID_COLOUR, SGI_TRANSLATION_SELECTION), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SGI_TRANSLATION_SELECTION), NWidget(NWID_VERTICAL), - NWidget(WWT_EMPTY, COLOUR_ORANGE, SGI_TRANSLATION), SetMinimalSize(316, 12), SetFill(1, 0), SetPadding(0, 10, 7, 10), + NWidget(WWT_EMPTY, COLOUR_ORANGE, WID_SGI_TRANSLATION), SetMinimalSize(316, 12), SetFill(1, 0), SetPadding(0, 10, 7, 10), EndContainer(), EndContainer(), /* 'game options' and 'difficulty options' buttons */ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_OPTIONS), SetMinimalSize(158, 12), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_OPTIONS), SetMinimalSize(158, 12), SetDataTip(STR_INTRO_GAME_OPTIONS, STR_INTRO_TOOLTIP_GAME_OPTIONS), SetPadding(0, 0, 0, 10), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_DIFFICULTIES), SetMinimalSize(158, 12), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_DIFFICULTIES), SetMinimalSize(158, 12), SetDataTip(STR_INTRO_DIFFICULTY, STR_INTRO_TOOLTIP_DIFFICULTY_OPTIONS), SetPadding(0, 10, 0, 0), SetFill(1, 0), EndContainer(), @@ -231,9 +231,9 @@ static const NWidgetPart _nested_select_game_widgets[] = { /* 'advanced settings' and 'newgrf settings' buttons */ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_SETTINGS_OPTIONS), SetMinimalSize(158, 12), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_SETTINGS_OPTIONS), SetMinimalSize(158, 12), SetDataTip(STR_INTRO_ADVANCED_SETTINGS, STR_INTRO_TOOLTIP_ADVANCED_SETTINGS), SetPadding(0, 0, 0, 10), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_GRF_SETTINGS), SetMinimalSize(158, 12), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_GRF_SETTINGS), SetMinimalSize(158, 12), SetDataTip(STR_INTRO_NEWGRF_SETTINGS, STR_INTRO_TOOLTIP_NEWGRF_SETTINGS), SetPadding(0, 10, 0, 0), SetFill(1, 0), EndContainer(), @@ -241,9 +241,9 @@ static const NWidgetPart _nested_select_game_widgets[] = { /* 'online content' and 'ai settings' buttons */ NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_CONTENT_DOWNLOAD), SetMinimalSize(158, 12), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_CONTENT_DOWNLOAD), SetMinimalSize(158, 12), SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT), SetPadding(0, 0, 0, 10), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_AI_SETTINGS), SetMinimalSize(158, 12), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_AI_SETTINGS), SetMinimalSize(158, 12), SetDataTip(STR_INTRO_AI_SETTINGS, STR_INTRO_TOOLTIP_AI_SETTINGS), SetPadding(0, 10, 0, 0), SetFill(1, 0), EndContainer(), @@ -252,7 +252,7 @@ static const NWidgetPart _nested_select_game_widgets[] = { /* 'exit program' button */ NWidget(NWID_HORIZONTAL), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, SGI_EXIT), SetMinimalSize(128, 12), + NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_EXIT), SetMinimalSize(128, 12), SetDataTip(STR_INTRO_QUIT, STR_INTRO_TOOLTIP_QUIT), NWidget(NWID_SPACER), SetFill(1, 0), EndContainer(), diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 65372ba6d..04dbd3533 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -202,7 +202,7 @@ void ZoomInOrOutToCursorWindow(bool in, Window *w) } static const struct NWidgetPart _nested_main_window_widgets[] = { - NWidget(NWID_VIEWPORT, INVALID_COLOUR, MW_VIEWPORT), SetResize(1, 1), + NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_M_VIEWPORT), SetResize(1, 1), }; static const WindowDesc _main_window_desc( @@ -244,7 +244,7 @@ struct MainWindow : Window CLRBITS(this->flags, WF_WHITE_BORDER); ResizeWindow(this, _screen.width, _screen.height); - NWidgetViewport *nvp = this->GetWidget(MW_VIEWPORT); + NWidgetViewport *nvp = this->GetWidget(WID_M_VIEWPORT); nvp->InitializeViewport(this, TileXY(32, 32), ZOOM_LVL_VIEWPORT); } @@ -423,7 +423,7 @@ struct MainWindow : Window virtual void OnResize() { if (this->viewport != NULL) { - NWidgetViewport *nvp = this->GetWidget(MW_VIEWPORT); + NWidgetViewport *nvp = this->GetWidget(WID_M_VIEWPORT); nvp->UpdateViewportCoordinates(this); } } diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 5db89d377..1256f5470 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -48,7 +48,7 @@ static const NWidgetPart _nested_land_info_widgets[] = { NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_LAND_AREA_INFORMATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_DEBUGBOX, COLOUR_GREY), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, LIW_BACKGROUND), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_LI_BACKGROUND), EndContainer(), }; static const WindowDesc _land_info_desc( @@ -73,7 +73,7 @@ public: virtual void DrawWidget(const Rect &r, int widget) const { - if (widget != LIW_BACKGROUND) return; + if (widget != WID_LI_BACKGROUND) return; uint y = r.top + WD_TEXTPANEL_TOP; for (uint i = 0; i < LAND_INFO_CENTERED_LINES; i++) { @@ -92,7 +92,7 @@ public: virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget != LIW_BACKGROUND) return; + if (widget != WID_LI_BACKGROUND) return; size->height = WD_TEXTPANEL_TOP + WD_TEXTPANEL_BOTTOM; for (uint i = 0; i < LAND_INFO_CENTERED_LINES; i++) { @@ -361,9 +361,9 @@ static const NWidgetPart _nested_about_widgets[] = { NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_ABOUT_ORIGINAL_COPYRIGHT, STR_NULL), NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_ABOUT_VERSION, STR_NULL), NWidget(WWT_FRAME, COLOUR_GREY), SetPadding(0, 5, 1, 5), - NWidget(WWT_EMPTY, INVALID_COLOUR, AW_SCROLLING_TEXT), + NWidget(WWT_EMPTY, INVALID_COLOUR, WID_A_SCROLLING_TEXT), EndContainer(), - NWidget(WWT_LABEL, COLOUR_GREY, AW_WEBSITE), SetDataTip(STR_BLACK_RAW_STRING, STR_NULL), + NWidget(WWT_LABEL, COLOUR_GREY, WID_A_WEBSITE), SetDataTip(STR_BLACK_RAW_STRING, STR_NULL), NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_ABOUT_COPYRIGHT_OPENTTD, STR_NULL), EndContainer(), }; @@ -446,17 +446,17 @@ struct AboutWindow : public Window { this->InitNested(&_about_desc); this->counter = 5; - this->text_position = this->GetWidget(AW_SCROLLING_TEXT)->pos_y + this->GetWidget(AW_SCROLLING_TEXT)->current_y; + this->text_position = this->GetWidget(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget(WID_A_SCROLLING_TEXT)->current_y; } virtual void SetStringParameters(int widget) const { - if (widget == AW_WEBSITE) SetDParamStr(0, "Website: http://www.openttd.org"); + if (widget == WID_A_WEBSITE) SetDParamStr(0, "Website: http://www.openttd.org"); } virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget != AW_SCROLLING_TEXT) return; + if (widget != WID_A_SCROLLING_TEXT) return; this->line_height = FONT_HEIGHT_NORMAL; @@ -472,7 +472,7 @@ struct AboutWindow : public Window { virtual void DrawWidget(const Rect &r, int widget) const { - if (widget != AW_SCROLLING_TEXT) return; + if (widget != WID_A_SCROLLING_TEXT) return; int y = this->text_position; @@ -491,8 +491,8 @@ struct AboutWindow : public Window { this->counter = 5; this->text_position--; /* If the last text has scrolled start a new from the start */ - if (this->text_position < (int)(this->GetWidget(AW_SCROLLING_TEXT)->pos_y - lengthof(_credits) * this->line_height)) { - this->text_position = this->GetWidget(AW_SCROLLING_TEXT)->pos_y + this->GetWidget(AW_SCROLLING_TEXT)->current_y; + if (this->text_position < (int)(this->GetWidget(WID_A_SCROLLING_TEXT)->pos_y - lengthof(_credits) * this->line_height)) { + this->text_position = this->GetWidget(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget(WID_A_SCROLLING_TEXT)->current_y; } this->SetDirty(); } @@ -603,7 +603,7 @@ void HideFillingPercent(TextEffectID *te_id) } static const NWidgetPart _nested_tooltips_widgets[] = { - NWidget(WWT_PANEL, COLOUR_GREY, TTW_BACKGROUND), SetMinimalSize(200, 32), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_TT_BACKGROUND), SetMinimalSize(200, 32), EndContainer(), }; static const WindowDesc _tool_tips_desc( @@ -1118,13 +1118,13 @@ struct QueryStringWindow : public QueryStringBaseWindow this->parent = parent; - this->SetFocusedWidget(QUERY_STR_WIDGET_TEXT); - this->LowerWidget(QUERY_STR_WIDGET_TEXT); + this->SetFocusedWidget(WID_QS_TEXT); + this->LowerWidget(WID_QS_TEXT); } virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget == QUERY_STR_WIDGET_DEFAULT && (this->flags & QSF_ENABLE_DEFAULT) == 0) { + if (widget == WID_QS_DEFAULT && (this->flags & QSF_ENABLE_DEFAULT) == 0) { /* We don't want this widget to show! */ fill->width = 0; resize->width = 0; @@ -1136,12 +1136,12 @@ struct QueryStringWindow : public QueryStringBaseWindow { this->DrawWidgets(); - this->DrawEditBox(QUERY_STR_WIDGET_TEXT); + this->DrawEditBox(WID_QS_TEXT); } virtual void SetStringParameters(int widget) const { - if (widget == QUERY_STR_WIDGET_CAPTION) SetDParam(0, this->caption); + if (widget == WID_QS_CAPTION) SetDParam(0, this->caption); } void OnOk() @@ -1161,13 +1161,13 @@ struct QueryStringWindow : public QueryStringBaseWindow virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case QUERY_STR_WIDGET_DEFAULT: + case WID_QS_DEFAULT: this->text.buf[0] = '\0'; /* FALL THROUGH */ - case QUERY_STR_WIDGET_OK: + case WID_QS_OK: this->OnOk(); /* FALL THROUGH */ - case QUERY_STR_WIDGET_CANCEL: + case WID_QS_CANCEL: delete this; break; } @@ -1175,13 +1175,13 @@ struct QueryStringWindow : public QueryStringBaseWindow virtual void OnMouseLoop() { - this->HandleEditBox(QUERY_STR_WIDGET_TEXT); + this->HandleEditBox(WID_QS_TEXT); } virtual EventState OnKeyPress(uint16 key, uint16 keycode) { EventState state = ES_NOT_HANDLED; - switch (this->HandleEditBoxKey(QUERY_STR_WIDGET_TEXT, key, keycode, state)) { + switch (this->HandleEditBoxKey(WID_QS_TEXT, key, keycode, state)) { default: NOT_REACHED(); case HEBR_EDITING: { Window *osk = FindWindowById(WC_OSK, 0); @@ -1198,7 +1198,7 @@ struct QueryStringWindow : public QueryStringBaseWindow virtual void OnOpenOSKWindow(int wid) { - ShowOnScreenKeyboard(this, wid, QUERY_STR_WIDGET_CANCEL, QUERY_STR_WIDGET_OK); + ShowOnScreenKeyboard(this, wid, WID_QS_CANCEL, WID_QS_OK); } ~QueryStringWindow() @@ -1214,15 +1214,15 @@ struct QueryStringWindow : public QueryStringBaseWindow static const NWidgetPart _nested_query_string_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, QUERY_STR_WIDGET_CAPTION), SetDataTip(STR_WHITE_STRING, STR_NULL), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_QS_CAPTION), SetDataTip(STR_WHITE_STRING, STR_NULL), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY), - NWidget(WWT_EDITBOX, COLOUR_GREY, QUERY_STR_WIDGET_TEXT), SetMinimalSize(256, 12), SetFill(1, 1), SetPadding(2, 2, 2, 2), + NWidget(WWT_EDITBOX, COLOUR_GREY, WID_QS_TEXT), SetMinimalSize(256, 12), SetFill(1, 1), SetPadding(2, 2, 2, 2), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_TEXTBTN, COLOUR_GREY, QUERY_STR_WIDGET_DEFAULT), SetMinimalSize(87, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_DEFAULT, STR_NULL), - NWidget(WWT_TEXTBTN, COLOUR_GREY, QUERY_STR_WIDGET_CANCEL), SetMinimalSize(86, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), - NWidget(WWT_TEXTBTN, COLOUR_GREY, QUERY_STR_WIDGET_OK), SetMinimalSize(87, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_OK, STR_NULL), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_DEFAULT), SetMinimalSize(87, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_DEFAULT, STR_NULL), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_CANCEL), SetMinimalSize(86, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_QS_OK), SetMinimalSize(87, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_OK, STR_NULL), EndContainer(), }; @@ -1282,12 +1282,12 @@ struct QueryWindow : public Window { virtual void SetStringParameters(int widget) const { switch (widget) { - case QUERY_WIDGET_CAPTION: + case WID_Q_CAPTION: CopyInDParam(1, this->params, lengthof(this->params)); SetDParam(0, this->caption); break; - case QUERY_WIDGET_TEXT: + case WID_Q_TEXT: CopyInDParam(0, this->params, lengthof(this->params)); break; } @@ -1295,7 +1295,7 @@ struct QueryWindow : public Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget != QUERY_WIDGET_TEXT) return; + if (widget != WID_Q_TEXT) return; Dimension d = GetStringMultiLineBoundingBox(this->message, *size); d.width += padding.width; @@ -1305,7 +1305,7 @@ struct QueryWindow : public Window { virtual void DrawWidget(const Rect &r, int widget) const { - if (widget != QUERY_WIDGET_TEXT) return; + if (widget != WID_Q_TEXT) return; DrawStringMultiLine(r.left, r.right, r.top, r.bottom, this->message, TC_FROMSTRING, SA_CENTER); } @@ -1313,7 +1313,7 @@ struct QueryWindow : public Window { virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case QUERY_WIDGET_YES: { + case WID_Q_YES: { /* in the Generate New World window, clicking 'Yes' causes * DeleteNonVitalWindows() to be called - we shouldn't be in a window then */ QueryCallbackProc *proc = this->proc; @@ -1327,7 +1327,7 @@ struct QueryWindow : public Window { } break; } - case QUERY_WIDGET_NO: + case WID_Q_NO: delete this; break; } @@ -1355,13 +1355,13 @@ struct QueryWindow : public Window { static const NWidgetPart _nested_query_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_RED), - NWidget(WWT_CAPTION, COLOUR_RED, QUERY_WIDGET_CAPTION), SetDataTip(STR_JUST_STRING, STR_NULL), + NWidget(WWT_CAPTION, COLOUR_RED, WID_Q_CAPTION), SetDataTip(STR_JUST_STRING, STR_NULL), EndContainer(), NWidget(WWT_PANEL, COLOUR_RED), SetPIP(8, 15, 8), - NWidget(WWT_TEXT, COLOUR_RED, QUERY_WIDGET_TEXT), SetMinimalSize(200, 12), + NWidget(WWT_TEXT, COLOUR_RED, WID_Q_TEXT), SetMinimalSize(200, 12), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(20, 29, 20), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, QUERY_WIDGET_NO), SetMinimalSize(71, 12), SetDataTip(STR_QUIT_NO, STR_NULL), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, QUERY_WIDGET_YES), SetMinimalSize(71, 12), SetDataTip(STR_QUIT_YES, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_Q_NO), SetMinimalSize(71, 12), SetDataTip(STR_QUIT_NO, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_Q_YES), SetMinimalSize(71, 12), SetDataTip(STR_QUIT_YES, STR_NULL), EndContainer(), EndContainer(), }; diff --git a/src/widgets/intro_widget.h b/src/widgets/intro_widget.h index 5b7de2252..b5ac79496 100644 --- a/src/widgets/intro_widget.h +++ b/src/widgets/intro_widget.h @@ -14,25 +14,25 @@ /** Widgets of the WC_SELECT_GAME. */ enum SelectGameIntroWidgets { - SGI_GENERATE_GAME, - SGI_LOAD_GAME, - SGI_PLAY_SCENARIO, - SGI_PLAY_HEIGHTMAP, - SGI_EDIT_SCENARIO, - SGI_PLAY_NETWORK, - SGI_TEMPERATE_LANDSCAPE, - SGI_ARCTIC_LANDSCAPE, - SGI_TROPIC_LANDSCAPE, - SGI_TOYLAND_LANDSCAPE, - SGI_TRANSLATION_SELECTION, - SGI_TRANSLATION, - SGI_OPTIONS, - SGI_DIFFICULTIES, - SGI_SETTINGS_OPTIONS, - SGI_GRF_SETTINGS, - SGI_CONTENT_DOWNLOAD, - SGI_AI_SETTINGS, - SGI_EXIT, + WID_SGI_GENERATE_GAME, ///< Generate game button. + WID_SGI_LOAD_GAME, ///< Load game button. + WID_SGI_PLAY_SCENARIO, ///< Play scenario button. + WID_SGI_PLAY_HEIGHTMAP, ///< Play heightmap button. + WID_SGI_EDIT_SCENARIO, ///< Edit scenario button. + WID_SGI_PLAY_NETWORK, ///< Play network button. + WID_SGI_TEMPERATE_LANDSCAPE, ///< Select temperate landscape button. + WID_SGI_ARCTIC_LANDSCAPE, ///< Select arctic landscape button. + WID_SGI_TROPIC_LANDSCAPE, ///< Select tropic landscape button. + WID_SGI_TOYLAND_LANDSCAPE, ///< Select toyland landscape button. + WID_SGI_TRANSLATION_SELECTION, ///< Translation selection. + WID_SGI_TRANSLATION, ///< Translation. + WID_SGI_OPTIONS, ///< Options button. + WID_SGI_DIFFICULTIES, ///< Difficulties button. + WID_SGI_SETTINGS_OPTIONS, ///< Settings button. + WID_SGI_GRF_SETTINGS, ///< NewGRF button. + WID_SGI_CONTENT_DOWNLOAD, ///< Content Download button. + WID_SGI_AI_SETTINGS, ///< AI button. + WID_SGI_EXIT, ///< Exit button. }; #endif /* WIDGETS_INTRO_WIDGET_H */ diff --git a/src/widgets/main_widget.h b/src/widgets/main_widget.h index 823e62283..7bb16804a 100644 --- a/src/widgets/main_widget.h +++ b/src/widgets/main_widget.h @@ -13,8 +13,8 @@ #define WIDGETS_MAIN_WIDGET_H /** Widgets of the WC_MAIN_WINDOW. */ -enum MainWindowWidgets { - MW_VIEWPORT, ///< Main window viewport. +enum MainWidgets { + WID_M_VIEWPORT, ///< Main window viewport. }; #endif /* WIDGETS_MAIN_WIDGET_H */ diff --git a/src/widgets/misc_widget.h b/src/widgets/misc_widget.h index b446509e2..13d37da97 100644 --- a/src/widgets/misc_widget.h +++ b/src/widgets/misc_widget.h @@ -14,35 +14,35 @@ /** Widgets of the WC_LAND_INFO. */ enum LandInfoWidgets { - LIW_BACKGROUND, ///< Background to draw on + WID_LI_BACKGROUND, ///< Background of the window. }; /** Widgets of the WC_TOOLTIPS. */ enum ToolTipsWidgets { - TTW_BACKGROUND, ///< Background to draw on + WID_TT_BACKGROUND, ///< Background of the window. }; /** Widgets of the WC_GAME_OPTIONS (WC_GAME_OPTIONS is also used in others). */ enum AboutWidgets { - AW_SCROLLING_TEXT, ///< The actually scrolling text - AW_WEBSITE, ///< URL of OpenTTD website + WID_A_SCROLLING_TEXT, ///< The actually scrolling text. + WID_A_WEBSITE, ///< URL of OpenTTD website. }; /** Widgets of the WC_QUERY_STRING (WC_QUERY_STRING is also used in QueryEditSignWidgets). */ enum QueryStringWidgets { - QUERY_STR_WIDGET_CAPTION, - QUERY_STR_WIDGET_TEXT, - QUERY_STR_WIDGET_DEFAULT, - QUERY_STR_WIDGET_CANCEL, - QUERY_STR_WIDGET_OK + WID_QS_CAPTION, ///< Caption of the window. + WID_QS_TEXT, ///< Text of the query. + WID_QS_DEFAULT, ///< Default button. + WID_QS_CANCEL, ///< Cancel button. + WID_QS_OK ///< OK button. }; /** Widgets of the WC_CONFIRM_POPUP_QUERY (WC_CONFIRM_POPUP_QUERY is also used in BootstrapAskForDownloadWidgets). */ enum QueryWidgets { - QUERY_WIDGET_CAPTION, - QUERY_WIDGET_TEXT, - QUERY_WIDGET_NO, - QUERY_WIDGET_YES + WID_Q_CAPTION, ///< Caption of the window. + WID_Q_TEXT, ///< Text of the query. + WID_Q_NO, ///< Yes button. + WID_Q_YES ///< No button. }; #endif /* WIDGETS_MISC_WIDGET_H */ -- cgit v1.2.3-70-g09d2