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 __OTTAVA_H__
|
|
|
|
#define __OTTAVA_H__
|
|
|
|
|
|
|
|
#include "textline.h"
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
namespace Ms {
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// OttavaE
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
struct OttavaE {
|
|
|
|
int offset;
|
|
|
|
unsigned start;
|
|
|
|
unsigned end;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Ottava;
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ OttavaSegment
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class OttavaSegment : public TextLineSegment {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
protected:
|
|
|
|
|
|
|
|
public:
|
2013-08-28 11:10:12 +02:00
|
|
|
// OttavaSegment(Score* s) : TextLineSegment(s) { setFlag(ELEMENT_ON_STAFF, true); }
|
|
|
|
OttavaSegment(Score* s) : TextLineSegment(s) { }
|
2013-08-08 11:38:32 +02:00
|
|
|
virtual ElementType type() const override { return OTTAVA_SEGMENT; }
|
|
|
|
virtual OttavaSegment* clone() const override { return new OttavaSegment(*this); }
|
2012-05-26 14:26:10 +02:00
|
|
|
Ottava* ottava() const { return (Ottava*)spanner(); }
|
2013-08-08 11:38:32 +02:00
|
|
|
virtual void layout() override;
|
|
|
|
virtual QVariant getProperty(P_ID propertyId) const override;
|
|
|
|
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
|
|
|
|
virtual QVariant propertyDefault(P_ID) const override;
|
2013-08-07 13:20:44 +02:00
|
|
|
virtual PropertyStyle propertyStyle(P_ID) const override;
|
2013-08-06 19:28:04 +02:00
|
|
|
virtual void resetProperty(P_ID id) override;
|
|
|
|
virtual void styleChanged() override;
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2013-08-12 10:37:30 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// OttavaType
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
enum class OttavaType {
|
|
|
|
OTTAVA_8VA,
|
|
|
|
OTTAVA_8VB,
|
|
|
|
OTTAVA_15MA,
|
|
|
|
OTTAVA_15MB,
|
|
|
|
OTTAVA_22MA,
|
|
|
|
OTTAVA_22MB
|
|
|
|
};
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ Ottava
|
2013-08-29 11:08:09 +02:00
|
|
|
// @P ottavaType enum OttavaType OTTAVA_8VA, OTTAVA_15MA, OTTAVA_8VB, OTTAVA_15MB, OTTAVA_22MA, OTTAVA_22MB
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class Ottava : public TextLine {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
2012-09-17 17:35:49 +02:00
|
|
|
Q_ENUMS(OttavaType)
|
2012-05-28 11:29:21 +02:00
|
|
|
|
2012-09-17 17:35:49 +02:00
|
|
|
public:
|
|
|
|
|
|
|
|
private:
|
2013-03-05 20:23:59 +01:00
|
|
|
Q_PROPERTY(OttavaType ottavaType READ ottavaType WRITE undoSetOttavaType)
|
|
|
|
OttavaType _ottavaType;
|
2013-08-12 10:37:30 +02:00
|
|
|
bool _numbersOnly;
|
|
|
|
PropertyStyle numbersOnlyStyle;
|
2013-08-07 13:20:44 +02:00
|
|
|
PropertyStyle lineWidthStyle;
|
2013-08-08 11:38:32 +02:00
|
|
|
PropertyStyle lineStyleStyle;
|
2013-08-30 12:46:15 +02:00
|
|
|
PropertyStyle beginSymbolStyle;
|
|
|
|
PropertyStyle continueSymbolStyle;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
QString text;
|
|
|
|
int _pitchShift;
|
|
|
|
mutable qreal textHeight; ///< cached value
|
|
|
|
|
|
|
|
friend class OttavaSegment;
|
|
|
|
|
|
|
|
public:
|
|
|
|
Ottava(Score* s);
|
2013-08-06 19:28:04 +02:00
|
|
|
virtual Ottava* clone() const override { return new Ottava(*this); }
|
|
|
|
virtual ElementType type() const override { return OTTAVA; }
|
2012-09-17 17:35:49 +02:00
|
|
|
|
2013-03-05 20:23:59 +01:00
|
|
|
void setOttavaType(OttavaType val);
|
|
|
|
OttavaType ottavaType() const { return _ottavaType; }
|
|
|
|
void undoSetOttavaType(OttavaType val);
|
2012-09-17 17:35:49 +02:00
|
|
|
|
2013-08-12 10:37:30 +02:00
|
|
|
bool numbersOnly() const { return _numbersOnly; }
|
|
|
|
void setNumbersOnly(bool val) { _numbersOnly = val; }
|
|
|
|
|
2013-08-06 19:28:04 +02:00
|
|
|
virtual LineSegment* createLineSegment() override;
|
2012-05-26 14:26:10 +02:00
|
|
|
int pitchShift() const { return _pitchShift; }
|
2012-09-17 17:35:49 +02:00
|
|
|
|
2013-08-06 19:28:04 +02:00
|
|
|
virtual void endEdit() override;
|
|
|
|
virtual void write(Xml& xml) const override;
|
|
|
|
virtual void read(XmlReader& de) override;
|
|
|
|
|
|
|
|
virtual QVariant getProperty(P_ID propertyId) const override;
|
|
|
|
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
|
|
|
|
virtual QVariant propertyDefault(P_ID) const override;
|
2013-08-07 13:20:44 +02:00
|
|
|
virtual PropertyStyle propertyStyle(P_ID) const override;
|
2013-08-06 19:28:04 +02:00
|
|
|
virtual void resetProperty(P_ID id) override;
|
|
|
|
|
|
|
|
virtual void setYoff(qreal) override;
|
|
|
|
virtual void styleChanged() override;
|
2013-08-09 13:19:54 +02:00
|
|
|
virtual void reset() override;
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
} // namespace Ms
|
|
|
|
|
2013-08-12 10:37:30 +02:00
|
|
|
Q_DECLARE_METATYPE(Ms::OttavaType)
|
2013-05-13 18:49:17 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
#endif
|
|
|
|
|