From dd0ccfb6e974309baa595cabc8b7c606114bf28d Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Mon, 5 Sep 2022 17:24:32 +0800 Subject: [PATCH] FIX: StaticBox background color Change-Id: Ifbb0bc4ac3e0a69675f16dc3234b4190fff698fb --- src/slic3r/GUI/Widgets/StaticBox.cpp | 5 ++++- src/slic3r/GUI/Widgets/StepCtrl.cpp | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Widgets/StaticBox.cpp b/src/slic3r/GUI/Widgets/StaticBox.cpp index e98d931c5..538a81224 100644 --- a/src/slic3r/GUI/Widgets/StaticBox.cpp +++ b/src/slic3r/GUI/Widgets/StaticBox.cpp @@ -169,7 +169,10 @@ void StaticBox::doRender(wxDC& dc) } else { dc.SetPen(wxPen(background_color.colorForStates(states))); } - dc.SetBrush(wxBrush(background_color.colorForStates(states))); + if (background_color.count() > 0) + dc.SetBrush(wxBrush(background_color.colorForStates(states))); + else + dc.SetBrush(wxBrush(GetBackgroundColour())); if (radius == 0) { dc.DrawRectangle(rc); } diff --git a/src/slic3r/GUI/Widgets/StepCtrl.cpp b/src/slic3r/GUI/Widgets/StepCtrl.cpp index 44847c840..c52f47c30 100644 --- a/src/slic3r/GUI/Widgets/StepCtrl.cpp +++ b/src/slic3r/GUI/Widgets/StepCtrl.cpp @@ -144,7 +144,13 @@ void StepCtrl::mouseMove(wxMouseEvent &event) wxPoint pt; event.GetPosition(&pt.x, &pt.y); pos_thumb.x = pt.x + drag_offset.x; - Refresh(); + wxSize size = GetSize(); + int itemWidth = size.x / steps.size(); + int index = pos_thumb.x / itemWidth; + if (index != pos_thumb.y) { + pos_thumb.y = index; + Refresh(); + } } void StepCtrl::mouseUp(wxMouseEvent &event) @@ -160,7 +166,6 @@ void StepCtrl::mouseUp(wxMouseEvent &event) void StepCtrl::doRender(wxDC &dc) { if (steps.empty()) return; - StaticBox::doRender(dc); wxSize size = GetSize(); @@ -177,7 +182,7 @@ void StepCtrl::doRender(wxDC &dc) dc.SetPen(wxPen(clr_step.colorForStates(states))); dc.SetBrush(wxBrush(clr_step.colorForStates(states))); for (int i = 0; i < steps.size(); ++i) { - bool check = pos_thumb == wxPoint{0, 0} ? step == i : (pos_thumb.x >= circleX - itemWidth / 2 && pos_thumb.x < circleX + itemWidth / 2); + bool check = (pos_thumb == wxPoint{0, 0} ? step : pos_thumb.y) == i; dc.DrawEllipse(circleX - radius, circleY - radius, radius * 2, radius * 2); dc.SetFont(GetFont()); dc.SetTextForeground(clr_text.colorForStates(states | (check ? StateColor::Checked : 0)));