misc. layout fixes

This commit is contained in:
Werner Schweer 2017-03-14 17:00:38 +01:00
parent e559a34e58
commit d9ff5a26f6
29 changed files with 290 additions and 186 deletions

View file

@ -2474,5 +2474,22 @@ StyleIdx Beam::getPropertyStyle(P_ID id) const
return StyleIdx::NOSTYLE;
}
//---------------------------------------------------------
// tick
//---------------------------------------------------------
int Beam::tick() const
{
return _elements.empty() ? 0 : _elements.front()->tick();
}
//---------------------------------------------------------
// rtick
//---------------------------------------------------------
int Beam::rtick() const
{
return _elements.empty() ? 0 : _elements.front()->rtick();
}
}

View file

@ -90,6 +90,9 @@ class Beam : public Element {
virtual void updateGrips(Grip*, QVector<QRectF>&) const override;
virtual int grips() const override { return 2; }
virtual int tick() const override;
virtual int rtick() const override;
virtual void write(XmlWriter& xml) const override;
virtual void read(XmlReader&) override;
virtual void spatiumChanged(qreal /*oldValue*/, qreal /*newValue*/) override;

View file

@ -1050,8 +1050,9 @@ void ChordRest::removeDeleteBeam(bool beamed)
if (b->empty())
score()->undoRemoveElement(b);
}
if (!beamed && isChord())
toChord(this)->layoutStem();
// no systems at this point in layout:
// if (!beamed && isChord())
// toChord(this)->layoutStem();
}
//---------------------------------------------------------

View file

