MuseScore/libmscore/arpeggio.h

90 lines
3 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 __ARPEGGIO_H__
#define __ARPEGGIO_H__
#include "element.h"
class QPainter;
2013-05-13 18:49:17 +02:00
namespace Ms {
class Chord;
enum class ArpeggioType : char {
2013-02-27 11:23:30 +01:00
NORMAL, UP, DOWN, BRACKET, UP_STRAIGHT, DOWN_STRAIGHT
2012-05-26 14:26:10 +02:00
};
//---------------------------------------------------------
2012-07-25 11:49:34 +02:00
// @@ Arpeggio
2012-05-26 14:26:10 +02:00
//---------------------------------------------------------
class Arpeggio : public Element {
Q_OBJECT
ArpeggioType _arpeggioType;
qreal _userLen1;
qreal _userLen2;
2012-05-26 14:26:10 +02:00
qreal _height;
int _span; // spanning staves
2015-05-05 18:46:13 +02:00
QList<SymId> symbols;
2013-11-19 12:12:07 +01:00
void symbolLine(SymId start, SymId fill);
void symbolLine2(SymId end, SymId fill);
2012-05-26 14:26:10 +02:00
virtual void spatiumChanged(qreal /*oldValue*/, qreal /*newValue*/) override;
virtual QLineF dragAnchor() const override;
virtual QPointF gripAnchor(Grip) const override;
virtual void startEdit(MuseScoreView*, const QPointF&) override;
2012-05-26 14:26:10 +02:00
public:
Arpeggio(Score* s);
virtual Arpeggio* clone() const override { return new Arpeggio(*this); }
virtual Element::Type type() const override { return Element::Type::ARPEGGIO; }
ArpeggioType arpeggioType() const { return _arpeggioType; }
void setArpeggioType(ArpeggioType v) { _arpeggioType = v; }
2012-05-26 14:26:10 +02:00
Chord* chord() const { return (Chord*)parent(); }
2014-08-13 21:01:21 +02:00
virtual bool acceptDrop(const DropData&) const override;
virtual Element* drop(const DropData&) override;
virtual void layout() override;
virtual void draw(QPainter*) const override;
virtual bool isEditable() const override { return true; }
virtual void editDrag(const EditData&) override;
virtual void updateGrips(Grip*, QVector<QRectF>&) const override;
virtual int grips() const override { return 2; }
virtual bool edit(MuseScoreView*, Grip, int key, Qt::KeyboardModifiers, const QString&) override;
virtual void read(XmlReader& e) override;
virtual void write(Xml& xml) const override;
2012-05-26 14:26:10 +02:00
int span() const { return _span; }
void setSpan(int val) { _span = val; }
void setHeight(qreal);
qreal userLen1() const { return _userLen1; }
qreal userLen2() const { return _userLen2; }
void setUserLen1(qreal v) { _userLen1 = v; }
void setUserLen2(qreal v) { _userLen2 = v; }
virtual QVariant getProperty(P_ID propertyId) const override;
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
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