feat(gui): add purge mode selector dialog

The engine already implements prime_volume_mode (Default/Saving/Fast)
but nothing in the UI could set it, leaving prime-saving unreachable on
multi-sub-nozzle extruders and fast purge unreachable on printers that
support it.

- new PurgeModeDialog with selectable Standard/Fast or
  Standard/Prime Saving cards depending on printer capability
- "Purge mode" sidebar button next to Flushing volumes; opens the
  dialog and stores the choice in the project config
- printer preset-load gating: button shown only when the printer has
  multiple sub-nozzles per extruder or sets support_fast_purge_mode;
  stale project values the printer cannot honor reset to Default
- enable fast purge on A2L 0.4 (support_fast_purge_mode), explicit
  default 0 in the common machine base
- new dialog strings added to OrcaSlicer.pot

Printers without these capabilities never show the button and their
projects keep prime_volume_mode at Default, so slicing output is
unchanged.
This commit is contained in:
SoftFever
2026-07-10 15:41:57 +08:00
parent b2eeed2622
commit 93a81179a1
13 changed files with 432 additions and 3 deletions

View File

@@ -5656,6 +5656,27 @@ void TabPrinter::on_preset_loaded()
if (wxGetApp().plater())
wxGetApp().plater()->sidebar().reset_fila_switch();
}
// Purge mode selection is only meaningful for printers with multiple sub-nozzles per
// extruder (prime saving) or fast-purge support; reset stale project values that the
// current printer cannot honor and toggle the sidebar button accordingly.
auto extruder_max_nozzle_count = current_printer.config.option<ConfigOptionIntsNullable>("extruder_max_nozzle_count");
bool has_multiple_nozzle = extruder_max_nozzle_count &&
std::any_of(extruder_max_nozzle_count->values.begin(), extruder_max_nozzle_count->values.end(),
[](int v) { return v > 1 && v != ConfigOptionIntsNullable::nil_value(); });
auto support_fast_purge_opt = current_printer.config.option<ConfigOptionBool>("support_fast_purge_mode");
bool support_fast_purge = support_fast_purge_opt ? support_fast_purge_opt->value : false;
bool show_purge_mode = has_multiple_nozzle || support_fast_purge;
if (auto *prime_volume_mode = m_preset_bundle->project_config.option<ConfigOptionEnum<PrimeVolumeMode>>("prime_volume_mode")) {
if (!show_purge_mode)
prime_volume_mode->value = PrimeVolumeMode::pvmDefault;
else if (!has_multiple_nozzle && prime_volume_mode->value == PrimeVolumeMode::pvmSaving)
prime_volume_mode->value = PrimeVolumeMode::pvmDefault;
else if (!support_fast_purge && prime_volume_mode->value == PrimeVolumeMode::pvmFast)
prime_volume_mode->value = PrimeVolumeMode::pvmDefault;
}
if (wxGetApp().plater())
wxGetApp().plater()->sidebar().enable_purge_mode_btn(show_purge_mode);
}
void TabPrinter::update_pages()