X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor_canvas.cc;h=66caeb7bc6d72ab55899873d6bb4f22320070943;hb=0b1ee476edaed41f4c679f89e93a486e4d487333;hp=cae0199673ae2f8fce2d88cd59518bf25b34b5da;hpb=c706b1c4bb172fb3622ada9da879e5c684f94a74;p=ardour.git diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index cae0199673..66caeb7bc6 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -805,7 +805,7 @@ Editor::entered_track_canvas (GdkEventCrossing */*ev*/) } void -Editor::_ensure_time_axis_view_is_visible (TimeAxisView const & track, bool at_top) +Editor::ensure_time_axis_view_is_visible (TimeAxisView const & track, bool at_top) { if (track.hidden()) { return; @@ -822,19 +822,28 @@ Editor::_ensure_time_axis_view_is_visible (TimeAxisView const & track, bool at_t double const track_max_y = track.y_position () + track.effective_height (); if (!at_top && - (track_min_y > current_view_min_y && - track_max_y <= current_view_max_y)) { + (track_min_y >= current_view_min_y && + track_max_y < current_view_max_y)) { + /* already visible, and caller did not ask to place it at the + * top of the track canvas + */ return; } double new_value; - if (track_min_y < current_view_min_y) { - // Track is above the current view + if (at_top) { new_value = track_min_y; } else { - // Track is below the current view - new_value = track.y_position () + track.effective_height() - vertical_adjustment.get_page_size(); + if (track_min_y < current_view_min_y) { + // Track is above the current view + new_value = track_min_y; + } else if (track_max_y > current_view_max_y) { + // Track is below the current view + new_value = track.y_position () + track.effective_height() - vertical_adjustment.get_page_size(); + } else { + new_value = track_min_y; + } } vertical_adjustment.set_value(new_value); @@ -1107,6 +1116,10 @@ Editor::which_mode_cursor () const } break; + case MouseCut: + mode_cursor = _cursors->scissors; + break; + case MouseObject: /* don't use mode cursor, pick a grabber cursor based on the item */ break; @@ -1182,11 +1195,9 @@ Editor::which_track_cursor () const case JOIN_OBJECT_RANGE_NONE: case JOIN_OBJECT_RANGE_OBJECT: cursor = which_grabber_cursor (); - cerr << "region use grabber\n"; break; case JOIN_OBJECT_RANGE_RANGE: cursor = _cursors->selector; - cerr << "region use selector\n"; break; } } @@ -1216,8 +1227,6 @@ Editor::choose_canvas_cursor_on_entry (GdkEventCrossing* /*event*/, ItemType typ { Gdk::Cursor* cursor = 0; - cerr << "entered new item type " << enum_2_string (type) << endl; - if (_drags->active()) { return; } @@ -1290,10 +1299,12 @@ Editor::choose_canvas_cursor_on_entry (GdkEventCrossing* /*event*/, ItemType typ cursor = _cursors->cross_hair; break; case LeftFrameHandle: - cursor = which_trim_cursor (true); + 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 break; case RightFrameHandle: - cursor = which_trim_cursor (false); + if ( effective_mouse_mode() == MouseObject ) //see above + cursor = which_trim_cursor (false); break; case StartCrossFadeItem: cursor = _cursors->fade_in; @@ -1329,6 +1340,7 @@ Editor::choose_canvas_cursor_on_entry (GdkEventCrossing* /*event*/, ItemType typ case CdMarkerBarItem: case VideoBarItem: case TransportMarkerBarItem: + case DropZoneItem: cursor = which_grabber_cursor(); break; @@ -1340,3 +1352,13 @@ Editor::choose_canvas_cursor_on_entry (GdkEventCrossing* /*event*/, ItemType typ set_canvas_cursor (cursor, false); } } + +double +Editor::trackviews_height() const +{ + if (!_trackview_group) { + return 0; + } + + return _visible_canvas_height - _trackview_group->canvas_origin().y; +}