Remove most triggerLayoutAll calls

This commit is contained in:
Michele Spagnolo 2023-11-22 10:49:36 +01:00
parent acb1bad4da
commit 0691f8524f
15 changed files with 33 additions and 32 deletions

View file

@ -1893,9 +1893,13 @@ void EngravingItem::triggerLayout() const
}
}
//---------------------------------------------------------
//----------------------------------------------------------------------
// triggerLayoutAll
//---------------------------------------------------------
//
// *************************** CAUTION *******************************
// This causes a layout of the entire score: extremely expensive and
// likely unnecessary! Consider overriding triggerLayout() instead.
//----------------------------------------------------------------------
void EngravingItem::triggerLayoutAll() const
{

View file

@ -526,7 +526,7 @@ bool FiguredBassItem::setProperty(Pid propertyId, const PropertyValue& v)
default:
return EngravingItem::setProperty(propertyId, v);
}
triggerLayoutAll();
triggerLayout();
return true;
}

View file

@ -533,7 +533,7 @@ bool Glissando::setProperty(Pid propertyId, const PropertyValue& v)
}
break;
}
triggerLayoutAll();
triggerLayout();
return true;
}

View file

@ -296,7 +296,7 @@ bool GuitarBend::setProperty(Pid propertyId, const PropertyValue& v)
default:
return SLine::setProperty(propertyId, v);
}
triggerLayoutAll();
triggerLayout();
return true;
}
@ -564,7 +564,7 @@ bool GuitarBendSegment::setProperty(Pid propertyId, const PropertyValue& v)
default:
return LineSegment::setProperty(propertyId, v);
}
triggerLayoutAll();
triggerLayout();
return true;
}

View file

@ -241,7 +241,10 @@ bool LayoutBreak::setProperty(Pid propertyId, const PropertyValue& v)
}
break;
}
triggerLayoutAll();
triggerLayout();
if (explicitParent() && measure()->next()) {
measure()->next()->triggerLayout();
}
setGenerated(false);
return true;
}

View file

@ -345,7 +345,10 @@ void Lyrics::endEdit(EditData& ed)
{
TextBase::endEdit(ed);
triggerLayoutAll();
triggerLayout();
if (m_separator) {
m_separator->triggerLayout();
}
}
//---------------------------------------------------------

View file

@ -112,7 +112,7 @@ bool LyricsLine::setProperty(Pid propertyId, const engraving::PropertyValue& v)
}
break;
}
triggerLayoutAll();
triggerLayout();
return true;
}

View file

@ -208,7 +208,7 @@ bool Marker::setProperty(Pid propertyId, const PropertyValue& v)
}
break;
}
triggerLayoutAll();
triggerLayout();
return true;
}

View file

@ -130,8 +130,6 @@ void MeasureBase::add(EngravingItem* e)
setLineBreak(false);
setSectionBreak(true);
setNoBreak(false);
//does not work with repeats: score()->tempomap()->setPause(endTick(), b->pause());
triggerLayoutAll();
break;
case LayoutBreakType:: NOBREAK:
setPageBreak(false);
@ -169,18 +167,23 @@ void MeasureBase::remove(EngravingItem* el)
case LayoutBreakType::SECTION:
setSectionBreak(false);
score()->setPause(endTick(), 0);
triggerLayoutAll();
break;
case LayoutBreakType::NOBREAK:
setNoBreak(false);
break;
}
}
if (!m_el.remove(el)) {
LOGD("MeasureBase(%p)::remove(%s,%p) not found", this, el->typeName(), el);
} else {
el->removed();
}
triggerLayout();
if (next()) {
next()->triggerLayout();
}
}
//---------------------------------------------------------
@ -445,7 +448,7 @@ bool MeasureBase::setProperty(Pid id, const PropertyValue& value)
}
break;
}
triggerLayoutAll();
triggerLayout();
score()->setPlaylistDirty();
return true;
}

View file

@ -273,7 +273,7 @@ bool SlurTieSegment::setProperty(Pid propertyId, const PropertyValue& v)
default:
return SpannerSegment::setProperty(propertyId, v);
}
triggerLayoutAll();
triggerLayout();
return true;
}
@ -428,7 +428,7 @@ bool SlurTie::setProperty(Pid propertyId, const PropertyValue& v)
default:
return Spanner::setProperty(propertyId, v);
}
triggerLayoutAll();
triggerLayout();
return true;
}

View file

@ -175,7 +175,7 @@ bool SpannerSegment::setProperty(Pid pid, const PropertyValue& v)
switch (pid) {
case Pid::OFFSET2:
m_offset2 = v.value<PointF>();
triggerLayoutAll();
triggerLayout();
break;
default:
return EngravingItem::setProperty(pid, v);
@ -1343,17 +1343,6 @@ void Spanner::triggerLayout() const
score()->setLayout(m_tick, m_tick + m_ticks, staffIdx(), track2staff(tr2), this);
}
void Spanner::triggerLayoutAll() const
{
// Spanners do not have parent even when added to a score, so can't check parent here
score()->setLayoutAll(staffIdx(), this);
const track_idx_t tr2 = track2();
if (tr2 != mu::nidx && tr2 != track()) {
score()->setLayoutAll(track2staff(tr2), this);
}
}
//---------------------------------------------------------
// pushUnusedSegment
//---------------------------------------------------------

View file

@ -193,7 +193,6 @@ public:
bool eitherEndVisible() const;
virtual void triggerLayout() const override;
virtual void triggerLayoutAll() const override;
virtual void add(EngravingItem*) override;
virtual void remove(EngravingItem*) override;
virtual void scanElements(void* data, void (* func)(void*, EngravingItem*), bool all=true) override;

View file

@ -128,7 +128,7 @@ void TieSegment::changeAnchor(EditData& ed, EngravingItem* element)
score()->endCmd();
score()->startCmd();
ed.view()->changeEditElement(newSegment);
triggerLayoutAll();
triggerLayout();
}
}

View file

@ -319,7 +319,7 @@ bool Trill::setProperty(Pid propertyId, const PropertyValue& val)
}
break;
}
triggerLayoutAll();
triggerLayout();
return true;
}

View file

@ -210,7 +210,7 @@ bool Vibrato::setProperty(Pid propertyId, const PropertyValue& val)
}
break;
}
triggerLayoutAll();
triggerLayout();
return true;
}