diff options
-rw-r--r-- | src/newgrf_gui.cpp | 6 | ||||
-rw-r--r-- | src/rail_gui.cpp | 238 | ||||
-rw-r--r-- | src/road_gui.cpp | 250 | ||||
-rw-r--r-- | src/signs_gui.cpp | 64 | ||||
-rw-r--r-- | src/subsidy_gui.cpp | 16 | ||||
-rw-r--r-- | src/widgets/graph_widget.h | 2 | ||||
-rw-r--r-- | src/widgets/newgrf_widget.h | 4 | ||||
-rw-r--r-- | src/widgets/news_widget.h | 2 | ||||
-rw-r--r-- | src/widgets/rail_widget.h | 40 | ||||
-rw-r--r-- | src/widgets/road_widget.h | 34 | ||||
-rw-r--r-- | src/widgets/sign_widget.h | 13 | ||||
-rw-r--r-- | src/widgets/subsidy_widget.h | 5 |
12 files changed, 343 insertions, 331 deletions
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index ce18a1e61..8d49326a2 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -1918,7 +1918,7 @@ static const NWidgetPart _nested_scan_progress_widgets[] = { NWidget(NWID_VERTICAL), SetPIP(11, 8, 11), NWidget(WWT_LABEL, INVALID_COLOUR), SetDataTip(STR_NEWGRF_SCAN_MESSAGE, STR_NULL), SetFill(1, 0), NWidget(WWT_EMPTY, INVALID_COLOUR, SPWW_PROGRESS_BAR), SetFill(1, 0), - NWidget(WWT_EMPTY, INVALID_COLOUR, GPWW_PROGRESS_TEXT), SetFill(1, 0), + NWidget(WWT_EMPTY, INVALID_COLOUR, SPWW_PROGRESS_TEXT), SetFill(1, 0), EndContainer(), EndContainer(), EndContainer(), @@ -1961,7 +1961,7 @@ struct ScanProgressWindow : public Window { break; } - case GPWW_PROGRESS_TEXT: + case SPWW_PROGRESS_TEXT: SetDParam(0, 9999); SetDParam(1, 9999); /* We really don't know the width. We could determine it by scanning the NewGRFs, @@ -1985,7 +1985,7 @@ struct ScanProgressWindow : public Window { break; } - case GPWW_PROGRESS_TEXT: + case SPWW_PROGRESS_TEXT: SetDParam(0, this->scanned); SetDParam(1, _settings_client.gui.last_newgrf_count); DrawString(r.left, r.right, r.top, STR_NEWGRF_SCAN_STATUS, TC_FROMSTRING, SA_HOR_CENTER); diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 195202d80..d093ba661 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -286,9 +286,9 @@ void CcBuildRailTunnel(const CommandCost &result, TileIndex tile, uint32 p1, uin static void ToggleRailButton_Remove(Window *w) { DeleteWindowById(WC_SELECT_STATION, 0); - w->ToggleWidgetLoweredState(RTW_REMOVE); - w->SetWidgetDirty(RTW_REMOVE); - _remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE); + w->ToggleWidgetLoweredState(RATW_REMOVE); + w->SetWidgetDirty(RATW_REMOVE); + _remove_button_clicked = w->IsWidgetLowered(RATW_REMOVE); SetSelectionRed(_remove_button_clicked); } @@ -299,11 +299,11 @@ static void ToggleRailButton_Remove(Window *w) */ static bool RailToolbar_CtrlChanged(Window *w) { - if (w->IsWidgetDisabled(RTW_REMOVE)) return false; + if (w->IsWidgetDisabled(RATW_REMOVE)) return false; /* allow ctrl to switch remove mode only for these widgets */ - for (uint i = RTW_BUILD_NS; i <= RTW_BUILD_STATION; i++) { - if ((i <= RTW_AUTORAIL || i >= RTW_BUILD_WAYPOINT) && w->IsWidgetLowered(i)) { + for (uint i = RATW_BUILD_NS; i <= RATW_BUILD_STATION; i++) { + if ((i <= RATW_AUTORAIL || i >= RATW_BUILD_WAYPOINT) && w->IsWidgetLowered(i)) { ToggleRailButton_Remove(w); return true; } @@ -320,12 +320,12 @@ static bool RailToolbar_CtrlChanged(Window *w) */ static void BuildRailClick_Remove(Window *w) { - if (w->IsWidgetDisabled(RTW_REMOVE)) return; + if (w->IsWidgetDisabled(RATW_REMOVE)) return; ToggleRailButton_Remove(w); SndPlayFx(SND_15_BEEP); /* handle station builder */ - if (w->IsWidgetLowered(RTW_BUILD_STATION)) { + if (w->IsWidgetLowered(RATW_BUILD_STATION)) { if (_remove_button_clicked) { /* starting drag & drop remove */ if (!_settings_client.gui.station_dragdrop) { @@ -418,7 +418,7 @@ struct BuildRailToolbarWindow : Window { { this->InitNested(desc); this->SetupRailToolbar(railtype); - this->DisableWidget(RTW_REMOVE); + this->DisableWidget(RATW_REMOVE); this->last_user_action = WIDGET_LIST_END; if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this); @@ -439,14 +439,14 @@ struct BuildRailToolbarWindow : Window { const RailtypeInfo *rti = GetRailTypeInfo(railtype); assert(railtype < RAILTYPE_END); - this->GetWidget<NWidgetCore>(RTW_BUILD_NS)->widget_data = rti->gui_sprites.build_ns_rail; - this->GetWidget<NWidgetCore>(RTW_BUILD_X)->widget_data = rti->gui_sprites.build_x_rail; - this->GetWidget<NWidgetCore>(RTW_BUILD_EW)->widget_data = rti->gui_sprites.build_ew_rail; - this->GetWidget<NWidgetCore>(RTW_BUILD_Y)->widget_data = rti->gui_sprites.build_y_rail; - this->GetWidget<NWidgetCore>(RTW_AUTORAIL)->widget_data = rti->gui_sprites.auto_rail; - this->GetWidget<NWidgetCore>(RTW_BUILD_DEPOT)->widget_data = rti->gui_sprites.build_depot; - this->GetWidget<NWidgetCore>(RTW_CONVERT_RAIL)->widget_data = rti->gui_sprites.convert_rail; - this->GetWidget<NWidgetCore>(RTW_BUILD_TUNNEL)->widget_data = rti->gui_sprites.build_tunnel; + this->GetWidget<NWidgetCore>(RATW_BUILD_NS)->widget_data = rti->gui_sprites.build_ns_rail; + this->GetWidget<NWidgetCore>(RATW_BUILD_X)->widget_data = rti->gui_sprites.build_x_rail; + this->GetWidget<NWidgetCore>(RATW_BUILD_EW)->widget_data = rti->gui_sprites.build_ew_rail; + this->GetWidget<NWidgetCore>(RATW_BUILD_Y)->widget_data = rti->gui_sprites.build_y_rail; + this->GetWidget<NWidgetCore>(RATW_AUTORAIL)->widget_data = rti->gui_sprites.auto_rail; + this->GetWidget<NWidgetCore>(RATW_BUILD_DEPOT)->widget_data = rti->gui_sprites.build_depot; + this->GetWidget<NWidgetCore>(RATW_CONVERT_RAIL)->widget_data = rti->gui_sprites.convert_rail; + this->GetWidget<NWidgetCore>(RATW_BUILD_TUNNEL)->widget_data = rti->gui_sprites.build_tunnel; } /** @@ -462,36 +462,36 @@ struct BuildRailToolbarWindow : Window { void UpdateRemoveWidgetStatus(int clicked_widget) { switch (clicked_widget) { - case RTW_REMOVE: + case RATW_REMOVE: /* If it is the removal button that has been clicked, do nothing, * as it is up to the other buttons to drive removal status */ return; - case RTW_BUILD_NS: - case RTW_BUILD_X: - case RTW_BUILD_EW: - case RTW_BUILD_Y: - case RTW_AUTORAIL: - case RTW_BUILD_WAYPOINT: - case RTW_BUILD_STATION: - case RTW_BUILD_SIGNALS: + case RATW_BUILD_NS: + case RATW_BUILD_X: + case RATW_BUILD_EW: + case RATW_BUILD_Y: + case RATW_AUTORAIL: + case RATW_BUILD_WAYPOINT: + case RATW_BUILD_STATION: + case RATW_BUILD_SIGNALS: /* Removal button is enabled only if the rail/signal/waypoint/station * button is still lowered. Once raised, it has to be disabled */ - this->SetWidgetDisabledState(RTW_REMOVE, !this->IsWidgetLowered(clicked_widget)); + this->SetWidgetDisabledState(RATW_REMOVE, !this->IsWidgetLowered(clicked_widget)); break; default: /* When any other buttons than rail/signal/waypoint/station, raise and * disable the removal button */ - this->DisableWidget(RTW_REMOVE); - this->RaiseWidget(RTW_REMOVE); + this->DisableWidget(RATW_REMOVE); + this->RaiseWidget(RATW_REMOVE); break; } } virtual void SetStringParameters(int widget) const { - if (widget == RTW_CAPTION) { + if (widget == RATW_CAPTION) { const RailtypeInfo *rti = GetRailTypeInfo(this->railtype); if (rti->max_speed > 0) { SetDParam(0, STR_TOOLBAR_RAILTYPE_VELOCITY); @@ -505,87 +505,87 @@ struct BuildRailToolbarWindow : Window { virtual void OnClick(Point pt, int widget, int click_count) { - if (widget < RTW_BUILD_NS) return; + if (widget < RATW_BUILD_NS) return; _remove_button_clicked = false; switch (widget) { - case RTW_BUILD_NS: - HandlePlacePushButton(this, RTW_BUILD_NS, GetRailTypeInfo(_cur_railtype)->cursor.rail_ns, HT_LINE | HT_DIR_VL); + case RATW_BUILD_NS: + HandlePlacePushButton(this, RATW_BUILD_NS, GetRailTypeInfo(_cur_railtype)->cursor.rail_ns, HT_LINE | HT_DIR_VL); this->last_user_action = widget; break; - case RTW_BUILD_X: - HandlePlacePushButton(this, RTW_BUILD_X, GetRailTypeInfo(_cur_railtype)->cursor.rail_swne, HT_LINE | HT_DIR_X); + case RATW_BUILD_X: + HandlePlacePushButton(this, RATW_BUILD_X, GetRailTypeInfo(_cur_railtype)->cursor.rail_swne, HT_LINE | HT_DIR_X); this->last_user_action = widget; break; - case RTW_BUILD_EW: - HandlePlacePushButton(this, RTW_BUILD_EW, GetRailTypeInfo(_cur_railtype)->cursor.rail_ew, HT_LINE | HT_DIR_HL); + case RATW_BUILD_EW: + HandlePlacePushButton(this, RATW_BUILD_EW, GetRailTypeInfo(_cur_railtype)->cursor.rail_ew, HT_LINE | HT_DIR_HL); this->last_user_action = widget; break; - case RTW_BUILD_Y: - HandlePlacePushButton(this, RTW_BUILD_Y, GetRailTypeInfo(_cur_railtype)->cursor.rail_nwse, HT_LINE | HT_DIR_Y); + case RATW_BUILD_Y: + HandlePlacePushButton(this, RATW_BUILD_Y, GetRailTypeInfo(_cur_railtype)->cursor.rail_nwse, HT_LINE | HT_DIR_Y); this->last_user_action = widget; break; - case RTW_AUTORAIL: - HandlePlacePushButton(this, RTW_AUTORAIL, GetRailTypeInfo(_cur_railtype)->cursor.autorail, HT_RAIL); + case RATW_AUTORAIL: + HandlePlacePushButton(this, RATW_AUTORAIL, GetRailTypeInfo(_cur_railtype)->cursor.autorail, HT_RAIL); this->last_user_action = widget; break; - case RTW_DEMOLISH: - HandlePlacePushButton(this, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL); + case RATW_DEMOLISH: + HandlePlacePushButton(this, RATW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL); this->last_user_action = widget; break; - case RTW_BUILD_DEPOT: - if (HandlePlacePushButton(this, RTW_BUILD_DEPOT, GetRailTypeInfo(_cur_railtype)->cursor.depot, HT_RECT)) { + case RATW_BUILD_DEPOT: + if (HandlePlacePushButton(this, RATW_BUILD_DEPOT, GetRailTypeInfo(_cur_railtype)->cursor.depot, HT_RECT)) { ShowBuildTrainDepotPicker(this); this->last_user_action = widget; } break; - case RTW_BUILD_WAYPOINT: + case RATW_BUILD_WAYPOINT: this->last_user_action = widget; _waypoint_count = StationClass::GetCount(STAT_CLASS_WAYP); - if (HandlePlacePushButton(this, RTW_BUILD_WAYPOINT, SPR_CURSOR_WAYPOINT, HT_RECT) && _waypoint_count > 1) { + if (HandlePlacePushButton(this, RATW_BUILD_WAYPOINT, SPR_CURSOR_WAYPOINT, HT_RECT) && _waypoint_count > 1) { ShowBuildWaypointPicker(this); } break; - case RTW_BUILD_STATION: - if (HandlePlacePushButton(this, RTW_BUILD_STATION, SPR_CURSOR_RAIL_STATION, HT_RECT)) { + case RATW_BUILD_STATION: + if (HandlePlacePushButton(this, RATW_BUILD_STATION, SPR_CURSOR_RAIL_STATION, HT_RECT)) { ShowStationBuilder(this); this->last_user_action = widget; } break; - case RTW_BUILD_SIGNALS: { + case RATW_BUILD_SIGNALS: { this->last_user_action = widget; - bool started = HandlePlacePushButton(this, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, HT_RECT); + bool started = HandlePlacePushButton(this, RATW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, HT_RECT); if (started && _settings_client.gui.enable_signal_gui != _ctrl_pressed) { ShowSignalBuilder(this); } break; } - case RTW_BUILD_BRIDGE: - HandlePlacePushButton(this, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT); + case RATW_BUILD_BRIDGE: + HandlePlacePushButton(this, RATW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT); this->last_user_action = widget; break; - case RTW_BUILD_TUNNEL: - HandlePlacePushButton(this, RTW_BUILD_TUNNEL, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, HT_SPECIAL); + case RATW_BUILD_TUNNEL: + HandlePlacePushButton(this, RATW_BUILD_TUNNEL, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, HT_SPECIAL); this->last_user_action = widget; break; - case RTW_REMOVE: + case RATW_REMOVE: BuildRailClick_Remove(this); break; - case RTW_CONVERT_RAIL: - HandlePlacePushButton(this, RTW_CONVERT_RAIL, GetRailTypeInfo(_cur_railtype)->cursor.convert, HT_RECT | HT_DIAGONAL); + case RATW_CONVERT_RAIL: + HandlePlacePushButton(this, RATW_CONVERT_RAIL, GetRailTypeInfo(_cur_railtype)->cursor.convert, HT_RECT | HT_DIAGONAL); this->last_user_action = widget; break; @@ -607,57 +607,57 @@ struct BuildRailToolbarWindow : Window { virtual void OnPlaceObject(Point pt, TileIndex tile) { switch (this->last_user_action) { - case RTW_BUILD_NS: + case RATW_BUILD_NS: VpStartPlaceSizing(tile, VPM_FIX_VERTICAL | VPM_RAILDIRS, DDSP_PLACE_RAIL); break; - case RTW_BUILD_X: + case RATW_BUILD_X: VpStartPlaceSizing(tile, VPM_FIX_Y | VPM_RAILDIRS, DDSP_PLACE_RAIL); break; - case RTW_BUILD_EW: + case RATW_BUILD_EW: VpStartPlaceSizing(tile, VPM_FIX_HORIZONTAL | VPM_RAILDIRS, DDSP_PLACE_RAIL); break; - case RTW_BUILD_Y: + case RATW_BUILD_Y: VpStartPlaceSizing(tile, VPM_FIX_X | VPM_RAILDIRS, DDSP_PLACE_RAIL); break; - case RTW_AUTORAIL: + case RATW_AUTORAIL: VpStartPlaceSizing(tile, VPM_RAILDIRS, DDSP_PLACE_RAIL); break; - case RTW_DEMOLISH: + case RATW_DEMOLISH: PlaceProc_DemolishArea(tile); break; - case RTW_BUILD_DEPOT: + case RATW_BUILD_DEPOT: DoCommandP(tile, _cur_railtype, _build_depot_direction, CMD_BUILD_TRAIN_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_TRAIN_DEPOT), CcRailDepot); break; - case RTW_BUILD_WAYPOINT: + case RATW_BUILD_WAYPOINT: PlaceRail_Waypoint(tile); break; - case RTW_BUILD_STATION: + case RATW_BUILD_STATION: PlaceRail_Station(tile); break; - case RTW_BUILD_SIGNALS: + case RATW_BUILD_SIGNALS: VpStartPlaceSizing(tile, VPM_SIGNALDIRS, DDSP_BUILD_SIGNALS); break; - case RTW_BUILD_BRIDGE: + case RATW_BUILD_BRIDGE: PlaceRail_Bridge(tile, this); break; - case RTW_BUILD_TUNNEL: + case RATW_BUILD_TUNNEL: DoCommandP(tile, _cur_railtype | (TRANSPORT_RAIL << 8), 0, CMD_BUILD_TUNNEL | CMD_MSG(STR_ERROR_CAN_T_BUILD_TUNNEL_HERE), CcBuildRailTunnel); break; - case RTW_CONVERT_RAIL: + case RATW_CONVERT_RAIL: VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CONVERT_RAIL); break; @@ -668,7 +668,7 @@ struct BuildRailToolbarWindow : Window { virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) { /* no dragging if you have pressed the convert button */ - if (FindWindowById(WC_BUILD_SIGNAL, 0) != NULL && _convert_signal_button && this->IsWidgetLowered(RTW_BUILD_SIGNALS)) return; + if (FindWindowById(WC_BUILD_SIGNAL, 0) != NULL && _convert_signal_button && this->IsWidgetLowered(RATW_BUILD_SIGNALS)) return; VpSelectTilesWithMethod(pt.x, pt.y, select_method); } @@ -701,7 +701,7 @@ struct BuildRailToolbarWindow : Window { case DDSP_REMOVE_STATION: case DDSP_BUILD_STATION: - if (this->IsWidgetLowered(RTW_BUILD_STATION)) { + if (this->IsWidgetLowered(RATW_BUILD_STATION)) { /* Station */ if (_remove_button_clicked) { DoCommandP(end_tile, start_tile, _ctrl_pressed ? 0 : 1, CMD_REMOVE_FROM_RAIL_STATION | CMD_MSG(STR_ERROR_CAN_T_REMOVE_PART_OF_STATION), CcPlaySound1E); @@ -729,8 +729,8 @@ struct BuildRailToolbarWindow : Window { virtual void OnPlaceObjectAbort() { this->RaiseButtons(); - this->DisableWidget(RTW_REMOVE); - this->SetWidgetDirty(RTW_REMOVE); + this->DisableWidget(RATW_REMOVE); + this->SetWidgetDirty(RATW_REMOVE); DeleteWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL); DeleteWindowById(WC_BUILD_STATION, TRANSPORT_RAIL); @@ -748,7 +748,7 @@ struct BuildRailToolbarWindow : Window { virtual EventState OnCTRLStateChange() { /* do not toggle Remove button by Ctrl when placing station */ - if (!this->IsWidgetLowered(RTW_BUILD_STATION) && !this->IsWidgetLowered(RTW_BUILD_WAYPOINT) && RailToolbar_CtrlChanged(this)) return ES_HANDLED; + if (!this->IsWidgetLowered(RATW_BUILD_STATION) && !this->IsWidgetLowered(RATW_BUILD_WAYPOINT) && RailToolbar_CtrlChanged(this)) return ES_HANDLED; return ES_NOT_HANDLED; } @@ -758,20 +758,20 @@ struct BuildRailToolbarWindow : Window { const uint16 _railtoolbar_autorail_keys[] = {'5', 'A' | WKC_GLOBAL_HOTKEY, 0}; Hotkey<BuildRailToolbarWindow> BuildRailToolbarWindow::railtoolbar_hotkeys[] = { - Hotkey<BuildRailToolbarWindow>('1', "build_ns", RTW_BUILD_NS), - Hotkey<BuildRailToolbarWindow>('2', "build_x", RTW_BUILD_X), - Hotkey<BuildRailToolbarWindow>('3', "build_ew", RTW_BUILD_EW), - Hotkey<BuildRailToolbarWindow>('4', "build_y", RTW_BUILD_Y), - Hotkey<BuildRailToolbarWindow>(_railtoolbar_autorail_keys, "autorail", RTW_AUTORAIL), - Hotkey<BuildRailToolbarWindow>('6', "demolish", RTW_DEMOLISH), - Hotkey<BuildRailToolbarWindow>('7', "depot", RTW_BUILD_DEPOT), - Hotkey<BuildRailToolbarWindow>('8', "waypoint", RTW_BUILD_WAYPOINT), - Hotkey<BuildRailToolbarWindow>('9', "station", RTW_BUILD_STATION), - Hotkey<BuildRailToolbarWindow>('S', "signal", RTW_BUILD_SIGNALS), - Hotkey<BuildRailToolbarWindow>('B', "bridge", RTW_BUILD_BRIDGE), - Hotkey<BuildRailToolbarWindow>('T', "tunnel", RTW_BUILD_TUNNEL), - Hotkey<BuildRailToolbarWindow>('R', "remove", RTW_REMOVE), - Hotkey<BuildRailToolbarWindow>('C', "convert", RTW_CONVERT_RAIL), + Hotkey<BuildRailToolbarWindow>('1', "build_ns", RATW_BUILD_NS), + Hotkey<BuildRailToolbarWindow>('2', "build_x", RATW_BUILD_X), + Hotkey<BuildRailToolbarWindow>('3', "build_ew", RATW_BUILD_EW), + Hotkey<BuildRailToolbarWindow>('4', "build_y", RATW_BUILD_Y), + Hotkey<BuildRailToolbarWindow>(_railtoolbar_autorail_keys, "autorail", RATW_AUTORAIL), + Hotkey<BuildRailToolbarWindow>('6', "demolish", RATW_DEMOLISH), + Hotkey<BuildRailToolbarWindow>('7', "depot", RATW_BUILD_DEPOT), + Hotkey<BuildRailToolbarWindow>('8', "waypoint", RATW_BUILD_WAYPOINT), + Hotkey<BuildRailToolbarWindow>('9', "station", RATW_BUILD_STATION), + Hotkey<BuildRailToolbarWindow>('S', "signal", RATW_BUILD_SIGNALS), + Hotkey<BuildRailToolbarWindow>('B', "bridge", RATW_BUILD_BRIDGE), + Hotkey<BuildRailToolbarWindow>('T', "tunnel", RATW_BUILD_TUNNEL), + Hotkey<BuildRailToolbarWindow>('R', "remove", RATW_REMOVE), + Hotkey<BuildRailToolbarWindow>('C', "convert", RATW_CONVERT_RAIL), HOTKEY_LIST_END(BuildRailToolbarWindow) }; Hotkey<BuildRailToolbarWindow> *_railtoolbar_hotkeys = BuildRailToolbarWindow::railtoolbar_hotkeys; @@ -779,40 +779,40 @@ Hotkey<BuildRailToolbarWindow> *_railtoolbar_hotkeys = BuildRailToolbarWindow::r static const NWidgetPart _nested_build_rail_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), - NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, RTW_CAPTION), SetDataTip(STR_WHITE_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, RATW_CAPTION), SetDataTip(STR_WHITE_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_NS), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RATW_BUILD_NS), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_RAIL_NS, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TRACK), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_X), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RATW_BUILD_X), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_RAIL_NE, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TRACK), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_EW), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RATW_BUILD_EW), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_RAIL_EW, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TRACK), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_Y), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RATW_BUILD_Y), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_RAIL_NW, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TRACK), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_AUTORAIL), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RATW_AUTORAIL), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTORAIL, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_AUTORAIL), NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(4, 22), SetDataTip(0x0, STR_NULL), EndContainer(), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_DEMOLISH), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RATW_DEMOLISH), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_DEPOT), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RATW_BUILD_DEPOT), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DEPOT_RAIL, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_TRAIN_DEPOT_FOR_BUILDING), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_WAYPOINT), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RATW_BUILD_WAYPOINT), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_WAYPOINT, STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL_TO_WAYPOINT), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_STATION), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RATW_BUILD_STATION), SetFill(0, 1), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_RAIL_STATION, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_STATION), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_SIGNALS), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RATW_BUILD_SIGNALS), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_RAIL_SIGNALS, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_SIGNALS), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_BRIDGE), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RATW_BUILD_BRIDGE), SetFill(0, 1), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_BRIDGE, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_BRIDGE), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_TUNNEL), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RATW_BUILD_TUNNEL), SetFill(0, 1), SetMinimalSize(20, 22), SetDataTip(SPR_IMG_TUNNEL_RAIL, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TUNNEL), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_REMOVE), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RATW_REMOVE), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_REMOVE, STR_RAIL_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_CONVERT_RAIL), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RATW_CONVERT_RAIL), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_CONVERT_RAIL, STR_RAIL_TOOLBAR_TOOLTIP_CONVERT_RAIL), EndContainer(), }; @@ -1624,26 +1624,26 @@ struct BuildRailDepotWindow : public PickerWindowBase { BuildRailDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent) { this->InitNested(desc, TRANSPORT_RAIL); - this->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE); + this->LowerWidget(_build_depot_direction + BRADW_DEPOT_NE); } virtual void DrawWidget(const Rect &r, int widget) const { - if (!IsInsideMM(widget, BRDW_DEPOT_NE, BRDW_DEPOT_NW + 1)) return; + if (!IsInsideMM(widget, BRADW_DEPOT_NE, BRADW_DEPOT_NW + 1)) return; - DrawTrainDepotSprite(r.left - 1, r.top, widget - BRDW_DEPOT_NE + DIAGDIR_NE, _cur_railtype); + DrawTrainDepotSprite(r.left - 1, r.top, widget - BRADW_DEPOT_NE + DIAGDIR_NE, _cur_railtype); } virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case BRDW_DEPOT_NE: - case BRDW_DEPOT_SE: - case BRDW_DEPOT_SW: - case BRDW_DEPOT_NW: - this->RaiseWidget(_build_depot_direction + BRDW_DEPOT_NE); - _build_depot_direction = (DiagDirection)(widget - BRDW_DEPOT_NE); - this->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE); + case BRADW_DEPOT_NE: + case BRADW_DEPOT_SE: + case BRADW_DEPOT_SW: + case BRADW_DEPOT_NW: + this->RaiseWidget(_build_depot_direction + BRADW_DEPOT_NE); + _build_depot_direction = (DiagDirection)(widget - BRADW_DEPOT_NE); + this->LowerWidget(_build_depot_direction + BRADW_DEPOT_NE); SndPlayFx(SND_15_BEEP); this->SetDirty(); break; @@ -1662,18 +1662,18 @@ static const NWidgetPart _nested_build_depot_widgets[] = { NWidget(NWID_HORIZONTAL_LTR), NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), NWidget(NWID_VERTICAL), - NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_NW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, BRADW_DEPOT_NW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 2), - NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_SW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, BRADW_DEPOT_SW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), EndContainer(), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(2, 0), NWidget(NWID_VERTICAL), - NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_NE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, BRADW_DEPOT_NE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 2), - NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_SE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, BRADW_DEPOT_SE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_TRAIN_ORIENTATION_TOOLTIP), EndContainer(), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 6c67762b6..573261a32 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -278,9 +278,9 @@ typedef void OnButtonClick(Window *w); */ static void ToggleRoadButton_Remove(Window *w) { - w->ToggleWidgetLoweredState(RTW_REMOVE); - w->SetWidgetDirty(RTW_REMOVE); - _remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE); + w->ToggleWidgetLoweredState(ROTW_REMOVE); + w->SetWidgetDirty(ROTW_REMOVE); + _remove_button_clicked = w->IsWidgetLowered(ROTW_REMOVE); SetSelectionRed(_remove_button_clicked); } @@ -291,10 +291,10 @@ static void ToggleRoadButton_Remove(Window *w) */ static bool RoadToolbar_CtrlChanged(Window *w) { - if (w->IsWidgetDisabled(RTW_REMOVE)) return false; + if (w->IsWidgetDisabled(ROTW_REMOVE)) return false; /* allow ctrl to switch remove mode only for these widgets */ - for (uint i = RTW_ROAD_X; i <= RTW_AUTOROAD; i++) { + for (uint i = ROTW_ROAD_X; i <= ROTW_AUTOROAD; i++) { if (w->IsWidgetLowered(i)) { ToggleRoadButton_Remove(w); return true; @@ -312,8 +312,8 @@ struct BuildRoadToolbarWindow : Window { { this->InitNested(desc, window_number); this->SetWidgetsDisabledState(true, - RTW_REMOVE, - RTW_ONE_WAY, + ROTW_REMOVE, + ROTW_ONE_WAY, WIDGET_LIST_END); this->OnInvalidateData(); @@ -336,9 +336,9 @@ struct BuildRoadToolbarWindow : Window { { if (!gui_scope) return; this->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_ROAD), - RTW_DEPOT, - RTW_BUS_STATION, - RTW_TRUCK_STATION, + ROTW_DEPOT, + ROTW_BUS_STATION, + ROTW_TRUCK_STATION, WIDGET_LIST_END); } @@ -353,28 +353,28 @@ struct BuildRoadToolbarWindow : Window { * by the other buttons so they don't act on themselfs. * Both are only valid if they are able to apply as options. */ switch (clicked_widget) { - case RTW_REMOVE: - this->RaiseWidget(RTW_ONE_WAY); - this->SetWidgetDirty(RTW_ONE_WAY); + case ROTW_REMOVE: + this->RaiseWidget(ROTW_ONE_WAY); + this->SetWidgetDirty(ROTW_ONE_WAY); break; - case RTW_ONE_WAY: - this->RaiseWidget(RTW_REMOVE); - this->SetWidgetDirty(RTW_REMOVE); + case ROTW_ONE_WAY: + this->RaiseWidget(ROTW_REMOVE); + this->SetWidgetDirty(ROTW_REMOVE); break; - case RTW_BUS_STATION: - case RTW_TRUCK_STATION: - this->DisableWidget(RTW_ONE_WAY); - this->SetWidgetDisabledState(RTW_REMOVE, !this->IsWidgetLowered(clicked_widget)); + case ROTW_BUS_STATION: + case ROTW_TRUCK_STATION: + this->DisableWidget(ROTW_ONE_WAY); + this->SetWidgetDisabledState(ROTW_REMOVE, !this->IsWidgetLowered(clicked_widget)); break; - case RTW_ROAD_X: - case RTW_ROAD_Y: - case RTW_AUTOROAD: + case ROTW_ROAD_X: + case ROTW_ROAD_Y: + case ROTW_AUTOROAD: this->SetWidgetsDisabledState(!this->IsWidgetLowered(clicked_widget), - RTW_REMOVE, - RTW_ONE_WAY, + ROTW_REMOVE, + ROTW_ONE_WAY, WIDGET_LIST_END); break; @@ -382,12 +382,12 @@ struct BuildRoadToolbarWindow : Window { /* When any other buttons than road/station, raise and * disable the removal button */ this->SetWidgetsDisabledState(true, - RTW_REMOVE, - RTW_ONE_WAY, + ROTW_REMOVE, + ROTW_ONE_WAY, WIDGET_LIST_END); this->SetWidgetsLoweredState(false, - RTW_REMOVE, - RTW_ONE_WAY, + ROTW_REMOVE, + ROTW_ONE_WAY, WIDGET_LIST_END); break; } @@ -398,69 +398,69 @@ struct BuildRoadToolbarWindow : Window { _remove_button_clicked = false; _one_way_button_clicked = false; switch (widget) { - case RTW_ROAD_X: - HandlePlacePushButton(this, RTW_ROAD_X, _road_type_infos[_cur_roadtype].cursor_nwse, HT_RECT); + case ROTW_ROAD_X: + HandlePlacePushButton(this, ROTW_ROAD_X, _road_type_infos[_cur_roadtype].cursor_nwse, HT_RECT); this->last_started_action = widget; break; - case RTW_ROAD_Y: - HandlePlacePushButton(this, RTW_ROAD_Y, _road_type_infos[_cur_roadtype].cursor_nesw, HT_RECT); + case ROTW_ROAD_Y: + HandlePlacePushButton(this, ROTW_ROAD_Y, _road_type_infos[_cur_roadtype].cursor_nesw, HT_RECT); this->last_started_action = widget; break; - case RTW_AUTOROAD: - HandlePlacePushButton(this, RTW_AUTOROAD, _road_type_infos[_cur_roadtype].cursor_autoroad, HT_RECT); + case ROTW_AUTOROAD: + HandlePlacePushButton(this, ROTW_AUTOROAD, _road_type_infos[_cur_roadtype].cursor_autoroad, HT_RECT); this->last_started_action = widget; break; - case RTW_DEMOLISH: - HandlePlacePushButton(this, RTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL); + case ROTW_DEMOLISH: + HandlePlacePushButton(this, ROTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL); this->last_started_action = widget; break; - case RTW_DEPOT: + case ROTW_DEPOT: if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return; - if (HandlePlacePushButton(this, RTW_DEPOT, SPR_CURSOR_ROAD_DEPOT, HT_RECT)) { + if (HandlePlacePushButton(this, ROTW_DEPOT, SPR_CURSOR_ROAD_DEPOT, HT_RECT)) { ShowRoadDepotPicker(this); this->last_started_action = widget; } break; - case RTW_BUS_STATION: + case ROTW_BUS_STATION: if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return; - if (HandlePlacePushButton(this, RTW_BUS_STATION, SPR_CURSOR_BUS_STATION, HT_RECT)) { + if (HandlePlacePushButton(this, ROTW_BUS_STATION, SPR_CURSOR_BUS_STATION, HT_RECT)) { ShowRVStationPicker(this, ROADSTOP_BUS); this->last_started_action = widget; } break; - case RTW_TRUCK_STATION: + case ROTW_TRUCK_STATION: if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return; - if (HandlePlacePushButton(this, RTW_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, HT_RECT)) { + if (HandlePlacePushButton(this, ROTW_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, HT_RECT)) { ShowRVStationPicker(this, ROADSTOP_TRUCK); this->last_started_action = widget; } break; - case RTW_ONE_WAY: - if (this->IsWidgetDisabled(RTW_ONE_WAY)) return; + case ROTW_ONE_WAY: + if (this->IsWidgetDisabled(ROTW_ONE_WAY)) return; this->SetDirty(); - this->ToggleWidgetLoweredState(RTW_ONE_WAY); + this->ToggleWidgetLoweredState(ROTW_ONE_WAY); SetSelectionRed(false); break; - case RTW_BUILD_BRIDGE: - HandlePlacePushButton(this, RTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT); + case ROTW_BUILD_BRIDGE: + HandlePlacePushButton(this, ROTW_BUILD_BRIDGE, SPR_CURSOR_BRIDGE, HT_RECT); this->last_started_action = widget; break; - case RTW_BUILD_TUNNEL: - HandlePlacePushButton(this, RTW_BUILD_TUNNEL, SPR_CURSOR_ROAD_TUNNEL, HT_SPECIAL); + case ROTW_BUILD_TUNNEL: + HandlePlacePushButton(this, ROTW_BUILD_TUNNEL, SPR_CURSOR_ROAD_TUNNEL, HT_SPECIAL); this->last_started_action = widget; break; - case RTW_REMOVE: - if (this->IsWidgetDisabled(RTW_REMOVE)) return; + case ROTW_REMOVE: + if (this->IsWidgetDisabled(ROTW_REMOVE)) return; DeleteWindowById(WC_SELECT_STATION, 0); ToggleRoadButton_Remove(this); @@ -484,50 +484,50 @@ struct BuildRoadToolbarWindow : Window { virtual void OnPlaceObject(Point pt, TileIndex tile) { - _remove_button_clicked = this->IsWidgetLowered(RTW_REMOVE); - _one_way_button_clicked = this->IsWidgetLowered(RTW_ONE_WAY); + _remove_button_clicked = this->IsWidgetLowered(ROTW_REMOVE); + _one_way_button_clicked = this->IsWidgetLowered(ROTW_ONE_WAY); switch (this->last_started_action) { - case RTW_ROAD_X: + case ROTW_ROAD_X: _place_road_flag = RF_DIR_X; if (_tile_fract_coords.x >= 8) _place_road_flag |= RF_START_HALFROAD_X; VpStartPlaceSizing(tile, VPM_FIX_Y, DDSP_PLACE_ROAD_X_DIR); break; - case RTW_ROAD_Y: + case ROTW_ROAD_Y: _place_road_flag = RF_DIR_Y; if (_tile_fract_coords.y >= 8) _place_road_flag |= RF_START_HALFROAD_Y; VpStartPlaceSizing(tile, VPM_FIX_X, DDSP_PLACE_ROAD_Y_DIR); break; - case RTW_AUTOROAD: + case ROTW_AUTOROAD: _place_road_flag = RF_NONE; if (_tile_fract_coords.x >= 8) _place_road_flag |= RF_START_HALFROAD_X; if (_tile_fract_coords.y >= 8) _place_road_flag |= RF_START_HALFROAD_Y; VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_PLACE_AUTOROAD); break; - case RTW_DEMOLISH: + case ROTW_DEMOLISH: PlaceProc_DemolishArea(tile); break; - case RTW_DEPOT: + case ROTW_DEPOT: DoCommandP(tile, _cur_roadtype << 2 | _road_depot_orientation, 0, CMD_BUILD_ROAD_DEPOT | CMD_MSG(_road_type_infos[_cur_roadtype].err_depot), CcRoadDepot); break; - case RTW_BUS_STATION: + case ROTW_BUS_STATION: PlaceRoad_BusStation(tile); break; - case RTW_TRUCK_STATION: + case ROTW_TRUCK_STATION: PlaceRoad_TruckStation(tile); break; - case RTW_BUILD_BRIDGE: + case ROTW_BUILD_BRIDGE: PlaceRoad_Bridge(tile, this); break; - case RTW_BUILD_TUNNEL: + case ROTW_BUILD_TUNNEL: DoCommandP(tile, RoadTypeToRoadTypes(_cur_roadtype) | (TRANSPORT_ROAD << 8), 0, CMD_BUILD_TUNNEL | CMD_MSG(STR_ERROR_CAN_T_BUILD_TUNNEL_HERE), CcBuildRoadTunnel); break; @@ -540,11 +540,11 @@ struct BuildRoadToolbarWindow : Window { { this->RaiseButtons(); this->SetWidgetsDisabledState(true, - RTW_REMOVE, - RTW_ONE_WAY, + ROTW_REMOVE, + ROTW_ONE_WAY, WIDGET_LIST_END); - this->SetWidgetDirty(RTW_REMOVE); - this->SetWidgetDirty(RTW_ONE_WAY); + this->SetWidgetDirty(ROTW_REMOVE); + this->SetWidgetDirty(ROTW_ONE_WAY); DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD); DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD); @@ -664,17 +664,17 @@ struct BuildRoadToolbarWindow : Window { }; Hotkey<BuildRoadToolbarWindow> BuildRoadToolbarWindow::roadtoolbar_hotkeys[] = { - Hotkey<BuildRoadToolbarWindow>('1', "build_x", RTW_ROAD_X), - Hotkey<BuildRoadToolbarWindow>('2', "build_y", RTW_ROAD_Y), - Hotkey<BuildRoadToolbarWindow>('3', "autoroad", RTW_AUTOROAD), - Hotkey<BuildRoadToolbarWindow>('4', "demolish", RTW_DEMOLISH), - Hotkey<BuildRoadToolbarWindow>('5', "depot", RTW_DEPOT), - Hotkey<BuildRoadToolbarWindow>('6', "bus_station", RTW_BUS_STATION), - Hotkey<BuildRoadToolbarWindow>('7', "truck_station", RTW_TRUCK_STATION), - Hotkey<BuildRoadToolbarWindow>('8', "oneway", RTW_ONE_WAY), - Hotkey<BuildRoadToolbarWindow>('B', "bridge", RTW_BUILD_BRIDGE), - Hotkey<BuildRoadToolbarWindow>('T', "tunnel", RTW_BUILD_TUNNEL), - Hotkey<BuildRoadToolbarWindow>('R', "remove", RTW_REMOVE), + Hotkey<BuildRoadToolbarWindow>('1', "build_x", ROTW_ROAD_X), + Hotkey<BuildRoadToolbarWindow>('2', "build_y", ROTW_ROAD_Y), + Hotkey<BuildRoadToolbarWindow>('3', "autoroad", ROTW_AUTOROAD), + Hotkey<BuildRoadToolbarWindow>('4', "demolish", ROTW_DEMOLISH), + Hotkey<BuildRoadToolbarWindow>('5', "depot", ROTW_DEPOT), + Hotkey<BuildRoadToolbarWindow>('6', "bus_station", ROTW_BUS_STATION), + Hotkey<BuildRoadToolbarWindow>('7', "truck_station", ROTW_TRUCK_STATION), + Hotkey<BuildRoadToolbarWindow>('8', "oneway", ROTW_ONE_WAY), + Hotkey<BuildRoadToolbarWindow>('B', "bridge", ROTW_BUILD_BRIDGE), + Hotkey<BuildRoadToolbarWindow>('T', "tunnel", ROTW_BUILD_TUNNEL), + Hotkey<BuildRoadToolbarWindow>('R', "remove", ROTW_REMOVE), HOTKEY_LIST_END(BuildRoadToolbarWindow) }; Hotkey<BuildRoadToolbarWindow> *_roadtoolbar_hotkeys = BuildRoadToolbarWindow::roadtoolbar_hotkeys; @@ -687,28 +687,28 @@ static const NWidgetPart _nested_build_road_widgets[] = { NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_ROAD_X), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ROAD_X), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_X_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_ROAD_Y), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ROAD_Y), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_Y_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_AUTOROAD), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_AUTOROAD), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTOROAD, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_AUTOROAD), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_DEMOLISH), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_DEMOLISH), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_DEPOT), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_DEPOT), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_DEPOT, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_VEHICLE_DEPOT), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUS_STATION), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUS_STATION), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_BUS_STATION, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_BUS_STATION), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_TRUCK_STATION), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_TRUCK_STATION), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRUCK_BAY, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, -1), SetMinimalSize(0, 22), SetFill(1, 1), EndContainer(), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_ONE_WAY), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ONE_WAY), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_ONE_WAY, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_ONE_WAY_ROAD), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_BRIDGE), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUILD_BRIDGE), SetFill(0, 1), SetMinimalSize(43, 22), SetDataTip(SPR_IMG_BRIDGE, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_BRIDGE), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_TUNNEL), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUILD_TUNNEL), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_TUNNEL, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_TUNNEL), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_REMOVE), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_REMOVE), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_REMOVE, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_ROAD), EndContainer(), }; @@ -727,27 +727,27 @@ static const NWidgetPart _nested_build_tramway_widgets[] = { NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_ROAD_X), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ROAD_X), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRAMWAY_X_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_SECTION), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_ROAD_Y), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ROAD_Y), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRAMWAY_Y_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_SECTION), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_AUTOROAD), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_AUTOROAD), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTOTRAM, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_AUTOTRAM), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_DEMOLISH), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_DEMOLISH), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_DEPOT), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_DEPOT), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_DEPOT, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAM_VEHICLE_DEPOT), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUS_STATION), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUS_STATION), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_BUS_STATION, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_PASSENGER_TRAM_STATION), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_TRUCK_STATION), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_TRUCK_STATION), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_TRUCK_BAY, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_CARGO_TRAM_STATION), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, -1), SetMinimalSize(0, 22), SetFill(1, 1), EndContainer(), - NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, RTW_ONE_WAY), SetMinimalSize(0, 0), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_BRIDGE), + NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, ROTW_ONE_WAY), SetMinimalSize(0, 0), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUILD_BRIDGE), SetFill(0, 1), SetMinimalSize(43, 22), SetDataTip(SPR_IMG_BRIDGE, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_BRIDGE), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_TUNNEL), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUILD_TUNNEL), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_TUNNEL, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAMWAY_TUNNEL), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_REMOVE), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_REMOVE), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_REMOVE, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS), EndContainer(), }; @@ -792,22 +792,22 @@ static const NWidgetPart _nested_build_road_scen_widgets[] = { NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_ROAD_X), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ROAD_X), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_X_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_ROAD_Y), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ROAD_Y), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_Y_DIR, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_SECTION), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_AUTOROAD), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_AUTOROAD), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTOROAD, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_AUTOROAD), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_DEMOLISH), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_DEMOLISH), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, -1), SetMinimalSize(0, 22), SetFill(1, 1), EndContainer(), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_ONE_WAY), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_ONE_WAY), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_ONE_WAY, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_ONE_WAY_ROAD), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_BRIDGE), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUILD_BRIDGE), SetFill(0, 1), SetMinimalSize(43, 22), SetDataTip(SPR_IMG_BRIDGE, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_BRIDGE), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_BUILD_TUNNEL), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_BUILD_TUNNEL), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_ROAD_TUNNEL, STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_TUNNEL), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, RTW_REMOVE), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, ROTW_REMOVE), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_REMOVE, STR_ROAD_TOOLBAR_TOOLTIP_TOGGLE_BUILD_REMOVE_FOR_ROAD), EndContainer(), }; @@ -843,10 +843,10 @@ struct BuildRoadDepotWindow : public PickerWindowBase { { this->CreateNestedTree(desc); - this->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE); + this->LowerWidget(_road_depot_orientation + BRODW_DEPOT_NE); if ( _cur_roadtype == ROADTYPE_TRAM) { - this->GetWidget<NWidgetCore>(BRDW_CAPTION)->widget_data = STR_BUILD_DEPOT_TRAM_ORIENTATION_CAPTION; - for (int i = BRDW_DEPOT_NE; i <= BRDW_DEPOT_NW; i++) this->GetWidget<NWidgetCore>(i)->tool_tip = STR_BUILD_DEPOT_TRAM_ORIENTATION_SELECT_TOOLTIP; + this->GetWidget<NWidgetCore>(BRODW_CAPTION)->widget_data = STR_BUILD_DEPOT_TRAM_ORIENTATION_CAPTION; + for (int i = BRODW_DEPOT_NE; i <= BRODW_DEPOT_NW; i++) this->GetWidget<NWidgetCore>(i)->tool_tip = STR_BUILD_DEPOT_TRAM_ORIENTATION_SELECT_TOOLTIP; } this->FinishInitNested(desc, TRANSPORT_ROAD); @@ -854,21 +854,21 @@ struct BuildRoadDepotWindow : public PickerWindowBase { virtual void DrawWidget(const Rect &r, int widget) const { - if (!IsInsideMM(widget, BRDW_DEPOT_NE, BRDW_DEPOT_NW + 1)) return; + if (!IsInsideMM(widget, BRODW_DEPOT_NE, BRODW_DEPOT_NW + 1)) return; - DrawRoadDepotSprite(r.left - 1, r.top, (DiagDirection)(widget - BRDW_DEPOT_NE + DIAGDIR_NE), _cur_roadtype); + DrawRoadDepotSprite(r.left - 1, r.top, (DiagDirection)(widget - BRODW_DEPOT_NE + DIAGDIR_NE), _cur_roadtype); } virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case BRDW_DEPOT_NW: - case BRDW_DEPOT_NE: - case BRDW_DEPOT_SW: - case BRDW_DEPOT_SE: - this->RaiseWidget(_road_depot_orientation + BRDW_DEPOT_NE); - _road_depot_orientation = (DiagDirection)(widget - BRDW_DEPOT_NE); - this->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE); + case BRODW_DEPOT_NW: + case BRODW_DEPOT_NE: + case BRODW_DEPOT_SW: + case BRODW_DEPOT_SE: + this->RaiseWidget(_road_depot_orientation + BRODW_DEPOT_NE); + _road_depot_orientation = (DiagDirection)(widget - BRODW_DEPOT_NE); + this->LowerWidget(_road_depot_orientation + BRODW_DEPOT_NE); SndPlayFx(SND_15_BEEP); this->SetDirty(); break; @@ -882,25 +882,25 @@ struct BuildRoadDepotWindow : public PickerWindowBase { static const NWidgetPart _nested_build_road_depot_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), - NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, BRDW_CAPTION), SetDataTip(STR_BUILD_DEPOT_ROAD_ORIENTATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, BRODW_CAPTION), SetDataTip(STR_BUILD_DEPOT_ROAD_ORIENTATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), NWidget(WWT_PANEL, COLOUR_DARK_GREEN), NWidget(NWID_SPACER), SetMinimalSize(0, 3), NWidget(NWID_HORIZONTAL_LTR), NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), NWidget(NWID_VERTICAL), - NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_NW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, BRODW_DEPOT_NW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 2), - NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_SW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, BRODW_DEPOT_SW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), EndContainer(), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(2, 0), NWidget(NWID_VERTICAL), - NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_NE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, BRODW_DEPOT_NE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 2), - NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_SE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_GREY, BRODW_DEPOT_SE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_BUILD_DEPOT_ROAD_ORIENTATION_SELECT_TOOLTIP), EndContainer(), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0), diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index e9b025e12..00c2a5a35 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -147,15 +147,15 @@ enum SignListHotkeys { }; struct SignListWindow : QueryStringBaseWindow, SignList { - int text_offset; ///< Offset of the sign text relative to the left edge of the SLW_LIST widget. + int text_offset; ///< Offset of the sign text relative to the left edge of the SILW_LIST widget. Scrollbar *vscroll; SignListWindow(const WindowDesc *desc, WindowNumber window_number) : QueryStringBaseWindow(MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS) { this->CreateNestedTree(desc); - this->vscroll = this->GetScrollbar(SLW_SCROLLBAR); + this->vscroll = this->GetScrollbar(SILW_SCROLLBAR); this->FinishInitNested(desc, window_number); - this->SetWidgetLoweredState(SLW_FILTER_MATCH_CASE_BTN, SignList::match_case); + this->SetWidgetLoweredState(SILW_FILTER_MATCH_CASE_BTN, SignList::match_case); /* Initialize the text edit widget */ this->afilter = CS_ALPHANUMERAL; @@ -180,7 +180,7 @@ struct SignListWindow : QueryStringBaseWindow, SignList { this->edit_str_buf[0] = '\0'; UpdateTextBufferSize(&this->text); - this->SetWidgetDirty(SLW_FILTER_TEXT); + this->SetWidgetDirty(SILW_FILTER_TEXT); } /** @@ -198,17 +198,17 @@ struct SignListWindow : QueryStringBaseWindow, SignList { this->signs.SetFilterState(true); - this->EnableWidget(SLW_FILTER_CLEAR_BTN); + this->EnableWidget(SILW_FILTER_CLEAR_BTN); } else { /* There is no new string -> clear this->filter_string */ this->filter_string[0] = '\0'; this->signs.SetFilterState(!HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS)); // keep sign list filtering active if competitor signs should be hidden - this->DisableWidget(SLW_FILTER_CLEAR_BTN); + this->DisableWidget(SILW_FILTER_CLEAR_BTN); } /* Repaint the clear button since its disabled state may have changed */ - this->SetWidgetDirty(SLW_FILTER_CLEAR_BTN); + this->SetWidgetDirty(SILW_FILTER_CLEAR_BTN); /* Rebuild the list of signs */ this->InvalidateData(); @@ -218,13 +218,13 @@ struct SignListWindow : QueryStringBaseWindow, SignList { { if (this->signs.NeedRebuild()) this->BuildSortSignList(); this->DrawWidgets(); - if (!this->IsShaded()) this->DrawEditBox(SLW_FILTER_TEXT); + if (!this->IsShaded()) this->DrawEditBox(SILW_FILTER_TEXT); } virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { - case SLW_LIST: { + case SILW_LIST: { uint y = r.top + WD_FRAMERECT_TOP; // Offset from top of widget. /* No signs? */ if (this->vscroll->GetCount() == 0) { @@ -255,28 +255,28 @@ struct SignListWindow : QueryStringBaseWindow, SignList { virtual void SetStringParameters(int widget) const { - if (widget == SLW_CAPTION) SetDParam(0, this->vscroll->GetCount()); + if (widget == SILW_CAPTION) SetDParam(0, this->vscroll->GetCount()); } virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case SLW_LIST: { - uint id_v = this->vscroll->GetScrolledRowFromWidget(pt.y, this, SLW_LIST, WD_FRAMERECT_TOP); + case SILW_LIST: { + uint id_v = this->vscroll->GetScrolledRowFromWidget(pt.y, this, SILW_LIST, WD_FRAMERECT_TOP); if (id_v == INT_MAX) return; const Sign *si = this->signs[id_v]; ScrollMainWindowToTile(TileVirtXY(si->x, si->y)); break; } - case SLW_FILTER_CLEAR_BTN: + case SILW_FILTER_CLEAR_BTN: this->ClearFilterTextWidget(); // Empty the text in the EditBox widget this->SetFilterString(""); // Use empty text as filter text (= view all signs) break; - case SLW_FILTER_MATCH_CASE_BTN: + case SILW_FILTER_MATCH_CASE_BTN: SignList::match_case = !SignList::match_case; // Toggle match case - this->SetWidgetLoweredState(SLW_FILTER_MATCH_CASE_BTN, SignList::match_case); // Toggle button pushed state + this->SetWidgetLoweredState(SILW_FILTER_MATCH_CASE_BTN, SignList::match_case); // Toggle button pushed state this->InvalidateData(); // Rebuild the list of signs break; } @@ -284,13 +284,13 @@ struct SignListWindow : QueryStringBaseWindow, SignList { virtual void OnResize() { - this->vscroll->SetCapacityFromWidget(this, SLW_LIST, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM); + this->vscroll->SetCapacityFromWidget(this, SILW_LIST, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM); } virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case SLW_LIST: { + case SILW_LIST: { Dimension spr_dim = GetSpriteSize(SPR_COMPANY_ICON); this->text_offset = WD_FRAMETEXT_LEFT + spr_dim.width + 2; // 2 pixels space between icon and the sign text. resize->height = max<uint>(FONT_HEIGHT_NORMAL, spr_dim.height); @@ -299,7 +299,7 @@ struct SignListWindow : QueryStringBaseWindow, SignList { break; } - case SLW_CAPTION: + case SILW_CAPTION: SetDParam(0, max<size_t>(1000, Sign::GetPoolSize())); *size = GetStringBoundingBox(STR_SIGN_LIST_CAPTION); size->height += padding.height; @@ -311,7 +311,7 @@ struct SignListWindow : QueryStringBaseWindow, SignList { virtual EventState OnKeyPress(uint16 key, uint16 keycode) { EventState state = ES_NOT_HANDLED; - switch (this->HandleEditBoxKey(SLW_FILTER_TEXT, key, keycode, state)) { + switch (this->HandleEditBoxKey(SILW_FILTER_TEXT, key, keycode, state)) { case HEBR_EDITING: this->SetFilterString(this->text.buf); break; @@ -324,13 +324,13 @@ struct SignListWindow : QueryStringBaseWindow, SignList { return state; case HEBR_CANCEL: // ESC pressed, clear filter. - this->OnClick(Point(), SLW_FILTER_CLEAR_BTN, 1); // Simulate click on clear button. + this->OnClick(Point(), SILW_FILTER_CLEAR_BTN, 1); // Simulate click on clear button. this->UnfocusFocusedWidget(); // Unfocus the text box. return state; case HEBR_NOT_FOCUSED: // The filter text box is not globaly focused. if (CheckHotkeyMatch(signlist_hotkeys, keycode, this) == SLHK_FOCUS_FILTER_BOX) { - this->SetFocusedWidget(SLW_FILTER_TEXT); + this->SetFocusedWidget(SILW_FILTER_TEXT); SetFocusedWindow(this); // The user has asked to give focus to the text box, so make sure this window is focused. state = ES_HANDLED; } @@ -340,19 +340,19 @@ struct SignListWindow : QueryStringBaseWindow, SignList { NOT_REACHED(); } - if (state == ES_HANDLED) OnOSKInput(SLW_FILTER_TEXT); + if (state == ES_HANDLED) OnOSKInput(SILW_FILTER_TEXT); return state; } virtual void OnOSKInput(int widget) { - if (widget == SLW_FILTER_TEXT) this->SetFilterString(this->text.buf); + if (widget == SILW_FILTER_TEXT) this->SetFilterString(this->text.buf); } virtual void OnMouseLoop() { - this->HandleEditBox(SLW_FILTER_TEXT); + this->HandleEditBox(SILW_FILTER_TEXT); } void BuildSortSignList() @@ -360,7 +360,7 @@ struct SignListWindow : QueryStringBaseWindow, SignList { if (this->signs.NeedRebuild()) { this->BuildSignsList(); this->vscroll->SetCount(this->signs.Length()); - this->SetWidgetDirty(SLW_CAPTION); + this->SetWidgetDirty(SILW_CAPTION); } this->SortSignsList(); } @@ -406,26 +406,26 @@ Hotkey<SignListWindow> *_signlist_hotkeys = SignListWindow::signlist_hotkeys; static const NWidgetPart _nested_sign_list_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, SLW_CAPTION), SetDataTip(STR_SIGN_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), + NWidget(WWT_CAPTION, COLOUR_GREY, SILW_CAPTION), SetDataTip(STR_SIGN_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(NWID_VERTICAL), - NWidget(WWT_PANEL, COLOUR_GREY, SLW_LIST), SetMinimalSize(WD_FRAMETEXT_LEFT + 16 + 255 + WD_FRAMETEXT_RIGHT, 50), - SetResize(1, 10), SetFill(1, 0), SetScrollbar(SLW_SCROLLBAR), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY, SILW_LIST), SetMinimalSize(WD_FRAMETEXT_LEFT + 16 + 255 + WD_FRAMETEXT_RIGHT, 50), + SetResize(1, 10), SetFill(1, 0), SetScrollbar(SILW_SCROLLBAR), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(WWT_PANEL, COLOUR_GREY), SetFill(1, 1), - NWidget(WWT_EDITBOX, COLOUR_GREY, SLW_FILTER_TEXT), SetMinimalSize(80, 12), SetResize(1, 0), SetFill(1, 0), SetPadding(2, 2, 2, 2), + NWidget(WWT_EDITBOX, COLOUR_GREY, SILW_FILTER_TEXT), SetMinimalSize(80, 12), SetResize(1, 0), SetFill(1, 0), SetPadding(2, 2, 2, 2), SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP), EndContainer(), - NWidget(WWT_TEXTBTN, COLOUR_GREY, SLW_FILTER_MATCH_CASE_BTN), SetDataTip(STR_SIGN_LIST_MATCH_CASE, STR_SIGN_LIST_MATCH_CASE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SLW_FILTER_CLEAR_BTN), SetDataTip(STR_SIGN_LIST_CLEAR, STR_SIGN_LIST_CLEAR_TOOLTIP), + NWidget(WWT_TEXTBTN, COLOUR_GREY, SILW_FILTER_MATCH_CASE_BTN), SetDataTip(STR_SIGN_LIST_MATCH_CASE, STR_SIGN_LIST_MATCH_CASE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SILW_FILTER_CLEAR_BTN), SetDataTip(STR_SIGN_LIST_CLEAR, STR_SIGN_LIST_CLEAR_TOOLTIP), EndContainer(), EndContainer(), NWidget(NWID_VERTICAL), NWidget(NWID_VERTICAL), SetFill(0, 1), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, SLW_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_GREY, SILW_SCROLLBAR), EndContainer(), NWidget(WWT_RESIZEBOX, COLOUR_GREY), EndContainer(), diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index 71bb3f2cf..4d67bd53f 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(SLW_SCROLLBAR); + this->vscroll = this->GetScrollbar(SULW_SCROLLBAR); this->FinishInitNested(desc, window_number); this->OnInvalidateData(0); } virtual void OnClick(Point pt, int widget, int click_count) { - if (widget != SLW_PANEL) return; + if (widget != SULW_PANEL) return; - int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, SLW_PANEL, WD_FRAMERECT_TOP); + int y = this->vscroll->GetScrolledRowFromWidget(pt.y, this, SULW_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 != SLW_PANEL) return; + if (widget != SULW_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 != SLW_PANEL) return; + if (widget != SULW_PANEL) return; YearMonthDay ymd; ConvertDateToYMD(_date, &ymd); @@ -208,7 +208,7 @@ struct SubsidyListWindow : Window { virtual void OnResize() { - this->vscroll->SetCapacityFromWidget(this, SLW_PANEL); + this->vscroll->SetCapacityFromWidget(this, SULW_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, SLW_PANEL), SetDataTip(0x0, STR_SUBSIDIES_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER), SetResize(1, 1), SetScrollbar(SLW_SCROLLBAR), EndContainer(), + 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(NWID_VERTICAL), - NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, SLW_SCROLLBAR), + NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, SULW_SCROLLBAR), NWidget(WWT_RESIZEBOX, COLOUR_BROWN), EndContainer(), EndContainer(), diff --git a/src/widgets/graph_widget.h b/src/widgets/graph_widget.h index b2d95c98a..66c637086 100644 --- a/src/widgets/graph_widget.h +++ b/src/widgets/graph_widget.h @@ -12,6 +12,8 @@ #ifndef WIDGETS_GRAPH_WIDGET_H #define WIDGETS_GRAPH_WIDGET_H +#include "../economy_type.h" + /** Widgets of the WC_GRAPH_LEGEND. */ enum GraphLegendWidgetNumbers { GLW_BACKGROUND, diff --git a/src/widgets/newgrf_widget.h b/src/widgets/newgrf_widget.h index d76d3019b..b5d219fee 100644 --- a/src/widgets/newgrf_widget.h +++ b/src/widgets/newgrf_widget.h @@ -12,6 +12,8 @@ #ifndef WIDGETS_NEWGRF_WIDGET_H #define WIDGETS_NEWGRF_WIDGET_H +#include "../newgrf_config.h" + /** Widgets of the WC_GRF_PARAMETERS. */ enum ShowNewGRFParametersWidgets { GRFPAR_WIDGET_SHOW_NUMPAR, ///< #NWID_SELECTION to optionally display #GRFPAR_WIDGET_NUMPAR @@ -67,7 +69,7 @@ enum ShowNewGRFStateWidgets { /** Widgets of the WC_MODAL_PROGRESS (WC_MODAL_PROGRESS is also used in GenerationProgressWindowWidgets). */ enum ScanProgressWindowWidgets { SPWW_PROGRESS_BAR, ///< Simple progress bar. - GPWW_PROGRESS_TEXT, ///< Text explaining what is happening. + SPWW_PROGRESS_TEXT, ///< Text explaining what is happening. }; #endif /* WIDGETS_NEWGRF_WIDGET_H */ diff --git a/src/widgets/news_widget.h b/src/widgets/news_widget.h index 5326188a1..35925dff1 100644 --- a/src/widgets/news_widget.h +++ b/src/widgets/news_widget.h @@ -12,6 +12,8 @@ #ifndef WIDGETS_NEWS_WIDGET_H #define WIDGETS_NEWS_WIDGET_H +#include "../news_type.h" + /** Constants in the message options window. */ enum MessageOptionsSpace { MOS_WIDG_PER_SETTING = 4, ///< Number of widgets needed for each news category, starting at widget #WIDGET_NEWSOPT_START_OPTION. diff --git a/src/widgets/rail_widget.h b/src/widgets/rail_widget.h index ebf3b2584..0a56f985f 100644 --- a/src/widgets/rail_widget.h +++ b/src/widgets/rail_widget.h @@ -14,21 +14,22 @@ /** Widgets of the WC_BUILD_TOOLBAR (WC_BUILD_TOOLBAR is also used in others). */ enum RailToolbarWidgets { - RTW_CAPTION, - RTW_BUILD_NS, - RTW_BUILD_X, - RTW_BUILD_EW, - RTW_BUILD_Y, - RTW_AUTORAIL, - RTW_DEMOLISH, - RTW_BUILD_DEPOT, - RTW_BUILD_WAYPOINT, - RTW_BUILD_STATION, - RTW_BUILD_SIGNALS, - RTW_BUILD_BRIDGE, - RTW_BUILD_TUNNEL, - RTW_REMOVE, - RTW_CONVERT_RAIL, + /* Name starts with RA instead of R, becuase of collision with RoadToolbarWidgets */ + RATW_CAPTION, + RATW_BUILD_NS, + RATW_BUILD_X, + RATW_BUILD_EW, + RATW_BUILD_Y, + RATW_AUTORAIL, + RATW_DEMOLISH, + RATW_BUILD_DEPOT, + RATW_BUILD_WAYPOINT, + RATW_BUILD_STATION, + RATW_BUILD_SIGNALS, + RATW_BUILD_BRIDGE, + RATW_BUILD_TUNNEL, + RATW_REMOVE, + RATW_CONVERT_RAIL, }; /** Widgets of the WC_BUILD_STATION (WC_BUILD_STATION is also used in others). */ @@ -96,10 +97,11 @@ enum BuildSignalWidgets { /** Widgets of the WC_BUILD_DEPOT (WC_BUILD_DEPOT is also used in others). */ enum BuildRailDepotWidgets { - BRDW_DEPOT_NE, - BRDW_DEPOT_SE, - BRDW_DEPOT_SW, - BRDW_DEPOT_NW, + /* Name starts with BRA instead of BR, becuase of collision with BuildRoadDepotWidgets */ + BRADW_DEPOT_NE, + BRADW_DEPOT_SE, + BRADW_DEPOT_SW, + BRADW_DEPOT_NW, }; /** Widgets of the WC_BUILD_DEPOT (WC_BUILD_DEPOT is also used in others). */ diff --git a/src/widgets/road_widget.h b/src/widgets/road_widget.h index f2e5f54ca..2f948dfc9 100644 --- a/src/widgets/road_widget.h +++ b/src/widgets/road_widget.h @@ -14,26 +14,28 @@ /** Widgets of the WC_SCEN_BUILD_TOOLBAR / WC_BUILD_TOOLBAR (WC_SCEN_BUILD_TOOLBAR / WC_BUILD_TOOLBAR is also used in others). */ enum RoadToolbarWidgets { - RTW_ROAD_X, - RTW_ROAD_Y, - RTW_AUTOROAD, - RTW_DEMOLISH, - RTW_DEPOT, - RTW_BUS_STATION, - RTW_TRUCK_STATION, - RTW_ONE_WAY, - RTW_BUILD_BRIDGE, - RTW_BUILD_TUNNEL, - RTW_REMOVE, + /* Name starts with RO instead of R, becuase of collision with RailToolbarWidgets */ + ROTW_ROAD_X, + ROTW_ROAD_Y, + ROTW_AUTOROAD, + ROTW_DEMOLISH, + ROTW_DEPOT, + ROTW_BUS_STATION, + ROTW_TRUCK_STATION, + ROTW_ONE_WAY, + ROTW_BUILD_BRIDGE, + ROTW_BUILD_TUNNEL, + ROTW_REMOVE, }; /** Widgets of the WC_BUILD_DEPOT (WC_BUILD_DEPOT is also used in others). */ enum BuildRoadDepotWidgets { - BRDW_CAPTION, - BRDW_DEPOT_NE, - BRDW_DEPOT_SE, - BRDW_DEPOT_SW, - BRDW_DEPOT_NW, + /* Name starts with BRO instead of BR, becuase of collision with BuildRailDepotWidgets */ + BRODW_CAPTION, + BRODW_DEPOT_NE, + BRODW_DEPOT_SE, + BRODW_DEPOT_SW, + BRODW_DEPOT_NW, }; /** Widgets of the WC_BUS_STATION / WC_TRUCK_STATION. */ diff --git a/src/widgets/sign_widget.h b/src/widgets/sign_widget.h index 0163334cc..8d65bb309 100644 --- a/src/widgets/sign_widget.h +++ b/src/widgets/sign_widget.h @@ -14,12 +14,13 @@ /** Widgets of the WC_SIGN_LIST. */ enum SignListWidgets { - SLW_CAPTION, - SLW_LIST, - SLW_SCROLLBAR, - SLW_FILTER_TEXT, ///< Text box for typing a filter string - SLW_FILTER_MATCH_CASE_BTN, ///< Button to toggle if case sensitive filtering should be used - SLW_FILTER_CLEAR_BTN, ///< Button to clear the filter + /* Name starts with SI instead of S, becuase of collision with StationListWidgets */ + SILW_CAPTION, + SILW_LIST, + SILW_SCROLLBAR, + SILW_FILTER_TEXT, ///< Text box for typing a filter string + SILW_FILTER_MATCH_CASE_BTN, ///< Button to toggle if case sensitive filtering should be used + SILW_FILTER_CLEAR_BTN, ///< Button to clear the filter }; /** Widgets of the WC_QUERY_STRING (WC_QUERY_STRING is also used in QueryStringWidgets). */ diff --git a/src/widgets/subsidy_widget.h b/src/widgets/subsidy_widget.h index db6472c5f..656fd8604 100644 --- a/src/widgets/subsidy_widget.h +++ b/src/widgets/subsidy_widget.h @@ -14,8 +14,9 @@ /** Widgets of the WC_SUBSIDIES_LIST. */ enum SubsidyListWidgets { - SLW_PANEL, - SLW_SCROLLBAR, + /* Name starts with SU instead of S, becuase of collision with StationListWidgets */ + SULW_PANEL, + SULW_SCROLLBAR, }; #endif /* WIDGETS_SUBSIDY_WIDGET_H */ |