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 __TRILL_H__
|
|
|
|
#define __TRILL_H__
|
|
|
|
|
|
|
|
#include "line.h"
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
class QPainter;
|
|
|
|
|
|
|
|
namespace Ms {
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
class Trill;
|
|
|
|
class Accidental;
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ TrillSegment
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class TrillSegment : public LineSegment {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2016-01-04 14:48:58 +01:00
|
|
|
std::vector<SymId> _symbols;
|
2013-11-19 16:06:08 +01:00
|
|
|
|
|
|
|
void symbolLine(SymId start, SymId fill);
|
|
|
|
void symbolLine(SymId start, SymId fill, SymId end);
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
protected:
|
|
|
|
public:
|
2016-09-04 16:17:33 +02:00
|
|
|
TrillSegment(Score* s) : LineSegment(s) {}
|
|
|
|
Trill* trill() const { return (Trill*)spanner(); }
|
2014-06-24 18:36:02 +02:00
|
|
|
virtual Element::Type type() const override { return Element::Type::TRILL_SEGMENT; }
|
2013-08-30 16:03:46 +02:00
|
|
|
virtual TrillSegment* clone() const override { return new TrillSegment(*this); }
|
|
|
|
virtual void draw(QPainter*) const override;
|
2014-08-13 21:01:21 +02:00
|
|
|
virtual bool acceptDrop(const DropData&) const override;
|
2013-08-30 16:03:46 +02:00
|
|
|
virtual Element* drop(const DropData&) override;
|
|
|
|
virtual void layout() override;
|
|
|
|
virtual QVariant getProperty(P_ID propertyId) const override;
|
|
|
|
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
|
|
|
|
virtual QVariant propertyDefault(P_ID) const override;
|
|
|
|
virtual void add(Element*) override;
|
|
|
|
virtual void remove(Element*) override;
|
2013-09-02 12:29:25 +02:00
|
|
|
virtual void scanElements(void* data, void (*func)(void*, Element*), bool all) override;
|
2013-11-19 16:06:08 +01:00
|
|
|
|
2016-01-04 14:48:58 +01:00
|
|
|
std::vector<SymId> symbols() const { return _symbols; }
|
|
|
|
void setSymbols(const std::vector<SymId>& s) { _symbols = s; }
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ Trill
|
2015-04-24 02:23:37 +02:00
|
|
|
// @P trillType enum (Trill.DOWNPRALL_LINE, .PRALLPRALL_LINE, .PURE_LINE, .TRILL_LINE, .UPPRALL_LINE)
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class Trill : public SLine {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
2014-06-25 14:07:43 +02:00
|
|
|
Q_ENUMS(Type)
|
2012-05-28 11:29:21 +02:00
|
|
|
|
2012-09-17 18:09:30 +02:00
|
|
|
public:
|
2014-06-25 14:07:43 +02:00
|
|
|
enum class Type : char {
|
2015-07-12 10:10:36 +02:00
|
|
|
TRILL_LINE, UPPRALL_LINE, DOWNPRALL_LINE, PRALLPRALL_LINE
|
2012-09-17 18:09:30 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
2014-06-25 14:07:43 +02:00
|
|
|
Q_PROPERTY(Ms::Trill::Type trillType READ trillType WRITE undoSetTrillType)
|
|
|
|
Type _trillType;
|
2013-08-30 16:03:46 +02:00
|
|
|
Accidental* _accidental;
|
2015-07-11 17:02:40 +02:00
|
|
|
MScore::OrnamentStyle _ornamentStyle; // for use in ornaments such as trill
|
|
|
|
bool _playArticulation;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
Trill(Score* s);
|
2013-08-30 16:03:46 +02:00
|
|
|
virtual ~Trill();
|
2014-06-24 18:36:02 +02:00
|
|
|
virtual Trill* clone() const override { return new Trill(*this); }
|
|
|
|
virtual Element::Type type() const override { return Element::Type::TRILL; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-08-30 16:03:46 +02:00
|
|
|
virtual void layout() override;
|
|
|
|
virtual LineSegment* createLineSegment() override;
|
|
|
|
virtual void add(Element*) override;
|
|
|
|
virtual void remove(Element*) override;
|
|
|
|
virtual void write(Xml&) const override;
|
|
|
|
virtual void read(XmlReader&) override;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-03-05 20:23:59 +01:00
|
|
|
void setTrillType(const QString& s);
|
2014-06-25 14:07:43 +02:00
|
|
|
void undoSetTrillType(Type val);
|
|
|
|
void setTrillType(Type tt) { _trillType = tt; }
|
|
|
|
Type trillType() const { return _trillType; }
|
2015-07-11 17:02:40 +02:00
|
|
|
void setOrnamentStyle(MScore::OrnamentStyle val) { _ornamentStyle = val;}
|
|
|
|
MScore::OrnamentStyle ornamentStyle() const { return _ornamentStyle;}
|
|
|
|
void setPlayArticulation(bool val) { _playArticulation = val;}
|
|
|
|
bool playArticulation() const { return _playArticulation; }
|
2013-03-05 20:23:59 +01:00
|
|
|
QString trillTypeName() const;
|
2016-02-04 17:06:32 +01:00
|
|
|
QString trillTypeUserName() const;
|
2013-08-30 16:03:46 +02:00
|
|
|
Accidental* accidental() const { return _accidental; }
|
|
|
|
void setAccidental(Accidental* a) { _accidental = a; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
Segment* segment() const { return (Segment*)parent(); }
|
2013-08-30 16:03:46 +02:00
|
|
|
virtual void scanElements(void* data, void (*func)(void*, Element*), bool all=true) override;
|
2012-09-17 18:09:30 +02:00
|
|
|
|
2013-08-30 16:03:46 +02:00
|
|
|
virtual QVariant getProperty(P_ID propertyId) const override;
|
|
|
|
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
|
|
|
|
virtual QVariant propertyDefault(P_ID) const override;
|
|
|
|
virtual void setYoff(qreal) override;
|
2014-07-10 14:13:37 +02:00
|
|
|
|
2016-02-04 17:06:32 +01:00
|
|
|
virtual QString accessibleInfo() const override;
|
2014-07-10 14:13:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct TrillTableItem {
|
|
|
|
Trill::Type type;
|
|
|
|
const char* name;
|
|
|
|
QString userName;
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2014-07-10 14:13:37 +02:00
|
|
|
extern const TrillTableItem trillTable[];
|
|
|
|
extern int trillTableSize();
|
2013-05-13 18:49:17 +02:00
|
|
|
|
|
|
|
} // namespace Ms
|
|
|
|
|
2014-06-25 14:07:43 +02:00
|
|
|
Q_DECLARE_METATYPE(Ms::Trill::Type);
|
2013-05-13 18:49:17 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
#endif
|
|
|
|
|