diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index 156fa4e50b..94040f0c76 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -1546,8 +1546,8 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj) else { // update speed this->speed_lvl = obj->printing_speed_lvl; - wxString text_speed = wxString::Format("%d%%", obj->printing_speed_mag); - m_switch_speed->SetLabels(text_speed, text_speed); + wxString text_speed = wxString::Format("%d%%", obj->printing_speed_mag); + m_switch_speed->SetLabels(text_speed, text_speed); } } @@ -2290,7 +2290,7 @@ void StatusPanel::on_switch_speed(wxCommandEvent &event) popUp->SetSizer(sizer); auto em = em_unit(this); popUp->SetSize(em * 36, em * 8); - + step->SetHint(_L("This only takes effect during printing")); step->AppendItem(_L("Silent"), ""); step->AppendItem(_L("Standard"), ""); step->AppendItem(_L("Sport"), ""); @@ -2306,6 +2306,11 @@ void StatusPanel::on_switch_speed(wxCommandEvent &event) } step->SelectItem(selected_item); + if (!obj->is_in_printing()) { + step->Bind(wxEVT_LEFT_DOWN, [](auto& e) { + return; }); + } + step->Bind(EVT_STEP_CHANGED, [this](auto &e) { this->speed_lvl = e.GetInt() + 1; if (obj) { diff --git a/src/slic3r/GUI/Widgets/StepCtrl.cpp b/src/slic3r/GUI/Widgets/StepCtrl.cpp index c52f47c30b..e64c9fb0fe 100644 --- a/src/slic3r/GUI/Widgets/StepCtrl.cpp +++ b/src/slic3r/GUI/Widgets/StepCtrl.cpp @@ -58,6 +58,10 @@ bool StepCtrlBase::SetTipFont(wxFont const& font) return true; } +void StepCtrlBase::SetHint(wxString hint) { + this->hint = hint; +} + int StepCtrlBase::AppendItem(const wxString &item, wxString const & tip) { steps.push_back(item); @@ -181,6 +185,12 @@ void StepCtrl::doRender(wxDC &dc) int circleY = size.y / 2; dc.SetPen(wxPen(clr_step.colorForStates(states))); dc.SetBrush(wxBrush(clr_step.colorForStates(states))); + if (!hint.empty()) { + dc.SetFont(font_tip); + dc.SetTextForeground(clr_tip.colorForStates(states)); + wxSize sz = dc.GetTextExtent(hint); + dc.DrawText(hint, dc.GetCharWidth(), circleY - FromDIP(20) - sz.y); + } for (int i = 0; i < steps.size(); ++i) { bool check = (pos_thumb == wxPoint{0, 0} ? step : pos_thumb.y) == i; dc.DrawEllipse(circleX - radius, circleY - radius, radius * 2, radius * 2); diff --git a/src/slic3r/GUI/Widgets/StepCtrl.hpp b/src/slic3r/GUI/Widgets/StepCtrl.hpp index 6fbba600c4..4986e39ca2 100644 --- a/src/slic3r/GUI/Widgets/StepCtrl.hpp +++ b/src/slic3r/GUI/Widgets/StepCtrl.hpp @@ -19,6 +19,7 @@ protected: std::vector steps; std::vector tips; + wxString hint; int step = -1; @@ -35,6 +36,8 @@ public: ~StepCtrlBase(); public: + void SetHint(wxString hint); + bool SetTipFont(wxFont const & font); public: