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);
+ }
}
}
}