mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r15862) -Codechange: New widgets for the road, rail and ship depot guis.
This commit is contained in:
parent
d17083e429
commit
84b632d60f
|
@ -407,16 +407,17 @@ static void ShowBuildDockStationPicker(Window *parent)
|
|||
new BuildDocksStationWindow(&_build_dock_station_desc, parent);
|
||||
}
|
||||
|
||||
/** Widgets for the build ship depot window. */
|
||||
enum BuildDockDepotWidgets {
|
||||
BDDW_CLOSE,
|
||||
BDDW_CAPTION,
|
||||
BDDW_BACKGROUND,
|
||||
BDDW_X,
|
||||
BDDW_Y,
|
||||
};
|
||||
|
||||
struct BuildDocksDepotWindow : public PickerWindowBase {
|
||||
private:
|
||||
enum BuildDockDepotWidgets {
|
||||
BDDW_CLOSE,
|
||||
BDDW_CAPTION,
|
||||
BDDW_BACKGROUND,
|
||||
BDDW_X,
|
||||
BDDW_Y,
|
||||
};
|
||||
|
||||
static void UpdateDocksDirection()
|
||||
{
|
||||
if (_ship_depot_direction != AXIS_X) {
|
||||
|
@ -469,11 +470,31 @@ static const Widget _build_docks_depot_widgets[] = {
|
|||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const NWidgetPart _nested_build_docks_depot_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN, BDDW_CLOSE),
|
||||
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, BDDW_CAPTION), SetMinimalSize(193, 14), SetDataTip(STR_3800_SHIP_DEPOT_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BDDW_BACKGROUND),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 3),
|
||||
NWidget(NWID_HORIZONTAL_LTR),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(3, 0),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, BDDW_X), SetMinimalSize(98, 66), SetDataTip(0x0, STR_3803_SELECT_SHIP_DEPOT_ORIENTATION),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, BDDW_Y), SetMinimalSize(98, 66), SetDataTip(0x0, STR_3803_SELECT_SHIP_DEPOT_ORIENTATION),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(3, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 3),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
static const WindowDesc _build_docks_depot_desc(
|
||||
WDP_AUTO, WDP_AUTO, 204, 86, 204, 86,
|
||||
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
|
||||
_build_docks_depot_widgets
|
||||
_build_docks_depot_widgets, _nested_build_docks_depot_widgets, lengthof(_nested_build_docks_depot_widgets)
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -1525,20 +1525,18 @@ static void ShowSignalBuilder(Window *parent)
|
|||
new BuildSignalWindow(&_signal_builder_desc, parent);
|
||||
}
|
||||
|
||||
struct BuildRailDepotWindow : public PickerWindowBase {
|
||||
private:
|
||||
/** Enum referring to the widgets of the build rail depot window */
|
||||
enum BuildRailDepotWidgets {
|
||||
BRDW_CLOSEBOX = 0,
|
||||
BRDW_CAPTION,
|
||||
BRDW_BACKGROUND,
|
||||
BRDW_DEPOT_NE,
|
||||
BRDW_DEPOT_SE,
|
||||
BRDW_DEPOT_SW,
|
||||
BRDW_DEPOT_NW,
|
||||
};
|
||||
/** Enum referring to the widgets of the build rail depot window */
|
||||
enum BuildRailDepotWidgets {
|
||||
BRDW_CLOSEBOX = 0,
|
||||
BRDW_CAPTION,
|
||||
BRDW_BACKGROUND,
|
||||
BRDW_DEPOT_NE,
|
||||
BRDW_DEPOT_SE,
|
||||
BRDW_DEPOT_SW,
|
||||
BRDW_DEPOT_NW,
|
||||
};
|
||||
|
||||
public:
|
||||
struct BuildRailDepotWindow : public PickerWindowBase {
|
||||
BuildRailDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
{
|
||||
this->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE);
|
||||
|
@ -1549,10 +1547,10 @@ public:
|
|||
{
|
||||
this->DrawWidgets();
|
||||
|
||||
DrawTrainDepotSprite(70, 17, DIAGDIR_NE, _cur_railtype);
|
||||
DrawTrainDepotSprite(70, 69, DIAGDIR_SE, _cur_railtype);
|
||||
DrawTrainDepotSprite( 2, 69, DIAGDIR_SW, _cur_railtype);
|
||||
DrawTrainDepotSprite( 2, 17, DIAGDIR_NW, _cur_railtype);
|
||||
DrawTrainDepotSprite(this->widget[BRDW_DEPOT_NE].left - 1, this->widget[BRDW_DEPOT_NE].top, DIAGDIR_NE, _cur_railtype);
|
||||
DrawTrainDepotSprite(this->widget[BRDW_DEPOT_SE].left - 1, this->widget[BRDW_DEPOT_SE].top, DIAGDIR_SE, _cur_railtype);
|
||||
DrawTrainDepotSprite(this->widget[BRDW_DEPOT_SW].left - 1, this->widget[BRDW_DEPOT_SW].top, DIAGDIR_SW, _cur_railtype);
|
||||
DrawTrainDepotSprite(this->widget[BRDW_DEPOT_NW].left - 1, this->widget[BRDW_DEPOT_NW].top, DIAGDIR_NW, _cur_railtype);
|
||||
}
|
||||
|
||||
virtual void OnClick(Point pt, int widget)
|
||||
|
@ -1584,11 +1582,41 @@ static const Widget _build_depot_widgets[] = {
|
|||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const NWidgetPart _nested_build_depot_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN, BRDW_CLOSEBOX),
|
||||
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, BRDW_CAPTION), SetMinimalSize(129, 14), SetDataTip(STR_1014_TRAIN_DEPOT_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BRDW_BACKGROUND),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 3),
|
||||
NWidget(NWID_HORIZONTAL_LTR),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(3, 0),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_NW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 2),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_SW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_NE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 2),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_SE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_1020_SELECT_RAILROAD_DEPOT_ORIENTATIO),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(3, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 3),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
static const WindowDesc _build_depot_desc(
|
||||
WDP_AUTO, WDP_AUTO, 140, 122, 140, 122,
|
||||
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
|
||||
_build_depot_widgets
|
||||
_build_depot_widgets, _nested_build_depot_widgets, lengthof(_nested_build_depot_widgets)
|
||||
);
|
||||
|
||||
static void ShowBuildTrainDepotPicker(Window *parent)
|
||||
|
|
|
@ -784,20 +784,18 @@ void ShowBuildRoadScenToolbar()
|
|||
AllocateWindowDescFront<BuildRoadToolbarWindow>(&_build_road_scen_desc, 0);
|
||||
}
|
||||
|
||||
struct BuildRoadDepotWindow : public PickerWindowBase {
|
||||
private:
|
||||
/** Enum referring to the widgets of the build road depot window */
|
||||
enum BuildRoadDepotWidgets {
|
||||
BRDW_CLOSEBOX = 0,
|
||||
BRDW_CAPTION,
|
||||
BRDW_BACKGROUND,
|
||||
BRDW_DEPOT_NE,
|
||||
BRDW_DEPOT_SE,
|
||||
BRDW_DEPOT_SW,
|
||||
BRDW_DEPOT_NW,
|
||||
};
|
||||
/** Enum referring to the widgets of the build road depot window */
|
||||
enum BuildRoadDepotWidgets {
|
||||
BRDW_CLOSEBOX = 0,
|
||||
BRDW_CAPTION,
|
||||
BRDW_BACKGROUND,
|
||||
BRDW_DEPOT_NE,
|
||||
BRDW_DEPOT_SE,
|
||||
BRDW_DEPOT_SW,
|
||||
BRDW_DEPOT_NW,
|
||||
};
|
||||
|
||||
public:
|
||||
struct BuildRoadDepotWindow : public PickerWindowBase {
|
||||
BuildRoadDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
{
|
||||
this->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE);
|
||||
|
@ -812,10 +810,10 @@ public:
|
|||
{
|
||||
this->DrawWidgets();
|
||||
|
||||
DrawRoadDepotSprite(70, 17, DIAGDIR_NE, _cur_roadtype);
|
||||
DrawRoadDepotSprite(70, 69, DIAGDIR_SE, _cur_roadtype);
|
||||
DrawRoadDepotSprite( 2, 69, DIAGDIR_SW, _cur_roadtype);
|
||||
DrawRoadDepotSprite( 2, 17, DIAGDIR_NW, _cur_roadtype);
|
||||
DrawRoadDepotSprite(this->widget[BRDW_DEPOT_NE].left - 1, this->widget[BRDW_DEPOT_NE].top, DIAGDIR_NE, _cur_roadtype);
|
||||
DrawRoadDepotSprite(this->widget[BRDW_DEPOT_SE].left - 1, this->widget[BRDW_DEPOT_SE].top, DIAGDIR_SE, _cur_roadtype);
|
||||
DrawRoadDepotSprite(this->widget[BRDW_DEPOT_SW].left - 1, this->widget[BRDW_DEPOT_SW].top, DIAGDIR_SW, _cur_roadtype);
|
||||
DrawRoadDepotSprite(this->widget[BRDW_DEPOT_NW].left - 1, this->widget[BRDW_DEPOT_NW].top, DIAGDIR_NW, _cur_roadtype);
|
||||
}
|
||||
|
||||
virtual void OnClick(Point pt, int widget)
|
||||
|
@ -850,11 +848,41 @@ static const Widget _build_road_depot_widgets[] = {
|
|||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const NWidgetPart _nested_build_road_depot_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN, BRDW_CLOSEBOX),
|
||||
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, BRDW_CAPTION), SetMinimalSize(129, 14), SetDataTip(STR_1806_ROAD_DEPOT_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BRDW_BACKGROUND),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 3),
|
||||
NWidget(NWID_HORIZONTAL_LTR),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(3, 0),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_NW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_1813_SELECT_ROAD_VEHICLE_DEPOT),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 2),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_SW), SetMinimalSize(66, 50), SetDataTip(0x0, STR_1813_SELECT_ROAD_VEHICLE_DEPOT),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_NE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_1813_SELECT_ROAD_VEHICLE_DEPOT),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 2),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, BRDW_DEPOT_SE), SetMinimalSize(66, 50), SetDataTip(0x0, STR_1813_SELECT_ROAD_VEHICLE_DEPOT),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(3, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 3),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
static const WindowDesc _build_road_depot_desc(
|
||||
WDP_AUTO, WDP_AUTO, 140, 122, 140, 122,
|
||||
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
|
||||
_build_road_depot_widgets
|
||||
_build_road_depot_widgets, _nested_build_road_depot_widgets, lengthof(_nested_build_road_depot_widgets)
|
||||
);
|
||||
|
||||
static void ShowRoadDepotPicker(Window *parent)
|
||||
|
|
Loading…
Reference in New Issue