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

Create defaults for pedal begin, continue and end text #19666

Merged
merged 6 commits into from
Nov 9, 2023

Conversation

miiizen
Copy link
Contributor

@miiizen miiizen commented Oct 10, 2023

Resolves: #18603

  • Create defaults for pedal begin, continue and end text
  • The end text default varies based on the visibility of the line. If the line is visible the default is no text. If the line is invisible the default is the rosette symbol
  • The begin text varies based on the start hook. If there is a start hook the default is no text. If there is no start hook the default is the 'Ped.' symbol
  • Import MS1, 2, 3, 4, & 4.1 pedals properly
  • Import MEI and musicXML scores properly
  • Prevent "Reset shapes & positions" from resetting text line's text.

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.

  • I signed the CLA
  • The title of the PR describes the problem it addresses
  • Each commit's message describes its purpose and effects, and references the issue it resolves
  • If changes are extensive, there is a sequence of easily reviewable commits
  • The code in the PR follows the coding rules
  • There are no unnecessary changes
  • The code compiles and runs on my machine, preferably after each commit individually
  • I created a unit test or vtest to verify the changes I made (if applicable)

@@ -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) {
Copy link
Contributor

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

Comment on lines 2049 to 2051
pedal->setBeginText(String());
pedal->setContinueText(String());
pedal->setEndText(String());
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

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 sorry, I understand now thanks! Yes that makes sense, they should be set to UNSTYLED

Comment on lines 3349 to 3353
if (p->score()->mscVersion() < 420) {
p->setBeginText(String());
p->setContinueText(String());
p->setEndText(String());
}
Copy link
Contributor

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/read114/read114.cpp Show resolved Hide resolved
src/inspector/models/notation/lines/pedalsettingsmodel.h Outdated Show resolved Hide resolved
Comment on lines 3396 to 3397
} else if (tag == "lineVisible") {
if (TRead::readProperty(p, tag, e, ctx, Pid::LINE_VISIBLE)) {
Copy link
Contributor

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

Suggested change
} 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

Suggested change
} 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));

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);
Copy link
Contributor

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

@miiizen miiizen force-pushed the 18603-pedal-text branch 2 times, most recently from 1c6a0b3 to 995eb3d Compare October 19, 2023 09:49
@oktophonie oktophonie added the vtests This PR produces approved changes to vtest results label Oct 20, 2023
@@ -50,6 +50,7 @@ class PedalSettingsModel : public TextLineSettingsModel
void setLineType(int newType);

PropertyItem* m_lineType = nullptr;
bool rosetteHookSelected = false;
Copy link
Contributor

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();
Copy link
Contributor

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();
Copy link
Contributor

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())?

Copy link
Contributor

@cbjeukendrup cbjeukendrup left a 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!

Comment on lines 1366 to 1368
pedal->setBeginText(String());
pedal->setContinueText(String());
pedal->setEndText(String());
Copy link
Contributor

@cbjeukendrup cbjeukendrup Oct 29, 2023

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.

@cbjeukendrup
Copy link
Contributor

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
@miiizen What do you think about that one?

@miiizen
Copy link
Contributor Author

miiizen commented Nov 6, 2023

@cbjeukendrup looks good to me!

@cbjeukendrup
Copy link
Contributor

@miiizen In that case I'll push that commit to this PR and merge it!

@cbjeukendrup
Copy link
Contributor

VTests are still not happy apparently... I can hopefully take a look tonight, unless you beat me to it :)

@miiizen
Copy link
Contributor Author

miiizen commented Nov 9, 2023

@cbjeukendrup these are desired changes showing the defaults working. All looks good to me!

@cbjeukendrup
Copy link
Contributor

Ah, of course, since those are new VTests and thus 420 scores. I see, thanks!

@cbjeukendrup cbjeukendrup merged commit c2b234c into musescore:master Nov 9, 2023
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vtests This PR produces approved changes to vtest results
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ctrl+R reset removes pedal text markings
4 participants