Linux issue: fixed Object's DnD with sub items
This commit is contained in:
parent
74d3ca2350
commit
5e4a0b96b7
3 changed files with 35 additions and 4 deletions
|
@ -1561,9 +1561,11 @@ wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
|
|||
|
||||
// Add frequently settings
|
||||
const ItemType item_type = m_objects_model->GetItemType(GetSelection());
|
||||
if (item_type == itUndef)
|
||||
if (item_type == itUndef && !selection.is_single_full_object())
|
||||
return nullptr;
|
||||
const bool is_object_settings = item_type & itObject || item_type & itInstance || selection.is_single_full_object();
|
||||
const bool is_object_settings = item_type & itObject || item_type & itInstance ||
|
||||
// multi-selection in ObjectList, but full_object in Selection
|
||||
(item_type == itUndef && selection.is_single_full_object());
|
||||
create_freq_settings_popupmenu(menu, is_object_settings);
|
||||
|
||||
if (mode == comAdvanced)
|
||||
|
|
|
@ -1185,6 +1185,26 @@ void ObjectDataViewModel::SetExtruder(const wxString& extruder, wxDataViewItem i
|
|||
SetValue(value, item, colExtruder);
|
||||
}
|
||||
|
||||
void ObjectDataViewModel::AddAllChildren(const wxDataViewItem& parent)
|
||||
{
|
||||
ObjectDataViewModelNode* node = (ObjectDataViewModelNode*)parent.GetID();
|
||||
if (!node || node->GetChildCount() == 0)
|
||||
return;
|
||||
|
||||
wxDataViewItemArray array;
|
||||
const size_t count = node->GetChildCount();
|
||||
for (size_t pos = 0; pos < count; pos++) {
|
||||
ObjectDataViewModelNode* child = node->GetChildren().Item(pos);
|
||||
array.Add(wxDataViewItem((void*)child));
|
||||
ItemAdded(parent, wxDataViewItem((void*)child));
|
||||
}
|
||||
|
||||
for (const auto item : array)
|
||||
AddAllChildren(item);
|
||||
|
||||
m_ctrl->Expand(parent);
|
||||
};
|
||||
|
||||
wxDataViewItem ObjectDataViewModel::ReorganizeChildren( const int current_volume_id,
|
||||
const int new_volume_id,
|
||||
const wxDataViewItem &parent)
|
||||
|
@ -1205,6 +1225,10 @@ wxDataViewItem ObjectDataViewModel::ReorganizeChildren( const int current_volume
|
|||
node_parent->Insert(deleted_node, new_volume_id+shift);
|
||||
ItemAdded(parent, wxDataViewItem(deleted_node));
|
||||
|
||||
// If some item has a children, just to add a deleted item is not enough on Linux
|
||||
// We should to add all its children separately
|
||||
AddAllChildren(wxDataViewItem(deleted_node));
|
||||
|
||||
//update volume_id value for child-nodes
|
||||
auto children = node_parent->GetChildren();
|
||||
int id_frst = current_volume_id < new_volume_id ? current_volume_id : new_volume_id;
|
||||
|
@ -1227,6 +1251,10 @@ wxDataViewItem ObjectDataViewModel::ReorganizeObjects( const int current_id, co
|
|||
m_objects.emplace(m_objects.begin() + new_id, deleted_node);
|
||||
ItemAdded(wxDataViewItem(nullptr), wxDataViewItem(deleted_node));
|
||||
|
||||
// If some item has a children, just to add a deleted item is not enough on Linux
|
||||
// We should to add all its children separately
|
||||
AddAllChildren(wxDataViewItem(deleted_node));
|
||||
|
||||
return wxDataViewItem(deleted_node);
|
||||
}
|
||||
|
||||
|
|
|
@ -504,8 +504,9 @@ public:
|
|||
void UpdateExtruderBitmap(wxDataViewItem item);
|
||||
|
||||
private:
|
||||
wxDataViewItem AddRoot(const wxDataViewItem& parent_item, const ItemType root_type);
|
||||
wxDataViewItem AddInstanceRoot(const wxDataViewItem& parent_item);
|
||||
wxDataViewItem AddRoot(const wxDataViewItem& parent_item, const ItemType root_type);
|
||||
wxDataViewItem AddInstanceRoot(const wxDataViewItem& parent_item);
|
||||
void AddAllChildren(const wxDataViewItem& parent);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue