1
0
Fork 0

(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label

CodeChange : Move almost all fixed strings from ON_PAINT event to Widget array using WWT_LABEL.
Feature : All "Select Refit Cargo" are now centered, instead of been left aligned
release/0.5
belugas 2006-08-22 15:23:25 +00:00
parent 480af9c917
commit 4c2abf1de5
11 changed files with 69 additions and 68 deletions

View File

@ -273,7 +273,6 @@ static void AircraftRefitWndProc(Window *w, WindowEvent *e)
SetDParam(1, v->unitnumber); SetDParam(1, v->unitnumber);
DrawWindowWidgets(w); DrawWindowWidgets(w);
DrawString(1, 15, STR_A040_SELECT_CARGO_TYPE_TO_CARRY, 0);
/* TODO: Support for custom GRFSpecial-specified refitting! --pasky */ /* TODO: Support for custom GRFSpecial-specified refitting! --pasky */
WP(w,refit_d).cargo = DrawVehicleRefitWindow(v, WP(w, refit_d).sel); WP(w,refit_d).cargo = DrawVehicleRefitWindow(v, WP(w, refit_d).sel);
@ -316,6 +315,7 @@ static const Widget _aircraft_refit_widgets[] = {
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 14, 145, 0x0, STR_A03E_SELECT_TYPE_OF_CARGO_FOR }, { WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 14, 145, 0x0, STR_A03E_SELECT_TYPE_OF_CARGO_FOR },
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 146, 167, 0x0, STR_NULL }, { WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 146, 167, 0x0, STR_NULL },
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 239, 168, 179, STR_A03D_REFIT_AIRCRAFT, STR_A03F_REFIT_AIRCRAFT_TO_CARRY }, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 239, 168, 179, STR_A03D_REFIT_AIRCRAFT, STR_A03F_REFIT_AIRCRAFT_TO_CARRY },
{ WWT_LABEL, RESIZE_NONE, 0, 0, 239, 13, 26, STR_A040_SELECT_CARGO_TYPE_TO_CARRY, STR_NULL},
{ WIDGETS_END}, { WIDGETS_END},
}; };

View File

@ -186,11 +186,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
DrawWindowWidgets(w); DrawWindowWidgets(w);
// strings such as 'Size' and 'Coverage Area' // strings such as 'Size' and 'Coverage Area'
DrawStringCentered(74, 16, STR_SMALL_AIRPORTS, 0); // 'Coverage Area'
DrawStringCentered(74, 54, STR_LARGE_AIRPORTS, 0);
DrawStringCentered(74, 92, STR_HUB_AIRPORTS, 0);
DrawStringCentered(74, 130, STR_HELIPORTS, 0);
DrawStringCentered(74, 180, STR_3066_COVERAGE_AREA_HIGHLIGHT, 0);
DrawStationCoverageAreaText(2, 206, (uint)-1, rad); DrawStationCoverageAreaText(2, 206, (uint)-1, rad);
break; break;
} }
@ -244,6 +240,11 @@ static const Widget _build_airport_picker_widgets[] = {
{WWT_NODISTXTBTN, RESIZE_NONE, 14, 2, 145, 153, 164, STR_HELISTATION, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, {WWT_NODISTXTBTN, RESIZE_NONE, 14, 2, 145, 153, 164, STR_HELISTATION, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
{ WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 191, 202, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, { WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 191, 202, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE},
{ WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 191, 202, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, { WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 191, 202, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA},
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 14, 27, STR_SMALL_AIRPORTS, STR_NULL},
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 52, 65, STR_LARGE_AIRPORTS, STR_NULL},
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 90, 103, STR_HUB_AIRPORTS, STR_NULL},
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 128, 141, STR_HELIPORTS, STR_NULL},
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 178, 191, STR_3066_COVERAGE_AREA_HIGHLIGHT, STR_NULL},
{ WIDGETS_END}, { WIDGETS_END},
}; };

View File

