Skip to content

Commit

Permalink
Code review fixes - more corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-spa committed Sep 25, 2023
1 parent 8c12948 commit 15737ad
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/engraving/dom/box.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class Box : public MeasureBase
Grip defaultGrip() const override { return Grip::START; }
std::vector<mu::PointF> gripsPositions(const EditData&) const override { return { mu::PointF() }; } // overridden in descendants

bool canBeExcludedFromOtherParts() const override { return true; }
void manageExclusionFromParts(bool exclude) override;

private:
Expand Down
1 change: 1 addition & 0 deletions src/engraving/dom/clef.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class Clef final : public EngravingItem
bool isHeader() const { return m_isHeader; }
void setIsHeader(bool val) { m_isHeader = val; }

bool canBeExcludedFromOtherParts() const override { return true; }
void manageExclusionFromParts(bool exclude) override;

struct LayoutData : public EngravingItem::LayoutData {
Expand Down
2 changes: 0 additions & 2 deletions src/engraving/dom/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4039,8 +4039,6 @@ MeasureBase* Score::insertMeasure(ElementType type, MeasureBase* beforeMeasure,

if (score == this) {
result = newMeasureBase;
} else if (!result && score == scores.back()) {
result = newMeasureBase;
}

if (actualBeforeMeasure) {
Expand Down
20 changes: 2 additions & 18 deletions src/engraving/dom/engravingitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1302,35 +1302,19 @@ PropertyPropagation EngravingItem::propertyPropagation(EngravingItem* destinatio
return PropertyPropagation::PROPAGATE;
}

if (sourceScore != destinationScore && !sourceScore->isMaster()) {
if (!sourceScore->isMaster()) {
// Properties are only propagated when being edited from master. If this is being edited
// from a part score, we mark it as unlinked so it becomes independent in the part.
return PropertyPropagation::UNLINK;
}

if (destinationItem->isPropertyLinkedToMaster(propertyId) || sourceScore == destinationScore) {
if (destinationItem->isPropertyLinkedToMaster(propertyId)) {
return PropertyPropagation::PROPAGATE;
}

return PropertyPropagation::NONE;
}

bool EngravingItem::canBeExcludedFromOtherParts() const
{
static const std::set<ElementType> TYPE_EXCLUDIBLE_FROM_PARTS {
ElementType::STAFF_TEXT,
ElementType::SYSTEM_TEXT,
ElementType::CLEF,
ElementType::OTTAVA_SEGMENT,
ElementType::HBOX,
ElementType::VBOX,
ElementType::TBOX,
ElementType::FBOX,
};

return mu::contains(TYPE_EXCLUDIBLE_FROM_PARTS, type());
}

//---------------------------------------------------------
// undoChangeProperty
//---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/engravingitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ class EngravingItem : public EngravingObject
void unlinkPropertyFromMaster(Pid id);
void relinkPropertiesToMaster(PropertyGroup propGroup);
PropertyPropagation propertyPropagation(EngravingItem* destinationItem, Pid propertyId);
bool canBeExcludedFromOtherParts() const;
virtual bool canBeExcludedFromOtherParts() const { return false; }
virtual void manageExclusionFromParts(bool exclude);

//! --- Old Interface ---
Expand Down
2 changes: 2 additions & 0 deletions src/engraving/dom/ottava.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class OttavaSegment final : public TextLineBaseSegment
Ottava* ottava() const { return (Ottava*)spanner(); }

EngravingItem* propertyDelegate(Pid) override;

bool canBeExcludedFromOtherParts() const override { return true; }
};

//---------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions src/engraving/dom/stafftext.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class StaffText final : public StaffTextBase

StaffText* clone() const override { return new StaffText(*this); }

bool canBeExcludedFromOtherParts() const override { return true; }

private:
PropertyValue propertyDefault(Pid id) const override;
};
Expand Down
2 changes: 2 additions & 0 deletions src/engraving/dom/systemtext.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class SystemText : public StaffTextBase
SystemText* clone() const override { return new SystemText(*this); }
Segment* segment() const { return (Segment*)explicitParent(); }

bool canBeExcludedFromOtherParts() const override { return true; }

protected:
PropertyValue propertyDefault(Pid id) const override;
};
Expand Down
3 changes: 1 addition & 2 deletions src/engraving/dom/textbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3393,8 +3393,7 @@ void TextBase::undoChangeProperty(Pid id, const PropertyValue& v, PropertyFlags
}
}

bool isTextSpecificProperty = id == Pid::FONT_STYLE || id == Pid::FONT_FACE || id == Pid::FONT_SIZE || id == Pid::TEXT_SCRIPT_ALIGN;
if (!isTextSpecificProperty) {
if (propertyGroup(id) != PropertyGroup::TEXT) {
EngravingItem::undoChangeProperty(id, v, ps);
return;
}
Expand Down

0 comments on commit 15737ad

Please sign in to comment.