fix #88171: Lyrics dash max distance as a parameter
Turns the previously hard-coded max. distance between multiple dashes into a user configurable score style. __References__: - Issue: https://musescore.org/en/node/88171 - Original request with discussion and screen-shots: https://musescore.org/en/node/87841 Shamelessly stolen from PR #2294, which needed a non-trivial rebase
This commit is contained in:
parent
4f8a845d8b
commit
ab9ffd633c
6 changed files with 34 additions and 4 deletions
|
@ -872,6 +872,7 @@ void LyricsLineSegment::layout()
|
|||
#endif
|
||||
qreal len = pos2().x();
|
||||
qreal minDashLen = score()->styleS(StyleIdx::lyricsDashMinLength).val() * sp;
|
||||
qreal maxDashDist = score()->styleS(StyleIdx::lyricsDashMaxDistance).val() * sp;
|
||||
if (len < minDashLen) { // if no room for a dash
|
||||
// if at end of system or dash is forced
|
||||
if (endOfSystem || score()->styleB(StyleIdx::lyricsDashForce)) {
|
||||
|
@ -882,13 +883,13 @@ void LyricsLineSegment::layout()
|
|||
else // if within system or dash not forced
|
||||
_numOfDashes = 0; // draw no dash
|
||||
}
|
||||
else if (len < (Lyrics::LYRICS_DASH_DEFAULT_STEP * TWICE * sp)) { // if no room for two dashes
|
||||
else if (len < (maxDashDist * TWICE)) { // if no room for two dashes
|
||||
_numOfDashes = 1; // draw one dash
|
||||
if (_dashLength > len) // if no room for a full dash
|
||||
_dashLength = len; // shorten it
|
||||
}
|
||||
else
|
||||
_numOfDashes = len / (Lyrics::LYRICS_DASH_DEFAULT_STEP * sp);// draw several dashes
|
||||
_numOfDashes = len / (maxDashDist); // draw several dashes
|
||||
|
||||
// adjust next lyrics horiz. position if too little a space forced to skip the dash
|
||||
if (_numOfDashes == 0 && nextLyr != nullptr && len > 0)
|
||||
|
|
|
@ -60,7 +60,6 @@ class Lyrics : public Text {
|
|||
// metrics for dashes and melisma; all in sp. units:
|
||||
static constexpr qreal MELISMA_DEFAULT_LINE_THICKNESS = 0.10; // for melisma line only;
|
||||
static constexpr qreal MELISMA_DEFAULT_PAD = 0.10; // the empty space before a melisma line
|
||||
static constexpr qreal LYRICS_DASH_DEFAULT_STEP = 16.0; // the max. distance between dashes
|
||||
static constexpr qreal LYRICS_DASH_DEFAULT_PAD = 0.05; // the min. empty space before and after a dash
|
||||
// WORD_MIN_DISTANCE has never been implemented
|
||||
// static constexpr qreal LYRICS_WORD_MIN_DISTANCE = 0.33; // min. distance between lyrics from different words
|
||||
|
|
|
@ -272,7 +272,7 @@ static const StyleType styleTypes[] {
|
|||
{ StyleIdx::barGraceDistance, "barGraceDistance", Spatium(.6) },
|
||||
{ StyleIdx::lyricsDashMinLength, "lyricsDashMinLength", Spatium(0.4) },
|
||||
{ StyleIdx::lyricsDashMaxLength, "lyricsDashMaxLegth", Spatium(0.8) },
|
||||
|
||||
{ StyleIdx::lyricsDashMaxDistance, "lyricsDashMaxDistance", Spatium(16.0) },
|
||||
{ StyleIdx::lyricsDashForce, "lyricsDashForce", QVariant(true) },
|
||||
{ StyleIdx::minVerticalDistance, "minVerticalDistance", Spatium(0.5) },
|
||||
{ StyleIdx::ornamentStyle, "ornamentStyle", int(MScore::OrnamentStyle::DEFAULT) },
|
||||
|
|
|
@ -29,6 +29,8 @@ class Element;
|
|||
|
||||
//---------------------------------------------------------
|
||||
// StyleIdx
|
||||
//
|
||||
// Keep in sync with styleTypes[] in style.cpp
|
||||
//---------------------------------------------------------
|
||||
|
||||
enum class StyleIdx : int {
|
||||
|
@ -269,6 +271,7 @@ enum class StyleIdx : int {
|
|||
barGraceDistance,
|
||||
lyricsDashMinLength,
|
||||
lyricsDashMaxLength,
|
||||
lyricsDashMaxDistance,
|
||||
lyricsDashForce,
|
||||
|
||||
minVerticalDistance,
|
||||
|
|
|
@ -208,6 +208,7 @@ EditStyle::EditStyle(Score* s, QWidget* parent)
|
|||
{ StyleIdx::smallClefMag, true, smallClefSize, 0 },
|
||||
{ StyleIdx::lyricsDashMinLength, false, lyricsDashMinLength, 0 },
|
||||
{ StyleIdx::lyricsDashMaxLength, false, lyricsDashMaxLength, 0 },
|
||||
{ StyleIdx::lyricsDashMaxDistance, false, lyricsDashMaxDistance, 0 },
|
||||
{ StyleIdx::lyricsDashForce, false, lyricsDashForce, 0 },
|
||||
{ StyleIdx::lastSystemFillLimit, true, lastSystemFillThreshold, 0 },
|
||||
{ StyleIdx::genClef, false, genClef, 0 },
|
||||
|
|
|
@ -4049,6 +4049,13 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_119">
|
||||
<property name="text">
|
||||
<string>Max. dash distance:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="lyricsDashForce">
|
||||
<property name="text">
|
||||
<string>Always force dash</string>
|
||||
|
@ -4068,6 +4075,25 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="lyricsDashMaxDistance">
|
||||
<property name="suffix">
|
||||
<string>sp</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>16.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="lyricsDashMaxLength">
|
||||
<property name="suffix">
|
||||
|
|
Loading…
Reference in a new issue