mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 03:07:55 -06:00
Parameter "G-code thumbnails": check value for the out of range
This commit is contained in:
parent
2d711d8646
commit
90248bffa5
1 changed files with 16 additions and 3 deletions
|
@ -322,6 +322,7 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
|
||||||
str.Replace(" ", wxEmptyString, true);
|
str.Replace(" ", wxEmptyString, true);
|
||||||
if (!str.IsEmpty()) {
|
if (!str.IsEmpty()) {
|
||||||
bool invalid_val = false;
|
bool invalid_val = false;
|
||||||
|
bool out_of_range_val = false;
|
||||||
wxStringTokenizer thumbnails(str, ",");
|
wxStringTokenizer thumbnails(str, ",");
|
||||||
while (thumbnails.HasMoreTokens()) {
|
while (thumbnails.HasMoreTokens()) {
|
||||||
wxString token = thumbnails.GetNextToken();
|
wxString token = thumbnails.GetNextToken();
|
||||||
|
@ -332,8 +333,12 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
|
||||||
if (x_str.ToDouble(&x) && thumbnail.HasMoreTokens()) {
|
if (x_str.ToDouble(&x) && thumbnail.HasMoreTokens()) {
|
||||||
wxString y_str = thumbnail.GetNextToken();
|
wxString y_str = thumbnail.GetNextToken();
|
||||||
if (y_str.ToDouble(&y) && !thumbnail.HasMoreTokens()) {
|
if (y_str.ToDouble(&y) && !thumbnail.HasMoreTokens()) {
|
||||||
out_values.push_back(Vec2d(x, y));
|
if (0 < x && x < 1000 && 0 < y && y < 1000) {
|
||||||
continue;
|
out_values.push_back(Vec2d(x, y));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
out_of_range_val = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,7 +346,15 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (invalid_val) {
|
if (out_of_range_val) {
|
||||||
|
wxString text_value;
|
||||||
|
if (!m_value.empty())
|
||||||
|
text_value = get_thumbnails_string(boost::any_cast<std::vector<Vec2d>>(m_value));
|
||||||
|
set_value(text_value, true);
|
||||||
|
show_error(m_parent, _L("Input value is out of range")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (invalid_val) {
|
||||||
wxString text_value;
|
wxString text_value;
|
||||||
if (!m_value.empty())
|
if (!m_value.empty())
|
||||||
text_value = get_thumbnails_string(boost::any_cast<std::vector<Vec2d>>(m_value));
|
text_value = get_thumbnails_string(boost::any_cast<std::vector<Vec2d>>(m_value));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue