fix crash when copy'ing latent plugins
[ardour.git] / gtk2_ardour / hit.h
1 /*
2     Copyright (C) 2007 Paul Davis
3     Author: Dave Robillard
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
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #ifndef __gtk_ardour_hit_h__
21 #define __gtk_ardour_hit_h__
22
23 #include <iostream>
24 #include "note_base.h"
25
26 namespace ArdourCanvas {
27         class Polygon;
28 }
29
30 class Hit : public NoteBase
31 {
32 public:
33         typedef Evoral::Note<Evoral::Beats> NoteType;
34
35         Hit (MidiRegionView&                   region,
36              ArdourCanvas::Item*               parent,
37              double                            size,
38              const boost::shared_ptr<NoteType> note        = boost::shared_ptr<NoteType>(),
39              bool                              with_events = true);
40
41         ~Hit();
42
43         void show ();
44         void hide ();
45
46         ArdourCanvas::Coord x0 () const;
47         ArdourCanvas::Coord y0 () const;
48         ArdourCanvas::Coord x1 () const;
49         ArdourCanvas::Coord y1 () const;
50
51         ArdourCanvas::Duple position ();
52
53         void set_position (ArdourCanvas::Duple);
54
55         void set_height (ArdourCanvas::Coord);
56
57         void set_outline_color (uint32_t);
58         void set_fill_color (uint32_t);
59
60         void set_ignore_events (bool);
61
62         void move_event (double, double);
63
64         /* no trimming of percussive hits */
65         bool big_enough_to_trim() const { return false; }
66
67         static ArdourCanvas::Points points(ArdourCanvas::Distance height);
68
69 private:
70         ArdourCanvas::Polygon* _polygon;
71 };
72
73 #endif /* __gtk_ardour_hit_h__ */