diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 21c8a3a588..5f27d170b1 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1758,7 +1758,7 @@ private: void mid_tempo_per_region_update (RegionView*); bool ignore_map_change; - Temporal::TempoMap::WritableSharedPtr begin_tempo_mapping (); + Temporal::TempoMap::WritableSharedPtr begin_tempo_mapping (PBD::Command**); void abort_tempo_mapping (); void commit_tempo_mapping (Temporal::TempoMap::WritableSharedPtr&); diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index c83f770512..425d2e00bf 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -3012,7 +3012,8 @@ Editor::choose_mapping_drag (ArdourCanvas::Item* item, GdkEvent* event) return; } - Temporal::TempoMap::WritableSharedPtr map = begin_tempo_mapping (); + PBD::Command* swap_undo_command; + Temporal::TempoMap::WritableSharedPtr map = begin_tempo_mapping (&swap_undo_command); /* Decide between a mid-twist, which we do if the * pointer is between two tempo markers, and an end-stretch, @@ -3103,6 +3104,7 @@ Editor::choose_mapping_drag (ArdourCanvas::Item* item, GdkEvent* event) if (at_end) { begin_reversible_command (_("tempo mapping: end-stretch")); + _session->add_command (swap_undo_command); std::cerr << "END STRETCH\n"; _drags->set (new MappingEndDrag (this, item, map, tempo, *focus, *before_state), event); return; @@ -3111,11 +3113,13 @@ Editor::choose_mapping_drag (ArdourCanvas::Item* item, GdkEvent* event) if (before && focus && after) { std::cerr << "TWIST\n"; begin_reversible_command (_("tempo mapping: mid-twist")); + _session->add_command (swap_undo_command); _drags->set (new MappingTwistDrag (this, item, map, *before, *focus, *after, *before_state, ramped), event); } else if (ramped && focus && after) { /* special case 4: user is manipulating a beat line after the INITIAL tempo marker, so there is no prior marker*/ std::cerr << "TWIST ON START\n"; begin_reversible_command (_("tempo mapping: mid-twist")); + _session->add_command (swap_undo_command); before = focus; /* this is unused in MappingTwistDrag, when ramped is true, but let's not pass in garbage */ _drags->set (new MappingTwistDrag (this, item, map, *before, *focus, *after, *before_state, ramped), event); } else { diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 1a66417d8e..1a430066ba 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -813,13 +813,13 @@ Editor::real_remove_meter_marker (Temporal::MeterPoint const * section) Temporal::TempoMap::WritableSharedPtr -Editor::begin_tempo_mapping () +Editor::begin_tempo_mapping (PBD::Command** cmd) { TempoMap::WritableSharedPtr wmap = TempoMap::write_copy (); - TempoMap::set (wmap); + TempoMap::set (wmap); reassociate_metric_markers (wmap); (void) Temporal::DomainSwapInformation::start (Temporal::BeatTime); - _session->globally_change_time_domain (Temporal::BeatTime, Temporal::AudioTime); + *cmd = _session->globally_change_time_domain (Temporal::BeatTime, Temporal::AudioTime); return wmap; } diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 220ea7dfdb..338ddd1e67 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -528,7 +528,7 @@ public: _commit_tempo_map_edit (map, with_update); } - virtual Temporal::TempoMap::WritableSharedPtr begin_tempo_mapping () = 0; + virtual Temporal::TempoMap::WritableSharedPtr begin_tempo_mapping (PBD::Command**) = 0; virtual void abort_tempo_mapping () = 0; virtual void commit_tempo_mapping (Temporal::TempoMap::WritableSharedPtr& map) = 0;