Unconditionally save instant.xml on session-close
[ardour.git] / gtk2_ardour / note.cc
1 /*
2  * Copyright (C) 2013-2018 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2013 John Emmas <john@creativepost.co.uk>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19
20 #include "evoral/Note.h"
21
22 #include "canvas/note.h"
23 #include "canvas/debug.h"
24
25 #include "note.h"
26 #include "public_editor.h"
27
28 using namespace ARDOUR;
29 using ArdourCanvas::Coord;
30 using ArdourCanvas::Duple;
31
32 Note::Note (
33         MidiRegionView& region, ArdourCanvas::Item* parent, const boost::shared_ptr<NoteType> note, bool with_events)
34         : NoteBase (region, with_events, note)
35         , _note (new ArdourCanvas::Note (parent))
36 {
37         CANVAS_DEBUG_NAME (_note, "note");
38         set_item (_note);
39 }
40
41 Note::~Note ()
42 {
43         delete _note;
44 }
45
46 void
47 Note::move_event (double dx, double dy)
48 {
49         _note->set (_note->get().translate (Duple (dx, dy)));
50 }
51
52 Coord
53 Note::x0 () const
54 {
55         return _note->x0 ();
56 }
57
58 Coord
59 Note::x1 () const
60 {
61         return _note->x1 ();
62 }
63
64 Coord
65 Note::y0 () const
66 {
67         return _note->y0 ();
68 }
69
70 Coord
71 Note::y1 () const
72 {
73         return _note->y1 ();
74 }
75
76 void
77 Note::set_outline_color (uint32_t color)
78 {
79         _note->set_outline_color (color);
80 }
81
82 void
83 Note::set_fill_color (uint32_t color)
84 {
85         _note->set_fill_color (color);
86 }
87
88 void
89 Note::show ()
90 {
91         _note->show ();
92 }
93
94 void
95 Note::hide ()
96 {
97         _note->hide ();
98 }
99
100 void
101 Note::set (ArdourCanvas::Rect rect)
102 {
103         _note->set (rect);
104 }
105
106 void
107 Note::set_x0 (Coord x0)
108 {
109         _note->set_x0 (x0);
110 }
111
112 void
113 Note::set_y0 (Coord y0)
114 {
115         _note->set_y0 (y0);
116 }
117
118 void
119 Note::set_x1 (Coord x1)
120 {
121         _note->set_x1 (x1);
122 }
123
124 void
125 Note::set_y1 (Coord y1)
126 {
127         _note->set_y1 (y1);
128 }
129
130 void
131 Note::set_outline_what (ArdourCanvas::Rectangle::What what)
132 {
133         _note->set_outline_what (what);
134 }
135
136 void
137 Note::set_outline_all ()
138 {
139         _note->set_outline_all ();
140 }
141
142 void
143 Note::set_ignore_events (bool ignore)
144 {
145         _note->set_ignore_events (ignore);
146 }
147
148 void
149 Note::set_velocity (double fract)
150 {
151         _note->set_velocity (fract);
152 }
153