diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index b45440605..eabc63e85 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -57,4 +57,11 @@ #define ENABLE_GCODE_VIEWER_DATA_CHECKING (0 && ENABLE_GCODE_VIEWER) +//=================== +// 2.3.0.alpha3 techs +//=================== +#define ENABLE_2_3_0_ALPHA3 1 + +#define ENABLE_CTRL_M_ON_WINDOWS (1 && ENABLE_2_3_0_ALPHA3) + #endif // _prusaslicer_technologies_h_ diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 1324aec73..2dda6f18a 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2934,6 +2934,15 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) post_event(SimpleEvent(EVT_GLTOOLBAR_COPY)); break; +#if ENABLE_CTRL_M_ON_WINDOWS + case WXK_CONTROL_M: + { + Mouse3DController& controller = wxGetApp().plater()->get_mouse3d_controller(); + controller.show_settings_dialog(!controller.is_settings_dialog_shown()); + m_dirty = true; + break; + } +#else #if defined(__linux__) || defined(__APPLE__) case WXK_CONTROL_M: { @@ -2943,6 +2952,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) break; } #endif /* __linux__ */ +#endif // ENABLE_CTRL_M_ON_WINDOWS #ifdef __APPLE__ case 'v': diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp index 1d19c7b2b..e613e05a6 100644 --- a/src/slic3r/GUI/KBShortcutsDialog.cpp +++ b/src/slic3r/GUI/KBShortcutsDialog.cpp @@ -178,9 +178,13 @@ void KBShortcutsDialog::fill_shortcuts() { "O", L("Zoom out") }, { "Tab", L("Switch between Editor/Preview") }, { "Shift+Tab", L("Collapse/Expand the sidebar") }, +#if ENABLE_CTRL_M_ON_WINDOWS + { ctrl + "M", L("Show/Hide 3Dconnexion devices settings dialog") }, +#else #if defined(__linux__) || defined(__APPLE__) { ctrl + "M", L("Show/Hide 3Dconnexion devices settings dialog") }, #endif // __linux__ +#endif // ENABLE_CTRL_M_ON_WINDOWS #if ENABLE_RENDER_PICKING_PASS // Don't localize debugging texts. { "P", "Toggle picking pass texture rendering on/off" }, diff --git a/src/slic3r/GUI/Mouse3DController.cpp b/src/slic3r/GUI/Mouse3DController.cpp index 4c5ee2076..e5f7f6fca 100644 --- a/src/slic3r/GUI/Mouse3DController.cpp +++ b/src/slic3r/GUI/Mouse3DController.cpp @@ -115,10 +115,20 @@ void Mouse3DController::device_attached(const std::string &device) // Never mind, enumeration will be performed until connected. m_wakeup = true; m_stop_condition.notify_all(); - } +#if ENABLE_CTRL_M_ON_WINDOWS + m_connected = true; +#endif // ENABLE_CTRL_M_ON_WINDOWS + } } } +#if ENABLE_CTRL_M_ON_WINDOWS +void Mouse3DController::device_detached(const std::string& device) +{ + m_connected = false; +} +#endif // ENABLE_CTRL_M_ON_WINDOWS + // Filter out mouse scroll events produced by the 3DConnexion driver. bool Mouse3DController::State::process_mouse_wheel() { @@ -863,6 +873,9 @@ bool Mouse3DController::handle_raw_input_win32(const unsigned char *data, const DataPacketRaw packet; memcpy(packet.data(), data, packet_length); handle_packet(packet, packet_length, m_params, m_state); +#if ENABLE_CTRL_M_ON_WINDOWS + m_connected = true; +#endif // ENABLE_CTRL_M_ON_WINDOWS } return true; diff --git a/src/slic3r/GUI/Mouse3DController.hpp b/src/slic3r/GUI/Mouse3DController.hpp index b3dce9f34..ba289e448 100644 --- a/src/slic3r/GUI/Mouse3DController.hpp +++ b/src/slic3r/GUI/Mouse3DController.hpp @@ -194,6 +194,9 @@ public: // Called by Win32 HID enumeration callback. void device_attached(const std::string &device); +#if ENABLE_CTRL_M_ON_WINDOWS + void device_detached(const std::string& device); +#endif // ENABLE_CTRL_M_ON_WINDOWS // On Windows, the 3DConnexion driver sends out mouse wheel rotation events to an active application // if the application does not register at the driver. This is a workaround to ignore these superfluous diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 3bdfa7b1c..f819702e4 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2016,7 +2016,12 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) // is one of the 3D Mouse vendors (3DConnexion or Logitech). this->q->Bind(EVT_HID_DEVICE_ATTACHED, [this](HIDDeviceAttachedEvent &evt) { mouse3d_controller.device_attached(evt.data); - }); + }); +#if ENABLE_CTRL_M_ON_WINDOWS + this->q->Bind(EVT_HID_DEVICE_DETACHED, [this](HIDDeviceAttachedEvent& evt) { + mouse3d_controller.device_detached(evt.data); + }); +#endif // ENABLE_CTRL_M_ON_WINDOWS #endif /* _WIN32 */ notification_manager = new NotificationManager(this->q);