mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-06 22:47:32 -06:00
Fixed some UI glitches about the All checkbox in the dependency tab (#8949)
* bugfix:All button doesnt get checked on tab-reopen when the selection is empty * bugfix:when dep tab is open, and you check All, hitting reset all doesnt update the All button correctly; also partially fixed the bug that checking All doesnt flag the tab as dirty * fixed a bug where checking All in dependency tab doesnt flag the field as dirty --------- Co-authored-by: Noisyfox <timemanager.rick@gmail.com> Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
parent
cd2df8f5ef
commit
06d36b9718
1 changed files with 72 additions and 14 deletions
|
@ -793,6 +793,42 @@ void Tab::decorate()
|
||||||
tt = &m_tt_white_bullet;
|
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 (option_without_field) {
|
||||||
if (Line* line = get_line(opt.first)) {
|
if (Line* line = get_line(opt.first)) {
|
||||||
line->set_undo_bitmap(icon);
|
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);
|
auto opt = m_options_list.find(opt_key);
|
||||||
if (opt == m_options_list.end())
|
if (opt == m_options_list.end())
|
||||||
return;
|
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<ConfigOptionStrings>(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;
|
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()
|
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) {
|
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");
|
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);
|
load_key_value("compatible_printers", true/*some value*/, true);
|
||||||
|
|
||||||
if (m_compatible_printers.checkbox) {
|
|
||||||
bool is_empty = m_config->option<ConfigOptionStrings>("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) {
|
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");
|
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);
|
load_key_value("compatible_prints", true/*some value*/, true);
|
||||||
|
|
||||||
if (m_compatible_prints.checkbox) {
|
|
||||||
bool is_empty = m_config->option<ConfigOptionStrings>("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()) {
|
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
|
// BBS: restore all pages in preset, update_dirty also update combobox
|
||||||
update_dirty();
|
update_dirty();
|
||||||
|
|
||||||
|
if (m_compatible_printers.checkbox) {
|
||||||
|
bool is_empty = m_config->option<ConfigOptionStrings>("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<ConfigOptionStrings>("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();
|
m_page_view->GetParent()->Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5880,6 +5926,18 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
|
||||||
this->update_changed_ui();
|
this->update_changed_ui();
|
||||||
}) );
|
}) );
|
||||||
|
|
||||||
|
if (m_compatible_printers.checkbox) {
|
||||||
|
bool is_empty = m_config->option<ConfigOptionStrings>("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<ConfigOptionStrings>("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)
|
deps.btn->Bind(wxEVT_BUTTON, ([this, parent, &deps](wxCommandEvent e)
|
||||||
{
|
{
|
||||||
// Collect names of non-default non-external profiles.
|
// Collect names of non-default non-external profiles.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue