From 6d7e2b2dd76348b49c54f51be66ebc36ac8617a6 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 9 Jan 2019 08:48:25 +0100 Subject: [PATCH] Added SetLock() function for PrusaLockButton --- src/slic3r/GUI/GUI_ObjectManipulation.cpp | 8 ++++++-- src/slic3r/GUI/GUI_ObjectManipulation.hpp | 2 ++ src/slic3r/GUI/wxExtensions.cpp | 6 ++++++ src/slic3r/GUI/wxExtensions.hpp | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp index 84025bae0..17371ccf6 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp @@ -172,6 +172,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) : event.Skip(); wxTheApp->CallAfter([btn, this]() { set_uniform_scaling(btn->IsLocked()); }); }); + m_lock_bnt = btn; return btn; }; } @@ -399,8 +400,11 @@ void ObjectManipulation::update_if_dirty() m_cache.rotation = m_new_rotation; -// if (wxGetApp().plater()->canvas3D()->get_selection().requires_uniform_scale()) -// m_uniform_scale = true; + if (wxGetApp().plater()->canvas3D()->get_selection().requires_uniform_scale()) { +// m_uniform_scale = true; + m_lock_bnt->SetLock(true); +// m_lock_bnt->Disable(); + } if (m_new_enabled) m_og->enable(); diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.hpp b/src/slic3r/GUI/GUI_ObjectManipulation.hpp index 57eb93b71..d0afa528e 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.hpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.hpp @@ -7,6 +7,7 @@ #include "GLCanvas3D.hpp" class wxStaticText; +class PrusaLockButton; namespace Slic3r { namespace GUI { @@ -75,6 +76,7 @@ class ObjectManipulation : public OG_Settings Vec3d m_new_size; bool m_new_enabled; bool m_uniform_scale {false}; + PrusaLockButton* m_lock_bnt{ nullptr }; public: ObjectManipulation(wxWindow* parent); diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 466580074..9ffa649cc 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -2216,6 +2216,12 @@ void PrusaLockButton::OnButton(wxCommandEvent& event) event.Skip(); } +void PrusaLockButton::SetLock(bool lock) +{ + m_is_pushed = lock; + enter_button(true); +} + void PrusaLockButton::enter_button(const bool enter) { wxBitmap* icon = m_is_pushed ? diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index b951c5635..b6f7a4220 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -851,6 +851,7 @@ public: void OnLeaveBtn(wxMouseEvent& event) { enter_button(false); event.Skip(); } bool IsLocked() const { return m_is_pushed; } + void SetLock(bool lock); protected: void enter_button(const bool enter);