Skip to content

Commit

Permalink
fix pos output format; scale position to 100dpi
Browse files Browse the repository at this point in the history
  • Loading branch information
Werner Schweer committed Feb 2, 2013
1 parent fc7fc3a commit 550bf01
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions mscore/savePositions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ static QHash<void*, int> segs;

static void saveMeasureEvents(Xml& xml, Measure* m, int offset)
{
printf("saveMeasureEvents\n");
for (Segment* s = m->first(Segment::SegChordRest); s; s = s->next(Segment::SegChordRest)) {
int tick = s->tick() + offset;
int id = segs[(void*)s];
Expand All @@ -39,6 +38,7 @@ printf("saveMeasureEvents\n");

//---------------------------------------------------------
// savePositions
// output in 100 dpi
//---------------------------------------------------------

bool savePositions(Score* score, const QString& name)
Expand All @@ -51,6 +51,7 @@ bool savePositions(Score* score, const QString& name)
}
Xml xml(&fp);
xml.header();
xml.stag("score");
xml.stag("elements");
int id = 0;
for (Segment* s = score->firstMeasure()->first(Segment::SegChordRest);
Expand All @@ -62,10 +63,13 @@ bool savePositions(Score* score, const QString& name)
if (e)
sx = qMax(sx, e->width());
}
qreal ndpi = 100.0 / MScore::DPI;

sx *= ndpi;
int sy = s->measure()->system()->height() * ndpi;
int x = s->pagePos().x() * ndpi;
int y = s->pagePos().y() * ndpi;

int sy = s->measure()->system()->height();
int x = s->pagePos().x();
int y = s->pagePos().y();
Page* p = s->measure()->system()->page();
int page = score->pageIdx(p);

Expand Down Expand Up @@ -103,6 +107,8 @@ bool savePositions(Score* score, const QString& name)
}
}
xml.etag();

xml.etag(); // score
return true;
}

0 comments on commit 550bf01

Please sign in to comment.