Skip to content

Commit

Permalink
Merge pull request #23473 from Jojo-Schmitz/fix-xml-or-style
Browse files Browse the repository at this point in the history
Sync XML tags with Style ID names
  • Loading branch information
cbjeukendrup committed Jul 10, 2024
2 parents b2b9d57 + 1386a19 commit 1157e0f
Show file tree
Hide file tree
Showing 61 changed files with 1,982 additions and 1,877 deletions.
2 changes: 1 addition & 1 deletion src/engraving/data/styles/gp-style.mss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<fermataShowTabSimple>0</fermataShowTabSimple>
<fermataShowTabCommon>1</fermataShowTabCommon>
<dynamicsShowTabSimple>0</dynamicsShowTabSimple>
<dymanicsShowTabCommon>1</dymanicsShowTabCommon>
<dynamicsShowTabCommon>1</dynamicsShowTabCommon>
<hairpinShowTabSimple>0</hairpinShowTabSimple>
<hairpinShowTabCommon>1</hairpinShowTabCommon>
<accentShowTabSimple>0</accentShowTabSimple>
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/dom/bracket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void Bracket::setStaffSpan(size_t a, size_t b)
m_lastStaff = b;

if (bracketType() == BracketType::BRACE
&& style().styleSt(Sid::MusicalSymbolFont) != "Emmentaler" && style().styleSt(Sid::MusicalSymbolFont) != "Gonville") {
&& style().styleSt(Sid::musicalSymbolFont) != "Emmentaler" && style().styleSt(Sid::musicalSymbolFont) != "Gonville") {
int v = static_cast<int>(m_lastStaff - m_firstStaff + 1);

// if staves inner staves are hidden, decrease span
Expand All @@ -94,7 +94,7 @@ void Bracket::setStaffSpan(size_t a, size_t b)
}
}

