KiCad PCB EDA Suite
PANEL_SETUP_TRACKS_AND_VIAS Class Reference

#include <panel_setup_tracks_and_vias.h>

Inheritance diagram for PANEL_SETUP_TRACKS_AND_VIAS:
PANEL_SETUP_TRACKS_AND_VIAS_BASE

Public Member Functions

 PANEL_SETUP_TRACKS_AND_VIAS (PAGED_DIALOG *aParent, PCB_EDIT_FRAME *aFrame)
 
 ~PANEL_SETUP_TRACKS_AND_VIAS () override
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
bool Validate () override
 
void ImportSettingsFrom (BOARD *aBoard)
 

Protected Member Functions

void OnAddTrackWidthsClick (wxCommandEvent &event) override
 
void OnSortTrackWidthsClick (wxCommandEvent &event) override
 
void OnRemoveTrackWidthsClick (wxCommandEvent &event) override
 
void OnAddViaSizesClick (wxCommandEvent &event) override
 
void OnSortViaSizesClick (wxCommandEvent &event) override
 
void OnRemoveViaSizesClick (wxCommandEvent &event) override
 
void OnAddDiffPairsClick (wxCommandEvent &event) override
 
void OnSortDiffPairsClick (wxCommandEvent &event) override
 
void OnRemoveDiffPairsClick (wxCommandEvent &event) override
 
void onUnitsChanged (wxCommandEvent &aEvent)
 
void AppendTrackWidth (int aWidth)
 
void AppendViaSize (int aSize, int aDrill)
 
void AppendDiffPairs (int aWidth, int aGap, int aViaGap)
 

Protected Attributes

wxStaticText * m_label
 
WX_GRIDm_trackWidthsGrid
 
wxBitmapButton * m_trackWidthsAddButton
 
wxBitmapButton * m_trackWidthsSortButton
 
wxBitmapButton * m_trackWidthsRemoveButton
 
WX_GRIDm_viaSizesGrid
 
wxBitmapButton * m_viaSizesAddButton
 
wxBitmapButton * m_viaSizesSortButton
 
wxBitmapButton * m_viaSizesRemoveButton
 
WX_GRIDm_diffPairsGrid
 
wxBitmapButton * m_diffPairsAddButton
 
wxBitmapButton * m_diffPairsSortButton
 
wxBitmapButton * m_diffPairsRemoveButton
 

Private Attributes

PAGED_DIALOGm_Parent
 
PCB_EDIT_FRAMEm_Frame
 
BOARDm_Pcb
 
BOARD_DESIGN_SETTINGSm_BrdSettings
 

Detailed Description

Definition at line 39 of file panel_setup_tracks_and_vias.h.

Constructor & Destructor Documentation

◆ PANEL_SETUP_TRACKS_AND_VIAS()

PANEL_SETUP_TRACKS_AND_VIAS::PANEL_SETUP_TRACKS_AND_VIAS ( PAGED_DIALOG aParent,
PCB_EDIT_FRAME aFrame 
)

Definition at line 54 of file panel_setup_tracks_and_vias.cpp.

55 :
57{
58 m_Parent = aParent;
59 m_Frame = aFrame;
62
72
73 // Membership combobox editors require a bit more room, so increase the row size of
74 // all our grids for consistency
75 m_trackWidthsGrid->SetDefaultRowSize( m_trackWidthsGrid->GetDefaultRowSize() + 4 );
76 m_viaSizesGrid->SetDefaultRowSize( m_viaSizesGrid->GetDefaultRowSize() + 4 );
77 m_diffPairsGrid->SetDefaultRowSize( m_diffPairsGrid->GetDefaultRowSize() + 4 );
78
79 m_trackWidthsGrid->PushEventHandler( new GRID_TRICKS( m_trackWidthsGrid,
80 [this]( wxCommandEvent& aEvent )
81 {
82 OnAddTrackWidthsClick( aEvent );
83 } ) );
84 m_viaSizesGrid->PushEventHandler( new GRID_TRICKS( m_viaSizesGrid,
85 [this]( wxCommandEvent& aEvent )
86 {
87 OnAddViaSizesClick( aEvent );
88 } ) );
89 m_diffPairsGrid->PushEventHandler( new GRID_TRICKS( m_diffPairsGrid,
90 [this]( wxCommandEvent& aEvent )
91 {
92 OnAddDiffPairsClick( aEvent );
93 } ) );
94
95 m_trackWidthsGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
96 m_viaSizesGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
97 m_diffPairsGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
98
102
104 m_viaSizesGrid->SetAutoEvalCols( { 0, 1 } );
105 m_diffPairsGrid->SetAutoEvalCols( { 0, 1, 2 } );
106
107 // Ensure width of columns is enough to enter any reasonable value
108 WX_GRID* grid_list[] = { m_trackWidthsGrid, m_viaSizesGrid, m_diffPairsGrid, nullptr };
109 int min_linesize = m_trackWidthsGrid->GetTextExtent( wxT( "000.000000 mm " ) ).x;
110
111 for( int ii = 0; grid_list[ii]; ii++ )
112 {
113 WX_GRID* curr_grid = grid_list[ii];
114
115 for( int col = 0; col < curr_grid->GetNumberCols(); col++ )
116 {
117 int min_w = curr_grid->GetVisibleWidth( col, true, true, true );
118 int best_w = std::max( min_linesize, min_w );
119 curr_grid->SetColMinimalWidth( col, best_w );
120 curr_grid->SetColSize( col,best_w );
121 }
122 }
123
124 m_Frame->Bind( UNITS_CHANGED, &PANEL_SETUP_TRACKS_AND_VIAS::onUnitsChanged, this );
125}
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
@ small_sort_desc
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:628
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition: grid_tricks.h:61
wxTreebook * GetTreebook()
Definition: paged_dialog.h:37
PANEL_SETUP_TRACKS_AND_VIAS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(674, 343), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
void onUnitsChanged(wxCommandEvent &aEvent)
void OnAddViaSizesClick(wxCommandEvent &event) override
void OnAddDiffPairsClick(wxCommandEvent &event) override
void OnAddTrackWidthsClick(wxCommandEvent &event) override
BOARD * GetBoard() const
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=true, bool aKeep=false)
Calculates the specified column based on the actual size of the text on screen.
Definition: wx_grid.cpp:377
void SetAutoEvalCols(const std::vector< int > &aCols)
Definition: wx_grid.h:90
void SetUnitsProvider(UNITS_PROVIDER *aProvider, int aCol=0)
Set a UNITS_PROVIDER to enable use of unit- and eval-based Getters.
Definition: wx_grid.cpp:329

References PCB_BASE_FRAME::GetBoard(), BOARD::GetDesignSettings(), WX_GRID::GetVisibleWidth(), KiBitmap(), m_BrdSettings, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsAddButton, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsRemoveButton, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsSortButton, m_Frame, m_Parent, m_Pcb, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsAddButton, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsGrid, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsRemoveButton, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsSortButton, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesAddButton, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesRemoveButton, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesSortButton, OnAddDiffPairsClick(), OnAddTrackWidthsClick(), OnAddViaSizesClick(), onUnitsChanged(), WX_GRID::SetAutoEvalCols(), WX_GRID::SetUnitsProvider(), small_plus, small_sort_desc, and small_trash.

◆ ~PANEL_SETUP_TRACKS_AND_VIAS()

PANEL_SETUP_TRACKS_AND_VIAS::~PANEL_SETUP_TRACKS_AND_VIAS ( )
override

Definition at line 128 of file panel_setup_tracks_and_vias.cpp.

129{
130 // Delete the GRID_TRICKS.
131 m_trackWidthsGrid->PopEventHandler( true );
132 m_viaSizesGrid->PopEventHandler( true );
133 m_diffPairsGrid->PopEventHandler( true );
134
135 m_Frame->Unbind( UNITS_CHANGED, &PANEL_SETUP_TRACKS_AND_VIAS::onUnitsChanged, this );
136}

References PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid, m_Frame, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsGrid, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid, and onUnitsChanged().

Member Function Documentation

◆ AppendDiffPairs()

void PANEL_SETUP_TRACKS_AND_VIAS::AppendDiffPairs ( int  aWidth,
int  aGap,
int  aViaGap 
)
protected

Definition at line 417 of file panel_setup_tracks_and_vias.cpp.

418{
419 int i = m_diffPairsGrid->GetNumberRows();
420
421 m_diffPairsGrid->AppendRows( 1 );
422
424
425 if( aGap > 0 )
427
428 if( aViaGap > 0 )
430}
void SetUnitValue(int aRow, int aCol, int aValue)
Set a unitized cell's value.
Definition: wx_grid.cpp:359

References DP_GAP_COL, DP_VIA_GAP_COL, DP_WIDTH_COL, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid, and WX_GRID::SetUnitValue().

Referenced by OnAddDiffPairsClick(), OnSortDiffPairsClick(), and TransferDataToWindow().

◆ AppendTrackWidth()

void PANEL_SETUP_TRACKS_AND_VIAS::AppendTrackWidth ( int  aWidth)
protected

◆ AppendViaSize()

void PANEL_SETUP_TRACKS_AND_VIAS::AppendViaSize ( int  aSize,
int  aDrill 
)
protected

Definition at line 404 of file panel_setup_tracks_and_vias.cpp.

405{
406 int i = m_viaSizesGrid->GetNumberRows();
407
408 m_viaSizesGrid->AppendRows( 1 );
409
411
412 if( aDrill > 0 )
414}

References PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid, WX_GRID::SetUnitValue(), VIA_DRILL_COL, and VIA_SIZE_COL.

Referenced by OnAddViaSizesClick(), OnSortViaSizesClick(), and TransferDataToWindow().

◆ ImportSettingsFrom()

void PANEL_SETUP_TRACKS_AND_VIAS::ImportSettingsFrom ( BOARD aBoard)

Definition at line 550 of file panel_setup_tracks_and_vias.cpp.

551{
555
556 // Note: do not change the board, as we need to get the current nets from it for
557 // netclass memberships. All the netclass definitions and dimension lists are in
558 // the BOARD_DESIGN_SETTINGS.
559
560 BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
561
562 m_BrdSettings = &aBoard->GetDesignSettings();
564
565 m_BrdSettings = savedSettings;
566}
Container for design settings for a BOARD object.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:280

References WX_GRID::CommitPendingChanges(), BOARD::GetDesignSettings(), m_BrdSettings, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsGrid, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid, and TransferDataToWindow().

Referenced by DIALOG_BOARD_SETUP::onAuxiliaryAction().

◆ OnAddDiffPairsClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnAddDiffPairsClick ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_SETUP_TRACKS_AND_VIAS_BASE.

Definition at line 518 of file panel_setup_tracks_and_vias.cpp.

519{
523 {
524 return;
525 }
526
527 AppendDiffPairs( 0, 0, 0 );
528
529 m_diffPairsGrid->MakeCellVisible( m_diffPairsGrid->GetNumberRows() - 1, DP_WIDTH_COL );
530 m_diffPairsGrid->SetGridCursor( m_diffPairsGrid->GetNumberRows() - 1, DP_WIDTH_COL );
531
532 m_diffPairsGrid->EnableCellEditControl( true );
533 m_diffPairsGrid->ShowCellEditControl();
534}
void AppendDiffPairs(int aWidth, int aGap, int aViaGap)

References AppendDiffPairs(), WX_GRID::CommitPendingChanges(), DP_WIDTH_COL, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsGrid, and PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid.

Referenced by PANEL_SETUP_TRACKS_AND_VIAS().

◆ OnAddTrackWidthsClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnAddTrackWidthsClick ( wxCommandEvent &  event)
overrideprotectedvirtual

◆ OnAddViaSizesClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnAddViaSizesClick ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_SETUP_TRACKS_AND_VIAS_BASE.

