From 00444ae4d7c0f57e558eb105cd86b0f36be3ba62 Mon Sep 17 00:00:00 2001 From: Erkan Ozgur Yilmaz Date: Sat, 24 Oct 2026 20:53:05 +0100 Subject: [PATCH] Add 3Dconnexion Settings to the View Menu (#16345) * Add 3Dconnexion Settings to the View Menu The 3Dconnexion settings overlay could only be opened with its keyboard shortcut. On macOS that is Cmd+Shift+M, because plain Cmd+M is the system Minimize shortcut, so users who pressed Cmd+M minimized the window and never found the dialog (#5484). Add a "3Dconnexion settings" check item to the View menu. It toggles the overlay and shows the shortcut bound to it, and its label follows the key if the user rebinds it. It is enabled only on Prepare and Preview when a device is connected (on Windows, also only with the legacy 3Dconnexion option enabled). Move that availability test into Mouse3DController::can_show_settings_dialog() so the menu item and the canvas shortcut share it. * Rename and move the 3Dconnexion Settings menu item Label it "Show 3Dconnexion Settings" to match the other View menu items, and move it below "Reset Window Layout" in its own separated group since it opens a settings window. --------- Co-authored-by: yw4z --- src/slic3r/GUI/GLCanvas3D.cpp | 8 ++------ src/slic3r/GUI/MainFrame.cpp | 12 ++++++++++++ src/slic3r/GUI/Mouse3DController.cpp | 10 ++++++++++ src/slic3r/GUI/Mouse3DController.hpp | 2 ++ 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 3544021ef9..eba723e0d7 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4200,15 +4200,11 @@ bool GLCanvas3D::handle_shortcut(const KeyChord& chord) m_dirty = true; break; case Shortcut::Mouse3DSettings: { -#ifdef _WIN32 - if (wxGetApp().app_config->get("use_legacy_3DConnexion") == "true") { -#endif //_WIN32 - Mouse3DController& controller = wxGetApp().plater()->get_mouse3d_controller(); + Mouse3DController& controller = wxGetApp().plater()->get_mouse3d_controller(); + if (controller.can_show_settings_dialog()) { controller.show_settings_dialog(!controller.is_settings_dialog_shown()); m_dirty = true; -#ifdef _WIN32 } -#endif //_WIN32 break; } case Shortcut::ReloadDevicePage: diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 9938509e89..1cf508b612 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -3473,6 +3473,18 @@ void MainFrame::init_menubar_as_editor() }, this); + viewMenu->AppendSeparator(); + wxMenuItem* mouse3d_settings = append_menu_check_item(viewMenu, wxID_ANY, shortcut_label(_L("Show 3Dconnexion Settings"), Shortcut::Mouse3DSettings, true), + _L("Show/Hide 3Dconnexion devices settings dialog"), + [this](wxCommandEvent&) { + Mouse3DController& controller = m_plater->get_mouse3d_controller(); + controller.show_settings_dialog(!controller.is_settings_dialog_shown()); + m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); + }, + this, [this]() { return is_prepare_or_preview_tab() && m_plater->get_mouse3d_controller().can_show_settings_dialog(); }, + [this]() { return m_plater->get_mouse3d_controller().is_settings_dialog_shown(); }, this); + m_shortcut_menu_items.push_back({ mouse3d_settings, Shortcut::Mouse3DSettings, _L("Show 3Dconnexion Settings"), true }); + viewMenu->AppendSeparator(); wxMenuItem* show_labels = append_menu_check_item(viewMenu, wxID_ANY, shortcut_label(_L("Show &Labels"), Shortcut::ShowLabels, true), _L("Show object labels in 3D scene."), [this](wxCommandEvent&) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); }, this, diff --git a/src/slic3r/GUI/Mouse3DController.cpp b/src/slic3r/GUI/Mouse3DController.cpp index 3e1943ecb3..eff4381dea 100644 --- a/src/slic3r/GUI/Mouse3DController.cpp +++ b/src/slic3r/GUI/Mouse3DController.cpp @@ -1,5 +1,6 @@ #include "libslic3r/libslic3r.h" #include "libslic3r/PresetBundle.hpp" +#include "libslic3r/AppConfig.hpp" #include "Mouse3DController.hpp" #include "GUI.hpp" @@ -452,6 +453,15 @@ bool Mouse3DController::apply(Camera& camera) return m_state.apply(m_params, camera); } +bool Mouse3DController::can_show_settings_dialog() const +{ +#ifdef _WIN32 + if (wxGetApp().app_config->get("use_legacy_3DConnexion") != "true") + return false; +#endif // _WIN32 + return this->connected(); +} + void Mouse3DController::render_settings_dialog(GLCanvas3D& canvas) const { if (! m_show_settings_dialog || ! m_connected) diff --git a/src/slic3r/GUI/Mouse3DController.hpp b/src/slic3r/GUI/Mouse3DController.hpp index ac6a2b9b9f..ea2fcc1290 100644 --- a/src/slic3r/GUI/Mouse3DController.hpp +++ b/src/slic3r/GUI/Mouse3DController.hpp @@ -221,6 +221,8 @@ public: // Apply the received 3DConnexion mouse events to the camera. Called from the UI rendering thread. bool apply(Camera& camera); + // Whether the settings dialog can be shown: a device is connected and, on Windows, the legacy driver path is in use. + bool can_show_settings_dialog() const; bool is_settings_dialog_shown() const { return m_show_settings_dialog; } void show_settings_dialog(bool show) { m_show_settings_dialog = show && this->connected(); } void render_settings_dialog(GLCanvas3D& canvas) const;