crossfade hack and slash. removed overlap checks, overlap mode, default length,...
[ardour.git] / gtk2_ardour / editor_drag.h
index f39f5cfcb3e006148bb521c613aefc3d5cdad1dd..f18a40a9e257f894ef07d92e279684c0fbee28b5 100644 (file)
@@ -242,8 +242,9 @@ private:
 class RegionDrag;
 
 /** Container for details about a region being dragged */
-struct DraggingView
+class DraggingView
 {
+public:
        DraggingView (RegionView *, RegionDrag *);
 
        RegionView* view; ///< the view
@@ -310,7 +311,7 @@ public:
 
 protected:
 
-       double compute_x_delta (GdkEvent const *, ARDOUR::framecnt_t *);
+       double compute_x_delta (GdkEvent const *, ARDOUR::framepos_t *);
        bool y_movement_allowed (int, double) const;
 
        bool _brushing;
@@ -514,7 +515,7 @@ public:
                ContentsTrim,
        };
 
-       TrimDrag (Editor *, ArdourCanvas::Item *, RegionView*, std::list<RegionView*> const &);
+       TrimDrag (Editor *, ArdourCanvas::Item *, RegionView*, std::list<RegionView*> const &, bool preserve_fade_anchor = false);
 
        void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
        void motion (GdkEvent *, bool);
@@ -530,6 +531,8 @@ public:
 private:
 
        Operation _operation;
+       
+       bool _preserve_fade_anchor;
 };
 
 /** Meter marker drag */
@@ -932,11 +935,14 @@ private:
        bool _zoom_out;
 };
 
-/** Drag of a range of automation data, changing value but not position */
+/** Drag of a range of automation data (either on an automation track or region gain),
+ *  changing value but not position.
+ */
 class AutomationRangeDrag : public Drag
 {
 public:
-       AutomationRangeDrag (Editor *, ArdourCanvas::Item *, std::list<ARDOUR::AudioRange> const &);
+       AutomationRangeDrag (Editor *, AutomationTimeAxisView *, std::list<ARDOUR::AudioRange> const &);
+       AutomationRangeDrag (Editor *, AudioRegionView *, std::list<ARDOUR::AudioRange> const &);
 
        void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
        void motion (GdkEvent *, bool);
@@ -947,9 +953,15 @@ public:
                return false;
        }
 
+       bool active (Editing::MouseMode) {
+               return true;
+       }
+
 private:
+       void setup (std::list<boost::shared_ptr<AutomationLine> > const &);
+        double y_fraction (boost::shared_ptr<AutomationLine>, double global_y_position) const;
+
        std::list<ARDOUR::AudioRange> _ranges;
-       AutomationTimeAxisView* _atav;
 
        /** A line that is part of the drag */
        struct Line {
@@ -957,12 +969,38 @@ private:
                std::list<ControlPoint*> points; ///< points to drag on the line
                std::pair<ARDOUR::framepos_t, ARDOUR::framepos_t> range; ///< the range of all points on the line, in session frames
                XMLNode* state; ///< the XML state node before the drag
+               double original_fraction; ///< initial y-fraction before the drag
        };
 
        std::list<Line> _lines;
-
+        double y_origin;
        bool _nothing_to_drag;
 };
 
+/** Drag of one edge of an xfade
+ */
+class CrossfadeEdgeDrag : public Drag
+{
+  public:
+       CrossfadeEdgeDrag (Editor*, AudioRegionView*, ArdourCanvas::Item*, bool start);
+
+       void start_grab (GdkEvent*, Gdk::Cursor* c = 0);
+       void motion (GdkEvent*, bool);
+       void finished (GdkEvent*, bool);
+       void aborted (bool);
+       
+       bool y_movement_matters () const {
+               return false;
+       }
+
+       virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
+               return std::make_pair (4, 4);
+       }
+
+  private:
+       AudioRegionView* arv;
+       bool start;
+};
+
 #endif /* __gtk2_ardour_editor_drag_h_ */