@ -2441,39 +2441,6 @@ void Score::nextInputPos(ChordRest* cr, bool doSelect)
}
}
//---------------------------------------------------------
// searchMeasureBase
// search corresponding measure in linked score
//---------------------------------------------------------
static MeasureBase* searchMeasureBase(Score* score, MeasureBase* mb)
{
if (mb == 0)
return 0;
if (mb->isMeasure()) {
for (Measure* m = score->firstMeasure(); m; m = m->nextMeasure()) {
if (m->tick() == mb->tick())
return m;
}
}
else {
if (!mb->links()) {
if (mb->score() == score)
return mb;
else
qDebug("searchMeasureBase: no links");
}
else {
for (ScoreElement* m : *mb->links()) {
if (m->score() == score)
return static_cast<MeasureBase*>(m);
}
}
}
qDebug("searchMeasureBase: measure not found");
return nullptr;
}
//---------------------------------------------------------
// insertMeasure
// Create a new MeasureBase of type type and insert
@ -2481,10 +2448,9 @@ static MeasureBase* searchMeasureBase(Score* score, MeasureBase* mb)
// If measure is zero, append new MeasureBase.
//---------------------------------------------------------
MeasureBase* Score::insertMeasure(ElementType type, MeasureBase* measure, bool createEmptyMeasures)
void Score::insertMeasure(ElementType type, MeasureBase* measure, bool createEmptyMeasures)
{
int tick;
int ticks = 0;
if (measure) {
if (measure->isMeasure() && toMeasure(measure)->isMMRest()) {
measure = toMeasure(measure)->prev();
@ -2496,35 +2462,52 @@ MeasureBase* Score::insertMeasure(ElementType type, MeasureBase* measure, bool c
else
tick = last() ? last()->endTick() : 0;
// use nominal time signature of current measure
Fraction f = sigmap()->timesig(tick).nominal();
Fraction f = sigmap()->timesig(tick).nominal(); // use nominal time signature of current measure
Measure* om = 0; // measure base in "this" score
MeasureBase* rmb = 0; // measure base in root score (for linking)
int ticks = 0;
QList<pair<Score*, MeasureBase*>> ml;
for (Score* score : scoreList())
ml.append(pair<Score*, MeasureBase*>(score, searchMeasureBase(score, measure)));
MeasureBase* omb = 0; // measure base in "this" score
MeasureBase* rmb = 0; // measure base in root score (for linking)
for (pair<Score*, MeasureBase*> p : ml) {
Score* score = p.first;
MeasureBase* im = p.second;
MeasureBase* mb = static_cast<MeasureBase*>(Element::create(type, score));
for (Score* score : scoreList()) {
MeasureBase* im = 0;
if (measure) {
if (measure->isMeasure())
im = score->tick2measure(tick);
else {
if (!measure->links()) {
if (measure->score() == score)
im = measure;
else
qDebug("no links");
}
else {
for (ScoreElement* m : *measure->links()) {
if (measure->score() == score) {
im = toMeasureBase(m);
break;
}
}
}
}
if (!im)
qDebug("measure not found");
}
MeasureBase* mb = toMeasureBase(Element::create(type, score));
mb->setTick(tick);
if (score == this)
omb = mb;
mb->setNext(im);
mb->setPrev(im ? im->prev() : score->last());
undo(new InsertMeasures(mb, mb));
if (type == ElementType::MEASURE) {
if (isMaster())
omb = toMeasure(mb);
Measure* m = toMeasure(mb); // new measure
ticks = m->ticks();
Measure* mi = toMeasure(im); // insert before
Measure* m = toMeasure(mb);
Measure* mi = im ? score->tick2measure(im->tick()) : 0;
if (score->isMaster())
om = m;
m->setTimesig(f);
m->setLen(f);
ticks = m->ticks();
QList<TimeSig*> tsl;
QList<KeySig*> ksl;
@ -2549,7 +2532,9 @@ MeasureBase* Score::insertMeasure(ElementType type, MeasureBase* measure, bool c
}
}
}
for (Segment* s = mi->first(); s && s->tick() == tick; s = s->next()) {
for (Segment* s = mi->first(); s && s->rtick() == 0; s = s->next()) {
if (s->isHeaderClefType())
continue;
Element* e = s->element(staffIdx * VOICES);
if (!e)
continue;
@ -2578,28 +2563,25 @@ MeasureBase* Score::insertMeasure(ElementType type, MeasureBase* measure, bool c
}
}
m->setNext(im);
m->setPrev(im ? im->prev() : score->last());
undo(new InsertMeasures(m, m));
//
// move clef, time, key signatrues
//
for (TimeSig* ts : tsl) {
TimeSig* nts = new TimeSig(*ts);
Segment* s = m->undoGetSegment(SegmentType::TimeSig, tick);
Segment* s = m->undoGetSegmentR(SegmentType::TimeSig, 0);
nts->setParent(s);
undoAddElement(nts);
}
for (KeySig* ks : ksl) {
KeySig* nks = new KeySig(*ks);
Segment* s = m->undoGetSegment(SegmentType::KeySig, tick);
Segment* s = m->undoGetSegmentR(SegmentType::KeySig, 0);
nks->setParent(s);
undoAddElement(nks);
}
for (Clef* clef : cl) {
Clef* nClef = new Clef(*clef);
Segment* s = m->undoGetSegment(SegmentType::Clef, tick);
Segment* s = m->undoGetSegmentR(SegmentType::Clef, 0);
nClef->setParent(s);
undoAddElement(nClef);
}
@ -2610,8 +2592,6 @@ MeasureBase* Score::insertMeasure(ElementType type, MeasureBase* measure, bool c
nClef->setParent(s);
undoAddElement(nClef);
}
// if (createEndBar)
// m->setEndBarLineType(BarLineType::END, false);
}
else {
// a frame, not a measure
@ -2622,38 +2602,28 @@ MeasureBase* Score::insertMeasure(ElementType type, MeasureBase* measure, bool c
if (rmb->isTBox())
toTBox(mb)->text()->linkTo(toTBox(rmb)->text());
}
mb->setNext(im);
mb->setPrev(im ? im->prev() : score->last());
undo(new InsertMeasures(mb, mb));
}
}
undoInsertTime(tick, ticks);
if (omb && type == ElementType::MEASURE && !createEmptyMeasures) {
if (om && !createEmptyMeasures) {
//
// fill measure with rest
//
Score* _root = masterScore();
MeasureBase* rootMeasure = searchMeasureBase(_root, omb);
Score* score = om->score();
Q_ASSERT(_root == rootMeasure->score());
for (int staffIdx = 0; staffIdx < _root->nstaves(); ++staffIdx) {
// add rest to all staves and to all the staves linked to it
for (int staffIdx = 0; staffIdx < score->nstaves(); ++staffIdx) {
int track = staffIdx * VOICES;
int tick = omb->tick();
Segment* s = toMeasure(rootMeasure)->findSegment(SegmentType::ChordRest, tick);
if (s == 0 || s->element(track) == 0) {
// add rest to this staff and to all the staves linked to it
Rest* rest = new Rest(_root, TDuration(TDuration::DurationType::V_MEASURE));
Fraction timeStretch(_root->staff(staffIdx)->timeStretch(tick));
rest->setDuration(toMeasure(omb)->len() * timeStretch);
rest->setTrack(track);
_root->undoAddCR(rest, toMeasure(rootMeasure), tick);
}
Rest* rest = new Rest(score, TDuration(TDuration::DurationType::V_MEASURE));
Fraction timeStretch(score->staff(staffIdx)->timeStretch(om->tick()));
rest->setDuration(om->len() * timeStretch);
rest->setTrack(track);
score->undoAddCR(rest, om, tick);
}
}
deselectAll();
return omb;
}
//---------------------------------------------------------

View file

@ -179,14 +179,17 @@ void Excerpt::createExcerpt(Excerpt* excerpt)
// create excerpt title and title frame for all scores if not already there
MeasureBase* measure = oscore->first();
if (!measure || (measure->type() != ElementType::VBOX))
measure = oscore->insertMeasure(ElementType::VBOX, measure);
VBox* titleFrameScore = static_cast<VBox*>(measure);
if (!measure || !measure->isVBox()) {
qDebug("original score has no header frame");
oscore->insertMeasure(ElementType::VBOX, measure);
measure = oscore->first();
}
VBox* titleFrameScore = toVBox(measure);
measure = score->first();
Q_ASSERT(measure->type() == ElementType::VBOX);
Q_ASSERT(measure->isVBox());
VBox* titleFramePart = static_cast<VBox*>(measure);
VBox* titleFramePart = toVBox(measure);
titleFramePart->copyValues(titleFrameScore);
QString partLabel = excerpt->title(); // parts.front()->longName();
if (!partLabel.isEmpty()) {

View file

@ -2729,8 +2729,7 @@ System* Score::collectSystem(LayoutContext& lc)
while (lc.curMeasure) { // collect measure for system
System* oldSystem = lc.curMeasure->system();
lc.curMeasure->setSystem(system);
system->measures().push_back(lc.curMeasure);
system->appendMeasure(lc.curMeasure);
qreal ww = 0; // width of current measure
@ -3220,10 +3219,12 @@ void LayoutContext::collectPage()
y += distance;
curSystem->setPos(page->lm(), y);
#ifndef NDEBUG
for (System* s : page->systems()) {
if (s == curSystem)
qDebug("bad system %d\n", k);
qDebug("bad system %d", k);
}
#endif
page->appendSystem(curSystem);
y += curSystem->height();
@ -3383,7 +3384,9 @@ void Score::doLayoutRange(int stick, int etick)
{
if (!firstMeasure())
return;
qDebug("%p %d-%d", this, stick, etick);
qDebug("%p %d-%d %s systems %d", this, stick, etick, isMaster() ? "Master" : "Part", int(_systems.size()));
bool layoutAll = stick <= 0 && (etick < 0 || etick >= lastMeasure()->endTick());
if (stick < 0)
stick = 0;
if (etick < 0)
@ -3418,13 +3421,16 @@ qDebug("%p %d-%d", this, stick, etick);
// m->system() will return a nullptr. We need to find the multi measure
// rest which replaces the measure range
if (!m->system() && m->isMeasure() && toMeasure(m)->hasMMRest())
if (!m->system() && m->isMeasure() && toMeasure(m)->hasMMRest()) {
qDebug(" dont start with mmrest");
m = toMeasure(m)->mmRest();
}
qDebug("start <%s> tick %d, system %p", m->name(), m->tick(), m->system());
lc.score = m->score();
System* system = m->system();
if (system) {
if (!layoutAll && m->system()) {
System* system = m->system();
int systemIndex = _systems.indexOf(system);
lc.page = system->page();
lc.curPage = pageIdx(lc.page);
@ -3435,8 +3441,10 @@ qDebug("%p %d-%d", this, stick, etick);
if (systemIndex == 0)
lc.nextMeasure = _measures.first();
else
lc.nextMeasure = _systems[systemIndex-1]->measures().back()->next();
else {
System* prevSystem = _systems[systemIndex-1];
lc.nextMeasure = prevSystem->measures().back()->next();
}
_systems.erase(_systems.begin() + systemIndex, _systems.end());
if (!lc.nextMeasure->prevMeasure()) {
@ -3449,6 +3457,29 @@ qDebug("%p %d-%d", this, stick, etick);
}
}
else {
qDebug("layoutAll, systems %d", int(_systems.size()));
//lc.measureNo = 0;
//lc.tick = 0;
// qDeleteAll(_systems);
// _systems.clear();
// lc.systemList = _systems;
// _systems.clear();
for (System* s : _systems) {
for (SpannerSegment* ss : s->spannerSegments())
ss->setSystem(0);
}
for (MeasureBase* mb = first(); mb; mb = mb->next()) {
mb->setSystem(0);
if (mb->isMeasure() && toMeasure(mb)->mmRest())
toMeasure(mb)->mmRest()->setSystem(0);
}
qDeleteAll(_systems);
_systems.clear();
qDeleteAll(pages());
pages().clear();
lc.nextMeasure = _measures.first();
}
@ -3465,7 +3496,8 @@ qDebug("%p %d-%d", this, stick, etick);
else {
QList<System*>& systems = lc.page->systems();
int i = systems.indexOf(lc.curSystem);
if (i == -1)
qDebug("clear page systems from %d", i);
if (i <= -1)
systems.clear();
else {
systems.erase(systems.begin() + i, systems.end());

View file

@ -27,7 +27,6 @@ class Score;
class System;
class Measure;
#if 1
//---------------------------------------------------------
// Repeat
//---------------------------------------------------------
@ -46,7 +45,6 @@ constexpr Repeat operator| (Repeat t1, Repeat t2) {
constexpr bool operator& (Repeat t1, Repeat t2) {
return static_cast<int>(t1) & static_cast<int>(t2);
}
#endif
//---------------------------------------------------------
// @@ MeasureBase

View file

@ -50,7 +50,7 @@ class Page : public Element {
Page(Score*);
~Page();
virtual Page* clone() const { return new Page(*this); }
virtual ElementType type() const { return ElementType::PAGE; }
virtual ElementType type() const { return ElementType::PAGE; }
const QList<System*>& systems() const { return _systems; }
QList<System*>& systems() { return _systems; }
System* system(int idx) { return _systems[idx]; }

View file

@ -196,8 +196,11 @@ void TrackList::append(Element* e)
}
}
}
else
QList<Element*>::append(e->clone());
else {
Element* c = e->clone();
c->setParent(0);
QList<Element*>::append(c);
}
}
//---------------------------------------------------------
@ -638,6 +641,9 @@ void ScoreRange::read(Segment* first, Segment* last, bool readSpanner)
Spanner* s = i.second;
if (s->tick() >= stick && s->tick() < etick && s->track() >= startTrack && s->track() < endTrack) {
Spanner* ns = static_cast<Spanner*>(s->clone());
ns->setParent(0);
ns->setStartElement(0);
ns->setEndElement(0);
ns->setTick(ns->tick() - stick);
spanner.push_back(ns);
}

View file

@ -1410,8 +1410,10 @@ void Score::removeElement(Element* element)
return;
}
if (et == ElementType::BEAM) // beam parent does not survive layout
if (et == ElementType::BEAM) { // beam parent does not survive layout
element->setParent(0);
parent = 0;
}
if (parent)
parent->remove(element);

View file

@ -1028,8 +1028,7 @@ class Score : public QObject, ScoreElement {
void cmdSelectSection();
void respace(std::vector<ChordRest*>* elements);
void transposeSemitone(int semitone);
MeasureBase* insertMeasure(ElementType type, MeasureBase*,
bool createEmptyMeasures = false);
void insertMeasure(ElementType type, MeasureBase*, bool createEmptyMeasures = false);
Audio* audio() const { return _audio; }
void setAudio(Audio* a) { _audio = a; }
PlayMode playMode() const { return _playMode; }

View file

@ -420,9 +420,9 @@ void Segment::removeStaff(int staff)
void Segment::checkElement(Element* el, int track)
{
if (_elist[track]) {
qDebug("Segment::add(%s) there is already a %s at %s(%d) track %d. score %p",
qDebug("Segment::add(%s) there is already a %s at %s(%d) track %d. score %p %s",
el->name(), _elist[track]->name(),
qPrintable(score()->sigmap()->pos(tick())), tick(), track, score());
qPrintable(score()->sigmap()->pos(tick())), tick(), track, score(), score()->isMaster() ? "Master" : "Part");
// abort();
}
}

View file

@ -783,7 +783,12 @@ void Slur::slurPos(SlurPos* sp)
return;
sp->p1 = scr->pagePos() - sp->system1->pagePos();
sp->p2 = ecr->pagePos() - sp->system2->pagePos();
QPointF ppp = ecr->pagePos();
System* sss = sp->system2;
QPointF pppp = sss->pagePos();
sp->p2 = ppp - pppp;
// sp->p2 = ecr->pagePos() - sp->system2->pagePos();
// account for centering or other adjustments (other than mirroring)
if (note1 && !note1->mirror())
sp->p1.rx() += note1->x();

View file

@ -92,8 +92,6 @@ class SlurTieSegment : public SpannerSegment {
class SlurTie : public Spanner {
Q_GADGET
Q_PROPERTY(int lineType READ lineType WRITE undoSetLineType)
//TODO-WS Q_PROPERTY(Ms::Direction slurDirection READ slurDirection WRITE undoSetSlurDirection)
//TODO-WS Q_ENUMS(Ms::MScore::Direction)
int _lineType; // 0 = solid, 1 = dotted, 2 = dashed

View file

@ -16,6 +16,7 @@
#include "chordrest.h"
#include "range.h"
#include "tuplet.h"
#include "spanner.h"
namespace Ms {
@ -50,12 +51,26 @@ void Score::splitMeasure(Segment* segment)
ScoreRange range;
range.read(measure->first(), measure->last());
int stick = measure->tick();
int etick = measure->endTick();
for (auto i : spanner()) {
Spanner* s = i.second;
if (s->tick() >= stick && s->tick() < etick)
s->setStartElement(0);
if (s->tick2() >= stick && s->tick2() < etick)
s->setEndElement(0);
}
MeasureBase* nm = measure->next();
undoRemoveMeasures(measure, measure);
undoInsertTime(measure->tick(), -measure->ticks());
// create empty measures:
Measure* m2 = toMeasure(insertMeasure(ElementType::MEASURE, measure->next(), true));
Measure* m1 = toMeasure(insertMeasure(ElementType::MEASURE, m2, true));
insertMeasure(ElementType::MEASURE, nm, true);
Measure* m2 = toMeasure(nm ? nm->prev() : lastMeasure());
insertMeasure(ElementType::MEASURE, m2, true);
Measure* m1 = toMeasure(m2->prev());
int tick = segment->tick();
m1->setTick(measure->tick());

View file

@ -92,6 +92,16 @@ void System::clear()
// _systemDividers are reused
}
//---------------------------------------------------------
// appendMeasure
//---------------------------------------------------------
void System::appendMeasure(MeasureBase* mb)
{
mb->setSystem(this);
ml.push_back(mb);
}
//---------------------------------------------------------
// vbox
// a system can only contain one vertical frame

View file

@ -99,6 +99,8 @@ class System : public Element {
virtual void scanElements(void* data, void (*func)(void*, Element*), bool all=true) override;
void appendMeasure(MeasureBase*);
Page* page() const { return (Page*)parent(); }
void layoutSystem(qreal);

View file

@ -1035,10 +1035,10 @@ void Score::undoAddElement(Element* element)
|| (et == ElementType::TEMPO_TEXT)
|| (et == ElementType::VOLTA)
) {
foreach(Score* s, scoreList())
for (Score* s : scoreList())
staffList.append(s->staff(0));
foreach (Staff* staff, staffList) {
for (Staff* staff : staffList) {
Score* score = staff->score();
int staffIdx = staff->idx();
int ntrack = staffIdx * VOICES;
@ -1121,9 +1121,8 @@ void Score::undoAddElement(Element* element)
if (e == parent)
ne = element;
else {
bool tabFingering = e->staff()->staffType(e->tick())->showTabFingering();
if (element->isGlissando()) { // and other spanners with Anchor::NOTE
Note* newEnd = Spanner::endElementFromSpanner(static_cast<Glissando*>(element), e);
Note* newEnd = Spanner::endElementFromSpanner(toGlissando(element), e);
if (newEnd) {
ne = element->linkedClone();
static_cast<Spanner*>(ne)->setNoteSpan(toNote(e), newEnd);
@ -1131,8 +1130,12 @@ void Score::undoAddElement(Element* element)
else //couldn't find suitable start note
continue;
}
else if (element->isFingering() && e->staff()->isTabStaff(e->tick()) && !tabFingering)
continue;
else if (element->isFingering()) {
bool tabFingering = e->staff()->staffType(e->tick())->showTabFingering();
if (e->staff()->isTabStaff(e->tick()) && !tabFingering)
continue;
ne = element->linkedClone();
}
else
ne = element->linkedClone();
}

View file

@ -2279,7 +2279,8 @@ void MusicXMLParserPass2::print(Measure* measure)
if (blankPage == 1) { // blank title page, insert a VBOX if needed
pm = measure->prev();
if (pm == 0) {
pm = _score->insertMeasure(ElementType::VBOX, measure);
_score->insertMeasure(ElementType::VBOX, measure);
pm = measure->prev();
}
}
}

View file

@ -91,6 +91,12 @@
<property name="accessibleName">
<string>substyle</string>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToMinimumContentsLengthWithIcon</enum>
</property>
<property name="minimumContentsLength">
<number>10</number>
</property>
</widget>
</item>
<item row="0" column="2">

View file

@ -5461,8 +5461,10 @@ void ScoreView::cmdAddText(TEXT type)
case TEXT::PART:
{
MeasureBase* measure = _score->first();
if (measure->type() != ElementType::VBOX)
measure = _score->insertMeasure(ElementType::VBOX, measure);
if (!measure->isVBox()) {
_score->insertMeasure(ElementType::VBOX, measure);
measure = measure->prev();
}
s = new Text(_score);
switch(type) {
case TEXT::TITLE: s->initSubStyle(SubStyle::TITLE); break;
@ -5578,7 +5580,8 @@ void ScoreView::cmdAppendMeasures(int n, ElementType type)
MeasureBase* ScoreView::appendMeasure(ElementType type)
{
_score->startCmd();
MeasureBase* mb = _score->insertMeasure(type, 0);
_score->insertMeasure(type, 0);
MeasureBase* mb = _score->last();
_score->endCmd();
return mb;
}
@ -5636,7 +5639,8 @@ void ScoreView::cmdInsertMeasure(ElementType type)
if (!mb)
return;
_score->startCmd();
mb = _score->insertMeasure(type, mb);
_score->insertMeasure(type, mb);
mb = mb->prev();
if (mb->type() == ElementType::TBOX) {
TBox* tbox = static_cast<TBox*>(mb);
Text* s = tbox->text();

View file

@ -90,7 +90,6 @@ void TestCopyPaste::initTestCase()
void TestCopyPaste::copypaste(const char* idx)
{
MasterScore* score = readScore(DIR + QString("copypaste%1.mscx").arg(idx));
score->doLayout();
Measure* m1 = score->firstMeasure();
Measure* m2 = m1->nextMeasure(); // src
Measure* m3 = m2->nextMeasure();
@ -116,7 +115,6 @@ void TestCopyPaste::copypaste(const char* idx)
score->startCmd();
score->cmdPaste(mimeData,0);
score->doLayout();
score->endCmd();
QVERIFY(saveCompareScore(score, QString("copypaste%1.mscx").arg(idx),
@ -132,7 +130,6 @@ void TestCopyPaste::copypaste(const char* idx)
void TestCopyPaste::copypastestaff(const char* idx)
{
MasterScore* score = readScore(DIR + QString("copypaste%1.mscx").arg(idx));
score->doLayout();
Measure* m1 = score->firstMeasure();
Measure* m2 = m1->nextMeasure(); // src
@ -155,8 +152,6 @@ void TestCopyPaste::copypastestaff(const char* idx)
score->cmdPaste(mimeData,0);
score->endCmd();
score->doLayout();
QVERIFY(saveCompareScore(score, QString("copypaste%1.mscx").arg(idx),
DIR + QString("copypaste%1-ref.mscx").arg(idx)));
delete score;
@ -165,7 +160,6 @@ void TestCopyPaste::copypastestaff(const char* idx)
void TestCopyPaste::copyPastePartial()
{
MasterScore* score = readScore(DIR + QString("copypaste_partial_01.mscx"));
score->doLayout();
Measure* m1 = score->firstMeasure();
@ -188,8 +182,6 @@ void TestCopyPaste::copyPastePartial()
score->cmdPaste(mimeData,0);
score->endCmd();
score->doLayout();
QVERIFY(saveCompareScore(score, QString("copypaste_partial_01.mscx"),
DIR + QString("copypaste_partial_01-ref.mscx")));
delete score;
@ -198,7 +190,6 @@ void TestCopyPaste::copyPastePartial()
void TestCopyPaste::copyPaste2Voice()
{
MasterScore* score = readScore(DIR + QString("copypaste13.mscx"));
score->doLayout();
Measure* m1 = score->firstMeasure();
Measure* m2 = m1->nextMeasure();
@ -226,8 +217,6 @@ void TestCopyPaste::copyPaste2Voice()
score->cmdPaste(mimeData,0);
score->endCmd();
score->doLayout();
QVERIFY(saveCompareScore(score, QString("copypaste13.mscx"),
DIR + QString("copypaste13-ref.mscx")));
delete score;
@ -241,7 +230,6 @@ void TestCopyPaste::copyPaste2Voice()
void TestCopyPaste::copypastevoice(const char* idx, int voice)
{
MasterScore* score = readScore(DIR + QString("copypaste%1.mscx").arg(idx));
score->doLayout();
Measure* m1 = score->firstMeasure();
Measure* m2 = m1->nextMeasure();
@ -269,8 +257,6 @@ void TestCopyPaste::copypastevoice(const char* idx, int voice)
score->cmdPaste(mimeData,0);
score->endCmd();
score->doLayout();
QVERIFY(saveCompareScore(score, QString("copypaste%1.mscx").arg(idx),
DIR + QString("copypaste%1-ref.mscx").arg(idx)));
delete score;
@ -279,7 +265,6 @@ void TestCopyPaste::copypastevoice(const char* idx, int voice)
void TestCopyPaste::copyPaste2Voice5()
{
MasterScore* score = readScore(DIR + QString("copypaste17.mscx"));
score->doLayout();
Measure* m1 = score->firstMeasure();
QVERIFY(m1 != 0);
@ -310,8 +295,6 @@ void TestCopyPaste::copyPaste2Voice5()
score->cmdPaste(mimeData,0);
score->endCmd();
score->doLayout();
QVERIFY(saveCompareScore(score, QString("copypaste17.mscx"),
DIR + QString("copypaste17-ref.mscx")));
delete score;
@ -321,7 +304,6 @@ void TestCopyPaste::copyPaste2Voice5()
void TestCopyPaste::copyPasteOnlySecondVoice()
{
MasterScore* score = readScore(DIR + QString("copypaste18.mscx"));
score->doLayout();
Measure* m1 = score->firstMeasure();
Measure* m2 = m1->nextMeasure();
@ -349,8 +331,6 @@ void TestCopyPaste::copyPasteOnlySecondVoice()
score->cmdPaste(mimeData,0);
score->endCmd();
score->doLayout();
QVERIFY(saveCompareScore(score, QString("copypaste18.mscx"),
DIR + QString("copypaste18-ref.mscx")));
delete score;
@ -359,7 +339,6 @@ void TestCopyPaste::copyPasteOnlySecondVoice()
void TestCopyPaste::copypaste2Voice6()
{
MasterScore* score = readScore(DIR + QString("copypaste20.mscx"));
score->doLayout();
Measure* m1 = score->firstMeasure();
QVERIFY(m1 != 0);
@ -388,7 +367,6 @@ void TestCopyPaste::copypaste2Voice6()
score->startCmd();
score->cmdPaste(mimeData,0);
score->doLayout();
score->endCmd();
QVERIFY(saveCompareScore(score, QString("copypaste20.mscx"),
@ -399,7 +377,6 @@ void TestCopyPaste::copypaste2Voice6()
void TestCopyPaste::copypastetuplet(const char* idx)
{
MasterScore* score = readScore(DIR + QString("copypaste_tuplet_%1.mscx").arg(idx));
score->doLayout();
Measure* m1 = score->firstMeasure();
Measure* m2 = m1->nextMeasure();
@ -419,7 +396,6 @@ void TestCopyPaste::copypastetuplet(const char* idx)
score->select(dest);
score->startCmd();
score->cmdPaste(mimeData,0);
score->doLayout();
score->endCmd();
QVERIFY(saveCompareScore(score, QString("copypaste_tuplet_%1.mscx").arg(idx),

View file

@ -63,7 +63,6 @@ void TestJoin::initTestCase()
void TestJoin::join(const char* p1, const char* p2)
{
MasterScore* score = readScore(DIR + p1);
score->doLayout();
Measure* m1 = score->firstMeasure();
Measure* m2 = m1->nextMeasure();

View file

@ -119,10 +119,6 @@
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<Rest>
<lid>179</lid>
<durationType>measure</durationType>
@ -130,6 +126,10 @@
</Rest>
</Measure>
<Measure number="2">
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<Tempo>
<tempo>1.66667</tempo>
<text>𝅘𝅥 = 100</text>
@ -208,10 +208,6 @@
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Clef>
<concertClefType>F</concertClefType>
<transposingClefType>F</transposingClefType>
</Clef>
<Rest>
<lid>180</lid>
<durationType>measure</durationType>
@ -219,6 +215,10 @@
</Rest>
</Measure>
<Measure number="2">
<Clef>
<concertClefType>F</concertClefType>
<transposingClefType>F</transposingClefType>
</Clef>
<Rest>
<lid>3</lid>
<durationType>measure</durationType>
@ -254,10 +254,6 @@
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<Rest>
<lid>181</lid>
<durationType>measure</durationType>
@ -265,6 +261,10 @@
</Rest>
</Measure>
<Measure number="2">
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<Rest>
<lid>9</lid>
<durationType>measure</durationType>
@ -378,10 +378,6 @@
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<Rest>
<lid>179</lid>
<durationType>measure</durationType>
@ -390,6 +386,10 @@
</Measure>
<Measure number="2">
<breakMultiMeasureRest>1</breakMultiMeasureRest>
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<Tempo>
<tempo>1.66667</tempo>
<text>𝅘𝅥 = 100</text>
@ -468,10 +468,6 @@
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<Rest>
<lid>180</lid>
<durationType>measure</durationType>
@ -479,6 +475,10 @@
</Rest>
</Measure>
<Measure number="2">
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<Rest>
<lid>3</lid>
<durationType>measure</durationType>
@ -586,10 +586,6 @@
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<Rest>
<lid>181</lid>
<durationType>measure</durationType>
@ -598,6 +594,10 @@
</Measure>
<Measure number="2">
<breakMultiMeasureRest>1</breakMultiMeasureRest>
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<Tempo>
<tempo>1.66667</tempo>
<lid>25</lid>

View file

@ -5,6 +5,22 @@
<currentLayer>0</currentLayer>
<Division>480</Division>
<Style>
<page-layout>
<page-height>1683.78</page-height>
<page-width>1190.55</page-width>
<page-margins type="even">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
<page-margins type="odd">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
</page-layout>
<Spatium>1.76389</Spatium>
</Style>
<showInvisible>1</showInvisible>
@ -302,6 +318,22 @@
<Division>480</Division>
<Style>
<createMultiMeasureRests>1</createMultiMeasureRests>
<page-layout>
<page-height>1683.78</page-height>
<page-width>1190.55</page-width>
<page-margins type="even">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
<page-margins type="odd">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
</page-layout>
<Spatium>1.76389</Spatium>
</Style>
<showInvisible>1</showInvisible>
@ -520,6 +552,22 @@
<Division>480</Division>
<Style>
<createMultiMeasureRests>1</createMultiMeasureRests>
<page-layout>
<page-height>1683.78</page-height>
<page-width>1190.55</page-width>
<page-margins type="even">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
<page-margins type="odd">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
</page-layout>
<Spatium>1.76389</Spatium>
</Style>
<showInvisible>1</showInvisible>
@ -608,8 +656,7 @@
<duration>2/4</duration>
</Rest>
</Measure>
<Measure number="1" len="10/4">
<multiMeasureRest>5</multiMeasureRest>
<Measure number="1" len="8/4">
<TimeSig>
<sigN>2</sigN>
<sigD>4</sigD>
@ -646,7 +693,7 @@
<duration>2/4</duration>
</Rest>
</Measure>
<Measure number="5">
<Measure number="1">
<Rest>
<lid>181</lid>
<durationType>measure</durationType>

View file

@ -63,16 +63,16 @@
<sigD>4</sigD>
<showCourtesySig>1</showCourtesySig>
</TimeSig>
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<Rest>
<durationType>measure</durationType>
<duration>4/4</duration>
</Rest>
</Measure>
<Measure number="2">
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<Chord>
<durationType>quarter</durationType>
<Note>

View file

@ -118,6 +118,7 @@
</Tempo>
<Chord>
<durationType>quarter</durationType>
<Slur type="stop" id="2"/>
<Note>
<pitch>60</pitch>
<tpc>14</tpc>
@ -166,6 +167,7 @@
<durationType>half</durationType>
</Rest>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>

View file

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<museScore version="3.00">
<programVersion>3.0.0</programVersion>
<programRevision>3543170</programRevision>
<Score>
<LayerTag id="0" tag="default"></LayerTag>
<currentLayer>0</currentLayer>
<Synthesizer>
</Synthesizer>
<Division>480</Division>
<Style>
<Spatium>1.76389</Spatium>
@ -14,9 +18,11 @@
<metaTag name="arranger"></metaTag>
<metaTag name="composer"></metaTag>
<metaTag name="copyright"></metaTag>
<metaTag name="creationDate">2017-03-14</metaTag>
<metaTag name="lyricist"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
<metaTag name="platform">Linux</metaTag>
<metaTag name="poet"></metaTag>
<metaTag name="source"></metaTag>
<metaTag name="translator"></metaTag>
@ -53,6 +59,7 @@
<gateTime>100</gateTime>
</Articulation>
<Channel>
<synti>Fluid</synti>
</Channel>
</Instrument>
</Part>
@ -146,7 +153,6 @@
</Note>
</Chord>
<BarLine>
<subtype>normal</subtype>
<span>1</span>
</BarLine>
</Measure>
@ -169,7 +175,6 @@
<durationType>half</durationType>
</Rest>
<BarLine>
<subtype>end</subtype>
<span>1</span>
</BarLine>
</Measure>

View file

@ -82,7 +82,7 @@ void TestSplit::split(const char* f1, const char* ref, int index)
Segment* s = m->first(SegmentType::ChordRest);
for (int i = 0; i < index; ++i)
s = s->next1(SegmentType::ChordRest);
ChordRest* cr = static_cast<ChordRest*>(s->element(0));
ChordRest* cr = toChordRest(s->element(0));
score->cmdSplitMeasure(cr);