Skip to content

Commit

Permalink
Merge pull request #1290 from mgavioli/lute_fingering
Browse files Browse the repository at this point in the history
Adds to the Articulation class 4 symbols for lute tablature fingerings.
  • Loading branch information
mgavioli committed Sep 9, 2014
2 parents c3754c0 + 9bc34cc commit f5e8522
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 13 deletions.
27 changes: 23 additions & 4 deletions libmscore/articulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ ArticulationInfo Articulation::articulationList[int(ArticulationType::ARTICULATI
"verylongfermata", QT_TRANSLATE_NOOP("articulation", "very long fermata"),
1.0, ArticulationShowIn::PITCHED_STAFF | ArticulationShowIn::TABLATURE
},
{ SymId::stringsThumbPosition, SymId::stringsThumbPosition,
"thumb", QT_TRANSLATE_NOOP("articulation", "thumb"),
1.0, ArticulationShowIn::PITCHED_STAFF | ArticulationShowIn::TABLATURE
},
{ SymId::articAccentAbove, SymId::articAccentBelow,
"sforzato", QT_TRANSLATE_NOOP("articulation", "sforzato"),
1.0, ArticulationShowIn::PITCHED_STAFF | ArticulationShowIn::TABLATURE
Expand Down Expand Up @@ -202,6 +198,29 @@ ArticulationInfo Articulation::articulationList[int(ArticulationType::ARTICULATI
1.0, ArticulationShowIn::TABLATURE
},
#endif

// Fingerings

{ SymId::stringsThumbPosition, SymId::stringsThumbPosition,
"thumb", QT_TRANSLATE_NOOP("articulation", "thumb pos."),
1.0, ArticulationShowIn::PITCHED_STAFF | ArticulationShowIn::TABLATURE
},
{ SymId::luteFingeringRHThumb, SymId::luteFingeringRHThumb,
"lutefingeringthumb", QT_TRANSLATE_NOOP("articulation", "lute thumb fing."),
1.0, ArticulationShowIn::TABLATURE
},
{ SymId::luteFingeringRHFirst, SymId::luteFingeringRHFirst,
"lutefingering1st", QT_TRANSLATE_NOOP("articulation", "lute 1 fing."),
1.0, ArticulationShowIn::TABLATURE
},
{ SymId::luteFingeringRHSecond, SymId::luteFingeringRHSecond,
"lutefingering2nd", QT_TRANSLATE_NOOP("articulation", "lute 2 fing."),
1.0, ArticulationShowIn::TABLATURE
},
{ SymId::luteFingeringRHThird, SymId::luteFingeringRHThird,
"lutefingering3rd", QT_TRANSLATE_NOOP("articulation", "lute 3 fing."),
1.0, ArticulationShowIn::TABLATURE
},
};

//---------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions libmscore/articulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ constexpr bool operator& (ArticulationShowIn a1, ArticulationShowIn a2) {
struct ArticulationInfo {
SymId upSym;
SymId downSym;
QString name;
QString description; // translated name
QString name; // as stored in score files
QString description; // user-visible, translatable, name
qreal timeStretch; // for fermata
ArticulationShowIn flags;
};
Expand Down
24 changes: 24 additions & 0 deletions libmscore/chord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2573,6 +2573,30 @@ QPointF Chord::layoutArticulation(Articulation* a)
return QPointF(pos);
}

// Lute fingering are always in the middle of the space right below the fret mark,
else if (staff() && staff()->staffGroup() == StaffGroup::TAB
&& st >= ArticulationType::LuteFingThumb && st <= ArticulationType::LuteFingThird) {
// lute fing. glyphs are vertically registered in the middle of bottom space;
// move down of half a space to have the glyph on the line
y = chordBotY + _spatium * 0.5;
if (staff()->staffType()->onLines()) { // if fret marks are on lines
// move down by half the height of fret marks (extending below the line)
// and half of the remaing space below,
// to centre the symbol between the fret mark and the line below
// fretBoxH/2 + (spStaff - fretBoxH/2) / 2 becomes:
y += (staff()->staffType()->fretBoxH()*0.5 + _spStaff) * 0.5;
}
else { // if marks are between lines
// move down by half a sp to pace the glyph right below the mark,
// and not too far away (as it would have been, if centred in the line space below)
y += _spatium * 0.5;
}
a->layout();
a->setPos(x, y);
a->adjustReadPos();
return QPointF(x, y);
}

// other articulations are outside of area occupied by the staff or the chord
// reserve space for slur
bool botGap = false;
Expand Down
7 changes: 6 additions & 1 deletion libmscore/mscore.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ enum class ArticulationType : char {
Shortfermata,
Longfermata,
Verylongfermata,
Thumb,
Sforzatoaccent,
// Espressivo,
Staccato,
Expand Down Expand Up @@ -120,6 +119,12 @@ enum class ArticulationType : char {
// Tapping,
// Slapping,
// Popping,
// Fingerings
ThumbPosition,
LuteFingThumb,
LuteFingFirst,
LuteFingSecond,
LuteFingThird,
ARTICULATIONS
};

Expand Down
6 changes: 5 additions & 1 deletion libmscore/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@ StyleData::StyleData()
_articulationAnchor[int(ArticulationType::Shortfermata)] = ArticulationAnchor::TOP_STAFF;
_articulationAnchor[int(ArticulationType::Longfermata)] = ArticulationAnchor::TOP_STAFF;
_articulationAnchor[int(ArticulationType::Verylongfermata)] = ArticulationAnchor::TOP_STAFF;
_articulationAnchor[int(ArticulationType::Thumb)] = ArticulationAnchor::TOP_STAFF;
_articulationAnchor[int(ArticulationType::Sforzatoaccent)] = ArticulationAnchor::CHORD;
// _articulationAnchor[int(ArticulationType::Espressivo)] = ArticulationAnchor::CHORD;
_articulationAnchor[int(ArticulationType::Staccato)] = ArticulationAnchor::CHORD;
Expand Down Expand Up @@ -593,6 +592,11 @@ StyleData::StyleData()
// _articulationAnchor[int(ArticulationType::Tapping)] = ArticulationAnchor::TOP_STAFF;
// _articulationAnchor[int(ArticulationType::Slapping)] = ArticulationAnchor::TOP_STAFF;
// _articulationAnchor[int(ArticulationType::Popping)] = ArticulationAnchor::TOP_STAFF;
_articulationAnchor[int(ArticulationType::ThumbPosition)] = ArticulationAnchor::TOP_STAFF;
_articulationAnchor[int(ArticulationType::LuteFingThumb)] = ArticulationAnchor::BOTTOM_CHORD;
_articulationAnchor[int(ArticulationType::LuteFingFirst)] = ArticulationAnchor::BOTTOM_CHORD;
_articulationAnchor[int(ArticulationType::LuteFingSecond)] = ArticulationAnchor::BOTTOM_CHORD;
_articulationAnchor[int(ArticulationType::LuteFingThird)] = ArticulationAnchor::BOTTOM_CHORD;
};

StyleData::StyleData(const StyleData& s)
Expand Down
6 changes: 3 additions & 3 deletions mscore/exportxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,7 @@ static void chordAttributes(Chord* chord, Notations& notations, Technical& techn
case ArticulationType::Upbow:
case ArticulationType::Downbow:
case ArticulationType::Snappizzicato:
case ArticulationType::Thumb:
case ArticulationType::ThumbPosition:
// ignore, handled with technical
break;
default:
Expand Down Expand Up @@ -1911,7 +1911,7 @@ static void chordAttributes(Chord* chord, Notations& notations, Technical& techn
case ArticulationType::Upbow:
case ArticulationType::Downbow:
case ArticulationType::Snappizzicato:
case ArticulationType::Thumb:
case ArticulationType::ThumbPosition:
// ignore, handled with technical
break;
default:
Expand Down Expand Up @@ -1961,7 +1961,7 @@ static void chordAttributes(Chord* chord, Notations& notations, Technical& techn
xml.tagE("open-string");
}
break;
case ArticulationType::Thumb:
case ArticulationType::ThumbPosition:
{
notations.tag(xml);
technical.tag(xml);
Expand Down
2 changes: 1 addition & 1 deletion mscore/importxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3969,7 +3969,7 @@ static bool readArticulations(ChordRest* cr, QString mxmlName)
map["snap-pizzicato"] = ArticulationType::Snappizzicato;
map["schleifer"] = ArticulationType::Schleifer;
map["open-string"] = ArticulationType::Ouvert;
map["thumb-position"] = ArticulationType::Thumb;
map["thumb-position"] = ArticulationType::ThumbPosition;

if (map.contains(mxmlName)) {
addArticulationToChord(cr, map.value(mxmlName), "");
Expand Down
2 changes: 1 addition & 1 deletion mtest/libmscore/compat/style-ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
<shortfermataAnchor>2</shortfermataAnchor>
<longfermataAnchor>2</longfermataAnchor>
<verylongfermataAnchor>2</verylongfermataAnchor>
<thumbAnchor>1</thumbAnchor>
<sforzatoAnchor>1</sforzatoAnchor>
<staccatoAnchor>1</staccatoAnchor>
<staccatissimoAnchor>1</staccatissimoAnchor>
Expand All @@ -123,6 +122,7 @@
<upprallAnchor>1</upprallAnchor>
<upmordentAnchor>1</upmordentAnchor>
<downmordentAnchor>1</downmordentAnchor>
<thumbAnchor>1</thumbAnchor>
<page-layout>
<page-height>1683.78</page-height>
<page-width>1190.55</page-width>
Expand Down

0 comments on commit f5e8522

Please sign in to comment.