Merge pull request #20103 from mike-spa/partScoreRefinements2

Parts & score refinements - the sequel
This commit is contained in:
RomanPudashkin 2023-11-24 12:38:14 +02:00 committed by GitHub
commit 187676ec23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 36 additions and 17 deletions

View File

@ -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;
}
@ -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) {
@ -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);
}
}
}
@ -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) {

View File

@ -600,6 +600,7 @@ public:
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;

View File

@ -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") },
@ -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") },

View File

@ -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);
}
}

View File

@ -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
//---------------------------------------------------------

View File

@ -380,6 +380,7 @@ public:
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;

View File

@ -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();
@ -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();

View File

@ -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;
}
}

View File

@ -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()) {