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 "cursor_context.h"
31 #include "editor_items.h"
32 #include "mouse_cursors.h"
39 class StatefulDiffCommand;
46 class MidiTimeAxisView;
50 /** Class to manage current drags */
55 DragManager (Editor* e);
58 bool motion_handler (GdkEvent *, bool);
62 void set (Drag *, GdkEvent *, Gdk::Cursor* c = MouseCursors::invalid_cursor());
63 void start_grab (GdkEvent *, Gdk::Cursor* c = MouseCursors::invalid_cursor());
64 bool end_grab (GdkEvent *);
65 bool have_item (ArdourCanvas::Item *) const;
67 void mark_double_click ();
69 /** @return true if an end drag or abort is in progress */
70 bool ending () const {
74 bool active () const {
75 return !_drags.empty ();
78 /** @return current pointer x position in canvas coordinates */
79 double current_pointer_x () const {
80 return _current_pointer_x;
83 /** @return current pointer y position in canvas coordinates */
84 double current_pointer_y () const {
85 return _current_pointer_y;
88 /** @return current pointer frame */
89 ARDOUR::framepos_t current_pointer_frame () const {
90 return _current_pointer_frame;
95 std::list<Drag*> _drags;
96 bool _ending; ///< true if end_grab or abort is in progress, otherwise false
97 double _current_pointer_x; ///< canvas-coordinate space x of the current pointer
98 double _current_pointer_y; ///< canvas-coordinate space y of the current pointer
99 ARDOUR::framepos_t _current_pointer_frame; ///< frame that the pointer is now at
100 bool _old_follow_playhead; ///< state of Editor::follow_playhead() before the drags started
103 /** Abstract base class for dragging of things within the editor */
107 Drag (Editor *, ArdourCanvas::Item *, bool trackview_only = true);
110 void set_manager (DragManager* m) {
114 /** @return the canvas item being dragged */
115 ArdourCanvas::Item* item () const {
119 void swap_grab (ArdourCanvas::Item *, Gdk::Cursor *, uint32_t);
120 bool motion_handler (GdkEvent*, bool);
123 ARDOUR::framepos_t adjusted_frame (ARDOUR::framepos_t, GdkEvent const *, bool snap = true) const;
124 ARDOUR::framepos_t adjusted_current_frame (GdkEvent const *, bool snap = true) const;
126 bool was_double_click() const { return _was_double_click; }
127 void set_double_click (bool yn) { _was_double_click = yn; }
129 /** Called to start a grab of an item.
130 * @param e Event that caused the grab to start.
131 * @param c Cursor to use, or 0.
133 virtual void start_grab (GdkEvent* e, Gdk::Cursor* c = 0);
135 virtual bool end_grab (GdkEvent *);
137 /** Called when a drag motion has occurred.
138 * @param e Event describing the motion.
139 * @param f true if this is the first movement, otherwise false.
141 virtual void motion (GdkEvent* e, bool f) = 0;
143 /** Called when a drag has finished.
144 * @param e Event describing the finish.
145 * @param m true if some movement occurred, otherwise false.
147 virtual void finished (GdkEvent* e, bool m) = 0;
149 /** Called to abort a drag and return things to how
150 * they were before it started.
151 * @param m true if some movement occurred, otherwise false.
153 virtual void aborted (bool m) = 0;
155 /** @param m Mouse mode.
156 * @return true if this drag should happen in this mouse mode.
158 virtual bool active (Editing::MouseMode m) {
162 /** @return minimum number of frames (in x) and pixels (in y) that should be considered a movement */
163 virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
164 return std::make_pair (1, 1);
167 virtual bool allow_vertical_autoscroll () const {
171 /** @return true if x movement matters to this drag */
172 virtual bool x_movement_matters () const {
176 /** @return true if y movement matters to this drag */
177 virtual bool y_movement_matters () const {
181 bool initially_vertical() const {
182 return _initially_vertical;
185 /** Set up the _pointer_frame_offset */
186 virtual void setup_pointer_frame_offset () {
187 _pointer_frame_offset = 0;
192 double grab_x () const {
196 double grab_y () const {
200 ARDOUR::framepos_t raw_grab_frame () const {
201 return _raw_grab_frame;
204 ARDOUR::framepos_t grab_frame () const {
208 double last_pointer_x () const {
209 return _last_pointer_x;
212 double last_pointer_y () const {
213 return _last_pointer_y;
216 double last_pointer_frame () const {
217 return _last_pointer_frame;
220 double current_pointer_x () const;
221 double current_pointer_y () const;
223 boost::shared_ptr<ARDOUR::Region> add_midi_region (MidiTimeAxisView*);
225 void show_verbose_cursor_time (framepos_t);
226 void show_verbose_cursor_duration (framepos_t, framepos_t, double xoffset = 0);
227 void show_verbose_cursor_text (std::string const &);
229 Editor* _editor; ///< our editor
231 ArdourCanvas::Item* _item; ///< our item
232 /** Offset from the mouse's position for the drag to the start of the thing that is being dragged */
233 ARDOUR::framecnt_t _pointer_frame_offset;
234 bool _x_constrained; ///< true if x motion is constrained, otherwise false
235 bool _y_constrained; ///< true if y motion is constrained, otherwise false
236 bool _was_rolling; ///< true if the session was rolling before the drag started, otherwise false
239 bool _trackview_only; ///< true if pointer y value should always be relative to the top of the trackview group
240 bool _move_threshold_passed; ///< true if the move threshold has been passed, otherwise false
241 bool _starting_point_passed; ///< true if we called move () with first_move flag, otherwise false
242 bool _initially_vertical; ///< true if after move threshold is passed we appear to be moving vertically; undefined before that
243 bool _was_double_click; ///< true if drag initiated by a double click event
244 double _grab_x; ///< trackview x of the grab start position
245 double _grab_y; ///< y of the grab start position, possibly adjusted if _trackview_only is true
246 double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred
247 double _last_pointer_y; ///< trackview y of the pointer last time a motion occurred
248 ARDOUR::framepos_t _raw_grab_frame; ///< unsnapped frame that the mouse was at when start_grab was called, or 0
249 ARDOUR::framepos_t _grab_frame; ///< adjusted_frame that the mouse was at when start_grab was called, or 0
250 ARDOUR::framepos_t _last_pointer_frame; ///< adjusted_frame the last time a motion occurred
251 CursorContext::Handle _cursor_ctx; ///< cursor change context
256 /** Container for details about a region being dragged */
260 DraggingView (RegionView *, RegionDrag *, TimeAxisView* original_tav);
262 RegionView* view; ///< the view
263 /** index into RegionDrag::_time_axis_views of the view that this region is currently being displayed on,
264 * or -1 if it is not visible.
267 /** layer that this region is currently being displayed on. This is a double
268 rather than a layer_t as we use fractional layers during drags to allow the user
269 to indicate a new layer to put a region on.
272 double initial_y; ///< the initial y position of the view before any reparenting
273 framepos_t initial_position; ///< initial position of the region
274 framepos_t initial_end; ///< initial end position of the region
275 framepos_t anchored_fade_length; ///< fade_length when anchored during drag
276 boost::shared_ptr<ARDOUR::Playlist> initial_playlist;
277 TimeAxisView* initial_time_axis_view;
280 /** Abstract base class for drags that involve region(s) */
281 class RegionDrag : public Drag, public sigc::trackable
284 RegionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
285 virtual ~RegionDrag () {}
289 RegionView* _primary; ///< the view that was clicked on (or whatever) to start the drag
290 std::list<DraggingView> _views; ///< information about all views that are being dragged
292 /** a list of the non-hidden TimeAxisViews sorted by editor order key */
293 std::vector<TimeAxisView*> _time_axis_views;
294 int find_time_axis_view (TimeAxisView *) const;
299 friend class DraggingView;
303 void region_going_away (RegionView *);
304 PBD::ScopedConnection death_connection;
308 /** Drags involving region motion from somewhere */
309 class RegionMotionDrag : public RegionDrag
313 RegionMotionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &, bool);
314 virtual ~RegionMotionDrag () {}
316 virtual void start_grab (GdkEvent *, Gdk::Cursor *);
317 virtual void motion (GdkEvent *, bool);
318 virtual void finished (GdkEvent *, bool);
319 virtual void aborted (bool);
321 /** @return true if the regions being `moved' came from somewhere on the canvas;
322 * false if they came from outside (e.g. from the region list).
324 virtual bool regions_came_from_canvas () const = 0;
328 double compute_x_delta (GdkEvent const *, ARDOUR::framepos_t *);
329 virtual bool y_movement_allowed (int, double) const;
332 ARDOUR::framepos_t _last_frame_position; ///< last position of the thing being dragged
333 double _total_x_delta;
334 int _last_pointer_time_axis_view;
335 double _last_pointer_layer;
340 /** Drags to move (or copy) regions that are already shown in the GUI to
341 * somewhere different.
343 class RegionMoveDrag : public RegionMotionDrag
346 RegionMoveDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &, bool, bool);
347 virtual ~RegionMoveDrag () {}
349 void motion (GdkEvent *, bool);
350 void finished (GdkEvent *, bool);
353 bool regions_came_from_canvas () const {
357 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
358 return std::make_pair (4, 4);
361 void setup_pointer_frame_offset ();
364 typedef std::set<boost::shared_ptr<ARDOUR::Playlist> > PlaylistSet;
365 void add_stateful_diff_commands_for_playlists (PlaylistSet const &);
368 void finished_no_copy (
371 ARDOUR::framecnt_t const
377 ARDOUR::framecnt_t const
380 RegionView* insert_region_into_playlist (
381 boost::shared_ptr<ARDOUR::Region>,
388 void remove_region_from_playlist (
389 boost::shared_ptr<ARDOUR::Region>,
390 boost::shared_ptr<ARDOUR::Playlist>,
391 PlaylistSet& modified_playlists
395 void collect_new_region_view (RegionView *);
396 RouteTimeAxisView* create_destination_time_axis (boost::shared_ptr<ARDOUR::Region>, TimeAxisView* original);
399 RegionView* _new_region_view;
402 /** Drag to insert a region from somewhere */
403 class RegionInsertDrag : public RegionMotionDrag
406 RegionInsertDrag (Editor *, boost::shared_ptr<ARDOUR::Region>, RouteTimeAxisView*, ARDOUR::framepos_t);
408 void finished (GdkEvent *, bool);
411 bool regions_came_from_canvas () const {
416 /** Region drag in splice mode */
417 class RegionSpliceDrag : public RegionMoveDrag
420 RegionSpliceDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
422 void motion (GdkEvent *, bool);
423 void finished (GdkEvent *, bool);
427 /** Region drag in ripple mode */
429 class RegionRippleDrag : public RegionMoveDrag
432 RegionRippleDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
433 ~RegionRippleDrag () { delete exclude; }
435 void motion (GdkEvent *, bool);
436 void finished (GdkEvent *, bool);
439 bool y_movement_allowed (int delta_track, double delta_layer) const;
442 TimeAxisView *prev_tav; // where regions were most recently dragged from
443 TimeAxisView *orig_tav; // where drag started
444 framecnt_t prev_amount;
445 framepos_t prev_position;
446 framecnt_t selection_length;
447 bool allow_moves_across_tracks; // only if all selected regions are on one track
448 ARDOUR::RegionList *exclude;
449 void add_all_after_to_views (TimeAxisView *tav, framepos_t where, const RegionSelection &exclude, bool drag_in_progress);
450 void remove_unselected_from_views (framecnt_t amount, bool move_regions);
454 /** "Drag" to cut a region (action only on button release) */
455 class RegionCutDrag : public Drag
458 RegionCutDrag (Editor*, ArdourCanvas::Item*, framepos_t);
461 void motion (GdkEvent*, bool);
462 void finished (GdkEvent*, bool);
469 /** Drags to create regions */
470 class RegionCreateDrag : public Drag
473 RegionCreateDrag (Editor *, ArdourCanvas::Item *, TimeAxisView *);
475 void motion (GdkEvent *, bool);
476 void finished (GdkEvent *, bool);
480 MidiTimeAxisView* _view;
481 boost::shared_ptr<ARDOUR::Region> _region;
484 /** Drags to resize MIDI notes */
485 class NoteResizeDrag : public Drag
488 NoteResizeDrag (Editor *, ArdourCanvas::Item *);
490 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
491 void motion (GdkEvent *, bool);
492 void finished (GdkEvent *, bool);
496 MidiRegionView* region;
501 /** Drags to move MIDI notes */
502 class NoteDrag : public Drag
505 NoteDrag (Editor*, ArdourCanvas::Item*);
507 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
508 void motion (GdkEvent *, bool);
509 void finished (GdkEvent *, bool);
514 ARDOUR::frameoffset_t total_dx () const;
515 int8_t total_dy () const;
517 MidiRegionView* _region;
519 double _cumulative_dx;
520 double _cumulative_dy;
525 class NoteCreateDrag : public Drag
528 NoteCreateDrag (Editor *, ArdourCanvas::Item *, MidiRegionView *);
531 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
532 void motion (GdkEvent *, bool);
533 void finished (GdkEvent *, bool);
536 bool active (Editing::MouseMode mode) {
537 return mode == Editing::MouseDraw;
540 bool y_movement_matters () const {
545 double y_to_region (double) const;
546 framecnt_t grid_frames (framepos_t) const;
548 MidiRegionView* _region_view;
549 ArdourCanvas::Rectangle* _drag_rect;
553 /** Drag to move MIDI patch changes */
554 class PatchChangeDrag : public Drag
557 PatchChangeDrag (Editor *, PatchChange *, MidiRegionView *);
559 void motion (GdkEvent *, bool);
560 void finished (GdkEvent *, bool);
563 bool y_movement_matters () const {
567 void setup_pointer_frame_offset ();
570 MidiRegionView* _region_view;
571 PatchChange* _patch_change;
572 double _cumulative_dx;
575 /** Container for details about audio regions being dragged along with video */
579 AVDraggingView (RegionView *);
581 RegionView* view; ///< the view
582 framepos_t initial_position; ///< initial position of the region
585 /** Drag of video offset */
586 class VideoTimeLineDrag : public Drag
589 VideoTimeLineDrag (Editor *e, ArdourCanvas::Item *i);
591 void motion (GdkEvent *, bool);
592 void finished (GdkEvent *, bool);
593 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
595 bool y_movement_matters () const {
599 bool allow_vertical_autoscroll () const {
606 std::list<AVDraggingView> _views; ///< information about all audio that are being dragged along
609 ARDOUR::frameoffset_t _startdrag_video_offset;
610 ARDOUR::frameoffset_t _max_backwards_drag;
613 /** Drag to trim region(s) */
614 class TrimDrag : public RegionDrag
623 TrimDrag (Editor *, ArdourCanvas::Item *, RegionView*, std::list<RegionView*> const &, bool preserve_fade_anchor = false);
625 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
626 void motion (GdkEvent *, bool);
627 void finished (GdkEvent *, bool);
630 bool y_movement_matters () const {
634 void setup_pointer_frame_offset ();
638 Operation _operation;
640 bool _preserve_fade_anchor;
641 bool _jump_position_when_done;
644 /** Meter marker drag */
645 class MeterMarkerDrag : public Drag
648 MeterMarkerDrag (Editor *, ArdourCanvas::Item *, bool);
650 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
651 void motion (GdkEvent *, bool);
652 void finished (GdkEvent *, bool);
655 bool allow_vertical_autoscroll () const {
659 bool y_movement_matters () const {
663 void setup_pointer_frame_offset ();
666 MeterMarker* _marker;
668 XMLNode* before_state;
671 /** Tempo marker drag */
672 class TempoMarkerDrag : public Drag
675 TempoMarkerDrag (Editor *, ArdourCanvas::Item *, bool);
677 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
678 void motion (GdkEvent *, bool);
679 void finished (GdkEvent *, bool);
682 bool allow_vertical_autoscroll () const {
686 bool y_movement_matters () const {
690 void setup_pointer_frame_offset ();
693 TempoMarker* _marker;
695 XMLNode* before_state;
699 /** Drag of the playhead cursor */
700 class CursorDrag : public Drag
703 CursorDrag (Editor *, EditorCursor&, bool);
705 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
706 void motion (GdkEvent *, bool);
707 void finished (GdkEvent *, bool);
710 bool allow_vertical_autoscroll () const {
714 bool y_movement_matters () const {
719 void fake_locate (framepos_t);
721 EditorCursor& _cursor;
722 bool _stop; ///< true to stop the transport on starting the drag, otherwise false
723 double _grab_zoom; ///< editor frames per unit when our grab started
726 /** Region fade-in drag */
727 class FadeInDrag : public RegionDrag
730 FadeInDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
732 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
733 void motion (GdkEvent *, bool);
734 void finished (GdkEvent *, bool);
737 bool y_movement_matters () const {
741 void setup_pointer_frame_offset ();
744 /** Region fade-out drag */
745 class FadeOutDrag : public RegionDrag
748 FadeOutDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
750 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
751 void motion (GdkEvent *, bool);
752 void finished (GdkEvent *, bool);
755 bool y_movement_matters () const {
759 void setup_pointer_frame_offset ();
763 class MarkerDrag : public Drag
766 MarkerDrag (Editor *, ArdourCanvas::Item *);
769 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
770 void motion (GdkEvent *, bool);
771 void finished (GdkEvent *, bool);
774 bool allow_vertical_autoscroll () const {
778 bool y_movement_matters () const {
782 void setup_pointer_frame_offset ();
785 void update_item (ARDOUR::Location *);
787 Marker* _marker; ///< marker being dragged
789 struct CopiedLocationMarkerInfo {
790 ARDOUR::Location* location;
791 std::vector<Marker*> markers;
793 CopiedLocationMarkerInfo (ARDOUR::Location* l, Marker* m);
796 typedef std::list<CopiedLocationMarkerInfo> CopiedLocationInfo;
797 CopiedLocationInfo _copied_locations;
798 ArdourCanvas::Points _points;
801 /** Control point drag */
802 class ControlPointDrag : public Drag
805 ControlPointDrag (Editor *, ArdourCanvas::Item *);
807 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
808 void motion (GdkEvent *, bool);
809 void finished (GdkEvent *, bool);
812 bool active (Editing::MouseMode m);
816 ControlPoint* _point;
817 double _fixed_grab_x;
818 double _fixed_grab_y;
819 double _cumulative_x_drag;
820 double _cumulative_y_drag;
822 uint32_t _final_index;
823 static double _zero_gain_fraction;
826 /** Gain or automation line drag */
827 class LineDrag : public Drag
830 LineDrag (Editor *e, ArdourCanvas::Item *i);
832 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
833 void motion (GdkEvent *, bool);
834 void finished (GdkEvent *, bool);
839 AutomationLine* _line;
840 double _fixed_grab_x;
841 double _fixed_grab_y;
842 double _cumulative_y_drag;
845 /** Transient feature line drags*/
846 class FeatureLineDrag : public Drag
849 FeatureLineDrag (Editor *e, ArdourCanvas::Item *i);
851 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
852 void motion (GdkEvent *, bool);
853 void finished (GdkEvent *, bool);
858 ArdourCanvas::Line* _line;
859 AudioRegionView* _arv;
861 double _region_view_grab_x;
862 double _cumulative_x_drag;
868 /** Dragging of a rubberband rectangle for selecting things */
869 class RubberbandSelectDrag : public Drag
872 RubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
874 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
875 void motion (GdkEvent *, bool);
876 void finished (GdkEvent *, bool);
879 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
880 return std::make_pair (8, 1);
883 void do_select_things (GdkEvent *, bool);
885 /** Select some things within a rectangle.
886 * @param button_state The button state from the GdkEvent.
887 * @param x1 The left-hand side of the rectangle in session frames.
888 * @param x2 The right-hand side of the rectangle in session frames.
889 * @param y1 The top of the rectangle in trackview coordinates.
890 * @param y2 The bottom of the rectangle in trackview coordinates.
891 * @param drag_in_progress true if the drag is currently happening.
893 virtual void select_things (int button_state, framepos_t x1, framepos_t x2, double y1, double y2, bool drag_in_progress) = 0;
895 virtual void deselect_things () = 0;
901 /** A general editor RubberbandSelectDrag (for regions, automation points etc.) */
902 class EditorRubberbandSelectDrag : public RubberbandSelectDrag
905 EditorRubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
907 void select_things (int, framepos_t, framepos_t, double, double, bool);
908 void deselect_things ();
911 /** A RubberbandSelectDrag for selecting MIDI notes */
912 class MidiRubberbandSelectDrag : public RubberbandSelectDrag
915 MidiRubberbandSelectDrag (Editor *, MidiRegionView *);
917 void select_things (int, framepos_t, framepos_t, double, double, bool);
918 void deselect_things ();
921 MidiRegionView* _region_view;
924 /** A RubberbandSelectDrag for selecting MIDI notes but with no horizonal component */
925 class MidiVerticalSelectDrag : public RubberbandSelectDrag
928 MidiVerticalSelectDrag (Editor *, MidiRegionView *);
930 void select_things (int, framepos_t, framepos_t, double, double, bool);
931 void deselect_things ();
934 MidiRegionView* _region_view;
937 /** Region drag in time-FX mode */
938 class TimeFXDrag : public RegionDrag
941 TimeFXDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
943 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
944 void motion (GdkEvent *, bool);
945 void finished (GdkEvent *, bool);
949 /** Scrub drag in audition mode */
950 class ScrubDrag : public Drag
953 ScrubDrag (Editor *, ArdourCanvas::Item *);
955 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
956 void motion (GdkEvent *, bool);
957 void finished (GdkEvent *, bool);
961 /** Drag in range select mode */
962 class SelectionDrag : public Drag
973 SelectionDrag (Editor *, ArdourCanvas::Item *, Operation);
975 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
976 void motion (GdkEvent *, bool);
977 void finished (GdkEvent *, bool);
980 void setup_pointer_frame_offset ();
983 Operation _operation;
985 int _original_pointer_time_axis;
986 std::list<TimeAxisView*> _added_time_axes;
987 bool _time_selection_at_start;
988 framepos_t start_at_start;
989 framepos_t end_at_start;
992 /** Range marker drag */
993 class RangeMarkerBarDrag : public Drag
999 CreateTransportMarker,
1003 RangeMarkerBarDrag (Editor *, ArdourCanvas::Item *, Operation);
1004 ~RangeMarkerBarDrag ();
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 allow_vertical_autoscroll () const {
1015 bool y_movement_matters () const {
1020 void update_item (ARDOUR::Location *);
1022 Operation _operation;
1023 ArdourCanvas::Rectangle* _drag_rect;
1027 /** Drag of rectangle to set zoom */
1028 class MouseZoomDrag : public Drag
1031 MouseZoomDrag (Editor *, ArdourCanvas::Item *);
1033 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
1034 void motion (GdkEvent *, bool);
1035 void finished (GdkEvent *, bool);
1036 void aborted (bool);
1038 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
1039 return std::make_pair (4, 4);
1046 /** Drag of a range of automation data (either on an automation track or region gain),
1047 * changing value but not position.
1049 class AutomationRangeDrag : public Drag
1052 AutomationRangeDrag (Editor *, AutomationTimeAxisView *, std::list<ARDOUR::AudioRange> const &);
1053 AutomationRangeDrag (Editor *, RegionView *, std::list<ARDOUR::AudioRange> const &);
1055 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
1056 void motion (GdkEvent *, bool);
1057 void finished (GdkEvent *, bool);
1058 void aborted (bool);
1060 bool x_movement_matters () const {
1065 void setup (std::list<boost::shared_ptr<AutomationLine> > const &);
1066 double y_fraction (boost::shared_ptr<AutomationLine>, double global_y_position) const;
1067 double value (boost::shared_ptr<ARDOUR::AutomationList> list, double x) const;
1069 std::list<ARDOUR::AudioRange> _ranges;
1071 /** A line that is part of the drag */
1073 boost::shared_ptr<AutomationLine> line; ///< the line
1074 std::list<ControlPoint*> points; ///< points to drag on the line
1075 std::pair<ARDOUR::framepos_t, ARDOUR::framepos_t> range; ///< the range of all points on the line, in session frames
1076 XMLNode* state; ///< the XML state node before the drag
1077 double original_fraction; ///< initial y-fraction before the drag
1080 std::list<Line> _lines;
1082 bool _nothing_to_drag;
1086 /** Drag of one edge of an xfade
1088 class CrossfadeEdgeDrag : public Drag
1091 CrossfadeEdgeDrag (Editor*, AudioRegionView*, ArdourCanvas::Item*, bool start);
1093 void start_grab (GdkEvent*, Gdk::Cursor* c = 0);
1094 void motion (GdkEvent*, bool);
1095 void finished (GdkEvent*, bool);
1096 void aborted (bool);
1098 bool y_movement_matters () const {
1102 virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
1103 return std::make_pair (4, 4);
1107 AudioRegionView* arv;
1111 #endif /* __gtk2_ardour_editor_drag_h_ */