From: Carl Hetherington Date: Thu, 6 Sep 2018 22:34:48 +0000 (+0100) Subject: Interface levels in audio tab. X-Git-Tag: v2.13.49~48 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=401af8742fe5b2bb3ec117acdc4b0b36bc8f5047 Interface levels in audio tab. --- diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index 7d3ea3264..c250e9914 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -48,33 +48,18 @@ AudioPanel::AudioPanel (ContentPanel* p) : ContentSubPanel (p, _("Audio")) , _audio_dialog (0) { - wxBoxSizer* reference_sizer = new wxBoxSizer (wxVERTICAL); - _reference = new wxCheckBox (this, wxID_ANY, _("Use this DCP's audio as OV and make VF")); - reference_sizer->Add (_reference, 0, wxLEFT | wxRIGHT | wxTOP, DCPOMATIC_SIZER_GAP); - _reference_note = new wxStaticText (this, wxID_ANY, _("")); _reference_note->Wrap (200); - reference_sizer->Add (_reference_note, 0, wxLEFT | wxRIGHT, DCPOMATIC_SIZER_GAP); wxFont font = _reference_note->GetFont(); font.SetStyle(wxFONTSTYLE_ITALIC); font.SetPointSize(font.GetPointSize() - 1); _reference_note->SetFont(font); - _sizer->Add (reference_sizer); - - wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); - _sizer->Add (grid, 0, wxALL, 8); - - int r = 0; - _show = new wxButton (this, wxID_ANY, _("Show graph of audio levels...")); - grid->Add (_show, wxGBPosition (r, 0), wxGBSpan (1, 2)); _peak = new wxStaticText (this, wxID_ANY, wxT ("")); - grid->Add (_peak, wxGBPosition (r, 2), wxGBSpan (1, 2), wxALIGN_CENTER_VERTICAL); - ++r; - add_label_to_sizer (grid, this, _("Gain"), true, wxGBPosition (r, 0)); + _gain_label = create_label (this, _("Gain"), true); _gain = new ContentSpinCtrlDouble ( this, new wxSpinCtrlDouble (this), @@ -84,13 +69,10 @@ AudioPanel::AudioPanel (ContentPanel* p) boost::mem_fn (&AudioContent::set_gain) ); - _gain->add (grid, wxGBPosition (r, 1)); - add_label_to_sizer (grid, this, _("dB"), false, wxGBPosition (r, 2)); + _gain_db_label = create_label (this, _("dB"), false); _gain_calculate_button = new wxButton (this, wxID_ANY, _("Calculate...")); - grid->Add (_gain_calculate_button, wxGBPosition (r, 3)); - ++r; - add_label_to_sizer (grid, this, _("Delay"), true, wxGBPosition (r, 0)); + _delay_label = create_label (this, _("Delay"), true); _delay = new ContentSpinCtrl ( this, new wxSpinCtrl (this), @@ -100,19 +82,15 @@ AudioPanel::AudioPanel (ContentPanel* p) boost::mem_fn (&AudioContent::set_delay) ); - _delay->add (grid, wxGBPosition (r, 1)); /// TRANSLATORS: this is an abbreviation for milliseconds, the unit of time - add_label_to_sizer (grid, this, _("ms"), false, wxGBPosition (r, 2)); - ++r; + _delay_ms_label = create_label (this, _("ms"), false); _mapping = new AudioMappingView (this); _sizer->Add (_mapping, 1, wxEXPAND | wxALL, 6); - ++r; _description = new wxStaticText (this, wxID_ANY, wxT (" \n"), wxDefaultPosition, wxDefaultSize); _sizer->Add (_description, 0, wxALL, 12); _description->SetFont (font); - ++r; _gain->wrapped()->SetRange (-60, 60); _gain->wrapped()->SetDigits (1); @@ -131,6 +109,42 @@ AudioPanel::AudioPanel (ContentPanel* p) _mapping_connection = _mapping->Changed.connect (boost::bind (&AudioPanel::mapping_changed, this, _1)); JobManager::instance()->ActiveJobsChanged.connect (boost::bind (&AudioPanel::active_jobs_changed, this, _1, _2)); + + add_to_grid (); +} + +void +AudioPanel::add_to_grid () +{ + Config::Interface const interface = Config::instance()->interface_complexity(); + + int r = 0; + + _reference->Show (interface == Config::INTERFACE_FULL); + _reference_note->Show (interface == Config::INTERFACE_FULL); + + if (interface == Config::INTERFACE_FULL) { + wxBoxSizer* reference_sizer = new wxBoxSizer (wxVERTICAL); + reference_sizer->Add (_reference, 0, wxLEFT | wxRIGHT | wxTOP, DCPOMATIC_SIZER_GAP); + reference_sizer->Add (_reference_note, 0, wxLEFT | wxRIGHT, DCPOMATIC_SIZER_GAP); + _grid->Add (reference_sizer, wxGBPosition(r, 0), wxGBSpan(1, 4)); + ++r; + } + + _grid->Add (_show, wxGBPosition (r, 0), wxGBSpan (1, 2)); + _grid->Add (_peak, wxGBPosition (r, 2), wxGBSpan (1, 2), wxALIGN_CENTER_VERTICAL); + ++r; + + add_label_to_sizer (_grid, _gain_label, true, wxGBPosition(r, 0)); + _gain->add (_grid, wxGBPosition(r, 1)); + add_label_to_sizer (_grid, _gain_db_label, false, wxGBPosition(r, 2)); + _grid->Add (_gain_calculate_button, wxGBPosition(r, 3)); + ++r; + + add_label_to_sizer (_grid, _delay_label, true, wxGBPosition(r, 0)); + _delay->add (_grid, wxGBPosition (r, 1)); + add_label_to_sizer (_grid, _delay_ms_label, false, wxGBPosition(r, 2)); + ++r; } AudioPanel::~AudioPanel () diff --git a/src/wx/audio_panel.h b/src/wx/audio_panel.h index 66667e1ad..56b6fbe84 100644 --- a/src/wx/audio_panel.h +++ b/src/wx/audio_panel.h @@ -49,13 +49,18 @@ private: void active_jobs_changed (boost::optional, boost::optional); void setup_sensitivity (); void reference_clicked (); + void add_to_grid (); wxCheckBox* _reference; wxStaticText* _reference_note; wxButton* _show; + wxStaticText* _gain_label; + wxStaticText* _gain_db_label; ContentSpinCtrlDouble* _gain; wxButton* _gain_calculate_button; wxStaticText* _peak; + wxStaticText* _delay_label; + wxStaticText* _delay_ms_label; ContentSpinCtrl* _delay; AudioMappingView* _mapping; wxStaticText* _description; diff --git a/src/wx/content_sub_panel.cc b/src/wx/content_sub_panel.cc index aab404b74..0bd79805b 100644 --- a/src/wx/content_sub_panel.cc +++ b/src/wx/content_sub_panel.cc @@ -39,6 +39,23 @@ ContentSubPanel::ContentSubPanel (ContentPanel* p, wxString name) { SetScrollRate (8, 8); SetSizer (_sizer); + + _grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + _sizer->Add (_grid, 0, wxALL, 8); + + Config::instance()->Changed.connect (boost::bind (&ContentSubPanel::config_changed, this, _1)); +} + + +void +ContentSubPanel::config_changed (Config::Property p) +{ + if (p == Config::INTERFACE_COMPLEXITY) { + _grid->Clear (); + add_to_grid (); + _sizer->Layout (); + _grid->Layout (); + } } void diff --git a/src/wx/content_sub_panel.h b/src/wx/content_sub_panel.h index 8c7854af2..bb0e937a1 100644 --- a/src/wx/content_sub_panel.h +++ b/src/wx/content_sub_panel.h @@ -24,10 +24,12 @@ #include #include #include "lib/film.h" +#include "lib/config.h" class ContentPanel; class Content; class DCPContent; +class wxGridBagSizer; class ContentSubPanel : public wxScrolledWindow { @@ -47,10 +49,15 @@ public: protected: void setup_refer_button (wxCheckBox* button, wxStaticText* note, boost::shared_ptr dcp, bool can_reference, std::string why_not) const; + virtual void add_to_grid () = 0; ContentPanel* _parent; wxSizer* _sizer; + wxGridBagSizer* _grid; wxString _name; + +private: + void config_changed (Config::Property); }; #endif diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc index 164b9dd7d..169732b66 100644 --- a/src/wx/text_panel.cc +++ b/src/wx/text_panel.cc @@ -185,6 +185,12 @@ TextPanel::TextPanel (ContentPanel* p, TextType t) _appearance_dialog_button->Bind (wxEVT_BUTTON, boost::bind (&TextPanel::appearance_dialog_clicked, this)); } +void +TextPanel::add_to_grid () +{ + +} + void TextPanel::update_dcp_track_selection () { diff --git a/src/wx/text_panel.h b/src/wx/text_panel.h index 349960f8e..3c0dc2365 100644 --- a/src/wx/text_panel.h +++ b/src/wx/text_panel.h @@ -53,6 +53,7 @@ private: TextType current_type () const; void update_dcp_tracks (); void update_dcp_track_selection (); + void add_to_grid (); void setup_sensitivity (); diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc index e9fc51f58..5a69fa686 100644 --- a/src/wx/timing_panel.cc +++ b/src/wx/timing_panel.cc @@ -170,6 +170,12 @@ TimingPanel::TimingPanel (ContentPanel* p, FilmViewer* viewer) setup_sensitivity (); } +void +TimingPanel::add_to_grid () +{ + +} + void TimingPanel::update_full_length () { diff --git a/src/wx/timing_panel.h b/src/wx/timing_panel.h index 0767daa09..400305c1a 100644 --- a/src/wx/timing_panel.h +++ b/src/wx/timing_panel.h @@ -46,6 +46,7 @@ private: void update_full_length (); void update_play_length (); void setup_sensitivity (); + void add_to_grid (); FilmViewer* _viewer; diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index 029e410a6..dbba9e3b0 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -82,9 +82,6 @@ VideoPanel::VideoPanel (ContentPanel* p) font.SetPointSize(font.GetPointSize() - 1); _reference_note->SetFont(font); - _grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); - _sizer->Add (_grid, 0, wxALL, 8); - _type_label = create_label (this, _("Type"), true); _frame_type = new ContentChoice ( this, @@ -205,22 +202,9 @@ VideoPanel::VideoPanel (ContentPanel* p) _colour_conversion->Bind (wxEVT_CHOICE, boost::bind (&VideoPanel::colour_conversion_changed, this)); _edit_colour_conversion_button->Bind (wxEVT_BUTTON, boost::bind (&VideoPanel::edit_colour_conversion_clicked, this)); - Config::instance()->Changed.connect (boost::bind (&VideoPanel::config_changed, this, _1)); - add_to_grid (); } -void -VideoPanel::config_changed (Config::Property p) -{ - if (p == Config::INTERFACE_COMPLEXITY) { - _grid->Clear (); - add_to_grid (); - _sizer->Layout (); - _grid->Layout (); - } -} - void VideoPanel::add_to_grid () { diff --git a/src/wx/video_panel.h b/src/wx/video_panel.h index a244d08b3..795a52a78 100644 --- a/src/wx/video_panel.h +++ b/src/wx/video_panel.h @@ -27,7 +27,6 @@ #include "timecode.h" #include "lib/video_content_scale.h" #include "lib/film.h" -#include "lib/config.h" class wxChoice; class wxStaticText; @@ -54,12 +53,10 @@ private: void fade_in_changed (); void fade_out_changed (); void add_to_grid (); - void config_changed (Config::Property p); void setup_description (); void setup_sensitivity (); - wxGridBagSizer* _grid; wxCheckBox* _reference; wxStaticText* _reference_note; wxStaticText* _type_label;