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 hidden staff conditions with spanners #20846

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

miiizen
Copy link
Contributor

@miiizen miiizen commented Jan 5, 2024

Resolves: #20782

Spanners should only make the following bar visible if the spanner is a slur.

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Jan 5, 2024

While at it, couldn't you also change this a few lines above?

diff --git a/src/engraving/rendering/dev/systemlayout.cpp b/src/engraving/rendering/dev/systemlayout.cpp
index d8833d5e31..a6e3191af8 100644
--- a/src/engraving/rendering/dev/systemlayout.cpp
+++ b/src/engraving/rendering/dev/systemlayout.cpp
@@ -596,7 +596,7 @@ void SystemLayout::hideEmptyStaves(System* system, LayoutContext& ctx, bool isFi

     Fraction stick = system->measures().front()->tick();
     Fraction etick = system->measures().back()->endTick();
-    auto spanners = ctx.dom().spannerMap().findOverlapping(stick.ticks(), etick.ticks() - 1);
+    auto& spanners = ctx.dom().spannerMap().findOverlapping(stick.ticks(), etick.ticks() - 1);

     for (const Staff* staff : ctx.dom().staves()) {
         SysStaff* ss  = system->staff(staffIdx);
@@ -609,7 +609,7 @@ void SystemLayout::hideEmptyStaves(System* system, LayoutContext& ctx, bool isFi
                 && !(isFirstSystem && ctx.conf().styleB(Sid::dontHideStavesInFirstSystem))
                 && hideMode != Staff::HideMode::NEVER)) {
             bool hideStaff = true;
-            for (auto spanner : spanners) {
+            for (auto& spanner : spanners) {
                 if (spanner.value->staff() == staff
                     && !spanner.value->systemFlag()
                     && !spanner.value->isHairpin()

It'd fix code warnings "'auto' doesn't deduce a reference . A possible unintended copy is being made"

Also why only in ...dev/systemlayout.cpp and not also in ...stable/systemlayout.cpp?

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Jan 5, 2024

This additional test
image
renders the previous one
image
useless, as not that staff isn't empty anymore

@@ -612,7 +612,8 @@ void SystemLayout::hideEmptyStaves(System* system, LayoutContext& ctx, bool isFi
for (auto spanner : spanners) {
if (spanner.value->staff() == staff
&& !spanner.value->systemFlag()
&& !spanner.value->isHairpin()) {
&& !spanner.value->isHairpin()
Copy link
Contributor

@Jojo-Schmitz Jojo-Schmitz Jan 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't that hairpin condition get dropped here?
Looking at the reasoning for having added it in #19679, which I meanwhile believe to have been wrong

Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Jan 7, 2024
@@ -596,7 +596,7 @@ void SystemLayout::hideEmptyStaves(System* system, LayoutContext& ctx, bool isFi

Fraction stick = system->measures().front()->tick();
Fraction etick = system->measures().back()->endTick();
auto spanners = ctx.dom().spannerMap().findOverlapping(stick.ticks(), etick.ticks() - 1);
auto& spanners = ctx.dom().spannerMap().findOverlapping(stick.ticks(), etick.ticks() - 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto& or const SpannerMap::IntervalList&

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry for having misled you

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, MSVC believes it to be const without explicitly being qualified as such

Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Jan 8, 2024
@RomanPudashkin RomanPudashkin merged commit eee11f9 into musescore:master Jan 9, 2024
11 checks passed
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Jan 9, 2024
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Jan 9, 2024
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.

Line end at system break unhides next system
4 participants