summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-01-04 20:40:06 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-01-04 20:40:06 +0000
commitc80649d913606bebc34da29d3efaa6b8bd743a32 (patch)
treed79be0c178cc115a5bc39b4743467f6dd4e6e00f
parentd48fd2a67954bf5eb3eb24b540f6c2790b4f8f44 (diff)
restore correct behaviour of undo/redo for tempo map drags
git-svn-id: svn://localhost/ardour2/branches/3.0@11162 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/editor_drag.cc10
-rw-r--r--gtk2_ardour/editor_drag.h2
2 files changed, 8 insertions, 4 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index e07844f7a9..feddeb8e6c 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -1953,6 +1953,8 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move)
if (!_copy) {
TempoMap& map (_editor->session()->tempo_map());
+ /* get current state */
+ before_state = &map.get_state();
/* remove the section while we drag it */
map.remove_meter (section, true);
}
@@ -1987,13 +1989,12 @@ MeterMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
} else {
_editor->begin_reversible_command (_("move meter mark"));
- XMLNode &before = map.get_state();
/* we removed it before, so add it back now */
map.add_meter (_marker->meter(), when);
XMLNode &after = map.get_state();
- _editor->session()->add_command(new MementoCommand<TempoMap>(map, &before, &after));
+ _editor->session()->add_command(new MementoCommand<TempoMap>(map, before_state, &after));
_editor->commit_reversible_command ();
}
@@ -2071,6 +2072,8 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
if (!_copy) {
TempoMap& map (_editor->session()->tempo_map());
+ /* get current state */
+ before_state = &map.get_state();
/* remove the section while we drag it */
map.remove_tempo (section, true);
}
@@ -2105,11 +2108,10 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
} else {
_editor->begin_reversible_command (_("move tempo mark"));
- XMLNode &before = map.get_state();
/* we removed it before, so add it back now */
map.add_tempo (_marker->tempo(), when);
XMLNode &after = map.get_state();
- _editor->session()->add_command (new MementoCommand<TempoMap>(map, &before, &after));
+ _editor->session()->add_command (new MementoCommand<TempoMap>(map, before_state, &after));
_editor->commit_reversible_command ();
}
diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h
index 4170315294..6e055a6344 100644
--- a/gtk2_ardour/editor_drag.h
+++ b/gtk2_ardour/editor_drag.h
@@ -570,6 +570,7 @@ public:
private:
MeterMarker* _marker;
bool _copy;
+ XMLNode* before_state;
};
/** Tempo marker drag */
@@ -596,6 +597,7 @@ public:
private:
TempoMarker* _marker;
bool _copy;
+ XMLNode* before_state;
};