Skip to content

Commit

Permalink
fix #31006: Creation of Part - header formatting could be improved
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Aug 27, 2014
1 parent 98653d1 commit 48a8430
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
18 changes: 18 additions & 0 deletions libmscore/box.cpp
Expand Up @@ -386,6 +386,24 @@ QVariant Box::propertyDefault(P_ID id) const
}
}

//---------------------------------------------------------
// copyValues
//---------------------------------------------------------

void Box::copyValues(Box* origin)
{
_boxHeight = origin->boxHeight();
_boxWidth = origin->boxWidth();

qreal factor = magS() / origin->magS();
_bottomGap = origin->bottomGap() * factor;
_topGap = origin->topGap() * factor;
_bottomMargin = origin->bottomMargin() * factor;
_topMargin = origin->topMargin() * factor;
_leftMargin = origin->leftMargin() * factor;
_rightMargin = origin->rightMargin() * factor;
}

//---------------------------------------------------------
// HBox
//---------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions libmscore/box.h
Expand Up @@ -79,6 +79,7 @@ class Box : public MeasureBase {
void setTopGap(qreal val) { _topGap = val; }
qreal bottomGap() const { return _bottomGap; }
void setBottomGap(qreal val) { _bottomGap = val; }
void copyValues(Box* origin);

virtual QVariant getProperty(P_ID propertyId) const override;
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
Expand Down
7 changes: 6 additions & 1 deletion libmscore/excerpt.cpp
Expand Up @@ -140,10 +140,15 @@ void createExcerpt(Score* score, const QList<Part*>& parts)

// create title frame for all scores if not already there
if (!measure || (measure->type() != Element::Type::VBOX))
oscore->insertMeasure(Element::Type::VBOX, measure);
measure = oscore->insertMeasure(Element::Type::VBOX, measure);

VBox* titleFrameScore = static_cast<VBox*>(measure);
measure = score->first();

Q_ASSERT(measure->type() == Element::Type::VBOX);

VBox* titleFramePart = static_cast<VBox*>(measure);
titleFramePart->copyValues(titleFrameScore);
QString partLabel = parts.front()->longName();
if (!partLabel.isEmpty()) {
Text* txt = new Text(score);
Expand Down

0 comments on commit 48a8430

Please sign in to comment.