|
58 | 58 | #include "libmscore/system.h" |
59 | 59 | #include "libmscore/tempo.h" |
60 | 60 | #include "libmscore/tempotext.h" |
| 61 | +#include "libmscore/text.h" |
61 | 62 | #include "libmscore/tie.h" |
62 | 63 | #include "libmscore/timesig.h" |
63 | 64 | #include "libmscore/tremolo.h" |
64 | 65 | #include "libmscore/trill.h" |
65 | 66 | #include "libmscore/utils.h" |
| 67 | +#include "libmscore/box.h" |
66 | 68 | #include "libmscore/volta.h" |
67 | 69 | #include "libmscore/textline.h" |
68 | 70 | #include "libmscore/barline.h" |
@@ -619,6 +621,52 @@ static void setPartInstruments(MxmlLogger* logger, const QXmlStreamReader* const |
619 | 621 | } |
620 | 622 | } |
621 | 623 | } |
| 624 | + |
| 625 | +//--------------------------------------------------------- |
| 626 | +// addCopyrightVBox |
| 627 | +//--------------------------------------------------------- |
| 628 | + |
| 629 | +static MeasureBase* findFirstPageBreak(Score* score) |
| 630 | + { |
| 631 | + for (MeasureBase* mb = score->first(); mb; mb = mb->next()) |
| 632 | + if (mb->pageBreak()) |
| 633 | + return mb; |
| 634 | + // If no imported pageBreaks, find the last measure of the |
| 635 | + // second-to-last or last system of the first page |
| 636 | + score->doLayout(); |
| 637 | + if (score->pages().size() == 1) return score->last(); |
| 638 | + auto firstPageSystems = score->pages().first()->systems(); |
| 639 | + MeasureBase* lastMeasureOfFirstPageAdjusted = firstPageSystems[firstPageSystems.length() - 2]->measures().back(); |
| 640 | + return lastMeasureOfFirstPageAdjusted ? lastMeasureOfFirstPageAdjusted : score->last(); |
| 641 | + } |
| 642 | + |
| 643 | +//--------------------------------------------------------- |
| 644 | +// addCopyrightVBox |
| 645 | +//--------------------------------------------------------- |
| 646 | + |
| 647 | +/** |
| 648 | + Adds VBox at the end of the first page with copyright info |
| 649 | + */ |
| 650 | + |
| 651 | +void MusicXMLParserPass2::addCopyrightVBox() |
| 652 | + { |
| 653 | + if (_score->metaTag("copyright").isEmpty()) |
| 654 | + return; |
| 655 | + Text* copyrightText = new Text(_score); |
| 656 | + VBox* copyrightVBox = new VBox(_score); |
| 657 | + copyrightText->setPlainText(_score->metaTag("copyright")); |
| 658 | + copyrightText->setAlign(Align::BASELINE | Align::HCENTER); |
| 659 | + copyrightText->setPropertyFlags(Pid::ALIGN, PropertyFlags::UNSTYLED); |
| 660 | + copyrightVBox->add(copyrightText); |
| 661 | + copyrightVBox->setAutoSizeEnabled(true); |
| 662 | + MeasureBase* mb = findFirstPageBreak(_score); |
| 663 | + _score->addMeasure(copyrightVBox, mb->next()); |
| 664 | + copyrightVBox->setPageBreak(true); |
| 665 | + if (mb->pageBreak()) { |
| 666 | + mb->setPageBreak(false); |
| 667 | + mb->setLineBreak(true); |
| 668 | + } |
| 669 | + } |
622 | 670 |
|
623 | 671 | //--------------------------------------------------------- |
624 | 672 | // text2syms |
@@ -1893,10 +1941,16 @@ void MusicXMLParserPass2::scorePartwise() |
1893 | 1941 | _score->lastMeasure()->setEndBarLineType(BarLineType::NORMAL, 0); |
1894 | 1942 |
|
1895 | 1943 | _score->connectArpeggios(); |
1896 | | - _score->fixupLaissezVibrer(); |
| 1944 | + _score->fixupLaissezVibrer(); |
1897 | 1945 | cleanFretDiagrams(_score->firstMeasure()); |
1898 | 1946 | if (_pass1.hasInferredHeaderText()) |
1899 | 1947 | reformatHeaderVBox(_score->measures()->first()); |
| 1948 | + |
| 1949 | + bool copyrightFirstPageOnly = true; // TODO: expose as import setting |
| 1950 | + if (copyrightFirstPageOnly) |
| 1951 | + // Somewhat temporary fix: hide footer and make copyright a text box |
| 1952 | + addCopyrightVBox(); |
| 1953 | + |
1900 | 1954 | cleanUpLayoutBreaks(_score, _logger); |
1901 | 1955 | } |
1902 | 1956 |
|
|
0 commit comments