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 #286531: change staff type works for all options #4893

Closed
wants to merge 1 commit into from

Conversation

peterhieuvu
Copy link
Contributor

Change Staff Type previously didn't work for hiding barlines and not generating key signatures. In this fix I removed the key signature from layout and ceased to draw the symbol. Additionally I also made it so that it wouldn't generate the key signature in the first place when creating system headers. For barlines I just made sure not to draw the barline.

@MarcSabatella
Copy link
Contributor

The barline issue is also dealt with my my PR #4843, specifically in 6a7d830.

Note my version works on the layout, yours on the draw. The good thing about doing it on layout is that it means we don't allocate as much space, in theory. But it's possible the two approaches would work together.

@peterhieuvu
Copy link
Contributor Author

Ah that's good. I dealt with the issue for both layout and draw for the KeySigs so I think that these two approaches should work together. In any case I realize now that it would be good to also do it on layout like in your solution. I decided not to do so at first since I only thought about normal barlines and assumed that it might just be better to leave the space that they occupied. It definitely looks a bit weird that way with the wider barlines on certain occasions though.

@@ -101,7 +101,8 @@ void KeySig::layout()
}

_sig.keySymbols().clear();
if (staff() && !staff()->genKeySig()) // no key sigs on TAB staves
// no key sigs on TAB staves or if the staff type says no key sigs
if (staff() && (!staff()->genKeySig() || !staff()->staffType(tick())->genKeysig()))
Copy link
Contributor

Choose a reason for hiding this comment

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

You might consider just adding the tick parameter to Staff::genKeySig(), that's how most other tick-dependent staff properties are handled. Llook at, for example, Staff::small()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah okay that makes sense, I will look into that! Thank you!

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, there shouldn't be a need to test both the global setting and the tick-based setting. We don't do that elsewhere. The tick-based check should do the right thing no matter what.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I will take out the first part of the OR. They do the same thing except the first part checks from the beginning of the score and the other one checks from the current tick which is what should be happening. Thank you.

}
keysig->setKeySigEvent(keyIdx);
keysig->layout();
if (staff->staffType(tick())->genKeysig()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

So we were previously generating them here if the global staff property was set, and now we still will be for the global staff property but not if this option is set by staff type change? That seems inconsistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I understand what you mean by it being inconsistent. I made this change based on how time signatures handled this, and it made sense at first, but I definitely could be missing something. What would you propose instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Right now, if you go to Staff Properties and turn off "Generate key signatures", it seems from this code that the code below still gets executed - correct? But with you change, that same code does not get executed if instead you turn off the same property from a staff type change. That's what seems executed. Either that code should be executed in both cases or in neither. I don't have a preference offhand, you should test it both ways and see what differences there might be.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh actually I just realized there is no such thing as "Generate key signatures" in Staff Properties which is a bit interesting. The only way to change this property is through "Change staff type"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay I just fixed this in the UI. StaffType is what gets changed for both "Staff Properties" and "Change staff type". It's just in Staff Properties, it changes the properties from Fraction(0, 1) rather than a tick somewhere in the middle of the score. Because of this, the line of code I added before does in fact work for both cases.

@Jojo-Schmitz
Copy link
Contributor

rebase needed

@dmitrio95 dmitrio95 added the archived PRs that have gone stale but could potentially be revived in the future label Mar 18, 2020
@dmitrio95
Copy link
Contributor

Archiving this pull request, feel free to reopen or open a new pull request on this issue.

@dmitrio95 dmitrio95 closed this Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
archived PRs that have gone stale but could potentially be revived in the future
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants