Fixed control of options category for single material profiles

This commit is contained in:
YuSanka 2019-08-06 19:01:59 +02:00
parent 621a552dc0
commit 91e0b7aa9a

View file

@ -1013,6 +1013,11 @@ const std::vector<std::string>& ObjectList::get_options_for_bundle(const wxStrin
return empty; return empty;
} }
static bool improper_category(const std::string& category, const int extruders_cnt)
{
return category.empty() || (extruders_cnt == 1 && (category == "Extruders" || category == "Wipe options" ));
}
void ObjectList::get_options_menu(settings_menu_hierarchy& settings_menu, const bool is_part) void ObjectList::get_options_menu(settings_menu_hierarchy& settings_menu, const bool is_part)
{ {
auto options = get_options(is_part); auto options = get_options(is_part);
@ -1024,8 +1029,8 @@ void ObjectList::get_options_menu(settings_menu_hierarchy& settings_menu, const
{ {
auto const opt = config.def()->get(option); auto const opt = config.def()->get(option);
auto category = opt->category; auto category = opt->category;
if (category.empty() || if (improper_category(category, extruders_cnt))
(category == "Extruders" && extruders_cnt == 1)) continue; continue;
const std::string& label = !opt->full_label.empty() ? opt->full_label : opt->label; const std::string& label = !opt->full_label.empty() ? opt->full_label : opt->label;
std::pair<std::string, std::string> option_label(option, label); std::pair<std::string, std::string> option_label(option, label);
@ -1537,7 +1542,7 @@ void ObjectList::create_freq_settings_popupmenu(wxMenu *menu)
const int extruders_cnt = extruders_count(); const int extruders_cnt = extruders_count();
for (auto& it : bundle) { for (auto& it : bundle) {
if (it.first.empty() || it.first == "Extruders" && extruders_cnt == 1) if (improper_category(it.first, extruders_cnt))
continue; continue;
append_menu_item(menu, wxID_ANY, _(it.first), "", append_menu_item(menu, wxID_ANY, _(it.first), "",
@ -1550,7 +1555,7 @@ void ObjectList::create_freq_settings_popupmenu(wxMenu *menu)
m_freq_settings_fff : m_freq_settings_sla; m_freq_settings_fff : m_freq_settings_sla;
for (auto& it : bundle_quick) { for (auto& it : bundle_quick) {
if (it.first.empty() || it.first == "Extruders" && extruders_cnt == 1) if (improper_category(it.first, extruders_cnt))
continue; continue;
append_menu_item(menu, wxID_ANY, wxString::Format(_(L("Quick Add Settings (%s)")), _(it.first)), "", append_menu_item(menu, wxID_ANY, wxString::Format(_(L("Quick Add Settings (%s)")), _(it.first)), "",
@ -2184,7 +2189,7 @@ SettingsBundle ObjectList::get_item_settings_bundle(const DynamicPrintConfig* co
for (auto& opt_key : opt_keys) for (auto& opt_key : opt_keys)
{ {
auto category = config->def()->get(opt_key)->category; auto category = config->def()->get(opt_key)->category;
if (category.empty() || (category == "Extruders" && extruders_cnt == 1)) if (improper_category(category, extruders_cnt))
continue; continue;
std::vector< std::string > new_category; std::vector< std::string > new_category;
@ -2456,13 +2461,13 @@ void ObjectList::del_layer_range(const t_layer_height_range& range)
select_item(selectable_item); select_item(selectable_item);
} }
double get_min_layer_height(const int extruder_idx) static double get_min_layer_height(const int extruder_idx)
{ {
const DynamicPrintConfig& config = wxGetApp().preset_bundle->printers.get_edited_preset().config; const DynamicPrintConfig& config = wxGetApp().preset_bundle->printers.get_edited_preset().config;
return config.opt_float("min_layer_height", extruder_idx <= 0 ? 0 : extruder_idx-1); return config.opt_float("min_layer_height", extruder_idx <= 0 ? 0 : extruder_idx-1);
} }
double get_max_layer_height(const int extruder_idx) static double get_max_layer_height(const int extruder_idx)
{ {
const DynamicPrintConfig& config = wxGetApp().preset_bundle->printers.get_edited_preset().config; const DynamicPrintConfig& config = wxGetApp().preset_bundle->printers.get_edited_preset().config;
return config.opt_float("max_layer_height", extruder_idx <= 0 ? 0 : extruder_idx-1); return config.opt_float("max_layer_height", extruder_idx <= 0 ? 0 : extruder_idx-1);