do lazy creation of Editor::_pianoroll
In reality, this doesn't save us much, because there's often a region selection early on (or even at startup) during an instance of the application
This commit is contained in:
@@ -1221,13 +1221,9 @@ Editor::set_session (Session *t)
|
||||
_locations->set_session (_session);
|
||||
_properties_box->set_session (_session);
|
||||
|
||||
/* Cannot initialize in constructor, because pianoroll needs Actions */
|
||||
if (!_pianoroll) {
|
||||
// XXX this should really not happen here
|
||||
_pianoroll = new Pianoroll ("editor pianoroll", true);
|
||||
_pianoroll->get_canvas_viewport()->set_size_request (-1, 120);
|
||||
if (_pianoroll) {
|
||||
_pianoroll->set_session (_session);
|
||||
}
|
||||
_pianoroll->set_session (_session);
|
||||
|
||||
/* _pianoroll is packed on demand in Editor::region_selection_changed */
|
||||
_bottom_hbox.show_all();
|
||||
|
||||
@@ -1722,7 +1722,7 @@ Editor::region_selection_changed ()
|
||||
maybe_edit_region_in_bottom_pane (*rv);
|
||||
} else {
|
||||
_bottom_hbox.set_child_packing (*_properties_box, true, true);
|
||||
if (_pianoroll->contents().get_parent()) {
|
||||
if (_pianoroll && _pianoroll->contents().get_parent()) {
|
||||
_pianoroll->contents().unmap ();
|
||||
_pianoroll->contents().get_parent()->remove (_pianoroll->contents());
|
||||
}
|
||||
@@ -1739,6 +1739,16 @@ Editor::maybe_edit_region_in_bottom_pane (RegionView& rv)
|
||||
std::shared_ptr<ARDOUR::MidiTrack> mt = std::dynamic_pointer_cast<ARDOUR::MidiTrack> (mrv->midi_view()->track());
|
||||
std::shared_ptr<MidiRegion> mr = std::dynamic_pointer_cast<MidiRegion>(mrv->region());
|
||||
if (mrv && mt && mr) {
|
||||
|
||||
if (!_pianoroll) {
|
||||
// XXX this should really not happen here
|
||||
_pianoroll = new Pianoroll ("editor pianoroll", true);
|
||||
_pianoroll->get_canvas_viewport()->set_size_request (-1, 120);
|
||||
if (_session) {
|
||||
_pianoroll->set_session (_session);
|
||||
}
|
||||
}
|
||||
|
||||
_pianoroll->set_track (mt);
|
||||
_pianoroll->set_region (mr);
|
||||
pack_pianoroll = true;
|
||||
@@ -1747,6 +1757,7 @@ Editor::maybe_edit_region_in_bottom_pane (RegionView& rv)
|
||||
|
||||
if (pack_pianoroll) {
|
||||
_bottom_hbox.set_child_packing (*_properties_box, false, false);
|
||||
|
||||
if (!_pianoroll->contents().get_parent()) {
|
||||
_bottom_hbox.pack_start (_pianoroll->contents(), true, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user