Skip to content

Commit

Permalink
Merge pull request #20103 from mike-spa/partScoreRefinements2
Browse files Browse the repository at this point in the history
Parts & score refinements - the sequel
  • Loading branch information
RomanPudashkin authored Nov 24, 2023
2 parents 647a6ba + 2f5e5aa commit 187676e
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 17 deletions.
22 changes: 13 additions & 9 deletions src/engraving/dom/engravingitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ String EngravingItem::translatedSubtypeUserName() const
EngravingItem* EngravingItem::linkedClone()
{
EngravingItem* e = clone();
e->setAutoplace(true);
score()->undo(new Link(e, this));
return e;
}
Expand Down Expand Up @@ -627,12 +626,7 @@ mu::draw::Color EngravingItem::curColor(bool isVisible, Color normalColor) const
}

if (selected() || marked) {
bool isUnlinkedFromMaster = !(getProperty(Pid::POSITION_LINKED_TO_MASTER).toBool()
&& getProperty(Pid::APPEARANCE_LINKED_TO_MASTER).toBool());
if (isTextBase()) {
isUnlinkedFromMaster = isUnlinkedFromMaster || !getProperty(Pid::TEXT_LINKED_TO_MASTER).toBool();
}
return engravingConfiguration()->selectionColor(track() == mu::nidx ? 0 : voice(), isVisible, isUnlinkedFromMaster);
return engravingConfiguration()->selectionColor(track() == mu::nidx ? 0 : voice(), isVisible, isUnlinkedFromMaster());
}

if (!isVisible) {
Expand Down Expand Up @@ -1280,8 +1274,12 @@ void EngravingItem::relinkPropertiesToMaster(PropertyGroup propGroup)
}
const PropertyValue masterValue = masterElement->getProperty(propertyId);
const PropertyFlags masterFlags = masterElement->propertyFlags(propertyId);
setProperty(propertyId, masterValue);
setPropertyFlags(propertyId, masterFlags);
if (getProperty(propertyId) != masterValue) {
setProperty(propertyId, masterValue);
}
if (propertyFlags(propertyId) != masterFlags) {
setPropertyFlags(propertyId, masterFlags);
}
}
}

Expand Down Expand Up @@ -2361,6 +2359,12 @@ bool EngravingItem::isPropertyLinkedToMaster(Pid id) const
return true;
}

bool EngravingItem::isUnlinkedFromMaster() const
{
return !(getProperty(Pid::POSITION_LINKED_TO_MASTER).toBool()
&& getProperty(Pid::APPEARANCE_LINKED_TO_MASTER).toBool());
}

void EngravingItem::unlinkPropertyFromMaster(Pid id)
{
if (propertyGroup(id) == PropertyGroup::POSITION) {
Expand Down
1 change: 1 addition & 0 deletions src/engraving/dom/engravingitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ class EngravingItem : public EngravingObject
mu::RectF canvasBoundingRect(LD_ACCESS mode = LD_ACCESS::CHECK) const { return ldata()->bbox(mode).translated(canvasPos()); }

virtual bool isPropertyLinkedToMaster(Pid id) const;
virtual bool isUnlinkedFromMaster() const;
void unlinkPropertyFromMaster(Pid id);
void relinkPropertiesToMaster(PropertyGroup propGroup);
PropertyPropagation propertyPropagation(const EngravingItem* destinationItem, Pid propertyId) const;
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/dom/property.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct PropertyMetaData {
/* *INDENT-OFF* */
static constexpr PropertyMetaData propertyList[] = {
{ Pid::SUBTYPE, false, "subtype", P_TYPE::INT, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "subtype") },
{ Pid::SELECTED, false, "selected", P_TYPE::BOOL, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "selected") },
{ Pid::SELECTED, false, "selected", P_TYPE::BOOL, PropertyGroup::NONE, DUMMY_QT_TR_NOOP("propertyName", "selected") },
{ Pid::GENERATED, false, "generated", P_TYPE::BOOL, PropertyGroup::NONE, DUMMY_QT_TR_NOOP("propertyName", "generated") },
{ Pid::COLOR, false, "color", P_TYPE::COLOR, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "color") },
{ Pid::VISIBLE, false, "visible", P_TYPE::BOOL, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "visible") },
Expand Down Expand Up @@ -359,7 +359,7 @@ static constexpr PropertyMetaData propertyList[] = {
{ Pid::LOCATION_GRACE, false, "grace", P_TYPE::INT, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "grace note index") },
{ Pid::LOCATION_NOTE, false, "note", P_TYPE::INT, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "note index") },

