Ardour  9.0-pre0-582-g084a23a80d
piano_roll_header.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2009 David Robillard <d@drobilla.net>
3  * Copyright (C) 2010-2012 Paul Davis <paul@linuxaudiosystems.com>
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 along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #pragma once
21 
22 #include "ardour/types.h"
23 
24 #include <gtkmm/drawingarea.h>
25 
26 namespace ARDOUR {
27  class MidiTrack;
28 }
29 
30 class MidiTimeAxisView;
31 class MidiStreamView;
32 class PublicEditor;
33 
35 public:
37 
45 
47 
49 
51  void set_note_highlight (uint8_t note);
52 
53  sigc::signal<void,uint8_t> SetNoteSelection;
54  sigc::signal<void,uint8_t> AddNoteSelection;
55  sigc::signal<void,uint8_t> ToggleNoteSelection;
56  sigc::signal<void,uint8_t> ExtendNoteSelection;
57 
58 private:
59  struct NoteName {
60  std::string name;
62  };
65  void set_min_page_size(double page_size);
66  void render_scroomer(Cairo::RefPtr<Cairo::Context>);
67  NoteName get_note_name (int note);
68 
70 
72 
73  enum ItemType {
81  WHITE_DGA
82  };
83 
84  void invalidate_note_range(int lowest, int highest);
85 
86  void get_path(int note, double x[], double y[]);
87 
88  void send_note_on(uint8_t note);
89  void send_note_off(uint8_t note);
90 
91  void reset_clicked_note(uint8_t, bool invalidate = true);
92 
94 
95  uint8_t _event[3];
96 
97  Glib::RefPtr<Pango::Layout> _layout;
98  Glib::RefPtr<Pango::Layout> _big_c_layout;
99  Glib::RefPtr<Pango::Layout> _midnam_layout;
100 
101  Pango::FontDescription _font_descript;
102  Pango::FontDescription _font_descript_big_c;
103  Pango::FontDescription _font_descript_midnam;
104  bool _active_notes[128];
106  uint8_t _clicked_note;
107  double _grab_y;
108  bool _dragging;
111  double _old_y;
112  double _fract;
113  double _fract_top;
122  bool entered;
123 
124  double _note_height;
126 
128  bool show_scroomer () const;
129 };
130 
void get_path(int note, double x[], double y[])
bool on_enter_notify_event(GdkEventCrossing *)
This is a default handler for the signal signal_enter_notify_event().
sigc::signal< void, uint8_t > SetNoteSelection
Pango::FontDescription _font_descript
bool show_scroomer() const
void send_note_on(uint8_t note)
sigc::signal< void, uint8_t > AddNoteSelection
void set_note_highlight(uint8_t note)
MidiStreamView & _view
void on_size_request(Gtk::Requisition *)
This is a default handler for the signal signal_size_request().
bool on_scroll_event(GdkEventScroll *)
This is a default handler for the signal signal_scroll_event().
scr_pos _scroomer_button_state
void reset_clicked_note(uint8_t, bool invalidate=true)
Pango::FontDescription _font_descript_big_c
void set_min_page_size(double page_size)
bool on_button_release_event(GdkEventButton *)
This is a default handler for the signal signal_button_release_event().
sigc::signal< void, uint8_t > ToggleNoteSelection
void send_note_off(uint8_t note)
void note_range_changed()
bool on_leave_notify_event(GdkEventCrossing *)
This is a default handler for the signal signal_leave_notify_event().
Gtk::Adjustment & _adj
bool on_expose_event(GdkEventExpose *)
This is a default handler for the signal signal_expose_event().
bool on_button_press_event(GdkEventButton *)
This is a default handler for the signal signal_button_press_event().
PublicEditor & editor() const
void invalidate_note_range(int lowest, int highest)
PianoRollHeader(MidiStreamView &)
void instrument_info_change()
Glib::RefPtr< Pango::Layout > _midnam_layout
Glib::RefPtr< Pango::Layout > _big_c_layout
Pango::FontDescription _font_descript_midnam
Glib::RefPtr< Pango::Layout > _layout
bool on_motion_notify_event(GdkEventMotion *)
This is a default handler for the signal signal_motion_notify_event().
NoteName get_note_name(int note)
void render_scroomer(Cairo::RefPtr< Cairo::Context >)
sigc::signal< void, uint8_t > ExtendNoteSelection
PianoRollHeader(const PianoRollHeader &)
NoteName note_names[128]
Representation of the interface of the Editor class.