From 8ccbe70f3c2f5db9e88978a98f3ad5735ece07ab Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 9 Jul 2021 00:30:02 +0200 Subject: [PATCH] Fix strange layout problems with the content sub panels (#2059). 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 | 2 +- src/wx/content_sub_panel.cc | 15 ++++++++++++++- src/wx/content_sub_panel.h | 3 ++- src/wx/video_panel.cc | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index a77922ed2..732468c84 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -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) { diff --git a/src/wx/content_sub_panel.cc b/src/wx/content_sub_panel.cc index e0a1a52bd..9c236abeb 100644 --- a/src/wx/content_sub_panel.cc +++ b/src/wx/content_sub_panel.cc @@ -47,7 +47,7 @@ ContentSubPanel::ContentSubPanel (ContentPanel* p, wxString name) } void -ContentSubPanel::setup_refer_button (wxCheckBox* button, wxStaticText* note, shared_ptr dcp, bool can_reference, wxString cannot) const +ContentSubPanel::setup_refer_button (wxCheckBox* button, wxStaticText* note, shared_ptr 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); } + diff --git a/src/wx/content_sub_panel.h b/src/wx/content_sub_panel.h index 08c61c25f..2a7bc4f75 100644 --- a/src/wx/content_sub_panel.h +++ b/src/wx/content_sub_panel.h @@ -49,7 +49,8 @@ public: protected: - void setup_refer_button (wxCheckBox* button, wxStaticText* note, std::shared_ptr dcp, bool can_reference, wxString cannot) const; + void setup_refer_button (wxCheckBox* button, wxStaticText* note, std::shared_ptr dcp, bool can_reference, wxString cannot); + void layout (); virtual void add_to_grid () = 0; ContentPanel* _parent; diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index e3c12b4ae..4b1e8b229 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -492,7 +492,7 @@ VideoPanel::setup_description () } checked_set (_description, d); - _sizer->Layout (); + layout (); } void -- 2.30.2