code review fix

This commit is contained in:
sammik 2023-10-30 15:11:20 +01:00
parent 7f54afaf9f
commit 4769f59e60
3 changed files with 27 additions and 6 deletions

View file

@ -475,12 +475,6 @@ void EngravingObject::undoChangeProperty(Pid id, const PropertyValue& v, Propert
toEngravingItem(this)->manageExclusionFromParts(v.toBool());
}
}
} else if (id == Pid::REPEAT_START || id == Pid::REPEAT_END) {
// change also coresponding mmRestMeasure
Measure* m = const_cast<Measure*>(toMeasure(this)->coveringMMRestOrThis());
if (m != this) {
m->undoChangeProperty(id, v);
}
}
changeProperties(this, id, v, ps);
if (id != Pid::GENERATED) {

View file

@ -2712,6 +2712,30 @@ PropertyValue Measure::propertyDefault(Pid propertyId) const
return MeasureBase::propertyDefault(propertyId);
}
//---------------------------------------------------------
// undoChangeProperty
//---------------------------------------------------------
void Measure::undoChangeProperty(Pid id, const PropertyValue& v)
{
undoChangeProperty(id, v, propertyFlags(id));
}
void Measure::undoChangeProperty(Pid id, const PropertyValue& v, PropertyFlags ps)
{
if ((getProperty(id) == v) && (propertyFlags(id) == ps)) {
return;
}
if (id == Pid::REPEAT_START || id == Pid::REPEAT_END) {
// change also coresponding mmRestMeasure
Measure* m = const_cast<Measure*>(toMeasure(this)->coveringMMRestOrThis());
if (m != this) {
m->undoChangeProperty(id, v);
}
}
EngravingObject::undoChangeProperty(id, v, ps);
}
//-------------------------------------------------------------------
// mmRestFirst
// this is a multi measure rest

View file

@ -300,6 +300,9 @@ public:
bool setProperty(Pid propertyId, const PropertyValue&) override;
PropertyValue propertyDefault(Pid) const override;
void undoChangeProperty(Pid id, const PropertyValue& newValue);
void undoChangeProperty(Pid id, const PropertyValue& newValue, PropertyFlags ps) override;
bool hasMMRest() const { return m_mmRest != 0; }
bool isMMRest() const { return m_mmRestCount > 0; }
Measure* mmRest() const { return m_mmRest; }