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);
57 bool window_motion_handler (GdkEvent *, bool);
61 void set (Drag *, GdkEvent *, Gdk::Cursor* c = 0);
62 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
63 bool end_grab (GdkEvent *);
64 bool have_item (ArdourCanvas::Item *) const;
66 void mark_double_click ();
68 /** @return true if an end drag or abort is in progress */
69 bool ending () const {
73 bool active () const {
74 return !_drags.empty ();
77 /** @return current pointer x position in canvas coordinates */
78 double current_pointer_x () const {
79 return _current_pointer_x;
82 /** @return current pointer y position in canvas coordinates */
83 double current_pointer_y () const {
84 return _current_pointer_y;
87 /** @return current pointer frame */
88 ARDOUR::framepos_t current_pointer_frame () const {
89 return _current_pointer_frame;
94 std::list<Drag*> _drags;
95 bool _ending; ///< true if end_grab or abort is in progress, otherwise false
96 double _current_pointer_x; ///< canvas-coordinate space x of the current pointer
97 double _current_pointer_y; ///< canvas-coordinate space y of the current pointer
98 ARDOUR::framepos_t _current_pointer_frame; ///< frame that the pointer is now at
99 bool _old_follow_playhead; ///< state of Editor::follow_playhead() before the drags started
102 /** Abstract base class for dragging of things within the editor */
106 Drag (Editor *, ArdourCanvas::Item *);
109 void set_manager (DragManager* m) {
113 /** @return the canvas item being dragged */
114 ArdourCanvas::Item* item () const {
118 void swap_grab (ArdourCanvas::Item *, Gdk::Cursor *, uint32_t);
119 bool motion_handler (GdkEvent*, bool);
122 ARDOUR::framepos_t adjusted_frame (ARDOUR::framepos_t, GdkEvent const *, bool snap = true) const;
123 ARDOUR::framepos_t adjusted_current_frame (GdkEvent const *, bool snap = true) const;
125 bool was_double_click() const { return _was_double_click; }
126 void set_double_click (bool yn) { _was_double_click = yn; }
128 /** Called to start a grab of an item.
129 * @param e Event that caused the grab to start.
130 * @param c Cursor to use, or 0.
132 virtual void start_grab (GdkEvent* e, Gdk::Cursor* c = 0);
134 virtual bool end_grab (GdkEvent *);
136 /** Called when a drag motion has occurred.
137 * @param e Event describing the motion.
138 * @param f true if this is the first movement, otherwise false.
140 virtual void motion (GdkEvent* e, bool f) = 0;
142 /** Called when a drag has finished.
143 * @param e Event describing the finish.
144 * @param m true if some movement occurred, otherwise false.
146 virtual void finished (GdkEvent* e, bool m) = 0;
148 /** Called to abort a drag and return things to how
149 * they were before it started.
150 * @param m true if some movement occurred, otherwise false.
152 virtual void aborted (bool m) = 0;
154 /** @param m Mouse mode.
155 * @return true if this drag should happen in this mouse mode.
157 virtual bool active (Editing::MouseMode m) {
158 return (m != Editing::MouseGain);
161 /** @return minimum number of frames (in x) and pixels (in y) that should be considered a movement */
162 virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
163 return std::make_pair (1, 1);
166 virtual bool allow_vertical_autoscroll () const {
170 /** @return true if x movement matters to this drag */
171 virtual bool x_movement_matters () const {
175 /** @return true if y movement matters to this drag */
176 virtual bool y_movement_matters () const {
180 /** Set up the _pointer_frame_offset */
181 virtual void setup_pointer_frame_offset () {
182 _pointer_frame_offset = 0;
187 double grab_x () const {
191 double grab_y () const {
195 ARDOUR::framepos_t raw_grab_frame () const {
196 return _raw_grab_frame;
199 ARDOUR::framepos_t grab_frame () const {
203 double last_pointer_x () const {
204 return _last_pointer_x;
207 double last_pointer_y () const {
208 return _last_pointer_y;
211 double last_pointer_frame () const {
212 return _last_pointer_frame;
215 boost::shared_ptr<ARDOUR::Region> add_midi_region (MidiTimeAxisView*);
217 void show_verbose_cursor_time (framepos_t);
218 void show_verbose_cursor_duration (framepos_t, framepos_t, double xoffset = 0);
219 void show_verbose_cursor_text (std::string const &);
221 Editor* _editor; ///< our editor
223 ArdourCanvas::Item* _item; ///< our item
224 /** Offset from the mouse's position for the drag to the start of the thing that is being dragged */
225 ARDOUR::framecnt_t _pointer_frame_offset;
226 bool _x_constrained; ///< true if x motion is constrained, otherwise false
227 bool _y_constrained; ///< true if y motion is constrained, otherwise false
228 bool _was_rolling; ///< true if the session was rolling before the drag started, otherwise false
232 bool _move_threshold_passed; ///< true if the move threshold has been passed, otherwise false
233 bool _was_double_click; ///< true if drag initiated by a double click event
234 double _grab_x; ///< trackview x of the grab start position
235 double _grab_y; ///< trackview y of the grab start position
236 double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred
237 double _last_pointer_y; ///< trackview y of the pointer last time a motion occurred
238 ARDOUR::framepos_t _raw_grab_frame; ///< unsnapped frame that the mouse was at when start_grab was called, or 0
239 ARDOUR::framepos_t _grab_frame; ///< adjusted_frame that the mouse was at when start_grab was called, or 0
240 ARDOUR::framepos_t _last_pointer_frame; ///< adjusted_frame the last time a motion occurred
245 /** Container for details about a region being dragged */
249 DraggingView (RegionView *, RegionDrag *);
251 RegionView* view; ///< the view
252 /** index into RegionDrag::_time_axis_views of the view that this region is currently being displayed on,
253 * or -1 if it is not visible.
256 /** layer that this region is currently being displayed on. This is a double
257 rather than a layer_t as we use fractional layers during drags to allow the user
258 to indicate a new layer to put a region on.
261 double initial_y; ///< the initial y position of the view before any reparenting
262 framepos_t initial_position; ///< initial position of the region
263 framepos_t initial_end; ///< initial end position of the region
264 boost::shared_ptr<ARDOUR::Playlist> initial_playlist;
267 /** Abstract base class for drags that involve region(s) */
268 class RegionDrag : public Drag, public sigc::trackable
271 RegionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
272 virtual ~RegionDrag () {}
276 RegionView* _primary; ///< the view that was clicked on (or whatever) to start the drag
277 std::list<DraggingView> _views; ///< information about all views that are being dragged
279 /** a list of the non-hidden TimeAxisViews sorted by editor order key */
280 std::vector<TimeAxisView*> _time_axis_views;
281 int find_time_axis_view (TimeAxisView *) const;
286 friend class DraggingView;
290 void region_going_away (RegionView *);
291 PBD::ScopedConnection death_connection;
295 /** Drags involving region motion from somewhere */
296 class RegionMotionDrag : public RegionDrag
300 RegionMotionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &, bool);
301 virtual ~RegionMotionDrag () {}
303 virtual void start_grab (GdkEvent *, Gdk::Cursor *);
304 virtual void motion (GdkEvent *, bool);
305 virtual void finished (GdkEvent *, bool);
306 virtual void aborted (bool);
308 /** @return true if the regions being `moved' came from somewhere on the canvas;
309 * false if they came from outside (e.g. from the region list).
311 virtual bool regions_came_from_canvas () const = 0;
315 double compute_x_delta (GdkEvent const *, ARDOUR::framepos_t *);
316 bool y_movement_allowed (int, double) const;
319 ARDOUR::framepos_t _last_frame_position; ///< last position of the thing being dragged
320 double _total_x_delta;
321 int _last_pointer_time_axis_view;
322 double _last_pointer_layer;
326 /** Drags to move (or copy) regions that are already shown in the GUI to
327 * somewhere different.
329 class RegionMoveDrag : public RegionMotionDrag
332 RegionMoveDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &, bool, bool);
333 virtual ~RegionMoveDrag () {}
335 void motion (GdkEvent *, bool);
336 void finished (GdkEvent *, bool);
339 bool regions_came_from_canvas () const {
343 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
344 return std::make_pair (4, 4);
347 void setup_pointer_frame_offset ();
350 typedef std::set<boost::shared_ptr<ARDOUR::Playlist> > PlaylistSet;
352 void finished_no_copy (
355 ARDOUR::framecnt_t const
361 ARDOUR::framecnt_t const
364 RegionView* insert_region_into_playlist (
365 boost::shared_ptr<ARDOUR::Region>,
372 void remove_region_from_playlist (
373 boost::shared_ptr<ARDOUR::Region>,
374 boost::shared_ptr<ARDOUR::Playlist>,
375 PlaylistSet& modified_playlists
378 void add_stateful_diff_commands_for_playlists (PlaylistSet const &);
380 void collect_new_region_view (RegionView *);
381 RouteTimeAxisView* create_destination_time_axis (boost::shared_ptr<ARDOUR::Region>);
384 RegionView* _new_region_view;
387 /** Drag to insert a region from somewhere */
388 class RegionInsertDrag : public RegionMotionDrag
391 RegionInsertDrag (Editor *, boost::shared_ptr<ARDOUR::Region>, RouteTimeAxisView*, ARDOUR::framepos_t);
393 void finished (GdkEvent *, bool);
396 bool regions_came_from_canvas () const {
401 /** Region drag in splice mode */
402 class RegionSpliceDrag : public RegionMoveDrag
405 RegionSpliceDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
407 void motion (GdkEvent *, bool);
408 void finished (GdkEvent *, bool);
412 /** Drags to create regions */
413 class RegionCreateDrag : public Drag
416 RegionCreateDrag (Editor *, ArdourCanvas::Item *, TimeAxisView *);
418 void motion (GdkEvent *, bool);
419 void finished (GdkEvent *, bool);
423 MidiTimeAxisView* _view;
424 boost::shared_ptr<ARDOUR::Region> _region;
427 /** Drags to resize MIDI notes */
428 class NoteResizeDrag : public Drag
431 NoteResizeDrag (Editor *, ArdourCanvas::Item *);
433 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
434 void motion (GdkEvent *, bool);
435 void finished (GdkEvent *, bool);
439 MidiRegionView* region;
444 /** Drags to move MIDI notes */
445 class NoteDrag : public Drag
448 NoteDrag (Editor*, ArdourCanvas::Item*);
450 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
451 void motion (GdkEvent *, bool);
452 void finished (GdkEvent *, bool);
457 ARDOUR::frameoffset_t total_dx () const;
458 int8_t total_dy () const;
460 MidiRegionView* _region;
462 double _cumulative_dx;
463 double _cumulative_dy;
468 class NoteCreateDrag : public Drag
471 NoteCreateDrag (Editor *, ArdourCanvas::Item *, MidiRegionView *);
474 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
475 void motion (GdkEvent *, bool);
476 void finished (GdkEvent *, bool);
480 double y_to_region (double) const;
481 framecnt_t grid_frames (framepos_t) const;
483 MidiRegionView* _region_view;
484 ArdourCanvas::Rectangle* _drag_rect;
488 /** Drag to move MIDI patch changes */
489 class PatchChangeDrag : public Drag
492 PatchChangeDrag (Editor *, PatchChange *, MidiRegionView *);
494 void motion (GdkEvent *, bool);
495 void finished (GdkEvent *, bool);
498 bool y_movement_matters () const {
502 void setup_pointer_frame_offset ();
505 MidiRegionView* _region_view;
506 PatchChange* _patch_change;
507 double _cumulative_dx;
510 /** Container for details about audio regions being dragged along with video */
514 AVDraggingView (RegionView *);
516 RegionView* view; ///< the view
517 framepos_t initial_position; ///< initial position of the region
520 /** Drag of video offset */
521 class VideoTimeLineDrag : public Drag
524 VideoTimeLineDrag (Editor *e, ArdourCanvas::Item *i);
526 void motion (GdkEvent *, bool);
527 void finished (GdkEvent *, bool);
528 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
530 bool y_movement_matters () const {
534 bool allow_vertical_autoscroll () const {
541 std::list<AVDraggingView> _views; ///< information about all audio that are being dragged along
544 ARDOUR::frameoffset_t _startdrag_video_offset;
545 ARDOUR::frameoffset_t _max_backwards_drag;
548 /** Drag to trim region(s) */
549 class TrimDrag : public RegionDrag
558 TrimDrag (Editor *, ArdourCanvas::Item *, RegionView*, std::list<RegionView*> const &, bool preserve_fade_anchor = false);
560 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
561 void motion (GdkEvent *, bool);
562 void finished (GdkEvent *, bool);
565 bool y_movement_matters () const {
569 void setup_pointer_frame_offset ();
573 Operation _operation;
575 bool _preserve_fade_anchor;
576 bool _jump_position_when_done;
579 /** Meter marker drag */
580 class MeterMarkerDrag : public Drag
583 MeterMarkerDrag (Editor *, ArdourCanvas::Item *, bool);
585 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
586 void motion (GdkEvent *, bool);
587 void finished (GdkEvent *, bool);
590 bool allow_vertical_autoscroll () const {
594 bool y_movement_matters () const {
598 void setup_pointer_frame_offset ();
601 MeterMarker* _marker;
603 XMLNode* before_state;
606 /** Tempo marker drag */
607 class TempoMarkerDrag : public Drag
610 TempoMarkerDrag (Editor *, ArdourCanvas::Item *, bool);
612 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
613 void motion (GdkEvent *, bool);
614 void finished (GdkEvent *, bool);
617 bool allow_vertical_autoscroll () const {
621 bool y_movement_matters () const {
625 void setup_pointer_frame_offset ();
628 TempoMarker* _marker;
630 XMLNode* before_state;
634 /** Drag of the playhead cursor */
635 class CursorDrag : public Drag
638 CursorDrag (Editor *, EditorCursor&, bool);
640 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
641 void motion (GdkEvent *, bool);
642 void finished (GdkEvent *, bool);
645 bool active (Editing::MouseMode) {
649 bool allow_vertical_autoscroll () const {
653 bool y_movement_matters () const {
658 void fake_locate (framepos_t);
660 EditorCursor& _cursor;
661 bool _stop; ///< true to stop the transport on starting the drag, otherwise false
662 double _grab_zoom; ///< editor frames per unit when our grab started
665 /** Region fade-in drag */
666 class FadeInDrag : public RegionDrag
669 FadeInDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
671 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
672 void motion (GdkEvent *, bool);
673 void finished (GdkEvent *, bool);
676 bool y_movement_matters () const {
680 void setup_pointer_frame_offset ();
683 /** Region fade-out drag */
684 class FadeOutDrag : public RegionDrag
687 FadeOutDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
689 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
690 void motion (GdkEvent *, bool);
691 void finished (GdkEvent *, bool);
694 bool y_movement_matters () const {
698 void setup_pointer_frame_offset ();
702 class MarkerDrag : public Drag
705 MarkerDrag (Editor *, ArdourCanvas::Item *);
708 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
709 void motion (GdkEvent *, bool);
710 void finished (GdkEvent *, bool);
713 bool allow_vertical_autoscroll () const {
717 bool y_movement_matters () const {
721 void setup_pointer_frame_offset ();
724 void update_item (ARDOUR::Location *);
726 Marker* _marker; ///< marker being dragged
728 struct CopiedLocationMarkerInfo {
729 ARDOUR::Location* location;
730 std::vector<Marker*> markers;
732 CopiedLocationMarkerInfo (ARDOUR::Location* l, Marker* m);
735 typedef std::list<CopiedLocationMarkerInfo> CopiedLocationInfo;
736 CopiedLocationInfo _copied_locations;
737 ArdourCanvas::Points _points;
740 /** Control point drag */
741 class ControlPointDrag : public Drag
744 ControlPointDrag (Editor *, ArdourCanvas::Item *);
746 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
747 void motion (GdkEvent *, bool);
748 void finished (GdkEvent *, bool);
751 bool active (Editing::MouseMode m);
755 ControlPoint* _point;
756 double _fixed_grab_x;
757 double _fixed_grab_y;
758 double _cumulative_x_drag;
759 double _cumulative_y_drag;
761 uint32_t _final_index;
762 static double _zero_gain_fraction;
765 /** Gain or automation line drag */
766 class LineDrag : public Drag
769 LineDrag (Editor *e, ArdourCanvas::Item *i);
771 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
772 void motion (GdkEvent *, bool);
773 void finished (GdkEvent *, bool);
776 bool active (Editing::MouseMode) {
782 AutomationLine* _line;
783 double _fixed_grab_x;
784 double _fixed_grab_y;
787 double _cumulative_y_drag;
790 /** Transient feature line drags*/
791 class FeatureLineDrag : public Drag
794 FeatureLineDrag (Editor *e, ArdourCanvas::Item *i);
796 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
797 void motion (GdkEvent *, bool);
798 void finished (GdkEvent *, bool);
801 bool active (Editing::MouseMode) {
807 ArdourCanvas::Line* _line;
808 AudioRegionView* _arv;
810 double _region_view_grab_x;
811 double _cumulative_x_drag;
817 /** Dragging of a rubberband rectangle for selecting things */
818 class RubberbandSelectDrag : public Drag
821 RubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
823 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
824 void motion (GdkEvent *, bool);
825 void finished (GdkEvent *, bool);
828 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
829 return std::make_pair (8, 1);
832 void do_select_things (GdkEvent *, bool);
834 /** Select some things within a rectangle.
835 * @param button_state The button state from the GdkEvent.
836 * @param x1 The left-hand side of the rectangle in session frames.
837 * @param x2 The right-hand side of the rectangle in session frames.
838 * @param y1 The top of the rectangle in trackview coordinates.
839 * @param y2 The bottom of the rectangle in trackview coordinates.
840 * @param drag_in_progress true if the drag is currently happening.
842 virtual void select_things (int button_state, framepos_t x1, framepos_t x2, double y1, double y2, bool drag_in_progress) = 0;
844 virtual void deselect_things () = 0;
850 /** A general editor RubberbandSelectDrag (for regions, automation points etc.) */
851 class EditorRubberbandSelectDrag : public RubberbandSelectDrag
854 EditorRubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
856 void select_things (int, framepos_t, framepos_t, double, double, bool);
857 void deselect_things ();
860 /** A RubberbandSelectDrag for selecting MIDI notes */
861 class MidiRubberbandSelectDrag : public RubberbandSelectDrag
864 MidiRubberbandSelectDrag (Editor *, MidiRegionView *);
866 void select_things (int, framepos_t, framepos_t, double, double, bool);
867 void deselect_things ();
870 MidiRegionView* _region_view;
873 /** A RubberbandSelectDrag for selecting MIDI notes but with no horizonal component */
874 class MidiVerticalSelectDrag : public RubberbandSelectDrag
877 MidiVerticalSelectDrag (Editor *, MidiRegionView *);
879 void select_things (int, framepos_t, framepos_t, double, double, bool);
880 void deselect_things ();
883 MidiRegionView* _region_view;
886 /** Region drag in time-FX mode */
887 class TimeFXDrag : public RegionDrag
890 TimeFXDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
892 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
893 void motion (GdkEvent *, bool);
894 void finished (GdkEvent *, bool);
898 /** Scrub drag in audition mode */
899 class ScrubDrag : public Drag
902 ScrubDrag (Editor *, ArdourCanvas::Item *);
904 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
905 void motion (GdkEvent *, bool);
906 void finished (GdkEvent *, bool);
910 /** Drag in range select mode */
911 class SelectionDrag : public Drag
922 SelectionDrag (Editor *, ArdourCanvas::Item *, Operation);
924 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
925 void motion (GdkEvent *, bool);
926 void finished (GdkEvent *, bool);
929 void setup_pointer_frame_offset ();
932 Operation _operation;
935 int _original_pointer_time_axis;
936 int _last_pointer_time_axis;
937 std::list<TimeAxisView*> _added_time_axes;
938 bool _time_selection_at_start;
939 framepos_t start_at_start;
940 framepos_t end_at_start;
943 /** Range marker drag */
944 class RangeMarkerBarDrag : public Drag
949 CreateTransportMarker,
953 RangeMarkerBarDrag (Editor *, ArdourCanvas::Item *, Operation);
955 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
956 void motion (GdkEvent *, bool);
957 void finished (GdkEvent *, bool);
960 bool allow_vertical_autoscroll () const {
964 bool y_movement_matters () const {
969 void update_item (ARDOUR::Location *);
971 Operation _operation;
972 ArdourCanvas::Rectangle* _drag_rect;
976 /** Drag of rectangle to set zoom */
977 class MouseZoomDrag : public Drag
980 MouseZoomDrag (Editor *, ArdourCanvas::Item *);
982 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
983 void motion (GdkEvent *, bool);
984 void finished (GdkEvent *, bool);
987 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
988 return std::make_pair (4, 4);
995 /** Drag of a range of automation data (either on an automation track or region gain),
996 * changing value but not position.
998 class AutomationRangeDrag : public Drag
1001 AutomationRangeDrag (Editor *, AutomationTimeAxisView *, std::list<ARDOUR::AudioRange> const &);
1002 AutomationRangeDrag (Editor *, AudioRegionView *, std::list<ARDOUR::AudioRange> const &);
1004 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
1005 void motion (GdkEvent *, bool);
1006 void finished (GdkEvent *, bool);
1007 void aborted (bool);
1009 bool x_movement_matters () const {
1013 bool active (Editing::MouseMode) {
1018 void setup (std::list<boost::shared_ptr<AutomationLine> > const &);
1019 double y_fraction (boost::shared_ptr<AutomationLine>, double global_y_position) const;
1021 std::list<ARDOUR::AudioRange> _ranges;
1023 /** A line that is part of the drag */
1025 boost::shared_ptr<AutomationLine> line; ///< the line
1026 std::list<ControlPoint*> points; ///< points to drag on the line
1027 std::pair<ARDOUR::framepos_t, ARDOUR::framepos_t> range; ///< the range of all points on the line, in session frames
1028 XMLNode* state; ///< the XML state node before the drag
1029 double original_fraction; ///< initial y-fraction before the drag
1032 std::list<Line> _lines;
1034 bool _nothing_to_drag;
1037 /** Drag of one edge of an xfade
1039 class CrossfadeEdgeDrag : public Drag
1042 CrossfadeEdgeDrag (Editor*, AudioRegionView*, ArdourCanvas::Item*, bool start);
1044 void start_grab (GdkEvent*, Gdk::Cursor* c = 0);
1045 void motion (GdkEvent*, bool);
1046 void finished (GdkEvent*, bool);
1047 void aborted (bool);
1049 bool y_movement_matters () const {
1053 virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
1054 return std::make_pair (4, 4);
1058 AudioRegionView* arv;
1062 #endif /* __gtk2_ardour_editor_drag_h_ */