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 onUnitsChanged (wxCommandEvent &aEvent)
 
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( wxT( "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 
104  m_Frame->Bind( UNITS_CHANGED, &PANEL_SETUP_TRACKS_AND_VIAS::onUnitsChanged, this );
105 }
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
void onUnitsChanged(wxCommandEvent &aEvent)
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:282
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, onUnitsChanged(), 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 328 of file panel_setup_tracks_and_vias.cpp.

330 {
331  int i = m_diffPairsGrid->GetNumberRows();
332 
333  m_diffPairsGrid->AppendRows( 1 );
334 
335  wxString val = StringFromValue( m_Frame->GetUserUnits(), aWidth, true );
336  m_diffPairsGrid->SetCellValue( i, DP_WIDTH_COL, val );
337 
338  if( aGap > 0 )
339  {
340  val = StringFromValue( m_Frame->GetUserUnits(), aGap, true );
341  m_diffPairsGrid->SetCellValue( i, DP_GAP_COL, val );
342  }
343 
344  if( aViaGap > 0 )
345  {
346  val = StringFromValue( m_Frame->GetUserUnits(), aViaGap, true );
347  m_diffPairsGrid->SetCellValue( i, DP_VIA_GAP_COL, val );
348  }
349 }
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 300 of file panel_setup_tracks_and_vias.cpp.

301 {
302  int i = m_trackWidthsGrid->GetNumberRows();
303 
304  m_trackWidthsGrid->AppendRows( 1 );
305 
306  wxString val = StringFromValue( m_Frame->GetUserUnits(), aWidth, true );
307  m_trackWidthsGrid->SetCellValue( i, TR_WIDTH_COL, val );
308 }
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 311 of file panel_setup_tracks_and_vias.cpp.

312 {
313  int i = m_viaSizesGrid->GetNumberRows();
314 
315  m_viaSizesGrid->AppendRows( 1 );
316 
317  wxString val = StringFromValue( m_Frame->GetUserUnits(), aSize, true );
318  m_viaSizesGrid->SetCellValue( i, VIA_SIZE_COL, val );
319 
320  if( aDrill > 0 )
321  {
322  val = StringFromValue( m_Frame->GetUserUnits(), aDrill, true );
323  m_viaSizesGrid->SetCellValue( i, VIA_DRILL_COL, val );
324  }
325 }
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 432 of file panel_setup_tracks_and_vias.cpp.

433 {
437 
438  // Note: do not change the board, as we need to get the current nets from it for
439  // netclass memberships. All the netclass definitions and dimension lists are in
440  // the BOARD_DESIGN_SETTINGS.
441 
442  BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
443 
444  m_BrdSettings = &aBoard->GetDesignSettings();
446 
447  m_BrdSettings = savedSettings;
448 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:226
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 405 of file panel_setup_tracks_and_vias.cpp.

406 {
407  AppendDiffPairs( 0, 0, 0 );
408 
409  m_diffPairsGrid->MakeCellVisible( m_diffPairsGrid->GetNumberRows() - 1, DP_WIDTH_COL );
410  m_diffPairsGrid->SetGridCursor( m_diffPairsGrid->GetNumberRows() - 1, DP_WIDTH_COL );
411 
412  m_diffPairsGrid->EnableCellEditControl( true );
413  m_diffPairsGrid->ShowCellEditControl();
414 }
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 351 of file panel_setup_tracks_and_vias.cpp.

352 {
353  AppendTrackWidth( 0 );
354 
355  m_trackWidthsGrid->MakeCellVisible( m_trackWidthsGrid->GetNumberRows() - 1, TR_WIDTH_COL );
356  m_trackWidthsGrid->SetGridCursor( m_trackWidthsGrid->GetNumberRows() - 1, TR_WIDTH_COL );
357 
358  m_trackWidthsGrid->EnableCellEditControl( true );
359  m_trackWidthsGrid->ShowCellEditControl();
360 }

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

379 {
380  AppendViaSize( 0, 0 );
381 
382  m_viaSizesGrid->MakeCellVisible( m_viaSizesGrid->GetNumberRows() - 1, VIA_SIZE_COL );
383  m_viaSizesGrid->SetGridCursor( m_viaSizesGrid->GetNumberRows() - 1, VIA_SIZE_COL );
384 
385  m_viaSizesGrid->EnableCellEditControl( true );
386  m_viaSizesGrid->ShowCellEditControl();
387 }
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 417 of file panel_setup_tracks_and_vias.cpp.

418 {
419  int curRow = m_diffPairsGrid->GetGridCursorRow();
420 
421  if( curRow < 0 || m_diffPairsGrid->GetNumberRows() <= curRow )
422  return;
423 
424  m_diffPairsGrid->DeleteRows( curRow, 1 );
425 
426  curRow = std::max( 0, curRow - 1 );
427  m_diffPairsGrid->MakeCellVisible( curRow, m_diffPairsGrid->GetGridCursorCol() );
428  m_diffPairsGrid->SetGridCursor( curRow, m_diffPairsGrid->GetGridCursorCol() );
429 }

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

364 {
365  int curRow = m_trackWidthsGrid->GetGridCursorRow();
366 
367  if( curRow < 0 || m_trackWidthsGrid->GetNumberRows() <= curRow )
368  return;
369 
370  m_trackWidthsGrid->DeleteRows( curRow, 1 );
371 
372  curRow = std::max( 0, curRow - 1 );
373  m_trackWidthsGrid->MakeCellVisible( curRow, m_trackWidthsGrid->GetGridCursorCol() );
374  m_trackWidthsGrid->SetGridCursor( curRow, m_trackWidthsGrid->GetGridCursorCol() );
375 }

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

391 {
392  int curRow = m_viaSizesGrid->GetGridCursorRow();
393 
394  if( curRow < 0 || m_viaSizesGrid->GetNumberRows() <= curRow )
395  return;
396 
397  m_viaSizesGrid->DeleteRows( curRow, 1 );
398 
399  curRow = std::max( 0, curRow - 1 );
400  m_viaSizesGrid->MakeCellVisible( curRow, m_viaSizesGrid->GetGridCursorCol() );
401  m_viaSizesGrid->SetGridCursor( curRow, m_viaSizesGrid->GetGridCursorCol() );
402 }

References PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid.

◆ onUnitsChanged()

void PANEL_SETUP_TRACKS_AND_VIAS::onUnitsChanged ( wxCommandEvent &  aEvent)
protected

Definition at line 119 of file panel_setup_tracks_and_vias.cpp.

120 {
121  BOARD_DESIGN_SETTINGS tempBDS( nullptr, "dummy" );
123 
124  m_BrdSettings = &tempBDS; // No, address of stack var does not escape function
125 
128 
129  m_BrdSettings = saveBDS;
130 
131  aEvent.Skip();
132 }
Container for design settings for a BOARD object.

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

167 {
171  {
172  return false;
173  }
174 
175  wxString msg;
176  std::vector<int> trackWidths;
177  std::vector<VIA_DIMENSION> vias;
178  std::vector<DIFF_PAIR_DIMENSION> diffPairs;
179 
183  {
184  return false;
185  }
186 
187  // Test ONLY for malformed data. Design rules and constraints are the business of DRC.
188 
189  for( int row = 0; row < m_trackWidthsGrid->GetNumberRows(); ++row )
190  {
191  msg = m_trackWidthsGrid->GetCellValue( row, TR_WIDTH_COL );
192 
193  if( !msg.IsEmpty() )
194  trackWidths.push_back( ValueFromString( m_Frame->GetUserUnits(), msg ) );
195  }
196 
197  for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row )
198  {
199  msg = m_viaSizesGrid->GetCellValue( row, VIA_SIZE_COL );
200 
201  if( !msg.IsEmpty() )
202  {
203  VIA_DIMENSION via_dim;
204  via_dim.m_Diameter = ValueFromString( m_Frame->GetUserUnits(), msg );
205 
206  msg = m_viaSizesGrid->GetCellValue( row, VIA_DRILL_COL );
207 
208  if( !msg.IsEmpty() )
209  via_dim.m_Drill = ValueFromString( m_Frame->GetUserUnits(), msg );
210 
211  vias.push_back( via_dim );
212  }
213  }
214 
215  for( int row = 0; row < m_diffPairsGrid->GetNumberRows(); ++row )
216  {
217  msg = m_diffPairsGrid->GetCellValue( row, DP_WIDTH_COL );
218 
219  if( !msg.IsEmpty() )
220  {
221  DIFF_PAIR_DIMENSION diffPair_dim;
222  diffPair_dim.m_Width = ValueFromString( m_Frame->GetUserUnits(), msg );
223 
224  msg = m_diffPairsGrid->GetCellValue( row, DP_GAP_COL );
225  diffPair_dim.m_Gap = ValueFromString( m_Frame->GetUserUnits(), msg );
226 
227  msg = m_diffPairsGrid->GetCellValue( row, DP_VIA_GAP_COL );
228 
229  if( !msg.IsEmpty() )
230  diffPair_dim.m_ViaGap = ValueFromString( m_Frame->GetUserUnits(), msg );
231 
232  diffPairs.push_back( diffPair_dim );
233  }
234  }
235 
236  // Sort lists by increasing value
237  sort( trackWidths.begin(), trackWidths.end() );
238  sort( vias.begin(), vias.end() );
239  sort( diffPairs.begin(), diffPairs.end() );
240 
241  // These are all stored in project file, not board, so no need for OnModify()
242 
243  trackWidths.insert( trackWidths.begin(), 0 ); // dummy value for "use netclass"
244  m_BrdSettings->m_TrackWidthList = trackWidths;
245 
246  vias.insert( vias.begin(), { 0, 0 } ); // dummy value for "use netclass"
248 
249  diffPairs.insert( diffPairs.begin(), { 0, 0, 0 } ); // dummy value for "use netclass"
251 
252  return true;
253 }
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:226
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.

Referenced by onUnitsChanged().

◆ TransferDataToWindow()

bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataToWindow ( )
override

Definition at line 135 of file panel_setup_tracks_and_vias.cpp.

136 {
140 
141  // Skip the first item, which is the current netclass value
142  for( unsigned ii = 1; ii < m_BrdSettings->m_TrackWidthList.size(); ii++ )
143  {
145  }
146 
147  // Skip the first item, which is the current netclass value
148  for( unsigned ii = 1; ii < m_BrdSettings->m_ViasDimensionsList.size(); ii++ )
149  {
151  m_BrdSettings->m_ViasDimensionsList[ii].m_Drill );
152  }
153 
154  // Skip the first item, which is the current netclass value
155  for( unsigned ii = 1; ii < m_BrdSettings->m_DiffPairDimensionsList.size(); ii++ )
156  {
159  m_BrdSettings->m_DiffPairDimensionsList[ii].m_ViaGap );
160  }
161 
162  return true;
163 }
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:109
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(), and onUnitsChanged().

