74 add_events (Gdk::BUTTON_PRESS_MASK |
75 Gdk::BUTTON_RELEASE_MASK |
76 Gdk::POINTER_MOTION_MASK |
77 Gdk::ENTER_NOTIFY_MASK |
78 Gdk::LEAVE_NOTIFY_MASK |
81 for (
int i = 0; i < 128; ++i) {
89 create_path(Cairo::RefPtr<Cairo::Context> cr,
double x[],
double y[],
int start,
int stop)
91 cr->move_to(x[start], y[start]);
93 for (
int i = start+1; i <= stop; ++i) {
94 cr->line_to(x[i], y[i]);
99 render_rect(Cairo::RefPtr<Cairo::Context> cr,
int ,
double x[],
double y[],
102 cr->set_source_rgb(bg.
r, bg.
g, bg.
b);
106 cr->set_source_rgb(tl_shadow.
r, tl_shadow.
g, tl_shadow.
b);
110 cr->set_source_rgb(br_shadow.
r, br_shadow.
g, br_shadow.
b);
116 render_cf(Cairo::RefPtr<Cairo::Context> cr,
int ,
double x[],
double y[],
119 cr->set_source_rgb(bg.
r, bg.
g, bg.
b);
123 cr->set_source_rgb(tl_shadow.
r, tl_shadow.
g, tl_shadow.
b);
127 cr->set_source_rgb(br_shadow.
r, br_shadow.
g, br_shadow.
b);
133 render_eb(Cairo::RefPtr<Cairo::Context> cr,
int ,
double x[],
double y[],
136 cr->set_source_rgb(bg.
r, bg.
g, bg.
b);
140 cr->set_source_rgb(tl_shadow.
r, tl_shadow.
g, tl_shadow.
b);
146 cr->set_source_rgb(br_shadow.
r, br_shadow.
g, br_shadow.
b);
154 render_dga(Cairo::RefPtr<Cairo::Context> cr,
int ,
double x[],
double y[],
157 cr->set_source_rgb(bg.
r, bg.
g, bg.
b);
161 cr->set_source_rgb(tl_shadow.
r, tl_shadow.
g, tl_shadow.
b);
167 cr->set_source_rgb(br_shadow.
r, br_shadow.
g, br_shadow.
b);
181 double width = get_width();
204 y[0] = y_pos + note_height - 0.5f;
210 y[3] = y_pos + note_height - 0.5f;
212 y[4] = y_pos + note_height - 0.5f;
222 y[0] = y_pos + note_height - 0.5f;
228 y[3] = y_pos + note_height - 0.5f;
230 y[4] = y_pos + note_height - 0.5f;
234 y[0] = y_pos + note_height - 1.5f;
244 y[5] = y_pos + note_height - 1.5f;
246 y[6] = y_pos + note_height - 1.5f;
250 y[0] = y_pos + note_height - 1.5f;
260 y[5] = y_pos + note_height - 1.5f;
262 y[6] = y_pos + note_height - 1.5f;
266 y[0] = y_pos + note_height - 1.5f;
280 y[7] = y_pos + note_height - 1.5f;
282 y[8] = y_pos + note_height - 1.5f;
292 GdkRectangle& rect = ev->area;
295 Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context();
296 Cairo::RefPtr<Cairo::LinearGradient> pat = Cairo::LinearGradient::create(0, 0,
_black_note_width, 0);
299 Color bg, tl_shadow, br_shadow;
301 int y1 = max(rect.y, 0);
312 cr->select_font_face (
"Georgia", Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_BOLD);
314 cr->set_font_size(font_size);
323 cr->set_line_width(1.0f);
326 cr->set_source_rgb(0.0f, 0.0f, 0.0f);
327 cr->move_to(0.5f, rect.y);
328 cr->line_to(0.5f, rect.y + rect.height);
330 cr->move_to(get_width() - 0.5f, rect.y);
331 cr->line_to(get_width() - 0.5f, rect.y + rect.height);
339 for (
int i = lowest; i <= highest; ++i) {
364 cr->set_source_rgb(0.0f, 0.0f, 0.0f);
374 render_rect(cr, i, x, y, bg, tl_shadow, br_shadow);
398 render_rect(cr, i, x, y, bg, tl_shadow, br_shadow);
401 render_cf(cr, i, x, y, bg, tl_shadow, br_shadow);
410 render_eb(cr, i, x, y, bg, tl_shadow, br_shadow);
413 render_cf(cr, i, x, y, bg, tl_shadow, br_shadow);
416 render_dga(cr, i, x, y, bg, tl_shadow, br_shadow);
422 cr->set_source_rgb(0.0f, 0.0f, 0.0f);
429 render_rect(cr, i, x, y, bg, tl_shadow, br_shadow);
432 render_eb(cr, i, x, y, bg, tl_shadow, br_shadow);
454 cr->set_source_rgb(0.30f, 0.30f, 0.30f);
455 cr->move_to(2.0f, y + note_height - 1.0f - (note_height - font_size) / 2.0f);
456 cr->show_text(s.str());
470 if (
editor().current_mouse_mode() == Editing::MouseRange) {
474 if (Keyboard::no_modifiers_active (ev->state)) {
516 bool tertiary = Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier);
518 if (ev->button == 2 && Keyboard::no_modifiers_active (ev->state)) {
521 }
else if (tertiary && (ev->button == 1 || ev->button == 2)) {
524 }
else if (ev->button == 1 && note >= 0 && note < 128) {
547 if (
editor().current_mouse_mode() == Editing::MouseRange) {
549 if (Keyboard::no_modifiers_active (ev->state)) {
551 }
else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
553 }
else if (Keyboard::modifier_state_equals (ev->state, Keyboard::RangeSelectModifier)) {
610 Glib::RefPtr<Gdk::Window> win = get_window();
615 switch(lowest % 12) {
625 switch(highest % 12) {
646 rect.set_width(get_width());
647 rect.set_y((
int) floor(y));
648 rect.set_height((
int) floor(height));
651 win->invalidate_rect(rect,
false);
664 DrawingArea::on_size_allocate(a);
#define MIDI_CMD_NOTE_OFF
boost::shared_ptr< ARDOUR::MidiTrack > midi_track() const
PublicEditor & editor() const
Representation of the interface of the Editor class.
RouteTimeAxisView & trackview()
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > start
sigc::signal< void > NoteRangeChanged
uint8_t lowest_note() const
uint8_t get_channel_for_add() const
bool write_immediate_event(size_t size, const uint8_t *buf)
double note_to_y(uint8_t note) const
double note_height() const
uint8_t highest_note() const
uint8_t y_to_note(double y) const
static double note_height(TimeAxisView &trackview, MidiStreamView *mv)
double contents_height() const