From ff1370ae7ce37ca988d826a9597ebdb52235c732 Mon Sep 17 00:00:00 2001 From: cjw Date: Fri, 14 Feb 2025 16:27:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD=E5=86=8D?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E4=BD=86=E6=9C=AA=E8=83=BD=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E4=B8=8B=E6=8B=89=E5=88=97=E8=A1=A8=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=9B=9E=E6=98=BE=E3=80=82=E6=96=B0=E5=A2=9E=E6=9B=B4=E5=A4=9A?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=8A=9F=E8=83=BD=E3=80=82=E8=BD=AF=E4=BB=B6?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E9=A1=B5=E5=BC=B9=E7=AA=97=E5=86=8D=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libslic3r/Preset.cpp | 14 +- libslic3r/PresetBundle.cpp | 12 +- libslic3r/PrintConfig.cpp | 16 +- slic3r/GUI/ConfigWizard.hpp | 1 + slic3r/GUI/GCodeViewer.cpp | 1524 ++++++++++++++------------ slic3r/GUI/GUI_App.cpp | 195 ++-- slic3r/GUI/ParamsPanel.cpp | 19 +- slic3r/GUI/ParamsPanel.hpp | 2 + slic3r/GUI/PhysicalPrinterDialog.cpp | 2 +- slic3r/GUI/PresetComboBoxes.cpp | 113 +- slic3r/GUI/PresetComboBoxes.hpp | 1 + slic3r/GUI/SavePresetDialog.cpp | 2 +- slic3r/GUI/Tab.cpp | 710 ++++++------ 13 files changed, 1446 insertions(+), 1165 deletions(-) diff --git a/libslic3r/Preset.cpp b/libslic3r/Preset.cpp index 3542f6c..6130c30 100644 --- a/libslic3r/Preset.cpp +++ b/libslic3r/Preset.cpp @@ -805,13 +805,13 @@ static std::vector s_Preset_print_options { "minimum_sparse_infill_area", "reduce_infill_retraction", "ironing_pattern", "ironing_type", "ironing_flow", "ironing_speed", "ironing_spacing","ironing_direction", "max_travel_detour_distance", - "fuzzy_skin", "fuzzy_skin_thickness", "fuzzy_skin_point_distance", + "fuzzy_skin", "fuzzy_skin_thickness", "fuzzy_skin_point_distance","fibre_feed_rate", #ifdef HAS_PRESSURE_EQUALIZER "max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative", #endif /* HAS_PRESSURE_EQUALIZER */ "inner_wall_speed", "outer_wall_speed", "sparse_infill_speed", "internal_solid_infill_speed", "top_surface_speed", "support_speed", "support_object_xy_distance", "support_object_first_layer_gap","support_interface_speed", - "bridge_speed", "gap_infill_speed", "travel_speed", "travel_speed_z", "initial_layer_speed", "outer_wall_acceleration", + "bridge_speed", "gap_infill_speed", "travel_speed", "travel_speed_z", "initial_layer_speed", "outer_wall_acceleration","default_print_speed", "initial_layer_acceleration", "top_surface_acceleration", "default_acceleration", "inner_wall_acceleration", "sparse_infill_acceleration", "accel_to_decel_enable", "accel_to_decel_factor", "skirt_loops", "skirt_distance", "skirt_height", "draft_shield", @@ -997,8 +997,14 @@ static std::vector s_Preset_sla_printer_options { "inherits" }; static std::vector s_Preset_config_options{ - "initial_layer_print_height","initial_layer_line_width","outer_wall_line_width","inner_wall_line_width","top_surface_line_width","sparse_infill_line_width","support_line_width","resolution","enable_arc_fitting","wall_generator","wall_sequence", - "detect_thin_wall" + "initial_layer_print_height","initial_layer_line_width","outer_wall_line_width","inner_wall_line_width","top_surface_line_width","sparse_infill_line_width","support_line_width","seam_gap","seam_slope_conditional","scarf_angle_threshold","seam_slope_start_height", + "seam_slope_entire_loop","seam_slope_min_length","seam_slope_steps","seam_slope_inner_walls","wipe_speed","resolution","enable_arc_fitting","ironing_pattern","ironing_speed","ironing_flow","ironing_spacing","ironing_direction","wall_generator","wall_transition_angle", + "wall_transition_filter_deviation","wall_transition_length","wall_distribution_count","min_bead_width","min_feature_size","wall_sequence","top_one_wall_type","top_area_threshold","only_one_wall_first_layer","detect_overhang_wall","max_travel_detour_distance","support_base_pattern_spacing", + "support_interface_top_layers","support_interface_bottom_layers","support_bottom_interface_spacing","top_surface_pattern","bottom_surface_pattern","internal_solid_infill_pattern","sparse_infill_pattern","filter_out_gap_fill","bridge_angle","minimum_sparse_infill_area","infill_combination", + "default_print_speed","initial_layer_speed","initial_layer_infill_speed","outer_wall_speed","inner_wall_speed","sparse_infill_speed","internal_solid_infill_speed","top_surface_speed","bridge_speed","gap_infill_speed","support_speed","support_interface_speed","travel_speed", + "default_acceleration","accel_to_decel_enable","accel_to_decel_factor","support_type","support_style","support_threshold_angle","support_on_build_plate_only","support_critical_regions_only","support_remove_small_overhang","raft_layers","raft_contact_distance","raft_first_layer_density", + "support_filament","support_interface_filament","support_interface_not_for_body","raft_first_layer_expansion","tree_support_wall_count","support_base_pattern","support_interface_pattern","support_object_xy_distance","bridge_no_support","max_bridge_length","independent_support_layer_height", + "tree_support_branch_distance","tree_support_branch_diameter","tree_support_branch_angle","slicing_mode","fibre_feed_rate","print_sequence","spiral_mode","spiral_mode_smooth","spiral_mode_max_xy_smoothing","timelapse_type","fuzzy_skin","fuzzy_skin_point_distance","fuzzy_skin_thickness" }; const std::vector& Preset::print_options() { return s_Preset_print_options; } diff --git a/libslic3r/PresetBundle.cpp b/libslic3r/PresetBundle.cpp index 5030142..dc900ef 100644 --- a/libslic3r/PresetBundle.cpp +++ b/libslic3r/PresetBundle.cpp @@ -577,8 +577,7 @@ PresetsConfigSubstitutions PresetBundle::load_user_presets(std::string user, For std::string config_selected_preset_name = configs.get_selected_preset().name; this->configs.load_presets(dir_user_presets, PRESET_CONFIG_NAME, substitutions, substitution_rule); configs.select_preset_by_name(config_selected_preset_name, false); - } - catch (const std::runtime_error& err) { + }catch (const std::runtime_error& err) { errors_cummulative += err.what(); } if (!errors_cummulative.empty()) throw Slic3r::RuntimeError(errors_cummulative); @@ -1396,15 +1395,18 @@ std::vector PresetBundle::merge_presets(PresetBundle &&other) std::vector duplicate_filaments = this->filaments .merge_presets(std::move(other.filaments), this->vendors); std::vector duplicate_sla_materials = this->sla_materials.merge_presets(std::move(other.sla_materials), this->vendors); std::vector duplicate_printers = this->printers .merge_presets(std::move(other.printers), this->vendors); + std::vector duplicate_configs = this->configs .merge_presets(std::move(other.configs), this->vendors); append(this->obsolete_presets.prints, std::move(other.obsolete_presets.prints)); append(this->obsolete_presets.sla_prints, std::move(other.obsolete_presets.sla_prints)); append(this->obsolete_presets.filaments, std::move(other.obsolete_presets.filaments)); append(this->obsolete_presets.sla_materials, std::move(other.obsolete_presets.sla_materials)); append(this->obsolete_presets.printers, std::move(other.obsolete_presets.printers)); + append(this->obsolete_presets.configs, std::move(other.obsolete_presets.configs)); append(duplicate_prints, std::move(duplicate_sla_prints)); append(duplicate_prints, std::move(duplicate_filaments)); append(duplicate_prints, std::move(duplicate_sla_materials)); append(duplicate_prints, std::move(duplicate_printers)); + append(duplicate_configs, std::move(duplicate_configs)); return duplicate_prints; } @@ -1415,6 +1417,8 @@ void PresetBundle::update_system_maps() this->filaments .update_map_system_profile_renamed(); this->sla_materials.update_map_system_profile_renamed(); this->printers .update_map_system_profile_renamed(); + //xiamian+ + //this->configs .update_map_system_profile_renamed(); this->prints .update_map_alias_to_profile_name(); this->sla_prints .update_map_alias_to_profile_name(); @@ -1483,7 +1487,9 @@ void PresetBundle::save_changes_for_preset(const std::string& new_name, Preset:: 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 : printers; + type == Preset::TYPE_SLA_MATERIAL ? sla_materials : + type == Preset::TYPE_PRINTER ?printers : + configs; // if we want to save just some from selected options if (!unselected_options.empty()) { diff --git a/libslic3r/PrintConfig.cpp b/libslic3r/PrintConfig.cpp index fff501a..a09a141 100644 --- a/libslic3r/PrintConfig.cpp +++ b/libslic3r/PrintConfig.cpp @@ -940,7 +940,7 @@ void PrintConfigDef::init_fff_params() def->enum_labels.emplace_back(L("No-brim")); def->mode = comSimple; - def->set_default_value(new ConfigOptionEnum(btAutoBrim)); + def->set_default_value(new ConfigOptionEnum(btOuterOnly)); def = this->add("brim_object_gap", coFloat); def->label = L("Brim-object gap"); @@ -1788,7 +1788,7 @@ void PrintConfigDef::init_fff_params() def = this->add("default_print_speed", coFloat); def->label = L("Default print speed"); - def->tooltip = L("Speed of initial layer except the solid infill part"); + //def->tooltip = L("Speed of initial layer except the solid infill part"); def->sidetext = L("mm/s"); def->min = 0; def->mode = comAdvanced; @@ -1857,6 +1857,16 @@ void PrintConfigDef::init_fff_params() def->mode = comSimple; def->set_default_value(new ConfigOptionFloat(0.3)); + def = this->add("fibre_feed_rate", coFloat); + def->label = L("Fibre feed rate"); + def->category = L("Others"); + //def->tooltip = L("The width within which to jitter. It's adversed to be below outer wall line width"); + def->sidetext = L("mm"); + def->min = 0; + def->max = 1; + def->mode = comSimple; + def->set_default_value(new ConfigOptionFloat(0.3)); + def = this->add("fuzzy_skin_point_distance", coFloat); def->label = L("Fuzzy skin point distance"); def->category = L("Others"); @@ -3007,7 +3017,7 @@ void PrintConfigDef::init_fff_params() def->min = 0; def->max = 10; def->mode = comSimple; - def->set_default_value(new ConfigOptionInt(1)); + def->set_default_value(new ConfigOptionInt(2)); def = this->add("slow_down_layer_time", coInts); def->label = L("Layer time"); diff --git a/slic3r/GUI/ConfigWizard.hpp b/slic3r/GUI/ConfigWizard.hpp index f929a3a..891c118 100644 --- a/slic3r/GUI/ConfigWizard.hpp +++ b/slic3r/GUI/ConfigWizard.hpp @@ -33,6 +33,7 @@ public: SP_FILAMENTS, SP_MATERIALS, SP_CUSTOM, + SP_CONFIGS, }; ConfigWizard(wxWindow *parent); diff --git a/slic3r/GUI/GCodeViewer.cpp b/slic3r/GUI/GCodeViewer.cpp index 8d86156..1f134a9 100644 --- a/slic3r/GUI/GCodeViewer.cpp +++ b/slic3r/GUI/GCodeViewer.cpp @@ -4556,11 +4556,16 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv return; const Size cnv_size = wxGetApp().plater()->get_current_canvas3D()->get_canvas_size(); - + //Plater s_panel = wxGetApp().plater(); + //GLCanvas3D* s_panel = wxGetApp().plater()->get_current_canvas3D(); + //wxPanel* s_panel = p->status_panel; ImGuiWrapper& imgui = *wxGetApp().imgui(); + //ImGuiWrapper& imgui2 = *wxGetApp().imgui(); + //wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); //BBS: GUI refactor: move to the right imgui.set_next_window_pos(float(canvas_width - right_margin * m_scale), 0.0f, ImGuiCond_Always, 1.0f, 0.0f); + //imgui2.set_next_window_pos(float(canvas_width - right_margin * m_scale), 1.0f, ImGuiCond_Always, 2.0f, 1.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0,0.0)); ImGui::PushStyleColor(ImGuiCol_Separator, ImVec4(1.0f,1.0f,1.0f,0.6f)); @@ -4673,16 +4678,16 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv // BBS render column item { - if(callback && !checkbox && !visible) + if (callback && !checkbox && !visible) ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(172 / 255.0f, 172 / 255.0f, 172 / 255.0f, 1.00f)); float dummy_size = type == EItemType::None ? window_padding * 3 : ImGui::GetStyle().ItemSpacing.x + icon_size; ImGui::SameLine(dummy_size); imgui.text(columns_offsets[0].first); - - for (auto i = 1; i < columns_offsets.size(); i++) { - ImGui::SameLine(columns_offsets[i].second); - imgui.text(columns_offsets[i].first); - } + for (auto i = 1; i < columns_offsets.size(); i++) { + ImGui::SameLine(columns_offsets[i].second); + imgui.text(columns_offsets[i].first); + } + if (callback && !checkbox && !visible) ImGui::PopStyleColor(1); } @@ -4863,46 +4868,84 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv ImGui::PopStyleColor(3); ImGui::PopStyleVar(1); ImGui::SameLine(); - imgui.bold_text(_u8L("Color Scheme")); - push_combo_style(); - //xiamian+ - //wxBoxSizer* moreOptionsSizer = new wxBoxSizer(wxVERTICAL); + imgui.bold_text(_u8L("More parameters")); + //push_combo_style(); + + ////xiamian+ + ////wxBoxSizer* moreOptionsSizer = new wxBoxSizer(wxVERTICAL); - ImGui::SameLine(); - const char* view_type_value = view_type_items_str[m_view_type_sel].c_str(); - ImGuiComboFlags flags = 0; - if (ImGui::BBLBeginCombo("", view_type_value, flags)) { - ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0.0f); - for (int i = 0; i < view_type_items_str.size(); i++) { - const bool is_selected = (m_view_type_sel == i); - if (ImGui::BBLSelectable(view_type_items_str[i].c_str(), is_selected)) { - m_fold = false; - m_view_type_sel = i; - set_view_type(view_type_items[m_view_type_sel]); - reset_visible(view_type_items[m_view_type_sel]); - // update buffers' render paths - refresh_render_paths(false, false); - update_moves_slider(); - wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); - } - if (is_selected) { - ImGui::SetItemDefaultFocus(); - } - } - ImGui::PopStyleVar(1); - ImGui::EndCombo(); - } - pop_combo_style(); - ImGui::SameLine(); - ImGui::Dummy({ window_padding, window_padding }); + //ImGui::SameLine(); + //const char* view_type_value = view_type_items_str[m_view_type_sel].c_str(); + //ImGuiComboFlags flags = 0; + //if (ImGui::BBLBeginCombo("", view_type_value, flags)) { + // ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0.0f); + // //select controller + // for (int i = 0; i < view_type_items_str.size(); i++) { + // const bool is_selected = (m_view_type_sel == i); + // if (ImGui::BBLSelectable(view_type_items_str[i].c_str(), is_selected)) { + // m_fold = false; + // m_view_type_sel = i; + // set_view_type(view_type_items[m_view_type_sel]); + // reset_visible(view_type_items[m_view_type_sel]); + // // update buffers' render paths + // refresh_render_paths(false, false); + // update_moves_slider(); + // wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); + // } + // if (is_selected) { + // ImGui::SetItemDefaultFocus(); + // } + // } + // ImGui::PopStyleVar(1); + // ImGui::EndCombo(); + //} + //pop_combo_style(); + - if (m_fold) { + //ImGui::Dummy({ window_padding, window_padding }); + + /* if (m_fold) { legend_height = ImGui::GetStyle().WindowPadding.y + ImGui::GetFrameHeight() + window_padding * 2.5; imgui.end(); ImGui::PopStyleColor(6); ImGui::PopStyleVar(2); return; - } + }*/ + + //ImGui::Dummy({ window_padding, window_padding }); + + //imgui.bold_text(_u8L("Color Scheme")); + + //push_combo_style(); + //ImGui::SameLine(); + //const char* view_type_value = view_type_items_str[m_view_type_sel].c_str(); + //ImGuiComboFlags flags = 0; + //if (ImGui::BBLBeginCombo("", view_type_value, flags)) { + // ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0.0f); + // //select controller + // for (int i = 0; i < view_type_items_str.size(); i++) { + // const bool is_selected = (m_view_type_sel == i); + // if (ImGui::BBLSelectable(view_type_items_str[i].c_str(), is_selected)) { + // m_fold = false; + // m_view_type_sel = i; + // set_view_type(view_type_items[m_view_type_sel]); + // reset_visible(view_type_items[m_view_type_sel]); + // // update buffers' render paths + // refresh_render_paths(false, false); + // update_moves_slider(); + // wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); + // } + // if (is_selected) { + // ImGui::SetItemDefaultFocus(); + // } + // } + // ImGui::PopStyleVar(1); + // ImGui::EndCombo(); + //} + //pop_combo_style(); + + //ImGui::SameLine(); + //ImGui::Dummy({ window_padding, window_padding }); // data used to properly align items in columns when showing time std::vector offsets; @@ -4939,199 +4982,16 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv double koef = imperial_units ? GizmoObjectManipulation::in_to_mm : 1000.0; double unit_conver = imperial_units ? GizmoObjectManipulation::oz_to_g : 1; - - // used filament statistics - for (size_t extruder_id : m_extruder_ids) { - if (m_print_statistics.model_volumes_per_extruder.find(extruder_id) == m_print_statistics.model_volumes_per_extruder.end()) { - model_used_filaments_m.push_back(0.0); - model_used_filaments_g.push_back(0.0); - } - else { - double volume = m_print_statistics.model_volumes_per_extruder.at(extruder_id); - auto [model_used_filament_m, model_used_filament_g] = get_used_filament_from_volume(volume, extruder_id); - model_used_filaments_m.push_back(model_used_filament_m); - model_used_filaments_g.push_back(model_used_filament_g); - total_model_used_filament_m += model_used_filament_m; - total_model_used_filament_g += model_used_filament_g; - displayed_columns |= ColumnData::Model; - } - } - - for (size_t extruder_id : m_extruder_ids) { - if (m_print_statistics.wipe_tower_volumes_per_extruder.find(extruder_id) == m_print_statistics.wipe_tower_volumes_per_extruder.end()) { - wipe_tower_used_filaments_m.push_back(0.0); - wipe_tower_used_filaments_g.push_back(0.0); - } - else { - double volume = m_print_statistics.wipe_tower_volumes_per_extruder.at(extruder_id); - auto [wipe_tower_used_filament_m, wipe_tower_used_filament_g] = get_used_filament_from_volume(volume, extruder_id); - wipe_tower_used_filaments_m.push_back(wipe_tower_used_filament_m); - wipe_tower_used_filaments_g.push_back(wipe_tower_used_filament_g); - total_wipe_tower_used_filament_m += wipe_tower_used_filament_m; - total_wipe_tower_used_filament_g += wipe_tower_used_filament_g; - displayed_columns |= ColumnData::WipeTower; - } - } - - for (size_t extruder_id : m_extruder_ids) { - if (m_print_statistics.flush_per_filament.find(extruder_id) == m_print_statistics.flush_per_filament.end()) { - flushed_filaments_m.push_back(0.0); - flushed_filaments_g.push_back(0.0); - } - else { - double volume = m_print_statistics.flush_per_filament.at(extruder_id); - auto [flushed_filament_m, flushed_filament_g] = get_used_filament_from_volume(volume, extruder_id); - flushed_filaments_m.push_back(flushed_filament_m); - flushed_filaments_g.push_back(flushed_filament_g); - total_flushed_filament_m += flushed_filament_m; - total_flushed_filament_g += flushed_filament_g; - displayed_columns |= ColumnData::Flushed; - } - } - - for (size_t extruder_id : m_extruder_ids) { - if (m_print_statistics.support_volumes_per_extruder.find(extruder_id) == m_print_statistics.support_volumes_per_extruder.end()) { - support_used_filaments_m.push_back(0.0); - support_used_filaments_g.push_back(0.0); - } - else { - double volume = m_print_statistics.support_volumes_per_extruder.at(extruder_id); - auto [used_filament_m, used_filament_g] = get_used_filament_from_volume(volume, extruder_id); - support_used_filaments_m.push_back(used_filament_m); - support_used_filaments_g.push_back(used_filament_g); - total_support_used_filament_m += used_filament_m; - total_support_used_filament_g += used_filament_g; - displayed_columns |= ColumnData::Support; - } - } - - - // extrusion paths section -> title - ImGui::Dummy({ window_padding, window_padding }); - ImGui::SameLine(); - switch (m_view_type) - { - case EViewType::FeatureType: - { - // calculate offsets to align time/percentage data - char buffer[64]; - for (size_t i = 0; i < m_roles.size(); ++i) { - ExtrusionRole role = m_roles[i]; - if (role < erCount) { - labels.push_back(_u8L(ExtrusionEntity::role_to_string(role))); - auto [time, percent] = role_time_and_percent(role); - times.push_back((time > 0.0f) ? short_time(get_time_dhms(time)) : ""); - if (percent == 0) - ::sprintf(buffer, "0%%"); - else - percent > 0.001 ? ::sprintf(buffer, "%.1f%%", percent * 100) : ::sprintf(buffer, "<0.1%%"); - percents.push_back(buffer); - auto [model_used_filament_m, model_used_filament_g] = used_filament_per_role(role); - //model_used_filaments_m.push_back(model_used_filament_m); - //model_used_filaments_g.push_back(model_used_filament_g); - memset(&buffer, 0, sizeof(buffer)); - ::sprintf(buffer, imperial_units ? "%.2f in" : "%.2f m", model_used_filament_m); - used_filaments_m.push_back(buffer); - - memset(&buffer, 0, sizeof(buffer)); - ::sprintf(buffer, "%.2f g", model_used_filament_g); - used_filaments_g.push_back(buffer); - } - } - - //BBS: get travel time and percent - { - auto [time, percent] = move_time_and_percent(EMoveType::Travel); - travel_time = (time > 0.0f) ? short_time(get_time_dhms(time)) : ""; - if (percent == 0) - ::sprintf(buffer, "0%%"); - else - percent > 0.001 ? ::sprintf(buffer, "%.1f%%", percent * 100) : ::sprintf(buffer, "<0.1%%"); - travel_percent = buffer; - } - - offsets = calculate_offsets({ {_u8L("Line Type"), labels}, {_u8L("Time"), times}, {_u8L("Percent"), percents}, {_u8L("Used filament"), used_filaments_m}, {"", used_filaments_g}, {_u8L("Display"), {""}}}, icon_size); - append_headers({{_u8L("Line Type"), offsets[0]}, {_u8L("Time"), offsets[1]}, {_u8L("Percent"), offsets[2]}, {_u8L("Used filament"), offsets[3]}, {"", offsets[4]}, {_u8L("Display"), offsets[5]}}); - break; - } - case EViewType::Height: { imgui.title(_u8L("Layer Height (mm)")); break; } - case EViewType::Width: { imgui.title(_u8L("Line Width (mm)")); break; } - case EViewType::Feedrate: - { - imgui.title(_u8L("Speed (mm/s)")); - break; - } - - case EViewType::FanSpeed: { imgui.title(_u8L("Fan Speed (%)")); break; } - case EViewType::Temperature: { imgui.title(_u8L("Temperature (°C)")); break; } - case EViewType::VolumetricRate: { imgui.title(_u8L("Volumetric flow rate (mm³/s)")); break; } - case EViewType::LayerTime: { imgui.title(_u8L("Layer Time (s)")); break; } - - case EViewType::Tool: - { - // calculate used filaments data - for (size_t extruder_id : m_extruder_ids) { - if (m_print_statistics.model_volumes_per_extruder.find(extruder_id) == m_print_statistics.model_volumes_per_extruder.end()) - continue; - double volume = m_print_statistics.model_volumes_per_extruder.at(extruder_id); - - auto [model_used_filament_m, model_used_filament_g] = get_used_filament_from_volume(volume, extruder_id); - model_used_filaments_m.push_back(model_used_filament_m); - model_used_filaments_g.push_back(model_used_filament_g); - } - - offsets = calculate_offsets({ { "Extruder NNN", {""}}}, icon_size); - append_headers({ {_u8L("Filament"), offsets[0]}, {_u8L("Used filament"), offsets[1]} }); - break; - } - case EViewType::ColorPrint: - { - std::vector total_filaments; - char buffer[64]; - ::sprintf(buffer, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", ps.total_used_filament / /*1000*/koef, ps.total_weight / unit_conver); - total_filaments.push_back(buffer); - - - std::vector>> title_columns; - if (displayed_columns & ColumnData::Model) { - title_columns.push_back({ _u8L("Filament"), {""} }); - title_columns.push_back({ _u8L("Model"), total_filaments }); - } - if (displayed_columns & ColumnData::Support) { - title_columns.push_back({ _u8L("Support"), total_filaments }); - } - if (displayed_columns & ColumnData::Flushed) { - title_columns.push_back({ _u8L("Flushed"), total_filaments }); - } - if (displayed_columns & ColumnData::WipeTower) { - title_columns.push_back({ _u8L("Tower"), total_filaments }); - } - if ((displayed_columns & ~ColumnData::Model) > 0) { - title_columns.push_back({ _u8L("Total"), total_filaments }); - } - auto offsets_ = calculate_offsets(title_columns, icon_size); - std::vector> title_offsets; - for (int i = 0; i < offsets_.size(); i++) { - title_offsets.push_back({ title_columns[i].first, offsets_[i] }); - color_print_offsets[title_columns[i].first] = offsets_[i]; - } - append_headers(title_offsets); - - break; - } - default: { break; } - } - auto append_option_item = [this, append_item](EMoveType type, std::vector offsets) { auto append_option_item_with_type = [this, offsets, append_item](EMoveType type, const Color& color, const std::string& label, bool visible) { - append_item(EItemType::Rect, color, {{ label , offsets[0] }}, true, visible, [this, type, visible]() { + append_item(EItemType::Rect, color, { { label , offsets[0] } }, true, visible, [this, type, visible]() { m_buffers[buffer_id(type)].visible = !m_buffers[buffer_id(type)].visible; // update buffers' render paths refresh_render_paths(false, false); update_moves_slider(); wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); }); - }; + }; const bool visible = m_buffers[buffer_id(type)].visible; if (type == EMoveType::Travel) { //BBS: only display travel time in FeatureType view @@ -5147,544 +5007,797 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv append_option_item_with_type(type, Options_Colors[(int)EOptionsColors::ToolChanges], _u8L("Filament Changes"), visible); else if (type == EMoveType::Wipe) append_option_item_with_type(type, Wipe_Color, _u8L("Wipe"), visible); - }; + }; - // extrusion paths section -> items - switch (m_view_type) - { - case EViewType::FeatureType: - { - for (size_t i = 0; i < m_roles.size(); ++i) { - ExtrusionRole role = m_roles[i]; - if (role >= erCount) - continue; - const bool visible = is_visible(role); - std::vector> columns_offsets; - columns_offsets.push_back({ labels[i], offsets[0] }); - columns_offsets.push_back({ times[i], offsets[1] }); - columns_offsets.push_back({ percents[i], offsets[2] }); - columns_offsets.push_back({ used_filaments_m[i], offsets[3] }); - columns_offsets.push_back({ used_filaments_g[i], offsets[4] }); - append_item(EItemType::Rect, Extrusion_Role_Colors[static_cast(role)], columns_offsets, - true, visible, [this, role, visible]() { - m_extrusions.role_visibility_flags = visible ? m_extrusions.role_visibility_flags & ~(1 << role) : m_extrusions.role_visibility_flags | (1 << role); + if (!m_fold) { + //ImGui::Dummy(ImVec2(0.0f, ImGui::GetFontSize() * 0.1)); + ImGui::Dummy({ window_padding, window_padding }); + ImGui::Spacing(); + ImGui::Dummy({ window_padding, window_padding }); + //ImGui::Spacing(); + //ImGui::Dummy({ window_padding, window_padding }); + //imgui.bold_text(_u8L("Color Scheme")); + ImGui::SameLine(); + imgui.text(_u8L("Color Scheme")); + + push_combo_style(); + ImGui::SameLine(); + const char* view_type_value = view_type_items_str[m_view_type_sel].c_str(); + ImGuiComboFlags flags = 0; + if (ImGui::BBLBeginCombo("", view_type_value, flags)) { + ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0.0f); + //select controller + for (int i = 0; i < view_type_items_str.size(); i++) { + const bool is_selected = (m_view_type_sel == i); + if (ImGui::BBLSelectable(view_type_items_str[i].c_str(), is_selected)) { + m_fold = false; + m_view_type_sel = i; + set_view_type(view_type_items[m_view_type_sel]); + reset_visible(view_type_items[m_view_type_sel]); // update buffers' render paths refresh_render_paths(false, false); update_moves_slider(); wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); - }); + } + if (is_selected) { + ImGui::SetItemDefaultFocus(); + } + } + ImGui::PopStyleVar(1); + ImGui::EndCombo(); + } + pop_combo_style(); + //ImGui::Dummy({ window_padding, window_padding }); + ImGui::SameLine(); + ImGui::Dummy({ window_padding, window_padding }); + ImGui::Dummy({ window_padding, window_padding }); + // used filament statistics + for (size_t extruder_id : m_extruder_ids) { + if (m_print_statistics.model_volumes_per_extruder.find(extruder_id) == m_print_statistics.model_volumes_per_extruder.end()) { + model_used_filaments_m.push_back(0.0); + model_used_filaments_g.push_back(0.0); + } + else { + double volume = m_print_statistics.model_volumes_per_extruder.at(extruder_id); + auto [model_used_filament_m, model_used_filament_g] = get_used_filament_from_volume(volume, extruder_id); + model_used_filaments_m.push_back(model_used_filament_m); + model_used_filaments_g.push_back(model_used_filament_g); + total_model_used_filament_m += model_used_filament_m; + total_model_used_filament_g += model_used_filament_g; + displayed_columns |= ColumnData::Model; + } } - for(auto item : options_items) { - if (item != EMoveType::Travel) { - append_option_item(item, offsets); - } else { - //BBS: show travel time in FeatureType view - const bool visible = m_buffers[buffer_id(item)].visible; + for (size_t extruder_id : m_extruder_ids) { + if (m_print_statistics.wipe_tower_volumes_per_extruder.find(extruder_id) == m_print_statistics.wipe_tower_volumes_per_extruder.end()) { + wipe_tower_used_filaments_m.push_back(0.0); + wipe_tower_used_filaments_g.push_back(0.0); + } + else { + double volume = m_print_statistics.wipe_tower_volumes_per_extruder.at(extruder_id); + auto [wipe_tower_used_filament_m, wipe_tower_used_filament_g] = get_used_filament_from_volume(volume, extruder_id); + wipe_tower_used_filaments_m.push_back(wipe_tower_used_filament_m); + wipe_tower_used_filaments_g.push_back(wipe_tower_used_filament_g); + total_wipe_tower_used_filament_m += wipe_tower_used_filament_m; + total_wipe_tower_used_filament_g += wipe_tower_used_filament_g; + displayed_columns |= ColumnData::WipeTower; + } + } + + for (size_t extruder_id : m_extruder_ids) { + if (m_print_statistics.flush_per_filament.find(extruder_id) == m_print_statistics.flush_per_filament.end()) { + flushed_filaments_m.push_back(0.0); + flushed_filaments_g.push_back(0.0); + } + else { + double volume = m_print_statistics.flush_per_filament.at(extruder_id); + auto [flushed_filament_m, flushed_filament_g] = get_used_filament_from_volume(volume, extruder_id); + flushed_filaments_m.push_back(flushed_filament_m); + flushed_filaments_g.push_back(flushed_filament_g); + total_flushed_filament_m += flushed_filament_m; + total_flushed_filament_g += flushed_filament_g; + displayed_columns |= ColumnData::Flushed; + } + } + + for (size_t extruder_id : m_extruder_ids) { + if (m_print_statistics.support_volumes_per_extruder.find(extruder_id) == m_print_statistics.support_volumes_per_extruder.end()) { + support_used_filaments_m.push_back(0.0); + support_used_filaments_g.push_back(0.0); + } + else { + double volume = m_print_statistics.support_volumes_per_extruder.at(extruder_id); + auto [used_filament_m, used_filament_g] = get_used_filament_from_volume(volume, extruder_id); + support_used_filaments_m.push_back(used_filament_m); + support_used_filaments_g.push_back(used_filament_g); + total_support_used_filament_m += used_filament_m; + total_support_used_filament_g += used_filament_g; + displayed_columns |= ColumnData::Support; + } + } + + + // extrusion paths section -> title + ImGui::Dummy({ window_padding, window_padding }); + ImGui::SameLine(); + switch (m_view_type) + { + case EViewType::FeatureType: + { + // calculate offsets to align time/percentage data + char buffer[64]; + for (size_t i = 0; i < m_roles.size(); ++i) { + ExtrusionRole role = m_roles[i]; + if (role < erCount) { + labels.push_back(_u8L(ExtrusionEntity::role_to_string(role))); + auto [time, percent] = role_time_and_percent(role); + times.push_back((time > 0.0f) ? short_time(get_time_dhms(time)) : ""); + if (percent == 0) + ::sprintf(buffer, "0%%"); + else + percent > 0.001 ? ::sprintf(buffer, "%.1f%%", percent * 100) : ::sprintf(buffer, "<0.1%%"); + percents.push_back(buffer); + auto [model_used_filament_m, model_used_filament_g] = used_filament_per_role(role); + //model_used_filaments_m.push_back(model_used_filament_m); + //model_used_filaments_g.push_back(model_used_filament_g); + memset(&buffer, 0, sizeof(buffer)); + ::sprintf(buffer, imperial_units ? "%.2f in" : "%.2f m", model_used_filament_m); + used_filaments_m.push_back(buffer); + + memset(&buffer, 0, sizeof(buffer)); + ::sprintf(buffer, "%.2f g", model_used_filament_g); + used_filaments_g.push_back(buffer); + } + } + + //BBS: get travel time and percent + { + auto [time, percent] = move_time_and_percent(EMoveType::Travel); + travel_time = (time > 0.0f) ? short_time(get_time_dhms(time)) : ""; + if (percent == 0) + ::sprintf(buffer, "0%%"); + else + percent > 0.001 ? ::sprintf(buffer, "%.1f%%", percent * 100) : ::sprintf(buffer, "<0.1%%"); + travel_percent = buffer; + } + + offsets = calculate_offsets({ {_u8L("Line Type"), labels}, {_u8L("Time"), times}, {_u8L("Percent"), percents}, {_u8L("Used filament"), used_filaments_m}, {"", used_filaments_g}, {_u8L("Display"), {""}} }, icon_size); + append_headers({ {_u8L("Line Type"), offsets[0]}, {_u8L("Time"), offsets[1]}, {_u8L("Percent"), offsets[2]}, {_u8L("Used filament"), offsets[3]}, {"", offsets[4]}, {_u8L("Display"), offsets[5]} }); + break; + } + case EViewType::Height: { imgui.title(_u8L("Layer Height (mm)")); break; } + case EViewType::Width: { imgui.title(_u8L("Line Width (mm)")); break; } + case EViewType::Feedrate: + { + imgui.title(_u8L("Speed (mm/s)")); + break; + } + + case EViewType::FanSpeed: { imgui.title(_u8L("Fan Speed (%)")); break; } + case EViewType::Temperature: { imgui.title(_u8L("Temperature (°C)")); break; } + case EViewType::VolumetricRate: { imgui.title(_u8L("Volumetric flow rate (mm³/s)")); break; } + case EViewType::LayerTime: { imgui.title(_u8L("Layer Time (s)")); break; } + + case EViewType::Tool: + { + // calculate used filaments data + for (size_t extruder_id : m_extruder_ids) { + if (m_print_statistics.model_volumes_per_extruder.find(extruder_id) == m_print_statistics.model_volumes_per_extruder.end()) + continue; + double volume = m_print_statistics.model_volumes_per_extruder.at(extruder_id); + + auto [model_used_filament_m, model_used_filament_g] = get_used_filament_from_volume(volume, extruder_id); + model_used_filaments_m.push_back(model_used_filament_m); + model_used_filaments_g.push_back(model_used_filament_g); + } + + offsets = calculate_offsets({ { "Extruder NNN", {""}} }, icon_size); + append_headers({ {_u8L("Filament"), offsets[0]}, {_u8L("Used filament"), offsets[1]} }); + break; + } + case EViewType::ColorPrint: + { + std::vector total_filaments; + char buffer[64]; + ::sprintf(buffer, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", ps.total_used_filament / /*1000*/koef, ps.total_weight / unit_conver); + total_filaments.push_back(buffer); + + + std::vector>> title_columns; + if (displayed_columns & ColumnData::Model) { + title_columns.push_back({ _u8L("Filament"), {""} }); + title_columns.push_back({ _u8L("Model"), total_filaments }); + } + if (displayed_columns & ColumnData::Support) { + title_columns.push_back({ _u8L("Support"), total_filaments }); + } + if (displayed_columns & ColumnData::Flushed) { + title_columns.push_back({ _u8L("Flushed"), total_filaments }); + } + if (displayed_columns & ColumnData::WipeTower) { + title_columns.push_back({ _u8L("Tower"), total_filaments }); + } + if ((displayed_columns & ~ColumnData::Model) > 0) { + title_columns.push_back({ _u8L("Total"), total_filaments }); + } + auto offsets_ = calculate_offsets(title_columns, icon_size); + std::vector> title_offsets; + for (int i = 0; i < offsets_.size(); i++) { + title_offsets.push_back({ title_columns[i].first, offsets_[i] }); + color_print_offsets[title_columns[i].first] = offsets_[i]; + } + append_headers(title_offsets); + + break; + } + default: { break; } + } + + //auto append_option_item = [this, append_item](EMoveType type, std::vector offsets) { + // auto append_option_item_with_type = [this, offsets, append_item](EMoveType type, const Color& color, const std::string& label, bool visible) { + // append_item(EItemType::Rect, color, { { label , offsets[0] } }, true, visible, [this, type, visible]() { + // m_buffers[buffer_id(type)].visible = !m_buffers[buffer_id(type)].visible; + // // update buffers' render paths + // refresh_render_paths(false, false); + // update_moves_slider(); + // wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); + // }); + // }; + // const bool visible = m_buffers[buffer_id(type)].visible; + // if (type == EMoveType::Travel) { + // //BBS: only display travel time in FeatureType view + // append_option_item_with_type(type, Travel_Colors[0], _u8L("Travel"), visible); + // } + // else if (type == EMoveType::Seam) + // append_option_item_with_type(type, Options_Colors[(int)EOptionsColors::Seams], _u8L("Seams"), visible); + // else if (type == EMoveType::Retract) + // append_option_item_with_type(type, Options_Colors[(int)EOptionsColors::Retractions], _u8L("Retract"), visible); + // else if (type == EMoveType::Unretract) + // append_option_item_with_type(type, Options_Colors[(int)EOptionsColors::Unretractions], _u8L("Unretract"), visible); + // else if (type == EMoveType::Tool_change) + // append_option_item_with_type(type, Options_Colors[(int)EOptionsColors::ToolChanges], _u8L("Filament Changes"), visible); + // else if (type == EMoveType::Wipe) + // append_option_item_with_type(type, Wipe_Color, _u8L("Wipe"), visible); + // }; + + // extrusion paths section -> items + switch (m_view_type) + { + case EViewType::FeatureType: + { + for (size_t i = 0; i < m_roles.size(); ++i) { + ExtrusionRole role = m_roles[i]; + if (role >= erCount) + continue; + const bool visible = is_visible(role); std::vector> columns_offsets; - columns_offsets.push_back({ _u8L("Travel"), offsets[0] }); - columns_offsets.push_back({ travel_time, offsets[1] }); - columns_offsets.push_back({ travel_percent, offsets[2] }); - append_item(EItemType::Rect, Travel_Colors[0], columns_offsets, true, visible, [this, item, visible]() { + columns_offsets.push_back({ labels[i], offsets[0] }); + columns_offsets.push_back({ times[i], offsets[1] }); + columns_offsets.push_back({ percents[i], offsets[2] }); + columns_offsets.push_back({ used_filaments_m[i], offsets[3] }); + columns_offsets.push_back({ used_filaments_g[i], offsets[4] }); + append_item(EItemType::Rect, Extrusion_Role_Colors[static_cast(role)], columns_offsets, + true, visible, [this, role, visible]() { + m_extrusions.role_visibility_flags = visible ? m_extrusions.role_visibility_flags & ~(1 << role) : m_extrusions.role_visibility_flags | (1 << role); + // update buffers' render paths + refresh_render_paths(false, false); + update_moves_slider(); + wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); + }); + } + + for (auto item : options_items) { + if (item != EMoveType::Travel) { + append_option_item(item, offsets); + } + else { + //BBS: show travel time in FeatureType view + const bool visible = m_buffers[buffer_id(item)].visible; + std::vector> columns_offsets; + columns_offsets.push_back({ _u8L("Travel"), offsets[0] }); + columns_offsets.push_back({ travel_time, offsets[1] }); + columns_offsets.push_back({ travel_percent, offsets[2] }); + append_item(EItemType::Rect, Travel_Colors[0], columns_offsets, true, visible, [this, item, visible]() { m_buffers[buffer_id(item)].visible = !m_buffers[buffer_id(item)].visible; // update buffers' render paths refresh_render_paths(false, false); update_moves_slider(); wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); - }); + }); + } } + break; } - break; - } - case EViewType::Height: { append_range(m_extrusions.ranges.height, 2); break; } - case EViewType::Width: { append_range(m_extrusions.ranges.width, 2); break; } - case EViewType::Feedrate: { - append_range(m_extrusions.ranges.feedrate, 0); - ImGui::Spacing(); - ImGui::Dummy({ window_padding, window_padding }); - ImGui::SameLine(); - offsets = calculate_offsets({ { _u8L("Options"), { _u8L("Travel")}}, { _u8L("Display"), {""}} }, icon_size); - append_headers({ {_u8L("Options"), offsets[0] }, { _u8L("Display"), offsets[1]} }); - const bool travel_visible = m_buffers[buffer_id(EMoveType::Travel)].visible; - ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 3.0f)); - append_item(EItemType::None, Travel_Colors[0], { {_u8L("travel"), offsets[0] }}, true, travel_visible, [this, travel_visible]() { - m_buffers[buffer_id(EMoveType::Travel)].visible = !m_buffers[buffer_id(EMoveType::Travel)].visible; - // update buffers' render paths, and update m_tools.m_tool_colors and m_extrusions.ranges - refresh(*m_gcode_result, wxGetApp().plater()->get_extruder_colors_from_plater_config(m_gcode_result)); - update_moves_slider(); - wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); - }); - ImGui::PopStyleVar(1); - break; - } - case EViewType::FanSpeed: { append_range(m_extrusions.ranges.fan_speed, 0); break; } - case EViewType::Temperature: { append_range(m_extrusions.ranges.temperature, 0); break; } - case EViewType::LayerTime: { append_range(m_extrusions.ranges.layer_duration, 1); break; } - case EViewType::VolumetricRate: { append_range(m_extrusions.ranges.volumetric_rate, 2); break; } - case EViewType::Tool: - { - // shows only extruders actually used - char buf[64]; - size_t i = 0; - for (unsigned char extruder_id : m_extruder_ids) { - ::sprintf(buf, imperial_units ? "%.2f in %.2f g" : "%.2f m %.2f g", model_used_filaments_m[i], model_used_filaments_g[i]); - append_item(EItemType::Rect, m_tools.m_tool_colors[extruder_id], { { _u8L("Extruder") + " " + std::to_string(extruder_id + 1), offsets[0]}, {buf, offsets[1]} }); - i++; + case EViewType::Height: { append_range(m_extrusions.ranges.height, 2); break; } + case EViewType::Width: { append_range(m_extrusions.ranges.width, 2); break; } + case EViewType::Feedrate: { + append_range(m_extrusions.ranges.feedrate, 0); + ImGui::Spacing(); + ImGui::Dummy({ window_padding, window_padding }); + ImGui::SameLine(); + offsets = calculate_offsets({ { _u8L("Options"), { _u8L("Travel")}}, { _u8L("Display"), {""}} }, icon_size); + append_headers({ {_u8L("Options"), offsets[0] }, { _u8L("Display"), offsets[1]} }); + const bool travel_visible = m_buffers[buffer_id(EMoveType::Travel)].visible; + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 3.0f)); + append_item(EItemType::None, Travel_Colors[0], { {_u8L("travel"), offsets[0] } }, true, travel_visible, [this, travel_visible]() { + m_buffers[buffer_id(EMoveType::Travel)].visible = !m_buffers[buffer_id(EMoveType::Travel)].visible; + // update buffers' render paths, and update m_tools.m_tool_colors and m_extrusions.ranges + refresh(*m_gcode_result, wxGetApp().plater()->get_extruder_colors_from_plater_config(m_gcode_result)); + update_moves_slider(); + wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); + }); + ImGui::PopStyleVar(1); + break; } - break; - } - case EViewType::ColorPrint: - { - //BBS: replace model custom gcode with current plate custom gcode - const std::vector& custom_gcode_per_print_z = wxGetApp().is_editor() ? wxGetApp().plater()->model().get_curr_plate_custom_gcodes().gcodes : m_custom_gcode_per_print_z; - size_t total_items = 1; - // BBS: no ColorChange type, use ToolChange - //for (size_t extruder_id : m_extruder_ids) { - // total_items += color_print_ranges(extruder_id, custom_gcode_per_print_z).size(); - //} + case EViewType::FanSpeed: { append_range(m_extrusions.ranges.fan_speed, 0); break; } + case EViewType::Temperature: { append_range(m_extrusions.ranges.temperature, 0); break; } + case EViewType::LayerTime: { append_range(m_extrusions.ranges.layer_duration, 1); break; } + case EViewType::VolumetricRate: { append_range(m_extrusions.ranges.volumetric_rate, 2); break; } + case EViewType::Tool: + { + // shows only extruders actually used + char buf[64]; + size_t i = 0; + for (unsigned char extruder_id : m_extruder_ids) { + ::sprintf(buf, imperial_units ? "%.2f in %.2f g" : "%.2f m %.2f g", model_used_filaments_m[i], model_used_filaments_g[i]); + append_item(EItemType::Rect, m_tools.m_tool_colors[extruder_id], { { _u8L("Extruder") + " " + std::to_string(extruder_id + 1), offsets[0]}, {buf, offsets[1]} }); + i++; + } + break; + } + case EViewType::ColorPrint: + { + //BBS: replace model custom gcode with current plate custom gcode + const std::vector& custom_gcode_per_print_z = wxGetApp().is_editor() ? wxGetApp().plater()->model().get_curr_plate_custom_gcodes().gcodes : m_custom_gcode_per_print_z; + size_t total_items = 1; + // BBS: no ColorChange type, use ToolChange + //for (size_t extruder_id : m_extruder_ids) { + // total_items += color_print_ranges(extruder_id, custom_gcode_per_print_z).size(); + //} - const bool need_scrollable = static_cast(total_items) * (icon_size + ImGui::GetStyle().ItemSpacing.y) > child_height; + const bool need_scrollable = static_cast(total_items) * (icon_size + ImGui::GetStyle().ItemSpacing.y) > child_height; - // add scrollable region, if needed - if (need_scrollable) - ImGui::BeginChild("color_prints", { -1.0f, child_height }, false); + // add scrollable region, if needed + if (need_scrollable) + ImGui::BeginChild("color_prints", { -1.0f, child_height }, false); - // shows only extruders actually used - size_t i = 0; - for (auto extruder_idx : m_extruder_ids) { - const bool filament_visible = m_tools.m_tool_visibles[extruder_idx]; - if (i < model_used_filaments_m.size() && i < model_used_filaments_g.size()) { - std::vector> columns_offsets; - columns_offsets.push_back({ std::to_string(extruder_idx + 1), color_print_offsets[_u8L("Filament")]}); + // shows only extruders actually used + size_t i = 0; + for (auto extruder_idx : m_extruder_ids) { + const bool filament_visible = m_tools.m_tool_visibles[extruder_idx]; + if (i < model_used_filaments_m.size() && i < model_used_filaments_g.size()) { + std::vector> columns_offsets; + columns_offsets.push_back({ std::to_string(extruder_idx + 1), color_print_offsets[_u8L("Filament")] }); - char buf[64]; - float column_sum_m = 0.0f; - float column_sum_g = 0.0f; - if (displayed_columns & ColumnData::Model) { - if ((displayed_columns & ~ColumnData::Model) > 0) - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", model_used_filaments_m[i], model_used_filaments_g[i] / unit_conver); - else - ::sprintf(buf, imperial_units ? "%.2f in %.2f oz" : "%.2f m %.2f g", model_used_filaments_m[i], model_used_filaments_g[i] / unit_conver); - columns_offsets.push_back({ buf, color_print_offsets[_u8L("Model")] }); - column_sum_m += model_used_filaments_m[i]; - column_sum_g += model_used_filaments_g[i]; - } - if (displayed_columns & ColumnData::Support) { - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", support_used_filaments_m[i], support_used_filaments_g[i] / unit_conver); - columns_offsets.push_back({ buf, color_print_offsets[_u8L("Support")] }); - column_sum_m += support_used_filaments_m[i]; - column_sum_g += support_used_filaments_g[i]; - } - if (displayed_columns & ColumnData::Flushed) { - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", flushed_filaments_m[i], flushed_filaments_g[i] / unit_conver); - columns_offsets.push_back({ buf, color_print_offsets[_u8L("Flushed")]}); - column_sum_m += flushed_filaments_m[i]; - column_sum_g += flushed_filaments_g[i]; - } - if (displayed_columns & ColumnData::WipeTower) { - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", wipe_tower_used_filaments_m[i], wipe_tower_used_filaments_g[i] / unit_conver); - columns_offsets.push_back({ buf, color_print_offsets[_u8L("Tower")] }); - column_sum_m += wipe_tower_used_filaments_m[i]; - column_sum_g += wipe_tower_used_filaments_g[i]; - } - if ((displayed_columns & ~ColumnData::Model) > 0) { - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", column_sum_m, column_sum_g / unit_conver); - columns_offsets.push_back({ buf, color_print_offsets[_u8L("Total")] }); - } + char buf[64]; + float column_sum_m = 0.0f; + float column_sum_g = 0.0f; + if (displayed_columns & ColumnData::Model) { + if ((displayed_columns & ~ColumnData::Model) > 0) + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", model_used_filaments_m[i], model_used_filaments_g[i] / unit_conver); + else + ::sprintf(buf, imperial_units ? "%.2f in %.2f oz" : "%.2f m %.2f g", model_used_filaments_m[i], model_used_filaments_g[i] / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Model")] }); + column_sum_m += model_used_filaments_m[i]; + column_sum_g += model_used_filaments_g[i]; + } + if (displayed_columns & ColumnData::Support) { + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", support_used_filaments_m[i], support_used_filaments_g[i] / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Support")] }); + column_sum_m += support_used_filaments_m[i]; + column_sum_g += support_used_filaments_g[i]; + } + if (displayed_columns & ColumnData::Flushed) { + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", flushed_filaments_m[i], flushed_filaments_g[i] / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Flushed")] }); + column_sum_m += flushed_filaments_m[i]; + column_sum_g += flushed_filaments_g[i]; + } + if (displayed_columns & ColumnData::WipeTower) { + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", wipe_tower_used_filaments_m[i], wipe_tower_used_filaments_g[i] / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Tower")] }); + column_sum_m += wipe_tower_used_filaments_m[i]; + column_sum_g += wipe_tower_used_filaments_g[i]; + } + if ((displayed_columns & ~ColumnData::Model) > 0) { + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", column_sum_m, column_sum_g / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Total")] }); + } - append_item(EItemType::Rect, m_tools.m_tool_colors[extruder_idx], columns_offsets, false, filament_visible, [this, extruder_idx]() { + append_item(EItemType::Rect, m_tools.m_tool_colors[extruder_idx], columns_offsets, false, filament_visible, [this, extruder_idx]() { m_tools.m_tool_visibles[extruder_idx] = !m_tools.m_tool_visibles[extruder_idx]; // update buffers' render paths refresh_render_paths(false, false); update_moves_slider(); wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); - }); - } - i++; - } - - if (need_scrollable) - ImGui::EndChild(); - - // Sum of all rows - char buf[64]; - if (m_extruder_ids.size() > 1) { - // Separator - ImGuiWindow* window = ImGui::GetCurrentWindow(); - const ImRect separator(ImVec2(window->Pos.x + window_padding * 3, window->DC.CursorPos.y), ImVec2(window->Pos.x + window->Size.x - window_padding * 3, window->DC.CursorPos.y + 1.0f)); - ImGui::ItemSize(ImVec2(0.0f, 0.0f)); - const bool item_visible = ImGui::ItemAdd(separator, 0); - window->DrawList->AddLine(separator.Min, ImVec2(separator.Max.x, separator.Min.y), ImGui::GetColorU32(ImGuiCol_Separator)); - - std::vector> columns_offsets; - columns_offsets.push_back({ _u8L("Total"), color_print_offsets[_u8L("Filament")]}); - if (displayed_columns & ColumnData::Model) { - if ((displayed_columns & ~ColumnData::Model) > 0) - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_model_used_filament_m, total_model_used_filament_g / unit_conver); - else - ::sprintf(buf, imperial_units ? "%.2f in %.2f oz" : "%.2f m %.2f g", total_model_used_filament_m, total_model_used_filament_g / unit_conver); - columns_offsets.push_back({ buf, color_print_offsets[_u8L("Model")] }); - } - if (displayed_columns & ColumnData::Support) { - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_support_used_filament_m, total_support_used_filament_g / unit_conver); - columns_offsets.push_back({ buf, color_print_offsets[_u8L("Support")] }); - } - if (displayed_columns & ColumnData::Flushed) { - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_flushed_filament_m, total_flushed_filament_g / unit_conver); - columns_offsets.push_back({ buf, color_print_offsets[_u8L("Flushed")] }); - } - if (displayed_columns & ColumnData::WipeTower) { - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_wipe_tower_used_filament_m, total_wipe_tower_used_filament_g / unit_conver); - columns_offsets.push_back({ buf, color_print_offsets[_u8L("Tower")] }); - } - if ((displayed_columns & ~ColumnData::Model) > 0) { - ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_model_used_filament_m + total_support_used_filament_m + total_flushed_filament_m + total_wipe_tower_used_filament_m, - (total_model_used_filament_g + total_support_used_filament_g + total_flushed_filament_g + total_wipe_tower_used_filament_g) / unit_conver); - columns_offsets.push_back({ buf, color_print_offsets[_u8L("Total")] }); - } - append_item(EItemType::None, m_tools.m_tool_colors[0], columns_offsets); - } - - //BBS display filament change times - ImGui::Dummy({window_padding, window_padding}); - ImGui::SameLine(); - imgui.text(_u8L("Filament change times") + ":"); - ImGui::SameLine(); - ::sprintf(buf, "%d", m_print_statistics.total_filamentchanges); - imgui.text(buf); - - //BBS display cost - ImGui::Dummy({ window_padding, window_padding }); - ImGui::SameLine(); - imgui.text(_u8L("Cost")+":"); - ImGui::SameLine(); - ::sprintf(buf, "%.2f", ps.total_cost); - imgui.text(buf); - - break; - } - default: { break; } - } - - // partial estimated printing time section - if (m_view_type == EViewType::ColorPrint) { - using Times = std::pair; - using TimesList = std::vector>; - - // helper structure containig the data needed to render the time items - struct PartialTime - { - enum class EType : unsigned char - { - Print, - ColorChange, - Pause - }; - EType type; - int extruder_id; - Color color1; - Color color2; - Times times; - std::pair used_filament {0.0f, 0.0f}; - }; - using PartialTimes = std::vector; - - auto generate_partial_times = [this, get_used_filament_from_volume](const TimesList& times, const std::vector& used_filaments) { - PartialTimes items; - - //BBS: replace model custom gcode with current plate custom gcode - std::vector custom_gcode_per_print_z = wxGetApp().is_editor() ? wxGetApp().plater()->model().get_curr_plate_custom_gcodes().gcodes : m_custom_gcode_per_print_z; - std::vector last_color(m_extruders_count); - for (size_t i = 0; i < m_extruders_count; ++i) { - last_color[i] = m_tools.m_tool_colors[i]; - } - int last_extruder_id = 1; - int color_change_idx = 0; - for (const auto& time_rec : times) { - switch (time_rec.first) - { - case CustomGCode::PausePrint: { - auto it = std::find_if(custom_gcode_per_print_z.begin(), custom_gcode_per_print_z.end(), [time_rec](const CustomGCode::Item& item) { return item.type == time_rec.first; }); - if (it != custom_gcode_per_print_z.end()) { - items.push_back({ PartialTime::EType::Print, it->extruder, last_color[it->extruder - 1], Color(), time_rec.second }); - items.push_back({ PartialTime::EType::Pause, it->extruder, Color(), Color(), time_rec.second }); - custom_gcode_per_print_z.erase(it); - } - break; + }); } - case CustomGCode::ColorChange: { - auto it = std::find_if(custom_gcode_per_print_z.begin(), custom_gcode_per_print_z.end(), [time_rec](const CustomGCode::Item& item) { return item.type == time_rec.first; }); - if (it != custom_gcode_per_print_z.end()) { - items.push_back({ PartialTime::EType::Print, it->extruder, last_color[it->extruder - 1], Color(), time_rec.second, get_used_filament_from_volume(used_filaments[color_change_idx++], it->extruder-1) }); - items.push_back({ PartialTime::EType::ColorChange, it->extruder, last_color[it->extruder - 1], decode_color(it->color), time_rec.second }); - last_color[it->extruder - 1] = decode_color(it->color); - last_extruder_id = it->extruder; - custom_gcode_per_print_z.erase(it); - } + i++; + } + + if (need_scrollable) + ImGui::EndChild(); + + // Sum of all rows + char buf[64]; + if (m_extruder_ids.size() > 1) { + // Separator + ImGuiWindow* window = ImGui::GetCurrentWindow(); + const ImRect separator(ImVec2(window->Pos.x + window_padding * 3, window->DC.CursorPos.y), ImVec2(window->Pos.x + window->Size.x - window_padding * 3, window->DC.CursorPos.y + 1.0f)); + ImGui::ItemSize(ImVec2(0.0f, 0.0f)); + const bool item_visible = ImGui::ItemAdd(separator, 0); + window->DrawList->AddLine(separator.Min, ImVec2(separator.Max.x, separator.Min.y), ImGui::GetColorU32(ImGuiCol_Separator)); + + std::vector> columns_offsets; + columns_offsets.push_back({ _u8L("Total"), color_print_offsets[_u8L("Filament")] }); + if (displayed_columns & ColumnData::Model) { + if ((displayed_columns & ~ColumnData::Model) > 0) + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_model_used_filament_m, total_model_used_filament_g / unit_conver); else - items.push_back({ PartialTime::EType::Print, last_extruder_id, last_color[last_extruder_id - 1], Color(), time_rec.second, get_used_filament_from_volume(used_filaments[color_change_idx++], last_extruder_id -1) }); - - break; + ::sprintf(buf, imperial_units ? "%.2f in %.2f oz" : "%.2f m %.2f g", total_model_used_filament_m, total_model_used_filament_g / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Model")] }); } - default: { break; } + if (displayed_columns & ColumnData::Support) { + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_support_used_filament_m, total_support_used_filament_g / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Support")] }); } + if (displayed_columns & ColumnData::Flushed) { + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_flushed_filament_m, total_flushed_filament_g / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Flushed")] }); + } + if (displayed_columns & ColumnData::WipeTower) { + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_wipe_tower_used_filament_m, total_wipe_tower_used_filament_g / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Tower")] }); + } + if ((displayed_columns & ~ColumnData::Model) > 0) { + ::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_model_used_filament_m + total_support_used_filament_m + total_flushed_filament_m + total_wipe_tower_used_filament_m, + (total_model_used_filament_g + total_support_used_filament_g + total_flushed_filament_g + total_wipe_tower_used_filament_g) / unit_conver); + columns_offsets.push_back({ buf, color_print_offsets[_u8L("Total")] }); + } + append_item(EItemType::None, m_tools.m_tool_colors[0], columns_offsets); } - return items; - }; - - auto append_color_change = [&imgui](const Color& color1, const Color& color2, const std::array& offsets, const Times& times) { - imgui.text(_u8L("Color change")); + //BBS display filament change times + ImGui::Dummy({ window_padding, window_padding }); ImGui::SameLine(); - - float icon_size = ImGui::GetTextLineHeight(); - ImDrawList* draw_list = ImGui::GetWindowDrawList(); - ImVec2 pos = ImGui::GetCursorScreenPos(); - pos.x -= 0.5f * ImGui::GetStyle().ItemSpacing.x; - - draw_list->AddRectFilled({ pos.x + 1.0f, pos.y + 1.0f }, { pos.x + icon_size - 1.0f, pos.y + icon_size - 1.0f }, - ImGui::GetColorU32({ color1[0], color1[1], color1[2], 1.0f })); - pos.x += icon_size; - draw_list->AddRectFilled({ pos.x + 1.0f, pos.y + 1.0f }, { pos.x + icon_size - 1.0f, pos.y + icon_size - 1.0f }, - ImGui::GetColorU32({ color2[0], color2[1], color2[2], 1.0f })); - - ImGui::SameLine(offsets[0]); - imgui.text(short_time(get_time_dhms(times.second - times.first))); - }; - - auto append_print = [&imgui, imperial_units](const Color& color, const std::array& offsets, const Times& times, std::pair used_filament) { - imgui.text(_u8L("Print")); + imgui.text(_u8L("Filament change times") + ":"); ImGui::SameLine(); + ::sprintf(buf, "%d", m_print_statistics.total_filamentchanges); + imgui.text(buf); - float icon_size = ImGui::GetTextLineHeight(); - ImDrawList* draw_list = ImGui::GetWindowDrawList(); - ImVec2 pos = ImGui::GetCursorScreenPos(); - pos.x -= 0.5f * ImGui::GetStyle().ItemSpacing.x; + //BBS display cost + ImGui::Dummy({ window_padding, window_padding }); + ImGui::SameLine(); + imgui.text(_u8L("Cost") + ":"); + ImGui::SameLine(); + ::sprintf(buf, "%.2f", ps.total_cost); + imgui.text(buf); - draw_list->AddRectFilled({ pos.x + 1.0f, pos.y + 1.0f }, { pos.x + icon_size - 1.0f, pos.y + icon_size - 1.0f }, - ImGui::GetColorU32({ color[0], color[1], color[2], 1.0f })); + break; + } + default: { break; } + } - ImGui::SameLine(offsets[0]); - imgui.text(short_time(get_time_dhms(times.second))); - ImGui::SameLine(offsets[1]); - imgui.text(short_time(get_time_dhms(times.first))); - if (used_filament.first > 0.0f) { - char buffer[64]; - ImGui::SameLine(offsets[2]); - ::sprintf(buffer, imperial_units ? "%.2f in" : "%.2f m", used_filament.first); - imgui.text(buffer); + // partial estimated printing time section + if (m_view_type == EViewType::ColorPrint) { + using Times = std::pair; + using TimesList = std::vector>; - ImGui::SameLine(offsets[3]); - ::sprintf(buffer, "%.2f g", used_filament.second); - imgui.text(buffer); - } - }; - - PartialTimes partial_times = generate_partial_times(time_mode.custom_gcode_times, m_print_statistics.volumes_per_color_change); - if (!partial_times.empty()) { - labels.clear(); - times.clear(); - - for (const PartialTime& item : partial_times) { - switch (item.type) + // helper structure containig the data needed to render the time items + struct PartialTime + { + enum class EType : unsigned char { - case PartialTime::EType::Print: { labels.push_back(_u8L("Print")); break; } - case PartialTime::EType::Pause: { labels.push_back(_u8L("Pause")); break; } - case PartialTime::EType::ColorChange: { labels.push_back(_u8L("Color change")); break; } - } - times.push_back(short_time(get_time_dhms(item.times.second))); - } + Print, + ColorChange, + Pause + }; + EType type; + int extruder_id; + Color color1; + Color color2; + Times times; + std::pair used_filament{ 0.0f, 0.0f }; + }; + using PartialTimes = std::vector; - std::string longest_used_filament_string; - for (const PartialTime& item : partial_times) { - if (item.used_filament.first > 0.0f) { + auto generate_partial_times = [this, get_used_filament_from_volume](const TimesList& times, const std::vector& used_filaments) { + PartialTimes items; + + //BBS: replace model custom gcode with current plate custom gcode + std::vector custom_gcode_per_print_z = wxGetApp().is_editor() ? wxGetApp().plater()->model().get_curr_plate_custom_gcodes().gcodes : m_custom_gcode_per_print_z; + std::vector last_color(m_extruders_count); + for (size_t i = 0; i < m_extruders_count; ++i) { + last_color[i] = m_tools.m_tool_colors[i]; + } + int last_extruder_id = 1; + int color_change_idx = 0; + for (const auto& time_rec : times) { + switch (time_rec.first) + { + case CustomGCode::PausePrint: { + auto it = std::find_if(custom_gcode_per_print_z.begin(), custom_gcode_per_print_z.end(), [time_rec](const CustomGCode::Item& item) { return item.type == time_rec.first; }); + if (it != custom_gcode_per_print_z.end()) { + items.push_back({ PartialTime::EType::Print, it->extruder, last_color[it->extruder - 1], Color(), time_rec.second }); + items.push_back({ PartialTime::EType::Pause, it->extruder, Color(), Color(), time_rec.second }); + custom_gcode_per_print_z.erase(it); + } + break; + } + case CustomGCode::ColorChange: { + auto it = std::find_if(custom_gcode_per_print_z.begin(), custom_gcode_per_print_z.end(), [time_rec](const CustomGCode::Item& item) { return item.type == time_rec.first; }); + if (it != custom_gcode_per_print_z.end()) { + items.push_back({ PartialTime::EType::Print, it->extruder, last_color[it->extruder - 1], Color(), time_rec.second, get_used_filament_from_volume(used_filaments[color_change_idx++], it->extruder - 1) }); + items.push_back({ PartialTime::EType::ColorChange, it->extruder, last_color[it->extruder - 1], decode_color(it->color), time_rec.second }); + last_color[it->extruder - 1] = decode_color(it->color); + last_extruder_id = it->extruder; + custom_gcode_per_print_z.erase(it); + } + else + items.push_back({ PartialTime::EType::Print, last_extruder_id, last_color[last_extruder_id - 1], Color(), time_rec.second, get_used_filament_from_volume(used_filaments[color_change_idx++], last_extruder_id - 1) }); + + break; + } + default: { break; } + } + } + + return items; + }; + + auto append_color_change = [&imgui](const Color& color1, const Color& color2, const std::array& offsets, const Times& times) { + imgui.text(_u8L("Color change")); + ImGui::SameLine(); + + float icon_size = ImGui::GetTextLineHeight(); + ImDrawList* draw_list = ImGui::GetWindowDrawList(); + ImVec2 pos = ImGui::GetCursorScreenPos(); + pos.x -= 0.5f * ImGui::GetStyle().ItemSpacing.x; + + draw_list->AddRectFilled({ pos.x + 1.0f, pos.y + 1.0f }, { pos.x + icon_size - 1.0f, pos.y + icon_size - 1.0f }, + ImGui::GetColorU32({ color1[0], color1[1], color1[2], 1.0f })); + pos.x += icon_size; + draw_list->AddRectFilled({ pos.x + 1.0f, pos.y + 1.0f }, { pos.x + icon_size - 1.0f, pos.y + icon_size - 1.0f }, + ImGui::GetColorU32({ color2[0], color2[1], color2[2], 1.0f })); + + ImGui::SameLine(offsets[0]); + imgui.text(short_time(get_time_dhms(times.second - times.first))); + }; + + auto append_print = [&imgui, imperial_units](const Color& color, const std::array& offsets, const Times& times, std::pair used_filament) { + imgui.text(_u8L("Print")); + ImGui::SameLine(); + + float icon_size = ImGui::GetTextLineHeight(); + ImDrawList* draw_list = ImGui::GetWindowDrawList(); + ImVec2 pos = ImGui::GetCursorScreenPos(); + pos.x -= 0.5f * ImGui::GetStyle().ItemSpacing.x; + + draw_list->AddRectFilled({ pos.x + 1.0f, pos.y + 1.0f }, { pos.x + icon_size - 1.0f, pos.y + icon_size - 1.0f }, + ImGui::GetColorU32({ color[0], color[1], color[2], 1.0f })); + + ImGui::SameLine(offsets[0]); + imgui.text(short_time(get_time_dhms(times.second))); + ImGui::SameLine(offsets[1]); + imgui.text(short_time(get_time_dhms(times.first))); + if (used_filament.first > 0.0f) { char buffer[64]; - ::sprintf(buffer, imperial_units ? "%.2f in" : "%.2f m", item.used_filament.first); - if (::strlen(buffer) > longest_used_filament_string.length()) - longest_used_filament_string = buffer; + ImGui::SameLine(offsets[2]); + ::sprintf(buffer, imperial_units ? "%.2f in" : "%.2f m", used_filament.first); + imgui.text(buffer); + + ImGui::SameLine(offsets[3]); + ::sprintf(buffer, "%.2f g", used_filament.second); + imgui.text(buffer); } + }; + + PartialTimes partial_times = generate_partial_times(time_mode.custom_gcode_times, m_print_statistics.volumes_per_color_change); + if (!partial_times.empty()) { + labels.clear(); + times.clear(); + + for (const PartialTime& item : partial_times) { + switch (item.type) + { + case PartialTime::EType::Print: { labels.push_back(_u8L("Print")); break; } + case PartialTime::EType::Pause: { labels.push_back(_u8L("Pause")); break; } + case PartialTime::EType::ColorChange: { labels.push_back(_u8L("Color change")); break; } + } + times.push_back(short_time(get_time_dhms(item.times.second))); + } + + std::string longest_used_filament_string; + for (const PartialTime& item : partial_times) { + if (item.used_filament.first > 0.0f) { + char buffer[64]; + ::sprintf(buffer, imperial_units ? "%.2f in" : "%.2f m", item.used_filament.first); + if (::strlen(buffer) > longest_used_filament_string.length()) + longest_used_filament_string = buffer; + } + } + + //offsets = calculate_offsets(labels, times, { _u8L("Event"), _u8L("Remaining time"), _u8L("Duration"), longest_used_filament_string }, 2.0f * icon_size); + + //ImGui::Spacing(); + //append_headers({ _u8L("Event"), _u8L("Remaining time"), _u8L("Duration"), _u8L("Used filament") }, offsets); + //const bool need_scrollable = static_cast(partial_times.size()) * (icon_size + ImGui::GetStyle().ItemSpacing.y) > child_height; + //if (need_scrollable) + // // add scrollable region + // ImGui::BeginChild("events", { -1.0f, child_height }, false); + + //for (const PartialTime& item : partial_times) { + // switch (item.type) + // { + // case PartialTime::EType::Print: { + // append_print(item.color1, offsets, item.times, item.used_filament); + // break; + // } + // case PartialTime::EType::Pause: { + // imgui.text(_u8L("Pause")); + // ImGui::SameLine(offsets[0]); + // imgui.text(short_time(get_time_dhms(item.times.second - item.times.first))); + // break; + // } + // case PartialTime::EType::ColorChange: { + // append_color_change(item.color1, item.color2, offsets, item.times); + // break; + // } + // } + //} + + //if (need_scrollable) + // ImGui::EndChild(); } - - //offsets = calculate_offsets(labels, times, { _u8L("Event"), _u8L("Remaining time"), _u8L("Duration"), longest_used_filament_string }, 2.0f * icon_size); - - //ImGui::Spacing(); - //append_headers({ _u8L("Event"), _u8L("Remaining time"), _u8L("Duration"), _u8L("Used filament") }, offsets); - //const bool need_scrollable = static_cast(partial_times.size()) * (icon_size + ImGui::GetStyle().ItemSpacing.y) > child_height; - //if (need_scrollable) - // // add scrollable region - // ImGui::BeginChild("events", { -1.0f, child_height }, false); - - //for (const PartialTime& item : partial_times) { - // switch (item.type) - // { - // case PartialTime::EType::Print: { - // append_print(item.color1, offsets, item.times, item.used_filament); - // break; - // } - // case PartialTime::EType::Pause: { - // imgui.text(_u8L("Pause")); - // ImGui::SameLine(offsets[0]); - // imgui.text(short_time(get_time_dhms(item.times.second - item.times.first))); - // break; - // } - // case PartialTime::EType::ColorChange: { - // append_color_change(item.color1, item.color2, offsets, item.times); - // break; - // } - // } - //} - - //if (need_scrollable) - // ImGui::EndChild(); } - } - // travel paths section - if (m_buffers[buffer_id(EMoveType::Travel)].visible) { - switch (m_view_type) - { - case EViewType::Feedrate: - case EViewType::Tool: - case EViewType::ColorPrint: { - break; + // travel paths section + if (m_buffers[buffer_id(EMoveType::Travel)].visible) { + switch (m_view_type) + { + case EViewType::Feedrate: + case EViewType::Tool: + case EViewType::ColorPrint: { + break; + } + default: { + // BBS GUI:refactor + // title + //ImGui::Spacing(); + //imgui.title(_u8L("Travel")); + //// items + //append_item(EItemType::Line, Travel_Colors[0], _u8L("Movement")); + //append_item(EItemType::Line, Travel_Colors[1], _u8L("Extrusion")); + //append_item(EItemType::Line, Travel_Colors[2], _u8L("Retraction")); + + break; + } + } } - default: { - // BBS GUI:refactor - // title - //ImGui::Spacing(); - //imgui.title(_u8L("Travel")); - //// items - //append_item(EItemType::Line, Travel_Colors[0], _u8L("Movement")); - //append_item(EItemType::Line, Travel_Colors[1], _u8L("Extrusion")); - //append_item(EItemType::Line, Travel_Colors[2], _u8L("Retraction")); - break; + // wipe paths section + //if (m_buffers[buffer_id(EMoveType::Wipe)].visible) { + // switch (m_view_type) + // { + // case EViewType::Feedrate: + // case EViewType::Tool: + // case EViewType::ColorPrint: { break; } + // default: { + // // title + // ImGui::Spacing(); + // ImGui::Dummy({ window_padding, window_padding }); + // ImGui::SameLine(); + // imgui.title(_u8L("Wipe")); + + // // items + // append_item(EItemType::Line, Wipe_Color, { {_u8L("Wipe"), 0} }); + + // break; + // } + // } + //} + + auto any_option_available = [this]() { + auto available = [this](EMoveType type) { + const TBuffer& buffer = m_buffers[buffer_id(type)]; + return buffer.visible && buffer.has_data(); + }; + + return available(EMoveType::Color_change) || + available(EMoveType::Custom_GCode) || + available(EMoveType::Pause_Print) || + available(EMoveType::Retract) || + available(EMoveType::Tool_change) || + available(EMoveType::Unretract) || + available(EMoveType::Seam); + }; + + //auto add_option = [this, append_item](EMoveType move_type, EOptionsColors color, const std::string& text) { + // const TBuffer& buffer = m_buffers[buffer_id(move_type)]; + // if (buffer.visible && buffer.has_data()) + // append_item(EItemType::Circle, Options_Colors[static_cast(color)], text); + //}; + + /* BBS GUI refactor */ + // options section + //if (any_option_available()) { + // // title + // ImGui::Spacing(); + // imgui.title(_u8L("Options")); + + // // items + // add_option(EMoveType::Retract, EOptionsColors::Retractions, _u8L("Retractions")); + // add_option(EMoveType::Unretract, EOptionsColors::Unretractions, _u8L("Deretractions")); + // add_option(EMoveType::Seam, EOptionsColors::Seams, _u8L("Seams")); + // add_option(EMoveType::Tool_change, EOptionsColors::ToolChanges, _u8L("Tool changes")); + // add_option(EMoveType::Color_change, EOptionsColors::ColorChanges, _u8L("Color changes")); + // add_option(EMoveType::Pause_Print, EOptionsColors::PausePrints, _u8L("Print pauses")); + // add_option(EMoveType::Custom_GCode, EOptionsColors::CustomGCodes, _u8L("Custom G-codes")); + //} + + + // settings section + bool has_settings = false; + has_settings |= !m_settings_ids.print.empty(); + has_settings |= !m_settings_ids.printer.empty(); + bool has_filament_settings = true; + has_filament_settings &= !m_settings_ids.filament.empty(); + for (const std::string& fs : m_settings_ids.filament) { + has_filament_settings &= !fs.empty(); } - } - } + has_settings |= has_filament_settings; + //BBS: add only gcode mode + bool show_settings = m_only_gcode_in_preview; //wxGetApp().is_gcode_viewer(); + show_settings &= (m_view_type == EViewType::FeatureType || m_view_type == EViewType::Tool); + show_settings &= has_settings; + if (show_settings) { + auto calc_offset = [this]() { + float ret = 0.0f; + if (!m_settings_ids.printer.empty()) + ret = std::max(ret, ImGui::CalcTextSize((_u8L("Printer") + std::string(":")).c_str()).x); + if (!m_settings_ids.print.empty()) + ret = std::max(ret, ImGui::CalcTextSize((_u8L("Print settings") + std::string(":")).c_str()).x); + if (!m_settings_ids.filament.empty()) { + for (unsigned char i : m_extruder_ids) { + ret = std::max(ret, ImGui::CalcTextSize((_u8L("Filament") + " " + std::to_string(i + 1) + ":").c_str()).x); + } + } + if (ret > 0.0f) + ret += 2.0f * ImGui::GetStyle().ItemSpacing.x; + return ret; + }; - // wipe paths section - //if (m_buffers[buffer_id(EMoveType::Wipe)].visible) { - // switch (m_view_type) - // { - // case EViewType::Feedrate: - // case EViewType::Tool: - // case EViewType::ColorPrint: { break; } - // default: { - // // title - // ImGui::Spacing(); - // ImGui::Dummy({ window_padding, window_padding }); - // ImGui::SameLine(); - // imgui.title(_u8L("Wipe")); + ImGui::Spacing(); + imgui.title(_u8L("Settings")); - // // items - // append_item(EItemType::Line, Wipe_Color, { {_u8L("Wipe"), 0} }); + float offset = calc_offset(); - // break; - // } - // } - //} - - auto any_option_available = [this]() { - auto available = [this](EMoveType type) { - const TBuffer& buffer = m_buffers[buffer_id(type)]; - return buffer.visible && buffer.has_data(); - }; - - return available(EMoveType::Color_change) || - available(EMoveType::Custom_GCode) || - available(EMoveType::Pause_Print) || - available(EMoveType::Retract) || - available(EMoveType::Tool_change) || - available(EMoveType::Unretract) || - available(EMoveType::Seam); - }; - - //auto add_option = [this, append_item](EMoveType move_type, EOptionsColors color, const std::string& text) { - // const TBuffer& buffer = m_buffers[buffer_id(move_type)]; - // if (buffer.visible && buffer.has_data()) - // append_item(EItemType::Circle, Options_Colors[static_cast(color)], text); - //}; - - /* BBS GUI refactor */ - // options section - //if (any_option_available()) { - // // title - // ImGui::Spacing(); - // imgui.title(_u8L("Options")); - - // // items - // add_option(EMoveType::Retract, EOptionsColors::Retractions, _u8L("Retractions")); - // add_option(EMoveType::Unretract, EOptionsColors::Unretractions, _u8L("Deretractions")); - // add_option(EMoveType::Seam, EOptionsColors::Seams, _u8L("Seams")); - // add_option(EMoveType::Tool_change, EOptionsColors::ToolChanges, _u8L("Tool changes")); - // add_option(EMoveType::Color_change, EOptionsColors::ColorChanges, _u8L("Color changes")); - // add_option(EMoveType::Pause_Print, EOptionsColors::PausePrints, _u8L("Print pauses")); - // add_option(EMoveType::Custom_GCode, EOptionsColors::CustomGCodes, _u8L("Custom G-codes")); - //} - - - // settings section - bool has_settings = false; - has_settings |= !m_settings_ids.print.empty(); - has_settings |= !m_settings_ids.printer.empty(); - bool has_filament_settings = true; - has_filament_settings &= !m_settings_ids.filament.empty(); - for (const std::string& fs : m_settings_ids.filament) { - has_filament_settings &= !fs.empty(); - } - has_settings |= has_filament_settings; - //BBS: add only gcode mode - bool show_settings = m_only_gcode_in_preview; //wxGetApp().is_gcode_viewer(); - show_settings &= (m_view_type == EViewType::FeatureType || m_view_type == EViewType::Tool); - show_settings &= has_settings; - if (show_settings) { - auto calc_offset = [this]() { - float ret = 0.0f; - if (!m_settings_ids.printer.empty()) - ret = std::max(ret, ImGui::CalcTextSize((_u8L("Printer") + std::string(":")).c_str()).x); - if (!m_settings_ids.print.empty()) - ret = std::max(ret, ImGui::CalcTextSize((_u8L("Print settings") + std::string(":")).c_str()).x); + if (!m_settings_ids.printer.empty()) { + imgui.text(_u8L("Printer") + ":"); + ImGui::SameLine(offset); + imgui.text(m_settings_ids.printer); + } + if (!m_settings_ids.print.empty()) { + imgui.text(_u8L("Print settings") + ":"); + ImGui::SameLine(offset); + imgui.text(m_settings_ids.print); + } if (!m_settings_ids.filament.empty()) { for (unsigned char i : m_extruder_ids) { - ret = std::max(ret, ImGui::CalcTextSize((_u8L("Filament") + " " + std::to_string(i + 1) + ":").c_str()).x); - } - } - if (ret > 0.0f) - ret += 2.0f * ImGui::GetStyle().ItemSpacing.x; - return ret; - }; - - ImGui::Spacing(); - imgui.title(_u8L("Settings")); - - float offset = calc_offset(); - - if (!m_settings_ids.printer.empty()) { - imgui.text(_u8L("Printer") + ":"); - ImGui::SameLine(offset); - imgui.text(m_settings_ids.printer); - } - if (!m_settings_ids.print.empty()) { - imgui.text(_u8L("Print settings") + ":"); - ImGui::SameLine(offset); - imgui.text(m_settings_ids.print); - } - if (!m_settings_ids.filament.empty()) { - for (unsigned char i : m_extruder_ids) { - if (i < static_cast(m_settings_ids.filament.size()) && !m_settings_ids.filament[i].empty()) { - std::string txt = _u8L("Filament"); - txt += (m_extruder_ids.size() == 1) ? ":" : " " + std::to_string(i + 1); - imgui.text(txt); - ImGui::SameLine(offset); - imgui.text(m_settings_ids.filament[i]); + if (i < static_cast(m_settings_ids.filament.size()) && !m_settings_ids.filament[i].empty()) { + std::string txt = _u8L("Filament"); + txt += (m_extruder_ids.size() == 1) ? ":" : " " + std::to_string(i + 1); + imgui.text(txt); + ImGui::SameLine(offset); + imgui.text(m_settings_ids.filament[i]); + } } } } } - // total estimated printing time section if (show_estimated) { + ImGui::Dummy({ window_padding, window_padding }); ImGui::Spacing(); std::string time_title = m_view_type == EViewType::FeatureType ? _u8L("Total Estimation") : _u8L("Time Estimation"); auto can_show_mode_button = [this](PrintEstimatedStatistics::ETimeMode mode) { @@ -5713,6 +5826,8 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv ImGui::Dummy({ window_padding, window_padding }); ImGui::SameLine(); imgui.title(time_title); + //auto timecText = new wxStaticText(s_panel, wxID_ANY, wxString::FromUTF8(time_title), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + //auto timecText = new wxStaticText(s_panel, wxID_ANY, time_title, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); std::string total_filament_str = _u8L("Total Filament"); std::string model_filament_str = _u8L("Model Filament"); std::string cost_str = _u8L("Cost"); @@ -5844,6 +5959,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv } default : { assert(false); break; } } + ImGui::Dummy({ window_padding, window_padding }); } if (m_view_type == EViewType::ColorPrint) { diff --git a/slic3r/GUI/GUI_App.cpp b/slic3r/GUI/GUI_App.cpp index 836980c..e473303 100644 --- a/slic3r/GUI/GUI_App.cpp +++ b/slic3r/GUI/GUI_App.cpp @@ -326,16 +326,9 @@ public: } } wxBitmap new_ground(groundImage); - /* wxMask* mask = new wxMask(new_ground, *wxWHITE); - wxMemoryDC memDC(mask->GetBitmap()); - wxBrush brush(*wxWHITE); - memDC.SetBrush(brush); - memDC.SetPen(*wxTRANSPARENT_PEN); - int radius = 20; - memDC.DrawRoundedRectangle(0, 0, groundWidth, groundHeight, radius); - new_ground.SetMask(mask);*/ - + memDc.DrawBitmap(new_ground, 0, 50, true); + //memDc.SelectObject(wxNullBitmap); BitmapCache logo_cache; @@ -357,17 +350,34 @@ public: int split_width = (width + title_width - version_width) / 2; wxRect title_rect(wxPoint(150, 300), wxPoint(400,450)); //memDc.SetTextForeground(StateColor::darkModeColorFor(wxColour(38, 46, 48))); - memDc.SetTextForeground(StateColor::darkModeColorFor(wxColour(0, 0, 0))); - memDc.SetFont(m_constant_text.title_font); + //memDc.SetTextForeground(StateColor::darkModeColorFor(wxColour(0, 0, 0,255))); + //memDc.SetFont(m_constant_text.title_font); + //memDc.SetTextBackground(*wxBLACK); //memDc.DrawLabel(m_constant_text.title, title_rect, wxALIGN_RIGHT | wxALIGN_BOTTOM); - memDc.DrawLabel(_L("Ui title"), title_rect, wxALIGN_CENTER_VERTICAL); + //memDc.DrawLabel(_L("Ui title"), title_rect, wxALIGN_CENTER_VERTICAL); + //memDc.DrawText(_L("Ui title"), 150, 300); //BBS align bottom of title and version text //wxRect version_rect(wxPoint(split_width + text_padding, top_margin), wxPoint(width, top_margin + title_height - text_padding)); wxRect version_rect(wxPoint(50,550), wxPoint(300,550)); - memDc.SetFont(m_constant_text.version_font); - memDc.SetTextForeground(StateColor::darkModeColorFor(wxColor(134, 134, 134))); - memDc.DrawLabel(m_constant_text.version, version_rect, wxALIGN_LEFT | wxALIGN_BOTTOM); + //memDc.SetFont(m_constant_text.version_font); + //memDc.SetTextForeground(StateColor::darkModeColorFor(wxColor(0, 0, 0,255))); + //memDc.SetTextForeground(*wxBLACK); + //memDc.SetTextBackground(StateColor::darkModeColorFor(wxColor(0, 0, 0,255))); + //memDc.SetTextBackground(*wxBLACK); + //memDc.DrawLabel(m_constant_text.version, version_rect, wxALIGN_LEFT | wxALIGN_BOTTOM); + //memDc.DrawText(m_constant_text.version, 50, 500); + //version_title.svg + BitmapCache version_cache; + wxBitmap version_bmp = *version_cache.load_svg("version_title", FromDIP(600), FromDIP(600)); + memDc.DrawBitmap(version_bmp, 50, 500, false); + BitmapCache title_cache; + wxBitmap title_bmp = *title_cache.load_svg("ui_title", FromDIP(600), FromDIP(600)); + memDc.DrawBitmap(title_bmp, 50, 350, false); + + BitmapCache config_cache; + wxBitmap config_bmp = *config_cache.load_svg("config_title", FromDIP(550), FromDIP(550)); + memDc.DrawBitmap(config_bmp, 515, 600, false); // draw title and version //int text_padding = FromDIP(3 * m_scale); //memDc.SetFont(m_constant_text.title_font); @@ -402,13 +412,15 @@ public: //#endif // load bitmap for logo BitmapCache bmp_cache; + int logo_margin = FromDIP(72 * m_scale); int logo_size = FromDIP(122 * m_scale); int logo_width = FromDIP(94 * m_scale); wxBitmap logo_bmp = *bmp_cache.load_svg("splash_logo", logo_size, logo_size); int logo_y = top_margin + title_rect.GetHeight() + logo_margin; memDc.DrawBitmap(logo_bmp, 900, 0, true); - + + // calculate position for the dynamic text int text_margin = FromDIP(80 * m_scale); m_action_line_y_position = logo_y + logo_size + text_margin; @@ -419,88 +431,89 @@ public: int width = FromDIP(1000, nullptr); int height = FromDIP(550, nullptr); - /*wxImage image(width, height);111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 - wxBitmap new_bmp(image);2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 - 333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 - wxMemoryDC memDC;41234444444444444444444444444444444444344444444444444444555555555555555555555555555555555555555555555555555555555555555555555555555 - memDC.SelectObject(new_bmp);12344444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 - memDC.SetBrush(StateColor::darkModeColorFor(wxColor(0, 157, 244,128)));2341324132444444444444444444444444444444444444444444444444444444444444444442 - memDC.DrawRectangle(-1, -1, width + 2, height + 2);23411111111111111111111111111111111111111111111111111111111111111111111111111111111121341234234 - memDC.DrawBitmap(new_bmp, 0, 0, true);*/ - // StateColor::darkModeColorFor(wxColor(0, 157, 244) - //fangfa1 - /* wxImage image(width, height, true); - unsigned char* alpha = image.GetAlpha(); - if (alpha) { - for (int i = 0; i < width * height; ++i) { - alpha[i] = 0; - } - } + /*wxImage image(width, height); wxBitmap new_bmp(image); wxMemoryDC memDC; memDC.SelectObject(new_bmp); - wxBrush brush(wxColor(254, 254, 254, 128)); - memDC.SetBrush(brush); + memDC.SetBrush(StateColor::darkModeColorFor(*wxWHITE)); memDC.DrawRectangle(-1, -1, width + 2, height + 2); memDC.DrawBitmap(new_bmp, 0, 0, true);*/ - //fangfa2 - //wxBitmap new_bmp(width, height, 32); + //wxImage image(width, height); + //wxBitmap new_bmp(image); //wxMemoryDC memDC; //memDC.SelectObject(new_bmp); - //memDC.SetBackground(*wxTRANSPARENT_BRUSH); - //memDC.Clear(); - //wxGraphicsContext* gc = wxGraphicsContext::Create(memDC); - //if (gc) { - // gc->SetAntialiasMode(wxANTIALIAS_DEFAULT); - // //wxColour semiTransparent(255, 255, 255, 128); - // //gc->SetBrush(semiTransparent); - // gc->DrawRectangle(0, 0, width, height); - // delete gc; - //} - //fangfa3 - /*wxBitmap bitmap(width, height,32); - { - wxMemoryDC dc(bitmap); - dc.SetBackground(*wxTRANSPARENT_BRUSH); - dc.Clear(); - } - { - wxMemoryDC dc(bitmap); - dc.SetBackground(*wxTRANSPARENT_BRUSH); - dc.Clear(); - dc.SetPen(wxPen(wxColour(255, 0, 0, 128))); - dc.SetBrush(wxBrush(wxColour(255, 0, 0, 128))); - dc.DrawRectangle(0, 0, width, height); - }*/ + //memDC.SetBrush(*wxWHITE_BRUSH); + //wxMask* mask = new wxMask(new_bmp, *wxWHITE); // Make cyan areas transparent + //new_bmp.SetMask(mask); + //memDC.DrawRectangle(-1, -1, width + 2, height + 2); + //memDC.DrawBitmap(new_bmp, 0, 0, true); + /* + 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 + 3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 + 44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 + 555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 + 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 + 77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 + 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 + 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 + 3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 + 44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 + 555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 + 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 + 77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 + 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 + 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 + 3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 + 44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 + 555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 + 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 + 77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 + 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 + 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 + 3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 + 44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 + 555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 + 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 + 77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 + 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 + 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 + 3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 + 44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 + 555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 + 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 + 77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 + 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 + 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + 22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 + 3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 + 44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 + 555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 + 666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 + 77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 + 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 + 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + */ - /* wxBitmap mask(100, 100); - wxMemoryDC maskDC(mask); - maskDC.SetBackground(*wxWHITE_BRUSH); - maskDC.Clear(); - maskDC.SetPen(wxPen(wxColour(0, 0, 0))); - maskDC.SetBrush(wxBrush(wxColour(0, 0, 0))); - maskDC.DrawRectangle(0, 0, width, height); - - bitmap.SetMask(new wxMask(mask, wxColour(0, 0, 0)));*/ - - //wxBitmap bitmap(width, height, 24); - ////wxBitmap bitmap("back.png", wxBITMAP_TYPE_PNG); - //wxMemoryDC memDC; - //memDC.SelectObject(bitmap); - - //memDC.SetBackground(*wxWHITE_BRUSH); - //memDC.Clear(); - //wxImage image = bitmap.ConvertToImage(); - - - //image.SetMask(true); - //image.SetMaskColour(255,255,255); - //bitmap = wxBitmap(image); - //BitmapCache bmp_cache; - //*bmp_cache.load_png - wxBitmap new_bmp("E:\\Code\\Projects\\BambuStudio\\resources\\images\\back1234.png", wxBITMAP_TYPE_PNG); + + wxBitmap new_bmp("E:\\Code\\Projects\\BambuStudio\\resources\\images\\back123.png", wxBITMAP_TYPE_PNG); new_bmp.SetHeight(height); new_bmp.SetWidth(width); return new_bmp; @@ -2783,8 +2796,12 @@ bool GUI_App::on_init_inner() #ifndef __linux__ wxYield(); #endif - //scrn->SetBackgroundColour(wxColor(0,0,0,0)); + //scrn->SetBackgroundColour(wxColor(0,0,0,255)); + //scrn->SetForegroundColour(wxColor(0, 0, 0, 255)); + //scrn->SetForegroundColour(*wxBLACK); scrn->SetText(_L("Loading configuration")+ dots); + //scrn->SetBackgroundColour(wxColor(0,0,0,255)); + //scrn->SetForegroundColour(wxColor(0, 0, 0, 255)); } BOOST_LOG_TRIVIAL(info) << "loading systen presets..."; diff --git a/slic3r/GUI/ParamsPanel.cpp b/slic3r/GUI/ParamsPanel.cpp index 8cbef04..465fe92 100644 --- a/slic3r/GUI/ParamsPanel.cpp +++ b/slic3r/GUI/ParamsPanel.cpp @@ -414,6 +414,9 @@ void ParamsPanel::create_layout() // m_left_sizer->Add( m_filament_sizer, 1, wxEXPAND, 5 ); m_left_sizer->Add( m_tab_filament, 0, wxEXPAND ); } + if (m_tab_config) { + m_left_sizer->Add(m_tab_config, 0, wxEXPAND); + } if (m_tab_printer) { //m_printer_sizer = new wxBoxSizer( wxVERTICAL ); @@ -481,6 +484,9 @@ void ParamsPanel::refresh_tabs() case Preset::TYPE_PRINTER: m_tab_printer = tab; break; + case Preset::TYPE_CONFIG: + m_tab_config = tab; + break; default: break; } @@ -509,7 +515,7 @@ void ParamsPanel::OnActivate() BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": first time opened, set current tab to print"); // BBS: open/close tab //m_current_tab = m_tab_print; - set_active_tab(m_tab_print ? m_tab_print : m_tab_filament); + set_active_tab(m_tab_print ? m_tab_print : m_tab_filament ? m_tab_filament : m_tab_config); } Tab* cur_tab = dynamic_cast (m_current_tab); if (cur_tab) @@ -587,7 +593,8 @@ void ParamsPanel::set_active_tab(wxPanel* tab) {m_tab_print_layer, nullptr}, {m_tab_print_plate, nullptr}, {m_tab_filament, m_staticline_filament}, - {m_tab_printer, m_staticline_printer}})) { + {m_tab_printer, m_staticline_printer}, + {m_tab_config, m_staticline_config}})) { if (!t.first) continue; t.first->Show(tab == t.first); if (!t.second) continue; @@ -658,7 +665,7 @@ void ParamsPanel::msw_rescale() ((SwitchButton* )m_mode_region)->Rescale(); if (m_mode_view) ((SwitchButton* )m_mode_view)->Rescale(); - for (auto tab : {m_tab_print, m_tab_print_plate, m_tab_print_object, m_tab_print_part, m_tab_print_layer, m_tab_filament, m_tab_printer}) { + for (auto tab : {m_tab_print, m_tab_print_plate, m_tab_print_object, m_tab_print_part, m_tab_print_layer, m_tab_filament, m_tab_printer, m_tab_config}) { if (tab) dynamic_cast(tab)->msw_rescale(); } //((Button*)m_export_to_file)->Rescale(); @@ -799,6 +806,12 @@ void ParamsPanel::delete_subwindows() m_staticline_printer = nullptr; } + if (m_staticline_config) + { + delete m_staticline_config; + m_staticline_config = nullptr; + } + if (m_export_to_file) { delete m_export_to_file; diff --git a/slic3r/GUI/ParamsPanel.hpp b/slic3r/GUI/ParamsPanel.hpp index bdc40f1..83e93cd 100644 --- a/slic3r/GUI/ParamsPanel.hpp +++ b/slic3r/GUI/ParamsPanel.hpp @@ -104,6 +104,8 @@ class ParamsPanel : public wxPanel wxStaticLine* m_staticline_printer { nullptr }; //wxBoxSizer* m_printer_sizer { nullptr }; wxPanel* m_tab_printer { nullptr }; + wxStaticLine* m_staticline_config{ nullptr }; + wxPanel* m_tab_config { nullptr }; //wxStaticLine* m_staticline_buttons { nullptr }; // BBS: new layout wxBoxSizer* m_button_sizer { nullptr }; diff --git a/slic3r/GUI/PhysicalPrinterDialog.cpp b/slic3r/GUI/PhysicalPrinterDialog.cpp index 1ab4672..b87adfa 100644 --- a/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -369,7 +369,7 @@ void PhysicalPrinterDialog::update_preset_input() { } if (m_valid_type == Valid && - (m_preset_name == "Default Setting" || m_preset_name == "Default Filament" || m_preset_name == "Default Printer")) { + (m_preset_name == "Default Setting" || m_preset_name == "Default Filament" || m_preset_name == "Default Printer" || m_preset_name == "Default Config")) { info_line = _L("Name is unavailable."); m_valid_type = NoValid; } diff --git a/slic3r/GUI/PresetComboBoxes.cpp b/slic3r/GUI/PresetComboBoxes.cpp index 6567bc9..fa1e922 100644 --- a/slic3r/GUI/PresetComboBoxes.cpp +++ b/slic3r/GUI/PresetComboBoxes.cpp @@ -1056,29 +1056,37 @@ void PlaterPresetComboBox::update() add_ams_filaments(into_u8(selected_user_preset.empty() ? selected_system_preset : selected_user_preset), true); //BBS: add project embedded preset logic - if (!project_embedded_presets.empty()) - { - set_label_marker(Append(separator(L("Project-inside presets")), wxNullBitmap)); - for (std::map::iterator it = project_embedded_presets.begin(); it != project_embedded_presets.end(); ++it) { - SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]); - validate_selection(it->first == selected_user_preset); - } - } - if (!nonsys_presets.empty()) - { - set_label_marker(Append(separator(L("User presets")), wxNullBitmap)); + if (m_type == Preset::TYPE_CONFIG) { for (std::map::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) { SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]); validate_selection(it->first == selected_user_preset); } } - //BBS: move system to the end - if (!system_presets.empty()) - { - set_label_marker(Append(separator(L("System presets")), wxNullBitmap)); - for (std::map::iterator it = system_presets.begin(); it != system_presets.end(); ++it) { - SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]); - validate_selection(it->first == selected_system_preset); + else { + if (!project_embedded_presets.empty()) + { + set_label_marker(Append(separator(L("Project-inside presets")), wxNullBitmap)); + for (std::map::iterator it = project_embedded_presets.begin(); it != project_embedded_presets.end(); ++it) { + SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]); + validate_selection(it->first == selected_user_preset); + } + } + if (!nonsys_presets.empty()) + { + set_label_marker(Append(separator(L("User presets")), wxNullBitmap)); + for (std::map::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) { + SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]); + validate_selection(it->first == selected_user_preset); + } + } + //BBS: move system to the end + if (!system_presets.empty()) + { + set_label_marker(Append(separator(L("System presets")), wxNullBitmap)); + for (std::map::iterator it = system_presets.begin(); it != system_presets.end(); ++it) { + SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]); + validate_selection(it->first == selected_system_preset); + } } } @@ -1114,8 +1122,8 @@ void PlaterPresetComboBox::update() set_label_marker(Append(separator(L("Add/Remove filaments")), *bmp), LABEL_ITEM_WIZARD_FILAMENTS); else if (m_type == Preset::TYPE_SLA_MATERIAL) set_label_marker(Append(separator(L("Add/Remove materials")), *bmp), LABEL_ITEM_WIZARD_MATERIALS); - else if (m_type == Preset::TYPE_CONFIG) - set_label_marker(Append(separator(L("Add/Remove filaments")), *bmp), LABEL_ITEM_WIZARD_FILAMENTS); + else if (m_type == Preset::TYPE_CONFIG) {} + //set_label_marker(Append(separator(L("Add/Remove configs")), *bmp), LABEL_ITEM_WIZARD_CONFIGS); else { set_label_marker(Append(separator(L("Select/Remove printers(system presets)")), *bmp), LABEL_ITEM_WIZARD_PRINTERS); set_label_marker(Append(separator(L("Create printer")), *bmp), LABEL_ITEM_WIZARD_ADD_PRINTERS); @@ -1183,6 +1191,7 @@ void TabPresetComboBox::OnSelect(wxCommandEvent &evt) case LABEL_ITEM_WIZARD_PRINTERS: sp = ConfigWizard::SP_PRINTERS; break; case LABEL_ITEM_WIZARD_FILAMENTS: sp = ConfigWizard::SP_FILAMENTS; break; case LABEL_ITEM_WIZARD_MATERIALS: sp = ConfigWizard::SP_MATERIALS; break; + case LABEL_ITEM_WIZARD_CONFIGS: sp = ConfigWizard::SP_CONFIGS; break; default: break; } if (sp != ConfigWizard::SP_WELCOME) { @@ -1292,21 +1301,7 @@ void TabPresetComboBox::update() add_ams_filaments(into_u8(selected)); //BBS: add project embedded preset logic - if (!project_embedded_presets.empty()) - { - set_label_marker(Append(separator(L("Project-inside presets")), wxNullBitmap)); - for (std::map>::iterator it = project_embedded_presets.begin(); it != project_embedded_presets.end(); ++it) { - int item_id = Append(it->first, *it->second.first); - SetItemTooltip(item_id, preset_descriptions[it->first]); - bool is_enabled = it->second.second; - if (!is_enabled) - set_label_marker(item_id, LABEL_ITEM_DISABLED); - validate_selection(it->first == selected); - } - } - if (!nonsys_presets.empty()) - { - set_label_marker(Append(separator(L("User presets")), wxNullBitmap)); + if (m_type == Preset::TYPE_CONFIG) { for (std::map>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) { int item_id = Append(it->first, *it->second.first); SetItemTooltip(item_id, preset_descriptions[it->first]); @@ -1316,17 +1311,43 @@ void TabPresetComboBox::update() validate_selection(it->first == selected); } } - //BBS: move system to the end - if (!system_presets.empty()) - { - set_label_marker(Append(separator(L("System presets")), wxNullBitmap)); - for (std::map>::iterator it = system_presets.begin(); it != system_presets.end(); ++it) { - int item_id = Append(it->first, *it->second.first); - SetItemTooltip(item_id, preset_descriptions[it->first]); - bool is_enabled = it->second.second; - if (!is_enabled) - set_label_marker(item_id, LABEL_ITEM_DISABLED); - validate_selection(it->first == selected); + else { + if (!project_embedded_presets.empty()) + { + set_label_marker(Append(separator(L("Project-inside presets")), wxNullBitmap)); + for (std::map>::iterator it = project_embedded_presets.begin(); it != project_embedded_presets.end(); ++it) { + int item_id = Append(it->first, *it->second.first); + SetItemTooltip(item_id, preset_descriptions[it->first]); + bool is_enabled = it->second.second; + if (!is_enabled) + set_label_marker(item_id, LABEL_ITEM_DISABLED); + validate_selection(it->first == selected); + } + } + if (!nonsys_presets.empty()) + { + set_label_marker(Append(separator(L("User presets")), wxNullBitmap)); + for (std::map>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) { + int item_id = Append(it->first, *it->second.first); + SetItemTooltip(item_id, preset_descriptions[it->first]); + bool is_enabled = it->second.second; + if (!is_enabled) + set_label_marker(item_id, LABEL_ITEM_DISABLED); + validate_selection(it->first == selected); + } + } + //BBS: move system to the end + if (!system_presets.empty()) + { + set_label_marker(Append(separator(L("System presets")), wxNullBitmap)); + for (std::map>::iterator it = system_presets.begin(); it != system_presets.end(); ++it) { + int item_id = Append(it->first, *it->second.first); + SetItemTooltip(item_id, preset_descriptions[it->first]); + bool is_enabled = it->second.second; + if (!is_enabled) + set_label_marker(item_id, LABEL_ITEM_DISABLED); + validate_selection(it->first == selected); + } } } diff --git a/slic3r/GUI/PresetComboBoxes.hpp b/slic3r/GUI/PresetComboBoxes.hpp index 8069e68..5c73efc 100644 --- a/slic3r/GUI/PresetComboBoxes.hpp +++ b/slic3r/GUI/PresetComboBoxes.hpp @@ -47,6 +47,7 @@ public: LABEL_ITEM_WIZARD_FILAMENTS, LABEL_ITEM_WIZARD_MATERIALS, LABEL_ITEM_WIZARD_ADD_PRINTERS, + LABEL_ITEM_WIZARD_CONFIGS, LABEL_ITEM_MAX, }; diff --git a/slic3r/GUI/SavePresetDialog.cpp b/slic3r/GUI/SavePresetDialog.cpp index 26310e3..19a4cce 100644 --- a/slic3r/GUI/SavePresetDialog.cpp +++ b/slic3r/GUI/SavePresetDialog.cpp @@ -202,7 +202,7 @@ void SavePresetDialog::Item::update() } if (m_valid_type == Valid && - (m_preset_name == "Default Setting" || m_preset_name == "Default Filament" || m_preset_name == "Default Printer")) { + (m_preset_name == "Default Setting" || m_preset_name == "Default Filament" || m_preset_name == "Default Printer" || m_preset_name == "Default Config")) { info_line = _L("Name is unavailable."); m_valid_type = NoValid; } diff --git a/slic3r/GUI/Tab.cpp b/slic3r/GUI/Tab.cpp index 9f19420..4161c23 100644 --- a/slic3r/GUI/Tab.cpp +++ b/slic3r/GUI/Tab.cpp @@ -966,7 +966,8 @@ void Tab::update_changed_tree_ui() } } if (page->title() == "Dependencies") { - if (m_type == Slic3r::Preset::TYPE_PRINTER) { + //xiamian+ + if (m_type == Slic3r::Preset::TYPE_PRINTER || m_type == Slic3r::Preset::TYPE_CONFIG) { sys_page = m_presets->get_selected_preset_parent() != nullptr; modified_page = false; } else { @@ -1923,304 +1924,271 @@ void TabPrint::build() m_presets = &m_preset_bundle->prints; load_initial_data(); - - auto page = add_options_page(L("Quality"), "empty"); - //xiamian- - //auto page = add_options_page(L("Quality"), "empty"); - //auto optgroup = page->new_optgroup(L("Layer height"), L"param_layer_height"); - auto optgroup = page->new_optgroup("", L"param_layer_height"); - //optgroup->append_single_option_line("layer_height", "layer-height"); - //optgroup->append_single_option_line("initial_layer_print_height", "layer-height"); - //xiamian- - //optgroup = page->new_optgroup(L("Line width"), L"param_line_width"); - //optgroup->append_single_option_line("line_width","parameter/line-width"); - //optgroup->append_single_option_line("initial_layer_line_width","parameter/line-width"); - //optgroup->append_single_option_line("outer_wall_line_width","parameter/line-width"); - //optgroup->append_single_option_line("inner_wall_line_width","parameter/line-width"); - //optgroup->append_single_option_line("top_surface_line_width","parameter/line-width"); - //optgroup->append_single_option_line("sparse_infill_line_width","parameter/line-width"); - //optgroup->append_single_option_line("internal_solid_infill_line_width","parameter/line-width"); - //optgroup->append_single_option_line("support_line_width","parameter/line-width"); - //xiamian- - //optgroup = page->new_optgroup(L("Seam"), L"param_seam"); - //optgroup->append_single_option_line("seam_position", "Seam"); - optgroup->append_single_option_line("seam_gap", "Seam"); - //optgroup->append_single_option_line("seam_slope_type"); - optgroup->append_single_option_line("seam_slope_conditional"); - optgroup->append_single_option_line("scarf_angle_threshold"); - optgroup->append_single_option_line("seam_slope_start_height"); - optgroup->append_single_option_line("seam_slope_entire_loop"); - optgroup->append_single_option_line("seam_slope_min_length"); - optgroup->append_single_option_line("seam_slope_steps"); - optgroup->append_single_option_line("seam_slope_inner_walls"); - optgroup->append_single_option_line("wipe_speed", "Seam"); - //xiamian- - //optgroup = page->new_optgroup(L("Precision"), L"param_precision"); - //optgroup->append_single_option_line("slice_closing_radius"); - //optgroup->append_single_option_line("resolution","acr-move"); - //optgroup->append_single_option_line("enable_arc_fitting", "acr-move"); - //optgroup->append_single_option_line("xy_hole_compensation", "xy-hole-contour-compensation"); - //optgroup->append_single_option_line("xy_contour_compensation", "xy-hole-contour-compensation"); - //optgroup->append_single_option_line("elefant_foot_compensation", "parameter/elephant-foot"); - //optgroup->append_single_option_line("precise_z_height"); - //xiamian- - //optgroup = page->new_optgroup(L("Ironing"), L"param_ironing"); - //optgroup->append_single_option_line("ironing_type", "parameter/ironing"); - optgroup->append_single_option_line("ironing_pattern"); - optgroup->append_single_option_line("ironing_speed"); - optgroup->append_single_option_line("ironing_flow"); - optgroup->append_single_option_line("ironing_spacing"); - optgroup->append_single_option_line("ironing_direction"); - //xiamian- - //optgroup = page->new_optgroup(L("Wall generator"), L"param_wall"); - optgroup->append_single_option_line("wall_generator", "wall-generator"); - optgroup->append_single_option_line("wall_transition_angle"); - optgroup->append_single_option_line("wall_transition_filter_deviation"); - optgroup->append_single_option_line("wall_transition_length"); - optgroup->append_single_option_line("wall_distribution_count"); - optgroup->append_single_option_line("min_bead_width"); - optgroup->append_single_option_line("min_feature_size"); - //xiamian- - //optgroup = page->new_optgroup(L("Advanced"), L"param_advanced"); - optgroup->append_single_option_line("wall_sequence"); - //optgroup->append_single_option_line("is_infill_first"); - //optgroup->append_single_option_line("bridge_flow","parameter/bridge"); - //optgroup->append_single_option_line("thick_bridges","parameter/bridge"); - //optgroup->append_single_option_line("top_solid_infill_flow_ratio"); - //optgroup->append_single_option_line("initial_layer_flow_ratio"); - //optgroup->append_single_option_line("top_one_wall_type"); - //optgroup->append_single_option_line("top_area_threshold"); - //optgroup->append_single_option_line("only_one_wall_first_layer"); - //optgroup->append_single_option_line("detect_overhang_wall"); - //optgroup->append_single_option_line("smooth_speed_discontinuity_area"); - //optgroup->append_single_option_line("smooth_coefficient"); - //optgroup->append_single_option_line("reduce_crossing_wall"); - //optgroup->append_single_option_line("max_travel_detour_distance"); + auto page = add_options_page(L("Quality"), "empty"); + auto optgroup = page->new_optgroup("", L"param_layer_height"); + optgroup->append_single_option_line("layer_height", "layer-height"); + //optgroup->append_single_option_line("initial_layer_print_height", "layer-height"); + + //optgroup = page->new_optgroup(L("Line width"), L"param_line_width"); + //optgroup->append_single_option_line("line_width", "parameter/line-width"); + //optgroup->append_single_option_line("initial_layer_line_width", "parameter/line-width"); + //optgroup->append_single_option_line("outer_wall_line_width", "parameter/line-width"); + //optgroup->append_single_option_line("inner_wall_line_width", "parameter/line-width"); + //optgroup->append_single_option_line("top_surface_line_width", "parameter/line-width"); + //optgroup->append_single_option_line("sparse_infill_line_width", "parameter/line-width"); + //optgroup->append_single_option_line("internal_solid_infill_line_width", "parameter/line-width"); + //optgroup->append_single_option_line("support_line_width", "parameter/line-width"); + + //optgroup = page->new_optgroup(L("Seam"), L"param_seam"); + //optgroup->append_single_option_line("seam_position", "Seam"); + //optgroup->append_single_option_line("seam_gap", "Seam"); + //optgroup->append_single_option_line("seam_slope_type"); + //optgroup->append_single_option_line("seam_slope_conditional"); + //optgroup->append_single_option_line("scarf_angle_threshold"); + //optgroup->append_single_option_line("seam_slope_start_height"); + //optgroup->append_single_option_line("seam_slope_entire_loop"); + //optgroup->append_single_option_line("seam_slope_min_length"); + //optgroup->append_single_option_line("seam_slope_steps"); + //optgroup->append_single_option_line("seam_slope_inner_walls"); + //optgroup->append_single_option_line("wipe_speed", "Seam"); + + //optgroup = page->new_optgroup(L("Precision"), L"param_precision"); + //optgroup->append_single_option_line("slice_closing_radius"); + //optgroup->append_single_option_line("resolution", "acr-move"); + //optgroup->append_single_option_line("enable_arc_fitting", "acr-move"); + //optgroup->append_single_option_line("xy_hole_compensation", "xy-hole-contour-compensation"); + //optgroup->append_single_option_line("xy_contour_compensation", "xy-hole-contour-compensation"); + //optgroup->append_single_option_line("elefant_foot_compensation", "parameter/elephant-foot"); + //optgroup->append_single_option_line("precise_z_height"); + + //optgroup = page->new_optgroup(L("Ironing"), L"param_ironing"); + //optgroup->append_single_option_line("ironing_type", "parameter/ironing"); + //optgroup->append_single_option_line("ironing_pattern"); + //optgroup->append_single_option_line("ironing_speed"); + //optgroup->append_single_option_line("ironing_flow"); + //optgroup->append_single_option_line("ironing_spacing"); + //optgroup->append_single_option_line("ironing_direction"); + + //optgroup = page->new_optgroup(L("Wall generator"), L"param_wall"); + //optgroup->append_single_option_line("wall_generator", "wall-generator"); + optgroup->append_single_option_line("wall_transition_angle"); + optgroup->append_single_option_line("wall_transition_filter_deviation"); + optgroup->append_single_option_line("wall_transition_length"); + optgroup->append_single_option_line("wall_distribution_count"); + optgroup->append_single_option_line("min_bead_width"); + optgroup->append_single_option_line("min_feature_size"); + + //optgroup = page->new_optgroup(L("Advanced"), L"param_advanced"); + //optgroup->append_single_option_line("wall_sequence"); + //optgroup->append_single_option_line("is_infill_first"); + //optgroup->append_single_option_line("bridge_flow", "parameter/bridge"); + //optgroup->append_single_option_line("thick_bridges", "parameter/bridge"); + //optgroup->append_single_option_line("top_solid_infill_flow_ratio"); + //optgroup->append_single_option_line("initial_layer_flow_ratio"); + optgroup->append_single_option_line("top_one_wall_type"); + optgroup->append_single_option_line("top_area_threshold"); + optgroup->append_single_option_line("only_one_wall_first_layer"); + optgroup->append_single_option_line("detect_overhang_wall"); + //optgroup->append_single_option_line("smooth_speed_discontinuity_area"); + //optgroup->append_single_option_line("smooth_coefficient"); + //optgroup->append_single_option_line("reduce_crossing_wall"); + optgroup->append_single_option_line("max_travel_detour_distance"); - optgroup->append_single_option_line("support_base_pattern_spacing", "support#base-pattern"); - optgroup->append_single_option_line("support_interface_top_layers", "support#base-pattern"); - optgroup->append_single_option_line("support_interface_bottom_layers", "support#base-pattern"); - optgroup->append_single_option_line("support_interface_spacing", "support#base-pattern"); - page = add_options_page(L("Strength"), "empty"); - //xiamian+ - optgroup = page->new_optgroup("", L"param_wall"); - //xiamian- - //optgroup = page->new_optgroup(L("Walls"), L"param_wall"); - //optgroup->append_single_option_line("wall_loops","wall-generator"); - optgroup->append_single_option_line("detect_thin_wall","wall-generator"); - - //optgroup = page->new_optgroup(L("Top/bottom shells"), L"param_shell"); - optgroup->append_single_option_line("interface_shells"); - optgroup->append_single_option_line("top_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface"); - //optgroup->append_single_option_line("top_shell_layers"); - //optgroup->append_single_option_line("top_shell_thickness"); - optgroup->append_single_option_line("bottom_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface"); - //optgroup->append_single_option_line("bottom_shell_layers"); - //optgroup->append_single_option_line("bottom_shell_thickness"); - optgroup->append_single_option_line("internal_solid_infill_pattern"); - - //optgroup = page->new_optgroup(L("Sparse infill"), L"param_infill"); - //optgroup->append_single_option_line("sparse_infill_density"); - optgroup->append_single_option_line("sparse_infill_pattern", "fill-patterns#infill types and their properties of sparse"); - //optgroup->append_single_option_line("sparse_infill_anchor"); - //optgroup->append_single_option_line("sparse_infill_anchor_max"); - optgroup->append_single_option_line("filter_out_gap_fill"); + optgroup = page->new_optgroup("", L"param_wall"); + optgroup->append_single_option_line("wall_loops", "wall-generator"); + //optgroup->append_single_option_line("detect_thin_wall", "wall-generator"); - //optgroup = page->new_optgroup(L("Advanced"), L"param_advanced"); - //optgroup->append_single_option_line("infill_wall_overlap","parameter/strength-advance-settings"); - //optgroup->append_single_option_line("infill_direction","parameter/strength-advance-settings"); - optgroup->append_single_option_line("bridge_angle","parameter/strength-advance-settings"); - optgroup->append_single_option_line("minimum_sparse_infill_area","parameter/strength-advance-settings"); - optgroup->append_single_option_line("infill_combination","parameter/strength-advance-settings"); - //optgroup->append_single_option_line("detect_narrow_internal_solid_infill","parameter/strength-advance-settings"); - //optgroup->append_single_option_line("ensure_vertical_shell_thickness","parameter/strength-advance-settings"); - //optgroup->append_single_option_line("internal_bridge_support_thickness","parameter/strength-advance-settings"); + //optgroup = page->new_optgroup(L("Top/bottom shells"), L"param_shell"); + optgroup->append_single_option_line("interface_shells"); + //optgroup->append_single_option_line("top_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface"); + optgroup->append_single_option_line("top_shell_layers"); + optgroup->append_single_option_line("top_shell_thickness"); + //optgroup->append_single_option_line("bottom_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface"); + optgroup->append_single_option_line("bottom_shell_layers"); + optgroup->append_single_option_line("bottom_shell_thickness"); + //optgroup->append_single_option_line("internal_solid_infill_pattern"); + + //optgroup = page->new_optgroup(L("Sparse infill"), L"param_infill"); + optgroup->append_single_option_line("sparse_infill_density"); + //optgroup->append_single_option_line("sparse_infill_pattern", "fill-patterns#infill types and their properties of sparse"); + //optgroup->append_single_option_line("sparse_infill_anchor"); + //optgroup->append_single_option_line("sparse_infill_anchor_max"); + //optgroup->append_single_option_line("filter_out_gap_fill"); + + //optgroup = page->new_optgroup(L("Advanced"), L"param_advanced"); + //optgroup->append_single_option_line("infill_wall_overlap", "parameter/strength-advance-settings"); + //optgroup->append_single_option_line("infill_direction", "parameter/strength-advance-settings"); + //optgroup->append_single_option_line("bridge_angle", "parameter/strength-advance-settings"); + //optgroup->append_single_option_line("minimum_sparse_infill_area", "parameter/strength-advance-settings"); + //optgroup->append_single_option_line("infill_combination", "parameter/strength-advance-settings"); + //optgroup->append_single_option_line("detect_narrow_internal_solid_infill", "parameter/strength-advance-settings"); + //optgroup->append_single_option_line("ensure_vertical_shell_thickness", "parameter/strength-advance-settings"); + //optgroup->append_single_option_line("internal_bridge_support_thickness","parameter/strength-advance-settings"); page = add_options_page(L("Speed"), "empty"); - //xiamian+ - optgroup = page->new_optgroup("", L"param_speed",15); - //xiamian- - //optgroup = page->new_optgroup(L("Initial layer speed"), L"param_speed_first", 15); - optgroup->append_single_option_line("default_print_speed"); - optgroup->append_single_option_line("initial_layer_speed"); - optgroup->append_single_option_line("initial_layer_infill_speed"); - //optgroup = page->new_optgroup(L("Other layers speed"), L"param_speed", 15); - optgroup->append_single_option_line("outer_wall_speed"); - optgroup->append_single_option_line("inner_wall_speed"); - //optgroup->append_single_option_line("small_perimeter_speed"); - //optgroup->append_single_option_line("small_perimeter_threshold"); - optgroup->append_single_option_line("sparse_infill_speed"); - optgroup->append_single_option_line("internal_solid_infill_speed"); - optgroup->append_single_option_line("top_surface_speed"); - //optgroup->append_single_option_line("enable_overhang_speed", "slow-down-for-overhang"); - //Line line = { L("Overhang speed"), L("This is the speed for various overhang degrees. Overhang degrees are expressed as a percentage of line width. 0 speed means no slowing down for the overhang degree range and wall speed is used") }; - //line.label_path = "slow-down-for-overhang"; - //line.append_option(optgroup->get_option("overhang_1_4_speed")); - //line.append_option(optgroup->get_option("overhang_2_4_speed")); - //line.append_option(optgroup->get_option("overhang_3_4_speed")); - //line.append_option(optgroup->get_option("overhang_4_4_speed")); - //optgroup->append_line(line); - //optgroup->append_single_option_line("overhang_totally_speed"); - optgroup->append_single_option_line("bridge_speed"); - optgroup->append_single_option_line("gap_infill_speed"); - optgroup->append_single_option_line("support_speed"); - optgroup->append_single_option_line("support_interface_speed"); + optgroup = page->new_optgroup("", L"param_speed_first", 15); + //optgroup->append_single_option_line("initial_layer_speed"); + //optgroup->append_single_option_line("initial_layer_infill_speed"); + + //optgroup = page->new_optgroup(L("Other layers speed"), L"param_speed", 15); + //optgroup->append_single_option_line("outer_wall_speed"); + //optgroup->append_single_option_line("inner_wall_speed"); + //optgroup->append_single_option_line("small_perimeter_speed"); + //optgroup->append_single_option_line("small_perimeter_threshold"); + //optgroup->append_single_option_line("sparse_infill_speed"); + //optgroup->append_single_option_line("internal_solid_infill_speed"); + //optgroup->append_single_option_line("top_surface_speed"); + //optgroup->append_single_option_line("enable_overhang_speed", "slow-down-for-overhang"); + //Line line = { L("Overhang speed"), L("This is the speed for various overhang degrees. Overhang degrees are expressed as a percentage of line width. 0 speed means no slowing down for the overhang degree range and wall speed is used") }; + //line.label_path = "slow-down-for-overhang"; + //line.append_option(optgroup->get_option("overhang_1_4_speed")); + //line.append_option(optgroup->get_option("overhang_2_4_speed")); + //line.append_option(optgroup->get_option("overhang_3_4_speed")); + //line.append_option(optgroup->get_option("overhang_4_4_speed")); + //optgroup->append_line(line); + //optgroup->append_single_option_line("overhang_totally_speed"); + //optgroup->append_single_option_line("bridge_speed"); + //optgroup->append_single_option_line("gap_infill_speed"); + //optgroup->append_single_option_line("support_speed"); + //optgroup->append_single_option_line("support_interface_speed"); - //optgroup = page->new_optgroup(L("Travel speed"), L"param_travel_speed", 15); - optgroup->append_single_option_line("travel_speed"); + //optgroup = page->new_optgroup(L("Travel speed"), L"param_travel_speed", 15); + //optgroup->append_single_option_line("travel_speed"); - //optgroup = page->new_optgroup(L("Acceleration"), L"param_acceleration", 15); - optgroup->append_single_option_line("default_acceleration"); - //optgroup->append_single_option_line("initial_layer_acceleration"); - //optgroup->append_single_option_line("outer_wall_acceleration"); - //optgroup->append_single_option_line("inner_wall_acceleration"); - //optgroup->append_single_option_line("top_surface_acceleration"); - //optgroup->append_single_option_line("sparse_infill_acceleration"); - //optgroup->append_single_option_line("accel_to_decel_enable"); - //optgroup->append_single_option_line("accel_to_decel_factor"); + //optgroup = page->new_optgroup(L("Acceleration"), L"param_acceleration", 15); + //optgroup->append_single_option_line("default_acceleration"); + //optgroup->append_single_option_line("initial_layer_acceleration"); + //optgroup->append_single_option_line("outer_wall_acceleration"); + //optgroup->append_single_option_line("inner_wall_acceleration"); + //optgroup->append_single_option_line("top_surface_acceleration"); + //optgroup->append_single_option_line("sparse_infill_acceleration"); + //optgroup->append_single_option_line("accel_to_decel_enable"); + //optgroup->append_single_option_line("accel_to_decel_factor"); - //optgroup = page->new_optgroup(L("Jerk(XY)"), L"param_acceleration", 15); - 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 = page->new_optgroup(L("Jerk(XY)"), L"param_acceleration", 15); + 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"); -#ifdef HAS_PRESSURE_EQUALIZER - optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_positive"); - optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_negative"); -#endif /* HAS_PRESSURE_EQUALIZER */ +//#ifdef HAS_PRESSURE_EQUALIZER +// optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_positive"); +// optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_negative"); +//#endif /* HAS_PRESSURE_EQUALIZER */ page = add_options_page(L("Support"), "support"); - //xiamian+ optgroup = page->new_optgroup("", L"param_support"); - //ximian- - //optgroup = page->new_optgroup(L("Support"), L"param_support"); - //optgroup->append_single_option_line("enable_support", "support"); - optgroup->append_single_option_line("support_type", "support#support-types"); - optgroup->append_single_option_line("support_style", "support#support-styles"); - optgroup->append_single_option_line("support_threshold_angle", "support#threshold-angle"); - optgroup->append_single_option_line("support_on_build_plate_only"); - optgroup->append_single_option_line("support_critical_regions_only"); - optgroup->append_single_option_line("support_remove_small_overhang"); - //optgroup->append_single_option_line("enforce_support_layers"); + optgroup->append_single_option_line("enable_support", "support"); + optgroup->append_single_option_line("support_type", "support#support-types"); + optgroup->append_single_option_line("support_style", "support#support-styles"); + optgroup->append_single_option_line("support_threshold_angle", "support#threshold-angle"); + optgroup->append_single_option_line("support_on_build_plate_only"); + optgroup->append_single_option_line("support_critical_regions_only"); + optgroup->append_single_option_line("support_remove_small_overhang"); + //optgroup->append_single_option_line("enforce_support_layers"); - //optgroup = page->new_optgroup(L("Raft"), L"param_raft"); - optgroup->append_single_option_line("raft_layers"); - optgroup->append_single_option_line("raft_contact_distance"); - optgroup->append_single_option_line("raft_first_layer_density"); + //optgroup = page->new_optgroup(L("Raft"), L"param_raft"); + //optgroup->append_single_option_line("raft_layers"); + //optgroup->append_single_option_line("raft_contact_distance"); + //optgroup->append_single_option_line("raft_first_layer_density"); - //optgroup = page->new_optgroup(L("Support filament"), L"param_support_filament"); - optgroup->append_single_option_line("support_filament", "support#support-filament"); - optgroup->append_single_option_line("support_interface_filament", "support#support-filament"); - optgroup->append_single_option_line("support_interface_not_for_body", "support#support-filament"); + //optgroup = page->new_optgroup(L("Support filament"), L"param_support_filament"); + //optgroup->append_single_option_line("support_filament", "support#support-filament"); + //optgroup->append_single_option_line("support_interface_filament", "support#support-filament"); + //optgroup->append_single_option_line("support_interface_not_for_body", "support#support-filament"); - //optgroup = page->new_optgroup(L("Options for support material and raft")); + //optgroup = page->new_optgroup(L("Options for support material and raft")); - //BBS - //optgroup = page->new_optgroup(L("Advanced"), L"param_advanced"); - optgroup->append_single_option_line("raft_first_layer_expansion"); // not only for raft, but for support too - optgroup->append_single_option_line("tree_support_wall_count"); - //optgroup->append_single_option_line("support_top_z_distance", "support#top-z-distance"); - //optgroup->append_single_option_line("support_bottom_z_distance", "support#bottom-z-distance"); - optgroup->append_single_option_line("support_base_pattern", "support#base-pattern"); - //optgroup->append_single_option_line("support_base_pattern_spacing", "support#base-pattern"); - //optgroup->append_single_option_line("support_angle"); - //optgroup->append_single_option_line("support_interface_top_layers", "support#base-pattern"); - //optgroup->append_single_option_line("support_interface_bottom_layers", "support#base-pattern"); - optgroup->append_single_option_line("support_interface_pattern", "support#base-pattern"); - //optgroup->append_single_option_line("support_interface_spacing", "support#base-pattern"); - optgroup->append_single_option_line("support_bottom_interface_spacing"); - //optgroup->append_single_option_line("support_expansion", "support#base-pattern"); - //optgroup->append_single_option_line("support_interface_loop_pattern"); + //BBS + //optgroup = page->new_optgroup(L("Advanced"), L"param_advanced"); + //optgroup->append_single_option_line("raft_first_layer_expansion"); // not only for raft, but for support too + //optgroup->append_single_option_line("tree_support_wall_count"); + //optgroup->append_single_option_line("support_top_z_distance", "support#top-z-distance"); + //optgroup->append_single_option_line("support_bottom_z_distance", "support#bottom-z-distance"); + //optgroup->append_single_option_line("support_base_pattern", "support#base-pattern"); + //optgroup->append_single_option_line("support_base_pattern_spacing", "support#base-pattern"); + //optgroup->append_single_option_line("support_angle"); + //optgroup->append_single_option_line("support_interface_top_layers", "support#base-pattern"); + //optgroup->append_single_option_line("support_interface_bottom_layers", "support#base-pattern"); + //optgroup->append_single_option_line("support_interface_pattern", "support#base-pattern"); + //optgroup->append_single_option_line("support_interface_spacing", "support#base-pattern"); + //optgroup->append_single_option_line("support_bottom_interface_spacing"); + //optgroup->append_single_option_line("support_expansion", "support#base-pattern"); + //optgroup->append_single_option_line("support_interface_loop_pattern"); - optgroup->append_single_option_line("support_object_xy_distance", "support"); - //optgroup->append_single_option_line("support_object_first_layer_gap", "support"); - optgroup->append_single_option_line("bridge_no_support", "support#base-pattern"); - optgroup->append_single_option_line("max_bridge_length", "support#base-pattern"); - optgroup->append_single_option_line("independent_support_layer_height", "support"); + //optgroup->append_single_option_line("support_object_xy_distance", "support"); + //optgroup->append_single_option_line("support_object_first_layer_gap", "support"); + //optgroup->append_single_option_line("bridge_no_support", "support#base-pattern"); + //optgroup->append_single_option_line("max_bridge_length", "support#base-pattern"); + //optgroup->append_single_option_line("independent_support_layer_height", "support"); - //optgroup = page->new_optgroup(L("Tree Support"), L"param_advanced"); - optgroup->append_single_option_line("tree_support_branch_distance", "support#tree-support-only-options"); - 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"); - //xiamian+ - page = add_options_page(L("Configuration"), "empty"); - optgroup = page->new_optgroup("", L"param_layer_height"); - optgroup->append_single_option_line("wall_loops", "wall-generator"); - optgroup->append_single_option_line("layer_height", "layer-height"); - optgroup->append_single_option_line("seam_position", "Seam"); - optgroup->append_single_option_line("top_shell_layers"); - optgroup->append_single_option_line("top_shell_thickness"); - optgroup->append_single_option_line("bottom_shell_layers"); - optgroup->append_single_option_line("bottom_shell_thickness"); - optgroup->append_single_option_line("sparse_infill_density"); - optgroup->append_single_option_line("enable_support", "support"); + //optgroup = page->new_optgroup(L("Tree Support"), L"param_advanced"); + //optgroup->append_single_option_line("tree_support_branch_distance", "support#tree-support-only-options"); + //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"); - //xiamian+ optgroup = page->new_optgroup("", L"param_adhension"); - //xiamian- - //optgroup = page->new_optgroup(L("Bed adhension"), L"param_adhension"); - //optgroup->append_single_option_line("skirt_loops"); - //optgroup->append_single_option_line("skirt_height"); - //optgroup->append_single_option_line("skirt_distance"); - //optgroup->append_single_option_line("draft_shield"); - //optgroup->append_single_option_line("brim_type", "auto-brim"); - //optgroup->append_single_option_line("brim_width", "auto-brim#manual"); - //optgroup->append_single_option_line("brim_object_gap", "auto-brim#brim-object-gap"); + //optgroup->append_single_option_line("skirt_loops"); + //optgroup->append_single_option_line("skirt_height"); + //optgroup->append_single_option_line("skirt_distance"); + //optgroup->append_single_option_line("draft_shield"); + //optgroup->append_single_option_line("brim_type", "auto-brim"); + //optgroup->append_single_option_line("brim_width", "auto-brim#manual"); + //optgroup->append_single_option_line("brim_object_gap", "auto-brim#brim-object-gap"); - //optgroup = page->new_optgroup(L("Prime tower"), L"param_tower"); - //optgroup->append_single_option_line("enable_prime_tower","parameter/prime-tower"); - //optgroup->append_single_option_line("prime_tower_width","parameter/prime-tower"); - //optgroup->append_single_option_line("prime_volume","parameter/prime-tower"); - //optgroup->append_single_option_line("prime_tower_brim_width","parameter/prime-tower"); + //optgroup = page->new_optgroup(L("Prime tower"), L"param_tower"); + //optgroup->append_single_option_line("enable_prime_tower", "parameter/prime-tower"); + //optgroup->append_single_option_line("prime_tower_width", "parameter/prime-tower"); + //optgroup->append_single_option_line("prime_volume", "parameter/prime-tower"); + //optgroup->append_single_option_line("prime_tower_brim_width", "parameter/prime-tower"); - //optgroup = page->new_optgroup(L("Flush options"), L"param_flush"); - //optgroup->append_single_option_line("flush_into_infill", "reduce-wasting-during-filament-change#wipe-into-infill"); - //optgroup->append_single_option_line("flush_into_objects", "reduce-wasting-during-filament-change#wipe-into-object"); - //optgroup->append_single_option_line("flush_into_support", "reduce-wasting-during-filament-change#wipe-into-support-enabled-by-default"); + //optgroup = page->new_optgroup(L("Flush options"), L"param_flush"); + //optgroup->append_single_option_line("flush_into_infill", "reduce-wasting-during-filament-change#wipe-into-infill"); + //optgroup->append_single_option_line("flush_into_objects", "reduce-wasting-during-filament-change#wipe-into-object"); + //optgroup->append_single_option_line("flush_into_support", "reduce-wasting-during-filament-change#wipe-into-support-enabled-by-default"); - //optgroup = page->new_optgroup(L("Special mode"), L"param_special"); - optgroup->append_single_option_line("slicing_mode"); - optgroup->append_single_option_line("print_sequence", "sequent-print"); - optgroup->append_single_option_line("spiral_mode", "spiral-vase"); - optgroup->append_single_option_line("spiral_mode_smooth", "spiral-vase#smooth"); - optgroup->append_single_option_line("spiral_mode_max_xy_smoothing", "spiral-vase#max-xy-smoothing"); - optgroup->append_single_option_line("timelapse_type", "Timelapse"); + //optgroup = page->new_optgroup(L("Special mode"), L"param_special"); + //optgroup->append_single_option_line("slicing_mode"); + //optgroup->append_single_option_line("print_sequence", "sequent-print"); + //optgroup->append_single_option_line("spiral_mode", "spiral-vase"); + //optgroup->append_single_option_line("spiral_mode_smooth", "spiral-vase#smooth"); + //optgroup->append_single_option_line("spiral_mode_max_xy_smoothing", "spiral-vase#max-xy-smoothing"); + //optgroup->append_single_option_line("timelapse_type", "Timelapse"); - 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"); + //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"); - //optgroup = page->new_optgroup(L("Advanced"), L"advanced"); - // optgroup->append_single_option_line("mmu_segmented_region_max_width"); - optgroup->append_single_option_line("mmu_segmented_region_interlocking_depth"); + //optgroup = page->new_optgroup(L("Advanced"), L"advanced"); + // optgroup->append_single_option_line("mmu_segmented_region_max_width"); + optgroup->append_single_option_line("mmu_segmented_region_interlocking_depth"); - //optgroup = page->new_optgroup(L("G-code output"), L"param_gcode"); - optgroup->append_single_option_line("reduce_infill_retraction"); - optgroup->append_single_option_line("gcode_add_line_number"); - optgroup->append_single_option_line("exclude_object"); - Option option = optgroup->get_option("filename_format"); - option.opt.full_width = true; - optgroup->append_single_option_line(option); + optgroup = page->new_optgroup(L("G-code output"), L"param_gcode"); + optgroup->append_single_option_line("reduce_infill_retraction"); + optgroup->append_single_option_line("gcode_add_line_number"); + optgroup->append_single_option_line("exclude_object"); + Option option = optgroup->get_option("filename_format"); + option.opt.full_width = true; + optgroup->append_single_option_line(option); - optgroup = page->new_optgroup(L("Post-processing scripts"), L"param_gcode", 0); - option = optgroup->get_option("post_process"); - option.opt.full_width = true; - option.opt.is_code = true; - option.opt.height = 15; - optgroup->append_single_option_line(option); + optgroup = page->new_optgroup(L("Post-processing scripts"), L"param_gcode", 0); + option = optgroup->get_option("post_process"); + option.opt.full_width = true; + option.opt.is_code = true; + option.opt.height = 15; + optgroup->append_single_option_line(option); - optgroup = page->new_optgroup(L("Notes"),"note"); - optgroup->label_width = 0; - option = optgroup->get_option("process_notes"); - option.opt.full_width = true; - option.opt.height = 25; - optgroup->append_single_option_line(option); + optgroup = page->new_optgroup(L("Notes"), "note"); + optgroup->label_width = 0; + option = optgroup->get_option("process_notes"); + option.opt.full_width = true; + option.opt.height = 25; + optgroup->append_single_option_line(option); #if 0 //page = add_options_page(L("Dependencies"), "advanced.png"); @@ -3184,7 +3152,7 @@ void TabFilament::build() line.append_option(optgroup->get_option("complete_print_exhaust_fan_speed")); optgroup->append_line(line); //BBS - add_filament_overrides_page(); + // add_filament_overrides_page(); #if 0 //page = add_options_page(L("Advanced"), "advanced"); // optgroup = page->new_optgroup(L("Wipe tower parameters")); @@ -4281,48 +4249,152 @@ void TabPrinter::update_fff() void TabPrinter::update_sla() { ; } + void TabConfig::build() { m_presets = &m_preset_bundle->configs; load_initial_data(); - //auto page = add_options_page(L("Qualityttttttt"), "empty"); - //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"); - //optgroup->append_single_option_line("outer_wall_line_width", "parameter/line-width"); - //optgroup->append_single_option_line("inner_wall_line_width", "parameter/line-width"); - //optgroup->append_single_option_line("top_surface_line_width", "parameter/line-width"); - //optgroup->append_single_option_line("sparse_infill_line_width", "parameter/line-width"); - //optgroup->append_single_option_line("support_line_width", "parameter/line-width"); - //optgroup->append_single_option_line("resolution", "acr-move"); - //optgroup->append_single_option_line("enable_arc_fitting", "acr-move"); - //optgroup->append_single_option_line("wall_generator", "wall-generator"); - //optgroup->append_single_option_line("wall_sequence"); + 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"); - /*page = add_options_page(L("Strength"), "empty"); - optgroup = page->new_optgroup("", L"param_wall"); - optgroup->append_single_option_line("detect_thin_wall", "wall-generator");*/ + optgroup->append_single_option_line("initial_layer_line_width"); + optgroup->append_single_option_line("outer_wall_line_width", "parameter/line-width"); + optgroup->append_single_option_line("inner_wall_line_width", "parameter/line-width"); + optgroup->append_single_option_line("top_surface_line_width", "parameter/line-width"); + optgroup->append_single_option_line("sparse_infill_line_width", "parameter/line-width"); + optgroup->append_single_option_line("support_line_width", "parameter/line-width"); - auto page = add_options_page(L("Filament"), "spool"); - //BBS - auto optgroup = page->new_optgroup(L("Basic information"), L"param_information"); - // Set size as all another fields for a better alignment - //Option option = optgroup->get_option("filament_type"); + optgroup->append_single_option_line("seam_gap", "Seam"); + optgroup->append_single_option_line("seam_slope_conditional"); + optgroup->append_single_option_line("scarf_angle_threshold"); + optgroup->append_single_option_line("seam_slope_start_height"); + optgroup->append_single_option_line("seam_slope_entire_loop"); + optgroup->append_single_option_line("seam_slope_min_length"); + optgroup->append_single_option_line("seam_slope_steps"); + optgroup->append_single_option_line("seam_slope_inner_walls"); + optgroup->append_single_option_line("wipe_speed", "Seam"); - page = add_options_page(L("Cooling"), "empty"); + optgroup->append_single_option_line("resolution", "acr-move"); + optgroup->append_single_option_line("enable_arc_fitting", "acr-move"); - //line = { "", "" }; - //line.full_width = 1; - //line.widget = [this](wxWindow* parent) { - // return description_line_widget(parent, &m_cooling_description_line); - //}; - //optgroup->append_line(line); - optgroup = page->new_optgroup(L("Cooling for specific layer"), L"param_cooling"); + optgroup->append_single_option_line("ironing_pattern"); + optgroup->append_single_option_line("ironing_speed"); + optgroup->append_single_option_line("ironing_flow"); + optgroup->append_single_option_line("ironing_spacing"); + optgroup->append_single_option_line("ironing_direction"); - page = add_options_page(L("Advanced"), "advanced"); - optgroup = page->new_optgroup(L("Filament start G-code"), L"param_gcode", 0); + optgroup->append_single_option_line("wall_generator", "wall-generator"); + optgroup->append_single_option_line("wall_transition_angle"); + optgroup->append_single_option_line("wall_transition_filter_deviation"); + optgroup->append_single_option_line("wall_transition_length"); + optgroup->append_single_option_line("wall_distribution_count"); + optgroup->append_single_option_line("min_bead_width"); + optgroup->append_single_option_line("min_feature_size"); + optgroup->append_single_option_line("wall_sequence"); + optgroup->append_single_option_line("top_one_wall_type"); + optgroup->append_single_option_line("top_area_threshold"); + optgroup->append_single_option_line("only_one_wall_first_layer"); + optgroup->append_single_option_line("detect_overhang_wall"); + optgroup->append_single_option_line("max_travel_detour_distance"); + + optgroup->append_single_option_line("support_base_pattern_spacing", "support#base-pattern"); + optgroup->append_single_option_line("support_interface_top_layers", "support#base-pattern"); + 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"); + 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"); + optgroup->append_single_option_line("internal_solid_infill_pattern"); + + optgroup->append_single_option_line("sparse_infill_pattern", "fill-patterns#infill types and their properties of sparse"); + optgroup->append_single_option_line("filter_out_gap_fill"); + optgroup->append_single_option_line("bridge_angle", "parameter/strength-advance-settings"); + 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"); + 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"); + optgroup->append_single_option_line("initial_layer_infill_speed"); + + optgroup->append_single_option_line("outer_wall_speed"); + optgroup->append_single_option_line("inner_wall_speed"); + optgroup->append_single_option_line("sparse_infill_speed"); + optgroup->append_single_option_line("internal_solid_infill_speed"); + optgroup->append_single_option_line("top_surface_speed"); + optgroup->append_single_option_line("bridge_speed"); + optgroup->append_single_option_line("gap_infill_speed"); + optgroup->append_single_option_line("support_speed"); + optgroup->append_single_option_line("support_interface_speed"); + + optgroup->append_single_option_line("travel_speed"); + + optgroup->append_single_option_line("default_acceleration"); + 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");*/ + + 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"); + optgroup->append_single_option_line("support_threshold_angle", "support#threshold-angle"); + optgroup->append_single_option_line("support_on_build_plate_only"); + optgroup->append_single_option_line("support_critical_regions_only"); + optgroup->append_single_option_line("support_remove_small_overhang"); + + optgroup->append_single_option_line("raft_layers"); + optgroup->append_single_option_line("raft_contact_distance"); + optgroup->append_single_option_line("raft_first_layer_density"); + + optgroup->append_single_option_line("support_filament", "support#support-filament"); + optgroup->append_single_option_line("support_interface_filament", "support#support-filament"); + optgroup->append_single_option_line("support_interface_not_for_body", "support#support-filament"); + + optgroup->append_single_option_line("raft_first_layer_expansion"); // not only for raft, but for support too + optgroup->append_single_option_line("tree_support_wall_count"); + optgroup->append_single_option_line("support_base_pattern", "support#base-pattern"); + optgroup->append_single_option_line("support_interface_pattern", "support#base-pattern"); + optgroup->append_single_option_line("support_bottom_interface_spacing"); + optgroup->append_single_option_line("support_object_xy_distance", "support"); + optgroup->append_single_option_line("bridge_no_support", "support#base-pattern"); + optgroup->append_single_option_line("max_bridge_length", "support#base-pattern"); + optgroup->append_single_option_line("independent_support_layer_height", "support"); + + optgroup->append_single_option_line("tree_support_branch_distance", "support#tree-support-only-options"); + 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"); + optgroup = page->new_optgroup("", L"param_adhension"); + optgroup->append_single_option_line("slicing_mode"); + optgroup->append_single_option_line("fibre_feed_rate"); + optgroup->append_single_option_line("print_sequence", "sequent-print"); + optgroup->append_single_option_line("spiral_mode", "spiral-vase"); + optgroup->append_single_option_line("spiral_mode_smooth", "spiral-vase#smooth"); + optgroup->append_single_option_line("spiral_mode_max_xy_smoothing", "spiral-vase#max-xy-smoothing"); + optgroup->append_single_option_line("timelapse_type", "Timelapse"); + + 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"); } + + void TabConfig::reload_config() { //this->compatible_widget_reload(m_compatible_printers); @@ -4333,8 +4405,8 @@ void TabConfig::update_description_lines() { Tab::update_description_lines(); - //if (!m_active_page) - // return; + if (!m_active_page) + return; //if (m_active_page->title() == "Cooling" && m_cooling_description_line) // m_cooling_description_line->SetText(from_u8(PresetHints::cooling_description(m_presets->get_edited_preset()))); @@ -4352,11 +4424,11 @@ void TabConfig::toggle_options() { m_preset_bundle->configs.get_edited_preset().is_bbl_vendor_preset( m_preset_bundle); } - if (m_active_page->title() == "Quality") { + //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); //BBS: gcode_flavore of BBL printer can't be edited and changed - toggle_option("gcode_flavor", !is_BBL_printer); + //toggle_option("gcode_flavor", !is_BBL_printer); //toggle_option("thumbnail_size", !is_BBL_printer); //toggle_option("printer_structure", !is_BBL_printer); //toggle_option("use_relative_e_distances", !is_BBL_printer); @@ -4370,21 +4442,37 @@ void TabConfig::toggle_options() { ////BBS: extruder clearance of BBL printer can't be edited. //for (auto el : { "extruder_clearance_max_radius", "extruder_clearance_height_to_rod", "extruder_clearance_height_to_lid" }) // toggle_option(el, !is_BBL_printer); - } + //} - if (m_active_page->title() == "Strength") { + //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); - } + //toggle_option("thumbnail_size", !is_BBL_printer); + //} } void TabConfig::update() { + //m_update_cnt++; + //update_description_lines(); + ////BBS: GUI refactor + ////Layout(); + //m_parent->Layout(); + + m_update_cnt++; + update_description_lines(); //BBS: GUI refactor //Layout(); m_parent->Layout(); + + toggle_options(); + + m_update_cnt--; + + if (m_update_cnt == 0) + wxGetApp().mainframe->on_config_changed(m_config); } void TabConfig::clear_pages() { + Tab::clear_pages(); } void Tab::update_ui_items_related_on_parent_preset(const Preset* selected_preset_parent) { @@ -4816,7 +4904,7 @@ bool Tab::select_preset(std::string preset_name, bool delete_current /*=false*/, if (current_dirty || delete_current || print_tab || printer_tab) m_preset_bundle->update_compatible( update_compatible_type(technology_changed, print_tab, (print_tab ? this : wxGetApp().get_tab(Preset::TYPE_PRINT))->m_show_incompatible_presets), - update_compatible_type(technology_changed, false, wxGetApp().get_tab(Preset::TYPE_FILAMENT)->m_show_incompatible_presets)); + update_compatible_type(technology_changed, false, wxGetApp().get_tab(Preset::TYPE_FILAMENT)->m_show_incompatible_presets)); // Initialize the UI from the current preset. if (printer_tab) static_cast(this)->update_pages();