Skip to content

Commit

Permalink
Slide, Hammeron and Pulloff
Browse files Browse the repository at this point in the history
  • Loading branch information
laturetab committed May 26, 2021
1 parent ba777e5 commit e4485ba
Show file tree
Hide file tree
Showing 16 changed files with 1,106 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/libmscore/CMakeLists.txt
Expand Up @@ -261,6 +261,8 @@ set(MODULE_SRC
skyline.h
slur.cpp
slur.h
slurando.cpp
slurando.h
slurtie.cpp
slurtie.h
spacer.cpp
Expand Down
18 changes: 18 additions & 0 deletions src/libmscore/chord.cpp
Expand Up @@ -38,6 +38,7 @@
#include "score.h"
#include "tremolo.h"
#include "glissando.h"
#include "slurando.h"
#include "staff.h"
#include "part.h"
#include "utils.h"
Expand Down Expand Up @@ -1986,6 +1987,15 @@ void Chord::layoutPitched()
}
}

// layout slurando
for (const Spanner* sp : note->spannerBack()) {
if (sp->isSlurando()) {
qreal d = ((Slurando*)sp)->layoutWidth(note, this);
lll = qMax(lll, d);
break;
}
}

// clear layout for note-based fingerings
for (Element* e : note->el()) {
if (e->isFingering()) {
Expand Down Expand Up @@ -2249,6 +2259,14 @@ void Chord::layoutTablature()
lll = qMax(lll, d);
}
}
// layout Slurando
for (const Spanner* sp : note->spannerBack()) {
if (sp->isSlurando()) {
qreal d = ((Slurando*)sp)->layoutWidthTab(note, this);
lll = qMax(lll, d);
break;
}
}
}

// create ledger lines, if required (in some historic styles)
Expand Down
2 changes: 2 additions & 0 deletions src/libmscore/element.cpp
Expand Up @@ -113,6 +113,7 @@
#include "palmmute.h"
#include "fermata.h"
#include "shape.h"
#include "slurando.h"
//#include "musescoreCore.h"

#include "log.h"
Expand Down Expand Up @@ -1184,6 +1185,7 @@ Element* Element::create(ElementType type, Score* score)
case ElementType::ARPEGGIO: return new Arpeggio(score);
case ElementType::BREATH: return new Breath(score);
case ElementType::GLISSANDO: return new Glissando(score);
case ElementType::SLURANDO: return new Slurando(score);
case ElementType::BRACKET: return new Bracket(score);
case ElementType::ARTICULATION: return new Articulation(score);
case ElementType::FERMATA: return new Fermata(score);
Expand Down
4 changes: 4 additions & 0 deletions src/libmscore/note.cpp
Expand Up @@ -64,6 +64,7 @@
#include "notedot.h"
#include "spanner.h"
#include "glissando.h"
#include "slurando.h"
#include "bagpembell.h"
#include "hairpin.h"
#include "textline.h"
Expand Down Expand Up @@ -1270,6 +1271,7 @@ void Note::add(Element* e)
break;
case ElementType::TEXTLINE:
case ElementType::GLISSANDO:
case ElementType::SLURANDO:
addSpanner(toSpanner(e));
break;
default:
Expand Down Expand Up @@ -1314,6 +1316,7 @@ void Note::remove(Element* e)

case ElementType::TEXTLINE:
case ElementType::GLISSANDO:
case ElementType::SLURANDO:
removeSpanner(toSpanner(e));
break;

