X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor_canvas.cc;h=3d763cbe568cdc7be7ddf85fcce6b9aee3d0abf3;hb=4e411dfd7bab6793426979fe005faf2435c0df0d;hp=9739f65dd1b60994e4e66b41262f6e2cce4a9f76;hpb=4df566782c377b3161218daf279effff11010521;p=ardour.git diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 9739f65dd1..3d763cbe56 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -517,14 +517,11 @@ Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool from_headers) ArdourCanvas::Rect scrolling_boundary; Gtk::Allocation alloc; - int cx, cy; if (from_headers) { alloc = controls_layout.get_allocation (); } else { alloc = _track_canvas_viewport->get_allocation (); - cx = alloc.get_x(); - cy = alloc.get_y(); /* reduce height by the height of the timebars, which happens to correspond to the position of the hv_scroll_group. @@ -581,12 +578,12 @@ Editor::autoscroll_canvas () Gdk::ModifierType mask; frameoffset_t dx = 0; bool no_stop = false; - bool y_motion = false; get_window()->get_pointer (x, y, mask); VisualChange vc; bool vertical_motion = false; + bool y_motion = false; if (autoscroll_horizontal_allowed) { @@ -644,14 +641,14 @@ Editor::autoscroll_canvas () /* scroll to make higher tracks visible */ if (autoscroll_cnt && (autoscroll_cnt % speed_factor == 0)) { - y_motion = scroll_up_one_track (); + scroll_up_one_track (); vertical_motion = true; } } else if (y > autoscroll_boundary.y1) { if (autoscroll_cnt && (autoscroll_cnt % speed_factor == 0)) { - y_motion = scroll_down_one_track (); + scroll_down_one_track (); vertical_motion = true; } } @@ -805,7 +802,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 +819,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 +1113,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; @@ -1286,10 +1296,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; @@ -1325,6 +1337,7 @@ Editor::choose_canvas_cursor_on_entry (GdkEventCrossing* /*event*/, ItemType typ case CdMarkerBarItem: case VideoBarItem: case TransportMarkerBarItem: + case DropZoneItem: cursor = which_grabber_cursor(); break; @@ -1336,3 +1349,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; +}