2 Copyright (C) 2009 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __gtk2_ardour_editor_drag_h_
21 #define __gtk2_ardour_editor_drag_h_
28 #include "ardour/types.h"
30 #include "editor_items.h"
37 class StatefulDiffCommand;
44 class MidiTimeAxisView;
48 /** Class to manage current drags */
53 DragManager (Editor* e);
56 bool motion_handler (GdkEvent *, bool);
60 void set (Drag *, GdkEvent *, Gdk::Cursor* c = 0);
61 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
62 bool end_grab (GdkEvent *);
63 bool have_item (ArdourCanvas::Item *) const;
65 void mark_double_click ();
67 /** @return true if an end drag or abort is in progress */
68 bool ending () const {
72 bool active () const {
73 return !_drags.empty ();
76 /** @return current pointer x position in canvas coordinates */
77 double current_pointer_x () const {
78 return _current_pointer_x;
81 /** @return current pointer y position in canvas coordinates */
82 double current_pointer_y () const {
83 return _current_pointer_y;
86 /** @return current pointer frame */
87 ARDOUR::framepos_t current_pointer_frame () const {
88 return _current_pointer_frame;
93 std::list<Drag*> _drags;
94 bool _ending; ///< true if end_grab or abort is in progress, otherwise false
95 double _current_pointer_x; ///< canvas-coordinate space x of the current pointer
96 double _current_pointer_y; ///< canvas-coordinate space y of the current pointer
97 ARDOUR::framepos_t _current_pointer_frame; ///< frame that the pointer is now at
98 bool _old_follow_playhead; ///< state of Editor::follow_playhead() before the drags started
101 /** Abstract base class for dragging of things within the editor */
105 Drag (Editor *, ArdourCanvas::Item *, bool trackview_only = true);
108 void set_manager (DragManager* m) {
112 /** @return the canvas item being dragged */
113 ArdourCanvas::Item* item () const {
117 void swap_grab (ArdourCanvas::Item *, Gdk::Cursor *, uint32_t);
118 bool motion_handler (GdkEvent*, bool);
121 ARDOUR::framepos_t adjusted_frame (ARDOUR::framepos_t, GdkEvent const *, bool snap = true) const;
122 ARDOUR::framepos_t adjusted_current_frame (GdkEvent const *, bool snap = true) const;
124 bool was_double_click() const { return _was_double_click; }
125 void set_double_click (bool yn) { _was_double_click = yn; }
127 /** Called to start a grab of an item.
128 * @param e Event that caused the grab to start.
129 * @param c Cursor to use, or 0.
131 virtual void start_grab (GdkEvent* e, Gdk::Cursor* c = 0);
133 virtual bool end_grab (GdkEvent *);
135 /** Called when a drag motion has occurred.
136 * @param e Event describing the motion.
137 * @param f true if this is the first movement, otherwise false.
139 virtual void motion (GdkEvent* e, bool f) = 0;
141 /** Called when a drag has finished.
142 * @param e Event describing the finish.
143 * @param m true if some movement occurred, otherwise false.
145 virtual void finished (GdkEvent* e, bool m) = 0;
147 /** Called to abort a drag and return things to how
148 * they were before it started.
149 * @param m true if some movement occurred, otherwise false.
151 virtual void aborted (bool m) = 0;
153 /** @param m Mouse mode.
154 * @return true if this drag should happen in this mouse mode.
156 virtual bool active (Editing::MouseMode m) {
157 return (m != Editing::MouseGain);
160 /** @return minimum number of frames (in x) and pixels (in y) that should be considered a movement */
161 virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
162 return std::make_pair (1, 1);
165 virtual bool allow_vertical_autoscroll () const {
169 /** @return true if x movement matters to this drag */
170 virtual bool x_movement_matters () const {
174 /** @return true if y movement matters to this drag */
175 virtual bool y_movement_matters () const {
179 /** Set up the _pointer_frame_offset */
180 virtual void setup_pointer_frame_offset () {
181 _pointer_frame_offset = 0;
186 double grab_x () const {
190 double grab_y () const {
194 ARDOUR::framepos_t raw_grab_frame () const {
195 return _raw_grab_frame;
198 ARDOUR::framepos_t grab_frame () const {
202 double last_pointer_x () const {
203 return _last_pointer_x;
206 double last_pointer_y () const {
207 return _last_pointer_y;
210 double last_pointer_frame () const {
211 return _last_pointer_frame;
214 double current_pointer_y () const;
216 boost::shared_ptr<ARDOUR::Region> add_midi_region (MidiTimeAxisView*);
218 void show_verbose_cursor_time (framepos_t);
219 void show_verbose_cursor_duration (framepos_t, framepos_t, double xoffset = 0);
220 void show_verbose_cursor_text (std::string const &);
222 Editor* _editor; ///< our editor
224 ArdourCanvas::Item* _item; ///< our item
225 /** Offset from the mouse's position for the drag to the start of the thing that is being dragged */
226 ARDOUR::framecnt_t _pointer_frame_offset;
227 bool _x_constrained; ///< true if x motion is constrained, otherwise false
228 bool _y_constrained; ///< true if y motion is constrained, otherwise false
229 bool _was_rolling; ///< true if the session was rolling before the drag started, otherwise false
232 bool _trackview_only; ///< true if pointer y value should always be relative to the top of the trackview group
233 bool _move_threshold_passed; ///< true if the move threshold has been passed, otherwise false
234 bool _was_double_click; ///< true if drag initiated by a double click event
235 double _grab_x; ///< trackview x of the grab start position
236 double _grab_y; ///< y of the grab start position, possibly adjusted if _trackview_only is true
237 double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred
238 double _last_pointer_y; ///< trackview y of the pointer last time a motion occurred
239 ARDOUR::framepos_t _raw_grab_frame; ///< unsnapped frame that the mouse was at when start_grab was called, or 0
240 ARDOUR::framepos_t _grab_frame; ///< adjusted_frame that the mouse was at when start_grab was called, or 0
241 ARDOUR::framepos_t _last_pointer_frame; ///< adjusted_frame the last time a motion occurred
246 /** Container for details about a region being dragged */
250 DraggingView (RegionView *, RegionDrag *);
252 RegionView* view; ///< the view
253 /** index into RegionDrag::_time_axis_views of the view that this region is currently being displayed on,
254 * or -1 if it is not visible.
257 /** layer that this region is currently being displayed on. This is a double
258 rather than a layer_t as we use fractional layers during drags to allow the user
259 to indicate a new layer to put a region on.
262 double initial_y; ///< the initial y position of the view before any reparenting
263 framepos_t initial_position; ///< initial position of the region
264 framepos_t initial_end; ///< initial end position of the region
265 framepos_t anchored_fade_length; ///< fade_length when anchored during drag
266 boost::shared_ptr<ARDOUR::Playlist> initial_playlist;
269 /** Abstract base class for drags that involve region(s) */
270 class RegionDrag : public Drag, public sigc::trackable
273 RegionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
274 virtual ~RegionDrag () {}
278 RegionView* _primary; ///< the view that was clicked on (or whatever) to start the drag
279 std::list<DraggingView> _views; ///< information about all views that are being dragged
281 /** a list of the non-hidden TimeAxisViews sorted by editor order key */
282 std::vector<TimeAxisView*> _time_axis_views;
283 int find_time_axis_view (TimeAxisView *) const;
288 friend class DraggingView;
292 void region_going_away (RegionView *);
293 PBD::ScopedConnection death_connection;
297 /** Drags involving region motion from somewhere */
298 class RegionMotionDrag : public RegionDrag
302 RegionMotionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &, bool);
303 virtual ~RegionMotionDrag () {}
305 virtual void start_grab (GdkEvent *, Gdk::Cursor *);
306 virtual void motion (GdkEvent *, bool);
307 virtual void finished (GdkEvent *, bool);
308 virtual void aborted (bool);
310 /** @return true if the regions being `moved' came from somewhere on the canvas;
311 * false if they came from outside (e.g. from the region list).
313 virtual bool regions_came_from_canvas () const = 0;
317 double compute_x_delta (GdkEvent const *, ARDOUR::framepos_t *);
318 bool y_movement_allowed (int, double) const;
321 ARDOUR::framepos_t _last_frame_position; ///< last position of the thing being dragged
322 double _total_x_delta;
323 int _last_pointer_time_axis_view;
324 double _last_pointer_layer;
328 /** Drags to move (or copy) regions that are already shown in the GUI to
329 * somewhere different.
331 class RegionMoveDrag : public RegionMotionDrag
334 RegionMoveDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &, bool, bool);
335 virtual ~RegionMoveDrag () {}
337 void motion (GdkEvent *, bool);
338 void finished (GdkEvent *, bool);
341 bool regions_came_from_canvas () const {
345 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
346 return std::make_pair (4, 4);
349 void setup_pointer_frame_offset ();
352 typedef std::set<boost::shared_ptr<ARDOUR::Playlist> > PlaylistSet;
354 void finished_no_copy (
357 ARDOUR::framecnt_t const
363 ARDOUR::framecnt_t const
366 RegionView* insert_region_into_playlist (
367 boost::shared_ptr<ARDOUR::Region>,
374 void remove_region_from_playlist (
375 boost::shared_ptr<ARDOUR::Region>,
376 boost::shared_ptr<ARDOUR::Playlist>,
377 PlaylistSet& modified_playlists
380 void add_stateful_diff_commands_for_playlists (PlaylistSet const &);
382 void collect_new_region_view (RegionView *);
383 RouteTimeAxisView* create_destination_time_axis (boost::shared_ptr<ARDOUR::Region>);
386 RegionView* _new_region_view;
389 /** Drag to insert a region from somewhere */
390 class RegionInsertDrag : public RegionMotionDrag
393 RegionInsertDrag (Editor *, boost::shared_ptr<ARDOUR::Region>, RouteTimeAxisView*, ARDOUR::framepos_t);
395 void finished (GdkEvent *, bool);
398 bool regions_came_from_canvas () const {
403 /** Region drag in splice mode */
404 class RegionSpliceDrag : public RegionMoveDrag
407 RegionSpliceDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
409 void motion (GdkEvent *, bool);
410 void finished (GdkEvent *, bool);
414 /** Drags to create regions */
415 class RegionCreateDrag : public Drag
418 RegionCreateDrag (Editor *, ArdourCanvas::Item *, TimeAxisView *);
420 void motion (GdkEvent *, bool);
421 void finished (GdkEvent *, bool);
425 MidiTimeAxisView* _view;
426 boost::shared_ptr<ARDOUR::Region> _region;
429 /** Drags to resize MIDI notes */
430 class NoteResizeDrag : public Drag
433 NoteResizeDrag (Editor *, ArdourCanvas::Item *);
435 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
436 void motion (GdkEvent *, bool);
437 void finished (GdkEvent *, bool);
441 MidiRegionView* region;
446 /** Drags to move MIDI notes */
447 class NoteDrag : public Drag
450 NoteDrag (Editor*, ArdourCanvas::Item*);
452 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
453 void motion (GdkEvent *, bool);
454 void finished (GdkEvent *, bool);
459 ARDOUR::frameoffset_t total_dx () const;
460 int8_t total_dy () const;
462 MidiRegionView* _region;
464 double _cumulative_dx;
465 double _cumulative_dy;
470 class NoteCreateDrag : public Drag
473 NoteCreateDrag (Editor *, ArdourCanvas::Item *, MidiRegionView *);
476 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
477 void motion (GdkEvent *, bool);
478 void finished (GdkEvent *, bool);
482 double y_to_region (double) const;
483 framecnt_t grid_frames (framepos_t) const;
485 MidiRegionView* _region_view;
486 ArdourCanvas::Rectangle* _drag_rect;
490 /** Drag to move MIDI patch changes */
491 class PatchChangeDrag : public Drag
494 PatchChangeDrag (Editor *, PatchChange *, MidiRegionView *);
496 void motion (GdkEvent *, bool);
497 void finished (GdkEvent *, bool);
500 bool y_movement_matters () const {
504 void setup_pointer_frame_offset ();
507 MidiRegionView* _region_view;
508 PatchChange* _patch_change;
509 double _cumulative_dx;
512 /** Container for details about audio regions being dragged along with video */
516 AVDraggingView (RegionView *);
518 RegionView* view; ///< the view
519 framepos_t initial_position; ///< initial position of the region
522 /** Drag of video offset */
523 class VideoTimeLineDrag : public Drag
526 VideoTimeLineDrag (Editor *e, ArdourCanvas::Item *i);
528 void motion (GdkEvent *, bool);
529 void finished (GdkEvent *, bool);
530 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
532 bool y_movement_matters () const {
536 bool allow_vertical_autoscroll () const {
543 std::list<AVDraggingView> _views; ///< information about all audio that are being dragged along
546 ARDOUR::frameoffset_t _startdrag_video_offset;
547 ARDOUR::frameoffset_t _max_backwards_drag;
550 /** Drag to trim region(s) */
551 class TrimDrag : public RegionDrag
560 TrimDrag (Editor *, ArdourCanvas::Item *, RegionView*, std::list<RegionView*> const &, bool preserve_fade_anchor = false);
562 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
563 void motion (GdkEvent *, bool);
564 void finished (GdkEvent *, bool);
567 bool y_movement_matters () const {
571 void setup_pointer_frame_offset ();
575 Operation _operation;
577 bool _preserve_fade_anchor;
578 bool _jump_position_when_done;
581 /** Meter marker drag */
582 class MeterMarkerDrag : public Drag
585 MeterMarkerDrag (Editor *, ArdourCanvas::Item *, bool);
587 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
588 void motion (GdkEvent *, bool);
589 void finished (GdkEvent *, bool);
592 bool allow_vertical_autoscroll () const {
596 bool y_movement_matters () const {
600 void setup_pointer_frame_offset ();
603 MeterMarker* _marker;
605 XMLNode* before_state;
608 /** Tempo marker drag */
609 class TempoMarkerDrag : public Drag
612 TempoMarkerDrag (Editor *, ArdourCanvas::Item *, bool);
614 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
615 void motion (GdkEvent *, bool);
616 void finished (GdkEvent *, bool);
619 bool allow_vertical_autoscroll () const {
623 bool y_movement_matters () const {
627 void setup_pointer_frame_offset ();
630 TempoMarker* _marker;
632 XMLNode* before_state;
636 /** Drag of the playhead cursor */
637 class CursorDrag : public Drag
640 CursorDrag (Editor *, EditorCursor&, bool);
642 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
643 void motion (GdkEvent *, bool);
644 void finished (GdkEvent *, bool);
647 bool active (Editing::MouseMode) {
651 bool allow_vertical_autoscroll () const {
655 bool y_movement_matters () const {
660 void fake_locate (framepos_t);
662 EditorCursor& _cursor;
663 bool _stop; ///< true to stop the transport on starting the drag, otherwise false
664 double _grab_zoom; ///< editor frames per unit when our grab started
667 /** Region fade-in drag */
668 class FadeInDrag : public RegionDrag
671 FadeInDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
673 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
674 void motion (GdkEvent *, bool);
675 void finished (GdkEvent *, bool);
678 bool y_movement_matters () const {
682 void setup_pointer_frame_offset ();
685 /** Region fade-out drag */
686 class FadeOutDrag : public RegionDrag
689 FadeOutDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
691 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
692 void motion (GdkEvent *, bool);
693 void finished (GdkEvent *, bool);
696 bool y_movement_matters () const {
700 void setup_pointer_frame_offset ();
704 class MarkerDrag : public Drag
707 MarkerDrag (Editor *, ArdourCanvas::Item *);
710 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
711 void motion (GdkEvent *, bool);
712 void finished (GdkEvent *, bool);
715 bool allow_vertical_autoscroll () const {
719 bool y_movement_matters () const {
723 void setup_pointer_frame_offset ();
726 void update_item (ARDOUR::Location *);
728 Marker* _marker; ///< marker being dragged
730 struct CopiedLocationMarkerInfo {
731 ARDOUR::Location* location;
732 std::vector<Marker*> markers;
734 CopiedLocationMarkerInfo (ARDOUR::Location* l, Marker* m);
737 typedef std::list<CopiedLocationMarkerInfo> CopiedLocationInfo;
738 CopiedLocationInfo _copied_locations;
739 ArdourCanvas::Points _points;
742 /** Control point drag */
743 class ControlPointDrag : public Drag
746 ControlPointDrag (Editor *, ArdourCanvas::Item *);
748 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
749 void motion (GdkEvent *, bool);
750 void finished (GdkEvent *, bool);
753 bool active (Editing::MouseMode m);
757 ControlPoint* _point;
758 double _fixed_grab_x;
759 double _fixed_grab_y;
760 double _cumulative_x_drag;
761 double _cumulative_y_drag;
763 uint32_t _final_index;
764 static double _zero_gain_fraction;
767 /** Gain or automation line drag */
768 class LineDrag : public Drag
771 LineDrag (Editor *e, ArdourCanvas::Item *i);
773 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
774 void motion (GdkEvent *, bool);
775 void finished (GdkEvent *, bool);
778 bool active (Editing::MouseMode) {
784 AutomationLine* _line;
785 double _fixed_grab_x;
786 double _fixed_grab_y;
789 double _cumulative_y_drag;
792 /** Transient feature line drags*/
793 class FeatureLineDrag : public Drag
796 FeatureLineDrag (Editor *e, ArdourCanvas::Item *i);
798 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
799 void motion (GdkEvent *, bool);
800 void finished (GdkEvent *, bool);
803 bool active (Editing::MouseMode) {
809 ArdourCanvas::Line* _line;
810 AudioRegionView* _arv;
812 double _region_view_grab_x;
813 double _cumulative_x_drag;
819 /** Dragging of a rubberband rectangle for selecting things */
820 class RubberbandSelectDrag : public Drag
823 RubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
825 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
826 void motion (GdkEvent *, bool);
827 void finished (GdkEvent *, bool);
830 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
831 return std::make_pair (8, 1);
834 void do_select_things (GdkEvent *, bool);
836 /** Select some things within a rectangle.
837 * @param button_state The button state from the GdkEvent.
838 * @param x1 The left-hand side of the rectangle in session frames.
839 * @param x2 The right-hand side of the rectangle in session frames.
840 * @param y1 The top of the rectangle in trackview coordinates.
841 * @param y2 The bottom of the rectangle in trackview coordinates.
842 * @param drag_in_progress true if the drag is currently happening.
844 virtual void select_things (int button_state, framepos_t x1, framepos_t x2, double y1, double y2, bool drag_in_progress) = 0;
846 virtual void deselect_things () = 0;
852 /** A general editor RubberbandSelectDrag (for regions, automation points etc.) */
853 class EditorRubberbandSelectDrag : public RubberbandSelectDrag
856 EditorRubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
858 void select_things (int, framepos_t, framepos_t, double, double, bool);
859 void deselect_things ();
862 /** A RubberbandSelectDrag for selecting MIDI notes */
863 class MidiRubberbandSelectDrag : public RubberbandSelectDrag
866 MidiRubberbandSelectDrag (Editor *, MidiRegionView *);
868 void select_things (int, framepos_t, framepos_t, double, double, bool);
869 void deselect_things ();
872 MidiRegionView* _region_view;
875 /** A RubberbandSelectDrag for selecting MIDI notes but with no horizonal component */
876 class MidiVerticalSelectDrag : public RubberbandSelectDrag
879 MidiVerticalSelectDrag (Editor *, MidiRegionView *);
881 void select_things (int, framepos_t, framepos_t, double, double, bool);
882 void deselect_things ();
885 MidiRegionView* _region_view;
888 /** Region drag in time-FX mode */
889 class TimeFXDrag : public RegionDrag
892 TimeFXDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
894 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
895 void motion (GdkEvent *, bool);
896 void finished (GdkEvent *, bool);
900 /** Scrub drag in audition mode */
901 class ScrubDrag : public Drag
904 ScrubDrag (Editor *, ArdourCanvas::Item *);
906 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
907 void motion (GdkEvent *, bool);
908 void finished (GdkEvent *, bool);
912 /** Drag in range select mode */
913 class SelectionDrag : public Drag
924 SelectionDrag (Editor *, ArdourCanvas::Item *, Operation);
926 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
927 void motion (GdkEvent *, bool);
928 void finished (GdkEvent *, bool);
931 void setup_pointer_frame_offset ();
934 Operation _operation;
937 int _original_pointer_time_axis;
938 int _last_pointer_time_axis;
939 std::list<TimeAxisView*> _added_time_axes;
940 bool _time_selection_at_start;
941 framepos_t start_at_start;
942 framepos_t end_at_start;
945 /** Range marker drag */
946 class RangeMarkerBarDrag : public Drag
951 CreateTransportMarker,
955 RangeMarkerBarDrag (Editor *, ArdourCanvas::Item *, Operation);
957 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
958 void motion (GdkEvent *, bool);
959 void finished (GdkEvent *, bool);
962 bool allow_vertical_autoscroll () const {
966 bool y_movement_matters () const {
971 void update_item (ARDOUR::Location *);
973 Operation _operation;
974 ArdourCanvas::Rectangle* _drag_rect;
978 /** Drag of rectangle to set zoom */
979 class MouseZoomDrag : public Drag
982 MouseZoomDrag (Editor *, ArdourCanvas::Item *);
984 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
985 void motion (GdkEvent *, bool);
986 void finished (GdkEvent *, bool);
989 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
990 return std::make_pair (4, 4);
997 /** Drag of a range of automation data (either on an automation track or region gain),
998 * changing value but not position.
1000 class AutomationRangeDrag : public Drag
1003 AutomationRangeDrag (Editor *, AutomationTimeAxisView *, std::list<ARDOUR::AudioRange> const &);
1004 AutomationRangeDrag (Editor *, AudioRegionView *, std::list<ARDOUR::AudioRange> const &);
1006 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
1007 void motion (GdkEvent *, bool);
1008 void finished (GdkEvent *, bool);
1009 void aborted (bool);
1011 bool x_movement_matters () const {
1015 bool active (Editing::MouseMode) {
1020 void setup (std::list<boost::shared_ptr<AutomationLine> > const &);
1021 double y_fraction (boost::shared_ptr<AutomationLine>, double global_y_position) const;
1023 std::list<ARDOUR::AudioRange> _ranges;
1025 /** A line that is part of the drag */
1027 boost::shared_ptr<AutomationLine> line; ///< the line
1028 std::list<ControlPoint*> points; ///< points to drag on the line
1029 std::pair<ARDOUR::framepos_t, ARDOUR::framepos_t> range; ///< the range of all points on the line, in session frames
1030 XMLNode* state; ///< the XML state node before the drag
1031 double original_fraction; ///< initial y-fraction before the drag
1034 std::list<Line> _lines;
1036 bool _nothing_to_drag;
1039 /** Drag of one edge of an xfade
1041 class CrossfadeEdgeDrag : public Drag
1044 CrossfadeEdgeDrag (Editor*, AudioRegionView*, ArdourCanvas::Item*, bool start);
1046 void start_grab (GdkEvent*, Gdk::Cursor* c = 0);
1047 void motion (GdkEvent*, bool);
1048 void finished (GdkEvent*, bool);
1049 void aborted (bool);
1051 bool y_movement_matters () const {
1055 virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
1056 return std::make_pair (4, 4);
1060 AudioRegionView* arv;
1064 #endif /* __gtk2_ardour_editor_drag_h_ */