Skip to content

Commit

Permalink
fix: importPdf, boundingRect of ShadowNote
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Jul 25, 2013
1 parent 2bf086a commit e9a3cd0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 19 deletions.
10 changes: 7 additions & 3 deletions libmscore/pedal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ void Pedal::read(XmlReader& e)
setBeginSymbol(noSym);
setEndHook(false);
}
if (e.name() == "subtype") // obsolete
e.skipCurrentElement();
TextLine::read(e);
setId(e.intAttribute("id", -1));
while (e.readNextStartElement()) {
if (e.name() == "subtype") // obsolete
e.skipCurrentElement();
else if (!TextLine::readProperties(e))
e.unknown();
}
}

//---------------------------------------------------------
Expand Down
14 changes: 9 additions & 5 deletions libmscore/shadownote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,19 @@ void ShadowNote::layout()
}
QRectF b = sym->bbox(magS());
qreal _spatium = spatium();
qreal x = b.width()/2 - _spatium;
qreal x = b.width() * .5 - _spatium;
qreal lw = point(score()->styleS(ST_ledgerLineWidth));

if (_line < 100 && _line > -100) {
QRectF r(0, -lw/2.0, 2 * _spatium, lw);
qreal x1 = sym->width(magS())*.5 - (_spatium * mag()) - lw * .5;
qreal x2 = x1 + 2 * _spatium * mag() + lw * .5;

InputState ps = score()->inputState();
QRectF r(x1, -lw * .5, x2 - x1, lw);
if (_line < 100 && _line > -100 && !ps.rest) {
for (int i = -2; i >= _line; i -= 2)
b |= r.translated(QPointF(x, _spatium * .5 * (i - _line)));
b |= r.translated(QPointF(0, _spatium * .5 * (i - _line)));
for (int i = 10; i <= _line; i += 2)
b |= r.translated(QPointF(x, _spatium * .5 * (i - _line)));
b |= r.translated(QPointF(0, _spatium * .5 * (i - _line)));
}
setbbox(b);
}
Expand Down
3 changes: 2 additions & 1 deletion libmscore/xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ int XmlReader::intAttribute(const char* s) const

double XmlReader::doubleAttribute(const char* s) const
{
return attributes().value(s).toString().toDouble();
QString value(attributes().value(s).toString());
return value.toDouble();
}

double XmlReader::doubleAttribute(const char* s, double _default) const
Expand Down
6 changes: 3 additions & 3 deletions mscore/scoreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3006,10 +3006,10 @@ void ScoreView::dragScoreView(QMouseEvent* ev)
void ScoreView::dragNoteEntry(QMouseEvent* ev)
{
QPointF p = toLogical(ev->pos());
_score->addRefresh(shadowNote->canvasBoundingRect());
QRectF r(shadowNote->canvasBoundingRect());
setShadowNote(p);
_score->addRefresh(shadowNote->canvasBoundingRect());
_score->end();
r |= shadowNote->canvasBoundingRect();
update(toPhysical(r).adjusted(-2, -2, 2, 2));
}

//---------------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions omr/importpdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ Score::FileError importPdf(Score* score, const QString& path)
if (sp == 0.0)
sp = 1.5;
score->setSpatium(sp * MScore::DPMM);
score->style()->set(StyleVal(ST_lastSystemFillLimit, 0.0));
score->style()->set(StyleVal(ST_staffLowerBorder, 0.0));
score->style()->set(StyleVal(ST_measureSpacing, 1.0));
score->style()->set(ST_lastSystemFillLimit, 0.0);
score->style()->set(ST_staffLowerBorder, 0.0);
score->style()->set(ST_measureSpacing, 1.0);

PageFormat pF;
pF.copy(*score->pageFormat());
Expand All @@ -245,9 +245,9 @@ Score::FileError importPdf(Score* score, const QString& path)
pF.setOddBottomMargin(0);
score->setPageFormat(pF);

score->style()->set(StyleVal(ST_minSystemDistance, Spatium(omr->systemDistance())));
score->style()->set(StyleVal(ST_maxSystemDistance, Spatium(omr->systemDistance())));
score->style()->set(StyleVal(ST_akkoladeDistance, Spatium(omr->staffDistance())));
score->style()->set(ST_minSystemDistance, Spatium(omr->systemDistance()));
score->style()->set(ST_maxSystemDistance, Spatium(omr->systemDistance()));
score->style()->set(ST_akkoladeDistance, Spatium(omr->staffDistance()));

Part* part = new Part(score);
Staff* staff = new Staff(score, part, 0);
Expand Down Expand Up @@ -276,7 +276,7 @@ Score::FileError importPdf(Score* score, const QString& path)

//---create bracket

score->staff(0)->setBracket(0, BRACKET_AKKOLADE);
score->staff(0)->setBracket(0, BRACKET_BRACE);
score->staff(0)->setBracketSpan(0, 2);

score->setShowOmr(true);
Expand Down

0 comments on commit e9a3cd0

Please sign in to comment.