/
tremolo.h
75 lines (60 loc) · 2.16 KB
/
tremolo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//=============================================================================
// 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;
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) { _subtype = 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?
};
#endif