From 5d509146c815bee46e8d1ede78c7e4445f346db8 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 21 Dec 2011 14:21:05 +0000 Subject: [PATCH] followup to the previous tempo-dragging commit: use argument to Drag::aborted() to know if we moved; update the frame position of tempo map metrics when we remove a tempo mark (should fix visual glitches when dragging tempo) git-svn-id: svn://localhost/ardour2/branches/3.0@11049 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_drag.cc | 39 ++++++++++++++++++-------------------- libs/ardour/tempo.cc | 1 + 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index b90cb88c6f..020428a76b 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -1944,20 +1944,18 @@ MeterMarkerDrag::finished (GdkEvent* event, bool movement_occurred) } void -MeterMarkerDrag::aborted (bool) +MeterMarkerDrag::aborted (bool moved) { _marker->set_position (_marker->meter().frame ()); - /* XXX problem: we don't know if we've moved yet, so we don't - know if the marker is a copy yet or not - */ - - TempoMap& map (_editor->session()->tempo_map()); - /* we removed it before, so add it back now */ - map.add_meter (_marker->meter(), _marker->meter().frame()); - // delete the dummy marker we used for visual representation while moving. - // a new visual marker will show up automatically. - delete _marker; + if (moved) { + TempoMap& map (_editor->session()->tempo_map()); + /* we removed it before, so add it back now */ + map.add_meter (_marker->meter(), _marker->meter().frame()); + // delete the dummy marker we used for visual representation while moving. + // a new visual marker will show up automatically. + delete _marker; + } } TempoMarkerDrag::TempoMarkerDrag (Editor* e, ArdourCanvas::Item* i, bool c) @@ -2062,18 +2060,17 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred) } void -TempoMarkerDrag::aborted (bool) +TempoMarkerDrag::aborted (bool moved) { _marker->set_position (_marker->tempo().frame()); - /* XXX problem: we don't know if we've moved yet, so we don't - know if the marker is a copy yet or not - */ - TempoMap& map (_editor->session()->tempo_map()); - /* we removed it before, so add it back now */ - map.add_tempo (_marker->tempo(), _marker->tempo().frame()); - // delete the dummy marker we used for visual representation while moving. - // a new visual marker will show up automatically. - delete _marker; + if (moved) { + TempoMap& map (_editor->session()->tempo_map()); + /* we removed it before, so add it back now */ + map.add_tempo (_marker->tempo(), _marker->tempo().frame()); + // delete the dummy marker we used for visual representation while moving. + // a new visual marker will show up automatically. + delete _marker; + } } CursorDrag::CursorDrag (Editor* e, ArdourCanvas::Item* i, bool s) diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index a8f5bdf7ae..05a96c8dd8 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -345,6 +345,7 @@ TempoMap::remove_tempo (const TempoSection& tempo) } if (removed) { + timestamp_metrics (true); PropertyChanged (PropertyChange ()); } } -- 2.30.2