Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make text of textlines follow voice assignment colour #23959

Merged
merged 2 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/engraving/dom/spanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,10 @@ void SpannerSegment::undoChangeProperty(Pid pid, const PropertyValue& val, Prope

void SpannerSegment::setSelected(bool f)
{
for (SpannerSegment* ss : m_spanner->spannerSegments()) {
ss->EngravingItem::setSelected(f);
EngravingItem::setSelected(f);
if (spanner()->selected() != f) {
spanner()->setSelected(f);
}
m_spanner->setSelected(f);
}

//---------------------------------------------------------
Expand Down Expand Up @@ -1155,10 +1155,13 @@ Measure* Spanner::endMeasure() const

void Spanner::setSelected(bool f)
{
EngravingItem::setSelected(f);

for (SpannerSegment* ss : spannerSegments()) {
ss->EngravingItem::setSelected(f);
if (ss->selected() != f) {
ss->setSelected(f);
}
}
EngravingItem::setSelected(f);
}

//---------------------------------------------------------
Expand Down
21 changes: 21 additions & 0 deletions src/engraving/dom/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,31 @@ engraving::PropertyValue Text::propertyDefault(Pid id) const
}
}

PropertyValue Text::getProperty(Pid id) const
{
switch (id) {
case Pid::VOICE_ASSIGNMENT:
if (hasVoiceAssignmentProperties()) {
return parentItem()->getProperty(id);
}
default:
return TextBase::getProperty(id);
}
}

String Text::readXmlText(XmlReader& xml, Score* score)
{
Text t(score->dummy());
rw::RWRegister::reader()->readItem(&t, xml);
return t.xmlText();
}

bool Text::hasVoiceAssignmentProperties() const
{
const EngravingItem* parent = parentItem();
if (parent && parent->isTextLineBaseSegment()) {
return parent->hasVoiceAssignmentProperties();
}
return false;
}
}
4 changes: 4 additions & 0 deletions src/engraving/dom/text.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ class Text final : public TextBase
Text* clone() const override { return new Text(*this); }

PropertyValue propertyDefault(Pid id) const override;
PropertyValue getProperty(Pid id) const override;

static String readXmlText(XmlReader& r, Score* score);

void setLayoutToParentWidth(bool v) { m_layoutToParentWidth = v; }

bool hasVoiceAssignmentProperties() const override;
VoiceAssignment voiceAssignment() const;

private:
friend class Factory;
Text(EngravingItem* parent, TextStyleType tid = TextStyleType::DEFAULT);
Expand Down