Added SetLock() function for PrusaLockButton

This commit is contained in:
YuSanka 2019-01-09 08:48:25 +01:00
parent ab810f4b16
commit 6d7e2b2dd7
4 changed files with 15 additions and 2 deletions

View File

@ -172,6 +172,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
event.Skip(); event.Skip();
wxTheApp->CallAfter([btn, this]() { set_uniform_scaling(btn->IsLocked()); }); wxTheApp->CallAfter([btn, this]() { set_uniform_scaling(btn->IsLocked()); });
}); });
m_lock_bnt = btn;
return btn; return btn;
}; };
} }
@ -399,8 +400,11 @@ void ObjectManipulation::update_if_dirty()
m_cache.rotation = m_new_rotation; m_cache.rotation = m_new_rotation;
// if (wxGetApp().plater()->canvas3D()->get_selection().requires_uniform_scale()) if (wxGetApp().plater()->canvas3D()->get_selection().requires_uniform_scale()) {
// m_uniform_scale = true; // m_uniform_scale = true;
m_lock_bnt->SetLock(true);
// m_lock_bnt->Disable();
}
if (m_new_enabled) if (m_new_enabled)
m_og->enable(); m_og->enable();

View File

@ -7,6 +7,7 @@
#include "GLCanvas3D.hpp" #include "GLCanvas3D.hpp"
class wxStaticText; class wxStaticText;
class PrusaLockButton;
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
@ -75,6 +76,7 @@ class ObjectManipulation : public OG_Settings
Vec3d m_new_size; Vec3d m_new_size;
bool m_new_enabled; bool m_new_enabled;
bool m_uniform_scale {false}; bool m_uniform_scale {false};
PrusaLockButton* m_lock_bnt{ nullptr };
public: public:
ObjectManipulation(wxWindow* parent); ObjectManipulation(wxWindow* parent);

View File

@ -2216,6 +2216,12 @@ void PrusaLockButton::OnButton(wxCommandEvent& event)
event.Skip(); event.Skip();
} }
void PrusaLockButton::SetLock(bool lock)
{
m_is_pushed = lock;
enter_button(true);
}
void PrusaLockButton::enter_button(const bool enter) void PrusaLockButton::enter_button(const bool enter)
{ {
wxBitmap* icon = m_is_pushed ? wxBitmap* icon = m_is_pushed ?

View File

@ -851,6 +851,7 @@ public:
void OnLeaveBtn(wxMouseEvent& event) { enter_button(false); 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);
protected: protected:
void enter_button(const bool enter); void enter_button(const bool enter);