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_CONSTRAINTS *aConstraintsPanel)
 
 ~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 OnRemoveTrackWidthsClick (wxCommandEvent &event) override
 
void OnAddViaSizesClick (wxCommandEvent &event) override
 
void OnRemoveViaSizesClick (wxCommandEvent &event) override
 
void OnAddDiffPairsClick (wxCommandEvent &event) override
 
void OnRemoveDiffPairsClick (wxCommandEvent &event) override
 
void AppendTrackWidth (const int aWidth)
 
void AppendViaSize (const int aSize, const int aDrill)
 
void AppendDiffPairs (const int aWidth, const int aGap, const int aViaGap)
 

Protected Attributes

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

Private Attributes

PAGED_DIALOGm_Parent
 
PCB_EDIT_FRAMEm_Frame
 
BOARDm_Pcb
 
BOARD_DESIGN_SETTINGSm_BrdSettings
 
PANEL_SETUP_CONSTRAINTSm_ConstraintsPanel
 

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,
PANEL_SETUP_CONSTRAINTS aConstraintsPanel 
)

Definition at line 55 of file panel_setup_tracks_and_vias.cpp.

57  :
59 {
60  m_Parent = aParent;
61  m_Frame = aFrame;
62  m_Pcb = m_Frame->GetBoard();
64  m_ConstraintsPanel = aConstraintsPanel;
65 
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  m_viaSizesGrid->PushEventHandler( new GRID_TRICKS( m_viaSizesGrid ) );
81  m_diffPairsGrid->PushEventHandler( new GRID_TRICKS( m_diffPairsGrid ) );
82 
83  m_trackWidthsGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
84  m_viaSizesGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
85  m_diffPairsGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
86 
87  // Ensure width of columns is enough to enter any reasonable value
88  WX_GRID* grid_list[] = { m_trackWidthsGrid, m_viaSizesGrid, m_diffPairsGrid, nullptr };
89  int min_linesize = m_trackWidthsGrid->GetTextExtent( "000.000000 mm " ).x;
90 
91  for( int ii = 0; grid_list[ii]; ii++ )
92  {
93  WX_GRID* curr_grid = grid_list[ii];
94 
95  for( int col = 0; col < curr_grid->GetNumberCols(); col++ )
96  {
97  int min_w = curr_grid->GetVisibleWidth( col, true, true, true );
98  int best_w = std::max( min_linesize, min_w );
99  curr_grid->SetColMinimalWidth( col, best_w );
100  curr_grid->SetColSize( col,best_w );
101  }
102  }
103 }
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)
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition: grid_tricks.h:55
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=false, bool aKeep=true)
Calculates the specified column based on the actual size of the text on screen.
Definition: wx_grid.cpp:246
wxTreebook * GetTreebook()
Definition: paged_dialog.h:37
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
PANEL_SETUP_CONSTRAINTS * m_ConstraintsPanel
BOARD * GetBoard() const

References PCB_BASE_FRAME::GetBoard(), BOARD::GetDesignSettings(), WX_GRID::GetVisibleWidth(), KiBitmap(), m_BrdSettings, m_ConstraintsPanel, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsAddButton, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsRemoveButton, 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_viaSizesAddButton, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesRemoveButton, small_plus, and small_trash.

◆ ~PANEL_SETUP_TRACKS_AND_VIAS()

PANEL_SETUP_TRACKS_AND_VIAS::~PANEL_SETUP_TRACKS_AND_VIAS ( )
override

Member Function Documentation

◆ AppendDiffPairs()

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

Definition at line 306 of file panel_setup_tracks_and_vias.cpp.

