X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Faudio_panel.cc;h=732468c840c680490a38b6b2d9e012fc98d60cbb;hb=a70ec9be6a312c63e7655b3a266cbf353e8e1795;hp=f29704b548b197d5c82cf318275d2c85bd0bda26;hpb=0241df1707c7ea5658f471828ff6dc944e21af42;p=dcpomatic.git diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index f29704b54..732468c84 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -18,15 +18,16 @@ */ -#include "audio_panel.h" -#include "audio_mapping_view.h" -#include "wx_util.h" -#include "gain_calculator_dialog.h" -#include "content_panel.h" + #include "audio_dialog.h" -#include "static_text.h" +#include "audio_mapping_view.h" +#include "audio_panel.h" #include "check_box.h" +#include "content_panel.h" #include "dcpomatic_button.h" +#include "gain_calculator_dialog.h" +#include "static_text.h" +#include "wx_util.h" #include "lib/config.h" #include "lib/ffmpeg_audio_stream.h" #include "lib/ffmpeg_content.h" @@ -37,6 +38,7 @@ #include #include + using std::vector; using std::cout; using std::string; @@ -50,6 +52,7 @@ using boost::optional; using namespace boost::placeholders; #endif + AudioPanel::AudioPanel (ContentPanel* p) : ContentSubPanel (p, _("Audio")) , _audio_dialog (0) @@ -104,9 +107,9 @@ AudioPanel::AudioPanel (ContentPanel* p) _delay->wrapped()->SetRange (-1000, 1000); content_selection_changed (); - film_changed (Film::AUDIO_CHANNELS); - film_changed (Film::VIDEO_FRAME_RATE); - film_changed (Film::REEL_TYPE); + film_changed (Film::Property::AUDIO_CHANNELS); + film_changed (Film::Property::VIDEO_FRAME_RATE); + film_changed (Film::Property::REEL_TYPE); _reference->Bind (wxEVT_CHECKBOX, boost::bind (&AudioPanel::reference_clicked, this)); _show->Bind (wxEVT_BUTTON, boost::bind (&AudioPanel::show_clicked, this)); @@ -136,7 +139,7 @@ AudioPanel::add_to_grid () add_label_to_sizer (_grid, _gain_label, true, wxGBPosition(r, 0)); { auto s = new wxBoxSizer (wxHORIZONTAL); - s->Add (_gain->wrapped(), 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6); + s->Add (_gain->wrapped(), 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, DCPOMATIC_SIZER_GAP); s->Add (_gain_db_label, 0, wxALIGN_CENTER_VERTICAL); _grid->Add (s, wxGBPosition(r, 1)); } @@ -146,7 +149,7 @@ AudioPanel::add_to_grid () add_label_to_sizer (_grid, _delay_label, true, wxGBPosition(r, 0)); auto s = new wxBoxSizer (wxHORIZONTAL); - s->Add (_delay->wrapped(), 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6); + s->Add (_delay->wrapped(), 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, DCPOMATIC_SIZER_GAP); s->Add (_delay_ms_label, 0, wxALIGN_CENTER_VERTICAL); _grid->Add (s, wxGBPosition(r, 1)); ++r; @@ -168,16 +171,16 @@ AudioPanel::film_changed (Film::Property property) } switch (property) { - case Film::AUDIO_CHANNELS: - case Film::AUDIO_PROCESSOR: + case Film::Property::AUDIO_CHANNELS: + case Film::Property::AUDIO_PROCESSOR: _mapping->set_output_channels (_parent->film()->audio_output_names ()); setup_peak (); break; - case Film::VIDEO_FRAME_RATE: + case Film::Property::VIDEO_FRAME_RATE: setup_description (); break; - case Film::REEL_TYPE: - case Film::INTEROP: + case Film::Property::REEL_TYPE: + case Film::Property::INTEROP: setup_sensitivity (); break; default: @@ -215,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) { @@ -319,23 +322,16 @@ AudioPanel::setup_sensitivity () } setup_refer_button (_reference, _reference_note, dcp, can_reference, cannot); - if (_reference->GetValue ()) { - _gain->wrapped()->Enable (false); - _gain_calculate_button->Enable (false); - _show->Enable (true); - _peak->Enable (false); - _delay->wrapped()->Enable (false); - _mapping->Enable (false); - _description->Enable (false); - } else { - _gain->wrapped()->Enable (sel.size() == 1); - _gain_calculate_button->Enable (sel.size() == 1); - _show->Enable (sel.size() == 1); - _peak->Enable (sel.size() == 1); - _delay->wrapped()->Enable (sel.size() == 1); - _mapping->Enable (sel.size() == 1); - _description->Enable (sel.size() == 1); - } + auto const ref = _reference->GetValue(); + auto const single = sel.size() == 1; + + _gain->wrapped()->Enable (!ref); + _gain_calculate_button->Enable (!ref && single); + _show->Enable (single); + _peak->Enable (!ref && single); + _delay->wrapped()->Enable (!ref); + _mapping->Enable (!ref && single); + _description->Enable (!ref && single); } void @@ -440,3 +436,4 @@ AudioPanel::set_film (shared_ptr) _audio_dialog = nullptr; } } +