mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-30 14:22:07 +00:00
FIX: fix can't enter ',' in multiplicator
github: #3805 Change-Id: I6dd70822d1c2e79d66c70514d6dd580ab029c7ea
This commit is contained in:
@@ -581,18 +581,21 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
|
|||||||
|
|
||||||
auto on_apply_text_modify = [this](wxEvent& e) {
|
auto on_apply_text_modify = [this](wxEvent& e) {
|
||||||
wxString str = m_flush_multiplier_ebox->GetValue();
|
wxString str = m_flush_multiplier_ebox->GetValue();
|
||||||
float multiplier = wxAtof(str);
|
str.Replace(",", ".");
|
||||||
if (multiplier < g_min_flush_multiplier || multiplier > g_max_flush_multiplier) {
|
double multiplier = 1.f;
|
||||||
str = wxString::Format(("%.2f"), multiplier < g_min_flush_multiplier ? g_min_flush_multiplier : g_max_flush_multiplier);
|
if (str.ToDouble(&multiplier)) {
|
||||||
m_flush_multiplier_ebox->SetValue(str);
|
if (multiplier < g_min_flush_multiplier || multiplier > g_max_flush_multiplier) {
|
||||||
MessageDialog dlg(nullptr,
|
str = wxString::Format(("%.2f"), multiplier < g_min_flush_multiplier ? g_min_flush_multiplier : g_max_flush_multiplier);
|
||||||
wxString::Format(_L("The multiplier should be in range [%.2f, %.2f]."), g_min_flush_multiplier, g_max_flush_multiplier),
|
m_flush_multiplier_ebox->SetValue(str);
|
||||||
_L("Warning"), wxICON_WARNING | wxOK);
|
MessageDialog dlg(nullptr,
|
||||||
dlg.ShowModal();
|
wxString::Format(_L("The multiplier should be in range [%.2f, %.2f]."), g_min_flush_multiplier, g_max_flush_multiplier),
|
||||||
}
|
_L("Warning"), wxICON_WARNING | wxOK);
|
||||||
for (unsigned int i = 0; i < m_number_of_extruders; ++i) {
|
dlg.ShowModal();
|
||||||
for (unsigned int j = 0; j < m_number_of_extruders; ++j) {
|
}
|
||||||
edit_boxes[i][j]->SetValue(to_string(int(m_matrix[m_number_of_extruders * j + i] * multiplier)));
|
for (unsigned int i = 0; i < m_number_of_extruders; ++i) {
|
||||||
|
for (unsigned int j = 0; j < m_number_of_extruders; ++j) {
|
||||||
|
edit_boxes[i][j]->SetValue(to_string(int(m_matrix[m_number_of_extruders * j + i] * multiplier)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -610,12 +613,25 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
|
|||||||
char flush_multi_str[32] = { 0 };
|
char flush_multi_str[32] = { 0 };
|
||||||
snprintf(flush_multi_str, sizeof(flush_multi_str), "%.2f", flush_multiplier);
|
snprintf(flush_multi_str, sizeof(flush_multi_str), "%.2f", flush_multiplier);
|
||||||
m_flush_multiplier_ebox->SetValue(flush_multi_str);
|
m_flush_multiplier_ebox->SetValue(flush_multi_str);
|
||||||
|
m_flush_multiplier_ebox->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
|
||||||
param_sizer->Add(m_flush_multiplier_ebox, 0, wxALIGN_CENTER | wxALL, 0);
|
param_sizer->Add(m_flush_multiplier_ebox, 0, wxALIGN_CENTER | wxALL, 0);
|
||||||
param_sizer->AddStretchSpacer(1);
|
param_sizer->AddStretchSpacer(1);
|
||||||
m_sizer_advanced->Add(param_sizer, 0, wxEXPAND | wxLEFT, TEXT_BEG_PADDING);
|
m_sizer_advanced->Add(param_sizer, 0, wxEXPAND | wxLEFT, TEXT_BEG_PADDING);
|
||||||
|
|
||||||
m_flush_multiplier_ebox->Bind(wxEVT_TEXT_ENTER, on_apply_text_modify);
|
m_flush_multiplier_ebox->Bind(wxEVT_TEXT_ENTER, on_apply_text_modify);
|
||||||
m_flush_multiplier_ebox->Bind(wxEVT_KILL_FOCUS, on_apply_text_modify);
|
m_flush_multiplier_ebox->Bind(wxEVT_KILL_FOCUS, on_apply_text_modify);
|
||||||
|
m_flush_multiplier_ebox->Bind(wxEVT_COMMAND_TEXT_UPDATED, [this](wxCommandEvent&) {
|
||||||
|
wxString str = m_flush_multiplier_ebox->GetValue();
|
||||||
|
str.Replace(",", ".");
|
||||||
|
double multiplier = 1.f;
|
||||||
|
if (str.ToDouble(&multiplier)) {
|
||||||
|
if (multiplier < g_min_flush_multiplier || multiplier > g_max_flush_multiplier) {
|
||||||
|
str = wxString::Format(("%.2f"), multiplier < g_min_flush_multiplier ? g_min_flush_multiplier : g_max_flush_multiplier);
|
||||||
|
m_flush_multiplier_ebox->SetValue(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_flush_multiplier_ebox->SetInsertionPointEnd();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this->update_warning_texts();
|
this->update_warning_texts();
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,12 @@ public:
|
|||||||
if (m_flush_multiplier_ebox == nullptr)
|
if (m_flush_multiplier_ebox == nullptr)
|
||||||
return 1.f;
|
return 1.f;
|
||||||
|
|
||||||
return std::atof(m_flush_multiplier_ebox->GetValue().c_str());
|
wxString str = m_flush_multiplier_ebox->GetValue();
|
||||||
|
str.Replace(",", ".");
|
||||||
|
double multiplier = 1.f;
|
||||||
|
str.ToDouble(&multiplier);
|
||||||
|
|
||||||
|
return multiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user