initial commit of hand merging, plus getting "ancient" waf script to work correctly
[ardour.git] / gtk2_ardour / note.cc
1 /*
2     Copyright (C) 2007 Paul Davis
3     Author: Dave Robillard
4     Author: Hans Baier
5
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #include "evoral/Note.hpp"
22 #include "canvas/rectangle.h"
23 #include "note.h"
24 #include "midi_region_view.h"
25 #include "public_editor.h"
26
27 using namespace ARDOUR;
28 using namespace ArdourCanvas;
29
30 Note::Note (
31         MidiRegionView&                   region,
32         Group*                            group,
33         const boost::shared_ptr<NoteType> note,
34         bool with_events
35         )
36         : NoteBase (region, with_events, note)
37 {
38         _rectangle = new Rectangle (group);
39         _rectangle->name = "note";
40         set_item (_rectangle);
41 }
42
43 Note::~Note ()
44 {
45         delete _rectangle;
46 }
47
48 void
49 Note::move_event (double dx, double dy)
50 {
51         _rectangle->move (Duple (dx, dy));
52
53         /* XXX */
54         // if (_text) {
55         //      _text->hide();
56         //      _text->property_x() = _text->property_x() + dx;
57         //      _text->property_y() = _text->property_y() + dy;
58         //      _text->show();
59         // }
60 }
61
62 Coord
63 Note::x0 () const
64 {
65         return _rectangle->x0 ();
66 }
67
68 Coord
69 Note::x1 () const
70 {
71         return _rectangle->x1 ();
72 }
73
74 Coord
75 Note::y0 () const
76 {
77         return _rectangle->y0 ();
78 }
79
80 Coord
81 Note::y1 () const
82 {
83         return _rectangle->y1 ();
84 }
85
86 void
87 Note::set_outline_color (uint32_t color)
88 {
89         _rectangle->set_outline_color (color);
90 }
91
92 void
93 Note::set_fill_color (uint32_t color)
94 {
95         _rectangle->set_fill_color (color);
96 }
97
98 void
99 Note::show ()
100 {
101         _rectangle->show ();
102 }
103
104 void
105 Note::hide ()
106 {
107         _rectangle->hide ();
108 }
109
110 void
111 Note::set_x0 (Coord x0)
112 {
113         _rectangle->set_x0 (x0);
114 }
115
116 void
117 Note::set_y0 (Coord y0)
118 {
119         _rectangle->set_y0 (y0);
120 }
121
122 void
123 Note::set_x1 (Coord x1)
124 {
125         _rectangle->set_x1 (x1);
126 }
127
128 void
129 Note::set_y1 (Coord y1)
130 {
131         _rectangle->set_y1 (y1);
132 }
133
134 void
135 Note::set_outline_what (int what)
136 {
137         _rectangle->set_outline_what (what);
138 }
139
140 void
141 Note::set_ignore_events (bool ignore)
142 {
143         _rectangle->set_ignore_events (ignore);
144 }