Build fixes for Boost >= 1.73
[dcpomatic.git] / src / wx / content_panel.cc
index a164ee977bf25686bce9170d594ab475e459926a..123e1f051f2468e22e6e8645b24fda710b423a3d 100644 (file)
@@ -61,6 +61,9 @@ using boost::shared_ptr;
 using boost::weak_ptr;
 using boost::dynamic_pointer_cast;
 using boost::optional;
+#if BOOST_VERSION >= 106100
+using namespace boost::placeholders;
+#endif
 
 class LimitedSplitter : public wxSplitterWindow
 {
@@ -68,7 +71,10 @@ public:
        LimitedSplitter (wxWindow* parent)
                : wxSplitterWindow (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_NOBORDER | wxSP_3DSASH | wxSP_LIVE_UPDATE)
        {
-
+               /* This value doesn't really mean much but we just want to stop double-click on the
+                  divider from shrinking the bottom panel (#1601).
+               */
+               SetMinimumPaneSize (64);
        }
 
        bool OnSashPositionChange (int new_position)
@@ -94,8 +100,11 @@ ContentPanel::ContentPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmV
        }
 
        _splitter = new LimitedSplitter (n);
-       wxDisplay display (wxDisplay::GetFromWindow(_splitter));
-       wxRect screen = display.GetClientArea();
+       optional<wxRect> screen;
+       int const sn = wxDisplay::GetFromWindow(_splitter);
+       if (sn >= 0) {
+               screen = wxDisplay(sn).GetClientArea();
+       }
        wxPanel* top = new wxPanel (_splitter);
 
        _menu = new ContentMenu (_splitter);
@@ -149,8 +158,13 @@ ContentPanel::ContentPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmV
 
        /* 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.
+          Big displays: make the bottom half 600 pixels high, so the content list is big and takes up remaining space.
+          Small displays: make the top half 250 pixels high so we can definitely see all the buttons, even at the
+          expense of height in the bottom half.
        */
-       _splitter->SplitHorizontally (top, _notebook, screen.height > 800 ? -600 : -150);
+       if (screen) {
+               _splitter->SplitHorizontally (top, _notebook, screen->height > 800 ? -600 : 250);
+       }
 
        _timing_panel = new TimingPanel (this, _film_viewer);
        _notebook->AddPage (_timing_panel, _("Timing"), false);
@@ -290,13 +304,6 @@ ContentPanel::item_selected ()
 void
 ContentPanel::check_selection ()
 {
-       if (_last_selected == selected()) {
-               /* This was triggered by a re-build of the view but the selection
-                  did not really change.
-               */
-               return;
-       }
-
        _last_selected = selected ();
 
        setup_sensitivity ();