Skip to content

Commit

Permalink
fix #176511: Allow fingerings in tablature staves for 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusLutz63 committed Mar 6, 2017
1 parent 5908ba7 commit a21c6a8
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 19 deletions.
8 changes: 5 additions & 3 deletions libmscore/fingering.cpp
Expand Up @@ -60,8 +60,9 @@ void Fingering::read(XmlReader& e)

void Fingering::layout()
{
if (staff() && staff()->isTabStaff()) // in TAB staves
setbbox(QRectF()); // fingerings have no area
if (staff() && staff()->isTabStaff()
&& !staff()->staffType()->showTabFingering()) // in TAB staves
setbbox(QRectF()); // fingerings have no area, if they not should be shown
else
Text::layout();
}
Expand All @@ -72,7 +73,8 @@ void Fingering::layout()

void Fingering::draw(QPainter* painter) const
{
if (staff() && staff()->isTabStaff()) // hide fingering in TAB staves
if (staff() && staff()->isTabStaff()
&& !staff()->staffType()->showTabFingering()) // hide fingering in TAB staves, if they not should be shown
return;
Text::draw(painter);
}
Expand Down
35 changes: 20 additions & 15 deletions libmscore/stafftype.cpp
Expand Up @@ -64,7 +64,7 @@ StaffType::StaffType(StaffGroup sg, const QString& xml, const QString& name, int
const QString& durFontName, qreal durFontSize, qreal durFontUserY, qreal genDur,
const QString& fretFontName, qreal fretFontSize, qreal fretFontUserY,
TablatureSymbolRepeat symRepeat, bool linesThrough, TablatureMinimStyle minimStyle, bool onLines,
bool showRests, bool stemsDown, bool stemThrough, bool upsideDown, bool useNumbers, bool showBackTied)
bool showRests, bool stemsDown, bool stemThrough, bool upsideDown, bool showTabFingering, bool useNumbers, bool showBackTied)
{
_group = sg;
_xmlName = xml;
Expand All @@ -90,6 +90,7 @@ StaffType::StaffType(StaffGroup sg, const QString& xml, const QString& name, int
setStemsDown(stemsDown);
setStemsThrough(stemThrough);
setUpsideDown(upsideDown);
setShowTabFingering(showTabFingering);
setUseNumbers(useNumbers);
setShowBackTied(showBackTied);
}
Expand Down Expand Up @@ -167,6 +168,7 @@ bool StaffType::isSameStructure(const StaffType& st) const
&& st._stemsDown == _stemsDown
&& st._stemsThrough == _stemsThrough
&& st._upsideDown == _upsideDown
&& st._showTabFingering == _showTabFingering
&& st._useNumbers == _useNumbers
;
}
Expand Down Expand Up @@ -241,6 +243,7 @@ void StaffType::write(Xml& xml) const
xml.tag("stemsDown", _stemsDown);
xml.tag("stemsThrough", _stemsThrough);
xml.tag("upsideDown", _upsideDown);
xml.tag("showTabFingering", _showTabFingering, false);
xml.tag("useNumbers", _useNumbers);
// only output "showBackTied" if different from !"slashStyle"
// to match the behaviour in 2.0.2 scores (or older)
Expand Down Expand Up @@ -321,6 +324,8 @@ void StaffType::read(XmlReader& e)
setStemsThrough(e.readBool());
else if (tag == "upsideDown")
setUpsideDown(e.readBool());
else if (tag == "showTabFingering")
setShowTabFingering(e.readBool());
else if (tag == "useNumbers")
setUseNumbers(e.readBool());
else if (tag == "showBackTied") // must be after reading "slashStyle" prop, as in older
Expand Down Expand Up @@ -1047,20 +1052,20 @@ void StaffType::initStaffTypes()
StaffType(StaffGroup::PERCUSSION, "perc1Line", QObject::tr("Perc. 1 line"), 1, 1, true, true, false, true, false, true),
StaffType(StaffGroup::PERCUSSION, "perc3Line", QObject::tr("Perc. 3 lines"), 3, 2, true, true, false, true, false, true),
StaffType(StaffGroup::PERCUSSION, "perc5Line", QObject::tr("Perc. 5 lines"), 5, 1, true, true, false, true, false, true),
// group xml-name, human-readable-name lin dist clef bars stemless time duration font size off genDur fret font size off duration symbol repeat thru minim style onLin rests stmDn stmThr upsDn nums bkTied
StaffType(StaffGroup::TAB, "tab6StrSimple", QObject::tr("Tab. 6-str. simple"), 6, 1.5, true, true, true, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Sans", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::NONE, true, false, true, false, false, true, false),
StaffType(StaffGroup::TAB, "tab6StrCommon", QObject::tr("Tab. 6-str. common"), 6, 1.5, true, true, false, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SHORTER,true, false, true, false, false, true, true),
StaffType(StaffGroup::TAB, "tab6StrFull", QObject::tr("Tab. 6-str. full"), 6, 1.5, true, true, false, true, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SLASHED,true, true, true, true, false, true, true),
StaffType(StaffGroup::TAB, "tab4StrSimple", QObject::tr("Tab. 4-str. simple"), 4, 1.5, true, true, true, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Sans", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::NONE, true, false, true, false, false, true, false),
StaffType(StaffGroup::TAB, "tab4StrCommon", QObject::tr("Tab. 4-str. common"), 4, 1.5, true, true, false, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SHORTER,true, false, true, false, false, true, true),
StaffType(StaffGroup::TAB, "tab4StrFull", QObject::tr("Tab. 4-str. full"), 4, 1.5, true, true, false, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SLASHED,true, true, true, true, false, true, true),
StaffType(StaffGroup::TAB, "tab5StrSimple", QObject::tr("Tab. 5-str. simple"), 5, 1.5, true, true, true, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Sans", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::NONE, true, false, true, false, false, true, false),
StaffType(StaffGroup::TAB, "tab5StrCommon", QObject::tr("Tab. 5-str. common"), 5, 1.5, true, true, false, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SHORTER,true, false, true, false, false, true, true),
StaffType(StaffGroup::TAB, "tab5StrFull", QObject::tr("Tab. 5-str. full"), 5, 1.5, true, true, false, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SLASHED,true, true, true, true, false, true, true),
StaffType(StaffGroup::TAB, "tabUkulele", QObject::tr("Tab. ukulele"), 4, 1.5, true, true, false, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SHORTER,true, true, true, false, false, true, true),
StaffType(StaffGroup::TAB, "tabBalajka", QObject::tr("Tab. balalaika"), 3, 1.5, true, true, false, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SHORTER,true, true, true, false, false, true, true),
StaffType(StaffGroup::TAB, "tab6StrItalian",QObject::tr("Tab. 6-str. Italian"),6, 1.5, false, true, true, true, "MuseScore Tab Italian",15, 0, true, "MuseScore Tab Renaiss",10, 0, TablatureSymbolRepeat::NEVER, true, TablatureMinimStyle::NONE, true, true, false, false, true, true, false),
StaffType(StaffGroup::TAB, "tab6StrFrench", QObject::tr("Tab. 6-str. French"), 6, 1.5, false, true, true, true, "MuseScore Tab French", 15, 0, true, "MuseScore Tab Renaiss",10, 0, TablatureSymbolRepeat::NEVER, true, TablatureMinimStyle::NONE, false, false, false, false, false, false,false)
// group xml-name, human-readable-name lin dist clef bars stemless time duration font size off genDur fret font size off duration symbol repeat thru minim style onLin rests stmDn stmThr upsDn sTFing nums bkTied
StaffType(StaffGroup::TAB, "tab6StrSimple", QObject::tr("Tab. 6-str. simple"), 6, 1.5, true, true, true, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Sans", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::NONE, true, false, true, false, false, false, true, false),
StaffType(StaffGroup::TAB, "tab6StrCommon", QObject::tr("Tab. 6-str. common"), 6, 1.5, true, true, false, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SHORTER,true, false, true, false, false, false, true, true),
StaffType(StaffGroup::TAB, "tab6StrFull", QObject::tr("Tab. 6-str. full"), 6, 1.5, true, true, false, true, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SLASHED,true, true, true, true, false, false, true, true),
StaffType(StaffGroup::TAB, "tab4StrSimple", QObject::tr("Tab. 4-str. simple"), 4, 1.5, true, true, true, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Sans", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::NONE, true, false, true, false, false, false, true, false),
StaffType(StaffGroup::TAB, "tab4StrCommon", QObject::tr("Tab. 4-str. common"), 4, 1.5, true, true, false, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SHORTER,true, false, true, false, false, false, true, true),
StaffType(StaffGroup::TAB, "tab4StrFull", QObject::tr("Tab. 4-str. full"), 4, 1.5, true, true, false, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SLASHED,true, true, true, true, false, false, true, true),
StaffType(StaffGroup::TAB, "tab5StrSimple", QObject::tr("Tab. 5-str. simple"), 5, 1.5, true, true, true, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Sans", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::NONE, true, false, true, false, false, false, true, false),
StaffType(StaffGroup::TAB, "tab5StrCommon", QObject::tr("Tab. 5-str. common"), 5, 1.5, true, true, false, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SHORTER,true, false, true, false, false, false, true, true),
StaffType(StaffGroup::TAB, "tab5StrFull", QObject::tr("Tab. 5-str. full"), 5, 1.5, true, true, false, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SLASHED,true, true, true, true, false, false, true, true),
StaffType(StaffGroup::TAB, "tabUkulele", QObject::tr("Tab. ukulele"), 4, 1.5, true, true, false, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SHORTER,true, true, true, false, false, false, true, true),
StaffType(StaffGroup::TAB, "tabBalajka", QObject::tr("Tab. balalaika"), 3, 1.5, true, true, false, false, "MuseScore Tab Modern", 15, 0, false, "MuseScore Tab Serif", 9, 0, TablatureSymbolRepeat::NEVER, false, TablatureMinimStyle::SHORTER,true, true, true, false, false, false, true, true),
StaffType(StaffGroup::TAB, "tab6StrItalian",QObject::tr("Tab. 6-str. Italian"),6, 1.5, false, true, true, true, "MuseScore Tab Italian",15, 0, true, "MuseScore Tab Renaiss",10, 0, TablatureSymbolRepeat::NEVER, true, TablatureMinimStyle::NONE, true, true, false, false, true, false, true, false),
StaffType(StaffGroup::TAB, "tab6StrFrench", QObject::tr("Tab. 6-str. French"), 6, 1.5, false, true, true, true, "MuseScore Tab French", 15, 0, true, "MuseScore Tab Renaiss",10, 0, TablatureSymbolRepeat::NEVER, true, TablatureMinimStyle::NONE, false, false, false, false, false, false, false,false)
};
}
} // namespace Ms
Expand Down
5 changes: 4 additions & 1 deletion libmscore/stafftype.h
Expand Up @@ -171,6 +171,7 @@ class StaffType {
bool _stemsDown = true; // stems are drawn downward (stem-and-beam durations only)
bool _stemsThrough = true; // stems are drawn through the staff rather than beside it (stem-and-beam durations only)
bool _upsideDown = false; // whether lines are drawn with highest string at top (false) or at bottom (true)
bool _showTabFingering = false; // Allow fingering in tablature staff (true) or not (false)
bool _useNumbers = true; // true: use numbers ('0' - ...) for frets | false: use letters ('a' - ...)
bool _showBackTied = true; // whether back-tied notes are shown or not

Expand Down Expand Up @@ -220,7 +221,7 @@ class StaffType {
const QString& durFontName, qreal durFontSize, qreal durFontUserY, qreal genDur,
const QString& fretFontName, qreal fretFontSize, qreal fretFontUserY, TablatureSymbolRepeat symRepeat,
bool linesThrough, TablatureMinimStyle minimStyle, bool onLines, bool showRests,
bool stemsDown, bool stemThrough, bool upsideDown, bool useNumbers, bool showBackTied);
bool stemsDown, bool stemThrough, bool upsideDown, bool showTabFingering, bool useNumbers, bool showBackTied);

virtual ~StaffType() {}
bool operator==(const StaffType&) const;
Expand Down Expand Up @@ -302,6 +303,7 @@ class StaffType {
bool stemsDown() const { return _stemsDown; }
bool stemThrough() const { return _stemsThrough; }
bool upsideDown() const { return _upsideDown; }
bool showTabFingering() const { return _showTabFingering; }
bool useNumbers() const { return _useNumbers; }
bool showBackTied() const { return _showBackTied; }

Expand All @@ -321,6 +323,7 @@ class StaffType {
void setStemsDown(bool val) { _stemsDown = val; }
void setStemsThrough(bool val) { _stemsThrough = val; }
void setUpsideDown(bool val) { _upsideDown = val; }
void setShowTabFingering (bool val) { _showTabFingering = val; }
void setUseNumbers(bool val) { _useNumbers = val; _fretMetricsValid = false; }
void setShowBackTied(bool val) { _showBackTied = val; }

Expand Down
4 changes: 4 additions & 0 deletions mscore/editstafftype.cpp
Expand Up @@ -115,6 +115,7 @@ EditStaffType::EditStaffType(QWidget* parent, Staff* st)
connect(linesThroughRadio, SIGNAL(toggled(bool)), SLOT(updatePreview()));
connect(onLinesRadio, SIGNAL(toggled(bool)), SLOT(updatePreview()));
connect(upsideDown, SIGNAL(toggled(bool)), SLOT(updatePreview()));
connect(showTabFingering, SIGNAL(toggled(bool)), SLOT(updatePreview()));
connect(numbersRadio, SIGNAL(toggled(bool)), SLOT(updatePreview()));
connect(showBackTied, SIGNAL(toggled(bool)), SLOT(updatePreview()));

Expand Down Expand Up @@ -185,6 +186,7 @@ void EditStaffType::setValues()
fretFontSize->setValue(staffType.fretFontSize());
fretY->setValue(staffType.fretFontUserY());

showTabFingering->setChecked(staffType.showTabFingering());
numbersRadio->setChecked(staffType.useNumbers());
lettersRadio->setChecked(!staffType.useNumbers());
onLinesRadio->setChecked(staffType.onLines());
Expand Down Expand Up @@ -368,6 +370,7 @@ void EditStaffType::setFromDlg()
staffType.setOnLines(onLinesRadio->isChecked());
staffType.setShowRests(showRests->isChecked());
staffType.setUpsideDown(upsideDown->isChecked());
staffType.setShowTabFingering(showTabFingering->isChecked());
staffType.setUseNumbers(numbersRadio->isChecked());
//note values
staffType.setStemsDown(stemBelowRadio->isChecked());
Expand Down Expand Up @@ -404,6 +407,7 @@ void EditStaffType::blockSignals(bool block)
fretFontSize->blockSignals(block);
fretY->blockSignals(block);

showTabFingering->blockSignals(block);
numbersRadio->blockSignals(block);
linesThroughRadio->blockSignals(block);
onLinesRadio->blockSignals(block);
Expand Down
8 changes: 8 additions & 0 deletions mscore/editstafftype.ui
Expand Up @@ -650,6 +650,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showTabFingering">
<property name="text">
<string>Show fingerings</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
Expand Down Expand Up @@ -1376,6 +1383,7 @@
<tabstop>linesThroughRadio</tabstop>
<tabstop>linesBrokenRadio</tabstop>
<tabstop>showBackTied</tabstop>
<tabstop>showTabFingering</tabstop>
<tabstop>durFontName</tabstop>
<tabstop>durFontSize</tabstop>
<tabstop>durY</tabstop>
Expand Down

0 comments on commit a21c6a8

Please sign in to comment.