MuseScore/libmscore/ottava.h

133 lines
4.1 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 __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 {
Q_OBJECT
2012-05-26 14:26:10 +02:00
protected:
public:
// OttavaSegment(Score* s) : TextLineSegment(s) { setFlag(ELEMENT_ON_STAFF, true); }
OttavaSegment(Score* s) : TextLineSegment(s) { }
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(); }
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;
virtual PropertyStyle propertyStyle(P_ID) const override;
virtual void resetProperty(P_ID id) override;
virtual void styleChanged() override;
2012-05-26 14:26:10 +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 {
Q_OBJECT
2012-09-17 17:35:49 +02:00
Q_ENUMS(OttavaType)
2012-09-17 17:35:49 +02:00
public:
private:
Q_PROPERTY(OttavaType ottavaType READ ottavaType WRITE undoSetOttavaType)
OttavaType _ottavaType;
bool _numbersOnly;
PropertyStyle numbersOnlyStyle;
PropertyStyle lineWidthStyle;
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);
virtual Ottava* clone() const override { return new Ottava(*this); }
virtual ElementType type() const override { return OTTAVA; }
2012-09-17 17:35:49 +02:00
void setOttavaType(OttavaType val);
OttavaType ottavaType() const { return _ottavaType; }
void undoSetOttavaType(OttavaType val);
2012-09-17 17:35:49 +02:00
bool numbersOnly() const { return _numbersOnly; }
void setNumbersOnly(bool val) { _numbersOnly = val; }
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
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;
virtual PropertyStyle propertyStyle(P_ID) const override;
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
Q_DECLARE_METATYPE(Ms::OttavaType)
2013-05-13 18:49:17 +02:00
2012-05-26 14:26:10 +02:00
#endif