@ -239,7 +239,6 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
SetTileSelectBigSize(0, 0, 0, 0); SetTileSelectBigSize(0, 0, 0, 0);
} }
DrawStringCentered(74, 17, STR_3066_COVERAGE_AREA_HIGHLIGHT, 0);
DrawStationCoverageAreaText(4, 50, (uint)-1, rad); DrawStationCoverageAreaText(4, 50, (uint)-1, rad);
break; break;
} }
@ -276,6 +275,7 @@ static const Widget _build_dock_station_widgets[] = {
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 74, 0x0, STR_NULL}, { WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 74, 0x0, STR_NULL},
{ WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 30, 40, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, { WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 30, 40, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE},
{ WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 30, 40, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, { WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 30, 40, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA},
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 17, 30, STR_3066_COVERAGE_AREA_HIGHLIGHT, STR_NULL},
{ WIDGETS_END}, { WIDGETS_END},
}; };

View File

@ -1394,6 +1394,7 @@ static const Widget _scen_edit_town_gen_widgets[] = {
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 53, 68, 79, STR_02A1_SMALL, STR_02A4_SELECT_TOWN_SIZE}, { WWT_TEXTBTN, RESIZE_NONE, 14, 2, 53, 68, 79, STR_02A1_SMALL, STR_02A4_SELECT_TOWN_SIZE},
{ WWT_TEXTBTN, RESIZE_NONE, 14, 54, 105, 68, 79, STR_02A2_MEDIUM, STR_02A4_SELECT_TOWN_SIZE}, { WWT_TEXTBTN, RESIZE_NONE, 14, 54, 105, 68, 79, STR_02A2_MEDIUM, STR_02A4_SELECT_TOWN_SIZE},
{ WWT_TEXTBTN, RESIZE_NONE, 14, 106, 157, 68, 79, STR_02A3_LARGE, STR_02A4_SELECT_TOWN_SIZE}, { WWT_TEXTBTN, RESIZE_NONE, 14, 106, 157, 68, 79, STR_02A3_LARGE, STR_02A4_SELECT_TOWN_SIZE},
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 54, 67, STR_02A5_TOWN_SIZE, STR_NULL},
{ WIDGETS_END}, { WIDGETS_END},
}; };
@ -1402,7 +1403,6 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e)
switch (e->event) { switch (e->event) {
case WE_PAINT: case WE_PAINT:
DrawWindowWidgets(w); DrawWindowWidgets(w);
DrawStringCentered(80, 56, STR_02A5_TOWN_SIZE, 0);
break; break;
case WE_CREATE: case WE_CREATE:

View File

@ -731,7 +731,6 @@ static void MessageOptionsWndProc(Window *w, WindowEvent *e)
if (_news_ticker_sound) SETBIT(w->click_state, 25); if (_news_ticker_sound) SETBIT(w->click_state, 25);
DrawWindowWidgets(w); DrawWindowWidgets(w);
DrawStringCentered(185, 15, STR_0205_MESSAGE_TYPES, 0);
/* XXX - Draw the fake widgets-buttons. Can't add these to the widget-desc since /* XXX - Draw the fake widgets-buttons. Can't add these to the widget-desc since
* openttd currently can only handle 32 widgets. So hack it *g* */ * openttd currently can only handle 32 widgets. So hack it *g* */
@ -839,6 +838,7 @@ static const Widget _message_options_widgets[] = {
{ WWT_TEXTBTN, RESIZE_NONE, 3, 87, 98, 154, 165, STR_0225, STR_NULL}, { WWT_TEXTBTN, RESIZE_NONE, 3, 87, 98, 154, 165, STR_0225, STR_NULL},
{ WWT_4, RESIZE_NONE, 3, 4, 98, 166, 177, STR_02DB_OFF, STR_NULL}, { WWT_4, RESIZE_NONE, 3, 4, 98, 166, 177, STR_02DB_OFF, STR_NULL},
{ WWT_LABEL, RESIZE_NONE, 13, 0, 409, 13, 26, STR_0205_MESSAGE_TYPES, STR_NULL},
{ WIDGETS_END}, { WIDGETS_END},
}; };

View File

@ -430,7 +430,6 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
StationPickerDrawSprite(35, 85, 0, image+2); StationPickerDrawSprite(35, 85, 0, image+2);
StationPickerDrawSprite(35, 35, 0, image+3); StationPickerDrawSprite(35, 35, 0, image+3);
DrawStringCentered(70, 120, STR_3066_COVERAGE_AREA_HIGHLIGHT, 0);
DrawStationCoverageAreaText(2, 146, DrawStationCoverageAreaText(2, 146,
((w->window_class == WC_BUS_STATION) ? (1<<CT_PASSENGERS) : ~(1<<CT_PASSENGERS)), ((w->window_class == WC_BUS_STATION) ? (1<<CT_PASSENGERS) : ~(1<<CT_PASSENGERS)),
3); 3);
@ -477,6 +476,7 @@ static const Widget _bus_station_picker_widgets[] = {
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_3051_SELECT_BUS_STATION_ORIENTATION}, { WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_3051_SELECT_BUS_STATION_ORIENTATION},
{ WWT_TEXTBTN, RESIZE_NONE, 14, 10, 69, 133, 144, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, { WWT_TEXTBTN, RESIZE_NONE, 14, 10, 69, 133, 144, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE},
{ WWT_TEXTBTN, RESIZE_NONE, 14, 70, 129, 133, 144, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, { WWT_TEXTBTN, RESIZE_NONE, 14, 70, 129, 133, 144, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA},
{ WWT_LABEL, RESIZE_NONE, 7, 0, 139, 120, 133, STR_3066_COVERAGE_AREA_HIGHLIGHT, STR_NULL},
{ WIDGETS_END}, { WIDGETS_END},
}; };
@ -503,6 +503,7 @@ static const Widget _truck_station_picker_widgets[] = {
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_3052_SELECT_TRUCK_LOADING_BAY}, { WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_3052_SELECT_TRUCK_LOADING_BAY},
{ WWT_TEXTBTN, RESIZE_NONE, 14, 10, 69, 133, 144, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, { WWT_TEXTBTN, RESIZE_NONE, 14, 10, 69, 133, 144, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE},
{ WWT_TEXTBTN, RESIZE_NONE, 14, 70, 129, 133, 144, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, { WWT_TEXTBTN, RESIZE_NONE, 14, 70, 129, 133, 144, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA},
{ WWT_LABEL, RESIZE_NONE, 7, 0, 139, 120, 133, STR_3066_COVERAGE_AREA_HIGHLIGHT, STR_NULL},
{ WIDGETS_END}, { WIDGETS_END},
}; };

View File

@ -89,8 +89,6 @@ static void RoadVehRefitWndProc(Window *w, WindowEvent *e)
SetDParam(1, v->unitnumber); SetDParam(1, v->unitnumber);
DrawWindowWidgets(w); DrawWindowWidgets(w);
DrawString(1, 15, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, 0);
WP(w,refit_d).cargo = DrawVehicleRefitWindow(v, WP(w,refit_d).sel); WP(w,refit_d).cargo = DrawVehicleRefitWindow(v, WP(w,refit_d).sel);
if (WP(w,refit_d).cargo != CT_INVALID) { if (WP(w,refit_d).cargo != CT_INVALID) {
@ -135,6 +133,7 @@ static const Widget _road_veh_refit_widgets[] = {
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 14, 135, 0x0, STR_983D_SELECT_TYPE_OF_CARGO_FOR }, { WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 14, 135, 0x0, STR_983D_SELECT_TYPE_OF_CARGO_FOR },
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 136, 157, 0x0, STR_NULL }, { WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 136, 157, 0x0, STR_NULL },
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 239, 158, 169, STR_REFIT_ROAD_VEHICLE, STR_REFIT_ROAD_VEHICLE_TO_CARRY_HIGHLIGHTED }, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 239, 158, 169, STR_REFIT_ROAD_VEHICLE, STR_REFIT_ROAD_VEHICLE_TO_CARRY_HIGHLIGHTED },
{ WWT_LABEL, RESIZE_NONE, 0, 0, 239, 13, 26, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, STR_NULL},
{ WIDGETS_END }, { WIDGETS_END },
}; };

