Don't display all possible channel checkboxes while the analysis v2.15.94
authorCarl Hetherington <cth@carlh.net>
Wed, 29 Jul 2020 20:30:38 +0000 (22:30 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 29 Jul 2020 20:30:38 +0000 (22:30 +0200)
is running as clicking the higher ones will cause an assertion
failure.

src/wx/audio_dialog.cc
src/wx/audio_dialog.h

index f2377de43fefc07c3a273e95b348494a1e8e2839..0f6bace2590282c8ad792513e22afd1fcdf03ab0 100644 (file)
@@ -111,6 +111,8 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr<Film> film, weak_ptr<Film
                _channel_checkbox[i]->Bind (wxEVT_CHECKBOX, boost::bind (&AudioDialog::channel_clicked, this, _1));
        }
 
+       show_or_hide_channel_checkboxes ();
+
        {
                wxStaticText* m = new StaticText (this, _("Type"));
                m->SetFont (subheading_font);
@@ -168,6 +170,20 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr<Film> film, weak_ptr<Film
        _plot->Cursor.connect (bind (&AudioDialog::set_cursor, this, _1, _2));
 }
 
+
+void
+AudioDialog::show_or_hide_channel_checkboxes ()
+{
+       for (int i = 0; i < _channels; ++i) {
+               _channel_checkbox[i]->Show ();
+       }
+
+       for (int i = _channels; i < MAX_DCP_AUDIO_CHANNELS; ++i) {
+               _channel_checkbox[i]->Hide ();
+       }
+}
+
+
 void
 AudioDialog::try_to_load_analysis ()
 {
@@ -216,14 +232,7 @@ AudioDialog::try_to_load_analysis ()
        _plot->set_analysis (_analysis);
        _plot->set_gain_correction (_analysis->gain_correction (_playlist));
        setup_statistics ();
-
-       for (int i = 0; i < _channels; ++i) {
-               _channel_checkbox[i]->Show ();
-       }
-
-       for (int i = _channels; i < MAX_DCP_AUDIO_CHANNELS; ++i) {
-               _channel_checkbox[i]->Hide ();
-       }
+       show_or_hide_channel_checkboxes ();
 
        /* Set up some defaults if no check boxes are checked */
 
index e5625d415b5662f8e7885102d9058e1513eb1914..8f7151b1bab196fd41dd4ac4b8de26278046362e 100644 (file)
@@ -50,6 +50,7 @@ private:
        void try_to_load_analysis ();
        void analysis_finished ();
        void setup_statistics ();
+       void show_or_hide_channel_checkboxes ();
 
        boost::shared_ptr<AudioAnalysis> _analysis;
        boost::weak_ptr<Film> _film;