summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/smallmap_gui.cpp126
-rw-r--r--src/station_cmd.cpp24
-rw-r--r--src/station_gui.cpp256
-rw-r--r--src/widgets/smallmap_widget.h40
-rw-r--r--src/widgets/station_widget.h58
5 files changed, 251 insertions, 253 deletions
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index 1011ba584..2c43c33de 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -565,7 +565,7 @@ static const byte _vehicle_type_colours[6] = {
/** Class managing the smallmap window. */
class SmallMapWindow : public Window {
- /** Types of legends in the #SM_WIDGET_LEGEND widget. */
+ /** Types of legends in the #WID_SM_LEGEND widget. */
enum SmallMapType {
SMT_CONTOUR,
SMT_VEHICLES,
@@ -585,10 +585,10 @@ class SmallMapWindow : public Window {
static SmallMapType map_type; ///< Currently displayed legends.
static bool show_towns; ///< Display town names in the smallmap.
- static const uint LEGEND_BLOB_WIDTH = 8; ///< Width of the coloured blob in front of a line text in the #SM_WIDGET_LEGEND widget.
- static const uint INDUSTRY_MIN_NUMBER_OF_COLUMNS = 2; ///< Minimal number of columns in the #SM_WIDGET_LEGEND widget for the #SMT_INDUSTRY legend.
+ static const uint LEGEND_BLOB_WIDTH = 8; ///< Width of the coloured blob in front of a line text in the #WID_SM_LEGEND widget.
+ static const uint INDUSTRY_MIN_NUMBER_OF_COLUMNS = 2; ///< Minimal number of columns in the #WID_SM_LEGEND widget for the #SMT_INDUSTRY legend.
uint min_number_of_fixed_rows; ///< Minimal number of rows in the legends for the fixed layouts only (all except #SMT_INDUSTRY).
- uint column_width; ///< Width of a column in the #SM_WIDGET_LEGEND widget.
+ uint column_width; ///< Width of a column in the #WID_SM_LEGEND widget.
int32 scroll_x; ///< Horizontal world coordinate of the base tile left of the top-left corner of the smallmap display.
int32 scroll_y; ///< Vertical world coordinate of the base tile left of the top-left corner of the smallmap display.
@@ -731,8 +731,8 @@ class SmallMapWindow : public Window {
this->SetNewScroll(this->scroll_x + (tile.x - new_tile.x) * TILE_SIZE,
this->scroll_y + (tile.y - new_tile.y) * TILE_SIZE, sub);
}
- this->SetWidgetDisabledState(SM_WIDGET_ZOOM_IN, this->zoom == zoomlevels[MIN_ZOOM_INDEX]);
- this->SetWidgetDisabledState(SM_WIDGET_ZOOM_OUT, this->zoom == zoomlevels[MAX_ZOOM_INDEX]);
+ this->SetWidgetDisabledState(WID_SM_ZOOM_IN, this->zoom == zoomlevels[MIN_ZOOM_INDEX]);
+ this->SetWidgetDisabledState(WID_SM_ZOOM_OUT, this->zoom == zoomlevels[MAX_ZOOM_INDEX]);
this->SetDirty();
}
}
@@ -1042,10 +1042,10 @@ class SmallMapWindow : public Window {
break;
}
- this->GetWidget<NWidgetCore>(SM_WIDGET_LEGEND)->SetDataTip(STR_NULL, legend_tooltip);
- this->GetWidget<NWidgetCore>(SM_WIDGET_ENABLE_ALL)->SetDataTip(STR_SMALLMAP_ENABLE_ALL, enable_all_tooltip);
- this->GetWidget<NWidgetCore>(SM_WIDGET_DISABLE_ALL)->SetDataTip(STR_SMALLMAP_DISABLE_ALL, disable_all_tooltip);
- this->GetWidget<NWidgetStacked>(SM_WIDGET_SELECT_BUTTONS)->SetDisplayedPlane(plane);
+ this->GetWidget<NWidgetCore>(WID_SM_LEGEND)->SetDataTip(STR_NULL, legend_tooltip);
+ this->GetWidget<NWidgetCore>(WID_SM_ENABLE_ALL)->SetDataTip(STR_SMALLMAP_ENABLE_ALL, enable_all_tooltip);
+ this->GetWidget<NWidgetCore>(WID_SM_DISABLE_ALL)->SetDataTip(STR_SMALLMAP_DISABLE_ALL, disable_all_tooltip);
+ this->GetWidget<NWidgetStacked>(WID_SM_SELECT_BUTTONS)->SetDisplayedPlane(plane);
}
public:
@@ -1054,12 +1054,12 @@ public:
SmallMapWindow(const WindowDesc *desc, int window_number) : Window(), refresh(FORCE_REFRESH_PERIOD)
{
this->InitNested(desc, window_number);
- this->LowerWidget(this->map_type + SM_WIDGET_CONTOUR);
+ this->LowerWidget(this->map_type + WID_SM_CONTOUR);
BuildLandLegend();
- this->SetWidgetLoweredState(SM_WIDGET_SHOW_HEIGHT, _smallmap_show_heightmap);
+ this->SetWidgetLoweredState(WID_SM_SHOW_HEIGHT, _smallmap_show_heightmap);
- this->SetWidgetLoweredState(SM_WIDGET_TOGGLETOWNNAME, this->show_towns);
+ this->SetWidgetLoweredState(WID_SM_TOGGLETOWNNAME, this->show_towns);
this->SetupWidgetData();
@@ -1099,7 +1099,7 @@ public:
virtual void SetStringParameters(int widget) const
{
switch (widget) {
- case SM_WIDGET_CAPTION:
+ case WID_SM_CAPTION:
SetDParam(0, STR_SMALLMAP_TYPE_CONTOURS + this->map_type);
break;
}
@@ -1171,14 +1171,14 @@ public:
virtual void DrawWidget(const Rect &r, int widget) const
{
switch (widget) {
- case SM_WIDGET_MAP: {
+ case WID_SM_MAP: {
DrawPixelInfo new_dpi;
if (!FillDrawPixelInfo(&new_dpi, r.left + 1, r.top + 1, r.right - r.left - 1, r.bottom - r.top - 1)) return;
this->DrawSmallMap(&new_dpi);
break;
}
- case SM_WIDGET_LEGEND: {
+ case WID_SM_LEGEND: {
uint columns = this->GetNumberColumnsLegend(r.right - r.left + 1);
uint number_of_rows = max((this->map_type == SMT_INDUSTRY || this->map_type == SMT_OWNER) ? CeilDiv(max(_smallmap_company_count, _smallmap_industry_count), columns) : 0, this->min_number_of_fixed_rows);
bool rtl = _current_text_dir == TD_RTL;
@@ -1246,9 +1246,9 @@ public:
*/
void SwitchMapType(SmallMapType map_type)
{
- this->RaiseWidget(this->map_type + SM_WIDGET_CONTOUR);
+ this->RaiseWidget(this->map_type + WID_SM_CONTOUR);
this->map_type = map_type;
- this->LowerWidget(this->map_type + SM_WIDGET_CONTOUR);
+ this->LowerWidget(this->map_type + WID_SM_CONTOUR);
this->SetupWidgetData();
@@ -1261,7 +1261,7 @@ public:
InvalidateWindowClassesData(WC_INDUSTRY_CARGOES, NUM_INDUSTRYTYPES);
switch (widget) {
- case SM_WIDGET_MAP: { // Map window
+ case WID_SM_MAP: { // Map window
/*
* XXX: scrolling with the left mouse button is done by subsequently
* clicking with the left mouse button; clicking once centers the
@@ -1272,7 +1272,7 @@ public:
*/
_left_button_clicked = false;
- const NWidgetBase *wid = this->GetWidget<NWidgetBase>(SM_WIDGET_MAP);
+ const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_SM_MAP);
Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
int sub;
pt = this->PixelToTile(pt.x - wid->pos_x, pt.y - wid->pos_y, &sub);
@@ -1287,42 +1287,42 @@ public:
break;
}
- case SM_WIDGET_ZOOM_IN:
- case SM_WIDGET_ZOOM_OUT: {
- const NWidgetBase *wid = this->GetWidget<NWidgetBase>(SM_WIDGET_MAP);
+ case WID_SM_ZOOM_IN:
+ case WID_SM_ZOOM_OUT: {
+ const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_SM_MAP);
Point pt = {wid->current_x / 2, wid->current_y / 2};
- this->SetZoomLevel((widget == SM_WIDGET_ZOOM_IN) ? ZLC_ZOOM_IN : ZLC_ZOOM_OUT, &pt);
+ this->SetZoomLevel((widget == WID_SM_ZOOM_IN) ? ZLC_ZOOM_IN : ZLC_ZOOM_OUT, &pt);
SndPlayFx(SND_15_BEEP);
break;
}
- case SM_WIDGET_CONTOUR: // Show land contours
- case SM_WIDGET_VEHICLES: // Show vehicles
- case SM_WIDGET_INDUSTRIES: // Show industries
- case SM_WIDGET_ROUTES: // Show transport routes
- case SM_WIDGET_VEGETATION: // Show vegetation
- case SM_WIDGET_OWNERS: // Show land owners
- this->SwitchMapType((SmallMapType)(widget - SM_WIDGET_CONTOUR));
+ case WID_SM_CONTOUR: // Show land contours
+ case WID_SM_VEHICLES: // Show vehicles
+ case WID_SM_INDUSTRIES: // Show industries
+ case WID_SM_ROUTES: // Show transport routes
+ case WID_SM_VEGETATION: // Show vegetation
+ case WID_SM_OWNERS: // Show land owners
+ this->SwitchMapType((SmallMapType)(widget - WID_SM_CONTOUR));
SndPlayFx(SND_15_BEEP);
break;
- case SM_WIDGET_CENTERMAP: // Center the smallmap again
+ case WID_SM_CENTERMAP: // Center the smallmap again
this->SmallMapCenterOnCurrentPos();
- this->HandleButtonClick(SM_WIDGET_CENTERMAP);
+ this->HandleButtonClick(WID_SM_CENTERMAP);
SndPlayFx(SND_15_BEEP);
break;
- case SM_WIDGET_TOGGLETOWNNAME: // Toggle town names
+ case WID_SM_TOGGLETOWNNAME: // Toggle town names
this->show_towns = !this->show_towns;
- this->SetWidgetLoweredState(SM_WIDGET_TOGGLETOWNNAME, this->show_towns);
+ this->SetWidgetLoweredState(WID_SM_TOGGLETOWNNAME, this->show_towns);
this->SetDirty();
SndPlayFx(SND_15_BEEP);
break;
- case SM_WIDGET_LEGEND: // Legend
+ case WID_SM_LEGEND: // Legend
if (this->map_type == SMT_INDUSTRY || this->map_type == SMT_OWNER) {
- const NWidgetBase *wi = this->GetWidget<NWidgetBase>(SM_WIDGET_LEGEND); // Label panel
+ const NWidgetBase *wi = this->GetWidget<NWidgetBase>(WID_SM_LEGEND); // Label panel
uint line = (pt.y - wi->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_SMALL;
uint columns = this->GetNumberColumnsLegend(wi->current_x);
uint number_of_rows = max(CeilDiv(max(_smallmap_company_count, _smallmap_industry_count), columns), this->min_number_of_fixed_rows);
@@ -1388,7 +1388,7 @@ public:
}
break;
- case SM_WIDGET_ENABLE_ALL:
+ case WID_SM_ENABLE_ALL:
if (this->map_type == SMT_INDUSTRY) {
for (int i = 0; i != _smallmap_industry_count; i++) {
_legend_from_industries[i].show_on_map = true;
@@ -1401,7 +1401,7 @@ public:
this->SetDirty();
break;
- case SM_WIDGET_DISABLE_ALL:
+ case WID_SM_DISABLE_ALL:
if (this->map_type == SMT_INDUSTRY) {
for (int i = 0; i != _smallmap_industry_count; i++) {
_legend_from_industries[i].show_on_map = false;
@@ -1414,9 +1414,9 @@ public:
this->SetDirty();
break;
- case SM_WIDGET_SHOW_HEIGHT: // Enable/disable showing of heightmap.
+ case WID_SM_SHOW_HEIGHT: // Enable/disable showing of heightmap.
_smallmap_show_heightmap = !_smallmap_show_heightmap;
- this->SetWidgetLoweredState(SM_WIDGET_SHOW_HEIGHT, _smallmap_show_heightmap);
+ this->SetWidgetLoweredState(WID_SM_SHOW_HEIGHT, _smallmap_show_heightmap);
this->SetDirty();
break;
}
@@ -1455,7 +1455,7 @@ public:
virtual bool OnRightClick(Point pt, int widget)
{
- if (widget != SM_WIDGET_MAP || _scrolling_viewport) return false;
+ if (widget != WID_SM_MAP || _scrolling_viewport) return false;
_scrolling_viewport = true;
return true;
@@ -1464,7 +1464,7 @@ public:
virtual void OnMouseWheel(int wheel)
{
if (_settings_client.gui.scrollwheel_scrolling == 0) {
- const NWidgetBase *wid = this->GetWidget<NWidgetBase>(SM_WIDGET_MAP);
+ const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_SM_MAP);
int cursor_x = _cursor.pos.x - this->left - wid->pos_x;
int cursor_y = _cursor.pos.y - this->top - wid->pos_y;
if (IsInsideMM(cursor_x, 0, wid->current_x) && IsInsideMM(cursor_y, 0, wid->current_y)) {
@@ -1492,7 +1492,7 @@ public:
*/
void SetNewScroll(int sx, int sy, int sub)
{
- const NWidgetBase *wi = this->GetWidget<NWidgetBase>(SM_WIDGET_MAP);
+ const NWidgetBase *wi = this->GetWidget<NWidgetBase>(WID_SM_MAP);
Point hv = InverseRemapCoords(wi->current_x * ZOOM_LVL_BASE * TILE_SIZE / 2, wi->current_y * ZOOM_LVL_BASE * TILE_SIZE / 2);
hv.x *= this->zoom;
hv.y *= this->zoom;
@@ -1537,7 +1537,7 @@ public:
Point pt = InverseRemapCoords(vp->virtual_left + vp->virtual_width / 2, vp->virtual_top + vp->virtual_height / 2);
int sub;
- const NWidgetBase *wid = this->GetWidget<NWidgetBase>(SM_WIDGET_MAP);
+ const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_SM_MAP);
Point sxy = this->ComputeScroll(pt.x / TILE_SIZE, pt.y / TILE_SIZE, max(0, (int)wid->current_x / 2 - 2), wid->current_y / 2, &sub);
this->SetNewScroll(sxy.x, sxy.y, sub);
this->SetDirty();
@@ -1622,8 +1622,8 @@ public:
/** Widget parts of the smallmap display. */
static const NWidgetPart _nested_smallmap_display[] = {
- NWidget(WWT_PANEL, COLOUR_BROWN, SM_WIDGET_MAP_BORDER),
- NWidget(WWT_INSET, COLOUR_BROWN, SM_WIDGET_MAP), SetMinimalSize(346, 140), SetResize(1, 1), SetPadding(2, 2, 2, 2), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_BROWN, WID_SM_MAP_BORDER),
+ NWidget(WWT_INSET, COLOUR_BROWN, WID_SM_MAP), SetMinimalSize(346, 140), SetResize(1, 1), SetPadding(2, 2, 2, 2), EndContainer(),
EndContainer(),
};
@@ -1631,32 +1631,32 @@ static const NWidgetPart _nested_smallmap_display[] = {
static const NWidgetPart _nested_smallmap_bar[] = {
NWidget(WWT_PANEL, COLOUR_BROWN),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_EMPTY, INVALID_COLOUR, SM_WIDGET_LEGEND), SetResize(1, 1),
+ NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SM_LEGEND), SetResize(1, 1),
NWidget(NWID_VERTICAL),
/* Top button row. */
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
- NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, SM_WIDGET_ZOOM_IN),
+ NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, WID_SM_ZOOM_IN),
SetDataTip(SPR_IMG_ZOOMIN, STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_IN), SetFill(1, 1),
- NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, SM_WIDGET_CENTERMAP),
+ NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, WID_SM_CENTERMAP),
SetDataTip(SPR_IMG_SMALLMAP, STR_SMALLMAP_CENTER), SetFill(1, 1),
- NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_CONTOUR),
+ NWidget(WWT_IMGBTN, COLOUR_BROWN, WID_SM_CONTOUR),
SetDataTip(SPR_IMG_SHOW_COUNTOURS, STR_SMALLMAP_TOOLTIP_SHOW_LAND_CONTOURS_ON_MAP), SetFill(1, 1),
- NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_VEHICLES),
+ NWidget(WWT_IMGBTN, COLOUR_BROWN, WID_SM_VEHICLES),
SetDataTip(SPR_IMG_SHOW_VEHICLES, STR_SMALLMAP_TOOLTIP_SHOW_VEHICLES_ON_MAP), SetFill(1, 1),
- NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_INDUSTRIES),
+ NWidget(WWT_IMGBTN, COLOUR_BROWN, WID_SM_INDUSTRIES),
SetDataTip(SPR_IMG_INDUSTRY, STR_SMALLMAP_TOOLTIP_SHOW_INDUSTRIES_ON_MAP), SetFill(1, 1),
EndContainer(),
/* Bottom button row. */
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
- NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, SM_WIDGET_ZOOM_OUT),
+ NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, WID_SM_ZOOM_OUT),
SetDataTip(SPR_IMG_ZOOMOUT, STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_OUT), SetFill(1, 1),
- NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_TOGGLETOWNNAME),
+ NWidget(WWT_IMGBTN, COLOUR_BROWN, WID_SM_TOGGLETOWNNAME),
SetDataTip(SPR_IMG_TOWN, STR_SMALLMAP_TOOLTIP_TOGGLE_TOWN_NAMES_ON_OFF), SetFill(1, 1),
- NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_ROUTES),
+ NWidget(WWT_IMGBTN, COLOUR_BROWN, WID_SM_ROUTES),
SetDataTip(SPR_IMG_SHOW_ROUTES, STR_SMALLMAP_TOOLTIP_SHOW_TRANSPORT_ROUTES_ON), SetFill(1, 1),
- NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_VEGETATION),
+ NWidget(WWT_IMGBTN, COLOUR_BROWN, WID_SM_VEGETATION),
SetDataTip(SPR_IMG_PLANTTREES, STR_SMALLMAP_TOOLTIP_SHOW_VEGETATION_ON_MAP), SetFill(1, 1),
- NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_OWNERS),
+ NWidget(WWT_IMGBTN, COLOUR_BROWN, WID_SM_OWNERS),
SetDataTip(SPR_IMG_COMPANY_GENERAL, STR_SMALLMAP_TOOLTIP_SHOW_LAND_OWNERS_ON_MAP), SetFill(1, 1),
EndContainer(),
NWidget(NWID_SPACER), SetResize(0, 1),
@@ -1678,7 +1678,7 @@ static NWidgetBase *SmallMapDisplay(int *biggest_index)
static const NWidgetPart _nested_smallmap_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
- NWidget(WWT_CAPTION, COLOUR_BROWN, SM_WIDGET_CAPTION), SetDataTip(STR_SMALLMAP_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
+ NWidget(WWT_CAPTION, COLOUR_BROWN, WID_SM_CAPTION), SetDataTip(STR_SMALLMAP_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
EndContainer(),
@@ -1687,11 +1687,11 @@ static const NWidgetPart _nested_smallmap_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PANEL, COLOUR_BROWN),
NWidget(NWID_HORIZONTAL),
- NWidget(NWID_SELECTION, INVALID_COLOUR, SM_WIDGET_SELECT_BUTTONS),
+ NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SM_SELECT_BUTTONS),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
- NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, SM_WIDGET_ENABLE_ALL), SetDataTip(STR_SMALLMAP_ENABLE_ALL, STR_NULL),
- NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, SM_WIDGET_DISABLE_ALL), SetDataTip(STR_SMALLMAP_DISABLE_ALL, STR_NULL),
- NWidget(WWT_TEXTBTN, COLOUR_BROWN, SM_WIDGET_SHOW_HEIGHT), SetDataTip(STR_SMALLMAP_SHOW_HEIGHT, STR_SMALLMAP_TOOLTIP_SHOW_HEIGHT),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_SM_ENABLE_ALL), SetDataTip(STR_SMALLMAP_ENABLE_ALL, STR_NULL),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_SM_DISABLE_ALL), SetDataTip(STR_SMALLMAP_DISABLE_ALL, STR_NULL),
+ NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_SM_SHOW_HEIGHT), SetDataTip(STR_SMALLMAP_SHOW_HEIGHT, STR_SMALLMAP_TOOLTIP_SHOW_HEIGHT),
EndContainer(),
NWidget(NWID_SPACER), SetFill(1, 1),
EndContainer(),
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 74223f6fa..c2de53bde 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -615,7 +615,7 @@ void UpdateStationAcceptance(Station *st, bool show_msg)
}
/* redraw the station view since acceptance changed */
- SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_ACCEPTLIST);
+ SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_ACCEPT_RATING_LIST);
}
static void UpdateStationSignCoord(BaseStation *st)
@@ -1297,7 +1297,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
st->RecomputeIndustriesNear();
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
- SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS);
+ SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS);
DirtyCompanyInfrastructureWindows(st->owner);
}
@@ -1461,7 +1461,7 @@ CommandCost RemoveFromRailBaseStation(TileArea ta, SmallVector<T *, 4> &affected
/* if we deleted the whole station, delete the train facility. */
if (st->train_station.tile == INVALID_TILE) {
st->facilities &= ~FACIL_TRAIN;
- SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS);
+ SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS);
st->UpdateVirtCoord();
DeleteStationIfEmpty(st);
}
@@ -1497,7 +1497,7 @@ CommandCost CmdRemoveFromRailStation(TileIndex start, DoCommandFlag flags, uint3
for (Station **stp = affected_stations.Begin(); stp != affected_stations.End(); stp++) {
Station *st = *stp;
- if (st->train_station.tile == INVALID_TILE) SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS);
+ if (st->train_station.tile == INVALID_TILE) SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS);
st->MarkTilesDirty(false);
st->RecomputeIndustriesNear();
}
@@ -1592,7 +1592,7 @@ CommandCost RemoveRailStation(T *st, DoCommandFlag flags)
st->cached_anim_triggers = 0;
DirtyCompanyInfrastructureWindows(st->owner);
- SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_TRAINS);
+ SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_TRAINS);
st->UpdateVirtCoord();
DeleteStationIfEmpty(st);
}
@@ -1828,7 +1828,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
st->RecomputeIndustriesNear();
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
- SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_ROADVEHS);
+ SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_ROADVEHS);
}
return cost;
}
@@ -1922,7 +1922,7 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
DoClearSquare(tile);
}
- SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_ROADVEHS);
+ SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_ROADVEHS);
delete cur_stop;
/* Make sure no vehicle is going to the old roadstop */
@@ -2263,7 +2263,7 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
st->RecomputeIndustriesNear();
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
- SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_PLANES);
+ SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_PLANES);
if (_settings_game.economy.station_noise_level) {
SetWindowDirty(WC_TOWN_VIEW, st->town->index);
@@ -2339,7 +2339,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
st->airport.Clear();
st->facilities &= ~FACIL_AIRPORT;
- SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_PLANES);
+ SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_PLANES);
if (_settings_game.economy.station_noise_level) {
SetWindowDirty(WC_TOWN_VIEW, st->town->index);
@@ -2503,7 +2503,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
st->RecomputeIndustriesNear();
InvalidateWindowData(WC_SELECT_STATION, 0, 0);
InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
- SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_SHIPS);
+ SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_SHIPS);
}
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_STATION_DOCK]);
@@ -2542,7 +2542,7 @@ static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
Company::Get(st->owner)->infrastructure.station -= 2;
DirtyCompanyInfrastructureWindows(st->owner);
- SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_SHIPS);
+ SetWindowWidgetDirty(WC_STATION_VIEW, st->index, WID_SV_SHIPS);
st->UpdateVirtCoord();
st->RecomputeIndustriesNear();
DeleteStationIfEmpty(st);
@@ -3239,7 +3239,7 @@ static void UpdateStationRating(Station *st)
if (waiting_changed) {
SetWindowDirty(WC_STATION_VIEW, index); // update whole window
} else {
- SetWindowWidgetDirty(WC_STATION_VIEW, index, SVW_RATINGLIST); // update only ratings list
+ SetWindowWidgetDirty(WC_STATION_VIEW, index, WID_SV_ACCEPT_RATING_LIST); // update only ratings list
}
}
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 3fc28cfff..76df154e1 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -314,7 +314,7 @@ protected:
this->last_station = NULL;
/* Set the modified widget dirty */
- this->SetWidgetDirty(SLW_LIST);
+ this->SetWidgetDirty(WID_SL_LIST);
}
public:
@@ -327,23 +327,23 @@ public:
this->SortStationsList();
this->CreateNestedTree(desc);
- this->vscroll = this->GetScrollbar(SLW_SCROLLBAR);
+ this->vscroll = this->GetScrollbar(WID_SL_SCROLLBAR);
this->FinishInitNested(desc, window_number);
this->owner = (Owner)this->window_number;
CargoID cid;
FOR_EACH_SET_CARGO_ID(cid, this->cargo_filter) {
- if (CargoSpec::Get(cid)->IsValid()) this->LowerWidget(SLW_CARGOSTART + cid);
+ if (CargoSpec::Get(cid)->IsValid()) this->LowerWidget(WID_SL_CARGOSTART + cid);
}
if (this->cargo_filter == this->cargo_filter_max) this->cargo_filter = _cargo_mask;
for (uint i = 0; i < 5; i++) {
- if (HasBit(this->facilities, i)) this->LowerWidget(i + SLW_TRAIN);
+ if (HasBit(this->facilities, i)) this->LowerWidget(i + WID_SL_TRAIN);
}
- this->SetWidgetLoweredState(SLW_NOCARGOWAITING, this->include_empty);
+ this->SetWidgetLoweredState(WID_SL_NOCARGOWAITING, this->include_empty);
- this->GetWidget<NWidgetCore>(SLW_SORTDROPBTN)->widget_data = this->sorter_names[this->stations.SortType()];
+ this->GetWidget<NWidgetCore>(WID_SL_SORTDROPBTN)->widget_data = this->sorter_names[this->stations.SortType()];
}
~CompanyStationsWindow()
@@ -354,7 +354,7 @@ public:
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
{
switch (widget) {
- case SLW_SORTBY: {
+ case WID_SL_SORTBY: {
Dimension d = GetStringBoundingBox(this->GetWidget<NWidgetCore>(widget)->widget_data);
d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better.
d.height += padding.height;
@@ -362,7 +362,7 @@ public:
break;
}
- case SLW_SORTDROPBTN: {
+ case WID_SL_SORTDROPBTN: {
Dimension d = {0, 0};
for (int i = 0; this->sorter_names[i] != INVALID_STRING_ID; i++) {
d = maxdim(d, GetStringBoundingBox(this->sorter_names[i]));
@@ -373,23 +373,23 @@ public:
break;
}
- case SLW_LIST:
+ case WID_SL_LIST:
resize->height = FONT_HEIGHT_NORMAL;
size->height = WD_FRAMERECT_TOP + 5 * resize->height + WD_FRAMERECT_BOTTOM;
break;
- case SLW_TRAIN:
- case SLW_TRUCK:
- case SLW_BUS:
- case SLW_AIRPLANE:
- case SLW_SHIP:
+ case WID_SL_TRAIN:
+ case WID_SL_TRUCK:
+ case WID_SL_BUS:
+ case WID_SL_AIRPLANE:
+ case WID_SL_SHIP:
size->height = max<uint>(FONT_HEIGHT_SMALL, 10) + padding.height;
break;
- case SLW_CARGOALL:
- case SLW_FACILALL:
- case SLW_NOCARGOWAITING: {
- Dimension d = GetStringBoundingBox(widget == SLW_NOCARGOWAITING ? STR_ABBREV_NONE : STR_ABBREV_ALL);
+ case WID_SL_CARGOALL:
+ case WID_SL_FACILALL:
+ case WID_SL_NOCARGOWAITING: {
+ Dimension d = GetStringBoundingBox(widget == WID_SL_NOCARGOWAITING ? STR_ABBREV_NONE : STR_ABBREV_ALL);
d.width += padding.width + 2;
d.height += padding.height;
*size = maxdim(*size, d);
@@ -397,8 +397,8 @@ public:
}
default:
- if (widget >= SLW_CARGOSTART) {
- const CargoSpec *cs = CargoSpec::Get(widget - SLW_CARGOSTART);
+ if (widget >= WID_SL_CARGOSTART) {
+ const CargoSpec *cs = CargoSpec::Get(widget - WID_SL_CARGOSTART);
if (cs->IsValid()) {
Dimension d = GetStringBoundingBox(cs->abbrev);
d.width += padding.width + 2;
@@ -421,12 +421,12 @@ public:
virtual void DrawWidget(const Rect &r, int widget) const
{
switch (widget) {
- case SLW_SORTBY:
+ case WID_SL_SORTBY:
/* draw arrow pointing up/down for ascending/descending sorting */
- this->DrawSortButtonState(SLW_SORTBY, this->stations.IsDescSortOrder() ? SBS_DOWN : SBS_UP);
+ this->DrawSortButtonState(WID_SL_SORTBY, this->stations.IsDescSortOrder() ? SBS_DOWN : SBS_UP);
break;
- case SLW_LIST: {
+ case WID_SL_LIST: {
bool rtl = _current_text_dir == TD_RTL;
int max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->stations.Length());
int y = r.top + WD_FRAMERECT_TOP;
@@ -471,27 +471,27 @@ public:
break;
}
- case SLW_NOCARGOWAITING: {
+ case WID_SL_NOCARGOWAITING: {
int cg_ofst = this->IsWidgetLowered(widget) ? 2 : 1;
DrawString(r.left + cg_ofst, r.right + cg_ofst, r.top + cg_ofst, STR_ABBREV_NONE, TC_BLACK, SA_HOR_CENTER);
break;
}
- case SLW_CARGOALL: {
+ case WID_SL_CARGOALL: {
int cg_ofst = this->IsWidgetLowered(widget) ? 2 : 1;
DrawString(r.left + cg_ofst, r.right + cg_ofst, r.top + cg_ofst, STR_ABBREV_ALL, TC_BLACK, SA_HOR_CENTER);
break;
}
- case SLW_FACILALL: {
+ case WID_SL_FACILALL: {
int cg_ofst = this->IsWidgetLowered(widget) ? 2 : 1;
DrawString(r.left + cg_ofst, r.right + cg_ofst, r.top + cg_ofst, STR_ABBREV_ALL, TC_BLACK);
break;
}
default:
- if (widget >= SLW_CARGOSTART) {
- const CargoSpec *cs = CargoSpec::Get(widget - SLW_CARGOSTART);
+ if (widget >= WID_SL_CARGOSTART) {
+ const CargoSpec *cs = CargoSpec::Get(widget - WID_SL_CARGOSTART);
if (cs->IsValid()) {
int cg_ofst = HasBit(this->cargo_filter, cs->Index()) ? 2 : 1;
GfxFillRect(r.left + cg_ofst, r.top + cg_ofst, r.right - 2 + cg_ofst, r.bottom - 2 + cg_ofst, cs->rating_colour);
@@ -504,7 +504,7 @@ public:
virtual void SetStringParameters(int widget) const
{
- if (widget == SLW_CAPTION) {
+ if (widget == WID_SL_CAPTION) {
SetDParam(0, this->window_number);
SetDParam(1, this->vscroll->GetCount());
}
@@ -513,8 +513,8 @@ public:
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, 0, FONT_HEIGHT_NORMAL);
+ case WID_SL_LIST: {
+ uint id_v = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_SL_LIST, 0, FONT_HEIGHT_NORMAL);
if (id_v >= this->stations.Length()) return; // click out of list bound
const Station *st = this->stations[id_v];
@@ -529,28 +529,28 @@ public:
break;
}
- case SLW_TRAIN:
- case SLW_TRUCK:
- case SLW_BUS:
- case SLW_AIRPLANE:
- case SLW_SHIP:
+ case WID_SL_TRAIN:
+ case WID_SL_TRUCK:
+ case WID_SL_BUS:
+ case WID_SL_AIRPLANE:
+ case WID_SL_SHIP:
if (_ctrl_pressed) {
- ToggleBit(this->facilities, widget - SLW_TRAIN);
+ ToggleBit(this->facilities, widget - WID_SL_TRAIN);
this->ToggleWidgetLoweredState(widget);
} else {
uint i;
FOR_EACH_SET_BIT(i, this->facilities) {
- this->RaiseWidget(i + SLW_TRAIN);
+ this->RaiseWidget(i + WID_SL_TRAIN);
}
- this->facilities = 1 << (widget - SLW_TRAIN);
+ this->facilities = 1 << (widget - WID_SL_TRAIN);
this->LowerWidget(widget);
}
this->stations.ForceRebuild();
this->SetDirty();
break;
- case SLW_FACILALL:
- for (uint i = SLW_TRAIN; i <= SLW_SHIP; i++) {
+ case WID_SL_FACILALL:
+ for (uint i = WID_SL_TRAIN; i <= WID_SL_SHIP; i++) {
this->LowerWidget(i);
}
@@ -559,12 +559,12 @@ public:
this->SetDirty();
break;
- case SLW_CARGOALL: {
+ case WID_SL_CARGOALL: {
for (uint i = 0; i < NUM_CARGO; i++) {
const CargoSpec *cs = CargoSpec::Get(i);
- if (cs->IsValid()) this->LowerWidget(SLW_CARGOSTART + i);
+ if (cs->IsValid()) this->LowerWidget(WID_SL_CARGOSTART + i);
}
- this->LowerWidget(SLW_NOCARGOWAITING);
+ this->LowerWidget(WID_SL_NOCARGOWAITING);
this->cargo_filter = _cargo_mask;
this->include_empty = true;
@@ -573,40 +573,40 @@ public:
break;
}
- case SLW_SORTBY: // flip sorting method asc/desc
+ case WID_SL_SORTBY: // flip sorting method asc/desc
this->stations.ToggleSortOrder();
this->SetTimeout();
- this->LowerWidget(SLW_SORTBY);
+ this->LowerWidget(WID_SL_SORTBY);
this->SetDirty();
break;
- case SLW_SORTDROPBTN: // select sorting criteria dropdown menu
- ShowDropDownMenu(this, this->sorter_names, this->stations.SortType(), SLW_SORTDROPBTN, 0, 0);
+ case WID_SL_SORTDROPBTN: // select sorting criteria dropdown menu
+ ShowDropDownMenu(this, this->sorter_names, this->stations.SortType(), WID_SL_SORTDROPBTN, 0, 0);
break;
- case SLW_NOCARGOWAITING:
+ case WID_SL_NOCARGOWAITING:
if (_ctrl_pressed) {
this->include_empty = !this->include_empty;
- this->ToggleWidgetLoweredState(SLW_NOCARGOWAITING);
+ this->ToggleWidgetLoweredState(WID_SL_NOCARGOWAITING);
} else {
for (uint i = 0; i < NUM_CARGO; i++) {
const CargoSpec *cs = CargoSpec::Get(i);
- if (cs->IsValid()) this->RaiseWidget(SLW_CARGOSTART + i);
+ if (cs->IsValid()) this->RaiseWidget(WID_SL_CARGOSTART + i);
}
this->cargo_filter = 0;
this->include_empty = true;
- this->LowerWidget(SLW_NOCARGOWAITING);
+ this->LowerWidget(WID_SL_NOCARGOWAITING);
}
this->stations.ForceRebuild();
this->SetDirty();
break;
default:
- if (widget >= SLW_CARGOSTART) { // change cargo_filter
+ if (widget >= WID_SL_CARGOSTART) { // change cargo_filter
/* Determine the selected cargo type */
- const CargoSpec *cs = CargoSpec::Get(widget - SLW_CARGOSTART);
+ const CargoSpec *cs = CargoSpec::Get(widget - WID_SL_CARGOSTART);
if (!cs->IsValid()) break;
if (_ctrl_pressed) {
@@ -615,9 +615,9 @@ public:
} else {
for (uint i = 0; i < NUM_CARGO; i++) {
const CargoSpec *cs = CargoSpec::Get(i);
- if (cs->IsValid()) this->RaiseWidget(SLW_CARGOSTART + i);
+ if (cs->IsValid()) this->RaiseWidget(WID_SL_CARGOSTART + i);
}
- this->RaiseWidget(SLW_NOCARGOWAITING);
+ this->RaiseWidget(WID_SL_NOCARGOWAITING);
this->cargo_filter = 0;
this->include_empty = false;
@@ -638,7 +638,7 @@ public:
this->stations.SetSortType(index);
/* Display the current sort variant */
- this->GetWidget<NWidgetCore>(SLW_SORTDROPBTN)->widget_data = this->sorter_names[this->stations.SortType()];
+ this->GetWidget<NWidgetCore>(WID_SL_SORTDROPBTN)->widget_data = this->sorter_names[this->stations.SortType()];
this->SetDirty();
}
@@ -655,13 +655,13 @@ public:
virtual void OnTimeout()
{
- this->RaiseWidget(SLW_SORTBY);
+ this->RaiseWidget(WID_SL_SORTBY);
this->SetDirty();
}
virtual void OnResize()
{
- this->vscroll->SetCapacityFromWidget(this, SLW_LIST, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM);
+ this->vscroll->SetCapacityFromWidget(this, WID_SL_LIST, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM);
}
/**
@@ -707,7 +707,7 @@ const StringID CompanyStationsWindow::sorter_names[] = {
};
/**
- * Make a horizontal row of cargo buttons, starting at widget #SLW_CARGOSTART.
+ * Make a horizontal row of cargo buttons, starting at widget #WID_SL_CARGOSTART.
* @param biggest_index Pointer to store biggest used widget number of the buttons.
* @return Horizontal row.
*/
@@ -718,53 +718,53 @@ static NWidgetBase *CargoWidgets(int *biggest_index)
for (uint i = 0; i < NUM_CARGO; i++) {
const CargoSpec *cs = CargoSpec::Get(i);
if (cs->IsValid()) {
- NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, SLW_CARGOSTART + i);
+ NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, WID_SL_CARGOSTART + i);
panel->SetMinimalSize(14, 11);
panel->SetResize(0, 0);
panel->SetFill(0, 1);
panel->SetDataTip(0, STR_STATION_LIST_USE_CTRL_TO_SELECT_MORE);
container->Add(panel);
} else {
- NWidgetLeaf *nwi = new NWidgetLeaf(WWT_EMPTY, COLOUR_GREY, SLW_CARGOSTART + i, 0x0, STR_NULL);
+ NWidgetLeaf *nwi = new NWidgetLeaf(WWT_EMPTY, COLOUR_GREY, WID_SL_CARGOSTART + i, 0x0, STR_NULL);
nwi->SetMinimalSize(0, 11);
nwi->SetResize(0, 0);
nwi->SetFill(0, 1);
container->Add(nwi);
}
}
- *biggest_index = SLW_CARGOSTART + NUM_CARGO;
+ *biggest_index = WID_SL_CARGOSTART + NUM_CARGO;
return container;
}
static const NWidgetPart _nested_company_stations_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
- NWidget(WWT_CAPTION, COLOUR_GREY, SLW_CAPTION), SetDataTip(STR_STATION_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
+ NWidget(WWT_CAPTION, COLOUR_GREY, WID_SL_CAPTION), SetDataTip(STR_STATION_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_GREY),
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, SLW_TRAIN), SetMinimalSize(14, 11), SetDataTip(STR_TRAIN, STR_STATION_LIST_USE_CTRL_TO_SELECT_MORE), SetFill(0, 1),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, SLW_TRUCK), SetMinimalSize(14, 11), SetDataTip(STR_LORRY, STR_STATION_LIST_USE_CTRL_TO_SELECT_MORE), SetFill(0, 1),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, SLW_BUS), SetMinimalSize(14, 11), SetDataTip(STR_BUS, STR_STATION_LIST_USE_CTRL_TO_SELECT_MORE), SetFill(0, 1),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, SLW_SHIP), SetMinimalSize(14, 11), SetDataTip(STR_SHIP, STR_STATION_LIST_USE_CTRL_TO_SELECT_MORE), SetFill(0, 1),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, SLW_AIRPLANE), SetMinimalSize(14, 11), SetDataTip(STR_PLANE, STR_STATION_LIST_USE_CTRL_TO_SELECT_MORE), SetFill(0, 1),
- NWidget(WWT_PUSHBTN, COLOUR_GREY, SLW_FACILALL), SetMinimalSize(14, 11), SetDataTip(0x0, STR_STATION_LIST_SELECT_ALL_FACILITIES), SetFill(0, 1),
+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SL_TRAIN), SetMinimalSize(14, 11), SetDataTip(STR_TRAIN, STR_STATION_LIST_USE_CTRL_TO_SELECT_MORE), SetFill(0, 1),
+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SL_TRUCK), SetMinimalSize(14, 11), SetDataTip(STR_LORRY, STR_STATION_LIST_USE_CTRL_TO_SELECT_MORE), SetFill(0, 1),
+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SL_BUS), SetMinimalSize(14, 11), SetDataTip(STR_BUS, STR_STATION_LIST_USE_CTRL_TO_SELECT_MORE), SetFill(0, 1),
+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SL_SHIP), SetMinimalSize(14, 11), SetDataTip(STR_SHIP, STR_STATION_LIST_USE_CTRL_TO_SELECT_MORE), SetFill(0, 1),
+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SL_AIRPLANE), SetMinimalSize(14, 11), SetDataTip(STR_PLANE, STR_STATION_LIST_USE_CTRL_TO_SELECT_MORE), SetFill(0, 1),
+ NWidget(WWT_PUSHBTN, COLOUR_GREY, WID_SL_FACILALL), SetMinimalSize(14, 11), SetDataTip(0x0, STR_STATION_LIST_SELECT_ALL_FACILITIES), SetFill(0, 1),
NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(5, 11), SetFill(0, 1), EndContainer(),
NWidgetFunction(CargoWidgets),
- NWidget(WWT_PANEL, COLOUR_GREY, SLW_NOCARGOWAITING), SetMinimalSize(14, 11), SetDataTip(0x0, STR_STATION_LIST_NO_WAITING_CARGO), SetFill(0, 1), EndContainer(),
- NWidget(WWT_PUSHBTN, COLOUR_GREY, SLW_CARGOALL), SetMinimalSize(14, 11), SetDataTip(0x0, STR_STATION_LIST_SELECT_ALL_TYPES), SetFill(0, 1),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_NOCARGOWAITING), SetMinimalSize(14, 11), SetDataTip(0x0, STR_STATION_LIST_NO_WAITING_CARGO), SetFill(0, 1), EndContainer(),
+ NWidget(WWT_PUSHBTN, COLOUR_GREY, WID_SL_CARGOALL), SetMinimalSize(14, 11), SetDataTip(0x0, STR_STATION_LIST_SELECT_ALL_TYPES), SetFill(0, 1),
NWidget(WWT_PANEL, COLOUR_GREY), SetDataTip(0x0, STR_NULL), SetResize(1, 0), SetFill(1, 1), EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, SLW_SORTBY), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER),
- NWidget(WWT_DROPDOWN, COLOUR_GREY, SLW_SORTDROPBTN), SetMinimalSize(163, 12), SetDataTip(STR_SORT_BY_NAME, STR_TOOLTIP_SORT_CRITERIA), // widget_data gets overwritten.
+ NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SL_SORTBY), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER),
+ NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_SL_SORTDROPBTN), SetMinimalSize(163, 12), SetDataTip(STR_SORT_BY_NAME, STR_TOOLTIP_SORT_CRITERIA), // widget_data gets overwritten.
NWidget(WWT_PANEL, COLOUR_GREY), SetDataTip(0x0, STR_NULL), SetResize(1, 0), SetFill(1, 1), EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_GREY, SLW_LIST), SetMinimalSize(346, 125), SetResize(1, 10), SetDataTip(0x0, STR_STATION_LIST_TOOLTIP), SetScrollbar(SLW_SCROLLBAR), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_SL_LIST), SetMinimalSize(346, 125), SetResize(1, 10), SetDataTip(0x0, STR_STATION_LIST_TOOLTIP), SetScrollbar(WID_SL_SCROLLBAR), EndContainer(),
NWidget(NWID_VERTICAL),
- NWidget(NWID_VSCROLLBAR, COLOUR_GREY, SLW_SCROLLBAR),
+ NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_SL_SCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
EndContainer(),
@@ -792,26 +792,26 @@ void ShowCompanyStations(CompanyID company)
static const NWidgetPart _nested_station_view_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
- NWidget(WWT_CAPTION, COLOUR_GREY, SVW_CAPTION), SetDataTip(STR_STATION_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
+ NWidget(WWT_CAPTION, COLOUR_GREY, WID_SV_CAPTION), SetDataTip(STR_STATION_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_GREY),
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_GREY, SVW_WAITING), SetMinimalSize(237, 52), SetResize(1, 10), SetScrollbar(SVW_SCROLLBAR), EndContainer(),
- NWidget(NWID_VSCROLLBAR, COLOUR_GREY, SVW_SCROLLBAR),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_SV_WAITING), SetMinimalSize(237, 52), SetResize(1, 10), SetScrollbar(WID_SV_SCROLLBAR), EndContainer(),
+ NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_SV_SCROLLBAR),
EndContainer(),
- NWidget(WWT_PANEL, COLOUR_GREY, SVW_ACCEPTLIST), SetMinimalSize(249, 32), SetResize(1, 0), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_SV_ACCEPT_RATING_LIST), SetMinimalSize(249, 32), SetResize(1, 0), EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SVW_LOCATION), SetMinimalSize(60, 12), SetResize(1, 0), SetFill(1, 1),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SV_LOCATION), SetMinimalSize(60, 12), SetResize(1, 0), SetFill(1, 1),
SetDataTip(STR_BUTTON_LOCATION, STR_STATION_VIEW_CENTER_TOOLTIP),
- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SVW_ACCEPTS), SetMinimalSize(61, 12), SetResize(1, 0), SetFill(1, 1),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SV_ACCEPTS_RATINGS), SetMinimalSize(61, 12), SetResize(1, 0), SetFill(1, 1),
SetDataTip(STR_STATION_VIEW_RATINGS_BUTTON, STR_STATION_VIEW_RATINGS_TOOLTIP),
- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SVW_RENAME), SetMinimalSize(60, 12), SetResize(1, 0), SetFill(1, 1),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SV_RENAME), SetMinimalSize(60, 12), SetResize(1, 0), SetFill(1, 1),
SetDataTip(STR_BUTTON_RENAME, STR_STATION_VIEW_RENAME_TOOLTIP),
- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SVW_TRAINS), SetMinimalSize(14, 12), SetFill(0, 1), SetDataTip(STR_TRAIN, STR_STATION_VIEW_SCHEDULED_TRAINS_TOOLTIP),
- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SVW_ROADVEHS), SetMinimalSize(14, 12), SetFill(0, 1), SetDataTip(STR_LORRY, STR_STATION_VIEW_SCHEDULED_ROAD_VEHICLES_TOOLTIP),
- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SVW_SHIPS), SetMinimalSize(14, 12), SetFill(0, 1), SetDataTip(STR_SHIP, STR_STATION_VIEW_SCHEDULED_SHIPS_TOOLTIP),
- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, SVW_PLANES), SetMinimalSize(14, 12), SetFill(0, 1), SetDataTip(STR_PLANE, STR_STATION_VIEW_SCHEDULED_AIRCRAFT_TOOLTIP),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SV_TRAINS), SetMinimalSize(14, 12), SetFill(0, 1), SetDataTip(STR_TRAIN, STR_STATION_VIEW_SCHEDULED_TRAINS_TOOLTIP),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SV_ROADVEHS), SetMinimalSize(14, 12), SetFill(0, 1), SetDataTip(STR_LORRY, STR_STATION_VIEW_SCHEDULED_ROAD_VEHICLES_TOOLTIP),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SV_SHIPS), SetMinimalSize(14, 12), SetFill(0, 1), SetDataTip(STR_SHIP, STR_STATION_VIEW_SCHEDULED_SHIPS_TOOLTIP),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SV_PLANES), SetMinimalSize(14, 12), SetFill(0, 1), SetDataTip(STR_PLANE, STR_STATION_VIEW_SCHEDULED_AIRCRAFT_TOOLTIP),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
};
@@ -865,7 +865,7 @@ struct StationViewWindow : public Window {
int accepts_lines; ///< Number of lines in the accepted cargo view.
Scrollbar *vscroll;
- /** Height of the #SVW_ACCEPTLIST widget for different views. */
+ /** Height of the #WID_SV_ACCEPT_RATING_LIST widget for different views. */
enum AcceptListHeight {
ALH_RATING = 13, ///< Height of the cargo ratings view.
ALH_ACCEPTS = 3, ///< Height of the accepted cargo view.
@@ -877,8 +877,8 @@ struct StationViewWindow : public Window {
this->accepts_lines = ALH_ACCEPTS;
this->CreateNestedTree(desc);
- this->vscroll = this->GetScrollbar(SVW_SCROLLBAR);
- /* Nested widget tree creation is done in two steps to ensure that this->GetWidget<NWidgetCore>(SVW_ACCEPTS) exists in UpdateWidgetSize(). */
+ this->vscroll = this->GetScrollbar(WID_SV_SCROLLBAR);
+ /* Nested widget tree creation is done in two steps to ensure that this->GetWidget<NWidgetCore>(WID_SV_ACCEPTS_RATINGS) exists in UpdateWidgetSize(). */
this->FinishInitNested(desc, window_number);
Owner owner = Station::Get(window_number)->owner;
@@ -899,14 +899,14 @@ struct StationViewWindow : public Window {
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
{
switch (widget) {
- case SVW_WAITING:
+ case WID_SV_WAITING:
resize->height = FONT_HEIGHT_NORMAL;
size->height = WD_FRAMERECT_TOP + 5 * resize->height + WD_FRAMERECT_BOTTOM;
this->expand_shrink_width = max(GetStringBoundingBox("-").width, GetStringBoundingBox("+").width) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
break;
- case SVW_ACCEPTLIST:
- size->height = WD_FRAMERECT_TOP + ((this->GetWidget<NWidgetCore>(SVW_ACCEPTS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON) ? this->accepts_lines : this->rating_lines) * FONT_HEIGHT_NORMAL + WD_FRAMERECT_BOTTOM;
+ case WID_SV_ACCEPT_RATING_LIST:
+ size->height = WD_FRAMERECT_TOP + ((this->GetWidget<NWidgetCore>(WID_SV_ACCEPTS_RATINGS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON) ? this->accepts_lines : this->rating_lines) * FONT_HEIGHT_NORMAL + WD_FRAMERECT_BOTTOM;
break;
}
}
@@ -921,19 +921,19 @@ struct StationViewWindow : public Window {
/* disable some buttons */
const Station *st = Station::Get(this->window_number);
- this->SetWidgetDisabledState(SVW_RENAME, st->owner != _local_company);
- this->SetWidgetDisabledState(SVW_TRAINS, !(st->facilities & FACIL_TRAIN));
- this->SetWidgetDisabledState(SVW_ROADVEHS, !(st->facilities & FACIL_TRUCK_STOP) && !(st->facilities & FACIL_BUS_STOP));
- this->SetWidgetDisabledState(SVW_SHIPS, !(st->facilities & FACIL_DOCK));
- this->SetWidgetDisabledState(SVW_PLANES, !(st->facilities & FACIL_AIRPORT));
+ this->SetWidgetDisabledState(WID_SV_RENAME, st->owner != _local_company);
+ this->SetWidgetDisabledState(WID_SV_TRAINS, !(st->facilities & FACIL_TRAIN));
+ this->SetWidgetDisabledState(WID_SV_ROADVEHS, !(st->facilities & FACIL_TRUCK_STOP) && !(st->facilities & FACIL_BUS_STOP));
+ this->SetWidgetDisabledState(WID_SV_SHIPS, !(st->facilities & FACIL_DOCK));
+ this->SetWidgetDisabledState(WID_SV_PLANES, !(st->facilities & FACIL_AIRPORT));
this->DrawWidgets();
if (!this->IsShaded()) {
/* Draw 'accepted cargo' or 'cargo ratings'. */
- const NWidgetBase *wid = this->GetWidget<NWidgetBase>(SVW_ACCEPTLIST);
+ const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_SV_ACCEPT_RATING_LIST);
const Rect r = {wid->pos_x, wid->pos_y, wid->pos_x + wid->current_x - 1, wid->pos_y + wid->current_y - 1};
- if (this->GetWidget<NWidgetCore>(SVW_ACCEPTS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON) {
+ if (this->GetWidget<NWidgetCore>(WID_SV_ACCEPTS_RATINGS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON) {
int lines = this->DrawAcceptedCargo(r);
if (lines > this->accepts_lines) { // Resize the widget, and perform re-initialization of the window.
this->accepts_lines = lines;
@@ -950,7 +950,7 @@ struct StationViewWindow : public Window {
}
/* Draw waiting cargo. */
- NWidgetBase *nwi = this->GetWidget<NWidgetBase>(SVW_WAITING);
+ NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_SV_WAITING);
Rect waiting_rect = {nwi->pos_x, nwi->pos_y, nwi->pos_x + nwi->current_x - 1, nwi->pos_y + nwi->current_y - 1};
this->DrawWaitingCargo(waiting_rect, cargolist, transfers);
}
@@ -958,7 +958,7 @@ struct StationViewWindow : public Window {
virtual void SetStringParameters(int widget) const
{
- if (widget == SVW_CAPTION) {
+ if (widget == WID_SV_CAPTION) {
const Station *st = Station::Get(this->window_number);
SetDParam(0, st->index);
SetDParam(1, st->facilities);
@@ -1079,7 +1079,7 @@ struct StationViewWindow : public Window {
}
/**
- * Draw accepted cargo in the #SVW_ACCEPTLIST widget.
+ * Draw accepted cargo in the #WID_SV_ACCEPT_RATING_LIST widget.
* @param r Rectangle of the widget.
* @return Number of lines needed for drawing the accepted cargo.
*/
@@ -1097,7 +1097,7 @@ struct StationViewWindow : public Window {
}
/**
- * Draw cargo ratings in the #SVW_ACCEPTLIST widget.
+ * Draw cargo ratings in the #WID_SV_ACCEPT_RATING_LIST widget.
* @param r Rectangle of the widget.
* @return Number of lines needed for drawing the cargo ratings.
*/
@@ -1130,7 +1130,7 @@ struct StationViewWindow : public Window {
for (CargoID c = 0; c < NUM_CARGO; c++) {
if (this->cargo_rows[c] == row) {
ToggleBit(this->cargo, c);
- this->SetWidgetDirty(SVW_WAITING);
+ this->SetWidgetDirty(WID_SV_WAITING);
break;
}
}
@@ -1139,11 +1139,11 @@ struct StationViewWindow : public Window {
virtual void OnClick(Point pt, int widget, int click_count)
{
switch (widget) {
- case SVW_WAITING:
- this->HandleCargoWaitingClick(this->vscroll->GetScrolledRowFromWidget(pt.y, this, SVW_WAITING, WD_FRAMERECT_TOP, FONT_HEIGHT_NORMAL));
+ case WID_SV_WAITING:
+ this->HandleCargoWaitingClick(this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_SV_WAITING, WD_FRAMERECT_TOP, FONT_HEIGHT_NORMAL));
break;
- case SVW_LOCATION:
+ case WID_SV_LOCATION:
if (_ctrl_pressed) {
ShowExtraViewPortWindow(Station::Get(this->window_number)->xy);
} else {
@@ -1151,11 +1151,11 @@ struct StationViewWindow : public Window {
}
break;
- case SVW_RATINGS: {
+ case WID_SV_ACCEPTS_RATINGS: {
/* Swap between 'accepts' and 'ratings' view. */
int height_change;
- NWidgetCore *nwi = this->GetWidget<NWidgetCore>(SVW_RATINGS);
- if (this->GetWidget<NWidgetCore>(SVW_RATINGS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON) {
+ NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_SV_ACCEPTS_RATINGS);
+ if (this->GetWidget<NWidgetCore>(WID_SV_ACCEPTS_RATINGS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON) {
nwi->SetDataTip(STR_STATION_VIEW_ACCEPTS_BUTTON, STR_STATION_VIEW_ACCEPTS_TOOLTIP); // Switch to accepts view.
height_change = this->rating_lines - this->accepts_lines;
} else {
@@ -1166,17 +1166,17 @@ struct StationViewWindow : public Window {
break;
}
- case SVW_RENAME:
+ case WID_SV_RENAME:
SetDParam(0, this->window_number);
ShowQueryString(STR_STATION_NAME, STR_STATION_VIEW_RENAME_STATION_CAPTION, MAX_LENGTH_STATION_NAME_CHARS,
this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS);
break;
- case SVW_TRAINS: // Show list of scheduled trains to this station
- case SVW_ROADVEHS: // Show list of scheduled road-vehicles to this station
- case SVW_SHIPS: // Show list of scheduled ships to this station
- case SVW_PLANES: // Show list of scheduled aircraft to this station
- ShowVehicleListWindow(this->owner, (VehicleType)(widget - SVW_TRAINS), (StationID)this->window_number);
+ case WID_SV_TRAINS: // Show list of scheduled trains to this station
+ case WID_SV_ROADVEHS: // Show list of scheduled road-vehicles to this station
+ case WID_SV_SHIPS: // Show list of scheduled ships to this station
+ case WID_SV_PLANES: // Show list of scheduled aircraft to this station
+ ShowVehicleListWindow(this->owner, (VehicleType)(widget - WID_SV_TRAINS), (StationID)this->window_number);
break;
}
}
@@ -1190,7 +1190,7 @@ struct StationViewWindow : public Window {
virtual void OnResize()
{
- this->vscroll->SetCapacityFromWidget(this, SVW_WAITING, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM);
+ this->vscroll->SetCapacityFromWidget(this, WID_SV_WAITING, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM);
}
};
@@ -1317,12 +1317,12 @@ static const T *FindStationsNearby(TileArea ta, bool distant_join)
static const NWidgetPart _nested_select_station_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
- NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, JSW_WIDGET_CAPTION), SetDataTip(STR_JOIN_STATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
+ NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_JS_CAPTION), SetDataTip(STR_JOIN_STATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PANEL, COLOUR_DARK_GREEN, JSW_PANEL), SetResize(1, 0), SetScrollbar(JSW_SCROLLBAR), EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_JS_PANEL), SetResize(1, 0), SetScrollbar(WID_JS_SCROLLBAR), EndContainer(),
NWidget(NWID_VERTICAL),
- NWidget(NWID_VSCROLLBAR, COLOUR_DARK_GREEN, JSW_SCROLLBAR),
+ NWidget(NWID_VSCROLLBAR, COLOUR_DARK_GREEN, WID_JS_SCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_DARK_GREEN),
EndContainer(),
EndContainer(),
@@ -1344,15 +1344,15 @@ struct SelectStationWindow : Window {
area(ta)
{
this->CreateNestedTree(desc);
- this->vscroll = this->GetScrollbar(JSW_SCROLLBAR);
- this->GetWidget<NWidgetCore>(JSW_WIDGET_CAPTION)->widget_data = T::EXPECTED_FACIL == FACIL_WAYPOINT ? STR_JOIN_WAYPOINT_CAPTION : STR_JOIN_STATION_CAPTION;
+ this->vscroll = this->GetScrollbar(WID_JS_SCROLLBAR);
+ this->GetWidget<NWidgetCore>(WID_JS_CAPTION)->widget_data = T::EXPECTED_FACIL == FACIL_WAYPOINT ? STR_JOIN_WAYPOINT_CAPTION : STR_JOIN_STATION_CAPTION;
this->FinishInitNested(desc, 0);
this->OnInvalidateData(0);
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
{
- if (widget != JSW_PANEL) return;
+ if (widget != WID_JS_PANEL) return;
/* Determine the widest string */
Dimension d = GetStringBoundingBox(T::EXPECTED_FACIL == FACIL_WAYPOINT ? STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT : STR_JOIN_STATION_CREATE_SPLITTED_STATION);
@@ -1372,7 +1372,7 @@ struct SelectStationWindow : Window {
virtual void DrawWidget(const Rect &r, int widget) const
{
- if (widget != JSW_PANEL) return;
+ if (widget != WID_JS_PANEL) return;
uint y = r.top + WD_FRAMERECT_TOP;
if (this->vscroll->GetPosition() == 0) {
@@ -1393,9 +1393,9 @@ struct SelectStationWindow : Window {
virtual void OnClick(Point pt, int widget, int click_count)
{
- if (widget != JSW_PANEL) return;
+ if (widget != WID_JS_PANEL) return;
- uint st_index = this->vscroll->GetScrolledRowFromWidget(pt.y, this, JSW_PANEL, WD_FRAMERECT_TOP);
+ uint st_index = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_JS_PANEL, WD_FRAMERECT_TOP);
bool distant_join = (st_index > 0);
if (distant_join) st_index--;
@@ -1422,7 +1422,7 @@ struct SelectStationWindow : Window {
virtual void OnResize()
{
- this->vscroll->SetCapacityFromWidget(this, JSW_PANEL, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM);
+ this->vscroll->SetCapacityFromWidget(this, WID_JS_PANEL, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM);
}
/**
diff --git a/src/widgets/smallmap_widget.h b/src/widgets/smallmap_widget.h
index c23163ba3..00ae1faed 100644
--- a/src/widgets/smallmap_widget.h
+++ b/src/widgets/smallmap_widget.h
@@ -13,25 +13,25 @@
#define WIDGETS_SMALLMAP_WIDGET_H
/** Widgets of the WC_SMALLMAP. */
-enum SmallMapWindowWidgets {
- SM_WIDGET_CAPTION, ///< Caption widget.
- SM_WIDGET_MAP_BORDER, ///< Border around the smallmap.
- SM_WIDGET_MAP, ///< Panel containing the smallmap.
- SM_WIDGET_LEGEND, ///< Bottom panel to display smallmap legends.
- SM_WIDGET_ZOOM_IN, ///< Button to zoom in one step.
- SM_WIDGET_ZOOM_OUT, ///< Button to zoom out one step.
- SM_WIDGET_CONTOUR, ///< Button to select the contour view (height map).
- SM_WIDGET_VEHICLES, ///< Button to select the vehicles view.
- SM_WIDGET_INDUSTRIES, ///< Button to select the industries view.
- SM_WIDGET_ROUTES, ///< Button to select the routes view.
- SM_WIDGET_VEGETATION, ///< Button to select the vegetation view.
- SM_WIDGET_OWNERS, ///< Button to select the owners view.
- SM_WIDGET_CENTERMAP, ///< Button to move smallmap center to main window center.
- SM_WIDGET_TOGGLETOWNNAME, ///< Toggle button to display town names.
- SM_WIDGET_SELECT_BUTTONS, ///< Selection widget for the buttons present in some smallmap modes.
- SM_WIDGET_ENABLE_ALL, ///< Button to enable display of all legend entries.
- SM_WIDGET_DISABLE_ALL, ///< Button to disable display of all legend entries.
- SM_WIDGET_SHOW_HEIGHT, ///< Show heightmap toggle button.
+enum SmallMapWidgets {
+ WID_SM_CAPTION, ///< Caption of the window.
+ WID_SM_MAP_BORDER, ///< Border around the smallmap.
+ WID_SM_MAP, ///< Panel containing the smallmap.
+ WID_SM_LEGEND, ///< Bottom panel to display smallmap legends.
+ WID_SM_ZOOM_IN, ///< Button to zoom in one step.
+ WID_SM_ZOOM_OUT, ///< Button to zoom out one step.
+ WID_SM_CONTOUR, ///< Button to select the contour view (height map).
+ WID_SM_VEHICLES, ///< Button to select the vehicles view.
+ WID_SM_INDUSTRIES, ///< Button to select the industries view.
+ WID_SM_ROUTES, ///< Button to select the routes view.
+ WID_SM_VEGETATION, ///< Button to select the vegetation view.
+ WID_SM_OWNERS, ///< Button to select the owners view.
+ WID_SM_CENTERMAP, ///< Button to move smallmap center to main window center.
+ WID_SM_TOGGLETOWNNAME, ///< Toggle button to display town names.
+ WID_SM_SELECT_BUTTONS, ///< Selection widget for the buttons present in some smallmap modes.
+ WID_SM_ENABLE_ALL, ///< Button to enable display of all legend entries.
+ WID_SM_DISABLE_ALL, ///< Button to disable display of all legend entries.
+ WID_SM_SHOW_HEIGHT, ///< Show heightmap toggle button.
};
-#endif /* WIDGETS_SMALLPAM_WIDGET_H */
+#endif /* WIDGETS_SMALLMAP_WIDGET_H */
diff --git a/src/widgets/station_widget.h b/src/widgets/station_widget.h
index 67a60f54d..612eef777 100644
--- a/src/widgets/station_widget.h
+++ b/src/widgets/station_widget.h
@@ -14,49 +14,47 @@
/** Widgets of the WC_STATION_VIEW. */
enum StationViewWidgets {
- SVW_CAPTION = 0, ///< Caption of the window
- SVW_WAITING = 1, ///< List of waiting cargo
- SVW_SCROLLBAR = 2, ///< Scrollbar
- SVW_ACCEPTLIST = 3, ///< List of accepted cargoes
- SVW_RATINGLIST = 3, ///< Ratings of cargoes
- SVW_LOCATION = 4, ///< 'Location' button
- SVW_RATINGS = 5, ///< 'Ratings' button
- SVW_ACCEPTS = 5, ///< 'Accepts' button
- SVW_RENAME = 6, ///< 'Rename' button
- SVW_TRAINS = 7, ///< List of scheduled trains button
- SVW_ROADVEHS, ///< List of scheduled road vehs button
- SVW_SHIPS, ///< List of scheduled ships button
- SVW_PLANES, ///< List of scheduled planes button
+ WID_SV_CAPTION, ///< Caption of the window.
+ WID_SV_WAITING, ///< List of waiting cargo.
+ WID_SV_SCROLLBAR, ///< Scrollbar.
+ WID_SV_ACCEPT_RATING_LIST, ///< List of accepted cargoes / rating of cargoes.
+ WID_SV_LOCATION, ///< 'Location' button.
+ WID_SV_ACCEPTS_RATINGS, ///< 'Accepts' / 'Ratings' button.
+ WID_SV_RENAME, ///< 'Rename' button.
+ WID_SV_TRAINS, ///< List of scheduled trains button.
+ WID_SV_ROADVEHS, ///< List of scheduled road vehs button.
+ WID_SV_SHIPS, ///< List of scheduled ships button.
+ WID_SV_PLANES, ///< List of scheduled planes button.
};
/** Widgets of the WC_STATION_LIST. */
enum StationListWidgets {
- SLW_CAPTION, ///< Window caption
- SLW_LIST, ///< The main panel, list of stations
- SLW_SCROLLBAR, ///< Scrollbar next to the main panel
+ WID_SL_CAPTION, ///< Caption of the window.
+ WID_SL_LIST, ///< The main panel, list of stations.
+ WID_SL_SCROLLBAR, ///< Scrollbar next to the main panel.
/* Vehicletypes need to be in order of StationFacility due to bit magic */
- SLW_TRAIN, ///< 'TRAIN' button - list only facilities where is a railroad station
- SLW_TRUCK, ///< 'TRUCK' button - list only facilities where is a truck stop
- SLW_BUS, ///< 'BUS' button - list only facilities where is a bus stop
- SLW_AIRPLANE, ///< 'AIRPLANE' button - list only facilities where is an airport
- SLW_SHIP, ///< 'SHIP' button - list only facilities where is a dock
- SLW_FACILALL, ///< 'ALL' button - list all facilities
+ WID_SL_TRAIN, ///< 'TRAIN' button - list only facilities where is a railroad station.
+ WID_SL_TRUCK, ///< 'TRUCK' button - list only facilities where is a truck stop.
+ WID_SL_BUS, ///< 'BUS' button - list only facilities where is a bus stop.
+ WID_SL_AIRPLANE, ///< 'AIRPLANE' button - list only facilities where is an airport.
+ WID_SL_SHIP, ///< 'SHIP' button - list only facilities where is a dock.
+ WID_SL_FACILALL, ///< 'ALL' button - list all facilities.
- SLW_NOCARGOWAITING, ///< 'NO' button - list stations where no cargo is waiting
- SLW_CARGOALL, ///< 'ALL' button - list all stations
+ WID_SL_NOCARGOWAITING, ///< 'NO' button - list stations where no cargo is waiting.
+ WID_SL_CARGOALL, ///< 'ALL' button - list all stations.
- SLW_SORTBY, ///< 'Sort by' button - reverse sort direction
- SLW_SORTDROPBTN, ///< Dropdown button
+ WID_SL_SORTBY, ///< 'Sort by' button - reverse sort direction.
+ WID_SL_SORTDROPBTN, ///< Dropdown button.
- SLW_CARGOSTART, ///< Widget numbers used for list of cargo types (not present in _company_stations_widgets)
+ WID_SL_CARGOSTART, ///< Widget numbers used for list of cargo types (not present in _company_stations_widgets).
};
/** Widgets of the WC_SELECT_STATION. */
enum JoinStationWidgets {
- JSW_WIDGET_CAPTION,
- JSW_PANEL,
- JSW_SCROLLBAR,
+ WID_JS_CAPTION, // Caption of the window.
+ WID_JS_PANEL, // Main panel.
+ WID_JS_SCROLLBAR, // Scrollbar of the panel.
};
#endif /* WIDGETS_STATION_WIDGET_H */