summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-01-17 21:57:20 +0000
committerpeter1138 <peter1138@openttd.org>2008-01-17 21:57:20 +0000
commit307b0e8e7aa05ae776bd13331409ac1a2aaf4ecd (patch)
treef0865c504ce14b5f8046a8c43c3cd24a7eaa5bea
parentada41b7b3ff7560fc0b79aaac9292ea9acbde4c6 (diff)
downloadopenttd-307b0e8e7aa05ae776bd13331409ac1a2aaf4ecd.tar.xz
(svn r11912) -Codechange: use dropdown widget for autoreplace, station builder and (second?) vehicle list windows
-rw-r--r--src/autoreplace_gui.cpp13
-rw-r--r--src/rail_gui.cpp7
-rw-r--r--src/vehicle_gui.cpp13
3 files changed, 10 insertions, 23 deletions
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 4b87baaba..448a48c81 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -49,7 +49,6 @@ enum ReplaceVehicleWindowWidgets {
RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE,
RVW_WIDGET_TRAIN_FLUFF_LEFT,
- RVW_WIDGET_TRAIN_RAILTYPE_TEXT,
RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN,
RVW_WIDGET_TRAIN_FLUFF_RIGHT,
RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE,
@@ -311,14 +310,14 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
w->widget[RVW_WIDGET_TRAIN_FLUFF_RIGHT].color = _player_colors[_local_player];
}
- DrawWindowWidgets(w);
-
if (w->window_number == VEH_TRAIN) {
- /* Draw the selected railtype in the pulldown menu */
+ /* Show the selected railtype in the pulldown menu */
RailType railtype = _railtype_selected_in_replace_gui;
- DrawString(157, w->widget[RVW_WIDGET_TRAIN_RAILTYPE_TEXT].top + 1, _rail_types_list[railtype], TC_BLACK);
+ w->widget[RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN].data = _rail_types_list[railtype];
}
+ DrawWindowWidgets(w);
+
/* sets up the string for the vehicle that is being replaced to */
if (selected_id[0] != INVALID_ENGINE) {
if (!EngineHasReplacementForPlayer(p, selected_id[0], selected_group)) {
@@ -361,7 +360,6 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
SetWindowDirty(w);
break;
- case RVW_WIDGET_TRAIN_RAILTYPE_TEXT:
case RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN: /* Railtype selection dropdown menu */
ShowDropDownMenu(w, _rail_types_list, _railtype_selected_in_replace_gui, RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN, 0, ~GetPlayer(_local_player)->avail_railtypes);
break;
@@ -457,8 +455,7 @@ static const Widget _replace_rail_vehicle_widgets[] = {
// train specific stuff
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 138, 228, 239, STR_REPLACE_ENGINE_WAGON_SELECT, STR_REPLACE_ENGINE_WAGON_SELECT_HELP}, // widget 12
{ WWT_PANEL, RESIZE_TB, 14, 139, 153, 240, 251, 0x0, STR_NULL},
-{ WWT_PANEL, RESIZE_TB, 14, 154, 277, 240, 251, 0x0, STR_REPLACE_HELP_RAILTYPE},
-{ WWT_TEXTBTN, RESIZE_TB, 14, 278, 289, 240, 251, STR_0225, STR_REPLACE_HELP_RAILTYPE},
+{ WWT_DROPDOWN, RESIZE_TB, 14, 154, 289, 240, 251, 0x0, STR_REPLACE_HELP_RAILTYPE},
{ WWT_PANEL, RESIZE_TB, 14, 290, 305, 240, 251, 0x0, STR_NULL},
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 317, 455, 228, 239, STR_REPLACE_REMOVE_WAGON, STR_REPLACE_REMOVE_WAGON_HELP},
// end of train specific stuff
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index d0a74b420..b29267af3 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -723,7 +723,6 @@ enum BuildRailStationWidgets {
BRSW_HIGHLIGHT_ON,
BRSW_NEWST_DROPDOWN,
- BRSW_NEWST_DROPDOWN_TEXT,
BRSW_NEWST_LIST,
BRSW_NEWST_SCROLL
};
@@ -1004,8 +1003,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
break;
case BRSW_NEWST_DROPDOWN:
- case BRSW_NEWST_DROPDOWN_TEXT:
- ShowDropDownList(w, BuildStationClassDropDown(), _railstation.station_class, BRSW_NEWST_DROPDOWN_TEXT);
+ ShowDropDownList(w, BuildStationClassDropDown(), _railstation.station_class, BRSW_NEWST_DROPDOWN);
break;
case BRSW_NEWST_LIST: {
@@ -1122,8 +1120,7 @@ static const Widget _newstation_builder_widgets[] = {
{ WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 242, 253, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, // BRSW_HIGHLIGHT_ON
/* newstations gui additions */
-{ WWT_INSET, RESIZE_NONE, 14, 7, 140, 17, 28, STR_02BD, STR_SELECT_STATION_CLASS_TIP}, // BRSW_NEWST_DROPDOWN
-{ WWT_TEXTBTN, RESIZE_NONE, 14, 129, 139, 18, 27, STR_0225, STR_SELECT_STATION_CLASS_TIP}, // BRSW_NEWST_DROPDOWN_TEXT
+{ WWT_DROPDOWNIN, RESIZE_NONE, 14, 7, 140, 17, 28, STR_02BD, STR_SELECT_STATION_CLASS_TIP}, // BRSW_NEWST_DROPDOWN
{ WWT_MATRIX, RESIZE_NONE, 14, 7, 128, 32, 102, 0x501, STR_SELECT_STATION_TYPE_TIP}, // BRSW_NEWST_LIST
{ WWT_SCROLLBAR, RESIZE_NONE, 14, 129, 140, 32, 102, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // BRSW_NEWST_SCROLL
{ WIDGETS_END},
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 5a94394d1..2e4c666d4 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -743,14 +743,12 @@ enum VehicleListWindowWidgets {
VLW_WIDGET_CAPTION,
VLW_WIDGET_STICKY,
VLW_WIDGET_SORT_ORDER,
- VLW_WIDGET_SORT_BY_TEXT,
VLW_WIDGET_SORT_BY_PULLDOWN,
VLW_WIDGET_EMPTY_TOP_RIGHT,
VLW_WIDGET_LIST,
VLW_WIDGET_SCROLLBAR,
VLW_WIDGET_OTHER_PLAYER_FILLER,
VLW_WIDGET_AVAILABLE_VEHICLES,
- VLW_WIDGET_MANAGE_VEHICLES,
VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN,
VLW_WIDGET_STOP_ALL,
VLW_WIDGET_START_ALL,
@@ -763,8 +761,7 @@ static const Widget _vehicle_list_widgets[] = {
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 247, 0, 13, 0x0, STR_018C_WINDOW_TITLE_DRAG_THIS},
{ WWT_STICKYBOX, RESIZE_LR, 14, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 80, 14, 25, STR_SORT_BY, STR_SORT_ORDER_TIP},
- { WWT_PANEL, RESIZE_NONE, 14, 81, 235, 14, 25, 0x0, STR_SORT_CRITERIA_TIP},
- { WWT_TEXTBTN, RESIZE_NONE, 14, 236, 247, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP},
+ { WWT_DROPDOWN, RESIZE_NONE, 14, 81, 247, 14, 25, 0x0, STR_SORT_CRITERIA_TIP},
{ WWT_PANEL, RESIZE_RIGHT, 14, 248, 259, 14, 25, 0x0, STR_NULL},
{ WWT_MATRIX, RESIZE_RB, 14, 0, 247, 26, 169, 0x0, STR_NULL},
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 248, 259, 26, 169, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
@@ -772,8 +769,7 @@ static const Widget _vehicle_list_widgets[] = {
{ WWT_PANEL, RESIZE_RTB, 14, 0, 247, 170, 181, 0x0, STR_NULL},
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 105, 170, 181, 0x0, STR_AVAILABLE_ENGINES_TIP},
- { WWT_TEXTBTN, RESIZE_TB, 14, 106, 211, 170, 181, STR_MANAGE_LIST, STR_MANAGE_LIST_TIP},
- { WWT_TEXTBTN, RESIZE_TB, 14, 212, 223, 170, 181, STR_0225, STR_MANAGE_LIST_TIP},
+ { WWT_DROPDOWN, RESIZE_TB, 14, 106, 223, 170, 181, STR_MANAGE_LIST, STR_MANAGE_LIST_TIP},
{ WWT_PUSHIMGBTN, RESIZE_TB, 14, 224, 235, 170, 181, SPR_FLAG_VEH_STOPPED, STR_MASS_STOP_LIST_TIP},
{ WWT_PUSHIMGBTN, RESIZE_TB, 14, 236, 247, 170, 181, SPR_FLAG_VEH_RUNNING, STR_MASS_START_LIST_TIP},
@@ -801,7 +797,6 @@ static void CreateVehicleListWindow(Window *w)
} else {
w->SetWidgetsHiddenState(true,
VLW_WIDGET_AVAILABLE_VEHICLES,
- VLW_WIDGET_MANAGE_VEHICLES,
VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN,
VLW_WIDGET_STOP_ALL,
VLW_WIDGET_START_ALL,
@@ -983,7 +978,6 @@ static void DrawVehicleListWindow(Window *w)
}
w->SetWidgetsDisabledState(vl->l.list_length == 0,
- VLW_WIDGET_MANAGE_VEHICLES,
VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN,
VLW_WIDGET_STOP_ALL,
VLW_WIDGET_START_ALL,
@@ -1059,7 +1053,7 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
vl->_sorting->order = !!(vl->l.flags & VL_DESC);
SetWindowDirty(w);
break;
- case VLW_WIDGET_SORT_BY_TEXT: case VLW_WIDGET_SORT_BY_PULLDOWN:/* Select sorting criteria dropdown menu */
+ case VLW_WIDGET_SORT_BY_PULLDOWN:/* Select sorting criteria dropdown menu */
ShowDropDownMenu(w, _vehicle_sort_listing, vl->l.sort_type, VLW_WIDGET_SORT_BY_PULLDOWN, 0, 0);
return;
case VLW_WIDGET_LIST: { /* Matrix to show vehicles */
@@ -1081,7 +1075,6 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
ShowBuildVehicleWindow(0, vl->vehicle_type);
break;
- case VLW_WIDGET_MANAGE_VEHICLES:
case VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN: {
static StringID action_str[] = {
STR_REPLACE_VEHICLES,