FIX:fixed ams setting button display error due to scaling

Change-Id: I810b9f75410d15b16851ec31e710d037d2fba1d6
This commit is contained in:
tao wang 2022-11-29 16:57:58 +08:00 committed by Lane.Wei
parent 5afc02ee72
commit a9f3f195e1
2 changed files with 20 additions and 11 deletions

View file

@ -1573,10 +1573,14 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons
m_simplebook_right->AddPage(m_filament_load_step, wxEmptyString, false);
m_simplebook_right->AddPage(m_filament_unload_step, wxEmptyString, false);
m_button_ams_setting_normal = ScalableBitmap(this, "ams_setting_normal", 24);
m_button_ams_setting_hover = ScalableBitmap(this, "ams_setting_hover", 24);
m_button_ams_setting_press = ScalableBitmap(this, "ams_setting_press", 24);
wxBoxSizer *m_sizer_right_bottom = new wxBoxSizer(wxHORIZONTAL);
m_button_ams_setting = new Button(m_amswin, "", "ams_setting_normal", wxBORDER_NONE, FromDIP(24));
m_button_ams_setting->SetPaddingSize(wxSize(0, 0));
m_button_ams_setting->SetBackgroundColor(m_amswin->GetBackgroundColour());
m_button_ams_setting = new wxStaticBitmap(m_amswin, wxID_ANY, m_button_ams_setting_normal.bmp(), wxDefaultPosition, wxSize(FromDIP(24), FromDIP(24)));
m_button_ams_setting->SetBackgroundColour(m_amswin->GetBackgroundColour());
m_button_guide = new Button(m_amswin, _L("Guide"));
m_button_guide->SetFont(Label::Body_13);
@ -1685,20 +1689,22 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons
m_button_extruder_feed->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AMSControl::on_filament_load), NULL, this);
m_button_extruder_back->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AMSControl::on_filament_unload), NULL, this);
m_button_ams_setting->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AMSControl::on_ams_setting_click), NULL, this);
m_button_ams_setting->Bind(wxEVT_LEFT_DOWN, &AMSControl::on_ams_setting_click, this);
m_button_ams_setting->Bind(wxEVT_ENTER_WINDOW, [this](wxMouseEvent& e) {
m_button_ams_setting->SetIcon("ams_setting_hover");
m_button_ams_setting->SetBitmap(m_button_ams_setting_hover.bmp());
e.Skip();
});
m_button_ams_setting->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
m_button_ams_setting->SetIcon("ams_setting_press");
m_button_ams_setting->SetBitmap(m_button_ams_setting_press.bmp());
e.Skip();
});
m_button_ams_setting->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent&e) {
m_button_ams_setting->SetIcon("ams_setting_normal");
m_button_ams_setting->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) {
m_button_ams_setting->SetBitmap(m_button_ams_setting_normal.bmp());
e.Skip();
});
m_button_guide->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {
post_event(wxCommandEvent(EVT_AMS_GUIDE_WIKI));
});
@ -2175,7 +2181,7 @@ void AMSControl::on_filament_unload(wxCommandEvent &event)
post_event(SimpleEvent(EVT_AMS_UNLOAD));
}
void AMSControl::on_ams_setting_click(wxCommandEvent &event)
void AMSControl::on_ams_setting_click(wxMouseEvent &event)
{
post_event(SimpleEvent(EVT_AMS_SETTINGS));
}

View file

@ -478,7 +478,10 @@ protected:
Button *m_button_extruder_feed = {nullptr};
Button *m_button_extruder_back = {nullptr};
Button* m_button_ams_setting = {nullptr};
wxStaticBitmap* m_button_ams_setting = {nullptr};
ScalableBitmap m_button_ams_setting_normal;
ScalableBitmap m_button_ams_setting_hover;
ScalableBitmap m_button_ams_setting_press;
Button *m_button_guide = {nullptr};
Button *m_button_retry = {nullptr};
@ -516,7 +519,7 @@ public:
void msw_rescale();
void on_filament_load(wxCommandEvent &event);
void on_filament_unload(wxCommandEvent &event);
void on_ams_setting_click(wxCommandEvent &event);
void on_ams_setting_click(wxMouseEvent &event);
void on_clibration_again_click(wxMouseEvent &event);
void on_clibration_cancel_click(wxMouseEvent &event);
void Reset();