Fix assertion with wxWidgets 3.1.
[dcpomatic.git] / src / wx / audio_dialog.cc
index f2377de43fefc07c3a273e95b348494a1e8e2839..748bd72d07e545d8b5cf41019278d1902e52022e 100644 (file)
@@ -44,6 +44,9 @@ using boost::optional;
 using boost::const_pointer_cast;
 using boost::dynamic_pointer_cast;
 using namespace dcpomatic;
+#if BOOST_VERSION >= 106100
+using namespace boost::placeholders;
+#endif
 
 /** @param parent Parent window.
  *  @param film Film we are using.
@@ -111,6 +114,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 +173,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 +235,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 */