+ Gdk::Cursor* cursor = which_mode_cursor ();
+
+ if (mouse_mode == MouseRange) {
+ switch (type) {
+ case StartSelectionTrimItem:
+ cursor = _cursors->left_side_trim;
+ break;
+ case EndSelectionTrimItem:
+ cursor = _cursors->right_side_trim;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if ((mouse_mode == MouseObject || get_smart_mode ()) ||
+ mouse_mode == MouseContent) {
+
+ /* find correct cursor to use in object/smart mode */
+
+ switch (type) {
+ case RegionItem:
+ /* We don't choose a cursor for these items on top of a region view,
+ because this would push a new context on the enter stack which
+ means switching the region context for things like smart mode
+ won't actualy change the cursor. */
+ // case RegionViewNameHighlight:
+ // case RegionViewName:
+ // case WaveItem:
+ case StreamItem:
+ case AutomationTrackItem:
+ cursor = which_track_cursor ();
+ break;
+ case PlayheadCursorItem:
+ switch (_edit_point) {
+ case EditAtMouse:
+ cursor = _cursors->grabber_edit_point;
+ break;
+ default:
+ cursor = _cursors->grabber;
+ break;
+ }
+ break;
+ case SelectionItem:
+ cursor = _cursors->selector;
+ break;
+ case ControlPointItem:
+ cursor = _cursors->fader;
+ break;
+ case GainLineItem:
+ cursor = _cursors->cross_hair;
+ break;
+ case AutomationLineItem:
+ cursor = _cursors->cross_hair;
+ break;
+ case StartSelectionTrimItem:
+ cursor = _cursors->left_side_trim;
+ break;
+ case EndSelectionTrimItem:
+ cursor = _cursors->right_side_trim;
+ break;
+ case FadeInItem:
+ cursor = _cursors->fade_in;
+ break;
+ case FadeInHandleItem:
+ cursor = _cursors->fade_in;
+ break;
+ case FadeInTrimHandleItem:
+ cursor = _cursors->fade_in;
+ break;
+ case FadeOutItem:
+ cursor = _cursors->fade_out;
+ break;
+ case FadeOutHandleItem:
+ cursor = _cursors->fade_out;
+ break;
+ case FadeOutTrimHandleItem:
+ cursor = _cursors->fade_out;
+ break;
+ case FeatureLineItem:
+ cursor = _cursors->cross_hair;
+ break;
+ case LeftFrameHandle:
+ if ( effective_mouse_mode() == MouseObject ) // (smart mode): if the user is in the btm half, show the trim cursor
+ cursor = which_trim_cursor (true);
+ else
+ cursor = _cursors->selector; // (smart mode): in the top half, just show the selection (range) cursor
+ break;
+ case RightFrameHandle:
+ if ( effective_mouse_mode() == MouseObject ) //see above
+ cursor = which_trim_cursor (false);
+ else
+ cursor = _cursors->selector;
+ break;
+ case StartCrossFadeItem:
+ cursor = _cursors->fade_in;
+ break;
+ case EndCrossFadeItem:
+ cursor = _cursors->fade_out;
+ break;
+ case CrossfadeViewItem:
+ cursor = _cursors->cross_hair;
+ break;
+ case NoteItem:
+ cursor = _cursors->grabber_note;
+ default:
+ break;
+ }
+
+ } else if (mouse_mode == MouseDraw) {
+
+ /* ControlPointItem is not really specific to region gain mode
+ but it is the same cursor so don't worry about this for now.
+ The result is that we'll see the fader cursor if we enter
+ non-region-gain-line control points while in MouseDraw
+ mode, even though we can't edit them in this mode.
+ */
+
+ switch (type) {
+ case GainLineItem:
+ case ControlPointItem:
+ cursor = _cursors->fader;
+ break;
+ case NoteItem:
+ cursor = _cursors->grabber_note;
+ default:
+ break;
+ }
+ }
+
+ switch (type) {
+ /* These items use the timebar cursor at all times */
+ case TimecodeRulerItem:
+ case MinsecRulerItem:
+ case BBTRulerItem:
+ case SamplesRulerItem:
+ cursor = _cursors->timebar;
+ break;
+
+ /* These items use the grabber cursor at all times */
+ case MeterMarkerItem:
+ case TempoMarkerItem:
+ case MeterBarItem:
+ case TempoBarItem:
+ case MarkerItem:
+ case MarkerBarItem:
+ case RangeMarkerBarItem:
+ case CdMarkerBarItem:
+ case VideoBarItem:
+ case TransportMarkerBarItem:
+ case DropZoneItem:
+ cursor = which_grabber_cursor();
+ break;
+
+ default:
+ break;
+ }
+
+ return cursor;
+}
+
+void
+Editor::choose_canvas_cursor_on_entry (ItemType type)
+{
+ if (_drags->active()) {
+ return;
+ }
+
+ Gdk::Cursor* cursor = which_canvas_cursor(type);
+
+ if (!_cursors->is_invalid (cursor)) {
+ // 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));
+ }
+}
+
+double
+Editor::trackviews_height() const
+{
+ if (!_trackview_group) {
+ return 0;
+ }
+
+ return _visible_canvas_height - _trackview_group->canvas_origin().y;