mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-16 03:05:57 +08:00
#183 allow min for floatAndPercent fields
Have to modify the Fields.cpp function a bit. May need a better patch later on, as this one is only for min. Also, the current checks for float&percent are very strange.
This commit is contained in:
parent
f636d0cbfc
commit
5205598cf7
@ -2934,12 +2934,7 @@ void PrintConfigDef::init_fff_params()
|
||||
"for the first object layer. Can be a % of the extruding width used for the interface layers.");
|
||||
def->ratio_over = "top_infill_extrusion_width";
|
||||
def->sidetext = L("mm");
|
||||
def->enum_labels.push_back((boost::format("0.2 (%1%)") % L("detachable")).str());
|
||||
def->min = 0;
|
||||
def->enum_values.push_back("0");
|
||||
def->enum_values.push_back("0.2");
|
||||
def->enum_labels.push_back(L("0 (soluble)"));
|
||||
def->enum_labels.push_back(L("0.2 (detachable)"));
|
||||
def->mode = comAdvanced;
|
||||
def->aliases = { "support_material_contact_distance" };
|
||||
def->set_default_value(new ConfigOptionFloatOrPercent(0.2, false));
|
||||
|
@ -225,8 +225,19 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
|
||||
}
|
||||
show_error(m_parent, _(L("Invalid numeric input.")));
|
||||
set_value(double_to_string(val), true);
|
||||
} else {
|
||||
|
||||
//at least check min, as we can want a 0 min
|
||||
if (m_opt.min > val)
|
||||
{
|
||||
if (!check_value) {
|
||||
m_value.clear();
|
||||
break;
|
||||
}
|
||||
else if (((m_opt.sidetext.rfind("mm/s") != std::string::npos && val > m_opt.max) ||
|
||||
show_error(m_parent, _(L("Input value is out of range")));
|
||||
if (m_opt.min > val) val = m_opt.min;
|
||||
set_value(double_to_string(val), true);
|
||||
} else if (((m_opt.sidetext.rfind("mm/s") != std::string::npos && val > m_opt.max) ||
|
||||
(m_opt.sidetext.rfind("mm ") != std::string::npos && val > 1)) &&
|
||||
(m_value.empty() || std::string(str.ToUTF8().data()) != boost::any_cast<std::string>(m_value)))
|
||||
{
|
||||
@ -244,11 +255,11 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
|
||||
if (dialog.ShowModal() == wxID_YES) {
|
||||
set_value(from_u8((boost::format("%s%%") % stVal).str()), false/*true*/);
|
||||
str += "%%";
|
||||
}
|
||||
else
|
||||
} else
|
||||
set_value(stVal, false); // it's no needed but can be helpful, when inputted value contained "," instead of "."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_value = std::string(str.ToUTF8().data());
|
||||
break; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user