summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-12-30 23:41:17 +0000
committerCarl Hetherington <carl@carlh.net>2011-12-30 23:41:17 +0000
commitb93254f27550ddffbc9d6c0f043e4e24cfe536c2 (patch)
treecb125b9640e4985f3d1a6b56c16bb44d213a9d75 /gtk2_ardour
parent0be530821c5afb2bb7377efdb9eb886e350d0544 (diff)
Anywhere that deletes regions needs to use a rdiff() on the playlist
for the undo history, so that changes to regions' layering_index get stored in the undo record. Make Playlist::update use add_region_internal so that undone regions don't have their layering_index corrupted. Setup layering indices on relayer() so that deletion of regions causes an update. git-svn-id: svn://localhost/ardour2/branches/3.0@11123 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor_ops.cc43
1 files changed, 43 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 9bdd2e26a8..96ae169aed 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -3706,7 +3706,16 @@ Editor::remove_clicked_region ()
begin_reversible_command (_("remove region"));
playlist->clear_changes ();
+ playlist->clear_owned_changes ();
playlist->remove_region (clicked_regionview->region());
+
+ /* We might have removed regions, which alters other regions' layering_index,
+ so we need to do a recursive diff here.
+ */
+ vector<Command*> cmds;
+ playlist->rdiff (cmds);
+ _session->add_commands (cmds);
+
_session->add_command(new StatefulDiffCommand (playlist));
commit_reversible_command ();
}
@@ -3758,6 +3767,7 @@ Editor::remove_selected_regions ()
playlists.push_back (playlist);
playlist->clear_changes ();
+ playlist->clear_owned_changes ();
playlist->freeze ();
playlist->remove_region (*rl);
}
@@ -3766,6 +3776,14 @@ Editor::remove_selected_regions ()
for (pl = playlists.begin(); pl != playlists.end(); ++pl) {
(*pl)->thaw ();
+
+ /* We might have removed regions, which alters other regions' layering_index,
+ so we need to do a recursive diff here.
+ */
+ vector<Command*> cmds;
+ (*pl)->rdiff (cmds);
+ _session->add_commands (cmds);
+
_session->add_command(new StatefulDiffCommand (*pl));
}
@@ -3812,6 +3830,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
if (fl == freezelist.end()) {
pl->clear_changes();
+ pl->clear_owned_changes ();
pl->freeze ();
freezelist.insert (pl);
}
@@ -3927,6 +3946,14 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
for (FreezeList::iterator pl = freezelist.begin(); pl != freezelist.end(); ++pl) {
(*pl)->thaw ();
+
+ /* We might have removed regions, which alters other regions' layering_index,
+ so we need to do a recursive diff here.
+ */
+ vector<Command*> cmds;
+ (*pl)->rdiff (cmds);
+ _session->add_commands (cmds);
+
_session->add_command (new StatefulDiffCommand (*pl));
}
}
@@ -4615,6 +4642,7 @@ Editor::apply_filter (Filter& filter, string command, ProgressReporter* progress
if (arv->audio_region()->apply (filter, progress) == 0) {
playlist->clear_changes ();
+ playlist->clear_owned_changes ();
if (filter.results.empty ()) {
@@ -4637,6 +4665,13 @@ Editor::apply_filter (Filter& filter, string command, ProgressReporter* progress
}
+ /* We might have removed regions, which alters other regions' layering_index,
+ so we need to do a recursive diff here.
+ */
+ vector<Command*> cmds;
+ playlist->rdiff (cmds);
+ _session->add_commands (cmds);
+
_session->add_command(new StatefulDiffCommand (playlist));
} else {
goto out;
@@ -5716,6 +5751,7 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList
AnalysisFeatureList::const_iterator x;
pl->clear_changes ();
+ pl->clear_owned_changes ();
x = positions.begin();
@@ -5802,6 +5838,13 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList
pl->thaw ();
+ /* We might have removed regions, which alters other regions' layering_index,
+ so we need to do a recursive diff here.
+ */
+ vector<Command*> cmds;
+ pl->rdiff (cmds);
+ _session->add_commands (cmds);
+
_session->add_command (new StatefulDiffCommand (pl));
if (select_new) {