Implemented a support of the coFloatsOrPercents values on settings tabs

This commit is contained in:
YuSanka 2022-12-12 17:12:48 +01:00 committed by Pavel Mikuš
parent f730fd21d4
commit f04545f1e6
10 changed files with 95 additions and 38 deletions

View file

@ -1205,6 +1205,14 @@ static wxString get_string_value(std::string opt_key, const DynamicPrintConfig&
out = double_to_string(opt->value) + (opt->percent ? "%" : "");
return out;
}
case coFloatsOrPercents: {
const ConfigOptionFloatsOrPercents* opt = config.opt<ConfigOptionFloatsOrPercents>(opt_key);
if (opt) {
const auto val = opt->get_at(opt_idx);
out = double_to_string(val.value) + (val.percent ? "%" : "");
}
return out;
}
case coEnum: {
return get_string_from_enum(opt_key, config,
opt_key == "top_fill_pattern" ||
@ -1303,7 +1311,7 @@ void UnsavedChangesDialog::update_tree(Preset::Type type, PresetCollection* pres
m_tree->model->AddPreset(type, from_u8(presets->get_edited_preset().name), old_pt, from_u8(new_selected_preset));
// Collect dirty options.
const bool deep_compare = (type == Preset::TYPE_PRINTER || type == Preset::TYPE_SLA_MATERIAL);
const bool deep_compare = type != Preset::TYPE_FILAMENT;
auto dirty_options = presets->current_dirty_options(deep_compare);
// process changes of extruders count
@ -1833,7 +1841,7 @@ void DiffPresetDialog::update_tree()
}
// Collect dirty options.
const bool deep_compare = (type == Preset::TYPE_PRINTER || type == Preset::TYPE_SLA_MATERIAL);
const bool deep_compare = type != Preset::TYPE_FILAMENT;
auto dirty_options = type == Preset::TYPE_PRINTER && left_pt == ptFFF &&
left_config.opt<ConfigOptionStrings>("extruder_colour")->values.size() < right_congig.opt<ConfigOptionStrings>("extruder_colour")->values.size() ?
presets->dirty_options(right_preset, left_preset, deep_compare) :