To OptionsGroup added "reload_config" to reload configurations after changes in any fields & "get_config_value" to get current option value from config.

In Field extended "set_value" to Choice.
In PrintConfig added default_value to "post_process".
This commit is contained in:
YuSanka 2018-01-09 09:41:07 +01:00
parent 16458e070a
commit 59432d50ff
8 changed files with 168 additions and 12 deletions

View file

@ -47,7 +47,7 @@ namespace Slic3r { namespace GUI {
text_value += "%";
}
else
wxNumberFormatter::ToString(m_opt.default_value->getFloat(), 2);
text_value = wxNumberFormatter::ToString(m_opt.default_value->getFloat(), 2);
break;
}
case coPercent:
@ -312,6 +312,36 @@ void Choice::set_value(const std::string value) //! Redundant?
m_disable_change_event = false;
}
void Choice::set_value(boost::any value)
{
switch (m_opt.type){
case coInt:
case coFloat:
case coPercent:
case coStrings:{
wxString text_value = boost::any_cast<wxString>(value);
auto idx = 0;
for (auto el : m_opt.enum_values)
{
if (el.compare(text_value) == 0)
break;
++idx;
}
if (m_opt.type == coPercent) text_value += "%";
idx == m_opt.enum_values.size() ?
dynamic_cast<wxComboBox*>(window)->SetValue(text_value) :
dynamic_cast<wxComboBox*>(window)->SetSelection(idx);
break;
}
case coEnum:{
dynamic_cast<wxComboBox*>(window)->SetSelection(boost::any_cast<int>(value));
break;
}
default:
break;
}
}
//! it's needed for _update_serial_ports()
void Choice::set_values(const std::vector<std::string> values)
{