Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #17600 - Tuplets Skipped by Alt+left and Alt+right #18947

Conversation

codecruisedor
Copy link

Make Tuplet select-able via alt+right, alt+left

Resolves: #17600

Clone of PR #18346

  • I signed the CLA
  • The title of the PR describes the problem it addresses
  • Each commit's message describes its purpose and effects, and references the issue it resolves
  • If changes are extensive, there is a sequence of easily reviewable commits
  • The code in the PR follows the coding rules
  • There are no unnecessary changes
  • The code compiles and runs on my machine, preferably after each commit individually
  • I created a unit test or vtest to verify the changes I made (if applicable)

Make Tuplet select-able via alt+right, alt+left
@codecruisedor codecruisedor changed the title Commit-1 Fix #17600 - Tuplets Skipped by Alt+left and Alt+right Aug 6, 2023
@oktophonie oktophonie requested a review from shoogle August 7, 2023 14:59
@oktophonie
Copy link
Contributor

This doesn't seem to work correctly to me - tuplet brackets will be included (sometimes) as you step through with alt-left/right, but the sequence seems to get thrown and many items will be skipped. I've not managed to deduce what the pattern is yet.

Comment on lines +917 to +920
ChordRest* nextCR = nextChordRest(this);
Tuplet* tuplet = nextCR ? nextCR->tuplet() : nullptr;
if (tuplet) {
return tuplet;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good start, but it's in the wrong place. I can tell because with your build Alt+Right skips barlines and articulations/lyrics/fermatas on the current note and goes straight to a tuplet on the next note instead:

image

Alt+Right should visit everything on the current note before moving on to the next note, so my guess is this code probably needs to go at the end of this function, or perhaps in Segment::nextElement() instead (because that function is called at the end of this function).

In fact, I think it should go in Segment::firstElementOfSegment(), which is called from within Segment::nextElement().

Also, you should only visit the tuplet if nextCR is the first (leftmost) ChordRest within the tuplet. If nextCR is in the middle/end of the tuplet then you shouldn't visit the tuplet.

Comment on lines +958 to +960
Tuplet* tuplet = prevCR ? prevCR->tuplet() : nullptr;
if (tuplet) {
return tuplet;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When going backwards, you shouldn't look for tuplets on the previous ChordRest (CR). Instead you would check current CR. You need to know:

  1. Does the current CR have a tuplet? And if so...
  2. Is the current CR the first (leftmost) CR inside the tuplet?

If the answer to both questions is "yes" then you visit the tuplet, otherwise go back to the previous CR.


EngravingItem* Tuplet::nextElement()
{
return elements().front();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good!


EngravingItem* Tuplet::prevElement()
{
return elements().back();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous element will be something before the tuplet, not something inside the tuplet. Exceptionally, it might be an element in a different voice that occurs at the same time as the tuplet.

You probably need to call Segment::previousElement() or something like that.

@codecruisedor
Copy link
Author

Thanks for the review, working on the changes

@cbjeukendrup cbjeukendrup removed their assignment Oct 8, 2023
@igorkorsukov igorkorsukov force-pushed the master branch 6 times, most recently from fa1f8d3 to 525a11a Compare February 14, 2024 09:08
@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Jun 20, 2024

Rebase needed, but see also #23082, while this here looks pretty much orphaned?

@RomanPudashkin
Copy link
Contributor

Closing due to a long period of inactivity. Also, see #23082

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Accessibility] Tuplets skipped by Alt+Left and Alt+Right
6 participants