mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
some prep work for generally handling dbl-click on draggable objects
This commit is contained in:
parent
a079118981
commit
479e97dc59
3 changed files with 26 additions and 2 deletions
|
|
@ -160,6 +160,14 @@ DragManager::end_grab (GdkEvent* e)
|
|||
return r;
|
||||
}
|
||||
|
||||
void
|
||||
DragManager::mark_double_click ()
|
||||
{
|
||||
for (list<Drag*>::const_iterator i = _drags.begin(); i != _drags.end(); ++i) {
|
||||
(*i)->set_double_click (true);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
DragManager::motion_handler (GdkEvent* e, bool from_autoscroll)
|
||||
{
|
||||
|
|
@ -212,6 +220,7 @@ Drag::Drag (Editor* e, ArdourCanvas::Item* i)
|
|||
, _item (i)
|
||||
, _pointer_frame_offset (0)
|
||||
, _move_threshold_passed (false)
|
||||
, _was_double_click (false)
|
||||
, _raw_grab_frame (0)
|
||||
, _grab_frame (0)
|
||||
, _last_pointer_frame (0)
|
||||
|
|
@ -2974,6 +2983,10 @@ void
|
|||
MarkerDrag::finished (GdkEvent* event, bool movement_occurred)
|
||||
{
|
||||
if (!movement_occurred) {
|
||||
|
||||
if (was_double_click()) {
|
||||
cerr << "End of marker double click\n";
|
||||
}
|
||||
|
||||
/* just a click, do nothing but finish
|
||||
off the selection process
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ public:
|
|||
bool end_grab (GdkEvent *);
|
||||
bool have_item (ArdourCanvas::Item *) const;
|
||||
|
||||
void mark_double_click ();
|
||||
|
||||
/** @return true if an end drag or abort is in progress */
|
||||
bool ending () const {
|
||||
return _ending;
|
||||
|
|
@ -101,7 +103,7 @@ private:
|
|||
class Drag
|
||||
{
|
||||
public:
|
||||
Drag (Editor *, ArdourCanvas::Item *);
|
||||
Drag (Editor *, ArdourCanvas::Item *);
|
||||
virtual ~Drag () {}
|
||||
|
||||
void set_manager (DragManager* m) {
|
||||
|
|
@ -120,6 +122,9 @@ public:
|
|||
ARDOUR::framepos_t adjusted_frame (ARDOUR::framepos_t, GdkEvent const *, bool snap = true) const;
|
||||
ARDOUR::framepos_t adjusted_current_frame (GdkEvent const *, bool snap = true) const;
|
||||
|
||||
bool was_double_click() const { return _was_double_click; }
|
||||
void set_double_click (bool yn) { _was_double_click = yn; }
|
||||
|
||||
/** Called to start a grab of an item.
|
||||
* @param e Event that caused the grab to start.
|
||||
* @param c Cursor to use, or 0.
|
||||
|
|
@ -225,6 +230,7 @@ protected:
|
|||
private:
|
||||
|
||||
bool _move_threshold_passed; ///< true if the move threshold has been passed, otherwise false
|
||||
bool _was_double_click; ///< true if drag initiated by a double click event
|
||||
double _grab_x; ///< trackview x of the grab start position
|
||||
double _grab_y; ///< trackview y of the grab start position
|
||||
double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred
|
||||
|
|
@ -694,7 +700,7 @@ public:
|
|||
class MarkerDrag : public Drag
|
||||
{
|
||||
public:
|
||||
MarkerDrag (Editor *, ArdourCanvas::Item *);
|
||||
MarkerDrag (Editor *, ArdourCanvas::Item *);
|
||||
~MarkerDrag ();
|
||||
|
||||
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
|
||||
|
|
|
|||
|
|
@ -1293,6 +1293,11 @@ Editor::button_press_handler_2 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
bool
|
||||
Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
|
||||
{
|
||||
if (event->type == GDK_2BUTTON_PRESS) {
|
||||
_drags->mark_double_click ();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (event->type != GDK_BUTTON_PRESS) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue