Revert "Fix for SPE-1657 : [LINUX - GTK3] Crash when change position of part in sidebar"
This reverts commit a4cf34a49f
.
This commit is contained in:
parent
1de963d7d7
commit
115ac0aace
@ -1192,13 +1192,6 @@ void ObjectList::key_event(wxKeyEvent& event)
|
|||||||
|
|
||||||
void ObjectList::OnBeginDrag(wxDataViewEvent &event)
|
void ObjectList::OnBeginDrag(wxDataViewEvent &event)
|
||||||
{
|
{
|
||||||
if (m_is_editing_started)
|
|
||||||
m_is_editing_started = false;
|
|
||||||
#ifdef __WXGTK__
|
|
||||||
const auto renderer = dynamic_cast<BitmapTextRenderer*>(GetColumn(colName)->GetRenderer());
|
|
||||||
renderer->FinishEditing();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const wxDataViewItem item(event.GetItem());
|
const wxDataViewItem item(event.GetItem());
|
||||||
|
|
||||||
const bool mult_sel = multiple_selection();
|
const bool mult_sel = multiple_selection();
|
||||||
@ -1232,11 +1225,18 @@ void ObjectList::OnBeginDrag(wxDataViewEvent &event)
|
|||||||
m_objects_model->GetInstanceIdByItem(item),
|
m_objects_model->GetInstanceIdByItem(item),
|
||||||
type);
|
type);
|
||||||
|
|
||||||
|
/* Under MSW or OSX, DnD moves an item to the place of another selected item
|
||||||
|
* But under GTK, DnD moves an item between another two items.
|
||||||
|
* And as a result - call EVT_CHANGE_SELECTION to unselect all items.
|
||||||
|
* To prevent such behavior use m_prevent_list_events
|
||||||
|
**/
|
||||||
|
m_prevent_list_events = true;//it's needed for GTK
|
||||||
|
|
||||||
/* Under GTK, DnD requires to the wxTextDataObject been initialized with some valid value,
|
/* Under GTK, DnD requires to the wxTextDataObject been initialized with some valid value,
|
||||||
* so set some nonempty string
|
* so set some nonempty string
|
||||||
*/
|
*/
|
||||||
wxTextDataObject* obj = new wxTextDataObject;
|
wxTextDataObject* obj = new wxTextDataObject;
|
||||||
obj->SetText(mult_sel ? "SomeText" : m_objects_model->GetItemName(item));//it's needed for GTK
|
obj->SetText("Some text");//it's needed for GTK
|
||||||
|
|
||||||
event.SetDataObject(obj);
|
event.SetDataObject(obj);
|
||||||
event.SetDragFlags(wxDrag_DefaultMove); // allows both copy and move;
|
event.SetDragFlags(wxDrag_DefaultMove); // allows both copy and move;
|
||||||
@ -1299,8 +1299,11 @@ bool ObjectList::can_drop(const wxDataViewItem& item) const
|
|||||||
void ObjectList::OnDropPossible(wxDataViewEvent &event)
|
void ObjectList::OnDropPossible(wxDataViewEvent &event)
|
||||||
{
|
{
|
||||||
const wxDataViewItem& item = event.GetItem();
|
const wxDataViewItem& item = event.GetItem();
|
||||||
if (!can_drop(item))
|
|
||||||
|
if (!can_drop(item)) {
|
||||||
event.Veto();
|
event.Veto();
|
||||||
|
m_prevent_list_events = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectList::OnDrop(wxDataViewEvent &event)
|
void ObjectList::OnDrop(wxDataViewEvent &event)
|
||||||
@ -1314,13 +1317,6 @@ void ObjectList::OnDrop(wxDataViewEvent &event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Under MSW or OSX, DnD moves an item to the place of another selected item
|
|
||||||
* But under GTK, DnD moves an item between another two items.
|
|
||||||
* And as a result - call EVT_CHANGE_SELECTION to unselect all items.
|
|
||||||
* To prevent such behavior use m_prevent_list_events
|
|
||||||
**/
|
|
||||||
m_prevent_list_events = true;//it's needed for GTK
|
|
||||||
|
|
||||||
if (m_dragged_data.type() == itInstance)
|
if (m_dragged_data.type() == itInstance)
|
||||||
{
|
{
|
||||||
Plater::TakeSnapshot snapshot(wxGetApp().plater(),_(L("Instances to Separated Objects")));
|
Plater::TakeSnapshot snapshot(wxGetApp().plater(),_(L("Instances to Separated Objects")));
|
||||||
@ -4823,9 +4819,6 @@ void ObjectList::sys_color_changed()
|
|||||||
|
|
||||||
void ObjectList::ItemValueChanged(wxDataViewEvent &event)
|
void ObjectList::ItemValueChanged(wxDataViewEvent &event)
|
||||||
{
|
{
|
||||||
if (!m_is_editing_started)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (event.GetColumn() == colName)
|
if (event.GetColumn() == colName)
|
||||||
update_name_in_model(event.GetItem());
|
update_name_in_model(event.GetItem());
|
||||||
else if (event.GetColumn() == colExtruder) {
|
else if (event.GetColumn() == colExtruder) {
|
||||||
@ -4848,9 +4841,6 @@ void ObjectList::OnEditingStarted(wxDataViewEvent &event)
|
|||||||
|
|
||||||
void ObjectList::OnEditingDone(wxDataViewEvent &event)
|
void ObjectList::OnEditingDone(wxDataViewEvent &event)
|
||||||
{
|
{
|
||||||
if (!m_is_editing_started)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_is_editing_started = false;
|
m_is_editing_started = false;
|
||||||
if (event.GetColumn() != colName)
|
if (event.GetColumn() != colName)
|
||||||
return;
|
return;
|
||||||
|
@ -1042,16 +1042,6 @@ int ObjectDataViewModel::GetItemIdByLayerRange(const int obj_idx, const t_layer
|
|||||||
return GetLayerIdByItem(item);
|
return GetLayerIdByItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString ObjectDataViewModel::GetItemName(const wxDataViewItem &item) const
|
|
||||||
{
|
|
||||||
if (!item.IsOk())
|
|
||||||
return wxEmptyString;
|
|
||||||
ObjectDataViewModelNode* node = static_cast<ObjectDataViewModelNode*>(item.GetID());
|
|
||||||
if (!node)
|
|
||||||
return wxEmptyString;
|
|
||||||
return node->GetName();
|
|
||||||
}
|
|
||||||
|
|
||||||
int ObjectDataViewModel::GetIdByItem(const wxDataViewItem& item) const
|
int ObjectDataViewModel::GetIdByItem(const wxDataViewItem& item) const
|
||||||
{
|
{
|
||||||
if(!item.IsOk())
|
if(!item.IsOk())
|
||||||
|
@ -311,7 +311,6 @@ public:
|
|||||||
wxDataViewItem GetItemByLayerId(int obj_idx, int layer_idx);
|
wxDataViewItem GetItemByLayerId(int obj_idx, int layer_idx);
|
||||||
wxDataViewItem GetItemByLayerRange(const int obj_idx, const t_layer_height_range& layer_range);
|
wxDataViewItem GetItemByLayerRange(const int obj_idx, const t_layer_height_range& layer_range);
|
||||||
int GetItemIdByLayerRange(const int obj_idx, const t_layer_height_range& layer_range);
|
int GetItemIdByLayerRange(const int obj_idx, const t_layer_height_range& layer_range);
|
||||||
wxString GetItemName(const wxDataViewItem& item) const;
|
|
||||||
int GetIdByItem(const wxDataViewItem& item) const;
|
int GetIdByItem(const wxDataViewItem& item) const;
|
||||||
int GetIdByItemAndType(const wxDataViewItem& item, const ItemType type) const;
|
int GetIdByItemAndType(const wxDataViewItem& item, const ItemType type) const;
|
||||||
int GetObjectIdByItem(const wxDataViewItem& item) const;
|
int GetObjectIdByItem(const wxDataViewItem& item) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user