summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_canvas.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-12-23 13:46:53 -0500
committerDavid Robillard <d@drobilla.net>2014-12-23 13:47:59 -0500
commit62355de33a00e40c20b79d7db1ac2139fd042743 (patch)
tree252d1c251f57f8e5465bbff5a468af31a0da5f37 /gtk2_ardour/editor_canvas.cc
parente00c579fb2e99e993a0ab84ff00ba3109f6b5f20 (diff)
Fix cursor update on nested entry.
For example, if you're in a note and something about the mode changes, it's the underlying region context that needs to change. So, seems we need a stack of entry contexts to deal with this sort of thing. Switching in/out of smart mode still doesn't update immediately because we don't have the y-coordinate needed to update it.
Diffstat (limited to 'gtk2_ardour/editor_canvas.cc')
-rw-r--r--gtk2_ardour/editor_canvas.cc52
1 files changed, 41 insertions, 11 deletions
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 03637ec7f6..c26f00603e 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -782,6 +782,17 @@ Editor::stop_canvas_autoscroll ()
autoscroll_connection.disconnect ();
}
+Editor::EnterContext*
+Editor::get_enter_context(ItemType type)
+{
+ for (ssize_t i = _enter_stack.size() - 1; i >= 0; --i) {
+ if (_enter_stack[i].item_type == type) {
+ return &_enter_stack[i];
+ }
+ }
+ return NULL;
+}
+
bool
Editor::left_track_canvas (GdkEventCrossing */*ev*/)
{
@@ -1165,16 +1176,10 @@ Editor::which_track_cursor () const
return cursor;
}
-void
-Editor::choose_canvas_cursor_on_entry (ItemType type)
+Gdk::Cursor*
+Editor::which_canvas_cursor(ItemType type) const
{
- Gdk::Cursor* cursor = 0;
-
- if (_drags->active()) {
- return;
- }
-
- cursor = which_mode_cursor ();
+ Gdk::Cursor* cursor = which_mode_cursor ();
if ((mouse_mode == MouseObject || get_smart_mode ()) ||
mouse_mode == MouseContent) {
@@ -1256,6 +1261,8 @@ Editor::choose_canvas_cursor_on_entry (ItemType type)
case CrossfadeViewItem:
cursor = _cursors->cross_hair;
break;
+ case NoteItem:
+ cursor = _cursors->grabber_note;
default:
break;
}
@@ -1274,6 +1281,8 @@ Editor::choose_canvas_cursor_on_entry (ItemType type)
case ControlPointItem:
cursor = _cursors->fader;
break;
+ case NoteItem:
+ cursor = _cursors->grabber_note;
default:
break;
}
@@ -1307,9 +1316,30 @@ Editor::choose_canvas_cursor_on_entry (ItemType type)
break;
}
+ return cursor;
+}
+
+void
+Editor::choose_canvas_cursor_on_entry (ItemType type)
+{
+ if (_drags->active()) {
+ return;
+ }
+
+ Gdk::Cursor* cursor = which_canvas_cursor(type);
+
if (cursor) {
- CursorContext::set(&_enter_cursor_ctx, *this, cursor);
- _entered_item_type = type;
+ // Push a new enter context
+ const EnterContext ctx = { type, CursorContext::create(*this, cursor) };
+ _enter_stack.push_back(ctx);
+ }
+}
+
+void
+Editor::update_all_enter_cursors ()
+{
+ for (std::vector<EnterContext>::iterator i = _enter_stack.begin(); i != _enter_stack.end(); ++i) {
+ i->cursor_ctx->change(which_canvas_cursor(i->item_type));
}
}