diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dock_gui.cpp | 76 |
1 files changed, 18 insertions, 58 deletions
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index cad78f3df..0fba14285 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -164,9 +164,9 @@ static OnButtonClick * const _build_docks_button_proc[] = { }; struct BuildDocksToolbarWindow : Window { - BuildDocksToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number) + BuildDocksToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window() { - this->FindWindowPlacementAndResize(desc); + this->InitNested(desc, window_number); if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this); } @@ -256,23 +256,6 @@ struct BuildDocksToolbarWindow : Window { } }; -static const Widget _build_docks_toolb_widgets[] = { -{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW}, // DTW_CLOSEBOX -{ WWT_CAPTION, RESIZE_NONE, COLOUR_DARK_GREEN, 11, 147, 0, 13, STR_WATERWAYS_TOOLBAR_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // DTW_CAPTION -{ WWT_STICKYBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 148, 159, 0, 13, 0x0, STR_STICKY_BUTTON}, // DTW_STICKY -{ WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 21, 14, 35, SPR_IMG_BUILD_CANAL, STR_BUILD_CANALS_TIP}, // DTW_CANAL -{ WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 22, 43, 14, 35, SPR_IMG_BUILD_LOCK, STR_BUILD_LOCKS_TIP}, // DTW_LOCK - -{ WWT_PANEL, RESIZE_NONE, COLOUR_DARK_GREEN, 44, 48, 14, 35, 0x0, STR_NULL}, // DTW_SEPERATOR - -{ WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 49, 70, 14, 35, SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC}, // DTW_DEMOLISH -{ WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 71, 92, 14, 35, SPR_IMG_SHIP_DEPOT, STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP}, // DTW_DEPOT -{ WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 93, 114, 14, 35, SPR_IMG_SHIP_DOCK, STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP}, // DTW_STATION -{ WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 115, 136, 14, 35, SPR_IMG_BOUY, STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP}, // DTW_BUOY -{ WWT_EMPTY, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 0, 0, 0, 0x0, STR_NULL}, // DTW_RIVER -{ WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 137, 159, 14, 35, SPR_IMG_AQUEDUCT, STR_BUILD_AQUEDUCT}, // DTW_BUILD_AQUEDUCT -{ WIDGETS_END}, -}; /** * Nested widget parts of docks toolbar, game version. @@ -285,15 +268,14 @@ static const NWidgetPart _nested_build_docks_toolbar_widgets[] = { NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN, DTW_STICKY), EndContainer(), NWidget(NWID_HORIZONTAL_LTR), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_CANAL), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_BUILD_CANAL, STR_BUILD_CANALS_TIP), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_LOCK), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_BUILD_LOCK, STR_BUILD_LOCKS_TIP), - NWidget(WWT_PANEL, COLOUR_DARK_GREEN, DTW_SEPERATOR), SetMinimalSize(5, 22), EndContainer(), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEMOLISH), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEPOT), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_SHIP_DEPOT, STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_STATION), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_SHIP_DOCK, STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUOY), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_BOUY, STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP), - NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, DTW_RIVER), SetMinimalSize(0, 0), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUILD_AQUEDUCT), SetMinimalSize(23, 22), SetDataTip(SPR_IMG_AQUEDUCT, STR_BUILD_AQUEDUCT), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_CANAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_CANAL, STR_BUILD_CANALS_TIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_LOCK), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_LOCK, STR_BUILD_LOCKS_TIP), + NWidget(WWT_PANEL, COLOUR_DARK_GREEN, DTW_SEPERATOR), SetMinimalSize(5, 22), SetFill(0, 1), EndContainer(), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEPOT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DEPOT, STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_STATION), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DOCK, STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUOY), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BOUY, STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUILD_AQUEDUCT), SetMinimalSize(23, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AQUEDUCT, STR_BUILD_AQUEDUCT), EndContainer(), }; @@ -301,7 +283,7 @@ static const WindowDesc _build_docks_toolbar_desc( WDP_ALIGN_TBR, 22, 160, 36, 160, 36, WC_BUILD_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_CONSTRUCTION, - _build_docks_toolb_widgets, _nested_build_docks_toolbar_widgets, lengthof(_nested_build_docks_toolbar_widgets) + NULL, _nested_build_docks_toolbar_widgets, lengthof(_nested_build_docks_toolbar_widgets) ); void ShowBuildDocksToolbar() @@ -312,25 +294,6 @@ void ShowBuildDocksToolbar() AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_toolbar_desc, TRANSPORT_WATER); } -/** Widget definition for the build docks in scenario editor window. */ -static const Widget _build_docks_scen_toolb_widgets[] = { -{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW}, // DTW_CLOSEBOX -{ WWT_CAPTION, RESIZE_NONE, COLOUR_DARK_GREEN, 11, 102, 0, 13, STR_WATERWAYS_TOOLBAR_CAPTION_SE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // DTW_CAPTION -{ WWT_STICKYBOX, RESIZE_NONE, COLOUR_DARK_GREEN, 103, 114, 0, 13, 0x0, STR_STICKY_BUTTON}, // DTW_STICKY -{ WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 21, 14, 35, SPR_IMG_BUILD_CANAL, STR_CREATE_LAKE}, // DTW_CANAL -{ WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 22, 43, 14, 35, SPR_IMG_BUILD_LOCK, STR_BUILD_LOCKS_TIP}, // DTW_LOCK - -{ WWT_PANEL, RESIZE_NONE, COLOUR_DARK_GREEN, 44, 48, 14, 35, 0x0, STR_NULL}, // DTW_SEPERATOR - -{ WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 49, 70, 14, 35, SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC}, // DTW_DEMOLISH -{ WWT_EMPTY, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 0, 0, 0, 0x0, STR_NULL}, // DTW_DEPOT -{ WWT_EMPTY, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 0, 0, 0, 0x0, STR_NULL}, // DTW_STATION -{ WWT_EMPTY, RESIZE_NONE, COLOUR_DARK_GREEN, 0, 0, 0, 0, 0x0, STR_NULL}, // DTW_BUOY -{ WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 71, 92, 14, 35, SPR_IMG_BUILD_RIVER, STR_CREATE_RIVER}, // DTW_RIVER -{ WWT_IMGBTN, RESIZE_NONE, COLOUR_DARK_GREEN, 93, 114, 14, 35, SPR_IMG_AQUEDUCT, STR_BUILD_AQUEDUCT}, // DTW_BUILD_AQUEDUCT -{ WIDGETS_END}, -}; - /** * Nested widget parts of docks toolbar, scenario editor version. * Positions of #DTW_DEPOT, #DTW_STATION, and #DTW_BUOY widgets have changed. @@ -342,15 +305,12 @@ static const NWidgetPart _nested_build_docks_scen_toolbar_widgets[] = { NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN, DTW_STICKY), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_CANAL), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_BUILD_CANAL, STR_CREATE_LAKE), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_LOCK), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_BUILD_LOCK, STR_BUILD_LOCKS_TIP), - NWidget(WWT_PANEL, COLOUR_DARK_GREEN, DTW_SEPERATOR), SetMinimalSize(5, 22), EndContainer(), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEMOLISH), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), - NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, DTW_DEPOT), SetMinimalSize(0, 0), - NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, DTW_STATION), SetMinimalSize(0, 0), - NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, DTW_BUOY), SetMinimalSize(0, 0), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_RIVER), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_BUILD_RIVER, STR_CREATE_RIVER), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUILD_AQUEDUCT), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AQUEDUCT, STR_BUILD_AQUEDUCT), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_CANAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_CANAL, STR_CREATE_LAKE), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_LOCK), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_LOCK, STR_BUILD_LOCKS_TIP), + NWidget(WWT_PANEL, COLOUR_DARK_GREEN, DTW_SEPERATOR), SetMinimalSize(5, 22), SetFill(0, 1), EndContainer(), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_RIVER), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_RIVER, STR_CREATE_RIVER), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUILD_AQUEDUCT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AQUEDUCT, STR_BUILD_AQUEDUCT), EndContainer(), }; @@ -359,7 +319,7 @@ static const WindowDesc _build_docks_scen_toolbar_desc( WDP_AUTO, WDP_AUTO, 115, 36, 115, 36, WC_SCEN_BUILD_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_CONSTRUCTION, - _build_docks_scen_toolb_widgets, _nested_build_docks_scen_toolbar_widgets, lengthof(_nested_build_docks_scen_toolbar_widgets) + NULL, _nested_build_docks_scen_toolbar_widgets, lengthof(_nested_build_docks_scen_toolbar_widgets) ); void ShowBuildDocksScenToolbar() |