mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-16 12:21:11 +00:00
refactor(imex): replace "primary" magic string with kImexPrimaryMode constant
Across 6 files the literal "primary" string was the sentinel for "no IMEX parallel mode active" — used for short-circuiting in serialization, ghost visualization, zone calc, popup-menu list construction, the IMEXModesCtrl non-deletable first row, and several layer-of-export checks. A typo in any one would silently bypass the guard. Define kImexPrimaryMode in IMEXHelpers.hpp with a docstring describing what equality with it means semantically, and route every call site through it. No behavior change. Touched: bbs_3mf.cpp, GCode.cpp, PartPlate.cpp, Plater.cpp, Tab.cpp. The bbs_3mf and Tab files now include IMEXHelpers.hpp; the other three already did. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
efa9d65cb4
commit
085f5ccec8
@@ -9944,7 +9944,7 @@ static std::vector<wxString> collect_imex_warnings(PartPlate* plate)
|
||||
|
||||
// Checks 2 & 3 only apply when a non-primary parallel mode is active
|
||||
const std::string mode = plate->get_imex_mode();
|
||||
if (mode == "primary") return warnings;
|
||||
if (mode == kImexPrimaryMode) return warnings;
|
||||
|
||||
PresetBundle* bundle = wxGetApp().preset_bundle;
|
||||
if (!bundle) return warnings;
|
||||
@@ -17970,14 +17970,14 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click, bool isModi
|
||||
ret = select_plate(plate_index);
|
||||
if (!ret) {
|
||||
PartPlate* curr_plate = p->partplate_list.get_curr_plate();
|
||||
// Build ordered mode list: "primary" first, then all named modes.
|
||||
// Build ordered mode list: kImexPrimaryMode first, then all named modes.
|
||||
std::vector<std::string> modes;
|
||||
modes.push_back("primary");
|
||||
modes.push_back(kImexPrimaryMode);
|
||||
const DynamicPrintConfig& printer_cfg = wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
auto* names_opt = printer_cfg.option<ConfigOptionStrings>("imex_mode_names");
|
||||
if (names_opt) {
|
||||
for (const auto& n : names_opt->values)
|
||||
if (!n.empty() && n != "primary") modes.push_back(n);
|
||||
if (!n.empty() && n != kImexPrimaryMode) modes.push_back(n);
|
||||
}
|
||||
|
||||
if (right_click) {
|
||||
|
||||
Reference in New Issue
Block a user