fix monitoring so that MIDI tracks don't work the same way as audio (basically, they...
[ardour2.git] / gtk2_ardour / piano_roll_header.h
blob453c32468de620a2c33378b1d35d4e8002ee3359
1 /*
2 Copyright (C) 2008 Paul Davis
3 Author: Audan Holland ??
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.
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.
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.
20 #ifndef __ardour_piano_roll_header_h__
21 #define __ardour_piano_roll_header_h__
23 #include "ardour/types.h"
25 #include <gtkmm/drawingarea.h>
27 namespace ARDOUR {
28 class MidiTrack;
31 class MidiTimeAxisView;
32 class MidiStreamView;
34 class PianoRollHeader : public Gtk::DrawingArea {
35 public:
36 PianoRollHeader(MidiStreamView&);
38 bool on_expose_event (GdkEventExpose*);
39 bool on_motion_notify_event (GdkEventMotion*);
40 bool on_button_press_event (GdkEventButton*);
41 bool on_button_release_event (GdkEventButton*);
42 bool on_scroll_event (GdkEventScroll*);
43 bool on_enter_notify_event (GdkEventCrossing*);
44 bool on_leave_notify_event (GdkEventCrossing*);
46 void on_size_request(Gtk::Requisition*);
47 void on_size_allocate(Gtk::Allocation& a);
49 void note_range_changed();
51 struct Color {
52 Color();
53 Color(double _r, double _g, double _b);
54 inline void set(const Color& c);
56 double r;
57 double g;
58 double b;
61 sigc::signal<void,uint8_t> AddNoteSelection;
62 sigc::signal<void,uint8_t> ToggleNoteSelection;
63 sigc::signal<void,uint8_t> ExtendNoteSelection;
65 private:
66 static Color white;
67 static Color white_highlight;
68 static Color white_shade_light;
69 static Color white_shade_dark;
70 static Color black;
71 static Color black_highlight;
72 static Color black_shade_light;
73 static Color black_shade_dark;
75 PianoRollHeader(const PianoRollHeader&);
77 enum ItemType {
78 BLACK_SEPARATOR,
79 BLACK_MIDDLE_SEPARATOR,
80 BLACK,
81 WHITE_SEPARATOR,
82 WHITE_RECT,
83 WHITE_CF,
84 WHITE_EB,
85 WHITE_DGA
88 void invalidate_note_range(int lowest, int highest);
90 void get_path(ItemType, int note, double x[], double y[]);
92 void send_note_on(uint8_t note);
93 void send_note_off(uint8_t note);
95 MidiStreamView& _view;
97 uint8_t _event[3];
99 Cairo::RefPtr<Cairo::Context> cc;
100 bool _active_notes[128];
101 uint8_t _highlighted_note;
102 uint8_t _clicked_note;
103 double _grab_y;
104 bool _dragging;
106 double _note_height;
107 double _black_note_width;
110 #endif /* __ardour_piano_roll_header_h__ */