13
0

Fix TrackView selection after re-order.

because reordering a TreeView [pragmatically] does not retain selection.
This commit is contained in:
Robin Gareus 2017-06-17 18:26:35 +02:00
parent ea1669aa00
commit fec5aec9a0

View File

@ -1050,11 +1050,11 @@ EditorRoutes::sync_treeview_from_presentation_info (PropertyChange const & what_
TreeModel::Children rows = _model->children(); TreeModel::Children rows = _model->children();
if (what_changed.contains (hidden_or_order)) { bool changed = false;
if (what_changed.contains (hidden_or_order)) {
vector<int> neworder; vector<int> neworder;
uint32_t old_order = 0; uint32_t old_order = 0;
bool changed = false;
if (rows.empty()) { if (rows.empty()) {
return; return;
@ -1101,15 +1101,13 @@ EditorRoutes::sync_treeview_from_presentation_info (PropertyChange const & what_
} }
} }
if (what_changed.contains (Properties::selected)) { if (changed || what_changed.contains (Properties::selected)) {
/* by the time this is invoked, the GUI Selection model has /* by the time this is invoked, the GUI Selection model has
* already updated itself. * already updated itself.
*/ */
PBD::Unwinder<bool> uw (_ignore_selection_change, true); PBD::Unwinder<bool> uw (_ignore_selection_change, true);
/* set the treeview model selection state */
/* set the treeview model selection state */
for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri) { for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri) {
boost::shared_ptr<Stripable> stripable = (*ri)[_columns.stripable]; boost::shared_ptr<Stripable> stripable = (*ri)[_columns.stripable];
if (stripable && stripable->is_selected()) { if (stripable && stripable->is_selected()) {