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

[CMD: up/down chord] Traverse as list after range selection #24400

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Jojo-Schmitz
Copy link
Contributor

@Jojo-Schmitz Jojo-Schmitz commented Sep 3, 2024

The commands [up/down chord] work only with a single selection of a note/rest, moving through a chord, and then moves to the next voice above/below.

At the moment, it won't work while in a list selection of multiple notes, nor will it do anything while having a range selection.

Posited feature: allow a range selection to convert to a list selection, where [up] takes the list selection to the top of that chord and [down] takes to the bottom note. It will work on multiple chords at once in the range.

  • Let a list-selection do likewise of moving up/down but only within selected chords. That is, when a list-selection is active, "bottom out" or "top out" on the chord that is initially selected as a designed limitation, and not move on to a chord/rest above/below it.

  • Finally, regular single element selection should function exactly the same way as usual.

This will allow for something akin to the "Chord Levels Selector" Plugin but built in through traversal. And, in addition with @XiaoMigros' changes (in already) a list selection will still have a valid selection after deletion or [add interval] - so it kind of takes on a new charm that Mu4.4 and before just didn't have

An example doing inversions on a range of chords:

  1. Range selection
  2. bottom-chord: selects bottom of voice 1 and 2
  3. octave shift and then use bottom-chord some more to reach to bottom and continue
  4. then finally delete.
demonstration.webm

Nifty. The only thing it doesn't really do that the Chord Level Selector plugin does is the "select all but particular voice", but whatever.

Update: Had to make use of some other personal changes to get this to work here, which is to allow to "stay" within the beat when using up/down the chord when going beyond the current chord. It's also an enhancement in my opinion, but you can test that ---

The old 3.6.2 way forces into a voice that isn't related to the beat:

2.olderUpDown.webm

With this change the beat takes precedence (the vertical space)

1newerUpDown.webm

And with the ability to keep the list selection after deleting/adding intervals (was backported earlier), you can do something like this:

enh3.webm

Port of Jojo-Schmitz#607 to fix Jojo-Schmitz#606


Fix regression from the above and also allow for [prev measure/system] in note-entry even when input state has no ChordRest

Resolves: #604 regression and enabling previous measure/previous system when input track doesn't contain a correspondent chordrest

That should do it. Unfortunately that means your "up-port" (is that the word?) would also need to be updated

Verification:

  1. Traversal through grace notes is verified:
1.webm
  1. Reason for issue is verified:
2.webm
  1. Update: allow previous measure and previous system (switches to voice one, but initially wasn't working at all when in that input state of not having any existing chordrest in 3.6.2 etc):
3.webm

Port of Jojo-Schmitz#666 to fix Jojo-Schmitz#604

@Jojo-Schmitz Jojo-Schmitz force-pushed the Improvement-UpDownChord branch 6 times, most recently from 9d7462c to 9f3422f Compare September 3, 2024 10:26
@worldwideweary
Copy link
Contributor

worldwideweary commented Sep 3, 2024

Just checked the linux artifact quickly, and seems to kind of work. I got a crash though on a single selection moving down into second voice and trying to go down further. Doesn't happen on 3.x so something went amiss. I'll try to toy with it.

Update: with the if check, no crash. Seems to be on par with 3.x branch now

@Jojo-Schmitz Jojo-Schmitz force-pushed the Improvement-UpDownChord branch 2 times, most recently from fbd62d7 to 2a8b2f6 Compare September 3, 2024 11:10
@Jojo-Schmitz
Copy link
Contributor Author

Jojo-Schmitz commented Sep 3, 2024

Not sure that 2nd commit is worth the effort, it is quite fat for its little purpose.
OTOH most of its changes might be beneficial for other reasons... (if I can finally get the darn thing to build)

@Jojo-Schmitz Jojo-Schmitz force-pushed the Improvement-UpDownChord branch from 2a8b2f6 to 5104741 Compare September 3, 2024 11:21
@worldwideweary
Copy link
Contributor

worldwideweary commented Sep 3, 2024

Congratulations on exceeding like 20 force pushes in 10 minutes! Hey moveAlt can return a nullptr, yet there was no check, so there needs to be a safeguard on the single traversal:

    // Single traverse:
    if (currentSingle && (currentSingle->isNote() || currentSingle->isRest())) {
        EngravingItem* newSingle = _score.moveAlt(currentSingle, d);
        if (newSingle == currentSingle) {
            return;
        }
        while (newSingle && newSingle->isRest() && toRest(newSingle)->isGap()) {
            newSingle = _score.moveAlt(newSingle, d);
            if (newSingle == oldSingle) {
                break;
            }
        }
        if (newSingle) {
            select({ newSingle }, SelectType::SINGLE, newSingle->staffIdx());
            showItem(newSingle);
            }
        return;
    }

That also could probably be refactored to be more simple

@Jojo-Schmitz Jojo-Schmitz force-pushed the Improvement-UpDownChord branch from 5104741 to b7414d1 Compare September 3, 2024 13:21
@Jojo-Schmitz Jojo-Schmitz force-pushed the Improvement-UpDownChord branch 2 times, most recently from b5b190d to 3c34944 Compare October 2, 2024 07:57
… even when input state has no ChordRest

Port of #666
@Jojo-Schmitz Jojo-Schmitz force-pushed the Improvement-UpDownChord branch from 3c34944 to 8861e63 Compare October 2, 2024 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants