MuseScore icon indicating copy to clipboard operation
MuseScore copied to clipboard

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

Open Jojo-Schmitz opened this issue 1 year ago • 9 comments

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 https://github.com/Jojo-Schmitz/MuseScore/pull/607 to fix https://github.com/Jojo-Schmitz/MuseScore/issues/606


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

Resolves: (https://github.com/Jojo-Schmitz/MuseScore/issues/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 https://github.com/Jojo-Schmitz/MuseScore/pull/666 to fix https://github.com/Jojo-Schmitz/MuseScore/issues/604

Jojo-Schmitz avatar Sep 03 '24 08:09 Jojo-Schmitz

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

worldwideweary avatar Sep 03 '24 10:09 worldwideweary

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 avatar Sep 03 '24 11:09 Jojo-Schmitz

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

worldwideweary avatar Sep 03 '24 13:09 worldwideweary

Hmm, strange, a simple rebase (without confilcts) causes it to not build anymore at all?!?

Edit: found and fixed...

Jojo-Schmitz avatar Mar 23 '25 09:03 Jojo-Schmitz

Can this one please get reviewed?

Jojo-Schmitz avatar Nov 23 '25 19:11 Jojo-Schmitz

This is very cool! Didn't check the code, but woud be possible to make it work for right/left too? It would be very helpful on multi-staff chords.

Ash-86 avatar Dec 08 '25 23:12 Ash-86

@Ash-86, MuseScore doesn't extend list selections left/right (only range selections), but I may be missing your point here. You can, though, [mouse ctrl+click] a notehead to "add" to an existing list-selection and continue traversing vertically...

Feel free to explain in greater detail!

worldwideweary avatar Dec 11 '25 21:12 worldwideweary

@worldwideweary I meant traversing horizontally with multiple selections. if you have list selection of several notes, each on a different staff, pressing right, for example, would traverse forward on every staff simultaneously, like this:

image

pressing right would result in:

image

Ash-86 avatar Dec 11 '25 21:12 Ash-86

@Ash-86 Okay. This PR doesn't deal with maintaining multiple list-selections of notes while traversing left and right (nor does it look to be allowed in MSS4 currently), so if that were to be implemented some how later, it'd be something of a separate feature.

worldwideweary avatar Dec 11 '25 22:12 worldwideweary