diff --git a/libmscore/page.cpp b/libmscore/page.cpp index 9b0a382549223..f129059262d70 100644 --- a/libmscore/page.cpp +++ b/libmscore/page.cpp @@ -602,13 +602,16 @@ void Page::doRebuildBspTree() //--------------------------------------------------------- // replaceTextMacros -// $p - page number -// $$ - $ +// $p - page number, except on first page +// $P - page number, on all pages // $n - number of pages // $f - file name // $F - file path+name // $d - current date // $D - creation date +// $C - copyright, on first page only +// $c - copyright, on all pages +// $$ - the $ sign itself // $:tag: - meta data tag // already defined tags: // movementNumber @@ -621,19 +624,19 @@ void Page::doRebuildBspTree() QString Page::replaceTextMacros(const QString& s) const { - int pageno = no() + 1 + _score->pageNumberOffset(); QString d; - int n = s.size(); - for (int i = 0; i < n; ++i) { + for (int i = 0, n = s.size(); i < n; ++i) { QChar c = s[i]; if (c == '$' && (i < (n-1))) { QChar c = s[i+1]; switch(c.toLatin1()) { - case 'p': - d += QString("%1").arg(pageno); + case 'p': // not on first page 1 + if (_no) // FALLTHROUGH + case 'P': // on all pages + d += QString("%1").arg(_no + 1 + _score->pageNumberOffset()); break; case 'n': - d += QString("%1").arg(_score->pages().size() + _score->pageNumberOffset()); + d += QString("%1").arg(_score->npages() + _score->pageNumberOffset()); break; case 'f': d += _score->name(); @@ -646,12 +649,16 @@ QString Page::replaceTextMacros(const QString& s) const break; case 'D': { - QString creationDate = score()->metaTag("creationDate"); - if(!creationDate.isNull()) { + QString creationDate = _score->metaTag("creationDate"); + if (!creationDate.isNull()) d += QDate::fromString(creationDate, Qt::ISODate).toString(Qt::DefaultLocaleShortDate); - } } break; + case 'C': // only on first page + if (!_no) // FALLTHROUGH + case 'c': + d += _score->metaTag("copyright"); + break; case '$': d += '$'; break; @@ -665,7 +672,7 @@ QString Page::replaceTextMacros(const QString& s) const tag += s[k]; } if (k != n) { // found ':' ? - d += score()->metaTag(tag); + d += _score->metaTag(tag); i = k-1; } } @@ -689,7 +696,7 @@ QString Page::replaceTextMacros(const QString& s) const bool Page::isOdd() const { - return (_no + 1 + score()->pageNumberOffset()) & 1; + return (_no + 1 + _score->pageNumberOffset()) & 1; } //--------------------------------------------------------- diff --git a/libmscore/read114.cpp b/libmscore/read114.cpp index f2703c5d46a6c..5d2d95dc35459 100644 --- a/libmscore/read114.cpp +++ b/libmscore/read114.cpp @@ -639,10 +639,14 @@ Score::FileError Score::read114(XmlReader& e) style()->set(ST_lyricsDistance, 2.0f); if (style(ST_voltaY) == MScore::baseStyle()->value(ST_voltaY)) style()->set(ST_voltaY, -2.0f); - if (style(ST_hideEmptyStaves).toBool() == true) // http://musescore.org/en/node/16228 + if (style(ST_hideEmptyStaves).toBool()) // http://musescore.org/en/node/16228 style()->set(ST_dontHideStavesInFirstSystem, false); if (style(ST_useGermanNoteNames).toBool()) style()->set(ST_useStandardNoteNames, false); + if (style(ST_showPageNumberOne).toBool()) { // http://musescore.org/en/node/21207 + style()->set(ST_evenFooterL, QString("$P")); + style()->set(ST_oddFooterR, QString("$P")); + } _showOmr = false; diff --git a/mscore/editstyle.cpp b/mscore/editstyle.cpp index d5bc5c1731cfa..e76bb19fcfb95 100644 --- a/mscore/editstyle.cpp +++ b/mscore/editstyle.cpp @@ -35,6 +35,43 @@ namespace Ms { +// keep in sync with implementation in Page::replaceTextMacros (page.cpp) +// jumping thru hoops here to make the job of translators easier, yet have a nice display +static QString toolTipHeaderFooter + = QString("

") + + QT_TRANSLATE_NOOP("toolTipHeaderFooter", "Special symbols in header/footer") + + QString("

") + + QString("
$p-") + + QT_TRANSLATE_NOOP("toolTipHeaderFooter", "page number, except on first page") + + QString("
$P-") + + QT_TRANSLATE_NOOP("toolTipHeaderFooter", "page number, on all pages") + + QString("
$n-") + + QT_TRANSLATE_NOOP("toolTipHeaderFooter", "number of pages") + + QString("
$f-") + + QT_TRANSLATE_NOOP("toolTipHeaderFooter", "file name") + + QString("
$F-") + + QT_TRANSLATE_NOOP("toolTipHeaderFooter", "file path+name") + + QString("
$d-") + + QT_TRANSLATE_NOOP("toolTipHeaderFooter", "current date") + + QString("
$D-") + + QT_TRANSLATE_NOOP("toolTipHeaderFooter", "creation date") + + QString("
$C-") + + QT_TRANSLATE_NOOP("toolTipHeaderFooter", "copyright, on first page only") + + QString("
$c-") + + QT_TRANSLATE_NOOP("toolTipHeaderFooter", "copyright, on all pages") + + QString("
$$-") + + QT_TRANSLATE_NOOP("toolTipHeaderFooter", "the $ sign itself") + + QString("
$:tag:-") + + QT_TRANSLATE_NOOP("toolTipHeaderFooter", "meta data tag") + + QString("

") + + QT_TRANSLATE_NOOP("toolTipHeaderFooter", "already defined tags:") + + QString("

") + + QString("") + + QString("") + + QString("") + + QString("") + + QString("
movementNumber
movementTitle
workNumber
workTitle
source
copyright
"); + //--------------------------------------------------------- // EditStyle //--------------------------------------------------------- @@ -111,6 +148,8 @@ EditStyle::EditStyle(Score* s, QWidget* parent) connect(comboFBFont, SIGNAL(currentIndexChanged(int)), SLOT(on_comboFBFont_currentIndexChanged(int))); setValues(); + showHeader->setToolTip(toolTipHeaderFooter); + showFooter->setToolTip(toolTipHeaderFooter); connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), SLOT(buttonClicked(QAbstractButton*))); connect(chordDescriptionFileButton, SIGNAL(clicked()), SLOT(selectChordDescriptionFile())); connect(chordsStandard, SIGNAL(toggled(bool)), SLOT(setChordStyle(bool))); diff --git a/mscore/editstyle.ui b/mscore/editstyle.ui index a7b8266a2a66e..9e194c01d96c7 100644 --- a/mscore/editstyle.ui +++ b/mscore/editstyle.ui @@ -1205,9 +1205,6 @@ 0 - - - Footer text @@ -1446,33 +1443,6 @@ - - - - - 0 - 0 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:8pt; font-weight:600;">Special symbols in header/footer:</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:8pt;">$p </span><span style=" font-family:'Sans Serif'; font-size:8pt; font-style:italic;">- page number </span><span style=" font-family:'Sans Serif'; font-size:8pt;">$n</span><span style=" font-family:'Sans Serif'; font-size:8pt; font-style:italic;"> - number of last page </span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:8pt;">$$</span><span style=" font-family:'Sans Serif'; font-size:8pt; font-style:italic;"> - the character $</span><span style=" font-family:'Sans Serif'; font-size:8pt;"> $f - </span><span style=" font-family:'Sans Serif'; font-size:8pt; font-style:italic;">score name</span><span style=" font-family:'Sans Serif'; font-size:8pt;"> </span><span style=" font-family:'Sans Serif'; font-size:8pt; font-style:italic;"> </span><span style=" font-family:'Sans Serif'; font-size:8pt;">$F - </span><span style=" font-family:'Sans Serif'; font-size:8pt; font-style:italic;">file path</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:8pt;">$d - </span><span style=" font-family:'Sans Serif'; font-size:8pt; font-style:italic;">current date </span><span style=" font-family:'Sans Serif'; font-size:8pt;">$D - </span><span style=" font-family:'Sans Serif'; font-size:8pt; font-style:italic;">creation date</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:8pt;">$:tag: - </span><span style=" font-family:'Sans Serif'; font-size:8pt; font-style:italic;">meta tag (copyright etc.)</span></p></body></html> - - - Qt::RichText - - - true - - -