_outline = UIConfiguration::instance().color ("ghost track midi outline");
base_rect->lower_to_bottom();
- update_range ();
-
- midi_view()->NoteRangeChanged.connect (sigc::mem_fun (*this, &MidiGhostRegion::update_range));
}
/**
_outline = UIConfiguration::instance().color ("ghost track midi outline");
base_rect->lower_to_bottom();
- update_range ();
-
- midi_view()->NoteRangeChanged.connect (sigc::mem_fun (*this, &MidiGhostRegion::update_range));
}
MidiGhostRegion::~MidiGhostRegion()
MidiGhostRegion::set_height ()
{
GhostRegion::set_height();
- set_contents_height ();
+ update_contents_height ();
}
void
}
void
-MidiGhostRegion::update_range ()
-{
- MidiStreamView* mv = midi_view();
-
- if (!mv) {
- return;
- }
-
- for (EventList::iterator it = events.begin(); it != events.end(); ++it) {
- uint8_t const note_num = (*it).second->event->note()->note();
-
- if (note_num < mv->lowest_note() || note_num > mv->highest_note()) {
- (*it).second->item->hide();
- } else {
- (*it).second->item->show();
- }
- }
-}
-
-void
-MidiGhostRegion::set_contents_height ()
+MidiGhostRegion::update_contents_height ()
{
MidiStreamView* mv = midi_view();
double const y = note_y(trackview, mv, note_num);
double const h = note_height(trackview, mv);
- if ((_tmp_rect = dynamic_cast<ArdourCanvas::Rectangle*>(ev->item))) {
- _tmp_rect->set (ArdourCanvas::Rect (note->x0(), y, note->x1(), y + h));
+ if (note_num < mv->lowest_note() || note_num > mv->highest_note()) {
+ ev->item->hide();
+ } else {
+ if ((_tmp_rect = dynamic_cast<ArdourCanvas::Rectangle*>(ev->item))) {
+ _tmp_rect->set (ArdourCanvas::Rect (note->x0(), y, note->x1(), y + h));
+ }
+ ev->item->show();
}
-
}
/** Update the x positions of our representation of a parent's hit.
double const h = note_height(trackview, mv);
double const y = note_y(trackview, mv, note_num);
-
- if ((_tmp_poly = dynamic_cast<ArdourCanvas::Polygon*>(ev->item))) {
- ArdourCanvas::Duple ppos = hit->position();
- ArdourCanvas::Duple gpos = _tmp_poly->position();
- gpos.x = ppos.x;
- gpos.y = y;
- _tmp_poly->set_position(gpos);
- _tmp_poly->set(Hit::points(h));
+ if (note_num < mv->lowest_note() || note_num > mv->highest_note()) {
+ ev->item->hide();
+ } else {
+ if ((_tmp_poly = dynamic_cast<ArdourCanvas::Polygon*>(ev->item))) {
+ ArdourCanvas::Duple ppos = hit->position();
+ ArdourCanvas::Duple gpos = _tmp_poly->position();
+ gpos.x = ppos.x;
+ gpos.y = y;
+ _tmp_poly->set_position(gpos);
+ _tmp_poly->set(Hit::points(h));
+ }
+ ev->item->show();
}
}
bool empty_when_starting = _events.empty();
MidiModel::ReadLock lock(_model->read_lock());
MidiModel::Notes missing_notes = _model->notes(); // copy
+ Note* sus = NULL;
+ Hit* hit = NULL;
if (!empty_when_starting) {
MidiModel::Notes::iterator f;
} else {
NoteBase* cne = (*i);
bool visible;
+ bool update = false;
if (note_in_region_range (note, visible)) {
if (visible) {
- update_note (cne);
+ update = true;
cne->show ();
} else {
cne->hide ();
} else {
cne->hide ();
}
+ if ((sus = dynamic_cast<Note*>(cne))) {
+
+ if (update) {
+ update_sustained (sus);
+ }
+
+ for (std::vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
+ MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*i);
+ if (gr) {
+ gr->update_note (sus);
+ }
+ }
+ } else if ((hit = dynamic_cast<Hit*>(cne))) {
+ if (update) {
+ update_hit (hit);
+ }
+
+ for (std::vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
+ MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*i);
+ if (gr) {
+ gr->update_hit (hit);
+ }
+ }
+ }
++i;
}
}
NoteBase* cne = add_note (note, true);
bool visible;
- if (note_in_region_range (note, visible)) {
- if (visible) {
- set<Evoral::event_id_t>::iterator it;
-
- cne->show ();
+ 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);
+ }
+ }
- for (it = _pending_note_selection.begin(); it != _pending_note_selection.end(); ++it) {
- if ((*it) == note->id()) {
- add_to_selection (cne);
- }
- }
- } else {
+ if (note_in_region_range (note, visible)) {
+ if (!visible) {
cne->hide ();
}
} else {
ev->set_fill_color(base_col);
ev->set_outline_color(ev->calculate_outline(base_col, ev->selected()));
- if (update_ghost_regions) {
- for (std::vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
- MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*i);
- if (gr) {
- gr->update_note (ev);
- }
- }
- }
}
void
ev->set_fill_color(base_col);
ev->set_outline_color(ev->calculate_outline(base_col, ev->selected()));
- if (update_ghost_regions) {
- for (std::vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
- MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*i);
- if (gr) {
- gr->update_hit (ev);
- }
- }
- }
}
/** Add a MIDI note to the view (with length).