Skip to content

Commit

Permalink
fix #182211: Time Signature position of numerals not updated when sta…
Browse files Browse the repository at this point in the history
…ff size change
  • Loading branch information
wschweer committed Mar 20, 2017
1 parent c351a0e commit f3ad7db
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 77 deletions.
2 changes: 1 addition & 1 deletion libmscore/chordrest.cpp
Expand Up @@ -1042,7 +1042,7 @@ void ChordRest::remove(Element* e)
// delete beam if empty
//---------------------------------------------------------

void ChordRest::removeDeleteBeam(bool beamed)
void ChordRest::removeDeleteBeam(bool /*beamed*/)
{
if (_beam) {
Beam* b = _beam;
Expand Down
1 change: 0 additions & 1 deletion libmscore/edit.cpp
Expand Up @@ -795,7 +795,6 @@ void Score::cmdAddTimeSig(Measure* fm, int staffIdx, TimeSig* ts, bool local)
nsig->setScore(score);
nsig->setTrack(staffIdx * VOICES);
nsig->setParent(seg);
nsig->setNeedLayout(true);
undoAddElement(nsig);
}
else {
Expand Down
1 change: 0 additions & 1 deletion libmscore/measure.cpp
Expand Up @@ -1145,7 +1145,6 @@ void Measure::cmdAddStaves(int sStaff, int eStaff, bool createRest)
timesig->setTrack(staffIdx * VOICES);
timesig->setParent(ts);
timesig->setSig(ots->sig(), ots->timeSigType());
timesig->setNeedLayout(true);
score()->undoAddElement(timesig);
if (constructed)
delete ots;
Expand Down
44 changes: 0 additions & 44 deletions libmscore/timesig.cpp
Expand Up @@ -44,17 +44,6 @@ TimeSig::TimeSig(Score* s)
_largeParentheses = false;
}

//---------------------------------------------------------
// clone
//---------------------------------------------------------

TimeSig* TimeSig::clone() const
{
TimeSig* ts = new TimeSig(*this);
ts->setNeedLayout(true); // relayout of the ts is needed in parts #24571
return ts;
}

//---------------------------------------------------------
// mag
//---------------------------------------------------------
Expand All @@ -73,11 +62,9 @@ void TimeSig::setSig(const Fraction& f, TimeSigType st)
{
if (!_sig.identical(f)) {
_sig = f;
_needLayout = true;
}
if (_timeSigType != st) {
_timeSigType = st;
_needLayout = true;
}
customText = false;
_largeParentheses = false;
Expand Down Expand Up @@ -121,7 +108,6 @@ void TimeSig::setNumeratorString(const QString& a)
_numeratorString = a;
customText = (_denominatorString != QString::number(_sig.denominator()))
|| (_numeratorString != QString::number(_sig.numerator()));
_needLayout = true;
}
}

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

Expand Down Expand Up @@ -246,24 +231,13 @@ void TimeSig::read(XmlReader& e)
customText = false;
}
_stretch.reduce();
_needLayout = true;
}

//---------------------------------------------------------
// layout
//---------------------------------------------------------

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

//---------------------------------------------------------
// layout1
//---------------------------------------------------------

void TimeSig::layout1()
{
setPos(0.0, 0.0);
qreal _spatium = spatium();
Expand Down Expand Up @@ -372,8 +346,6 @@ void TimeSig::layout1()
addbbox(QRect(pointLargeRightParen.x(), pointLargeRightParen.y() - denRect.height(), _spatium / 2, numRect.height() + denRect.height()));
}
}

_needLayout = false;
}

//---------------------------------------------------------
Expand Down Expand Up @@ -409,7 +381,6 @@ void TimeSig::setFrom(const TimeSig* ts)
_sig = ts->_sig;
_stretch = ts->_stretch;
customText = ts->customText;
_needLayout = true;
}

//---------------------------------------------------------
Expand Down Expand Up @@ -505,7 +476,6 @@ bool TimeSig::setProperty(P_ID propertyId, const QVariant& v)
return false;
break;
}
_needLayout = true;
score()->setLayoutAll(); // TODO
setGenerated(false);
return true;
Expand Down Expand Up @@ -578,20 +548,6 @@ void TimeSig::styleChanged()
Element::styleChanged();
}

//---------------------------------------------------------
// spatiumChanged
//---------------------------------------------------------

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

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

//---------------------------------------------------------
// nextElement
//---------------------------------------------------------
Expand Down
8 changes: 1 addition & 7 deletions libmscore/timesig.h
Expand Up @@ -65,7 +65,6 @@ class TimeSig : public Element {
TimeSigType _timeSigType;
bool _showCourtesySig;
bool customText; // if false, sz and sn are calculated from _sig
bool _needLayout;
bool _largeParentheses;
PropertyFlags scaleStyle;

Expand All @@ -77,7 +76,7 @@ class TimeSig : public Element {
QString ssig() const;
void setSSig(const QString&);

virtual TimeSig* clone() const override;
virtual TimeSig* clone() const override { return new TimeSig(*this); }
virtual ElementType type() const override { return ElementType::TIMESIG; }

TimeSigType timeSigType() const { return _timeSigType; }
Expand Down Expand Up @@ -131,11 +130,6 @@ class TimeSig : public Element {

bool hasCustomText() const { return customText; }

virtual void spatiumChanged(qreal /*oldValue*/, qreal /*newValue*/) override;
virtual void localSpatiumChanged(qreal /*oldValue*/, qreal /*newValue*/) override;

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

const Groups& groups() const { return _groups; }
void setGroups(const Groups& e) { _groups = e; }

Expand Down
23 changes: 0 additions & 23 deletions libmscore/undo.cpp
Expand Up @@ -2479,17 +2479,6 @@ ChangeStaff::ChangeStaff(Staff* _staff, bool _invisible,
hideSystemBarLine = hide;
}

//---------------------------------------------------------
// notifyTimeSigs
// mark timesigs for layout
//---------------------------------------------------------

static void notifyTimeSigs(void*, Element* e)
{
if (e->isTimeSig())
toTimeSig(e)->setNeedLayout(true);
}

//---------------------------------------------------------
// flip
//---------------------------------------------------------
Expand Down Expand Up @@ -2528,8 +2517,6 @@ void ChangeStaff::flip()
staff->score()->setLayoutAll();
staff->masterScore()->rebuildMidiMapping();
staff->score()->setPlaylistDirty();

score->scanElements(0, notifyTimeSigs);
}

//---------------------------------------------------------
Expand All @@ -2546,7 +2533,6 @@ void ChangeStaffType::flip()

Score* score = staff->score();
score->setLayoutAll();
score->scanElements(0, notifyTimeSigs);
}

//---------------------------------------------------------
Expand Down Expand Up @@ -2594,14 +2580,6 @@ ChangeStyle::ChangeStyle(Score* s, const MStyle& st)
{
}

static void updateTimeSigs(void*, Element* e)
{
if (e->isTimeSig()) {
TimeSig* ts = toTimeSig(e);
ts->setNeedLayout(true);
}
}

//---------------------------------------------------------
// flip
//---------------------------------------------------------
Expand All @@ -2614,7 +2592,6 @@ void ChangeStyle::flip()
score->cmdConcertPitchChanged(style.value(StyleIdx::concertPitch).toBool(), true);
if (score->styleV(StyleIdx::MusicalSymbolFont) != style.value(StyleIdx::MusicalSymbolFont)) {
score->setScoreFont(ScoreFont::fontFactory(style.value(StyleIdx::MusicalSymbolFont).toString()));
score->scanElements(0, updateTimeSigs);
}
score->setStyle(style);
score->styleChanged();
Expand Down
1 change: 1 addition & 0 deletions mscore/keyb.cpp
Expand Up @@ -303,6 +303,7 @@ void ScoreView::editKey(QKeyEvent* ev)
ed.data.clear();
if (curGrip != Grip::NO_GRIP && int(curGrip) < grips)
ed.pos = grip[int(curGrip)].center() + delta;

editObject->score()->startCmd();
editObject->startEditDrag(ed);
editObject->editDrag(ed);
Expand Down

1 comment on commit f3ad7db

@ericfont
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this has apparently fixed the issue...just noting that I've verified on that github-musescore-musescore-0d76609

Please sign in to comment.