Skip to content

Commit

Permalink
fix #284235: implement lyricsMinDistance
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella committed Feb 16, 2019
1 parent 7678137 commit 2016564
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libmscore/chordrest.cpp
Expand Up @@ -1180,7 +1180,7 @@ Shape ChordRest::shape() const
for (Lyrics* l : _lyrics) {
if (!l || !l->visible() || !l->autoplace())
continue;
static const qreal margin = spatium() * .5;
const qreal margin = styleP(Sid::lyricsMinDistance) * .5;
// for horizontal spacing we only need the lyrics width:
x1 = qMin(x1, l->bbox().x() - margin + l->pos().x());
x2 = qMax(x2, l->bbox().x() + l->bbox().width() + margin + l->pos().x());
Expand Down
1 change: 1 addition & 0 deletions libmscore/style.cpp
Expand Up @@ -81,6 +81,7 @@ static const StyleType styleTypes[] {
{ Sid::lyricsPosBelow, "lyricsPosBelow", QPointF(.0, 3.0) },
{ Sid::lyricsMinTopDistance, "lyricsMinTopDistance", Spatium(1.0) },
{ Sid::lyricsMinBottomDistance, "lyricsMinBottomDistance", Spatium(2.0) },
{ Sid::lyricsMinDistance, "lyricsMinDistance", Spatium(0.0) },
{ Sid::lyricsLineHeight, "lyricsLineHeight", 1.0 },
{ Sid::lyricsDashMinLength, "lyricsDashMinLength", Spatium(0.4) },
{ Sid::lyricsDashMaxLength, "lyricsDashMaxLegth", Spatium(0.8) },
Expand Down
1 change: 1 addition & 0 deletions libmscore/style.h
Expand Up @@ -57,6 +57,7 @@ enum class Sid {
lyricsPosBelow,
lyricsMinTopDistance,
lyricsMinBottomDistance,
lyricsMinDistance,
lyricsLineHeight,
lyricsDashMinLength,
lyricsDashMaxLength,
Expand Down
1 change: 1 addition & 0 deletions mscore/editstyle.cpp
Expand Up @@ -116,6 +116,7 @@ EditStyle::EditStyle(Score* s, QWidget* parent)
{ Sid::lyricsPosBelow, false, lyricsPosBelow, resetLyricsPosBelow },
{ Sid::lyricsMinTopDistance, false, lyricsMinTopDistance, resetLyricsMinTopDistance },
{ Sid::lyricsMinBottomDistance, false, lyricsMinBottomDistance, resetLyricsMinBottomDistance },
{ Sid::lyricsMinDistance, false, lyricsMinDistance, resetLyricsMinDistance },
{ Sid::lyricsLineHeight, true, lyricsLineHeight, resetLyricsLineHeight },
{ Sid::lyricsDashMinLength, false, lyricsDashMinLength, resetLyricsDashMinLength },
{ Sid::lyricsDashMaxLength, false, lyricsDashMaxLength, resetLyricsDashMaxLength },
Expand Down
61 changes: 59 additions & 2 deletions mscore/editstyle.ui
Expand Up @@ -9285,6 +9285,49 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_minDistance">
<property name="text">
<string>Min. distance:</string>
</property>
<property name="buddy">
<cstring>lyricsMinDistance</cstring>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QDoubleSpinBox" name="lyricsMinDistance">
<property name="suffix">
<string>sp</string>
</property>
<property name="decimals">
<number>2</number>
</property>
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QToolButton" name="resetLyricsMinDistance">
<property name="toolTip">
<string>Reset to default</string>
</property>
<property name="accessibleName">
<string>Reset 'Min. distance' value</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="musescore.qrc">
<normaloff>:/data/icons/edit-reset.svg</normaloff>:/data/icons/edit-reset.svg</iconset>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="lyricsAlignVerseNumber">
<property name="text">
Expand Down Expand Up @@ -9405,7 +9448,7 @@
</property>
</widget>
</item>
<item row="6" column="0">
<item row="8" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand Down Expand Up @@ -11337,13 +11380,18 @@
<tabstop>resetTupletDirection</tabstop>
<tabstop>lyricsPlacement</tabstop>
<tabstop>resetLyricsPlacement</tabstop>
<tabstop>lyricsPosAbove</tabstop>
<tabstop>resetLyricsPosAbove</tabstop>
<tabstop>lyricsPosBelow</tabstop>
<tabstop>resetLyricsPosBelow</tabstop>
<tabstop>lyricsLineHeight</tabstop>
<tabstop>resetLyricsLineHeight</tabstop>
<tabstop>lyricsMinTopDistance</tabstop>
<tabstop>resetLyricsMinTopDistance</tabstop>
<tabstop>lyricsMinBottomDistance</tabstop>
<tabstop>resetLyricsMinBottomDistance</tabstop>
<tabstop>lyricsMinDistance</tabstop>
<tabstop>resetLyricsMinDistance</tabstop>
<tabstop>lyricsAlignVerseNumber</tabstop>
<tabstop>resetLyricsAlignVerseNumber</tabstop>
<tabstop>lyricsDashMinLength</tabstop>
Expand All @@ -11352,14 +11400,23 @@
<tabstop>resetLyricsDashMaxLength</tabstop>
<tabstop>lyricsDashMaxDistance</tabstop>
<tabstop>resetLyricsDashMaxDistance</tabstop>
<tabstop>lyricsDashLineThickness</tabstop>
<tabstop>resetLyricsDashLineThickness</tabstop>
<tabstop>lyricsDashPad</tabstop>
<tabstop>resetLyricsDashPad</tabstop>
<tabstop>lyricsDashYposRatio</tabstop>
<tabstop>resetLyricsDashYposRatio</tabstop>
<tabstop>lyricsDashForce</tabstop>
<tabstop>resetLyricsDashForce</tabstop>
<tabstop>lyricsLineThickness</tabstop>
<tabstop>resetLyricsLineThickness</tabstop>
<tabstop>lyricsMelismaPad</tabstop>
<tabstop>resetLyricsMelismaPad</tabstop>
<tabstop>lyricsMelismaAlign</tabstop>
<tabstop>resetLyricsMelismaAlign</tabstop>
</tabstops>
<resources>
<include location="musescore.qrc"/>
<include location="musescore.qrc"/>
</resources>
<connections>
<connection>
Expand Down

0 comments on commit 2016564

Please sign in to comment.