X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Fwx%2Faudio_panel.cc;h=732468c840c680490a38b6b2d9e012fc98d60cbb;hp=59c9cd2a898549a5e07d71ba6ad8cb8a4ffe0bb4;hb=8ccbe70f3c2f5db9e88978a98f3ad5735ece07ab;hpb=e0255a64d22440d718e5512f34a4f21f0d37a21b diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index 59c9cd2a8..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) @@ -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; @@ -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; } } +