ardour
note.cc
Go to the documentation of this file.
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 
23 #include "canvas/rectangle.h"
24 #include "canvas/debug.h"
25 
26 #include "note.h"
27 #include "public_editor.h"
28 
29 using namespace ARDOUR;
30 using namespace ArdourCanvas;
31 
32 Note::Note (
33  MidiRegionView& region, Item* parent, const boost::shared_ptr<NoteType> note, bool with_events)
34  : NoteBase (region, with_events, note)
35  , _rectangle (new ArdourCanvas::Rectangle (parent))
36 {
37  CANVAS_DEBUG_NAME (_rectangle, "note");
38  set_item (_rectangle);
39 }
40 
42 {
43  delete _rectangle;
44 }
45 
46 void
47 Note::move_event (double dx, double dy)
48 {
49  _rectangle->set (_rectangle->get().translate (Duple (dx, dy)));
50 }
51 
52 Coord
53 Note::x0 () const
54 {
55  return _rectangle->x0 ();
56 }
57 
58 Coord
59 Note::x1 () const
60 {
61  return _rectangle->x1 ();
62 }
63 
64 Coord
65 Note::y0 () const
66 {
67  return _rectangle->y0 ();
68 }
69 
70 Coord
71 Note::y1 () const
72 {
73  return _rectangle->y1 ();
74 }
75 
76 void
78 {
79  _rectangle->set_outline_color (color);
80 }
81 
82 void
84 {
85  _rectangle->set_fill_color (color);
86 }
87 
88 void
90 {
91  _rectangle->show ();
92 }
93 
94 void
96 {
97  _rectangle->hide ();
98 }
99 
100 void
101 Note::set_x0 (Coord x0)
102 {
103  _rectangle->set_x0 (x0);
104 }
105 
106 void
107 Note::set_y0 (Coord y0)
108 {
109  _rectangle->set_y0 (y0);
110 }
111 
112 void
113 Note::set_x1 (Coord x1)
114 {
115  _rectangle->set_x1 (x1);
116 }
117 
118 void
119 Note::set_y1 (Coord y1)
120 {
121  _rectangle->set_y1 (y1);
122 }
123 
124 void
125 Note::set_outline_what (ArdourCanvas::Rectangle::What what)
126 {
127  _rectangle->set_outline_what (what);
128 }
129 
130 void
132 {
133  _rectangle->set_outline_all ();
134 }
135 
136 void
138 {
139  _rectangle->set_ignore_events (ignore);
140 }
void set_y0(ArdourCanvas::Coord)
Definition: note.cc:107
void set_y1(ArdourCanvas::Coord)
Definition: note.cc:119
void set_outline_all()
Definition: note.cc:131
void move_event(double dx, double dy)
Definition: note.cc:47
void set_outline_what(ArdourCanvas::Rectangle::What)
Definition: note.cc:125
void set_fill_color(uint32_t)
Definition: note.cc:83
Definition: amp.h:29
~Note()
Definition: note.cc:41
Note(MidiRegionView &region, ArdourCanvas::Item *parent, const boost::shared_ptr< NoteType > note=boost::shared_ptr< NoteType >(), bool with_events=true)
void set_outline_color(uint32_t)
Definition: note.cc:77
ArdourCanvas::Coord y1() const
Definition: note.cc:71
void set_x0(ArdourCanvas::Coord)
Definition: note.cc:101
ArdourCanvas::Rectangle * _rectangle
Definition: note.h:68
void hide()
Definition: note.cc:95
void show()
Definition: note.cc:89
ArdourCanvas::Coord x0() const
Definition: note.cc:53
void set_x1(ArdourCanvas::Coord)
Definition: note.cc:113
ArdourCanvas::Coord x1() const
Definition: note.cc:59
ArdourCanvas::Coord y0() const
Definition: note.cc:65
void set_ignore_events(bool)
Definition: note.cc:137
LIBARDOUR_API PBD::PropertyDescriptor< bool > color
Definition: route_group.cc:50