diff --git a/gtk2_ardour/pianoroll.cc b/gtk2_ardour/pianoroll.cc index 4dbd77c305..ccd466e35c 100644 --- a/gtk2_ardour/pianoroll.cc +++ b/gtk2_ardour/pianoroll.cc @@ -550,7 +550,7 @@ Pianoroll::build_canvas () data_group = new ArdourCanvas::Container (hv_scroll_group); CANVAS_DEBUG_NAME (data_group, "cue data group"); - bg = new CueMidiBackground (data_group); + bg = new PianorollMidiBackground (data_group, *this); _canvas_viewport->signal_size_allocate().connect (sigc::mem_fun(*this, &Pianoroll::canvas_allocate), false); // used as rubberband rect diff --git a/gtk2_ardour/pianoroll.h b/gtk2_ardour/pianoroll.h index 81785bf49c..4289c8f997 100644 --- a/gtk2_ardour/pianoroll.h +++ b/gtk2_ardour/pianoroll.h @@ -46,7 +46,7 @@ namespace ArdourWidgets { } class PianorollMidiView; -class CueMidiBackground; +class PianorollMidiBackground; class Pianoroll : public CueEditor { @@ -119,6 +119,8 @@ class Pianoroll : public CueEditor Gdk::Cursor* which_canvas_cursor (ItemType type) const; void set_visible_channel (int chan); + int visible_channel () const { return _visible_channel; } + void note_mode_clicked(); ARDOUR::NoteMode note_mode() const { return _note_mode; } void set_note_mode (ARDOUR::NoteMode); @@ -216,7 +218,7 @@ class Pianoroll : public CueEditor ParameterButtonMap parameter_button_map; void rebuild_parameter_button_map (); - CueMidiBackground* bg; + PianorollMidiBackground* bg; PianorollMidiView* view; void build_canvas (); diff --git a/gtk2_ardour/pianoroll_background.cc b/gtk2_ardour/pianoroll_background.cc index 3db5b9c72c..7168139810 100644 --- a/gtk2_ardour/pianoroll_background.cc +++ b/gtk2_ardour/pianoroll_background.cc @@ -20,23 +20,25 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "pianoroll.h" #include "pianoroll_background.h" #include "midi_view.h" -CueMidiBackground::CueMidiBackground (ArdourCanvas::Item* parent) +PianorollMidiBackground::PianorollMidiBackground (ArdourCanvas::Item* parent, Pianoroll& pr) : MidiViewBackground (parent) , view (nullptr) + , pianoroll (pr) , _width (0.) , _height (0.) { } -CueMidiBackground::~CueMidiBackground () +PianorollMidiBackground::~PianorollMidiBackground () { } void -CueMidiBackground::set_size (double w, double h) +PianorollMidiBackground::set_size (double w, double h) { _width = w; _height = h; @@ -47,47 +49,47 @@ CueMidiBackground::set_size (double w, double h) } double -CueMidiBackground::contents_height() const +PianorollMidiBackground::contents_height() const { return _height; } double -CueMidiBackground::height() const +PianorollMidiBackground::height() const { return _height; } double -CueMidiBackground::width() const +PianorollMidiBackground::width() const { return _width; } uint8_t -CueMidiBackground::get_preferred_midi_channel () const +PianorollMidiBackground::get_preferred_midi_channel () const { - return 0; + return pianoroll.visible_channel (); } void -CueMidiBackground::set_note_highlight (bool yn) +PianorollMidiBackground::set_note_highlight (bool yn) { } void -CueMidiBackground::record_layer_check (std::shared_ptr, samplepos_t) +PianorollMidiBackground::record_layer_check (std::shared_ptr, samplepos_t) { } void -CueMidiBackground::set_view (MidiView* mv) +PianorollMidiBackground::set_view (MidiView* mv) { view = mv; } void -CueMidiBackground::apply_note_range_to_children () +PianorollMidiBackground::apply_note_range_to_children () { if (view) { view->apply_note_range (lowest_note(), highest_note()); diff --git a/gtk2_ardour/pianoroll_background.h b/gtk2_ardour/pianoroll_background.h index 0f72160909..13f5f6abf3 100644 --- a/gtk2_ardour/pianoroll_background.h +++ b/gtk2_ardour/pianoroll_background.h @@ -31,12 +31,13 @@ #include "midi_view_background.h" class MidiView; +class Pianoroll; -class CueMidiBackground : public MidiViewBackground +class PianorollMidiBackground : public MidiViewBackground { public: - CueMidiBackground (ArdourCanvas::Item* parent); - ~CueMidiBackground (); + PianorollMidiBackground (ArdourCanvas::Item* parent, Pianoroll&); + ~PianorollMidiBackground (); double height() const; double width() const; @@ -51,6 +52,7 @@ class CueMidiBackground : public MidiViewBackground protected: MidiView* view; + Pianoroll& pianoroll; double _width; double _height;