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 "canvas/types.h"
32 #include "cursor_context.h"
33 #include "editor_items.h"
34 #include "mouse_cursors.h"
41 namespace ArdourCanvas {
48 class StatefulDiffCommand;
55 class MidiTimeAxisView;
60 class RouteTimeAxisView;
61 class RegionSelection;
67 class AudioRegionView;
69 class AutomationTimeAxisView;
71 /** Class to manage current drags */
76 DragManager (Editor* e);
79 bool motion_handler (GdkEvent *, bool);
83 void set (Drag *, GdkEvent *, Gdk::Cursor* c = MouseCursors::invalid_cursor());
84 void start_grab (GdkEvent *, Gdk::Cursor* c = MouseCursors::invalid_cursor());
85 bool end_grab (GdkEvent *);
86 bool have_item (ArdourCanvas::Item *) const;
88 void mark_double_click ();
90 /** @return true if an end drag or abort is in progress */
91 bool ending () const {
95 bool active () const {
96 return !_drags.empty ();
99 /** @return current pointer x position in canvas coordinates */
100 double current_pointer_x () const {
101 return _current_pointer_x;
104 /** @return current pointer y position in canvas coordinates */
105 double current_pointer_y () const {
106 return _current_pointer_y;
109 /** @return current pointer frame */
110 ARDOUR::framepos_t current_pointer_frame () const {
111 return _current_pointer_frame;
116 std::list<Drag*> _drags;
117 bool _ending; ///< true if end_grab or abort is in progress, otherwise false
118 double _current_pointer_x; ///< canvas-coordinate space x of the current pointer
119 double _current_pointer_y; ///< canvas-coordinate space y of the current pointer
120 ARDOUR::framepos_t _current_pointer_frame; ///< frame that the pointer is now at
121 bool _old_follow_playhead; ///< state of Editor::follow_playhead() before the drags started
124 /** Abstract base class for dragging of things within the editor */
128 Drag (Editor *, ArdourCanvas::Item *, bool trackview_only = true);
131 void set_manager (DragManager* m) {
135 /** @return the canvas item being dragged */
136 ArdourCanvas::Item* item () const {
140 void swap_grab (ArdourCanvas::Item *, Gdk::Cursor *, uint32_t);
141 bool motion_handler (GdkEvent*, bool);
144 ARDOUR::framepos_t adjusted_frame (ARDOUR::framepos_t, GdkEvent const *, bool snap = true) const;
145 ARDOUR::framepos_t adjusted_current_frame (GdkEvent const *, bool snap = true) const;
147 bool was_double_click() const { return _was_double_click; }
148 void set_double_click (bool yn) { _was_double_click = yn; }
150 /** Called to start a grab of an item.
151 * @param e Event that caused the grab to start.
152 * @param c Cursor to use, or 0.
154 virtual void start_grab (GdkEvent* e, Gdk::Cursor* c = 0);
156 virtual bool end_grab (GdkEvent *);
158 /** Called when a drag motion has occurred.
159 * @param e Event describing the motion.
160 * @param f true if this is the first movement, otherwise false.
162 virtual void motion (GdkEvent* e, bool f) = 0;
164 /** Called when a drag has finished.
165 * @param e Event describing the finish.
166 * @param m true if some movement occurred, otherwise false.
168 virtual void finished (GdkEvent* e, bool m) = 0;
170 /** Called to abort a drag and return things to how
171 * they were before it started.
172 * @param m true if some movement occurred, otherwise false.
174 virtual void aborted (bool m) = 0;
176 /** @param m Mouse mode.
177 * @return true if this drag should happen in this mouse mode.
179 virtual bool active (Editing::MouseMode m) {
183 /** @return minimum number of frames (in x) and pixels (in y) that should be considered a movement */
184 virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
185 return std::make_pair (1, 1);
188 virtual bool allow_vertical_autoscroll () const {
192 /** @return true if x movement matters to this drag */
193 virtual bool x_movement_matters () const {
197 /** @return true if y movement matters to this drag */
198 virtual bool y_movement_matters () const {
202 bool initially_vertical() const {
203 return _initially_vertical;
206 /** Set up the _pointer_frame_offset */
207 virtual void setup_pointer_frame_offset () {
208 _pointer_frame_offset = 0;
213 double grab_x () const {
217 double grab_y () const {
221 ARDOUR::framepos_t raw_grab_frame () const {
222 return _raw_grab_frame;
225 ARDOUR::framepos_t grab_frame () const {
229 double last_pointer_x () const {
230 return _last_pointer_x;
233 double last_pointer_y () const {
234 return _last_pointer_y;
237 ARDOUR::framepos_t last_pointer_frame () const {
238 return _last_pointer_frame;
241 ARDOUR::frameoffset_t snap_delta (guint const) const;
243 double current_pointer_x () const;
244 double current_pointer_y () const;
246 /* sets snap delta from unsnapped pos */
247 void setup_snap_delta (framepos_t pos);
249 boost::shared_ptr<ARDOUR::Region> add_midi_region (MidiTimeAxisView*);
251 void show_verbose_cursor_time (framepos_t);
252 void show_verbose_cursor_duration (framepos_t, framepos_t, double xoffset = 0);
253 void show_verbose_cursor_text (std::string const &);
255 Editor* _editor; ///< our editor
257 ArdourCanvas::Item* _item; ///< our item
258 /** Offset from the mouse's position for the drag to the start of the thing that is being dragged */
259 ARDOUR::framecnt_t _pointer_frame_offset;
260 bool _x_constrained; ///< true if x motion is constrained, otherwise false
261 bool _y_constrained; ///< true if y motion is constrained, otherwise false
262 bool _was_rolling; ///< true if the session was rolling before the drag started, otherwise false
265 bool _trackview_only; ///< true if pointer y value should always be relative to the top of the trackview group
266 bool _move_threshold_passed; ///< true if the move threshold has been passed, otherwise false
267 bool _starting_point_passed; ///< true if we called move () with first_move flag, otherwise false
268 bool _initially_vertical; ///< true if after move threshold is passed we appear to be moving vertically; undefined before that
269 bool _was_double_click; ///< true if drag initiated by a double click event
270 double _grab_x; ///< trackview x of the grab start position
271 double _grab_y; ///< y of the grab start position, possibly adjusted if _trackview_only is true
272 double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred
273 double _last_pointer_y; ///< trackview y of the pointer last time a motion occurred
274 ARDOUR::framepos_t _raw_grab_frame; ///< unsnapped frame that the mouse was at when start_grab was called, or 0
275 ARDOUR::framepos_t _grab_frame; ///< adjusted_frame that the mouse was at when start_grab was called, or 0
276 ARDOUR::framepos_t _last_pointer_frame; ///< adjusted_frame the last time a motion occurred
278 /* difference between some key position's snapped and unsnapped
279 * framepos. used for relative snap.
281 ARDOUR::frameoffset_t _snap_delta;
282 CursorContext::Handle _cursor_ctx; ///< cursor change context
287 /** Container for details about a region being dragged */
291 DraggingView (RegionView *, RegionDrag *, TimeAxisView* original_tav);
293 RegionView* view; ///< the view
294 /** index into RegionDrag::_time_axis_views of the view that this region is currently being displayed on,
295 * or -1 if it is not visible.
298 /** layer that this region is currently being displayed on. This is a double
299 rather than a layer_t as we use fractional layers during drags to allow the user
300 to indicate a new layer to put a region on.
303 double initial_y; ///< the initial y position of the view before any reparenting
304 framepos_t initial_position; ///< initial position of the region
305 framepos_t initial_end; ///< initial end position of the region
306 framepos_t anchored_fade_length; ///< fade_length when anchored during drag
307 boost::shared_ptr<ARDOUR::Playlist> initial_playlist;
308 TimeAxisView* initial_time_axis_view;
311 /** Abstract base class for drags that involve region(s) */
312 class RegionDrag : public Drag, public sigc::trackable
315 RegionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
316 virtual ~RegionDrag () {}
320 RegionView* _primary; ///< the view that was clicked on (or whatever) to start the drag
321 std::list<DraggingView> _views; ///< information about all views that are being dragged
323 /** a list of the non-hidden TimeAxisViews sorted by editor order key */
324 std::vector<TimeAxisView*> _time_axis_views;
325 int find_time_axis_view (TimeAxisView *) const;
326 int apply_track_delta (const int start, const int delta, const int skip, const bool distance_only = false) const;
332 friend class DraggingView;
336 void region_going_away (RegionView *);
337 PBD::ScopedConnection death_connection;
341 /** Drags involving region motion from somewhere */
342 class RegionMotionDrag : public RegionDrag
346 RegionMotionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &, bool);
347 virtual ~RegionMotionDrag () {}
349 virtual void start_grab (GdkEvent *, Gdk::Cursor *);
350 virtual void motion (GdkEvent *, bool);
351 virtual void finished (GdkEvent *, bool);
352 virtual void aborted (bool);
354 /** @return true if the regions being `moved' came from somewhere on the canvas;
355 * false if they came from outside (e.g. from the region list).
357 virtual bool regions_came_from_canvas () const = 0;
361 double compute_x_delta (GdkEvent const *, ARDOUR::framepos_t *);
362 virtual bool y_movement_allowed (int, double, int skip_invisible = 0) const;
365 bool _ignore_video_lock;
366 ARDOUR::framepos_t _last_frame_position; ///< last position of the thing being dragged
367 double _total_x_delta;
368 int _last_pointer_time_axis_view;
369 double _last_pointer_layer;
377 /** Drags to move (or copy) regions that are already shown in the GUI to
378 * somewhere different.
380 class RegionMoveDrag : public RegionMotionDrag
383 RegionMoveDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &, bool, bool);
384 virtual ~RegionMoveDrag () {}
386 void motion (GdkEvent *, bool);
387 void finished (GdkEvent *, bool);
390 bool regions_came_from_canvas () const {
394 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
395 return std::make_pair (4, 4);
398 void setup_pointer_frame_offset ();
401 typedef std::set<boost::shared_ptr<ARDOUR::Playlist> > PlaylistSet;
402 void add_stateful_diff_commands_for_playlists (PlaylistSet const &);
405 void finished_no_copy (
408 ARDOUR::framecnt_t const
414 ARDOUR::framecnt_t const
417 RegionView* insert_region_into_playlist (
418 boost::shared_ptr<ARDOUR::Region>,
425 void remove_region_from_playlist (
426 boost::shared_ptr<ARDOUR::Region>,
427 boost::shared_ptr<ARDOUR::Playlist>,
428 PlaylistSet& modified_playlists
432 void collect_new_region_view (RegionView *);
433 RouteTimeAxisView* create_destination_time_axis (boost::shared_ptr<ARDOUR::Region>, TimeAxisView* original);
436 RegionView* _new_region_view;
439 /** Drag to insert a region from somewhere */
440 class RegionInsertDrag : public RegionMotionDrag
443 RegionInsertDrag (Editor *, boost::shared_ptr<ARDOUR::Region>, RouteTimeAxisView*, ARDOUR::framepos_t);
445 void finished (GdkEvent *, bool);
448 bool regions_came_from_canvas () const {
453 /** Region drag in splice mode */
454 class RegionSpliceDrag : public RegionMoveDrag
457 RegionSpliceDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
459 void motion (GdkEvent *, bool);
460 void finished (GdkEvent *, bool);
464 /** Region drag in ripple mode */
466 class RegionRippleDrag : public RegionMoveDrag
469 RegionRippleDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
470 ~RegionRippleDrag () { delete exclude; }
472 void motion (GdkEvent *, bool);
473 void finished (GdkEvent *, bool);
476 bool y_movement_allowed (int delta_track, double delta_layer, int skip_invisible = 0) const;
479 TimeAxisView *prev_tav; // where regions were most recently dragged from
480 TimeAxisView *orig_tav; // where drag started
481 ARDOUR::framecnt_t prev_amount;
482 ARDOUR::framepos_t prev_position;
483 ARDOUR::framecnt_t selection_length;
484 bool allow_moves_across_tracks; // only if all selected regions are on one track
485 ARDOUR::RegionList *exclude;
486 void add_all_after_to_views (TimeAxisView *tav, ARDOUR::framepos_t where, const RegionSelection &exclude, bool drag_in_progress);
487 void remove_unselected_from_views (ARDOUR::framecnt_t amount, bool move_regions);
491 /** "Drag" to cut a region (action only on button release) */
492 class RegionCutDrag : public Drag
495 RegionCutDrag (Editor*, ArdourCanvas::Item*, framepos_t);
498 void motion (GdkEvent*, bool);
499 void finished (GdkEvent*, bool);
506 /** Drags to create regions */
507 class RegionCreateDrag : public Drag
510 RegionCreateDrag (Editor *, ArdourCanvas::Item *, TimeAxisView *);
512 void motion (GdkEvent *, bool);
513 void finished (GdkEvent *, bool);
517 MidiTimeAxisView* _view;
518 boost::shared_ptr<ARDOUR::Region> _region;
521 /** Drags to resize MIDI notes */
522 class NoteResizeDrag : public Drag
525 NoteResizeDrag (Editor *, ArdourCanvas::Item *);
527 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
528 void motion (GdkEvent *, bool);
529 void finished (GdkEvent *, bool);
533 MidiRegionView* region;
539 /** Drags to move MIDI notes */
540 class NoteDrag : public Drag
543 NoteDrag (Editor*, ArdourCanvas::Item*);
545 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
546 void motion (GdkEvent *, bool);
547 void finished (GdkEvent *, bool);
552 ARDOUR::frameoffset_t total_dx (const guint) const;
553 int8_t total_dy () const;
555 MidiRegionView* _region;
557 double _cumulative_dx;
558 double _cumulative_dy;
563 class NoteCreateDrag : public Drag
566 NoteCreateDrag (Editor *, ArdourCanvas::Item *, MidiRegionView *);
569 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
570 void motion (GdkEvent *, bool);
571 void finished (GdkEvent *, bool);
574 bool active (Editing::MouseMode mode) {
575 return mode == Editing::MouseDraw || mode == Editing::MouseContent;
578 bool y_movement_matters () const {
583 double y_to_region (double) const;
584 ARDOUR::framecnt_t grid_frames (framepos_t) const;
586 MidiRegionView* _region_view;
587 ArdourCanvas::Rectangle* _drag_rect;
591 /** Drag to move MIDI patch changes */
592 class PatchChangeDrag : public Drag
595 PatchChangeDrag (Editor *, PatchChange *, MidiRegionView *);
597 void motion (GdkEvent *, bool);
598 void finished (GdkEvent *, bool);
601 bool y_movement_matters () const {
605 void setup_pointer_frame_offset ();
608 MidiRegionView* _region_view;
609 PatchChange* _patch_change;
610 double _cumulative_dx;
613 /** Container for details about audio regions being dragged along with video */
617 AVDraggingView (RegionView *);
619 RegionView* view; ///< the view
620 framepos_t initial_position; ///< initial position of the region
623 /** Drag of video offset */
624 class VideoTimeLineDrag : public Drag
627 VideoTimeLineDrag (Editor *e, ArdourCanvas::Item *i);
629 void motion (GdkEvent *, bool);
630 void finished (GdkEvent *, bool);
631 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
633 bool y_movement_matters () const {
637 bool allow_vertical_autoscroll () const {
644 std::list<AVDraggingView> _views; ///< information about all audio that are being dragged along
647 ARDOUR::frameoffset_t _startdrag_video_offset;
648 ARDOUR::frameoffset_t _max_backwards_drag;
652 /** Drag to trim region(s) */
653 class TrimDrag : public RegionDrag
662 TrimDrag (Editor *, ArdourCanvas::Item *, RegionView*, std::list<RegionView*> const &, bool preserve_fade_anchor = false);
664 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
665 void motion (GdkEvent *, bool);
666 void finished (GdkEvent *, bool);
669 bool y_movement_matters () const {
673 void setup_pointer_frame_offset ();
677 Operation _operation;
679 bool _preserve_fade_anchor;
680 bool _jump_position_when_done;
683 /** Meter marker drag */
684 class MeterMarkerDrag : public Drag
687 MeterMarkerDrag (Editor *, ArdourCanvas::Item *, bool);
689 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
690 void motion (GdkEvent *, bool);
691 void finished (GdkEvent *, bool);
694 bool allow_vertical_autoscroll () const {
698 bool y_movement_matters () const {
702 void setup_pointer_frame_offset ();
705 MeterMarker* _marker;
707 XMLNode* before_state;
710 /** Tempo marker drag */
711 class TempoMarkerDrag : public Drag
714 TempoMarkerDrag (Editor *, ArdourCanvas::Item *, bool);
716 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
717 void motion (GdkEvent *, bool);
718 void finished (GdkEvent *, bool);
721 bool allow_vertical_autoscroll () const {
725 bool y_movement_matters () const {
729 void setup_pointer_frame_offset ();
732 TempoMarker* _marker;
734 XMLNode* before_state;
738 /** Drag of the playhead cursor */
739 class CursorDrag : public Drag
742 CursorDrag (Editor *, EditorCursor&, bool);
744 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
745 void motion (GdkEvent *, bool);
746 void finished (GdkEvent *, bool);
749 bool allow_vertical_autoscroll () const {
753 bool y_movement_matters () const {
758 void fake_locate (framepos_t);
760 EditorCursor& _cursor;
761 bool _stop; ///< true to stop the transport on starting the drag, otherwise false
762 double _grab_zoom; ///< editor frames per unit when our grab started
765 /** Region fade-in drag */
766 class FadeInDrag : public RegionDrag
769 FadeInDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
771 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
772 void motion (GdkEvent *, bool);
773 void finished (GdkEvent *, bool);
776 bool y_movement_matters () const {
780 void setup_pointer_frame_offset ();
783 /** Region fade-out drag */
784 class FadeOutDrag : public RegionDrag
787 FadeOutDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
789 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
790 void motion (GdkEvent *, bool);
791 void finished (GdkEvent *, bool);
794 bool y_movement_matters () const {
798 void setup_pointer_frame_offset ();
802 class MarkerDrag : public Drag
805 MarkerDrag (Editor *, ArdourCanvas::Item *);
808 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
809 void motion (GdkEvent *, bool);
810 void finished (GdkEvent *, bool);
813 bool allow_vertical_autoscroll () const {
817 bool y_movement_matters () const {
821 void setup_pointer_frame_offset ();
824 void update_item (ARDOUR::Location *);
826 ArdourMarker* _marker; ///< marker being dragged
828 struct CopiedLocationMarkerInfo {
829 ARDOUR::Location* location;
830 std::vector<ArdourMarker*> markers;
832 CopiedLocationMarkerInfo (ARDOUR::Location* l, ArdourMarker* m);
835 typedef std::list<CopiedLocationMarkerInfo> CopiedLocationInfo;
836 CopiedLocationInfo _copied_locations;
837 ArdourCanvas::Points _points;
840 /** Control point drag */
841 class ControlPointDrag : public Drag
844 ControlPointDrag (Editor *, ArdourCanvas::Item *);
846 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
847 void motion (GdkEvent *, bool);
848 void finished (GdkEvent *, bool);
851 bool active (Editing::MouseMode m);
855 ControlPoint* _point;
856 double _fixed_grab_x;
857 double _fixed_grab_y;
858 double _cumulative_x_drag;
859 double _cumulative_y_drag;
861 uint32_t _final_index;
862 static double _zero_gain_fraction;
865 /** Gain or automation line drag */
866 class LineDrag : public Drag
869 LineDrag (Editor *e, ArdourCanvas::Item *i);
871 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
872 void motion (GdkEvent *, bool);
873 void finished (GdkEvent *, bool);
878 AutomationLine* _line;
879 double _fixed_grab_x;
880 double _fixed_grab_y;
881 double _cumulative_y_drag;
886 /** Transient feature line drags*/
887 class FeatureLineDrag : public Drag
890 FeatureLineDrag (Editor *e, ArdourCanvas::Item *i);
892 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
893 void motion (GdkEvent *, bool);
894 void finished (GdkEvent *, bool);
899 ArdourCanvas::Line* _line;
900 AudioRegionView* _arv;
902 double _region_view_grab_x;
903 double _cumulative_x_drag;
909 /** Dragging of a rubberband rectangle for selecting things */
910 class RubberbandSelectDrag : public Drag
913 RubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
915 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
916 void motion (GdkEvent *, bool);
917 void finished (GdkEvent *, bool);
920 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
921 return std::make_pair (8, 1);
924 void do_select_things (GdkEvent *, bool);
926 /** Select some things within a rectangle.
927 * @param button_state The button state from the GdkEvent.
928 * @param x1 The left-hand side of the rectangle in session frames.
929 * @param x2 The right-hand side of the rectangle in session frames.
930 * @param y1 The top of the rectangle in trackview coordinates.
931 * @param y2 The bottom of the rectangle in trackview coordinates.
932 * @param drag_in_progress true if the drag is currently happening.
934 virtual void select_things (int button_state, framepos_t x1, framepos_t x2, double y1, double y2, bool drag_in_progress) = 0;
936 virtual void deselect_things () = 0;
942 /** A general editor RubberbandSelectDrag (for regions, automation points etc.) */
943 class EditorRubberbandSelectDrag : public RubberbandSelectDrag
946 EditorRubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
948 void select_things (int, framepos_t, framepos_t, double, double, bool);
949 void deselect_things ();
952 /** A RubberbandSelectDrag for selecting MIDI notes */
953 class MidiRubberbandSelectDrag : public RubberbandSelectDrag
956 MidiRubberbandSelectDrag (Editor *, MidiRegionView *);
958 void select_things (int, framepos_t, framepos_t, double, double, bool);
959 void deselect_things ();
962 MidiRegionView* _region_view;
965 /** A RubberbandSelectDrag for selecting MIDI notes but with no horizonal component */
966 class MidiVerticalSelectDrag : public RubberbandSelectDrag
969 MidiVerticalSelectDrag (Editor *, MidiRegionView *);
971 void select_things (int, framepos_t, framepos_t, double, double, bool);
972 void deselect_things ();
975 MidiRegionView* _region_view;
978 /** Region drag in time-FX mode */
979 class TimeFXDrag : public RegionDrag
982 TimeFXDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
984 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
985 void motion (GdkEvent *, bool);
986 void finished (GdkEvent *, bool);
990 /** Scrub drag in audition mode */
991 class ScrubDrag : public Drag
994 ScrubDrag (Editor *, ArdourCanvas::Item *);
996 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
997 void motion (GdkEvent *, bool);
998 void finished (GdkEvent *, bool);
1002 /** Drag in range select mode */
1003 class SelectionDrag : public Drag
1014 SelectionDrag (Editor *, ArdourCanvas::Item *, Operation);
1016 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
1017 void motion (GdkEvent *, bool);
1018 void finished (GdkEvent *, bool);
1019 void aborted (bool);
1021 void setup_pointer_frame_offset ();
1024 Operation _operation;
1026 std::list<TimeAxisView*> _added_time_axes;
1027 bool _time_selection_at_start;
1028 framepos_t start_at_start;
1029 framepos_t end_at_start;
1032 /** Range marker drag */
1033 class RangeMarkerBarDrag : public Drag
1039 CreateTransportMarker,
1043 RangeMarkerBarDrag (Editor *, ArdourCanvas::Item *, Operation);
1044 ~RangeMarkerBarDrag ();
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 allow_vertical_autoscroll () const {
1055 bool y_movement_matters () const {
1060 void update_item (ARDOUR::Location *);
1062 Operation _operation;
1063 ArdourCanvas::Rectangle* _drag_rect;
1067 /** Drag of rectangle to set zoom */
1068 class MouseZoomDrag : public Drag
1071 MouseZoomDrag (Editor *, ArdourCanvas::Item *);
1073 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
1074 void motion (GdkEvent *, bool);
1075 void finished (GdkEvent *, bool);
1076 void aborted (bool);
1078 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
1079 return std::make_pair (4, 4);
1086 /** Drag of a range of automation data (either on an automation track or region gain),
1087 * changing value but not position.
1089 class AutomationRangeDrag : public Drag
1092 AutomationRangeDrag (Editor *, AutomationTimeAxisView *, std::list<ARDOUR::AudioRange> const &);
1093 AutomationRangeDrag (Editor *, RegionView *, std::list<ARDOUR::AudioRange> const &);
1095 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
1096 void motion (GdkEvent *, bool);
1097 void finished (GdkEvent *, bool);
1098 void aborted (bool);
1100 bool x_movement_matters () const {
1105 void setup (std::list<boost::shared_ptr<AutomationLine> > const &);
1106 double y_fraction (boost::shared_ptr<AutomationLine>, double global_y_position) const;
1107 double value (boost::shared_ptr<ARDOUR::AutomationList> list, double x) const;
1109 std::list<ARDOUR::AudioRange> _ranges;
1111 /** A line that is part of the drag */
1113 boost::shared_ptr<AutomationLine> line; ///< the line
1114 std::list<ControlPoint*> points; ///< points to drag on the line
1115 std::pair<ARDOUR::framepos_t, ARDOUR::framepos_t> range; ///< the range of all points on the line, in session frames
1116 XMLNode* state; ///< the XML state node before the drag
1117 double original_fraction; ///< initial y-fraction before the drag
1120 std::list<Line> _lines;
1122 bool _nothing_to_drag;
1126 /** Drag of one edge of an xfade
1128 class CrossfadeEdgeDrag : public Drag
1131 CrossfadeEdgeDrag (Editor*, AudioRegionView*, ArdourCanvas::Item*, bool start);
1133 void start_grab (GdkEvent*, Gdk::Cursor* c = 0);
1134 void motion (GdkEvent*, bool);
1135 void finished (GdkEvent*, bool);
1136 void aborted (bool);
1138 bool y_movement_matters () const {
1142 virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
1143 return std::make_pair (4, 4);
1147 AudioRegionView* arv;
1151 #endif /* __gtk2_ardour_editor_drag_h_ */