Definition at line 486 of file panel_setup_tracks_and_vias.cpp.

487{
491 {
492 return;
493 }
494
495 AppendViaSize( 0, 0 );
496
497 m_viaSizesGrid->MakeCellVisible( m_viaSizesGrid->GetNumberRows() - 1, VIA_SIZE_COL );
498 m_viaSizesGrid->SetGridCursor( m_viaSizesGrid->GetNumberRows() - 1, VIA_SIZE_COL );
499
500 m_viaSizesGrid->EnableCellEditControl( true );
501 m_viaSizesGrid->ShowCellEditControl();
502}
void AppendViaSize(int aSize, int aDrill)

References AppendViaSize(), WX_GRID::CommitPendingChanges(), PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsGrid, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid, and VIA_SIZE_COL.

Referenced by PANEL_SETUP_TRACKS_AND_VIAS().

◆ OnRemoveDiffPairsClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnRemoveDiffPairsClick ( wxCommandEvent &  event)
overrideprotectedvirtual

◆ OnRemoveTrackWidthsClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnRemoveTrackWidthsClick ( wxCommandEvent &  event)
overrideprotectedvirtual

◆ OnRemoveViaSizesClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnRemoveViaSizesClick ( wxCommandEvent &  event)
overrideprotectedvirtual

◆ OnSortDiffPairsClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnSortDiffPairsClick ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_SETUP_TRACKS_AND_VIAS_BASE.

Definition at line 195 of file panel_setup_tracks_and_vias.cpp.

196{
197 wxString msg;
198 std::vector<DIFF_PAIR_DIMENSION> diffPairs;
199
200 wxGridUpdateLocker lock( m_diffPairsGrid );
201
202 for( int row = 0; row < m_diffPairsGrid->GetNumberRows(); ++row )
203 {
204 msg = m_diffPairsGrid->GetCellValue( row, DP_WIDTH_COL );
205
206 if( !msg.IsEmpty() )
207 {
208 DIFF_PAIR_DIMENSION diffPair_dim;
209 diffPair_dim.m_Width = m_Frame->ValueFromString( msg );
210
211 msg = m_diffPairsGrid->GetCellValue( row, DP_GAP_COL );
212 diffPair_dim.m_Gap = m_Frame->ValueFromString( msg );
213
214 msg = m_diffPairsGrid->GetCellValue( row, DP_VIA_GAP_COL );
215
216 if( !msg.IsEmpty() )
217 diffPair_dim.m_ViaGap = m_Frame->ValueFromString( msg );
218
219 diffPairs.push_back( diffPair_dim );
220 }
221 }
222
223 std::sort( diffPairs.begin(), diffPairs.end() );
224 m_diffPairsGrid->DeleteRows(0, m_diffPairsGrid->GetNumberRows(), false );
225
226 for( const DIFF_PAIR_DIMENSION& dp : diffPairs )
227 AppendDiffPairs( dp.m_Width, dp.m_Gap, dp.m_ViaGap );
228}
int ValueFromString(const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Converts aTextValue in aUnits to internal units used by the frame.
Container to handle a stock of specific differential pairs each with unique track width,...

References AppendDiffPairs(), DP_GAP_COL, DP_VIA_GAP_COL, DP_WIDTH_COL, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid, m_Frame, DIFF_PAIR_DIMENSION::m_Gap, DIFF_PAIR_DIMENSION::m_ViaGap, DIFF_PAIR_DIMENSION::m_Width, and UNITS_PROVIDER::ValueFromString().

◆ OnSortTrackWidthsClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnSortTrackWidthsClick ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_SETUP_TRACKS_AND_VIAS_BASE.

Definition at line 139 of file panel_setup_tracks_and_vias.cpp.

140{
141 std::vector<int> trackWidths;
142 wxString msg;
143
144 wxGridUpdateLocker lock( m_trackWidthsGrid );
145
146 for( int row = 0; row < m_trackWidthsGrid->GetNumberRows(); ++row )
147 {
148 msg = m_trackWidthsGrid->GetCellValue( row, TR_WIDTH_COL );
149
150 if( !msg.IsEmpty() )
151 trackWidths.push_back( m_Frame->ValueFromString( msg ) );
152 }
153
154 std::sort( trackWidths.begin(), trackWidths.end() );
155 m_trackWidthsGrid->DeleteRows(0, m_trackWidthsGrid->GetNumberRows(), false);
156
157 for( int width : trackWidths )
158 AppendTrackWidth( width );
159}

References AppendTrackWidth(), m_Frame, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsGrid, TR_WIDTH_COL, and UNITS_PROVIDER::ValueFromString().

◆ OnSortViaSizesClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnSortViaSizesClick ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_SETUP_TRACKS_AND_VIAS_BASE.

Definition at line 162 of file panel_setup_tracks_and_vias.cpp.

163{
164 std::vector<VIA_DIMENSION> vias;
165 wxString msg;
166
167 wxGridUpdateLocker lock( m_viaSizesGrid );
168
169 for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row )
170 {
171 msg = m_viaSizesGrid->GetCellValue( row, VIA_SIZE_COL );
172
173 if( !msg.IsEmpty() )
174 {
175 VIA_DIMENSION via_dim;
176 via_dim.m_Diameter = m_Frame->ValueFromString( msg );
177
178 msg = m_viaSizesGrid->GetCellValue( row, VIA_DRILL_COL );
179
180 if( !msg.IsEmpty() )
181 via_dim.m_Drill = m_Frame->ValueFromString( msg );
182
183 vias.push_back( via_dim );
184 }
185 }
186
187 std::sort( vias.begin(), vias.end() );
188 m_viaSizesGrid->DeleteRows(0, m_viaSizesGrid->GetNumberRows(), false );
189
190 for( const VIA_DIMENSION& via : vias )
191 AppendViaSize( via.m_Diameter, via.m_Drill );
192}
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...

References AppendViaSize(), VIA_DIMENSION::m_Diameter, VIA_DIMENSION::m_Drill, m_Frame, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid, UNITS_PROVIDER::ValueFromString(), via, VIA_DRILL_COL, and VIA_SIZE_COL.

◆ onUnitsChanged()

void PANEL_SETUP_TRACKS_AND_VIAS::onUnitsChanged ( wxCommandEvent &  aEvent)
protected

Definition at line 231 of file panel_setup_tracks_and_vias.cpp.

232{
233 BOARD_DESIGN_SETTINGS tempBDS( nullptr, "dummy" );
235
236 m_BrdSettings = &tempBDS; // No, address of stack var does not escape function
237
240
241 m_BrdSettings = saveBDS;
242
243 aEvent.Skip();
244}

References m_BrdSettings, TransferDataFromWindow(), and TransferDataToWindow().

Referenced by PANEL_SETUP_TRACKS_AND_VIAS(), and ~PANEL_SETUP_TRACKS_AND_VIAS().

◆ TransferDataFromWindow()

bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow ( )
override

Definition at line 278 of file panel_setup_tracks_and_vias.cpp.

279{
283 {
284 return false;
285 }
286
287 wxString msg;
288 std::vector<int> trackWidths;
289 std::vector<VIA_DIMENSION> vias;
290 std::vector<DIFF_PAIR_DIMENSION> diffPairs;
291
292 // Test ONLY for malformed data. Design rules and constraints are the business of DRC.
293
294 for( int row = 0; row < m_trackWidthsGrid->GetNumberRows(); ++row )
295 {
296 if( !m_trackWidthsGrid->GetCellValue( row, TR_WIDTH_COL ).IsEmpty() )
297 trackWidths.push_back( m_trackWidthsGrid->GetUnitValue( row, TR_WIDTH_COL ) );
298 }
299
300 for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row )
301 {
302 if( !m_viaSizesGrid->GetCellValue( row, VIA_SIZE_COL ).IsEmpty() )
303 {
304 VIA_DIMENSION via_dim;
306
307 if( !m_viaSizesGrid->GetCellValue( row, VIA_DRILL_COL ).IsEmpty() )
309
310 vias.push_back( via_dim );
311 }
312 }
313
314 for( int row = 0; row < m_diffPairsGrid->GetNumberRows(); ++row )
315 {
316 if( !m_diffPairsGrid->GetCellValue( row, DP_WIDTH_COL ).IsEmpty() )
317 {
318 DIFF_PAIR_DIMENSION diffPair_dim;
319 diffPair_dim.m_Width = m_diffPairsGrid->GetUnitValue( row, DP_WIDTH_COL );
320
321 if( !m_diffPairsGrid->GetCellValue( row, DP_GAP_COL ).IsEmpty() )
322 diffPair_dim.m_Gap = m_diffPairsGrid->GetUnitValue( row, DP_GAP_COL );
323
324 if( !m_diffPairsGrid->GetCellValue( row, DP_VIA_GAP_COL ).IsEmpty() )
325 diffPair_dim.m_ViaGap = m_diffPairsGrid->GetUnitValue( row, DP_VIA_GAP_COL );
326
327 diffPairs.push_back( diffPair_dim );
328 }
329 }
330
331 // Sort lists by increasing value
332 sort( trackWidths.begin(), trackWidths.end() );
333 sort( vias.begin(), vias.end() );
334 sort( diffPairs.begin(), diffPairs.end() );
335
336 // These are all stored in project file, not board, so no need for OnModify()
337
338 trackWidths.insert( trackWidths.begin(), 0 ); // dummy value for "use netclass"
339 m_BrdSettings->m_TrackWidthList = trackWidths;
340
341 vias.insert( vias.begin(), { 0, 0 } ); // dummy value for "use netclass"
343
344 diffPairs.insert( diffPairs.begin(), { 0, 0, 0 } ); // dummy value for "use netclass"
346
347 return true;
348}
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
std::vector< int > m_TrackWidthList
std::vector< VIA_DIMENSION > m_ViasDimensionsList
int GetUnitValue(int aRow, int aCol)
Apply standard KiCad unit and eval services to a numeric cell.
Definition: wx_grid.cpp:338

