X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Faudio_panel.cc;h=81a445efbce029fa7bf51842bf0ac9eba3d4c8f5;hb=fe851f2e6e57d3a8781ecc173089c19632c521e3;hp=7efdeb8ac88de1acd7c63cda135f8d0f87db6b01;hpb=1c9a65e90d05f02e1fd4914268435a9c2274459e;p=dcpomatic.git diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index 7efdeb8ac..81a445efb 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -113,7 +113,7 @@ AudioPanel::create () _fade_out_label = create_label (this, _("Fade out"), true); _fade_out = new Timecode (this); - _use_same_fades_as_video = new wxCheckBox (this, wxID_ANY, _("Use same fades as video")); + _use_same_fades_as_video = new CheckBox(this, _("Use same fades as video")); _mapping = new AudioMappingView (this, _("Content"), _("content"), _("DCP"), _("DCP")); _sizer->Add (_mapping, 1, wxEXPAND | wxALL, 6); @@ -132,13 +132,13 @@ AudioPanel::create () film_changed (Film::Property::VIDEO_FRAME_RATE); film_changed (Film::Property::REEL_TYPE); - _reference->Bind (wxEVT_CHECKBOX, boost::bind (&AudioPanel::reference_clicked, this)); + _reference->bind(&AudioPanel::reference_clicked, this); _show->Bind (wxEVT_BUTTON, boost::bind (&AudioPanel::show_clicked, this)); _gain_calculate_button->Bind (wxEVT_BUTTON, boost::bind (&AudioPanel::gain_calculate_button_clicked, this)); _fade_in->Changed.connect (boost::bind(&AudioPanel::fade_in_changed, this)); _fade_out->Changed.connect (boost::bind(&AudioPanel::fade_out_changed, this)); - _use_same_fades_as_video->Bind (wxEVT_CHECKBOX, boost::bind(&AudioPanel::use_same_fades_as_video_changed, this)); + _use_same_fades_as_video->bind(&AudioPanel::use_same_fades_as_video_changed, this); _mapping_connection = _mapping->Changed.connect (boost::bind (&AudioPanel::mapping_changed, this, _1)); _active_jobs_connection = JobManager::instance()->ActiveJobsChanged.connect (boost::bind (&AudioPanel::active_jobs_changed, this, _1, _2)); @@ -195,14 +195,6 @@ AudioPanel::add_to_grid () } -AudioPanel::~AudioPanel () -{ - if (_audio_dialog) { - _audio_dialog->Destroy (); - _audio_dialog = nullptr; - } -} - void AudioPanel::film_changed (Film::Property property) { @@ -261,6 +253,8 @@ AudioPanel::film_content_changed (int property) setup_peak (); layout (); } else if (property == AudioContentProperty::GAIN) { + /* This is a bit aggressive but probably not so bad */ + _peak_cache.clear(); setup_peak (); } else if (property == DCPContentProperty::REFERENCE_AUDIO) { if (ac.size() == 1) { @@ -422,17 +416,14 @@ AudioPanel::setup_sensitivity () void AudioPanel::show_clicked () { - if (_audio_dialog) { - _audio_dialog->Destroy (); - _audio_dialog = nullptr; - } + _audio_dialog.reset(); auto ac = _parent->selected_audio (); if (ac.size() != 1) { return; } - _audio_dialog = new AudioDialog (this, _parent->film(), _parent->film_viewer(), ac.front()); + _audio_dialog.reset(this, _parent->film(), _parent->film_viewer(), ac.front()); _audio_dialog->Show (); } @@ -531,10 +522,7 @@ void AudioPanel::set_film (shared_ptr) { /* We are changing film, so destroy any audio dialog for the old one */ - if (_audio_dialog) { - _audio_dialog->Destroy (); - _audio_dialog = nullptr; - } + _audio_dialog.reset(); }