fix #72491: text properties in lines added by double click

This commit is contained in:
Marc Sabatella 2015-08-11 13:39:12 -06:00
parent 0bb048d59a
commit 42ec49d357
3 changed files with 47 additions and 0 deletions

View file

@ -290,6 +290,37 @@ void Score::cmdAddSpanner(Spanner* spanner, int staffIdx, Segment* startSegment,
else
tick2 = endSegment->tick();
spanner->setTick2(tick2);
if (spanner->type() == Element::Type::TEXTLINE
|| spanner->type() == Element::Type::NOTELINE
|| spanner->type() == Element::Type::OTTAVA
|| spanner->type() == Element::Type::PEDAL
|| spanner->type() == Element::Type::VOLTA) {
// rebase text elements to score style
TextLine* tl = static_cast<TextLine*>(spanner);
TextStyleType st;
Text* t;
// begin
t = tl->beginTextElement();
if (t) {
st = t->textStyleType();
if (st >= TextStyleType::DEFAULT)
t->textStyle().restyle(MScore::baseStyle()->textStyle(st), textStyle(st));
}
// continue
t = tl->continueTextElement();
if (t) {
st = t->textStyleType();
if (st >= TextStyleType::DEFAULT)
t->textStyle().restyle(MScore::baseStyle()->textStyle(st), textStyle(st));
}
// end
t = tl->endTextElement();
if (t) {
st = t->textStyleType();
if (st >= TextStyleType::DEFAULT)
t->textStyle().restyle(MScore::baseStyle()->textStyle(st), textStyle(st));
}
}
undoAddElement(spanner);
}

View file

@ -445,6 +445,21 @@ TextLine::~TextLine()
delete _endText;
}
//---------------------------------------------------------
// setScore
//---------------------------------------------------------
void TextLine::setScore(Score* s)
{
Spanner::setScore(s);
if (_beginText)
_beginText->setScore(s);
if (_continueText)
_continueText->setScore(s);
if (_endText)
_endText->setScore(s);
}
//---------------------------------------------------------
// createBeginTextElement
//---------------------------------------------------------

View file

@ -84,6 +84,7 @@ class TextLine : public SLine {
virtual TextLine* clone() const override { return new TextLine(*this); }
virtual Element::Type type() const override { return Element::Type::TEXTLINE; }
virtual void setScore(Score* s) override;
virtual LineSegment* createLineSegment() override;
virtual void write(Xml& xml) const override;