Added Esc shortcut and menu item for command deselect all
This commit is contained in:
parent
c4c292168d
commit
14c4469cbf
10 changed files with 55 additions and 18 deletions
|
@ -59,4 +59,12 @@
|
||||||
#define ENABLE_SVG_ICONS (1 && ENABLE_1_42_0_ALPHA8 && ENABLE_TEXTURES_FROM_SVG)
|
#define ENABLE_SVG_ICONS (1 && ENABLE_1_42_0_ALPHA8 && ENABLE_TEXTURES_FROM_SVG)
|
||||||
|
|
||||||
|
|
||||||
|
//====================
|
||||||
|
// 1.42.0.rc techs
|
||||||
|
//====================
|
||||||
|
#define ENABLE_1_42_0_RC 1
|
||||||
|
|
||||||
|
// Disables Edit->Deselect all item menu item
|
||||||
|
#define DISABLE_DESELECT_ALL_MENU_ITEM (1 && ENABLE_1_42_0_RC)
|
||||||
|
|
||||||
#endif // _technologies_h_
|
#endif // _technologies_h_
|
||||||
|
|
|
@ -1715,6 +1715,16 @@ void GLCanvas3D::select_all()
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLCanvas3D::deselect_all()
|
||||||
|
{
|
||||||
|
m_selection.clear();
|
||||||
|
m_selection.set_mode(Selection::Instance);
|
||||||
|
wxGetApp().obj_manipul()->set_dirty();
|
||||||
|
m_gizmos.reset_all_states();
|
||||||
|
m_gizmos.update_data(*this);
|
||||||
|
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
|
||||||
|
}
|
||||||
|
|
||||||
void GLCanvas3D::delete_selected()
|
void GLCanvas3D::delete_selected()
|
||||||
{
|
{
|
||||||
m_selection.erase();
|
m_selection.erase();
|
||||||
|
@ -2359,7 +2369,8 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
||||||
post_event(SimpleEvent(EVT_GLTOOLBAR_DELETE));
|
post_event(SimpleEvent(EVT_GLTOOLBAR_DELETE));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '0': { select_view("iso"); break; }
|
case WXK_ESCAPE: { deselect_all(); break; }
|
||||||
|
case '0': { select_view("iso"); break; }
|
||||||
case '1': { select_view("top"); break; }
|
case '1': { select_view("top"); break; }
|
||||||
case '2': { select_view("bottom"); break; }
|
case '2': { select_view("bottom"); break; }
|
||||||
case '3': { select_view("front"); break; }
|
case '3': { select_view("front"); break; }
|
||||||
|
@ -2379,11 +2390,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
||||||
case 'o': { set_camera_zoom(-1.0f); break; }
|
case 'o': { set_camera_zoom(-1.0f); break; }
|
||||||
case 'Z':
|
case 'Z':
|
||||||
case 'z': { m_selection.is_empty() ? zoom_to_volumes() : zoom_to_selection(); break; }
|
case 'z': { m_selection.is_empty() ? zoom_to_volumes() : zoom_to_selection(); break; }
|
||||||
default:
|
default: { evt.Skip(); break; }
|
||||||
{
|
|
||||||
evt.Skip();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2900,14 +2907,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||||
{
|
{
|
||||||
// deselect and propagate event through callback
|
// deselect and propagate event through callback
|
||||||
if (!evt.ShiftDown() && m_picking_enabled)
|
if (!evt.ShiftDown() && m_picking_enabled)
|
||||||
{
|
deselect_all();
|
||||||
m_selection.clear();
|
|
||||||
m_selection.set_mode(Selection::Instance);
|
|
||||||
wxGetApp().obj_manipul()->set_dirty();
|
|
||||||
m_gizmos.reset_all_states();
|
|
||||||
m_gizmos.update_data(*this);
|
|
||||||
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (evt.LeftUp() && m_mouse.dragging)
|
else if (evt.LeftUp() && m_mouse.dragging)
|
||||||
// Flips X mouse deltas if bed is upside down
|
// Flips X mouse deltas if bed is upside down
|
||||||
|
|
|
@ -555,6 +555,7 @@ public:
|
||||||
void render();
|
void render();
|
||||||
|
|
||||||
void select_all();
|
void select_all();
|
||||||
|
void deselect_all();
|
||||||
void delete_selected();
|
void delete_selected();
|
||||||
void ensure_on_bed(unsigned int object_idx);
|
void ensure_on_bed(unsigned int object_idx);
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,12 @@ void View3D::select_all()
|
||||||
m_canvas->select_all();
|
m_canvas->select_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void View3D::deselect_all()
|
||||||
|
{
|
||||||
|
if (m_canvas != nullptr)
|
||||||
|
m_canvas->deselect_all();
|
||||||
|
}
|
||||||
|
|
||||||
void View3D::delete_selected()
|
void View3D::delete_selected()
|
||||||
{
|
{
|
||||||
if (m_canvas != nullptr)
|
if (m_canvas != nullptr)
|
||||||
|
|
|
@ -47,6 +47,7 @@ public:
|
||||||
|
|
||||||
void select_view(const std::string& direction);
|
void select_view(const std::string& direction);
|
||||||
void select_all();
|
void select_all();
|
||||||
|
void deselect_all();
|
||||||
void delete_selected();
|
void delete_selected();
|
||||||
void mirror_selection(Axis axis);
|
void mirror_selection(Axis axis);
|
||||||
|
|
||||||
|
|
|
@ -790,10 +790,13 @@ bool GLGizmosManager::on_char(wxKeyEvent& evt, GLCanvas3D& canvas)
|
||||||
// key ESC
|
// key ESC
|
||||||
case WXK_ESCAPE:
|
case WXK_ESCAPE:
|
||||||
{
|
{
|
||||||
if ((m_current != SlaSupports) || !gizmo_event(SLAGizmoEventType::DiscardChanges))
|
if (m_current != Undefined)
|
||||||
reset_all_states();
|
{
|
||||||
|
if ((m_current != SlaSupports) || !gizmo_event(SLAGizmoEventType::DiscardChanges))
|
||||||
|
reset_all_states();
|
||||||
|
|
||||||
processed = true;
|
processed = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WXK_RETURN:
|
case WXK_RETURN:
|
||||||
|
|
|
@ -267,6 +267,11 @@ bool MainFrame::can_select() const
|
||||||
return (m_plater != nullptr) && !m_plater->model().objects.empty();
|
return (m_plater != nullptr) && !m_plater->model().objects.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainFrame::can_deselect() const
|
||||||
|
{
|
||||||
|
return (m_plater != nullptr) && !m_plater->is_selection_empty();
|
||||||
|
}
|
||||||
|
|
||||||
bool MainFrame::can_delete() const
|
bool MainFrame::can_delete() const
|
||||||
{
|
{
|
||||||
return (m_plater != nullptr) && !m_plater->is_selection_empty();
|
return (m_plater != nullptr) && !m_plater->is_selection_empty();
|
||||||
|
@ -449,6 +454,11 @@ void MainFrame::init_menubar()
|
||||||
append_menu_item(editMenu, wxID_ANY, _(L("&Select all")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "A",
|
append_menu_item(editMenu, wxID_ANY, _(L("&Select all")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "A",
|
||||||
_(L("Selects all objects")), [this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->select_all(); },
|
_(L("Selects all objects")), [this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->select_all(); },
|
||||||
"", nullptr, [this](){return can_select(); }, this);
|
"", nullptr, [this](){return can_select(); }, this);
|
||||||
|
#if !DISABLE_DESELECT_ALL_MENU_ITEM
|
||||||
|
append_menu_item(editMenu, wxID_ANY, _(L("D&eselect all")) + sep + GUI::shortkey_ctrl_prefix() + sep + "Esc",
|
||||||
|
_(L("Deselects all objects")), [this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->deselect_all(); },
|
||||||
|
"", nullptr, [this](){return can_deselect(); }, this);
|
||||||
|
#endif // !DISABLE_DESELECT_ALL_MENU_ITEM
|
||||||
editMenu->AppendSeparator();
|
editMenu->AppendSeparator();
|
||||||
append_menu_item(editMenu, wxID_ANY, _(L("&Delete selected")) + sep + hotkey_delete,
|
append_menu_item(editMenu, wxID_ANY, _(L("&Delete selected")) + sep + hotkey_delete,
|
||||||
_(L("Deletes the current selection")),[this](wxCommandEvent&) { m_plater->remove_selected(); },
|
_(L("Deletes the current selection")),[this](wxCommandEvent&) { m_plater->remove_selected(); },
|
||||||
|
@ -458,7 +468,6 @@ void MainFrame::init_menubar()
|
||||||
menu_icon("delete_all_menu"), nullptr, [this](){return can_delete_all(); }, this);
|
menu_icon("delete_all_menu"), nullptr, [this](){return can_delete_all(); }, this);
|
||||||
|
|
||||||
editMenu->AppendSeparator();
|
editMenu->AppendSeparator();
|
||||||
|
|
||||||
append_menu_item(editMenu, wxID_ANY, _(L("&Copy")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "C",
|
append_menu_item(editMenu, wxID_ANY, _(L("&Copy")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "C",
|
||||||
_(L("Copy selection to clipboard")), [this](wxCommandEvent&) { m_plater->copy_selection_to_clipboard(); },
|
_(L("Copy selection to clipboard")), [this](wxCommandEvent&) { m_plater->copy_selection_to_clipboard(); },
|
||||||
menu_icon("copy_menu"), nullptr, [this](){return m_plater->can_copy(); }, this);
|
menu_icon("copy_menu"), nullptr, [this](){return m_plater->can_copy(); }, this);
|
||||||
|
|
|
@ -68,6 +68,7 @@ class MainFrame : public DPIFrame
|
||||||
bool can_slice() const;
|
bool can_slice() const;
|
||||||
bool can_change_view() const;
|
bool can_change_view() const;
|
||||||
bool can_select() const;
|
bool can_select() const;
|
||||||
|
bool can_deselect() const;
|
||||||
bool can_delete() const;
|
bool can_delete() const;
|
||||||
bool can_delete_all() const;
|
bool can_delete_all() const;
|
||||||
|
|
||||||
|
|
|
@ -1261,6 +1261,7 @@ struct Plater::priv
|
||||||
void object_list_changed();
|
void object_list_changed();
|
||||||
|
|
||||||
void select_all();
|
void select_all();
|
||||||
|
void deselect_all();
|
||||||
void remove(size_t obj_idx);
|
void remove(size_t obj_idx);
|
||||||
void delete_object_from_model(size_t obj_idx);
|
void delete_object_from_model(size_t obj_idx);
|
||||||
void reset();
|
void reset();
|
||||||
|
@ -2032,6 +2033,11 @@ void Plater::priv::select_all()
|
||||||
this->sidebar->obj_list()->update_selections();
|
this->sidebar->obj_list()->update_selections();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Plater::priv::deselect_all()
|
||||||
|
{
|
||||||
|
view3D->deselect_all();
|
||||||
|
}
|
||||||
|
|
||||||
void Plater::priv::remove(size_t obj_idx)
|
void Plater::priv::remove(size_t obj_idx)
|
||||||
{
|
{
|
||||||
// Prevent toolpaths preview from rendering while we modify the Print object
|
// Prevent toolpaths preview from rendering while we modify the Print object
|
||||||
|
@ -3303,6 +3309,7 @@ void Plater::select_view(const std::string& direction) { p->select_view(directio
|
||||||
void Plater::select_view_3D(const std::string& name) { p->select_view_3D(name); }
|
void Plater::select_view_3D(const std::string& name) { p->select_view_3D(name); }
|
||||||
|
|
||||||
void Plater::select_all() { p->select_all(); }
|
void Plater::select_all() { p->select_all(); }
|
||||||
|
void Plater::deselect_all() { p->deselect_all(); }
|
||||||
|
|
||||||
void Plater::remove(size_t obj_idx) { p->remove(obj_idx); }
|
void Plater::remove(size_t obj_idx) { p->remove(obj_idx); }
|
||||||
void Plater::reset() { p->reset(); }
|
void Plater::reset() { p->reset(); }
|
||||||
|
|
|
@ -152,6 +152,7 @@ public:
|
||||||
void update_ui_from_settings();
|
void update_ui_from_settings();
|
||||||
|
|
||||||
void select_all();
|
void select_all();
|
||||||
|
void deselect_all();
|
||||||
void remove(size_t obj_idx);
|
void remove(size_t obj_idx);
|
||||||
void reset();
|
void reset();
|
||||||
void reset_with_confirm();
|
void reset_with_confirm();
|
||||||
|
|
Loading…
Reference in a new issue