Expand Down Expand Up @@ -1679,6 +1682,7 @@ void Note::readAddConnector(ConnectorInfoReader* info, bool pasteMode)
case ElementType::TIE:
case ElementType::TEXTLINE:
case ElementType::GLISSANDO:
case ElementType::SLURANDO:
{
Spanner* sp = toSpanner(info->connector());
if (info->isStart()) {
Expand Down
68 changes: 68 additions & 0 deletions src/libmscore/property.cpp
Expand Up @@ -381,6 +381,10 @@ static constexpr PropertyMetaData propertyList[] = {

{ Pid::PREFER_SHARP_FLAT, true, "preferSharpFlat", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "prefer sharps or flats") },

{ Pid::SLURANDO_TYPE, false, "subtype", P_TYPE::SLURANDO_TYPE, DUMMY_QT_TR_NOOP("propertyName", "slurando type") },
{ Pid::SLURANDO_PLACE, false, "place", P_TYPE::SLURANDO_PLACE, DUMMY_QT_TR_NOOP("propertyName", "slurando placement") },
{ Pid::SLURANDO_TEXT, false, 0, P_TYPE::STRING, DUMMY_QT_TR_NOOP("propertyName", "text") },

{ Pid::END, false, "++end++", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "<invalid property>") }
};
/* *INDENT-ON* */
Expand Down Expand Up @@ -645,6 +649,36 @@ QVariant propertyFromString(Pid id, QString value)
return QVariant(int(Orientation::HORIZONTAL));
}
break;
case P_TYPE::SLURANDO_TYPE:
if (value == "legatoslide") {
return QVariant(int(SlurandoType::LEGATO_SLIDE));
} else if (value == "shiftslide") {
return QVariant(int(SlurandoType::SHIFT_SLIDE));
} else if (value == "hammeron") {
return QVariant(int(SlurandoType::HAMMER_ON));
} else if (value == "pulloff") {
return QVariant(int(SlurandoType::PULL_OFF));
} else if (value == "bend") {
return QVariant(int(SlurandoType::BEND));
} else if (value == "bendrelease") {
return QVariant(int(SlurandoType::BEND_RELEASE));
} else if (value == "tuner") {
return QVariant(int(SlurandoType::TUNER));
}
break;
case P_TYPE::SLURANDO_PLACE:
if (value == "none") {
return QVariant(int(SlurandoTextPlacement::NONE));
} else if (value == "onstem") {
return QVariant(int(SlurandoTextPlacement::ON_STEM));
} else if (value == "onslur") {
return QVariant(int(SlurandoTextPlacement::ON_SLUR));
} else if (value == "above") {
return QVariant(int(SlurandoTextPlacement::ABOVE_STAFF));
} else if (value == "below") {
return QVariant(int(SlurandoTextPlacement::BELOW_STAFF));
}
break;
default:
break;
}
Expand Down Expand Up @@ -699,6 +733,8 @@ QVariant readProperty(Pid id, XmlReader& e)
case P_TYPE::SUB_STYLE:
case P_TYPE::ALIGN:
case P_TYPE::ORIENTATION:
case P_TYPE::SLURANDO_TYPE:
case P_TYPE::SLURANDO_PLACE:
return propertyFromString(id, e.readElementText());

case P_TYPE::BEAM_MODE: // TODO
Expand Down Expand Up @@ -922,6 +958,38 @@ QString propertyToString(Pid id, QVariant value, bool mscx)
}
break;
}
case P_TYPE::SLURANDO_TYPE:
switch (SlurandoType(value.toInt())) {
case SlurandoType::SHIFT_SLIDE:
return "shiftslide";
case SlurandoType::LEGATO_SLIDE:
return "legatoslide";
case SlurandoType::HAMMER_ON:
return "hammeron";
case SlurandoType::PULL_OFF:
return "pulloff";
case SlurandoType::BEND:
return "bend";
case SlurandoType::BEND_RELEASE:
return "bendrelease";
case SlurandoType::TUNER:
return "tuner";
}
break;
case P_TYPE::SLURANDO_PLACE:
switch (SlurandoTextPlacement(value.toInt())) {
case SlurandoTextPlacement::NONE:
return "none";
case SlurandoTextPlacement::ON_STEM:
return "onstem";
case SlurandoTextPlacement::ON_SLUR:
return "onslur";
case SlurandoTextPlacement::ABOVE_STAFF:
return "above";
case SlurandoTextPlacement::BELOW_STAFF:
return "below";
}
break;
case P_TYPE::POINT_MM:
qFatal("unknown: POINT_MM");
case P_TYPE::SIZE_MM:
Expand Down
9 changes: 8 additions & 1 deletion src/libmscore/property.h
Expand Up @@ -389,7 +389,11 @@ enum class Pid {
PATH, // for ChordLine to make its shape changes undoable

PREFER_SHARP_FLAT,


SLURANDO_TYPE,
SLURANDO_PLACE,
SLURANDO_TEXT,

END
};

Expand Down Expand Up @@ -440,6 +444,9 @@ enum class P_TYPE : char {

PATH, // QPainterPath
HEAD_SCHEME, // enum class NoteHead::Scheme

SLURANDO_TYPE, // enum class SlurandoType
SLURANDO_PLACE // enum class SlurandoPlace
};

extern QVariant readProperty(Pid type, XmlReader& e);
Expand Down
2 changes: 2 additions & 0 deletions src/libmscore/scoreElement.cpp
Expand Up @@ -50,6 +50,7 @@ static const ElementName elementNames[] = {
{ ElementType::INSTRUMENT_NAME, "InstrumentName", QT_TRANSLATE_NOOP("elementName", "Instrument Name") },
{ ElementType::SLUR_SEGMENT, "SlurSegment", QT_TRANSLATE_NOOP("elementName", "Slur Segment") },
{ ElementType::TIE_SEGMENT, "TieSegment", QT_TRANSLATE_NOOP("elementName", "Tie Segment") },
{ ElementType::SLURANDO_SEGMENT, "SlurandoSegment", QT_TRANSLATE_NOOP("elementName", "Slurando Segment") },
{ ElementType::BAR_LINE, "BarLine", QT_TRANSLATE_NOOP("elementName", "Barline") },
{ ElementType::STAFF_LINES, "StaffLines", QT_TRANSLATE_NOOP("elementName", "Staff Lines") },
{ ElementType::SYSTEM_DIVIDER, "SystemDivider", QT_TRANSLATE_NOOP("elementName", "System Divider") },
Expand Down Expand Up @@ -128,6 +129,7 @@ static const ElementName elementNames[] = {
{ ElementType::NOTELINE, "NoteLine", QT_TRANSLATE_NOOP("elementName", "Note Line") },
{ ElementType::LYRICSLINE, "LyricsLine", QT_TRANSLATE_NOOP("elementName", "Melisma Line") },
{ ElementType::GLISSANDO, "Glissando", QT_TRANSLATE_NOOP("elementName", "Glissando") },
{ ElementType::SLURANDO, "Slurando", QT_TRANSLATE_NOOP("elementName", "Slurando") },
{ ElementType::BRACKET, "Bracket", QT_TRANSLATE_NOOP("elementName", "Bracket") },
{ ElementType::SEGMENT, "Segment", QT_TRANSLATE_NOOP("elementName", "Segment") },
{ ElementType::SYSTEM, "System", QT_TRANSLATE_NOOP("elementName", "System") },
Expand Down
19 changes: 15 additions & 4 deletions src/libmscore/scoreElement.h
Expand Up @@ -55,6 +55,7 @@ class FBox;
class ChordRest;
class Slur;
class Tie;
class Slurando;
class Glissando;
class GlissandoSegment;
class SystemDivider;
Expand All @@ -78,6 +79,7 @@ class LyricsLineSegment;
class Stem;
class SlurSegment;
class TieSegment;
class SlurandoSegment;
class OttavaSegment;
class Beam;
class Hook;
Expand Down Expand Up @@ -332,6 +334,7 @@ class ScoreElement
CONVERT(FBox, FBOX)
CONVERT(Tie, TIE)
CONVERT(Slur, SLUR)
CONVERT(Slurando, SLURANDO)
CONVERT(Glissando, GLISSANDO)
CONVERT(GlissandoSegment, GLISSANDO_SEGMENT)
CONVERT(SystemDivider, SYSTEM_DIVIDER)
Expand All @@ -351,6 +354,7 @@ class ScoreElement
CONVERT(StemSlash, STEM_SLASH)
CONVERT(SlurSegment, SLUR_SEGMENT)
CONVERT(TieSegment, TIE_SEGMENT)
CONVERT(SlurandoSegment, SLURANDO_SEGMENT)
CONVERT(Spacer, SPACER)
CONVERT(StaffLines, STAFF_LINES)
CONVERT(Ambitus, AMBITUS)
Expand Down Expand Up @@ -415,7 +419,7 @@ class ScoreElement
bool isRestFamily() const { return isRest() || isMMRest() || isMeasureRepeat(); }
bool isChordRest() const { return isRestFamily() || isChord(); }
bool isDurationElement() const { return isChordRest() || isTuplet(); }
bool isSlurTieSegment() const { return isSlurSegment() || isTieSegment(); }
bool isSlurTieSegment() const { return isSlurSegment() || isTieSegment() || isSlurandoSegment(); }
bool isSLineSegment() const;
bool isBox() const { return isVBox() || isHBox() || isTBox() || isFBox(); }
bool isVBoxBase() const { return isVBox() || isTBox() || isFBox(); }
Expand Down Expand Up @@ -445,7 +449,7 @@ class ScoreElement

bool isSpannerSegment() const
{
return isLineSegment() || isTextLineBaseSegment() || isSlurSegment() || isTieSegment();
return isLineSegment() || isTextLineBaseSegment() || isSlurSegment() || isTieSegment() || isSlurandoSegment();
}

bool isBSymbol() const { return isImage() || isSymbol(); }
Expand Down Expand Up @@ -475,6 +479,7 @@ class ScoreElement
|| isLyricsLine()
|| isTextLineBase()
|| isSLine()
|| isSlurando()
;
}

Expand Down Expand Up @@ -536,13 +541,17 @@ static inline const Rest* toRest(const ScoreElement* e)

static inline SlurTieSegment* toSlurTieSegment(ScoreElement* e)
{
Q_ASSERT(e == 0 || e->type() == ElementType::SLUR_SEGMENT || e->type() == ElementType::TIE_SEGMENT);
Q_ASSERT(
e == 0 || e->type() == ElementType::SLUR_SEGMENT || e->type() == ElementType::TIE_SEGMENT
|| e->type() == ElementType::SLURANDO_SEGMENT);
return (SlurTieSegment*)e;
}

static inline const SlurTieSegment* toSlurTieSegment(const ScoreElement* e)
{
Q_ASSERT(e == 0 || e->type() == ElementType::SLUR_SEGMENT || e->type() == ElementType::TIE_SEGMENT);
Q_ASSERT(
e == 0 || e->type() == ElementType::SLUR_SEGMENT || e->type() == ElementType::TIE_SEGMENT
|| e->type() == ElementType::SLURANDO_SEGMENT);
return (const SlurTieSegment*)e;
}

Expand Down Expand Up @@ -636,6 +645,7 @@ CONVERT(FBox)
CONVERT(Spanner)
CONVERT(Tie)
CONVERT(Slur)
CONVERT(Slurando)
CONVERT(Glissando)
CONVERT(GlissandoSegment)
CONVERT(SystemDivider)
Expand All @@ -657,6 +667,7 @@ CONVERT(StemSlash)
CONVERT(LineSegment)
CONVERT(SlurSegment)
CONVERT(TieSegment)
CONVERT(SlurandoSegment)
CONVERT(Spacer)
CONVERT(StaffLines)
CONVERT(Ambitus)
Expand Down

0 comments on commit e4485ba

Please sign in to comment.