References WX_GRID::CommitPendingChanges(), DP_GAP_COL, DP_VIA_GAP_COL, DP_WIDTH_COL, WX_GRID::GetUnitValue(), m_BrdSettings, VIA_DIMENSION::m_Diameter, BOARD_DESIGN_SETTINGS::m_DiffPairDimensionsList, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid, VIA_DIMENSION::m_Drill, DIFF_PAIR_DIMENSION::m_Gap, BOARD_DESIGN_SETTINGS::m_TrackWidthList, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsGrid, DIFF_PAIR_DIMENSION::m_ViaGap, BOARD_DESIGN_SETTINGS::m_ViasDimensionsList, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid, DIFF_PAIR_DIMENSION::m_Width, TR_WIDTH_COL, VIA_DRILL_COL, and VIA_SIZE_COL.

Referenced by onUnitsChanged().

◆ TransferDataToWindow()

bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataToWindow ( )
override

Definition at line 247 of file panel_setup_tracks_and_vias.cpp.

248{
252
253 // Skip the first item, which is the current netclass value
254 for( unsigned ii = 1; ii < m_BrdSettings->m_TrackWidthList.size(); ii++ )
255 {
257 }
258
259 // Skip the first item, which is the current netclass value
260 for( unsigned ii = 1; ii < m_BrdSettings->m_ViasDimensionsList.size(); ii++ )
261 {
263 m_BrdSettings->m_ViasDimensionsList[ii].m_Drill );
264 }
265
266 // Skip the first item, which is the current netclass value
267 for( unsigned ii = 1; ii < m_BrdSettings->m_DiffPairDimensionsList.size(); ii++ )
268 {
272 }
273
274 return true;
275}
void ClearRows()
wxWidgets recently added an ASSERT which fires if the position is greater than or equal to the number...
Definition: wx_grid.h:133

