some code shuffling to make sure that cut mode always operates at the mouse location...
[ardour.git] / gtk2_ardour / editor_drag.h
index de10ed078715e6553d85be023daae18386f55c95..378162621e5a9efde9bb2ecfdeea5a46da2f6931 100644 (file)
@@ -247,7 +247,7 @@ class RegionDrag;
 class DraggingView
 {
 public:
-       DraggingView (RegionView *, RegionDrag *);
+       DraggingView (RegionView *, RegionDrag *, TimeAxisView* original_tav);
 
        RegionView* view; ///< the view
        /** index into RegionDrag::_time_axis_views of the view that this region is currently being displayed on,
@@ -264,6 +264,7 @@ public:
        framepos_t initial_end; ///< initial end position of the region
        framepos_t anchored_fade_length; ///< fade_length when anchored during drag
        boost::shared_ptr<ARDOUR::Playlist> initial_playlist;
+       TimeAxisView* initial_time_axis_view;
 };
 
 /** Abstract base class for drags that involve region(s) */
@@ -315,7 +316,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
@@ -348,9 +349,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,
@@ -377,10 +380,9 @@ private:
                PlaylistSet& modified_playlists
                );
 
-       void add_stateful_diff_commands_for_playlists (PlaylistSet const &);
 
        void collect_new_region_view (RegionView *);
-       RouteTimeAxisView* create_destination_time_axis (boost::shared_ptr<ARDOUR::Region>);
+       RouteTimeAxisView* create_destination_time_axis (boost::shared_ptr<ARDOUR::Region>, TimeAxisView* original);
 
        bool _copy;
        RegionView* _new_region_view;
@@ -411,6 +413,48 @@ 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;
+
+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, bool move_regions);
+
+};
+
+/** "Drag" to cut a region (action only on button release) */
+class RegionCutDrag : public Drag
+{
+    public:
+       RegionCutDrag (Editor*, ArdourCanvas::Item*, framepos_t);
+       ~RegionCutDrag ();
+
+       void motion (GdkEvent*, bool);
+       void finished (GdkEvent*, bool);
+       void aborted (bool);
+
+    private:
+       EditorCursor* line;
+};
+
 /** Drags to create regions */
 class RegionCreateDrag : public Drag
 {