41 std::vector<DRC_RE_FIELD_POSITION> positions =
m_data->GetFieldPositions();
43 wxWindow* eventSource =
nullptr;
45 for( wxWindow* win = aParent; win; win = win->GetParent() )
57 wxArrayString choices;
58 choices.Add(
_(
"Any" ) );
59 choices.Add(
_(
"Through" ) );
60 choices.Add(
_(
"Micro" ) );
61 choices.Add(
_(
"Blind" ) );
62 choices.Add(
_(
"Buried" ) );
65 wxSize( viaTypePos.
xEnd - viaTypePos.
xStart, -1 ), choices );
72 wxPoint( viaTypePos.
xStart - labelSize.GetWidth() - 4,
73 viaTypePos.
yTop + (
m_viaTypeChoice->GetBestSize().GetHeight() - labelSize.GetHeight() ) / 2 ) );
76 auto* minViaDiameterField =
77 AddField<wxTextCtrl>( wxS(
"min_via_diameter" ), positions[0], wxTE_PROCESS_ENTER | wxTE_CENTRE );
79 std::make_unique<UNIT_BINDER>( &
m_unitsProvider, eventSource,
nullptr, minViaDiameterField->GetControl(),
80 minViaDiameterField->GetLabel(),
false,
false );
83 auto* maxViaDiameterField =
84 AddField<wxTextCtrl>( wxS(
"max_via_diameter" ), positions[1], wxTE_PROCESS_ENTER | wxTE_CENTRE );
86 std::make_unique<UNIT_BINDER>( &
m_unitsProvider, eventSource,
nullptr, maxViaDiameterField->GetControl(),
87 maxViaDiameterField->GetLabel(),
false,
false );
91 auto* minViaHoleField =
94 std::make_unique<UNIT_BINDER>( &
m_unitsProvider, eventSource,
nullptr, minViaHoleField->GetControl(),
95 minViaHoleField->GetLabel(),
false,
false );
98 auto* maxViaHoleField =
101 std::make_unique<UNIT_BINDER>( &
m_unitsProvider, eventSource,
nullptr, maxViaHoleField->GetControl(),
102 maxViaHoleField->GetLabel(),
false,
false );
109 int fieldHeight = minViaDiameterField->GetControl()->GetBestSize().GetHeight();
111 auto* openDia =
new wxStaticText(
this, wxID_ANY, wxS(
"(" ) );
112 wxSize openSize = openDia->GetBestSize();
113 openDia->SetPosition( wxPoint( minPos.
xStart - openSize.GetWidth() - 2,
114 minPos.
yTop + ( fieldHeight - openSize.GetHeight() ) / 2 ) );
116 auto* dashDia =
new wxStaticText(
this, wxID_ANY, wxS(
"-" ) );
117 wxSize dashSize = dashDia->GetBestSize();
118 wxStaticText* minMmLabel = minViaDiameterField->GetLabel();
119 int afterMinLabel = minMmLabel->GetPosition().x + minMmLabel->GetBestSize().GetWidth();
120 int gapMid = ( afterMinLabel + maxPos.
xStart ) / 2;
121 dashDia->SetPosition(
122 wxPoint( gapMid - dashSize.GetWidth() / 2, minPos.
yTop + ( fieldHeight - dashSize.GetHeight() ) / 2 ) );
124 auto* closeDia =
new wxStaticText(
this, wxID_ANY, wxS(
")" ) );
125 wxSize closeSize = closeDia->GetBestSize();
126 wxStaticText* mmLabel = maxViaDiameterField->GetLabel();
127 int afterLabel = mmLabel->GetPosition().x + mmLabel->GetBestSize().GetWidth();
128 closeDia->SetPosition( wxPoint( afterLabel + 2, minPos.
yTop + ( fieldHeight - closeSize.GetHeight() ) / 2 ) );
135 int fieldHeight = minViaHoleField->GetControl()->GetBestSize().GetHeight();
137 auto* openHole =
new wxStaticText(
this, wxID_ANY, wxS(
"(" ) );
138 wxSize openSize = openHole->GetBestSize();
139 openHole->SetPosition( wxPoint( minPos.
xStart - openSize.GetWidth() - 2,
140 minPos.
yTop + ( fieldHeight - openSize.GetHeight() ) / 2 ) );
143 auto* dashHole =
new wxStaticText(
this, wxID_ANY, wxS(
"-" ) );
144 wxSize dashSize = dashHole->GetBestSize();
145 wxStaticText* minMmLabel = minViaHoleField->GetLabel();
146 int afterMinLabel = minMmLabel->GetPosition().x + minMmLabel->GetBestSize().GetWidth();
147 int gapMid = ( afterMinLabel + maxPos.
xStart ) / 2;
148 dashHole->SetPosition(
149 wxPoint( gapMid - dashSize.GetWidth() / 2, minPos.
yTop + ( fieldHeight - dashSize.GetHeight() ) / 2 ) );
151 auto* closeHole =
new wxStaticText(
this, wxID_ANY, wxS(
")" ) );
152 wxSize closeSize = closeHole->GetBestSize();
153 wxStaticText* mmLabel = maxViaHoleField->GetLabel();
154 int afterLabel = mmLabel->GetPosition().x + mmLabel->GetBestSize().GetWidth();
155 closeHole->SetPosition( wxPoint( afterLabel + 2, minPos.
yTop + ( fieldHeight - closeSize.GetHeight() ) / 2 ) );
158 auto notifyModified = [
this]( wxCommandEvent& )
165 auto notifySave = [
this]( wxCommandEvent& aEvent )
172 minViaDiameterField->GetControl()->Bind( wxEVT_TEXT, notifyModified );
173 maxViaDiameterField->GetControl()->Bind( wxEVT_TEXT, notifyModified );
174 minViaHoleField->GetControl()->Bind( wxEVT_TEXT, notifyModified );
175 maxViaHoleField->GetControl()->Bind( wxEVT_TEXT, notifyModified );
177 minViaDiameterField->GetControl()->Bind( wxEVT_TEXT_ENTER, notifySave );
178 maxViaDiameterField->GetControl()->Bind( wxEVT_TEXT_ENTER, notifySave );
179 minViaHoleField->GetControl()->Bind( wxEVT_TEXT_ENTER, notifySave );
180 maxViaHoleField->GetControl()->Bind( wxEVT_TEXT_ENTER, notifySave );
wxString result
Test unit parsing edge cases and error handling.