mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-18 03:15:52 +01:00
hide ghost events appropriately (e.g. after split).
This commit is contained in:
parent
37e858da7d
commit
ddd085cf4e
3 changed files with 26 additions and 22 deletions
|
|
@ -336,8 +336,9 @@ MidiGhostRegion::add_note (NoteBase* n)
|
|||
uint8_t const note_num = n->note()->note();
|
||||
double const h = note_height(trackview, mv);
|
||||
double const y = note_y(trackview, mv, note_num);
|
||||
|
||||
if (note_num < mv->lowest_note() || note_num > mv->highest_note()) {
|
||||
if (n->x0() < base_rect->x0() || n->x1() > base_rect->x1()) {
|
||||
event->item->hide();
|
||||
} else if (note_num < mv->lowest_note() || note_num > mv->highest_note()) {
|
||||
event->item->hide();
|
||||
} else {
|
||||
if ((_tmp_rect = dynamic_cast<ArdourCanvas::Rectangle*>(event->item))) {
|
||||
|
|
@ -367,7 +368,7 @@ MidiGhostRegion::clear_events()
|
|||
* @param parent The CanvasNote from the parent MidiRegionView.
|
||||
*/
|
||||
void
|
||||
MidiGhostRegion::update_note (Note* note)
|
||||
MidiGhostRegion::update_note (Note* note, bool hide)
|
||||
{
|
||||
MidiStreamView* mv = midi_view();
|
||||
|
||||
|
|
@ -386,7 +387,7 @@ MidiGhostRegion::update_note (Note* note)
|
|||
double const y = note_y(trackview, mv, note_num);
|
||||
double const h = note_height(trackview, mv);
|
||||
|
||||
if (note_num < mv->lowest_note() || note_num > mv->highest_note()) {
|
||||
if (hide || note_num < mv->lowest_note() || note_num > mv->highest_note()) {
|
||||
ev->item->hide();
|
||||
} else {
|
||||
if ((_tmp_rect = dynamic_cast<ArdourCanvas::Rectangle*>(ev->item))) {
|
||||
|
|
@ -400,7 +401,7 @@ MidiGhostRegion::update_note (Note* note)
|
|||
* @param hit The CanvasHit from the parent MidiRegionView.
|
||||
*/
|
||||
void
|
||||
MidiGhostRegion::update_hit (Hit* hit)
|
||||
MidiGhostRegion::update_hit (Hit* hit, bool hide)
|
||||
{
|
||||
MidiStreamView* mv = midi_view();
|
||||
|
||||
|
|
@ -418,7 +419,7 @@ MidiGhostRegion::update_hit (Hit* hit)
|
|||
|
||||
double const h = note_height(trackview, mv);
|
||||
double const y = note_y(trackview, mv, note_num);
|
||||
if (note_num < mv->lowest_note() || note_num > mv->highest_note()) {
|
||||
if (hide || note_num < mv->lowest_note() || note_num > mv->highest_note()) {
|
||||
ev->item->hide();
|
||||
} else {
|
||||
if ((_tmp_poly = dynamic_cast<ArdourCanvas::Polygon*>(ev->item))) {
|
||||
|
|
|
|||
|
|
@ -109,8 +109,8 @@ public:
|
|||
void update_contents_height();
|
||||
|
||||
void add_note(NoteBase*);
|
||||
void update_note (Note*);
|
||||
void update_hit (Hit*);
|
||||
void update_note (Note* note, bool hide);
|
||||
void update_hit (Hit* hit, bool hide);
|
||||
void remove_note (NoteBase*);
|
||||
|
||||
void clear_events();
|
||||
|
|
|
|||
|
|
@ -1248,7 +1248,7 @@ MidiRegionView::redisplay_model()
|
|||
for (std::vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
|
||||
MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*i);
|
||||
if (gr && gr->trackview.y_position() != -1) {
|
||||
gr->update_note (sus);
|
||||
gr->update_note (sus, !update);
|
||||
}
|
||||
}
|
||||
} else if ((hit = dynamic_cast<Hit*>(cne))) {
|
||||
|
|
@ -1260,7 +1260,7 @@ MidiRegionView::redisplay_model()
|
|||
for (std::vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
|
||||
MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*i);
|
||||
if (gr && gr->trackview.y_position() != -1) {
|
||||
gr->update_hit (hit);
|
||||
gr->update_hit (hit, !update);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1272,22 +1272,24 @@ MidiRegionView::redisplay_model()
|
|||
|
||||
for (MidiModel::Notes::iterator n = missing_notes.begin(); n != missing_notes.end(); ++n) {
|
||||
boost::shared_ptr<NoteType> note (*n);
|
||||
NoteBase* cne = add_note (note, true);
|
||||
NoteBase* cne;
|
||||
bool visible;
|
||||
|
||||
if (note_in_region_range (note, visible)) {
|
||||
if (visible) {
|
||||
cne = add_note (note, true);
|
||||
} else {
|
||||
cne = add_note (note, false);
|
||||
}
|
||||
} else {
|
||||
cne = add_note (note, false);
|
||||
}
|
||||
|
||||
for (set<Evoral::event_id_t>::iterator it = _pending_note_selection.begin(); it != _pending_note_selection.end(); ++it) {
|
||||
if ((*it) == note->id()) {
|
||||
add_to_selection (cne);
|
||||
}
|
||||
}
|
||||
|
||||
if (note_in_region_range (note, visible)) {
|
||||
if (!visible) {
|
||||
cne->hide ();
|
||||
}
|
||||
} else {
|
||||
cne->hide ();
|
||||
}
|
||||
}
|
||||
|
||||
_sys_exes.clear();
|
||||
|
|
@ -1547,13 +1549,14 @@ MidiRegionView::add_ghost (TimeAxisView& tv)
|
|||
ghost = new MidiGhostRegion (*this, tv, trackview, unit_position);
|
||||
}
|
||||
|
||||
ghost->set_colors ();
|
||||
ghost->set_height ();
|
||||
ghost->set_duration (_region->length() / samples_per_pixel);
|
||||
|
||||
for (Events::iterator i = _events.begin(); i != _events.end(); ++i) {
|
||||
ghost->add_note(*i);
|
||||
}
|
||||
|
||||
ghost->set_colors ();
|
||||
ghost->set_height ();
|
||||
ghost->set_duration (_region->length() / samples_per_pixel);
|
||||
ghosts.push_back (ghost);
|
||||
|
||||
return ghost;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue