fix crash when copy'ing latent plugins
[ardour.git] / gtk2_ardour / note.h
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 #ifndef __gtk_ardour_note_h__
22 #define __gtk_ardour_note_h__
23
24 #include <iostream>
25 #include "note_base.h"
26 #include "midi_util.h"
27
28 namespace ArdourCanvas {
29         class Container;
30 }
31
32 class Note : public NoteBase
33 {
34 public:
35         typedef Evoral::Note<Evoral::Beats> NoteType;
36
37         Note (MidiRegionView&                   region,
38               ArdourCanvas::Item*               parent,
39               const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>(),
40               bool with_events = true);
41
42         ~Note ();
43
44         ArdourCanvas::Coord x0 () const;
45         ArdourCanvas::Coord y0 () const;
46         ArdourCanvas::Coord x1 () const;
47         ArdourCanvas::Coord y1 () const;
48
49         void set (ArdourCanvas::Rect);
50         void set_x0 (ArdourCanvas::Coord);
51         void set_y0 (ArdourCanvas::Coord);
52         void set_x1 (ArdourCanvas::Coord);
53         void set_y1 (ArdourCanvas::Coord);
54
55         void set_outline_what (ArdourCanvas::Rectangle::What);
56         void set_outline_all ();
57
58         void set_outline_color (uint32_t);
59         void set_fill_color (uint32_t);
60
61         void show ();
62         void hide ();
63
64         void set_ignore_events (bool);
65
66         void move_event (double dx, double dy);
67
68 private:
69         ArdourCanvas::Rectangle* _rectangle;
70 };
71
72 #endif /* __gtk_ardour_note_h__ */