9#include <wx/stattext.h>
11#include <wx/stc/stc.h>
18 wxBoxSizer* mainSizer =
new wxBoxSizer( wxVERTICAL );
20 m_label =
new wxStaticText(
this, wxID_ANY, label );
21 mainSizer->Add(
m_label, 0, wxALL, 5 );
25 wxArrayString choices;
26 choices.Add(
_(
"Any" ) );
27 choices.Add(
_(
"Net" ) );
28 choices.Add(
_(
"Netclass" ) );
29 choices.Add(
_(
"Within Area" ) );
30 choices.Add(
_(
"Custom Query" ) );
32 m_choice =
new wxChoice(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices );
53 SetSizer( mainSizer );
106 return m_choice->GetSelection() == 4;
112 wxString expr = aExpr;
125 wxString prefix = aPrefix;
126 if( !prefix.IsEmpty() && expr.StartsWith( prefix +
"." ) )
127 expr = expr.Mid( prefix.Length() + 1 );
129 if( std::optional<DRC_RULE_EDITOR_UTILS::SELECTOR_CONDITION> cond =
169 wxString prefix = aPrefix;
175 return wxEmptyString;
176 return prefix + wxString::Format(
".NetName == '%s'",
m_netSelector->GetSelectedNetname() );
180 return wxEmptyString;
181 return prefix + wxString::Format(
".hasNetclass('%s')",
m_netclassSelector->GetSelectedNetclass() );
185 return wxEmptyString;
186 return prefix + wxString::Format(
".enclosedByArea('%s')",
m_areaSelector->GetSelectedArea() );
192 return wxEmptyString;
194 default:
return wxEmptyString;
Information pertinent to a Pcbnew printed circuit board.
const NETINFO_LIST & GetNetInfo() const
void ParseCondition(const wxString &aExpr, const wxString &aPrefix=wxEmptyString)
Populate the panel controls from a rule condition expression.
void SetCustomQueryCtrl(wxStyledTextCtrl *ctrl)
std::function< void()> m_choiceChangeCallback
void onChoice(const wxCommandEvent &aEvent)
wxStyledTextCtrl * m_customQueryCtrl
DRC_RE_OBJECT_SELECTOR_PANEL(wxWindow *parent, BOARD *board, const wxString &label)
bool HasCustomQuerySelected() const
wxString BuildCondition(const wxString &aPrefix) const
Build a rule condition expression based on the panel state.
void SetLabelText(const wxString &text)
NET_SELECTOR * m_netSelector
AREA_SELECTOR * m_areaSelector
NETCLASS_SELECTOR * m_netclassSelector
static std::optional< SELECTOR_CONDITION > ParseSelectorCondition(const wxString &aExpr)
Match a condition that a net, netclass or area selector can show.