diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index e90f99ce17..9d0dda40f2 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -793,6 +793,42 @@ void Tab::decorate() tt = &m_tt_white_bullet; } + if (opt.first == "compatible_prints" || opt.first == "compatible_printers") { + bool sys_page = true; + bool modified_page = false; + if (m_type == Slic3r::Preset::TYPE_PRINTER) { + sys_page = m_presets->get_selected_preset_parent() != nullptr; + modified_page = false; + } else { + if (opt.first == "compatible_prints") { + get_sys_and_mod_flags("compatible_prints", sys_page, modified_page); + // Don't call for "compatible_printers" + } else if (opt.first == "compatible_printers") { + get_sys_and_mod_flags("compatible_printers", sys_page, modified_page); + if (m_type == Slic3r::Preset::TYPE_FILAMENT || m_type == Slic3r::Preset::TYPE_SLA_MATERIAL) { + get_sys_and_mod_flags("compatible_prints", sys_page, modified_page); + } + } + } + if (!sys_page) { + is_nonsys_value = true; + sys_icon = m_bmp_non_system; + sys_tt = m_tt_non_system; + + if (!modified_page) + color = &m_default_text_clr; + else + color = &m_modified_label_clr; + } + + if (!modified_page) { + is_modified_value = false; + icon = &m_bmp_white_bullet; + tt = &m_tt_white_bullet; + } + + } + if (option_without_field) { if (Line* line = get_line(opt.first)) { line->set_undo_bitmap(icon); @@ -945,9 +981,20 @@ void Tab::get_sys_and_mod_flags(const std::string& opt_key, bool& sys_page, bool auto opt = m_options_list.find(opt_key); if (opt == m_options_list.end()) return; + // If the value is empty, clear the system flag + if (opt_key == "compatible_printers" || opt_key == "compatible_prints") { + auto* compatible_values = m_config->option(opt_key); + if (compatible_values && compatible_values->values.empty()) { + sys_page = false; // Empty value should NOT be treated as a system value + } + } else if (sys_page) { + sys_page = (opt->second & osSystemValue) != 0; + } - if (sys_page) sys_page = (opt->second & osSystemValue) != 0; modified_page |= (opt->second & osInitValue) == 0; + + //if (sys_page) sys_page = (opt->second & osSystemValue) != 0; + //modified_page |= (opt->second & osInitValue) == 0; } void Tab::update_changed_tree_ui() @@ -1068,22 +1115,10 @@ void Tab::on_roll_back_value(const bool to_sys /*= true*/) if (m_type != Preset::TYPE_PRINTER && (m_options_list["compatible_printers"] & os) == 0) { to_sys ? group->back_to_sys_value("compatible_printers") : group->back_to_initial_value("compatible_printers"); load_key_value("compatible_printers", true/*some value*/, true); - - if (m_compatible_printers.checkbox) { - bool is_empty = m_config->option("compatible_printers")->values.empty(); - m_compatible_printers.checkbox->SetValue(is_empty); - is_empty ? m_compatible_printers.btn->Disable() : m_compatible_printers.btn->Enable(); - } } if ((m_type == Preset::TYPE_FILAMENT || m_type == Preset::TYPE_SLA_MATERIAL) && (m_options_list["compatible_prints"] & os) == 0) { to_sys ? group->back_to_sys_value("compatible_prints") : group->back_to_initial_value("compatible_prints"); load_key_value("compatible_prints", true/*some value*/, true); - - if (m_compatible_prints.checkbox) { - bool is_empty = m_config->option("compatible_prints")->values.empty(); - m_compatible_prints.checkbox->SetValue(is_empty); - is_empty ? m_compatible_prints.btn->Disable() : m_compatible_prints.btn->Enable(); - } } } for (const auto &kvp : group->opt_map()) { @@ -1106,6 +1141,17 @@ void Tab::on_roll_back_value(const bool to_sys /*= true*/) // BBS: restore all pages in preset, update_dirty also update combobox update_dirty(); + if (m_compatible_printers.checkbox) { + bool is_empty = m_config->option("compatible_printers")->values.empty(); + m_compatible_printers.checkbox->SetValue(is_empty); + is_empty ? m_compatible_printers.btn->Disable() : m_compatible_printers.btn->Enable(); + } + if (m_compatible_prints.checkbox) { + bool is_empty = m_config->option("compatible_prints")->values.empty(); + m_compatible_prints.checkbox->SetValue(is_empty); + is_empty ? m_compatible_prints.btn->Disable() : m_compatible_prints.btn->Enable(); + } + m_page_view->GetParent()->Layout(); } @@ -5874,12 +5920,24 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep { deps.btn->Enable(! deps.checkbox->GetValue()); // All printers have been made compatible with this preset. - if (deps.checkbox->GetValue()) + if (deps.checkbox->GetValue()) this->load_key_value(deps.key_list, std::vector {}); this->get_field(deps.key_condition)->toggle(deps.checkbox->GetValue()); this->update_changed_ui(); }) ); + if (m_compatible_printers.checkbox) { + bool is_empty = m_config->option("compatible_printers")->values.empty(); + m_compatible_printers.checkbox->SetValue(is_empty); + is_empty ? m_compatible_printers.btn->Disable() : m_compatible_printers.btn->Enable(); + } + + if (m_compatible_prints.checkbox) { + bool is_empty = m_config->option("compatible_prints")->values.empty(); + m_compatible_prints.checkbox->SetValue(is_empty); + is_empty ? m_compatible_prints.btn->Disable() : m_compatible_prints.btn->Enable(); + } + deps.btn->Bind(wxEVT_BUTTON, ([this, parent, &deps](wxCommandEvent e) { // Collect names of non-default non-external profiles.