GSoC 2020 Week 3 Recap: "Group Measures" is a better "Don't Break"
Hello again! I'm happy to report another productive week.
Update from last week
The question of n/2 time signatures was resolved; I put it to some engraving specialists in a Facebook group, and followed their recommendations, ensuring that in such cases the one-measure "multi"-measure rest would be a standard whole rest with the numeral 1 above it, like this:
Thus, PR #6211 is finished. Now I'm just waiting for it to be merged before I open my next WIP.
#279071: "Don't Break" element creates hole at end of system is now fixed! I spent a few days fruitlessly trying to make sense of the opaque code in libmscore/layout.cpp before asking my mentor for help, and he solved the problem immediately. I should probably make more use of him. ;-)
For the moment, at least, I've decided to swap out "Don't Break" for "Group Measures" in the UI.
I'm also thrilled to have improved on the original implementation, by now allowing more than two measures to be grouped.
Looking ahead to this week
I want to make the "Group Measures" layout element as intuitive to use as possible (and, of course, this will also make it easier for me in the coming weeks when coding for the two- and four-measure repeats). From a design perspective, here's how I think this should work:
- When one measure is selected (or an element within a measure is selected), clicking "Group Measures" in the palette should add a NOBREAK element to group the current measure with the next one.
- When two measures are selected, clicking "Group Measures" in the palette should add one NOBREAK element to group them together. Generalized, when (n | n>1) measures are selected, clicking "Group Measures" in the palette should add n-1 NOBREAK elements to group them together.
- When multiple measures are selected, some of which are currently grouped and some not, clicking "Group Measures" in the palette should group all of them together.
- When any number of measures are selected which are all already grouped, clicking "Group Measures" in the palette should ungroup them, removing all the NOBREAK elements. The same when the selection is a single measure which already has a NOBREAK element. (This allows a "toggling" effect similar to that currently implemented for line breaks.)
I will open a PR for this after the first one is merged.
I am also considering whether it is worth trying to accommodate a user wishing to group more measures than realistically can stay together. Currently, because the algorithm works backwards, if the earliest measures in the group cannot fit on the same system with the rest, they are left out of the group. What is really not ideal is that, in order to prevent crashes, I had to make it so that if there are more than one of those excess measures, each one ends up on its own system. It might be best to actually forcibly compress the grouped measures to give the user something like what he or she wants. On the other hand, due to the aforementioned opacity, I wouldn't know where to begin with that. I would rather modify what I have currently have so that if necessary the group splits into smaller groups. For this, I will ask Marc for help again.