mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 04:06:26 +01:00
initial work on displaying non-selected-channel notes in pianoroll
This commit is contained in:
parent
a76acf34f8
commit
47e635b689
3 changed files with 53 additions and 4 deletions
|
|
@ -126,6 +126,7 @@ MidiView::MidiView (std::shared_ptr<MidiTrack> mt,
|
|||
, _show_source (false)
|
||||
, selection_drag (nullptr)
|
||||
, draw_drag (nullptr)
|
||||
, _visible_channel (-1)
|
||||
, _optimization_iterator (_events.end())
|
||||
, _list_editor (nullptr)
|
||||
, _no_sound_notes (false)
|
||||
|
|
@ -161,6 +162,7 @@ MidiView::MidiView (MidiView const & other)
|
|||
, _show_source (false)
|
||||
, selection_drag (nullptr)
|
||||
, draw_drag (nullptr)
|
||||
, _visible_channel (-1)
|
||||
, _optimization_iterator (_events.end())
|
||||
, _list_editor (0)
|
||||
, _no_sound_notes (false)
|
||||
|
|
@ -1281,6 +1283,26 @@ MidiView::view_changed()
|
|||
size_end_rect ();
|
||||
}
|
||||
|
||||
void
|
||||
MidiView::visible_channel_changed ()
|
||||
{
|
||||
if (!display_is_enabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_model) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto & [note, gui] : _events) {
|
||||
|
||||
if (gui->item()->visible()) {
|
||||
color_note (gui, note->channel());
|
||||
gui->set_ignore_events (note->channel() != _visible_channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MidiView::display_patch_changes ()
|
||||
{
|
||||
|
|
@ -1767,11 +1789,22 @@ MidiView::update_sustained (Note* ev)
|
|||
ev->set_outline_all ();
|
||||
}
|
||||
|
||||
// Update color in case velocity has changed
|
||||
const uint32_t base_col = ev->base_color();
|
||||
ev->set_fill_color (base_col);
|
||||
ev->set_outline_color (ev->calculate_outline(base_col, ev->selected()));
|
||||
|
||||
color_note (ev, note->channel());
|
||||
}
|
||||
|
||||
void
|
||||
MidiView::color_note (NoteBase* ev, int channel)
|
||||
{
|
||||
// Update color in case velocity has changed
|
||||
uint32_t base_color = ev->base_color();
|
||||
|
||||
if (channel != _visible_channel) {
|
||||
base_color = Gtkmm2ext::change_alpha (base_color, 0.2);
|
||||
}
|
||||
|
||||
ev->set_fill_color (base_color);
|
||||
ev->set_outline_color (ev->calculate_outline (base_color, ev->selected()));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -5218,6 +5251,13 @@ MidiView::set_visibility_note_range (MidiViewBackground::VisibleNoteRange nvr, b
|
|||
_midi_context.set_note_visibility_range_style (nvr);
|
||||
}
|
||||
|
||||
void
|
||||
MidiView::set_visible_channel (int chn)
|
||||
{
|
||||
_visible_channel = chn;
|
||||
visible_channel_changed ();
|
||||
}
|
||||
|
||||
void
|
||||
StartBoundaryRect::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
||||
{
|
||||
|
|
@ -5313,3 +5353,4 @@ EndBoundaryRect::compute_bounding_box() const
|
|||
const double radius = 10. * scale;
|
||||
_bounding_box = _bounding_box.expand (0., 0., 0., radius + _outline_width);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -381,6 +381,9 @@ class MidiView : public virtual sigc::trackable, public LineMerger
|
|||
|
||||
virtual bool midi_canvas_group_event(GdkEvent* ev);
|
||||
|
||||
int visible_channel() const { return _visible_channel; }
|
||||
void set_visible_channel (int);
|
||||
|
||||
protected:
|
||||
void init (std::shared_ptr<ARDOUR::MidiTrack>);
|
||||
virtual void region_resized (const PBD::PropertyChange&);
|
||||
|
|
@ -540,6 +543,7 @@ class MidiView : public virtual sigc::trackable, public LineMerger
|
|||
bool _show_source;
|
||||
Drag* selection_drag;
|
||||
Drag* draw_drag;
|
||||
int _visible_channel;
|
||||
|
||||
/** Currently selected NoteBase objects */
|
||||
Selection _selection;
|
||||
|
|
@ -687,6 +691,9 @@ class MidiView : public virtual sigc::trackable, public LineMerger
|
|||
bool end_boundary_event (GdkEvent*);
|
||||
|
||||
virtual void add_control_points_to_selection (Temporal::timepos_t const &, Temporal::timepos_t const &, double y0, double y1) {}
|
||||
|
||||
void color_note (NoteBase*, int channel);
|
||||
void visible_channel_changed ();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -440,6 +440,7 @@ Pianoroll::set_visible_channel (int n)
|
|||
rebuild_parameter_button_map ();
|
||||
|
||||
if (view) {
|
||||
view->set_visible_channel (n);
|
||||
view->swap_automation_channel (n);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue