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 "Note.h"
20 #include "Chord.h"
21
22 namespace MusicCore {
23
24 class Note::Private {
25 public:
26 Staff* staff;
27 int pitch;
28 int accidentals;
29 bool tied;
30 bool drawAccidentals;
31 };
32
Note(Chord * chord,Staff * staff,int pitch,int accidentals)33 Note::Note(Chord* chord, Staff* staff, int pitch, int accidentals) : QObject(chord), d(new Private)
34 {
35 d->staff = staff;
36 d->pitch = pitch;
37 d->accidentals = accidentals;
38 d->tied = false;
39 d->drawAccidentals = false;
40 }
41
~Note()42 Note::~Note()
43 {
44 delete d;
45 }
46
staff()47 Staff* Note::staff()
48 {
49 return d->staff;
50 }
51
chord()52 Chord* Note::chord()
53 {
54 return qobject_cast<Chord*>(parent());
55 }
56
setStaff(Staff * staff)57 void Note::setStaff(Staff* staff)
58 {
59 d->staff = staff;
60 }
61
pitch() const62 int Note::pitch() const
63 {
64 return d->pitch;
65 }
66
accidentals() const67 int Note::accidentals() const
68 {
69 return d->accidentals;
70 }
71
setAccidentals(int accidentals)72 void Note::setAccidentals(int accidentals)
73 {
74 d->accidentals = accidentals;
75 }
76
drawAccidentals() const77 bool Note::drawAccidentals() const
78 {
79 return d->drawAccidentals;
80 }
81
setDrawAccidentals(bool drawAccidentals)82 void Note::setDrawAccidentals(bool drawAccidentals)
83 {
84 d->drawAccidentals = drawAccidentals;
85 }
86
isStartTie() const87 bool Note::isStartTie() const
88 {
89 return d->tied;
90 }
91
setStartTie(bool startTie)92 void Note::setStartTie(bool startTie)
93 {
94 d->tied = startTie;
95 }
96
97 } // namespace MusicCore
98