Skip to content

Conversation

@asattely
Copy link
Contributor

Resolves: #8975

Before, style options such as endBarDistance or doubleBarDistance described the distance between the mid points of the bar lines. This created an inconsistent distance when the line thicknesses were changed. Now, those distance style settings describe the distance between the right side of one bar and the left side of another.

image

Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 16, 2021
x += score()->styleP(Sid::repeatBarlineDotSeparation) * mag();
x -= symBbox(SymId::repeatDot).width() * .5;
x += ((lw * .5) + score()->styleP(Sid::repeatBarlineDotSeparation)) * mag();
//x -= symBbox(SymId::repeatDot).width() * .5;
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 line

x += score()->styleP(Sid::repeatBarlineDotSeparation) * mag();
x -= symBbox(SymId::repeatDot).width() * .5;
x += ((lw * .5) + score()->styleP(Sid::repeatBarlineDotSeparation)) * mag();
//x -= symBbox(SymId::repeatDot).width() * .5;
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 line

Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 16, 2021
@DmitryArefiev DmitryArefiev self-assigned this Sep 16, 2021
@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Sep 16, 2021

Seems with this all double barlines are too far apart from one another? Maybe now we'd need to half endBarDistance and doubleBarDistance?

image

This does show how important functioning vtests are!
My attempt to port this to 3.x and the vtests there show the problem quite clearly.

Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 16, 2021
@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Sep 16, 2021

Vs. this:
image

Patch used (for 3.x):

diff --git a/libmscore/barline.cpp b/libmscore/barline.cpp
index b6d96eb162..c872d77da4 100644
--- a/libmscore/barline.cpp
+++ b/libmscore/barline.cpp
@@ -585,7 +585,7 @@ void BarLine::draw(QPainter* painter) const
 
                   qreal lw2 = score()->styleP(Sid::endBarWidth) * mag();
                   painter->setPen(QPen(curColor(), lw2, Qt::SolidLine, Qt::FlatCap));
-                  x += ((lw * .5) + score()->styleP(Sid::endBarDistance) + (lw2 * .5)) * mag();
+                  x += ((lw * .5) + (score()->styleP(Sid::endBarDistance) * .5) + (lw2 * .5)) * mag();
                   painter->drawLine(QLineF(x, y1, x, y2));
                   }
                   break;
@@ -595,7 +595,7 @@ void BarLine::draw(QPainter* painter) const
                   painter->setPen(QPen(curColor(), lw, Qt::SolidLine, Qt::FlatCap));
                   qreal x = lw * .5;
                   painter->drawLine(QLineF(x, y1, x, y2));
-                  x += ((lw * .5) + score()->styleP(Sid::doubleBarDistance) + (lw * .5)) * mag();
+                  x += ((lw * .5) + (score()->styleP(Sid::doubleBarDistance) * .5) + (lw * .5)) * mag();
                   painter->drawLine(QLineF(x, y1, x, y2));
                   }
                   break;
@@ -608,7 +608,7 @@ void BarLine::draw(QPainter* painter) const
 
                   qreal lw2 = score()->styleP(Sid::barWidth) * mag();
                   painter->setPen(QPen(curColor(), lw2, Qt::SolidLine, Qt::FlatCap));
-                  x += ((lw * .5) + score()->styleP(Sid::endBarDistance) + (lw2 * .5)) * mag();
+                  x += ((lw * .5) + (score()->styleP(Sid::endBarDistance) * .5) + (lw2 * .5)) * mag();
                   painter->drawLine(QLineF(x, y1, x, y2));
                   }
                   break;
@@ -625,7 +625,7 @@ void BarLine::draw(QPainter* painter) const
                   painter->setPen(QPen(curColor(), lw2, Qt::SolidLine, Qt::FlatCap));
                   qreal x = lw2 * .5;
                   painter->drawLine(QLineF(x, y1, x, y2));
-                  x += ((lw2 * .5) + score()->styleP(Sid::endBarDistance) + (lw2 * .5)) * mag();
+                  x += ((lw2 * .5) + (score()->styleP(Sid::endBarDistance) * .5) + (lw2 * .5)) * mag();
                   painter->drawLine(QLineF(x, y1, x, y2));
                   }
                   break;
@@ -638,7 +638,7 @@ void BarLine::draw(QPainter* painter) const
 
                   qreal lw = score()->styleP(Sid::barWidth) * mag();
                   painter->setPen(QPen(curColor(), lw, Qt::SolidLine, Qt::FlatCap));
