Clean up Excerpt class
This commit is contained in:
parent
2b650d6ff4
commit
1498216ee7
26 changed files with 228 additions and 313 deletions
|
@ -516,7 +516,7 @@ Ret BackendApi::doExportScoreParts(const notation::INotationPtr notation, Device
|
|||
QJsonArray partsTitles;
|
||||
|
||||
for (const Ms::Excerpt* excerpt : score->excerpts()) {
|
||||
Ms::Score* part = excerpt->partScore();
|
||||
Ms::Score* part = excerpt->excerptScore();
|
||||
QMap<QString, QString> partMetaTags = part->metaTags();
|
||||
|
||||
QJsonValue partTitle(part->title());
|
||||
|
|
|
@ -65,8 +65,8 @@ void WriteScoreHook::onWriteExcerpts302(Ms::Score* score, Ms::XmlWriter& xml, bo
|
|||
if (!selectionOnly) {
|
||||
Ms::MasterScore* mScore = static_cast<Ms::MasterScore*>(score);
|
||||
for (const Ms::Excerpt* excerpt : mScore->excerpts()) {
|
||||
if (excerpt->partScore() != score) {
|
||||
excerpt->partScore()->write(xml, selectionOnly, *this); // recursion write
|
||||
if (excerpt->excerptScore() != score) {
|
||||
excerpt->excerptScore()->write(xml, selectionOnly, *this); // recursion write
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1310,7 +1310,7 @@ void Score::cmdAddTimeSig(Measure* fm, int staffIdx, TimeSig* ts, bool local)
|
|||
nsig->setParent(seg);
|
||||
undoAddElement(nsig);
|
||||
if (score->excerpt()) {
|
||||
const int masterTrack = score->excerpt()->tracks().key(nsig->track());
|
||||
const int masterTrack = score->excerpt()->tracksMapping().key(nsig->track());
|
||||
TimeSig* masterTimeSig = masterTimeSigs[masterTrack];
|
||||
if (masterTimeSig) {
|
||||
undo(new Link(masterTimeSig, nsig));
|
||||
|
@ -4749,11 +4749,11 @@ static EngravingItem* findLinkedVoiceElement(EngravingItem* e, Staff* nstaff)
|
|||
int dtrack = nstaff->idx() * VOICES + e->voice();
|
||||
|
||||
if (se) {
|
||||
strack = se->tracks().key(strack);
|
||||
strack = se->tracksMapping().key(strack);
|
||||
}
|
||||
|
||||
if (de) {
|
||||
QList<int> l = de->tracks().values(strack);
|
||||
QList<int> l = de->tracksMapping().values(strack);
|
||||
if (l.isEmpty()) {
|
||||
// simply return the first linked element whose staff is equal to nstaff
|
||||
for (EngravingObject* ee : e->linkList()) {
|
||||
|
@ -4792,11 +4792,11 @@ static Chord* findLinkedChord(Chord* c, Staff* nstaff)
|
|||
int dtrack = nstaff->idx() * VOICES + c->voice();
|
||||
|
||||
if (se) {
|
||||
strack = se->tracks().key(strack);
|
||||
strack = se->tracksMapping().key(strack);
|
||||
}
|
||||
|
||||
if (de) {
|
||||
QList<int> l = de->tracks().values(strack);
|
||||
QList<int> l = de->tracksMapping().values(strack);
|
||||
if (l.isEmpty()) {
|
||||
// simply return the first linked chord whose staff is equal to nstaff
|
||||
for (EngravingObject* ee : c->linkList()) {
|
||||
|
@ -4901,7 +4901,7 @@ void Score::undoExchangeVoice(Measure* measure, int srcVoice, int dstVoice, int
|
|||
Excerpt* ex = st->score()->excerpt();
|
||||
|
||||
if (ex) {
|
||||
QMultiMap<int, int> tracks = ex->tracks();
|
||||
QMultiMap<int, int> tracks = ex->tracksMapping();
|
||||
QList<int> srcTrackList = tracks.values(srcTrack);
|
||||
QList<int> dstTrackList = tracks.values(dstTrack);
|
||||
|
||||
|
@ -5105,8 +5105,8 @@ void Score::undoAddElement(EngravingItem* element, bool ctrlModifier)
|
|||
int strack = -1;
|
||||
if (ostaff) {
|
||||
strack = ostaff->idx() * VOICES + element->track() % VOICES;
|
||||
if (ostaff->score()->excerpt() && !ostaff->score()->excerpt()->tracks().isEmpty() && strack > -1) {
|
||||
strack = ostaff->score()->excerpt()->tracks().key(strack, -1);
|
||||
if (ostaff->score()->excerpt() && !ostaff->score()->excerpt()->tracksMapping().isEmpty() && strack > -1) {
|
||||
strack = ostaff->score()->excerpt()->tracksMapping().key(strack, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5305,7 +5305,7 @@ void Score::undoAddElement(EngravingItem* element, bool ctrlModifier)
|
|||
int track = staff->idx() * VOICES + (strack % VOICES);
|
||||
tr.append(track);
|
||||
} else {
|
||||
QMultiMap<int, int> mapping = staff->score()->excerpt()->tracks();
|
||||
QMultiMap<int, int> mapping = staff->score()->excerpt()->tracksMapping();
|
||||
if (mapping.isEmpty()) {
|
||||
// This can happen during reading the score and there is
|
||||
// no Tracklist tag specified.
|
||||
|
@ -5676,8 +5676,8 @@ void Score::undoAddCR(ChordRest* cr, Measure* measure, const Fraction& tick)
|
|||
Staff* ostaff = cr->staff();
|
||||
int strack = ostaff->idx() * VOICES + cr->voice();
|
||||
|
||||
if (ostaff->score()->excerpt() && !ostaff->score()->excerpt()->tracks().isEmpty()) {
|
||||
strack = ostaff->score()->excerpt()->tracks().key(strack, -1);
|
||||
if (ostaff->score()->excerpt() && !ostaff->score()->excerpt()->tracksMapping().isEmpty()) {
|
||||
strack = ostaff->score()->excerpt()->tracksMapping().key(strack, -1);
|
||||
}
|
||||
|
||||
SegmentType segmentType = SegmentType::ChordRest;
|
||||
|
@ -5694,7 +5694,7 @@ void Score::undoAddCR(ChordRest* cr, Measure* measure, const Fraction& tick)
|
|||
int track = staff->idx() * VOICES + (strack % VOICES);
|
||||
tracks.append(track);
|
||||
} else {
|
||||
QMultiMap<int, int> mapping = staff->score()->excerpt()->tracks();
|
||||
QMultiMap<int, int> mapping = staff->score()->excerpt()->tracksMapping();
|
||||
if (mapping.isEmpty()) {
|
||||
// This can happen during reading the score and there is
|
||||
// no Tracklist tag specified.
|
||||
|
|
|
@ -27,15 +27,17 @@
|
|||
#include "style/style.h"
|
||||
#include "rw/xml.h"
|
||||
|
||||
#include "factory.h"
|
||||
#include "barline.h"
|
||||
#include "beam.h"
|
||||
#include "box.h"
|
||||
#include "bracketItem.h"
|
||||
#include "chord.h"
|
||||
#include "factory.h"
|
||||
#include "harmony.h"
|
||||
#include "layoutbreak.h"
|
||||
#include "linkedobjects.h"
|
||||
#include "lyrics.h"
|
||||
#include "masterscore.h"
|
||||
#include "measure.h"
|
||||
#include "note.h"
|
||||
#include "page.h"
|
||||
|
@ -58,41 +60,40 @@
|
|||
#include "tupletmap.h"
|
||||
#include "undo.h"
|
||||
#include "utils.h"
|
||||
#include "masterscore.h"
|
||||
#include "linkedobjects.h"
|
||||
|
||||
#include "log.h"
|
||||
|
||||
using namespace mu;
|
||||
using namespace mu::engraving;
|
||||
|
||||
namespace Ms {
|
||||
//---------------------------------------------------------
|
||||
// Excerpt
|
||||
//---------------------------------------------------------
|
||||
using namespace Ms;
|
||||
|
||||
Excerpt::Excerpt(const Excerpt& ex, bool copyPartScore)
|
||||
: QObject(), _oscore(ex._oscore), _title(ex._title), _parts(ex._parts), _tracks(ex._tracks)
|
||||
: m_masterScore(ex.m_masterScore), m_title(ex.m_title), m_parts(ex.m_parts), m_tracksMapping(ex.m_tracksMapping)
|
||||
{
|
||||
_partScore = (copyPartScore && ex._partScore) ? ex._partScore->clone() : nullptr;
|
||||
m_excerptScore = (copyPartScore && ex.m_excerptScore) ? ex.m_excerptScore->clone() : nullptr;
|
||||
|
||||
if (_partScore) {
|
||||
_partScore->setExcerpt(this);
|
||||
if (m_excerptScore) {
|
||||
m_excerptScore->setExcerpt(this);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// ~Excerpt
|
||||
//---------------------------------------------------------
|
||||
|
||||
Excerpt::~Excerpt()
|
||||
{
|
||||
delete _partScore;
|
||||
delete m_excerptScore;
|
||||
}
|
||||
|
||||
void Excerpt::setExcerptScore(Score* s)
|
||||
{
|
||||
m_excerptScore = s;
|
||||
|
||||
if (s) {
|
||||
s->setExcerpt(this);
|
||||
}
|
||||
}
|
||||
|
||||
bool Excerpt::containsPart(const Part* part) const
|
||||
{
|
||||
for (Part* _part : _parts) {
|
||||
for (Part* _part : m_parts) {
|
||||
if (_part == part) {
|
||||
return true;
|
||||
}
|
||||
|
@ -101,37 +102,6 @@ bool Excerpt::containsPart(const Part* part) const
|
|||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// nstaves
|
||||
//---------------------------------------------------------
|
||||
|
||||
int Excerpt::nstaves() const
|
||||
{
|
||||
int n { 0 };
|
||||
for (Part* p : _parts) {
|
||||
n += p->nstaves();
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
bool Excerpt::isEmpty() const
|
||||
{
|
||||
return partScore() ? partScore()->parts().empty() : true;
|
||||
}
|
||||
|
||||
void Excerpt::setTracks(const QMultiMap<int, int>& tracks)
|
||||
{
|
||||
_tracks = tracks;
|
||||
|
||||
for (Staff* staff : partScore()->staves()) {
|
||||
Staff* masterStaff = _oscore->staffById(staff->id());
|
||||
if (!masterStaff) {
|
||||
continue;
|
||||
}
|
||||
staff->updateVisibilityVoices(masterStaff);
|
||||
}
|
||||
}
|
||||
|
||||
void Excerpt::removePart(const ID& id)
|
||||
{
|
||||
int index = 0;
|
||||
|
@ -141,88 +111,45 @@ void Excerpt::removePart(const ID& id)
|
|||
}
|
||||
++index;
|
||||
}
|
||||
if (index >= _parts.size()) {
|
||||
if (index >= m_parts.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
partScore()->undoRemovePart(partScore()->parts().at(index));
|
||||
excerptScore()->undoRemovePart(excerptScore()->parts().at(index));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// read
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Excerpt::read(XmlReader& e)
|
||||
int Excerpt::nstaves() const
|
||||
{
|
||||
const QList<Part*>& pl = _oscore->parts();
|
||||
QString name;
|
||||
while (e.readNextStartElement()) {
|
||||
const QStringRef& tag = e.name();
|
||||
if (tag == "name") {
|
||||
name = e.readElementText();
|
||||
} else if (tag == "title") {
|
||||
_title = e.readElementText().trimmed();
|
||||
} else if (tag == "part") {
|
||||
int partIdx = e.readInt();
|
||||
if (partIdx < 0 || partIdx >= pl.size()) {
|
||||
qDebug("Excerpt::read: bad part index");
|
||||
} else {
|
||||
_parts.append(pl.at(partIdx));
|
||||
}
|
||||
int n { 0 };
|
||||
for (Part* p : m_parts) {
|
||||
n += p->nstaves();
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
bool Excerpt::isEmpty() const
|
||||
{
|
||||
return excerptScore() ? excerptScore()->parts().empty() : true;
|
||||
}
|
||||
|
||||
void Excerpt::setTracksMapping(const QMultiMap<int, int>& tracksMapping)
|
||||
{
|
||||
m_tracksMapping = tracksMapping;
|
||||
|
||||
for (Staff* staff : excerptScore()->staves()) {
|
||||
Staff* masterStaff = m_masterScore->staffById(staff->id());
|
||||
if (!masterStaff) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (_title.isEmpty()) {
|
||||
_title = name.trimmed();
|
||||
staff->updateVisibilityVoices(masterStaff);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// operator!=
|
||||
//---------------------------------------------------------
|
||||
|
||||
bool Excerpt::operator!=(const Excerpt& e) const
|
||||
{
|
||||
if (e._oscore != _oscore) {
|
||||
return true;
|
||||
}
|
||||
if (e._title != _title) {
|
||||
return true;
|
||||
}
|
||||
if (e._parts != _parts) {
|
||||
return true;
|
||||
}
|
||||
if (e._tracks != _tracks) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// operator==
|
||||
//---------------------------------------------------------
|
||||
|
||||
bool Excerpt::operator==(const Excerpt& e) const
|
||||
{
|
||||
if (e._oscore != _oscore) {
|
||||
return false;
|
||||
}
|
||||
if (e._title != _title) {
|
||||
return false;
|
||||
}
|
||||
if (e._parts != _parts) {
|
||||
return false;
|
||||
}
|
||||
if (e._tracks != _tracks) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Excerpt::updateTracks()
|
||||
void Excerpt::updateTracksMapping()
|
||||
{
|
||||
QMultiMap<int, int> tracks;
|
||||
for (Staff* staff : partScore()->staves()) {
|
||||
Staff* masterStaff = oscore()->staffById(staff->id());
|
||||
for (Staff* staff : excerptScore()->staves()) {
|
||||
Staff* masterStaff = masterScore()->staffById(staff->id());
|
||||
if (!masterStaff) {
|
||||
continue;
|
||||
}
|
||||
|
@ -238,7 +165,7 @@ void Excerpt::updateTracks()
|
|||
}
|
||||
}
|
||||
|
||||
setTracks(tracks);
|
||||
setTracksMapping(tracks);
|
||||
}
|
||||
|
||||
void Excerpt::setVoiceVisible(Staff* staff, int voiceIndex, bool visible)
|
||||
|
@ -249,7 +176,7 @@ void Excerpt::setVoiceVisible(Staff* staff, int voiceIndex, bool visible)
|
|||
return;
|
||||
}
|
||||
|
||||
Staff* masterStaff = oscore()->staffById(staff->id());
|
||||
Staff* masterStaff = masterScore()->staffById(staff->id());
|
||||
if (!masterStaff) {
|
||||
return;
|
||||
}
|
||||
|
@ -260,7 +187,7 @@ void Excerpt::setVoiceVisible(Staff* staff, int voiceIndex, bool visible)
|
|||
|
||||
// update tracks
|
||||
staff->setVoiceVisible(voiceIndex, visible);
|
||||
updateTracks();
|
||||
updateTracksMapping();
|
||||
|
||||
// clone staff
|
||||
Staff* staffCopy = Factory::createStaff(staff->part());
|
||||
|
@ -268,42 +195,71 @@ void Excerpt::setVoiceVisible(Staff* staff, int voiceIndex, bool visible)
|
|||
staffCopy->init(staff);
|
||||
|
||||
// remove current staff, insert cloned
|
||||
partScore()->undoRemoveStaff(staff);
|
||||
int partStaffIndex = staffIndex - partScore()->staffIdx(staff->part());
|
||||
partScore()->undoInsertStaff(staffCopy, partStaffIndex);
|
||||
excerptScore()->undoRemoveStaff(staff);
|
||||
int partStaffIndex = staffIndex - excerptScore()->staffIdx(staff->part());
|
||||
excerptScore()->undoInsertStaff(staffCopy, partStaffIndex);
|
||||
|
||||
// clone master staff to current with mapped tracks
|
||||
cloneStaff2(masterStaff, staffCopy, startTick, endTick);
|
||||
|
||||
// link master staff to cloned
|
||||
Staff* newStaff = partScore()->staffById(masterStaff->id());
|
||||
partScore()->undo(new Link(newStaff, masterStaff));
|
||||
Staff* newStaff = excerptScore()->staffById(masterStaff->id());
|
||||
excerptScore()->undo(new Link(newStaff, masterStaff));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// createExcerpt
|
||||
//---------------------------------------------------------
|
||||
void Excerpt::read(XmlReader& e)
|
||||
{
|
||||
const QList<Part*>& pl = m_masterScore->parts();
|
||||
while (e.readNextStartElement()) {
|
||||
const QStringRef& tag = e.name();
|
||||
if (tag == "name" && m_title.isEmpty()) {
|
||||
m_title = e.readElementText().trimmed();
|
||||
} else if (tag == "title") {
|
||||
m_title = e.readElementText().trimmed();
|
||||
} else if (tag == "part") {
|
||||
int partIdx = e.readInt();
|
||||
if (partIdx < 0 || partIdx >= pl.size()) {
|
||||
qDebug("Excerpt::read: bad part index");
|
||||
} else {
|
||||
m_parts.append(pl.at(partIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Excerpt::operator==(const Excerpt& other) const
|
||||
{
|
||||
return m_masterScore == other.m_masterScore
|
||||
&& m_title == other.m_title
|
||||
&& m_parts == other.m_parts
|
||||
&& m_tracksMapping == other.m_tracksMapping;
|
||||
}
|
||||
|
||||
bool Excerpt::operator!=(const Excerpt& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
void Excerpt::createExcerpt(Excerpt* excerpt)
|
||||
{
|
||||
MasterScore* oscore = excerpt->oscore();
|
||||
Score* score = excerpt->partScore();
|
||||
MasterScore* masterScore = excerpt->masterScore();
|
||||
Score* score = excerpt->excerptScore();
|
||||
|
||||
QList<Part*>& parts = excerpt->parts();
|
||||
QList<int> srcStaves;
|
||||
|
||||
// clone layer:
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
score->layerTags()[i] = oscore->layerTags()[i];
|
||||
score->layerTagComments()[i] = oscore->layerTagComments()[i];
|
||||
score->layerTags()[i] = masterScore->layerTags()[i];
|
||||
score->layerTagComments()[i] = masterScore->layerTagComments()[i];
|
||||
}
|
||||
score->setCurrentLayer(oscore->currentLayer());
|
||||
score->setCurrentLayer(masterScore->currentLayer());
|
||||
score->layer().clear();
|
||||
foreach (const Layer& l, oscore->layer()) {
|
||||
foreach (const Layer& l, masterScore->layer()) {
|
||||
score->layer().append(l);
|
||||
}
|
||||
|
||||
score->setPageNumberOffset(oscore->pageNumberOffset());
|
||||
score->setPageNumberOffset(masterScore->pageNumberOffset());
|
||||
|
||||
// Set instruments and create linked staves
|
||||
for (const Part* part : parts) {
|
||||
|
@ -328,19 +284,19 @@ void Excerpt::createExcerpt(Excerpt* excerpt)
|
|||
}
|
||||
|
||||
// Fill tracklist (map all tracks of a stave)
|
||||
if (excerpt->tracks().isEmpty()) {
|
||||
excerpt->updateTracks();
|
||||
if (excerpt->tracksMapping().isEmpty()) {
|
||||
excerpt->updateTracksMapping();
|
||||
}
|
||||
|
||||
cloneStaves(oscore, score, srcStaves, excerpt->tracks());
|
||||
cloneStaves(masterScore, score, srcStaves, excerpt->tracksMapping());
|
||||
|
||||
// create excerpt title and title frame for all scores if not already there
|
||||
MeasureBase* measure = oscore->first();
|
||||
MeasureBase* measure = masterScore->first();
|
||||
|
||||
if (!measure || !measure->isVBox()) {
|
||||
qDebug("original score has no header frame");
|
||||
oscore->insertMeasure(ElementType::VBOX, measure);
|
||||
measure = oscore->first();
|
||||
masterScore->insertMeasure(ElementType::VBOX, measure);
|
||||
measure = masterScore->first();
|
||||
}
|
||||
VBox* titleFrameScore = toVBox(measure);
|
||||
|
||||
|
@ -362,7 +318,7 @@ void Excerpt::createExcerpt(Excerpt* excerpt)
|
|||
score->doLayout();
|
||||
|
||||
// handle transposing instruments
|
||||
if (oscore->styleB(Sid::concertPitch) != score->styleB(Sid::concertPitch)) {
|
||||
if (masterScore->styleB(Sid::concertPitch) != score->styleB(Sid::concertPitch)) {
|
||||
for (const Staff* staff : score->staves()) {
|
||||
if (staff->staffType(Fraction(0, 1))->group() == StaffGroup::PERCUSSION) {
|
||||
continue;
|
||||
|
@ -374,7 +330,7 @@ void Excerpt::createExcerpt(Excerpt* excerpt)
|
|||
continue;
|
||||
}
|
||||
bool flip = false;
|
||||
if (oscore->styleB(Sid::concertPitch)) {
|
||||
if (masterScore->styleB(Sid::concertPitch)) {
|
||||
interval.flip(); // flip the transposition for the original instrument
|
||||
flip = true; // transposeKeys() will flip transposition for each instrument change
|
||||
}
|
||||
|
@ -395,7 +351,7 @@ void Excerpt::createExcerpt(Excerpt* excerpt)
|
|||
if (interval.isZero()) {
|
||||
continue;
|
||||
}
|
||||
if (oscore->styleB(Sid::concertPitch)) {
|
||||
if (masterScore->styleB(Sid::concertPitch)) {
|
||||
interval.flip();
|
||||
}
|
||||
|
||||
|
@ -423,28 +379,24 @@ void Excerpt::createExcerpt(Excerpt* excerpt)
|
|||
}
|
||||
|
||||
// update style values if spatium different for part
|
||||
if (oscore->spatium() != score->spatium()) {
|
||||
if (masterScore->spatium() != score->spatium()) {
|
||||
//score->spatiumChanged(oscore->spatium(), score->spatium());
|
||||
score->styleChanged();
|
||||
}
|
||||
|
||||
// second layout of score
|
||||
score->setPlaylistDirty();
|
||||
oscore->rebuildMidiMapping();
|
||||
oscore->updateChannel();
|
||||
masterScore->rebuildMidiMapping();
|
||||
masterScore->updateChannel();
|
||||
|
||||
score->setLayoutAll();
|
||||
score->doLayout();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// deleteExcerpt
|
||||
//---------------------------------------------------------
|
||||
|
||||
void MasterScore::deleteExcerpt(Excerpt* excerpt)
|
||||
{
|
||||
Q_ASSERT(excerpt->oscore() == this);
|
||||
Score* partScore = excerpt->partScore();
|
||||
Q_ASSERT(excerpt->masterScore() == this);
|
||||
Score* partScore = excerpt->excerptScore();
|
||||
|
||||
if (!partScore) {
|
||||
qDebug("deleteExcerpt: no partScore");
|
||||
|
@ -497,7 +449,7 @@ void MasterScore::deleteExcerpt(Excerpt* excerpt)
|
|||
void MasterScore::initAndAddExcerpt(Excerpt* excerpt, bool fakeUndo)
|
||||
{
|
||||
Score* score = new Score(masterScore());
|
||||
excerpt->setPartScore(score);
|
||||
excerpt->setExcerptScore(score);
|
||||
score->style().set(Sid::createMultiMeasureRests, true);
|
||||
auto excerptCmd = new AddExcerpt(excerpt);
|
||||
if (fakeUndo) {
|
||||
|
@ -510,13 +462,9 @@ void MasterScore::initAndAddExcerpt(Excerpt* excerpt, bool fakeUndo)
|
|||
|
||||
void MasterScore::initEmptyExcerpt(Excerpt* excerpt)
|
||||
{
|
||||
Excerpt::cloneMeasures(this, excerpt->partScore());
|
||||
Excerpt::cloneMeasures(this, excerpt->excerptScore());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// cloneSpanner
|
||||
//---------------------------------------------------------
|
||||
|
||||
static void cloneSpanner(Spanner* s, Score* score, int dstTrack, int dstTrack2)
|
||||
{
|
||||
// don’t clone voltas for track != 0
|
||||
|
@ -571,10 +519,6 @@ static void cloneSpanner(Spanner* s, Score* score, int dstTrack, int dstTrack2)
|
|||
score->undo(new AddElement(ns));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// cloneTuplets
|
||||
//---------------------------------------------------------
|
||||
|
||||
static void cloneTuplets(ChordRest* ocr, ChordRest* ncr, Tuplet* ot, TupletMap& tupletMap, Measure* m, int track)
|
||||
{
|
||||
ot->setTrack(ocr->track());
|
||||
|
@ -606,10 +550,6 @@ static void cloneTuplets(ChordRest* ocr, ChordRest* ncr, Tuplet* ot, TupletMap&
|
|||
ncr->setTuplet(nt);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// processLinkedClone
|
||||
//---------------------------------------------------------
|
||||
|
||||
static void processLinkedClone(EngravingItem* ne, Score* score, int strack)
|
||||
{
|
||||
// reset offset as most likely it will not fit
|
||||
|
@ -931,23 +871,24 @@ static Ms::MeasureBase* cloneMeasure(Ms::MeasureBase* mb, Ms::Score* score, cons
|
|||
return nmb;
|
||||
}
|
||||
|
||||
void Excerpt::cloneStaves(Score* oscore, Score* score, const QList<int>& sourceStavesIndexes, const QMultiMap<int, int>& trackList)
|
||||
void Excerpt::cloneStaves(Score* sourceScore, Score* destinationScore, const QList<int>& sourceStavesIndexes, const QMultiMap<int,
|
||||
int>& trackList)
|
||||
{
|
||||
MeasureBaseList* measures = score->measures();
|
||||
MeasureBaseList* measures = destinationScore->measures();
|
||||
TieMap tieMap;
|
||||
|
||||
for (MeasureBase* mb = oscore->measures()->first(); mb; mb = mb->next()) {
|
||||
MeasureBase* newMeasure = cloneMeasure(mb, score, oscore, sourceStavesIndexes, trackList, tieMap);
|
||||
for (MeasureBase* mb = sourceScore->measures()->first(); mb; mb = mb->next()) {
|
||||
MeasureBase* newMeasure = cloneMeasure(mb, destinationScore, sourceScore, sourceStavesIndexes, trackList, tieMap);
|
||||
measures->add(newMeasure);
|
||||
}
|
||||
|
||||
int n = sourceStavesIndexes.size();
|
||||
for (int dstStaffIdx = 0; dstStaffIdx < n; ++dstStaffIdx) {
|
||||
Staff* srcStaff = oscore->staff(sourceStavesIndexes[dstStaffIdx]);
|
||||
Staff* dstStaff = score->staff(dstStaffIdx);
|
||||
Staff* srcStaff = sourceScore->staff(sourceStavesIndexes[dstStaffIdx]);
|
||||
Staff* dstStaff = destinationScore->staff(dstStaffIdx);
|
||||
|
||||
Measure* m = oscore->firstMeasure();
|
||||
Measure* nm = score->firstMeasure();
|
||||
Measure* m = sourceScore->firstMeasure();
|
||||
Measure* nm = destinationScore->firstMeasure();
|
||||
|
||||
while (m && nm) {
|
||||
nm->setMeasureRepeatCount(m->measureRepeatCount(srcStaff->idx()), dstStaffIdx);
|
||||
|
@ -963,7 +904,7 @@ void Excerpt::cloneStaves(Score* oscore, Score* score, const QList<int>& sourceS
|
|||
// but it was somewhere within a barline span in the old score
|
||||
// so, find beginning of span
|
||||
for (int i = 0; i <= sIdx; ++i) {
|
||||
span = oscore->staff(i)->barLineSpan();
|
||||
span = sourceScore->staff(i)->barLineSpan();
|
||||
if (i + span > sIdx) {
|
||||
sIdx = i;
|
||||
break;
|
||||
|
@ -989,7 +930,7 @@ void Excerpt::cloneStaves(Score* oscore, Score* score, const QList<int>& sourceS
|
|||
}
|
||||
}
|
||||
|
||||
for (auto i : oscore->spanner()) {
|
||||
for (auto i : sourceScore->spanner()) {
|
||||
Spanner* s = i.second;
|
||||
int dstTrack = -1;
|
||||
int dstTrack2 = -1;
|
||||
|
@ -998,7 +939,7 @@ void Excerpt::cloneStaves(Score* oscore, Score* score, const QList<int>& sourceS
|
|||
//always export voltas to first staff in part
|
||||
dstTrack = 0;
|
||||
dstTrack2 = 0;
|
||||
cloneSpanner(s, score, dstTrack, dstTrack2);
|
||||
cloneSpanner(s, destinationScore, dstTrack, dstTrack2);
|
||||
} else if (s->isHairpin()) {
|
||||
//always export these spanners to first voice of the destination staff
|
||||
|
||||
|
@ -1009,7 +950,7 @@ void Excerpt::cloneStaves(Score* oscore, Score* score, const QList<int>& sourceS
|
|||
|
||||
for (int track : qAsConst(track1)) {
|
||||
if (!(track % VOICES)) {
|
||||
cloneSpanner(s, score, track, track);
|
||||
cloneSpanner(s, destinationScore, track, track);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1027,7 +968,7 @@ void Excerpt::cloneStaves(Score* oscore, Score* score, const QList<int>& sourceS
|
|||
for (int ii = 0; ii < track1.length(); ii++) {
|
||||
dstTrack = track1.at(ii);
|
||||
dstTrack2 = track2.at(ii);
|
||||
cloneSpanner(s, score, dstTrack, dstTrack2);
|
||||
cloneSpanner(s, destinationScore, dstTrack, dstTrack2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1044,11 +985,7 @@ void Excerpt::cloneMeasures(Score* oscore, Score* score)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// cloneStaff
|
||||
// staves are in same score
|
||||
//---------------------------------------------------------
|
||||
|
||||
//! NOTE For staves in the same score
|
||||
void Excerpt::cloneStaff(Staff* srcStaff, Staff* dstStaff)
|
||||
{
|
||||
Score* score = srcStaff->score();
|
||||
|
@ -1249,11 +1186,7 @@ void Excerpt::cloneStaff(Staff* srcStaff, Staff* dstStaff)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// cloneStaff2
|
||||
// staves are potentially in different scores
|
||||
//---------------------------------------------------------
|
||||
|
||||
//! NOTE For staves potentially in different scores
|
||||
void Excerpt::cloneStaff2(Staff* srcStaff, Staff* dstStaff, const Fraction& startTick, const Fraction& endTick)
|
||||
{
|
||||
Score* oscore = srcStaff->score();
|
||||
|
@ -1263,10 +1196,10 @@ void Excerpt::cloneStaff2(Staff* srcStaff, Staff* dstStaff, const Fraction& star
|
|||
Excerpt* ex = score->excerpt();
|
||||
QMultiMap<int, int> otracks, tracks;
|
||||
if (oex) {
|
||||
otracks = oex->tracks();
|
||||
otracks = oex->tracksMapping();
|
||||
}
|
||||
if (ex) {
|
||||
tracks = ex->tracks();
|
||||
tracks = ex->tracksMapping();
|
||||
}
|
||||
|
||||
Measure* m1 = oscore->tick2measure(startTick);
|
||||
|
@ -1460,7 +1393,7 @@ QList<Excerpt*> Excerpt::createExcerptsFromParts(const QList<Part*>& parts)
|
|||
excerpt->parts().append(part);
|
||||
|
||||
for (int i = part->startTrack(), j = 0; i < part->endTrack(); ++i, ++j) {
|
||||
excerpt->tracks().insert(i, j);
|
||||
excerpt->tracksMapping().insert(i, j);
|
||||
}
|
||||
|
||||
QString title = formatTitle(part->partName(), result);
|
||||
|
@ -1503,17 +1436,3 @@ QString Excerpt::formatTitle(const QString& partName, const QList<Excerpt*>& exc
|
|||
|
||||
return name;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// setPartScore
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Excerpt::setPartScore(Score* s)
|
||||
{
|
||||
_partScore = s;
|
||||
|
||||
if (s) {
|
||||
s->setExcerpt(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __EXCERPT_H__
|
||||
#define __EXCERPT_H__
|
||||
#ifndef MU_ENGRAVING_EXCERPT_H
|
||||
#define MU_ENGRAVING_EXCERPT_H
|
||||
|
||||
#include <QMultiMap>
|
||||
|
||||
|
@ -29,75 +29,70 @@
|
|||
#include "mscore.h"
|
||||
|
||||
namespace Ms {
|
||||
class EngravingItem;
|
||||
class MasterScore;
|
||||
class Score;
|
||||
class Part;
|
||||
class Measure;
|
||||
class XmlWriter;
|
||||
class Score;
|
||||
class Staff;
|
||||
class XmlReader;
|
||||
class EngravingItem;
|
||||
|
||||
//---------------------------------------------------------
|
||||
// @@ Excerpt
|
||||
//---------------------------------------------------------
|
||||
|
||||
class Excerpt : public QObject
|
||||
class Excerpt
|
||||
{
|
||||
MasterScore* _oscore;
|
||||
|
||||
Score* _partScore { 0 };
|
||||
QString _title;
|
||||
QList<Part*> _parts;
|
||||
QMultiMap<int, int> _tracks;
|
||||
|
||||
public:
|
||||
Excerpt(MasterScore* s = 0) { _oscore = s; }
|
||||
Excerpt(MasterScore* masterScore = nullptr) { m_masterScore = masterScore; }
|
||||
Excerpt(const Excerpt& ex, bool copyPartScore = true);
|
||||
|
||||
~Excerpt();
|
||||
|
||||
QList<Part*>& parts() { return _parts; }
|
||||
const QList<Part*>& parts() const { return _parts; }
|
||||
MasterScore* masterScore() const { return m_masterScore; }
|
||||
Score* excerptScore() const { return m_excerptScore; }
|
||||
void setExcerptScore(Score* s);
|
||||
|
||||
QString title() const { return m_title; }
|
||||
void setTitle(const QString& title) { m_title = title; }
|
||||
|
||||
QList<Part*>& parts() { return m_parts; }
|
||||
const QList<Part*>& parts() const { return m_parts; }
|
||||
void setParts(const QList<Part*>& parts) { m_parts = parts; }
|
||||
|
||||
bool containsPart(const Part* part) const;
|
||||
|
||||
void removePart(const ID& id);
|
||||
|
||||
void setParts(const QList<Part*>& p) { _parts = p; }
|
||||
|
||||
int nstaves() const;
|
||||
bool isEmpty() const;
|
||||
|
||||
QMultiMap<int, int>& tracks() { return _tracks; }
|
||||
void setTracks(const QMultiMap<int, int>& tracks);
|
||||
QMultiMap<int, int>& tracksMapping() { return m_tracksMapping; }
|
||||
void setTracksMapping(const QMultiMap<int, int>& tracksMapping);
|
||||
|
||||
MasterScore* oscore() const { return _oscore; }
|
||||
Score* partScore() const { return _partScore; }
|
||||
void setPartScore(Score* s);
|
||||
void updateTracksMapping();
|
||||
|
||||
void setVoiceVisible(Staff* staff, int voiceIndex, bool visible);
|
||||
|
||||
void read(XmlReader&);
|
||||
|
||||
bool operator!=(const Excerpt&) const;
|
||||
bool operator==(const Excerpt&) const;
|
||||
|
||||
QString title() const { return _title; }
|
||||
void setTitle(const QString& s) { _title = s; }
|
||||
|
||||
void updateTracks();
|
||||
|
||||
void setVoiceVisible(Staff* staff, int voiceIndex, bool visible);
|
||||
bool operator==(const Excerpt& other) const;
|
||||
bool operator!=(const Excerpt& other) const;
|
||||
|
||||
static QList<Excerpt*> createExcerptsFromParts(const QList<Part*>& parts);
|
||||
static Excerpt* createExcerptFromPart(Part* part);
|
||||
|
||||
static void createExcerpt(Excerpt*);
|
||||
static void cloneStaves(Score* oscore, Score* score, const QList<int>& sourceStavesIndexes, const QMultiMap<int, int>& allTracks);
|
||||
static void cloneStaves(Score* sourceScore, Score* destinationScore, const QList<int>& sourceStavesIndexes, const QMultiMap<int,
|
||||
int>& allTracks);
|
||||
static void cloneMeasures(Score* oscore, Score* score);
|
||||
static void cloneStaff(Staff* ostaff, Staff* nstaff);
|
||||
static void cloneStaff2(Staff* ostaff, Staff* nstaff, const Fraction& startTick, const Fraction& endTick);
|
||||
|
||||
private:
|
||||
static QString formatTitle(const QString& partName, const QList<Excerpt*>&);
|
||||
|
||||
MasterScore* m_masterScore = nullptr;
|
||||
Score* m_excerptScore = nullptr;
|
||||
QString m_title;
|
||||
QList<Part*> m_parts;
|
||||
QMultiMap<int, int> m_tracksMapping;
|
||||
};
|
||||
} // namespace Ms
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // MU_ENGRAVING_EXCERPT_H
|
||||
|
|
|
@ -247,7 +247,7 @@ bool MasterScore::writeMscz(MscWriter& mscWriter, bool onlySelection, bool doCre
|
|||
{
|
||||
if (!onlySelection) {
|
||||
for (const Excerpt* excerpt : qAsConst(this->excerpts())) {
|
||||
Score* partScore = excerpt->partScore();
|
||||
Score* partScore = excerpt->excerptScore();
|
||||
if (partScore != this) {
|
||||
// Write excerpt style
|
||||
{
|
||||
|
@ -266,7 +266,7 @@ bool MasterScore::writeMscz(MscWriter& mscWriter, bool onlySelection, bool doCre
|
|||
excerptBuf.open(QIODevice::ReadWrite);
|
||||
|
||||
compat::WriteScoreHook hook;
|
||||
excerpt->partScore()->writeScore(&excerptBuf, false, onlySelection, hook, ctx);
|
||||
excerpt->excerptScore()->writeScore(&excerptBuf, false, onlySelection, hook, ctx);
|
||||
|
||||
mscWriter.addExcerptFile(excerpt->title(), excerptData);
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ bool MasterScore::exportPart(mu::engraving::MscWriter& mscWriter, Score* partSco
|
|||
|
||||
void MasterScore::addExcerpt(Excerpt* ex, int index)
|
||||
{
|
||||
Score* score = ex->partScore();
|
||||
Score* score = ex->excerptScore();
|
||||
|
||||
int nstaves { 1 }; // Initialise to 1 to force writing of the first part.
|
||||
QList<ID> assignedStavesIds;
|
||||
|
@ -407,8 +407,8 @@ void MasterScore::addExcerpt(Excerpt* ex, int index)
|
|||
}
|
||||
}
|
||||
|
||||
if (ex->tracks().isEmpty()) { // SHOULDN'T HAPPEN, protected in the UI, but it happens during read-in!!!
|
||||
ex->updateTracks();
|
||||
if (ex->tracksMapping().isEmpty()) { // SHOULDN'T HAPPEN, protected in the UI, but it happens during read-in!!!
|
||||
ex->updateTracksMapping();
|
||||
}
|
||||
|
||||
excerpts().insert(index < 0 ? excerpts().size() : index, ex);
|
||||
|
|
|
@ -154,7 +154,7 @@ int MasterScore::getNextFreeDrumMidiMapping()
|
|||
void MasterScore::rebuildExcerptsMidiMapping()
|
||||
{
|
||||
for (Excerpt* ex : excerpts()) {
|
||||
for (Part* p : ex->partScore()->parts()) {
|
||||
for (Part* p : ex->excerptScore()->parts()) {
|
||||
const Part* masterPart = p->masterPart();
|
||||
if (!masterPart->score()->isMaster()) {
|
||||
qWarning() << "rebuildExcerptsMidiMapping: no part in master score is linked with " << p->partName();
|
||||
|
|
|
@ -368,7 +368,8 @@ void Score::putNote(const Position& p, bool replace)
|
|||
_is.setTrack(p.staffIdx * VOICES + _is.voice());
|
||||
_is.setSegment(s);
|
||||
|
||||
if (score()->excerpt() && !score()->excerpt()->tracks().isEmpty() && score()->excerpt()->tracks().key(_is.track(), -1) == -1) {
|
||||
if (score()->excerpt() && !score()->excerpt()->tracksMapping().isEmpty()
|
||||
&& score()->excerpt()->tracksMapping().key(_is.track(), -1) == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -435,14 +435,14 @@ Score* Score::clone()
|
|||
excerpt->parts().append(part);
|
||||
|
||||
for (int track = part->startTrack(); track < part->endTrack(); ++track) {
|
||||
excerpt->tracks().insert(track, track);
|
||||
excerpt->tracksMapping().insert(track, track);
|
||||
}
|
||||
}
|
||||
|
||||
masterScore()->initAndAddExcerpt(excerpt, true);
|
||||
masterScore()->removeExcerpt(excerpt);
|
||||
|
||||
return excerpt->partScore();
|
||||
return excerpt->excerptScore();
|
||||
}
|
||||
|
||||
Score* Score::paletteScore()
|
||||
|
@ -2891,7 +2891,7 @@ void Score::sortStaves(QList<int>& dst)
|
|||
void Score::mapExcerptTracks(QList<int>& dst)
|
||||
{
|
||||
for (Excerpt* e : masterScore()->excerpts()) {
|
||||
QMultiMap<int, int> tr = e->tracks();
|
||||
QMultiMap<int, int> tr = e->tracksMapping();
|
||||
QMultiMap<int, int> tracks;
|
||||
for (QMap<int, int>::iterator it = tr.begin(); it != tr.end(); ++it) {
|
||||
int prvStaffIdx = it.key() / VOICES;
|
||||
|
@ -2899,7 +2899,7 @@ void Score::mapExcerptTracks(QList<int>& dst)
|
|||
int offset = (curStaffIdx - prvStaffIdx) * VOICES;
|
||||
tracks.insert(it.key() + offset, it.value());
|
||||
}
|
||||
e->tracks() = tracks;
|
||||
e->tracksMapping() = tracks;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4067,8 +4067,8 @@ QList<Score*> Score::scoreList()
|
|||
MasterScore* root = masterScore();
|
||||
scores.append(root);
|
||||
for (const Excerpt* ex : root->excerpts()) {
|
||||
if (ex->partScore()) {
|
||||
scores.append(ex->partScore());
|
||||
if (ex->excerptScore()) {
|
||||
scores.append(ex->excerptScore());
|
||||
}
|
||||
}
|
||||
return scores;
|
||||
|
@ -4939,7 +4939,7 @@ void Score::changeSelectedNotesVoice(int voice)
|
|||
ChordRest* dstCR = toChordRest(s->element(dstTrack));
|
||||
Chord* dstChord = nullptr;
|
||||
|
||||
if (excerpt() && excerpt()->tracks().key(dstTrack, -1) == -1) {
|
||||
if (excerpt() && excerpt()->tracksMapping().key(dstTrack, -1) == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ void Score::write(XmlWriter& xml, bool selectionOnly, compat::WriteScoreHook& ho
|
|||
|
||||
if (excerpt()) {
|
||||
Excerpt* e = excerpt();
|
||||
QMultiMap<int, int> trackList = e->tracks();
|
||||
QMultiMap<int, int> trackList = e->tracksMapping();
|
||||
QMapIterator<int, int> i(trackList);
|
||||
if (!(trackList.size() == e->nstaves() * VOICES) && !trackList.isEmpty()) {
|
||||
while (i.hasNext()) {
|
||||
|
|
|
@ -341,7 +341,7 @@ void Staff::updateVisibilityVoices(Staff* masterStaff)
|
|||
return;
|
||||
}
|
||||
|
||||
auto tracks = score()->excerpt()->tracks();
|
||||
auto tracks = score()->excerpt()->tracksMapping();
|
||||
if (tracks.empty()) {
|
||||
_visibilityVoices = { true, true, true, true };
|
||||
return;
|
||||
|
|
|
@ -2159,7 +2159,7 @@ void InsertRemoveMeasures::removeMeasures()
|
|||
|
||||
void AddExcerpt::undo(EditData*)
|
||||
{
|
||||
excerpt->oscore()->removeExcerpt(excerpt);
|
||||
excerpt->masterScore()->removeExcerpt(excerpt);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -2168,7 +2168,7 @@ void AddExcerpt::undo(EditData*)
|
|||
|
||||
void AddExcerpt::redo(EditData*)
|
||||
{
|
||||
excerpt->oscore()->addExcerpt(excerpt);
|
||||
excerpt->masterScore()->addExcerpt(excerpt);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -2178,7 +2178,7 @@ void AddExcerpt::redo(EditData*)
|
|||
RemoveExcerpt::RemoveExcerpt(Excerpt* ex)
|
||||
: excerpt(ex)
|
||||
{
|
||||
index = excerpt->oscore()->excerpts().indexOf(excerpt);
|
||||
index = excerpt->masterScore()->excerpts().indexOf(excerpt);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -2187,7 +2187,7 @@ RemoveExcerpt::RemoveExcerpt(Excerpt* ex)
|
|||
|
||||
void RemoveExcerpt::undo(EditData*)
|
||||
{
|
||||
excerpt->oscore()->addExcerpt(excerpt, index);
|
||||
excerpt->masterScore()->addExcerpt(excerpt, index);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -2196,7 +2196,7 @@ void RemoveExcerpt::undo(EditData*)
|
|||
|
||||
void RemoveExcerpt::redo(EditData*)
|
||||
{
|
||||
excerpt->oscore()->removeExcerpt(excerpt);
|
||||
excerpt->masterScore()->removeExcerpt(excerpt);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -2218,7 +2218,7 @@ void ChangeExcerptTitle::flip(EditData*)
|
|||
QString s = title;
|
||||
title = excerpt->title();
|
||||
excerpt->setTitle(s);
|
||||
excerpt->oscore()->setExcerptsChanged(true);
|
||||
excerpt->masterScore()->setExcerptsChanged(true);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -130,8 +130,8 @@ static void createExcerpts(MasterScore* cs, QList<Excerpt*> excerpts)
|
|||
{
|
||||
// borrowed from musescore.cpp endsWith(".pdf")
|
||||
for (Excerpt* e: excerpts) {
|
||||
Score* nscore = e->oscore()->createScore();
|
||||
e->setPartScore(nscore);
|
||||
Score* nscore = e->masterScore()->createScore();
|
||||
e->setExcerptScore(nscore);
|
||||
nscore->style().set(Sid::createMultiMeasureRests, true);
|
||||
cs->startCmd();
|
||||
cs->undo(new AddExcerpt(e));
|
||||
|
@ -139,8 +139,8 @@ static void createExcerpts(MasterScore* cs, QList<Excerpt*> excerpts)
|
|||
|
||||
// borrowed from excerptsdialog.cpp
|
||||
// a new excerpt is created in AddExcerpt, make sure the parts are filed
|
||||
for (Excerpt* ee : e->oscore()->excerpts()) {
|
||||
if (ee->partScore() == nscore && ee != e) {
|
||||
for (Excerpt* ee : e->masterScore()->excerpts()) {
|
||||
if (ee->excerptScore() == nscore && ee != e) {
|
||||
ee->parts().clear();
|
||||
ee->parts().append(e->parts());
|
||||
}
|
||||
|
|
|
@ -3115,7 +3115,7 @@ Score::FileError Read114::read114(MasterScore* masterScore, XmlReader& e, ReadCo
|
|||
masterScore->_excerpts.push_back(excerpt);
|
||||
Score* nscore = masterScore->createScore();
|
||||
ReadStyleHook::setupDefaultStyle(nscore);
|
||||
excerpt->setPartScore(nscore);
|
||||
excerpt->setExcerptScore(nscore);
|
||||
nscore->style().set(Sid::createMultiMeasureRests, true);
|
||||
Excerpt::createExcerpt(excerpt);
|
||||
}
|
||||
|
|
|
@ -3323,11 +3323,11 @@ bool Read206::readScore206(Score* score, XmlReader& e, ReadContext& ctx)
|
|||
ReadStyleHook::setupDefaultStyle(s);
|
||||
Excerpt* ex = new Excerpt(m);
|
||||
|
||||
ex->setPartScore(s);
|
||||
ex->setExcerptScore(s);
|
||||
e.setLastMeasure(nullptr);
|
||||
ReadContext exCtx(s);
|
||||
readScore206(s, e, exCtx);
|
||||
ex->setTracks(e.tracks());
|
||||
ex->setTracksMapping(e.tracks());
|
||||
m->addExcerpt(ex);
|
||||
}
|
||||
} else if (tag == "PageList") {
|
||||
|
|
|
@ -190,14 +190,14 @@ bool Read302::readScore302(Ms::Score* score, XmlReader& e, ReadContext& ctx)
|
|||
ReadStyleHook::setupDefaultStyle(s);
|
||||
|
||||
Excerpt* ex = new Excerpt(m);
|
||||
ex->setPartScore(s);
|
||||
ex->setExcerptScore(s);
|
||||
e.setLastMeasure(nullptr);
|
||||
|
||||
ReadContext exCtx(s);
|
||||
readScore302(s, e, exCtx);
|
||||
|
||||
s->linkMeasures(m);
|
||||
ex->setTracks(e.tracks());
|
||||
ex->setTracksMapping(e.tracks());
|
||||
m->addExcerpt(ex);
|
||||
}
|
||||
} else if (tag == "name") {
|
||||
|
|
|
@ -104,7 +104,7 @@ Err ScoreReader::loadMscz(Ms::MasterScore* masterScore, const mu::engraving::Msc
|
|||
compat::ReadStyleHook::setupDefaultStyle(partScore);
|
||||
|
||||
Excerpt* ex = new Excerpt(masterScore);
|
||||
ex->setPartScore(partScore);
|
||||
ex->setExcerptScore(partScore);
|
||||
|
||||
QByteArray excerptStyleData = mscReader.readExcerptStyleFile(excerptName);
|
||||
QBuffer excerptStyleBuf(&excerptStyleData);
|
||||
|
@ -123,7 +123,7 @@ Err ScoreReader::loadMscz(Ms::MasterScore* masterScore, const mu::engraving::Msc
|
|||
Read400::read400(partScore, xml, ctx);
|
||||
|
||||
partScore->linkMeasures(masterScore);
|
||||
ex->setTracks(xml.tracks());
|
||||
ex->setTracksMapping(xml.tracks());
|
||||
|
||||
ex->setTitle(excerptName);
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ TEST_F(ChordSymbolTests, testNoSystem)
|
|||
Score* nscore = score->createScore();
|
||||
|
||||
Excerpt* ex = new Excerpt(score);
|
||||
ex->setPartScore(nscore);
|
||||
ex->setExcerptScore(nscore);
|
||||
nscore->setExcerpt(ex);
|
||||
score->excerpts().append(ex);
|
||||
ex->setTitle(parts.front()->longName());
|
||||
|
@ -183,7 +183,7 @@ TEST_F(ChordSymbolTests, testNoSystem)
|
|||
nscore = score->createScore();
|
||||
|
||||
ex = new Excerpt(score);
|
||||
ex->setPartScore(nscore);
|
||||
ex->setExcerptScore(nscore);
|
||||
nscore->setExcerpt(ex);
|
||||
score->excerpts().append(ex);
|
||||
ex->setTitle(parts.front()->longName());
|
||||
|
|
|
@ -101,7 +101,7 @@ TEST_F(RemoveTests, removeStaff)
|
|||
|
||||
EXPECT_FALSE(staffHasElements(score, 1));
|
||||
for (Excerpt* ex : score->excerpts()) {
|
||||
Score* s = ex->partScore();
|
||||
Score* s = ex->excerptScore();
|
||||
EXPECT_TRUE(staffHasElements(s, 1));
|
||||
}
|
||||
|
||||
|
|
|
@ -1314,8 +1314,8 @@ Score::FileError PowerTab::read()
|
|||
}
|
||||
|
||||
Excerpt* excerpt = new Excerpt(score);
|
||||
excerpt->setTracks(tracks);
|
||||
excerpt->setPartScore(pscore);
|
||||
excerpt->setTracksMapping(tracks);
|
||||
excerpt->setExcerptScore(pscore);
|
||||
//title?
|
||||
excerpt->setTitle(part->instrument()->longNames()[0].name());
|
||||
pscore->setExcerpt(excerpt);
|
||||
|
|
|
@ -40,7 +40,7 @@ ExcerptNotation::~ExcerptNotation()
|
|||
return;
|
||||
}
|
||||
|
||||
Ms::MasterScore* master = m_excerpt->oscore();
|
||||
Ms::MasterScore* master = m_excerpt->masterScore();
|
||||
if (master) {
|
||||
master->deleteExcerpt(m_excerpt);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ void ExcerptNotation::setIsCreated(bool created)
|
|||
return;
|
||||
}
|
||||
|
||||
setScore(m_excerpt->partScore());
|
||||
setScore(m_excerpt->excerptScore());
|
||||
setTitle(m_title);
|
||||
|
||||
if (isEmpty()) {
|
||||
|
@ -76,11 +76,11 @@ void ExcerptNotation::fillWithDefaultInfo()
|
|||
{
|
||||
TRACEFUNC;
|
||||
|
||||
IF_ASSERT_FAILED(m_excerpt || m_excerpt->partScore()) {
|
||||
IF_ASSERT_FAILED(m_excerpt || m_excerpt->excerptScore()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ms::Score* excerptScore = m_excerpt->partScore();
|
||||
Ms::Score* excerptScore = m_excerpt->excerptScore();
|
||||
|
||||
auto setText = [&excerptScore](TextStyleType textType, const QString& text) {
|
||||
TextBase* textBox = excerptScore->getText(textType);
|
||||
|
|
|
@ -1042,7 +1042,7 @@ void NotationParts::updateTracks()
|
|||
return;
|
||||
}
|
||||
|
||||
score()->excerpt()->updateTracks();
|
||||
score()->excerpt()->updateTracksMapping();
|
||||
}
|
||||
|
||||
int NotationParts::resolveNewInstrumentNumber(const InstrumentTemplate& instrument,
|
||||
|
|
|
@ -80,8 +80,8 @@ void NotationStyle::applyToAllParts()
|
|||
Ms::MStyle style = m_getScore->score()->style();
|
||||
|
||||
for (Ms::Excerpt* excerpt : m_getScore->score()->masterScore()->excerpts()) {
|
||||
excerpt->partScore()->undo(new Ms::ChangeStyle(excerpt->partScore(), style));
|
||||
excerpt->partScore()->update();
|
||||
excerpt->excerptScore()->undo(new Ms::ChangeStyle(excerpt->excerptScore(), style));
|
||||
excerpt->excerptScore()->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -327,7 +327,7 @@ void PageSettings::applyToAllParts()
|
|||
return;
|
||||
}
|
||||
for (Excerpt* e : score()->masterScore()->excerpts()) {
|
||||
applyToScore(e->partScore());
|
||||
applyToScore(e->excerptScore());
|
||||
}
|
||||
_changeFlag = false;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace PluginAPI {
|
|||
|
||||
Score* Excerpt::partScore()
|
||||
{
|
||||
return wrap<Score>(e->partScore(), Ownership::SCORE);
|
||||
return wrap<Score>(e->excerptScore(), Ownership::SCORE);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -159,7 +159,7 @@ Ret ProjectMigrator::migrateProject(engraving::EngravingProjectPtr project, cons
|
|||
bool ProjectMigrator::applyLelandStyle(Ms::MasterScore* score)
|
||||
{
|
||||
for (Ms::Excerpt* excerpt : score->excerpts()) {
|
||||
if (!excerpt->partScore()->loadStyle(LELAND_STYLE_PATH, /*ign*/ false, /*overlap*/ true)) {
|
||||
if (!excerpt->excerptScore()->loadStyle(LELAND_STYLE_PATH, /*ign*/ false, /*overlap*/ true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ bool ProjectMigrator::applyLelandStyle(Ms::MasterScore* score)
|
|||
bool ProjectMigrator::applyEdwinStyle(Ms::MasterScore* score)
|
||||
{
|
||||
for (Ms::Excerpt* excerpt : score->excerpts()) {
|
||||
if (!excerpt->partScore()->loadStyle(EDWIN_STYLE_PATH, /*ign*/ false, /*overlap*/ true)) {
|
||||
if (!excerpt->excerptScore()->loadStyle(EDWIN_STYLE_PATH, /*ign*/ false, /*overlap*/ true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue