NEW:support multiple extruder new control

jira:[device page]

Change-Id: Idf68a3385172cbaa123cedb4e2b814c15cc09f07
(cherry picked from commit 7700b911a6fec782ce6b484b9b030963283a846c)
This commit is contained in:
tao wang
2024-12-03 21:49:35 +08:00
committed by Noisyfox
parent 6b093f11b6
commit f2598e0265
8 changed files with 184 additions and 75 deletions

View File

@@ -58,7 +58,7 @@ void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString
if (m_read_only) return;
// enter input mode
auto temp = text_ctrl->GetValue();
if (temp.length() > 0 && temp[0] == (0x5f)) {
if (temp.length() > 0 && temp[0] == (0x5f)) {
text_ctrl->SetValue(wxEmptyString);
}
if (wdialog != nullptr) { wdialog->Dismiss(); }
@@ -111,7 +111,7 @@ void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString
});
text_ctrl->Bind(wxEVT_RIGHT_DOWN, [this](auto &e) {}); // disable context menu
text_ctrl->Bind(wxEVT_LEFT_DOWN, [this](auto &e) {
if (m_read_only) {
if (m_read_only) {
return;
} else {
e.Skip();
@@ -145,6 +145,7 @@ void TempInput::SetFinish()
{
wxCommandEvent event(wxCUSTOMEVT_SET_TEMP_FINISH);
event.SetInt(temp_type);
event.SetString(wxString::Format("%d", m_input_type));
wxPostEvent(this->GetParent(), event);
}
@@ -165,26 +166,38 @@ wxString TempInput::erasePending(wxString &str)
void TempInput::SetTagTemp(int temp)
{
text_ctrl->SetValue(wxString::Format("%d", temp));
messureSize();
Refresh();
auto tp = wxString::Format("%d", temp);
if (text_ctrl->GetValue() != tp) {
text_ctrl->SetValue(tp);
messureSize();
Refresh();
}
}
void TempInput::SetTagTemp(wxString temp)
{
text_ctrl->SetValue(temp);
messureSize();
Refresh();
}
void TempInput::SetCurrTemp(int temp)
{
SetLabel(wxString::Format("%d", temp));
}
void TempInput::SetCurrTemp(wxString temp)
void TempInput::SetTagTemp(wxString temp)
{
SetLabel(temp);
if (text_ctrl->GetValue() != temp) {
text_ctrl->SetValue(temp);
messureSize();
Refresh();
}
}
void TempInput::SetCurrTemp(int temp)
{
auto tp = wxString::Format("%d", temp);
if (GetLabel() != tp) {
SetLabel(tp);
Refresh();
}
}
void TempInput::SetCurrTemp(wxString temp)
{
if (GetLabel() != temp) {
SetLabel(temp);
Refresh();
}
}
void TempInput::SetCurrType(TempInputType type) {
@@ -212,10 +225,10 @@ void TempInput::Warning(bool warn, WarningType type)
wxBoxSizer *sizer_text;
sizer_text = new wxBoxSizer(wxHORIZONTAL);
warning_text = new wxStaticText(body, wxID_ANY,
wxEmptyString,
warning_text = new wxStaticText(body, wxID_ANY,
wxEmptyString,
wxDefaultPosition, wxDefaultSize,
wxALIGN_CENTER_HORIZONTAL);
warning_text->SetFont(::Label::Body_12);
@@ -445,19 +458,19 @@ void TempInput::render(wxDC &dc)
auto text = wxWindow::GetLabel();
dc.SetFont(::Label::Head_14);
labelSize = dc.GetMultiLineTextExtent(wxWindow::GetLabel());
if (!IsEnabled()) {
dc.SetTextForeground(wxColour(0xAC, 0xAC, 0xAC));
dc.SetTextBackground(background_color.colorForStates((int) StateColor::Disabled));
}
}
else {
dc.SetTextForeground(wxColour(0x32, 0x3A, 0x3D));
dc.SetTextBackground(background_color.colorForStates((int) states));
}
/*if (!text.IsEmpty()) {
}*/
wxSize textSize = text_ctrl->GetSize();
if (align_right) {