2012-05-26 14:26:10 +02:00
|
|
|
//=============================================================================
|
|
|
|
// MuseScore
|
|
|
|
// Music Composition & Notation
|
|
|
|
//
|
|
|
|
// Copyright (C) 2002-2011 Werner Schweer
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License version 2
|
|
|
|
// as published by the Free Software Foundation and appearing in
|
|
|
|
// the file LICENCE.GPL
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
#ifndef __ARTICULATION_H__
|
|
|
|
#define __ARTICULATION_H__
|
|
|
|
|
2012-08-04 15:46:43 +02:00
|
|
|
#include "mscore.h"
|
2013-11-11 16:53:03 +01:00
|
|
|
#include "element.h"
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
class QPainter;
|
2013-05-13 18:49:17 +02:00
|
|
|
|
|
|
|
namespace Ms {
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
class ChordRest;
|
2014-06-24 17:16:22 +02:00
|
|
|
enum class SymId;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ArticulationInfo
|
|
|
|
// gives infos about note attributes
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2014-05-21 15:37:28 +02:00
|
|
|
enum class ArticulationAnchor : char {
|
|
|
|
TOP_STAFF, // anchor is always placed at top of staff
|
|
|
|
BOTTOM_STAFF, // anchor is always placed at bottom of staff
|
|
|
|
CHORD, // anchor depends on chord direction, away from stem
|
|
|
|
TOP_CHORD, // attribute is alway placed at top of chord
|
|
|
|
BOTTOM_CHORD, // attribute is placed at bottom of chord
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// flags:
|
2014-06-02 14:53:14 +02:00
|
|
|
enum class ArticulationShowIn : char { PITCHED_STAFF = 1, TABLATURE = 2 };
|
|
|
|
|
|
|
|
constexpr ArticulationShowIn operator| (ArticulationShowIn a1, ArticulationShowIn a2) {
|
|
|
|
return static_cast<ArticulationShowIn>(static_cast<unsigned char>(a1) | static_cast<unsigned char>(a2));
|
|
|
|
}
|
|
|
|
constexpr bool operator& (ArticulationShowIn a1, ArticulationShowIn a2) {
|
|
|
|
return static_cast<unsigned char>(a1) & static_cast<unsigned char>(a2);
|
|
|
|
}
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
struct ArticulationInfo {
|
|
|
|
SymId upSym;
|
|
|
|
SymId downSym;
|
|
|
|
QString name;
|
|
|
|
QString description; // translated name
|
|
|
|
qreal timeStretch; // for fermata
|
2014-06-02 14:53:14 +02:00
|
|
|
ArticulationShowIn flags;
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ Articulation
|
|
|
|
/// articulation marks
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class Articulation : public Element {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2013-03-05 20:23:59 +01:00
|
|
|
ArticulationType _articulationType;
|
2014-06-26 10:53:57 +02:00
|
|
|
MScore::Direction _direction;
|
2012-05-26 14:26:10 +02:00
|
|
|
QString _channelName;
|
2013-08-07 13:20:44 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
ArticulationAnchor _anchor;
|
2013-08-07 13:20:44 +02:00
|
|
|
PropertyStyle anchorStyle;
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
bool _up;
|
2013-06-03 14:39:59 +02:00
|
|
|
qreal _timeStretch; // for fermata
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
virtual void draw(QPainter*) const;
|
|
|
|
|
|
|
|
public:
|
|
|
|
Articulation(Score*);
|
|
|
|
Articulation &operator=(const Articulation&);
|
|
|
|
|
|
|
|
virtual Articulation* clone() const { return new Articulation(*this); }
|
2014-06-24 18:36:02 +02:00
|
|
|
virtual Element::Type type() const { return Element::Type::ARTICULATION; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-08-24 19:43:02 +02:00
|
|
|
virtual qreal mag() const;
|
2013-05-28 15:42:02 +02:00
|
|
|
|
2013-03-05 20:23:59 +01:00
|
|
|
void setArticulationType(ArticulationType);
|
|
|
|
ArticulationType articulationType() const { return _articulationType; }
|
2012-05-26 14:26:10 +02:00
|
|
|
void setSubtype(const QString& s);
|
|
|
|
QString subtypeName() const;
|
|
|
|
|
|
|
|
virtual void layout();
|
|
|
|
|
2013-01-11 18:10:18 +01:00
|
|
|
virtual void read(XmlReader&);
|
2012-05-26 14:26:10 +02:00
|
|
|
virtual void write(Xml& xml) const;
|
|
|
|
|
2012-11-19 10:08:15 +01:00
|
|
|
virtual void reset();
|
2012-05-26 14:26:10 +02:00
|
|
|
virtual QLineF dragAnchor() const;
|
|
|
|
|
|
|
|
virtual QVariant getProperty(P_ID propertyId) const;
|
|
|
|
virtual bool setProperty(P_ID propertyId, const QVariant&);
|
2013-06-03 12:54:11 +02:00
|
|
|
virtual QVariant propertyDefault(P_ID) const;
|
2013-08-07 13:20:44 +02:00
|
|
|
virtual PropertyStyle propertyStyle(P_ID) const override;
|
|
|
|
virtual void resetProperty(P_ID id) override;
|
|
|
|
virtual void styleChanged() override;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
QString subtypeUserName() const;
|
|
|
|
|
|
|
|
virtual QPointF pagePos() const; ///< position in page coordinates
|
|
|
|
virtual QPointF canvasPos() const;
|
|
|
|
|
|
|
|
bool up() const { return _up; }
|
|
|
|
void setUp(bool val) { _up = val; }
|
2014-06-26 10:53:57 +02:00
|
|
|
void setDirection(MScore::Direction d);
|
|
|
|
MScore::Direction direction() const { return _direction; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
ChordRest* chordRest() const;
|
|
|
|
|
|
|
|
static ArticulationInfo articulationList[];
|
|
|
|
|
|
|
|
ArticulationAnchor anchor() const { return _anchor; }
|
|
|
|
void setAnchor(ArticulationAnchor v) { _anchor = v; }
|
|
|
|
|
2013-06-03 14:39:59 +02:00
|
|
|
qreal timeStretch() const { return _timeStretch; }
|
|
|
|
void setTimeStretch(qreal val) { _timeStretch = val; }
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
QString channelName() const { return _channelName; }
|
|
|
|
void setChannelName(const QString& s) { _channelName = s; }
|
|
|
|
|
2014-05-26 21:55:26 +02:00
|
|
|
const ArticulationInfo* articulationInfo() const { return &articulationList[int(articulationType())]; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
static QString idx2name(int idx);
|
2014-06-21 08:08:39 +02:00
|
|
|
bool isFermata() { return _articulationType == ArticulationType::Fermata ||
|
|
|
|
_articulationType == ArticulationType::Shortfermata ||
|
|
|
|
_articulationType == ArticulationType::Longfermata ||
|
|
|
|
_articulationType == ArticulationType::Verylongfermata; }
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
|
|
|
|
} // namespace Ms
|
2012-05-26 14:26:10 +02:00
|
|
|
#endif
|
|
|
|
|