rename CueMidiBackground to PianorollMidiBackground; fix channel used when clicking on pianoroll header notes

This commit is contained in:
Paul Davis
2025-03-16 10:21:03 -06:00
parent 7f6f3d64f1
commit d5f9375c98
4 changed files with 24 additions and 18 deletions

View File

@@ -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

View File

@@ -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 ();

View File

@@ -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<ARDOUR::Region>, samplepos_t)
PianorollMidiBackground::record_layer_check (std::shared_ptr<ARDOUR::Region>, 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());

View File

@@ -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;