From 3d512eb422b64a11bb1f4d1f9d5461f5c2572b82 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sat, 19 May 2012 01:13:05 +0000 Subject: [PATCH] OS X: Always use 24x24 icons for toolbars attached to frames 32x32 icons really should be used here as they'll get automatically upscaled to that anyway, but we currently don't have those. Originally committed to SVN as r6827. --- aegisub/src/toolbar.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/aegisub/src/toolbar.cpp b/aegisub/src/toolbar.cpp index 3959a39cc..68124b7c1 100644 --- a/aegisub/src/toolbar.cpp +++ b/aegisub/src/toolbar.cpp @@ -62,6 +62,8 @@ namespace { std::vector commands; /// Hotkey context std::string ht_context; + /// Current icon size + int icon_size; /// Listener for icon size change signal agi::signal::Connection icon_size_slot; @@ -86,6 +88,12 @@ namespace { (*commands[evt.GetId() - TOOL_ID_BASE])(context); } + /// Regenerate the toolbar when the icon size changes + void OnIconSizeChange(agi::OptionValue const& opt) { + icon_size = opt.GetInt(); + RegenerateToolbar(); + } + /// Clear the toolbar and recreate it void RegenerateToolbar() { Unbind(wxEVT_IDLE, &Toolbar::OnIdle, this); @@ -103,8 +111,6 @@ namespace { throw agi::InternalError("Toolbar named " + name + " not found.", 0); } - int icon_size = OPT_GET("App/Toolbar Icon Size")->GetInt(); - json::Array const& arr = root_it->second; commands.reserve(arr.size()); bool needs_onidle = false; @@ -177,7 +183,8 @@ namespace { , name(name) , context(c) , ht_context(ht_context) - , icon_size_slot(OPT_SUB("App/Toolbar Icon Size", &Toolbar::RegenerateToolbar, this)) + , icon_size(OPT_GET("App/Toolbar Icon Size")->GetInt()) + , icon_size_slot(OPT_SUB("App/Toolbar Icon Size", &Toolbar::OnIconSizeChange, this)) , hotkeys_changed_slot(hotkey::inst->AddHotkeyChangeListener(&Toolbar::RegenerateToolbar, this)) { Populate(); @@ -189,7 +196,12 @@ namespace { , name(name) , context(c) , ht_context(ht_context) - , icon_size_slot(OPT_SUB("App/Toolbar Icon Size", &Toolbar::RegenerateToolbar, this)) +#ifndef __WXMAC__ + , icon_size(OPT_GET("App/Toolbar Icon Size")->GetInt()) + , icon_size_slot(OPT_SUB("App/Toolbar Icon Size", &Toolbar::OnIconSizeChange, this)) +#else + , icon_size(24) +#endif , hotkeys_changed_slot(hotkey::inst->AddHotkeyChangeListener(&Toolbar::RegenerateToolbar, this)) { parent->SetToolBar(this);