diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2018-10-10 11:47:05 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2018-10-10 11:47:29 -0400 |
commit | 0542a3090182fa97bd355ef876cf1918408e32b0 (patch) | |
tree | 666471a1f62687e6a4960a5c6d63027ace6b6aa9 | |
parent | 7d5eed09142ef5805c31940f563b43e87290ba62 (diff) |
use primary, not secondary, clock mode to drive other clock modes, and dynamically update region editors, location UI and editor regions when it changes
-rw-r--r-- | gtk2_ardour/editor_regions.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/insert_remove_time_dialog.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/location_ui.cc | 13 | ||||
-rw-r--r-- | gtk2_ardour/location_ui.h | 3 | ||||
-rw-r--r-- | gtk2_ardour/region_editor.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/region_editor.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/sfdb_ui.cc | 2 |
7 files changed, 29 insertions, 9 deletions
diff --git a/gtk2_ardour/editor_regions.cc b/gtk2_ardour/editor_regions.cc index 4dd037dee0..89ecaf13b3 100644 --- a/gtk2_ardour/editor_regions.cc +++ b/gtk2_ardour/editor_regions.cc @@ -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); diff --git a/gtk2_ardour/insert_remove_time_dialog.cc b/gtk2_ardour/insert_remove_time_dialog.cc index 162559e539..2d444b92d1 100644 --- a/gtk2_ardour/insert_remove_time_dialog.cc +++ b/gtk2_ardour/insert_remove_time_dialog.cc @@ -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 diff --git a/gtk2_ardour/location_ui.cc b/gtk2_ardour/location_ui.cc index c868e1d38e..8354b54a2a 100644 --- a/gtk2_ardour/location_ui.cc +++ b/gtk2_ardour/location_ui.cc @@ -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)); @@ -1104,6 +1106,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) { SessionHandlePtr::set_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; diff --git a/gtk2_ardour/location_ui.h b/gtk2_ardour/location_ui.h index 46495aa4fc..d24dc840b3 100644 --- a/gtk2_ardour/location_ui.h +++ b/gtk2_ardour/location_ui.h @@ -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 diff --git a/gtk2_ardour/region_editor.cc b/gtk2_ardour/region_editor.cc index 1818e61963..36c648b712 100644 --- a/gtk2_ardour/region_editor.cc +++ b/gtk2_ardour/region_editor.cc @@ -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); @@ -203,6 +205,12 @@ RegionEditor::~RegionEditor () } 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) { if (what_changed.contains (ARDOUR::Properties::name)) { diff --git a/gtk2_ardour/region_editor.h b/gtk2_ardour/region_editor.h index aa0098a4ba..888ab8afb3 100644 --- a/gtk2_ardour/region_editor.h +++ b/gtk2_ardour/region_editor.h @@ -115,6 +115,8 @@ private: Gtk::Label _sources_label; Gtk::ListViewText _sources; + + void set_clock_mode_from_primary (); }; #endif /* __gtk_ardour_region_edit_h__ */ diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 0e612be42c..fcd8510d92 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -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); |