ardour
piano_roll_header.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 Paul Davis
3  Author: Audan Holland ??
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 __ardour_piano_roll_header_h__
21 #define __ardour_piano_roll_header_h__
22 
23 #include "ardour/types.h"
24 
25 #include <gtkmm/drawingarea.h>
26 
27 namespace ARDOUR {
28  class MidiTrack;
29 }
30 
31 class MidiTimeAxisView;
32 class MidiStreamView;
33 class PublicEditor;
34 
35 class PianoRollHeader : public Gtk::DrawingArea {
36 public:
38 
39  bool on_expose_event (GdkEventExpose*);
40  bool on_motion_notify_event (GdkEventMotion*);
41  bool on_button_press_event (GdkEventButton*);
42  bool on_button_release_event (GdkEventButton*);
43  bool on_scroll_event (GdkEventScroll*);
44  bool on_enter_notify_event (GdkEventCrossing*);
45  bool on_leave_notify_event (GdkEventCrossing*);
46 
47  void on_size_request(Gtk::Requisition*);
48  void on_size_allocate(Gtk::Allocation& a);
49 
50  void note_range_changed();
51 
52  struct Color {
53  Color();
54  Color(double _r, double _g, double _b);
55  inline void set(const Color& c);
56 
57  double r;
58  double g;
59  double b;
60  };
61 
62  sigc::signal<void,uint8_t> SetNoteSelection;
63  sigc::signal<void,uint8_t> AddNoteSelection;
64  sigc::signal<void,uint8_t> ToggleNoteSelection;
65  sigc::signal<void,uint8_t> ExtendNoteSelection;
66 
67 private:
68  static Color white;
72  static Color black;
76 
78 
79  enum ItemType {
88  };
89 
90  void invalidate_note_range(int lowest, int highest);
91 
92  void get_path(ItemType, int note, double x[], double y[]);
93 
94  void send_note_on(uint8_t note);
95  void send_note_off(uint8_t note);
96 
97  void reset_clicked_note(uint8_t, bool invalidate = true);
98 
100 
101  uint8_t _event[3];
102 
103  Cairo::RefPtr<Cairo::Context> cc;
104  bool _active_notes[128];
106  uint8_t _clicked_note;
107  double _grab_y;
108  bool _dragging;
109 
110  double _note_height;
112 
113  PublicEditor& editor() const;
114 };
115 
116 #endif /* __ardour_piano_roll_header_h__ */
PianoRollHeader(MidiStreamView &)
static Color black
ItemType
Definition: editor_items.h:23
bool on_button_press_event(GdkEventButton *)
static Color white_shade_light
Representation of the interface of the Editor class.
bool on_motion_notify_event(GdkEventMotion *)
bool on_button_release_event(GdkEventButton *)
void set(const Color &c)
sigc::signal< void, uint8_t > AddNoteSelection
bool on_scroll_event(GdkEventScroll *)
static Color white
bool on_expose_event(GdkEventExpose *)
PublicEditor & editor() const
Definition: amp.h:29
static Color white_highlight
MidiStreamView & _view
void send_note_off(uint8_t note)
void on_size_request(Gtk::Requisition *)
static Color black_shade_dark
bool on_leave_notify_event(GdkEventCrossing *)
void invalidate_note_range(int lowest, int highest)
sigc::signal< void, uint8_t > ToggleNoteSelection
Cairo::RefPtr< Cairo::Context > cc
void on_size_allocate(Gtk::Allocation &a)
sigc::signal< void, uint8_t > SetNoteSelection
static Color white_shade_dark
static Color black_shade_light
bool on_enter_notify_event(GdkEventCrossing *)
static Color black_highlight
void reset_clicked_note(uint8_t, bool invalidate=true)
void get_path(ItemType, int note, double x[], double y[])
sigc::signal< void, uint8_t > ExtendNoteSelection
void send_note_on(uint8_t note)