only update GhostEvents on visible trackviews.

- this requires that MidiGhostRegion::update_contents_height()
	  also controls visibility.
This commit is contained in:
nick_m 2016-12-23 02:55:51 +11:00
parent 96048ad4c0
commit 37e858da7d
3 changed files with 18 additions and 10 deletions

View File

@ -305,14 +305,18 @@ MidiGhostRegion::update_contents_height ()
uint8_t const note_num = (*it).second->event->note()->note();
double const y = note_y(trackview, mv, note_num);
if ((_tmp_rect = dynamic_cast<ArdourCanvas::Rectangle*>((*it).second->item))) {
_tmp_rect->set (ArdourCanvas::Rect (_tmp_rect->x0(), y, _tmp_rect->x1(), y + h));
} else if ((_tmp_poly = dynamic_cast<ArdourCanvas::Polygon*>((*it).second->item))) {
Duple position = _tmp_poly->position();
position.y = y;
_tmp_poly->set_position(position);
_tmp_poly->set(Hit::points(h));
if (note_num < mv->lowest_note() || note_num > mv->highest_note()) {
(*it).second->item->hide();
} else {
if ((_tmp_rect = dynamic_cast<ArdourCanvas::Rectangle*>((*it).second->item))) {
_tmp_rect->set (ArdourCanvas::Rect (_tmp_rect->x0(), y, _tmp_rect->x1(), y + h));
} else if ((_tmp_poly = dynamic_cast<ArdourCanvas::Polygon*>((*it).second->item))) {
Duple position = _tmp_poly->position();
position.y = y;
_tmp_poly->set_position(position);
_tmp_poly->set(Hit::points(h));
}
(*it).second->item->show();
}
}
}

View File

@ -1247,7 +1247,7 @@ MidiRegionView::redisplay_model()
for (std::vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*i);
if (gr) {
if (gr && gr->trackview.y_position() != -1) {
gr->update_note (sus);
}
}
@ -1259,7 +1259,7 @@ MidiRegionView::redisplay_model()
for (std::vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*i);
if (gr) {
if (gr && gr->trackview.y_position() != -1) {
gr->update_hit (hit);
}
}

View File

@ -332,6 +332,10 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
}
}
for (list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
(*i)->set_height ();
}
/* put separator at the bottom of this time axis view */
_canvas_separator->set (ArdourCanvas::Duple(0, height), ArdourCanvas::Duple(ArdourCanvas::COORD_MAX, height));