1 /* This file is part of the KDE project
2  * Copyright (C) 2007 Marijn Kruisselbrink <mkruisselbrink@kde.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 #include "VoiceElement.h"
20 
21 namespace MusicCore {
22 
23 class VoiceElement::Private
24 {
25 public:
26     Staff* staff;
27     int length;
28     qreal x;
29     qreal y;
30     qreal width;
31     qreal height;
32     VoiceBar* voiceBar;
33     qreal beatline;
34 };
35 
VoiceElement(int length)36 VoiceElement::VoiceElement(int length) : d(new Private)
37 {
38     d->staff = 0;
39     d->length = length;
40     d->x = 0;
41     d->y = 0;
42     d->width = 0;
43     d->height = 0;
44     d->voiceBar = 0;
45     d->beatline = 0;
46 }
47 
~VoiceElement()48 VoiceElement::~VoiceElement()
49 {
50     delete d;
51 }
52 
staff() const53 Staff* VoiceElement::staff() const
54 {
55     return d->staff;
56 }
57 
setStaff(Staff * staff)58 void VoiceElement::setStaff(Staff* staff)
59 {
60     d->staff = staff;
61 }
62 
voiceBar() const63 VoiceBar* VoiceElement::voiceBar() const
64 {
65     return d->voiceBar;
66 }
67 
setVoiceBar(VoiceBar * voiceBar)68 void VoiceElement::setVoiceBar(VoiceBar* voiceBar)
69 {
70     d->voiceBar = voiceBar;
71 }
72 
x() const73 qreal VoiceElement::x() const
74 {
75     return d->x;
76 }
77 
setX(qreal x)78 void VoiceElement::setX(qreal x)
79 {
80     if (d->x == x) return;
81     d->x = x;
82     emit xChanged(x);
83 }
84 
y() const85 qreal VoiceElement::y() const
86 {
87     return d->y;
88 }
89 
setY(qreal y)90 void VoiceElement::setY(qreal y)
91 {
92     if (d->y == y) return;
93     d->y = y;
94     emit yChanged(y);
95 }
96 
width() const97 qreal VoiceElement::width() const
98 {
99     return d->width;
100 }
101 
setWidth(qreal width)102 void VoiceElement::setWidth(qreal width)
103 {
104     if (d->width == width) return;
105     d->width = width;
106     emit widthChanged(width);
107 }
108 
height() const109 qreal VoiceElement::height() const
110 {
111     return d->height;
112 }
113 
setHeight(qreal height)114 void VoiceElement::setHeight(qreal height)
115 {
116     if (d->height == height) return;
117     d->height = height;
118     emit heightChanged(height);
119 }
120 
length() const121 int VoiceElement::length() const
122 {
123     return d->length;
124 }
125 
setLength(int length)126 void VoiceElement::setLength(int length)
127 {
128     if (d->length == length) return;
129     d->length = length;
130     emit lengthChanged(length);
131 }
132 
beatline() const133 qreal VoiceElement::beatline() const
134 {
135     return d->beatline;
136 }
137 
setBeatline(qreal beatline)138 void VoiceElement::setBeatline(qreal beatline)
139 {
140     d->beatline = beatline;
141 }
142 
143 } // namespace MusicCore
144