GSoC 2020 Week 2 Recap: Old-Style Multimeasure Rests, or Fun with Special Cases
|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: https://github.com/musescore/MuseScore/pull/6211
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|