summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-04-15 12:44:11 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2014-04-15 12:44:49 -0400
commitdc4eae5c3720fc141a61bf67bdb410eb4b6ad433 (patch)
tree33df64586512361a61e3b60ef9e69e47d7f1ba83 /gtk2_ardour
parentdbaf203bac135bfc59eab8fbdc1c699217297802 (diff)
hopefully fix issue with Editor::set_canvas_cursor_for_region_view() which was incorrectly switching to trim cursors.
This started happening more frequently after this function started to be called more often (which was the right thing to do, but had this side effect (now fixed).
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor_mouse.cc35
1 files changed, 21 insertions, 14 deletions
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index b0ae055aa8..5ce8fcd386 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -2927,21 +2927,28 @@ Editor::set_canvas_cursor_for_region_view (double x, RegionView* rv)
assert (item_bbox);
ArdourCanvas::Rect parent_bbox = g->item_to_parent (item_bbox.get ());
- /* Halfway across the region */
- double const h = (parent_bbox.x0 + parent_bbox.x1) / 2;
+ /* First or last 10% of region is used for trimming, if the whole
+ region is wider than 20 pixels at the current zoom level.
+ */
- Trimmable::CanTrim ct = rv->region()->can_trim ();
- if (x <= h) {
- if (ct & Trimmable::FrontTrimEarlier) {
- set_canvas_cursor (_cursors->left_side_trim, true);
- } else {
- set_canvas_cursor (_cursors->left_side_trim_right_only, true);
- }
- } else {
- if (ct & Trimmable::EndTrimLater) {
- set_canvas_cursor (_cursors->right_side_trim, true);
- } else {
- set_canvas_cursor (_cursors->right_side_trim_left_only, true);
+ double const w = parent_bbox.width();
+
+ if (w > 20.0 && x >= parent_bbox.x0 && x < parent_bbox.x1) {
+
+ Trimmable::CanTrim ct = rv->region()->can_trim ();
+
+ if (((x - parent_bbox.x0) / w) < 0.10) {
+ if (ct & Trimmable::FrontTrimEarlier) {
+ set_canvas_cursor (_cursors->left_side_trim, true);
+ } else {
+ set_canvas_cursor (_cursors->left_side_trim_right_only, true);
+ }
+ } else if (((parent_bbox.x1 - x) / w) < 0.10) {
+ if (ct & Trimmable::EndTrimLater) {
+ set_canvas_cursor (_cursors->right_side_trim, true);
+ } else {
+ set_canvas_cursor (_cursors->right_side_trim_left_only, true);
+ }
}
}
}