45 std::vector<DRC_RE_FIELD_POSITION> positions =
m_data->GetFieldPositions();
47 wxWindow* eventSource =
nullptr;
49 for( wxWindow* win = aParent; win; win = win->GetParent() )
61 wxArrayString choices;
62 choices.Add(
_(
"Any" ) );
63 choices.Add(
_(
"Through" ) );
64 choices.Add(
_(
"Micro" ) );
65 choices.Add(
_(
"Blind" ) );
66 choices.Add(
_(
"Buried" ) );
69 wxSize( viaTypePos.
xEnd - viaTypePos.
xStart, -1 ), choices );
76 wxPoint( viaTypePos.
xStart - labelSize.GetWidth() - 4,
77 viaTypePos.
yTop + (
m_viaTypeChoice->GetBestSize().GetHeight() - labelSize.GetHeight() ) / 2 ) );
80 auto* minViaDiameterField =
81 AddField<wxTextCtrl>( wxS(
"min_via_diameter" ), positions[0], wxTE_PROCESS_ENTER | wxTE_CENTRE );
83 std::make_unique<UNIT_BINDER>( &
m_unitsProvider, eventSource,
nullptr, minViaDiameterField->GetControl(),
84 minViaDiameterField->GetLabel(),
false,
false );
87 auto* maxViaDiameterField =
88 AddField<wxTextCtrl>( wxS(
"max_via_diameter" ), positions[1], wxTE_PROCESS_ENTER | wxTE_CENTRE );
90 std::make_unique<UNIT_BINDER>( &
m_unitsProvider, eventSource,
nullptr, maxViaDiameterField->GetControl(),
91 maxViaDiameterField->GetLabel(),
false,
false );
95 auto* minViaHoleField =
98 std::make_unique<UNIT_BINDER>( &
m_unitsProvider, eventSource,
nullptr, minViaHoleField->GetControl(),
99 minViaHoleField->GetLabel(),
false,
false );
102 auto* maxViaHoleField =
105 std::make_unique<UNIT_BINDER>( &
m_unitsProvider, eventSource,
nullptr, maxViaHoleField->GetControl(),
106 maxViaHoleField->GetLabel(),
false,
false );
113 int fieldHeight = minViaDiameterField->GetControl()->GetBestSize().GetHeight();
115 auto* openDia =
new wxStaticText(
this, wxID_ANY, wxS(
"(" ) );
116 wxSize openSize = openDia->GetBestSize();
117 openDia->SetPosition( wxPoint( minPos.
xStart - openSize.GetWidth() - 2,
118 minPos.
yTop + ( fieldHeight - openSize.GetHeight() ) / 2 ) );
120 auto* dashDia =
new wxStaticText(
this, wxID_ANY, wxS(
"-" ) );
121 wxSize dashSize = dashDia->GetBestSize();
122 wxStaticText* minMmLabel = minViaDiameterField->GetLabel();
123 int afterMinLabel = minMmLabel->GetPosition().x + minMmLabel->GetBestSize().GetWidth();
124 int gapMid = ( afterMinLabel + maxPos.
xStart ) / 2;
125 dashDia->SetPosition(
126 wxPoint( gapMid - dashSize.GetWidth() / 2, minPos.
yTop + ( fieldHeight - dashSize.GetHeight() ) / 2 ) );
128 auto* closeDia =
new wxStaticText(
this, wxID_ANY, wxS(
")" ) );
129 wxSize closeSize = closeDia->GetBestSize();
130 wxStaticText* mmLabel = maxViaDiameterField->GetLabel();
131 int afterLabel = mmLabel->GetPosition().x + mmLabel->GetBestSize().GetWidth();
132 closeDia->SetPosition( wxPoint( afterLabel + 2, minPos.
yTop + ( fieldHeight - closeSize.GetHeight() ) / 2 ) );
139 int fieldHeight = minViaHoleField->GetControl()->GetBestSize().GetHeight();
141 auto* openHole =
new wxStaticText(
this, wxID_ANY, wxS(
"(" ) );
142 wxSize openSize = openHole->GetBestSize();
143 openHole->SetPosition( wxPoint( minPos.
xStart - openSize.GetWidth() - 2,
144 minPos.
yTop + ( fieldHeight - openSize.GetHeight() ) / 2 ) );
147 auto* dashHole =
new wxStaticText(
this, wxID_ANY, wxS(
"-" ) );
148 wxSize dashSize = dashHole->GetBestSize();
149 wxStaticText* minMmLabel = minViaHoleField->GetLabel();
150 int afterMinLabel = minMmLabel->GetPosition().x + minMmLabel->GetBestSize().GetWidth();
151 int gapMid = ( afterMinLabel + maxPos.
xStart ) / 2;
152 dashHole->SetPosition(
153 wxPoint( gapMid - dashSize.GetWidth() / 2, minPos.
yTop + ( fieldHeight - dashSize.GetHeight() ) / 2 ) );
155 auto* closeHole =
new wxStaticText(
this, wxID_ANY, wxS(
")" ) );
156 wxSize closeSize = closeHole->GetBestSize();
157 wxStaticText* mmLabel = maxViaHoleField->GetLabel();
158 int afterLabel = mmLabel->GetPosition().x + mmLabel->GetBestSize().GetWidth();
159 closeHole->SetPosition( wxPoint( afterLabel + 2, minPos.
yTop + ( fieldHeight - closeSize.GetHeight() ) / 2 ) );
162 auto notifyModified = [
this]( wxCommandEvent& )
169 auto notifySave = [
this]( wxCommandEvent& aEvent )
176 minViaDiameterField->GetControl()->Bind( wxEVT_TEXT, notifyModified );
177 maxViaDiameterField->GetControl()->Bind( wxEVT_TEXT, notifyModified );
178 minViaHoleField->GetControl()->Bind( wxEVT_TEXT, notifyModified );
179 maxViaHoleField->GetControl()->Bind( wxEVT_TEXT, notifyModified );
181 minViaDiameterField->GetControl()->Bind( wxEVT_TEXT_ENTER, notifySave );
182 maxViaDiameterField->GetControl()->Bind( wxEVT_TEXT_ENTER, notifySave );
183 minViaHoleField->GetControl()->Bind( wxEVT_TEXT_ENTER, notifySave );
184 maxViaHoleField->GetControl()->Bind( wxEVT_TEXT_ENTER, notifySave );
wxString result
Test unit parsing edge cases and error handling.