X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor_drag.h;h=d2593b24632604f40b293c3736ea1c446d852c7c;hb=1474b10d39873538f93a466517f518c5013d1ac3;hp=35920a46a842e46f0bb46c4209403c201458144e;hpb=4297071b3f7360b17d81ef9cf36b8d75d46d2818;p=ardour.git diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index 35920a46a8..d2593b2463 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Paul Davis + Copyright (C) 2009 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ class TimeAxisView; /** Abstract base class for dragging of things within the editor */ class Drag { - + public: Drag (Editor *, ArdourCanvas::Item *); virtual ~Drag () {} @@ -116,7 +116,7 @@ public: protected: nframes64_t adjusted_current_frame (GdkEvent *) const; - + Editor* _editor; ///< our editor ArdourCanvas::Item* _item; ///< our item nframes64_t _pointer_frame_offset; ///< offset from the mouse's position for the drag @@ -136,9 +136,10 @@ protected: bool _x_constrained; ///< true if x motion is constrained, otherwise false bool _y_constrained; ///< true if y motion is constrained, otherwise false bool _was_rolling; ///< true if the session was rolling before the drag started, otherwise false + bool _have_transaction; ///< true if a transaction has been started, false otherwise. Must be set true by derived class. private: - + bool _ending; ///< true if end_grab is in progress, otherwise false bool _had_movement; ///< true if movement has occurred, otherwise false bool _move_threshold_passed; ///< true if the move threshold has been passed, otherwise false @@ -153,7 +154,7 @@ public: virtual ~RegionDrag () {} protected: - + RegionView* _primary; ///< the view that was clicked on (or whatever) to start the drag std::list _views; ///< all views that are being dragged @@ -166,7 +167,7 @@ private: class RegionMotionDrag : public RegionDrag { public: - + RegionMotionDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list const &, bool); virtual ~RegionMotionDrag () {} @@ -177,28 +178,28 @@ public: protected: struct TimeAxisViewSummary { TimeAxisViewSummary () : height_list(512) {} - + std::bitset<512> tracks; std::vector height_list; int visible_y_low; int visible_y_high; }; - + void copy_regions (GdkEvent *); bool y_movement_disallowed (int, int, int, TimeAxisViewSummary const &) const; - std::map find_time_axis_views (); + std::map > find_time_axis_views_and_layers (); double compute_x_delta (GdkEvent const *, nframes64_t *); bool compute_y_delta ( - TimeAxisViewConstPtr, TimeAxisViewPtr, int32_t, int32_t, TimeAxisViewSummary const &, + TimeAxisView const *, TimeAxisView*, int32_t, int32_t, TimeAxisViewSummary const &, int32_t *, int32_t *, int32_t * ); TimeAxisViewSummary get_time_axis_view_summary (); - virtual bool x_move_allowed () const = 0; - - TimeAxisViewPtr _dest_trackview; + bool x_move_allowed () const; + + TimeAxisView* _dest_trackview; ARDOUR::layer_t _dest_layer; - bool check_possible (RouteTimeAxisViewPtr *, ARDOUR::layer_t *); + bool check_possible (RouteTimeAxisView **, ARDOUR::layer_t *); bool _brushing; }; @@ -215,14 +216,12 @@ public: virtual void start_grab (GdkEvent *, Gdk::Cursor *); void motion (GdkEvent *, bool); void finished (GdkEvent *, bool); - + bool apply_move_threshold () const { return true; } private: - bool x_move_allowed () const; - bool _copy; }; @@ -230,12 +229,9 @@ private: class RegionInsertDrag : public RegionMotionDrag { public: - RegionInsertDrag (Editor *, boost::shared_ptr, RouteTimeAxisViewPtr, nframes64_t); + RegionInsertDrag (Editor *, boost::shared_ptr, RouteTimeAxisView*, nframes64_t); void finished (GdkEvent *, bool); - -private: - bool x_move_allowed () const; }; /** Region drag in splice mode */ @@ -252,15 +248,49 @@ public: class RegionCreateDrag : public Drag { public: - RegionCreateDrag (Editor *, ArdourCanvas::Item *, TimeAxisViewPtr); + RegionCreateDrag (Editor *, ArdourCanvas::Item *, TimeAxisView *); void start_grab (GdkEvent *, Gdk::Cursor* c = 0); void motion (GdkEvent *, bool); void finished (GdkEvent *, bool); private: - TimeAxisViewPtr _view; - TimeAxisViewPtr _dest_trackview; + TimeAxisView* _view; + TimeAxisView* _dest_trackview; +}; + +/** Drags to resize MIDI notes */ +class NoteResizeDrag : public Drag +{ +public: + NoteResizeDrag (Editor *, ArdourCanvas::Item *); + + void start_grab (GdkEvent *, Gdk::Cursor* c = 0); + void motion (GdkEvent *, bool); + void finished (GdkEvent *, bool); + +private: + MidiRegionView* region; + bool relative; + bool at_front; +}; + +class NoteDrag : public Drag +{ + public: + NoteDrag (Editor*, ArdourCanvas::Item*); + + void start_grab (GdkEvent *, Gdk::Cursor* c = 0); + void motion (GdkEvent *, bool); + void finished (GdkEvent *, bool); + + private: + MidiRegionView* region; + double last_x; + double last_y; + double drag_delta_x; + double drag_delta_note; + bool was_selected; }; /** Drag of region gain */ @@ -349,7 +379,7 @@ public: private: EditorCursor* _cursor; ///< cursor being dragged bool _stop; ///< true to stop the transport on starting the drag, otherwise false - + }; /** Region fade-in drag */ @@ -387,7 +417,7 @@ public: private: void update_item (ARDOUR::Location *); - + Marker* _marker; ///< marker being dragged std::list _copied_locations; ArdourCanvas::Line* _line; @@ -407,7 +437,7 @@ public: bool active (Editing::MouseMode m); private: - + ControlPoint* _point; double _cumulative_x_drag; double _cumulative_y_drag; @@ -423,7 +453,7 @@ public: void start_grab (GdkEvent *, Gdk::Cursor* c = 0); void motion (GdkEvent *, bool); void finished (GdkEvent *, bool); - + bool active (Editing::MouseMode) { return true; } @@ -463,7 +493,7 @@ class ScrubDrag : public Drag { public: ScrubDrag (Editor *e, ArdourCanvas::Item *i) : Drag (e, i) {} - + void start_grab (GdkEvent *, Gdk::Cursor* c = 0); void motion (GdkEvent *, bool); void finished (GdkEvent *, bool);