GSoC 2020 Week 2 Recap: Old-Style Multimeasure Rests, or Fun with Special Cases

Posted 3 years ago
Previous post Next post

Hello again! Hard to believe it's only been two weeks of official coding so far. I'm almost done with the first part of my project, a week ahead of schedule—and that's probably for the best, because what comes next will be far more difficult.

Update from last week

I previously had opened a second PR for the old-style multimeasure rests, because I wanted to leave the first PR in a state of completeness and merge-readiness, but now I've just consolidated everything here:

Implementing old-style rests wasn't difficult, exactly, but it wasn't quite as simple as I had hoped. It just required a lot of differentiated code for the various symbols, especially with small numbers of measures (below 4). The least special (and easiest to explain) of these special cases has to do with odd numbers, where a whole rest, placed one staff line higher than usual, is the rightmost symbol. Because of this, for all odd numbers, that particular symbol has to be excluded from the vector of symbols, and drawn separately with the appropriate offset. These special cases are not complicated to look at, but were tedious to figure out one by one.

On the other hand, I had a wonderfully satisfying experience at the same time. By changing my initial implementation of the spacing between the symbols, I made a lot of the code complexity cancel out. Just look at these three commits, Add old-style mmrests , Make space relative to spatium instead of symbol width, and Make spacing a user-controlled style, and watch the factors being multiplied together get fewer and simpler. (Note that these commits will eventually be squashed, so if you're reading this in the future and the links no longer work, that's why.)

Oh, and here's the result:

Looking ahead to this week

I still have to add the special case of a one-measure "multi"-measure rest, and figure out exactly how they should behave in certain time signatures (see recent discussion on #44846: old style multimeasure rests). Then, I'll be done with multimeasure rests, and ready to move on to the two-measure and four-measure repeats. I put the multimeasure rests first because I guessed they would be easier to work with; everything so far has been cosmetic, altering the appearance of symbols that already were completely functional. I expect the other work to go much slower, because, for the first time, I will be creating objects that do not already exist.

This week, I plan to begin that work by re-implementing the "don't break." As I mentioned in my first blog post, this existed briefly in a development version and then was removed before it saw the light of day, because of this bug: #279071: "Don't Break" element creates hole at end of system. There may be a delay while I'm investigating and reading through current code; I spent the community bonding period studying the multimeasure rest implementation (and actually started even earlier with #65241: Position of multimeasure rest numbers), but as yet I know nothing about the horizontal spacing and stretching of measures.

How can you help? Very easily: we have the system break, the page break, the section break, and the don't break. One of these things is not like the others. Please suggest different names for it!

Previous post Next post


It's nice to see the progress!
I'm not a native English speaker, but if the problem is the usage of the word "break", maybe it would be a good idea to name it without making a negative; e.g., "hold/force/keep (measures) together", "force/keep (measures) adjacent", "pack/group measures", "measure packer/joiner", "measure joint".
I like the last ones better because the main word is a noun and not a verb, as nouns usually refer to elements and verbs to commands.

Great job on the old style rests. I was amazed how quickly you got that together.

The two & four bar repeats will be harder indeed, but I am sure you'll figure it help, and of course I and others are here to help.

As for a better name for "don't break", I think the best analogy I can think of is "keep with next", which is what one might call a similar paragraph style setting in a word processor. Here's another thought - if we think of it being like a non-breaking space, then it's the barline it's actually applied to. So, maybe reimplement as a non-breaking barline? Probably not really needed. Although we could present it that way in the UI as a barline option, not a measure option. Maybe that would make the behavior seem less surprising, for people who might otherwise think this would somehow be the magic way to force extra measures to fit on a system.