mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 03:07:55 -06:00
FIX:speed ctrl in device
1.the speed ctrl shouldn't open popup when the printer is in idle status. 2.add tooltip Change-Id: I3b0b4c58ef1c1961835ee2e06b2e7f3cccb53428
This commit is contained in:
parent
b025de8746
commit
e6f0c5abec
3 changed files with 21 additions and 3 deletions
|
@ -2290,7 +2290,7 @@ void StatusPanel::on_switch_speed(wxCommandEvent &event)
|
||||||
popUp->SetSizer(sizer);
|
popUp->SetSizer(sizer);
|
||||||
auto em = em_unit(this);
|
auto em = em_unit(this);
|
||||||
popUp->SetSize(em * 36, em * 8);
|
popUp->SetSize(em * 36, em * 8);
|
||||||
|
step->SetHint(_L("This only takes effect during printing"));
|
||||||
step->AppendItem(_L("Silent"), "");
|
step->AppendItem(_L("Silent"), "");
|
||||||
step->AppendItem(_L("Standard"), "");
|
step->AppendItem(_L("Standard"), "");
|
||||||
step->AppendItem(_L("Sport"), "");
|
step->AppendItem(_L("Sport"), "");
|
||||||
|
@ -2306,6 +2306,11 @@ void StatusPanel::on_switch_speed(wxCommandEvent &event)
|
||||||
}
|
}
|
||||||
step->SelectItem(selected_item);
|
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) {
|
step->Bind(EVT_STEP_CHANGED, [this](auto &e) {
|
||||||
this->speed_lvl = e.GetInt() + 1;
|
this->speed_lvl = e.GetInt() + 1;
|
||||||
if (obj) {
|
if (obj) {
|
||||||
|
|
|
@ -58,6 +58,10 @@ bool StepCtrlBase::SetTipFont(wxFont const& font)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StepCtrlBase::SetHint(wxString hint) {
|
||||||
|
this->hint = hint;
|
||||||
|
}
|
||||||
|
|
||||||
int StepCtrlBase::AppendItem(const wxString &item, wxString const & tip)
|
int StepCtrlBase::AppendItem(const wxString &item, wxString const & tip)
|
||||||
{
|
{
|
||||||
steps.push_back(item);
|
steps.push_back(item);
|
||||||
|
@ -181,6 +185,12 @@ void StepCtrl::doRender(wxDC &dc)
|
||||||
int circleY = size.y / 2;
|
int circleY = size.y / 2;
|
||||||
dc.SetPen(wxPen(clr_step.colorForStates(states)));
|
dc.SetPen(wxPen(clr_step.colorForStates(states)));
|
||||||
dc.SetBrush(wxBrush(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) {
|
for (int i = 0; i < steps.size(); ++i) {
|
||||||
bool check = (pos_thumb == wxPoint{0, 0} ? step : pos_thumb.y) == i;
|
bool check = (pos_thumb == wxPoint{0, 0} ? step : pos_thumb.y) == i;
|
||||||
dc.DrawEllipse(circleX - radius, circleY - radius, radius * 2, radius * 2);
|
dc.DrawEllipse(circleX - radius, circleY - radius, radius * 2, radius * 2);
|
||||||
|
|
|
@ -19,6 +19,7 @@ protected:
|
||||||
|
|
||||||
std::vector<wxString> steps;
|
std::vector<wxString> steps;
|
||||||
std::vector<wxString> tips;
|
std::vector<wxString> tips;
|
||||||
|
wxString hint;
|
||||||
|
|
||||||
int step = -1;
|
int step = -1;
|
||||||
|
|
||||||
|
@ -35,6 +36,8 @@ public:
|
||||||
~StepCtrlBase();
|
~StepCtrlBase();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void SetHint(wxString hint);
|
||||||
|
|
||||||
bool SetTipFont(wxFont const & font);
|
bool SetTipFont(wxFont const & font);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue