Skip to content

Commit

Permalink
Merge pull request #5535 from Howard-C/gen-keysig
Browse files Browse the repository at this point in the history
fix #297738: "generate key signatures" in staff type change does not work
  • Loading branch information
dmitrio95 committed Dec 26, 2019
2 parents 3c1fe4a + 406566c commit a6b07a1
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libmscore/keysig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void KeySig::layout()
}

_sig.keySymbols().clear();
if (staff() && !staff()->genKeySig()) // no key sigs on TAB staves
if (staff() && !staff()->staffType(tick())->genKeysig())
return;

// determine current clef for this staff
Expand Down
6 changes: 5 additions & 1 deletion libmscore/stafftype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ StaffType::StaffType(StaffGroup sg, const QString& xml, const QString& name, int
setShowBarlines(showBarLines);
setStemless(stemless);
setGenTimesig(genTimesig);
setGenKeysig(sg != StaffGroup::TAB);
setDurationFontName(durFontName);
setDurationFontSize(durFontSize);
setDurationFontUserY(durFontUserY);
Expand Down Expand Up @@ -273,6 +274,9 @@ void StaffType::read(XmlReader& e)
_group = StaffGroup::STANDARD;
}

if (_group == StaffGroup::TAB)
setGenKeysig(false);

while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "name")
Expand Down Expand Up @@ -314,7 +318,7 @@ void StaffType::read(XmlReader& e)
setDurationFontSize(e.readDouble());
else if (tag == "durationFontY")
setDurationFontUserY(e.readDouble());
else if (tag == "fretFontName")
else if (tag == "fretFontName")
setFretFontName(e.readElementText());
else if (tag == "fretFontSize")
setFretFontSize(e.readDouble());
Expand Down
1 change: 1 addition & 0 deletions mscore/editstafftype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ void EditStaffType::setFromDlg()
staffType.setStemsDown(stemBelowRadio->isChecked());
staffType.setStemsThrough(stemThroughRadio->isChecked());
if (staffType.group() == StaffGroup::TAB) {
staffType.setGenKeysig(false);
staffType.setStemless(true); // assume no note values
staffType.setGenDurations(false); // " "
if (noteValuesSymb->isChecked())
Expand Down
27 changes: 27 additions & 0 deletions mscore/inspector/inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
#include "libmscore/accidental.h"
#include "libmscore/articulation.h"
#include "libmscore/fermata.h"
#include "libmscore/stafftypechange.h"
#include "libmscore/mscore.h"
#include "libmscore/stafftextbase.h"

namespace Ms {
Expand Down Expand Up @@ -502,6 +504,31 @@ InspectorStaffTypeChange::InspectorStaffTypeChange(QWidget* parent)
mapSignals();
}

//---------------------------------------------------------
// setElement
//---------------------------------------------------------

void InspectorStaffTypeChange::setElement()
{
InspectorBase::setElement();
bool hasTabStaff = false;
bool hasNonTabStaff = false;
for (Element* el : *(inspector->el())) {
StaffTypeChange* stc = toStaffTypeChange(el);
// tab staff shouldn't have key signature
if (stc->staffType()->group() == StaffGroup::TAB) {
hasTabStaff = true;
sl.genKeysig->setEnabled(false);
sl.resetGenKeysig->setEnabled(false);
}
else {
hasNonTabStaff = true;
}
}
if (hasTabStaff && !hasNonTabStaff)
sl.genKeysig->setChecked(false);
}

//---------------------------------------------------------
// InspectorVBox
//---------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions mscore/inspector/inspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class InspectorStaffTypeChange : public InspectorBase {

public:
InspectorStaffTypeChange(QWidget* parent);
virtual void setElement() override;
};

//---------------------------------------------------------
Expand Down

0 comments on commit a6b07a1

Please sign in to comment.