mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 09:47:58 -06:00
Correct split for the parts too
This commit is contained in:
parent
128d0f7708
commit
19411df0e4
4 changed files with 105 additions and 25 deletions
|
@ -456,7 +456,9 @@ wxDataViewItem PrusaObjectDataViewModel::Delete(const wxDataViewItem &item)
|
|||
|
||||
// set m_containet to FALSE if parent has no child
|
||||
if (node_parent && node_parent->GetChildCount() == 0){
|
||||
#ifndef __WXGTK__
|
||||
node_parent->m_container = false;
|
||||
#endif //__WXGTK__
|
||||
ret_item = parent;
|
||||
}
|
||||
|
||||
|
@ -475,6 +477,35 @@ void PrusaObjectDataViewModel::DeleteAll()
|
|||
}
|
||||
}
|
||||
|
||||
void PrusaObjectDataViewModel::DeleteChildren(wxDataViewItem& parent)
|
||||
{
|
||||
PrusaObjectDataViewModelNode *root = (PrusaObjectDataViewModelNode*)parent.GetID();
|
||||
if (!root) // happens if item.IsOk()==false
|
||||
return;
|
||||
|
||||
// first remove the node from the parent's array of children;
|
||||
// NOTE: MyObjectTreeModelNodePtrArray is only an array of _pointers_
|
||||
// thus removing the node from it doesn't result in freeing it
|
||||
auto& children = root->GetChildren();
|
||||
for (int id = root->GetChildCount() - 1; id >= 0; --id)
|
||||
{
|
||||
auto node = children[id];
|
||||
auto item = wxDataViewItem(node);
|
||||
children.RemoveAt(id);
|
||||
|
||||
// free the node
|
||||
delete node;
|
||||
|
||||
// notify control
|
||||
ItemDeleted(parent, item);
|
||||
}
|
||||
|
||||
// set m_containet to FALSE if parent has no child
|
||||
#ifndef __WXGTK__
|
||||
root->m_container = false;
|
||||
#endif //__WXGTK__
|
||||
}
|
||||
|
||||
wxDataViewItem PrusaObjectDataViewModel::GetItemById(int obj_idx)
|
||||
{
|
||||
if (obj_idx >= m_objects.size())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue