Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #276141: no space for lyrics in continuous view #6307

Merged
merged 1 commit into from
Jul 9, 2020

Conversation

MarcSabatella
Copy link
Contributor

Resolves: https://musescore.org/en/node/276141

A common complaint since the release of MuseScore 3 is
that we no longer allocate additional space between staves
for lyrics and other elements above/below the staff,
when in continuous view.
That's because these calculations in page view can be optimized
so they only need to be done for affected systems on each layout.
In continuous view, there is only one system,
so it would mean a full layout, which is very slow.
But MuseScore 2 did this, and people writing vocal music especially
were accustomed to this automatic staff spacing.
Since lyrics were about the only thing that did this spacing,
it wasn't as expensive as it would be using MuseScore 3 autoplace.
And yet, MuseScore 2 was extremely slow with large scores,
because it lacked any range optimizations, even in page view.

This change finds a compromise that should work well.
On the initial layout in continuous view, we do build a full skyline,
so it is easy enough to add space for each staff then,
and any performance penalty is paid only at that time.
Any extra space needed for this is remembered for subsequent layouts.
On future layouts, we do use a range, so we only have a partial skyline.
The code here calculates the space needed just within the current range,
but it also compares this with the remembered value,
so uses whichever is larger (and remembers this new value if different).

The result is that the spacing is correct when first opening the score,
or when first switching to continuous view.
After that, any edits that increase the required space
(such as adding a new verse of lyrics)
will do so as expected.
If you later make a change that reduces the amount of space requires,
we cannot reclaim that space, since a full layout would be required
in order to detect that we truly don't need the space anywhere.
But you can always reclaim it by switching to page view and back.

The code to do the partial skyline comparison is not free,
but it happens only once per staff per layout,
so in theory it should have a negigible effect on performance.
If this assumption turns out to be wrong,
we can switch to the code that skips the partial skyline comparison
except on the initial layout.
This is included but ifdef'ed out.

Resolves: https://musescore.org/en/node/276141

A common complaint since the release of MuseScore 3 is
that we no longer allocate additional space between staves
for lyrics and other elements above/below the staff,
when in continuous view.
That's because these calculations in page view can be optimized
so they only need to be done for affected systems on each layout.
In continuous view, there is only one system,
so it would mean a full layout, which is very slow.
But MuseScore 2 did this, and people writing vocal music especially
were accustomed to this automatic staff spacing.
Since lyrics were about the only thing that did this spacing,
it wasn't as expensive as it would be using MuseScore 3 autoplace.
And yet, MuseScore 2 was extremely slow with large scores,
because it lacked any range optimizations, even in page view.

This change finds a compromise that should work well.
On the initial layout in continuous view, we do build a full skyline,
so it is easy enough to add space for each staff then,
and any performance penalty is paid only at that time.
Any extra space needed for this is remembered for subsequent layouts.
On future layouts, we do use a range, so we only have a partial skyline.
The code here calculates the space needed just within the current range,
but it also compares this with the remembered value,
so uses whichever is larger (and remembers this new value if different).

The result is that the spacing is correct when first opening the score,
or when first switching to continuous view.
After that, any edits that *increase* the required space
(such as adding a new verse of lyrics)
will do so as expected.
If you later make a change that reduces the amount of space requires,
we cannot reclaim that space, since a full layout would be required
in order to detect that we truly don't need the space anywhere.
But you can always reclaim it by switching to page view and back.

The code to do the partial skyline comparison is not free,
but it happens only once per staff per layout,
so in theory it should have a negigible effect on performance.
If this assumption turns out to be wrong,
we can switch to the code that skips the partial skyline comparison
except on the initial layout.
This is included but ifdef'ed out.
@MarcSabatella MarcSabatella force-pushed the 276141-continuous-spacing branch from 17ba935 to cd92ec6 Compare July 7, 2020 21:41
@MarcSabatella
Copy link
Contributor Author

This PR replaces #5068. It uses the same basic approach but is optimized to not require a force a full skyline calculation and comparison for each staff on every layout. The performance impact should thus be very small. The tradeoff is, we cannot detect when we can reclaim the space added between staves - not until you do another full layout. Discussions in the issue thread lead to believe this will still be considered a big win, at a small price.

@MarcSabatella
Copy link
Contributor Author

I don't see what went wrong with the Linux build. Seems everything succeeded then just gave an error during the final packaging?

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Jul 8, 2020

I had the same Linux GitHub artifact build issue with PR #6306. An issue that had been fixed with #6291, but only for master it seems.
But maybe it is a different issue altogether? The 'regular' 3.x / 3.5RC / master builds fail the same way, check https://travis-ci.org/github/musescore/MuseScore/jobs/706080774 and https://travis-ci.org/github/musescore/MuseScore/jobs/705982438

Cause found, see AppImage/AppImageKit#1060

See #6309

@anatoly-os anatoly-os merged commit 05094e2 into musescore:3.x Jul 9, 2020
anatoly-os added a commit that referenced this pull request Jul 9, 2020
fix #276141: no space for lyrics in continuous view
anatoly-os added a commit that referenced this pull request Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants