MuseScore/libmscore/arpeggio.h

99 lines
3.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"
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 final : public Element {
ArpeggioType _arpeggioType;
qreal _userLen1;
qreal _userLen2;
2012-05-26 14:26:10 +02:00
qreal _height;
int _span; // spanning staves
2016-01-04 14:48:58 +01:00
std::vector<SymId> symbols;
2015-07-06 18:16:52 +02:00
bool _playArpeggio;
2013-11-19 12:12:07 +01:00
qreal _stretch;
bool _hidden = false; // set in layout, will skip draw if true
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;
2017-03-31 13:03:15 +02:00
virtual void startEdit(EditData&) override;
2012-05-26 14:26:10 +02:00
public:
Arpeggio(Score* s);
virtual Arpeggio* clone() const override { return new Arpeggio(*this); }
2017-01-18 14:16:33 +01:00
virtual ElementType type() const override { return ElementType::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(); }
2017-03-31 13:03:15 +02:00
virtual bool acceptDrop(EditData&) const override;
virtual Element* drop(EditData&) override;
virtual void layout() override;
virtual void draw(QPainter*) const override;
virtual bool isEditable() const override { return true; }
2017-03-31 13:03:15 +02:00
virtual void editDrag(EditData&) override;
virtual void updateGrips(EditData&) const override;
virtual bool edit(EditData&) override;
virtual void read(XmlReader& e) override;
2016-11-19 11:51:21 +01:00
virtual void write(XmlWriter& xml) const override;
2019-05-04 08:24:02 +02:00
virtual void reset() 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; }
2015-07-06 18:16:52 +02:00
bool playArpeggio() { return _playArpeggio; }
void setPlayArpeggio(bool p) { _playArpeggio = p; }
qreal Stretch() const { return _stretch; }
void setStretch(qreal val) { _stretch = val; }
2018-03-27 15:36:00 +02:00
virtual QVariant getProperty(Pid propertyId) const override;
virtual bool setProperty(Pid propertyId, const QVariant&) override;
virtual QVariant propertyDefault(Pid propertyId) const override;
2019-05-31 11:47:18 +02:00
virtual Pid propertyId(const QStringRef& xmlName) const 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