diff options
author | truebrain <truebrain@openttd.org> | 2011-12-16 18:21:13 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2011-12-16 18:21:13 +0000 |
commit | e2726ca3f18c41c0ff58d1046374a0d8bbf733d0 (patch) | |
tree | 5a69b58a410b76ce45607888d0dee1a12b633bc7 | |
parent | 9266bde593b359d1dd999a3c84f48f3b6981c983 (diff) | |
download | openttd-e2726ca3f18c41c0ff58d1046374a0d8bbf733d0.tar.xz |
(svn r23547) -Codechange: document and rename widgets to be consistent and understandable
-rw-r--r-- | src/statusbar_gui.cpp | 24 | ||||
-rw-r--r-- | src/subsidy_gui.cpp | 16 | ||||
-rw-r--r-- | src/terraform_gui.cpp | 192 | ||||
-rw-r--r-- | src/timetable_gui.cpp | 102 | ||||
-rw-r--r-- | src/widgets/statusbar_widget.h | 6 | ||||
-rw-r--r-- | src/widgets/subsidy_widget.h | 4 | ||||
-rw-r--r-- | src/widgets/terraform_widget.h | 52 | ||||
-rw-r--r-- | src/widgets/timetable_widget.h | 32 |
8 files changed, 214 insertions, 214 deletions
diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index 667240595..119c928be 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -103,12 +103,12 @@ struct StatusBarWindow : Window { { Dimension d; switch (widget) { - case SBW_LEFT: + case WID_S_LEFT: SetDParam(0, MAX_YEAR * DAYS_IN_YEAR); d = GetStringBoundingBox(STR_WHITE_DATE_LONG); break; - case SBW_RIGHT: { + case WID_S_RIGHT: { int64 max_money = UINT32_MAX; const Company *c; FOR_ALL_COMPANIES(c) max_money = max<int64>(c->money, max_money); @@ -129,13 +129,13 @@ struct StatusBarWindow : Window { virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case SBW_LEFT: + case WID_S_LEFT: /* Draw the date */ SetDParam(0, _date); DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_WHITE_DATE_LONG, TC_FROMSTRING, SA_HOR_CENTER); break; - case SBW_RIGHT: { + case WID_S_RIGHT: { /* Draw company money, if any */ const Company *c = Company::GetIfValid(_local_company); if (c != NULL) { @@ -145,7 +145,7 @@ struct StatusBarWindow : Window { break; } - case SBW_MIDDLE: + case WID_S_MIDDLE: /* Draw status bar */ if (this->saving) { // true when saving is active DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_STATUSBAR_SAVING_GAME, TC_FROMSTRING, SA_HOR_CENTER); @@ -203,8 +203,8 @@ struct StatusBarWindow : Window { virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case SBW_MIDDLE: ShowLastNewsMessage(); break; - case SBW_RIGHT: if (_local_company != COMPANY_SPECTATOR) ShowCompanyFinances(_local_company); break; + case WID_S_MIDDLE: ShowLastNewsMessage(); break; + case WID_S_RIGHT: if (_local_company != COMPANY_SPECTATOR) ShowCompanyFinances(_local_company); break; default: ResetObjectToPlace(); } } @@ -215,23 +215,23 @@ struct StatusBarWindow : Window { if (this->ticker_scroll < TICKER_STOP) { // Scrolling text this->ticker_scroll += COUNTER_STEP; - this->SetWidgetDirty(SBW_MIDDLE); + this->SetWidgetDirty(WID_S_MIDDLE); } if (this->reminder_timeout > REMINDER_STOP) { // Red blot to show there are new unread newsmessages this->reminder_timeout -= COUNTER_STEP; } else if (this->reminder_timeout < REMINDER_STOP) { this->reminder_timeout = REMINDER_STOP; - this->SetWidgetDirty(SBW_MIDDLE); + this->SetWidgetDirty(WID_S_MIDDLE); } } }; static const NWidgetPart _nested_main_status_widgets[] = { NWidget(NWID_HORIZONTAL), - NWidget(WWT_PANEL, COLOUR_GREY, SBW_LEFT), SetMinimalSize(140, 12), EndContainer(), - NWidget(WWT_PUSHBTN, COLOUR_GREY, SBW_MIDDLE), SetMinimalSize(40, 12), SetDataTip(0x0, STR_STATUSBAR_TOOLTIP_SHOW_LAST_NEWS), SetResize(1, 0), - NWidget(WWT_PUSHBTN, COLOUR_GREY, SBW_RIGHT), SetMinimalSize(140, 12), + NWidget(WWT_PANEL, COLOUR_GREY, WID_S_LEFT), SetMinimalSize(140, 12), EndContainer(), + NWidget(WWT_PUSHBTN, COLOUR_GREY, WID_S_MIDDLE), SetMinimalSize(40, 12), SetDataTip(0x0, STR_STATUSBAR_TOOLTIP_SHOW_LAST_NEWS), SetResize(1, 0), + NWidget(WWT_PUSHBTN, COLOUR_GREY, WID_S_RIGHT), SetMinimalSize(140, 12), EndContainer(), }; diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index 4d67bd53f..ae11c8482 100644 --- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -32,16 +32,16 @@ struct SubsidyListWindow : Window { SubsidyListWindow(const WindowDesc *desc, WindowNumber window_number) : Window() { this->CreateNestedTree(desc); - this->vscroll = this->GetScrollbar(SULW_SCROLLBAR); + this->vscroll = this->GetScrollbar(WID_SUL_SCROLLBAR); this->FinishInitNested(desc, window_number); this->OnInvalidateData(0); } virtual void OnClick(Point pt, int widget, int click_count) { - if (widget != SULW_PANEL) return; + if (widget != WID_SUL_PANEL) return; - int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, SULW_PANEL, WD_FRAMERECT_TOP); + int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_SUL_PANEL, WD_FRAMERECT_TOP); int num = 0; const Subsidy *s; FOR_ALL_SUBSIDIES(s) { @@ -130,7 +130,7 @@ struct SubsidyListWindow : Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { - if (widget != SULW_PANEL) return; + if (widget != WID_SUL_PANEL) return; Dimension d = maxdim(GetStringBoundingBox(STR_SUBSIDIES_OFFERED_TITLE), GetStringBoundingBox(STR_SUBSIDIES_SUBSIDISED_TITLE)); resize->height = d.height; @@ -143,7 +143,7 @@ struct SubsidyListWindow : Window { virtual void DrawWidget(const Rect &r, int widget) const { - if (widget != SULW_PANEL) return; + if (widget != WID_SUL_PANEL) return; YearMonthDay ymd; ConvertDateToYMD(_date, &ymd); @@ -208,7 +208,7 @@ struct SubsidyListWindow : Window { virtual void OnResize() { - this->vscroll->SetCapacityFromWidget(this, SULW_PANEL); + this->vscroll->SetCapacityFromWidget(this, WID_SUL_PANEL); } /** @@ -231,9 +231,9 @@ static const NWidgetPart _nested_subsidies_list_widgets[] = { NWidget(WWT_STICKYBOX, COLOUR_BROWN), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PANEL, COLOUR_BROWN, SULW_PANEL), SetDataTip(0x0, STR_SUBSIDIES_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER), SetResize(1, 1), SetScrollbar(SULW_SCROLLBAR), EndContainer(), + NWidget(WWT_PANEL, COLOUR_BROWN, WID_SUL_PANEL), SetDataTip(0x0, STR_SUBSIDIES_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER), SetResize(1, 1), SetScrollbar(WID_SUL_SCROLLBAR), EndContainer(), NWidget(NWID_VERTICAL), - NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, SULW_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, WID_SUL_SCROLLBAR), NWidget(WWT_RESIZEBOX, COLOUR_BROWN), EndContainer(), EndContainer(), diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 8e0024752..587135230 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -162,55 +162,55 @@ struct TerraformToolbarWindow : Window { virtual void OnInit() { /* Don't show the place object button when there are no objects to place. */ - NWidgetStacked *show_object = this->GetWidget<NWidgetStacked>(TTW_SHOW_PLACE_OBJECT); + NWidgetStacked *show_object = this->GetWidget<NWidgetStacked>(WID_TT_SHOW_PLACE_OBJECT); show_object->SetDisplayedPlane(ObjectClass::GetCount() != 0 ? 0 : SZSP_NONE); } virtual void OnClick(Point pt, int widget, int click_count) { - if (widget < TTW_BUTTONS_START) return; + if (widget < WID_TT_BUTTONS_START) return; switch (widget) { - case TTW_LOWER_LAND: // Lower land button - HandlePlacePushButton(this, TTW_LOWER_LAND, ANIMCURSOR_LOWERLAND, HT_POINT | HT_DIAGONAL); + case WID_TT_LOWER_LAND: // Lower land button + HandlePlacePushButton(this, WID_TT_LOWER_LAND, ANIMCURSOR_LOWERLAND, HT_POINT | HT_DIAGONAL); this->last_user_action = widget; break; - case TTW_RAISE_LAND: // Raise land button - HandlePlacePushButton(this, TTW_RAISE_LAND, ANIMCURSOR_RAISELAND, HT_POINT | HT_DIAGONAL); + case WID_TT_RAISE_LAND: // Raise land button + HandlePlacePushButton(this, WID_TT_RAISE_LAND, ANIMCURSOR_RAISELAND, HT_POINT | HT_DIAGONAL); this->last_user_action = widget; break; - case TTW_LEVEL_LAND: // Level land button - HandlePlacePushButton(this, TTW_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL); + case WID_TT_LEVEL_LAND: // Level land button + HandlePlacePushButton(this, WID_TT_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL); this->last_user_action = widget; break; - case TTW_DEMOLISH: // Demolish aka dynamite button - HandlePlacePushButton(this, TTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL); + case WID_TT_DEMOLISH: // Demolish aka dynamite button + HandlePlacePushButton(this, WID_TT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL); this->last_user_action = widget; break; - case TTW_BUY_LAND: // Buy land button - HandlePlacePushButton(this, TTW_BUY_LAND, SPR_CURSOR_BUY_LAND, HT_RECT); + case WID_TT_BUY_LAND: // Buy land button + HandlePlacePushButton(this, WID_TT_BUY_LAND, SPR_CURSOR_BUY_LAND, HT_RECT); this->last_user_action = widget; break; - case TTW_PLANT_TREES: // Plant trees button + case WID_TT_PLANT_TREES: // Plant trees button /* This button is NOT a place-push-button, so don't treat it as such */ - this->HandleButtonClick(TTW_PLANT_TREES); + this->HandleButtonClick(WID_TT_PLANT_TREES); ShowBuildTreesToolbar(); break; - case TTW_PLACE_SIGN: // Place sign button - HandlePlacePushButton(this, TTW_PLACE_SIGN, SPR_CURSOR_SIGN, HT_RECT); + case WID_TT_PLACE_SIGN: // Place sign button + HandlePlacePushButton(this, WID_TT_PLACE_SIGN, SPR_CURSOR_SIGN, HT_RECT); this->last_user_action = widget; break; - case TTW_PLACE_OBJECT: // Place object button + case WID_TT_PLACE_OBJECT: // Place object button /* Don't show the place object button when there are no objects to place. */ if (ObjectClass::GetCount() == 0) return; - if (HandlePlacePushButton(this, TTW_PLACE_OBJECT, SPR_CURSOR_TRANSMITTER, HT_RECT)) { + if (HandlePlacePushButton(this, WID_TT_PLACE_OBJECT, SPR_CURSOR_TRANSMITTER, HT_RECT)) { ShowBuildObjectPicker(this); this->last_user_action = widget; } @@ -222,8 +222,8 @@ struct TerraformToolbarWindow : Window { virtual void OnTimeout() { - this->RaiseWidget(TTW_PLANT_TREES); - this->SetWidgetDirty(TTW_PLANT_TREES); + this->RaiseWidget(WID_TT_PLANT_TREES); + this->SetWidgetDirty(WID_TT_PLANT_TREES); } virtual EventState OnKeyPress(uint16 key, uint16 keycode) @@ -237,31 +237,31 @@ struct TerraformToolbarWindow : Window { virtual void OnPlaceObject(Point pt, TileIndex tile) { switch (this->last_user_action) { - case TTW_LOWER_LAND: // Lower land button + case WID_TT_LOWER_LAND: // Lower land button VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_LOWER_AND_LEVEL_AREA); break; - case TTW_RAISE_LAND: // Raise land button + case WID_TT_RAISE_LAND: // Raise land button VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_RAISE_AND_LEVEL_AREA); break; - case TTW_LEVEL_LAND: // Level land button + case WID_TT_LEVEL_LAND: // Level land button VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_LEVEL_AREA); break; - case TTW_DEMOLISH: // Demolish aka dynamite button + case WID_TT_DEMOLISH: // Demolish aka dynamite button PlaceProc_DemolishArea(tile); break; - case TTW_BUY_LAND: // Buy land button + case WID_TT_BUY_LAND: // Buy land button DoCommandP(tile, OBJECT_OWNED_LAND, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_PURCHASE_THIS_LAND), CcPlaySound1E); break; - case TTW_PLACE_SIGN: // Place sign button + case WID_TT_PLACE_SIGN: // Place sign button PlaceProc_Sign(tile); break; - case TTW_PLACE_OBJECT: // Place object button + case WID_TT_PLACE_OBJECT: // Place object button PlaceProc_Object(tile); break; @@ -306,14 +306,14 @@ struct TerraformToolbarWindow : Window { }; Hotkey<TerraformToolbarWindow> TerraformToolbarWindow::terraform_hotkeys[] = { - Hotkey<TerraformToolbarWindow>('Q' | WKC_GLOBAL_HOTKEY, "lower", TTW_LOWER_LAND), - Hotkey<TerraformToolbarWindow>('W' | WKC_GLOBAL_HOTKEY, "raise", TTW_RAISE_LAND), - Hotkey<TerraformToolbarWindow>('E' | WKC_GLOBAL_HOTKEY, "level", TTW_LEVEL_LAND), - Hotkey<TerraformToolbarWindow>('D' | WKC_GLOBAL_HOTKEY, "dynamite", TTW_DEMOLISH), - Hotkey<TerraformToolbarWindow>('U', "buyland", TTW_BUY_LAND), - Hotkey<TerraformToolbarWindow>('I', "trees", TTW_PLANT_TREES), - Hotkey<TerraformToolbarWindow>('O', "placesign", TTW_PLACE_SIGN), - Hotkey<TerraformToolbarWindow>('P', "placeobject", TTW_PLACE_OBJECT), + Hotkey<TerraformToolbarWindow>('Q' | WKC_GLOBAL_HOTKEY, "lower", WID_TT_LOWER_LAND), + Hotkey<TerraformToolbarWindow>('W' | WKC_GLOBAL_HOTKEY, "raise", WID_TT_RAISE_LAND), + Hotkey<TerraformToolbarWindow>('E' | WKC_GLOBAL_HOTKEY, "level", WID_TT_LEVEL_LAND), + Hotkey<TerraformToolbarWindow>('D' | WKC_GLOBAL_HOTKEY, "dynamite", WID_TT_DEMOLISH), + Hotkey<TerraformToolbarWindow>('U', "buyland", WID_TT_BUY_LAND), + Hotkey<TerraformToolbarWindow>('I', "trees", WID_TT_PLANT_TREES), + Hotkey<TerraformToolbarWindow>('O', "placesign", WID_TT_PLACE_SIGN), + Hotkey<TerraformToolbarWindow>('P', "placeobject", WID_TT_PLACE_OBJECT), HOTKEY_LIST_END(TerraformToolbarWindow) }; Hotkey<TerraformToolbarWindow> *_terraform_hotkeys = TerraformToolbarWindow::terraform_hotkeys; @@ -325,25 +325,25 @@ static const NWidgetPart _nested_terraform_widgets[] = { NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_LOWER_LAND), SetMinimalSize(22, 22), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_LOWER_LAND), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TERRAFORM_DOWN, STR_LANDSCAPING_TOOLTIP_LOWER_A_CORNER_OF_LAND), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_RAISE_LAND), SetMinimalSize(22, 22), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_RAISE_LAND), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TERRAFORM_UP, STR_LANDSCAPING_TOOLTIP_RAISE_A_CORNER_OF_LAND), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_LEVEL_LAND), SetMinimalSize(22, 22), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_LEVEL_LAND), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_LEVEL_LAND, STR_LANDSCAPING_LEVEL_LAND_TOOLTIP), NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(4, 22), EndContainer(), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_DEMOLISH), SetMinimalSize(22, 22), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_BUY_LAND), SetMinimalSize(22, 22), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_BUY_LAND), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUY_LAND, STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_PLANT_TREES), SetMinimalSize(22, 22), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_PLANT_TREES), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_PLANTTREES, STR_SCENEDIT_TOOLBAR_PLANT_TREES), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_PLACE_SIGN), SetMinimalSize(22, 22), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_PLACE_SIGN), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SIGN, STR_SCENEDIT_TOOLBAR_PLACE_SIGN), - NWidget(NWID_SELECTION, INVALID_COLOUR, TTW_SHOW_PLACE_OBJECT), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, TTW_PLACE_OBJECT), SetMinimalSize(22, 22), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_TT_SHOW_PLACE_OBJECT), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_PLACE_OBJECT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TRANSMITTER, STR_SCENEDIT_TOOLBAR_PLACE_OBJECT), EndContainer(), EndContainer(), @@ -465,41 +465,41 @@ static const NWidgetPart _nested_scen_edit_land_gen_widgets[] = { NWidget(WWT_PANEL, COLOUR_DARK_GREEN), NWidget(NWID_HORIZONTAL), SetPadding(2, 2, 7, 2), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_IMGBTN, COLOUR_GREY, ETTW_DEMOLISH), SetMinimalSize(22, 22), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), - NWidget(WWT_IMGBTN, COLOUR_GREY, ETTW_LOWER_LAND), SetMinimalSize(22, 22), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_LOWER_LAND), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TERRAFORM_DOWN, STR_LANDSCAPING_TOOLTIP_LOWER_A_CORNER_OF_LAND), - NWidget(WWT_IMGBTN, COLOUR_GREY, ETTW_RAISE_LAND), SetMinimalSize(22, 22), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_RAISE_LAND), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TERRAFORM_UP, STR_LANDSCAPING_TOOLTIP_RAISE_A_CORNER_OF_LAND), - NWidget(WWT_IMGBTN, COLOUR_GREY, ETTW_LEVEL_LAND), SetMinimalSize(22, 22), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_LEVEL_LAND), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_LEVEL_LAND, STR_LANDSCAPING_LEVEL_LAND_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_GREY, ETTW_PLACE_ROCKS), SetMinimalSize(22, 22), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_PLACE_ROCKS), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_ROCKS, STR_TERRAFORM_TOOLTIP_PLACE_ROCKY_AREAS_ON_LANDSCAPE), - NWidget(NWID_SELECTION, INVALID_COLOUR, ETTW_SHOW_PLACE_DESERT), - NWidget(WWT_IMGBTN, COLOUR_GREY, ETTW_PLACE_DESERT), SetMinimalSize(22, 22), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_ETT_SHOW_PLACE_DESERT), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_PLACE_DESERT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DESERT, STR_TERRAFORM_TOOLTIP_DEFINE_DESERT_AREA), EndContainer(), - NWidget(WWT_IMGBTN, COLOUR_GREY, ETTW_PLACE_OBJECT), SetMinimalSize(23, 22), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_PLACE_OBJECT), SetMinimalSize(23, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TRANSMITTER, STR_SCENEDIT_TOOLBAR_PLACE_OBJECT), NWidget(NWID_SPACER), SetFill(1, 0), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(NWID_SPACER), SetFill(1, 0), - NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, ETTW_DOTS), SetMinimalSize(59, 31), SetDataTip(STR_EMPTY, STR_NULL), + NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_ETT_DOTS), SetMinimalSize(59, 31), SetDataTip(STR_EMPTY, STR_NULL), NWidget(NWID_SPACER), SetFill(1, 0), NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetFill(0, 1), - NWidget(WWT_IMGBTN, COLOUR_GREY, ETTW_INCREASE_SIZE), SetMinimalSize(12, 12), SetDataTip(SPR_ARROW_UP, STR_TERRAFORM_TOOLTIP_INCREASE_SIZE_OF_LAND_AREA), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_INCREASE_SIZE), SetMinimalSize(12, 12), SetDataTip(SPR_ARROW_UP, STR_TERRAFORM_TOOLTIP_INCREASE_SIZE_OF_LAND_AREA), NWidget(NWID_SPACER), SetMinimalSize(0, 1), - NWidget(WWT_IMGBTN, COLOUR_GREY, ETTW_DECREASE_SIZE), SetMinimalSize(12, 12), SetDataTip(SPR_ARROW_DOWN, STR_TERRAFORM_TOOLTIP_DECREASE_SIZE_OF_LAND_AREA), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_ETT_DECREASE_SIZE), SetMinimalSize(12, 12), SetDataTip(SPR_ARROW_DOWN, STR_TERRAFORM_TOOLTIP_DECREASE_SIZE_OF_LAND_AREA), NWidget(NWID_SPACER), SetFill(0, 1), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(2, 0), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 6), - NWidget(WWT_TEXTBTN, COLOUR_GREY, ETTW_NEW_SCENARIO), SetMinimalSize(160, 12), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_ETT_NEW_SCENARIO), SetMinimalSize(160, 12), SetFill(1, 0), SetDataTip(STR_TERRAFORM_SE_NEW_WORLD, STR_TERRAFORM_TOOLTIP_GENERATE_RANDOM_LAND), SetPadding(0, 2, 0, 2), - NWidget(WWT_TEXTBTN, COLOUR_GREY, ETTW_RESET_LANDSCAPE), SetMinimalSize(160, 12), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_ETT_RESET_LANDSCAPE), SetMinimalSize(160, 12), SetFill(1, 0), SetDataTip(STR_TERRAFORM_RESET_LANDSCAPE, STR_TERRAFORM_RESET_LANDSCAPE_TOOLTIP), SetPadding(1, 2, 2, 2), EndContainer(), }; @@ -547,7 +547,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { ScenarioEditorLandscapeGenerationWindow(const WindowDesc *desc, WindowNumber window_number) : Window() { this->CreateNestedTree(desc); - NWidgetStacked *show_desert = this->GetWidget<NWidgetStacked>(ETTW_SHOW_PLACE_DESERT); + NWidgetStacked *show_desert = this->GetWidget<NWidgetStacked>(WID_ETT_SHOW_PLACE_DESERT); show_desert->SetDisplayedPlane(_settings_game.game_creation.landscape == LT_TROPIC ? 0 : SZSP_NONE); this->FinishInitNested(desc, window_number); this->last_user_action = WIDGET_LIST_END; @@ -557,14 +557,14 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { { this->DrawWidgets(); - if (this->IsWidgetLowered(ETTW_LOWER_LAND) || this->IsWidgetLowered(ETTW_RAISE_LAND)) { // change area-size if raise/lower corner is selected + if (this->IsWidgetLowered(WID_ETT_LOWER_LAND) || this->IsWidgetLowered(WID_ETT_RAISE_LAND)) { // change area-size if raise/lower corner is selected SetTileSelectSize(_terraform_size, _terraform_size); } } virtual void DrawWidget(const Rect &r, int widget) const { - if (widget != ETTW_DOTS) return; + if (widget != WID_ETT_DOTS) return; int center_x = RoundDivSU(r.left + r.right, 2); int center_y = RoundDivSU(r.top + r.bottom, 2); @@ -589,49 +589,49 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { virtual void OnClick(Point pt, int widget, int click_count) { - if (widget < ETTW_BUTTONS_START) return; + if (widget < WID_ETT_BUTTONS_START) return; switch (widget) { - case ETTW_DEMOLISH: // Demolish aka dynamite button - HandlePlacePushButton(this, ETTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL); + case WID_ETT_DEMOLISH: // Demolish aka dynamite button + HandlePlacePushButton(this, WID_ETT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL); this->last_user_action = widget; break; - case ETTW_LOWER_LAND: // Lower land button - HandlePlacePushButton(this, ETTW_LOWER_LAND, ANIMCURSOR_LOWERLAND, HT_POINT); + case WID_ETT_LOWER_LAND: // Lower land button + HandlePlacePushButton(this, WID_ETT_LOWER_LAND, ANIMCURSOR_LOWERLAND, HT_POINT); this->last_user_action = widget; break; - case ETTW_RAISE_LAND: // Raise land button - HandlePlacePushButton(this, ETTW_RAISE_LAND, ANIMCURSOR_RAISELAND, HT_POINT); + case WID_ETT_RAISE_LAND: // Raise land button + HandlePlacePushButton(this, WID_ETT_RAISE_LAND, ANIMCURSOR_RAISELAND, HT_POINT); this->last_user_action = widget; break; - case ETTW_LEVEL_LAND: // Level land button - HandlePlacePushButton(this, ETTW_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL); + case WID_ETT_LEVEL_LAND: // Level land button + HandlePlacePushButton(this, WID_ETT_LEVEL_LAND, SPR_CURSOR_LEVEL_LAND, HT_POINT | HT_DIAGONAL); this->last_user_action = widget; break; - case ETTW_PLACE_ROCKS: // Place rocks button - HandlePlacePushButton(this, ETTW_PLACE_ROCKS, SPR_CURSOR_ROCKY_AREA, HT_RECT); + case WID_ETT_PLACE_ROCKS: // Place rocks button + HandlePlacePushButton(this, WID_ETT_PLACE_ROCKS, SPR_CURSOR_ROCKY_AREA, HT_RECT); this->last_user_action = widget; break; - case ETTW_PLACE_DESERT: // Place desert button (in tropical climate) - HandlePlacePushButton(this, ETTW_PLACE_DESERT, SPR_CURSOR_DESERT, HT_RECT); + case WID_ETT_PLACE_DESERT: // Place desert button (in tropical climate) + HandlePlacePushButton(this, WID_ETT_PLACE_DESERT, SPR_CURSOR_DESERT, HT_RECT); this->last_user_action = widget; break; - case ETTW_PLACE_OBJECT: // Place transmitter button - if (HandlePlacePushButton(this, ETTW_PLACE_OBJECT, SPR_CURSOR_TRANSMITTER, HT_RECT)) { + case WID_ETT_PLACE_OBJECT: // Place transmitter button + if (HandlePlacePushButton(this, WID_ETT_PLACE_OBJECT, SPR_CURSOR_TRANSMITTER, HT_RECT)) { ShowBuildObjectPicker(this); this->last_user_action = widget; } break; - case ETTW_INCREASE_SIZE: - case ETTW_DECREASE_SIZE: { // Increase/Decrease terraform size - int size = (widget == ETTW_INCREASE_SIZE) ? 1 : -1; + case WID_ETT_INCREASE_SIZE: + case WID_ETT_DECREASE_SIZE: { // Increase/Decrease terraform size + int size = (widget == WID_ETT_INCREASE_SIZE) ? 1 : -1; this->HandleButtonClick(widget); size += _terraform_size; @@ -643,12 +643,12 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { break; } - case ETTW_NEW_SCENARIO: // gen random land + case WID_ETT_NEW_SCENARIO: // gen random land this->HandleButtonClick(widget); ShowCreateScenario(); break; - case ETTW_RESET_LANDSCAPE: // Reset landscape + case WID_ETT_RESET_LANDSCAPE: // Reset landscape ShowQuery(STR_QUERY_RESET_LANDSCAPE_CAPTION, STR_RESET_LANDSCAPE_CONFIRMATION_TEXT, NULL, ResetLandscapeConfirmationCallback); break; @@ -658,8 +658,8 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { virtual void OnTimeout() { - for (uint i = ETTW_START; i < this->nested_array_size; i++) { - if (i == ETTW_BUTTONS_START) i = ETTW_BUTTONS_END; // skip the buttons + for (uint i = WID_ETT_START; i < this->nested_array_size; i++) { + if (i == WID_ETT_BUTTONS_START) i = WID_ETT_BUTTONS_END; // skip the buttons if (this->IsWidgetLowered(i)) { this->RaiseWidget(i); this->SetWidgetDirty(i); @@ -670,31 +670,31 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { virtual void OnPlaceObject(Point pt, TileIndex tile) { switch (this->last_user_action) { - case ETTW_DEMOLISH: // Demolish aka dynamite button + case WID_ETT_DEMOLISH: // Demolish aka dynamite button PlaceProc_DemolishArea(tile); break; - case ETTW_LOWER_LAND: // Lower land button + case WID_ETT_LOWER_LAND: // Lower land button CommonRaiseLowerBigLand(tile, 0); break; - case ETTW_RAISE_LAND: // Raise land button + case WID_ETT_RAISE_LAND: // Raise land button CommonRaiseLowerBigLand(tile, 1); break; - case ETTW_LEVEL_LAND: // Level land button + case WID_ETT_LEVEL_LAND: // Level land button VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_LEVEL_AREA); break; - case ETTW_PLACE_ROCKS: // Place rocks button + case WID_ETT_PLACE_ROCKS: // Place rocks button VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_ROCKS); break; - case ETTW_PLACE_DESERT: // Place desert button (in tropical climate) + case WID_ETT_PLACE_DESERT: // Place desert button (in tropical climate) VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_DESERT); break; - case ETTW_PLACE_OBJECT: // Place transmitter button + case WID_ETT_PLACE_OBJECT: // Place transmitter button PlaceProc_Object(tile); break; @@ -735,13 +735,13 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { }; Hotkey<ScenarioEditorLandscapeGenerationWindow> ScenarioEditorLandscapeGenerationWindow::terraform_editor_hotkeys[] = { - Hotkey<ScenarioEditorLandscapeGenerationWindow>('D' | WKC_GLOBAL_HOTKEY, "dynamite", ETTW_DEMOLISH), - Hotkey<ScenarioEditorLandscapeGenerationWindow>('Q' | WKC_GLOBAL_HOTKEY, "lower", ETTW_LOWER_LAND), - Hotkey<ScenarioEditorLandscapeGenerationWindow>('W' | WKC_GLOBAL_HOTKEY, "raise", ETTW_RAISE_LAND), - Hotkey<ScenarioEditorLandscapeGenerationWindow>('E' | WKC_GLOBAL_HOTKEY, "level", ETTW_LEVEL_LAND), - Hotkey<ScenarioEditorLandscapeGenerationWindow>('R', "rocky", ETTW_PLACE_ROCKS), - Hotkey<ScenarioEditorLandscapeGenerationWindow>('T', "desert", ETTW_PLACE_DESERT), - Hotkey<ScenarioEditorLandscapeGenerationWindow>('O', "object", ETTW_PLACE_OBJECT), + Hotkey<ScenarioEditorLandscapeGenerationWindow>('D' | WKC_GLOBAL_HOTKEY, "dynamite", WID_ETT_DEMOLISH), + Hotkey<ScenarioEditorLandscapeGenerationWindow>('Q' | WKC_GLOBAL_HOTKEY, "lower", WID_ETT_LOWER_LAND), + Hotkey<ScenarioEditorLandscapeGenerationWindow>('W' | WKC_GLOBAL_HOTKEY, "raise", WID_ETT_RAISE_LAND), + Hotkey<ScenarioEditorLandscapeGenerationWindow>('E' | WKC_GLOBAL_HOTKEY, "level", WID_ETT_LEVEL_LAND), + Hotkey<ScenarioEditorLandscapeGenerationWindow>('R', "rocky", WID_ETT_PLACE_ROCKS), + Hotkey<ScenarioEditorLandscapeGenerationWindow>('T', "desert", WID_ETT_PLACE_DESERT), + Hotkey<ScenarioEditorLandscapeGenerationWindow>('O', "object", WID_ETT_PLACE_OBJECT), HOTKEY_LIST_END(ScenarioEditorLandscapeGenerationWindow) }; diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index a3b53fff3..737b483a1 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -170,7 +170,7 @@ struct TimetableWindow : Window { show_expected(true) { this->CreateNestedTree(desc); - this->vscroll = this->GetScrollbar(TTV_SCROLLBAR); + this->vscroll = this->GetScrollbar(WID_TV_SCROLLBAR); this->UpdateSelectionStates(); this->FinishInitNested(desc, window_number); @@ -198,19 +198,19 @@ struct TimetableWindow : Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case TTV_ARRIVAL_DEPARTURE_PANEL: + case WID_TV_ARRIVAL_DEPARTURE_PANEL: SetDParam(0, MAX_YEAR * DAYS_IN_YEAR); this->deparr_time_width = GetStringBoundingBox(STR_JUST_DATE_TINY).width; this->deparr_abbr_width = max(GetStringBoundingBox(STR_TIMETABLE_ARRIVAL_ABBREVIATION).width, GetStringBoundingBox(STR_TIMETABLE_DEPARTURE_ABBREVIATION).width); size->width = WD_FRAMERECT_LEFT + this->deparr_abbr_width + 10 + this->deparr_time_width + WD_FRAMERECT_RIGHT; /* FALL THROUGH */ - case TTV_ARRIVAL_DEPARTURE_SELECTION: - case TTV_TIMETABLE_PANEL: + case WID_TV_ARRIVAL_DEPARTURE_SELECTION: + case WID_TV_TIMETABLE_PANEL: resize->height = FONT_HEIGHT_NORMAL; size->height = WD_FRAMERECT_TOP + 8 * resize->height + WD_FRAMERECT_BOTTOM; break; - case TTV_SUMMARY_PANEL: + case WID_TV_SUMMARY_PANEL: size->height = WD_FRAMERECT_TOP + 2 * FONT_HEIGHT_NORMAL + WD_FRAMERECT_BOTTOM; break; } @@ -218,7 +218,7 @@ struct TimetableWindow : Window { int GetOrderFromTimetableWndPt(int y, const Vehicle *v) { - int sel = (y - this->GetWidget<NWidgetBase>(TTV_TIMETABLE_PANEL)->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL; + int sel = (y - this->GetWidget<NWidgetBase>(WID_TV_TIMETABLE_PANEL)->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL; if ((uint)sel >= this->vscroll->GetCapacity()) return INVALID_ORDER; @@ -320,23 +320,23 @@ struct TimetableWindow : Window { } } - this->SetWidgetDisabledState(TTV_CHANGE_TIME, disable); - this->SetWidgetDisabledState(TTV_CLEAR_TIME, disable); - this->SetWidgetDisabledState(TTV_SHARED_ORDER_LIST, !v->IsOrderListShared()); + this->SetWidgetDisabledState(WID_TV_CHANGE_TIME, disable); + this->SetWidgetDisabledState(WID_TV_CLEAR_TIME, disable); + this->SetWidgetDisabledState(WID_TV_SHARED_ORDER_LIST, !v->IsOrderListShared()); - this->EnableWidget(TTV_START_DATE); - this->EnableWidget(TTV_RESET_LATENESS); - this->EnableWidget(TTV_AUTOFILL); + this->EnableWidget(WID_TV_START_DATE); + this->EnableWidget(WID_TV_RESET_LATENESS); + this->EnableWidget(WID_TV_AUTOFILL); } else { - this->DisableWidget(TTV_START_DATE); - this->DisableWidget(TTV_CHANGE_TIME); - this->DisableWidget(TTV_CLEAR_TIME); - this->DisableWidget(TTV_RESET_LATENESS); - this->DisableWidget(TTV_AUTOFILL); - this->DisableWidget(TTV_SHARED_ORDER_LIST); + this->DisableWidget(WID_TV_START_DATE); + this->DisableWidget(WID_TV_CHANGE_TIME); + this->DisableWidget(WID_TV_CLEAR_TIME); + this->DisableWidget(WID_TV_RESET_LATENESS); + this->DisableWidget(WID_TV_AUTOFILL); + this->DisableWidget(WID_TV_SHARED_ORDER_LIST); } - this->SetWidgetLoweredState(TTV_AUTOFILL, HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE)); + this->SetWidgetLoweredState(WID_TV_AUTOFILL, HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE)); this->DrawWidgets(); } @@ -344,8 +344,8 @@ struct TimetableWindow : Window { virtual void SetStringParameters(int widget) const { switch (widget) { - case TTV_CAPTION: SetDParam(0, this->vehicle->index); break; - case TTV_EXPECTED: SetDParam(0, this->show_expected ? STR_TIMETABLE_EXPECTED : STR_TIMETABLE_SCHEDULED); break; + case WID_TV_CAPTION: SetDParam(0, this->vehicle->index); break; + case WID_TV_EXPECTED: SetDParam(0, this->show_expected ? STR_TIMETABLE_EXPECTED : STR_TIMETABLE_SCHEDULED); break; } } @@ -355,7 +355,7 @@ struct TimetableWindow : Window { int selected = this->sel_index; switch (widget) { - case TTV_TIMETABLE_PANEL: { + case WID_TV_TIMETABLE_PANEL: { int y = r.top + WD_FRAMERECT_TOP; int i = this->vscroll->GetPosition(); VehicleOrderID order_id = (i + 1) / 2; @@ -408,7 +408,7 @@ struct TimetableWindow : Window { break; } - case TTV_ARRIVAL_DEPARTURE_PANEL: { + case WID_TV_ARRIVAL_DEPARTURE_PANEL: { /* Arrival and departure times are handled in an all-or-nothing approach, * i.e. are only shown if we can calculate all times. * Excluding order lists with only one order makes some things easier. @@ -459,7 +459,7 @@ struct TimetableWindow : Window { break; } - case TTV_SUMMARY_PANEL: { + case WID_TV_SUMMARY_PANEL: { int y = r.top + WD_FRAMERECT_TOP; Ticks total_time = v->orders.list != NULL ? v->orders.list->GetTimetableDurationIncomplete() : 0; @@ -505,11 +505,11 @@ struct TimetableWindow : Window { const Vehicle *v = this->vehicle; switch (widget) { - case TTV_ORDER_VIEW: // Order view button + case WID_TV_ORDER_VIEW: // Order view button ShowOrdersWindow(v); break; - case TTV_TIMETABLE_PANEL: { // Main panel. + case WID_TV_TIMETABLE_PANEL: { // Main panel. int selected = GetOrderFromTimetableWndPt(pt.y, v); this->DeleteChildWindows(); @@ -517,11 +517,11 @@ struct TimetableWindow : Window { break; } - case TTV_START_DATE: // Change the date that the timetable starts. + case WID_TV_START_DATE: // Change the date that the timetable starts. ShowSetDateWindow(this, v->index, _date, _cur_year, _cur_year + 15, ChangeTimetableStartCallback); break; - case TTV_CHANGE_TIME: { // "Wait For" button. + case WID_TV_CHANGE_TIME: { // "Wait For" button. int selected = this->sel_index; VehicleOrderID real = (selected + 1) / 2; @@ -544,17 +544,17 @@ struct TimetableWindow : Window { break; } - case TTV_CLEAR_TIME: { // Clear waiting time button. + case WID_TV_CLEAR_TIME: { // Clear waiting time button. uint32 p1 = PackTimetableArgs(v, this->sel_index); DoCommandP(0, p1, 0, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE)); break; } - case TTV_RESET_LATENESS: // Reset the vehicle's late counter. + case WID_TV_RESET_LATENESS: // Reset the vehicle's late counter. DoCommandP(0, v->index, 0, CMD_SET_VEHICLE_ON_TIME | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE)); break; - case TTV_AUTOFILL: { // Autofill the timetable. + case WID_TV_AUTOFILL: { // Autofill the timetable. uint32 p2 = 0; if (!HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE)) SetBit(p2, 0); if (_ctrl_pressed) SetBit(p2, 1); @@ -562,11 +562,11 @@ struct TimetableWindow : Window { break; } - case TTV_EXPECTED: + case WID_TV_EXPECTED: this->show_expected = !this->show_expected; break; - case TTV_SHARED_ORDER_LIST: + case WID_TV_SHARED_ORDER_LIST: ShowVehicleListWindow(v); break; } @@ -593,7 +593,7 @@ struct TimetableWindow : Window { virtual void OnResize() { /* Update the scroll bar */ - this->vscroll->SetCapacityFromWidget(this, TTV_TIMETABLE_PANEL, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM); + this->vscroll->SetCapacityFromWidget(this, WID_TV_TIMETABLE_PANEL, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM); } /** @@ -601,47 +601,47 @@ struct TimetableWindow : Window { */ void UpdateSelectionStates() { - this->GetWidget<NWidgetStacked>(TTV_ARRIVAL_DEPARTURE_SELECTION)->SetDisplayedPlane(_settings_client.gui.timetable_arrival_departure ? 0 : SZSP_NONE); - this->GetWidget<NWidgetStacked>(TTV_EXPECTED_SELECTION)->SetDisplayedPlane(_settings_client.gui.timetable_arrival_departure ? 0 : 1); + this->GetWidget<NWidgetStacked>(WID_TV_ARRIVAL_DEPARTURE_SELECTION)->SetDisplayedPlane(_settings_client.gui.timetable_arrival_departure ? 0 : SZSP_NONE); + this->GetWidget<NWidgetStacked>(WID_TV_EXPECTED_SELECTION)->SetDisplayedPlane(_settings_client.gui.timetable_arrival_departure ? 0 : 1); } }; static const NWidgetPart _nested_timetable_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, TTV_CAPTION), SetDataTip(STR_TIMETABLE_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TTV_ORDER_VIEW), SetMinimalSize(61, 14), SetDataTip( STR_TIMETABLE_ORDER_VIEW, STR_TIMETABLE_ORDER_VIEW_TOOLTIP), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_TV_CAPTION), SetDataTip(STR_TIMETABLE_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TV_ORDER_VIEW), SetMinimalSize(61, 14), SetDataTip( STR_TIMETABLE_ORDER_VIEW, STR_TIMETABLE_ORDER_VIEW_TOOLTIP), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PANEL, COLOUR_GREY, TTV_TIMETABLE_PANEL), SetMinimalSize(388, 82), SetResize(1, 10), SetDataTip(STR_NULL, STR_TIMETABLE_TOOLTIP), SetScrollbar(TTV_SCROLLBAR), EndContainer(), - NWidget(NWID_SELECTION, INVALID_COLOUR, TTV_ARRIVAL_DEPARTURE_SELECTION), - NWidget(WWT_PANEL, COLOUR_GREY, TTV_ARRIVAL_DEPARTURE_PANEL), SetMinimalSize(110, 0), SetFill(0, 1), SetDataTip(STR_NULL, STR_TIMETABLE_TOOLTIP), SetScrollbar(TTV_SCROLLBAR), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_TV_TIMETABLE_PANEL), SetMinimalSize(388, 82), SetResize(1, 10), SetDataTip(STR_NULL, STR_TIMETABLE_TOOLTIP), SetScrollbar(WID_TV_SCROLLBAR), EndContainer(), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_TV_ARRIVAL_DEPARTURE_SELECTION), + NWidget(WWT_PANEL, COLOUR_GREY, WID_TV_ARRIVAL_DEPARTURE_PANEL), SetMinimalSize(110, 0), SetFill(0, 1), SetDataTip(STR_NULL, STR_TIMETABLE_TOOLTIP), SetScrollbar(WID_TV_SCROLLBAR), EndContainer(), EndContainer(), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, TTV_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_TV_SCROLLBAR), EndContainer(), - NWidget(WWT_PANEL, COLOUR_GREY, TTV_SUMMARY_PANEL), SetMinimalSize(400, 22), SetResize(1, 0), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, WID_TV_SUMMARY_PANEL), SetMinimalSize(400, 22), SetResize(1, 0), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), NWidget(NWID_VERTICAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TTV_CHANGE_TIME), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_CHANGE_TIME, STR_TIMETABLE_WAIT_TIME_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TTV_CLEAR_TIME), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_CLEAR_TIME, STR_TIMETABLE_CLEAR_TIME_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TV_CHANGE_TIME), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_CHANGE_TIME, STR_TIMETABLE_WAIT_TIME_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TV_CLEAR_TIME), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_CLEAR_TIME, STR_TIMETABLE_CLEAR_TIME_TOOLTIP), EndContainer(), NWidget(NWID_VERTICAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TTV_START_DATE), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_STARTING_DATE, STR_TIMETABLE_STARTING_DATE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TTV_RESET_LATENESS), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_RESET_LATENESS, STR_TIMETABLE_RESET_LATENESS_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TV_START_DATE), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_STARTING_DATE, STR_TIMETABLE_STARTING_DATE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TV_RESET_LATENESS), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_RESET_LATENESS, STR_TIMETABLE_RESET_LATENESS_TOOLTIP), EndContainer(), NWidget(NWID_VERTICAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TTV_AUTOFILL), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_AUTOFILL, STR_TIMETABLE_AUTOFILL_TOOLTIP), - NWidget(NWID_SELECTION, INVALID_COLOUR, TTV_EXPECTED_SELECTION), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, TTV_EXPECTED), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_BLACK_STRING, STR_TIMETABLE_EXPECTED_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TV_AUTOFILL), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_TIMETABLE_AUTOFILL, STR_TIMETABLE_AUTOFILL_TOOLTIP), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_TV_EXPECTED_SELECTION), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TV_EXPECTED), SetResize(1, 0), SetFill(1, 1), SetDataTip(STR_BLACK_STRING, STR_TIMETABLE_EXPECTED_TOOLTIP), NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 0), SetFill(1, 1), EndContainer(), EndContainer(), EndContainer(), EndContainer(), NWidget(NWID_VERTICAL, NC_EQUALSIZE), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, TTV_SHARED_ORDER_LIST), SetFill(0, 1), SetDataTip(SPR_SHARED_ORDERS_ICON, STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_TV_SHARED_ORDER_LIST), SetFill(0, 1), SetDataTip(SPR_SHARED_ORDERS_ICON, STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP), NWidget(WWT_RESIZEBOX, COLOUR_GREY), SetFill(0, 1), EndContainer(), EndContainer(), diff --git a/src/widgets/statusbar_widget.h b/src/widgets/statusbar_widget.h index 50094f0fa..526aa17f6 100644 --- a/src/widgets/statusbar_widget.h +++ b/src/widgets/statusbar_widget.h @@ -14,9 +14,9 @@ /** Widgets of the WC_STATUS_BAR. */ enum StatusbarWidget { - SBW_LEFT, ///< left part of the statusbar; date is shown there - SBW_MIDDLE, ///< middle part; current news or company name or *** SAVING *** or *** PAUSED *** - SBW_RIGHT, ///< right part; bank balance + WID_S_LEFT, ///< Left part of the statusbar; date is shown there. + WID_S_MIDDLE, ///< Middle part; current news or company name or *** SAVING *** or *** PAUSED ***. + WID_S_RIGHT, ///< Right part; bank balance. }; #endif /* WIDGETS_STATUSBAR_WIDGET_H */ diff --git a/src/widgets/subsidy_widget.h b/src/widgets/subsidy_widget.h index 312e0b852..82ab32fd6 100644 --- a/src/widgets/subsidy_widget.h +++ b/src/widgets/subsidy_widget.h @@ -15,8 +15,8 @@ /** Widgets of the WC_SUBSIDIES_LIST. */ enum SubsidyListWidgets { /* Name starts with SU instead of S, because of collision with StationListWidgets */ - SULW_PANEL, - SULW_SCROLLBAR, + WID_SUL_PANEL, ///< Main panel of window. + WID_SUL_SCROLLBAR, ///< Scrollbar of panel. }; #endif /* WIDGETS_SUBSIDY_WIDGET_H */ diff --git a/src/widgets/terraform_widget.h b/src/widgets/terraform_widget.h index 0c085fe55..99a248e1c 100644 --- a/src/widgets/terraform_widget.h +++ b/src/widgets/terraform_widget.h @@ -14,36 +14,36 @@ /** Widgets of the WC_SCEN_LAND_GEN (WC_SCEN_LAND_GEN is also used in EditorTerraformToolbarWidgets). */ enum TerraformToolbarWidgets { - TTW_SHOW_PLACE_OBJECT, ///< Should the place object button be shown? - TTW_BUTTONS_START, ///< Start of pushable buttons - TTW_LOWER_LAND = TTW_BUTTONS_START, ///< Lower land button - TTW_RAISE_LAND, ///< Raise land button - TTW_LEVEL_LAND, ///< Level land button - TTW_DEMOLISH, ///< Demolish aka dynamite button - TTW_BUY_LAND, ///< Buy land button - TTW_PLANT_TREES, ///< Plant trees button (note: opens seperate window, no place-push-button) - TTW_PLACE_SIGN, ///< Place sign button - TTW_PLACE_OBJECT, ///< Place object button + WID_TT_SHOW_PLACE_OBJECT, ///< Should the place object button be shown? + WID_TT_BUTTONS_START, ///< Start of pushable buttons. + WID_TT_LOWER_LAND = WID_TT_BUTTONS_START, ///< Lower land button. + WID_TT_RAISE_LAND, ///< Raise land button. + WID_TT_LEVEL_LAND, ///< Level land button. + WID_TT_DEMOLISH, ///< Demolish aka dynamite button. + WID_TT_BUY_LAND, ///< Buy land button. + WID_TT_PLANT_TREES, ///< Plant trees button (note: opens seperate window, no place-push-button). + WID_TT_PLACE_SIGN, ///< Place sign button. + WID_TT_PLACE_OBJECT, ///< Place object button. }; /** Widgets of the WC_SCEN_LAND_GEN (WC_SCEN_LAND_GEN is also used in TerraformToolbarWidgets). */ enum EditorTerraformToolbarWidgets { - ETTW_SHOW_PLACE_DESERT, ///< Should the place desert button be shown? - ETTW_START, ///< Used for iterations - ETTW_DOTS = ETTW_START, ///< Invisible widget for rendering the terraform size on. - ETTW_BUTTONS_START, ///< Start of pushable buttons - ETTW_DEMOLISH = ETTW_BUTTONS_START, ///< Demolish aka dynamite button - ETTW_LOWER_LAND, ///< Lower land button - ETTW_RAISE_LAND, ///< Raise land button - ETTW_LEVEL_LAND, ///< Level land button - ETTW_PLACE_ROCKS, ///< Place rocks button - ETTW_PLACE_DESERT, ///< Place desert button (in tropical climate) - ETTW_PLACE_OBJECT, ///< Place transmitter button - ETTW_BUTTONS_END, ///< End of pushable buttons - ETTW_INCREASE_SIZE = ETTW_BUTTONS_END, ///< Upwards arrow button to increase terraforming size - ETTW_DECREASE_SIZE, ///< Downwards arrow button to decrease terraforming size - ETTW_NEW_SCENARIO, ///< Button for generating a new scenario - ETTW_RESET_LANDSCAPE, ///< Button for removing all company-owned property + WID_ETT_SHOW_PLACE_DESERT, ///< Should the place desert button be shown? + WID_ETT_START, ///< Used for iterations. + WID_ETT_DOTS = WID_ETT_START, ///< Invisible widget for rendering the terraform size on. + WID_ETT_BUTTONS_START, ///< Start of pushable buttons. + WID_ETT_DEMOLISH = WID_ETT_BUTTONS_START, ///< Demolish aka dynamite button. + WID_ETT_LOWER_LAND, ///< Lower land button. + WID_ETT_RAISE_LAND, ///< Raise land button. + WID_ETT_LEVEL_LAND, ///< Level land button. + WID_ETT_PLACE_ROCKS, ///< Place rocks button. + WID_ETT_PLACE_DESERT, ///< Place desert button (in tropical climate). + WID_ETT_PLACE_OBJECT, ///< Place transmitter button. + WID_ETT_BUTTONS_END, ///< End of pushable buttons. + WID_ETT_INCREASE_SIZE = WID_ETT_BUTTONS_END, ///< Upwards arrow button to increase terraforming size. + WID_ETT_DECREASE_SIZE, ///< Downwards arrow button to decrease terraforming size. + WID_ETT_NEW_SCENARIO, ///< Button for generating a new scenario. + WID_ETT_RESET_LANDSCAPE, ///< Button for removing all company-owned property. }; #endif /* WIDGETS_TERRAFORM_WIDGET_H */ diff --git a/src/widgets/timetable_widget.h b/src/widgets/timetable_widget.h index e90c1f554..2b8b1ca07 100644 --- a/src/widgets/timetable_widget.h +++ b/src/widgets/timetable_widget.h @@ -13,22 +13,22 @@ #define WIDGETS_TIMETABLE_WIDGET_H /** Widgets of the WC_VEHICLE_TIMETABLE. */ -enum TimetableViewWindowWidgets { - TTV_CAPTION, - TTV_ORDER_VIEW, - TTV_TIMETABLE_PANEL, - TTV_ARRIVAL_DEPARTURE_PANEL, ///< Panel with the expected/scheduled arrivals - TTV_SCROLLBAR, - TTV_SUMMARY_PANEL, - TTV_START_DATE, - TTV_CHANGE_TIME, - TTV_CLEAR_TIME, - TTV_RESET_LATENESS, - TTV_AUTOFILL, - TTV_EXPECTED, ///< Toggle between expected and scheduled arrivals - TTV_SHARED_ORDER_LIST, ///< Show the shared order list - TTV_ARRIVAL_DEPARTURE_SELECTION, ///< Disable/hide the arrival departure panel - TTV_EXPECTED_SELECTION, ///< Disable/hide the expected selection button +enum TimetableViewWidgets { + WID_TV_CAPTION, ///< Caption of the window. + WID_TV_ORDER_VIEW, ///< Order view. + WID_TV_TIMETABLE_PANEL, ///< Timetable panel. + WID_TV_ARRIVAL_DEPARTURE_PANEL, ///< Panel with the expected/scheduled arrivals. + WID_TV_SCROLLBAR, ///< Scrollbar for the panel. + WID_TV_SUMMARY_PANEL, ///< Summary panel. + WID_TV_START_DATE, ///< Start date button. + WID_TV_CHANGE_TIME, ///< Change time button. + WID_TV_CLEAR_TIME, ///< Clear time button. + WID_TV_RESET_LATENESS, ///< Reset lateness button. + WID_TV_AUTOFILL, ///< Autofill button. + WID_TV_EXPECTED, ///< Toggle between expected and scheduled arrivals. + WID_TV_SHARED_ORDER_LIST, ///< Show the shared order list. + WID_TV_ARRIVAL_DEPARTURE_SELECTION, ///< Disable/hide the arrival departure panel. + WID_TV_EXPECTED_SELECTION, ///< Disable/hide the expected selection button. }; #endif /* WIDGETS_TIMETABLE_WIDGET_H */ |