diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 2b2e49ed9d..b9d93aa77d 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -376,7 +376,7 @@ struct AISettingsWindow : public Window { int y = r.top; int button_y_offset = (this->line_height - SETTING_BUTTON_HEIGHT) / 2; - int text_y_offset = (this->line_height - FONT_HEIGHT_NORMAL) / 2; + int text_y_offset = (this->line_height - SETTING_BUTTON_HEIGHT) / 2; for (; this->vscroll->IsVisible(i) && it != visible_settings.end(); i++, it++) { const ScriptConfigItem &config_item = **it; int current_value = config->GetSetting((config_item).name); @@ -418,7 +418,7 @@ struct AISettingsWindow : public Window { } } - DrawString(text_left, text_right, Center(y, this->line_height), str, colour); + DrawString(text_left, text_right, y + text_y_offset, str, colour); y += this->line_height; } } diff --git a/src/gfx.cpp b/src/gfx.cpp index 35e1aadd06..180dae39b9 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -1525,8 +1525,6 @@ void ScreenSizeChanged() /* screen size changed and the old bitmap is invalid now, so we don't want to undraw it */ _cursor.visible = false; - - CheckWindowMinSizings(); } void UndrawMouseCursor() diff --git a/src/settings_gui.h b/src/settings_gui.h index 2699d8aa8c..5daabd84fb 100644 --- a/src/settings_gui.h +++ b/src/settings_gui.h @@ -13,6 +13,12 @@ #include "gfx_type.h" #include "widgets/dropdown_type.h" +/** Width of setting buttons */ +#define SETTING_BUTTON_WIDTH (GetMinButtonSize() * 2) +/** Height of setting buttons */ +#define SETTING_BUTTON_HEIGHT (GetMinButtonSize()) + + extern int SETTING_BUTTON_WIDTH; ///< Width of setting buttons extern int SETTING_BUTTON_HEIGHT; ///< Height of setting buttons diff --git a/src/window.cpp b/src/window.cpp index 27b4c44207..2eee0df862 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1921,21 +1921,6 @@ Window *FindWindowFromPt(int x, int y) return nullptr; } -int SETTING_BUTTON_WIDTH = 20; -int SETTING_BUTTON_HEIGHT = 10; - -/** - * Set button size of settings. If automatic sizing is also enabled, it also sets - * the sizing of buttons, scrollbars and font size (recommend restart). - * @todo Check if it can be moved to another file, so we do not need to include error, string and fontcache headers. - * @todo Fix magic numbers 16/18/20/30/32 - */ -void CheckWindowMinSizings() -{ - SETTING_BUTTON_HEIGHT = GetMinButtonSize(); - SETTING_BUTTON_WIDTH = 2 * SETTING_BUTTON_HEIGHT; -} - /** * (re)initialize the windowing system */ diff --git a/src/window_func.h b/src/window_func.h index 1b8d6bc0f0..ad87a8ea5c 100644 --- a/src/window_func.h +++ b/src/window_func.h @@ -27,7 +27,6 @@ int PositionNetworkChatWindow(Window *w); int GetMainViewTop(); int GetMainViewBottom(); -void CheckWindowMinSizings(); void InitWindowSystem(); void UnInitWindowSystem(); void ResetWindowSystem();