308 {
309  int i = m_diffPairsGrid->GetNumberRows();
310 
311  m_diffPairsGrid->AppendRows( 1 );
312 
313  wxString val = StringFromValue( m_Frame->GetUserUnits(), aWidth );
314  m_diffPairsGrid->SetCellValue( i, DP_WIDTH_COL, val );
315 
316  if( aGap > 0 )
317  {
318  val = StringFromValue( m_Frame->GetUserUnits(), aGap );
319  m_diffPairsGrid->SetCellValue( i, DP_GAP_COL, val );
320  }
321 
322  if( aViaGap > 0 )
323  {
324  val = StringFromValue( m_Frame->GetUserUnits(), aViaGap );
325  m_diffPairsGrid->SetCellValue( i, DP_VIA_GAP_COL, val );
326  }
327 }
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:204
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References DP_GAP_COL, DP_VIA_GAP_COL, DP_WIDTH_COL, EDA_BASE_FRAME::GetUserUnits(), PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid, m_Frame, and StringFromValue().

Referenced by OnAddDiffPairsClick(), and TransferDataToWindow().

◆ AppendTrackWidth()

void PANEL_SETUP_TRACKS_AND_VIAS::AppendTrackWidth ( const int  aWidth)
protected

Definition at line 278 of file panel_setup_tracks_and_vias.cpp.

279 {
280  int i = m_trackWidthsGrid->GetNumberRows();
281 
282  m_trackWidthsGrid->AppendRows( 1 );
283 
284  wxString val = StringFromValue( m_Frame->GetUserUnits(), aWidth );
285  m_trackWidthsGrid->SetCellValue( i, TR_WIDTH_COL, val );
286 }
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:204
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References EDA_BASE_FRAME::GetUserUnits(), m_Frame, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsGrid, StringFromValue(), and TR_WIDTH_COL.

Referenced by OnAddTrackWidthsClick(), and TransferDataToWindow().

◆ AppendViaSize()

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

Definition at line 289 of file panel_setup_tracks_and_vias.cpp.

290 {
291  int i = m_viaSizesGrid->GetNumberRows();
292 
293  m_viaSizesGrid->AppendRows( 1 );
294 
295  wxString val = StringFromValue( m_Frame->GetUserUnits(), aSize );
296  m_viaSizesGrid->SetCellValue( i, VIA_SIZE_COL, val );
297 
298  if( aDrill > 0 )
299  {
300  val = StringFromValue( m_Frame->GetUserUnits(), aDrill );
301  m_viaSizesGrid->SetCellValue( i, VIA_DRILL_COL, val );
302  }
303 }
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:204
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References EDA_BASE_FRAME::GetUserUnits(), m_Frame, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid, StringFromValue(), VIA_DRILL_COL, and VIA_SIZE_COL.

Referenced by OnAddViaSizesClick(), and TransferDataToWindow().

◆ ImportSettingsFrom()

void PANEL_SETUP_TRACKS_AND_VIAS::ImportSettingsFrom ( BOARD aBoard)

Definition at line 410 of file panel_setup_tracks_and_vias.cpp.

