First cut of some Pro-tools inspired editing features; linked play/play range
[ardour.git] / gtk2_ardour / automation_line.h
index a171be15121edcdbd9cc91586819c06bb5424404..436e5cbb205ac05ff3f7043947364e1b2421b6cf 100644 (file)
@@ -52,7 +52,7 @@ namespace Gnome {
        }
 }
 
-class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoingAway
+class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible
 {
   public:
        AutomationLine (const std::string& name, TimeAxisView&, ArdourCanvas::Group&,
@@ -74,10 +74,11 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin
        bool control_points_adjacent (double xval, uint32_t& before, uint32_t& after);
 
        /* dragging API */
-       virtual void start_drag (ControlPoint*, nframes_t x, float fraction);
-       virtual void point_drag(ControlPoint&, nframes_t x, float, bool with_push);
-       virtual void end_drag (ControlPoint*);
-       virtual void line_drag(uint32_t i1, uint32_t i2, float, bool with_push);
+       virtual void start_drag_single (ControlPoint*, nframes_t x, float);
+       virtual void start_drag_line (uint32_t, uint32_t, float);
+       virtual void start_drag_multiple (std::list<ControlPoint*>, float, XMLNode *);
+       virtual void drag_motion (nframes_t, float, bool);
+       virtual void end_drag ();
 
        ControlPoint* nth (uint32_t);
        uint32_t npoints() const { return control_points.size(); }
@@ -125,11 +126,14 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin
        bool is_first_point (ControlPoint &);
 
        XMLNode& get_state (void);
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version);
        void set_colors();
 
        void modify_point_y (ControlPoint&, double);
 
+       void add_always_in_view (double);
+       void clear_always_in_view ();
+
   protected:
 
        std::string    _name;
@@ -164,31 +168,33 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin
        static bool invalid_point (ALPoints&, uint32_t index);
 
        void determine_visible_control_points (ALPoints&);
-       void sync_model_with_view_point (ControlPoint&, bool did_push, int64_t distance);
-       void sync_model_with_view_line (uint32_t, uint32_t);
+       void sync_model_with_view_point (ControlPoint&, bool, int64_t);
+       void sync_model_with_view_points (std::list<ControlPoint*>, bool, int64_t);
+       void start_drag_common (nframes_t, float);
 
        virtual void change_model (ARDOUR::AutomationList::iterator, double x, double y);
 
        void reset_callback (const Evoral::ControlList&);
        void list_changed ();
+       PBD::ScopedConnection _state_connection;
 
        virtual bool event_handler (GdkEvent*);
        virtual void add_model_point (ALPoints& tmp_points, double frame, double yfract);
 
   private:
-       uint32_t drags;
-       double   first_drag_fraction;
-       double   last_drag_fraction;
-       uint32_t line_drag_cp1;
-       uint32_t line_drag_cp2;
-       int64_t  drag_x;
-       int64_t  drag_distance;
+       std::list<ControlPoint*> _drag_points; ///< points we are dragging
+       bool _drag_had_movement; ///< true if the drag has seen movement, otherwise false
+       nframes64_t drag_x; ///< last x position of the drag, in frames
+       nframes64_t drag_distance; ///< total x movement of the drag, in frames
+       double _last_drag_fraction; ///< last y position of the drag, as a fraction
+       std::list<double> _always_in_view;
 
        const Evoral::TimeConverter<double, ARDOUR::sframes_t>& _time_converter;
        ARDOUR::AutomationList::InterpolationStyle              _interpolation;
 
-       void modify_view_point (ControlPoint&, double, double, bool with_push);
+       void modify_view_point (ControlPoint&, double, double, bool, bool with_push);
        void reset_line_coords (ControlPoint&);
+       void add_visible_control_point (uint32_t, uint32_t, double, double, ARDOUR::AutomationList::iterator, uint32_t);
 
        double control_point_box_size ();