Fix High DPI issue on GTK

* Use icon size in the config
This commit is contained in:
wangqr 2019-05-17 03:01:31 -04:00 committed by arch1t3cht
parent 5f3757525a
commit 6cb1a49943
4 changed files with 23 additions and 5 deletions

View file

@ -278,7 +278,7 @@ TimeEdit *SubsEditBox::MakeTimeCtrl(wxString const& tooltip, TimeField field) {
void SubsEditBox::MakeButton(const char *cmd_name) {
cmd::Command *command = cmd::get(cmd_name);
wxBitmapButton *btn = new wxBitmapButton(this, -1, command->Icon(16, retina_helper->GetScaleFactor()));
wxBitmapButton *btn = new wxBitmapButton(this, -1, command->Icon(OPT_GET("App/Toolbar Icon Size")->GetInt(), retina_helper->GetScaleFactor()));
ToolTipManager::Bind(btn, command->StrHelp(), "Subtitle Edit Box", cmd_name);
middle_right_sizer->Add(btn, wxSizerFlags().Expand());

View file

@ -214,9 +214,15 @@ void AddFullScreenButton(wxWindow *) { }
void SetFloatOnParent(wxWindow *) { }
// OS X implementation in retina_helper.mm
RetinaHelper::RetinaHelper(wxWindow *) { }
RetinaHelper::RetinaHelper(wxWindow* w) { window = w; }
RetinaHelper::~RetinaHelper() { }
int RetinaHelper::GetScaleFactor() const { return 1; }
int RetinaHelper::GetScaleFactor() const {
#ifdef __WXGTK__
return int(window->GetContentScaleFactor());
#else
return 1;
#endif
}
#endif
wxString FontFace(std::string opt_prefix) {

View file

@ -42,7 +42,13 @@ static const DraggableFeatureType DRAG_ORIGIN = DRAG_BIG_TRIANGLE;
static const DraggableFeatureType DRAG_START = DRAG_BIG_SQUARE;
static const DraggableFeatureType DRAG_END = DRAG_BIG_CIRCLE;
#define ICON(name) (OPT_GET("App/Toolbar Icon Size")->GetInt() == 16 ? GETIMAGE(name ## _16) : GETIMAGE(name ## _24))
#define ICON(name) ( \
OPT_GET("App/Toolbar Icon Size")->GetInt() >= 64 ? GETIMAGE(name##_64) : \
OPT_GET("App/Toolbar Icon Size")->GetInt() >= 48 ? GETIMAGE(name##_48) : \
OPT_GET("App/Toolbar Icon Size")->GetInt() >= 32 ? GETIMAGE(name##_32) : \
OPT_GET("App/Toolbar Icon Size")->GetInt() >= 24 ? GETIMAGE(name##_24) : \
GETIMAGE(name##_16) \
)
VisualToolDrag::VisualToolDrag(VideoDisplay *parent, agi::Context *context)
: VisualTool<VisualToolDragDraggableFeature>(parent, context)

View file

@ -56,7 +56,13 @@ void VisualToolVectorClip::SetToolbar(wxToolBar *toolBar) {
int icon_size = OPT_GET("App/Toolbar Icon Size")->GetInt();
#define ICON(name) icon_size == 16 ? GETIMAGE(name ## _16) : GETIMAGE(name ## _24)
#define ICON(name) ( \
icon_size >= 64 ? GETIMAGE(name##_64) : \
icon_size >= 48 ? GETIMAGE(name##_48) : \
icon_size >= 32 ? GETIMAGE(name##_32) : \
icon_size >= 24 ? GETIMAGE(name##_24) : \
GETIMAGE(name##_16) \
)
toolBar->AddTool(BUTTON_DRAG, _("Drag"), ICON(visual_vector_clip_drag), _("Drag control points"), wxITEM_CHECK);
toolBar->AddTool(BUTTON_LINE, _("Line"), ICON(visual_vector_clip_line), _("Appends a line"), wxITEM_CHECK);
toolBar->AddTool(BUTTON_BICUBIC, _("Bicubic"), ICON(visual_vector_clip_bicubic), _("Appends a bezier bicubic curve"), wxITEM_CHECK);