KiCad PCB EDA Suite
Loading...
Searching...
No Matches
DRC_RE_CONDITION_GROUP_PANEL Class Reference

Container panel that manages multiple condition rows with boolean operators. More...

#include <drc_re_condition_group_panel.h>

Inheritance diagram for DRC_RE_CONDITION_GROUP_PANEL:

Classes

struct  CONDITION_ENTRY
 

Public Types

enum class  BOOL_OPERATOR { AND = 0 , OR , AND_NOT , OR_NOT }
 

Public Member Functions

 DRC_RE_CONDITION_GROUP_PANEL (wxWindow *aParent, BOARD *aBoard, bool aTwoObjectConstraint)
 
void ParseCondition (const wxString &aConditionExpr)
 Parse a condition string and populate the UI.
 
wxString BuildCondition () const
 Build a condition string from the current UI state.
 
void SetChangeCallback (std::function< void()> aCallback)
 Set a callback to be invoked when any condition changes.
 
bool HasCustomQuerySelected () const
 

Private Member Functions

void addConditionRow (BOOL_OPERATOR aOp=BOOL_OPERATOR::AND)
 
void removeConditionRow (int aIndex)
 
void onAddClicked (wxCommandEvent &aEvent)
 
void rebuildLayout ()
 
void updateDeleteButtonVisibility ()
 
bool tokenizeCondition (const wxString &aExpr, std::vector< std::pair< BOOL_OPERATOR, wxString > > &aParts)
 Tokenize a condition expression by boolean operators.
 

Private Attributes

BOARDm_board
 
bool m_twoObjectConstraint
 
bool m_suppressCallbacks
 
std::vector< CONDITION_ENTRYm_conditions
 
wxBoxSizer * m_mainSizer
 
wxBitmapButton * m_addBtn
 
wxStaticText * m_labelText
 
std::function< void()> m_changeCallback
 

Detailed Description

Container panel that manages multiple condition rows with boolean operators.

Supports AND, OR, AND NOT, OR NOT operators between conditions. Evaluates left-to-right without parentheses.

Definition at line 43 of file drc_re_condition_group_panel.h.

Member Enumeration Documentation

◆ BOOL_OPERATOR

Enumerator
AND 
OR 
AND_NOT 
OR_NOT 

Definition at line 46 of file drc_re_condition_group_panel.h.

Constructor & Destructor Documentation

◆ DRC_RE_CONDITION_GROUP_PANEL()

DRC_RE_CONDITION_GROUP_PANEL::DRC_RE_CONDITION_GROUP_PANEL ( wxWindow * aParent,
BOARD * aBoard,
bool aTwoObjectConstraint )

Member Function Documentation

◆ addConditionRow()

◆ BuildCondition()

wxString DRC_RE_CONDITION_GROUP_PANEL::BuildCondition ( ) const

Build a condition string from the current UI state.

Returns
The complete condition expression

Definition at line 145 of file drc_re_condition_group_panel.cpp.

References AND, AND_NOT, m_conditions, OR, OR_NOT, and result.

◆ HasCustomQuerySelected()

bool DRC_RE_CONDITION_GROUP_PANEL::HasCustomQuerySelected ( ) const
Returns
true if any row has custom query selected.

Definition at line 174 of file drc_re_condition_group_panel.cpp.

References m_conditions, and TRACE_COND.

Referenced by ParseCondition().

◆ onAddClicked()

void DRC_RE_CONDITION_GROUP_PANEL::onAddClicked ( wxCommandEvent & aEvent)
private

◆ ParseCondition()

void DRC_RE_CONDITION_GROUP_PANEL::ParseCondition ( const wxString & aConditionExpr)

Parse a condition string and populate the UI.

Parameters
aConditionExprThe complete condition expression

Definition at line 72 of file drc_re_condition_group_panel.cpp.

References addConditionRow(), HasCustomQuerySelected(), m_conditions, m_suppressCallbacks, removeConditionRow(), tokenizeCondition(), TRACE_COND, and updateDeleteButtonVisibility().

◆ rebuildLayout()

void DRC_RE_CONDITION_GROUP_PANEL::rebuildLayout ( )
private

Definition at line 326 of file drc_re_condition_group_panel.cpp.

References m_addBtn, and m_mainSizer.

◆ removeConditionRow()

◆ SetChangeCallback()

void DRC_RE_CONDITION_GROUP_PANEL::SetChangeCallback ( std::function< void()> aCallback)
inline

Set a callback to be invoked when any condition changes.

Definition at line 73 of file drc_re_condition_group_panel.h.

References m_changeCallback.

◆ tokenizeCondition()

bool DRC_RE_CONDITION_GROUP_PANEL::tokenizeCondition ( const wxString & aExpr,
std::vector< std::pair< BOOL_OPERATOR, wxString > > & aParts )
private

Tokenize a condition expression by boolean operators.

Parameters
aExprThe expression to tokenize
aPartsOutput vector of (operator, expression) pairs
Returns
true if tokenization succeeded

Definition at line 346 of file drc_re_condition_group_panel.cpp.

References AND, AND_NOT, end, OR, and OR_NOT.

Referenced by ParseCondition().

◆ updateDeleteButtonVisibility()

void DRC_RE_CONDITION_GROUP_PANEL::updateDeleteButtonVisibility ( )
private

Definition at line 336 of file drc_re_condition_group_panel.cpp.

References m_conditions.

Referenced by addConditionRow(), ParseCondition(), and removeConditionRow().

Member Data Documentation

◆ m_addBtn

wxBitmapButton* DRC_RE_CONDITION_GROUP_PANEL::m_addBtn
private

Definition at line 110 of file drc_re_condition_group_panel.h.

Referenced by DRC_RE_CONDITION_GROUP_PANEL(), and rebuildLayout().

◆ m_board

BOARD* DRC_RE_CONDITION_GROUP_PANEL::m_board
private

◆ m_changeCallback

std::function<void()> DRC_RE_CONDITION_GROUP_PANEL::m_changeCallback
private

◆ m_conditions

std::vector<CONDITION_ENTRY> DRC_RE_CONDITION_GROUP_PANEL::m_conditions
private

◆ m_labelText

wxStaticText* DRC_RE_CONDITION_GROUP_PANEL::m_labelText
private

Definition at line 111 of file drc_re_condition_group_panel.h.

Referenced by DRC_RE_CONDITION_GROUP_PANEL().

◆ m_mainSizer

wxBoxSizer* DRC_RE_CONDITION_GROUP_PANEL::m_mainSizer
private

◆ m_suppressCallbacks

bool DRC_RE_CONDITION_GROUP_PANEL::m_suppressCallbacks
private

◆ m_twoObjectConstraint

bool DRC_RE_CONDITION_GROUP_PANEL::m_twoObjectConstraint
private

The documentation for this class was generated from the following files: