Info in ObjectList: Settings should be above the new info items, info items are selectable

This commit is contained in:
Lukas Matena 2021-04-19 11:51:56 +02:00
parent 548ceb7acc
commit df3fb31268
2 changed files with 9 additions and 12 deletions

View File

@ -1525,14 +1525,20 @@ void ObjectList::del_subobject_item(wxDataViewItem& item)
if (type == itUndef)
return;
wxDataViewItem parent = m_objects_model->GetParent(item);
if (type & itSettings)
del_settings_from_config(m_objects_model->GetParent(item));
del_settings_from_config(parent);
else if (type & itInstanceRoot && obj_idx != -1)
del_instances_from_object(obj_idx);
else if (type & itLayerRoot && obj_idx != -1)
del_layers_from_object(obj_idx);
else if (type & itLayer && obj_idx != -1)
del_layer_from_object(obj_idx, m_objects_model->GetLayerRangeByItem(item));
else if (type & itInfo && obj_idx != -1) {
Unselect(item);
Select(parent);
}
else if (idx == -1)
return;
else if (!del_subobject_from_object(obj_idx, idx, type))
@ -1540,7 +1546,7 @@ void ObjectList::del_subobject_item(wxDataViewItem& item)
// If last volume item with warning was deleted, unmark object item
if (type & itVolume && (*m_objects)[obj_idx]->get_mesh_errors_count() == 0)
m_objects_model->DeleteWarningIcon(m_objects_model->GetParent(item));
m_objects_model->DeleteWarningIcon(parent);
m_objects_model->Delete(item);
update_info_items(obj_idx);
@ -2131,9 +2137,6 @@ void ObjectList::part_selection_changed()
update_and_show_manipulations = true;
if (type == itInfo) {
Unselect(item);
assert(parent_type == itObject);
Select(parent);
InfoItemType info_type = m_objects_model->GetInfoItemType(item);
GLGizmosManager::EType gizmo_type =
info_type == InfoItemType::CustomSupports ? GLGizmosManager::EType::FdmSupports

View File

@ -377,13 +377,7 @@ wxDataViewItem ObjectDataViewModel::AddSettingsChild(const wxDataViewItem &paren
const auto node = new ObjectDataViewModelNode(root, itSettings);
// In case there are some info items, append after them.
size_t i = 0;
for (i = 0; i<root->GetChildCount(); ++i)
if (root->GetNthChild(i)->GetType() != itInfo)
break;
root->Insert(node, i);
root->Insert(node, 0);
// notify control
const wxDataViewItem child((void*)node);
ItemAdded(parent_item, child);