mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-16 08:25:55 +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.");
|
"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->ratio_over = "top_infill_extrusion_width";
|
||||||
def->sidetext = L("mm");
|
def->sidetext = L("mm");
|
||||||
def->enum_labels.push_back((boost::format("0.2 (%1%)") % L("detachable")).str());
|
|
||||||
def->min = 0;
|
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->mode = comAdvanced;
|
||||||
def->aliases = { "support_material_contact_distance" };
|
def->aliases = { "support_material_contact_distance" };
|
||||||
def->set_default_value(new ConfigOptionFloatOrPercent(0.2, false));
|
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.")));
|
show_error(m_parent, _(L("Invalid numeric input.")));
|
||||||
set_value(double_to_string(val), true);
|
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_opt.sidetext.rfind("mm ") != std::string::npos && val > 1)) &&
|
||||||
(m_value.empty() || std::string(str.ToUTF8().data()) != boost::any_cast<std::string>(m_value)))
|
(m_value.empty() || std::string(str.ToUTF8().data()) != boost::any_cast<std::string>(m_value)))
|
||||||
{
|
{
|
||||||
@ -240,15 +251,15 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
|
|||||||
const wxString msg_text = from_u8((boost::format(_utf8(L("Do you mean %s%% instead of %s %s?\n"
|
const wxString msg_text = from_u8((boost::format(_utf8(L("Do you mean %s%% instead of %s %s?\n"
|
||||||
"Select YES if you want to change this value to %s%%, \n"
|
"Select YES if you want to change this value to %s%%, \n"
|
||||||
"or NO if you are sure that %s %s is a correct value."))) % stVal % stVal % sidetext % stVal % stVal % sidetext).str());
|
"or NO if you are sure that %s %s is a correct value."))) % stVal % stVal % sidetext % stVal % stVal % sidetext).str());
|
||||||
wxMessageDialog dialog(m_parent, msg_text, _(L("Parameter validation")) + ": " + m_opt_id , wxICON_WARNING | wxYES | wxNO);
|
wxMessageDialog dialog(m_parent, msg_text, _(L("Parameter validation")) + ": " + m_opt_id, wxICON_WARNING | wxYES | wxNO);
|
||||||
if (dialog.ShowModal() == wxID_YES) {
|
if (dialog.ShowModal() == wxID_YES) {
|
||||||
set_value(from_u8((boost::format("%s%%") % stVal).str()), false/*true*/);
|
set_value(from_u8((boost::format("%s%%") % stVal).str()), false/*true*/);
|
||||||
str += "%%";
|
str += "%%";
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
set_value(stVal, false); // it's no needed but can be helpful, when inputted value contained "," instead of "."
|
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());
|
m_value = std::string(str.ToUTF8().data());
|
||||||
break; }
|
break; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user