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
This commit is contained in:
Carl Hetherington 2010-08-18 18:06:31 +00:00
parent 6832155310
commit a958dd0512
6 changed files with 30 additions and 7 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -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<Drag*>::const_iterator i = _drags.begin(); i != _drags.end(); ++i) {
(*i)->start_grab (e);
(*i)->start_grab (e, c);
}
}

View File

@ -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;

View File

@ -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<TimeAxisView*, int> tvp = trackview_by_y_position (_last_motion_y + vertical_adjustment.get_value() - canvas_timebars_vsize);
if (dynamic_cast<AutomationTimeAxisView*> (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<AutomationTimeAxisView*> (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<AutomationTimeAxisView*> (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;

View File

@ -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);