Skip to content
Permalink
Browse files

layout for movements

  • Loading branch information...
wschweer committed Jan 5, 2017
1 parent 29a1f47 commit 0b1aea952f9f870ef79f39899f8ec12cc2b60fa6
Showing 873 changed files with 1,306 additions and 10,818 deletions.
@@ -66,7 +66,7 @@ add_library (
synthesizerstate.cpp mcursor.cpp groups.cpp mscoreview.cpp
noteline.cpp spannermap.cpp
bagpembell.cpp ambitus.cpp keylist.cpp scoreElement.cpp
shape.cpp systemdivider.cpp midimapping.cpp stafflines.cpp
shape.cpp systemdivider.cpp midimapping.cpp stafflines.cpp pageformat.cpp
read114.cpp read206.cpp read300.cpp stafftypelist.cpp stafftypechange.cpp
)

@@ -56,8 +56,8 @@ struct BarLineTableItem {
class BarLine : public Element {
Q_OBJECT

Q_PROPERTY(Ms::MSQE_BarLineType::E barLineType READ qmlBarLineType)
Q_ENUMS(Ms::MSQE_BarLineType::E)
// Q_PROPERTY(Ms::MSQE_BarLineType::E barLineType READ qmlBarLineType)
// Q_ENUMS(Ms::MSQE_BarLineType::E)

char _spanStaff { false }; // span barline to next staff if true
char _spanFrom { 0 }; // line number on start and end staves
@@ -131,7 +131,7 @@ class BarLine : public Element {
BarLineType barLineType() const { return _barLineType; }
static BarLineType barLineType(const QString&);

Ms::MSQE_BarLineType::E qmlBarLineType() const { return static_cast<Ms::MSQE_BarLineType::E>(_barLineType); }
// Ms::MSQE_BarLineType::E qmlBarLineType() const { return static_cast<Ms::MSQE_BarLineType::E>(_barLineType); }

virtual int subtype() const override { return int(_barLineType); }
virtual QString subtypeName() const override { return qApp->translate("barline", barLineTypeName().toUtf8()); }
@@ -152,7 +152,7 @@ class BarLine : public Element {
};
} // namespace Ms

Q_DECLARE_METATYPE(Ms::MSQE_BarLineType::E);
// Q_DECLARE_METATYPE(Ms::MSQE_BarLineType::E);

#endif

@@ -489,7 +489,7 @@ bool Bracket::setProperty(P_ID id, const QVariant& v)
case P_ID::BRACKET_COLUMN: {
int oldColumn = _column;
_column = v.toInt(); // TODO
staff()->swapBracket(oldColumn, _column, _bracketType);
staff()->swapBracket(oldColumn, _column);
staff()->setBracketSpan(_column, _lastStaff - _firstStaff + 1);
score()->moveBracket(staffIdx(), oldColumn, _column);
}
@@ -768,7 +768,7 @@ Element* ChordRest::drop(const DropData& data)
TextStyleType st = tt->textStyleType();
//tt->setTextStyleType(st);
if (st >= TextStyleType::DEFAULT && fromPalette)
tt->textStyle().restyle(MScore::baseStyle()->textStyle(st), score()->textStyle(st));
tt->textStyle().restyle(MScore::baseStyle().textStyle(st), score()->textStyle(st));
score()->undoAddElement(tt);
}
return e;
@@ -780,7 +780,7 @@ Element* ChordRest::drop(const DropData& data)
TextStyleType st = d->textStyleType();
//d->setTextStyleType(st);
if (st >= TextStyleType::DEFAULT && fromPalette)
d->textStyle().restyle(MScore::baseStyle()->textStyle(st), score()->textStyle(st));
d->textStyle().restyle(MScore::baseStyle().textStyle(st), score()->textStyle(st));
d->setParent(segment());
score()->undoAddElement(d);
}
@@ -843,7 +843,7 @@ Element* ChordRest::drop(const DropData& data)
// palette text style will be relative to baseStyle, so rebase this to score
//f->setTextStyleType(st);
if (st >= TextStyleType::DEFAULT && fromPalette)
t->textStyle().restyle(MScore::baseStyle()->textStyle(st), score()->textStyle(st));
t->textStyle().restyle(MScore::baseStyle().textStyle(st), score()->textStyle(st));
if (e->type() == Element::Type::REHEARSAL_MARK && fromPalette)
t->setXmlText(score()->createRehearsalMarkText(static_cast<RehearsalMark*>(e)));
}
@@ -96,13 +96,11 @@ void CmdState::reset()

void CmdState::setTick(int t)
{
if (_updateMode == UpdateMode::LayoutAll)
return;
if (_startTick == -1 || t < _startTick)
_startTick = t;
if (_endTick == -1 || t > _endTick)
_endTick = t;
setUpdateMode(UpdateMode::LayoutRange);
setUpdateMode(UpdateMode::Layout);
}

//---------------------------------------------------------
@@ -162,6 +160,7 @@ void Score::undoRedo(bool undo)

void Score::endCmd(bool rollback)
{
qDebug("++++%p", this);
if (!undoStack()->active()) {
qDebug("Score::endCmd(): no cmd active");
update();
@@ -195,40 +194,49 @@ void Score::endCmd(bool rollback)

void Score::update()
{
CmdState& cs = cmdState();
if (cs.layoutAll()) {
for (Score* s : scoreList())
s->doLayout();
cs._setUpdateMode(UpdateMode::UpdateAll);
}
else if (cs.layoutRange()) {
for (Score* s : scoreList())
s->doLayoutRange(cs.startTick(), cs.endTick());
cs._setUpdateMode(UpdateMode::UpdateAll);
}
if (cs.updateAll()) {
for (Score* s : scoreList()) {
for (MuseScoreView* v : s->viewer)
v->updateAll();
for (MasterScore* ms : *movements()) {
CmdState& cs = ms->cmdState();
if (cs.layoutRange()) {
for (Score* s : ms->scoreList())
s->doLayoutRange(cs.startTick(), cs.endTick());
for (Score* s : scoreList()) {
for (MuseScoreView* v : s->viewer)
v->updateAll();
}
cs._setUpdateMode(UpdateMode::DoNothing);
const InputState& is = inputState();
if (is.noteEntryMode() && is.segment()) {
setPlayPos(is.segment()->tick());
}
if (_playlistDirty) {
emit playlistChanged();
_playlistDirty = false;
}
break;
}
if (cs.updateAll()) {
for (Score* s : scoreList()) {
for (MuseScoreView* v : s->viewer)
v->updateAll();
}
cs._setUpdateMode(UpdateMode::DoNothing);
}
else if (cs.updateRange()) {
// updateRange updates only current score
qreal d = spatium() * .5;
_updateState.refresh.adjust(-d, -d, 2 * d, 2 * d);
for (MuseScoreView* v : viewer)
v->dataChanged(_updateState.refresh);
_updateState.refresh = QRectF();
}
const InputState& is = inputState();
if (is.noteEntryMode() && is.segment()) {
setPlayPos(is.segment()->tick());
}
if (_playlistDirty) {
emit playlistChanged();
_playlistDirty = false;
}
cs._setUpdateMode(UpdateMode::DoNothing);
}
else if (cs.updateRange()) {
// updateRange updates only current score
qreal d = spatium() * .5;
_updateState.refresh.adjust(-d, -d, 2 * d, 2 * d);
for (MuseScoreView* v : viewer)
v->dataChanged(_updateState.refresh);
_updateState.refresh = QRectF();
}

const InputState& is = inputState();
if (is.noteEntryMode() && is.segment()) {
setPlayPos(is.segment()->tick());
}
if (_playlistDirty) {
emit playlistChanged();
_playlistDirty = false;
}
}

@@ -306,21 +314,21 @@ void Score::cmdAddSpanner(Spanner* spanner, int staffIdx, Segment* startSegment,
if (t) {
st = t->textStyleType();
if (st >= TextStyleType::DEFAULT)
t->textStyle().restyle(MScore::baseStyle()->textStyle(st), textStyle(st));
t->textStyle().restyle(MScore::baseStyle().textStyle(st), textStyle(st));
}
// continue
t = tl->continueTextElement();
if (t) {
st = t->textStyleType();
if (st >= TextStyleType::DEFAULT)
t->textStyle().restyle(MScore::baseStyle()->textStyle(st), textStyle(st));
t->textStyle().restyle(MScore::baseStyle().textStyle(st), textStyle(st));
}
// end
t = tl->endTextElement();
if (t) {
st = t->textStyleType();
if (st >= TextStyleType::DEFAULT)
t->textStyle().restyle(MScore::baseStyle()->textStyle(st), textStyle(st));
t->textStyle().restyle(MScore::baseStyle().textStyle(st), textStyle(st));
}
}
undoAddElement(spanner);
@@ -1756,6 +1756,7 @@ void Score::deleteItem(Element* el)

void Score::deleteMeasures(MeasureBase* is, MeasureBase* ie)
{
printf("deleteMeasures %p %p\n", is,ie);
#if 0
if (!selection().isRange())
return;
@@ -1786,10 +1787,11 @@ void Score::deleteMeasures(MeasureBase* is, MeasureBase* ie)


// get the last deleted timesig & keysig in order to restore after deletion
TimeSig* lastDeletedSig = 0;
KeySig* lastDeletedKeySig = 0;
KeySigEvent lastDeletedKeySigEvent;
TimeSig* lastDeletedSig = 0;
KeySig* lastDeletedKeySig = 0;
bool transposeKeySigEvent = false;

for (MeasureBase* mb = ie;; mb = mb->prev()) {
if (mb->isMeasure()) {
Measure* m = toMeasure(mb);
@@ -1821,10 +1823,11 @@ void Score::deleteMeasures(MeasureBase* is, MeasureBase* ie)
int endTick = ie->tick();

undoInsertTime(is->tick(), -(ie->endTick() - is->tick()));
foreach (Score* score, scoreList()) {
for (Score* score : scoreList()) {
Measure* is = score->tick2measure(startTick);
Measure* ie = score->tick2measure(endTick);

printf("undoRemoveMeasures %p %p\n", is, ie);
score->undoRemoveMeasures(is, ie);

// adjust views
@@ -2793,6 +2796,7 @@ void Score::globalTimeDelete()

void Score::localTimeDelete()
{
printf("local time delete\n");
Segment* startSegment;
Segment* endSegment;

@@ -2830,8 +2834,10 @@ void Score::localTimeDelete()
else
ie = lastMeasure();

printf("A\n");
for (;;) {
if (is->tick() != startSegment->tick()) {
printf("B\n");
int tick = startSegment->tick();
int len;
if (ie == is)
@@ -2845,13 +2851,16 @@ void Score::localTimeDelete()
}
int endTick = endSegment ? endSegment->tick() : ie->endTick();
if (ie->endTick() != endTick) {
printf("C\n");
int len = endSegment->tick() - ie->tick();
timeDelete(toMeasure(ie), toMeasure(ie)->first(), Fraction::fromTicks(len));
if (is == ie)
break;
ie = ie->prev();
}
printf("D\n");
deleteMeasures(is, ie);
printf("E\n");
break;
};

@@ -3182,6 +3191,6 @@ void Score::cloneVoice(int strack, int dtrack, Segment* sf, int lTick, bool link
}

//Layout
doLayoutRange(start, lTick);
//TODO ?? doLayoutRange(start, lTick);
}
}
Oops, something went wrong.

0 comments on commit 0b1aea9

Please sign in to comment.
You can’t perform that action at this time.