Skip to content

Commit

Permalink
Fix #314029: Order of Text styles in Inspector dropdown and Styles di…
Browse files Browse the repository at this point in the history
…alog is different
  • Loading branch information
Jojo-Schmitz committed Dec 7, 2020
1 parent 8c98ded commit bf07f14
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 67 deletions.
2 changes: 1 addition & 1 deletion libmscore/read114.cpp
Expand Up @@ -670,7 +670,7 @@ static void readFingering114(XmlReader& e, Fingering* fing)
auto subtype = e.readElementText();
if (subtype == "StringNumber") {
isStringNumber = true;
fing->setProperty(Pid::SUB_STYLE, QVariant(10));
fing->setProperty(Pid::SUB_STYLE, QVariant(int(Tid::STRING_NUMBER)));
fing->setPropertyFlags(Pid::SUB_STYLE, PropertyFlags::UNSTYLED);
}
}
Expand Down
82 changes: 41 additions & 41 deletions libmscore/style.cpp
Expand Up @@ -2404,61 +2404,61 @@ struct TextStyleName {
Tid tid;
};

// Must be in sync with Tid enum (in types.h)

static constexpr std::array<TextStyleName, int(Tid::TEXT_STYLES)> textStyles { {
{ QT_TRANSLATE_NOOP("TextStyle", "Default"), &defaultTextStyle, Tid::DEFAULT },
// Page-orientde styles
{ QT_TRANSLATE_NOOP("TextStyle", "Title"), &titleTextStyle, Tid::TITLE },
{ QT_TRANSLATE_NOOP("TextStyle", "Subtitle"), &subTitleTextStyle, Tid::SUBTITLE },
{ QT_TRANSLATE_NOOP("TextStyle", "Composer"), &composerTextStyle, Tid::COMPOSER },
{ QT_TRANSLATE_NOOP("TextStyle", "Lyricist"), &lyricistTextStyle, Tid::POET },

{ QT_TRANSLATE_NOOP("TextStyle", "Lyrics Odd Lines"), &lyricsOddTextStyle, Tid::LYRICS_ODD },
{ QT_TRANSLATE_NOOP("TextStyle", "Lyrics Even Lines"), &lyricsEvenTextStyle, Tid::LYRICS_EVEN },
{ QT_TRANSLATE_NOOP("TextStyle", "Fingering"), &fingeringTextStyle, Tid::FINGERING },
{ QT_TRANSLATE_NOOP("TextStyle", "LH Guitar Fingering"), &lhGuitarFingeringTextStyle, Tid::LH_GUITAR_FINGERING },
{ QT_TRANSLATE_NOOP("TextStyle", "RH Guitar Fingering"), &rhGuitarFingeringTextStyle, Tid::RH_GUITAR_FINGERING },
{ QT_TRANSLATE_NOOP("TextStyle", "String Number"), &stringNumberTextStyle, Tid::STRING_NUMBER },

{ QT_TRANSLATE_NOOP("TextStyle", "Translator"), &translatorTextStyle, Tid::TRANSLATOR },
{ QT_TRANSLATE_NOOP("TextStyle", "Frame"), &frameTextStyle, Tid::FRAME },
{ QT_TRANSLATE_NOOP("TextStyle", "Instrument Name (Part)"), &partInstrumentTextStyle, Tid::INSTRUMENT_EXCERPT },
{ QT_TRANSLATE_NOOP("TextStyle", "Instrument Name (Long)"), &longInstrumentTextStyle, Tid::INSTRUMENT_LONG },
{ QT_TRANSLATE_NOOP("TextStyle", "Instrument Name (Short)"), &shortInstrumentTextStyle, Tid::INSTRUMENT_SHORT },
{ QT_TRANSLATE_NOOP("TextStyle", "Instrument Name (Part)"), &partInstrumentTextStyle, Tid::INSTRUMENT_EXCERPT },
{ QT_TRANSLATE_NOOP("TextStyle", "Dynamics"), &dynamicsTextStyle, Tid::DYNAMICS },
{ QT_TRANSLATE_NOOP("TextStyle", "Expression"), &expressionTextStyle, Tid::EXPRESSION },

{ QT_TRANSLATE_NOOP("TextStyle", "Tempo"), &tempoTextStyle, Tid::TEMPO },
{ QT_TRANSLATE_NOOP("TextStyle", "Metronome"), &metronomeTextStyle, Tid::METRONOME },
{ QT_TRANSLATE_NOOP("TextStyle", "Instrument Change"), &instrumentChangeTextStyle, Tid::INSTRUMENT_CHANGE },
{ QT_TRANSLATE_NOOP("TextStyle", "Header"), &headerTextStyle, Tid::HEADER },
{ QT_TRANSLATE_NOOP("TextStyle", "Footer"), &footerTextStyle, Tid::FOOTER },
// Measure-oriented styles
{ QT_TRANSLATE_NOOP("TextStyle", "Measure Number"), &measureNumberTextStyle, Tid::MEASURE_NUMBER },
{ QT_TRANSLATE_NOOP("TextStyle", "Multi-Measure Rest Range"), &mmRestRangeTextStyle, Tid::MMREST_RANGE },
{ QT_TRANSLATE_NOOP("TextStyle", "Translator"), &translatorTextStyle, Tid::TRANSLATOR },
{ QT_TRANSLATE_NOOP("TextStyle", "Tuplet"), &tupletTextStyle, Tid::TUPLET },

// Sytem-level styles
{ QT_TRANSLATE_NOOP("TextStyle", "Tempo"), &tempoTextStyle, Tid::TEMPO },
{ QT_TRANSLATE_NOOP("TextStyle", "Metronome"), &metronomeTextStyle, Tid::METRONOME },
{ QT_TRANSLATE_NOOP("TextStyle", "Repeat Text Left"), &repeatLeftTextStyle, Tid::REPEAT_LEFT },
{ QT_TRANSLATE_NOOP("TextStyle", "Repeat Text Right"), &repeatRightTextStyle, Tid::REPEAT_RIGHT },
{ QT_TRANSLATE_NOOP("TextStyle", "Rehearsal Mark"), &rehearsalMarkTextStyle, Tid::REHEARSAL_MARK },
{ QT_TRANSLATE_NOOP("TextStyle", "System"), &systemTextStyle, Tid::SYSTEM },
// Staff oriented styles
{ QT_TRANSLATE_NOOP("TextStyle", "Staff"), &staffTextStyle, Tid::STAFF },
{ QT_TRANSLATE_NOOP("TextStyle", "Expression"), &expressionTextStyle, Tid::EXPRESSION },
{ QT_TRANSLATE_NOOP("TextStyle", "Dynamics"), &dynamicsTextStyle, Tid::DYNAMICS },
{ QT_TRANSLATE_NOOP("TextStyle", "Hairpin"), &hairpinTextStyle, Tid::HAIRPIN },
{ QT_TRANSLATE_NOOP("TextStyle", "Lyrics Odd Lines"), &lyricsOddTextStyle, Tid::LYRICS_ODD },
{ QT_TRANSLATE_NOOP("TextStyle", "Lyrics Even Lines"), &lyricsEvenTextStyle, Tid::LYRICS_EVEN },
{ QT_TRANSLATE_NOOP("TextStyle", "Chord Symbol"), &chordSymbolTextStyleA, Tid::HARMONY_A },
{ QT_TRANSLATE_NOOP("TextStyle", "Chord Symbol (Alternate)"),&chordSymbolTextStyleB, Tid::HARMONY_B },
{ QT_TRANSLATE_NOOP("TextStyle", "Roman Numeral Analysis"), &romanNumeralTextStyle, Tid::HARMONY_ROMAN },
{ QT_TRANSLATE_NOOP("TextStyle", "Nashville Number"), &nashvilleNumberTextStyle, Tid::HARMONY_NASHVILLE },
{ QT_TRANSLATE_NOOP("TextStyle", "Rehearsal Mark"), &rehearsalMarkTextStyle, Tid::REHEARSAL_MARK },

{ QT_TRANSLATE_NOOP("TextStyle", "Repeat Text Left"), &repeatLeftTextStyle, Tid::REPEAT_LEFT },
{ QT_TRANSLATE_NOOP("TextStyle", "Repeat Text Right"), &repeatRightTextStyle, Tid::REPEAT_RIGHT },
{ QT_TRANSLATE_NOOP("TextStyle", "Frame"), &frameTextStyle, Tid::FRAME },
// Note oriented styles
{ QT_TRANSLATE_NOOP("TextStyle", "Tuplet"), &tupletTextStyle, Tid::TUPLET },
{ QT_TRANSLATE_NOOP("TextStyle", "Sticking"), &stickingTextStyle, Tid::STICKING },
{ QT_TRANSLATE_NOOP("TextStyle", "Fingering"), &fingeringTextStyle, Tid::FINGERING },
{ QT_TRANSLATE_NOOP("TextStyle", "LH Guitar Fingering"), &lhGuitarFingeringTextStyle, Tid::LH_GUITAR_FINGERING },
{ QT_TRANSLATE_NOOP("TextStyle", "RH Guitar Fingering"), &rhGuitarFingeringTextStyle, Tid::RH_GUITAR_FINGERING },
{ QT_TRANSLATE_NOOP("TextStyle", "String Number"), &stringNumberTextStyle, Tid::STRING_NUMBER },
// Line-oriented styles
{ QT_TRANSLATE_NOOP("TextStyle", "Text Line"), &textLineTextStyle, Tid::TEXTLINE },
{ QT_TRANSLATE_NOOP("TextStyle", "Glissando"), &glissandoTextStyle, Tid::GLISSANDO },

{ QT_TRANSLATE_NOOP("TextStyle", "Ottava"), &ottavaTextStyle, Tid::OTTAVA },
{ QT_TRANSLATE_NOOP("TextStyle", "Volta"), &voltaTextStyle, Tid::VOLTA },
{ QT_TRANSLATE_NOOP("TextStyle", "Ottava"), &ottavaTextStyle, Tid::OTTAVA },
{ QT_TRANSLATE_NOOP("TextStyle", "Glissando"), &glissandoTextStyle, Tid::GLISSANDO },
{ QT_TRANSLATE_NOOP("TextStyle", "Pedal"), &pedalTextStyle, Tid::PEDAL },
{ QT_TRANSLATE_NOOP("TextStyle", "Bend"), &bendTextStyle, Tid::BEND },
{ QT_TRANSLATE_NOOP("TextStyle", "Let Ring"), &letRingTextStyle, Tid::LET_RING },
{ QT_TRANSLATE_NOOP("TextStyle", "Palm Mute"), &palmMuteTextStyle, Tid::PALM_MUTE },

{ QT_TRANSLATE_NOOP("TextStyle", "Hairpin"), &hairpinTextStyle, Tid::HAIRPIN },
{ QT_TRANSLATE_NOOP("TextStyle", "Bend"), &bendTextStyle, Tid::BEND },
{ QT_TRANSLATE_NOOP("TextStyle", "Header"), &headerTextStyle, Tid::HEADER },
{ QT_TRANSLATE_NOOP("TextStyle", "Footer"), &footerTextStyle, Tid::FOOTER },
{ QT_TRANSLATE_NOOP("TextStyle", "Instrument Change"), &instrumentChangeTextStyle, Tid::INSTRUMENT_CHANGE },

{ QT_TRANSLATE_NOOP("TextStyle", "Sticking"), &stickingTextStyle, Tid::STICKING },

// User styles
{ QT_TRANSLATE_NOOP("TextStyle", "User-1"), &user1TextStyle, Tid::USER1 },
{ QT_TRANSLATE_NOOP("TextStyle", "User-2"), &user2TextStyle, Tid::USER2 },
{ QT_TRANSLATE_NOOP("TextStyle", "User-3"), &user3TextStyle, Tid::USER3 },
Expand Down Expand Up @@ -2539,21 +2539,21 @@ static const std::vector<Tid> _primaryTextStyles = {
Tid::POET,
Tid::TRANSLATOR,
Tid::FRAME,
Tid::INSTRUMENT_EXCERPT,
Tid::INSTRUMENT_CHANGE,
Tid::HEADER,
Tid::FOOTER,
Tid::MEASURE_NUMBER,
Tid::MMREST_RANGE,
Tid::INSTRUMENT_EXCERPT,
Tid::INSTRUMENT_CHANGE,
Tid::STAFF,
Tid::TEMPO,
Tid::REPEAT_LEFT,
Tid::REPEAT_RIGHT,
Tid::REHEARSAL_MARK,
Tid::SYSTEM,
Tid::STAFF,
Tid::EXPRESSION,
Tid::DYNAMICS,
Tid::HAIRPIN,
Tid::TEMPO,
Tid::REHEARSAL_MARK,
Tid::REPEAT_LEFT,
Tid::REPEAT_RIGHT,
Tid::LYRICS_ODD,
Tid::LYRICS_EVEN,
Tid::HARMONY_A,
Expand Down
50 changes: 25 additions & 25 deletions libmscore/types.h
Expand Up @@ -478,46 +478,46 @@ enum class Tid {
SUBTITLE,
COMPOSER,
POET,
LYRICS_ODD,
LYRICS_EVEN,
FINGERING,
LH_GUITAR_FINGERING,
RH_GUITAR_FINGERING,
STRING_NUMBER,
TRANSLATOR,
FRAME,
INSTRUMENT_EXCERPT,
INSTRUMENT_LONG,
INSTRUMENT_SHORT,
INSTRUMENT_EXCERPT,
DYNAMICS,
EXPRESSION,
TEMPO,
METRONOME,
INSTRUMENT_CHANGE,
HEADER,
FOOTER,
MEASURE_NUMBER,
MMREST_RANGE,
TRANSLATOR,
TUPLET,
TEMPO,
METRONOME,
REPEAT_LEFT, // align to start of measure
REPEAT_RIGHT, // align to end of measure
REHEARSAL_MARK,
SYSTEM,
STAFF,
EXPRESSION,
DYNAMICS,
HAIRPIN,
LYRICS_ODD,
LYRICS_EVEN,
HARMONY_A,
HARMONY_B,
HARMONY_ROMAN,
HARMONY_NASHVILLE,
REHEARSAL_MARK,
REPEAT_LEFT, // align to start of measure
REPEAT_RIGHT, // align to end of measure
FRAME,
TUPLET,
STICKING,
FINGERING,
LH_GUITAR_FINGERING,
RH_GUITAR_FINGERING,
STRING_NUMBER,
TEXTLINE,
GLISSANDO,
OTTAVA,
VOLTA,
OTTAVA,
GLISSANDO,
PEDAL,
BEND,
LET_RING,
PALM_MUTE,
HAIRPIN,
BEND,
HEADER,
FOOTER,
INSTRUMENT_CHANGE,
STICKING,
USER1,
USER2,
USER3,
Expand Down

0 comments on commit bf07f14

Please sign in to comment.