40 bool aShowObjectSelector ) :
44 wxLogTrace(
TRACE_COND, wxS(
"[DRC_RE_CONDITION_ROW_PANEL] ctor START" ) );
54 wxArrayString objectChoices;
55 objectChoices.Add(
_(
"Object A" ) );
56 objectChoices.Add(
_(
"Object B" ) );
58 m_objectChoice =
new wxChoice(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, objectChoices );
60 m_objectChoice->SetToolTip(
_(
"Which of the two compared objects this condition applies to" ) );
63 if( !aShowObjectSelector )
67 wxArrayString conditionChoices;
68 conditionChoices.Add(
_(
"Any" ) );
69 conditionChoices.Add(
_(
"Net" ) );
70 conditionChoices.Add(
_(
"Netclass" ) );
71 conditionChoices.Add(
_(
"Within Area" ) );
72 conditionChoices.Add(
_(
"Custom Query" ) );
74 m_conditionChoice =
new wxChoice(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, conditionChoices );
103 m_customQueryCtrl =
new wxStyledTextCtrl(
this, wxID_ANY, wxDefaultPosition, wxSize( -1, 60 ) );
104 m_customQueryCtrl->SetToolTip(
_(
"Custom match expression in the DRC rule language" ) );
119 []( wxKeyEvent& aEvent )
123 []( wxStyledTextEvent& aEvent )
134 m_deleteBtn->SetToolTip(
_(
"Remove this condition" ) );
137 wxLogTrace(
TRACE_COND, wxS(
"[DRC_RE_CONDITION_ROW_PANEL] setting sizer" ) );
149 wxLogTrace(
TRACE_COND, wxS(
"[DRC_RE_CONDITION_ROW_PANEL] ctor END" ) );
228 wxLogTrace(
TRACE_COND, wxS(
"[ParseExpression] expr='%s'" ), aExpr );
230 if( aExpr.IsEmpty() )
232 wxLogTrace(
TRACE_COND, wxS(
"[ParseExpression] empty -> ANY" ) );
237 wxString expr = aExpr;
240 if( expr.StartsWith(
"A." ) )
243 expr = expr.Mid( 2 );
245 else if( expr.StartsWith(
"B." ) )
248 expr = expr.Mid( 2 );
252 static wxRegEx netRe( wxT(
"^NetName\\s*==\\s*'([^']*)'" ) );
253 static wxRegEx netclassRe1( wxT(
"^hasNetclass\\('([^']*)'\\)" ) );
254 static wxRegEx netclassRe2( wxT(
"^NetClass\\s*==\\s*'([^']*)'" ) );
255 static wxRegEx areaRe( wxT(
"^(?:enclosedByArea|intersectsArea)\\('([^']*)'\\)" ) );
257 if( netRe.Matches( expr ) )
259 wxLogTrace(
TRACE_COND, wxS(
"[ParseExpression] matched NET pattern" ) );
264 else if( netclassRe1.Matches( expr ) )
266 wxLogTrace(
TRACE_COND, wxS(
"[ParseExpression] matched NETCLASS (hasNetclass) pattern" ) );
271 else if( netclassRe2.Matches( expr ) )
273 wxLogTrace(
TRACE_COND, wxS(
"[ParseExpression] matched NETCLASS (NetClass==) pattern" ) );
278 else if( areaRe.Matches( expr ) )
280 wxLogTrace(
TRACE_COND, wxS(
"[ParseExpression] matched WITHIN_AREA pattern" ) );
287 wxLogTrace(
TRACE_COND, wxS(
"[ParseExpression] no match -> CUSTOM" ) );