add more F and C clefs, refactor clef.cpp and use symId and line when possible

This commit is contained in:
lasconic 2016-09-28 20:34:21 +02:00
parent 202d3728f8
commit f966b08d77
17 changed files with 155 additions and 174 deletions

View file

@ -32,32 +32,40 @@ namespace Ms {
// table must be in sync with enum ClefType
const ClefInfo ClefInfo::clefTable[] = {
// tag xmlName line oCh pOff|-lines for sharps---||---lines for flats--| name
{ "G", "G", 2, 0, 45, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, QT_TRANSLATE_NOOP("clefTable", "Treble clef"), StaffGroup::STANDARD },
{ "G8va", "G", 2, 1, 52, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, QT_TRANSLATE_NOOP("clefTable", "Treble clef 8va"), StaffGroup::STANDARD },
{ "G15ma","G", 2, 2, 59, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, QT_TRANSLATE_NOOP("clefTable", "Treble clef 15ma"), StaffGroup::STANDARD },
{ "G8vb", "G", 2, -1, 38, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, QT_TRANSLATE_NOOP("clefTable", "Treble clef 8vb"), StaffGroup::STANDARD },
{ "F", "F", 4, 0, 33, { 2, 5, 1, 4, 7, 3, 6, 6, 3, 7, 4, 8, 5, 9 }, QT_TRANSLATE_NOOP("clefTable", "Bass clef"), StaffGroup::STANDARD },
{ "F8vb", "F", 4, -1, 26, { 2, 5, 1, 4, 7, 3, 6, 6, 3, 7, 4, 8, 5, 9 }, QT_TRANSLATE_NOOP("clefTable", "Bass clef 8vb"), StaffGroup::STANDARD },
{ "F15mb","F", 4, -2, 19, { 2, 5, 1, 4, 7, 3, 6, 6, 3, 7, 4, 8, 5, 9 }, QT_TRANSLATE_NOOP("clefTable", "Bass clef 15mb"), StaffGroup::STANDARD },
{ "F3", "F", 3, 0, 35, { 4, 0, 3,-1, 2, 5, 1, 1, 5, 2, 6, 3, 7, 4 }, QT_TRANSLATE_NOOP("clefTable", "Baritone clef (F clef)"), StaffGroup::STANDARD },
{ "F5", "F", 5, 0, 31, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, QT_TRANSLATE_NOOP("clefTable", "Subbass clef"), StaffGroup::STANDARD },
{ "C1", "C", 1, 0, 43, { 5, 1, 4, 0, 3,-1, 2, 2, 6, 3, 7, 4, 8, 5 }, QT_TRANSLATE_NOOP("clefTable", "Soprano clef"), StaffGroup::STANDARD }, // C1
{ "C2", "C", 2, 0, 41, { 3, 6, 2, 5, 1, 4, 0, 0, 4, 1, 5, 2, 6, 3 }, QT_TRANSLATE_NOOP("clefTable", "Mezzo-soprano clef"), StaffGroup::STANDARD }, // C2
{ "C3", "C", 3, 0, 39, { 1, 4, 0, 3, 6, 2, 5, 5, 2, 6, 3, 7, 4, 8 }, QT_TRANSLATE_NOOP("clefTable", "Alto clef"), StaffGroup::STANDARD }, // C3
{ "C4", "C", 4, 0, 37, { 6, 2, 5, 1, 4, 0, 3, 3, 0, 4, 1, 5, 2, 6 }, QT_TRANSLATE_NOOP("clefTable", "Tenor clef"), StaffGroup::STANDARD }, // C4
{ "TAB", "TAB", 5, 0, 0, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, QT_TRANSLATE_NOOP("clefTable", "Tablature"), StaffGroup::TAB },
{ "TAB4", "TAB", 5, 0, 0, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, QT_TRANSLATE_NOOP("clefTable", "Tablature 4 lines"), StaffGroup::TAB },
{ "PERC", "percussion",2, 0, 45, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, QT_TRANSLATE_NOOP("clefTable", "Percussion"), StaffGroup::PERCUSSION},
{ "C5", "C", 5, 0, 35, { 4, 0, 3,-1, 2, 5, 1, 1, 5, 2, 6, 3, 7, 4 }, QT_TRANSLATE_NOOP("clefTable", "Baritone clef (C clef)"), StaffGroup::STANDARD }, // C5
{ "G1", "G", 1, 0, 47, { 2, 5, 1, 4, 7, 3, 6, 6, 3, 7, 4, 8, 5, 9 }, QT_TRANSLATE_NOOP("clefTable", "French violin clef"), StaffGroup::STANDARD }, // G4
{ "F8va", "F", 4, 1, 40, { 2, 5, 1, 4, 7, 3, 6, 6, 3, 7, 4, 8, 5, 9 }, QT_TRANSLATE_NOOP("clefTable", "Bass clef 8va"), StaffGroup::STANDARD }, // F_8VA
{ "F15ma","F", 4, 2, 47, { 2, 5, 1, 4, 7, 3, 6, 6, 3, 7, 4, 8, 5, 9 }, QT_TRANSLATE_NOOP("clefTable", "Bass clef 15ma"), StaffGroup::STANDARD }, // F_15MA
{ "PERC2","percussion",2, 0, 45, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, QT_TRANSLATE_NOOP("clefTable", "Percussion2"), StaffGroup::PERCUSSION}, // PERC2
{ "TAB2", "TAB", 5, 0, 0, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, QT_TRANSLATE_NOOP("clefTable", "Tablature Serif"), StaffGroup::TAB },
{ "TAB4_SERIF", "TAB", 5, 0, 0, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, QT_TRANSLATE_NOOP("clefTable", "Tablature Serif 4 lines"), StaffGroup::TAB },
{ "G8vbp","G", 2, 0, 45, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, QT_TRANSLATE_NOOP("clefTable", "Treble clef optional 8vb"),StaffGroup::STANDARD }, // G5
{ "G8vbo","G", 2, -1, 38, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, QT_TRANSLATE_NOOP("clefTable", "Treble clef 8vb Old"), StaffGroup::STANDARD },
// tag xmlName line oCh pOff|-lines for sharps---||---lines for flats--| symbol | name
{ "G", "G", 2, 0, 45, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, SymId::gClef, QT_TRANSLATE_NOOP("clefTable", "Treble clef"), StaffGroup::STANDARD }, // G
{ "G15mb","G", 2, -2, 59, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, SymId::gClef15mb, QT_TRANSLATE_NOOP("clefTable", "Treble clef 15mb"), StaffGroup::STANDARD }, // G15_MB
{ "G8vb", "G", 2, -1, 38, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, SymId::gClef8vb, QT_TRANSLATE_NOOP("clefTable", "Treble clef 8vb"), StaffGroup::STANDARD }, // G8_VB
{ "G8va", "G", 2, 1, 52, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, SymId::gClef8va, QT_TRANSLATE_NOOP("clefTable", "Treble clef 8va"), StaffGroup::STANDARD }, // G8_VA
{ "G15ma","G", 2, 2, 59, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, SymId::gClef15ma, QT_TRANSLATE_NOOP("clefTable", "Treble clef 15ma"), StaffGroup::STANDARD }, // G15_MA
{ "G8vbo","G", 2, -1, 38, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, SymId::gClef8vbOld, QT_TRANSLATE_NOOP("clefTable", "Double treble clef 8vb on 2nd line"), StaffGroup::STANDARD }, // G8_VB_O
{ "G8vbp","G", 2, 0, 45, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, SymId::gClef8vbParens, QT_TRANSLATE_NOOP("clefTable", "Treble clef optional 8vb"),StaffGroup::STANDARD }, // G8_VB_P
{ "G1", "G", 1, 0, 47, { 2, 5, 1, 4, 7, 3, 6, 6, 3, 7, 4, 8, 5, 9 }, SymId::gClef, QT_TRANSLATE_NOOP("clefTable", "French violin clef"), StaffGroup::STANDARD }, // G_1
{ "C1", "C", 1, 0, 43, { 5, 1, 4, 0, 3,-1, 2, 2, 6, 3, 7, 4, 8, 5 }, SymId::cClef, QT_TRANSLATE_NOOP("clefTable", "Soprano clef"), StaffGroup::STANDARD }, // C1
{ "C2", "C", 2, 0, 41, { 3, 6, 2, 5, 1, 4, 0, 0, 4, 1, 5, 2, 6, 3 }, SymId::cClef, QT_TRANSLATE_NOOP("clefTable", "Mezzo-soprano clef"), StaffGroup::STANDARD }, // C2
{ "C3", "C", 3, 0, 39, { 1, 4, 0, 3, 6, 2, 5, 5, 2, 6, 3, 7, 4, 8 }, SymId::cClef, QT_TRANSLATE_NOOP("clefTable", "Alto clef"), StaffGroup::STANDARD }, // C3
{ "C4", "C", 4, 0, 37, { 6, 2, 5, 1, 4, 0, 3, 3, 0, 4, 1, 5, 2, 6 }, SymId::cClef, QT_TRANSLATE_NOOP("clefTable", "Tenor clef"), StaffGroup::STANDARD }, // C4
{ "C5", "C", 5, 0, 35, { 4, 0, 3,-1, 2, 5, 1, 1, 5, 2, 6, 3, 7, 4 }, SymId::cClef, QT_TRANSLATE_NOOP("clefTable", "Baritone clef (C clef)"), StaffGroup::STANDARD }, // C5
{ "C_19C", "G", 2, 0, 45, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, SymId::cClefSquare, QT_TRANSLATE_NOOP("clefTable", "C clef, H shape (19th century)"), StaffGroup::STANDARD }, // C_19C
{ "C3_F18C", "C", 3, 0, 39, { 1, 4, 0, 3, 6, 2, 5, 5, 2, 6, 3, 7, 4, 8 }, SymId::cClefFrench, QT_TRANSLATE_NOOP("clefTable", "Alto clef (French, 18th century)"), StaffGroup::STANDARD }, // C3_F18C
{ "C4_F18C", "C", 4, 0, 37, { 6, 2, 5, 1, 4, 0, 3, 3, 0, 4, 1, 5, 2, 6 }, SymId::cClefFrench, QT_TRANSLATE_NOOP("clefTable", "Tenor clef (French, 18th century)"), StaffGroup::STANDARD }, // C4_F18C
{ "C3_F20C", "C", 3, 0, 39, { 1, 4, 0, 3, 6, 2, 5, 5, 2, 6, 3, 7, 4, 8 }, SymId::cClefFrench20C, QT_TRANSLATE_NOOP("clefTable", "Alto clef (French, 20th century)"), StaffGroup::STANDARD }, // C3_F20C
{ "C4_F20C", "C", 4, 0, 37, { 6, 2, 5, 1, 4, 0, 3, 3, 0, 4, 1, 5, 2, 6 }, SymId::cClefFrench20C, QT_TRANSLATE_NOOP("clefTable", "Tenor clef (French, 20th century)"), StaffGroup::STANDARD }, // C4_F20C
{ "F", "F", 4, 0, 33, { 2, 5, 1, 4, 7, 3, 6, 6, 3, 7, 4, 8, 5, 9 }, SymId::fClef, QT_TRANSLATE_NOOP("clefTable", "Bass clef"), StaffGroup::STANDARD },
{ "F15mb","F", 4, -2, 19, { 2, 5, 1, 4, 7, 3, 6, 6, 3, 7, 4, 8, 5, 9 }, SymId::fClef15mb, QT_TRANSLATE_NOOP("clefTable", "Bass clef 15mb"), StaffGroup::STANDARD }, // F15_MB // F
{ "F8vb", "F", 4, -1, 26, { 2, 5, 1, 4, 7, 3, 6, 6, 3, 7, 4, 8, 5, 9 }, SymId::fClef8vb, QT_TRANSLATE_NOOP("clefTable", "Bass clef 8vb"), StaffGroup::STANDARD }, //F8_VB
{ "F8va", "F", 4, 1, 40, { 2, 5, 1, 4, 7, 3, 6, 6, 3, 7, 4, 8, 5, 9 }, SymId::fClef8va, QT_TRANSLATE_NOOP("clefTable", "Bass clef 8va"), StaffGroup::STANDARD }, // F_8VA
{ "F15ma","F", 4, 2, 47, { 2, 5, 1, 4, 7, 3, 6, 6, 3, 7, 4, 8, 5, 9 }, SymId::fClef15ma, QT_TRANSLATE_NOOP("clefTable", "Bass clef 15ma"), StaffGroup::STANDARD }, // F_15MA
{ "F3", "F", 3, 0, 35, { 4, 0, 3,-1, 2, 5, 1, 1, 5, 2, 6, 3, 7, 4 }, SymId::fClef, QT_TRANSLATE_NOOP("clefTable", "Baritone clef (F clef)"), StaffGroup::STANDARD }, // F_B
{ "F5", "F", 5, 0, 31, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, SymId::fClef, QT_TRANSLATE_NOOP("clefTable", "Subbass clef"), StaffGroup::STANDARD }, // F_C
{ "F_F18C","F", 4, 0, 33, { 2, 5, 1, 4, 7, 3, 6, 6, 3, 7, 4, 8, 5, 9 }, SymId::fClefFrench, QT_TRANSLATE_NOOP("clefTable", "F clef (French, 18th century)"), StaffGroup::STANDARD }, // F_F18C
{ "F_19C","F", 4, 0, 33, { 2, 5, 1, 4, 7, 3, 6, 6, 3, 7, 4, 8, 5, 9 }, SymId::fClef19thCentury, QT_TRANSLATE_NOOP("clefTable", "F clef (19th century)"), StaffGroup::STANDARD }, // F_19C
{ "PERC", "percussion",2, 0, 45, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, SymId::unpitchedPercussionClef1, QT_TRANSLATE_NOOP("clefTable", "Percussion"), StaffGroup::PERCUSSION}, //PERC
{ "PERC2","percussion",2, 0, 45, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, SymId::unpitchedPercussionClef2, QT_TRANSLATE_NOOP("clefTable", "Percussion 2"), StaffGroup::PERCUSSION}, // PERC2
{ "TAB", "TAB", 5, 0, 0, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, SymId::sixStringTabClef, QT_TRANSLATE_NOOP("clefTable", "Tablature"), StaffGroup::TAB }, // TAB
{ "TAB4", "TAB", 5, 0, 0, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, SymId::fourStringTabClef, QT_TRANSLATE_NOOP("clefTable", "Tablature 4 lines"), StaffGroup::TAB }, //TAB4
{ "TAB2", "TAB", 5, 0, 0, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, SymId::sixStringTabClefSerif, QT_TRANSLATE_NOOP("clefTable", "Tablature Serif"), StaffGroup::TAB }, //TAB_SERIF
{ "TAB4_SERIF", "TAB", 5, 0, 0, { 0, 3,-1, 2, 5, 1, 4, 4, 1, 5, 2, 6, 3, 7 }, SymId::fourStringTabClefSerif, QT_TRANSLATE_NOOP("clefTable", "Tablature Serif 4 lines"), StaffGroup::TAB }, // TAB4_SERIF
};
@ -154,116 +162,43 @@ void Clef::layout()
qreal _spatium = spatium();
qreal yoff = 0.0;
if (clefType() != ClefType::INVALID && clefType() != ClefType::MAX) {
symId = ClefInfo::symId(clefType());
yoff = lineDist * (lines - ClefInfo::line(clefType()));
}
switch (clefType()) {
case ClefType::G: // G clef on 2nd line
symId = SymId::gClef;
yoff = 3.0 * lineDist;
break;
case ClefType::G1: // G clef 8va on 2nd line
symId = SymId::gClef8va;
yoff = 3.0 * lineDist;
break;
case ClefType::G2: // G clef 15ma on 2nd line
symId = SymId::gClef15ma;
yoff = 3.0 * lineDist;
break;
case ClefType::G3: // G clef 8vb on 2nd line
symId = SymId::gClef8vb;
yoff = 3.0 * lineDist;
break;
case ClefType::G3_O: // double G clef 8vb on 2nd line
symId = SymId::gClef8vbOld;
yoff = 3.0 * lineDist;
break;
case ClefType::F: // F clef on penultimate line
symId = SymId::fClef;
yoff = 1.0 * lineDist;
break;
case ClefType::F8: // F clef 8va bassa on penultimate line
symId = SymId::fClef8vb;
yoff = 1.0 * lineDist;
break;
case ClefType::F15: // F clef 15ma bassa on penultimate line
symId = SymId::fClef15mb;
yoff = 1.0 * lineDist;
break;
case ClefType::F_B: // baritone clef
symId = SymId::fClef;
yoff = 2.0 * lineDist;
break;
case ClefType::F_C: // subbass clef
symId = SymId::fClef;
yoff = 0.0;
break;
case ClefType::C1: // C clef in 1st line
symId = SymId::cClef;
yoff = 4.0 * lineDist;
break;
case ClefType::C2: // C clef on 2nd line
symId = SymId::cClef;
yoff = 3.0 * lineDist;
break;
case ClefType::C3: // C clef in 3rd line
symId = SymId::cClef;
yoff = 2.0 * lineDist;
break;
case ClefType::C4: // C clef on 4th line
symId = SymId::cClef;
yoff = 1.0 * lineDist;
break;
case ClefType::C5: // C clef on 5th line
symId = SymId::cClef;
yoff = 0.0;
case ClefType::C_19C: // 19th C clef is like a G clef
yoff = lineDist * 1.5;
break;
case ClefType::TAB: // TAB clef
symId = SymId::sixStringTabClef;
// on tablature, position clef at half the number of spaces * line distance
yoff = lineDist * (lines - 1) * .5;
break;
case ClefType::TAB4: // TAB clef 4 strings
symId = SymId::fourStringTabClef;
// on tablature, position clef at half the number of spaces * line distance
yoff = lineDist * (lines - 1) * .5;
break;
case ClefType::TAB_SERIF: // TAB clef alternate style
symId = SymId::sixStringTabClefSerif;
// on tablature, position clef at half the number of spaces * line distance
yoff = lineDist * (lines - 1) * .5;
break;
case ClefType::TAB4_SERIF: // TAB clef alternate style
symId = SymId::fourStringTabClefSerif;
// on tablature, position clef at half the number of spaces * line distance
yoff = lineDist * (lines - 1) * .5;
break;
case ClefType::PERC: // percussion clefs
symId = SymId::unpitchedPercussionClef1;
yoff = lineDist * (lines - 1) * 0.5;
break;
case ClefType::PERC2:
symId = SymId::unpitchedPercussionClef2;
yoff = lineDist * (lines - 1) * 0.5;
break;
case ClefType::G4: // G clef in 1st line
symId = SymId::gClef;
yoff = 4.0 * lineDist;
break;
case ClefType::F_8VA: // F clef 8va on penultimate line
symId = SymId::fClef8va;
yoff = 1.0 * lineDist;
break;
case ClefType::F_15MA: // F clef 15ma on penultimate line
symId = SymId::fClef15ma;
yoff = 1.0 * lineDist;
break;
case ClefType::G5: // G clef on 2nd line
symId = SymId::gClef8vbParens;
yoff = 3.0 * lineDist;
break;
case ClefType::INVALID:
case ClefType::MAX:
qDebug("Clef::layout: invalid type");
return;
default:
break;
}
// clefs are right aligned to Segment
QRectF r(symBbox(symId));

View file

@ -39,30 +39,38 @@ static const int NO_CLEF = -1000;
enum class ClefType : signed char {
INVALID = -1,
G = 0,
G1,
G2,
G3,
F,
F8,
F15,
F_B,
F_C,
G15_MB,
G8_VB,
G8_VA,
G15_MA,
G8_VB_O,
G8_VB_P,
G_1,
C1,
C2,
C3,
C4,
TAB,
TAB4,
PERC,
C5,
G4,
C_19C,
C3_F18C,
C4_F18C,
C3_F20C,
C4_F20C,
F,
F15_MB,
F8_VB,
F_8VA,
F_15MA,
F_B,
F_C,
F_F18C,
F_19C,
PERC,
PERC2,
TAB,
TAB4,
TAB_SERIF,
TAB4_SERIF,
G5,
G3_O,
MAX
};
@ -92,10 +100,11 @@ class ClefInfo {
const char* _tag; ///< comprehensive name for instruments.xml
const char* _sign; ///< Name for musicXml.
int _line; ///< Line for musicXml.
int _line; ///< Line for musicXml and for positioning on the staff
int _octChng; ///< Octave change for musicXml.
int _pitchOffset; ///< Pitch offset for line 0.
signed char _lines[14];
SymId _symId;
const char* _name;
StaffGroup _staffGroup;
@ -105,6 +114,7 @@ class ClefInfo {
static int line(ClefType t) { return clefTable[int(t)]._line; }
static int octChng(ClefType t) { return clefTable[int(t)]._octChng; }
static int pitchOffset(ClefType t) { return clefTable[int(t)]._pitchOffset; }
static SymId symId(ClefType t) { return clefTable[int(t)]._symId; }
static const signed char* lines(ClefType t) { return clefTable[int(t)]._lines; }
static const char* name(ClefType t) { return clefTable[int(t)]._name; }
static StaffGroup staffGroup(ClefType t) { return clefTable[int(t)]._staffGroup; }

View file

@ -555,12 +555,12 @@ static ClefType readClefType(const QString& s)
switch (i) {
default:
case 0: ct = ClefType::G; break;
case 1: ct = ClefType::G1; break;
case 2: ct = ClefType::G2; break;
case 3: ct = ClefType::G3; break;
case 1: ct = ClefType::G8_VA; break;
case 2: ct = ClefType::G15_MA; break;
case 3: ct = ClefType::G8_VB; break;
case 4: ct = ClefType::F; break;
case 5: ct = ClefType::F8; break;
case 6: ct = ClefType::F15; break;
case 5: ct = ClefType::F8_VB; break;
case 6: ct = ClefType::F15_MB; break;
case 7: ct = ClefType::F_B; break;
case 8: ct = ClefType::F_C; break;
case 9: ct = ClefType::C1; break;
@ -570,7 +570,7 @@ static ClefType readClefType(const QString& s)
case 13: ct = ClefType::TAB; break;
case 14: ct = ClefType::PERC; break;
case 15: ct = ClefType::C5; break;
case 16: ct = ClefType::G4; break;
case 16: ct = ClefType::G_1; break;
case 17: ct = ClefType::F_8VA; break;
case 18: ct = ClefType::F_15MA; break;
case 19: ct = ClefType::PERC; break; // PERC2 no longer supported

View file

@ -2650,6 +2650,10 @@ QVector<const char*> Sym::symNames = {
"noteheadDoubleWholeAlt", // double whole with double side bars
"4stringTabClefSerif", // TAB clef in script style
"6stringTabClefSerif", // TAB clef in script style
"cClefFrench",
"cClefFrench20C",
"fClefFrench",
"fClef19thCentury",
// MuseScore local symbols, precomposed symbols to mimic some emmentaler glyphs
@ -5274,6 +5278,10 @@ QVector<QString> Sym::symUserNames = {
"noteheadDoubleWholeAlt", // double whole with double side bars
"4StringTabClefSerif", // TAB clef in script style
"6StringTabClefSerif", // TAB clef in script style
"cClefFrench",
"cClefFrench20C",
"fClefFrench",
"fClef19thCentury",
// MuseScore local symbols, precomposed symbols to mimic some emmentaler glyphs
@ -5981,6 +5989,22 @@ void ScoreFont::load()
QString("6stringTabClefSerif"),
SymId::sixStringTabClefSerif
},
{ QString("cClef"),
QString("cClefFrench"),
SymId::cClefFrench
},
{ QString("cClef"),
QString("cClefFrench20C"),
SymId::cClefFrench20C
},
{ QString("fClef"),
QString("fClefFrench"),
SymId::fClefFrench
},
{ QString("fClef"),
QString("fClef19thCentury"),
SymId::fClef19thCentury
},
{ QString("noteheadBlack"),
QString("noteheadBlackOversized"),
SymId::noteheadBlack

View file

@ -2636,6 +2636,11 @@ enum class SymId {
noteheadDoubleWholeAlt, // double whole with double side bars
fourStringTabClefSerif, // TAB clef in script style
sixStringTabClefSerif, // TAB clef in script style
cClefFrench,
cClefFrench20C,
fClefFrench,
fClef19thCentury,
// MuseScore local symbols, precomposed symbols to mimic some emmentaler glyphs

View file

@ -691,12 +691,12 @@ static int readCapVoice(Score* score, CapVoice* cvoice, int staffIdx, int tick,
int off;
switch (clef) {
case ClefType::G: off = 0; break;
case ClefType::G1: off = 7; break;
case ClefType::G2: off = 14; break;
case ClefType::G3: off = -7; break;
case ClefType::G8_VA: off = 7; break;
case ClefType::G15_MA: off = 14; break;
case ClefType::G8_VB: off = -7; break;
case ClefType::F: off = -14; break;
case ClefType::F8: off = -21; break;
case ClefType::F15: off = -28; break;
case ClefType::F8_VB: off = -21; break;
case ClefType::F15_MB: off = -28; break;
case ClefType::F_B: off = -14; break;
case ClefType::F_C: off = -14; break;
case ClefType::C1: off = -7; break;
@ -704,7 +704,7 @@ static int readCapVoice(Score* score, CapVoice* cvoice, int staffIdx, int tick,
case ClefType::C3: off = -7; break;
case ClefType::C4: off = -7; break;
case ClefType::C5: off = -7; break;
case ClefType::G4: off = 0; break;
case ClefType::G_1: off = 0; break;
case ClefType::F_8VA: off = -7; break;
case ClefType::F_15MA: off = 0; break;
default: off = 0; qDebug("clefType %d not implemented", int(clef));
@ -2291,8 +2291,8 @@ ClefType CapClef::clefType(Form form, ClefLine line, Oct oct)
int idx = int(form) + (int(line) << 3) + (int(oct) << 5);
switch (idx) {
case int(Form::G) + (int(ClefLine::L2) << 3) + (int(Oct::OCT_NULL) << 5): return ClefType::G;
case int(Form::G) + (int(ClefLine::L2) << 3) + (int(Oct::OCT_ALTA) << 5): return ClefType::G1;
case int(Form::G) + (int(ClefLine::L2) << 3) + (int(Oct::OCT_BASSA) << 5): return ClefType::G3;
case int(Form::G) + (int(ClefLine::L2) << 3) + (int(Oct::OCT_ALTA) << 5): return ClefType::G8_VA;
case int(Form::G) + (int(ClefLine::L2) << 3) + (int(Oct::OCT_BASSA) << 5): return ClefType::G8_VB;
case int(Form::C) + (int(ClefLine::L1) << 3) + (int(Oct::OCT_NULL) << 5): return ClefType::C1;
case int(Form::C) + (int(ClefLine::L2) << 3) + (int(Oct::OCT_NULL) << 5): return ClefType::C2;
@ -2301,7 +2301,7 @@ ClefType CapClef::clefType(Form form, ClefLine line, Oct oct)
case int(Form::C) + (int(ClefLine::L5) << 3) + (int(Oct::OCT_NULL) << 5): return ClefType::C5;
case int(Form::F) + (int(ClefLine::L4) << 3) + (int(Oct::OCT_NULL) << 5): return ClefType::F;
case int(Form::F) + (int(ClefLine::L4) << 3) + (int(Oct::OCT_BASSA) << 5): return ClefType::F8;
case int(Form::F) + (int(ClefLine::L4) << 3) + (int(Oct::OCT_BASSA) << 5): return ClefType::F8_VB;
case int(Form::F) + (int(ClefLine::L3) << 3) + (int(Oct::OCT_NULL) << 5): return ClefType::F_B;
case int(Form::F) + (int(ClefLine::L5) << 3) + (int(Oct::OCT_NULL) << 5): return ClefType::F_C;

View file

@ -624,9 +624,9 @@ void GuitarPro4::read(QFile* fp)
staff->setStaffType(StaffType::preset(StaffTypes::PERC_DEFAULT));
}
else if (patch >= 24 && patch < 32)
clefId = ClefType::G3;
clefId = ClefType::G8_VB;
else if (patch >= 32 && patch < 40)
clefId = ClefType::F8;
clefId = ClefType::F8_VB;
Measure* measure = score->firstMeasure();
Clef* clef = new Clef(score);
clef->setClefType(clefId);

View file

@ -430,9 +430,9 @@ void GuitarPro5::readTracks()
staff->setStaffType(StaffType::preset(StaffTypes::PERC_DEFAULT));
}
else if (patch >= 24 && patch < 32)
clefId = ClefType::G3;
clefId = ClefType::G8_VB;
else if (patch >= 32 && patch < 40)
clefId = ClefType::F8;
clefId = ClefType::F8_VB;
Measure* measure = score->firstMeasure();
Clef* clef = new Clef(score);
clef->setClefType(clefId);

View file

@ -1450,11 +1450,11 @@ void GuitarPro6::readBars(QDomNode* barList, Measure* measure, ClefType oldClefI
// get the clef of the bar and apply
if (!currentNode.nodeName().compare("Clef")) {
QString clefString = currentNode.toElement().text();
ClefType clefId = ClefType::G3;
ClefType clefId = ClefType::G8_VB;
if (!clefString.compare("F4"))
clefId = ClefType::F8;
clefId = ClefType::F8_VB;
else if (!clefString.compare("G2"))
clefId = ClefType::G3;
clefId = ClefType::G8_VB;
else if (!clefString.compare("Neutral"))
clefId = ClefType::PERC;
else

View file

@ -1325,9 +1325,9 @@ void GuitarPro2::read(QFile* fp)
staff->setStaffType(StaffType::preset(StaffTypes::PERC_DEFAULT));
}
else if (patch >= 24 && patch < 32)
clefId = ClefType::G3;
clefId = ClefType::G8_VB;
else if (patch >= 32 && patch < 40)
clefId = ClefType::F8;
clefId = ClefType::F8_VB;
Measure* measure = score->firstMeasure();
Clef* clef = new Clef(score);
clef->setClefType(clefId);
@ -1943,9 +1943,9 @@ void GuitarPro3::read(QFile* fp)
staff->setStaffType(StaffType::preset(StaffTypes::PERC_DEFAULT));
}
else if (patch >= 24 && patch < 32)
clefId = ClefType::G3;
clefId = ClefType::G8_VB;
else if (patch >= 32 && patch < 40)
clefId = ClefType::F8;
clefId = ClefType::F8_VB;
Measure* measure = score->firstMeasure();
Clef* clef = new Clef(score);
clef->setClefType(clefId);

View file

@ -3543,13 +3543,13 @@ void MusicXMLParserPass2::clef(const QString& partId, Measure* measure, const in
if (c == "G" && i == 0 && line == 2)
clef = ClefType::G;
else if (c == "G" && i == 1 && line == 2)
clef = ClefType::G1;
clef = ClefType::G8_VA;
else if (c == "G" && i == 2 && line == 2)
clef = ClefType::G2;
clef = ClefType::G15_MA;
else if (c == "G" && i == -1 && line == 2)
clef = ClefType::G3;
clef = ClefType::G8_VB;
else if (c == "G" && i == 0 && line == 1)
clef = ClefType::G4;
clef = ClefType::G_1;
else if (c == "F" && i == 0 && line == 3)
clef = ClefType::F_B;
else if (c == "F" && i == 0 && line == 4)
@ -3559,9 +3559,9 @@ void MusicXMLParserPass2::clef(const QString& partId, Measure* measure, const in
else if (c == "F" && i == 2 && line == 4)
clef = ClefType::F_15MA;
else if (c == "F" && i == -1 && line == 4)
clef = ClefType::F8;
clef = ClefType::F8_VB;
else if (c == "F" && i == -2 && line == 4)
clef = ClefType::F15;
clef = ClefType::F15_MB;
else if (c == "F" && i == 0 && line == 5)
clef = ClefType::F_C;
else if (c == "C") {

View file

@ -447,7 +447,7 @@ ClefType OveClefToClef(OVE::ClefType type){
break;
}
case OVE::ClefType::Treble8va:{
clef = ClefType::G1;
clef = ClefType::G8_VA;
break;
}
case OVE::ClefType::Bass8va:{
@ -455,11 +455,11 @@ ClefType OveClefToClef(OVE::ClefType type){
break;
}
case OVE::ClefType::Treble8vb:{
clef = ClefType::G3;
clef = ClefType::G8_VB;
break;
}
case OVE::ClefType::Bass8vb:{
clef = ClefType::F8;
clef = ClefType::F8_VB;
break;
}
case OVE::ClefType::Percussion1:{

View file

@ -145,7 +145,7 @@ MasterPalette::MasterPalette(QWidget* parent)
treeWidget->clear();
addPalette(MuseScore::newClefsPalette(false));
addPalette(MuseScore::newClefsPalette(false, true));
keyEditor = new KeyEditor;
keyItem = new QTreeWidgetItem();

View file

@ -713,24 +713,32 @@ Palette* MuseScore::newArpeggioPalette()
// newClefsPalette
//---------------------------------------------------------
Palette* MuseScore::newClefsPalette(bool basic)
Palette* MuseScore::newClefsPalette(bool basic, bool master)
{
Palette* sp = new Palette;
sp->setName(QT_TRANSLATE_NOOP("Palette", "Clefs"));
sp->setMag(0.8);
sp->setGrid(33, 60);
sp->setYOffset(0.5);
static std::vector<ClefType> clefs1 {
static std::vector<ClefType> clefsBasic {
ClefType::G, ClefType::F, ClefType::C3, ClefType::C4
};
static std::vector<ClefType> clefs2 {
ClefType::G, ClefType::G1, ClefType::G2, ClefType::G3, ClefType::G3_O,
ClefType::G5, ClefType::G4, ClefType::C1, ClefType::C2, ClefType::C3,
ClefType::C4, ClefType::C5, ClefType::F, ClefType::F_8VA, ClefType::F_15MA,
ClefType::F8, ClefType::F15, ClefType::F_B, ClefType::F_C, ClefType::PERC,
static std::vector<ClefType> clefsAdvanced {
ClefType::G, ClefType::G8_VA, ClefType::G15_MA, ClefType::G8_VB, ClefType::G15_MB, ClefType::G8_VB_O,
ClefType::G8_VB_P, ClefType::G_1, ClefType::C1, ClefType::C2, ClefType::C3,
ClefType::C4, ClefType::C5, ClefType::F, ClefType::F_8VA, ClefType::F_15MA,
ClefType::F8_VB, ClefType::F15_MB, ClefType::F_B, ClefType::F_C, ClefType::PERC,
ClefType::PERC2, ClefType::TAB, ClefType::TAB4
};
static std::vector<ClefType> clefsMaster {
ClefType::G, ClefType::G8_VA, ClefType::G15_MA, ClefType::G8_VB, ClefType::G15_MB, ClefType::G8_VB_O,
ClefType::G8_VB_P, ClefType::G_1, ClefType::C1, ClefType::C2, ClefType::C3,
ClefType::C4, ClefType::C5, ClefType::C_19C, ClefType::C3_F18C, ClefType::C4_F18C, ClefType::C3_F20C, ClefType::C4_F20C,
ClefType::F, ClefType::F_8VA, ClefType::F_15MA,
ClefType::F8_VB, ClefType::F15_MB, ClefType::F_B, ClefType::F_C, ClefType::F_F18C, ClefType::F_19C, ClefType::PERC,
ClefType::PERC2, ClefType::TAB, ClefType::TAB4, ClefType::TAB_SERIF, ClefType::TAB4_SERIF
};
for (ClefType j : basic ? clefs1 : clefs2) {
for (ClefType j : master ? clefsMaster : (basic ? clefsBasic : clefsAdvanced)) {
Clef* k = new Ms::Clef(gscore);
k->setClefType(ClefTypeList(j, j));
sp->append(k, qApp->translate("clefTable", ClefInfo::name(j)));
@ -1244,7 +1252,7 @@ void MuseScore::setAdvancedPalette()
{
mscore->getPaletteBox();
paletteBox->clear();
paletteBox->addPalette(newClefsPalette(false));
paletteBox->addPalette(newClefsPalette(false, false));
paletteBox->addPalette(newKeySigPalette());
paletteBox->addPalette(newTimePalette());
paletteBox->addPalette(newBracketsPalette());
@ -1308,7 +1316,7 @@ void MuseScore::setBasicPalette()
{
mscore->getPaletteBox();
paletteBox->clear();
paletteBox->addPalette(newClefsPalette(true));
paletteBox->addPalette(newClefsPalette(true, false));
paletteBox->addPalette(newKeySigPalette(true));
paletteBox->addPalette(newTimePalette());
// paletteBox->addPalette(newBracketsPalette());

View file

@ -701,7 +701,7 @@ class MuseScore : public QMainWindow, public MuseScoreCore {
static Palette* newBracketsPalette();
static Palette* newBreathPalette();
static Palette* newArpeggioPalette();
static Palette* newClefsPalette(bool basic);
static Palette* newClefsPalette(bool basic, bool master);
static Palette* newGraceNotePalette(bool basic);
static Palette* newBagpipeEmbellishmentPalette();
static Palette* newKeySigPalette(bool basic = false);

View file

@ -56,7 +56,6 @@ void SymbolDialog::createSymbols()
sp->clear();
for (auto name : (*smuflRanges())[range]) {
SymId id = Sym::name2id(name);
if (search->text().isEmpty()
|| Sym::id2userName(id).contains(search->text(), Qt::CaseInsensitive)) {
Symbol* s = new Symbol(gscore);

View file

@ -78,7 +78,7 @@ void TestClefCourtesy::clef_courtesy01()
// drop G1 clef to 4th measure
Measure* m1 = getMeasure(score, 4);
dropClef(m1, ClefType::G1);
dropClef(m1, ClefType::G8_VA);
// drop G clef to 7th measure
Measure* m2 = getMeasure(score, 7);
@ -123,7 +123,7 @@ void TestClefCourtesy::clef_courtesy02()
m1 = m1->nextMeasure();
// make a clef-drop object and drop it to the measure
Clef* clef = new Clef(score); // create a new element, as Measure::drop() will eventually delete it
clef->setClefType(ClefType::G1);
clef->setClefType(ClefType::G8_VA);
DropData dropData;
dropData.pos = m1->pagePos();
dropData.element = clef;
@ -179,7 +179,7 @@ void TestClefCourtesy::clef_courtesy03()
// make a clef-drop object and drop it to the 2nd measure
Clef* clef = new Clef(score); // create a new element, as Measure::drop() will eventually delete it
clef->setClefType(ClefType::G1);
clef->setClefType(ClefType::G8_VA);
DropData dropData;
dropData.pos = m2->pagePos();
dropData.element = clef;