Mercurial > hg > openttd
changeset 8338:133b06cabee8 draft
(svn r11904) -Codechange: use dropdown widget in 3 more windows, build vehicle, group vehicle list and station list.
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Thu, 17 Jan 2008 18:49:39 +0000 |
parents | 94d8a0939021 |
children | a67679dfa876 |
files | src/build_vehicle_gui.cpp src/group_gui.cpp src/station_gui.cpp src/station_gui.h |
diffstat | 4 files changed, 19 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -55,7 +55,6 @@ BUILD_VEHICLE_WIDGET_CLOSEBOX = 0, BUILD_VEHICLE_WIDGET_CAPTION, BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING, - BUILD_VEHICLE_WIDGET_SORT_TEXT, BUILD_VEHICLE_WIDGET_SORT_DROPDOWN, BUILD_VEHICLE_WIDGET_LIST, BUILD_VEHICLE_WIDGET_SCROLLBAR, @@ -70,8 +69,7 @@ { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, { WWT_CAPTION, RESIZE_RIGHT, 14, 11, 239, 0, 13, 0x0, STR_018C_WINDOW_TITLE_DRAG_THIS }, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 80, 14, 25, STR_SORT_BY, STR_SORT_ORDER_TIP}, - { WWT_PANEL, RESIZE_RIGHT, 14, 81, 227, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, - { WWT_TEXTBTN, RESIZE_LR, 14, 228, 239, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP}, + { WWT_DROPDOWN, RESIZE_RIGHT, 14, 81, 239, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, { WWT_MATRIX, RESIZE_RB, 14, 0, 227, 26, 39, 0x101, STR_NULL }, { WWT_SCROLLBAR, RESIZE_LRB, 14, 228, 239, 26, 39, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST }, { WWT_PANEL, RESIZE_RTB, 14, 0, 239, 40, 161, 0x0, STR_NULL }, @@ -982,6 +980,10 @@ SetVScrollCount(w, EngList_Count(&bv->eng_list)); SetDParam(0, bv->filter.railtype + STR_881C_NEW_RAIL_VEHICLES); // This should only affect rail vehicles + + /* Set text of sort by dropdown */ + w->widget[BUILD_VEHICLE_WIDGET_SORT_DROPDOWN].data = _sort_listing[bv->vehicle_type][bv->sort_criteria]; + DrawWindowWidgets(w); DrawEngineList(bv->vehicle_type, 2, 27, bv->eng_list, w->vscroll.pos, max, bv->sel_engine, false, DEFAULT_GROUP); @@ -993,7 +995,6 @@ if (text_end > wi->bottom) ExpandPurchaseInfoWidget(w, text_end - wi->bottom); } - DrawString(85, 15, _sort_listing[bv->vehicle_type][bv->sort_criteria], TC_BLACK); DoDrawString(bv->descending_sort_order ? DOWNARROW : UPARROW, 69, 15, TC_BLACK); } @@ -1017,7 +1018,7 @@ break; } - case BUILD_VEHICLE_WIDGET_SORT_TEXT: case BUILD_VEHICLE_WIDGET_SORT_DROPDOWN: // Select sorting criteria dropdown menu + case BUILD_VEHICLE_WIDGET_SORT_DROPDOWN: // Select sorting criteria dropdown menu ShowDropDownMenu(w, _sort_listing[bv->vehicle_type], bv->sort_criteria, BUILD_VEHICLE_WIDGET_SORT_DROPDOWN, 0, 0); break;
--- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -115,7 +115,6 @@ GRP_WIDGET_LIST_GROUP, GRP_WIDGET_LIST_GROUP_SCROLLBAR, GRP_WIDGET_SORT_BY_ORDER, - GRP_WIDGET_SORT_BY_TEXT, GRP_WIDGET_SORT_BY_DROPDOWN, GRP_WIDGET_EMPTY_TOP_RIGHT, GRP_WIDGET_LIST_VEHICLE, @@ -127,7 +126,6 @@ GRP_WIDGET_REPLACE_PROTECTION, GRP_WIDGET_EMPTY2, GRP_WIDGET_AVAILABLE_VEHICLES, - GRP_WIDGET_MANAGE_VEHICLES, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN, GRP_WIDGET_STOP_ALL, GRP_WIDGET_START_ALL, @@ -146,8 +144,7 @@ { WWT_MATRIX, RESIZE_BOTTOM, 14, 0, 188, 52, 168, 0x701, STR_GROUPS_CLICK_ON_GROUP_FOR_TIP}, { WWT_SCROLLBAR, RESIZE_BOTTOM, 14, 189, 200, 52, 168, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 201, 281, 14, 25, STR_SORT_BY, STR_SORT_ORDER_TIP}, -{ WWT_PANEL, RESIZE_NONE, 14, 282, 435, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, -{ WWT_TEXTBTN, RESIZE_NONE, 14, 436, 447, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP}, +{ WWT_DROPDOWN, RESIZE_NONE, 14, 282, 447, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, { WWT_PANEL, RESIZE_RIGHT, 14, 448, 459, 14, 25, 0x0, STR_NULL}, { WWT_MATRIX, RESIZE_RB, 14, 201, 447, 26, 181, 0x701, STR_NULL}, { WWT_SCROLL2BAR, RESIZE_LRB, 14, 448, 459, 26, 181, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, @@ -158,8 +155,7 @@ { WWT_PUSHIMGBTN, RESIZE_TB, 14, 165, 188, 169, 193, 0x0, STR_GROUP_REPLACE_PROTECTION_TIP}, { WWT_PANEL, RESIZE_TB, 14, 189, 200, 169, 193, 0x0, STR_NULL}, { WWT_PUSHTXTBTN, RESIZE_TB, 14, 201, 306, 182, 193, 0x0, STR_AVAILABLE_ENGINES_TIP}, -{ WWT_TEXTBTN, RESIZE_TB, 14, 307, 411, 182, 193, STR_MANAGE_LIST, STR_MANAGE_LIST_TIP}, -{ WWT_TEXTBTN, RESIZE_TB, 14, 412, 423, 182, 193, STR_0225, STR_MANAGE_LIST_TIP}, +{ WWT_DROPDOWN, RESIZE_TB, 14, 307, 423, 182, 193, STR_MANAGE_LIST, STR_MANAGE_LIST_TIP}, { WWT_PUSHIMGBTN, RESIZE_TB, 14, 424, 435, 182, 193, SPR_FLAG_VEH_STOPPED, STR_MASS_STOP_LIST_TIP}, { WWT_PUSHIMGBTN, RESIZE_TB, 14, 436, 447, 182, 193, SPR_FLAG_VEH_RUNNING, STR_MASS_START_LIST_TIP}, { WWT_PANEL, RESIZE_RTB, 14, 448, 447, 182, 193, 0x0, STR_NULL}, @@ -345,7 +341,6 @@ w->SetWidgetsDisabledState(gv->l.list_length == 0 || _local_player != owner, GRP_WIDGET_STOP_ALL, GRP_WIDGET_START_ALL, - GRP_WIDGET_MANAGE_VEHICLES, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN, WIDGET_LIST_END); @@ -420,6 +415,8 @@ } } + /* Set text of sort by dropdown */ + w->widget[GRP_WIDGET_SORT_BY_DROPDOWN].data = _vehicle_sort_listing[gv->l.sort_type]; DrawWindowWidgets(w); @@ -470,7 +467,6 @@ } /* Draw Matrix Vehicle according to the vehicle list built before */ - DrawString(285, 15, _vehicle_sort_listing[gv->l.sort_type], TC_BLACK); DoDrawString(gv->l.flags & VL_DESC ? DOWNARROW : UPARROW, 269, 15, TC_BLACK); max = min(w->vscroll2.pos + w->vscroll2.cap, gv->l.list_length); @@ -514,7 +510,6 @@ SetWindowDirty(w); break; - case GRP_WIDGET_SORT_BY_TEXT: case GRP_WIDGET_SORT_BY_DROPDOWN: // Select sorting criteria dropdown menu ShowDropDownMenu(w, _vehicle_sort_listing, gv->l.sort_type, GRP_WIDGET_SORT_BY_DROPDOWN, 0, 0); return; @@ -599,12 +594,9 @@ ShowBuildVehicleWindow(0, gv->vehicle_type); break; - case GRP_WIDGET_MANAGE_VEHICLES: - case GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN: { + case GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN: ShowGroupActionDropdown(w, gv->group_sel); break; - } - case GRP_WIDGET_START_ALL: case GRP_WIDGET_STOP_ALL: { // Start/stop all vehicles of the list
--- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -337,10 +337,12 @@ /* draw widgets, with player's name in the caption */ SetDParam(0, owner); SetDParam(1, w->vscroll.count); + + /* Set text of sort by dropdown */ + w->widget[SLW_SORTDROPBTN].data = _station_sort_listing[sl->sort_type]; + DrawWindowWidgets(w); - /* draw sorting criteria string */ - DrawString(85, 26, _station_sort_listing[sl->sort_type], TC_BLACK); /* draw arrow pointing up/down for ascending/descending sorting */ DoDrawString(sl->flags & SL_ORDER ? DOWNARROW : UPARROW, 69, 26, TC_BLACK); @@ -481,7 +483,6 @@ SetWindowDirty(w); break; - case SLW_SORTCRITERIA: case SLW_SORTDROPBTN: // select sorting criteria dropdown menu ShowDropDownMenu(w, _station_sort_listing, sl->sort_type, SLW_SORTDROPBTN, 0, 0); break; @@ -591,8 +592,7 @@ { WWT_PANEL, RESIZE_RIGHT, 14, 117, 357, 14, 24, 0x0, STR_NULL}, // SLW_PAN_RIGHT { WWT_TEXTBTN, RESIZE_NONE, 14, 0, 80, 25, 36, STR_SORT_BY, STR_SORT_ORDER_TIP}, // SLW_SORTBY -{ WWT_PANEL, RESIZE_NONE, 14, 81, 232, 25, 36, 0x0, STR_SORT_CRITERIA_TIP}, // SLW_SORTCRITERIA -{ WWT_TEXTBTN, RESIZE_NONE, 14, 233, 243, 25, 36, STR_0225, STR_SORT_CRITERIA_TIP}, // SLW_SORTDROPBTN +{ WWT_DROPDOWN, RESIZE_NONE, 14, 81, 243, 25, 36, 0x0, STR_SORT_CRITERIA_TIP}, // SLW_SORTDROPBTN { WWT_PANEL, RESIZE_RIGHT, 14, 244, 357, 25, 36, 0x0, STR_NULL}, // SLW_PAN_SORT_RIGHT { WIDGETS_END}, };
--- a/src/station_gui.h +++ b/src/station_gui.h @@ -24,11 +24,10 @@ SLW_PAN_RIGHT = 15, ///< Panel right of list of cargo types SLW_SORTBY = 16, ///< 'Sort by' button - reverse sort direction - SLW_SORTCRITERIA = 17, ///< Button - list of criteria - SLW_SORTDROPBTN = 18, ///< Dropdown button - SLW_PAN_SORT_RIGHT = 19, ///< Panel right of sorting options + SLW_SORTDROPBTN = 17, ///< Dropdown button + SLW_PAN_SORT_RIGHT = 18, ///< Panel right of sorting options - SLW_CARGOSTART = 20, ///< Widget numbers used for list of cargo types (not present in _player_stations_widgets) + SLW_CARGOSTART = 19, ///< Widget numbers used for list of cargo types (not present in _player_stations_widgets) }; /** Enum for StationView, referring to _station_view_widgets and _station_view_expanded_widgets */