summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_drag.h
diff options
context:
space:
mode:
authorColin Fletcher <colin.m.fletcher@googlemail.com>2013-10-23 21:50:01 +0100
committerColin Fletcher <colin.m.fletcher@googlemail.com>2014-05-07 19:46:24 +0100
commitd75c7151d4cf306f1961e7a967ea129c6fd8d153 (patch)
tree927ac2c5c36bb0cb68c23556ed1ba68d9a0eb54d /gtk2_ardour/editor_drag.h
parentce8e374cf8ff1c8f9611cba89ba4e9509e262878 (diff)
Ripple mode: basic implementation
Add a value for Ripple to EditMode enum. Add Ripple edit mode to edit mode dropdown, by adding it to the Editor::build_edit_mode_menu() helper function, and remove the old code that added items to the (now unused) Editor::edit_mode_strings. Add the regions that should be affected by the drag to RegionDrag::_views so that the drag carries them along automatically. Use a copy of the RegionList in Playlist::core_ripple(), since bad things happen when iterating over regions and they get moved around in the list. Handle rippling in removal of regions from playlist. When dragging in ripple mode, exclude all regions that lie before the original start position of the selected regions being dragged from rippling: this is what Mixbus does. Make editor dragging respect snap-to settings, by using the existing compute_x_delta() function, which did almost the right thing. Move setting of _last_frame_position out of that function so all ripple-dragged regions can move. Ripple when dragging from region list: even though Mixbus doesn't do this, it seems like a good idea. Prevent multi-track selection being dragged across tracks, by making RegionMotionDrag::y_movement_allowed() virtual, and overriding it in RegionRippleDrag to forbid dragging of selections containing regions on more than one track to dofferent tracks in ripple mode. Remember which TimeAxisView a ripple-mode drag that's allowed cross-track drags started from, so that the effect of rippling regions after any region that's dragged off that track can be undone.
Diffstat (limited to 'gtk2_ardour/editor_drag.h')
-rw-r--r--gtk2_ardour/editor_drag.h43
1 files changed, 40 insertions, 3 deletions
diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h
index 0bcfed9979..4b7114c67c 100644
--- a/gtk2_ardour/editor_drag.h
+++ b/gtk2_ardour/editor_drag.h
@@ -313,7 +313,7 @@ public:
protected:
double compute_x_delta (GdkEvent const *, ARDOUR::framepos_t *);
- bool y_movement_allowed (int, double) const;
+ virtual bool y_movement_allowed (int, double) const;
bool _brushing;
ARDOUR::framepos_t _last_frame_position; ///< last position of the thing being dragged
@@ -346,9 +346,11 @@ public:
void setup_pointer_frame_offset ();
-private:
+protected:
typedef std::set<boost::shared_ptr<ARDOUR::Playlist> > PlaylistSet;
+ void add_stateful_diff_commands_for_playlists (PlaylistSet const &);
+private:
void finished_no_copy (
bool const,
bool const,
@@ -375,7 +377,6 @@ private:
PlaylistSet& modified_playlists
);
- void add_stateful_diff_commands_for_playlists (PlaylistSet const &);
void collect_new_region_view (RegionView *);
@@ -408,6 +409,42 @@ public:
void aborted (bool);
};
+/** Region drag in ripple mode */
+
+class RegionRippleDrag : public RegionMoveDrag
+{
+public:
+ RegionRippleDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
+ ~RegionRippleDrag () { delete exclude; }
+
+ void motion (GdkEvent *, bool);
+ void finished (GdkEvent *, bool);
+ void aborted (bool);
+protected:
+ bool y_movement_allowed (int delta_track, double delta_layer) const {
+ std::cerr << "RegionRippleDrag::y_movement_allowed (" << delta_track << ", " << delta_layer << ")..." << std::endl;
+ if (RegionMotionDrag::y_movement_allowed (delta_track, delta_layer)) {
+ if (delta_track) {
+ return allow_moves_across_tracks;
+ } else {
+ return true;
+ }
+ }
+ return false;
+ }
+private:
+ TimeAxisView *prev_tav; // where regions were most recently dragged from
+ TimeAxisView *orig_tav; // where drag started
+ framecnt_t prev_amount;
+ framepos_t prev_position;
+ framecnt_t selection_length;
+ bool allow_moves_across_tracks; // only if all selected regions are on one track
+ ARDOUR::RegionList *exclude;
+ void add_all_after_to_views (TimeAxisView *tav, framepos_t where, const RegionSelection &exclude, bool drag_in_progress);
+ void remove_unselected_from_views (framecnt_t amount);
+
+};
+
/** Drags to create regions */
class RegionCreateDrag : public Drag
{