Merge branch 'main' into zaa

This commit is contained in:
SoftFever
2026-04-28 16:57:02 +08:00
committed by GitHub
11158 changed files with 1904570 additions and 1867502 deletions

View File

@@ -43,7 +43,9 @@
#include "MsgDialog.hpp"
#include "Notebook.hpp"
#include "Widgets/ComboBox.hpp"
#include "Widgets/Label.hpp"
#include "Widgets/SwitchButton.hpp"
#include "Widgets/TabCtrl.hpp"
#include "MarkdownTip.hpp"
#include "Search.hpp"
@@ -65,8 +67,21 @@ t_config_option_keys deep_diff(const ConfigBase &config_this, const ConfigBase &
namespace GUI {
namespace
{
int mode_to_selection(ConfigOptionMode mode)
{
return mode == comExpert ? 2 :
mode == comAdvanced ? 1 :
0;
}
}
#define DISABLE_UNDO_SYS
// Forward declaration for early use; definitions live later in this translation unit.
static void validate_custom_gcode_cb(Tab* tab, const wxString& title, const t_config_option_key& opt_key, const boost::any& value);
static const std::vector<std::string> plate_keys = { "curr_bed_type", "skirt_start_angle", "first_layer_print_sequence", "first_layer_sequence_choice", "other_layers_print_sequence", "other_layers_sequence_choice", "print_sequence", "spiral_mode"};
void Tab::Highlighter::set_timer_owner(wxEvtHandler* owner, int timerid/* = wxID_ANY*/)
@@ -387,17 +402,19 @@ void Tab::create_preset_tab()
if (dynamic_cast<TabPrint*>(this) == nullptr) {
m_mode_icon = new ScalableButton(m_top_panel, wxID_ANY, "advanced"); // ORCA
m_mode_icon->SetToolTip(_L("Show/Hide advanced parameters"));
m_mode_icon->SetToolTip(_L("Cycle settings visibility"));
m_mode_icon->Bind(wxEVT_BUTTON, [this](wxCommandEvent e) {
if(wxGetApp().get_mode() == comDevelop) return; // prevent change on dev mode
m_mode_view->SetValue(!m_mode_view->GetValue());
wxCommandEvent evt(wxEVT_TOGGLEBUTTON, m_mode_view->GetId()); // ParamsPanel::OnToggled(evt)
evt.SetEventObject(m_mode_view);
m_mode_view->wxEvtHandler::ProcessEvent(evt);
if (wxGetApp().get_mode() == comDevelop || m_mode_view == nullptr)
return; // prevent change on dev mode
const int selection = m_mode_view->GetSelection();
m_mode_view->SelectAndNotify((selection + 1) % 3);
});
m_top_sizer->Add(m_mode_icon, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::WideSpacing()));
m_mode_view = new SwitchButton(m_top_panel, wxID_ABOUT);
m_mode_view->SetToolTip(_L("Show/Hide advanced parameters"));
m_mode_view = new ModeSwitchButton(m_top_panel);
m_mode_view->SetSelection(mode_to_selection(wxGetApp().get_saved_mode()));
if (wxGetApp().get_mode() == comDevelop)
m_mode_view->Enable(false);
m_top_sizer->AddSpacer(FromDIP(SidebarProps::ElementSpacing()));
m_top_sizer->Add( m_mode_view, 0, wxALIGN_CENTER_VERTICAL);
}
@@ -411,56 +428,6 @@ void Tab::create_preset_tab()
else
m_top_panel->Hide();
#if 0
#ifdef _MSW_DARK_MODE
// Sizer with buttons for mode changing
if (wxGetApp().tabs_as_menu())
#endif
m_mode_sizer = new ModeSizer(panel, int (0.5*em_unit(this)));
const float scale_factor = /*wxGetApp().*/em_unit(this)*0.1;// GetContentScaleFactor();
m_hsizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(m_hsizer, 0, wxEXPAND | wxBOTTOM, 3);
m_hsizer->Add(m_presets_choice, 0, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3);
m_hsizer->AddSpacer(int(4*scale_factor));
m_hsizer->Add(m_btn_save_preset, 0, wxALIGN_CENTER_VERTICAL);
m_hsizer->AddSpacer(int(4 * scale_factor));
m_hsizer->Add(m_btn_delete_preset, 0, wxALIGN_CENTER_VERTICAL);
if (m_btn_edit_ph_printer) {
m_hsizer->AddSpacer(int(4 * scale_factor));
m_hsizer->Add(m_btn_edit_ph_printer, 0, wxALIGN_CENTER_VERTICAL);
}
m_hsizer->AddSpacer(int(/*16*/8 * scale_factor));
m_hsizer->Add(m_btn_hide_incompatible_presets, 0, wxALIGN_CENTER_VERTICAL);
m_hsizer->AddSpacer(int(8 * scale_factor));
m_hsizer->Add(m_question_btn, 0, wxALIGN_CENTER_VERTICAL);
m_hsizer->AddSpacer(int(32 * scale_factor));
m_hsizer->Add(m_undo_to_sys_btn, 0, wxALIGN_CENTER_VERTICAL);
m_hsizer->Add(m_undo_btn, 0, wxALIGN_CENTER_VERTICAL);
m_hsizer->AddSpacer(int(32 * scale_factor));
m_hsizer->Add(m_search_btn, 0, wxALIGN_CENTER_VERTICAL);
m_hsizer->AddSpacer(int(8*scale_factor));
m_hsizer->Add(m_btn_compare_preset, 0, wxALIGN_CENTER_VERTICAL);
m_hsizer->AddSpacer(int(16*scale_factor));
// m_hsizer->AddStretchSpacer(32);
// StretchSpacer has a strange behavior under OSX, so
// There is used just additional sizer for m_mode_sizer with right alignment
if (m_mode_sizer) {
auto mode_sizer = new wxBoxSizer(wxVERTICAL);
// Don't set the 2nd parameter to 1, making the sizer rubbery scalable in Y axis may lead
// to wrong vertical size assigned to wxBitmapComboBoxes, see GH issue #7176.
mode_sizer->Add(m_mode_sizer, 0, wxALIGN_RIGHT);
m_hsizer->Add(mode_sizer, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, wxOSX ? 15 : 10);
}
//Horizontal sizer to hold the tree and the selected page.
m_hsizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(m_hsizer, 1, wxEXPAND, 0);
//left vertical sizer
m_left_sizer = new wxBoxSizer(wxVERTICAL);
m_hsizer->Add(m_left_sizer, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 3);
#endif
// tree
m_tabctrl = new TabCtrl(panel, wxID_ANY, wxDefaultPosition, wxSize(20 * m_em_unit, -1),
wxTR_NO_BUTTONS | wxTR_HIDE_ROOT | wxTR_SINGLE | wxTR_NO_LINES | wxBORDER_NONE | wxWANTS_CHARS | wxTR_FULL_ROW_HIGHLIGHT);
@@ -1271,11 +1238,6 @@ void Tab::update_mode()
{
m_mode = wxGetApp().get_mode();
//BBS: GUI refactor
// update mode for ModeSizer
//if (m_mode_sizer)
// m_mode_sizer->SetMode(m_mode);
update_visibility();
update_changed_tree_ui();
@@ -1319,7 +1281,9 @@ void Tab::msw_rescale()
bmp->msw_rescale();
if (m_mode_view)
{
m_mode_view->Rescale();
}
if (m_detach_preset_btn)
m_detach_preset_btn->msw_rescale();
@@ -2324,6 +2288,7 @@ void TabPrint::build()
optgroup->append_single_option_line("xy_hole_compensation", "quality_settings_precision#x-y-compensation");
optgroup->append_single_option_line("xy_contour_compensation", "quality_settings_precision#x-y-compensation");
optgroup->append_single_option_line("elefant_foot_compensation", "quality_settings_precision#elephant-foot-compensation");
optgroup->append_single_option_line("elefant_foot_layers_density", "quality_settings_precision#elephant-foot-compensation");
optgroup->append_single_option_line("elefant_foot_compensation_layers", "quality_settings_precision#elephant-foot-compensation");
optgroup->append_single_option_line("precise_outer_wall", "quality_settings_precision#precise-wall");
optgroup->append_single_option_line("precise_z_height", "quality_settings_precision#precise-z-height");
@@ -2356,6 +2321,8 @@ void TabPrint::build()
optgroup->append_single_option_line("min_bead_width", "quality_settings_wall_generator#arachne");
optgroup->append_single_option_line("min_feature_size", "quality_settings_wall_generator#arachne");
optgroup->append_single_option_line("min_length_factor", "quality_settings_wall_generator#arachne");
optgroup->append_single_option_line("wall_maximum_resolution", "quality_settings_wall_generator#arachne");
optgroup->append_single_option_line("wall_maximum_deviation", "quality_settings_wall_generator#arachne");
optgroup = page->new_optgroup(L("Walls and surfaces"), L"param_wall_surface");
optgroup->append_single_option_line("wall_sequence", "quality_settings_wall_and_surfaces#walls-printing-order");
@@ -2374,9 +2341,9 @@ void TabPrint::build()
optgroup->append_single_option_line("gap_fill_flow_ratio", "quality_settings_wall_and_surfaces#surface-flow-ratio");
optgroup->append_single_option_line("support_flow_ratio", "quality_settings_wall_and_surfaces#surface-flow-ratio");
optgroup->append_single_option_line("support_interface_flow_ratio", "quality_settings_wall_and_surfaces#surface-flow-ratio");
optgroup->append_single_option_line("only_one_wall_first_layer", "quality_settings_wall_and_surfaces#only-one-wall");
optgroup->append_single_option_line("only_one_wall_top", "quality_settings_wall_and_surfaces#only-one-wall");
optgroup->append_single_option_line("min_width_top_surface", "quality_settings_wall_and_surfaces#threshold");
optgroup->append_single_option_line("only_one_wall_first_layer", "quality_settings_wall_and_surfaces#only-one-wall");
optgroup->append_single_option_line("reduce_crossing_wall", "quality_settings_wall_and_surfaces#avoid-crossing-walls");
optgroup->append_single_option_line("max_travel_detour_distance", "quality_settings_wall_and_surfaces#max-detour-length");
@@ -2509,6 +2476,7 @@ void TabPrint::build()
optgroup->append_single_option_line("sparse_infill_acceleration", "speed_settings_acceleration#sparse-infill");
optgroup->append_single_option_line("internal_solid_infill_acceleration", "speed_settings_acceleration#internal-solid-infill");
optgroup->append_single_option_line("initial_layer_acceleration", "speed_settings_acceleration#initial-layer");
optgroup->append_single_option_line("initial_layer_travel_acceleration", "speed_settings_acceleration#initial-layer-travel");
optgroup->append_single_option_line("top_surface_acceleration", "speed_settings_acceleration#top-surface");
optgroup->append_single_option_line("travel_acceleration", "speed_settings_acceleration#travel");
optgroup->append_single_option_line("accel_to_decel_enable", "speed_settings_acceleration");
@@ -2522,6 +2490,7 @@ void TabPrint::build()
optgroup->append_single_option_line("infill_jerk", "speed_settings_jerk_xy#infill");
optgroup->append_single_option_line("top_surface_jerk", "speed_settings_jerk_xy#top-surface");
optgroup->append_single_option_line("initial_layer_jerk", "speed_settings_jerk_xy#initial-layer");
optgroup->append_single_option_line("initial_layer_travel_jerk", "speed_settings_jerk_xy#initial-layer-travel");
optgroup->append_single_option_line("travel_jerk", "speed_settings_jerk_xy#travel");
optgroup = page->new_optgroup(L("Advanced"), L"param_advanced", 15);
@@ -2663,8 +2632,9 @@ void TabPrint::build()
optgroup->append_single_option_line("brim_type", "others_settings_brim#type");
optgroup->append_single_option_line("brim_width", "others_settings_brim#width");
optgroup->append_single_option_line("brim_object_gap", "others_settings_brim#brim-object-gap");
optgroup->append_single_option_line("brim_flow_ratio", "others_settings_brim#brim-flow-ratio");
optgroup->append_single_option_line("brim_use_efc_outline", "others_settings_brim#brim-use-efc-outline");
optgroup->append_single_option_line("combine_brims", "others_settings_brim#combine-brim");
optgroup->append_single_option_line("combine_brims", "others_settings_brim#combine-brims");
optgroup->append_single_option_line("brim_ears_max_angle", "others_settings_brim#ear-max-angle");
optgroup->append_single_option_line("brim_ears_detection_length", "others_settings_brim#ear-detection-radius");
@@ -2705,6 +2675,17 @@ void TabPrint::build()
// option.opt.height = 5;
optgroup->append_single_option_line(option, "others_settings_g_code_output#filename-format");
optgroup = page->new_optgroup(L("Change extrusion role G-code"), L"param_gcode", 0);
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
};
optgroup->edit_custom_gcode = [this](const t_config_option_key& opt_key) { edit_custom_gcode(opt_key); };
option = optgroup->get_option("process_change_extrusion_role_gcode");
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;
@@ -3887,8 +3868,8 @@ void TabFilament::build()
//
optgroup = page->new_optgroup(L("Print chamber temperature"), L"param_chamber_temp");
optgroup->append_single_option_line("chamber_temperature", "material_temperatures#print-chamber-temperature");
optgroup->append_single_option_line("activate_chamber_temp_control", "material_temperatures#print-chamber-temperature");
optgroup->append_single_option_line("chamber_temperature", "material_temperatures#print-chamber-temperature");
optgroup = page->new_optgroup(L("Print temperature"), L"param_extruder_temp");
line = { L("Nozzle"), L("Nozzle temperature when printing") };
@@ -4025,12 +4006,14 @@ void TabFilament::build()
optgroup->append_single_option_line("activate_air_filtration", "material_cooling#activate-air-filtration");
line = {L("During print"), ""};
line.append_option(optgroup->get_option("activate_air_filtration_during_print"));
line.append_option(optgroup->get_option("during_print_exhaust_fan_speed"));
line.label_path = "material_cooling#during-print";
optgroup->append_line(line);
line = {L("Complete print"), ""};
line.append_option(optgroup->get_option("activate_air_filtration_on_completion"));
line.append_option(optgroup->get_option("complete_print_exhaust_fan_speed"));
line.label_path = "material_cooling#complete-print";
optgroup->append_line(line);
@@ -4053,6 +4036,17 @@ void TabFilament::build()
option.opt.height = gcode_field_height;// 150;
optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(L("Change extrusion role G-code"), L"param_gcode", 0);
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
};
optgroup->edit_custom_gcode = edit_custom_gcode_fn;
option = optgroup->get_option("filament_change_extrusion_role_gcode");
option.opt.full_width = true;
option.opt.is_code = true;
option.opt.height = gcode_field_height;// 150;
optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(L("Filament end G-code"), L"param_gcode", 0);
optgroup->m_on_change = [this, &optgroup_title = optgroup->title](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup_title, opt_key, value);
@@ -4186,22 +4180,33 @@ void TabFilament::toggle_options()
return;
bool is_BBL_printer = false;
if (m_preset_bundle) {
is_BBL_printer =
wxGetApp().preset_bundle->is_bbl_vendor();
is_BBL_printer = wxGetApp().preset_bundle->is_bbl_vendor();
}
bool is_multi_extruder = m_preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloats>("nozzle_diameter")->size() > 1;
auto cfg = m_preset_bundle->printers.get_edited_preset().config;
auto printer_cfg = m_preset_bundle->printers.get_edited_preset().config;
if (m_active_page->title() == L("Cooling")) {
bool has_enable_overhang_bridge_fan = m_config->opt_bool("enable_overhang_bridge_fan", 0);
for (auto el : {"overhang_fan_speed", "overhang_fan_threshold", "internal_bridge_fan_speed"}) // ORCA: Add support for separate internal bridge fan speed control
bool has_enable_overhang_bridge_fan = m_config->opt_bool("enable_overhang_bridge_fan", 0);
for (auto el : {"overhang_fan_speed", "overhang_fan_threshold", "internal_bridge_fan_speed"}) // ORCA: Add support for separate internal bridge fan speed control
toggle_option(el, has_enable_overhang_bridge_fan);
toggle_option("additional_cooling_fan_speed", cfg.opt_bool("auxiliary_fan"));
// Orca: toggle dont slow down for external perimeters if
bool has_slow_down_for_layer_cooling = m_config->opt_bool("slow_down_for_layer_cooling", 0);
toggle_option("dont_slow_down_outer_wall", has_slow_down_for_layer_cooling);
// Orca: toggle dont slow down for external perimeters if
bool has_slow_down_for_layer_cooling = m_config->opt_bool("slow_down_for_layer_cooling", 0);
toggle_option("dont_slow_down_outer_wall", has_slow_down_for_layer_cooling);
toggle_line("additional_cooling_fan_speed", printer_cfg.opt_bool("auxiliary_fan"));
bool support_air_filtration = printer_cfg.opt_bool("support_air_filtration");
for (auto el : {"activate_air_filtration", "during_print_exhaust_fan_speed", "complete_print_exhaust_fan_speed"})
toggle_line(el, support_air_filtration);
if (support_air_filtration) {
bool activate_air_filtration = m_config->opt_bool("activate_air_filtration", 0);
toggle_option("activate_air_filtration_during_print", activate_air_filtration);
toggle_option("during_print_exhaust_fan_speed", activate_air_filtration && m_config->opt_bool("activate_air_filtration_during_print", 0));
toggle_option("activate_air_filtration_on_completion", activate_air_filtration);
toggle_option("complete_print_exhaust_fan_speed", activate_air_filtration && m_config->opt_bool("activate_air_filtration_on_completion", 0));
}
}
if (m_active_page->title() == L("Filament"))
{
@@ -4222,7 +4227,7 @@ void TabFilament::toggle_options()
bool support_multi_bed_types = std::find(bed_temp_keys.begin(), bed_temp_keys.end(), bed_temp_1st_layer_key) ==
bed_temp_keys.end() ||
is_BBL_printer || cfg.opt_bool("support_multi_bed_types");
is_BBL_printer || printer_cfg.opt_bool("support_multi_bed_types");
for (const auto& key : bed_temp_keys)
{
@@ -4241,20 +4246,26 @@ void TabFilament::toggle_options()
toggle_line("adaptive_pressure_advance_model", has_adaptive_pa && pa);
toggle_line("adaptive_pressure_advance_bridges", has_adaptive_pa && pa);
bool is_pellet_printer = cfg.opt_bool("pellet_modded_printer");
bool is_pellet_printer = printer_cfg.opt_bool("pellet_modded_printer");
toggle_line("pellet_flow_coefficient", is_pellet_printer);
toggle_line("filament_diameter", !is_pellet_printer);
bool support_chamber_temp_control = this->m_preset_bundle->printers.get_edited_preset().config.opt_bool("support_chamber_temp_control");
bool support_chamber_temp_control = printer_cfg.opt_bool("support_chamber_temp_control");
toggle_line("activate_chamber_temp_control", support_chamber_temp_control);
toggle_line("chamber_temperature", support_chamber_temp_control);
if (support_chamber_temp_control) {
bool activate_chamber_temp_control = m_config->opt_bool("activate_chamber_temp_control", 0);
toggle_option("chamber_temperature", activate_chamber_temp_control);
}
std::string volumetric_speed_cos = m_config->opt_string("volumetric_speed_coefficients", 0u);
bool enable_fit = volumetric_speed_cos != "0 0 0 0 0 0";
toggle_option("filament_adaptive_volumetric_speed", enable_fit, 256 + 0u);
}
if (m_active_page->title() == L("Setting Overrides"))
update_filament_overrides_page(&cfg);
update_filament_overrides_page(&printer_cfg);
if (m_active_page->title() == L("Multimaterial")) {
// Orca: hide specific settings for BBL printers
@@ -4267,9 +4278,10 @@ void TabFilament::toggle_options()
toggle_option("filament_multitool_ramming_volume", multitool_ramming);
toggle_option("filament_multitool_ramming_flow", multitool_ramming);
bool is_BBL_multi_extruder = is_BBL_printer && printer_cfg.option<ConfigOptionFloats>("nozzle_diameter")->size() > 1;
const int extruder_idx = 0; // m_variant_combo->GetSelection(); // TODO: Orca hack
toggle_line("long_retractions_when_ec", is_multi_extruder && is_BBL_printer, 256 + extruder_idx);
toggle_line("retraction_distances_when_ec", is_multi_extruder && is_BBL_printer && m_config->opt_bool("long_retractions_when_ec", extruder_idx), 256 + extruder_idx);
toggle_line("long_retractions_when_ec", is_BBL_multi_extruder, 256 + extruder_idx);
toggle_line("retraction_distances_when_ec", is_BBL_multi_extruder && m_config->opt_bool("long_retractions_when_ec", extruder_idx), 256 + extruder_idx);
}
}