Merge pull request #11205 from RomanPudashkin/staff_properties_dialog

[MU4] Fix #11202: Some of Staff/part properties changes does not affect to tab staff after edited
This commit is contained in:
RomanPudashkin 2022-04-18 10:52:52 +02:00 committed by GitHub
commit c097a35ac7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 86 additions and 66 deletions

View file

@ -167,64 +167,60 @@ int StaffType::bottomLine() const
bool StaffType::operator==(const StaffType& st) const
{
if (!isSameStructure(st) || st._xmlName != _xmlName) { // common to all type groups
return false;
}
if (_group == StaffGroup::TAB) { // TAB-specific
bool v = st._durationFontIdx == _durationFontIdx
&& st._durationFontSize == _durationFontSize
&& st._durationFontUserY == _durationFontUserY
&& st._fretFontIdx == _fretFontIdx
&& st._fretFontSize == _fretFontSize
&& st._fretFontUserY == _fretFontUserY
;
return v;
}
return true;
}
bool equal = true;
//---------------------------------------------------------
// isSameStructure
//
// same as operator==, but ignores names and fonts
//---------------------------------------------------------
equal &= (_group == st._group);
equal &= (_type == st._type);
equal &= (_xmlName == st._xmlName);
equal &= (_type == st._type);
equal &= (_name == st._name);
equal &= (_userMag == st._userMag);
equal &= (_yoffset == st._yoffset);
equal &= (_small == st._small);
equal &= (_invisible == st._invisible);
equal &= (_color == st._color);
equal &= (_lines == st._lines);
equal &= (_stepOffset == st._stepOffset);
equal &= (_lineDistance == st._lineDistance);
equal &= (_showBarlines == st._showBarlines);
equal &= (_showLedgerLines == st._showBarlines);
equal &= (_stemless == st._stemless);
equal &= (_genClef == st._genClef);
equal &= (_genTimesig == st._genTimesig);
equal &= (_genKeysig == st._genKeysig);
equal &= (_noteHeadScheme == st._noteHeadScheme);
equal &= (_durationFontSize == st._durationFontSize);
equal &= (_durationFontUserY == st._durationFontUserY);
equal &= (_fretFontSize == st._fretFontSize);
equal &= (_fretFontUserY == st._fretFontUserY);
equal &= (_genDurations == st._genDurations);
equal &= (_linesThrough == st._linesThrough);
equal &= (_minimStyle == st._minimStyle);
equal &= (_symRepeat == st._symRepeat);
equal &= (_onLines == st._onLines);
equal &= (_showRests == st._showRests);
equal &= (_stemsDown == st._stemsDown);
equal &= (_stemsThrough == st._stemsThrough);
equal &= (_upsideDown == st._upsideDown);
equal &= (_showTabFingering == st._showTabFingering);
equal &= (_useNumbers == st._useNumbers);
equal &= (_showBackTied == st._showBackTied);
equal &= (_durationBoxH == st._durationBoxH);
equal &= (_durationBoxY == st._durationBoxY);
equal &= (_durationFont == st._durationFont);
equal &= (_durationFontIdx == st._durationFontIdx);
equal &= (_durationYOffset == st._durationYOffset);
equal &= (_durationGridYOffset == st._durationGridYOffset);
equal &= (_durationMetricsValid == st._durationMetricsValid);
equal &= (_fretBoxH == st._fretBoxH);
equal &= (_fretBoxY == st._fretBoxY);
equal &= (_fretFont == st._fretFont);
equal &= (_fretFontIdx == st._fretFontIdx);
equal &= (_fretYOffset == st._fretYOffset);
equal &= (_fretMetricsValid == st._fretMetricsValid);
equal &= (_refDPI == st._refDPI);
bool StaffType::isSameStructure(const StaffType& st) const
{
if (st.group() != group() // common to all type groups
|| st._lines != _lines
|| st._stepOffset != _stepOffset
|| st._lineDistance != _lineDistance
|| st._genClef != _genClef
|| st._showBarlines != _showBarlines
|| st._stemless != _stemless
|| st._genTimesig != _genTimesig) {
return false;
}
if (_group == StaffGroup::STANDARD) { // standard specific
if (st._noteHeadScheme != _noteHeadScheme) {
return false;
}
}
if (_group != StaffGroup::TAB) { // common to pitched and percussion
return st._genKeysig == _genKeysig
&& st._showLedgerLines == _showLedgerLines
;
} else { // TAB-specific
return st._genDurations == _genDurations
&& st._symRepeat == _symRepeat
&& st._linesThrough == _linesThrough
&& st._minimStyle == _minimStyle
&& st._onLines == _onLines
&& st._showBackTied == _showBackTied
&& st._showRests == _showRests
&& st._stemsDown == _stemsDown
&& st._stemsThrough == _stemsThrough
&& st._upsideDown == _upsideDown
&& st._showTabFingering == _showTabFingering
&& st._useNumbers == _useNumbers
;
}
return equal;
}
//---------------------------------------------------------

View file

@ -287,9 +287,9 @@ public:
TablatureSymbolRepeat symRepeat, bool linesThrough, TablatureMinimStyle minimStyle, bool onLines, bool showRests,
bool stemsDown, bool stemThrough, bool upsideDown, bool showTabFingering, bool useNumbers, bool showBackTied);
virtual ~StaffType() {}
virtual ~StaffType() = default;
bool operator==(const StaffType&) const;
bool isSameStructure(const StaffType&) const;
StaffGroup group() const { return _group; }
StaffTypes type() const { return _type; }

View file

@ -79,6 +79,12 @@ EditStaff::EditStaff(QWidget* parent)
connect(showTimesig, &QCheckBox::clicked, this, &EditStaff::showTimeSigChanged);
connect(showBarlines, &QCheckBox::clicked, this, &EditStaff::showBarlinesChanged);
connect(invisible, &QCheckBox::clicked, this, &EditStaff::invisibleChanged);
connect(isSmallCheckbox, &QCheckBox::clicked, this, &EditStaff::isSmallChanged);
connect(color, &Awl::ColorLabel::colorChanged, this, &EditStaff::colorChanged);
connect(mag, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
this, &EditStaff::magChanged);
connect(iList, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &EditStaff::transpositionChanged);
@ -384,22 +390,37 @@ void EditStaff::numOfLinesChanged()
void EditStaff::showClefChanged()
{
m_staff->staffType(Fraction(0, 1))->setGenClef(showClef->checkState() == Qt::Checked);
m_staff->staffType(Fraction(0, 1))->setGenClef(showClef->isChecked());
}
void EditStaff::showTimeSigChanged()
{
m_staff->staffType(Fraction(0, 1))->setGenTimesig(showTimesig->checkState() == Qt::Checked);
m_staff->staffType(Fraction(0, 1))->setGenTimesig(showTimesig->isChecked());
}
void EditStaff::showBarlinesChanged()
{
m_staff->staffType(Fraction(0, 1))->setShowBarlines(showBarlines->checkState() == Qt::Checked);
m_staff->staffType(Fraction(0, 1))->setShowBarlines(showBarlines->isChecked());
}
void EditStaff::invisibleChanged()
{
m_staff->staffType(Fraction(0, 1))->setInvisible(invisible->checkState() == Qt::Checked);
m_staff->staffType(Fraction(0, 1))->setInvisible(invisible->isChecked());
}
void EditStaff::isSmallChanged()
{
m_staff->staffType(Fraction(0, 1))->setSmall(isSmallCheckbox->isChecked());
}
void EditStaff::colorChanged()
{
m_staff->staffType(Fraction(0, 1))->setColor(color->color());
}
void EditStaff::magChanged(double newValue)
{
m_staff->staffType(Fraction(0, 1))->setUserMag(newValue / 100.0);
}
void EditStaff::transpositionChanged()

View file

@ -76,6 +76,9 @@ private slots:
void gotoNextStaff();
void gotoPreviousStaff();
void invisibleChanged();
void colorChanged();
void magChanged(double newValue);
void isSmallChanged();
void transpositionChanged();
signals: