X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor_drag.h;h=f235881d035287376d7bcabd1ce77d828f3b8b6a;hb=d6106b22cb755f0d5087c8b1b74b2ca3bd41e350;hp=1b8bfb140892345c41b63a3997375ad93fee196d;hpb=ca046a8bb2379d80c1cfe1e919d63dc0ac6d2475;p=ardour.git diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index 1b8bfb1408..f235881d03 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -502,6 +502,7 @@ class RegionCutDrag : public Drag RegionCutDrag (Editor*, ArdourCanvas::Item*, framepos_t); ~RegionCutDrag (); + void start_grab (GdkEvent *, Gdk::Cursor* c = 0); void motion (GdkEvent*, bool); void finished (GdkEvent*, bool); void aborted (bool); @@ -591,11 +592,50 @@ private: double y_to_region (double) const; ARDOUR::framecnt_t grid_frames (framepos_t) const; + /** @return minimum number of frames (in x) and pixels (in y) that should be considered a movement */ + virtual std::pair move_threshold () const { + return std::make_pair (0, 0); + } + MidiRegionView* _region_view; ArdourCanvas::Rectangle* _drag_rect; framepos_t _note[2]; }; +class HitCreateDrag : public Drag +{ +public: + HitCreateDrag (Editor *, ArdourCanvas::Item *, MidiRegionView *); + ~HitCreateDrag (); + + void start_grab (GdkEvent *, Gdk::Cursor* c = 0); + void motion (GdkEvent *, bool); + void finished (GdkEvent *, bool); + void aborted (bool); + + bool active (Editing::MouseMode mode) { + return mode == Editing::MouseDraw || mode == Editing::MouseContent; + } + + bool y_movement_matters () const { + return false; + } + +private: + double y_to_region (double) const; + ARDOUR::framecnt_t grid_frames (framepos_t) const; + + /** @return minimum number of frames (in x) and pixels (in y) that should be considered a movement */ + virtual std::pair move_threshold () const { + return std::make_pair (0, 0); + } + + MidiRegionView* _region_view; + framepos_t _last_pos; + double _last_y; + +}; + /** Drag to move MIDI patch changes */ class PatchChangeDrag : public Drag {