Files
essim/src/frontends/wx/wx_frame.hpp
François 19dbec9672 Extract set-signal-type into core; add it to the wx GUI.
Fourth editing op into the wx frontend. Extract the type-name parse + apply
into core/app/edit.hpp::set_signal_type(Signal*, name) -> {ok, error, type},
failing without mutation on an unrecognised name. The interactive sigtype modal
keeps its own SignalType-cycling path (different interaction, trivial mutation).

The TUI `set-signal-type` command now renders that result (output unchanged).
The wx GUI gains Edit ▸ Set signal type…: a shared PickModule() helper (PickPart
now builds on it) + inline signal choice + a power/gnd/other dropdown, then the
core op, logged as "module/signal: signal type = …" and reflected.

tests/test_edit.cpp: name parsed and applied; unknown name refused without
mutation. 387 core assertions green; tui + wx build clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 21:27:44 +02:00

49 lines
1.6 KiB
C++

#ifndef _WX_FRAME_HPP_
#define _WX_FRAME_HPP_
#include <wx/frame.h>
class WxFrontend;
class wxTreeCtrl;
class wxTextCtrl;
class wxCommandEvent;
// The essim main window. Holds no domain state of its own: it reads and mutates
// the System owned by the WxFrontend, calling the core/app operations directly
// (load, verify, export, save, restore) and rendering their results into a
// model tree, an overview panel and a log.
class EssimFrame : public wxFrame {
public:
explicit EssimFrame(WxFrontend &fe);
private:
// Menu handlers — each is a thin wrapper over a core/app operation.
void OnLoad(wxCommandEvent &);
void OnRestore(wxCommandEvent &);
void OnSave(wxCommandEvent &);
void OnExport(wxCommandEvent &);
void OnSetConnectorType(wxCommandEvent &);
void OnAttachBsdl(wxCommandEvent &);
void OnConnect(wxCommandEvent &);
void OnSetSignalType(wxCommandEvent &);
void OnVerify(wxCommandEvent &);
void OnQuit(wxCommandEvent &);
void OnAbout(wxCommandEvent &);
// Modal pickers over the current System. `caption` titles the dialogs (e.g.
// to distinguish two picks). Each returns nullptr if there is nothing to
// pick or the user cancels.
class Module *PickModule(const wxString &caption);
class Part *PickPart(const wxString &caption = "Select part");
void RebuildModelView(); ///< refresh tree + overview from the System
void Log(const wxString &line); ///< append a line to the log pane
WxFrontend &fe_;
wxTreeCtrl *tree_ = nullptr;
wxTextCtrl *overview_ = nullptr;
wxTextCtrl *log_ = nullptr;
};
#endif // _WX_FRAME_HPP_