diff options
author | Colin Fletcher <colin.m.fletcher@googlemail.com> | 2015-02-07 23:22:59 +0000 |
---|---|---|
committer | Colin Fletcher <colin.m.fletcher@googlemail.com> | 2015-02-12 18:06:16 +0000 |
commit | ecd265222a6fe7a1d2dba1aa706a1ea95abeff87 (patch) | |
tree | 2e68d2aed4ce56961f4892f042c92470e6d4deed /gtk2_ardour/main_clock.cc | |
parent | 24e8e865a6c5240ddacb2e2dca2f45be29ebfb03 (diff) |
Add/edit tempo/meter change at right position with 'delta to edit cursor'
Find the absolute position of the main clock when 'display delta to edit
cursor' is set when adding/editing tempo/meter changes from the context
menu.
Diffstat (limited to 'gtk2_ardour/main_clock.cc')
-rw-r--r-- | gtk2_ardour/main_clock.cc | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/gtk2_ardour/main_clock.cc b/gtk2_ardour/main_clock.cc index b8bc733ea6..8bb685da4b 100644 --- a/gtk2_ardour/main_clock.cc +++ b/gtk2_ardour/main_clock.cc @@ -73,6 +73,17 @@ MainClock::build_ops_menu () ops_items.push_back (MenuElem (_("Insert Meter Change"), sigc::mem_fun(*this, &MainClock::insert_new_meter))); } +framepos_t +MainClock::absolute_time () const +{ + if (get_is_duration ()) { + // delta to edit cursor + return current_time () + PublicEditor::instance().get_preferred_edit_position (true); + } else { + return current_time (); + } +} + void MainClock::display_delta_to_edit_cursor () { @@ -86,27 +97,27 @@ MainClock::display_delta_to_edit_cursor () void MainClock::edit_current_tempo () { - ARDOUR::TempoSection ts = PublicEditor::instance().session()->tempo_map().tempo_section_at(current_time()); + ARDOUR::TempoSection ts = PublicEditor::instance().session()->tempo_map().tempo_section_at (absolute_time()); PublicEditor::instance().edit_tempo_section (&ts); } void MainClock::edit_current_meter () { - ARDOUR::Meter m = PublicEditor::instance().session()->tempo_map().meter_at(current_time()); - ARDOUR::MeterSection ms(current_time(), m.divisions_per_bar(), m.note_divisor()); + ARDOUR::Meter m = PublicEditor::instance().session()->tempo_map().meter_at (absolute_time()); + ARDOUR::MeterSection ms (absolute_time(), m.divisions_per_bar(), m.note_divisor()); PublicEditor::instance().edit_meter_section (&ms); } void MainClock::insert_new_tempo () { - PublicEditor::instance().mouse_add_new_tempo_event (current_time ()); + PublicEditor::instance().mouse_add_new_tempo_event (absolute_time ()); } void MainClock::insert_new_meter () { - PublicEditor::instance().mouse_add_new_meter_event (current_time ()); + PublicEditor::instance().mouse_add_new_meter_event (absolute_time ()); } |