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) {
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_x () const;
215 double current_pointer_y () const;
217 boost::shared_ptr<ARDOUR::Region> add_midi_region (MidiTimeAxisView*);
219 void show_verbose_cursor_time (framepos_t);
220 void show_verbose_cursor_duration (framepos_t, framepos_t, double xoffset = 0);
221 void show_verbose_cursor_text (std::string const &);
223 Editor* _editor; ///< our editor
225 ArdourCanvas::Item* _item; ///< our item
226 /** Offset from the mouse's position for the drag to the start of the thing that is being dragged */
227 ARDOUR::framecnt_t _pointer_frame_offset;
228 bool _x_constrained; ///< true if x motion is constrained, otherwise false
229 bool _y_constrained; ///< true if y motion is constrained, otherwise false
230 bool _was_rolling; ///< true if the session was rolling before the drag started, otherwise false
233 bool _trackview_only; ///< true if pointer y value should always be relative to the top of the trackview group
234 bool _move_threshold_passed; ///< true if the move threshold has been passed, otherwise false
235 bool _was_double_click; ///< true if drag initiated by a double click event
236 double _grab_x; ///< trackview x of the grab start position
237 double _grab_y; ///< y of the grab start position, possibly adjusted if _trackview_only is true
238 double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred
239 double _last_pointer_y; ///< trackview y of the pointer last time a motion occurred
240 ARDOUR::framepos_t _raw_grab_frame; ///< unsnapped frame that the mouse was at when start_grab was called, or 0
241 ARDOUR::framepos_t _grab_frame; ///< adjusted_frame that the mouse was at when start_grab was called, or 0
242 ARDOUR::framepos_t _last_pointer_frame; ///< adjusted_frame the last time a motion occurred
247 /** Container for details about a region being dragged */
251 DraggingView (RegionView *, RegionDrag *, TimeAxisView* original_tav);
253 RegionView* view; ///< the view
254 /** index into RegionDrag::_time_axis_views of the view that this region is currently being displayed on,
255 * or -1 if it is not visible.
258 /** layer that this region is currently being displayed on. This is a double
259 rather than a layer_t as we use fractional layers during drags to allow the user
260 to indicate a new layer to put a region on.
263 double initial_y; ///< the initial y position of the view before any reparenting
264 framepos_t initial_position; ///< initial position of the region
265 framepos_t initial_end; ///< initial end position of the region
266 framepos_t anchored_fade_length; ///< fade_length when anchored during drag
267 boost::shared_ptr<ARDOUR::Playlist> initial_playlist;
268 TimeAxisView* initial_time_axis_view;
271 /** Abstract base class for drags that involve region(s) */
272 class RegionDrag : public Drag, public sigc::trackable
275 RegionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
276 virtual ~RegionDrag () {}
280 RegionView* _primary; ///< the view that was clicked on (or whatever) to start the drag
281 std::list<DraggingView> _views; ///< information about all views that are being dragged
283 /** a list of the non-hidden TimeAxisViews sorted by editor order key */
284 std::vector<TimeAxisView*> _time_axis_views;
285 int find_time_axis_view (TimeAxisView *) const;
290 friend class DraggingView;
294 void region_going_away (RegionView *);
295 PBD::ScopedConnection death_connection;
299 /** Drags involving region motion from somewhere */
300 class RegionMotionDrag : public RegionDrag
304 RegionMotionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &, bool);
305 virtual ~RegionMotionDrag () {}
307 virtual void start_grab (GdkEvent *, Gdk::Cursor *);
308 virtual void motion (GdkEvent *, bool);
309 virtual void finished (GdkEvent *, bool);
310 virtual void aborted (bool);
312 /** @return true if the regions being `moved' came from somewhere on the canvas;
313 * false if they came from outside (e.g. from the region list).
315 virtual bool regions_came_from_canvas () const = 0;
319 double compute_x_delta (GdkEvent const *, ARDOUR::framepos_t *);
320 virtual bool y_movement_allowed (int, double) const;
323 ARDOUR::framepos_t _last_frame_position; ///< last position of the thing being dragged
324 double _total_x_delta;
325 int _last_pointer_time_axis_view;
326 double _last_pointer_layer;
330 /** Drags to move (or copy) regions that are already shown in the GUI to
331 * somewhere different.
333 class RegionMoveDrag : public RegionMotionDrag
336 RegionMoveDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &, bool, bool);
337 virtual ~RegionMoveDrag () {}
339 void motion (GdkEvent *, bool);
340 void finished (GdkEvent *, bool);
343 bool regions_came_from_canvas () const {
347 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
348 return std::make_pair (4, 4);
351 void setup_pointer_frame_offset ();
354 typedef std::set<boost::shared_ptr<ARDOUR::Playlist> > PlaylistSet;
355 void add_stateful_diff_commands_for_playlists (PlaylistSet const &);
358 void finished_no_copy (
361 ARDOUR::framecnt_t const
367 ARDOUR::framecnt_t const
370 RegionView* insert_region_into_playlist (
371 boost::shared_ptr<ARDOUR::Region>,
378 void remove_region_from_playlist (
379 boost::shared_ptr<ARDOUR::Region>,
380 boost::shared_ptr<ARDOUR::Playlist>,
381 PlaylistSet& modified_playlists
385 void collect_new_region_view (RegionView *);
386 RouteTimeAxisView* create_destination_time_axis (boost::shared_ptr<ARDOUR::Region>, TimeAxisView* original);
389 RegionView* _new_region_view;
392 /** Drag to insert a region from somewhere */
393 class RegionInsertDrag : public RegionMotionDrag
396 RegionInsertDrag (Editor *, boost::shared_ptr<ARDOUR::Region>, RouteTimeAxisView*, ARDOUR::framepos_t);
398 void finished (GdkEvent *, bool);
401 bool regions_came_from_canvas () const {
406 /** Region drag in splice mode */
407 class RegionSpliceDrag : public RegionMoveDrag
410 RegionSpliceDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
412 void motion (GdkEvent *, bool);
413 void finished (GdkEvent *, bool);
417 /** Region drag in ripple mode */
419 class RegionRippleDrag : public RegionMoveDrag
422 RegionRippleDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
423 ~RegionRippleDrag () { delete exclude; }
425 void motion (GdkEvent *, bool);
426 void finished (GdkEvent *, bool);
429 bool y_movement_allowed (int delta_track, double delta_layer) const;
432 TimeAxisView *prev_tav; // where regions were most recently dragged from
433 TimeAxisView *orig_tav; // where drag started
434 framecnt_t prev_amount;
435 framepos_t prev_position;
436 framecnt_t selection_length;
437 bool allow_moves_across_tracks; // only if all selected regions are on one track
438 ARDOUR::RegionList *exclude;
439 void add_all_after_to_views (TimeAxisView *tav, framepos_t where, const RegionSelection &exclude, bool drag_in_progress);
440 void remove_unselected_from_views (framecnt_t amount, bool move_regions);
444 /** "Drag" to cut a region (action only on button release) */
445 class RegionCutDrag : public Drag
448 RegionCutDrag (Editor*, ArdourCanvas::Item*, framepos_t);
451 void motion (GdkEvent*, bool);
452 void finished (GdkEvent*, bool);
459 /** Drags to create regions */
460 class RegionCreateDrag : public Drag
463 RegionCreateDrag (Editor *, ArdourCanvas::Item *, TimeAxisView *);
465 void motion (GdkEvent *, bool);
466 void finished (GdkEvent *, bool);
470 MidiTimeAxisView* _view;
471 boost::shared_ptr<ARDOUR::Region> _region;
474 /** Drags to resize MIDI notes */
475 class NoteResizeDrag : public Drag
478 NoteResizeDrag (Editor *, ArdourCanvas::Item *);
480 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
481 void motion (GdkEvent *, bool);
482 void finished (GdkEvent *, bool);
486 MidiRegionView* region;
491 /** Drags to move MIDI notes */
492 class NoteDrag : public Drag
495 NoteDrag (Editor*, ArdourCanvas::Item*);
497 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
498 void motion (GdkEvent *, bool);
499 void finished (GdkEvent *, bool);
504 ARDOUR::frameoffset_t total_dx () const;
505 int8_t total_dy () const;
507 MidiRegionView* _region;
509 double _cumulative_dx;
510 double _cumulative_dy;
515 class NoteCreateDrag : public Drag
518 NoteCreateDrag (Editor *, ArdourCanvas::Item *, MidiRegionView *);
521 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
522 void motion (GdkEvent *, bool);
523 void finished (GdkEvent *, bool);
526 bool active (Editing::MouseMode mode) {
527 return mode == Editing::MouseDraw;
530 bool y_movement_matters () const {
535 double y_to_region (double) const;
536 framecnt_t grid_frames (framepos_t) const;
538 MidiRegionView* _region_view;
539 ArdourCanvas::Rectangle* _drag_rect;
543 /** Drag to move MIDI patch changes */
544 class PatchChangeDrag : public Drag
547 PatchChangeDrag (Editor *, PatchChange *, MidiRegionView *);
549 void motion (GdkEvent *, bool);
550 void finished (GdkEvent *, bool);
553 bool y_movement_matters () const {
557 void setup_pointer_frame_offset ();
560 MidiRegionView* _region_view;
561 PatchChange* _patch_change;
562 double _cumulative_dx;
565 /** Container for details about audio regions being dragged along with video */
569 AVDraggingView (RegionView *);
571 RegionView* view; ///< the view
572 framepos_t initial_position; ///< initial position of the region
575 /** Drag of video offset */
576 class VideoTimeLineDrag : public Drag
579 VideoTimeLineDrag (Editor *e, ArdourCanvas::Item *i);
581 void motion (GdkEvent *, bool);
582 void finished (GdkEvent *, bool);
583 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
585 bool y_movement_matters () const {
589 bool allow_vertical_autoscroll () const {
596 std::list<AVDraggingView> _views; ///< information about all audio that are being dragged along
599 ARDOUR::frameoffset_t _startdrag_video_offset;
600 ARDOUR::frameoffset_t _max_backwards_drag;
603 /** Drag to trim region(s) */
604 class TrimDrag : public RegionDrag
613 TrimDrag (Editor *, ArdourCanvas::Item *, RegionView*, std::list<RegionView*> const &, bool preserve_fade_anchor = false);
615 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
616 void motion (GdkEvent *, bool);
617 void finished (GdkEvent *, bool);
620 bool y_movement_matters () const {
624 void setup_pointer_frame_offset ();
628 Operation _operation;
630 bool _preserve_fade_anchor;
631 bool _jump_position_when_done;
634 /** Meter marker drag */
635 class MeterMarkerDrag : public Drag
638 MeterMarkerDrag (Editor *, ArdourCanvas::Item *, bool);
640 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
641 void motion (GdkEvent *, bool);
642 void finished (GdkEvent *, bool);
645 bool allow_vertical_autoscroll () const {
649 bool y_movement_matters () const {
653 void setup_pointer_frame_offset ();
656 MeterMarker* _marker;
658 XMLNode* before_state;
661 /** Tempo marker drag */
662 class TempoMarkerDrag : public Drag
665 TempoMarkerDrag (Editor *, ArdourCanvas::Item *, bool);
667 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
668 void motion (GdkEvent *, bool);
669 void finished (GdkEvent *, bool);
672 bool allow_vertical_autoscroll () const {
676 bool y_movement_matters () const {
680 void setup_pointer_frame_offset ();
683 TempoMarker* _marker;
685 XMLNode* before_state;
689 /** Drag of the playhead cursor */
690 class CursorDrag : public Drag
693 CursorDrag (Editor *, EditorCursor&, bool);
695 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
696 void motion (GdkEvent *, bool);
697 void finished (GdkEvent *, bool);
700 bool allow_vertical_autoscroll () const {
704 bool y_movement_matters () const {
709 void fake_locate (framepos_t);
711 EditorCursor& _cursor;
712 bool _stop; ///< true to stop the transport on starting the drag, otherwise false
713 double _grab_zoom; ///< editor frames per unit when our grab started
716 /** Region fade-in drag */
717 class FadeInDrag : public RegionDrag
720 FadeInDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
722 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
723 void motion (GdkEvent *, bool);
724 void finished (GdkEvent *, bool);
727 bool y_movement_matters () const {
731 void setup_pointer_frame_offset ();
734 /** Region fade-out drag */
735 class FadeOutDrag : public RegionDrag
738 FadeOutDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
740 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
741 void motion (GdkEvent *, bool);
742 void finished (GdkEvent *, bool);
745 bool y_movement_matters () const {
749 void setup_pointer_frame_offset ();
753 class MarkerDrag : public Drag
756 MarkerDrag (Editor *, ArdourCanvas::Item *);
759 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
760 void motion (GdkEvent *, bool);
761 void finished (GdkEvent *, bool);
764 bool allow_vertical_autoscroll () const {
768 bool y_movement_matters () const {
772 void setup_pointer_frame_offset ();
775 void update_item (ARDOUR::Location *);
777 Marker* _marker; ///< marker being dragged
779 struct CopiedLocationMarkerInfo {
780 ARDOUR::Location* location;
781 std::vector<Marker*> markers;
783 CopiedLocationMarkerInfo (ARDOUR::Location* l, Marker* m);
786 typedef std::list<CopiedLocationMarkerInfo> CopiedLocationInfo;
787 CopiedLocationInfo _copied_locations;
788 ArdourCanvas::Points _points;
791 /** Control point drag */
792 class ControlPointDrag : public Drag
795 ControlPointDrag (Editor *, ArdourCanvas::Item *);
797 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
798 void motion (GdkEvent *, bool);
799 void finished (GdkEvent *, bool);
802 bool active (Editing::MouseMode m);
806 ControlPoint* _point;
807 double _fixed_grab_x;
808 double _fixed_grab_y;
809 double _cumulative_x_drag;
810 double _cumulative_y_drag;
812 uint32_t _final_index;
813 static double _zero_gain_fraction;
816 /** Gain or automation line drag */
817 class LineDrag : public Drag
820 LineDrag (Editor *e, ArdourCanvas::Item *i);
822 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
823 void motion (GdkEvent *, bool);
824 void finished (GdkEvent *, bool);
829 AutomationLine* _line;
830 double _fixed_grab_x;
831 double _fixed_grab_y;
832 double _cumulative_y_drag;
835 /** Transient feature line drags*/
836 class FeatureLineDrag : public Drag
839 FeatureLineDrag (Editor *e, ArdourCanvas::Item *i);
841 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
842 void motion (GdkEvent *, bool);
843 void finished (GdkEvent *, bool);
848 ArdourCanvas::Line* _line;
849 AudioRegionView* _arv;
851 double _region_view_grab_x;
852 double _cumulative_x_drag;
858 /** Dragging of a rubberband rectangle for selecting things */
859 class RubberbandSelectDrag : public Drag
862 RubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
864 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
865 void motion (GdkEvent *, bool);
866 void finished (GdkEvent *, bool);
869 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
870 return std::make_pair (8, 1);
873 void do_select_things (GdkEvent *, bool);
875 /** Select some things within a rectangle.
876 * @param button_state The button state from the GdkEvent.
877 * @param x1 The left-hand side of the rectangle in session frames.
878 * @param x2 The right-hand side of the rectangle in session frames.
879 * @param y1 The top of the rectangle in trackview coordinates.
880 * @param y2 The bottom of the rectangle in trackview coordinates.
881 * @param drag_in_progress true if the drag is currently happening.
883 virtual void select_things (int button_state, framepos_t x1, framepos_t x2, double y1, double y2, bool drag_in_progress) = 0;
885 virtual void deselect_things () = 0;
891 /** A general editor RubberbandSelectDrag (for regions, automation points etc.) */
892 class EditorRubberbandSelectDrag : public RubberbandSelectDrag
895 EditorRubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
897 void select_things (int, framepos_t, framepos_t, double, double, bool);
898 void deselect_things ();
901 /** A RubberbandSelectDrag for selecting MIDI notes */
902 class MidiRubberbandSelectDrag : public RubberbandSelectDrag
905 MidiRubberbandSelectDrag (Editor *, MidiRegionView *);
907 void select_things (int, framepos_t, framepos_t, double, double, bool);
908 void deselect_things ();
911 MidiRegionView* _region_view;
914 /** A RubberbandSelectDrag for selecting MIDI notes but with no horizonal component */
915 class MidiVerticalSelectDrag : public RubberbandSelectDrag
918 MidiVerticalSelectDrag (Editor *, MidiRegionView *);
920 void select_things (int, framepos_t, framepos_t, double, double, bool);
921 void deselect_things ();
924 MidiRegionView* _region_view;
927 /** Region drag in time-FX mode */
928 class TimeFXDrag : public RegionDrag
931 TimeFXDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
933 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
934 void motion (GdkEvent *, bool);
935 void finished (GdkEvent *, bool);
939 /** Scrub drag in audition mode */
940 class ScrubDrag : public Drag
943 ScrubDrag (Editor *, ArdourCanvas::Item *);
945 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
946 void motion (GdkEvent *, bool);
947 void finished (GdkEvent *, bool);
951 /** Drag in range select mode */
952 class SelectionDrag : public Drag
963 SelectionDrag (Editor *, ArdourCanvas::Item *, Operation);
965 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
966 void motion (GdkEvent *, bool);
967 void finished (GdkEvent *, bool);
970 void setup_pointer_frame_offset ();
973 Operation _operation;
975 int _original_pointer_time_axis;
976 std::list<TimeAxisView*> _added_time_axes;
977 bool _time_selection_at_start;
978 framepos_t start_at_start;
979 framepos_t end_at_start;
982 /** Range marker drag */
983 class RangeMarkerBarDrag : public Drag
989 CreateTransportMarker,
993 RangeMarkerBarDrag (Editor *, ArdourCanvas::Item *, Operation);
995 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
996 void motion (GdkEvent *, bool);
997 void finished (GdkEvent *, bool);
1000 bool allow_vertical_autoscroll () const {
1004 bool y_movement_matters () const {
1009 void update_item (ARDOUR::Location *);
1011 Operation _operation;
1012 ArdourCanvas::Rectangle* _drag_rect;
1016 /** Drag of rectangle to set zoom */
1017 class MouseZoomDrag : public Drag
1020 MouseZoomDrag (Editor *, ArdourCanvas::Item *);
1022 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
1023 void motion (GdkEvent *, bool);
1024 void finished (GdkEvent *, bool);
1025 void aborted (bool);
1027 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
1028 return std::make_pair (4, 4);
1035 /** Drag of a range of automation data (either on an automation track or region gain),
1036 * changing value but not position.
1038 class AutomationRangeDrag : public Drag
1041 AutomationRangeDrag (Editor *, AutomationTimeAxisView *, std::list<ARDOUR::AudioRange> const &);
1042 AutomationRangeDrag (Editor *, AudioRegionView *, std::list<ARDOUR::AudioRange> const &);
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 x_movement_matters () const {
1054 void setup (std::list<boost::shared_ptr<AutomationLine> > const &);
1055 double y_fraction (boost::shared_ptr<AutomationLine>, double global_y_position) const;
1057 std::list<ARDOUR::AudioRange> _ranges;
1059 /** A line that is part of the drag */
1061 boost::shared_ptr<AutomationLine> line; ///< the line
1062 std::list<ControlPoint*> points; ///< points to drag on the line
1063 std::pair<ARDOUR::framepos_t, ARDOUR::framepos_t> range; ///< the range of all points on the line, in session frames
1064 XMLNode* state; ///< the XML state node before the drag
1065 double original_fraction; ///< initial y-fraction before the drag
1068 std::list<Line> _lines;
1070 bool _nothing_to_drag;
1073 /** Drag of one edge of an xfade
1075 class CrossfadeEdgeDrag : public Drag
1078 CrossfadeEdgeDrag (Editor*, AudioRegionView*, ArdourCanvas::Item*, bool start);
1080 void start_grab (GdkEvent*, Gdk::Cursor* c = 0);
1081 void motion (GdkEvent*, bool);
1082 void finished (GdkEvent*, bool);
1083 void aborted (bool);
1085 bool y_movement_matters () const {
1089 virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
1090 return std::make_pair (4, 4);
1094 AudioRegionView* arv;
1098 #endif /* __gtk2_ardour_editor_drag_h_ */