Skip to content

Commit

Permalink
Merge pull request #5996 from Howard-C/show-brackets
Browse files Browse the repository at this point in the history
fix #296075: enable showing brackets which span to single stave when empty staves are hidden
  • Loading branch information
anatoly-os committed Apr 27, 2020
2 parents 66de102 + 306bdf8 commit 2d22f00
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 23 deletions.
5 changes: 4 additions & 1 deletion libmscore/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ static const StyleType styleTypes[] {
{ Sid::repeatBarTips, "repeatBarTips", QVariant(false) },
{ Sid::startBarlineSingle, "startBarlineSingle", QVariant(false) },
{ Sid::startBarlineMultiple, "startBarlineMultiple", QVariant(true) },

{ Sid::bracketWidth, "bracketWidth", Spatium(0.45) },
{ Sid::bracketDistance, "bracketDistance", Spatium(0.1) },
{ Sid::akkoladeWidth, "akkoladeWidth", Spatium(1.6) },
Expand Down Expand Up @@ -402,7 +403,9 @@ static const StyleType styleTypes[] {
{ Sid::minMMRestWidth, "minMMRestWidth", Spatium(4) },
{ Sid::hideEmptyStaves, "hideEmptyStaves", QVariant(false) },
{ Sid::dontHideStavesInFirstSystem,
"dontHidStavesInFirstSystm", QVariant(true) },
"dontHidStavesInFirstSystm", QVariant(true) },
{ Sid::alwaysShowBracketsWhenEmptyStavesAreHidden,
"alwaysShowBracketsWhenEmptyStavesAreHidden", QVariant(false) },
{ Sid::hideInstrumentNameIfOneInstrument,
"hideInstrumentNameIfOneInstrument", QVariant(true) },
{ Sid::gateTime, "gateTime", QVariant(100) },
Expand Down
1 change: 1 addition & 0 deletions libmscore/style.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ enum class Sid {
minMMRestWidth,
hideEmptyStaves,
dontHideStavesInFirstSystem,
alwaysShowBracketsWhenEmptyStavesAreHidden,
hideInstrumentNameIfOneInstrument,
gateTime,
tenutoGateTime,
Expand Down
4 changes: 3 additions & 1 deletion libmscore/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,11 +656,13 @@ void System::layout2()
// if end staff not visible, try prev staff
while (staffIdx1 <= staffIdx2 && !_staves[staffIdx2]->show())
--staffIdx2;
// if the score doesn't have "alwaysShowBracketsWhenEmptyStavesAreHidden" as true,
// the bracket will be shown IF:
// it spans at least 2 visible staves (staffIdx1 < staffIdx2) OR
// it spans just one visible staff (staffIdx1 == staffIdx2) but it is required to do so
// (the second case happens at least when the bracket is initially dropped)
bool notHidden = (staffIdx1 < staffIdx2) || (b->span() == 1 && staffIdx1 == staffIdx2);
bool notHidden = score()->styleB(Sid::alwaysShowBracketsWhenEmptyStavesAreHidden)
? (staffIdx1 <= staffIdx2) : (staffIdx1 < staffIdx2) || (b->span() == 1 && staffIdx1 == staffIdx2);
if (notHidden) { // set vert. pos. and height to visible spanned staves
sy = _staves[staffIdx1]->bbox().top();
ey = _staves[staffIdx2]->bbox().bottom();
Expand Down
6 changes: 2 additions & 4 deletions mscore/editstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ EditStyle::EditStyle(Score* s, QWidget* parent)
{ Sid::minEmptyMeasures, false, minEmptyMeasures, 0 },
{ Sid::minMMRestWidth, false, minMeasureWidth, resetMinMMRestWidth },
{ Sid::hideEmptyStaves, false, hideEmptyStaves, 0 },
{ Sid::dontHideStavesInFirstSystem, false, dontHideStavesInFirstSystem, 0 },
{ Sid::dontHideStavesInFirstSystem, false, dontHideStavesInFirstSystem, 0 },
{ Sid::alwaysShowBracketsWhenEmptyStavesAreHidden, false, alwaysShowBrackets, 0 },
{ Sid::hideInstrumentNameIfOneInstrument, false, hideInstrumentNameIfOneInstrument, 0 },
{ Sid::accidentalNoteDistance, false, accidentalNoteDistance, 0 },
{ Sid::accidentalDistance, false, accidentalDistance, 0 },
Expand Down Expand Up @@ -501,7 +502,6 @@ EditStyle::EditStyle(Score* s, QWidget* parent)
connect(swingSixteenth, SIGNAL(toggled(bool)), SLOT(setSwingParams(bool)));

connect(concertPitch, SIGNAL(toggled(bool)), SLOT(concertPitchToggled(bool)));
connect(hideEmptyStaves, SIGNAL(clicked(bool)), dontHideStavesInFirstSystem, SLOT(setEnabled(bool)));
connect(lyricsDashMinLength, SIGNAL(valueChanged(double)), SLOT(lyricsDashMinLengthValueChanged(double)));
connect(lyricsDashMaxLength, SIGNAL(valueChanged(double)), SLOT(lyricsDashMaxLengthValueChanged(double)));
connect(minSystemDistance, SIGNAL(valueChanged(double)), SLOT(systemMinDistanceValueChanged(double)));
Expand Down Expand Up @@ -1091,8 +1091,6 @@ void EditStyle::setValues()
}
//formattingGroup->setEnabled(lstyle.chordList()->autoAdjust());

dontHideStavesInFirstSystem->setEnabled(hideEmptyStaves->isChecked());

// figured bass
for (int i = 0; i < comboFBFont->count(); i++)
if (comboFBFont->itemText(i) == lstyle.value(Sid::figuredBassFontFamily).toString()) {
Expand Down
47 changes: 30 additions & 17 deletions mscore/editstyle.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>912</width>
<height>660</height>
<height>692</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -481,17 +481,32 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="hideEmptyStaves">
<property name="text">
<widget class="QGroupBox" name="hideEmptyStaves">
<property name="title">
<string>Hide empty staves within systems</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="dontHideStavesInFirstSystem">
<property name="text">
<string>Don't hide empty staves in first system</string>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="dontHideStavesInFirstSystem">
<property name="text">
<string>Don't hide empty staves in first system</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="alwaysShowBrackets">
<property name="text">
<string>Always show brackets which span to single staff</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
Expand Down Expand Up @@ -9354,7 +9369,7 @@
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="extensionAdjust">
<property name="minimum">
<double>-99.99</double>
<double>-99.989999999999995</double>
</property>
</widget>
</item>
Expand Down Expand Up @@ -9388,7 +9403,7 @@
<item row="1" column="4">
<widget class="QDoubleSpinBox" name="modifierAdjust">
<property name="minimum">
<double>-99.99</double>
<double>-99.989999999999995</double>
</property>
</widget>
</item>
Expand Down Expand Up @@ -10201,8 +10216,7 @@
<number>0</number>
</property>
<item row="0" column="1">
<widget class="Awl::ColorLabel" name="textStyleFrameForeground">
</widget>
<widget class="Awl::ColorLabel" name="textStyleFrameForeground"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_205">
Expand Down Expand Up @@ -10287,8 +10301,7 @@
<widget class="QDoubleSpinBox" name="textStyleFramePadding"/>
</item>
<item row="1" column="1">
<widget class="Awl::ColorLabel" name="textStyleFrameBackground">
</widget>
<widget class="Awl::ColorLabel" name="textStyleFrameBackground"/>
</item>
<item row="3" column="2">
<widget class="QToolButton" name="resetTextStyleFramePadding">
Expand Down Expand Up @@ -10348,8 +10361,7 @@
</widget>
</item>
<item row="6" column="1">
<widget class="Awl::ColorLabel" name="textStyleColor">
</widget>
<widget class="Awl::ColorLabel" name="textStyleColor"/>
</item>
<item row="7" column="1">
<widget class="Ms::OffsetSelect" name="textStyleOffset" native="true"/>
Expand Down Expand Up @@ -10545,6 +10557,7 @@
<tabstop>resetMinMMRestWidth</tabstop>
<tabstop>hideEmptyStaves</tabstop>
<tabstop>dontHideStavesInFirstSystem</tabstop>
<tabstop>alwaysShowBrackets</tabstop>
<tabstop>crossMeasureValues</tabstop>
<tabstop>hideInstrumentNameIfOneInstrument</tabstop>
<tabstop>swingOff</tabstop>
Expand Down

0 comments on commit 2d22f00

Please sign in to comment.