411 {
415 
416  // Note: do not change the board, as we need to get the current nets from it for
417  // netclass memberships. All the netclass definitions and dimension lists are in
418  // the BOARD_DESIGN_SETTINGS.
419 
420  BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
421 
422  m_BrdSettings = &aBoard->GetDesignSettings();
424 
425  m_BrdSettings = savedSettings;
426 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:190
Container for design settings for a BOARD object.

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 383 of file panel_setup_tracks_and_vias.cpp.

384 {
385  AppendDiffPairs( 0, 0, 0 );
386 
387  m_diffPairsGrid->MakeCellVisible( m_diffPairsGrid->GetNumberRows() - 1, DP_WIDTH_COL );
388  m_diffPairsGrid->SetGridCursor( m_diffPairsGrid->GetNumberRows() - 1, DP_WIDTH_COL );
389 
390  m_diffPairsGrid->EnableCellEditControl( true );
391  m_diffPairsGrid->ShowCellEditControl();
392 }
void AppendDiffPairs(const int aWidth, const int aGap, const int aViaGap)

References AppendDiffPairs(), DP_WIDTH_COL, and PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid.

◆ OnAddTrackWidthsClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnAddTrackWidthsClick ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_SETUP_TRACKS_AND_VIAS_BASE.

Definition at line 329 of file panel_setup_tracks_and_vias.cpp.

330 {
331  AppendTrackWidth( 0 );
332 
333  m_trackWidthsGrid->MakeCellVisible( m_trackWidthsGrid->GetNumberRows() - 1, TR_WIDTH_COL );
334  m_trackWidthsGrid->SetGridCursor( m_trackWidthsGrid->GetNumberRows() - 1, TR_WIDTH_COL );
335 
336  m_trackWidthsGrid->EnableCellEditControl( true );
337  m_trackWidthsGrid->ShowCellEditControl();
338 }

References AppendTrackWidth(), PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsGrid, and TR_WIDTH_COL.

◆ OnAddViaSizesClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnAddViaSizesClick ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_SETUP_TRACKS_AND_VIAS_BASE.

Definition at line 356 of file panel_setup_tracks_and_vias.cpp.

357 {
358  AppendViaSize( 0, 0 );
359 
360  m_viaSizesGrid->MakeCellVisible( m_viaSizesGrid->GetNumberRows() - 1, VIA_SIZE_COL );
361  m_viaSizesGrid->SetGridCursor( m_viaSizesGrid->GetNumberRows() - 1, VIA_SIZE_COL );
362 
363  m_viaSizesGrid->EnableCellEditControl( true );
364  m_viaSizesGrid->ShowCellEditControl();
365 }
void AppendViaSize(const int aSize, const int aDrill)

References AppendViaSize(), PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid, and VIA_SIZE_COL.

◆ OnRemoveDiffPairsClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnRemoveDiffPairsClick ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_SETUP_TRACKS_AND_VIAS_BASE.

Definition at line 395 of file panel_setup_tracks_and_vias.cpp.

396 {
397  int curRow = m_diffPairsGrid->GetGridCursorRow();
398 
399  if( curRow < 0 || m_diffPairsGrid->GetNumberRows() <= curRow )
400  return;
401 
402  m_diffPairsGrid->DeleteRows( curRow, 1 );
403 
404  curRow = std::max( 0, curRow - 1 );
405  m_diffPairsGrid->MakeCellVisible( curRow, m_diffPairsGrid->GetGridCursorCol() );
406  m_diffPairsGrid->SetGridCursor( curRow, m_diffPairsGrid->GetGridCursorCol() );
407 }

References PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid.

◆ OnRemoveTrackWidthsClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnRemoveTrackWidthsClick ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_SETUP_TRACKS_AND_VIAS_BASE.

Definition at line 341 of file panel_setup_tracks_and_vias.cpp.

342 {
343  int curRow = m_trackWidthsGrid->GetGridCursorRow();
344 
345  if( curRow < 0 || m_trackWidthsGrid->GetNumberRows() <= curRow )
346  return;
347 
348  m_trackWidthsGrid->DeleteRows( curRow, 1 );
349 
350  curRow = std::max( 0, curRow - 1 );
351  m_trackWidthsGrid->MakeCellVisible( curRow, m_trackWidthsGrid->GetGridCursorCol() );
352  m_trackWidthsGrid->SetGridCursor( curRow, m_trackWidthsGrid->GetGridCursorCol() );
353 }

References PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsGrid.

◆ OnRemoveViaSizesClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnRemoveViaSizesClick ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_SETUP_TRACKS_AND_VIAS_BASE.

Definition at line 368 of file panel_setup_tracks_and_vias.cpp.

369 {
370  int curRow = m_viaSizesGrid->GetGridCursorRow();
371 
372  if( curRow < 0 || m_viaSizesGrid->GetNumberRows() <= curRow )
373  return;
374 
375  m_viaSizesGrid->DeleteRows( curRow, 1 );
376 
377  curRow = std::max( 0, curRow - 1 );
378  m_viaSizesGrid->MakeCellVisible( curRow, m_viaSizesGrid->GetGridCursorCol() );
379  m_viaSizesGrid->SetGridCursor( curRow, m_viaSizesGrid->GetGridCursorCol() );
380 }

References PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid.

◆ TransferDataFromWindow()

bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow ( )
override

Definition at line 144 of file panel_setup_tracks_and_vias.cpp.

145 {
149  {
150  return false;
151  }
152 
153  wxString msg;
154  std::vector<int> trackWidths;
155  std::vector<VIA_DIMENSION> vias;
156  std::vector<DIFF_PAIR_DIMENSION> diffPairs;
157 
161  {
162  return false;
163  }
164 
165  // Test ONLY for malformed data. Design rules and constraints are the business of DRC.
166 
167  for( int row = 0; row < m_trackWidthsGrid->GetNumberRows(); ++row )
168  {
169  msg = m_trackWidthsGrid->GetCellValue( row, TR_WIDTH_COL );
170 
171  if( !msg.IsEmpty() )
172  trackWidths.push_back( ValueFromString( m_Frame->GetUserUnits(), msg ) );
173  }
174 
175  for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row )
176  {
177  msg = m_viaSizesGrid->GetCellValue( row, VIA_SIZE_COL );
178 
179  if( !msg.IsEmpty() )
180  {
181  VIA_DIMENSION via_dim;
182  via_dim.m_Diameter = ValueFromString( m_Frame->GetUserUnits(), msg );
183 
184  msg = m_viaSizesGrid->GetCellValue( row, VIA_DRILL_COL );
185 
186  if( !msg.IsEmpty() )
187  via_dim.m_Drill = ValueFromString( m_Frame->GetUserUnits(), msg );
188 
189  vias.push_back( via_dim );
190  }
191  }
192 
193  for( int row = 0; row < m_diffPairsGrid->GetNumberRows(); ++row )
194  {
195  msg = m_diffPairsGrid->GetCellValue( row, DP_WIDTH_COL );
196 
197  if( !msg.IsEmpty() )
198  {
199  DIFF_PAIR_DIMENSION diffPair_dim;
200  diffPair_dim.m_Width = ValueFromString( m_Frame->GetUserUnits(), msg );
201 
202  msg = m_diffPairsGrid->GetCellValue( row, DP_GAP_COL );
203  diffPair_dim.m_Gap = ValueFromString( m_Frame->GetUserUnits(), msg );
204 
205  msg = m_diffPairsGrid->GetCellValue( row, DP_VIA_GAP_COL );
206 
207  if( !msg.IsEmpty() )
208  diffPair_dim.m_ViaGap = ValueFromString( m_Frame->GetUserUnits(), msg );
209 
210  diffPairs.push_back( diffPair_dim );
211  }
212  }
213 
214  // Sort lists by increasing value
215  sort( trackWidths.begin(), trackWidths.end() );
216  sort( vias.begin(), vias.end() );
217  sort( diffPairs.begin(), diffPairs.end() );
218 
219  // These are all stored in project file, not board, so no need for OnModify()
220 
221  trackWidths.insert( trackWidths.begin(), 0 ); // dummy value for "use netclass"
222  m_BrdSettings->m_TrackWidthList = trackWidths;
223 
224  vias.insert( vias.begin(), { 0, 0 } ); // dummy value for "use netclass"
226 
227  diffPairs.insert( diffPairs.begin(), { 0, 0, 0 } ); // dummy value for "use netclass"
229 
230  return true;
231 }
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
std::vector< int > m_TrackWidthList
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
Container to handle a stock of specific differential pairs each with unique track width,...
long long int ValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
Definition: base_units.cpp:416
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:190
std::vector< VIA_DIMENSION > m_ViasDimensionsList
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References WX_GRID::CommitPendingChanges(), DP_GAP_COL, DP_VIA_GAP_COL, DP_WIDTH_COL, EDA_BASE_FRAME::GetUserUnits(), m_BrdSettings, VIA_DIMENSION::m_Diameter, BOARD_DESIGN_SETTINGS::m_DiffPairDimensionsList, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid, VIA_DIMENSION::m_Drill, m_Frame, 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, ValueFromString(), VIA_DRILL_COL, and VIA_SIZE_COL.

◆ TransferDataToWindow()

bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataToWindow ( )
override

Definition at line 113 of file panel_setup_tracks_and_vias.cpp.

114 {
118 
119  // Skip the first item, which is the current netclass value
120  for( unsigned ii = 1; ii < m_BrdSettings->m_TrackWidthList.size(); ii++ )
121  {
123  }
124 
125  // Skip the first item, which is the current netclass value
126  for( unsigned ii = 1; ii < m_BrdSettings->m_ViasDimensionsList.size(); ii++ )
127  {
129  m_BrdSettings->m_ViasDimensionsList[ii].m_Drill );
130  }
131 
132  // Skip the first item, which is the current netclass value
133  for( unsigned ii = 1; ii < m_BrdSettings->m_DiffPairDimensionsList.size(); ii++ )
134  {
137  m_BrdSettings->m_DiffPairDimensionsList[ii].m_ViaGap );
138  }
139 
140  return true;
141 }
std::vector< int > m_TrackWidthList
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
void AppendViaSize(const int aSize, const int aDrill)
std::vector< VIA_DIMENSION > m_ViasDimensionsList
void ClearRows()
wxWidgets recently added an ASSERT which fires if the position is greater than or equal to the number...
Definition: wx_grid.h:106
void AppendDiffPairs(const int aWidth, const int aGap, const int aViaGap)

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().

