20#ifndef PANEL_DRC_RULE_EDITOR_H
21#define PANEL_DRC_RULE_EDITOR_H
46 std::shared_ptr<DRC_RE_BASE_CONSTRAINT_DATA> aConstraintData );
67 std::function<
bool(
int aNodeId,
const wxString& aRuleName )> aCallbackRuleNameValidation )
104 bool ValidateInputs(
int* aErrorCount, wxString* aValidationMessage )
override;
108 void OnEnterKey( wxCommandEvent& aEvent )
override;
110 void Save( wxCommandEvent& aEvent );
178 const wxString& aLayerSource = wxEmptyString );
Information pertinent to a Pcbnew printed circuit board.
Container panel that manages multiple condition rows with boolean operators.
DRC_RULE_EDITOR_CONTENT_PANEL_BASE()=default
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
PANEL_DRC_RULE_EDITOR_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxBORDER_NONE|wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
std::shared_ptr< DRC_RE_BASE_CONSTRAINT_DATA > m_constraintData
wxString GenerateRule(const RULE_GENERATION_CONTEXT &aContext) override
void onScintillaCharAdded(wxStyledTextEvent &aEvent)
Handles character addition in the Scintilla text control, performing auto-complete and context-sensit...
static void LayoutAncestors(wxWindow *aWindow)
Lays out aWindow's parents, out to the page it scrolls in.
void onShowMatchesButtonClicked(wxCommandEvent &aEvent)
void ClearModified()
Called once the form's contents have reached the document.
void onFieldChanged(wxEvent &aEvent)
void SetSaveCallback(std::function< void(int aNodeId)> aCallBackSave)
void onCheckSyntax(wxCommandEvent &aEvent) override
Checks the syntax of the DRC rule condition and reports any errors.
std::function< void(int aNodeId)> m_callBackSave
wxString m_validationMessage
HTML_MESSAGE_BOX * m_helpWindow
wxString GetValidationMessage()
static PANEL_DRC_RULE_EDITOR * FindEditor(wxWindow *aChild)
The rule editor that hosts aChild, or nullptr when it is not inside one.
void stretchConstraintColumn()
wxString getSelectedLayerSource() const
void onContextMenu(wxMouseEvent &aEvent) override
Handles right-click context menu actions for text editing (undo, redo, cut, copy, paste,...
PANEL_DRC_RULE_EDITOR(wxWindow *aParent, BOARD *aBoard, DRC_RULE_EDITOR_CONSTRAINT_NAME aConstraintType, std::shared_ptr< DRC_RE_BASE_CONSTRAINT_DATA > aConstraintData)
bool TransferDataFromWindow() override
wxString GetCondition() const
The condition the form currently describes, which is not yet the one the rule applies.
bool GetIsValidationSucceeded()
std::function< void()> m_callBackFieldChanged
void setSelectedLayers(const std::vector< PCB_LAYER_ID > &aLayers, const wxString &aLayerSource=wxEmptyString)
DRC_LAYER_CATEGORY m_layerCategory
wxButton * m_btnShowMatches
void onSyntaxHelp(wxHyperlinkEvent &aEvent) override
Displays a modeless help window with syntax and rule documentation.
std::vector< int > m_layerIDs
wxStaticText * m_matchReport
~PANEL_DRC_RULE_EDITOR() override
wxChoice * m_layerListChoiceCtrl
void populateLayerSelector(DRC_LAYER_CATEGORY aCategory)
DRC_RULE_EDITOR_CONSTRAINT_NAME m_constraintType
void SetOverrideNote(const wxString &aText)
Shows a line above the constraint saying what this rule displaces, or clears it when empty.
void SetShowMatchesCallBack(std::function< int(int aNodeId)> aCallBackShowMatches)
wxStaticText * m_overrideNote
void SetRuleNameValidationCallback(std::function< bool(int aNodeId, const wxString &aRuleName)> aCallbackRuleNameValidation)
bool m_validationSucceeded
void RelayoutHost()
Lays out the editor's parents, out to the page it scrolls in.
void onErrorLinkClicked(wxHtmlLinkEvent &aEvent) override
Handles clicks on error links in the syntax error report and navigates to the error location.
void OnEnterKey(wxCommandEvent &aEvent) override
std::function< int(int aNodeId)> m_callBackShowMatches
wxString GetLayerSource() const
The layers the form currently selects, empty for any layer.
std::function< bool(int aNodeId, const wxString &aRuleName)> m_callBackRuleNameValidation
bool TransferDataToWindow() override
DRC_RE_CONDITION_GROUP_PANEL * m_conditionGroupPanel
std::unique_ptr< SCINTILLA_TRICKS > m_scintillaTricks
void Save(wxCommandEvent &aEvent)
void onSaveButtonClicked(wxCommandEvent &aEvent)
Handles the save button click event, validating inputs and invoking the save callback if valid.
std::vector< int > m_validLayers
DRC_RULE_EDITOR_CONTENT_PANEL_BASE * getConstraintPanel(wxWindow *aParent, const DRC_RULE_EDITOR_CONSTRAINT_NAME &aConstraintType)
std::vector< PCB_LAYER_ID > getSelectedLayers()
bool ValidateRule()
Runs the rule's validators and keeps the outcome, without applying anything.
wxString buildLayerClause() const
bool ValidateInputs(int *aErrorCount, wxString *aValidationMessage) override
DRC_RULE_EDITOR_CONTENT_PANEL_BASE * m_constraintPanel
void SetFieldChangeCallback(std::function< void()> aCallback)
Called whenever a field is edited, so a caller can follow the form rather than the document.
Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.
DRC_RULE_EDITOR_CONSTRAINT_NAME
DRC_LAYER_CATEGORY
Layer categories for filtering the layer selector dropdown.