Merge branch 'ripple-mode-cc' into cairocanvas
[ardour.git] / gtk2_ardour / route_time_axis.cc
index e6a8f59be093fbf4299e5ae0783475d249a3a700..55dbec5f8bc0d186d958dd5360efe17e529d23a1 100644 (file)
@@ -1413,6 +1413,10 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
        switch (op) {
        case Delete:
                if (playlist->cut (time) != 0) {
+                       if (Config->get_edit_mode() == Ripple)
+                               playlist->ripple(time.start(), -time.length(), NULL);
+                               // no need to exclude any regions from rippling here
+
                         vector<Command*> cmds;
                         playlist->rdiff (cmds);
                         _session->add_commands (cmds);
@@ -1424,6 +1428,10 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
        case Cut:
                if ((what_we_got = playlist->cut (time)) != 0) {
                        _editor.get_cut_buffer().add (what_we_got);
+                       if (Config->get_edit_mode() == Ripple)
+                               playlist->ripple(time.start(), -time.length(), NULL);
+                               // no need to exclude any regions from rippling here
+
                         vector<Command*> cmds;
                         playlist->rdiff (cmds);
                         _session->add_commands (cmds);
@@ -1439,6 +1447,9 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
 
        case Clear:
                if ((what_we_got = playlist->cut (time)) != 0) {
+                       if (Config->get_edit_mode() == Ripple)
+                               playlist->ripple(time.start(), -time.length(), NULL);
+                               // no need to exclude any regions from rippling here
 
                         vector<Command*> cmds;
                         playlist->rdiff (cmds);
@@ -1473,8 +1484,18 @@ RouteTimeAxisView::paste (framepos_t pos, float times, Selection& selection, siz
                 DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("modified paste to %1\n", pos));
        }
 
-        pl->clear_changes ();
+       pl->clear_changes ();
+       if (Config->get_edit_mode() == Ripple) {
+               std::pair<framepos_t, framepos_t> extent = (*p)->get_extent();
+               framecnt_t amount = extent.second - extent.first;
+               pl->ripple(pos, amount * times, boost::shared_ptr<Region>());
+       }
        pl->paste (*p, pos, times);
+
+       vector<Command*> cmds;
+       pl->rdiff (cmds);
+       _session->add_commands (cmds);
+
        _session->add_command (new StatefulDiffCommand (pl));
 
        return true;