Fix missing scrollbar in the audio tab on macOS/Windows (#2480).
[dcpomatic.git] / src / wx / content_sub_panel.cc
index e0a1a52bddac98382118852cc029b0c9c005c769..6bbc9a51fcae43a89ad9e785ec99e2242fb266cb 100644 (file)
 
 */
 
+
 #include "content_sub_panel.h"
 #include "content_panel.h"
 #include "wx_util.h"
 #include "lib/dcp_content.h"
 #include "lib/compose.hpp"
 #include "lib/log.h"
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
 #include <wx/notebook.h>
+LIBDCP_ENABLE_WARNINGS
+
 
 using std::list;
-using std::string;
 using std::shared_ptr;
+using std::string;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 
+
 ContentSubPanel::ContentSubPanel (ContentPanel* p, wxString name)
        : wxScrolledWindow (p->notebook(), wxID_ANY)
        , _parent (p)
@@ -47,7 +53,7 @@ ContentSubPanel::ContentSubPanel (ContentPanel* p, wxString name)
 }
 
 void
-ContentSubPanel::setup_refer_button (wxCheckBox* button, wxStaticText* note, shared_ptr<DCPContent> dcp, bool can_reference, wxString cannot) const
+ContentSubPanel::setup_refer_button (wxCheckBox* button, wxStaticText* note, shared_ptr<DCPContent> dcp, bool can_reference, wxString cannot)
 {
        button->Enable (can_reference);
 
@@ -65,5 +71,19 @@ ContentSubPanel::setup_refer_button (wxCheckBox* button, wxStaticText* note, sha
                note->Show ();
        }
 
+       layout ();
+}
+
+
+void
+ContentSubPanel::layout ()
+{
+       int x;
+       int y;
+       GetViewStart (&x, &y);
+       Scroll (0, 0);
        _sizer->Layout ();
+       _sizer->FitInside(this);
+       Scroll (x, y);
 }
+