mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-18 04:36:30 +01:00
more centralized code for deciding if a note is visible or note based on key
This commit is contained in:
parent
d0cdd0c9db
commit
e8baad9efa
1 changed files with 9 additions and 7 deletions
|
|
@ -1645,6 +1645,15 @@ MidiRegionView::update_sustained (Note* ev, bool update_ghost_regions)
|
||||||
const timepos_t note_start (note->time());
|
const timepos_t note_start (note->time());
|
||||||
timepos_t note_end (note->end_time());
|
timepos_t note_end (note->end_time());
|
||||||
|
|
||||||
|
MidiTimeAxisView* mtv = dynamic_cast<MidiTimeAxisView*>(&trackview);
|
||||||
|
MusicalKey const & key (mtv->midi_track()->key());
|
||||||
|
if (!(mtv->midi_track()->key_enforcment_policy() & NoDraw) || key.in_key (note->note())) {
|
||||||
|
ev->show ();
|
||||||
|
} else {
|
||||||
|
ev->hide ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* The note is drawn as a child item of this region view, so its
|
/* The note is drawn as a child item of this region view, so its
|
||||||
* coordinate system is relative to the region view. This means that x0
|
* coordinate system is relative to the region view. This means that x0
|
||||||
* and x1 are pixel offsets relative to beginning of the region (view)
|
* and x1 are pixel offsets relative to beginning of the region (view)
|
||||||
|
|
@ -3928,13 +3937,6 @@ MidiRegionView::update_ghost_note (double x, double y, uint32_t state)
|
||||||
_ghost_note->note()->set_channel (mtv->get_preferred_midi_channel ());
|
_ghost_note->note()->set_channel (mtv->get_preferred_midi_channel ());
|
||||||
_ghost_note->note()->set_velocity (get_velocity_for_add (snapped_beats));
|
_ghost_note->note()->set_velocity (get_velocity_for_add (snapped_beats));
|
||||||
|
|
||||||
MusicalKey const & key (mtv->midi_track()->key());
|
|
||||||
if (!(mtv->midi_track()->key_enforcment_policy() & NoDraw) || key.in_key (_ghost_note->note()->note())) {
|
|
||||||
_ghost_note->show ();
|
|
||||||
} else {
|
|
||||||
_ghost_note->hide ();
|
|
||||||
}
|
|
||||||
|
|
||||||
update_note (_ghost_note, false);
|
update_note (_ghost_note, false);
|
||||||
|
|
||||||
show_verbose_cursor (_ghost_note->note ());
|
show_verbose_cursor (_ghost_note->note ());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue