Extract layout_for_short_screen().
authorCarl Hetherington <cth@carlh.net>
Wed, 15 Jan 2025 23:14:46 +0000 (00:14 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 15 Jan 2025 23:14:46 +0000 (00:14 +0100)
src/tools/dcpomatic_kdm.cc
src/wx/wx_util.cc
src/wx/wx_util.h

index 0c0af4a96520661acc0412a4daf59265f6f58ecd..d554107cdf7e6637f7307438e9ce0f9f5454b21f 100644 (file)
@@ -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);
                }
 
index fc8b3dc999f1d7274df30876f58c44bda4594345..e82ca8e1b97e442f2ae848f933cf520d7317f34f 100644 (file)
@@ -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;
+}
+
index b6907310d8bc08419e228882faba1baad37fc3fa..a101a8498c52a4fb0ccbee97b51ead927d4dbcf7 100644 (file)
@@ -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