13
0

Fix cursor icon over region-bar (use trim)

This commit is contained in:
Robin Gareus 2019-09-26 19:44:22 +02:00
parent 7850547e12
commit 57e1b3219f
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -1169,7 +1169,6 @@ Editor::which_trim_cursor (bool left) const
Trimmable::CanTrim ct = entered_regionview->region()->can_trim (); Trimmable::CanTrim ct = entered_regionview->region()->can_trim ();
if (left) { if (left) {
if (ct & Trimmable::FrontTrimEarlier) { if (ct & Trimmable::FrontTrimEarlier) {
return _cursors->left_side_trim; return _cursors->left_side_trim;
} else { } else {
@ -1290,15 +1289,12 @@ Editor::which_canvas_cursor(ItemType type) const
mouse_mode == MouseContent) { mouse_mode == MouseContent) {
/* find correct cursor to use in object/smart mode */ /* find correct cursor to use in object/smart mode */
switch (type) { switch (type) {
case RegionItem: case RegionItem:
/* We don't choose a cursor for these items on top of a region view, /* We don't choose a cursor for these items on top of a region view,
because this would push a new context on the enter stack which because this would push a new context on the enter stack which
means switching the region context for things like smart mode means switching the region context for things like smart mode
won't actualy change the cursor. */ won't actualy change the cursor. */
// case RegionViewNameHighlight:
// case RegionViewName:
// case WaveItem: // case WaveItem:
case StreamItem: case StreamItem:
case AutomationTrackItem: case AutomationTrackItem:
@ -1358,6 +1354,20 @@ Editor::which_canvas_cursor(ItemType type) const
else else
cursor = _cursors->selector; cursor = _cursors->selector;
break; break;
case RegionViewName:
case RegionViewNameHighlight:
/* the trim bar is used for trimming, but we have to determine if we are on the left or right side of the region */
cursor = MouseCursors::invalid_cursor ();
if (entered_regionview) {
samplepos_t where;
bool in_track_canvas;
if (mouse_sample (where, in_track_canvas)) {
samplepos_t start = entered_regionview->region()->first_sample();
samplepos_t end = entered_regionview->region()->last_sample();
cursor = which_trim_cursor ((where - start) < (end - where));
}
}
break;
case StartCrossFadeItem: case StartCrossFadeItem:
cursor = _cursors->fade_in; cursor = _cursors->fade_in;
break; break;