X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor_canvas.cc;h=6413b6d6910de00031a27aecd6851676a0711b76;hb=46c83693284ece4a732d26e62113ea4ac584d539;hp=335117114fbf9a6723230c74f435718f64d41519;hpb=e79af77a18c13a304c0c08e52ca337b03ecc0a78;p=ardour.git diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 335117114f..6413b6d691 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -80,7 +80,11 @@ Editor::initialize_canvas () ArdourCanvas::ScrollGroup* hsg; ArdourCanvas::ScrollGroup* hg; - ArdourCanvas::ScrollGroup* vg; + ArdourCanvas::ScrollGroup* cg; + + h_scroll_group = hg = new ArdourCanvas::ScrollGroup (_track_canvas->root(), ArdourCanvas::ScrollGroup::ScrollsHorizontally); + CANVAS_DEBUG_NAME (h_scroll_group, "canvas h scroll"); + _track_canvas->add_scroller (*hg); hv_scroll_group = hsg = new ArdourCanvas::ScrollGroup (_track_canvas->root(), ArdourCanvas::ScrollGroup::ScrollSensitivity (ArdourCanvas::ScrollGroup::ScrollsVertically| @@ -88,13 +92,9 @@ Editor::initialize_canvas () CANVAS_DEBUG_NAME (hv_scroll_group, "canvas hv scroll"); _track_canvas->add_scroller (*hsg); - v_scroll_group = vg = new ArdourCanvas::ScrollGroup (_track_canvas->root(), ArdourCanvas::ScrollGroup::ScrollsVertically); - CANVAS_DEBUG_NAME (v_scroll_group, "canvas v scroll"); - _track_canvas->add_scroller (*vg); - - h_scroll_group = hg = new ArdourCanvas::ScrollGroup (_track_canvas->root(), ArdourCanvas::ScrollGroup::ScrollsHorizontally); - CANVAS_DEBUG_NAME (h_scroll_group, "canvas h scroll"); - _track_canvas->add_scroller (*hg); + cursor_scroll_group = cg = new ArdourCanvas::ScrollGroup (_track_canvas->root(), ArdourCanvas::ScrollGroup::ScrollsHorizontally); + CANVAS_DEBUG_NAME (cursor_scroll_group, "canvas cursor scroll"); + _track_canvas->add_scroller (*cg); _verbose_cursor = new VerboseCursor (this); @@ -231,8 +231,6 @@ Editor::initialize_canvas () logo_item->lower_to_bottom (); } - hv_scroll_group->raise_to_top (); - _canvas_drop_zone = new ArdourCanvas::Rectangle (hv_scroll_group, ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, 0.0)); /* this thing is transparent */ _canvas_drop_zone->set_fill (false); @@ -1014,15 +1012,22 @@ Editor::set_canvas_cursor (Gdk::Cursor* cursor) { Glib::RefPtr win = _track_canvas->get_window(); - if (win && cursor) { - win->set_cursor (*cursor); + if (win && !_cursors->is_invalid (cursor)) { + /* glibmm 2.4 doesn't allow null cursor pointer because it uses + a Gdk::Cursor& as the argument to Gdk::Window::set_cursor(). + But a null pointer just means "use parent window cursor", + and so should be allowed. Gtkmm 3.x has fixed this API. + + For now, drop down and use C API + */ + gdk_window_set_cursor (win->gobj(), cursor ? cursor->gobj() : 0); } } size_t Editor::push_canvas_cursor (Gdk::Cursor* cursor) { - if (cursor) { + if (!_cursors->is_invalid (cursor)) { _cursor_stack.push_back (cursor); set_canvas_cursor (cursor); } @@ -1097,7 +1102,7 @@ Editor::which_trim_cursor (bool left) const Gdk::Cursor* Editor::which_mode_cursor () const { - Gdk::Cursor* mode_cursor = 0; + Gdk::Cursor* mode_cursor = MouseCursors::invalid_cursor (); switch (mouse_mode) { case MouseRange: @@ -1163,7 +1168,7 @@ Editor::which_mode_cursor () const Gdk::Cursor* Editor::which_track_cursor () const { - Gdk::Cursor* cursor = 0; + Gdk::Cursor* cursor = MouseCursors::invalid_cursor(); switch (_join_object_range_state) { case JOIN_OBJECT_RANGE_NONE: @@ -1183,6 +1188,19 @@ Editor::which_canvas_cursor(ItemType type) const { 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) { @@ -1218,7 +1236,7 @@ Editor::which_canvas_cursor(ItemType type) const cursor = _cursors->fader; break; case GainLineItem: - cursor = which_track_cursor (); + cursor = _cursors->cross_hair; break; case AutomationLineItem: cursor = _cursors->cross_hair; @@ -1251,12 +1269,16 @@ Editor::which_canvas_cursor(ItemType type) const cursor = _cursors->cross_hair; break; case LeftFrameHandle: - if ( effective_mouse_mode() == MouseObject ) // (smart mode): if the user is in the top half, override the trim cursor, since they are in the range zone - cursor = which_trim_cursor (true); //alternatively, one could argue that we _should_ allow trims here, and disallow range selection + 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; @@ -1334,7 +1356,7 @@ Editor::choose_canvas_cursor_on_entry (ItemType type) Gdk::Cursor* cursor = which_canvas_cursor(type); - if (cursor) { + if (!_cursors->is_invalid (cursor)) { // Push a new enter context const EnterContext ctx = { type, CursorContext::create(*this, cursor) }; _enter_stack.push_back(ctx);