Changeset - r8346:fc2790a75614
[Not reviewed]
master
0 3 0
peter1138 - 17 years ago 2008-01-17 21:57:20
peter1138@openttd.org
(svn r11912) -Codechange: use dropdown widget for autoreplace, station builder and (second?) vehicle list windows
3 files changed with 12 insertions and 25 deletions:
0 comments (0 inline, 0 general)
src/autoreplace_gui.cpp
Show inline comments
 
@@ -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,13 +310,13 @@ static void ReplaceVehicleWndProc(Window
 
				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 @@ static void ReplaceVehicleWndProc(Window
 
					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_vehicl
 
// 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
src/rail_gui.cpp
Show inline comments
 
@@ -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 *
 
			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_
 
{    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},
src/vehicle_gui.cpp
Show inline comments
 
@@ -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_widget
 
	{    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_widget
 
	{      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(Wind
 
	} 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->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, WindowE
 
					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, WindowE
 
					ShowBuildVehicleWindow(0, vl->vehicle_type);
 
					break;
 

	
 
				case VLW_WIDGET_MANAGE_VEHICLES:
 
				case VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN: {
 
					static StringID action_str[] = {
 
						STR_REPLACE_VEHICLES,
0 comments (0 inline, 0 general)