diff options
author | Carl Hetherington <carl@carlh.net> | 2010-08-26 01:44:11 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-08-26 01:44:11 +0000 |
commit | c243a02c998f585295f2179657673e2cf0fa4428 (patch) | |
tree | 1a18ca901b5f7fb1270938e2fb62f7e2636400ef /gtk2_ardour | |
parent | df2fd9491904aba95e08e1e26552be609530ee83 (diff) |
Fix crossfade undo using the stateful diff system. Fixes #3257.
git-svn-id: svn://localhost/ardour2/branches/3.0@7694 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/crossfade_edit.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 16 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 29 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 18 |
4 files changed, 32 insertions, 35 deletions
diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc index b6dcf07920..49e5ee0609 100644 --- a/gtk2_ardour/crossfade_edit.cc +++ b/gtk2_ardour/crossfade_edit.cc @@ -788,10 +788,10 @@ CrossfadeEditor::apply () _session->begin_reversible_command (_("Edit crossfade")); XMLNode& before = xfade->get_state (); - + _apply_to (xfade); - _session->add_command (new MementoCommand<Crossfade> (*xfade.get(), &before, &xfade->get_state())); + _session->add_command (new MementoCommand<Crossfade> (*xfade.get(), &before, &xfade->get_state ())); _session->commit_reversible_command (); } diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index f2acf2e7a8..cef27660a6 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -1037,6 +1037,15 @@ RegionMoveDrag::finished_no_copy ( playlist->freeze (); } + /* this movement may result in a crossfade being modified, so we need to get undo + data from the playlist as well as the region. + */ + + r = modified_playlists.insert (playlist); + if (r.second) { + playlist->clear_changes (); + } + rv->region()->set_position (where, (void*) this); _editor->session()->add_command (new StatefulDiffCommand (rv->region())); @@ -1172,7 +1181,12 @@ void RegionMoveDrag::add_stateful_diff_commands_for_playlists (PlaylistSet const & playlists) { for (PlaylistSet::const_iterator i = playlists.begin(); i != playlists.end(); ++i) { - _editor->session()->add_command (new StatefulDiffCommand (*i)); + StatefulDiffCommand* c = new StatefulDiffCommand (*i); + if (!c->empty()) { + _editor->session()->add_command (new StatefulDiffCommand (*i)); + } else { + delete c; + } } } diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index f4c63531cc..d540134f17 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -2820,11 +2820,9 @@ Editor::separate_regions_between (const TimeSelection& ts) /* pick up changes to existing regions */ - vector<StatefulDiffCommand*> cmds; + vector<Command*> cmds; playlist->rdiff (cmds); - for (vector<StatefulDiffCommand*>::iterator j = cmds.begin(); j != cmds.end(); ++j) { - _session->add_command (*j); - } + _session->add_commands (cmds); /* pick up changes to the playlist itself (adds/removes) */ @@ -3773,11 +3771,9 @@ Editor::bounce_range_selection (bool replace, bool enable_processing) playlist->add_region (r, start); } - vector<StatefulDiffCommand*> cmds; + vector<Command*> cmds; playlist->rdiff (cmds); - for (vector<StatefulDiffCommand*>::iterator j = cmds.begin(); j != cmds.end(); ++j) { - _session->add_command (*j); - } + _session->add_commands (cmds); _session->add_command (new StatefulDiffCommand (playlist)); } @@ -4492,13 +4488,10 @@ Editor::nudge_track (bool use_edit, bool forwards) playlist->nudge_after (start, distance, forwards); - vector<StatefulDiffCommand*> cmds; + vector<Command*> cmds; playlist->rdiff (cmds); - - for (vector<StatefulDiffCommand*>::iterator c = cmds.begin(); c != cmds.end(); ++c) { - _session->add_command (*c); - } + _session->add_commands (cmds); _session->add_command (new StatefulDiffCommand (playlist)); } @@ -6568,14 +6561,10 @@ Editor::insert_time (nframes64_t pos, nframes64_t frames, InsertTimeOption opt, pl->shift (pos, frames, (opt == MoveIntersected), ignore_music_glue); - vector<StatefulDiffCommand*> cmds; - + vector<Command*> cmds; pl->rdiff (cmds); - - for (vector<StatefulDiffCommand*>::iterator c = cmds.begin(); c != cmds.end(); ++c) { - _session->add_command (*c); - } - + _session->add_commands (cmds); + _session->add_command (new StatefulDiffCommand (pl)); commit = true; } diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 391b08eac6..abc8101195 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -1339,13 +1339,10 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op) if ((what_we_got = playlist->cut (time)) != 0) { _editor.get_cut_buffer().add (what_we_got); - vector<StatefulDiffCommand*> cmds; - + vector<Command*> cmds; playlist->rdiff (cmds); - - for (vector<StatefulDiffCommand*>::iterator c = cmds.begin(); c != cmds.end(); ++c) { - _session->add_command (*c); - } + _session->add_commands (cmds); + _session->add_command (new StatefulDiffCommand (playlist)); } break; @@ -1357,13 +1354,10 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op) case Clear: if ((what_we_got = playlist->cut (time)) != 0) { - vector<StatefulDiffCommand*> cmds; - + + vector<Command*> cmds; playlist->rdiff (cmds); - - for (vector<StatefulDiffCommand*>::iterator c = cmds.begin(); c != cmds.end(); ++c) { - _session->add_command (*c); - } + _session->add_commands (cmds); _session->add_command (new StatefulDiffCommand (playlist)); what_we_got->release (); } |