From 4f8fa6787a160f1951081c3782697c5bdd1c1ed9 Mon Sep 17 00:00:00 2001 From: nick_m Date: Sat, 16 Apr 2016 07:07:42 +1000 Subject: [PATCH] Tempo ramps - add undo to right-click lock style & ramp type changes. --- gtk2_ardour/editor_markers.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index c597ec292d..74e35a246b 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -1389,19 +1389,29 @@ Editor::toggle_marker_lock_style () dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm); if (mm) { + begin_reversible_command (_("change meter lock style")); + XMLNode &before = _session->tempo_map().get_state(); MeterSection* msp = &mm->meter(); if (mm->meter().position_lock_style() == AudioTime) { _session->tempo_map().replace_meter (*msp, Meter (msp->divisions_per_bar(), msp->note_divisor()), msp->bbt()); } else { _session->tempo_map().replace_meter (*msp, Meter (msp->divisions_per_bar(), msp->note_divisor()), msp->frame()); } + XMLNode &after = _session->tempo_map().get_state(); + _session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); + commit_reversible_command (); } else if (tm) { + begin_reversible_command (_("change tempo lock style")); + XMLNode &before = _session->tempo_map().get_state(); TempoSection* tsp = &tm->tempo(); if (tsp->position_lock_style() == AudioTime) { _session->tempo_map().replace_tempo (*tsp, Tempo (tsp->beats_per_minute(), tsp->note_type()), tsp->pulse(), tsp->type()); } else { _session->tempo_map().replace_tempo (*tsp, Tempo (tsp->beats_per_minute(), tsp->note_type()), tsp->frame(), tsp->type()); } + XMLNode &after = _session->tempo_map().get_state(); + _session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); + commit_reversible_command (); } } @@ -1413,10 +1423,15 @@ Editor::toggle_tempo_type () dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm); if (tm) { + begin_reversible_command (_("change tempo type")); + XMLNode &before = _session->tempo_map().get_state(); TempoSection* tsp = &tm->tempo(); _session->tempo_map().replace_tempo (*tsp, Tempo (tsp->beats_per_minute(), tsp->note_type()) , (tsp->position_lock_style() == MusicTime) ? tsp->pulse() : tsp->frame() , (tsp->type() == TempoSection::Ramp) ? TempoSection::Constant : TempoSection::Ramp); + XMLNode &after = _session->tempo_map().get_state(); + _session->add_command(new MementoCommand(_session->tempo_map(), &before, &after)); + commit_reversible_command (); } } -- 2.30.2