MuseScore/libmscore/trill.h

114 lines
3.9 KiB
C
Raw Normal View History

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 {
Q_OBJECT
2013-11-19 16:06:08 +01:00
QString _symbols;
void symbolLine(SymId start, SymId fill);
void symbolLine(SymId start, SymId fill, SymId end);
2012-05-26 14:26:10 +02:00
protected:
public:
TrillSegment(Score* s) : LineSegment(s) {}
Trill* trill() const { return (Trill*)spanner(); }
virtual ElementType type() const override { return ElementType::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;
virtual bool acceptDrop(MuseScoreView*, const QPointF&, Element*) const override;
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
QString symbols() const { return _symbols; }
void setSymbols(const QString& s) { _symbols = s; }
2012-05-26 14:26:10 +02:00
};
//---------------------------------------------------------
2012-07-25 11:49:34 +02:00
// @@ Trill
// @P trillType Ms::Trill::TrillType (TRILL_LINE, UPPRALL_LINE, DOWNPRALL_LINE, PRALLPRALL_LINE, PURE_LINE)
2012-05-26 14:26:10 +02:00
//---------------------------------------------------------
class Trill : public SLine {
Q_OBJECT
2012-09-17 18:09:30 +02:00
Q_ENUMS(TrillType)
2012-09-17 18:09:30 +02:00
public:
2014-05-25 18:51:19 +02:00
enum class TrillType : char {
2012-10-15 23:58:40 +02:00
TRILL_LINE, UPPRALL_LINE, DOWNPRALL_LINE, PRALLPRALL_LINE, PURE_LINE
2012-09-17 18:09:30 +02:00
};
private:
Q_PROPERTY(TrillType trillType READ trillType WRITE undoSetTrillType)
TrillType _trillType;
2013-08-30 16:03:46 +02:00
Accidental* _accidental;
2012-05-26 14:26:10 +02:00
public:
Trill(Score* s);
2013-08-30 16:03:46 +02:00
virtual ~Trill();
virtual Trill* clone() const override { return new Trill(*this); }
virtual ElementType type() const override { return ElementType::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
void setTrillType(const QString& s);
void undoSetTrillType(TrillType val);
void setTrillType(TrillType tt) { _trillType = tt; }
TrillType trillType() const { return _trillType; }
QString trillTypeName() 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;
2012-05-26 14:26:10 +02:00
};
2013-05-13 18:49:17 +02:00
} // namespace Ms
Q_DECLARE_METATYPE(Ms::Trill::TrillType);
2013-05-13 18:49:17 +02:00
2012-05-26 14:26:10 +02:00
#endif