-                  x += ((lw2 * .5) + score()->styleP(Sid::endBarDistance) + (lw * .5)) * mag();
+                  x += ((lw2 * .5) + (score()->styleP(Sid::endBarDistance) * .5) + (lw * .5)) * mag();
                   painter->drawLine(QLineF(x, y1, x, y2));
 
                   x += ((lw * .5) + score()->styleP(Sid::repeatBarlineDotSeparation)) * mag();
@@ -661,7 +661,7 @@ void BarLine::draw(QPainter* painter) const
                   painter->drawLine(QLineF(x, y1, x, y2));
 
                   qreal lw2 = score()->styleP(Sid::endBarWidth) * mag();
-                  x += ((lw * .5) + score()->styleP(Sid::endBarDistance) + (lw2 * .5)) * mag();
+                  x += ((lw * .5) + (score()->styleP(Sid::endBarDistance) * .5) + (lw2 * .5)) * mag();
                   painter->setPen(QPen(curColor(), lw2, Qt::SolidLine, Qt::FlatCap));
                   painter->drawLine(QLineF(x, y1, x, y2));
 
@@ -681,7 +681,7 @@ void BarLine::draw(QPainter* painter) const
                   painter->drawLine(QLineF(x, y1, x, y2));
 
                   qreal lw2 = score()->styleP(Sid::endBarWidth) * mag();
-                  x += ((lw * .5) + score()->styleP(Sid::endBarDistance) + (lw2 * .5)) * mag();
+                  x += ((lw * .5) + (score()->styleP(Sid::endBarDistance) * .5) + (lw2 * .5)) * mag();
                   painter->setPen(QPen(curColor(), lw2, Qt::SolidLine, Qt::FlatCap));
                   painter->drawLine(QLineF(x, y1, x, y2));
 
@@ -689,7 +689,7 @@ void BarLine::draw(QPainter* painter) const
                         drawTips(painter, true, x + lw2 * .5);
 
                   painter->setPen(QPen(curColor(), lw, Qt::SolidLine, Qt::FlatCap));
-                  x  += ((lw2 * .5) + score()->styleP(Sid::endBarDistance) + (lw * .5)) * mag();
+                  x  += ((lw2 * .5) + (score()->styleP(Sid::endBarDistance) * .5) + (lw * .5)) * mag();
                   painter->drawLine(QLineF(x, y1, x, y2));
 
                   x += ((lw * .5) + score()->styleP(Sid::repeatBarlineDotSeparation)) * mag();
