Context menu for applying edits to note selection.
[ardour.git] / gtk2_ardour / editor_mouse.cc
index c12d11ff3f9d06e928c8482b99043c84dcf7df52..6f22199d661a727558e52bbd171924170b27bf3d 100644 (file)
@@ -221,6 +221,28 @@ Editor::mouse_mode_object_range_toggled()
        set_mouse_mode(m, true);  //call this so the button styles can get updated
 }
 
+static Glib::RefPtr<Action>
+get_mouse_mode_action(MouseMode m)
+{
+       switch (m) {
+       case MouseRange:
+               return ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-range"));
+       case MouseObject:
+               return ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-object"));
+       case MouseCut:
+               return ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-cut"));
+       case MouseDraw:
+               return ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-draw"));
+       case MouseTimeFX:
+               return ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-timefx"));
+       case MouseContent:
+               return ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-content"));
+       case MouseAudition:
+               return ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-audition"));
+       }
+       return Glib::RefPtr<Action>();
+}
+
 void
 Editor::set_mouse_mode (MouseMode m, bool force)
 {
@@ -233,50 +255,11 @@ Editor::set_mouse_mode (MouseMode m, bool force)
        }
 
        if (ARDOUR::Profile->get_mixbus()) {
-               if ( m == MouseZoom) m = MouseObject;
                if ( m == MouseCut) m = MouseObject;
        }
 
-       Glib::RefPtr<Action> act;
-
-       switch (m) {
-       case MouseRange:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-range"));
-               break;
-
-       case MouseCut:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-cut"));
-               break;
-
-       case MouseObject:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-object"));
-               break;
-
-       case MouseDraw:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-draw"));
-               break;
-
-       case MouseGain:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-gain"));
-               break;
-
-       case MouseZoom:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-zoom"));
-               break;
-
-       case MouseTimeFX:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-timefx"));
-               break;
-
-       case MouseAudition:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-audition"));
-               break;
-       }
-
-       assert (act);
-
-       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-       assert (tact);
+       Glib::RefPtr<Action>       act  = get_mouse_mode_action(m);
+       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
 
        /* go there and back to ensure that the toggled handler is called to set up mouse_mode */
        tact->set_active (false);
@@ -288,52 +271,12 @@ Editor::set_mouse_mode (MouseMode m, bool force)
 void
 Editor::mouse_mode_toggled (MouseMode m)
 {
-       Glib::RefPtr<Action> act;
-       Glib::RefPtr<ToggleAction> tact;
-
        if (ARDOUR::Profile->get_mixbus()) {
-               if ( m == MouseZoom) m = MouseObject;
                if ( m == MouseCut)  m = MouseObject;
        }
 
-       switch (m) {
-       case MouseRange:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-range"));
-               break;
-
-       case MouseObject:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-object"));
-               break;
-
-       case MouseCut:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-cut"));
-               break;
-
-       case MouseDraw:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-draw"));
-               break;
-
-       case MouseGain:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-gain"));
-               break;
-
-       case MouseZoom:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-zoom"));
-               break;
-
-       case MouseTimeFX:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-timefx"));
-               break;
-
-       case MouseAudition:
-               act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-audition"));
-               break;
-       }
-
-       assert (act);
-
-       tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-       assert (tact);
+       Glib::RefPtr<Action>       act  = get_mouse_mode_action(m);
+       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
 
        if (!tact->get_active()) {
                /* this was just the notification that the old mode has been
@@ -343,24 +286,27 @@ Editor::mouse_mode_toggled (MouseMode m)
                return;
        }
 
-       switch (m) {
-       case MouseDraw:
-               act = ActionManager::get_action (X_("MouseMode"), X_("toggle-internal-edit"));
-               tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
-               tact->set_active (true);
-               break;
-       default:
-               break;
-       }
-       
        if (_session && mouse_mode == MouseAudition) {
                /* stop transport and reset default speed to avoid oddness with
                   auditioning */
                _session->request_transport_speed (0.0, true);
        }
 
+       const bool was_internal = internal_editing();
+
        mouse_mode = m;
 
+       /* Switch snap type/mode if we're moving to/from an internal tool.  Note
+          this must toggle the actions and not call set_snap_*() directly,
+          otherwise things get out of sync and the combo box stops working. */
+       if (!was_internal && internal_editing()) {
+               snap_type_action(internal_snap_type)->set_active(true);
+               snap_mode_action(internal_snap_mode)->set_active(true);
+       } else if (was_internal && !internal_editing()) {
+               snap_type_action(pre_internal_snap_type)->set_active(true);
+               snap_mode_action(pre_internal_snap_mode)->set_active(true);
+       }
+
        instant_save ();
 
        /* this should generate a new enter event which will
@@ -375,9 +321,17 @@ Editor::mouse_mode_toggled (MouseMode m)
        
        update_time_selection_display ();
 
+       update_all_enter_cursors ();
+
        MouseModeChanged (); /* EMIT SIGNAL */
 }
 
