From 0c01d7b3e0224f745b249e8d8dbe1990f3b407bc Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Thu, 16 Jan 2025 16:12:21 +0800 Subject: [PATCH] FIX: switch_diameter in sync Change-Id: Iff7c654ef932f36b9c3cb4267e4ea90b8074c9c2 Jira: STUDIO-9744 --- src/slic3r/GUI/Plater.cpp | 8 +++++++- src/slic3r/GUI/Widgets/StaticGroup.cpp | 9 +++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 62d3ad047..066aa5dac 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -912,7 +912,11 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title //label_ams->SetMinSize({FromDIP(70), -1}); if (index >= 0) { btn_edit = new ScalableButton(this, wxID_ANY, "dot"); +#ifdef __WXOSX__ + btn_edit->SetBackgroundColour("#F7F7F7"); +#else btn_edit->SetBackgroundColour(*wxWHITE); +#endif btn_edit->Hide(); btn_edit->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this, index](auto &evt) { PopupWindow *window = new AMSCountPopupWindow(this, index); @@ -1194,7 +1198,9 @@ bool Sidebar::priv::sync_extruder_list() left_extruder->combo_diameter->SetSelection(get_diameter_index(nozzle_diameters[0])); right_extruder->combo_diameter->SetSelection(get_diameter_index(nozzle_diameters[1])); + is_switching_diameter = true; switch_diameter(false); + is_switching_diameter = false; AMSCountPopupWindow::SetAMSCount(deputy_index, deputy_4, deputy_1); AMSCountPopupWindow::SetAMSCount(main_index, main_4, main_1); AMSCountPopupWindow::UpdateAMSCount(0, left_extruder); @@ -1630,7 +1636,7 @@ Sidebar::Sidebar(Plater *parent) auto switch_diameter = [this](wxCommandEvent & evt) { auto extruder = dynamic_cast(dynamic_cast(evt.GetEventObject())->GetParent()); p->is_switching_diameter = true; - auto result = p->switch_diameter(extruder == p->single_extruder); + p->switch_diameter(extruder == p->single_extruder); p->is_switching_diameter = false; }; p->left_extruder->combo_diameter->Bind(wxEVT_COMBOBOX, switch_diameter); diff --git a/src/slic3r/GUI/Widgets/StaticGroup.cpp b/src/slic3r/GUI/Widgets/StaticGroup.cpp index 6d40690f6..297c599f3 100644 --- a/src/slic3r/GUI/Widgets/StaticGroup.cpp +++ b/src/slic3r/GUI/Widgets/StaticGroup.cpp @@ -43,10 +43,11 @@ void StaticGroup::PaintForeground(wxDC &dc, const struct tagRECT &rc) int right = rc.right - 1; int bottom = rc.bottom - 1; auto blue = GetBackgroundColour().Blue(); - while (image.GetBlue(0, top) == blue) ++top; - while (image.GetBlue(left, top) != blue) ++left; // --left; // fix start - while (image.GetBlue(right, top) != blue) --right; ++right; - while (image.GetBlue(0, bottom) == blue) --bottom; + while (image.GetBlue(0, top) == blue && top < bottom) ++top; + while (image.GetBlue(left, top) != blue && left < right) ++left; // --left; // fix start + while (image.GetBlue(right, top) != blue && right > 0) --right; + ++right; + while (image.GetBlue(0, bottom) == blue && bottom > 0) --bottom; // Draw border with foreground color wxPoint polygon[] = { {left, top}, {0, top}, {0, bottom}, {rc.right - 1, bottom}, {rc.right - 1, top}, {right, top} }; dc.SetPen(wxPen(GetForegroundColour(), 1));