Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More mmrest / copy/paste fixes #2193

Merged
merged 3 commits into from Oct 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions libmscore/paste.cpp
Expand Up @@ -404,8 +404,10 @@ bool Score::pasteStaff(XmlReader& e, Segment* dst, int dstStaff)
s->connectTies();

if (pasted) { //select only if we pasted something
Segment* s1 = tick2segment(dstTick);
Segment* s2 = tick2segment(dstTick + tickLen);
if (styleB(StyleIdx::createMultiMeasureRests))
createMMRests();
Segment* s1 = tick2segmentMM(dstTick);
Segment* s2 = tick2segmentMM(dstTick + tickLen);
int endStaff = dstStaff + staves;
if (endStaff > nstaves())
endStaff = nstaves();
Expand Down
14 changes: 13 additions & 1 deletion libmscore/scorefile.cpp
Expand Up @@ -1367,6 +1367,18 @@ void Score::writeSegments(Xml& xml, int strack, int etrack,
Segment* fs, Segment* ls, bool writeSystemElements, bool clip, bool needFirstTick)
{
int endTick = ls == 0 ? lastMeasure()->endTick() : ls->tick();
// in clipboard mode, ls might be in an mmrest
// since we are traversing regular measures,
// force ls to last segment of the corresponding regular measure
// if it is not in same measure as fs
Measure* lm = ls ? ls->measure() : 0;
if (clip && lm && lm->isMMRest() && lm != fs->measure()) {
lm = tick2measure(ls->measure()->tick());
if (lm)
ls = lm->last();
else
qDebug("writeSegments: no measure for end segment in mmrest");
}
for (int track = strack; track < etrack; ++track) {
if (!xml.canWriteVoice(track))
continue;
Expand Down Expand Up @@ -1394,7 +1406,7 @@ void Score::writeSegments(Xml& xml, int strack, int etrack,
}
}
}
foreach (Element* e, segment->annotations()) {
for (Element* e : segment->annotations()) {
if (e->track() != track || e->generated()
|| (e->systemFlag() && !writeSystemElements)) {
continue;
Expand Down
21 changes: 16 additions & 5 deletions mscore/scoreview.cpp
Expand Up @@ -1938,12 +1938,12 @@ void ScoreView::paint(const QRect& r, QPainter& p)
// this can happen in mmrests
// first chordrest segment of mmrest instead
const Measure* mmr = ss->measure()->mmRest1();
if (mmr)
if (mmr && mmr->system())
ss = mmr->first(Segment::Type::ChordRest);
else
return; // not an mmrest?
return; // still no system?
if (!ss)
return; // mmrest has no chordrest segment?
return; // no chordrest segment?
}

p.setBrush(Qt::NoBrush);
Expand Down Expand Up @@ -1984,11 +1984,22 @@ void ScoreView::paint(const QRect& r, QPainter& p)
System* system1 = system2;
double x1;

for (Segment* s = ss; s && (s != es);) {
for (Segment* s = ss; s && (s != es); ) {
Segment* ns = s->next1MM();
system1 = system2;
system2 = s->measure()->system();
pt = s->pagePos();
if (!system2) {
// as before, use mmrest if necessary
const Measure* mmr = s->measure()->mmRest1();
if (mmr)
system2 = mmr->system();
if (!system2)
break;
// extend rectangle to end of mmrest
pt = mmr->last()->pagePos();
}
else
pt = s->pagePos();
x1 = x2;
x2 = pt.x() + _spatium * 2;

Expand Down