◆ Validate()

bool PANEL_SETUP_TRACKS_AND_VIAS::Validate ( )
override

Definition at line 234 of file panel_setup_tracks_and_vias.cpp.

235 {
239  {
240  return false;
241  }
242 
243  wxString msg;
244 
245  // Test vias
246  for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row )
247  {
248  wxString viaDia = m_viaSizesGrid->GetCellValue( row, VIA_SIZE_COL );
249  wxString viaDrill = m_viaSizesGrid->GetCellValue( row, VIA_DRILL_COL );
250 
251  if( !viaDia.IsEmpty() && viaDrill.IsEmpty() )
252  {
253  msg = _( "No via hole size defined." );
254  m_Parent->SetError( msg, this, m_viaSizesGrid, row, VIA_DRILL_COL );
255  return false;
256  }
257 
258  }
259 
260  // Test diff pairs
261  for( int row = 0; row < m_diffPairsGrid->GetNumberRows(); ++row )
262  {
263  wxString dpWidth = m_diffPairsGrid->GetCellValue( row, 0 );
264  wxString dpGap = m_diffPairsGrid->GetCellValue( row, 1 );
265 
266  if( !dpWidth.IsEmpty() && dpGap.IsEmpty() )
267  {
268  msg = _( "No differential pair gap defined." );
269  m_Parent->SetError( msg, this, m_diffPairsGrid, row, 1 );
270  return false;
271  }
272  }
273 
274  return true;
275 }
void SetError(const wxString &aMessage, const wxString &aPageName, int aCtrlId, int aRow=-1, int aCol=-1)
#define _(s)
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:190

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_ConstraintsPanel

PANEL_SETUP_CONSTRAINTS* PANEL_SETUP_TRACKS_AND_VIAS::m_ConstraintsPanel
private

Definition at line 73 of file panel_setup_tracks_and_vias.h.

Referenced by PANEL_SETUP_TRACKS_AND_VIAS().

◆ 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_Frame

PCB_EDIT_FRAME* PANEL_SETUP_TRACKS_AND_VIAS::m_Frame
private

◆ 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 66 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 68 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_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

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