diff --git a/resources/icons/lock_closed_f.svg b/resources/icons/lock_closed_f.svg new file mode 100644 index 000000000..2920ea0aa --- /dev/null +++ b/resources/icons/lock_closed_f.svg @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/resources/icons/lock_open_f.svg b/resources/icons/lock_open_f.svg new file mode 100644 index 000000000..9440d9266 --- /dev/null +++ b/resources/icons/lock_open_f.svg @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 9f36eceb9..e85de5cc2 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -2743,21 +2743,20 @@ LockButton::LockButton( wxWindow *parent, const wxSize& size /*= wxDefaultSize*/): wxButton(parent, id, wxEmptyString, pos, size, wxBU_EXACTFIT | wxNO_BORDER) { - m_bmp_lock_on = ScalableBitmap(this, "one_layer_lock_on.png"); - m_bmp_lock_off = ScalableBitmap(this, "one_layer_lock_off.png"); - m_bmp_unlock_on = ScalableBitmap(this, "one_layer_unlock_on.png"); - m_bmp_unlock_off = ScalableBitmap(this, "one_layer_unlock_off.png"); + m_bmp_lock_closed = ScalableBitmap(this, "lock_closed"); + m_bmp_lock_closed_f = ScalableBitmap(this, "lock_closed_f"); + m_bmp_lock_open = ScalableBitmap(this, "lock_open"); + m_bmp_lock_open_f = ScalableBitmap(this, "lock_open_f"); #ifdef __WXMSW__ SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); #endif // __WXMSW__ - SetBitmap(m_bmp_unlock_on.bmp()); - SetBitmapDisabled(m_bmp_lock_on.bmp()); + SetBitmap(m_bmp_lock_open.bmp()); + SetBitmapDisabled(m_bmp_lock_open.bmp()); + SetBitmapHover(m_bmp_lock_closed_f.bmp()); //button events - Bind(wxEVT_BUTTON, &LockButton::OnButton, this); - Bind(wxEVT_ENTER_WINDOW, &LockButton::OnEnterBtn, this); - Bind(wxEVT_LEAVE_WINDOW, &LockButton::OnLeaveBtn, this); + Bind(wxEVT_BUTTON, &LockButton::OnButton, this); } void LockButton::OnButton(wxCommandEvent& event) @@ -2766,7 +2765,7 @@ void LockButton::OnButton(wxCommandEvent& event) return; m_is_pushed = !m_is_pushed; - enter_button(true); + update_button_bitmaps(); event.Skip(); } @@ -2774,23 +2773,21 @@ void LockButton::OnButton(wxCommandEvent& event) void LockButton::SetLock(bool lock) { m_is_pushed = lock; - enter_button(true); + update_button_bitmaps(); } void LockButton::msw_rescale() { - m_bmp_lock_on .msw_rescale(); - m_bmp_lock_off .msw_rescale(); - m_bmp_unlock_on .msw_rescale(); - m_bmp_unlock_off.msw_rescale(); + m_bmp_lock_closed.msw_rescale(); + m_bmp_lock_closed_f.msw_rescale(); + m_bmp_lock_open.msw_rescale(); + m_bmp_lock_open_f.msw_rescale(); } -void LockButton::enter_button(const bool enter) +void LockButton::update_button_bitmaps() { - const wxBitmap& icon = m_is_pushed ? - enter ? m_bmp_lock_off.bmp() : m_bmp_lock_on.bmp() : - enter ? m_bmp_unlock_off.bmp() : m_bmp_unlock_on.bmp(); - SetBitmap(icon); + SetBitmap(m_is_pushed ? m_bmp_lock_closed.bmp() : m_bmp_lock_open.bmp()); + SetBitmapHover(m_is_pushed ? m_bmp_lock_closed_f.bmp() : m_bmp_lock_open_f.bmp()); Refresh(); Update(); diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index d7d5fcac2..6d8d23aec 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -843,8 +843,6 @@ public: ~LockButton() {} void OnButton(wxCommandEvent& event); - 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; } void SetLock(bool lock); @@ -856,16 +854,16 @@ public: void msw_rescale(); protected: - void enter_button(const bool enter); + void update_button_bitmaps(); private: bool m_is_pushed = false; bool m_disabled = false; - ScalableBitmap m_bmp_lock_on; - ScalableBitmap m_bmp_lock_off; - ScalableBitmap m_bmp_unlock_on; - ScalableBitmap m_bmp_unlock_off; + ScalableBitmap m_bmp_lock_closed; + ScalableBitmap m_bmp_lock_closed_f; + ScalableBitmap m_bmp_lock_open; + ScalableBitmap m_bmp_lock_open_f; };