From b2b9264d1893f39bdf5e39e9d9bcbc4b40e02385 Mon Sep 17 00:00:00 2001 From: cjw Date: Sun, 23 Feb 2025 17:03:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=85=8D=E7=BD=AE=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=A1=86=E5=88=B7=E6=96=B0=E3=80=82=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E4=BF=AE=E6=94=B9=E5=B0=9D=E8=AF=95=E3=80=82?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=9B=B4=E5=A4=9A=E5=8F=82=E6=95=B0=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libslic3r/PresetBundle.cpp | 32 +++++++++++++++----- libslic3r/PresetBundle.hpp | 1 + slic3r/GUI/CreatePresetsDialog.cpp | 3 +- slic3r/GUI/GCodeViewer.cpp | 5 ++++ slic3r/GUI/ParamsPanel.cpp | 1 + slic3r/GUI/Plater.cpp | 12 ++++++++ slic3r/GUI/Tab.cpp | 45 +++++++++++++++-------------- slic3r/GUI/Widgets/Button.cpp | 1 + slic3r/GUI/Widgets/SwitchButton.cpp | 2 +- 9 files changed, 70 insertions(+), 32 deletions(-) diff --git a/libslic3r/PresetBundle.cpp b/libslic3r/PresetBundle.cpp index dc900ef..7f755bb 100644 --- a/libslic3r/PresetBundle.cpp +++ b/libslic3r/PresetBundle.cpp @@ -391,6 +391,9 @@ std::vector PresetBundle::get_current_project_embedded_presets() auto printer_presets = this->printers.get_project_embedded_presets(); if (!printer_presets.empty()) std::copy(printer_presets.begin(), printer_presets.end(), std::back_inserter(project_presets)); + auto config_presets = this->configs.get_project_embedded_presets(); + if (!config_presets.empty()) + std::copy(config_presets.begin(), config_presets.end(), std::back_inserter(project_presets)); BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(" finished, returned project_presets count %1%")%project_presets.size(); return project_presets; @@ -409,6 +412,7 @@ void PresetBundle::reset_project_embedded_presets() bool printer_reselect = this->printers.reset_project_embedded_presets(); bool filament_reselect = this->filaments.reset_project_embedded_presets(); bool print_reselect = this->prints.reset_project_embedded_presets(); + bool config_reselect = this->configs.reset_project_embedded_presets(); if (printer_reselect) { if (!prefer_printer.empty()) @@ -419,7 +423,7 @@ void PresetBundle::reset_project_embedded_presets() //this->update_multi_material_filament_presets(); this->update_compatible(PresetSelectCompatibleType::Never); } - else if (filament_reselect || print_reselect) { + else if (filament_reselect || print_reselect || config_reselect) { //Preset& current_printer = this->printers.get_selected_preset(); /*if (filament_reselect) { const std::vector &prefered_filament_profiles = current_printer.config.option("default_filament_profile")->values; @@ -1418,12 +1422,13 @@ void PresetBundle::update_system_maps() this->sla_materials.update_map_system_profile_renamed(); this->printers .update_map_system_profile_renamed(); //xiamian+ - //this->configs .update_map_system_profile_renamed(); + this->configs .update_map_system_profile_renamed(); this->prints .update_map_alias_to_profile_name(); this->sla_prints .update_map_alias_to_profile_name(); this->filaments .update_map_alias_to_profile_name(); this->sla_materials.update_map_alias_to_profile_name(); + this->configs .update_map_alias_to_profile_name(); } static inline std::string remove_ini_suffix(const std::string &name) @@ -1443,6 +1448,12 @@ void PresetBundle::load_installed_printers(const AppConfig &config) for (auto &preset : printers) preset.set_visible_from_appconfig(config); } +void PresetBundle::load_installed_configs(const AppConfig& config) +{ + this->update_system_maps(); + for (auto& preset : configs) + preset.set_visible_from_appconfig(config); +} const std::string& PresetBundle::get_preset_name_by_alias( const Preset::Type& preset_type, const std::string& alias) const { @@ -1453,6 +1464,7 @@ const std::string& PresetBundle::get_preset_name_by_alias( const Preset::Type& p const PresetCollection& presets = preset_type == Preset::TYPE_PRINT ? prints : preset_type == Preset::TYPE_SLA_PRINT ? sla_prints : preset_type == Preset::TYPE_FILAMENT ? filaments : + preset_type == Preset::TYPE_CONFIG ? configs : sla_materials; return presets.get_preset_name_by_alias(alias); @@ -1484,12 +1496,13 @@ const int PresetBundle::get_required_hrc_by_filament_type(const std::string& fil void PresetBundle::save_changes_for_preset(const std::string& new_name, Preset::Type type, const std::vector& unselected_options, bool save_to_project) { - PresetCollection& presets = type == Preset::TYPE_PRINT ? prints : - type == Preset::TYPE_SLA_PRINT ? sla_prints : - type == Preset::TYPE_FILAMENT ? filaments : - type == Preset::TYPE_SLA_MATERIAL ? sla_materials : - type == Preset::TYPE_PRINTER ?printers : - configs; + PresetCollection& presets = type == Preset::TYPE_PRINT ? prints : + type == Preset::TYPE_SLA_PRINT ? sla_prints : + type == Preset::TYPE_FILAMENT ? filaments : + type == Preset::TYPE_SLA_MATERIAL ? sla_materials : + type == Preset::TYPE_CONFIG ? configs : + printers; + // if we want to save just some from selected options if (!unselected_options.empty()) { @@ -1595,6 +1608,7 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": enter, preferred printer_model_id %1%")%preferred_selection.printer_model_id; // Update visibility of presets based on application vendor / model / variant configuration. this->load_installed_printers(config); + this->load_installed_configs(config); // Update visibility of filament and sla material presets this->load_installed_filaments(config); @@ -1637,6 +1651,7 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p filaments.select_preset_by_name_strict(initial_filament_profile_name); sla_prints.select_preset_by_name_strict(initial_sla_print_profile_name); sla_materials.select_preset_by_name_strict(initial_sla_material_profile_name); + configs.select_preset_by_name_strict(initial_config_profile_name); // Load the names of the other filament profiles selected for a multi-material printer. // Load it even if the current printer technology is SLA. @@ -4049,6 +4064,7 @@ void PresetBundle::set_default_suppressed(bool default_suppressed) sla_prints.set_default_suppressed(default_suppressed); sla_materials.set_default_suppressed(default_suppressed); printers.set_default_suppressed(default_suppressed); + configs.set_default_suppressed(default_suppressed); } } // namespace Slic3r diff --git a/libslic3r/PresetBundle.hpp b/libslic3r/PresetBundle.hpp index a26c581..a41dcca 100644 --- a/libslic3r/PresetBundle.hpp +++ b/libslic3r/PresetBundle.hpp @@ -227,6 +227,7 @@ public: // based on the user configuration. // If the "vendor" section is missing, enable all models and variants of the particular vendor. void load_installed_printers(const AppConfig &config); + void load_installed_configs(const AppConfig &config); const std::string& get_preset_name_by_alias(const Preset::Type& preset_type, const std::string& alias) const; diff --git a/slic3r/GUI/CreatePresetsDialog.cpp b/slic3r/GUI/CreatePresetsDialog.cpp index 6d22aa8..27034b1 100644 --- a/slic3r/GUI/CreatePresetsDialog.cpp +++ b/slic3r/GUI/CreatePresetsDialog.cpp @@ -30,7 +30,8 @@ #define STATIC_TEXT_COLOUR wxColour("#363636") #define PRINTER_LIST_COLOUR wxColour("#EEEEEE") #define FILAMENT_OPTION_COLOUR wxColour("#D9D9D9") -#define SELECT_ALL_OPTION_COLOUR wxColour("#00AE42") +//#define SELECT_ALL_OPTION_COLOUR wxColour("#00AE42") +#define SELECT_ALL_OPTION_COLOUR wxColour("#009FF3") #define DEFAULT_PROMPT_TEXT_COLOUR wxColour("#ACACAC") namespace Slic3r { diff --git a/slic3r/GUI/GCodeViewer.cpp b/slic3r/GUI/GCodeViewer.cpp index 1f134a9..1bce721 100644 --- a/slic3r/GUI/GCodeViewer.cpp +++ b/slic3r/GUI/GCodeViewer.cpp @@ -5911,6 +5911,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv imgui.text(total_str + ":"); ImGui::SameLine(max_len); imgui.text(short_time(get_time_dhms(time_mode.time))); + //imgui.text(get_time_dhms(time_mode.time)); //xiamian+ ImGui::Dummy({ window_padding, window_padding }); ImGui::SameLine(); @@ -5933,6 +5934,10 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv //oss << std::put_time(new_local_tm, "%Y-%m-%d %H:%M:%S"); oss << std::put_time(new_local_tm, "%Y-%m-%d %H:%M"); imgui.text(oss.str()); + ImGui::SameLine(max_len); + std::string abc = " "; + imgui.text(abc); + //ImGui::Spacing(); //shangmian+ auto show_mode_button = [this, &imgui, can_show_mode_button](const wxString& label, PrintEstimatedStatistics::ETimeMode mode) { if (can_show_mode_button(mode)) { diff --git a/slic3r/GUI/ParamsPanel.cpp b/slic3r/GUI/ParamsPanel.cpp index 465fe92..ac23cfa 100644 --- a/slic3r/GUI/ParamsPanel.cpp +++ b/slic3r/GUI/ParamsPanel.cpp @@ -486,6 +486,7 @@ void ParamsPanel::refresh_tabs() break; case Preset::TYPE_CONFIG: m_tab_config = tab; + //m_tab_config = NULL; break; default: break; diff --git a/slic3r/GUI/Plater.cpp b/slic3r/GUI/Plater.cpp index 4585b7e..7c7fe61 100644 --- a/slic3r/GUI/Plater.cpp +++ b/slic3r/GUI/Plater.cpp @@ -1382,6 +1382,17 @@ void Sidebar::update_presets(Preset::Type preset_type) } break; } + case Preset::TYPE_CONFIG: + //wxGetApp().mainframe->m_param_panel; + //p->combo_print->update(); + { + /* Tab* config_tab = wxGetApp().get_tab(Preset::TYPE_CONFIG); + if (config_tab) { + config_tab->get_combo_box()->update(); + }*/ + p->combo_config->update(); + break; + } case Preset::TYPE_SLA_PRINT: ;// p->combo_sla_print->update(); break; @@ -1538,6 +1549,7 @@ void Sidebar::msw_rescale() // //p->combo_printer // } ) // combo->msw_rescale(); + p->combo_config->msw_rescale(); p->combo_printer->msw_rescale(); for (PlaterPresetComboBox* combo : p->combos_filament) combo->msw_rescale(); diff --git a/slic3r/GUI/Tab.cpp b/slic3r/GUI/Tab.cpp index 4161c23..225c7cc 100644 --- a/slic3r/GUI/Tab.cpp +++ b/slic3r/GUI/Tab.cpp @@ -4253,9 +4253,8 @@ void TabPrinter::update_sla() void TabConfig::build() { m_presets = &m_preset_bundle->configs; load_initial_data(); - - auto page = add_options_page(L("Quality"), "spool"); - auto optgroup = page->new_optgroup("", L"param_layer_height"); + auto page = add_options_page(L("Quality"), "spool"); + auto optgroup = page->new_optgroup("", L"param_layer_height"); optgroup->append_single_option_line("initial_layer_print_height", "layer-height"); optgroup->append_single_option_line("initial_layer_line_width"); @@ -4304,9 +4303,9 @@ void TabConfig::build() { optgroup->append_single_option_line("support_interface_bottom_layers", "support#base-pattern"); //you cuo wu -- zan ding //optgroup->append_single_option_line("support_interface_spacing", "support#base-pattern"); - - page = add_options_page(L("Strength"), "empty"); + + page = add_options_page(L("Strength"), "empty"); optgroup = page->new_optgroup("", L"param_wall"); optgroup->append_single_option_line("top_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface"); optgroup->append_single_option_line("bottom_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface"); @@ -4318,7 +4317,7 @@ void TabConfig::build() { optgroup->append_single_option_line("minimum_sparse_infill_area", "parameter/strength-advance-settings"); optgroup->append_single_option_line("infill_combination", "parameter/strength-advance-settings"); - page = add_options_page(L("Speed"), "empty"); + page = add_options_page(L("Speed"), "empty"); optgroup = page->new_optgroup("", L"param_speed_first", 15); optgroup->append_single_option_line("default_print_speed"); optgroup->append_single_option_line("initial_layer_speed"); @@ -4340,15 +4339,15 @@ void TabConfig::build() { optgroup->append_single_option_line("accel_to_decel_enable"); optgroup->append_single_option_line("accel_to_decel_factor"); - /* optgroup->append_single_option_line("default_jerk"); - optgroup->append_single_option_line("outer_wall_jerk"); - optgroup->append_single_option_line("inner_wall_jerk"); - optgroup->append_single_option_line("infill_jerk"); - optgroup->append_single_option_line("top_surface_jerk"); - optgroup->append_single_option_line("initial_layer_jerk"); - optgroup->append_single_option_line("travel_jerk");*/ + /* optgroup->append_single_option_line("default_jerk"); + optgroup->append_single_option_line("outer_wall_jerk"); + optgroup->append_single_option_line("inner_wall_jerk"); + optgroup->append_single_option_line("infill_jerk"); + optgroup->append_single_option_line("top_surface_jerk"); + optgroup->append_single_option_line("initial_layer_jerk"); + optgroup->append_single_option_line("travel_jerk");*/ - page = add_options_page(L("Support"), "support"); + page = add_options_page(L("Support"), "support"); optgroup = page->new_optgroup("", L"param_support"); optgroup->append_single_option_line("support_type", "support#support-types"); optgroup->append_single_option_line("support_style", "support#support-styles"); @@ -4379,7 +4378,7 @@ void TabConfig::build() { optgroup->append_single_option_line("tree_support_branch_diameter", "support#tree-support-only-options"); optgroup->append_single_option_line("tree_support_branch_angle", "support#tree-support-only-options"); - page = add_options_page(L("Others"), "advanced"); + page = add_options_page(L("Others"), "advanced"); optgroup = page->new_optgroup("", L"param_adhension"); optgroup->append_single_option_line("slicing_mode"); optgroup->append_single_option_line("fibre_feed_rate"); @@ -4392,6 +4391,7 @@ void TabConfig::build() { optgroup->append_single_option_line("fuzzy_skin", "parameter/fuzzy-skin"); optgroup->append_single_option_line("fuzzy_skin_point_distance"); optgroup->append_single_option_line("fuzzy_skin_thickness"); + } @@ -4420,10 +4420,11 @@ void TabConfig::toggle_options() { bool is_BBL_printer = false; if (m_preset_bundle) { - is_BBL_printer = - m_preset_bundle->configs.get_edited_preset().is_bbl_vendor_preset( - m_preset_bundle); + is_BBL_printer = m_preset_bundle->configs.get_edited_preset().is_bbl_vendor_preset(m_preset_bundle); } + + /* const Preset& preset = m_preset_bundle->configs.get_edited_preset(); + bool is_BBL = preset.is_system;*/ //if (m_active_page->title() == "Quality") { //toggle_line("printable_area", !is_configed_by_BBL);//all printer can entry and view data //toggle_option("single_extruder_multi_material", have_multiple_extruders); @@ -4444,10 +4445,10 @@ void TabConfig::toggle_options() { // toggle_option(el, !is_BBL_printer); //} - //if (m_active_page->title() == "Strength") { - //toggle_line("time_lapse_gcode", m_preset_bundle->configs.get_edited_preset().config.opt_enum("printer_structure") == PrinterStructure::psI3); - //toggle_option("thumbnail_size", !is_BBL_printer); - //} + /* if (m_active_page->title() == "Strength") { + toggle_line("time_lapse_gcode", m_preset_bundle->configs.get_edited_preset().config.opt_enum("printer_structure") == PrinterStructure::psI3); + toggle_option("thumbnail_size", !is_BBL_printer); + }*/ } void TabConfig::update() { diff --git a/slic3r/GUI/Widgets/Button.cpp b/slic3r/GUI/Widgets/Button.cpp index 9e54856..aa817f5 100644 --- a/slic3r/GUI/Widgets/Button.cpp +++ b/slic3r/GUI/Widgets/Button.cpp @@ -30,6 +30,7 @@ Button::Button() std::make_pair(0xF0F0F1, (int) StateColor::Disabled), std::make_pair(0x37EE7C, (int) StateColor::Hovered | StateColor::Checked), std::make_pair(0x00AE42, (int) StateColor::Checked), + //std::make_pair(0x009FF3, (int) StateColor::Checked), std::make_pair(*wxLIGHT_GREY, (int) StateColor::Hovered), std::make_pair(*wxWHITE, (int) StateColor::Normal)); text_color = StateColor( diff --git a/slic3r/GUI/Widgets/SwitchButton.cpp b/slic3r/GUI/Widgets/SwitchButton.cpp index 254ba61..f565606 100644 --- a/slic3r/GUI/Widgets/SwitchButton.cpp +++ b/slic3r/GUI/Widgets/SwitchButton.cpp @@ -15,7 +15,7 @@ SwitchButton::SwitchButton(wxWindow* parent, wxWindowID id) , m_off(this, "toggle_off", 16) , text_color(std::pair{0xfffffe, (int) StateColor::Checked}, std::pair{0x6B6B6B, (int) StateColor::Normal}) , track_color(0xD9D9D9) - , thumb_color(std::pair{0x00AE42, (int) StateColor::Checked}, std::pair{0xD9D9D9, (int) StateColor::Normal}) + , thumb_color(std::pair{0x009FF3, (int) StateColor::Checked}, std::pair{0xD9D9D9, (int) StateColor::Normal}) { SetBackgroundColour(StaticBox::GetParentBackgroundColor(parent)); Bind(wxEVT_TOGGLEBUTTON, [this](auto& e) { update(); e.Skip(); });