From fe395546f0cec0aa6fd6c5333f71c73b812ea56c Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 20 Jun 2019 12:56:23 +0200 Subject: [PATCH] Added "info" tooltip for a LockButton on Manipulation panel (#2539) --- src/slic3r/GUI/GUI_ObjectManipulation.cpp | 6 ++++-- src/slic3r/GUI/wxExtensions.cpp | 3 +++ src/slic3r/GUI/wxExtensions.hpp | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp index 310000ecc..372cd79ef 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp @@ -499,11 +499,13 @@ void ObjectManipulation::update_if_dirty() if (selection.requires_uniform_scale()) { m_lock_bnt->SetLock(true); - m_lock_bnt->Disable(); + m_lock_bnt->SetToolTip(_(L("You cann't use non-uniform scaling mode for multiple objects/parts selection"))); + m_lock_bnt->disable(); } else { m_lock_bnt->SetLock(m_uniform_scale); - m_lock_bnt->Enable(); + m_lock_bnt->SetToolTip(wxEmptyString); + m_lock_bnt->enable(); } { diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 7b7178a82..406daccf5 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -2472,6 +2472,9 @@ LockButton::LockButton( wxWindow *parent, void LockButton::OnButton(wxCommandEvent& event) { + if (m_disabled) + return; + m_is_pushed = !m_is_pushed; enter_button(true); diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index c496c28a0..dd035690a 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -838,9 +838,13 @@ public: void OnEnterBtn(wxMouseEvent& event) { enter_button(true); event.Skip(); } void OnLeaveBtn(wxMouseEvent& event) { enter_button(false); event.Skip(); } - bool IsLocked() const { return m_is_pushed; } + bool IsLocked() const { return m_is_pushed; } void SetLock(bool lock); + // create its own Enable/Disable functions to not really disabled button because of tooltip enabling + void enable() { m_disabled = false; } + void disable() { m_disabled = true; } + void msw_rescale(); protected: @@ -848,6 +852,7 @@ protected: private: bool m_is_pushed = false; + bool m_disabled = false; ScalableBitmap m_bmp_lock_on; ScalableBitmap m_bmp_lock_off;