More LHS sizing hacks.
authorCarl Hetherington <cth@carlh.net>
Wed, 9 Jan 2019 13:02:07 +0000 (13:02 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 9 Jan 2019 13:02:07 +0000 (13:02 +0000)
src/wx/content_sub_panel.cc

index 2fe104563eb16db5d0d35908649bcab1c8f4e50c..ac3a02ce95f65ce08f44871030e33703c2635ad2 100644 (file)
@@ -25,6 +25,7 @@
 #include "lib/compose.hpp"
 #include "lib/log.h"
 #include <wx/notebook.h>
+#include <wx/display.h>
 #include <boost/foreach.hpp>
 
 using std::list;
@@ -39,8 +40,13 @@ ContentSubPanel::ContentSubPanel (ContentPanel* p, wxString name)
 {
        SetScrollRate (8, 8);
        SetSizer (_sizer);
-       /* This stops the notebook collapsing to near-zero size.  The 600 is a guess. */
-       SetMinSize (wxSize(-1, 600));
+
+       /* This is a hack to try and make the content notebook a sensible size; large on big displays but small
+          enough on small displays to leave space for the content area.
+       */
+       wxDisplay display (wxDisplay::GetFromWindow(p->notebook()));
+       wxRect screen = display.GetClientArea();
+       SetMinSize (wxSize(-1, screen.height > 800 ? 600 : 320));
 
        _grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
        _sizer->Add (_grid, 0, wxALL, 8);
@@ -48,7 +54,6 @@ ContentSubPanel::ContentSubPanel (ContentPanel* p, wxString name)
        _config_connection = Config::instance()->Changed.connect (boost::bind (&ContentSubPanel::config_changed, this, _1));
 }
 
-
 void
 ContentSubPanel::config_changed (Config::Property p)
 {