From 51fe741987da095274cd3782ff62371a1126ddb8 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Mon, 22 Sep 2014 08:01:25 +0000 Subject: (svn r26906) -Codechange: Scale depot and station picker buttons by GUI zoom level. --- src/dock_gui.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src/dock_gui.cpp') diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 94b735573..cd994bc0b 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -26,6 +26,7 @@ #include "company_base.h" #include "hotkeys.h" #include "gui.h" +#include "zoom_func.h" #include "widgets/dock_widget.h" @@ -498,14 +499,30 @@ public: UpdateDocksDirection(); } + virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + { + switch (widget) { + case WID_BDD_X: + case WID_BDD_Y: + size->width = UnScaleByZoom(96 * 4, ZOOM_LVL_GUI) + 2; + size->height = UnScaleByZoom(64 * 4, ZOOM_LVL_GUI) + 2; + break; + } + } + virtual void OnPaint() { this->DrawWidgets(); - DrawShipDepotSprite(this->GetWidget(WID_BDD_X)->pos_x + 64, this->GetWidget(WID_BDD_X)->pos_y + 18, AXIS_X, DEPOT_PART_NORTH); - DrawShipDepotSprite(this->GetWidget(WID_BDD_X)->pos_x + 32, this->GetWidget(WID_BDD_X)->pos_y + 34, AXIS_X, DEPOT_PART_SOUTH); - DrawShipDepotSprite(this->GetWidget(WID_BDD_Y)->pos_x + 32, this->GetWidget(WID_BDD_Y)->pos_y + 18, AXIS_Y, DEPOT_PART_NORTH); - DrawShipDepotSprite(this->GetWidget(WID_BDD_Y)->pos_x + 64, this->GetWidget(WID_BDD_Y)->pos_y + 34, AXIS_Y, DEPOT_PART_SOUTH); + int x1 = UnScaleByZoom(63 * 4, ZOOM_LVL_GUI) + 1; + int x2 = UnScaleByZoom(31 * 4, ZOOM_LVL_GUI) + 1; + int y1 = UnScaleByZoom(17 * 4, ZOOM_LVL_GUI) + 1; + int y2 = UnScaleByZoom(33 * 4, ZOOM_LVL_GUI) + 1; + + DrawShipDepotSprite(this->GetWidget(WID_BDD_X)->pos_x + x1, this->GetWidget(WID_BDD_X)->pos_y + y1, AXIS_X, DEPOT_PART_NORTH); + DrawShipDepotSprite(this->GetWidget(WID_BDD_X)->pos_x + x2, this->GetWidget(WID_BDD_X)->pos_y + y2, AXIS_X, DEPOT_PART_SOUTH); + DrawShipDepotSprite(this->GetWidget(WID_BDD_Y)->pos_x + x2, this->GetWidget(WID_BDD_Y)->pos_y + y1, AXIS_Y, DEPOT_PART_NORTH); + DrawShipDepotSprite(this->GetWidget(WID_BDD_Y)->pos_x + x1, this->GetWidget(WID_BDD_Y)->pos_y + y2, AXIS_Y, DEPOT_PART_SOUTH); } virtual void OnClick(Point pt, int widget, int click_count) -- cgit v1.2.3-54-g00ecf