WIP: Pad quick-menu

This commit is contained in:
tamasmeszaros 2019-08-06 18:16:02 +02:00
parent 92e1649606
commit b8bfe001c0

View File

@ -556,14 +556,21 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) :
Tab* tab = wxGetApp().get_tab(Preset::TYPE_SLA_PRINT); Tab* tab = wxGetApp().get_tab(Preset::TYPE_SLA_PRINT);
if (!tab) return; if (!tab) return;
if (opt_key == "pad_enable") { DynamicPrintConfig new_conf = *config_sla;
tab->set_value(opt_key, value); if (opt_key == "pad") {
tab->update(); const wxString& selection = boost::any_cast<wxString>(value);
const bool pad_enable = selection == _("None") ? false : true;
new_conf.set_key_value("pad_enable", new ConfigOptionBool(pad_enable));
if (selection == _("Below object"))
new_conf.set_key_value("pad_zero_elevation", new ConfigOptionBool(false));
else if (selection == _("Around object"))
new_conf.set_key_value("pad_zero_elevation", new ConfigOptionBool(true));
} }
else else
{ {
assert(opt_key == "support"); assert(opt_key == "support");
DynamicPrintConfig new_conf = *config_sla;
const wxString& selection = boost::any_cast<wxString>(value); const wxString& selection = boost::any_cast<wxString>(value);
const bool supports_enable = selection == _("None") ? false : true; const bool supports_enable = selection == _("None") ? false : true;
@ -573,10 +580,9 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) :
new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(false)); new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(false));
else if (selection == _("Support on build plate only")) else if (selection == _("Support on build plate only"))
new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(true)); new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(true));
tab->load_config(new_conf);
} }
tab->load_config(new_conf);
tab->update_dirty(); tab->update_dirty();
}; };
@ -594,9 +600,19 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) :
line = Line{ "", "" }; line = Line{ "", "" };
option = m_og_sla->get_option("pad_enable"); ConfigOptionDef pad_def;
option.opt.sidetext = " "; pad_def.label = L("Pad");
pad_def.type = coStrings;
pad_def.gui_type = "select_open";
pad_def.tooltip = L("Select what kind of pad do you need");
pad_def.enum_labels.push_back(L("None"));
pad_def.enum_labels.push_back(L("Below object"));
pad_def.enum_labels.push_back(L("Around object"));
pad_def.set_default_value(new ConfigOptionStrings{ "Below object" });
option = Option(pad_def, "pad");
option.opt.full_width = true;
line.append_option(option); line.append_option(option);
line.append_widget(empty_widget);
m_og_sla->append_line(line); m_og_sla->append_line(line);