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"
38 class StatefulDiffCommand;
45 class MidiTimeAxisView;
49 /** Class to manage current drags */
54 DragManager (Editor* e);
57 bool motion_handler (GdkEvent *, bool);
61 void set (Drag *, GdkEvent *, Gdk::Cursor* c = 0);
62 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
63 bool end_grab (GdkEvent *);
64 bool have_item (ArdourCanvas::Item *) const;
66 void mark_double_click ();
68 /** @return true if an end drag or abort is in progress */
69 bool ending () const {
73 bool active () const {
74 return !_drags.empty ();
77 /** @return current pointer x position in canvas coordinates */
78 double current_pointer_x () const {
79 return _current_pointer_x;
82 /** @return current pointer y position in canvas coordinates */
83 double current_pointer_y () const {
84 return _current_pointer_y;
87 /** @return current pointer frame */
88 ARDOUR::framepos_t current_pointer_frame () const {
89 return _current_pointer_frame;
94 std::list<Drag*> _drags;
95 bool _ending; ///< true if end_grab or abort is in progress, otherwise false
96 double _current_pointer_x; ///< canvas-coordinate space x of the current pointer
97 double _current_pointer_y; ///< canvas-coordinate space y of the current pointer
98 ARDOUR::framepos_t _current_pointer_frame; ///< frame that the pointer is now at
99 bool _old_follow_playhead; ///< state of Editor::follow_playhead() before the drags started
102 /** Abstract base class for dragging of things within the editor */
106 Drag (Editor *, ArdourCanvas::Item *, bool trackview_only = true);
109 void set_manager (DragManager* m) {
113 /** @return the canvas item being dragged */
114 ArdourCanvas::Item* item () const {
118 void swap_grab (ArdourCanvas::Item *, Gdk::Cursor *, uint32_t);
119 bool motion_handler (GdkEvent*, bool);
122 ARDOUR::framepos_t adjusted_frame (ARDOUR::framepos_t, GdkEvent const *, bool snap = true) const;
123 ARDOUR::framepos_t adjusted_current_frame (GdkEvent const *, bool snap = true) const;
125 bool was_double_click() const { return _was_double_click; }
126 void set_double_click (bool yn) { _was_double_click = yn; }
128 /** Called to start a grab of an item.
129 * @param e Event that caused the grab to start.
130 * @param c Cursor to use, or 0.
132 virtual void start_grab (GdkEvent* e, Gdk::Cursor* c = 0);
134 virtual bool end_grab (GdkEvent *);
136 /** Called when a drag motion has occurred.
137 * @param e Event describing the motion.
138 * @param f true if this is the first movement, otherwise false.
140 virtual void motion (GdkEvent* e, bool f) = 0;
142 /** Called when a drag has finished.
143 * @param e Event describing the finish.
144 * @param m true if some movement occurred, otherwise false.
146 virtual void finished (GdkEvent* e, bool m) = 0;
148 /** Called to abort a drag and return things to how
149 * they were before it started.
150 * @param m true if some movement occurred, otherwise false.
152 virtual void aborted (bool m) = 0;
154 /** @param m Mouse mode.
155 * @return true if this drag should happen in this mouse mode.
157 virtual bool active (Editing::MouseMode m) {
161 /** @return minimum number of frames (in x) and pixels (in y) that should be considered a movement */
162 virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
163 return std::make_pair (1, 1);
166 virtual bool allow_vertical_autoscroll () const {
170 /** @return true if x movement matters to this drag */
171 virtual bool x_movement_matters () const {
175 /** @return true if y movement matters to this drag */
176 virtual bool y_movement_matters () const {
180 /** Set up the _pointer_frame_offset */
181 virtual void setup_pointer_frame_offset () {
182 _pointer_frame_offset = 0;
187 double grab_x () const {
191 double grab_y () const {
195 ARDOUR::framepos_t raw_grab_frame () const {
196 return _raw_grab_frame;
199 ARDOUR::framepos_t grab_frame () const {
203 double last_pointer_x () const {
204 return _last_pointer_x;
207 double last_pointer_y () const {
208 return _last_pointer_y;
211 double last_pointer_frame () const {
212 return _last_pointer_frame;
215 double current_pointer_x () const;
216 double current_pointer_y () const;
218 boost::shared_ptr<ARDOUR::Region> add_midi_region (MidiTimeAxisView*);
220 void show_verbose_cursor_time (framepos_t);
221 void show_verbose_cursor_duration (framepos_t, framepos_t, double xoffset = 0);
222 void show_verbose_cursor_text (std::string const &);
224 Editor* _editor; ///< our editor
226 ArdourCanvas::Item* _item; ///< our item
227 /** Offset from the mouse's position for the drag to the start of the thing that is being dragged */
228 ARDOUR::framecnt_t _pointer_frame_offset;
229 bool _x_constrained; ///< true if x motion is constrained, otherwise false
230 bool _y_constrained; ///< true if y motion is constrained, otherwise false
231 bool _was_rolling; ///< true if the session was rolling before the drag started, otherwise false
234 bool _trackview_only; ///< true if pointer y value should always be relative to the top of the trackview group
235 bool _move_threshold_passed; ///< true if the move threshold has been passed, otherwise false
236 bool _was_double_click; ///< true if drag initiated by a double click event
237 double _grab_x; ///< trackview x of the grab start position
238 double _grab_y; ///< y of the grab start position, possibly adjusted if _trackview_only is true
239 double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred
240 double _last_pointer_y; ///< trackview y of the pointer last time a motion occurred
241 ARDOUR::framepos_t _raw_grab_frame; ///< unsnapped frame that the mouse was at when start_grab was called, or 0
242 ARDOUR::framepos_t _grab_frame; ///< adjusted_frame that the mouse was at when start_grab was called, or 0
243 ARDOUR::framepos_t _last_pointer_frame; ///< adjusted_frame the last time a motion occurred
244 CursorContext::Handle _cursor_ctx; ///< cursor change context
249 /** Container for details about a region being dragged */
253 DraggingView (RegionView *, RegionDrag *, TimeAxisView* original_tav);
255 RegionView* view; ///< the view
256 /** index into RegionDrag::_time_axis_views of the view that this region is currently being displayed on,
257 * or -1 if it is not visible.
260 /** layer that this region is currently being displayed on. This is a double
261 rather than a layer_t as we use fractional layers during drags to allow the user
262 to indicate a new layer to put a region on.
265 double initial_y; ///< the initial y position of the view before any reparenting
266 framepos_t initial_position; ///< initial position of the region
267 framepos_t initial_end; ///< initial end position of the region
268 framepos_t anchored_fade_length; ///< fade_length when anchored during drag
269 boost::shared_ptr<ARDOUR::Playlist> initial_playlist;
270 TimeAxisView* initial_time_axis_view;
273 /** Abstract base class for drags that involve region(s) */
274 class RegionDrag : public Drag, public sigc::trackable
277 RegionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
278 virtual ~RegionDrag () {}
282 RegionView* _primary; ///< the view that was clicked on (or whatever) to start the drag
283 std::list<DraggingView> _views; ///< information about all views that are being dragged
285 /** a list of the non-hidden TimeAxisViews sorted by editor order key */
286 std::vector<TimeAxisView*> _time_axis_views;
287 int find_time_axis_view (TimeAxisView *) const;
292 friend class DraggingView;
296 void region_going_away (RegionView *);
297 PBD::ScopedConnection death_connection;
301 /** Drags involving region motion from somewhere */
302 class RegionMotionDrag : public RegionDrag
306 RegionMotionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &, bool);
307 virtual ~RegionMotionDrag () {}
309 virtual void start_grab (GdkEvent *, Gdk::Cursor *);
310 virtual void motion (GdkEvent *, bool);
311 virtual void finished (GdkEvent *, bool);
312 virtual void aborted (bool);
314 /** @return true if the regions being `moved' came from somewhere on the canvas;
315 * false if they came from outside (e.g. from the region list).
317 virtual bool regions_came_from_canvas () const = 0;
321 double compute_x_delta (GdkEvent const *, ARDOUR::framepos_t *);
322 virtual bool y_movement_allowed (int, double) const;
325 ARDOUR::framepos_t _last_frame_position; ///< last position of the thing being dragged
326 double _total_x_delta;
327 int _last_pointer_time_axis_view;
328 double _last_pointer_layer;
332 /** Drags to move (or copy) regions that are already shown in the GUI to
333 * somewhere different.
335 class RegionMoveDrag : public RegionMotionDrag
338 RegionMoveDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &, bool, bool);
339 virtual ~RegionMoveDrag () {}
341 void motion (GdkEvent *, bool);
342 void finished (GdkEvent *, bool);
345 bool regions_came_from_canvas () const {
349 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
350 return std::make_pair (4, 4);
353 void setup_pointer_frame_offset ();
356 typedef std::set<boost::shared_ptr<ARDOUR::Playlist> > PlaylistSet;
357 void add_stateful_diff_commands_for_playlists (PlaylistSet const &);
360 void finished_no_copy (
363 ARDOUR::framecnt_t const
369 ARDOUR::framecnt_t const
372 RegionView* insert_region_into_playlist (
373 boost::shared_ptr<ARDOUR::Region>,
380 void remove_region_from_playlist (
381 boost::shared_ptr<ARDOUR::Region>,
382 boost::shared_ptr<ARDOUR::Playlist>,
383 PlaylistSet& modified_playlists
387 void collect_new_region_view (RegionView *);
388 RouteTimeAxisView* create_destination_time_axis (boost::shared_ptr<ARDOUR::Region>, TimeAxisView* original);
391 RegionView* _new_region_view;
394 /** Drag to insert a region from somewhere */
395 class RegionInsertDrag : public RegionMotionDrag
398 RegionInsertDrag (Editor *, boost::shared_ptr<ARDOUR::Region>, RouteTimeAxisView*, ARDOUR::framepos_t);
400 void finished (GdkEvent *, bool);
403 bool regions_came_from_canvas () const {
408 /** Region drag in splice mode */
409 class RegionSpliceDrag : public RegionMoveDrag
412 RegionSpliceDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
414 void motion (GdkEvent *, bool);
415 void finished (GdkEvent *, bool);
419 /** Region drag in ripple mode */
421 class RegionRippleDrag : public RegionMoveDrag
424 RegionRippleDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
425 ~RegionRippleDrag () { delete exclude; }
427 void motion (GdkEvent *, bool);
428 void finished (GdkEvent *, bool);
431 bool y_movement_allowed (int delta_track, double delta_layer) const;
434 TimeAxisView *prev_tav; // where regions were most recently dragged from
435 TimeAxisView *orig_tav; // where drag started
436 framecnt_t prev_amount;
437 framepos_t prev_position;
438 framecnt_t selection_length;
439 bool allow_moves_across_tracks; // only if all selected regions are on one track
440 ARDOUR::RegionList *exclude;
441 void add_all_after_to_views (TimeAxisView *tav, framepos_t where, const RegionSelection &exclude, bool drag_in_progress);
442 void remove_unselected_from_views (framecnt_t amount, bool move_regions);
446 /** "Drag" to cut a region (action only on button release) */
447 class RegionCutDrag : public Drag
450 RegionCutDrag (Editor*, ArdourCanvas::Item*, framepos_t);
453 void motion (GdkEvent*, bool);
454 void finished (GdkEvent*, bool);
461 /** Drags to create regions */
462 class RegionCreateDrag : public Drag
465 RegionCreateDrag (Editor *, ArdourCanvas::Item *, TimeAxisView *);
467 void motion (GdkEvent *, bool);
468 void finished (GdkEvent *, bool);
472 MidiTimeAxisView* _view;
473 boost::shared_ptr<ARDOUR::Region> _region;
476 /** Drags to resize MIDI notes */
477 class NoteResizeDrag : public Drag
480 NoteResizeDrag (Editor *, ArdourCanvas::Item *);
482 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
483 void motion (GdkEvent *, bool);
484 void finished (GdkEvent *, bool);
488 MidiRegionView* region;
493 /** Drags to move MIDI notes */
494 class NoteDrag : public Drag
497 NoteDrag (Editor*, ArdourCanvas::Item*);
499 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
500 void motion (GdkEvent *, bool);
501 void finished (GdkEvent *, bool);
506 ARDOUR::frameoffset_t total_dx () const;
507 int8_t total_dy () const;
509 MidiRegionView* _region;
511 double _cumulative_dx;
512 double _cumulative_dy;
517 class NoteCreateDrag : public Drag
520 NoteCreateDrag (Editor *, ArdourCanvas::Item *, MidiRegionView *);
523 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
524 void motion (GdkEvent *, bool);
525 void finished (GdkEvent *, bool);
528 bool active (Editing::MouseMode mode) {
529 return mode == Editing::MouseDraw;
532 bool y_movement_matters () const {
537 double y_to_region (double) const;
538 framecnt_t grid_frames (framepos_t) const;
540 MidiRegionView* _region_view;
541 ArdourCanvas::Rectangle* _drag_rect;
545 /** Drag to move MIDI patch changes */
546 class PatchChangeDrag : public Drag
549 PatchChangeDrag (Editor *, PatchChange *, MidiRegionView *);
551 void motion (GdkEvent *, bool);
552 void finished (GdkEvent *, bool);
555 bool y_movement_matters () const {
559 void setup_pointer_frame_offset ();
562 MidiRegionView* _region_view;
563 PatchChange* _patch_change;
564 double _cumulative_dx;
567 /** Container for details about audio regions being dragged along with video */
571 AVDraggingView (RegionView *);
573 RegionView* view; ///< the view
574 framepos_t initial_position; ///< initial position of the region
577 /** Drag of video offset */
578 class VideoTimeLineDrag : public Drag
581 VideoTimeLineDrag (Editor *e, ArdourCanvas::Item *i);
583 void motion (GdkEvent *, bool);
584 void finished (GdkEvent *, bool);
585 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
587 bool y_movement_matters () const {
591 bool allow_vertical_autoscroll () const {
598 std::list<AVDraggingView> _views; ///< information about all audio that are being dragged along
601 ARDOUR::frameoffset_t _startdrag_video_offset;
602 ARDOUR::frameoffset_t _max_backwards_drag;
605 /** Drag to trim region(s) */
606 class TrimDrag : public RegionDrag
615 TrimDrag (Editor *, ArdourCanvas::Item *, RegionView*, std::list<RegionView*> const &, bool preserve_fade_anchor = false);
617 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
618 void motion (GdkEvent *, bool);
619 void finished (GdkEvent *, bool);
622 bool y_movement_matters () const {
626 void setup_pointer_frame_offset ();
630 Operation _operation;
632 bool _preserve_fade_anchor;
633 bool _jump_position_when_done;
636 /** Meter marker drag */
637 class MeterMarkerDrag : public Drag
640 MeterMarkerDrag (Editor *, ArdourCanvas::Item *, bool);
642 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
643 void motion (GdkEvent *, bool);
644 void finished (GdkEvent *, bool);
647 bool allow_vertical_autoscroll () const {
651 bool y_movement_matters () const {
655 void setup_pointer_frame_offset ();
658 MeterMarker* _marker;
660 XMLNode* before_state;
663 /** Tempo marker drag */
664 class TempoMarkerDrag : public Drag
667 TempoMarkerDrag (Editor *, ArdourCanvas::Item *, bool);
669 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
670 void motion (GdkEvent *, bool);
671 void finished (GdkEvent *, bool);
674 bool allow_vertical_autoscroll () const {
678 bool y_movement_matters () const {
682 void setup_pointer_frame_offset ();
685 TempoMarker* _marker;
687 XMLNode* before_state;
691 /** Drag of the playhead cursor */
692 class CursorDrag : public Drag
695 CursorDrag (Editor *, EditorCursor&, bool);
697 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
698 void motion (GdkEvent *, bool);
699 void finished (GdkEvent *, bool);
702 bool allow_vertical_autoscroll () const {
706 bool y_movement_matters () const {
711 void fake_locate (framepos_t);
713 EditorCursor& _cursor;
714 bool _stop; ///< true to stop the transport on starting the drag, otherwise false
715 double _grab_zoom; ///< editor frames per unit when our grab started
718 /** Region fade-in drag */
719 class FadeInDrag : public RegionDrag
722 FadeInDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
724 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
725 void motion (GdkEvent *, bool);
726 void finished (GdkEvent *, bool);
729 bool y_movement_matters () const {
733 void setup_pointer_frame_offset ();
736 /** Region fade-out drag */
737 class FadeOutDrag : public RegionDrag
740 FadeOutDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
742 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
743 void motion (GdkEvent *, bool);
744 void finished (GdkEvent *, bool);
747 bool y_movement_matters () const {
751 void setup_pointer_frame_offset ();
755 class MarkerDrag : public Drag
758 MarkerDrag (Editor *, ArdourCanvas::Item *);
761 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
762 void motion (GdkEvent *, bool);
763 void finished (GdkEvent *, bool);
766 bool allow_vertical_autoscroll () const {
770 bool y_movement_matters () const {
774 void setup_pointer_frame_offset ();
777 void update_item (ARDOUR::Location *);
779 Marker* _marker; ///< marker being dragged
781 struct CopiedLocationMarkerInfo {
782 ARDOUR::Location* location;
783 std::vector<Marker*> markers;
785 CopiedLocationMarkerInfo (ARDOUR::Location* l, Marker* m);
788 typedef std::list<CopiedLocationMarkerInfo> CopiedLocationInfo;
789 CopiedLocationInfo _copied_locations;
790 ArdourCanvas::Points _points;
793 /** Control point drag */
794 class ControlPointDrag : public Drag
797 ControlPointDrag (Editor *, ArdourCanvas::Item *);
799 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
800 void motion (GdkEvent *, bool);
801 void finished (GdkEvent *, bool);
804 bool active (Editing::MouseMode m);
808 ControlPoint* _point;
809 double _fixed_grab_x;
810 double _fixed_grab_y;
811 double _cumulative_x_drag;
812 double _cumulative_y_drag;
814 uint32_t _final_index;
815 static double _zero_gain_fraction;
818 /** Gain or automation line drag */
819 class LineDrag : public Drag
822 LineDrag (Editor *e, ArdourCanvas::Item *i);
824 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
825 void motion (GdkEvent *, bool);
826 void finished (GdkEvent *, bool);
831 AutomationLine* _line;
832 double _fixed_grab_x;
833 double _fixed_grab_y;
834 double _cumulative_y_drag;
837 /** Transient feature line drags*/
838 class FeatureLineDrag : public Drag
841 FeatureLineDrag (Editor *e, ArdourCanvas::Item *i);
843 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
844 void motion (GdkEvent *, bool);
845 void finished (GdkEvent *, bool);
850 ArdourCanvas::Line* _line;
851 AudioRegionView* _arv;
853 double _region_view_grab_x;
854 double _cumulative_x_drag;
860 /** Dragging of a rubberband rectangle for selecting things */
861 class RubberbandSelectDrag : public Drag
864 RubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
866 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
867 void motion (GdkEvent *, bool);
868 void finished (GdkEvent *, bool);
871 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
872 return std::make_pair (8, 1);
875 void do_select_things (GdkEvent *, bool);
877 /** Select some things within a rectangle.
878 * @param button_state The button state from the GdkEvent.
879 * @param x1 The left-hand side of the rectangle in session frames.
880 * @param x2 The right-hand side of the rectangle in session frames.
881 * @param y1 The top of the rectangle in trackview coordinates.
882 * @param y2 The bottom of the rectangle in trackview coordinates.
883 * @param drag_in_progress true if the drag is currently happening.
885 virtual void select_things (int button_state, framepos_t x1, framepos_t x2, double y1, double y2, bool drag_in_progress) = 0;
887 virtual void deselect_things () = 0;
893 /** A general editor RubberbandSelectDrag (for regions, automation points etc.) */
894 class EditorRubberbandSelectDrag : public RubberbandSelectDrag
897 EditorRubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
899 void select_things (int, framepos_t, framepos_t, double, double, bool);
900 void deselect_things ();
903 /** A RubberbandSelectDrag for selecting MIDI notes */
904 class MidiRubberbandSelectDrag : public RubberbandSelectDrag
907 MidiRubberbandSelectDrag (Editor *, MidiRegionView *);
909 void select_things (int, framepos_t, framepos_t, double, double, bool);
910 void deselect_things ();
913 MidiRegionView* _region_view;
916 /** A RubberbandSelectDrag for selecting MIDI notes but with no horizonal component */
917 class MidiVerticalSelectDrag : public RubberbandSelectDrag
920 MidiVerticalSelectDrag (Editor *, MidiRegionView *);
922 void select_things (int, framepos_t, framepos_t, double, double, bool);
923 void deselect_things ();
926 MidiRegionView* _region_view;
929 /** Region drag in time-FX mode */
930 class TimeFXDrag : public RegionDrag
933 TimeFXDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
935 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
936 void motion (GdkEvent *, bool);
937 void finished (GdkEvent *, bool);
941 /** Scrub drag in audition mode */
942 class ScrubDrag : public Drag
945 ScrubDrag (Editor *, ArdourCanvas::Item *);
947 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
948 void motion (GdkEvent *, bool);
949 void finished (GdkEvent *, bool);
953 /** Drag in range select mode */
954 class SelectionDrag : public Drag
965 SelectionDrag (Editor *, ArdourCanvas::Item *, Operation);
967 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
968 void motion (GdkEvent *, bool);
969 void finished (GdkEvent *, bool);
972 void setup_pointer_frame_offset ();
975 Operation _operation;
977 int _original_pointer_time_axis;
978 std::list<TimeAxisView*> _added_time_axes;
979 bool _time_selection_at_start;
980 framepos_t start_at_start;
981 framepos_t end_at_start;
984 /** Range marker drag */
985 class RangeMarkerBarDrag : public Drag
991 CreateTransportMarker,
995 RangeMarkerBarDrag (Editor *, ArdourCanvas::Item *, Operation);
997 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
998 void motion (GdkEvent *, bool);
999 void finished (GdkEvent *, bool);
1000 void aborted (bool);
1002 bool allow_vertical_autoscroll () const {
1006 bool y_movement_matters () const {
1011 void update_item (ARDOUR::Location *);
1013 Operation _operation;
1014 ArdourCanvas::Rectangle* _drag_rect;
1018 /** Drag of rectangle to set zoom */
1019 class MouseZoomDrag : public Drag
1022 MouseZoomDrag (Editor *, ArdourCanvas::Item *);
1024 void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
1025 void motion (GdkEvent *, bool);
1026 void finished (GdkEvent *, bool);
1027 void aborted (bool);
1029 std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
1030 return std::make_pair (4, 4);
1037 /** Drag of a range of automation data (either on an automation track or region gain),
1038 * changing value but not position.
1040 class AutomationRangeDrag : public Drag
1043 AutomationRangeDrag (Editor *, AutomationTimeAxisView *, std::list<ARDOUR::AudioRange> const &);
1044 AutomationRangeDrag (Editor *, RegionView *, std::list<ARDOUR::AudioRange> const &);
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 x_movement_matters () const {
1056 void setup (std::list<boost::shared_ptr<AutomationLine> > const &);
1057 double y_fraction (boost::shared_ptr<AutomationLine>, double global_y_position) const;
1058 double value (boost::shared_ptr<ARDOUR::AutomationList> list, double x) const;
1060 std::list<ARDOUR::AudioRange> _ranges;
1062 /** A line that is part of the drag */
1064 boost::shared_ptr<AutomationLine> line; ///< the line
1065 std::list<ControlPoint*> points; ///< points to drag on the line
1066 std::pair<ARDOUR::framepos_t, ARDOUR::framepos_t> range; ///< the range of all points on the line, in session frames
1067 XMLNode* state; ///< the XML state node before the drag
1068 double original_fraction; ///< initial y-fraction before the drag
1071 std::list<Line> _lines;
1073 bool _nothing_to_drag;
1077 /** Drag of one edge of an xfade
1079 class CrossfadeEdgeDrag : public Drag
1082 CrossfadeEdgeDrag (Editor*, AudioRegionView*, ArdourCanvas::Item*, bool start);
1084 void start_grab (GdkEvent*, Gdk::Cursor* c = 0);
1085 void motion (GdkEvent*, bool);
1086 void finished (GdkEvent*, bool);
1087 void aborted (bool);
1089 bool y_movement_matters () const {
1093 virtual std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
1094 return std::make_pair (4, 4);
1098 AudioRegionView* arv;
1102 #endif /* __gtk2_ardour_editor_drag_h_ */