summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2026-02-10 00:14:05 +0100
committerCarl Hetherington <cth@carlh.net>2026-02-10 00:14:05 +0100
commitb371e9946d60fa9885220d81da7b73a4ba34b3e1 (patch)
tree7d7e92b3b0554a5cf14e73ba27d172907b0ee125 /src/wx
parenta144b22781d8e004cd4d3ec343feb4b800e16df1 (diff)
Extract weird link button size logic to wx_util.{cc,h}.
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/video_panel.cc34
-rw-r--r--src/wx/wx_util.cc38
-rw-r--r--src/wx/wx_util.h2
3 files changed, 46 insertions, 28 deletions
diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc
index fc2ef882f..7842f0266 100644
--- a/src/wx/video_panel.cc
+++ b/src/wx/video_panel.cc
@@ -90,32 +90,10 @@ VideoPanel::create()
_crop_label = create_label(this, _("Crop"), true);
-#if defined(__WXGTK3__)
- int const crop_width = 128;
- int const link_width = 32;
- int const link_height = 64;
-#elif defined(__WXGTK20__)
- int const crop_width = 56;
- int const link_width = 24;
- int const link_height = 32;
-#elif defined(DCPOMATIC_OSX)
- int const crop_width = 56;
-#if wxCHECK_VERSION(3, 2, 0)
- int const link_width = 8 + 15 / dpi_scale_factor(this);
-#else
- int const link_width = 23;
-#endif
- int const link_height = 28;
-#else
- int const crop_width = 56;
- int const link_width = 22;
- int const link_height = 28;
-#endif
-
_left_crop_label = create_label(this, _("Left"), true);
_left_crop = new ContentSpinCtrl<VideoContent>(
this,
- new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
+ new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(dcpomatic::wx::linked_value_width(), -1)),
VideoContentProperty::CROP,
&Content::video,
boost::mem_fn(&VideoContent::requested_left_crop),
@@ -125,13 +103,13 @@ VideoPanel::create()
auto const link_path = bitmap_path(gui_is_dark() ? "link_white.png" : "link_black.png");
- _left_right_link = new wxToggleButton(this, wxID_ANY, {}, wxDefaultPosition, wxSize(link_width, link_height));
+ _left_right_link = new wxToggleButton(this, wxID_ANY, {}, wxDefaultPosition, dcpomatic::wx::link_size(this));
_left_right_link->SetBitmap(wxBitmap(link_path, wxBITMAP_TYPE_PNG));
_right_crop_label = create_label(this, _("Right"), true);
_right_crop = new ContentSpinCtrl<VideoContent>(
this,
- new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
+ new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(dcpomatic::wx::linked_value_width(), -1)),
VideoContentProperty::CROP,
&Content::video,
boost::mem_fn(&VideoContent::requested_right_crop),
@@ -142,7 +120,7 @@ VideoPanel::create()
_top_crop_label = create_label(this, _("Top"), true);
_top_crop = new ContentSpinCtrl<VideoContent>(
this,
- new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
+ new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(dcpomatic::wx::linked_value_width(), -1)),
VideoContentProperty::CROP,
&Content::video,
boost::mem_fn(&VideoContent::requested_top_crop),
@@ -150,13 +128,13 @@ VideoPanel::create()
boost::bind(&VideoPanel::top_crop_changed, this)
);
- _top_bottom_link = new wxToggleButton(this, wxID_ANY, {}, wxDefaultPosition, wxSize(link_width, link_height));
+ _top_bottom_link = new wxToggleButton(this, wxID_ANY, {}, wxDefaultPosition, dcpomatic::wx::link_size(this));
_top_bottom_link->SetBitmap(wxBitmap(link_path, wxBITMAP_TYPE_PNG));
_bottom_crop_label = create_label(this, _("Bottom"), true);
_bottom_crop = new ContentSpinCtrl<VideoContent>(
this,
- new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
+ new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(dcpomatic::wx::linked_value_width(), -1)),
VideoContentProperty::CROP,
&Content::video,
boost::mem_fn(&VideoContent::requested_bottom_crop),
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index 6abbaa7bb..4e5f77d33 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -738,3 +738,41 @@ layout_for_short_screen(wxWindow* reference)
return sn >= 0 && wxDisplay(sn).GetClientArea().height <= 800;
}
+
+int
+dcpomatic::wx::linked_value_width()
+{
+#if defined(__WXGTK3__)
+ return 128;
+#else
+ return 56;
+#endif
+}
+
+
+#if defined(DCPOMATIC_OSX) && wxCHECK_VERSION(3, 2, 0)
+
+wxSize
+dcpomatic::wx::link_size(wxWindow* window)
+{
+ return wxSize(8 + 15 / dpi_scale_factor(window), 28);
+}
+
+#else
+
+wxSize
+dcpomatic::wx::link_size(wxWindow*)
+{
+#if defined(__WXGTK3__)
+ return wxSize(32, 64);
+#elif defined(__WXGTK20__)
+ return wxSize(24, 32);
+#elif defined(DCPOMATIC_OSX)
+ return wxSize(23, 28);
+#else
+ return wxSize(22, 28);
+#endif
+}
+
+#endif
+
diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h
index 114caab15..9ca9c7888 100644
--- a/src/wx/wx_util.h
+++ b/src/wx/wx_util.h
@@ -142,6 +142,8 @@ extern int get_offsets (std::vector<Offset>& offsets);
namespace dcpomatic {
namespace wx {
extern wxString report_problem();
+ extern int linked_value_width();
+ extern wxSize link_size(wxWindow* parent);
}
}