-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Create defaults for pedal begin, continue and end text #19666
Conversation
src/engraving/rw/read206/read206.cpp
Outdated
@@ -2045,6 +2045,12 @@ static void readVolta206(XmlReader& e, ReadContext& ctx, Volta* volta) | |||
|
|||
static void readPedal(XmlReader& e, ReadContext& ctx, Pedal* pedal) | |||
{ | |||
if (pedal->score()->mscVersion() < 420) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if
seems a bit tautological given that it's in read206
src/engraving/rw/read206/read206.cpp
Outdated
pedal->setBeginText(String()); | ||
pedal->setContinueText(String()); | ||
pedal->setEndText(String()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we set the propertyFlags
to UNSTYLED
if we reach the bottom of this method without having encountered a tag for the these properties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I don't think so? if there's no tag present, doesn't that mean the property should follow the default? If I do set them to unstyled, then the start and end text is set based on hook/line visibility but the continue text is always read as a blank string which is incorrect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If no tag is present, the property should indeed follow the default; so in principle, it should be STYLED indeed. But in this case, the default has changed; so if no tag is present in an old score, that means that it should follow the old default, namely an empty string. It looks indeed like your code is properly doing that.
But if you set them to an empty string at the start of the method, and don't set them to UNSTYLED, then you basically get in an inconsistent state, because the property value (which is an empty string) does not equal the style value (which is now some text), while having its flags set to STYLED implies that it should be equal. That's what I'm wondering about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry, I understand now thanks! Yes that makes sense, they should be set to UNSTYLED
src/engraving/rw/read400/tread.cpp
Outdated
if (p->score()->mscVersion() < 420) { | ||
p->setBeginText(String()); | ||
p->setContinueText(String()); | ||
p->setEndText(String()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same two questions here
src/engraving/rw/read410/tread.cpp
Outdated
} else if (tag == "lineVisible") { | ||
if (TRead::readProperty(p, tag, e, ctx, Pid::LINE_VISIBLE)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this should either be
} else if (tag == "lineVisible") { | |
if (TRead::readProperty(p, tag, e, ctx, Pid::LINE_VISIBLE)) { | |
} else if (TRead::readProperty(p, tag, e, ctx, Pid::LINE_VISIBLE)) { |
or
} else if (tag == "lineVisible") { | |
if (TRead::readProperty(p, tag, e, ctx, Pid::LINE_VISIBLE)) { | |
} else if (tag == "lineVisible") { | |
TRead::readProperty(p, e, ctx, Pid::LINE_VISIBLE)); |
src/engraving/rw/read410/tread.cpp
Outdated
while (e.readNextStartElement()) { | ||
const AsciiStringView tag(e.name()); | ||
if (readStyledProperty(p, tag, e, ctx)) { | ||
} else if (tag == "lineVisible") { | ||
if (TRead::readProperty(p, tag, e, ctx, Pid::LINE_VISIBLE)) { | ||
p->setPropertyFlags(Pid::LINE_VISIBLE, PropertyFlags::UNSTYLED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already done inside TRead::readProperty
afaics
1c6a0b3
to
995eb3d
Compare
@@ -50,6 +50,7 @@ class PedalSettingsModel : public TextLineSettingsModel | |||
void setLineType(int newType); | |||
|
|||
PropertyItem* m_lineType = nullptr; | |||
bool rosetteHookSelected = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_rosetteHookSelected
@@ -59,7 +59,8 @@ PropertyItem* PedalSettingsModel::lineType() const | |||
|
|||
bool PedalSettingsModel::isChangingLineVisibilityAllowed() const | |||
{ | |||
return isStarSymbolVisible(); | |||
// return isStarSymbolVisible(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this comment
@@ -91,15 +92,18 @@ void PedalSettingsModel::loadProperties() | |||
m_lineType->setIsEnabled(true); | |||
|
|||
if (isStarSymbolVisible()) { | |||
rosetteHookSelected = true; | |||
emit isChangingLineVisibilityAllowedChanged(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be emitted in all cases (not only when isStarSymbolVisible()
)?
059d237
to
e085f29
Compare
e085f29
to
07ef1b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realised there was one more potential issue so I pushed a fix for that. Now it looks good to me!
src/engraving/rw/read114/read114.cpp
Outdated
pedal->setBeginText(String()); | ||
pedal->setContinueText(String()); | ||
pedal->setEndText(String()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realised there's still one issue: if symbol != pedal->propertyDefault(Pid::BEGIN_TEXT).value<String>()
is false a few lines below, then the begin text will not be set there, so it will have been set to String()
here at the top of the function.
So, instead we should only set it to String()
if the tag was absent.
It turns out that 114 also has beginText etc beside beginSymbol (I didn't know that yet). So here is yet another version: miiizen/MuseScore@18603-pedal-text...cbjeukendrup:MuseScore:pedal_text_reading |
@cbjeukendrup looks good to me! |
@miiizen In that case I'll push that commit to this PR and merge it! |
e29a279
to
f351a10
Compare
VTests are still not happy apparently... I can hopefully take a look tonight, unless you beat me to it :) |
@cbjeukendrup these are desired changes showing the defaults working. All looks good to me! |
Ah, of course, since those are new VTests and thus |
Resolves: #18603
The end text default varies based on the end hook. If there is no end hook, the default is the rosette symbol. If there is an end hook, the default is no text at all.