View File

@ -88,7 +88,6 @@ static void ShipRefitWndProc(Window *w, WindowEvent *e)
SetDParam(1, v->unitnumber); SetDParam(1, v->unitnumber);
DrawWindowWidgets(w); DrawWindowWidgets(w);
DrawString(1, 15, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, 0);
/* TODO: Support for custom GRFSpecial-specified refitting! --pasky */ /* TODO: Support for custom GRFSpecial-specified refitting! --pasky */
WP(w,refit_d).cargo = DrawVehicleRefitWindow(v, WP(w, refit_d).sel);; WP(w,refit_d).cargo = DrawVehicleRefitWindow(v, WP(w, refit_d).sel);;
@ -132,6 +131,7 @@ static const Widget _ship_refit_widgets[] = {
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 14, 135, 0x0, STR_983D_SELECT_TYPE_OF_CARGO_FOR}, { WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 14, 135, 0x0, STR_983D_SELECT_TYPE_OF_CARGO_FOR},
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 136, 157, 0x0, STR_NULL}, { WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 136, 157, 0x0, STR_NULL},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 239, 158, 169, STR_983C_REFIT_SHIP, STR_983E_REFIT_SHIP_TO_CARRY_HIGHLIGHTED}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 239, 158, 169, STR_983C_REFIT_SHIP, STR_983E_REFIT_SHIP_TO_CARRY_HIGHLIGHTED},
{ WWT_LABEL, RESIZE_NONE, 0, 0, 239, 13, 26, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, STR_NULL},
{ WIDGETS_END}, { WIDGETS_END},
}; };

View File

@ -829,7 +829,6 @@ static void RailVehicleRefitWndProc(Window *w, WindowEvent *e)
SetDParam(1, v->unitnumber); SetDParam(1, v->unitnumber);
DrawWindowWidgets(w); DrawWindowWidgets(w);
DrawString(1, 15, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, 0);
/* TODO: Support for custom GRFSpecial-specified refitting! --pasky */ /* TODO: Support for custom GRFSpecial-specified refitting! --pasky */
WP(w,refit_d).cargo = DrawVehicleRefitWindow(v, WP(w, refit_d).sel); WP(w,refit_d).cargo = DrawVehicleRefitWindow(v, WP(w, refit_d).sel);
@ -873,6 +872,7 @@ static const Widget _rail_vehicle_refit_widgets[] = {
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 14, 135, 0x0, STR_RAIL_SELECT_TYPE_OF_CARGO_FOR}, { WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 14, 135, 0x0, STR_RAIL_SELECT_TYPE_OF_CARGO_FOR},
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 136, 157, 0x0, STR_NULL}, { WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 136, 157, 0x0, STR_NULL},
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 239, 158, 169, STR_RAIL_REFIT_VEHICLE, STR_RAIL_REFIT_TO_CARRY_HIGHLIGHTED}, { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 239, 158, 169, STR_RAIL_REFIT_VEHICLE, STR_RAIL_REFIT_TO_CARRY_HIGHLIGHTED},
{ WWT_LABEL, RESIZE_NONE, 0, 0, 239, 13, 26, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, STR_NULL},
{ WIDGETS_END}, { WIDGETS_END},
}; };

View File

@ -197,7 +197,7 @@ void DrawWindowWidgets(const Window *w)
} }
/* fall through */ /* fall through */
case WWT_5: { case WWT_LABEL: {
StringID str = wi->unkA; StringID str = wi->unkA;
if ((wi->type&WWT_MASK) == WWT_4 && clicked) str++; if ((wi->type&WWT_MASK) == WWT_4 && clicked) str++;

View File

@ -538,7 +538,7 @@ enum WindowWidgetTypes {
WWT_TEXTBTN = 3, /* button with text */ WWT_TEXTBTN = 3, /* button with text */
WWT_4 = 4, /* button with diff text when clicked */ WWT_4 = 4, /* button with diff text when clicked */
WWT_5 = 5, /* label */ WWT_LABEL = 5, /* centered label */
WWT_6 = 6, /* combo box text area */ WWT_6 = 6, /* combo box text area */
WWT_MATRIX = 7, WWT_MATRIX = 7,
WWT_SCROLLBAR = 8, WWT_SCROLLBAR = 8,