Skip to content

Commit

Permalink
text styles for front cover and contents
Browse files Browse the repository at this point in the history
  • Loading branch information
SKefalidis committed Sep 6, 2020
1 parent 6e6ec9b commit 98efe2b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 35 deletions.
41 changes: 16 additions & 25 deletions libmscore/album.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1153,19 +1153,14 @@ void Album::updateFrontCover()
// make sure that we have these 3 text fields
MeasureBase* measure = getCombinedScore()->measures()->first();
measure->clearElements();
Text* s = new Text(getCombinedScore(), Tid::TITLE);
Text* s = new Text(getCombinedScore(), Tid::ALBUM_FRONT_TITLE);
s->setPlainText("");
s->setSize(36);
s->setTid(Tid::ALBUM_FRONT_TITLE);
s->reset();
measure->add(s);
s = new Text(getCombinedScore(), Tid::COMPOSER);
s = new Text(getCombinedScore(), Tid::ALBUM_FRONT_COMPOSER);
s->setPlainText("");
s->setSize(16);
measure->add(s);
s = new Text(getCombinedScore(), Tid::POET);
s = new Text(getCombinedScore(), Tid::ALBUM_FRONT_LYRICIST);
s->setPlainText("");
s->setSize(16);
measure->add(s);

for (auto& x : getCombinedScore()->measures()->first()->el()) {
Expand All @@ -1174,11 +1169,11 @@ void Album::updateFrontCover()

if (t->tid() == Tid::ALBUM_FRONT_TITLE) {
t->setPlainText(albumTitle());
} else if (t->tid() == Tid::COMPOSER) {
} else if (t->tid() == Tid::ALBUM_FRONT_COMPOSER) {
if (m_drawFrontCover) {
t->setPlainText(composers().join("\n"));
}
} else if (t->tid() == Tid::POET) {
} else if (t->tid() == Tid::ALBUM_FRONT_LYRICIST) {
if (m_drawFrontCover) {
t->setPlainText(lyricists().join("\n"));
}
Expand Down Expand Up @@ -1235,13 +1230,11 @@ void Album::updateContents()
// make sure that we have these 2 text fields
MeasureBase* measure = ms->measures()->first();
measure->clearElements();
Text* s = new Text(ms, Tid::TITLE);
Text* s = new Text(ms, Tid::ALBUM_CONTENTS_TITLE);
s->setPlainText("Contents");
s->setSize(36);
measure->add(s);
s = new Text(ms, Tid::SUBTITLE);
s = new Text(ms, Tid::ALBUM_CONTENTS_TEXT);
s->setPlainText("");
s->setSize(16);
measure->add(s);
}

Expand All @@ -1255,12 +1248,16 @@ void Album::updateContents()
for (auto& x : measure->el()) {
if (x && x->isText()) {
t = toText(x);
if (t->tid() == Tid::SUBTITLE) {
if (t->tid() == Tid::ALBUM_CONTENTS_TEXT) {
break;
}
}
}
t->setAlign(Align::LEFT | Align::BASELINE);

if (!t) {
return;
}

QString str("");
int i = 0;
for (auto& x : scoreTitles()) {
Expand All @@ -1283,10 +1280,7 @@ void Album::updateContents()
for (auto& x : measure->el()) {
if (x && x->isText()) {
t = toText(x);
if (t->tid() == Tid::SUBTITLE) {
t->setAlign(Align::LEFT | Align::BASELINE);
break;
}
break;
}
}
if (!t) {
Expand All @@ -1295,17 +1289,14 @@ void Album::updateContents()
} else {
VBox* newMeasure = new VBox(ms);
newMeasure->clearElements();
Text* s = new Text(ms, Tid::TITLE);
Text* s = new Text(ms, Tid::ALBUM_CONTENTS_TITLE);
s->setPlainText("Contents");
s->setSize(36);
newMeasure->add(s);
s = new Text(ms, Tid::SUBTITLE);
s = new Text(ms, Tid::ALBUM_CONTENTS_TEXT);
s->setPlainText("");
s->setSize(16);
newMeasure->add(s);
ms->measures()->add(newMeasure);
t = s;
t->setAlign(Align::LEFT | Align::BASELINE);
}
str = QString("");
}
Expand Down
20 changes: 10 additions & 10 deletions libmscore/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,9 +1088,9 @@ static const StyleType styleTypes[] {
{ Sid::albumFrontTitleFontSpatiumDependent, "albumFrontTitleFontSpatiumDependent", true },
{ Sid::albumFrontTitleFontStyle, "albumFrontTitleFontStyle", int(FontStyle::Normal) },
{ Sid::albumFrontTitleColor, "albumFrontTitleColor", QColor(0, 0, 0, 255) },
{ Sid::albumFrontTitleAlign, "albumFrontTitleAlign", QVariant::fromValue(Align::CENTER | Align::BASELINE) },
{ Sid::albumFrontTitleAlign, "albumFrontTitleAlign", QVariant::fromValue(Align::TOP | Align::HCENTER) },
{ Sid::albumFrontTitleOffset, "albumFrontTitleOffset", QPointF() },
{ Sid::albumFrontTitlePlacement, "albumFrontTitlePlacement", int(Placement::BELOW) },
{ Sid::albumFrontTitlePlacement, "albumFrontTitlePlacement", int(Placement::ABOVE) },
{ Sid::albumFrontTitlePosAbove, "albumFrontTitlePosAbove", QPointF(.0, -2.0) },
{ Sid::albumFrontTitlePosBelow, "albumFrontTitlePosBelow", QPointF(.0, 2.0) },
{ Sid::albumFrontTitleMinDistance, "albumFrontTitleMinDistance", Spatium(0.5) },
Expand All @@ -1102,11 +1102,11 @@ static const StyleType styleTypes[] {
{ Sid::albumFrontTitleFrameBgColor, "albumFrontTitleFrameBgColor", QColor(255, 255, 255, 0) },

{ Sid::albumFrontComposerFontFace, "albumFrontComposerFontFace", "FreeSerif" },
{ Sid::albumFrontComposerFontSize, "albumFrontComposerFontSize", 12.0 },
{ Sid::albumFrontComposerFontSize, "albumFrontComposerFontSize", 16.0 },
{ Sid::albumFrontComposerFontSpatiumDependent, "albumFrontComposerFontSpatiumDependent", true },
{ Sid::albumFrontComposerFontStyle, "albumFrontComposerFontStyle", int(FontStyle::Normal) },
{ Sid::albumFrontComposerColor, "albumFrontComposerColor", QColor(0, 0, 0, 255) },
{ Sid::albumFrontComposerAlign, "albumFrontComposerAlign", QVariant::fromValue(Align::LEFT | Align::BASELINE) },
{ Sid::albumFrontComposerAlign, "albumFrontComposerAlign", QVariant::fromValue(Align::RIGHT | Align::BOTTOM) },
{ Sid::albumFrontComposerOffset, "albumFrontComposerOffset", QPointF() },
{ Sid::albumFrontComposerPlacement, "albumFrontComposerPlacement", int(Placement::BELOW) },
{ Sid::albumFrontComposerPosAbove, "albumFrontComposerPosAbove", QPointF(.0, -2.0) },
Expand All @@ -1120,11 +1120,11 @@ static const StyleType styleTypes[] {
{ Sid::albumFrontComposerFrameBgColor, "albumFrontComposerFrameBgColor", QColor(255, 255, 255, 0) },

{ Sid::albumFrontLyricistFontFace, "albumFrontLyricistFontFace", "FreeSerif" },
{ Sid::albumFrontLyricistFontSize, "albumFrontLyricistFontSize", 12.0 },
{ Sid::albumFrontLyricistFontSize, "albumFrontLyricistFontSize", 16.0 },
{ Sid::albumFrontLyricistFontSpatiumDependent, "albumFrontLyricistFontSpatiumDependent", true },
{ Sid::albumFrontLyricistFontStyle, "albumFrontLyricistFontStyle", int(FontStyle::Normal) },
{ Sid::albumFrontLyricistColor, "albumFrontLyricistColor", QColor(0, 0, 0, 255) },
{ Sid::albumFrontLyricistAlign, "albumFrontLyricistAlign", QVariant::fromValue(Align::LEFT | Align::BASELINE) },
{ Sid::albumFrontLyricistAlign, "albumFrontLyricistAlign", QVariant::fromValue(Align::LEFT | Align::BOTTOM) },
{ Sid::albumFrontLyricistOffset, "albumFrontLyricistOffset", QPointF() },
{ Sid::albumFrontLyricistPlacement, "albumFrontLyricistPlacement", int(Placement::BELOW) },
{ Sid::albumFrontLyricistPosAbove, "albumFrontLyricistPosAbove", QPointF(.0, -2.0) },
Expand All @@ -1138,11 +1138,11 @@ static const StyleType styleTypes[] {
{ Sid::albumFrontLyricistFrameBgColor, "albumFrontLyricistFrameBgColor", QColor(255, 255, 255, 0) },

{ Sid::albumContentsTitleFontFace, "albumContentsTitleFontFace", "FreeSerif" },
{ Sid::albumContentsTitleFontSize, "albumContentsTitleFontSize", 12.0 },
{ Sid::albumContentsTitleFontSize, "albumContentsTitleFontSize", 24.0 },
{ Sid::albumContentsTitleFontSpatiumDependent, "albumContentsTitleFontSpatiumDependent", true },
{ Sid::albumContentsTitleFontStyle, "albumContentsTitleFontStyle", int(FontStyle::Normal) },
{ Sid::albumContentsTitleColor, "albumContentsTitleColor", QColor(0, 0, 0, 255) },
{ Sid::albumContentsTitleAlign, "albumContentsTitleAlign", QVariant::fromValue(Align::LEFT | Align::BASELINE) },
{ Sid::albumContentsTitleAlign, "albumContentsTitleAlign", QVariant::fromValue(Align::TOP | Align::HCENTER) },
{ Sid::albumContentsTitleOffset, "albumContentsTitleOffset", QPointF() },
{ Sid::albumContentsTitlePlacement, "albumContentsTitlePlacement", int(Placement::BELOW) },
{ Sid::albumContentsTitlePosAbove, "albumContentsTitlePosAbove", QPointF(.0, -2.0) },
Expand All @@ -1156,12 +1156,12 @@ static const StyleType styleTypes[] {
{ Sid::albumContentsTitleFrameBgColor, "albumContentsTitleFrameBgColor", QColor(255, 255, 255, 0) },

{ Sid::albumContentsTextFontFace, "albumContentsTextFontFace", "FreeSerif" },
{ Sid::albumContentsTextFontSize, "albumContentsTextFontSize", 12.0 },
{ Sid::albumContentsTextFontSize, "albumContentsTextFontSize", 14.0 },
{ Sid::albumContentsTextFontSpatiumDependent, "albumContentsTextFontSpatiumDependent", true },
{ Sid::albumContentsTextFontStyle, "albumContentsTextFontStyle", int(FontStyle::Normal) },
{ Sid::albumContentsTextColor, "albumContentsTextColor", QColor(0, 0, 0, 255) },
{ Sid::albumContentsTextAlign, "albumContentsTextAlign", QVariant::fromValue(Align::LEFT | Align::BASELINE) },
{ Sid::albumContentsTextOffset, "albumContentsTextOffset", QPointF() },
{ Sid::albumContentsTextOffset, "albumContentsTextOffset", QPointF(0.0, 10.0) },
{ Sid::albumContentsTextPlacement, "albumContentsTextPlacement", int(Placement::BELOW) },
{ Sid::albumContentsTextPosAbove, "albumContentsTextPosAbove", QPointF(.0, -2.0) },
{ Sid::albumContentsTextPosBelow, "albumContentsTextPosBelow", QPointF(.0, 2.0) },
Expand Down

0 comments on commit 98efe2b

Please sign in to comment.