From 8ad5bdb914a2858f5014e6e272e55009ee30b0d7 Mon Sep 17 00:00:00 2001 From: "liz.li" Date: Sat, 10 Dec 2022 15:11:35 +0800 Subject: [PATCH] FIX: fix ams_dialog filament color button display Change-Id: Id02b8e1d703e11006318fa4140393481ff9f5108 --- src/slic3r/GUI/AMSMaterialsSetting.cpp | 19 +++++++++---------- src/slic3r/GUI/AMSMaterialsSetting.hpp | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/slic3r/GUI/AMSMaterialsSetting.cpp b/src/slic3r/GUI/AMSMaterialsSetting.cpp index 99b1d0f4e..f509a2681 100644 --- a/src/slic3r/GUI/AMSMaterialsSetting.cpp +++ b/src/slic3r/GUI/AMSMaterialsSetting.cpp @@ -64,13 +64,12 @@ void AMSMaterialsSetting::create() m_clrData->SetChooseFull(true); m_clrData->SetChooseAlpha(false); - m_clr_picker = new wxButton(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,wxBU_AUTODRAW); + m_clr_picker = new Button(this, "", ""); m_clr_picker->SetCanFocus(false); m_clr_picker->SetSize(FromDIP(50), FromDIP(25)); m_clr_picker->SetMinSize(wxSize(FromDIP(50), FromDIP(25))); - //m_clr_picker->SetCornerRadius(FromDIP(6)); - //m_clr_picker->SetBorderColor(wxColour(172, 172, 172)); - m_clr_picker->SetBackgroundColour(StateColor::darkModeColorFor(*wxWHITE)); + m_clr_picker->SetCornerRadius(FromDIP(6)); + m_clr_picker->SetBorderColor(wxColour(172, 172, 172)); m_clr_picker->Bind(wxEVT_BUTTON, &AMSMaterialsSetting::on_clr_picker, this); m_sizer_colour->Add(m_clr_picker, 0, 0, 0); @@ -235,16 +234,16 @@ void AMSMaterialsSetting::create() SetSizer(m_sizer_main); Layout(); Fit(); - - Bind(wxEVT_PAINT, &AMSMaterialsSetting::paintEvent, this); - COMBOBOX_FILAMENT->Connect(wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler(AMSMaterialsSetting::on_select_filament), NULL, this); + + Bind(wxEVT_PAINT, &AMSMaterialsSetting::paintEvent, this); + COMBOBOX_FILAMENT->Connect(wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler(AMSMaterialsSetting::on_select_filament), NULL, this); } void AMSMaterialsSetting::paintEvent(wxPaintEvent &evt) { auto size = GetSize(); wxPaintDC dc(this); - dc.SetPen(wxPen(StateColor::darkModeColorFor(wxColour(38, 46, 48)), 1, wxSOLID)); + dc.SetPen(wxPen(StateColor::darkModeColorFor(wxColour("#000000")), 1, wxSOLID)); dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH)); dc.DrawRectangle(0, 0, size.x, size.y); } @@ -365,7 +364,7 @@ void AMSMaterialsSetting::on_clr_picker(wxCommandEvent & event) show_flag = true; if (clr_dialog->ShowModal() == wxID_OK) { m_clrData = &(clr_dialog->GetColourData()); - m_clr_picker->SetBackgroundColour(m_clrData->GetColour()); + m_clr_picker->SetBackgroundColor(m_clrData->GetColour()); } } @@ -381,7 +380,7 @@ bool AMSMaterialsSetting::Show(bool show) void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_min, wxString temp_max) { - m_clr_picker->SetBackgroundColour(m_clrData->GetColour()); + m_clr_picker->SetBackgroundColor(m_clrData->GetColour()); if (!m_is_third) { m_button_confirm->Hide(); diff --git a/src/slic3r/GUI/AMSMaterialsSetting.hpp b/src/slic3r/GUI/AMSMaterialsSetting.hpp index 386e8dd76..8b950bf8e 100644 --- a/src/slic3r/GUI/AMSMaterialsSetting.hpp +++ b/src/slic3r/GUI/AMSMaterialsSetting.hpp @@ -83,7 +83,7 @@ protected: Button * m_button_confirm; wxStaticText* m_tip_readonly; Button * m_button_close; - wxButton * m_clr_picker; + Button * m_clr_picker; wxColourData * m_clrData; #ifdef __APPLE__ wxComboBox *m_comboBox_filament_mac;