MuseScore/libmscore/tremolo.h
2012-11-14 12:25:00 +01:00

79 lines
2.2 KiB
C++

//=============================================================================
// MuseScore
// Music Composition & Notation
// $Id: tremolo.h 5149 2011-12-29 08:38:43Z wschweer $
//
// 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 __TREMOLO_H__
#define __TREMOLO_H__
#include "symbol.h"
class Chord;
class QPainter;
// Tremolo subtypes:
enum TremoloType {
OLD_TREMOLO_R8 = 0,
OLD_TREMOLO_R16,
OLD_TREMOLO_R32,
OLD_TREMOLO_C8,
OLD_TREMOLO_C16,
OLD_TREMOLO_C32,
TREMOLO_R8=6, TREMOLO_R16, TREMOLO_R32, TREMOLO_R64, // one note tremolo (repeat)
TREMOLO_C8, TREMOLO_C16, TREMOLO_C32, TREMOLO_C64 // two note tremolo (change)
};
//---------------------------------------------------------
// @@ Tremolo
//---------------------------------------------------------
class Tremolo : public Element {
Q_OBJECT
TremoloType _subtype;
Chord* _chord1;
Chord* _chord2;
QPainterPath path;
int _lines; // derived from _subtype
public:
Tremolo(Score*);
Tremolo &operator=(const Tremolo&);
virtual Tremolo* clone() const { return new Tremolo(*this); }
virtual ElementType type() const { return TREMOLO; }
QString subtypeName() const;
void setSubtype(const QString& s);
void setSubtype(TremoloType t);
TremoloType subtype() const { return _subtype; }
virtual void draw(QPainter*) const;
virtual void layout();
virtual void write(Xml& xml) const;
virtual void read(const QDomElement&);
Chord* chord1() const { return _chord1; }
Chord* chord2() const { return _chord2; }
void setChords(Chord* c1, Chord* c2) {
_chord1 = c1;
_chord2 = c2;
}
Fraction tremoloLen() const;
bool twoNotes() const { return subtype() > TREMOLO_R64; } // is it a two note tremolo?
int lines() const { return _lines; }
};
#endif