merge fix
[ardour.git] / gtk2_ardour / editor_drag.h
index ce2ac1ca16dff4d39ee502263754d646327dfbdf..e5acbaad448f3a9e6e22ebc27724c00be9cabe0c 100644 (file)
 
 #include "ardour/types.h"
 
+#include "canvas/types.h"
+
 #include "cursor_context.h"
 #include "editor_items.h"
 #include "mouse_cursors.h"
+#include "editing.h"
 
 namespace ARDOUR {
        class Location;
 }
 
+namespace ArdourCanvas {
+       class Item;
+       class Line;
+       class Rectangle;
+}
+
 namespace PBD {
        class StatefulDiffCommand;
 }
@@ -46,6 +55,18 @@ class TimeAxisView;
 class MidiTimeAxisView;
 class Drag;
 class NoteBase;
+class RegionView;
+class TimeAxisView;
+class RouteTimeAxisView;
+class RegionSelection;
+class MidiRegionView;
+class MeterMarker;
+class Marker;
+class TempoMarker;
+class ControlPoint;
+class AudioRegionView;
+class AutomationLine;
+class AutomationTimeAxisView;
 
 /** Class to manage current drags */
 class DragManager
@@ -213,13 +234,18 @@ protected:
                return _last_pointer_y;
        }
 
-       double last_pointer_frame () const {
+       ARDOUR::framepos_t last_pointer_frame () const {
                return _last_pointer_frame;
        }
 
+       ARDOUR::frameoffset_t snap_delta (guint const) const;
+
        double current_pointer_x () const;
        double current_pointer_y () const;
 
+       /* sets snap delta from unsnapped pos */
+       void setup_snap_delta (framepos_t pos);
+
        boost::shared_ptr<ARDOUR::Region> add_midi_region (MidiTimeAxisView*);
 
        void show_verbose_cursor_time (framepos_t);
@@ -239,9 +265,8 @@ private:
        bool _trackview_only; ///< true if pointer y value should always be relative to the top of the trackview group
        bool _move_threshold_passed; ///< true if the move threshold has been passed, otherwise false
        bool _starting_point_passed; ///< true if we called move () with first_move flag, otherwise false
-        bool _was_double_click; ///< true if drag initiated by a double click event
        bool _initially_vertical; ///< true if after move threshold is passed we appear to be moving vertically; undefined before that
-       bool _was_double_click; ///< true if drag initiated by a double click event
+        bool _was_double_click; ///< true if drag initiated by a double click event
        double _grab_x; ///< trackview x of the grab start position
        double _grab_y; ///< y of the grab start position, possibly adjusted if _trackview_only is true
        double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred
@@ -249,6 +274,11 @@ private:
        ARDOUR::framepos_t _raw_grab_frame; ///< unsnapped frame that the mouse was at when start_grab was called, or 0
        ARDOUR::framepos_t _grab_frame; ///< adjusted_frame that the mouse was at when start_grab was called, or 0
        ARDOUR::framepos_t _last_pointer_frame; ///< adjusted_frame the last time a motion occurred
+
+       /* difference between some key position's snapped and unsnapped
+        *  framepos. used for relative snap.
+        */
+       ARDOUR::frameoffset_t _snap_delta;
        CursorContext::Handle _cursor_ctx; ///< cursor change context
 };
 
@@ -293,9 +323,11 @@ protected:
        /** a list of the non-hidden TimeAxisViews sorted by editor order key */
        std::vector<TimeAxisView*> _time_axis_views;
        int find_time_axis_view (TimeAxisView *) const;
+       int apply_track_delta (const int start, const int delta, const int skip, const bool distance_only = false) const;
 
        int _visible_y_low;
        int _visible_y_high;
+       uint32_t _ntracks;
 
        friend class DraggingView;
 
@@ -327,14 +359,17 @@ public:
 protected:
 
        double compute_x_delta (GdkEvent const *, ARDOUR::framepos_t *);
-       virtual bool y_movement_allowed (int, double) const;
+       virtual bool y_movement_allowed (int, double, int skip_invisible = 0) const;
 
        bool _brushing;
        ARDOUR::framepos_t _last_frame_position; ///< last position of the thing being dragged
        double _total_x_delta;
        int _last_pointer_time_axis_view;
        double _last_pointer_layer;
-       bool _single_axis;
+private:
+       uint32_t _ndropzone;
+       uint32_t _pdropzone;
+       uint32_t _ddropzone;
 };
 
 
@@ -437,18 +472,18 @@ public:
        void finished (GdkEvent *, bool);
        void aborted (bool);
 protected:
-       bool y_movement_allowed (int delta_track, double delta_layer) const;
+       bool y_movement_allowed (int delta_track, double delta_layer, int skip_invisible = 0) 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;
+       ARDOUR::framecnt_t prev_amount;
+       ARDOUR::framepos_t prev_position;
+       ARDOUR::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);
+       void add_all_after_to_views (TimeAxisView *tav, ARDOUR::framepos_t where, const RegionSelection &exclude, bool drag_in_progress);
+       void remove_unselected_from_views (ARDOUR::framecnt_t amount, bool move_regions);
 
 };
 
@@ -497,6 +532,7 @@ private:
        MidiRegionView*     region;
        bool                relative;
        bool                at_front;
+       double              _snap_delta;
 };
 
 /** Drags to move MIDI notes */
@@ -512,7 +548,7 @@ class NoteDrag : public Drag
 
   private:
 
-       ARDOUR::frameoffset_t total_dx () const;
+       ARDOUR::frameoffset_t total_dx (const guint) const;
        int8_t total_dy () const;
 
        MidiRegionView* _region;
@@ -535,7 +571,7 @@ public:
        void aborted (bool);
 
        bool active (Editing::MouseMode mode) {
-               return mode == Editing::MouseDraw;
+               return mode == Editing::MouseDraw || mode == Editing::MouseContent;
        }
 
        bool y_movement_matters () const {
@@ -544,7 +580,7 @@ public:
 
 private:
        double y_to_region (double) const;
-       framecnt_t grid_frames (framepos_t) const;
+       ARDOUR::framecnt_t grid_frames (framepos_t) const;
        
        MidiRegionView* _region_view;
        ArdourCanvas::Rectangle* _drag_rect;
@@ -841,6 +877,8 @@ private:
        double _fixed_grab_x;
        double _fixed_grab_y;
        double _cumulative_y_drag;
+       uint32_t _before;
+       uint32_t _after;
 };
 
 /** Transient feature line drags*/
@@ -983,7 +1021,6 @@ public:
 private:
        Operation _operation;
        bool _add;
-       int _original_pointer_time_axis;
        std::list<TimeAxisView*> _added_time_axes;
        bool _time_selection_at_start;
         framepos_t start_at_start;