@@ -1244,16 +1244,16 @@ qreal BarLine::layoutWidth(Score* score, BarLineType type)
       switch (type) {
             case BarLineType::DOUBLE:
                   w = (score->styleP(Sid::doubleBarWidth) * 2)
-                     + score->styleP(Sid::doubleBarDistance);
+                     + (score->styleP(Sid::doubleBarDistance) * .5);
                   break;
             case BarLineType::DOUBLE_HEAVY:
                   w = (score->styleP(Sid::endBarWidth) * 2)
-                     + score->styleP(Sid::endBarDistance);
+                     + (score->styleP(Sid::endBarDistance) * .5);
                   break;
             case BarLineType::END_START_REPEAT:
                   w = score->styleP(Sid::endBarWidth)
                      + (score->styleP(Sid::barWidth) * 2)
-                     + (score->styleP(Sid::endBarDistance) * 2)
+                     + score->styleP(Sid::endBarDistance)
                      + (score->styleP(Sid::repeatBarlineDotSeparation) * 2)
                      + (dotwidth * 2);
                   break;
@@ -1261,7 +1261,7 @@ qreal BarLine::layoutWidth(Score* score, BarLineType type)
             case BarLineType::END_REPEAT:
                   w = score->styleP(Sid::endBarWidth)
                      + score->styleP(Sid::barWidth)
-                     + score->styleP(Sid::endBarDistance)
+                     + (score->styleP(Sid::endBarDistance) * .5)
                      + score->styleP(Sid::repeatBarlineDotSeparation)
                      + dotwidth;
                   break;
@@ -1269,7 +1269,7 @@ qreal BarLine::layoutWidth(Score* score, BarLineType type)
             case BarLineType::REVERSE_END:
                   w = score->styleP(Sid::endBarWidth)
                      + score->styleP(Sid::barWidth)
-                     + score->styleP(Sid::endBarDistance);
+                     + (score->styleP(Sid::endBarDistance) * .5);
                   break;
             case BarLineType::BROKEN:
             case BarLineType::NORMAL:

@asattely
Copy link
Contributor Author

asattely commented Sep 16, 2021

The bars are now too far apart because the 'distance' style parameters are now interpreted in a different way. I'm going to add a commit today that changes those default values to bring them closer to how it looks like in previous versions.

Note that it's never going to be exactly the same because in previous versions the same value for distance could produce different effective distances due to the fact that line thickness ate into them

distance style options now refer to the space between lines, not the distance between their centers.
@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Sep 16, 2021

That though would influence how these settings from scores imported from 3.x do get interpreted. So we'd need to adjust those on import.
But yes, my * .5 fix shows some (minimal) differences.

@asattely asattely force-pushed the barline-distance-v-thickness branch from 729b466 to c8412b5 Compare September 16, 2021 14:02
@asattely
Copy link
Contributor Author

Removed unnecessary commented code and changed the defaults in styledef to account for distance interpretation. Assuming all stock default options, I subtracted the amount of space that was eaten up by line thickness (for example double bar distance I subtracted the default double bar thickness because half of one barline and half of the other used to be included in the distance value)

@Jojo-Schmitz
Copy link
Contributor

As said: changing those defaults will fix the issue for new scores and for imported (pre 4.x) scores that never set those valued away from the default, but not for those that did change those values. So on import, these need to get adjusted.
Easiest might be to just half them?

@asattely
Copy link
Contributor Author

As said: changing those defaults will fix the issue for new scores and for imported (pre 4.x) scores that never set those valued away from the default, but not for those that did change those values. So on import, these need to get adjusted.
Easiest might be to just half them?

The process of converting old scores to new scores is going to be separate functionality--the current style defaults are the ones that apply to new scores in 4.0. How we deal with upconverting 3.x scores is going to be a different issue we'll see in the future, and those decisions can be made at that point I figure

@Jojo-Schmitz
Copy link
Contributor

IMHO these need to be decided upon now, else it'd get forgotten.

@asattely
Copy link
Contributor Author

Well I'm in the process of writing up a big list of added and changed style parameters that can be maintained by whoever is changing or adding them, with old and new defaults, but in any case old score conversion is outside the scope of this particular issue. Conversion is going to be a big issue that tackles a lot of different aspects and I think it'd be better to have all of the work for that centralized in one location rather than changed piecemeal in dozens of other pull requests.

Certainly the code that is changed in this pull request has absolutely nothing to do with score conversion, so for now let's keep this the way it is and I'll post the link to the wiki page I create today later.

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented Sep 16, 2021

Well, as far as I'm aware these 3 values are the first and only changed defaults.

But as long as it doesn't get forgotten...

Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 16, 2021
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 16, 2021
As the 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue
@asattely
Copy link
Contributor Author

Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 17, 2021
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 17, 2021
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Values found by some educated guesses and some trial and error...
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 17, 2021
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Values found by some educated guesses and some trial and error...
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 17, 2021
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 17, 2021
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Values found by some educated guesses and some trial and error...
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 17, 2021
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 20, 2021
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 20, 2021
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Values found by some educated guesses and some trial and error...
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 20, 2021
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Values found by some educated guesses and some trial and error...
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 21, 2021
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 21, 2021
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Values found by some educated guesses and some trial and error...
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 22, 2021
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 22, 2021
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Values found by some educated guesses and some trial and error...
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 23, 2021
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 23, 2021
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Values found by some educated guesses and some trial and error...
@DmitryArefiev
Copy link
Contributor

Checked #8975 on Win10, Mac11.13.1, Linux Mint 20.2 - FIXED

Please merge into master (@RomanPudashkin)

@RomanPudashkin RomanPudashkin merged commit 5767d9d into musescore:master Sep 23, 2021
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 24, 2021
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 24, 2021
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Values found by some educated guesses and some trial and error...
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 26, 2021
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 26, 2021
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Values found by some educated guesses and some trial and error...
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 29, 2021
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 29, 2021
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Values found by some educated guesses and some trial and error...
@DmitryArefiev DmitryArefiev removed their assignment Sep 29, 2021
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Oct 3, 2021
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Oct 3, 2021
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Values found by some educated guesses and some trial and error...
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Dec 7, 2021
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Dec 7, 2021
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Values found by some educated guesses and some trial and error...
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request May 12, 2022
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request May 12, 2022
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Values found by some educated guesses and some trial and error...
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 5, 2023
Jojo-Schmitz added a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 5, 2023
The 2nd part of musescore#9138 can't really get ported, as it would create a
compatibility issue.
Values found by some educated guesses and some trial and error...
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.

[MU4 Issue] "Barline distance" style options have unintuitive relationship with "Barline thickness" options

4 participants