Mercurial > hg > openttd
changeset 8346:7189ea1f59b2 draft
(svn r11912) -Codechange: use dropdown widget for autoreplace, station builder and (second?) vehicle list windows
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Thu, 17 Jan 2008 21:57:20 +0000 |
parents | fa1c3904e50d |
children | a83dd50f52f9 |
files | src/autoreplace_gui.cpp src/rail_gui.cpp src/vehicle_gui.cpp |
diffstat | 3 files changed, 12 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -49,7 +49,6 @@ 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,13 +310,13 @@ w->widget[RVW_WIDGET_TRAIN_FLUFF_RIGHT].color = _player_colors[_local_player]; } - DrawWindowWidgets(w); + if (w->window_number == VEH_TRAIN) { + /* Show the selected railtype in the pulldown menu */ + RailType railtype = _railtype_selected_in_replace_gui; + w->widget[RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN].data = _rail_types_list[railtype]; + } - if (w->window_number == VEH_TRAIN) { - /* Draw 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); - } + DrawWindowWidgets(w); /* sets up the string for the vehicle that is being replaced to */ if (selected_id[0] != INVALID_ENGINE) { @@ -361,7 +360,6 @@ 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 @@ // 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
--- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -723,7 +723,6 @@ BRSW_HIGHLIGHT_ON, BRSW_NEWST_DROPDOWN, - BRSW_NEWST_DROPDOWN_TEXT, BRSW_NEWST_LIST, BRSW_NEWST_SCROLL }; @@ -1004,8 +1003,7 @@ 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 @@ { 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},
--- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -743,14 +743,12 @@ 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 @@ { 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 @@ { 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 @@ } 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 @@ } 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 @@ 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 @@ ShowBuildVehicleWindow(0, vl->vehicle_type); break; - case VLW_WIDGET_MANAGE_VEHICLES: case VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN: { static StringID action_str[] = { STR_REPLACE_VEHICLES,