Interface levels in audio tab.
authorCarl Hetherington <cth@carlh.net>
Thu, 6 Sep 2018 22:34:48 +0000 (23:34 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 6 Sep 2018 22:34:48 +0000 (23:34 +0100)
src/wx/audio_panel.cc
src/wx/audio_panel.h
src/wx/content_sub_panel.cc
src/wx/content_sub_panel.h
src/wx/text_panel.cc
src/wx/text_panel.h
src/wx/timing_panel.cc
src/wx/timing_panel.h
src/wx/video_panel.cc
src/wx/video_panel.h

index 7d3ea32642b9cc8d8729f453a5cd95126f7c687c..c250e99141939ba960271bfffba0626568fd2914 100644 (file)
@@ -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<AudioContent> (
                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<AudioContent> (
                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 ()
index 66667e1ad8a318b84b8c121493d1fe340335b787..56b6fbe84522e4381577b14aa1759f27207ebb6c 100644 (file)
@@ -49,13 +49,18 @@ private:
        void active_jobs_changed (boost::optional<std::string>, boost::optional<std::string>);
        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<AudioContent>* _gain;
        wxButton* _gain_calculate_button;
        wxStaticText* _peak;
+       wxStaticText* _delay_label;
+       wxStaticText* _delay_ms_label;
        ContentSpinCtrl<AudioContent>* _delay;
        AudioMappingView* _mapping;
        wxStaticText* _description;
index aab404b74817861a08788845d18c51e9a2babc41..0bd79805b7f45d08a68aaeef7f84dbc2378d7f3d 100644 (file)
@@ -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
index 8c7854af29d77dcf31a36ae86eb3ff6e88615852..bb0e937a1add8b78f85829f4de44bec1109f4a10 100644 (file)
 #include <boost/shared_ptr.hpp>
 #include <wx/wx.h>
 #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<DCPContent> 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
index 164b9dd7dccbe42d2780b95d2068577ff87d1bf8..169732b66b70a8ba9a72f39ce724a71202f0fec6 100644 (file)
@@ -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 ()
 {
index 349960f8e7ad6d925d06eff9ade2b6fafb2dec93..3c0dc236599d3d6d0fcdc782382f4b1f2f938f66 100644 (file)
@@ -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 ();
 
index e9fc51f58344fbbe651a8e448144cab0d47d1599..5a69fa6864a0333c842af1430448acfa4490d2ab 100644 (file)
@@ -170,6 +170,12 @@ TimingPanel::TimingPanel (ContentPanel* p, FilmViewer* viewer)
        setup_sensitivity ();
 }
 
+void
+TimingPanel::add_to_grid ()
+{
+
+}
+
 void
 TimingPanel::update_full_length ()
 {
index 0767daa09aaa82ecd9c849dbe7052c18e1ea48e8..400305c1a0cf5432c81189a449f7e73be910eb12 100644 (file)
@@ -46,6 +46,7 @@ private:
        void update_full_length ();
        void update_play_length ();
        void setup_sensitivity ();
+       void add_to_grid ();
 
        FilmViewer* _viewer;
 
index 029e410a6cc1dc307c0ec4e30dfbfe413783b2c0..dbba9e3b01b08a781bef5c288429ea8318b48bef 100644 (file)
@@ -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<VideoContent, VideoFrameType> (
                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 ()
 {
index a244d08b3152af083ac5e2e9ad088a8e2452d180..795a52a78f2cfa33c5227a3dcb93efaf84a23ed6 100644 (file)
@@ -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;