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;
|
|
|
|
|
2014-05-21 18:52:58 +02:00
|
|
|
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
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2017-12-21 14:03:45 +01:00
|
|
|
class Arpeggio final : public Element {
|
2013-03-05 20:23:59 +01:00
|
|
|
ArpeggioType _arpeggioType;
|
2013-02-27 11:10:57 +01:00
|
|
|
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
|
|
|
|
2018-10-20 11:50:08 +02:00
|
|
|
qreal _stretch;
|
|
|
|
|
2017-11-23 13:57:10 +01:00
|
|
|
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
|
|
|
|
2015-01-19 12:37:17 +01: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);
|
2017-12-21 14:03:45 +01:00
|
|
|
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; }
|
2015-01-19 12:37:17 +01:00
|
|
|
|
2013-03-05 20:23:59 +01:00
|
|
|
ArpeggioType arpeggioType() const { return _arpeggioType; }
|
|
|
|
void setArpeggioType(ArpeggioType v) { _arpeggioType = v; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-03-05 20:23:59 +01:00
|
|
|
Chord* chord() const { return (Chord*)parent(); }
|
2015-01-19 12:37:17 +01:00
|
|
|
|
2017-03-31 13:03:15 +02:00
|
|
|
virtual bool acceptDrop(EditData&) const override;
|
|
|
|
virtual Element* drop(EditData&) override;
|
2015-01-19 12:37:17 +01:00
|
|
|
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;
|
2015-01-19 12:37:17 +01:00
|
|
|
|
|
|
|
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;
|
2015-01-19 12:37:17 +01:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
int span() const { return _span; }
|
|
|
|
void setSpan(int val) { _span = val; }
|
|
|
|
void setHeight(qreal);
|
2013-02-27 11:10:57 +01:00
|
|
|
|
|
|
|
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; }
|
|
|
|
|
2018-10-20 11:50:08 +02:00
|
|
|
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
|
|
|
|
|