Fix broken meter style on MIDI tracks.
[ardour2.git] / gtk2_ardour / canvas-note.h
blobeb8b1eab02c1c6a4af14bcc4c6a739e4359f6b4d
1 /*
2 Copyright (C) 2007 Paul Davis
3 Author: David Robillard
4 Author: Hans Baier
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.
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.
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.
21 #ifndef __gtk_ardour_canvas_note_h__
22 #define __gtk_ardour_canvas_note_h__
24 #include <iostream>
25 #include "simplerect.h"
26 #include "canvas-note-event.h"
27 #include "midi_util.h"
29 namespace Gnome {
30 namespace Canvas {
32 class CanvasNote : public SimpleRect, public CanvasNoteEvent
34 public:
35 typedef Evoral::Note<Evoral::MusicalTime> NoteType;
37 CanvasNote (MidiRegionView& region,
38 Group& group,
39 const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>(),
40 bool with_events = true);
42 double x1() const { return property_x1(); }
43 double y1() const { return property_y1(); }
44 double x2() const { return property_x2(); }
45 double y2() const { return property_y2(); }
47 void set_outline_color(uint32_t c) { property_outline_color_rgba() = c; hide(); show(); }
48 void set_fill_color(uint32_t c) { property_fill_color_rgba() = c; hide(); show(); }
50 void show() { SimpleRect::show(); }
51 void hide() { SimpleRect::hide(); }
53 bool on_event(GdkEvent* ev);
54 void move_event(double dx, double dy);
57 class NoEventCanvasNote : public CanvasNote
59 public:
60 NoEventCanvasNote (MidiRegionView& region,
61 Group& group,
62 const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>())
63 : CanvasNote (region, group, note, false) {}
65 double point_vfunc(double, double, int, int, GnomeCanvasItem**) {
66 /* return a huge value to tell the canvas that we're never the item for an event */
67 return 9999999999999.0;
71 } // namespace Gnome
72 } // namespace Canvas
74 #endif /* __gtk_ardour_canvas_note_h__ */