Ardour  9.0-pre0-582-g084a23a80d
prh.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 <pangomm/layout.h>
23 #include <glibmm/refptr.h>
24 
25 #include "ardour/types.h"
26 
27 #include "canvas/rectangle.h"
28 
29 #include <gtkmm/adjustment.h>
30 
31 namespace ARDOUR {
32  class MidiTrack;
33 }
34 
35 class MidiView;
36 class MidiViewBackground;
37 class EditingContext;
38 
39 namespace ArdourCanvas {
40 
42 public:
44 
45  void size_request (double& w, double& h) const;
46  void render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
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  void set_view (MidiView*);
59 
60 private:
64 
65  uint8_t _event[3];
66 
67  mutable Glib::RefPtr<Pango::Layout> _layout;
68  mutable Glib::RefPtr<Pango::Layout> _big_c_layout;
69  mutable Glib::RefPtr<Pango::Layout> _midnam_layout;
70  mutable Pango::FontDescription _font_descript;
71  Pango::FontDescription _font_descript_big_c;
72  mutable Pango::FontDescription _font_descript_midnam;
73  bool _active_notes[128];
75  uint8_t _clicked_note;
76  double _grab_y;
77  bool _dragging;
78  mutable double _scroomer_size;
80  double _old_y;
81  double _fract;
82  double _fract_top;
84  enum scr_pos {TOP, BOTTOM, MOVE, NONE};
89  mutable bool _mini_map_display;
90  bool entered;
91 
92  // void on_size_request(Gtk::Requisition*);
93 
94  struct NoteName {
95  std::string name;
97  };
101 
102  void set_min_page_size (double page_size);
103  void render_scroomer (Cairo::RefPtr<Cairo::Context>) const;
105 
113 
114  enum ItemType {
122  WHITE_DGA
123  };
124 
125  void invalidate_note_range (int lowest, int highest);
126  void get_path (int note, double x[], double y[]) const;
127  void send_note_on (uint8_t note);
128  void send_note_off (uint8_t note);
129  void reset_clicked_note (uint8_t, bool invalidate = true);
130  bool show_scroomer () const;
131  void resize ();
132 };
133 
134 }
135 
PBD::ScopedConnection height_connection
Definition: prh.h:100
bool event_handler(GdkEvent *)
NoteName get_note_name(int note)
void get_path(int note, double x[], double y[]) const
void send_note_off(uint8_t note)
void size_request(double &w, double &h) const
scr_pos _scroomer_button_state
Definition: prh.h:86
Glib::RefPtr< Pango::Layout > _midnam_layout
Definition: prh.h:69
MidiViewBackground & _midi_context
Definition: prh.h:61
Pango::FontDescription _font_descript
Definition: prh.h:70
Gtk::Adjustment & _adj
Definition: prh.h:62
Pango::FontDescription _font_descript_midnam
Definition: prh.h:72
sigc::signal< void, uint8_t > ExtendNoteSelection
Definition: prh.h:56
bool scroll_handler(GdkEventScroll *)
void reset_clicked_note(uint8_t, bool invalidate=true)
Glib::RefPtr< Pango::Layout > _big_c_layout
Definition: prh.h:68
Glib::RefPtr< Pango::Layout > _layout
Definition: prh.h:67
bool enter_handler(GdkEventCrossing *)
sigc::signal< void, uint8_t > SetNoteSelection
Definition: prh.h:53
void render(ArdourCanvas::Rect const &area, Cairo::RefPtr< Cairo::Context >) const
Pango::FontDescription _font_descript_big_c
Definition: prh.h:71
void set_note_highlight(uint8_t note)
bool motion_handler(GdkEventMotion *)
bool leave_handler(GdkEventCrossing *)
void invalidate_note_range(int lowest, int highest)
bool _active_notes[128]
Definition: prh.h:73
sigc::signal< void, uint8_t > AddNoteSelection
Definition: prh.h:54
PianoRollHeader(ArdourCanvas::Item *parent, MidiViewBackground &)
void send_note_on(uint8_t note)
bool button_release_handler(GdkEventButton *)
void set_min_page_size(double page_size)
NoteName note_names[128]
Definition: prh.h:98
bool button_press_handler(GdkEventButton *)
void render_scroomer(Cairo::RefPtr< Cairo::Context >) const
sigc::signal< void, uint8_t > ToggleNoteSelection
Definition: prh.h:55