Make Dropdown menus at least as wide as the button
[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
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
41 Note::~Note ()
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
77 Note::set_outline_color (uint32_t color)
78 {
79         _rectangle->set_outline_color (color);
80 }
81
82 void
83 Note::set_fill_color (uint32_t color)
84 {
85         _rectangle->set_fill_color (color);
86 }
87
88 void
89 Note::show ()
90 {
91         _rectangle->show ();
92 }
93
94 void
95 Note::hide ()
96 {
97         _rectangle->hide ();
98 }
99
100 void
101 Note::set (ArdourCanvas::Rect rect)
102 {
103         _rectangle->set (rect);
104 }
105
106 void
107 Note::set_x0 (Coord x0)
108 {
109         _rectangle->set_x0 (x0);
110 }
111
112 void
113 Note::set_y0 (Coord y0)
114 {
115         _rectangle->set_y0 (y0);
116 }
117
118 void
119 Note::set_x1 (Coord x1)
120 {
121         _rectangle->set_x1 (x1);
122 }
123
124 void
125 Note::set_y1 (Coord y1)
126 {
127         _rectangle->set_y1 (y1);
128 }
129
130 void
131 Note::set_outline_what (ArdourCanvas::Rectangle::What what)
132 {
133         _rectangle->set_outline_what (what);
134 }
135
136 void
137 Note::set_outline_all ()
138 {
139         _rectangle->set_outline_all ();
140 }
141
142 void
143 Note::set_ignore_events (bool ignore)
144 {
145         _rectangle->set_ignore_events (ignore);
146 }