Skip to content

Commit

Permalink
Add style option
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-spa committed Oct 22, 2024
1 parent ea03170 commit 6d7404c
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 104 deletions.
5 changes: 3 additions & 2 deletions src/engraving/rendering/score/horizontalspacing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,8 @@ double HorizontalSpacing::computeSegmentDurationStretch(const Segment* curSeg, c
bool prevHasAdjacent = prevSeg && (prevSeg->isChordRestType() && prevShortestCR == prevSeg->ticks());

double durStretch;
double slope = curSeg->style().styleD(Sid::measureSpacing);
const MStyle& style = curSeg->style();
double slope = style.styleD(Sid::measureSpacing);

if (hasAdjacent || curSeg->measure()->isMMRest()) {
durStretch = durationStretchForTicks(slope, segTicks);
Expand All @@ -551,7 +552,7 @@ double HorizontalSpacing::computeSegmentDurationStretch(const Segment* curSeg, c
}
}

if (segmentIsAllCueSized(curSeg)) {
if (style.styleB(Sid::scaleRythmicSpacingForSmallNotes) && segmentIsAllCueSized(curSeg)) {
durStretch *= curSeg->style().styleD(Sid::smallNoteMag);
}

Expand Down
5 changes: 5 additions & 0 deletions src/engraving/style/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,11 @@ void MStyle::read(XmlReader& e, compat::ReadChordListHook* readChordListHook)
}
}

if (m_version < 450) {
// Doesn't exist before 4.5. Default to false for compatibility.
set(Sid::scaleRythmicSpacingForSmallNotes, false);
}

if (m_version < 420 && !MScore::testMode) {
// This style didn't exist before version 4.2. For files older than 4.2, defaults
// to INSIDE for compatibility. For files 4.2 and newer, defaults to OUTSIDE.
Expand Down
1 change: 1 addition & 0 deletions src/engraving/style/styledef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
styleDef(measureNumberSystem, true),
styleDef(measureNumberAllStaves, false),
styleDef(smallNoteMag, PropertyValue(.7)),
styleDef(scaleRythmicSpacingForSmallNotes, true),
styleDef(graceNoteMag, PropertyValue(0.7)),
styleDef(graceToMainNoteDist, Spatium(0.45)),
styleDef(graceToGraceNoteDist, Spatium(0.3)),
Expand Down
1 change: 1 addition & 0 deletions src/engraving/style/styledef.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ enum class Sid {
measureNumberAllStaves,

smallNoteMag,
scaleRythmicSpacingForSmallNotes,
graceNoteMag,
graceToMainNoteDist,
graceToGraceNoteDist,
Expand Down
1 change: 1 addition & 0 deletions src/notation/view/widgets/editstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ EditStyle::EditStyle(QWidget* parent)
{ StyleId::graceNoteMag, true, graceNoteSize, resetGraceNoteSize },
{ StyleId::smallStaffMag, true, smallStaffSize, resetSmallStaffSize },
{ StyleId::smallNoteMag, true, smallNoteSize, resetSmallNoteSize },
{ StyleId::scaleRythmicSpacingForSmallNotes, true, reduceRythmicSpacing, 0 },
{ StyleId::smallClefMag, true, smallClefSize, resetSmallClefSize },
{ StyleId::lastSystemFillLimit, true, lastSystemFillThreshold, resetLastSystemFillThreshold },
{ StyleId::hideTabClefAfterFirst, false, hideTabClefs, 0 },
Expand Down
211 changes: 109 additions & 102 deletions src/notation/view/widgets/editstyle.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2053,24 +2053,40 @@
<string>Sizes</string>
</property>
<layout class="QGridLayout" name="gridLayout_27">
<item row="0" column="0">
<widget class="QLabel" name="label_38">
<item row="1" column="0">
<widget class="QLabel" name="label_44">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Small staff size:</string>
<string>Small note size:</string>
</property>
<property name="buddy">
<cstring>smallStaffSize</cstring>
<cstring>smallNoteSize</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="smallStaffSize">
<item row="4" column="0">
<widget class="QLabel" name="label_45">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Small clef size:</string>
</property>
<property name="buddy">
<cstring>smallClefSize</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="smallNoteSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand All @@ -2094,50 +2110,58 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="resetSmallStaffSize">
<property name="toolTip">
<string>Reset to default</string>
<item row="4" column="1">
<widget class="QSpinBox" name="smallClefSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="accessibleName">
<string>Reset 'Small staff size' value</string>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="text">
<string notr="true"/>
<property name="suffix">
<string notr="true">%</string>
</property>
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_24">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="minimum">
<number>10</number>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
<property name="maximum">
<number>200</number>
</property>
</spacer>
<property name="value">
<number>70</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_44">
<item row="3" column="1">
<widget class="QSpinBox" name="graceNoteSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Small note size:</string>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="buddy">
<cstring>smallNoteSize</cstring>
<property name="suffix">
<string notr="true">%</string>
</property>
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="value">
<number>70</number>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="smallNoteSize">
<item row="0" column="1">
<widget class="QSpinBox" name="smallStaffSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand All @@ -2161,20 +2185,7 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="resetSmallNoteSize">
<property name="toolTip">
<string>Reset to default</string>
</property>
<property name="accessibleName">
<string>Reset 'Small note size' value</string>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_39">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
Expand All @@ -2190,98 +2201,94 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="graceNoteSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="keyboardTracking">
<bool>false</bool>
<item row="0" column="4">
<spacer name="horizontalSpacer_24">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="suffix">
<string notr="true">%</string>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>10</number>
</spacer>
</item>
<item row="3" column="2">
<widget class="QToolButton" name="resetGraceNoteSize">
<property name="toolTip">
<string>Reset to default</string>
</property>
<property name="maximum">
<number>200</number>
<property name="accessibleName">
<string>Reset 'Grace note size' value</string>
</property>
<property name="value">
<number>70</number>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QToolButton" name="resetGraceNoteSize">
<item row="1" column="2">
<widget class="QToolButton" name="resetSmallNoteSize">
<property name="toolTip">
<string>Reset to default</string>
</property>
<property name="accessibleName">
<string>Reset 'Grace note size' value</string>
<string>Reset 'Small note size' value</string>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_45">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="4" column="2">
<widget class="QToolButton" name="resetSmallClefSize">
<property name="toolTip">
<string>Reset to default</string>
</property>
<property name="text">
<string>Small clef size:</string>
<property name="accessibleName">
<string>Reset 'Small clef size' value</string>
</property>
<property name="buddy">
<cstring>smallClefSize</cstring>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="smallClefSize">
<item row="0" column="0">
<widget class="QLabel" name="label_38">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string notr="true">%</string>
</property>
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>200</number>
<property name="text">
<string>Small staff size:</string>
</property>
<property name="value">
<number>70</number>
<property name="buddy">
<cstring>smallStaffSize</cstring>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QToolButton" name="resetSmallClefSize">
<item row="0" column="2">
<widget class="QToolButton" name="resetSmallStaffSize">
<property name="toolTip">
<string>Reset to default</string>
</property>
<property name="accessibleName">
<string>Reset 'Small clef size' value</string>
<string>Reset 'Small staff size' value</string>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="reduceRythmicSpacing">
<property name="text">
<string>Reduce rythmic spacing for small notes</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -4190,8 +4197,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>239</width>
<height>593</height>
<width>601</width>
<height>604</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_56">
Expand Down

0 comments on commit 6d7404c

Please sign in to comment.