{ Pid::VOICE, false, "voice", P_TYPE::INT, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "voice") },
{ Pid::VOICE, false, "voice", P_TYPE::INT, PropertyGroup::NONE, DUMMY_QT_TR_NOOP("propertyName", "voice") },
{ Pid::POSITION, false, "position", P_TYPE::FRACTION, PropertyGroup::POSITION, DUMMY_QT_TR_NOOP("propertyName", "position") },

{ Pid::CLEF_TYPE_CONCERT, true, "concertClefType", P_TYPE::CLEF_TYPE, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "concert clef type") },
Expand Down
9 changes: 5 additions & 4 deletions src/engraving/dom/spanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,11 @@ Spanner::Spanner(const Spanner& s)
m_tick = s.m_tick;
m_ticks = s.m_ticks;
m_track2 = s.m_track2;
if (!s.startElement() && !spannerSegments().size()) {
for (auto* segment : s.spannerSegments()) {
add(segment->clone());
}

for (auto* segment : s.m_segments) {
SpannerSegment* newSegment = toSpannerSegment(segment->clone());
newSegment->setParent(nullptr);
add(newSegment);
}
}

Expand Down
10 changes: 10 additions & 0 deletions src/engraving/dom/textbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2678,6 +2678,16 @@ bool TextBase::isPropertyLinkedToMaster(Pid id) const
return EngravingItem::isPropertyLinkedToMaster(id);
}

bool TextBase::isUnlinkedFromMaster() const
{
EngravingItem* parent = parentItem();
if (parent && parent->isUnlinkedFromMaster()) {
return true;
}

return !getProperty(Pid::TEXT_LINKED_TO_MASTER).toBool() || EngravingItem::isUnlinkedFromMaster();
}

//---------------------------------------------------------
// getProperty
//---------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/engraving/dom/textbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ class TextBase : public EngravingItem
mu::draw::FontMetrics fontMetrics() const;

bool isPropertyLinkedToMaster(Pid id) const override;
bool isUnlinkedFromMaster() const override;
PropertyValue getProperty(Pid propertyId) const override;
bool setProperty(Pid propertyId, const PropertyValue& v) override;
PropertyValue propertyDefault(Pid id) const override;
Expand Down
2 changes: 2 additions & 0 deletions src/engraving/rendering/dev/slurtielayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,7 @@ TieSegment* SlurTieLayout::tieLayoutFor(Tie* item, System* system)

item->fixupSegments(segmentCount);
TieSegment* segment = item->segmentAt(0);
segment->setTrack(item->track());
segment->setSpannerSegmentType(sPos.system1 != sPos.system2 ? SpannerSegmentType::BEGIN : SpannerSegmentType::SINGLE);
segment->setSystem(system); // Needed to populate System.spannerSegments
segment->resetAdjustmentOffset();
Expand Down Expand Up @@ -1182,6 +1183,7 @@ TieSegment* SlurTieLayout::tieLayoutBack(Tie* item, System* system)

item->fixupSegments(2);
TieSegment* segment = item->segmentAt(1);
segment->setTrack(item->track());
segment->setSystem(system);
segment->resetAdjustmentOffset();

Expand Down
2 changes: 1 addition & 1 deletion src/inspector/models/abstractinspectormodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ InspectorSectionTypeSet AbstractInspectorModel::sectionTypesByElementKeys(const
bool AbstractInspectorModel::showPartsSection(const QList<EngravingItem*>& selectedElementList)
{
for (EngravingItem* element : selectedElementList) {
if (!element->score()->isMaster() || element->canBeExcludedFromOtherParts()) {
if ((!element->score()->isMaster() && !element->isLayoutBreak()) || element->canBeExcludedFromOtherParts()) {
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/inspector/models/parts/partssettingsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void PartsSettingsModel::requestElements()
m_elementsForTextLinkingOption.clear();

for (EngravingItem* item : m_elementList) {
if (!item->score()->isMaster()) {
if (!item->score()->isMaster() && !item->isLayoutBreak()) {
m_elementsForPartLinkingOption.push_back(item);
}
if (item->canBeExcludedFromOtherParts()) {
Expand Down

0 comments on commit 187676e

Please sign in to comment.