Fix strange layout problems with the content sub panels (#2059).
authorCarl Hetherington <cth@carlh.net>
Thu, 8 Jul 2021 22:30:02 +0000 (00:30 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 8 Jul 2021 22:30:02 +0000 (00:30 +0200)
It seems that if Layout() is called on a sizer inside a wxScrolledWindow
when that window is scrolled, things go wrong.  Work around this by
wrapping calls to Layout().

src/wx/audio_panel.cc
src/wx/content_sub_panel.cc
src/wx/content_sub_panel.h
src/wx/video_panel.cc

index a77922ed20a8d4475affcfb2eb460864cb231436..732468c840c680490a38b6b2d9e012fc98d60cbb 100644 (file)
@@ -218,7 +218,7 @@ AudioPanel::film_content_changed (int property)
                }
                setup_description ();
                setup_peak ();
-               _sizer->Layout ();
+               layout ();
        } else if (property == AudioContentProperty::GAIN) {
                setup_peak ();
        } else if (property == DCPContentProperty::REFERENCE_AUDIO) {
index e0a1a52bddac98382118852cc029b0c9c005c769..9c236abebfef4a1b552b5e8b5f084a283f569a1d 100644 (file)
@@ -47,7 +47,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 +65,18 @@ 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 ();
+       Scroll (x, y);
 }
+
index 08c61c25f84c617ff30fab855ef7cd10ef0cd4d9..2a7bc4f75e05b9800fa48b115d7d2d153c3a5d59 100644 (file)
@@ -49,7 +49,8 @@ public:
 
 protected:
 
-       void setup_refer_button (wxCheckBox* button, wxStaticText* note, std::shared_ptr<DCPContent> dcp, bool can_reference, wxString cannot) const;
+       void setup_refer_button (wxCheckBox* button, wxStaticText* note, std::shared_ptr<DCPContent> dcp, bool can_reference, wxString cannot);
+       void layout ();
        virtual void add_to_grid () = 0;
 
        ContentPanel* _parent;
index e3c12b4ae5035d2b0fd73063296edfd047706068..4b1e8b2290f4462263b6301130505e1581e7f6f1 100644 (file)
@@ -492,7 +492,7 @@ VideoPanel::setup_description ()
        }
 
        checked_set (_description, d);
-       _sizer->Layout ();
+       layout ();
 }
 
 void