-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7328101
commit 641a5bc
Showing
20 changed files
with
240 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* SPDX-License-Identifier: GPL-3.0-only | ||
* MuseScore-CLA-applies | ||
* | ||
* MuseScore | ||
* Music Composition & Notation | ||
* | ||
* Copyright (C) 2021 MuseScore BVBA and others | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 3 as | ||
* published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
#include "readscorehook.h" | ||
#include "readstyle.h" | ||
|
||
#include "libmscore/score.h" | ||
#include "libmscore/scorefont.h" | ||
|
||
using namespace mu::engraving::compat; | ||
using namespace Ms; | ||
|
||
void ReadScoreHook::installReadStyleHook(Ms::MasterScore* score, const QByteArray& scoreData, const QString& completeBaseName) | ||
{ | ||
m_readStyle = std::make_shared<ReadStyleHook>(score, scoreData, completeBaseName); | ||
} | ||
|
||
void ReadScoreHook::setupDefaultStyle() | ||
{ | ||
if (!m_readStyle) { | ||
return; | ||
} | ||
m_readStyle->setupDefaultStyle(); | ||
} | ||
|
||
void ReadScoreHook::onReadStyleTag302(Ms::Score* score, Ms::XmlReader& xml) | ||
{ | ||
if (!m_readStyle) { | ||
return; | ||
} | ||
|
||
qreal sp = score->style().value(Sid::spatium).toDouble(); | ||
|
||
compat::ReadStyleHook::readStyleTag(score, xml); | ||
|
||
// if (_layoutMode == LayoutMode::FLOAT || _layoutMode == LayoutMode::SYSTEM) { | ||
if (score->_layoutMode == LayoutMode::FLOAT) { | ||
// style should not change spatium in | ||
// float mode | ||
score->style().set(Sid::spatium, sp); | ||
} | ||
score->_scoreFont = ScoreFont::fontByName(score->style().value(Sid::MusicalSymbolFont).toString()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* SPDX-License-Identifier: GPL-3.0-only | ||
* MuseScore-CLA-applies | ||
* | ||
* MuseScore | ||
* Music Composition & Notation | ||
* | ||
* Copyright (C) 2021 MuseScore BVBA and others | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 3 as | ||
* published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
#include "writescorehook.h" | ||
|
||
#include "libmscore/score.h" | ||
#include "libmscore/xml.h" | ||
|
||
#include "config.h" | ||
|
||
using namespace mu::engraving::compat; | ||
|
||
void WriteScoreHook::onWriteStyle302(Ms::Score* score, Ms::XmlWriter& xml) | ||
{ | ||
bool isWriteStyle = false; | ||
//! NOTE Write the style to the score file if the compatibility define is set | ||
#ifdef ENGRAVING_COMPAT_WRITESTYLE_302 | ||
isWriteStyle = true; | ||
#endif | ||
|
||
//! NOTE If not the master score, because the Excerpts (parts) have not yet been write to separate files | ||
if (!score->isMaster()) { | ||
isWriteStyle = true; | ||
} | ||
|
||
//! NOTE If the test mode, because the tests have not yet been adapted to the new format | ||
if (Ms::MScore::testMode) { | ||
isWriteStyle = true; | ||
} | ||
|
||
if (score->isTopScore()) { // only top score (logic from 3.) | ||
if (isWriteStyle) { | ||
score->style().save(xml, true); // save only differences to buildin style (logic from 3.) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.