Skip to content

Commit

Permalink
Fix GH#24998: cannot use shortcut (show-corrupted-measures)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jojo-Schmitz committed Oct 2, 2024
1 parent b125284 commit 6ba7955
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
16 changes: 8 additions & 8 deletions src/engraving/dom/check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ Ret Score::sanityCheckLocal()
Rest* fmrest0 = nullptr; // full measure rest in voice 0
Fraction voices[VOICES];

#ifndef NDEBUG
// #ifndef NDEBUG
m->setCorrupted(staffIdx, false);
#endif
// #endif

for (Segment* s = m->first(SegmentType::ChordRest); s; s = s->next(SegmentType::ChordRest)) {
for (voice_idx_t v = 0; v < VOICES; ++v) {
Expand Down Expand Up @@ -190,18 +190,18 @@ Ret Score::sanityCheckLocal()
if (!repeatsIsValid) {
errors << muse::mtrc("engraving", "<b>Corrupted measure</b>: %1, measure %2, staff %3.")
.arg(excerptInfo()).arg(mNumber).arg(staffIdx + 1);
#ifndef NDEBUG
// #ifndef NDEBUG
m->setCorrupted(staffIdx, true);
#endif
// #endif
}

if (voices[0] != mLen) {
//: %1 describes in which score the corruption is (either `Full score` or `"[part name]" part score`)
errors << muse::mtrc("engraving", "<b>Incomplete measure</b>: %1, measure %2, staff %3. Found: %4. Expected: %5.")
.arg(excerptInfo()).arg(mNumber).arg(staffIdx + 1).arg(voices[0].toString(), mLen.toString());
#ifndef NDEBUG
// #ifndef NDEBUG
m->setCorrupted(staffIdx, true);
#endif
// #endif
// try to fix a bad full measure rest
if (fmrest0) {
// fmrest0->setDuration(mLen * fmrest0->staff()->timeStretch(fmrest0->tick()));
Expand All @@ -214,9 +214,9 @@ Ret Score::sanityCheckLocal()
//: %1 describes in which score the corruption is (either `Full score` or `"[part name]" part score`)
errors << muse::mtrc("engraving", "<b>Voice too long</b>: %1, measure %2, staff %3, voice %4. Found: %5. Expected: %6.")
.arg(excerptInfo()).arg(mNumber).arg(staffIdx + 1).arg(v + 1).arg(voices[v].toString(), mLen.toString());
#ifndef NDEBUG
// #ifndef NDEBUG
m->setCorrupted(staffIdx, true);
#endif
// #endif
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/engraving/dom/measure.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ class MStaff
bool stemless() const { return m_stemless; }
void setStemless(bool val) { m_stemless = val; }

#ifndef NDEBUG
// #ifndef NDEBUG
bool corrupted() const { return m_corrupted; }
void setCorrupted(bool val) { m_corrupted = val; }
#endif
// #endif

int measureRepeatCount() const { return m_measureRepeatCount; }
void setMeasureRepeatCount(int n) { m_measureRepeatCount = n; }
Expand All @@ -125,9 +125,9 @@ class MStaff
// this changes some layout rules
bool m_visible = true;
bool m_stemless = false;
#ifndef NDEBUG
// #ifndef NDEBUG
bool m_corrupted = false;
#endif
// #endif
int m_measureRepeatCount = 0;
};

Expand Down Expand Up @@ -176,10 +176,10 @@ class Measure final : public MeasureBase
Spacer* vspacerUp(staff_idx_t staffIdx) const;
void setStaffVisible(staff_idx_t staffIdx, bool visible);
void setStaffStemless(staff_idx_t staffIdx, bool stemless);
#ifndef NDEBUG
// #ifndef NDEBUG
bool corrupted(staff_idx_t staffIdx) const { return m_mstaves[staffIdx]->corrupted(); }
void setCorrupted(staff_idx_t staffIdx, bool val) { m_mstaves[staffIdx]->setCorrupted(val); }
#endif
// #endif
MeasureNumber* noText(staff_idx_t staffIdx) const { return m_mstaves[staffIdx]->noText(); }
void setNoText(staff_idx_t staffIdx, MeasureNumber* t) { m_mstaves[staffIdx]->setNoText(t); }

Expand Down
8 changes: 6 additions & 2 deletions src/engraving/iengravingconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ class IEngravingConfiguration : MODULE_EXPORT_INTERFACE
bool colorSegmentShapes = false;
bool showSkylines = false;
bool showSystemBoundingRects = false;
#ifndef NDEBUG
bool showCorruptedMeasures = true;
#else
bool showCorruptedMeasures = false;
#endif

bool anyEnabled() const
{
Expand All @@ -103,9 +107,9 @@ class IEngravingConfiguration : MODULE_EXPORT_INTERFACE
|| colorSegmentShapes
|| showSkylines
|| showSystemBoundingRects
#ifndef NDEBUG
// #ifndef NDEBUG
|| showCorruptedMeasures
#endif
// #endif
;
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/rendering/score/debugpaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void DebugPaint::paintPageDebug(Painter& painter, const Page* page, const std::v
}
}

#ifndef NDEBUG
// #ifndef NDEBUG
if (options.showCorruptedMeasures) {
painter.setPen(Pen(Color::RED, 4.0));
painter.setBrush(BrushStyle::NoBrush);
Expand All @@ -256,7 +256,7 @@ void DebugPaint::paintPageDebug(Painter& painter, const Page* page, const std::v
}
}
}
#endif
// #endif

painter.restore();
}
Expand Down

0 comments on commit 6ba7955

Please sign in to comment.