* bugfix from http://tracker.ardour.org/view.php?id=2155 thanks to kristian: fix...
[ardour.git] / gtk2_ardour / canvas-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_canvas_note_h__
22 #define __gtk_ardour_canvas_note_h__
23
24 #include <iostream>
25 #include "simplerect.h"
26 #include "canvas-midi-event.h"
27 #include "midi_util.h"
28
29 namespace Gnome {
30 namespace Canvas {
31
32 class CanvasNote : public SimpleRect, public CanvasMidiEvent {
33 public:
34         CanvasNote(
35                         MidiRegionView&                       region,
36                         Group&                                group,
37                         const boost::shared_ptr<ARDOUR::Note> note = boost::shared_ptr<ARDOUR::Note>())
38
39                 : SimpleRect(group), CanvasMidiEvent(region, this, note)
40         {
41         }
42
43         double x1() { return property_x1(); }
44         double y1() { return property_y1(); }
45         double x2() { return property_x2(); }
46         double y2() { return property_y2(); }
47
48         void set_outline_color(uint32_t c) { property_outline_color_rgba() = c; }
49         void set_fill_color(uint32_t c) { property_fill_color_rgba() = c; }
50
51         bool on_event(GdkEvent* ev);
52
53         enum NoteEnd {
54                 NOTE_ON,
55                 NOTE_OFF
56         };
57
58         enum NoteState {
59                 None,
60                 RelativeResize,
61                 AbsoluteResize
62         };
63
64 protected:
65         NoteState _note_state;
66
67 private:
68
69 };
70
71 } // namespace Gnome
72 } // namespace Canvas
73
74 #endif /* __gtk_ardour_canvas_note_h__ */