From a958dd0512a29894096e67ccd41a3d879b6bc162 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 18 Aug 2010 18:06:31 +0000 Subject: [PATCH] Set cursor to hint that you can drag automation up and down in object/range link mode. git-svn-id: svn://localhost/ardour2/branches/3.0@7651 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor.cc | 3 ++- gtk2_ardour/editor.h | 3 +++ gtk2_ardour/editor_drag.cc | 6 +++--- gtk2_ardour/editor_drag.h | 2 +- gtk2_ardour/editor_mouse.cc | 22 ++++++++++++++++++++-- gtk2_ardour/time_axis_view.cc | 1 + 6 files changed, 30 insertions(+), 7 deletions(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index adfbf5293a..e1e4714eb3 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -230,6 +230,7 @@ Gdk::Cursor* Editor::midi_erase_cursor = 0; Gdk::Cursor* Editor::wait_cursor = 0; Gdk::Cursor* Editor::timebar_cursor = 0; Gdk::Cursor* Editor::transparent_cursor = 0; +Gdk::Cursor* Editor::up_down_cursor = 0; void show_me_the_size (Requisition* r, const char* what) @@ -301,7 +302,6 @@ Editor::Editor () , meters_running(false) , _pending_locate_request (false) , _pending_initial_locate (false) - { constructed = false; @@ -1279,6 +1279,7 @@ Editor::build_cursors () midi_select_cursor = new Gdk::Cursor (CENTER_PTR); midi_resize_cursor = new Gdk::Cursor (SIZING); midi_erase_cursor = new Gdk::Cursor (DRAPED_BOX); + up_down_cursor = new Gdk::Cursor (Gdk::SB_V_DOUBLE_ARROW); } /** Pop up a context menu for when the user clicks on a fade in or fade out */ diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 22f68c23ce..bc72dcb1f6 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -474,6 +474,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD static Gdk::Cursor* midi_select_cursor; static Gdk::Cursor* midi_resize_cursor; static Gdk::Cursor* midi_erase_cursor; + static Gdk::Cursor* up_down_cursor; static Gdk::Cursor* wait_cursor; static Gdk::Cursor* timebar_cursor; static Gdk::Cursor* transparent_cursor; @@ -2045,6 +2046,8 @@ public: bool check_step_edit (); sigc::connection step_edit_connection; + double _last_motion_y; + friend class Drag; friend class RegionDrag; friend class RegionMoveDrag; diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 873ee269a9..ca85ae809e 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -96,16 +96,16 @@ DragManager::set (Drag* d, GdkEvent* e, Gdk::Cursor* c) assert (_drags.empty ()); d->set_manager (this); _drags.push_back (d); - start_grab (e); + start_grab (e, c); } void -DragManager::start_grab (GdkEvent* e) +DragManager::start_grab (GdkEvent* e, Gdk::Cursor* c) { _current_pointer_frame = _editor->event_frame (e, &_current_pointer_x, &_current_pointer_y); for (list::const_iterator i = _drags.begin(); i != _drags.end(); ++i) { - (*i)->start_grab (e); + (*i)->start_grab (e, c); } } diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index 9e206cfebf..647655e7fb 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -53,7 +53,7 @@ public: void abort (); void add (Drag *); void set (Drag *, GdkEvent *, Gdk::Cursor* c = 0); - void start_grab (GdkEvent *); + void start_grab (GdkEvent *, Gdk::Cursor* c = 0); bool end_grab (GdkEvent *); bool have_item (ArdourCanvas::Item *) const; diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 4713258b19..58ef93bd37 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -266,6 +266,16 @@ Editor::set_canvas_cursor () break; } + /* up-down cursor as a cue that automation can be dragged up and down when in join object/range mode */ + if (join_object_range_button.get_active() && last_item_entered) { + if (last_item_entered->property_parent() && (*last_item_entered->property_parent()).get_data (X_("timeselection"))) { + pair tvp = trackview_by_y_position (_last_motion_y + vertical_adjustment.get_value() - canvas_timebars_vsize); + if (dynamic_cast (tvp.first)) { + current_canvas_cursor = up_down_cursor; + } + } + } + if (is_drawable()) { track_canvas->get_window()->set_cursor(*current_canvas_cursor); } @@ -654,7 +664,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT AutomationTimeAxisView* atv = dynamic_cast (tvp.first); if (join_object_range_button.get_active() && atv) { /* smart "join" mode: drag automation */ - _drags->set (new AutomationRangeDrag (this, atv->base_item(), selection->time), event); + _drags->set (new AutomationRangeDrag (this, atv->base_item(), selection->time), event, up_down_cursor); } else { /* this was debated, but decided the more common action was to make a new selection */ @@ -824,7 +834,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT /* if we're over an automation track, start a drag of its data */ AutomationTimeAxisView* atv = dynamic_cast (tvp.first); if (atv) { - _drags->set (new AutomationRangeDrag (this, atv->base_item(), selection->time), event); + _drags->set (new AutomationRangeDrag (this, atv->base_item(), selection->time), event, up_down_cursor); } /* if we're over a track and a region, and in the `object' part of a region, @@ -1646,6 +1656,12 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ line->property_color_rgba() = 0xFF0000FF; } break; + case SelectionItem: + if (join_object_range_button.get_active()) { + set_canvas_cursor (); + } + break; + default: break; } @@ -1896,6 +1912,8 @@ Editor::scrub (nframes64_t frame, double current_x) bool Editor::motion_handler (ArdourCanvas::Item* /*item*/, GdkEvent* event, bool from_autoscroll) { + _last_motion_y = event->motion.y; + if (event->motion.is_hint) { gint x, y; diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index 66eb6dbc89..6d297ef14e 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -87,6 +87,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie _canvas_display->hide(); // reveal as needed selection_group = new Group (*_canvas_display); + selection_group->set_data (X_("timeselection"), (void *) 1); selection_group->hide(); _ghost_group = new Group (*_canvas_display); -- 2.30.2