Fix of #5698 - When editing presets, list items are always green even if values have changed compared to preset or defaults

This commit is contained in:
YuSanka 2021-01-07 12:26:16 +01:00
parent efd3002ea9
commit 8e7958da12
2 changed files with 5 additions and 5 deletions

View File

@ -501,7 +501,7 @@ void Tab::update_labels_colour()
if (opt.first == "bed_shape" || opt.first == "filament_ramming_parameters" || if (opt.first == "bed_shape" || opt.first == "filament_ramming_parameters" ||
opt.first == "compatible_prints" || opt.first == "compatible_printers" ) { opt.first == "compatible_prints" || opt.first == "compatible_printers" ) {
if (m_colored_Label_colors.find(opt.first) != m_colored_Label_colors.end()) if (m_colored_Label_colors.find(opt.first) != m_colored_Label_colors.end())
*m_colored_Label_colors.at(opt.first) = *color; m_colored_Label_colors.at(opt.first) = *color;
continue; continue;
} }
@ -540,7 +540,7 @@ void Tab::decorate()
if (opt.first == "bed_shape" || opt.first == "filament_ramming_parameters" || if (opt.first == "bed_shape" || opt.first == "filament_ramming_parameters" ||
opt.first == "compatible_prints" || opt.first == "compatible_printers") opt.first == "compatible_prints" || opt.first == "compatible_printers")
colored_label_clr = (m_colored_Label_colors.find(opt.first) == m_colored_Label_colors.end()) ? nullptr : m_colored_Label_colors.at(opt.first); colored_label_clr = (m_colored_Label_colors.find(opt.first) == m_colored_Label_colors.end()) ? nullptr : &m_colored_Label_colors.at(opt.first);
if (!colored_label_clr) { if (!colored_label_clr) {
field = get_field(opt.first); field = get_field(opt.first);
@ -3553,8 +3553,8 @@ void Tab::create_line_with_widget(ConfigOptionsGroup* optgroup, const std::strin
line.widget = widget; line.widget = widget;
line.label_path = path; line.label_path = path;
m_colored_Label_colors[opt_key] = &m_default_text_clr; m_colored_Label_colors[opt_key] = m_default_text_clr;
line.full_Label_color = m_colored_Label_colors[opt_key]; line.full_Label_color = &m_colored_Label_colors[opt_key];
optgroup->append_line(line); optgroup->append_line(line);
} }

View File

@ -246,7 +246,7 @@ public:
// map of option name -> wxColour (color of the colored label, associated with option) // map of option name -> wxColour (color of the colored label, associated with option)
// Used for options which don't have corresponded field // Used for options which don't have corresponded field
std::map<std::string, wxColour*> m_colored_Label_colors; std::map<std::string, wxColour> m_colored_Label_colors;
// Counter for the updating (because of an update() function can have a recursive behavior): // Counter for the updating (because of an update() function can have a recursive behavior):
// 1. increase value from the very beginning of an update() function // 1. increase value from the very beginning of an update() function