Horizontal frame at end of system followed by staff names

• Dec 30, 2013 - 20:06
Type
Functional
Severity
S4 - Minor
Status
closed
Project

Windows 7, GIT commit: fa00a2a

1) create new score for two instruments (I used "Horn in F" and "C Trumpet")
2) key of C, 4/4, 32 bars
3) drag horizontal frame top first measure of second system

Result: frame appears at end of previous system, which is fine since I guess there is room, but the staff names are repeated after the frame.

frame-staff-name.png

Attempting to add a line break to the frame also produces incorrect results: the frame is moved to a new system all by itself (except for the phantom staff names):

frame-alone.png

Attachment Size
frame-staff-name.png 4.8 KB
frame-alone.png 9.91 KB

Comments

The main issue comes here:

https://github.com/musescore/MuseScore/blob/de7c65f6d31129c227436496cc8…

This is where we decide the current measure cannot fit on the system we are trying to layout, so we send it back home and stop looking for more. However, earlier we had set continueFlag to allow us to try to pile on more measures after the horizontal frame. Simply clearing continueFlag before breaking the loop fixes the basic issue here. The horizontal frame will be inserted where it belongs - at the beginning of the system, right you you tried to add it.

I think there is another minor issue with layout of horizontal frames that occur mid-system (technically, between the two systems of a single system row - I just learned the difference today :-). I think we are not properly accounting for the width of the frame and/or the system header created for the measure following the frame when deciding how many measures we can fit after the frame. As a result, you can get some pretty badly squeezed layouts.

I will continue to look into the second problem, but it's much less important to me to solve, since it's easily worked around using line breaks - and anyone inserting horizontal frames in the middle of systems has clearly stepped into territory where that shouldn't seem objectionable.

Turns out the layout issue was simpler and worse than I thought. It's not that we aren't accounting for the system header properly; we are not accounting for the horizontal frame itself properly. Adding a horizontal frame somewhere towards the beginning of the system and then expanding it leads to some crazy results:

horizontal-spacer-layout.png

Luckily, a one-line fix, that also fixes another small issue I had noticed recently but not reported: a line break on the last measure of a piece interferes with the "last system fill". That's because the width of the last measure wasn't being included in the calculation.

PR forthcoming for both the original issue with horizontal frame added at the beginning of a system and the layout issue where the width of a horizontal frame (and last measure of piece) was being ignored in layout calculations.