Fix flickering black square when selecting content on Windows (#1866).
authorCarl Hetherington <cth@carlh.net>
Thu, 12 Aug 2021 20:03:11 +0000 (22:03 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 12 Aug 2021 21:18:53 +0000 (23:18 +0200)
src/wx/audio_panel.cc
src/wx/audio_panel.h
src/wx/content_panel.cc
src/wx/content_sub_panel.h
src/wx/text_panel.cc
src/wx/text_panel.h
src/wx/timing_panel.cc
src/wx/timing_panel.h
src/wx/video_panel.cc
src/wx/video_panel.h

index 732468c840c680490a38b6b2d9e012fc98d60cbb..75659aebdcd2087c227b4991709d5b21420c6d06 100644 (file)
@@ -56,6 +56,13 @@ using namespace boost::placeholders;
 AudioPanel::AudioPanel (ContentPanel* p)
        : ContentSubPanel (p, _("Audio"))
        , _audio_dialog (0)
+{
+
+}
+
+
+void
+AudioPanel::create ()
 {
        _reference = new CheckBox (this, _("Use this DCP's audio as OV and make VF"));
        _reference_note = new StaticText (this, wxT(""));
@@ -119,6 +126,8 @@ AudioPanel::AudioPanel (ContentPanel* p)
        _active_jobs_connection = JobManager::instance()->ActiveJobsChanged.connect (boost::bind (&AudioPanel::active_jobs_changed, this, _1, _2));
 
        add_to_grid ();
+
+       _sizer->Layout ();
 }
 
 void
index 0ae9da88efa9a077d786d61db1409d861b377dec..5e8f925975c6e41564d5f76a70fc3bbe22b19630 100644 (file)
@@ -39,9 +39,10 @@ public:
        explicit AudioPanel (ContentPanel *);
        ~AudioPanel ();
 
-       void film_changed (Film::Property);
-       void film_content_changed (int);
-       void content_selection_changed ();
+       void create () override;
+       void film_changed (Film::Property) override;
+       void film_content_changed (int) override;
+       void content_selection_changed () override;
        void set_film (std::shared_ptr<Film>);
 
 private:
@@ -53,7 +54,7 @@ private:
        void active_jobs_changed (boost::optional<std::string>, boost::optional<std::string>);
        void setup_sensitivity ();
        void reference_clicked ();
-       void add_to_grid ();
+       void add_to_grid () override;
        boost::optional<float> peak () const;
 
        wxCheckBox* _reference;
index bcc6999139f248255b1ad2f61ca3697ddc1e87ef..5ec503720ca91ce0f8875bb7470ae611adbe9982 100644 (file)
@@ -135,6 +135,7 @@ ContentPanel::ContentPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmV
 
        _timing_panel = new TimingPanel (this, _film_viewer);
        _notebook->AddPage (_timing_panel, _("Timing"), false);
+       _timing_panel->create ();
 
        _content->Bind (wxEVT_LIST_ITEM_SELECTED, boost::bind (&ContentPanel::item_selected, this));
        _content->Bind (wxEVT_LIST_ITEM_DESELECTED, boost::bind (&ContentPanel::item_deselected, this));
@@ -358,6 +359,7 @@ ContentPanel::check_selection ()
        if (have_video && !_video_panel) {
                _video_panel = new VideoPanel (this);
                _notebook->InsertPage (off, _video_panel, _video_panel->name());
+               _video_panel->create ();
        } else if (!have_video && _video_panel) {
                _notebook->DeletePage (off);
                _video_panel = 0;
@@ -370,6 +372,7 @@ ContentPanel::check_selection ()
        if (have_audio && !_audio_panel) {
                _audio_panel = new AudioPanel (this);
                _notebook->InsertPage (off, _audio_panel, _audio_panel->name());
+               _audio_panel->create ();
        } else if (!have_audio && _audio_panel) {
                _notebook->DeletePage (off);
                _audio_panel = 0;
@@ -383,6 +386,7 @@ ContentPanel::check_selection ()
                if (have_text[i] && !_text_panel[i]) {
                        _text_panel[i] = new TextPanel (this, static_cast<TextType>(i));
                        _notebook->InsertPage (off, _text_panel[i], _text_panel[i]->name());
+                       _text_panel[i]->create ();
                } else if (!have_text[i] && _text_panel[i]) {
                        _notebook->DeletePage (off);
                        _text_panel[i] = 0;
index 2a7bc4f75e05b9800fa48b115d7d2d153c3a5d59..3f8317bf9d95b295659e253d594872d847d278df 100644 (file)
@@ -37,6 +37,8 @@ class ContentSubPanel : public wxScrolledWindow
 public:
        ContentSubPanel (ContentPanel *, wxString);
 
+       virtual void create () = 0;
+
        virtual void film_changed (Film::Property) {}
        /** Called when a given property of one of the selected Contents changes */
        virtual void film_content_changed (int) = 0;
index 134d397e83e3bc0f17e76c2b0ce7331645bb4e47..7bbead30ccb91926004e34e4cf49a1c557ae55b3 100644 (file)
@@ -61,9 +61,16 @@ using boost::bind;
 TextPanel::TextPanel (ContentPanel* p, TextType t)
        : ContentSubPanel (p, std_to_wx(text_type_to_name(t)))
        , _original_type (t)
+{
+
+}
+
+
+void
+TextPanel::create ()
 {
        wxString refer = _("Use this DCP's subtitle as OV and make VF");
-       if (t == TextType::CLOSED_CAPTION) {
+       if (_original_type == TextType::CLOSED_CAPTION) {
                refer = _("Use this DCP's closed caption as OV and make VF");
        }
 
@@ -131,6 +138,8 @@ TextPanel::TextPanel (ContentPanel* p, TextType t)
 
        add_to_grid();
        content_selection_changed ();
+
+       _sizer->Layout ();
 }
 
 
index c76449513dc6a7aaaa676affed767207920a575f..c4498f970b7a8d6c6e3d01911d44ca1fe4e1fe34 100644 (file)
@@ -36,9 +36,10 @@ class TextPanel : public ContentSubPanel
 public:
        TextPanel (ContentPanel *, TextType t);
 
-       void film_changed (Film::Property);
-       void film_content_changed (int);
-       void content_selection_changed ();
+       void create () override;
+       void film_changed (Film::Property) override;
+       void film_content_changed (int) override;
+       void content_selection_changed () override;
 
 private:
        void use_toggled ();
@@ -59,7 +60,7 @@ private:
        TextType current_type () const;
        void update_dcp_tracks ();
        void update_dcp_track_selection ();
-       void add_to_grid ();
+       void add_to_grid () override;
        void try_to_load_analysis ();
        void analysis_finished ();
        void language_changed ();
index f251e3c93679fbe45bbcbb07ab30b303caa8e9be..1f2928e018c588c33f7bc0807ff692c62dda92c4 100644 (file)
@@ -65,6 +65,13 @@ TimingPanel::TimingPanel (ContentPanel* p, weak_ptr<FilmViewer> viewer)
        : ContentSubPanel (p, S_("Timing|Timing"))
        , _viewer (viewer)
        , _film_content_changed_suspender (boost::bind(&TimingPanel::film_content_changed, this, _1))
+{
+
+}
+
+
+void
+TimingPanel::create ()
 {
        wxSize size = TimecodeBase::size (this);
 
@@ -123,6 +130,8 @@ TimingPanel::TimingPanel (ContentPanel* p, weak_ptr<FilmViewer> viewer)
 
        setup_sensitivity ();
        add_to_grid ();
+
+       _sizer->Layout ();
 }
 
 void
index 251acc9b559808523a757a1ba4f464433213b586..1702d93a908500a03a98d87061362566c5f75a35 100644 (file)
@@ -29,6 +29,7 @@ class TimingPanel : public ContentSubPanel
 public:
        TimingPanel (ContentPanel *, std::weak_ptr<FilmViewer> viewer);
 
+       void create () override;
        void film_changed (Film::Property);
        void film_content_changed (int);
        void content_selection_changed ();
index c5a48f986e0931662741416683abe3f7e0557c4e..07a929e1096c6429fd86a06cd67fe6d77bbbccb7 100644 (file)
@@ -64,6 +64,13 @@ using namespace boost::placeholders;
 
 VideoPanel::VideoPanel (ContentPanel* p)
        : ContentSubPanel (p, _("Video"))
+{
+
+}
+
+
+void
+VideoPanel::create ()
 {
        _reference = new CheckBox (this, _("Use this DCP's video as OV and make VF"));
        _reference_note = new StaticText (this, wxT(""));
@@ -221,6 +228,8 @@ VideoPanel::VideoPanel (ContentPanel* p)
        _top_bottom_link->Bind               (wxEVT_TOGGLEBUTTON, boost::bind(&VideoPanel::top_bottom_link_clicked, this));
 
        add_to_grid ();
+
+       _sizer->Layout ();
 }
 
 
index 3c51ac15207e5a65bf799b972e9fb80becd8cadf..2d25f82af4483b3e14522a356cdc4d49111b5420 100644 (file)
@@ -45,9 +45,10 @@ class VideoPanel : public ContentSubPanel
 public:
        explicit VideoPanel (ContentPanel *);
 
-       void film_changed (Film::Property);
-       void film_content_changed (int);
-       void content_selection_changed ();
+       void create () override;
+       void film_changed (Film::Property) override;
+       void film_content_changed (int) override;
+       void content_selection_changed () override;
 
 private:
        void reference_clicked ();
@@ -56,7 +57,7 @@ private:
        void range_changed ();
        void fade_in_changed ();
        void fade_out_changed ();
-       void add_to_grid ();
+       void add_to_grid () override;
        void scale_fit_clicked ();
        void scale_custom_clicked ();
        bool scale_custom_edit_clicked ();