ConfigOptions: GUI type as enum, not string.

Fixing compilation error in the new Platform code.
Fixing one issue in FDM support after splitting the top/bottom
interface layers.
This commit is contained in:
Vojtech Bubnik 2021-03-11 15:01:24 +01:00
parent 051ba0e6f4
commit a9c3d270e6
10 changed files with 66 additions and 55 deletions

View file

@ -902,7 +902,7 @@ void Choice::BUILD() {
if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
choice_ctrl* temp;
if (!m_opt.gui_type.empty() && m_opt.gui_type.compare("select_open") != 0) {
if (m_opt.gui_type != undefined && m_opt.gui_type != ConfigOptionDef::GUIType::select_open) {
m_is_editable = true;
temp = new choice_ctrl(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size);
}
@ -1237,7 +1237,7 @@ boost::any& Choice::get_value()
else if (m_opt_id == "brim_type")
m_value = static_cast<BrimType>(ret_enum);
}
else if (m_opt.gui_type == "f_enum_open") {
else if (m_opt.gui_type == ConfigOptionDef::GUIType::f_enum_open || m_opt.gui_type == ConfigOptionDef::GUIType::i_enum_open) {
const int ret_enum = field->GetSelection();
if (ret_enum < 0 || m_opt.enum_values.empty() || m_opt.type == coStrings ||
(ret_str != m_opt.enum_values[ret_enum] && ret_str != _(m_opt.enum_labels[ret_enum])))
@ -1245,6 +1245,8 @@ boost::any& Choice::get_value()
get_value_by_opt_type(ret_str);
else if (m_opt.type == coFloatOrPercent)
m_value = m_opt.enum_values[ret_enum];
else if (m_opt.type == coInt)
m_value = atoi(m_opt.enum_values[ret_enum].c_str());
else
m_value = atof(m_opt.enum_values[ret_enum].c_str());
}