summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rail_gui.cpp94
1 files changed, 17 insertions, 77 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 753426fd0..4564ebacb 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -941,6 +941,7 @@ enum BuildRailStationWidgets {
BRSW_HIGHLIGHT_OFF,
BRSW_HIGHLIGHT_ON,
+ BRSW_SHOW_NEWST_ADDITIONS,
BRSW_NEWST_DROPDOWN,
BRSW_NEWST_LIST,
BRSW_NEWST_SCROLL,
@@ -998,7 +999,10 @@ private:
public:
BuildRailStationWindow(const WindowDesc *desc, Window *parent, bool newstation) : PickerWindowBase(parent)
{
- this->InitNested(desc, TRANSPORT_RAIL);
+ this->CreateNestedTree(desc);
+ NWidgetStacked *newst_additions = this->GetWidget<NWidgetStacked>(BRSW_SHOW_NEWST_ADDITIONS);
+ newst_additions->SetDisplayedPlane(newstation ? 0 : SZSP_NONE);
+ this->FinishInitNested(desc, TRANSPORT_RAIL);
this->LowerWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X);
if (_settings_client.gui.station_dragdrop) {
@@ -1351,70 +1355,17 @@ static const NWidgetPart _nested_station_builder_widgets[] = {
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_RAIL_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BRSW_BACKGROUND),
- NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(144, 11), SetDataTip(STR_STATION_BUILD_ORIENTATION, STR_NULL), SetPadding(1, 2, 0, 2),
- NWidget(NWID_HORIZONTAL),
- NWidget(NWID_SPACER), SetMinimalSize(7, 0), SetFill(1, 0),
- NWidget(WWT_PANEL, COLOUR_GREY, BRSW_PLATFORM_DIR_X), SetMinimalSize(66, 48), SetFill(0, 0), SetDataTip(0x0, STR_STATION_BUILD_RAILROAD_ORIENTATION_TOOLTIP), EndContainer(),
- NWidget(NWID_SPACER), SetMinimalSize(2, 0), SetFill(1, 0),
- NWidget(WWT_PANEL, COLOUR_GREY, BRSW_PLATFORM_DIR_Y), SetMinimalSize(66, 48), SetFill(0, 0), SetDataTip(0x0, STR_STATION_BUILD_RAILROAD_ORIENTATION_TOOLTIP), EndContainer(),
- NWidget(NWID_SPACER), SetMinimalSize(7, 0), SetFill(1, 0),
- EndContainer(),
- NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(144, 11), SetDataTip(STR_STATION_BUILD_NUMBER_OF_TRACKS, STR_NULL), SetPadding(2, 2, 0, 2),
- NWidget(NWID_HORIZONTAL),
- NWidget(NWID_SPACER), SetFill(1, 0),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_PLATFORM_NUM_1), SetMinimalSize(15, 12), SetDataTip(STR_BLACK_1, STR_STATION_BUILD_NUMBER_OF_TRACKS_TOOLTIP),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_PLATFORM_NUM_2), SetMinimalSize(15, 12), SetDataTip(STR_BLACK_2, STR_STATION_BUILD_NUMBER_OF_TRACKS_TOOLTIP),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_PLATFORM_NUM_3), SetMinimalSize(15, 12), SetDataTip(STR_BLACK_3, STR_STATION_BUILD_NUMBER_OF_TRACKS_TOOLTIP),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_PLATFORM_NUM_4), SetMinimalSize(15, 12), SetDataTip(STR_BLACK_4, STR_STATION_BUILD_NUMBER_OF_TRACKS_TOOLTIP),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_PLATFORM_NUM_5), SetMinimalSize(15, 12), SetDataTip(STR_BLACK_5, STR_STATION_BUILD_NUMBER_OF_TRACKS_TOOLTIP),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_PLATFORM_NUM_6), SetMinimalSize(15, 12), SetDataTip(STR_BLACK_6, STR_STATION_BUILD_NUMBER_OF_TRACKS_TOOLTIP),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_PLATFORM_NUM_7), SetMinimalSize(15, 12), SetDataTip(STR_BLACK_7, STR_STATION_BUILD_NUMBER_OF_TRACKS_TOOLTIP),
- NWidget(NWID_SPACER), SetFill(1, 0),
- EndContainer(),
- NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(144, 11), SetDataTip(STR_STATION_BUILD_PLATFORM_LENGTH, STR_NULL), SetPadding(2, 2, 0, 2),
- NWidget(NWID_HORIZONTAL),
- NWidget(NWID_SPACER), SetFill(1, 0),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_PLATFORM_LEN_1), SetMinimalSize(15, 12), SetDataTip(STR_BLACK_1, STR_STATION_BUILD_PLATFORM_LENGTH_TOOLTIP),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_PLATFORM_LEN_2), SetMinimalSize(15, 12), SetDataTip(STR_BLACK_2, STR_STATION_BUILD_PLATFORM_LENGTH_TOOLTIP),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_PLATFORM_LEN_3), SetMinimalSize(15, 12), SetDataTip(STR_BLACK_3, STR_STATION_BUILD_PLATFORM_LENGTH_TOOLTIP),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_PLATFORM_LEN_4), SetMinimalSize(15, 12), SetDataTip(STR_BLACK_4, STR_STATION_BUILD_PLATFORM_LENGTH_TOOLTIP),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_PLATFORM_LEN_5), SetMinimalSize(15, 12), SetDataTip(STR_BLACK_5, STR_STATION_BUILD_PLATFORM_LENGTH_TOOLTIP),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_PLATFORM_LEN_6), SetMinimalSize(15, 12), SetDataTip(STR_BLACK_6, STR_STATION_BUILD_PLATFORM_LENGTH_TOOLTIP),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_PLATFORM_LEN_7), SetMinimalSize(15, 12), SetDataTip(STR_BLACK_7, STR_STATION_BUILD_PLATFORM_LENGTH_TOOLTIP),
- NWidget(NWID_SPACER), SetFill(1, 0),
- EndContainer(),
- NWidget(NWID_SPACER), SetMinimalSize(0, 2),
- NWidget(NWID_HORIZONTAL),
- NWidget(NWID_SPACER), SetMinimalSize(2, 0), SetFill(1, 0),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_PLATFORM_DRAG_N_DROP), SetMinimalSize(75, 12), SetDataTip(STR_STATION_BUILD_DRAG_DROP, STR_STATION_BUILD_DRAG_DROP_TOOLTIP),
- NWidget(NWID_SPACER), SetMinimalSize(2, 0), SetFill(1, 0),
- EndContainer(),
- NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(144, 11), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetPadding(3, 2, 0, 2),
- NWidget(NWID_HORIZONTAL),
- NWidget(NWID_SPACER), SetMinimalSize(2, 0), SetFill(1, 0),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_HIGHLIGHT_OFF), SetMinimalSize(60, 12),
- SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
- NWidget(WWT_TEXTBTN, COLOUR_GREY, BRSW_HIGHLIGHT_ON), SetMinimalSize(60, 12),
- SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
- NWidget(NWID_SPACER), SetMinimalSize(2, 0), SetFill(1, 0),
- EndContainer(),
- NWidget(NWID_SPACER), SetMinimalSize(0, 20), SetResize(0, 1),
- EndContainer(),
-};
-
-static const NWidgetPart _nested_newstation_builder_widgets[] = {
- NWidget(NWID_HORIZONTAL),
- NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
- NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_RAIL_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
- EndContainer(),
- NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BRSW_BACKGROUND),
/* begin newstations gui additions. */
- NWidget(WWT_DROPDOWN, COLOUR_GREY, BRSW_NEWST_DROPDOWN), SetMinimalSize(134, 12), SetFill(1, 0), SetPadding(3, 7, 3, 7), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_STATION_CLASS_TOOLTIP),
- NWidget(NWID_HORIZONTAL), SetPIP(7, 0, 7),
- NWidget(WWT_MATRIX, COLOUR_GREY, BRSW_NEWST_LIST), SetMinimalSize(122, 71), SetFill(1, 0), SetDataTip(0x501, STR_STATION_BUILD_STATION_TYPE_TOOLTIP),
- NWidget(WWT_SCROLLBAR, COLOUR_GREY, BRSW_NEWST_SCROLL),
+ NWidget(NWID_SELECTION, INVALID_COLOUR, BRSW_SHOW_NEWST_ADDITIONS),
+ NWidget(NWID_VERTICAL),
+ NWidget(WWT_DROPDOWN, COLOUR_GREY, BRSW_NEWST_DROPDOWN), SetMinimalSize(134, 12), SetFill(1, 0), SetPadding(3, 7, 3, 7), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_STATION_CLASS_TOOLTIP),
+ NWidget(NWID_HORIZONTAL), SetPIP(7, 0, 7),
+ NWidget(WWT_MATRIX, COLOUR_GREY, BRSW_NEWST_LIST), SetMinimalSize(122, 71), SetFill(1, 0), SetDataTip(0x501, STR_STATION_BUILD_STATION_TYPE_TOOLTIP),
+ NWidget(WWT_SCROLLBAR, COLOUR_GREY, BRSW_NEWST_SCROLL),
+ EndContainer(),
+ NWidget(NWID_SPACER), SetMinimalSize(0, 1),
+ EndContainer(),
EndContainer(),
- NWidget(NWID_SPACER), SetMinimalSize(0, 1),
/* end newstations gui additions. */
NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(144, 11), SetDataTip(STR_STATION_BUILD_ORIENTATION, STR_NULL), SetPadding(1, 2, 0, 2),
NWidget(NWID_HORIZONTAL),
@@ -1467,7 +1418,7 @@ static const NWidgetPart _nested_newstation_builder_widgets[] = {
EndContainer(),
};
-/** High level window description of the default station-build window */
+/** High level window description of the station-build window (default & newGRF) */
static const WindowDesc _station_builder_desc(
WDP_AUTO, 0, 0,
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
@@ -1475,22 +1426,11 @@ static const WindowDesc _station_builder_desc(
_nested_station_builder_widgets, lengthof(_nested_station_builder_widgets)
);
-/** High level window description of the newGRF station-build window */
-static const WindowDesc _newstation_builder_desc(
- WDP_AUTO, 0, 0,
- WC_BUILD_STATION, WC_BUILD_TOOLBAR,
- WDF_CONSTRUCTION,
- _nested_newstation_builder_widgets, lengthof(_nested_newstation_builder_widgets)
-);
-
/** Open station build window */
static void ShowStationBuilder(Window *parent)
{
- if (GetNumStationClasses() <= 2 && GetNumCustomStations(STAT_CLASS_DFLT) == 1) {
- new BuildRailStationWindow(&_station_builder_desc, parent, false);
- } else {
- new BuildRailStationWindow(&_newstation_builder_desc, parent, true);
- }
+ bool newstations = GetNumStationClasses() > 2 || GetNumCustomStations(STAT_CLASS_DFLT) != 1;
+ new BuildRailStationWindow(&_station_builder_desc, parent, newstations);
}
/** Enum referring to the widgets of the signal window */