/*
- Copyright (C) 2008 Paul Davis
+ Copyright (C) 2008 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*/
#include <iostream>
-#include <evoral/midi_events.h>
-#include <ardour/midi_track.h>
+#include "evoral/midi_events.h"
+#include "ardour/midi_track.h"
#include "piano_roll_header.h"
#include "midi_time_axis.h"
b = c.b;
}
-PianoRollHeader::PianoRollHeader(MidiStreamView& v)
- : _view(v)
+PianoRollHeader::PianoRollHeader(MidiStreamView& v)
+ : _view(v)
, _highlighted_note(no_note)
, _clicked_note(no_note)
, _dragging(false)
}
}
-inline void
-render_rect(Cairo::RefPtr<Cairo::Context> cr, int note, double x[], double y[],
+inline void
+render_rect(Cairo::RefPtr<Cairo::Context> cr, int /*note*/, double x[], double y[],
PianoRollHeader::Color& bg, PianoRollHeader::Color& tl_shadow, PianoRollHeader::Color& br_shadow)
{
cr->set_source_rgb(bg.r, bg.g, bg.b);
}
inline void
-render_cf(Cairo::RefPtr<Cairo::Context> cr, int note, double x[], double y[],
+render_cf(Cairo::RefPtr<Cairo::Context> cr, int /*note*/, double x[], double y[],
PianoRollHeader::Color& bg, PianoRollHeader::Color& tl_shadow, PianoRollHeader::Color& br_shadow)
{
cr->set_source_rgb(bg.r, bg.g, bg.b);
}
inline void
-render_eb(Cairo::RefPtr<Cairo::Context> cr, int note, double x[], double y[],
+render_eb(Cairo::RefPtr<Cairo::Context> cr, int /*note*/, double x[], double y[],
PianoRollHeader::Color& bg, PianoRollHeader::Color& tl_shadow, PianoRollHeader::Color& br_shadow)
{
cr->set_source_rgb(bg.r, bg.g, bg.b);
}
inline void
-render_dga(Cairo::RefPtr<Cairo::Context> cr, int note, double x[], double y[],
+render_dga(Cairo::RefPtr<Cairo::Context> cr, int /*note*/, double x[], double y[],
PianoRollHeader::Color& bg, PianoRollHeader::Color& tl_shadow, PianoRollHeader::Color& br_shadow)
{
cr->set_source_rgb(bg.r, bg.g, bg.b);
std::stringstream s;
double y = floor(_view.note_to_y(i)) - 0.5f;
double note_height = floor(_view.note_to_y(i - 1)) - y;
-
+
int cn = i / 12;
s << "C" << cn;
-
+
//cr->get_text_extents(s.str(), te);
cr->set_source_rgb(0.30f, 0.30f, 0.30f);
cr->move_to(2.0f, y + note_height - 1.0f - (note_height - font_size) / 2.0f);
_active_notes[note] = true;
_clicked_note = note;
send_note_on(note);
-
+
invalidate_note_range(note, note);
} else {
_clicked_note = no_note;
_active_notes[note] = false;
_clicked_note = no_note;
send_note_off(note);
-
+
invalidate_note_range(note, note);
}
}
PianoRollHeader::on_leave_notify_event (GdkEventCrossing*)
{
invalidate_note_range(_highlighted_note, _highlighted_note);
-
+
if (_clicked_note != no_note) {
_active_notes[_clicked_note] = false;
send_note_off(_clicked_note);
}
bool
-PianoRollHeader::on_scroll_event (GdkEventScroll* ev)
+PianoRollHeader::on_scroll_event (GdkEventScroll*)
{
return true;
}
PianoRollHeader::on_size_allocate(Gtk::Allocation& a)
{
DrawingArea::on_size_allocate(a);
-
+
_black_note_width = floor(0.7 * get_width()) + 0.5f;
}
//cerr << "note on: " << (int) note << endl;
if (track) {
- _event[0] = MIDI_CMD_NOTE_ON;
+ _event[0] = (MIDI_CMD_NOTE_ON | track->default_channel());
_event[1] = note;
_event[2] = 100;
boost::shared_ptr<ARDOUR::MidiTrack> track = _view.trackview().midi_track();
if (track) {
- _event[0] = MIDI_CMD_NOTE_OFF;
+ _event[0] = (MIDI_CMD_NOTE_OFF | track->default_channel());
_event[1] = note;
_event[2] = 100;