use primary, not secondary, clock mode to drive other clock modes, and dynamically...
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 10 Oct 2018 15:47:05 +0000 (11:47 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 10 Oct 2018 15:47:29 +0000 (11:47 -0400)
gtk2_ardour/editor_regions.cc
gtk2_ardour/insert_remove_time_dialog.cc
gtk2_ardour/location_ui.cc
gtk2_ardour/location_ui.h
gtk2_ardour/region_editor.cc
gtk2_ardour/region_editor.h
gtk2_ardour/sfdb_ui.cc

index 4dd037dee0184f60193f077b1b10b1a1a4ffc493..89ecaf13b3bb45e7fc7c810614236efd194006f8 100644 (file)
@@ -262,7 +262,7 @@ EditorRegions::EditorRegions (Editor* e)
        // _display.signal_popup_menu().connect (sigc::bind (sigc::mem_fun (*this, &Editor::show__display_context_menu), 1, 0));
 
        //ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (sigc::mem_fun(*this, &Editor::redisplay_regions));
-       ARDOUR_UI::instance()->secondary_clock->mode_changed.connect (sigc::mem_fun(*this, &EditorRegions::update_all_rows));
+       ARDOUR_UI::instance()->primary_clock->mode_changed.connect (sigc::mem_fun(*this, &EditorRegions::update_all_rows));
        ARDOUR::Region::RegionPropertyChanged.connect (region_property_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::region_changed, this, _1, _2), gui_context());
        ARDOUR::RegionFactory::CheckNewRegion.connect (check_new_region_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::add_region, this, _1), gui_context());
 
@@ -747,7 +747,7 @@ EditorRegions::format_position (samplepos_t pos, char* buf, size_t bufsize, bool
                return;
        }
 
-       switch (ARDOUR_UI::instance()->secondary_clock->mode ()) {
+       switch (ARDOUR_UI::instance()->primary_clock->mode ()) {
        case AudioClock::BBT:
                bbt = _session->tempo_map().bbt_at_sample (pos);
                if (onoff) {
@@ -898,7 +898,7 @@ EditorRegions::populate_row_length (boost::shared_ptr<Region> region, TreeModel:
 {
        char buf[16];
 
-       if (ARDOUR_UI::instance()->secondary_clock->mode () == AudioClock::BBT) {
+       if (ARDOUR_UI::instance()->primary_clock->mode () == AudioClock::BBT) {
                TempoMap& map (_session->tempo_map());
                Timecode::BBT_Time bbt = map.bbt_at_beat (map.beat_at_sample (region->last_sample()) - map.beat_at_sample (region->first_sample()));
                snprintf (buf, sizeof (buf), "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks);
index 162559e53976894584e7fd2971f43ceb5fca8be6..2d444b92d149752e33a3010c4f6a06399bd65b3b 100644 (file)
@@ -61,14 +61,14 @@ InsertRemoveTimeDialog::InsertRemoveTimeDialog (PublicEditor& e, bool remove)
        time_label->set_alignment (1, 0.5);
        table->attach (*time_label, 0, 1, 0, 1, FILL | EXPAND);
        position_clock.set_session (_session);
-       position_clock.set_mode (ARDOUR_UI::instance()->secondary_clock->mode());
+       position_clock.set_mode (ARDOUR_UI::instance()->primary_clock->mode());
        table->attach (position_clock, 1, 2, 0, 1);
 
        time_label = manage (new Label (remove ? _("Time to remove:") : _("Time to insert:")));
        time_label->set_alignment (1, 0.5);
        table->attach (*time_label, 0, 1, 1, 2, FILL | EXPAND);
        duration_clock.set_session (_session);
-       duration_clock.set_mode (ARDOUR_UI::instance()->secondary_clock->mode());
+       duration_clock.set_mode (ARDOUR_UI::instance()->primary_clock->mode());
        table->attach (duration_clock, 1, 2, 1, 2);
 
        //if a Range is selected, assume the user wants to insert/remove the length of the range
index c868e1d38eec83dd86bca585e6014e2071ee5c6c..8354b54a2a1e80d30aca0012eb118e8c5f3aadb1 100644 (file)
@@ -761,6 +761,8 @@ LocationUI::LocationUI (std::string state_node_name)
 
        _clock_group = new ClockGroup;
 
+       ARDOUR_UI::instance()->primary_clock->mode_changed.connect (sigc::mem_fun(*this, &LocationUI::set_clock_mode_from_primary));
+
        VBox* vbox = manage (new VBox);
 
        Table* table = manage (new Table (2, 2));
@@ -1103,6 +1105,13 @@ LocationUI::refresh_location_list ()
        }
 }
 
+void
+LocationUI::set_clock_mode_from_primary ()
+{
+       _clock_group->set_clock_mode (ARDOUR_UI::instance()->primary_clock->mode());
+       _mode_set = true;
+}
+
 void
 LocationUI::set_session(ARDOUR::Session* s)
 {
@@ -1180,11 +1189,11 @@ LocationUI::clock_mode_from_session_instant_xml ()
 
        XMLNode* node = _session->instant_xml (_state_node_name);
        if (!node) {
-               return ARDOUR_UI::instance()->secondary_clock->mode();
+               return ARDOUR_UI::instance()->primary_clock->mode();
        }
 
        if (!node->get_property (X_("clock-mode"), _mode)) {
-               return ARDOUR_UI::instance()->secondary_clock->mode();
+               return ARDOUR_UI::instance()->primary_clock->mode();
        }
 
        _mode_set = true;
index 46495aa4fca323f4f8586ad6763b710985c9e199..d24dc840b34df23c280df9c671b2e2ec7d00f9e4 100644 (file)
@@ -157,7 +157,6 @@ public:
        ~LocationUI ();
 
        void set_session (ARDOUR::Session *);
-       void set_clock_mode (AudioClock::Mode);
 
        void add_new_location();
        void add_new_range();
@@ -216,6 +215,8 @@ private:
        bool _mode_set;
 
        std::string _state_node_name;
+
+       void set_clock_mode_from_primary ();
 };
 
 class LocationUIWindow : public ArdourWindow
index 1818e61963b94f39471016d3e55cc5082ea5afbd..36c648b7128d71815777a4aa52693d614359a5bb 100644 (file)
@@ -65,6 +65,8 @@ RegionEditor::RegionEditor (Session* s, boost::shared_ptr<Region> r)
        set_session (s);
 
        _clock_group->set_clock_mode (ARDOUR_UI::instance()->primary_clock->mode());
+       ARDOUR_UI::instance()->primary_clock->mode_changed.connect (sigc::mem_fun (*this, &RegionEditor::set_clock_mode_from_primary));
+
        _clock_group->add (position_clock);
        _clock_group->add (end_clock);
        _clock_group->add (length_clock);
@@ -202,6 +204,12 @@ RegionEditor::~RegionEditor ()
        delete _clock_group;
 }
 
+void
+RegionEditor::set_clock_mode_from_primary ()
+{
+       _clock_group->set_clock_mode (ARDOUR_UI::instance()->primary_clock->mode());
+}
+
 void
 RegionEditor::region_changed (const PBD::PropertyChange& what_changed)
 {
index aa0098a4ba5f5993b9327e2a62d405cf77e3e9e6..888ab8afb38526598b89bd85d90ba0221d60f71b 100644 (file)
@@ -115,6 +115,8 @@ private:
 
        Gtk::Label _sources_label;
        Gtk::ListViewText _sources;
+
+       void set_clock_mode_from_primary ();
 };
 
 #endif /* __gtk_ardour_region_edit_h__ */
index 0e612be42c53c744d4f08f16120bb47f80bcd404..fcd8510d925d3cf04174183c5c8758dc8b220549 100644 (file)
@@ -199,7 +199,7 @@ SoundFileBox::SoundFileBox (bool /*persistent*/)
        table.attach (timecode_clock, 1, 2, 5, 6, FILL, FILL);
        table.attach (tempomap_value, 1, 2, 6, 7, FILL, FILL);
 
-       length_clock.set_mode (ARDOUR_UI::instance()->secondary_clock->mode());
+       length_clock.set_mode (ARDOUR_UI::instance()->primary_clock->mode());
        timecode_clock.set_mode (AudioClock::Timecode);
 
        main_box.pack_start (table, false, false);