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 /** Set up the _pointer_frame_offset */
182 virtual void setup_pointer_frame_offset () {
183 _pointer_frame_offset = 0;
188 double grab_x () const {
192 double grab_y () const {
196 ARDOUR::framepos_t raw_grab_frame () const {
197 return _raw_grab_frame;
200 ARDOUR::framepos_t grab_frame () const {
204 double last_pointer_x () const {
205 return _last_pointer_x;
208 double last_pointer_y () const {
209 return _last_pointer_y;
212 double last_pointer_frame () const {
213 return _last_pointer_frame;
216 double current_pointer_x () const;
217 double current_pointer_y () const;
219 boost::shared_ptr<ARDOUR::Region> add_midi_region (MidiTimeAxisView*);
221 void show_verbose_cursor_time (framepos_t);
222 void show_verbose_cursor_duration (framepos_t, framepos_t, double xoffset = 0);
223 void show_verbose_cursor_text (std::string const &);
225 Editor* _editor; ///< our editor
227 ArdourCanvas::Item* _item; ///< our item
228 /** Offset from the mouse's position for the drag to the start of the thing that is being dragged */
229 ARDOUR::framecnt_t _pointer_frame_offset;
230 bool _x_constrained; ///< true if x motion is constrained, otherwise false
231 bool _y_constrained; ///< true if y motion is constrained, otherwise false
232 bool _was_rolling; ///< true if the session was rolling before the drag started, otherwise false
235 bool _trackview_only; ///< true if pointer y value should always be relative to the top of the trackview group
236 bool _move_threshold_passed; ///< true if the move threshold has been passed, otherwise false
237 bool _starting_point_passed; ///< true if we called move () with first_move flag, otherwise false
238 bool _was_double_click; ///< true if drag initiated by a double click event
239 double _grab_x; ///< trackview x of the grab start position
240 double _grab_y; ///< y of the grab start position, possibly adjusted if _trackview_only is true
241 double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred
242 double _last_pointer_y; ///< trackview y of the pointer last time a motion occurred
243 ARDOUR::framepos_t _raw_grab_frame; ///< unsnapped frame that the mouse was at when start_grab was called, or 0
244 ARDOUR::framepos_t _grab_frame; ///< adjusted_frame that the mouse was at when start_grab was called, or 0
245 ARDOUR::framepos_t _last_pointer_frame; ///< adjusted_frame the last time a motion occurred
246 CursorContext::Handle _cursor_ctx; ///< cursor change context
251 /** Container for details about a region being dragged */
255 DraggingView (RegionView *, RegionDrag *, TimeAxisView* original_tav);
257 RegionView* view; ///< the view
258 /** index into RegionDrag::_time_axis_views of the view that this region is currently being displayed on,
259 * or -1 if it is not visible.
262 /** layer that this region is currently being displayed on. This is a double
263 rather than a layer_t as we use fractional layers during drags to allow the user
264 to indicate a new layer to put a region on.
267 double initial_y; ///< the initial y position of the view before any reparenting
268 framepos_t initial_position; ///< initial position of the region
269 framepos_t initial_end; ///< initial end position of the region
270 framepos_t anchored_fade_length; ///< fade_length when anchored during drag
271 boost::shared_ptr<ARDOUR::Playlist> initial_playlist;
272 TimeAxisView* initial_time_axis_view;
275 /** Abstract base class for drags that involve region(s) */
276 class RegionDrag : public Drag, public sigc::trackable
279 RegionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
280 virtual ~RegionDrag () {}
284 RegionView* _primary; ///< the view that was clicked on (or whatever) to start the drag
285 std::list<DraggingView> _views; ///< information about all views that are being dragged
287 /** a list of the non-hidden TimeAxisViews sorted by editor order key */
288 std::vector<TimeAxisView*> _time_axis_views;
289 int find_time_axis_view (TimeAxisView *) const;
294 friend class DraggingView;
298 void region_going_away (RegionView *);
299 PBD::ScopedConnection death_connection;
303 /** Drags involving region motion from somewhere */
304 class RegionMotionDrag : public RegionDrag
308 RegionMotionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &, bool);
309 virtual ~RegionMotionDrag () {}
311 virtual void start_grab (GdkEvent *, Gdk::Cursor *);
312 virtual void motion (GdkEvent *, bool);
313 virtual void finished (GdkEvent *, bool);
314 virtual void aborted (bool);
316 /** @return true if the regions being `moved' came from somewhere on the canvas;
317 * false if they came from outside (e.g. from the region list).
319 virtual bool regions_came_from_canvas () const = 0;
323 double compute_x_delta (GdkEvent const *, ARDOUR::framepos_t *);
324 virtual bool y_movement_allowed (int, double) const;
327 ARDOUR::framepos_t _last_frame_position; ///< last position of the thing being dragged
328 double _total_x_delta;
329 int _last_pointer_time_axis_view;
330 double _last_pointer_layer;
334 /** Drags to move (or copy) regions that are already shown in the GUI to
335 * somewhere different.
337 class RegionMoveDrag : public RegionMotionDrag
340 RegionMoveDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &, bool, bool);
341 virtual ~RegionMoveDrag () {}
343 void motion (GdkEvent *, bool);
344 void finished (GdkEvent *, bool);
347 bool regions_came_from_canvas () const {
351 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
352 return std::make_pair (4, 4);
355 void setup_pointer_frame_offset ();
358 typedef std::set<boost::shared_ptr<ARDOUR::Playlist> > PlaylistSet;
359 void add_stateful_diff_commands_for_playlists (PlaylistSet const &);
362 void finished_no_copy (
365 ARDOUR::framecnt_t const
371 ARDOUR::framecnt_t const
374 RegionView* insert_region_into_playlist (
375 boost::shared_ptr<ARDOUR::Region>,
382 void remove_region_from_playlist (
383 boost::shared_ptr<ARDOUR::Region>,
384 boost::shared_ptr<ARDOUR::Playlist>,
385 PlaylistSet& modified_playlists
389 void collect_new_region_view (RegionView *);
390 RouteTimeAxisView* create_destination_time_axis (boost::shared_ptr<ARDOUR::Region>, TimeAxisView* original);
393 RegionView* _new_region_view;
396 /** Drag to insert a region from somewhere */
397 class RegionInsertDrag : public RegionMotionDrag
400 RegionInsertDrag (Editor *, boost::shared_ptr<ARDOUR::Region>, RouteTimeAxisView*, ARDOUR::framepos_t);
402 void finished (GdkEvent *, bool);
405 bool regions_came_from_canvas () const {
410 /** Region drag in splice mode */
411 class RegionSpliceDrag : public RegionMoveDrag
414 RegionSpliceDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
416 void motion (GdkEvent *, bool);
417 void finished (GdkEvent *, bool);
421 /** Region drag in ripple mode */
423 class RegionRippleDrag : public RegionMoveDrag
426 RegionRippleDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
427 ~RegionRippleDrag () { delete exclude; }
429 void motion (GdkEvent *, bool);
430 void finished (GdkEvent *, bool);
433 bool y_movement_allowed (int delta_track, double delta_layer) const;
436 TimeAxisView *prev_tav; // where regions were most recently dragged from
437 TimeAxisView *orig_tav; // where drag started
438 framecnt_t prev_amount;
439 framepos_t prev_position;
440 framecnt_t selection_length;
441 bool allow_moves_across_tracks; // only if all selected regions are on one track
442 ARDOUR::RegionList *exclude;
443 void add_all_after_to_views (TimeAxisView *tav, framepos_t where, const RegionSelection &exclude, bool drag_in_progress);
444 void remove_unselected_from_views (framecnt_t amount, bool move_regions);
448 /** "Drag" to cut a region (action only on button release) */
449 class RegionCutDrag : public Drag
452 RegionCutDrag (Editor*, ArdourCanvas::Item*, framepos_t);
455 void motion (GdkEvent*, bool);
456 void finished (GdkEvent*, bool);
463 /** Drags to create regions */
464 class RegionCreateDrag : public Drag
467 RegionCreateDrag (Editor *, ArdourCanvas::Item *, TimeAxisView *);
469 void motion (GdkEvent *, bool);
470 void finished (GdkEvent *, bool);
474 MidiTimeAxisView* _view;
475 boost::shared_ptr<ARDOUR::Region> _region;
478 /** Drags to resize MIDI notes */
479 class NoteResizeDrag : public Drag
482 NoteResizeDrag (Editor *, ArdourCanvas::Item *);
484 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
485 void motion (GdkEvent *, bool);
486 void finished (GdkEvent *, bool);
490 MidiRegionView* region;
495 /** Drags to move MIDI notes */
496 class NoteDrag : public Drag
499 NoteDrag (Editor*, ArdourCanvas::Item*);
501 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
502 void motion (GdkEvent *, bool);
503 void finished (GdkEvent *, bool);
508 ARDOUR::frameoffset_t total_dx () const;
509 int8_t total_dy () const;
511 MidiRegionView* _region;
513 double _cumulative_dx;
514 double _cumulative_dy;
519 class NoteCreateDrag : public Drag
522 NoteCreateDrag (Editor *, ArdourCanvas::Item *, MidiRegionView *);
525 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
526 void motion (GdkEvent *, bool);
527 void finished (GdkEvent *, bool);
530 bool active (Editing::MouseMode mode) {
531 return mode == Editing::MouseDraw;
534 bool y_movement_matters () const {
539 double y_to_region (double) const;
540 framecnt_t grid_frames (framepos_t) const;
542 MidiRegionView* _region_view;
543 ArdourCanvas::Rectangle* _drag_rect;
547 /** Drag to move MIDI patch changes */
548 class PatchChangeDrag : public Drag
551 PatchChangeDrag (Editor *, PatchChange *, MidiRegionView *);
553 void motion (GdkEvent *, bool);
554 void finished (GdkEvent *, bool);
557 bool y_movement_matters () const {
561 void setup_pointer_frame_offset ();
564 MidiRegionView* _region_view;
565 PatchChange* _patch_change;
566 double _cumulative_dx;
569 /** Container for details about audio regions being dragged along with video */
573 AVDraggingView (RegionView *);
575 RegionView* view; ///< the view
576 framepos_t initial_position; ///< initial position of the region
579 /** Drag of video offset */
580 class VideoTimeLineDrag : public Drag
583 VideoTimeLineDrag (Editor *e, ArdourCanvas::Item *i);
585 void motion (GdkEvent *, bool);
586 void finished (GdkEvent *, bool);
587 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
589 bool y_movement_matters () const {
593 bool allow_vertical_autoscroll () const {
600 std::list<AVDraggingView> _views; ///< information about all audio that are being dragged along
603 ARDOUR::frameoffset_t _startdrag_video_offset;
604 ARDOUR::frameoffset_t _max_backwards_drag;
607 /** Drag to trim region(s) */
608 class TrimDrag : public RegionDrag
617 TrimDrag (Editor *, ArdourCanvas::Item *, RegionView*, std::list<RegionView*> const &, bool preserve_fade_anchor = false);
619 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
620 void motion (GdkEvent *, bool);
621 void finished (GdkEvent *, bool);
624 bool y_movement_matters () const {
628 void setup_pointer_frame_offset ();
632 Operation _operation;
634 bool _preserve_fade_anchor;
635 bool _jump_position_when_done;
638 /** Meter marker drag */
639 class MeterMarkerDrag : public Drag
642 MeterMarkerDrag (Editor *, ArdourCanvas::Item *, bool);
644 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
645 void motion (GdkEvent *, bool);
646 void finished (GdkEvent *, bool);
649 bool allow_vertical_autoscroll () const {
653 bool y_movement_matters () const {
657 void setup_pointer_frame_offset ();
660 MeterMarker* _marker;
662 XMLNode* before_state;
665 /** Tempo marker drag */
666 class TempoMarkerDrag : public Drag
669 TempoMarkerDrag (Editor *, ArdourCanvas::Item *, bool);
671 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
672 void motion (GdkEvent *, bool);
673 void finished (GdkEvent *, bool);
676 bool allow_vertical_autoscroll () const {
680 bool y_movement_matters () const {
684 void setup_pointer_frame_offset ();
687 TempoMarker* _marker;
689 XMLNode* before_state;
693 /** Drag of the playhead cursor */
694 class CursorDrag : public Drag
697 CursorDrag (Editor *, EditorCursor&, bool);
699 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
700 void motion (GdkEvent *, bool);
701 void finished (GdkEvent *, bool);
704 bool allow_vertical_autoscroll () const {
708 bool y_movement_matters () const {
713 void fake_locate (framepos_t);
715 EditorCursor& _cursor;
716 bool _stop; ///< true to stop the transport on starting the drag, otherwise false
717 double _grab_zoom; ///< editor frames per unit when our grab started
720 /** Region fade-in drag */
721 class FadeInDrag : public RegionDrag
724 FadeInDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
726 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
727 void motion (GdkEvent *, bool);
728 void finished (GdkEvent *, bool);
731 bool y_movement_matters () const {
735 void setup_pointer_frame_offset ();
738 /** Region fade-out drag */
739 class FadeOutDrag : public RegionDrag
742 FadeOutDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
744 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
745 void motion (GdkEvent *, bool);
746 void finished (GdkEvent *, bool);
749 bool y_movement_matters () const {
753 void setup_pointer_frame_offset ();
757 class MarkerDrag : public Drag
760 MarkerDrag (Editor *, ArdourCanvas::Item *);
763 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
764 void motion (GdkEvent *, bool);
765 void finished (GdkEvent *, bool);
768 bool allow_vertical_autoscroll () const {
772 bool y_movement_matters () const {
776 void setup_pointer_frame_offset ();
779 void update_item (ARDOUR::Location *);
781 Marker* _marker; ///< marker being dragged
783 struct CopiedLocationMarkerInfo {
784 ARDOUR::Location* location;
785 std::vector<Marker*> markers;
787 CopiedLocationMarkerInfo (ARDOUR::Location* l, Marker* m);
790 typedef std::list<CopiedLocationMarkerInfo> CopiedLocationInfo;
791 CopiedLocationInfo _copied_locations;
792 ArdourCanvas::Points _points;
795 /** Control point drag */
796 class ControlPointDrag : public Drag
799 ControlPointDrag (Editor *, ArdourCanvas::Item *);
801 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
802 void motion (GdkEvent *, bool);
803 void finished (GdkEvent *, bool);
806 bool active (Editing::MouseMode m);
810 ControlPoint* _point;
811 double _fixed_grab_x;
812 double _fixed_grab_y;
813 double _cumulative_x_drag;
814 double _cumulative_y_drag;
816 uint32_t _final_index;
817 static double _zero_gain_fraction;
820 /** Gain or automation line drag */
821 class LineDrag : public Drag
824 LineDrag (Editor *e, ArdourCanvas::Item *i);
826 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
827 void motion (GdkEvent *, bool);
828 void finished (GdkEvent *, bool);
833 AutomationLine* _line;
834 double _fixed_grab_x;
835 double _fixed_grab_y;
836 double _cumulative_y_drag;
839 /** Transient feature line drags*/
840 class FeatureLineDrag : public Drag
843 FeatureLineDrag (Editor *e, ArdourCanvas::Item *i);
845 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
846 void motion (GdkEvent *, bool);
847 void finished (GdkEvent *, bool);
852 ArdourCanvas::Line* _line;
853 AudioRegionView* _arv;
855 double _region_view_grab_x;
856 double _cumulative_x_drag;
862 /** Dragging of a rubberband rectangle for selecting things */
863 class RubberbandSelectDrag : public Drag
866 RubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
868 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
869 void motion (GdkEvent *, bool);
870 void finished (GdkEvent *, bool);
873 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
874 return std::make_pair (8, 1);
877 void do_select_things (GdkEvent *, bool);
879 /** Select some things within a rectangle.
880 * @param button_state The button state from the GdkEvent.
881 * @param x1 The left-hand side of the rectangle in session frames.
882 * @param x2 The right-hand side of the rectangle in session frames.
883 * @param y1 The top of the rectangle in trackview coordinates.
884 * @param y2 The bottom of the rectangle in trackview coordinates.
885 * @param drag_in_progress true if the drag is currently happening.
887 virtual void select_things (int button_state, framepos_t x1, framepos_t x2, double y1, double y2, bool drag_in_progress) = 0;
889 virtual void deselect_things () = 0;
895 /** A general editor RubberbandSelectDrag (for regions, automation points etc.) */
896 class EditorRubberbandSelectDrag : public RubberbandSelectDrag
899 EditorRubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
901 void select_things (int, framepos_t, framepos_t, double, double, bool);
902 void deselect_things ();
905 /** A RubberbandSelectDrag for selecting MIDI notes */
906 class MidiRubberbandSelectDrag : public RubberbandSelectDrag
909 MidiRubberbandSelectDrag (Editor *, MidiRegionView *);
911 void select_things (int, framepos_t, framepos_t, double, double, bool);
912 void deselect_things ();
915 MidiRegionView* _region_view;
918 /** A RubberbandSelectDrag for selecting MIDI notes but with no horizonal component */
919 class MidiVerticalSelectDrag : public RubberbandSelectDrag
922 MidiVerticalSelectDrag (Editor *, MidiRegionView *);
924 void select_things (int, framepos_t, framepos_t, double, double, bool);
925 void deselect_things ();
928 MidiRegionView* _region_view;
931 /** Region drag in time-FX mode */
932 class TimeFXDrag : public RegionDrag
935 TimeFXDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
937 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
938 void motion (GdkEvent *, bool);
939 void finished (GdkEvent *, bool);
943 /** Scrub drag in audition mode */
944 class ScrubDrag : public Drag
947 ScrubDrag (Editor *, ArdourCanvas::Item *);
949 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
950 void motion (GdkEvent *, bool);
951 void finished (GdkEvent *, bool);
955 /** Drag in range select mode */
956 class SelectionDrag : public Drag
967 SelectionDrag (Editor *, ArdourCanvas::Item *, Operation);
969 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
970 void motion (GdkEvent *, bool);
971 void finished (GdkEvent *, bool);
974 void setup_pointer_frame_offset ();
977 Operation _operation;
979 int _original_pointer_time_axis;
980 std::list<TimeAxisView*> _added_time_axes;
981 bool _time_selection_at_start;
982 framepos_t start_at_start;
983 framepos_t end_at_start;
986 /** Range marker drag */
987 class RangeMarkerBarDrag : public Drag
993 CreateTransportMarker,
997 RangeMarkerBarDrag (Editor *, ArdourCanvas::Item *, Operation);
999 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
1000 void motion (GdkEvent *, bool);
1001 void finished (GdkEvent *, bool);
1002 void aborted (bool);
1004 bool allow_vertical_autoscroll () const {
1008 bool y_movement_matters () const {
1013 void update_item (ARDOUR::Location *);
1015 Operation _operation;
1016 ArdourCanvas::Rectangle* _drag_rect;
1020 /** Drag of rectangle to set zoom */
1021 class MouseZoomDrag : public Drag
1024 MouseZoomDrag (Editor *, ArdourCanvas::Item *);
1026 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
1027 void motion (GdkEvent *, bool);
1028 void finished (GdkEvent *, bool);
1029 void aborted (bool);
1031 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
1032 return std::make_pair (4, 4);
1039 /** Drag of a range of automation data (either on an automation track or region gain),
1040 * changing value but not position.
1042 class AutomationRangeDrag : public Drag
1045 AutomationRangeDrag (Editor *, AutomationTimeAxisView *, std::list<ARDOUR::AudioRange> const &);
1046 AutomationRangeDrag (Editor *, RegionView *, std::list<ARDOUR::AudioRange> const &);
1048 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
1049 void motion (GdkEvent *, bool);
1050 void finished (GdkEvent *, bool);
1051 void aborted (bool);
1053 bool x_movement_matters () const {
1058 void setup (std::list<boost::shared_ptr<AutomationLine> > const &);
1059 double y_fraction (boost::shared_ptr<AutomationLine>, double global_y_position) const;
1060 double value (boost::shared_ptr<ARDOUR::AutomationList> list, double x) const;
1062 std::list<ARDOUR::AudioRange> _ranges;
1064 /** A line that is part of the drag */
1066 boost::shared_ptr<AutomationLine> line; ///< the line
1067 std::list<ControlPoint*> points; ///< points to drag on the line
1068 std::pair<ARDOUR::framepos_t, ARDOUR::framepos_t> range; ///< the range of all points on the line, in session frames
1069 XMLNode* state; ///< the XML state node before the drag
1070 double original_fraction; ///< initial y-fraction before the drag
1073 std::list<Line> _lines;
1075 bool _nothing_to_drag;
1079 /** Drag of one edge of an xfade
1081 class CrossfadeEdgeDrag : public Drag
1084 CrossfadeEdgeDrag (Editor*, AudioRegionView*, ArdourCanvas::Item*, bool start);
1086 void start_grab (GdkEvent*, Gdk::Cursor* c = 0);
1087 void motion (GdkEvent*, bool);
1088 void finished (GdkEvent*, bool);
1089 void aborted (bool);
1091 bool y_movement_matters () const {
1095 virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
1096 return std::make_pair (4, 4);
1100 AudioRegionView* arv;
1104 #endif /* __gtk2_ardour_editor_drag_h_ */