References AppendDiffPairs(), AppendTrackWidth(), AppendViaSize(), WX_GRID::ClearRows(), m_BrdSettings, BOARD_DESIGN_SETTINGS::m_DiffPairDimensionsList, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid, BOARD_DESIGN_SETTINGS::m_TrackWidthList, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsGrid, BOARD_DESIGN_SETTINGS::m_ViasDimensionsList, and PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid.

Referenced by ImportSettingsFrom(), and onUnitsChanged().

◆ Validate()

bool PANEL_SETUP_TRACKS_AND_VIAS::Validate ( )
override

Definition at line 351 of file panel_setup_tracks_and_vias.cpp.

352{
356 {
357 return false;
358 }
359
360 wxString msg;
361
362 // Test vias
363 for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row )
364 {
365 wxString viaDia = m_viaSizesGrid->GetCellValue( row, VIA_SIZE_COL );
366 wxString viaDrill = m_viaSizesGrid->GetCellValue( row, VIA_DRILL_COL );
367
368 if( !viaDia.IsEmpty() && viaDrill.IsEmpty() )
369 {
370 msg = _( "No via hole size defined." );
371 m_Parent->SetError( msg, this, m_viaSizesGrid, row, VIA_DRILL_COL );
372 return false;
373 }
374 }
375
376 // Test diff pairs
377 for( int row = 0; row < m_diffPairsGrid->GetNumberRows(); ++row )
378 {
379 wxString dpWidth = m_diffPairsGrid->GetCellValue( row, 0 );
380 wxString dpGap = m_diffPairsGrid->GetCellValue( row, 1 );
381
382 if( !dpWidth.IsEmpty() && dpGap.IsEmpty() )
383 {
384 msg = _( "No differential pair gap defined." );
385 m_Parent->SetError( msg, this, m_diffPairsGrid, row, 1 );
386 return false;
387 }
388 }
389
390 return true;
391}
void SetError(const wxString &aMessage, const wxString &aPageName, int aCtrlId, int aRow=-1, int aCol=-1)
#define _(s)

References _, WX_GRID::CommitPendingChanges(), PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid, m_Parent, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsGrid, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid, PAGED_DIALOG::SetError(), VIA_DRILL_COL, and VIA_SIZE_COL.

Member Data Documentation

◆ m_BrdSettings

BOARD_DESIGN_SETTINGS* PANEL_SETUP_TRACKS_AND_VIAS::m_BrdSettings
private

◆ m_diffPairsAddButton

wxBitmapButton* PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsAddButton
protectedinherited

◆ m_diffPairsGrid

◆ m_diffPairsRemoveButton

wxBitmapButton* PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsRemoveButton
protectedinherited

◆ m_diffPairsSortButton

wxBitmapButton* PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsSortButton
protectedinherited

◆ m_Frame

◆ m_label

wxStaticText* PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_label
protectedinherited

◆ m_Parent

PAGED_DIALOG* PANEL_SETUP_TRACKS_AND_VIAS::m_Parent
private

Definition at line 70 of file panel_setup_tracks_and_vias.h.

Referenced by PANEL_SETUP_TRACKS_AND_VIAS(), and Validate().

◆ m_Pcb

BOARD* PANEL_SETUP_TRACKS_AND_VIAS::m_Pcb
private

Definition at line 72 of file panel_setup_tracks_and_vias.h.

Referenced by PANEL_SETUP_TRACKS_AND_VIAS().

◆ m_trackWidthsAddButton

wxBitmapButton* PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsAddButton
protectedinherited

◆ m_trackWidthsGrid

◆ m_trackWidthsRemoveButton

wxBitmapButton* PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsRemoveButton
protectedinherited

◆ m_trackWidthsSortButton

wxBitmapButton* PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsSortButton
protectedinherited

◆ m_viaSizesAddButton

wxBitmapButton* PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesAddButton
protectedinherited

◆ m_viaSizesGrid

◆ m_viaSizesRemoveButton

wxBitmapButton* PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesRemoveButton
protectedinherited

◆ m_viaSizesSortButton

wxBitmapButton* PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesSortButton
protectedinherited

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