◆ Validate()

bool PANEL_SETUP_TRACKS_AND_VIAS::Validate ( )
override

Definition at line 256 of file panel_setup_tracks_and_vias.cpp.

257 {
261  {
262  return false;
263  }
264 
265  wxString msg;
266 
267  // Test vias
268  for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row )
269  {
270  wxString viaDia = m_viaSizesGrid->GetCellValue( row, VIA_SIZE_COL );
271  wxString viaDrill = m_viaSizesGrid->GetCellValue( row, VIA_DRILL_COL );
272 
273  if( !viaDia.IsEmpty() && viaDrill.IsEmpty() )
274  {
275  msg = _( "No via hole size defined." );
276  m_Parent->SetError( msg, this, m_viaSizesGrid, row, VIA_DRILL_COL );
277  return false;
278  }
279 
280  }
281 
282  // Test diff pairs
283  for( int row = 0; row < m_diffPairsGrid->GetNumberRows(); ++row )
284  {
285  wxString dpWidth = m_diffPairsGrid->GetCellValue( row, 0 );
286  wxString dpGap = m_diffPairsGrid->GetCellValue( row, 1 );
287 
288  if( !dpWidth.IsEmpty() && dpGap.IsEmpty() )
289  {
290  msg = _( "No differential pair gap defined." );
291  m_Parent->SetError( msg, this, m_diffPairsGrid, row, 1 );
292  return false;
293  }
294  }
295 
296  return true;
297 }
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:226

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 75 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

◆ 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 68 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 70 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: