From 66eb27cfaa8901149985eb2b22abc0a8b3ad4e44 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 (cherry picked from commit 0c01d7b3e0224f745b249e8d8dbe1990f3b407bc) --- 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 051c28e388..9ae85e7933 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1001,7 +1001,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); @@ -1300,7 +1304,9 @@ bool Sidebar::priv::sync_extruder_list(bool &only_external_material) 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); @@ -1751,7 +1757,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 4f4f24a75a..5b9e1ecd94 100644 --- a/src/slic3r/GUI/Widgets/StaticGroup.cpp +++ b/src/slic3r/GUI/Widgets/StaticGroup.cpp @@ -61,10 +61,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(borderColor_, 1));