Skip to content

Commit

Permalink
Merge branch 'master' of github.com:musescore/MuseScore
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Feb 13, 2014
2 parents c4d984e + 73954df commit 1b4d81d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
12 changes: 8 additions & 4 deletions libmscore/layout.cpp
Expand Up @@ -949,7 +949,9 @@ static bool validMMRestMeasure(Measure* m)
// return false;
for (Segment* s = m->first(); s; s = s->next()) {
for (Element* e : s->annotations()) {
if (e->type() != Element::REHEARSAL_MARK && e->type() != Element::TEMPO_TEXT)
if (e->type() != Element::REHEARSAL_MARK &&
e->type() != Element::TEMPO_TEXT &&
e->type() != Element::STAFF_TEXT)
return false;
}
}
Expand Down Expand Up @@ -977,7 +979,9 @@ static bool breakMultiMeasureRest(Measure* m)

for (Segment* s = m->first(); s; s = s->next()) {
for (Element* e : s->annotations()) {
if (e->type() == Element::REHEARSAL_MARK || e->type() == Element::TEMPO_TEXT)
if (e->type() == Element::REHEARSAL_MARK ||
e->type() == Element::TEMPO_TEXT ||
e->type() == Element::STAFF_TEXT)
return true;
}
}
Expand Down Expand Up @@ -1140,7 +1144,7 @@ void Score::createMMRests()
//
cs = m->findSegment(Segment::SegChordRest, m->tick());
for (Element* e : cs->annotations()) {
if (e->type() != Element::REHEARSAL_MARK && e->type() != Element::TEMPO_TEXT)
if (e->type() != Element::REHEARSAL_MARK && e->type() != Element::TEMPO_TEXT && e->type() != Element::STAFF_TEXT)
continue;

bool found = false;
Expand All @@ -1157,7 +1161,7 @@ void Score::createMMRests()
}
}
for (Element* e : s->annotations()) {
if (e->type() != Element::REHEARSAL_MARK && e->type() != Element::TEMPO_TEXT)
if (e->type() != Element::REHEARSAL_MARK && e->type() != Element::TEMPO_TEXT && e->type() != Element::STAFF_TEXT)
continue;
bool found = false;
for (Element* ee : cs->annotations()) {
Expand Down
3 changes: 2 additions & 1 deletion libmscore/sym.cpp
Expand Up @@ -4314,6 +4314,7 @@ void ScoreFont::load()
Sym* sym = &_symbols[int(symId)];
sym->setString(codeToString(code));
sym->setWidth(_fm->width(sym->string()));
sym->setBbox(QRectF(_fm->tightBoundingRect(sym->string())));
}
// else
// qDebug("unknown glyph: %s", qPrintable(i));
Expand Down Expand Up @@ -4463,7 +4464,7 @@ ScoreFont* ScoreFont::fallbackFont()

const QRectF ScoreFont::bbox(SymId id, qreal mag) const
{
QRectF r(_fm->tightBoundingRect(sym(id).string()));
QRectF r = sym(id).bbox();
return QRectF(r.x() * mag, r.y() * mag, r.width() * mag, r.height() * mag);
}

Expand Down
3 changes: 3 additions & 0 deletions libmscore/sym.h
Expand Up @@ -1952,6 +1952,7 @@ class Sym {
QString _string;
QPointF _attach;
qreal _width; // cached width
QRectF _bbox; // cached bbbox

public:
Sym() { }
Expand All @@ -1963,6 +1964,8 @@ class Sym {
void setAttach(const QPointF& r) { _attach = r; }
void setWidth(qreal val) { _width = val; }
qreal width() const { return _width; }
void setBbox(QRectF val) { _bbox = val; }
QRectF bbox() const { return _bbox; }

static SymId name2id(const QString& s) { return lnhash.value(s, SymId::noSym); } // return noSym if not found
static SymId oldName2id(const QString s) { return lonhash.value(s, SymId::noSym);}
Expand Down

0 comments on commit 1b4d81d

Please sign in to comment.