diff options
author | rubidium <rubidium@openttd.org> | 2011-12-16 16:57:56 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-12-16 16:57:56 +0000 |
commit | b8640b986f2a7188b7a21d4093a211b21a926c3e (patch) | |
tree | 3e451a7b233bac1eaf1a1e94a513144643b6dba3 /src | |
parent | 5ade484ce4e7a92a0932a48d3cec1aca513d1282 (diff) | |
download | openttd-b8640b986f2a7188b7a21d4093a211b21a926c3e.tar.xz |
(svn r23539) -Codechange: prevent conflict between widget naming of (vehicle) depots and vehicle details
Diffstat (limited to 'src')
-rw-r--r-- | src/depot_gui.cpp | 198 | ||||
-rw-r--r-- | src/widgets/depot_widget.h | 38 |
2 files changed, 118 insertions, 118 deletions
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index f230269af..d400f115d 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -44,37 +44,37 @@ static const NWidgetPart _nested_train_depot_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), - NWidget(WWT_CAPTION, COLOUR_GREY, WID_VD_CAPTION), SetDataTip(STR_DEPOT_CAPTION, STR_NULL), + NWidget(WWT_CAPTION, COLOUR_GREY, WID_D_CAPTION), SetDataTip(STR_DEPOT_CAPTION, STR_NULL), NWidget(WWT_SHADEBOX, COLOUR_GREY), NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(NWID_VERTICAL), - NWidget(WWT_MATRIX, COLOUR_GREY, WID_VD_MATRIX), SetDataTip(0x0, STR_NULL), SetResize(1, 1), SetScrollbar(WID_VD_V_SCROLL), - NWidget(NWID_SELECTION, INVALID_COLOUR, WID_VD_SHOW_H_SCROLL), - NWidget(NWID_HSCROLLBAR, COLOUR_GREY, WID_VD_H_SCROLL), + NWidget(WWT_MATRIX, COLOUR_GREY, WID_D_MATRIX), SetDataTip(0x0, STR_NULL), SetResize(1, 1), SetScrollbar(WID_D_V_SCROLL), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_D_SHOW_H_SCROLL), + NWidget(NWID_HSCROLLBAR, COLOUR_GREY, WID_D_H_SCROLL), EndContainer(), EndContainer(), NWidget(NWID_VERTICAL), - NWidget(WWT_IMGBTN, COLOUR_GREY, WID_VD_SELL), SetDataTip(0x0, STR_NULL), SetResize(0, 1), SetFill(0, 1), - NWidget(NWID_SELECTION, INVALID_COLOUR, WID_VD_SHOW_SELL_CHAIN), - NWidget(WWT_IMGBTN, COLOUR_GREY, WID_VD_SELL_CHAIN), SetDataTip(SPR_SELL_CHAIN_TRAIN, STR_DEPOT_DRAG_WHOLE_TRAIN_TO_SELL_TOOLTIP), SetResize(0, 1), SetFill(0, 1), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_D_SELL), SetDataTip(0x0, STR_NULL), SetResize(0, 1), SetFill(0, 1), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_D_SHOW_SELL_CHAIN), + NWidget(WWT_IMGBTN, COLOUR_GREY, WID_D_SELL_CHAIN), SetDataTip(SPR_SELL_CHAIN_TRAIN, STR_DEPOT_DRAG_WHOLE_TRAIN_TO_SELL_TOOLTIP), SetResize(0, 1), SetFill(0, 1), EndContainer(), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VD_SELL_ALL), SetDataTip(0x0, STR_NULL), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VD_AUTOREPLACE), SetDataTip(0x0, STR_NULL), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_D_SELL_ALL), SetDataTip(0x0, STR_NULL), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_D_AUTOREPLACE), SetDataTip(0x0, STR_NULL), EndContainer(), - NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_VD_V_SCROLL), + NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_D_V_SCROLL), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VD_BUILD), SetDataTip(0x0, STR_NULL), SetFill(1, 1), SetResize(1, 0), - NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_VD_CLONE), SetDataTip(0x0, STR_NULL), SetFill(1, 1), SetResize(1, 0), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VD_LOCATION), SetDataTip(STR_BUTTON_LOCATION, STR_NULL), SetFill(1, 1), SetResize(1, 0), - NWidget(NWID_SELECTION, INVALID_COLOUR, WID_VD_SHOW_RENAME), // rename button - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VD_RENAME), SetDataTip(STR_BUTTON_RENAME, STR_DEPOT_RENAME_TOOLTIP), SetFill(1, 1), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_D_BUILD), SetDataTip(0x0, STR_NULL), SetFill(1, 1), SetResize(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_D_CLONE), SetDataTip(0x0, STR_NULL), SetFill(1, 1), SetResize(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_D_LOCATION), SetDataTip(STR_BUTTON_LOCATION, STR_NULL), SetFill(1, 1), SetResize(1, 0), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_D_SHOW_RENAME), // rename button + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_D_RENAME), SetDataTip(STR_BUTTON_RENAME, STR_DEPOT_RENAME_TOOLTIP), SetFill(1, 1), SetResize(1, 0), EndContainer(), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VD_VEHICLE_LIST), SetDataTip(0x0, STR_NULL), SetFill(0, 1), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VD_STOP_ALL), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_NULL), SetFill(0, 1), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VD_START_ALL), SetDataTip(SPR_FLAG_VEH_RUNNING, STR_NULL), SetFill(0, 1), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_D_VEHICLE_LIST), SetDataTip(0x0, STR_NULL), SetFill(0, 1), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_D_STOP_ALL), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_NULL), SetFill(0, 1), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_D_START_ALL), SetDataTip(SPR_FLAG_VEH_RUNNING, STR_NULL), SetFill(0, 1), NWidget(WWT_RESIZEBOX, COLOUR_GREY), EndContainer(), }; @@ -144,7 +144,7 @@ static void TrainDepotMoveVehicle(const Vehicle *wagon, VehicleID sel, const Veh } /** - * Array containing the cell size in pixels of the #WID_VD_MATRIX widget for each vehicle type. + * Array containing the cell size in pixels of the #WID_D_MATRIX widget for each vehicle type. * @note The train vehicle type uses the entire row for each train. */ static Dimension _base_block_sizes[4]; @@ -221,13 +221,13 @@ struct DepotWindow : Window { this->num_columns = 1; // for non-trains this gets set in FinishInitNested() this->CreateNestedTree(desc); - this->hscroll = (this->type == VEH_TRAIN ? this->GetScrollbar(WID_VD_H_SCROLL) : NULL); - this->vscroll = this->GetScrollbar(WID_VD_V_SCROLL); + this->hscroll = (this->type == VEH_TRAIN ? this->GetScrollbar(WID_D_H_SCROLL) : NULL); + this->vscroll = this->GetScrollbar(WID_D_V_SCROLL); /* Don't show 'rename button' of aircraft hangar */ - this->GetWidget<NWidgetStacked>(WID_VD_SHOW_RENAME)->SetDisplayedPlane(type == VEH_AIRCRAFT ? SZSP_NONE : 0); + this->GetWidget<NWidgetStacked>(WID_D_SHOW_RENAME)->SetDisplayedPlane(type == VEH_AIRCRAFT ? SZSP_NONE : 0); /* Only train depots have a horizontal scrollbar and a 'sell chain' button */ - this->GetWidget<NWidgetStacked>(WID_VD_SHOW_H_SCROLL)->SetDisplayedPlane(type == VEH_TRAIN ? 0 : SZSP_HORIZONTAL); - this->GetWidget<NWidgetStacked>(WID_VD_SHOW_SELL_CHAIN)->SetDisplayedPlane(type == VEH_TRAIN ? 0 : SZSP_NONE); + this->GetWidget<NWidgetStacked>(WID_D_SHOW_H_SCROLL)->SetDisplayedPlane(type == VEH_TRAIN ? 0 : SZSP_HORIZONTAL); + this->GetWidget<NWidgetStacked>(WID_D_SHOW_SELL_CHAIN)->SetDisplayedPlane(type == VEH_TRAIN ? 0 : SZSP_NONE); this->SetupWidgetData(type); this->FinishInitNested(desc, tile); @@ -310,12 +310,12 @@ struct DepotWindow : Window { void DrawWidget(const Rect &r, int widget) const { - if (widget != WID_VD_MATRIX) return; + if (widget != WID_D_MATRIX) return; bool rtl = _current_text_dir == TD_RTL; /* Set the row and number of boxes in each row based on the number of boxes drawn in the matrix */ - uint16 mat_data = this->GetWidget<NWidgetCore>(WID_VD_MATRIX)->widget_data; + uint16 mat_data = this->GetWidget<NWidgetCore>(WID_D_MATRIX)->widget_data; uint16 rows_in_display = GB(mat_data, MAT_ROW_START, MAT_ROW_BITS); uint16 boxes_in_each_row = GB(mat_data, MAT_COL_START, MAT_COL_BITS); @@ -346,7 +346,7 @@ struct DepotWindow : Window { void SetStringParameters(int widget) const { - if (widget != WID_VD_CAPTION) return; + if (widget != WID_D_CAPTION) return; /* locate the depot struct */ TileIndex tile = this->window_number; @@ -368,7 +368,7 @@ struct DepotWindow : Window { DepotGUIAction GetVehicleFromDepotWndPt(int x, int y, const Vehicle **veh, GetDepotVehiclePtData *d) const { - const NWidgetCore *matrix_widget = this->GetWidget<NWidgetCore>(WID_VD_MATRIX); + const NWidgetCore *matrix_widget = this->GetWidget<NWidgetCore>(WID_D_MATRIX); /* In case of RTL the widgets are swapped as a whole */ if (_current_text_dir == TD_RTL) x = matrix_widget->current_x - x; @@ -514,56 +514,56 @@ struct DepotWindow : Window { */ void SetupWidgetData(VehicleType type) { - this->GetWidget<NWidgetCore>(WID_VD_STOP_ALL)->tool_tip = STR_DEPOT_MASS_STOP_DEPOT_TRAIN_TOOLTIP + type; - this->GetWidget<NWidgetCore>(WID_VD_START_ALL)->tool_tip = STR_DEPOT_MASS_START_DEPOT_TRAIN_TOOLTIP + type; - this->GetWidget<NWidgetCore>(WID_VD_SELL)->tool_tip = STR_DEPOT_TRAIN_SELL_TOOLTIP + type; - this->GetWidget<NWidgetCore>(WID_VD_SELL_ALL)->tool_tip = STR_DEPOT_SELL_ALL_BUTTON_TRAIN_TOOLTIP + type; + this->GetWidget<NWidgetCore>(WID_D_STOP_ALL)->tool_tip = STR_DEPOT_MASS_STOP_DEPOT_TRAIN_TOOLTIP + type; + this->GetWidget<NWidgetCore>(WID_D_START_ALL)->tool_tip = STR_DEPOT_MASS_START_DEPOT_TRAIN_TOOLTIP + type; + this->GetWidget<NWidgetCore>(WID_D_SELL)->tool_tip = STR_DEPOT_TRAIN_SELL_TOOLTIP + type; + this->GetWidget<NWidgetCore>(WID_D_SELL_ALL)->tool_tip = STR_DEPOT_SELL_ALL_BUTTON_TRAIN_TOOLTIP + type; - this->GetWidget<NWidgetCore>(WID_VD_BUILD)->SetDataTip(STR_DEPOT_TRAIN_NEW_VEHICLES_BUTTON + type, STR_DEPOT_TRAIN_NEW_VEHICLES_TOOLTIP + type); - this->GetWidget<NWidgetCore>(WID_VD_CLONE)->SetDataTip(STR_DEPOT_CLONE_TRAIN + type, STR_DEPOT_CLONE_TRAIN_DEPOT_INFO + type); + this->GetWidget<NWidgetCore>(WID_D_BUILD)->SetDataTip(STR_DEPOT_TRAIN_NEW_VEHICLES_BUTTON + type, STR_DEPOT_TRAIN_NEW_VEHICLES_TOOLTIP + type); + this->GetWidget<NWidgetCore>(WID_D_CLONE)->SetDataTip(STR_DEPOT_CLONE_TRAIN + type, STR_DEPOT_CLONE_TRAIN_DEPOT_INFO + type); - this->GetWidget<NWidgetCore>(WID_VD_LOCATION)->tool_tip = STR_DEPOT_TRAIN_LOCATION_TOOLTIP + type; - this->GetWidget<NWidgetCore>(WID_VD_VEHICLE_LIST)->tool_tip = STR_DEPOT_VEHICLE_ORDER_LIST_TRAIN_TOOLTIP + type; - this->GetWidget<NWidgetCore>(WID_VD_AUTOREPLACE)->tool_tip = STR_DEPOT_AUTOREPLACE_TRAIN_TOOLTIP + type; - this->GetWidget<NWidgetCore>(WID_VD_MATRIX)->tool_tip = STR_DEPOT_TRAIN_LIST_TOOLTIP + this->type; + this->GetWidget<NWidgetCore>(WID_D_LOCATION)->tool_tip = STR_DEPOT_TRAIN_LOCATION_TOOLTIP + type; + this->GetWidget<NWidgetCore>(WID_D_VEHICLE_LIST)->tool_tip = STR_DEPOT_VEHICLE_ORDER_LIST_TRAIN_TOOLTIP + type; + this->GetWidget<NWidgetCore>(WID_D_AUTOREPLACE)->tool_tip = STR_DEPOT_AUTOREPLACE_TRAIN_TOOLTIP + type; + this->GetWidget<NWidgetCore>(WID_D_MATRIX)->tool_tip = STR_DEPOT_TRAIN_LIST_TOOLTIP + this->type; switch (type) { default: NOT_REACHED(); case VEH_TRAIN: - this->GetWidget<NWidgetCore>(WID_VD_VEHICLE_LIST)->widget_data = STR_TRAIN; + this->GetWidget<NWidgetCore>(WID_D_VEHICLE_LIST)->widget_data = STR_TRAIN; /* Sprites */ - this->GetWidget<NWidgetCore>(WID_VD_SELL)->widget_data = SPR_SELL_TRAIN; - this->GetWidget<NWidgetCore>(WID_VD_SELL_ALL)->widget_data = SPR_SELL_ALL_TRAIN; - this->GetWidget<NWidgetCore>(WID_VD_AUTOREPLACE)->widget_data = SPR_REPLACE_TRAIN; + this->GetWidget<NWidgetCore>(WID_D_SELL)->widget_data = SPR_SELL_TRAIN; + this->GetWidget<NWidgetCore>(WID_D_SELL_ALL)->widget_data = SPR_SELL_ALL_TRAIN; + this->GetWidget<NWidgetCore>(WID_D_AUTOREPLACE)->widget_data = SPR_REPLACE_TRAIN; break; case VEH_ROAD: - this->GetWidget<NWidgetCore>(WID_VD_VEHICLE_LIST)->widget_data = STR_LORRY; + this->GetWidget<NWidgetCore>(WID_D_VEHICLE_LIST)->widget_data = STR_LORRY; /* Sprites */ - this->GetWidget<NWidgetCore>(WID_VD_SELL)->widget_data = SPR_SELL_ROADVEH; - this->GetWidget<NWidgetCore>(WID_VD_SELL_ALL)->widget_data = SPR_SELL_ALL_ROADVEH; - this->GetWidget<NWidgetCore>(WID_VD_AUTOREPLACE)->widget_data = SPR_REPLACE_ROADVEH; + this->GetWidget<NWidgetCore>(WID_D_SELL)->widget_data = SPR_SELL_ROADVEH; + this->GetWidget<NWidgetCore>(WID_D_SELL_ALL)->widget_data = SPR_SELL_ALL_ROADVEH; + this->GetWidget<NWidgetCore>(WID_D_AUTOREPLACE)->widget_data = SPR_REPLACE_ROADVEH; break; case VEH_SHIP: - this->GetWidget<NWidgetCore>(WID_VD_VEHICLE_LIST)->widget_data = STR_SHIP; + this->GetWidget<NWidgetCore>(WID_D_VEHICLE_LIST)->widget_data = STR_SHIP; /* Sprites */ - this->GetWidget<NWidgetCore>(WID_VD_SELL)->widget_data = SPR_SELL_SHIP; - this->GetWidget<NWidgetCore>(WID_VD_SELL_ALL)->widget_data = SPR_SELL_ALL_SHIP; - this->GetWidget<NWidgetCore>(WID_VD_AUTOREPLACE)->widget_data = SPR_REPLACE_SHIP; + this->GetWidget<NWidgetCore>(WID_D_SELL)->widget_data = SPR_SELL_SHIP; + this->GetWidget<NWidgetCore>(WID_D_SELL_ALL)->widget_data = SPR_SELL_ALL_SHIP; + this->GetWidget<NWidgetCore>(WID_D_AUTOREPLACE)->widget_data = SPR_REPLACE_SHIP; break; case VEH_AIRCRAFT: - this->GetWidget<NWidgetCore>(WID_VD_VEHICLE_LIST)->widget_data = STR_PLANE; + this->GetWidget<NWidgetCore>(WID_D_VEHICLE_LIST)->widget_data = STR_PLANE; /* Sprites */ - this->GetWidget<NWidgetCore>(WID_VD_SELL)->widget_data = SPR_SELL_AIRCRAFT; - this->GetWidget<NWidgetCore>(WID_VD_SELL_ALL)->widget_data = SPR_SELL_ALL_AIRCRAFT; - this->GetWidget<NWidgetCore>(WID_VD_AUTOREPLACE)->widget_data = SPR_REPLACE_AIRCRAFT; + this->GetWidget<NWidgetCore>(WID_D_SELL)->widget_data = SPR_SELL_AIRCRAFT; + this->GetWidget<NWidgetCore>(WID_D_SELL_ALL)->widget_data = SPR_SELL_ALL_AIRCRAFT; + this->GetWidget<NWidgetCore>(WID_D_AUTOREPLACE)->widget_data = SPR_REPLACE_AIRCRAFT; break; } } @@ -576,7 +576,7 @@ struct DepotWindow : Window { virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { - case WID_VD_MATRIX: { + case WID_D_MATRIX: { uint min_height = 0; if (this->type == VEH_TRAIN) { @@ -658,15 +658,15 @@ struct DepotWindow : Window { /* Setup disabled buttons. */ TileIndex tile = this->window_number; this->SetWidgetsDisabledState(!IsTileOwner(tile, _local_company), - WID_VD_STOP_ALL, - WID_VD_START_ALL, - WID_VD_SELL, - WID_VD_SELL_CHAIN, - WID_VD_SELL_ALL, - WID_VD_BUILD, - WID_VD_CLONE, - WID_VD_RENAME, - WID_VD_AUTOREPLACE, + WID_D_STOP_ALL, + WID_D_START_ALL, + WID_D_SELL, + WID_D_SELL_CHAIN, + WID_D_SELL_ALL, + WID_D_BUILD, + WID_D_CLONE, + WID_D_RENAME, + WID_D_AUTOREPLACE, WIDGET_LIST_END); this->DrawWidgets(); @@ -675,22 +675,22 @@ struct DepotWindow : Window { virtual void OnClick(Point pt, int widget, int click_count) { switch (widget) { - case WID_VD_MATRIX: { // List - NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_VD_MATRIX); + case WID_D_MATRIX: { // List + NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_D_MATRIX); this->DepotClick(pt.x - nwi->pos_x, pt.y - nwi->pos_y); break; } - case WID_VD_BUILD: // Build vehicle + case WID_D_BUILD: // Build vehicle ResetObjectToPlace(); ShowBuildVehicleWindow(this->window_number, this->type); break; - case WID_VD_CLONE: // Clone button - this->SetWidgetDirty(WID_VD_CLONE); - this->ToggleWidgetLoweredState(WID_VD_CLONE); + case WID_D_CLONE: // Clone button + this->SetWidgetDirty(WID_D_CLONE); + this->ToggleWidgetLoweredState(WID_D_CLONE); - if (this->IsWidgetLowered(WID_VD_CLONE)) { + if (this->IsWidgetLowered(WID_D_CLONE)) { static const CursorID clone_icons[] = { SPR_CURSOR_CLONE_TRAIN, SPR_CURSOR_CLONE_ROADVEH, SPR_CURSOR_CLONE_SHIP, SPR_CURSOR_CLONE_AIRPLANE @@ -702,7 +702,7 @@ struct DepotWindow : Window { } break; - case WID_VD_LOCATION: + case WID_D_LOCATION: if (_ctrl_pressed) { ShowExtraViewPortWindow(this->window_number); } else { @@ -710,20 +710,20 @@ struct DepotWindow : Window { } break; - case WID_VD_RENAME: // Rename button + case WID_D_RENAME: // Rename button SetDParam(0, this->type); SetDParam(1, Depot::GetByTile((TileIndex)this->window_number)->index); ShowQueryString(STR_DEPOT_NAME, STR_DEPOT_RENAME_DEPOT_CAPTION, MAX_LENGTH_DEPOT_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); break; - case WID_VD_STOP_ALL: - case WID_VD_START_ALL: { + case WID_D_STOP_ALL: + case WID_D_START_ALL: { VehicleListIdentifier vli(VL_DEPOT_LIST, this->type, this->owner); - DoCommandP(this->window_number, (widget == WID_VD_START_ALL ? (1 << 0) : 0), vli.Pack(), CMD_MASS_START_STOP); + DoCommandP(this->window_number, (widget == WID_D_START_ALL ? (1 << 0) : 0), vli.Pack(), CMD_MASS_START_STOP); break; } - case WID_VD_SELL_ALL: + case WID_D_SELL_ALL: /* Only open the confimation window if there are anything to sell */ if (this->vehicle_list.Length() != 0 || this->wagon_list.Length() != 0) { TileIndex tile = this->window_number; @@ -740,11 +740,11 @@ struct DepotWindow : Window { } break; - case WID_VD_VEHICLE_LIST: + case WID_D_VEHICLE_LIST: ShowVehicleListWindow(GetTileOwner(this->window_number), this->type, (TileIndex)this->window_number); break; - case WID_VD_AUTOREPLACE: + case WID_D_AUTOREPLACE: DoCommandP(this->window_number, this->type, 0, CMD_DEPOT_MASS_AUTOREPLACE); break; @@ -761,11 +761,11 @@ struct DepotWindow : Window { virtual bool OnRightClick(Point pt, int widget) { - if (widget != WID_VD_MATRIX) return false; + if (widget != WID_D_MATRIX) return false; GetDepotVehiclePtData gdvp = { NULL, NULL }; const Vehicle *v = NULL; - NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_VD_MATRIX); + NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_D_MATRIX); DepotGUIAction mode = this->GetVehicleFromDepotWndPt(pt.x - nwi->pos_x, pt.y - nwi->pos_y, &v, &gdvp); if (this->type == VEH_TRAIN) v = gdvp.wagon; @@ -831,13 +831,13 @@ struct DepotWindow : Window { virtual void OnPlaceObjectAbort() { /* abort clone */ - this->RaiseWidget(WID_VD_CLONE); - this->SetWidgetDirty(WID_VD_CLONE); + this->RaiseWidget(WID_D_CLONE); + this->SetWidgetDirty(WID_D_CLONE); /* abort drag & drop */ this->sel = INVALID_VEHICLE; this->vehicle_over = INVALID_VEHICLE; - this->SetWidgetDirty(WID_VD_MATRIX); + this->SetWidgetDirty(WID_D_MATRIX); } virtual void OnMouseDrag(Point pt, int widget) @@ -845,10 +845,10 @@ struct DepotWindow : Window { if (this->type != VEH_TRAIN || this->sel == INVALID_VEHICLE) return; /* A rail vehicle is dragged.. */ - if (widget != WID_VD_MATRIX) { // ..outside of the depot matrix. + if (widget != WID_D_MATRIX) { // ..outside of the depot matrix. if (this->vehicle_over != INVALID_VEHICLE) { this->vehicle_over = INVALID_VEHICLE; - this->SetWidgetDirty(WID_VD_MATRIX); + this->SetWidgetDirty(WID_D_MATRIX); } return; } @@ -883,14 +883,14 @@ struct DepotWindow : Window { virtual void OnDragDrop(Point pt, int widget) { switch (widget) { - case WID_VD_MATRIX: { + case WID_D_MATRIX: { const Vehicle *v = NULL; VehicleID sel = this->sel; this->sel = INVALID_VEHICLE; this->SetDirty(); - NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_VD_MATRIX); + NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_D_MATRIX); if (this->type == VEH_TRAIN) { GetDepotVehiclePtData gdvp = { NULL, NULL }; @@ -911,7 +911,7 @@ struct DepotWindow : Window { break; } - case WID_VD_SELL: case WID_VD_SELL_CHAIN: { + case WID_D_SELL: case WID_D_SELL_CHAIN: { if (this->IsWidgetDisabled(widget)) return; if (this->sel == INVALID_VEHICLE) return; @@ -921,7 +921,7 @@ struct DepotWindow : Window { this->sel = INVALID_VEHICLE; this->SetDirty(); - int sell_cmd = (v->type == VEH_TRAIN && (widget == WID_VD_SELL_CHAIN || _ctrl_pressed)) ? 1 : 0; + int sell_cmd = (v->type == VEH_TRAIN && (widget == WID_D_SELL_CHAIN || _ctrl_pressed)) ? 1 : 0; DoCommandP(v->tile, v->index | sell_cmd << 20 | MAKE_ORDER_BACKUP_FLAG, 0, GetCmdSellVeh(v->type)); break; } @@ -935,20 +935,20 @@ struct DepotWindow : Window { virtual void OnTimeout() { - if (!this->IsWidgetDisabled(WID_VD_SELL)) { - this->RaiseWidget(WID_VD_SELL); - this->SetWidgetDirty(WID_VD_SELL); + if (!this->IsWidgetDisabled(WID_D_SELL)) { + this->RaiseWidget(WID_D_SELL); + this->SetWidgetDirty(WID_D_SELL); } - if (this->nested_array[WID_VD_SELL] != NULL && !this->IsWidgetDisabled(WID_VD_SELL_CHAIN)) { - this->RaiseWidget(WID_VD_SELL_CHAIN); - this->SetWidgetDirty(WID_VD_SELL_CHAIN); + if (this->nested_array[WID_D_SELL] != NULL && !this->IsWidgetDisabled(WID_D_SELL_CHAIN)) { + this->RaiseWidget(WID_D_SELL_CHAIN); + this->SetWidgetDirty(WID_D_SELL_CHAIN); } } virtual void OnResize() { - NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_VD_MATRIX); - this->vscroll->SetCapacityFromWidget(this, WID_VD_MATRIX); + NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_D_MATRIX); + this->vscroll->SetCapacityFromWidget(this, WID_D_MATRIX); if (this->type == VEH_TRAIN) { this->hscroll->SetCapacity(nwi->current_x - this->header_width - this->count_width); nwi->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); @@ -962,7 +962,7 @@ struct DepotWindow : Window { { if (this->sel != INVALID_VEHICLE) { _cursor.vehchain = _ctrl_pressed; - this->SetWidgetDirty(WID_VD_MATRIX); + this->SetWidgetDirty(WID_D_MATRIX); return ES_HANDLED; } diff --git a/src/widgets/depot_widget.h b/src/widgets/depot_widget.h index d849bcd18..d15207e61 100644 --- a/src/widgets/depot_widget.h +++ b/src/widgets/depot_widget.h @@ -13,25 +13,25 @@ #define WIDGETS_DEPOT_WIDGET_H /** Widgets of the WC_VEHICLE_DEPOT. */ -enum VehicleDepotWidgets { - WID_VD_CAPTION, ///< Caption of window. - WID_VD_SELL, ///< Sell button. - WID_VD_SHOW_SELL_CHAIN, ///< Show sell chain panel. - WID_VD_SELL_CHAIN, ///< Sell chain button. - WID_VD_SELL_ALL, ///< Sell all button. - WID_VD_AUTOREPLACE, ///< Autoreplace button. - WID_VD_MATRIX, ///< Matrix of vehicles. - WID_VD_V_SCROLL, ///< Vertical scrollbar. - WID_VD_SHOW_H_SCROLL, ///< Show horizontal scrollbar panel. - WID_VD_H_SCROLL, ///< Horizontal scrollbar. - WID_VD_BUILD, ///< Build button. - WID_VD_CLONE, ///< Clone button. - WID_VD_LOCATION, ///< Location button. - WID_VD_SHOW_RENAME, ///< Show rename panel. - WID_VD_RENAME, ///< Rename button. - WID_VD_VEHICLE_LIST, ///< List of vehicles. - WID_VD_STOP_ALL, ///< Stop all button. - WID_VD_START_ALL, ///< Start all button. +enum DepotWidgets { + WID_D_CAPTION, ///< Caption of window. + WID_D_SELL, ///< Sell button. + WID_D_SHOW_SELL_CHAIN, ///< Show sell chain panel. + WID_D_SELL_CHAIN, ///< Sell chain button. + WID_D_SELL_ALL, ///< Sell all button. + WID_D_AUTOREPLACE, ///< Autoreplace button. + WID_D_MATRIX, ///< Matrix of vehicles. + WID_D_V_SCROLL, ///< Vertical scrollbar. + WID_D_SHOW_H_SCROLL, ///< Show horizontal scrollbar panel. + WID_D_H_SCROLL, ///< Horizontal scrollbar. + WID_D_BUILD, ///< Build button. + WID_D_CLONE, ///< Clone button. + WID_D_LOCATION, ///< Location button. + WID_D_SHOW_RENAME, ///< Show rename panel. + WID_D_RENAME, ///< Rename button. + WID_D_VEHICLE_LIST, ///< List of vehicles. + WID_D_STOP_ALL, ///< Stop all button. + WID_D_START_ALL, ///< Start all button. }; #endif /* WIDGETS_DEPOT_WIDGET_H */ |