+bool
+Editor::internal_editing() const
+{
+       return mouse_mode == Editing::MouseContent || mouse_mode == Editing::MouseDraw;
+}
+
 void
 Editor::update_time_selection_display ()
 {
@@ -390,9 +344,26 @@ Editor::update_time_selection_display ()
                switch (mouse_mode) {
                case MouseRange:
                        selection->clear_objects ();
+                       selection->ClearMidiNoteSelection();  //signal
+                       break;
+               case MouseObject:
+                       selection->clear_objects ();
+                       selection->clear_time ();
+                       selection->clear_tracks ();
+                       selection->ClearMidiNoteSelection();  //signal
+                       break;
+               case MouseContent:
+               case MouseDraw:
+                       //if we go into internal editing, clear everything in the outside world
+                       selection->clear_objects ();
+                       selection->clear_time ();
+                       selection->clear_tracks ();
                        break;
                default:
+                       //clear everything
+                       selection->clear_objects ();
                        selection->clear_time ();
+                       selection->clear_tracks ();
                        break;
                }
        }
@@ -401,90 +372,15 @@ Editor::update_time_selection_display ()
 void
 Editor::step_mouse_mode (bool next)
 {
-       switch (current_mouse_mode()) {
-       case MouseObject:
-               if (next) {
-                       if (Profile->get_sae()) {
-                               set_mouse_mode (MouseZoom);
-                       } else {
-                               set_mouse_mode (MouseRange);
-                       }
-               } else {
-                       set_mouse_mode (MouseTimeFX);
-               }
-               break;
-
-       case MouseRange:
-               if (next) set_mouse_mode (MouseDraw);
-               else set_mouse_mode (MouseCut);
-               break;
-
-       case MouseCut:
-               if (next) set_mouse_mode (MouseRange);
-               else set_mouse_mode (MouseDraw);
-               break;
-
-       case MouseDraw:
-               if (next) set_mouse_mode (MouseCut);
-               else set_mouse_mode (MouseRange);
-               break;
-
-       case MouseZoom:
-               if (next) {
-                       if (Profile->get_sae()) {
-                               set_mouse_mode (MouseTimeFX);
-                       } else {
-                               set_mouse_mode (MouseGain);
-                       }
-               } else {
-                       if (Profile->get_sae()) {
-                               set_mouse_mode (MouseObject);
-                       } else {
-                               set_mouse_mode (MouseDraw);
-                       }
-               }
-               break;
-
-       case MouseGain:
-               if (next) set_mouse_mode (MouseTimeFX);
-               else set_mouse_mode (MouseZoom);
-               break;
-
-       case MouseTimeFX:
-               if (next) {
-                       set_mouse_mode (MouseAudition);
-               } else {
-                       if (Profile->get_sae()) {
-                               set_mouse_mode (MouseZoom);
-                       } else {
-                               set_mouse_mode (MouseGain);
-                       }
-               }
-               break;
-
-       case MouseAudition:
-               if (next) set_mouse_mode (MouseObject);
-               else set_mouse_mode (MouseTimeFX);
-               break;
+       const int n_mouse_modes = (int)MouseContent + 1;
+       int       current       = (int)current_mouse_mode();
+       if (next) {
+               set_mouse_mode((MouseMode)((current + 1) % n_mouse_modes));
+       } else {
+               set_mouse_mode((MouseMode)((current + n_mouse_modes - 1) % n_mouse_modes));
        }
 }
 
-bool
-Editor::toggle_internal_editing_from_double_click (GdkEvent* event)
-{
-       if (_drags->active()) {
-               _drags->end_grab (event);
-       } 
-
-       ActionManager::do_action ("MouseMode", "toggle-internal-edit");
-
-       /* prevent reversion of edit cursor on button release */
-       
-       pre_press_cursor = 0;
-
-       return true;
-}
-
 void
 Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemType item_type)
 {
@@ -532,11 +428,8 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp
        if (((mouse_mode != MouseObject) &&
             (mouse_mode != MouseAudition || item_type != RegionItem) &&
             (mouse_mode != MouseTimeFX || item_type != RegionItem) &&
-            (mouse_mode != MouseGain) &&
             (mouse_mode != MouseDraw)) ||
-           ((event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE) || event->button.button > 3) ||
-           (internal_editing() && mouse_mode != MouseTimeFX)) {
-
+           ((event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE) || event->button.button > 3)) {
                return;
        }
 
@@ -629,6 +522,8 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
           them to be modeless.
        */
 
+       NoteBase* note = NULL;
+
        switch (item_type) {
        case PlayheadCursorItem:
                _drags->set (new CursorDrag (this, *playhead_cursor, true), event);
@@ -644,8 +539,6 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
 
        case TempoMarkerItem:
        {
-               TempoMarker* m = reinterpret_cast<TempoMarker*> (item->get_data ("marker"));
-               assert (m);
                _drags->set (
                        new TempoMarkerDrag (
                                this,
@@ -659,8 +552,6 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
 
        case MeterMarkerItem:
        {
-               MeterMarker* m = reinterpret_cast<MeterMarker*> (item->get_data ("marker"));
-               assert (m);
                _drags->set (
                        new MeterMarkerDrag (
                                this,
@@ -692,10 +583,12 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
 
 
        case RangeMarkerBarItem:
-               if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
-                       _drags->set (new CursorDrag (this, *playhead_cursor, false), event);
-               } else {
+               if (Keyboard::modifier_state_contains (event->button.state, Keyboard::TertiaryModifier)) {
+                       _drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateSkipMarker), event);
+               } else if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
                        _drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateRangeMarker), event);
+               } else {
+                       _drags->set (new CursorDrag (this, *playhead_cursor, false), event);
                }
                return true;
                break;
@@ -752,11 +645,6 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                }
        }
 
-       /* there is no Range mode when in internal edit mode */
-       if (eff == MouseRange && internal_editing()) {
-               eff = MouseObject;
-       }
-
        switch (eff) {
        case MouseRange:
                switch (item_type) {
@@ -776,36 +664,19 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                                /* grab selection for moving */
                                _drags->set (new SelectionDrag (this, item, SelectionDrag::SelectionMove), event);
                        } else {
-                               double const y = event->button.y;
-                               pair<TimeAxisView*, int> tvp = trackview_by_y_position (y);
-                               if (tvp.first) {
-                                       AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (tvp.first);
-                                       if ( get_smart_mode() && atv) {
-                                               /* smart "join" mode: drag automation */
-                                               _drags->set (new AutomationRangeDrag (this, atv, selection->time), event, _cursors->up_down);
-                                       } else {
-                                               /* this was debated, but decided the more common action was to
-                                                  make a new selection */
-                                               _drags->set (new SelectionDrag (this, item, SelectionDrag::CreateSelection), event);
-                                       }
-                               }
+                               /* this was debated, but decided the more common action was to
+                                  make a new selection */
+                               _drags->set (new SelectionDrag (this, item, SelectionDrag::CreateSelection), event);
                        }
                        break;
 
                case StreamItem:
-                       if (internal_editing()) {
-                               if (dynamic_cast<MidiTimeAxisView*> (clicked_axisview)) {
-                                       _drags->set (new RegionCreateDrag (this, item, clicked_axisview), event);
-                                       return true;
-                               } 
+                       if (Keyboard::modifier_state_equals (event->button.state, Keyboard::RangeSelectModifier)) {
+                               _drags->set (new SelectionDrag (this, item, SelectionDrag::SelectionExtend), event);
                        } else {
-                               if (Keyboard::modifier_state_equals (event->button.state, Keyboard::RangeSelectModifier)) {
-                                       _drags->set (new SelectionDrag (this, item, SelectionDrag::SelectionExtend), event);
-                               } else {
-                                       _drags->set (new SelectionDrag (this, item, SelectionDrag::CreateSelection), event);
-                               }
-                               return true;
+                               _drags->set (new SelectionDrag (this, item, SelectionDrag::CreateSelection), event);
                        }
+                       return true;
                        break;
 
                case RegionViewNameHighlight:
@@ -816,47 +687,15 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                        break;
 
                default:
-                       if (!internal_editing()) {
-                               if (Keyboard::modifier_state_equals (event->button.state, Keyboard::RangeSelectModifier)) {
-                                       _drags->set (new SelectionDrag (this, item, SelectionDrag::SelectionExtend), event);
-                               } else {
-                                       _drags->set (new SelectionDrag (this, item, SelectionDrag::CreateSelection), event);
-                               }
+                       if (Keyboard::modifier_state_equals (event->button.state, Keyboard::RangeSelectModifier)) {
+                               _drags->set (new SelectionDrag (this, item, SelectionDrag::SelectionExtend), event);
+                       } else {
+                               _drags->set (new SelectionDrag (this, item, SelectionDrag::CreateSelection), event);
                        }
                }
                return true;
                break;
 
-       case MouseDraw:
-               switch (item_type) {
-               case NoteItem:
-                       /* Existing note: allow trimming/motion */
-                       if (internal_editing()) {
-                               /* trim notes if we're in internal edit mode and near the ends of the note */
-                               NoteBase* cn = reinterpret_cast<NoteBase*>(item->get_data ("notebase"));
-                               assert (cn);
-                               if (cn->big_enough_to_trim() && cn->mouse_near_ends()) {
-                                       _drags->set (new NoteResizeDrag (this, item), event, current_canvas_cursor);
-                               } else {
-                                       _drags->set (new NoteDrag (this, item), event);
-                               }
-                               return true;
-                       } 
-                       break;
-               case StreamItem:
-                       if (internal_editing()) {
-                               if (dynamic_cast<MidiTimeAxisView*> (clicked_axisview)) {
-                                       _drags->set (new RegionCreateDrag (this, item, clicked_axisview), event);
-                               }
-                               return true;
-                       }
-                       break;
-
-               default:
-                       break;
-               }
-               break;
-
        case MouseCut:
                switch (item_type) {
                case RegionItem:
@@ -869,7 +708,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                case RegionViewName:
                case StreamItem:
                case AutomationTrackItem:
-                       _drags->set (new RegionCutDrag (this, item, canvas_event_sample (event)), event, current_canvas_cursor);
+                       _drags->set (new RegionCutDrag (this, item, canvas_event_sample (event)), event, get_canvas_cursor());
                        return true;
                        break;
                default:
@@ -877,26 +716,42 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                }
                break;
 
-       case MouseObject:
+       case MouseContent:
                switch (item_type) {
                case NoteItem:
                        /* Existing note: allow trimming/motion */
-                       if (internal_editing()) {
-                               NoteBase* cn = reinterpret_cast<NoteBase*> (item->get_data ("notebase"));
-                               assert (cn);
-                               if (cn->big_enough_to_trim() && cn->mouse_near_ends()) {
-                                       _drags->set (new NoteResizeDrag (this, item), event, current_canvas_cursor);
+                       if ((note = reinterpret_cast<NoteBase*> (item->get_data ("notebase")))) {
+                               if (note->big_enough_to_trim() && note->mouse_near_ends()) {
+                                       _drags->set (new NoteResizeDrag (this, item), event, get_canvas_cursor());
                                } else {
                                        _drags->set (new NoteDrag (this, item), event);
                                }
+                       }
+                       return true;
+
+               case ControlPointItem:
+                       _drags->set (new ControlPointDrag (this, item), event);
+                       return true;
+                       break;
+
+               case StreamItem:
+                       if (dynamic_cast<MidiTimeAxisView*> (clicked_axisview)) {
+                               _drags->set (new RegionCreateDrag (this, item, clicked_axisview), event);
                                return true;
                        }
                        break;
 
+               case AutomationTrackItem:
+                       /* rubberband drag to select automation points */
+                       _drags->set (new EditorRubberbandSelectDrag (this, item), event);
+                       break;
+
                default:
                        break;
                }
+               break;
 
+       case MouseObject:
                if (Keyboard::modifier_state_contains (event->button.state, Keyboard::ModifierMask(Keyboard::PrimaryModifier|Keyboard::SecondaryModifier)) &&
                    event->type == GDK_BUTTON_PRESS) {
 
@@ -946,10 +801,6 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                                        break;
                                }
 
-                               if (internal_editing ()) {
-                                       break;
-                               }
-
                                /* click on a normal region view */
                                if (Keyboard::modifier_state_contains (event->button.state, Keyboard::CopyModifier)) {
                                        add_region_copy_drag (item, event, clicked_regionview);
@@ -960,10 +811,6 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                                }
 
 
-//                             if (!internal_editing() && (_join_object_range_state == JOIN_OBJECT_RANGE_RANGE && !selection->regions.empty())) {
-//                                     _drags->add (new SelectionDrag (this, clicked_axisview->get_selection_rect (clicked_selection)->rect, SelectionDrag::SelectionMove));
-//                             }
-
                                _drags->start_grab (event);
                                return true;
                                break;
@@ -1006,15 +853,8 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                                break;
 
                        case StreamItem:
-                               if (internal_editing()) {
-                                       if (dynamic_cast<MidiTimeAxisView*> (clicked_axisview)) {
-                                               _drags->set (new RegionCreateDrag (this, item, clicked_axisview), event);
-                                       }
-                                       return true;
-                               } else {
-                                       _drags->set (new EditorRubberbandSelectDrag (this, item), event);
-                               }
-                               break;
+                               _drags->set (new EditorRubberbandSelectDrag (this, item), event);
+                               return true;
 
                        case AutomationTrackItem:
                        {
@@ -1048,45 +888,6 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
 
                        case SelectionItem:
                        {
-                               if ( get_smart_mode() ) {
-                                       /* we're in "smart" joined mode, and we've clicked on a Selection */
-                                       double const y = event->button.y;
-                                       pair<TimeAxisView*, int> tvp = trackview_by_y_position (y);
-                                       if (tvp.first) {
-                                               /* 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, selection->time), event, _cursors->up_down);
-                                               }
-
-                                               /* if we're over a track and a region, and in the `object' part of a region,
-                                                  put a selection around the region and drag both
-                                               */
-/*                                             RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tvp.first);
-                                               if (rtv && _join_object_range_state == JOIN_OBJECT_RANGE_OBJECT) {
-                                                       boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> (rtv->route ());
-                                                       if (t) {
-                                                               boost::shared_ptr<Playlist> pl = t->playlist ();
-                                                               if (pl) {
-
-                                                                       boost::shared_ptr<Region> r = pl->top_region_at (canvas_event_sample (event));
-                                                                       if (r) {
-                                                                               RegionView* rv = rtv->view()->find_view (r);
-                                                                               clicked_selection = select_range (rv->region()->position(), 
-                                                                                                                 rv->region()->last_frame()+1);
-                                                                               _drags->add (new SelectionDrag (this, item, SelectionDrag::SelectionMove));
-                                                                               list<RegionView*> rvs;
-                                                                               rvs.push_back (rv);
-                                                                               _drags->add (new RegionMoveDrag (this, item, rv, rvs, false, false));
-                                                                               _drags->start_grab (event);
-                                                                               return true;
-                                                                       }
-                                                               }
-                                                       }
-                                               }
-*/
-                                       }
-                               }
                                break;
                        }
 
@@ -1101,7 +902,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                return true;
                break;
 
-       case MouseGain:
+       case MouseDraw:
                switch (item_type) {
                case GainLineItem:
                        _drags->set (new LineDrag (this, item), event);
@@ -1117,7 +918,16 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                        AudioRegionView* arv = dynamic_cast<AudioRegionView *> (clicked_regionview);
                        if (arv) {
                                _drags->set (new AutomationRangeDrag (this, arv, selection->time), event, _cursors->up_down);
-                               _drags->start_grab (event);
+                       } else {
+                               double const y = event->button.y;
+                               pair<TimeAxisView*, int> tvp = trackview_by_y_position (y);
+                               if (tvp.first) {
+                                       AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (tvp.first);
+                                       if ( atv) {
+                                               /* smart "join" mode: drag automation */
+                                               _drags->set (new AutomationRangeDrag (this, atv, selection->time), event, _cursors->up_down);
+                                       }
+                               }
                        }
                        return true;
                        break;
@@ -1126,28 +936,39 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                case AutomationLineItem:
                        _drags->set (new LineDrag (this, item), event);
                        break;
-                       
+
+               case NoteItem:
+                       if ((note = reinterpret_cast<NoteBase*>(item->get_data ("notebase")))) {
+                               if (note->big_enough_to_trim() && note->mouse_near_ends()) {
+                                       /* Note is big and pointer is near the end, trim */
+                                       _drags->set (new NoteResizeDrag (this, item), event, get_canvas_cursor());
+                               } else {
+                                       /* Drag note */
+                                       _drags->set (new NoteDrag (this, item), event);
+                               }
+                               return true;
+                       }
+                       return true;
+
+               case StreamItem:
+                       if (dynamic_cast<MidiTimeAxisView*> (clicked_axisview)) {
+                               _drags->set (new RegionCreateDrag (this, item, clicked_axisview), event);
+                       }
+                       return true;
+
                default:
                        break;
                }
                return true;
                break;
 
-       case MouseZoom:
-               if (event->type == GDK_BUTTON_PRESS) {
-                       _drags->set (new MouseZoomDrag (this, item), event);
-               }
-
-               return true;
-               break;
-
        case MouseTimeFX:
-               if (internal_editing() && item_type == NoteItem ) {
-                       /* drag notes if we're in internal edit mode */
-                       NoteBase* cn = reinterpret_cast<NoteBase*>(item->get_data ("notebase"));
-                       assert (cn);
-                       if (cn->big_enough_to_trim()) {
-                               _drags->set (new NoteResizeDrag (this, item), event, current_canvas_cursor);
+               if (item_type == NoteItem) {
+                       /* resize-drag notes */
+                       if ((note = reinterpret_cast<NoteBase*>(item->get_data ("notebase")))) {
+                               if (note->big_enough_to_trim()) {
+                                       _drags->set (new NoteResizeDrag (this, item), event, get_canvas_cursor());
+                               }
                        }
                        return true;
                } else if (clicked_regionview) {
@@ -1158,12 +979,11 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                break;
 
        case MouseAudition:
-               _drags->set (new ScrubDrag (this, item), event);
+               _drags->set (new ScrubDrag (this, item), event, _cursors->transparent);
                scrub_reversals = 0;
                scrub_reverse_distance = 0;
                last_scrub_x = event->button.x;
                scrubbing_direction = 0;
-               push_canvas_cursor (_cursors->transparent);
                return true;
                break;
 
@@ -1182,11 +1002,6 @@ Editor::button_press_handler_2 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
        case MouseObject:
                switch (item_type) {
                case RegionItem:
-                       if (internal_editing ()) {
-                               /* no region drags in internal edit mode */
-                               return false;
-                       }
-
                        if (Keyboard::modifier_state_contains (event->button.state, Keyboard::CopyModifier)) {
                                add_region_copy_drag (item, event, clicked_regionview);
                        } else {
@@ -1212,9 +1027,7 @@ Editor::button_press_handler_2 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
 
                case LeftFrameHandle:
                case RightFrameHandle:
-                       if (!internal_editing ()) {
-                               _drags->set (new TrimDrag (this, item, clicked_regionview, selection->regions.by_layer()), event);
-                       }
+                       _drags->set (new TrimDrag (this, item, clicked_regionview, selection->regions.by_layer()), event);
                        return true;
                        break;
 
@@ -1237,16 +1050,6 @@ Editor::button_press_handler_2 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                return true;
                break;
 
-
-       case MouseZoom:
-               if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
-                       temporal_zoom_to_frame (false, canvas_event_sample (event));
-               } else {
-                       temporal_zoom_to_frame (true, canvas_event_sample(event));
-               }
-               return true;
-               break;
-
        default:
                break;
        }
@@ -1267,56 +1070,12 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
                return false;
        }
 
-        pre_press_cursor = current_canvas_cursor;
-
        _track_canvas->grab_focus();
 
        if (_session && _session->actively_recording()) {
                return true;
        }
 
-       if (internal_editing()) {
-               bool leave_internal_edit_mode = false;
-
-               switch (item_type) {
-               case NoteItem:
-                       break;
-
-               case RegionItem:
-                       if (!dynamic_cast<MidiRegionView*> (clicked_regionview) && !dynamic_cast<AutomationRegionView*> (clicked_regionview)) {
-                               leave_internal_edit_mode = true;
-                       }
-                       break;
-
-               case PlayheadCursorItem:
-               case MarkerItem:
-               case TempoMarkerItem:
-               case MeterMarkerItem:
-               case MarkerBarItem:
-               case TempoBarItem:
-               case MeterBarItem:
-               case RangeMarkerBarItem:
-               case CdMarkerBarItem:
-               case TransportMarkerBarItem:
-               case StreamItem:
-               case TimecodeRulerItem:
-               case SamplesRulerItem:
-               case MinsecRulerItem:
-               case BBTRulerItem:
-                       /* button press on these items never does anything to
-                          change the editing mode.
-                       */
-                       break;
-
-               default:
-                       break;
-               }
-               
-               if (leave_internal_edit_mode) {
-                       ActionManager::do_action ("MouseMode", "toggle-internal-edit");
-               }
-       }
-
        button_selection (item, event, item_type);
 
        if (!_drags->active () &&
@@ -1329,7 +1088,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
        }
 
        //not rolling, range mode click + join_play_range :  locate the PH here
-       if ( !_drags->active () && !_session->transport_rolling() && ( effective_mouse_mode() == MouseRange ) && Config->get_follow_edits() ) {
+       if ( !_drags->active () && !_session->transport_rolling() && ( effective_mouse_mode() == MouseRange ) && ARDOUR_UI::config()->get_follow_edits() ) {
                framepos_t where = canvas_event_sample (event);
                snap_to(where);
                _session->request_locate (where, false);
@@ -1382,10 +1141,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
        framepos_t where = canvas_event_sample (event);
        AutomationTimeAxisView* atv = 0;
 
-        if (pre_press_cursor) {
-                set_canvas_cursor (pre_press_cursor);
-                pre_press_cursor = 0;
-        }
+       _press_cursor_ctx.reset();
 
        /* no action if we're recording */
 
@@ -1422,12 +1178,12 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                        
                        if ((marker = reinterpret_cast<Marker *> (item->get_data ("marker"))) == 0) {
                                fatal << _("programming error: tempo marker canvas item has no marker object pointer!") << endmsg;
-                               /*NOTREACHED*/
+                               abort(); /*NOTREACHED*/
                        }
                        
                        if ((tempo_marker = dynamic_cast<TempoMarker*> (marker)) == 0) {
                                fatal << _("programming error: marker for tempo is not a tempo marker!") << endmsg;
-                               /*NOTREACHED*/
+                               abort(); /*NOTREACHED*/
                        }
                        
                        edit_tempo_marker (*tempo_marker);
@@ -1440,12 +1196,12 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                        
                        if ((marker = reinterpret_cast<Marker *> (item->get_data ("marker"))) == 0) {
                                fatal << _("programming error: tempo marker canvas item has no marker object pointer!") << endmsg;
-                               /*NOTREACHED*/
+                               abort(); /*NOTREACHED*/
                        }
                        
                        if ((meter_marker = dynamic_cast<MeterMarker*> (marker)) == 0) {
                                fatal << _("programming error: marker for meter is not a meter marker!") << endmsg;
-                               /*NOTREACHED*/
+                               abort(); /*NOTREACHED*/
                        }
                        edit_meter_marker (*meter_marker);
                        break;
@@ -1483,7 +1239,6 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                        case FadeInHandleItem:
                        case FadeInTrimHandleItem:
                        case StartCrossFadeItem:
-                       case LeftFrameHandle:
                                popup_xfade_in_context_menu (1, event->button.time, item, item_type);
                                break;
 
@@ -1491,10 +1246,13 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                        case FadeOutHandleItem:
                        case FadeOutTrimHandleItem:
                        case EndCrossFadeItem:
-                       case RightFrameHandle:
                                popup_xfade_out_context_menu (1, event->button.time, item, item_type);
                                break;
 
+                       case LeftFrameHandle:
+                       case RightFrameHandle:
+                               break;
+
                        case StreamItem:
                                popup_track_context_menu (1, event->button.time, item_type, false);
                                break;
@@ -1547,6 +1305,12 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                                popup_control_point_context_menu (item, event);
                                break;
 
+                       case NoteItem:
+                               if (internal_editing()) {
+                                       popup_note_context_menu (item, event);
+                               }
+                               break;
+
                        default:
                                break;
                        }
@@ -1609,7 +1373,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
 
                case MarkerBarItem:
                        if (!_dragging_playhead) {
-                               snap_to_with_modifier (where, event, 0, true);
+                               snap_to_with_modifier (where, event, RoundNearest, true);
                                mouse_add_new_marker (where);
                        }
                        return true;
@@ -1617,7 +1381,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                case CdMarkerBarItem:
                        if (!_dragging_playhead) {
                                // if we get here then a dragged range wasn't done
-                               snap_to_with_modifier (where, event, 0, true);
+                               snap_to_with_modifier (where, event, RoundNearest, true);
                                mouse_add_new_marker (where, true);
                        }
                        return true;
@@ -1648,22 +1412,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                }
 
                switch (eff) {
-               case MouseObject:
-                       switch (item_type) {
-                       case AutomationTrackItem:
-                               atv = dynamic_cast<AutomationTimeAxisView*>(clicked_axisview);
-                               if (atv) {
-                                       bool with_guard_points = Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier);
-                                       atv->add_automation_event (event, where, event->button.y, with_guard_points);
-                               }
-                               return true;
-                               break;
-                       default:
-                               break;
-                       }
-                       break;
-
-               case MouseGain:
+               case MouseDraw:
                        switch (item_type) {
                        case RegionItem:
                        {
@@ -1682,8 +1431,10 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
 
                        case AutomationTrackItem: {
                                bool with_guard_points = Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier);
-                               dynamic_cast<AutomationTimeAxisView*>(clicked_axisview)->
-                                       add_automation_event (event, where, event->button.y, with_guard_points);
+                               atv = dynamic_cast<AutomationTimeAxisView*>(clicked_axisview);
+                               if (atv) {
+                                       atv->add_automation_event (event, where, event->button.y, with_guard_points);
+                               }
                                return true;
                                break;
                        }
@@ -1693,7 +1444,6 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                        break;
 
                case MouseAudition:
-                       pop_canvas_cursor ();
                        if (scrubbing_direction == 0) {
                                /* no drag, just a click */
                                switch (item_type) {
@@ -1781,11 +1531,11 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
         * (e.g. the actual entered regionview)
         */
 
-       choose_canvas_cursor_on_entry (&event->crossing, item_type);
+       choose_canvas_cursor_on_entry (item_type);
 
        switch (item_type) {
        case ControlPointItem:
-               if (mouse_mode == MouseGain || mouse_mode == MouseObject) {
+               if (mouse_mode == MouseDraw || mouse_mode == MouseObject) {
                        cp = static_cast<ControlPoint*>(item->get_data ("control_point"));
                        cp->show ();
 
@@ -1797,19 +1547,19 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
                break;
 
        case GainLineItem:
-               if (mouse_mode == MouseGain) {
+               if (mouse_mode == MouseDraw) {
                        ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
                        if (line) {
-                               line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_EnteredGainLine());
+                               line->set_outline_color (ARDOUR_UI::config()->color ("entered gain line"));
                        }
                }
                break;
 
        case AutomationLineItem:
-               if (mouse_mode == MouseGain || mouse_mode == MouseObject) {
+               if (mouse_mode == MouseDraw || mouse_mode == MouseObject) {
                        ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
                        if (line) {
-                               line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_EnteredAutomationLine());
+                               line->set_outline_color (ARDOUR_UI::config()->color ("entered automation line"));
                        }
                }
                break;
@@ -1827,7 +1577,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
                        break;
                }
                entered_marker = marker;
-               marker->set_color_rgba (ARDOUR_UI::config()->get_canvasvar_EnteredMarker());
+               marker->set_color_rgba (ARDOUR_UI::config()->color ("entered marker"));
                // fall through
        case MeterMarkerItem:
        case TempoMarkerItem:
@@ -1835,7 +1585,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
 
        case FadeInHandleItem:
        case FadeInTrimHandleItem:
-               if (mouse_mode == MouseObject && !internal_editing()) {
+               if (mouse_mode == MouseObject) {
                        ArdourCanvas::Rectangle *rect = dynamic_cast<ArdourCanvas::Rectangle *> (item);
                        if (rect) {
                                RegionView* rv = static_cast<RegionView*>(item->get_data ("regionview"));
@@ -1846,7 +1596,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
 
        case FadeOutHandleItem:
        case FadeOutTrimHandleItem:
-               if (mouse_mode == MouseObject && !internal_editing()) {
+               if (mouse_mode == MouseObject) {
                        ArdourCanvas::Rectangle *rect = dynamic_cast<ArdourCanvas::Rectangle *> (item);
                        if (rect) {
                                RegionView* rv = static_cast<RegionView*>(item->get_data ("regionview"));
@@ -1901,6 +1651,8 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
        bool is_start;
        bool ret = true;
 
+       _enter_stack.pop_back();
+
        switch (item_type) {
        case ControlPointItem:
                _verbose_cursor->hide (); 
@@ -1923,7 +1675,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
                }
                entered_marker = 0;
                if ((loc = find_location_from_marker (marker, is_start)) != 0) {
-                       location_flags_changed (loc, this);
+                       location_flags_changed (loc);
                }
                // fall through
        case MeterMarkerItem:
@@ -1937,7 +1689,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
        {
                ArdourCanvas::Rectangle *rect = dynamic_cast<ArdourCanvas::Rectangle *> (item);
                if (rect) {
-                       rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_InactiveFadeHandle());
+                       rect->set_fill_color (ARDOUR_UI::config()->color ("inactive fade handle"));
                }
        }
        break;
@@ -1948,7 +1700,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
        case FeatureLineItem:
        {
                ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
-               line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_ZeroLine());
+               line->set_outline_color (ARDOUR_UI::config()->color ("zero line"));
        }
        break;
 
@@ -2085,7 +1837,7 @@ Editor::can_remove_control_point (ArdourCanvas::Item* item)
 
        if ((control_point = reinterpret_cast<ControlPoint *> (item->get_data ("control_point"))) == 0) {
                fatal << _("programming error: control point canvas item has no control point object pointer!") << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        AutomationLine& line = control_point->line ();
@@ -2110,7 +1862,7 @@ Editor::remove_control_point (ArdourCanvas::Item* item)
 
        if ((control_point = reinterpret_cast<ControlPoint *> (item->get_data ("control_point"))) == 0) {
                fatal << _("programming error: control point canvas item has no control point object pointer!") << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        control_point->line().remove_point (*control_point);
@@ -2123,7 +1875,7 @@ Editor::edit_control_point (ArdourCanvas::Item* item)
 
        if (p == 0) {
                fatal << _("programming error: control point canvas item has no control point object pointer!") << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        ControlPointDialog d (p);
@@ -2137,21 +1889,15 @@ Editor::edit_control_point (ArdourCanvas::Item* item)
 }
 
 void
-Editor::edit_notes (TimeAxisViewItem& tavi)
+Editor::edit_notes (MidiRegionView* mrv)
 {
-       MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(&tavi);
-
-       if (!mrv) {
-               return;
-       }
-
        MidiRegionView::Selection const & s = mrv->selection();
 
        if (s.empty ()) {
                return;
        }
 
-       EditNoteDialog* d = new EditNoteDialog (&(*s.begin())->region_view(), s);
+       EditNoteDialog* d = new EditNoteDialog (mrv, s);
        d->show_all ();
        ensure_float (*d);
 
@@ -2328,25 +2074,13 @@ Editor::hide_marker (ArdourCanvas::Item* item, GdkEvent* /*event*/)
 
        if ((marker = static_cast<Marker *> (item->get_data ("marker"))) == 0) {
                fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg;
-               /*NOTREACHED*/
+               abort(); /*NOTREACHED*/
        }
 
        Location* location = find_location_from_marker (marker, is_start);
        location->set_hidden (true, this);
 }
 
-
-void
-Editor::reposition_zoom_rect (framepos_t start, framepos_t end)
-{
-       double x1 = sample_to_pixel (start);
-       double x2 = sample_to_pixel (end);
-       double y2 = _full_canvas_height - 1.0;
-
-       zoom_rect->set (ArdourCanvas::Rect (x1, 1.0, x2, y2));
-}
-
-
 gint
 Editor::mouse_rename_region (ArdourCanvas::Item* /*item*/, GdkEvent* /*event*/)
 {
@@ -2526,8 +2260,6 @@ Editor::start_selection_grab (ArdourCanvas::Item* /*item*/, GdkEvent* event)
        clicked_routeview->playlist()->add_region (region, selection->time[clicked_selection].start);
        _session->add_command(new StatefulDiffCommand (playlist));
 
-       commit_reversible_command ();
-
        c.disconnect ();
 
        if (latest_regionviews.empty()) {
@@ -2538,8 +2270,11 @@ Editor::start_selection_grab (ArdourCanvas::Item* /*item*/, GdkEvent* event)
        /* we need to deselect all other regionviews, and select this one
           i'm ignoring undo stuff, because the region creation will take care of it
        */
+
        selection->set (latest_regionviews);
 
+       commit_reversible_command ();
+
        _drags->set (new RegionMoveDrag (this, latest_regionviews.front()->get_canvas_group(), latest_regionviews.front(), latest_regionviews, false, false), event);
 }
 
@@ -2551,48 +2286,8 @@ Editor::escape ()
        } else {
                selection->clear ();
        }
-}
-
-void
-Editor::set_internal_edit (bool yn)
-{
-       if (_internal_editing == yn) {
-               return;
-       }
-
-       _internal_editing = yn;
-
-       if (yn) {
-               pre_internal_mouse_mode = mouse_mode;
-               pre_internal_snap_type = _snap_type;
-               pre_internal_snap_mode = _snap_mode;
-
-               for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
-                       (*i)->enter_internal_edit_mode ();
-               }
-
-               set_snap_to (internal_snap_type);
-               set_snap_mode (internal_snap_mode);
 
-       } else {
-
-               internal_snap_mode = _snap_mode;
-               internal_snap_type = _snap_type;
-
-               for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
-                       (*i)->leave_internal_edit_mode ();
-               }
-
-               if (mouse_mode == MouseDraw && pre_internal_mouse_mode != MouseDraw) {
-                       /* we were drawing .. flip back to something sensible */
-                       set_mouse_mode (pre_internal_mouse_mode);
-               }
-
-               set_snap_to (pre_internal_snap_type);
-               set_snap_mode (pre_internal_snap_mode);
-       }
-
-       reset_canvas_cursor ();
+       reset_focus ();
 }
 
 /** Update _join_object_range_state which indicate whether we are over the top
@@ -2602,7 +2297,7 @@ Editor::set_internal_edit (bool yn)
 void
 Editor::update_join_object_range_location (double y)
 {
-       if (_internal_editing || !get_smart_mode()) {
+       if (!get_smart_mode()) {
                _join_object_range_state = JOIN_OBJECT_RANGE_NONE;
                return;
        }
@@ -2621,9 +2316,10 @@ Editor::update_join_object_range_location (double y)
                double const c = item_space.y / entered_regionview->height();
                        
                _join_object_range_state = c <= 0.5 ? JOIN_OBJECT_RANGE_RANGE : JOIN_OBJECT_RANGE_OBJECT;
-               
-               if (_join_object_range_state != old) {
-                       set_canvas_cursor (which_track_cursor ());
+
+               Editor::EnterContext* ctx = get_enter_context(RegionItem);
+               if (_join_object_range_state != old && ctx) {
+                       ctx->cursor_ctx->change(which_track_cursor());
                }
 
        } else if (entered_track) {
@@ -2638,7 +2334,7 @@ Editor::update_join_object_range_location (double y)
                        entered_route_view->canvas_display()->canvas_to_item (cx, cy);
 
                        double track_height = entered_route_view->view()->child_height();
-                       if (Config->get_show_name_highlight()) {
+                       if (ARDOUR_UI::config()->get_show_name_highlight()) {
                                track_height -= TimeAxisViewItem::NAME_HIGHLIGHT_SIZE;
                        }
                        double const c = cy / track_height;
@@ -2655,8 +2351,9 @@ Editor::update_join_object_range_location (double y)
                        _join_object_range_state = JOIN_OBJECT_RANGE_OBJECT;
                }
 
-               if (_join_object_range_state != old) {
-                       set_canvas_cursor (which_track_cursor ());
+               Editor::EnterContext* ctx = get_enter_context(StreamItem);
+               if (_join_object_range_state != old && ctx) {
+                       ctx->cursor_ctx->change(which_track_cursor());
                }
        }
 }