FIX:modify 3d mouse shortcut and add a menu

jira: STUDIO-7290
Change-Id: Ie05b3cfd5d34a5626b39bda16815936cecc1e991
(cherry picked from commit a2b7e0c74289b2faffb6a568c511401540a07dce)
This commit is contained in:
zhou.xu 2024-06-13 14:29:14 +08:00 committed by Lane.Wei
parent f5eb2899e7
commit 6e458699cf
3 changed files with 35 additions and 23 deletions

View File

@ -3105,27 +3105,24 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
break;
#ifdef __APPLE__
case 'm':
case 'M':
#else /* __APPLE__ */
case WXK_CONTROL_M:
case 'M': {
wxGetApp().mainframe->Iconize();
break;
}
#endif /* __APPLE__ */
#ifdef __APPLE__
case 'b':
case 'B':
#else /* __APPLE__ */
case WXK_CONTROL_B:
#endif /* __APPLE__ */
{
#ifdef _WIN32
if (wxGetApp().app_config->get("use_legacy_3DConnexion") == "true") {
#endif //_WIN32
#ifdef __APPLE__
// On OSX use Cmd+Shift+M to "Show/Hide 3Dconnexion devices settings dialog"
if ((evt.GetModifiers() & shiftMask) != 0) {
#endif // __APPLE__
Mouse3DController& controller = wxGetApp().plater()->get_mouse3d_controller();
Mouse3DController &controller = wxGetApp().plater()->get_mouse3d_controller();
controller.show_settings_dialog(!controller.is_settings_dialog_shown());
m_dirty = true;
#ifdef __APPLE__
}
else
// and Cmd+M to minimize application
wxGetApp().mainframe->Iconize();
#endif // __APPLE__
#ifdef _WIN32
}
#endif //_WIN32
@ -3298,8 +3295,6 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
post_event(SimpleEvent(EVT_GLCANVAS_ORIENT));
break;
}
//case 'B':
//case 'b': { zoom_to_bed(); break; }
#if !BBL_RELEASE_TO_PUBLIC
case 'C':
case 'c': { m_gcode_viewer.toggle_gcode_window_visibility(); m_dirty = true; request_extra_frame(); break; }

View File

@ -195,12 +195,10 @@ void KBShortcutsDialog::fill_shortcuts()
#else
{ ctrl + "P", L("Preferences") },
#endif
//3D control, for Apple, use Cmd-Shift-M instead of Ctrl/Cmd-M due
#ifndef __APPLE__
{ ctrl + "Shift+M", L("Show/Hide 3Dconnexion devices settings dialog") },
#else
{ ctrl + "M", L("Show/Hide 3Dconnexion devices settings dialog") },
#endif
//3Dconnexion control
{ ctrl + "B", L("Show/Hide 3Dconnexion devices settings dialog") },
// Switch table page
#ifndef __APPLE__

View File

@ -2175,7 +2175,7 @@ static wxMenu* generate_help_menu()
#ifdef __WINDOWS__
// shortcut key
auto alt = GUI::shortkey_alt_prefix();
append_menu_item(helpMenu, wxID_ANY, _L("Keyboard Shortcuts") + sep + "& Shift+" + alt +"+?", _L("Show the list of the keyboard shortcuts"),
append_menu_item(helpMenu, wxID_ANY, _L("Keyboard Shortcuts") + sep + "& Shift+" + alt +"?", _L("Show the list of the keyboard shortcuts"),
[](wxCommandEvent&) { wxGetApp().keyboard_shortcuts(); });
#else
append_menu_item(helpMenu, wxID_ANY, _L("Keyboard Shortcuts") + sep + "& Shift+?", _L("Show the list of the keyboard shortcuts"),
@ -2664,6 +2664,25 @@ void MainFrame::init_menubar_as_editor()
m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
},
this, [this]() { return m_plater->is_view3D_shown(); }, [this]() { return m_plater->is_view3D_overhang_shown(); }, this);
viewMenu->AppendSeparator();
append_menu_item(
viewMenu, wxID_ANY, _L("Set 3DConnexion") + "\t" + ctrl + "B", _L("Set 3DConnexion mouse"),
[this](wxCommandEvent &) {
#ifdef _WIN32
if (wxGetApp().app_config->get("use_legacy_3DConnexion") == "true") {
#endif //_WIN32
Mouse3DController &controller = wxGetApp().plater()->get_mouse3d_controller();
controller.show_settings_dialog(!controller.is_settings_dialog_shown());
#ifdef _WIN32
}
#endif //_WIN32
}, "", nullptr, [this]() {
Mouse3DController &controller = wxGetApp().plater()->get_mouse3d_controller();
auto tab_index = (MainFrame::TabPosition) dynamic_cast<Notebook *>(wxGetApp().tab_panel())->GetSelection();
auto is_3d_view = tab_index == MainFrame::TabPosition::tp3DEditor || tab_index == MainFrame::TabPosition::tpPreview;
return is_3d_view && controller.connected();
},
this);
/*viewMenu->AppendSeparator();
append_menu_check_item(viewMenu, wxID_ANY, _L("Show &Wireframe") + "\tCtrl+Shift+Enter", _L("Show wireframes in 3D scene"),
[this](wxCommandEvent&) { m_plater->toggle_show_wireframe(); m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); }, this,