Extract set-connector-type into core; add it to the wx GUI.

First of the editing ops to reach the wx frontend. Extract the business logic
(validate the kind, tag the part, apply the connector model) into
core/app/edit.{hpp,cpp}: app::set_connector_type(Part*, kind) -> {ok, error,
materialised}, refusing without mutation when the kind is invalid for the part.

Both TUI call sites now use it: the `set-connector-type` command and the
interactive settype screen (de-dup) — output unchanged. The wx GUI gains an
Edit ▸ Set connector type… menu: a reusable PickPart() (module → part choice
dialogs) + a kind prompt, then the same core op, logged and reflected in the
model tree. Prune the now-dead pin_model/transform_vpx includes from
commands.cpp.

Unit-tested by tests/test_edit.cpp (free-form kind tags; invalid kind refused
without mutation; null part). tui + wx build clean; 376 core assertions green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 21:13:08 +02:00
parent 76807b0307
commit 7e88f82446
7 changed files with 175 additions and 18 deletions

View File

@@ -22,10 +22,15 @@ private:
void OnRestore(wxCommandEvent &);
void OnSave(wxCommandEvent &);
void OnExport(wxCommandEvent &);
void OnSetConnectorType(wxCommandEvent &);
void OnVerify(wxCommandEvent &);
void OnQuit(wxCommandEvent &);
void OnAbout(wxCommandEvent &);
// Prompt the user to pick a module then a part from the current System.
// Returns nullptr if there is nothing to pick or the user cancels.
class Part *PickPart();
void RebuildModelView(); ///< refresh tree + overview from the System
void Log(const wxString &line); ///< append a line to the log pane