@@ -1192,13 +1192,6 @@ void ObjectList::key_event(wxKeyEvent& event)
11921192
11931193void ObjectList::OnBeginDrag (wxDataViewEvent &event)
11941194{
1195- if (m_is_editing_started)
1196- m_is_editing_started = false ;
1197- #ifdef __WXGTK__
1198- const auto renderer = dynamic_cast <BitmapTextRenderer*>(GetColumn (colName)->GetRenderer ());
1199- renderer->FinishEditing ();
1200- #endif
1201-
12021195 const wxDataViewItem item (event.GetItem ());
12031196
12041197 const bool mult_sel = multiple_selection ();
@@ -1232,11 +1225,18 @@ void ObjectList::OnBeginDrag(wxDataViewEvent &event)
12321225 m_objects_model->GetInstanceIdByItem (item),
12331226 type);
12341227
1228+ /* Under MSW or OSX, DnD moves an item to the place of another selected item
1229+ * But under GTK, DnD moves an item between another two items.
1230+ * And as a result - call EVT_CHANGE_SELECTION to unselect all items.
1231+ * To prevent such behavior use m_prevent_list_events
1232+ **/
1233+ m_prevent_list_events = true ;// it's needed for GTK
1234+
12351235 /* Under GTK, DnD requires to the wxTextDataObject been initialized with some valid value,
12361236 * so set some nonempty string
12371237 */
12381238 wxTextDataObject* obj = new wxTextDataObject;
1239- obj->SetText (mult_sel ? " SomeText " : m_objects_model-> GetItemName (item) );// it's needed for GTK
1239+ obj->SetText (" Some text " );// it's needed for GTK
12401240
12411241 event.SetDataObject (obj);
12421242 event.SetDragFlags (wxDrag_DefaultMove); // allows both copy and move;
@@ -1299,8 +1299,11 @@ bool ObjectList::can_drop(const wxDataViewItem& item) const
12991299void ObjectList::OnDropPossible (wxDataViewEvent &event)
13001300{
13011301 const wxDataViewItem& item = event.GetItem ();
1302- if (!can_drop (item))
1302+
1303+ if (!can_drop (item)) {
13031304 event.Veto ();
1305+ m_prevent_list_events = false ;
1306+ }
13041307}
13051308
13061309void ObjectList::OnDrop (wxDataViewEvent &event)
@@ -1314,13 +1317,6 @@ void ObjectList::OnDrop(wxDataViewEvent &event)
13141317 return ;
13151318 }
13161319
1317- /* Under MSW or OSX, DnD moves an item to the place of another selected item
1318- * But under GTK, DnD moves an item between another two items.
1319- * And as a result - call EVT_CHANGE_SELECTION to unselect all items.
1320- * To prevent such behavior use m_prevent_list_events
1321- **/
1322- m_prevent_list_events = true ;// it's needed for GTK
1323-
13241320 if (m_dragged_data.type () == itInstance)
13251321 {
13261322 Plater::TakeSnapshot snapshot (wxGetApp ().plater (),_ (L (" Instances to Separated Objects" )));
@@ -4823,9 +4819,6 @@ void ObjectList::sys_color_changed()
48234819
48244820void ObjectList::ItemValueChanged (wxDataViewEvent &event)
48254821{
4826- if (!m_is_editing_started)
4827- return ;
4828-
48294822 if (event.GetColumn () == colName)
48304823 update_name_in_model (event.GetItem ());
48314824 else if (event.GetColumn () == colExtruder) {
@@ -4848,9 +4841,6 @@ void ObjectList::OnEditingStarted(wxDataViewEvent &event)
48484841
48494842void ObjectList::OnEditingDone (wxDataViewEvent &event)
48504843{
4851- if (!m_is_editing_started)
4852- return ;
4853-
48544844 m_is_editing_started = false ;
48554845 if (event.GetColumn () != colName)
48564846 return ;
0 commit comments