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 __DYNAMICS_H__
|
|
|
|
#define __DYNAMICS_H__
|
|
|
|
|
|
|
|
#include "text.h"
|
|
|
|
#include "mscore.h"
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
namespace Ms {
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
class Measure;
|
|
|
|
class Segment;
|
|
|
|
|
2012-10-31 10:15:45 +01:00
|
|
|
//-----------------------------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ Dynamic
|
2014-05-16 13:44:32 +02:00
|
|
|
/// dynamics marker; determines midi velocity
|
2012-10-31 10:15:45 +01:00
|
|
|
//
|
2014-06-04 08:30:59 +02:00
|
|
|
// @P range Ms::DynamicRange (STAFF, PART, SYSTEM)
|
2012-10-31 10:15:45 +01:00
|
|
|
//-----------------------------------------------------------------------------
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
class Dynamic : public Text {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
2014-05-12 10:40:39 +02:00
|
|
|
Q_PROPERTY(DynamicRange range READ dynRange WRITE undoSetDynRange)
|
2012-05-28 11:29:21 +02:00
|
|
|
|
2013-02-12 20:51:17 +01:00
|
|
|
public:
|
2014-06-24 16:03:04 +02:00
|
|
|
enum class Type : char {
|
2014-05-21 15:44:16 +02:00
|
|
|
OTHER,
|
|
|
|
PPPPPP,
|
|
|
|
PPPPP,
|
|
|
|
PPPP,
|
|
|
|
PPP,
|
|
|
|
PP,
|
|
|
|
P,
|
|
|
|
MP,
|
|
|
|
MF,
|
|
|
|
F,
|
|
|
|
FF,
|
|
|
|
FFF,
|
|
|
|
FFFF,
|
|
|
|
FFFFF,
|
|
|
|
FFFFFF,
|
|
|
|
FP,
|
|
|
|
SF,
|
|
|
|
SFZ,
|
|
|
|
SFF,
|
|
|
|
SFFZ,
|
|
|
|
SFP,
|
|
|
|
SFPP,
|
|
|
|
RFZ,
|
|
|
|
RF,
|
|
|
|
FZ,
|
|
|
|
M,
|
|
|
|
R,
|
|
|
|
S,
|
|
|
|
Z
|
2013-02-12 20:51:17 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
2014-06-24 16:03:04 +02:00
|
|
|
Type _dynamicType;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
mutable QPointF dragOffset;
|
|
|
|
int _velocity; // associated midi velocity 0-127
|
2014-05-21 15:48:18 +02:00
|
|
|
DynamicRange _dynRange; // STAFF, PART, SYSTEM
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-10-22 12:05:31 +02:00
|
|
|
virtual QRectF drag(EditData*) override;
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
public:
|
|
|
|
Dynamic(Score*);
|
|
|
|
Dynamic(const Dynamic&);
|
2014-03-14 18:34:07 +01:00
|
|
|
virtual Dynamic* clone() const override { return new Dynamic(*this); }
|
2014-05-22 19:49:51 +02:00
|
|
|
virtual ElementType type() const override { return ElementType::DYNAMIC; }
|
2014-03-14 18:34:07 +01:00
|
|
|
Segment* segment() const { return (Segment*)parent(); }
|
|
|
|
Measure* measure() const { return (Measure*)parent()->parent(); }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2014-06-24 16:03:04 +02:00
|
|
|
void setDynamicType(Type val) { _dynamicType = val; }
|
2013-03-05 20:23:59 +01:00
|
|
|
void setDynamicType(const QString&);
|
|
|
|
QString dynamicTypeName() const;
|
2014-06-24 16:03:04 +02:00
|
|
|
Type dynamicType() const { return _dynamicType; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2014-03-14 18:34:07 +01:00
|
|
|
virtual void layout() override;
|
|
|
|
virtual void write(Xml& xml) const override;
|
|
|
|
virtual void read(XmlReader&) override;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2014-03-14 18:34:07 +01:00
|
|
|
virtual bool isEditable() const override { return true; }
|
|
|
|
virtual void startEdit(MuseScoreView*, const QPointF&) override;
|
|
|
|
virtual void endEdit() override;
|
|
|
|
virtual void reset() override;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
void setVelocity(int v);
|
|
|
|
int velocity() const;
|
2012-10-31 10:15:45 +01:00
|
|
|
DynamicRange dynRange() const { return _dynRange; }
|
|
|
|
void setDynRange(DynamicRange t) { _dynRange = t; }
|
|
|
|
void undoSetDynRange(DynamicRange t);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2014-03-14 18:34:07 +01:00
|
|
|
virtual QLineF dragAnchor() const override;
|
2012-10-31 10:15:45 +01:00
|
|
|
|
2014-03-14 18:34:07 +01:00
|
|
|
virtual QVariant getProperty(P_ID propertyId) const override;
|
|
|
|
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
|
|
|
|
virtual QVariant propertyDefault(P_ID id) 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
|