-
Notifications
You must be signed in to change notification settings - Fork 3k
[MU3] fix #303422: lyrics color is preserved when importing mxml + small bugfix and cleanup for isEven #6021
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
Conversation
|
As far as the issue is concerned, I see 2 possible solutions. One is removing the call to |
|
Strange enough |
|
The travis failure was expected. |
|
I believe that Travis CI mtest failure is exactly what this change is supposed to fix? See https://travis-ci.org/github/musescore/MuseScore/jobs/682247601#L4340-L4362
Edit: I suspected that ;-) So this PR does related to an earlier PR of your's, #5910, right? |
|
Yes, it does relate to that PR. |
|
Outch, I didn't even notice that it is Once you fixed |
|
The purpose of the |
|
@mattmcclinch that is very interesting and useful (and your valuable information helps explain the regression described above). What it fixed is the inconsistent behavior between odd and even lyrics. It looks like the problem lies somewhere else. |
|
How about |
|
My guess is that the problem is that all lyrics are initialized using the first constructor (line 5189 of importmxmlpass2, maybe?), therefore the yare all considered odd. Then layout runs and the even ones become even and they lose their properties because of styleChanged. Edit: Yes, it's most probably that, I'll push a fix soon (hopefully). |
199facb to
a6b45e7
Compare
| } | ||
| else { | ||
| l->setNo(lyricNo); | ||
| l->setEven(lyricNo % 2); |
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.
Really? The % operator?
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 would prefer to do the following l->setEven(l->isEven()) but doesn't that look even more confusing? Either way, hopefully, @Jojo-Schmitz s idea of setting _even inside setNo will work flawlessly. That will alleviate the need for setEven.
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.
Why not use l->setEven(isEven(lyricsNo))?
Ah, isEven() doesn't take an argument.
But at least use lyricNo & 1
Still better would be when setNo() also sets odd/even
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 believe that setting _even inside setNo() is a very bad idea. Unless you mean you are going to compare it against its previous value and call initTid() and set styleDidChange to true if the values differed. Probably best to just let this all happen in one place.
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.
@mattmcclinch yes, that's what I was thinking to do.
Frankly, I don't love either option. I prefer setters than only set, but at the same time having to call a second function when setting the number of the lyric is asking for trouble.
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.
Sorry, what are the two options that you don't love?
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.
The first one is setting _even in setNo (as you explained it has downsides, and it might even be not feasible). The second one is having to call 2 functions setNo and setEven together.
They are decent, but not quite as clean as I would hope :^).
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, so the second option is what you are currently doing. This is, in my opinion, the correct way to go about this. In most cases, you would only have to call setNo() and not bother calling setEven() (because it wouldn't be the right thing to do), but here is a case where you need to call both.
|
Finally, a solution that seems pretty safe and decent (thank you very much @mattmcclinch). I added a comment that explains the use of _even. @Jojo-Schmitz I like your idea very much, but at first I would like to test if that breaks something else (like the capella import). |
2bbb957 to
82a15b9
Compare
|
Added comments, changed |
libmscore/lyrics.cpp
Outdated
|
|
||
| bool styleDidChange = false; | ||
| if ((_no & 1) && !_even) { | ||
| if (isEven() && !_even) { |
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.
Hmm, now this does look confusing. One would need to look up what isEven() does to find that it does not work on _even, but on '_no'
I know I siggested to use isEven(), but I change my mind in the light of how this looks now ;-)
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 feel like the real problem is _even. Should I change it to _wasEven?
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.
But then void setEven(bool b) { _even = b; } seems strange
libmscore/lyrics.cpp
Outdated
| styleDidChange = true; | ||
| } | ||
| if (!(_no & 1) && _even) { | ||
| else if (!isEven() && _even){ |
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 here
| switch (id) { | ||
| case Pid::SUB_STYLE: | ||
| return int((_no & 1) ? Tid::LYRICS_EVEN : Tid::LYRICS_ODD); | ||
| return int(isEven() ? Tid::LYRICS_EVEN : Tid::LYRICS_ODD); |
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.
here though it is OK
|
Should I also modify testLyricsColor.xml to cover this case (of multiple colored lines of lyrics)? |
Yes, I think so |
Up to 3.5 it worked only for first line (number="1"), in 3.6 and master it stopped working all together Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Up to 3.5 it worked only for first line (number="1"), in 3.6 and master it stopped working all together Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Up to 3.5 it worked only for first line (number="1"), in 3.6 and master it stopped working all together Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Up to 3.5 it worked only for first line (number="1"), in 3.6 and master it stopped working all together Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Up to 3.5 it worked only for first line (number="1"), in 3.6 and master it stopped working all together Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Up to 3.5 it worked only for first line (number="1"), in 3.6 and master it stopped working all together Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Up to 3.5 it worked only for first line (number="1"), in 3.6 and master it stopped working all together Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Up to 3.5 it worked only for first line (number="1"), in 3.6 and master it stopped working all together Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Up to 3.5 it worked only for first line (number="1"), in 3.6 and master it stopped working all together Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Up to 3.5 it worked only for first line (number="1"), in 3.6 and master it stopped working all together Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Backport of musescore#8033, resp. duplicate of musescore#8034. See also musescore#6021
Up to 3.5 it worked only for first line (number="1"), in 3.6 and master it stopped working all together Backport of musescore#8033, resp. duplicate of musescore#8034, part 1. See also musescore#6021
Backport of musescore#8033, resp. duplicate of musescore#8034, part 2. See also musescore#6021
Up to 3.5 it worked only for first line (number="1"), in 3.6 and master it stopped working all together Backport of musescore#8033, resp. duplicate of musescore#8034, part 1. See also musescore#6021
Backport of musescore#8033, resp. duplicate of musescore#8034, part 2. See also musescore#6021
Up to 3.5 it worked only for first line (number="1"), in 3.6 and master it stopped working all together Backport of musescore#8033, resp. duplicate of musescore#8034, part 1. See also musescore#6021
Backport of musescore#8033, resp. duplicate of musescore#8034, part 2. See also musescore#6021
Up to 3.5 it worked only for first line (number="1"), in 3.6 and master it stopped working all together Backport of musescore#8033, resp. duplicate of musescore#8034, part 1. See also musescore#6021
Backport of musescore#8033, resp. duplicate of musescore#8034, part 2. See also musescore#6021
Relates to: https://musescore.org/en/node/303422
I removed the
_evenvariable which does not do anything other than creating a bug where there are lyrics that are neither odd nor even (as far asLyrics::layoutis concerned). EvenLayout::isEvenuses_noinstead of_even.This further breaks the behavior of the program when importing lyrics (since now no lyrics have the correct color when imported), but I would think that it is a step in the right direction :^).