diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index 933feb229f..f8471e302a 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -2079,14 +2079,15 @@ void PrintConfigDef::init_sla_params() def->default_value = new ConfigOptionFloat(100.); def = this->add("display_pixels_x", coInt); - def->label = L("Number of pixels in X"); + def->full_label = L("Number of pixels in"); + def->label = ("X"); def->tooltip = L("Number of pixels in X"); def->cli = "display-pixels-x=i"; def->min = 100; def->default_value = new ConfigOptionInt(2000); def = this->add("display_pixels_y", coInt); - def->label = L("Number of pixels in Y"); + def->label = ("Y"); def->tooltip = L("Number of pixels in Y"); def->cli = "display-pixels-y=i"; def->min = 100; diff --git a/xs/src/slic3r/GUI/Preset.cpp b/xs/src/slic3r/GUI/Preset.cpp index 412895eeb0..7aefd38274 100644 --- a/xs/src/slic3r/GUI/Preset.cpp +++ b/xs/src/slic3r/GUI/Preset.cpp @@ -387,6 +387,7 @@ const std::vector& Preset::sla_material_options() "exposure_time", "initial_exposure_time", "material_correction_printing", "material_correction_curing", "material_notes", + "compatible_printers", "compatible_printers_condition", "inherits" }; } @@ -895,11 +896,11 @@ bool PresetCollection::update_dirty_ui(wxBitmapComboBox *ui) return was_dirty != is_dirty; } -std::vector PresetCollection::dirty_options(const Preset *edited, const Preset *reference, const bool is_printer_type /*= false*/) +std::vector PresetCollection::dirty_options(const Preset *edited, const Preset *reference, const bool deep_compare /*= false*/) { std::vector changed; if (edited != nullptr && reference != nullptr) { - changed = is_printer_type ? + changed = deep_compare ? reference->config.deep_diff(edited->config) : reference->config.diff(edited->config); // The "compatible_printers" option key is handled differently from the others: diff --git a/xs/src/slic3r/GUI/Preset.hpp b/xs/src/slic3r/GUI/Preset.hpp index d1a4063214..821d7dc543 100644 --- a/xs/src/slic3r/GUI/Preset.hpp +++ b/xs/src/slic3r/GUI/Preset.hpp @@ -342,11 +342,11 @@ public: // Compare the content of get_selected_preset() with get_edited_preset() configs, return true if they differ. bool current_is_dirty() const { return ! this->current_dirty_options().empty(); } // Compare the content of get_selected_preset() with get_edited_preset() configs, return the list of keys where they differ. - std::vector current_dirty_options(const bool is_printer_type = false) const - { return dirty_options(&this->get_edited_preset(), &this->get_selected_preset(), is_printer_type); } + std::vector current_dirty_options(const bool deep_compare = false) const + { return dirty_options(&this->get_edited_preset(), &this->get_selected_preset(), deep_compare); } // Compare the content of get_selected_preset() with get_edited_preset() configs, return the list of keys where they differ. - std::vector current_different_from_parent_options(const bool is_printer_type = false) const - { return dirty_options(&this->get_edited_preset(), this->get_selected_preset_parent(), is_printer_type); } + std::vector current_different_from_parent_options(const bool deep_compare = false) const + { return dirty_options(&this->get_edited_preset(), this->get_selected_preset_parent(), deep_compare); } // Update the choice UI from the list of presets. // If show_incompatible, all presets are shown, otherwise only the compatible presets are shown. diff --git a/xs/src/slic3r/GUI/Tab.cpp b/xs/src/slic3r/GUI/Tab.cpp index 13941acc37..ac398e3471 100644 --- a/xs/src/slic3r/GUI/Tab.cpp +++ b/xs/src/slic3r/GUI/Tab.cpp @@ -314,10 +314,10 @@ void Tab::update_changed_ui() if (m_postpone_update_ui) return; - const bool is_printer_type = (name() == "printer"); - auto dirty_options = m_presets->current_dirty_options(is_printer_type); - auto nonsys_options = m_presets->current_different_from_parent_options(is_printer_type); - if (is_printer_type){ + const bool deep_compare = (m_name == "printer" || m_name == "sla_material"); + auto dirty_options = m_presets->current_dirty_options(deep_compare); + auto nonsys_options = m_presets->current_different_from_parent_options(deep_compare); + if (name() == "printer"){ TabPrinter* tab = static_cast(this); if (tab->m_initial_extruders_count != tab->m_extruders_count) dirty_options.emplace_back("extruders_count"); @@ -398,7 +398,7 @@ void Tab::init_options_list() } template -void add_correct_opts_to_options_list(const std::string &opt_key, std::map& map, TabPrinter *tab, const int& value) +void add_correct_opts_to_options_list(const std::string &opt_key, std::map& map, Tab *tab, const int& value) { T *opt_cur = static_cast(tab->m_config->option(opt_key)); for (int i = 0; i < opt_cur->values.size(); i++) @@ -430,6 +430,30 @@ void TabPrinter::init_options_list() m_options_list.emplace("extruders_count", m_opt_status_value); } +void TabSLAMaterial::init_options_list() +{ + if (!m_options_list.empty()) + m_options_list.clear(); + + for (const auto opt_key : m_config->keys()) + { + if (opt_key == "compatible_printers"){ + m_options_list.emplace(opt_key, m_opt_status_value); + continue; + } + switch (m_config->option(opt_key)->type()) + { + case coInts: add_correct_opts_to_options_list(opt_key, m_options_list, this, m_opt_status_value); break; + case coBools: add_correct_opts_to_options_list(opt_key, m_options_list, this, m_opt_status_value); break; + case coFloats: add_correct_opts_to_options_list(opt_key, m_options_list, this, m_opt_status_value); break; + case coStrings: add_correct_opts_to_options_list(opt_key, m_options_list, this, m_opt_status_value); break; + case coPercents:add_correct_opts_to_options_list(opt_key, m_options_list, this, m_opt_status_value); break; + case coPoints: add_correct_opts_to_options_list(opt_key, m_options_list, this, m_opt_status_value); break; + default: m_options_list.emplace(opt_key, m_opt_status_value); break; + } + } +} + void Tab::get_sys_and_mod_flags(const std::string& opt_key, bool& sys_page, bool& modified_page) { auto opt = m_options_list.find(opt_key); @@ -1750,8 +1774,9 @@ void TabPrinter::build_sla() optgroup->append_single_option_line("display_width"); optgroup->append_single_option_line("display_height"); - line = { _(L("Number of pixels in axes")), "" }; - line.append_option(optgroup->get_option("display_pixels_x")); + auto option = optgroup->get_option("display_pixels_x"); + line = { _(option.opt.full_label), "" }; + line.append_option(option); line.append_option(optgroup->get_option("display_pixels_y")); optgroup->append_line(line); @@ -1769,7 +1794,7 @@ void TabPrinter::build_sla() page = add_options_page(_(L("Notes")), "note.png"); optgroup = page->new_optgroup(_(L("Notes")), 0); - auto option = optgroup->get_option("printer_notes"); + option = optgroup->get_option("printer_notes"); option.opt.full_width = true; option.opt.height = 250; optgroup->append_single_option_line(option); @@ -2215,7 +2240,7 @@ void Tab::select_preset(std::string preset_name /*= ""*/) auto printer_tab = m_presets->name() == "printer"; auto canceled = false; m_reload_dependent_tabs = {}; - if (!current_dirty && !may_discard_current_dirty_preset()) { + if (current_dirty && !may_discard_current_dirty_preset()) { canceled = true; } else if (printer_tab) { // Before switching the printer to a new one, verify, whether the currently active print and filament @@ -2921,7 +2946,7 @@ void TabSLAMaterial::build() m_presets = &m_preset_bundle->sla_materials; load_initial_data(); - auto page = add_options_page(_(L("General")), "spool.png"); + auto page = add_options_page(_(L("Material")), "spool.png"); auto optgroup = page->new_optgroup(_(L("Layers"))); optgroup->append_single_option_line("layer_height"); @@ -2932,6 +2957,7 @@ void TabSLAMaterial::build() optgroup->append_single_option_line("initial_exposure_time"); optgroup = page->new_optgroup(_(L("Corrections"))); + optgroup->label_width = 190; std::vector corrections = { "material_correction_printing", "material_correction_curing" }; std::vector axes{ "X", "Y", "Z" }; for (auto& opt_key : corrections){ diff --git a/xs/src/slic3r/GUI/Tab.hpp b/xs/src/slic3r/GUI/Tab.hpp index c5b6b09363..a271b268d1 100644 --- a/xs/src/slic3r/GUI/Tab.hpp +++ b/xs/src/slic3r/GUI/Tab.hpp @@ -362,6 +362,7 @@ public: void build() override; void update() override; + void init_options_list() override; }; class SavePresetWindow :public wxDialog