Skip to content

Commit

Permalink
fix #20942: Changing font from Emmentaler to Gonville doesn't update …
Browse files Browse the repository at this point in the history
…time signature
  • Loading branch information
lasconic committed May 2, 2013
1 parent 6be7450 commit 2c78b3d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
16 changes: 8 additions & 8 deletions libmscore/timesig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TimeSig::TimeSig(Score* s)
_sig.set(0, 1); // initialize to invalid
_timeSigType = TSIG_NORMAL;
customText = false;
needLayout = true;
_needLayout = true;
}

//---------------------------------------------------------
Expand All @@ -54,7 +54,7 @@ void TimeSig::setSig(const Fraction& f, TimeSigType st)
customText = false;
_timeSigType = st;
// layout1();
needLayout = true;
_needLayout = true;
}

//---------------------------------------------------------
Expand Down Expand Up @@ -95,7 +95,7 @@ void TimeSig::setNumeratorString(const QString& a)
customText = _numeratorString.isEmpty() != _denominatorString.isEmpty()
|| ( !_numeratorString.isEmpty() && _numeratorString != QString::number(_sig.numerator()) )
|| ( !_denominatorString.isEmpty() && _denominatorString != QString::number(_sig.denominator()) );
needLayout = true;
_needLayout = true;
}

//---------------------------------------------------------
Expand All @@ -109,7 +109,7 @@ void TimeSig::setDenominatorString(const QString& a)
customText = _numeratorString.isEmpty() != _denominatorString.isEmpty()
|| ( !_numeratorString.isEmpty() && _numeratorString != QString::number(_sig.numerator()) )
|| ( !_denominatorString.isEmpty() && _denominatorString != QString::number(_sig.denominator()) );
needLayout = true;
_needLayout = true;
}

//---------------------------------------------------------
Expand Down Expand Up @@ -214,7 +214,7 @@ void TimeSig::read(XmlReader& e)
else
_timeSigType = TSIG_NORMAL;
}
needLayout = true;
_needLayout = true;
}

//---------------------------------------------------------
Expand Down Expand Up @@ -307,7 +307,7 @@ void TimeSig::layout1()

pz *= im; // convert positions to raster units
pn *= im;
needLayout = false;
_needLayout = false;
// adjustReadPos();
}

Expand Down Expand Up @@ -479,7 +479,7 @@ QVariant TimeSig::propertyDefault(P_ID id) const

void TimeSig::spatiumChanged(qreal /*oldValue*/, qreal /*newValue*/)
{
needLayout = true;
_needLayout = true;
}

//---------------------------------------------------------
Expand All @@ -488,7 +488,7 @@ void TimeSig::spatiumChanged(qreal /*oldValue*/, qreal /*newValue*/)

void TimeSig::layout()
{
if (needLayout)
if (_needLayout)
layout1();
}

4 changes: 3 additions & 1 deletion libmscore/timesig.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TimeSig : public Element {
Fraction _stretch; // localSig / globalSig
bool _showCourtesySig;
bool customText; // if false, sz and sn are calculated from actualSig()
bool needLayout;
bool _needLayout;
Groups _groups;

void layout1();
Expand Down Expand Up @@ -117,6 +117,8 @@ class TimeSig : public Element {
QVariant propertyDefault(P_ID id) const;
virtual void spatiumChanged(qreal /*oldValue*/, qreal /*newValue*/);

void setNeedLayout(bool nl) { _needLayout = nl; }

const Groups& groups() const { return _groups; }
void setGroups(const Groups& e) { _groups = e; }
void undoSetGroups(const Groups& e);
Expand Down
10 changes: 10 additions & 0 deletions libmscore/undo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,14 @@ ChangeStyle::ChangeStyle(Score* s, const MStyle& st)
{
}

static void updateTimeSigs(void*, Element* e)
{
if (e->type() == Element::TIMESIG) {
TimeSig* ts = static_cast<TimeSig*>(e);
ts->setNeedLayout(true);
}
}

static void updateTextStyle2(void*, Element* e)
{
if (!e->isText())
Expand Down Expand Up @@ -2527,6 +2535,8 @@ void ChangeStyle::flip()

if (score->styleB(ST_concertPitch) != style.valueB(ST_concertPitch))
score->cmdConcertPitchChanged(style.valueB(ST_concertPitch), true);
if (score->styleSt(ST_MusicalSymbolFont) != style.valueSt(ST_MusicalSymbolFont))
score->scanElements(0, updateTimeSigs);

score->setStyle(style);
score->scanElements(0, updateTextStyle2);
Expand Down

0 comments on commit 2c78b3d

Please sign in to comment.