Suppress to delete object from 3D-Scene, when ObjectList is in Editing mode

This commit is contained in:
YuSanka 2022-11-10 11:22:29 +01:00
parent b3183cb277
commit 252f9302ef
3 changed files with 10 additions and 9 deletions

View file

@ -216,9 +216,7 @@ ObjectList::ObjectList(wxWindow* parent) :
Bind(wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, &ObjectList::OnDropPossible, this);
Bind(wxEVT_DATAVIEW_ITEM_DROP, &ObjectList::OnDrop, this);
#ifdef __WXMSW__
Bind(wxEVT_DATAVIEW_ITEM_EDITING_STARTED, &ObjectList::OnEditingStarted, this);
#endif /* __WXMSW__ */
Bind(wxEVT_DATAVIEW_ITEM_EDITING_DONE, &ObjectList::OnEditingDone, this);
Bind(wxEVT_DATAVIEW_ITEM_VALUE_CHANGED, &ObjectList::ItemValueChanged, this);
@ -4621,17 +4619,19 @@ void ObjectList::ItemValueChanged(wxDataViewEvent &event)
}
}
void ObjectList::OnEditingStarted(wxDataViewEvent &event)
{
m_is_editing_started = true;
#ifdef __WXMSW__
// Workaround for entering the column editing mode on Windows. Simulate keyboard enter when another column of the active line is selected.
// Here the last active column is forgotten, so when leaving the editing mode, the next mouse click will not enter the editing mode of the newly selected column.
void ObjectList::OnEditingStarted(wxDataViewEvent &event)
{
m_last_selected_column = -1;
}
#endif //__WXMSW__
}
void ObjectList::OnEditingDone(wxDataViewEvent &event)
{
m_is_editing_started = false;
if (event.GetColumn() != colName)
return;

View file

@ -175,6 +175,7 @@ private:
// Workaround for entering the column editing mode on Windows. Simulate keyboard enter when another column of the active line is selected.
int m_last_selected_column = -1;
#endif /* __MSW__ */
bool m_is_editing_started{ false };
#if 0
SettingsFactory::Bundle m_freq_settings_fff;
@ -404,6 +405,8 @@ public:
void apply_volumes_order();
bool has_paint_on_segmentation();
bool is_editing() const { return m_is_editing_started; }
private:
#ifdef __WXOSX__
// void OnChar(wxKeyEvent& event);
@ -417,10 +420,8 @@ private:
bool can_drop(const wxDataViewItem& item) const ;
void ItemValueChanged(wxDataViewEvent &event);
#ifdef __WXMSW__
// Workaround for entering the column editing mode on Windows. Simulate keyboard enter when another column of the active line is selected.
void OnEditingStarted(wxDataViewEvent &event);
#endif /* __WXMSW__ */
void OnEditingDone(wxDataViewEvent &event);
};

View file

@ -4880,12 +4880,12 @@ void Plater::priv::set_bed_shape(const Pointfs& shape, const double max_print_he
bool Plater::priv::can_delete() const
{
return !get_selection().is_empty() && !get_selection().is_wipe_tower();
return !get_selection().is_empty() && !get_selection().is_wipe_tower() && !sidebar->obj_list()->is_editing();
}
bool Plater::priv::can_delete_all() const
{
return !model.objects.empty();
return !model.objects.empty() && !sidebar->obj_list()->is_editing();
}
bool Plater::priv::can_fix_through_netfabb() const