Skip to content

Commit

Permalink
implement new fermata element
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Jan 16, 2018
1 parent 182219a commit 35265cd
Show file tree
Hide file tree
Showing 46 changed files with 785 additions and 229 deletions.
2 changes: 1 addition & 1 deletion libmscore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ add_library (
${LIB_SCRIPT_FILES}
types.h
segmentlist.cpp fingering.cpp accidental.cpp arpeggio.cpp
articulation.cpp barline.cpp beam.cpp bend.cpp box.cpp
fermata.cpp articulation.cpp barline.cpp beam.cpp bend.cpp box.cpp
bracket.cpp breath.cpp bsp.cpp chord.cpp chordline.cpp
chordlist.cpp chordrest.cpp clef.cpp cleflist.cpp
drumset.cpp durationtype.cpp dynamic.cpp edit.cpp noteentry.cpp
Expand Down
10 changes: 5 additions & 5 deletions libmscore/chordrest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ void ChordRest::layoutArticulations()
if (parent() == 0 || _articulations.empty())
return;
qreal _spatium = spatium();
// bool scale = !staff()->isDrumStaff(tick());
qreal pld = staff()->lineDistance(tick());
qreal _spStaff = _spatium * pld; // scaled to staff line distance for vert. pos. within a staff

Expand Down Expand Up @@ -765,6 +764,7 @@ Element* ChordRest::drop(EditData& data)
case ElementType::FRET_DIAGRAM:
case ElementType::TREMOLOBAR:
case ElementType::SYMBOL:
case ElementType::FERMATA:
e->setTrack(track());
e->setParent(segment());
score()->undoAddElement(e);
Expand Down Expand Up @@ -1492,11 +1492,11 @@ int ChordRest::lastVerse(Placement p) const

void ChordRest::flipLyrics(Lyrics* l)
{
Element::Placement p = l->placement();
if (p == Element::Placement::ABOVE)
p = Element::Placement::BELOW;
Placement p = l->placement();
if (p == Placement::ABOVE)
p = Placement::BELOW;
else
p = Element::Placement::ABOVE;
p = Placement::ABOVE;
int verses = lastVerse(p);
l->undoChangeProperty(P_ID::VERSE, verses + 1);
l->undoChangeProperty(P_ID::AUTOPLACE, true);
Expand Down
7 changes: 4 additions & 3 deletions libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <assert.h>

#include "types.h"
#include "musescoreCore.h"
#include "score.h"
#include "utils.h"
Expand Down Expand Up @@ -2318,9 +2319,9 @@ void Score::cmdMoveRest(Rest* rest, Direction dir)

void Score::cmdMoveLyrics(Lyrics* lyrics, Direction dir)
{
ChordRest* cr = lyrics->chordRest();
int verse = lyrics->no();
Element::Placement placement = lyrics->placement();
ChordRest* cr = lyrics->chordRest();
int verse = lyrics->no();
Placement placement = lyrics->placement();
int newVerse;
if (lyrics->placeAbove())
dir = (dir == Direction::UP) ? Direction::DOWN : Direction::UP;
Expand Down
6 changes: 4 additions & 2 deletions libmscore/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include "excerpt.h"
#include "breath.h"
#include "glissando.h"
#include "fermata.h"

namespace Ms {

Expand Down Expand Up @@ -1294,10 +1295,11 @@ void Score::cmdFlip()
|| e->isOttavaSegment()
|| e->isTextLineSegment()
|| e->isPedalSegment()
|| e->isFermata()
|| e->isTrillSegment()) {
// getProperty() delegates call from spannerSegment to Spanner:
Element::Placement p = Element::Placement(e->getProperty(P_ID::PLACEMENT).toInt());
p = (p == Element::Placement::ABOVE) ? Element::Placement::BELOW : Element::Placement::ABOVE;
Placement p = Placement(e->getProperty(P_ID::PLACEMENT).toInt());
p = (p == Placement::ABOVE) ? Placement::BELOW : Placement::ABOVE;
e->undoChangeProperty(P_ID::AUTOPLACE, true);
e->undoChangeProperty(P_ID::PLACEMENT, int(p));
}
Expand Down
6 changes: 4 additions & 2 deletions libmscore/element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
#include "letring.h"
#include "vibrato.h"
#include "palmmute.h"
#include "fermata.h"

namespace Ms {

Expand Down Expand Up @@ -848,6 +849,7 @@ Element* Element::create(ElementType type, Score* score)
case ElementType::GLISSANDO: return new Glissando(score);
case ElementType::BRACKET: return new Bracket(score);
case ElementType::ARTICULATION: return new Articulation(score);
case ElementType::FERMATA: return new Fermata(score);
case ElementType::CHORDLINE: return new ChordLine(score);
case ElementType::ACCIDENTAL: return new Accidental(score);
case ElementType::DYNAMIC: return new Dynamic(score);
Expand Down Expand Up @@ -1000,7 +1002,7 @@ QVariant Element::getProperty(P_ID propertyId) const
case P_ID::USER_OFF:
return _userOff;
case P_ID::PLACEMENT:
return int(_placement);
return int(placement());
case P_ID::AUTOPLACE:
return autoplace();
case P_ID::Z:
Expand Down Expand Up @@ -1039,7 +1041,7 @@ bool Element::setProperty(P_ID propertyId, const QVariant& v)
_userOff = v.toPointF();
break;
case P_ID::PLACEMENT:
_placement = Placement(v.toInt());
setPlacement(Placement(v.toInt()));
break;
case P_ID::AUTOPLACE:
setAutoplace(v.toBool());
Expand Down
15 changes: 4 additions & 11 deletions libmscore/element.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,6 @@ class Element : public ScoreElement {
| ElementFlag::VISIBLE
}; // used for segments

protected:
mutable int _z;
QColor _color; ///< element color attribute

public:
enum class Placement : char {
ABOVE, BELOW
};

private:
Placement _placement;
int _track; ///< staffIdx * VOICES + voice
qreal _mag; ///< standard magnification (derived value)
Expand All @@ -163,6 +153,10 @@ class Element : public ScoreElement {
///< valid after call to layout()
uint _tag; ///< tag bitmask

protected:
mutable int _z;
QColor _color; ///< element color attribute

public:
Element(Score* s = 0);
Element(const Element&);
Expand Down Expand Up @@ -521,7 +515,6 @@ extern void collectElements(void* data, Element* e);
} // namespace Ms

Q_DECLARE_METATYPE(Ms::ElementType);
Q_DECLARE_METATYPE(Ms::Element::Placement);

#endif

Loading

0 comments on commit 35265cd

Please sign in to comment.