diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-01-16 00:14:46 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-01-16 00:14:46 +0100 |
| commit | 921e681d6e4bde33c6652905dcebf4e7259cf14e (patch) | |
| tree | 81ee631335e37e72b2b4596936f36c0225a3c457 /src | |
| parent | 0da18dbf9b62b532f48a4e859f70f4ddedb6f78e (diff) | |
Extract layout_for_short_screen().
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/dcpomatic_kdm.cc | 13 | ||||
| -rw-r--r-- | src/wx/wx_util.cc | 10 | ||||
| -rw-r--r-- | src/wx/wx_util.h | 1 |
3 files changed, 14 insertions, 10 deletions
diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 0c0af4a96..d554107cd 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -62,7 +62,6 @@ #include <dcp/filesystem.h> #include <dcp/warnings.h> LIBDCP_DISABLE_WARNINGS -#include <wx/display.h> #include <wx/dnd.h> #include <wx/filepicker.h> #include <wx/preferences.h> @@ -228,15 +227,9 @@ public: h->SetFont (subheading_font); right->Add(h, 0, wxTOP, DCPOMATIC_SUBHEADING_TOP_PAD); - int const sn = wxDisplay::GetFromWindow(this); - if (sn >= 0) { - auto const screen = wxDisplay(sn).GetClientArea(); - if (screen.height <= 800) { - _output = new ShortKDMOutputPanel(overall_panel); - } - } - - if (!_output) { + if (layout_for_short_screen(this)) { + _output = new ShortKDMOutputPanel(overall_panel); + } else { _output = new TallKDMOutputPanel(overall_panel); } diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index fc8b3dc99..e82ca8e1b 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -42,6 +42,7 @@ #include <dcp/locale_convert.h> #include <dcp/warnings.h> LIBDCP_DISABLE_WARNINGS +#include <wx/display.h> #include <wx/filepicker.h> #include <wx/progdlg.h> #include <wx/sizer.h> @@ -828,3 +829,12 @@ wx::report_problem() { return std_to_wx(::report_problem()); } + + +bool +layout_for_short_screen(wxWindow* reference) +{ + auto const sn = wxDisplay::GetFromWindow(reference); + return sn >= 0 && wxDisplay(sn).GetClientArea().height <= 800; +} + diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h index b6907310d..a101a8498 100644 --- a/src/wx/wx_util.h +++ b/src/wx/wx_util.h @@ -125,6 +125,7 @@ extern bool gui_is_dark (); extern double dpi_scale_factor (wxWindow* window); extern int search_ctrl_height (); extern void report_config_load_failure(wxWindow* parent, Config::LoadFailure what); +extern bool layout_for_short_screen(wxWindow* reference); struct Offset |