if (style().styleSt(Sid::MusicalSymbolFont) == "Leland") {
if (style().styleSt(Sid::musicalSymbolFont) == "Leland") {
v = std::min(4, v);
}

Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2551,7 +2551,7 @@ void Score::cmdResetToDefaultLayout()
Sid::tenutoGateTime,
Sid::staccatoGateTime,
Sid::slurGateTime,
Sid::SectionPause,
Sid::sectionPause,
Sid::showHeader,
Sid::headerFirstPage,
Sid::headerOddEven,
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/dom/layoutbreak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace mu::engraving {
//---------------------------------------------------------

static const ElementStyle sectionBreakStyle {
{ Sid::SectionPause, Pid::PAUSE }
{ Sid::sectionPause, Pid::PAUSE }
};

//---------------------------------------------------------
Expand Down Expand Up @@ -267,7 +267,7 @@ PropertyValue LayoutBreak::propertyDefault(Pid id) const
case Pid::LAYOUT_BREAK:
return PropertyValue(); // LAYOUT_BREAK_LINE;
case Pid::PAUSE:
return style().styleD(Sid::SectionPause);
return style().styleD(Sid::sectionPause);
case Pid::START_WITH_LONG_NAMES:
return true;
case Pid::START_WITH_MEASURE_ONE:
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5698,7 +5698,7 @@ void Score::doLayoutRange(const Fraction& st, const Fraction& et)
end = std::max(et, spanner->tick2());
}

m_engravingFont = engravingFonts()->fontByName(style().value(Sid::MusicalSymbolFont).value<String>().toStdString());
m_engravingFont = engravingFonts()->fontByName(style().value(Sid::musicalSymbolFont).value<String>().toStdString());
m_layoutOptions.noteHeadWidth = m_engravingFont->width(SymId::noteheadBlack, style().spatium() / SPATIUM20);

if (this->cmdState().layoutFlags & LayoutFlag::REBUILD_MIDI_MAPPING) {
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ PropertyValue Symbol::propertyDefault(Pid propertyId) const
return 1.0;
case Pid::SCORE_FONT:
if (m_scoreFont) {
return style().styleSt(Sid::MusicalSymbolFont);
return style().styleSt(Sid::musicalSymbolFont);
} else {
return String();
}
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ Spacer* System::downSpacer(staff_idx_t staffIdx) const

double System::firstNoteRestSegmentX(bool leading)
{
double margin = style().styleMM(Sid::HeaderToLineStartDistance);
double margin = style().styleMM(Sid::headerToLineStartDistance);
for (const MeasureBase* mb : measures()) {
if (mb->isMeasure()) {
const Measure* measure = static_cast<const Measure*>(mb);
Expand Down
10 changes: 5 additions & 5 deletions src/engraving/dom/textbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ RectF TextCursor::cursorRect() const
const TextFragment* fragment = tline.fragment(static_cast<int>(column()));

Font _font = fragment ? fragment->font(m_text) : m_text->font();
if (_font.family() == m_text->style().styleSt(Sid::MusicalSymbolFont)) {
_font.setFamily(m_text->style().styleSt(Sid::MusicalTextFont), Font::Type::MusicSymbolText);
if (_font.family() == m_text->style().styleSt(Sid::musicalSymbolFont)) {
_font.setFamily(m_text->style().styleSt(Sid::musicalTextFont), Font::Type::MusicSymbolText);
if (fragment) {
_font.setPointSizeF(fragment->format.fontSize());
}
Expand Down Expand Up @@ -889,7 +889,7 @@ Font TextFragment::font(const TextBase* t) const
|| t->textStyleType() == TextStyleType::REPEAT_LEFT
|| t->textStyleType() == TextStyleType::REPEAT_RIGHT
) {
std::string fontName = engravingFonts()->fontByName(t->style().styleSt(Sid::MusicalSymbolFont).toStdString())->family();
std::string fontName = engravingFonts()->fontByName(t->style().styleSt(Sid::musicalSymbolFont).toStdString())->family();
family = String::fromStdString(fontName);
fontType = Font::Type::MusicSymbol;
if (!t->isStringTunings()) {
Expand All @@ -916,12 +916,12 @@ Font TextFragment::font(const TextBase* t) const
// but Smufl standard is 20pt so multiply x2 here.
m *= 2;
} else if (t->isTempoText()) {
family = t->style().styleSt(Sid::MusicalTextFont);
family = t->style().styleSt(Sid::musicalTextFont);
fontType = Font::Type::MusicSymbolText;
// to keep desired size ratio (based on 20pt symbol size to 12pt text size)
m *= 5.0 / 3.0;
} else {
family = t->style().styleSt(Sid::MusicalTextFont);
family = t->style().styleSt(Sid::musicalTextFont);
fontType = Font::Type::MusicSymbolText;
}
// check if all symbols are available
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/dom/tremolosinglechord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ double TremoloSingleChord::chordMag() const

double TremoloSingleChord::minHeight() const
{
const double sw = style().styleS(Sid::tremoloStrokeWidth).val() * chordMag();
const double sw = style().styleS(Sid::tremoloLineWidth).val() * chordMag();
const double td = style().styleS(Sid::tremoloDistance).val() * chordMag();
return (lines() - 1) * td + sw;
}
Expand Down Expand Up @@ -167,7 +167,7 @@ PainterPath TremoloSingleChord::basePath(double /*stretch*/) const
const double sp = spatium() * chordMag();

double w2 = sp * style().styleS(Sid::tremoloWidth).val() * .5;
double lw = sp * style().styleS(Sid::tremoloStrokeWidth).val();
double lw = sp * style().styleS(Sid::tremoloLineWidth).val();
double td = sp * style().styleS(Sid::tremoloDistance).val();

PainterPath ppath;
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/dom/tremolotwochord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ double TremoloTwoChord::chordMag() const

double TremoloTwoChord::minHeight() const
{
const double sw = style().styleS(Sid::tremoloStrokeWidth).val() * chordMag();
const double sw = style().styleS(Sid::tremoloLineWidth).val() * chordMag();
const double td = style().styleS(Sid::tremoloDistance).val() * chordMag();
return (lines() - 1) * td + sw;
}
Expand Down Expand Up @@ -602,7 +602,7 @@ PainterPath TremoloTwoChord::basePath(double stretch) const

// overall width of two-note tremolos should not be changed if chordMag() isn't 1.0
double w2 = sp * style().styleS(Sid::tremoloWidth).val() * .5 / (twoNotes() ? chordMag() : 1.0);
double lw = sp * style().styleS(Sid::tremoloStrokeWidth).val();
double lw = sp * style().styleS(Sid::tremoloLineWidth).val();
double td = sp * style().styleS(Sid::tremoloDistance).val();

PainterPath ppath;
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/dom/undo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1934,8 +1934,8 @@ void ChangeStyle::flip(EditData*)
if (score->style().styleV(Sid::concertPitch) != style.value(Sid::concertPitch)) {
score->cmdConcertPitchChanged(style.value(Sid::concertPitch).toBool());
}
if (score->style().styleV(Sid::MusicalSymbolFont) != style.value(Sid::MusicalSymbolFont)) {
score->setEngravingFont(score->engravingFonts()->fontByName(style.styleSt(Sid::MusicalSymbolFont).toStdString()));
if (score->style().styleV(Sid::musicalSymbolFont) != style.value(Sid::musicalSymbolFont)) {
score->setEngravingFont(score->engravingFonts()->fontByName(style.styleSt(Sid::musicalSymbolFont).toStdString()));
}

score->setStyle(style, overlap);
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/engravingmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ void EngravingModule::onInit(const IApplication::RunMode& mode)

#ifndef ENGRAVING_NO_INTERNAL
gpaletteScore->setStyle(DefaultStyle::baseStyle());
gpaletteScore->style().set(Sid::MusicalTextFont, String(u"Leland Text"));
gpaletteScore->style().set(Sid::musicalTextFont, String(u"Leland Text"));
IEngravingFontPtr scoreFont = m_engravingfonts->fontByName("Leland");
gpaletteScore->setEngravingFont(scoreFont);
gpaletteScore->setNoteHeadWidth(scoreFont->width(SymId::noteheadBlack, gpaletteScore->style().spatium()) / SPATIUM20);
Expand Down
10 changes: 5 additions & 5 deletions src/engraving/internal/engravingfont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,10 @@ void EngravingFont::loadEngravingDefaults(const JsonObject& engravingDefaultsObj
// "beamSpacing" handled separately
{ "legerLineThickness", { { Sid::ledgerLineWidth } } },
{ "legerLineExtension", { { Sid::ledgerLineLength } } },
{ "slurEndpointThickness", { { Sid::SlurEndWidth } } },
{ "slurMidpointThickness", { { Sid::SlurMidWidth } } },
{ "tieEndpointThickness", { { Sid::TieEndWidth } } },
{ "tieMidpointThickness", { { Sid::TieMidWidth } } },
{ "slurEndpointThickness", { { Sid::slurEndWidth } } },
{ "slurMidpointThickness", { { Sid::slurMidWidth } } },
{ "tieEndpointThickness", { { Sid::tieEndWidth } } },
{ "tieMidpointThickness", { { Sid::tieMidWidth } } },
{ "thinBarlineThickness", { { Sid::barWidth, Sid::doubleBarWidth } } },
{ "thickBarlineThickness", { { Sid::endBarWidth } } },
// "dashedBarlineThickness" not supported
Expand Down Expand Up @@ -496,7 +496,7 @@ void EngravingFont::loadEngravingDefaults(const JsonObject& engravingDefaultsObj
applyEngravingDefault(key, engravingDefaultsObject.value(key).toDouble());
}

m_engravingDefaults.insert({ Sid::MusicalTextFont, String(u"%1 Text").arg(String::fromStdString(m_family)) });
m_engravingDefaults.insert({ Sid::musicalTextFont, String(u"%1 Text").arg(String::fromStdString(m_family)) });
}

void EngravingFont::computeMetrics(EngravingFont::Sym& sym, const Smufl::Code& code)
Expand Down
8 changes: 4 additions & 4 deletions src/engraving/rendering/dev/arpeggiolayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ double ArpeggioLayout::insetWidth(const Arpeggio* item)
case ArpeggioType::UP_STRAIGHT:
case ArpeggioType::DOWN_STRAIGHT:
{
return (item->width() - item->style().styleMM(Sid::ArpeggioLineWidth)) / 2;
return (item->width() - item->style().styleMM(Sid::arpeggioLineWidth)) / 2;
}

case ArpeggioType::BRACKET:
{
return item->width() - item->style().styleMM(Sid::ArpeggioLineWidth) / 2;
return item->width() - item->style().styleMM(Sid::arpeggioLineWidth) / 2;
}
}
return 0.0;
Expand Down Expand Up @@ -182,7 +182,7 @@ void ArpeggioLayout::clearAccidentals(Arpeggio* item, LayoutContext& ctx)
return true;
}
if (shapeElement.item()->type() == ElementType::ACCIDENTAL) {
// Pad accidentals with Sid::ArpeggioAccidentalDistance either side
// Pad accidentals with Sid::arpeggioAccidentalDistance either side
shapeElement.setTopLeft(PointF(shapeElement.topLeft().x() - arpeggioAccidentalDistance, shapeElement.topLeft().y()));
shapeElement.setWidth(shapeElement.width() + 2 * arpeggioAccidentalDistance);
} else if (shapeElement.item()->type() == ElementType::LEDGER_LINE) {
Expand Down Expand Up @@ -290,7 +290,7 @@ double ArpeggioLayout::insetDistance(const Arpeggio* item, const LayoutContext&
}

double maximumInset = (paddingTable.at(ElementType::ARPEGGIO).at(ElementType::ACCIDENTAL)
- ctx.conf().styleMM(Sid::ArpeggioAccidentalDistanceMin)) * mag_;
- ctx.conf().styleMM(Sid::arpeggioAccidentalDistanceMin)) * mag_;

RectF bbox = item->symBbox(furthestAccidental->symId());
double center = furthestAccidental->note()->pos().y() * mag_;
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/rendering/dev/chordlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ void ChordLayout::layoutTablature(Chord* item, LayoutContext& ctx)
double mag_ = item->staff() ? item->staff()->staffMag(item) : 1.0; // palette elements do not have a staff
double dotNoteDistance = ctx.conf().styleMM(Sid::dotNoteDistance) * mag_;
double minNoteDistance = ctx.conf().styleMM(Sid::minNoteDistance) * mag_;
double minTieLength = ctx.conf().styleMM(Sid::MinTieLength) * mag_;
double minTieLength = ctx.conf().styleMM(Sid::minTieLength) * mag_;

for (Chord* c : item->graceNotes()) {
layoutTablature(c, ctx);
Expand Down
14 changes: 7 additions & 7 deletions src/engraving/rendering/dev/horizontalspacing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ double HorizontalSpacing::minHorizontalDistance(const Segment* f, const Segment*
if (!e || !e->isChord()) {
continue;
}
double headerTieMargin = f->style().styleMM(Sid::HeaderToLineStartDistance);
double headerTieMargin = f->style().styleMM(Sid::headerToLineStartDistance);
for (Note* note : toChord(e)->notes()) {
bool tieOrGlissBack = note->spannerBack().size() || (note->tieBack() && !note->tieBack()->segmentsEmpty());
if (!tieOrGlissBack || note->lineAttachPoints().empty()) {
Expand All @@ -183,11 +183,11 @@ double HorizontalSpacing::minHorizontalDistance(const Segment* f, const Segment*
}
double minLength = 0.0;
if (attachedLine->isTie()) {
minLength = f->style().styleMM(Sid::MinTieLength);
minLength = f->style().styleMM(Sid::minTieLength);
} else if (attachedLine->isGlissando()) {
bool straight = toGlissando(attachedLine)->glissandoType() == GlissandoType::STRAIGHT;
minLength = straight ? f->style().styleMM(Sid::MinStraightGlissandoLength)
: f->style().styleMM(Sid::MinWigglyGlissandoLength);
minLength = straight ? f->style().styleMM(Sid::minStraightGlissandoLength)
: f->style().styleMM(Sid::minWigglyGlissandoLength);
}
double tieStartPointX = f->minRight() + headerTieMargin;
double notePosX = w + note->pos().x() + toChord(e)->pos().x() + note->headWidth() / 2;
Expand Down Expand Up @@ -423,12 +423,12 @@ void HorizontalSpacing::computeNotePadding(const Note* note, const EngravingItem

double minEndPointsDistance = 0.0;
if (laPoint1.line()->isTie()) {
minEndPointsDistance = style.styleMM(Sid::MinTieLength);
minEndPointsDistance = style.styleMM(Sid::minTieLength);
} else if (laPoint1.line()->isGlissando()) {
bool straight = toGlissando(laPoint1.line())->glissandoType() == GlissandoType::STRAIGHT;
double minGlissandoLength = straight
? style.styleMM(Sid::MinStraightGlissandoLength)
: style.styleMM(Sid::MinWigglyGlissandoLength);
? style.styleMM(Sid::minStraightGlissandoLength)
: style.styleMM(Sid::minWigglyGlissandoLength);
minEndPointsDistance = minGlissandoLength;
} else if (laPoint1.line()->isGuitarBend()) {
double minBendLength = 2 * note->spatium(); // TODO: style
Expand Down
10 changes: 5 additions & 5 deletions src/engraving/rendering/dev/slurtielayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2357,13 +2357,13 @@ void SlurTieLayout::layoutSegment(SlurSegment* item, LayoutContext& ctx, const P

void SlurTieLayout::computeMidThickness(SlurTieSegment* slurTieSeg, double slurTieLengthInSp)
{
const Millimetre endWidth = slurTieSeg->isTieSegment() ? slurTieSeg->style().styleMM(Sid::TieEndWidth)
: slurTieSeg->style().styleMM(Sid::SlurEndWidth);
const Millimetre midWidth = slurTieSeg->isTieSegment() ? slurTieSeg->style().styleMM(Sid::TieMidWidth)
: slurTieSeg->style().styleMM(Sid::SlurMidWidth);
const Millimetre endWidth = slurTieSeg->isTieSegment() ? slurTieSeg->style().styleMM(Sid::tieEndWidth)
: slurTieSeg->style().styleMM(Sid::slurEndWidth);
const Millimetre midWidth = slurTieSeg->isTieSegment() ? slurTieSeg->style().styleMM(Sid::tieMidWidth)
: slurTieSeg->style().styleMM(Sid::slurMidWidth);
Staff* staff = slurTieSeg->score() ? slurTieSeg->score()->staff(slurTieSeg->vStaffIdx()) : nullptr;
const double mag = staff ? staff->staffMag(slurTieSeg->slurTie()->tick()) : 1.0;
const double minTieLength = mag * slurTieSeg->style().styleS(Sid::MinTieLength).val();
const double minTieLength = mag * slurTieSeg->style().styleS(Sid::minTieLength).val();
const double shortTieLimit = mag * 4.0;
const double minTieThickness = mag * (0.15 * slurTieSeg->spatium() - endWidth);
const double normalThickness = mag * (midWidth - endWidth);
Expand Down
Loading

0 comments on commit 1157e0f

Please sign in to comment.