Use retina icons for the main toolbar if first opened on a retina display

This commit is contained in:
Thomas Goyne 2013-12-26 17:55:41 -08:00
parent b4ed6a3b1a
commit f4a6d90db4
4 changed files with 11 additions and 1 deletions

View file

@ -61,3 +61,8 @@ void SetPlaceholderText(wxWindow *window, wxString const& placeholder) {
cell.placeholderString = wxCFStringRef(placeholder).AsNSString(); cell.placeholderString = wxCFStringRef(placeholder).AsNSString();
} }
} }
double GetScaleFactor(wxWindow *window) {
NSWindow *nsWindow = [window->GetHandle() window];
return [nsWindow respondsToSelector:@selector(backingScaleFactor)] ? nsWindow.backingScaleFactor : 1.0;
}

View file

@ -26,6 +26,7 @@
#include "include/aegisub/hotkey.h" #include "include/aegisub/hotkey.h"
#include "libresrc/libresrc.h" #include "libresrc/libresrc.h"
#include "options.h" #include "options.h"
#include "utils.h"
#include <libaegisub/hotkey.h> #include <libaegisub/hotkey.h>
#include <libaegisub/json.h> #include <libaegisub/json.h>
@ -186,7 +187,7 @@ namespace {
, icon_size(OPT_GET("App/Toolbar Icon Size")->GetInt()) , icon_size(OPT_GET("App/Toolbar Icon Size")->GetInt())
, icon_size_slot(OPT_SUB("App/Toolbar Icon Size", &Toolbar::OnIconSizeChange, this)) , icon_size_slot(OPT_SUB("App/Toolbar Icon Size", &Toolbar::OnIconSizeChange, this))
#else #else
, icon_size(32) , icon_size(32 * GetScaleFactor(parent))
#endif #endif
, hotkeys_changed_slot(hotkey::inst->AddHotkeyChangeListener(&Toolbar::RegenerateToolbar, this)) , hotkeys_changed_slot(hotkey::inst->AddHotkeyChangeListener(&Toolbar::RegenerateToolbar, this))
{ {

View file

@ -271,6 +271,7 @@ size_t MaxLineLength(std::string const& text, bool ignore_whitespace) {
#ifndef __WXOSX_COCOA__ #ifndef __WXOSX_COCOA__
void AddFullScreenButton(wxWindow *) { } void AddFullScreenButton(wxWindow *) { }
void SetFloatOnParent(wxWindow *) { } void SetFloatOnParent(wxWindow *) { }
double GetScaleFactor(wxWindow *) { return 1; }
#endif #endif
wxString FontFace(std::string opt_prefix) { wxString FontFace(std::string opt_prefix) {

View file

@ -49,6 +49,7 @@
class wxMouseEvent; class wxMouseEvent;
class wxWindow; class wxWindow;
namespace cmd { class Command; }
wxString PrettySize(int bytes); wxString PrettySize(int bytes);
@ -77,6 +78,8 @@ void SetFloatOnParent(wxWindow *window);
void SetPlaceholderText(wxWindow *window, wxString const& placeholder); void SetPlaceholderText(wxWindow *window, wxString const& placeholder);
double GetScaleFactor(wxWindow *window);
/// Forward a mouse wheel event to the window under the mouse if needed /// Forward a mouse wheel event to the window under the mouse if needed
/// @param source The initial target of the wheel event /// @param source The initial target of the wheel event
/// @param evt The event /// @param evt The event