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
|
|
|
//
|
2015-04-23 21:06:36 +02:00
|
|
|
// @P range enum (Dynamic.STAFF, .PART, .SYSTEM)
|
2012-10-31 10:15:45 +01:00
|
|
|
//-----------------------------------------------------------------------------
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2017-12-27 11:51:00 +01:00
|
|
|
class Dynamic final : public TextBase {
|
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
|
|
|
};
|
|
|
|
|
2014-06-24 16:42:47 +02:00
|
|
|
enum class Range : char {
|
|
|
|
STAFF, PART, SYSTEM
|
|
|
|
};
|
|
|
|
|
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;
|
2014-06-24 16:42:47 +02:00
|
|
|
int _velocity; // associated midi velocity 0-127
|
|
|
|
Range _dynRange; // STAFF, PART, SYSTEM
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2017-03-31 13:03:15 +02:00
|
|
|
virtual QRectF drag(EditData&) override;
|
2018-10-18 11:53:01 +02:00
|
|
|
virtual Sid getPropertyStyle(Pid) const override;
|
2013-10-22 12:05:31 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
public:
|
|
|
|
Dynamic(Score*);
|
|
|
|
Dynamic(const Dynamic&);
|
2014-06-24 18:36:02 +02:00
|
|
|
virtual Dynamic* clone() const override { return new Dynamic(*this); }
|
2017-12-21 14:03:45 +01:00
|
|
|
virtual ElementType type() const override { return ElementType::DYNAMIC; }
|
2014-06-24 18:36:02 +02:00
|
|
|
Segment* segment() const { return (Segment*)parent(); }
|
|
|
|
Measure* measure() const { return (Measure*)parent()->parent(); }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2018-12-18 18:02:10 +01:00
|
|
|
void setDynamicType(Type val) { _dynamicType = val; }
|
2013-03-05 20:23:59 +01:00
|
|
|
void setDynamicType(const QString&);
|
|
|
|
QString dynamicTypeName() const;
|
2018-12-18 18:02:10 +01:00
|
|
|
Type dynamicType() const { return _dynamicType; }
|
|
|
|
virtual int subtype() const override { return (int) _dynamicType; }
|
|
|
|
virtual QString subtypeName() const override { return dynamicTypeName(); }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2014-03-14 18:34:07 +01:00
|
|
|
virtual void layout() override;
|
2016-11-19 11:51:21 +01:00
|
|
|
virtual void write(XmlWriter& xml) const override;
|
2014-03-14 18:34:07 +01:00
|
|
|
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; }
|
2017-03-31 13:03:15 +02:00
|
|
|
virtual void startEdit(EditData&) override;
|
|
|
|
virtual void endEdit(EditData&) override;
|
2014-03-14 18:34:07 +01:00
|
|
|
virtual void reset() override;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2016-08-02 17:00:49 +02:00
|
|
|
void setVelocity(int v) { _velocity = v; }
|
2012-05-26 14:26:10 +02:00
|
|
|
int velocity() const;
|
2014-06-24 16:42:47 +02:00
|
|
|
Range dynRange() const { return _dynRange; }
|
|
|
|
void setDynRange(Range t) { _dynRange = t; }
|
|
|
|
void undoSetDynRange(Range t);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
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 id) const override;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2016-02-04 17:06:32 +01:00
|
|
|
virtual QString accessibleInfo() const override;
|
2017-06-15 17:01:47 +02:00
|
|
|
virtual QString screenReaderInfo() const override;
|
2016-07-19 14:36:09 +02:00
|
|
|
void doAutoplace();
|
2014-07-10 14:13:37 +02:00
|
|
|
};
|
2013-05-13 18:49:17 +02:00
|
|
|
|
|
|
|
} // namespace Ms
|
2014-06-24 16:42:47 +02:00
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(Ms::Dynamic::Range);
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
#endif
|