Third editing op in the wx GUI. No core change — app::connect_parts was already extracted and unit-tested; this is pure wiring. Edit ▸ Connect parts… picks two parts (PickPart twice, now caption-parameterised to label "first/second part"), derives their parent modules from Part::prnt, calls app::connect_parts and renders the same outcomes the TUI does: refused / identity NC fill / connected (N wires) / failed. wx builds clean, window opens with no asserts; tui + tests unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
47 lines
1.5 KiB
C++
47 lines
1.5 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 OnVerify(wxCommandEvent &);
|
|
void OnQuit(wxCommandEvent &);
|
|
void OnAbout(wxCommandEvent &);
|
|
|
|
// Prompt the user to pick a module then a part from the current System.
|
|
// `caption` titles the dialogs (e.g. to distinguish two picks). Returns
|
|
// nullptr if there is nothing to pick or the user cancels.
|
|
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_
|