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_FEATURE_CONSTRAINTS *aConstraintsPanel)
 
 ~PANEL_SETUP_TRACKS_AND_VIAS () override
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () 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 Member Functions

bool validateData ()
 

Private Attributes

PAGED_DIALOGm_Parent
 
PCB_EDIT_FRAMEm_Frame
 
BOARDm_Pcb
 
BOARD_DESIGN_SETTINGSm_BrdSettings
 
PANEL_SETUP_FEATURE_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_FEATURE_CONSTRAINTS aConstraintsPanel 
)

Definition at line 56 of file panel_setup_tracks_and_vias.cpp.

58  :
60 {
61  m_Parent = aParent;
62  m_Frame = aFrame;
63  m_Pcb = m_Frame->GetBoard();
65  m_ConstraintsPanel = aConstraintsPanel;
66 
67  m_trackWidthsAddButton->SetBitmap( KiBitmap( small_plus_xpm ) );
68  m_trackWidthsRemoveButton->SetBitmap( KiBitmap( trash_xpm ) );
69  m_viaSizesAddButton->SetBitmap( KiBitmap( small_plus_xpm ) );
70  m_viaSizesRemoveButton->SetBitmap( KiBitmap( trash_xpm ) );
71  m_diffPairsAddButton->SetBitmap( KiBitmap( small_plus_xpm ) );
72  m_diffPairsRemoveButton->SetBitmap( KiBitmap( trash_xpm ) );
73 
74  // Membership combobox editors require a bit more room, so increase the row size of
75  // all our grids for consistency
76  m_trackWidthsGrid->SetDefaultRowSize( m_trackWidthsGrid->GetDefaultRowSize() + 4 );
77  m_viaSizesGrid->SetDefaultRowSize( m_viaSizesGrid->GetDefaultRowSize() + 4 );
78  m_diffPairsGrid->SetDefaultRowSize( m_diffPairsGrid->GetDefaultRowSize() + 4 );
79 
80  m_trackWidthsGrid->PushEventHandler( new GRID_TRICKS( m_trackWidthsGrid ) );
81  m_viaSizesGrid->PushEventHandler( new GRID_TRICKS( m_viaSizesGrid ) );
82  m_diffPairsGrid->PushEventHandler( new GRID_TRICKS( m_diffPairsGrid ) );
83 
84  m_trackWidthsGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
85  m_viaSizesGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
86  m_diffPairsGrid->SetSelectionMode( wxGrid::wxGridSelectionModes::wxGridSelectRows );
87 }
PANEL_SETUP_FEATURE_CONSTRAINTS * m_ConstraintsPanel
Class GRID_TRICKS is used to add mouse and command handling (such as cut, copy, and paste) to a WX_GR...
Definition: grid_tricks.h:51
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:534
wxTreebook * GetTreebook()
Definition: paged_dialog.h:43
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
PANEL_SETUP_TRACKS_AND_VIAS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL)
BOARD * GetBoard() const

References PCB_BASE_FRAME::GetBoard(), BOARD::GetDesignSettings(), 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, and PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesRemoveButton.

◆ ~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 365 of file panel_setup_tracks_and_vias.cpp.

367 {
368  int i = m_diffPairsGrid->GetNumberRows();
369 
370  m_diffPairsGrid->AppendRows( 1 );
371 
372  wxString val = StringFromValue( m_Frame->GetUserUnits(), aWidth, true, true );
373  m_diffPairsGrid->SetCellValue( i, DP_WIDTH_COL, val );
374 
375  if( aGap > 0 )
376  {
377  val = StringFromValue( m_Frame->GetUserUnits(), aGap, true, true );
378  m_diffPairsGrid->SetCellValue( i, DP_GAP_COL, val );
379  }
380 
381  if( aViaGap > 0 )
382  {
383  val = StringFromValue( m_Frame->GetUserUnits(), aViaGap, true, true );
384  m_diffPairsGrid->SetCellValue( i, DP_VIA_GAP_COL, val );
385  }
386 }
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:289
size_t i
Definition: json11.cpp:597
wxString StringFromValue(EDA_UNITS_T aUnits, int aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:210

References DP_GAP_COL, DP_VIA_GAP_COL, DP_WIDTH_COL, EDA_DRAW_FRAME::GetUserUnits(), i, 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 337 of file panel_setup_tracks_and_vias.cpp.

338 {
339  int i = m_trackWidthsGrid->GetNumberRows();
340 
341  m_trackWidthsGrid->AppendRows( 1 );
342 
343  wxString val = StringFromValue( m_Frame->GetUserUnits(), aWidth, true, true );
344  m_trackWidthsGrid->SetCellValue( i, TR_WIDTH_COL, val );
345 }
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:289
size_t i
Definition: json11.cpp:597
wxString StringFromValue(EDA_UNITS_T aUnits, int aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:210

References EDA_DRAW_FRAME::GetUserUnits(), i, 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 348 of file panel_setup_tracks_and_vias.cpp.

349 {
350  int i = m_viaSizesGrid->GetNumberRows();
351 
352  m_viaSizesGrid->AppendRows( 1 );
353 
354  wxString val = StringFromValue( m_Frame->GetUserUnits(), aSize, true, true );
355  m_viaSizesGrid->SetCellValue( i, VIA_SIZE_COL, val );
356 
357  if( aDrill > 0 )
358  {
359  val = StringFromValue( m_Frame->GetUserUnits(), aDrill, true, true );
360  m_viaSizesGrid->SetCellValue( i, VIA_DRILL_COL, val );
361  }
362 }
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:289
size_t i
Definition: json11.cpp:597
wxString StringFromValue(EDA_UNITS_T aUnits, int aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:210

References EDA_DRAW_FRAME::GetUserUnits(), i, 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 469 of file panel_setup_tracks_and_vias.cpp.

470 {
474 
475  // Note: do not change the board, as we need to get the current nets from it for
476  // netclass memberships. All the netclass definitions and dimension lists are in
477  // the BOARD_DESIGN_SETTINGS.
478 
479  BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
480 
481  m_BrdSettings = &aBoard->GetDesignSettings();
483 
484  m_BrdSettings = savedSettings;
485 }
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:534
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:167
Class BOARD_DESIGN_SETTINGS contains 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 442 of file panel_setup_tracks_and_vias.cpp.

443 {
444  AppendDiffPairs( 0, 0, 0 );
445 
446  m_diffPairsGrid->MakeCellVisible( m_diffPairsGrid->GetNumberRows() - 1, DP_WIDTH_COL );
447  m_diffPairsGrid->SetGridCursor( m_diffPairsGrid->GetNumberRows() - 1, DP_WIDTH_COL );
448 
449  m_diffPairsGrid->EnableCellEditControl( true );
450  m_diffPairsGrid->ShowCellEditControl();
451 }
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 388 of file panel_setup_tracks_and_vias.cpp.

389 {
390  AppendTrackWidth( 0 );
391 
392  m_trackWidthsGrid->MakeCellVisible( m_trackWidthsGrid->GetNumberRows() - 1, TR_WIDTH_COL );
393  m_trackWidthsGrid->SetGridCursor( m_trackWidthsGrid->GetNumberRows() - 1, TR_WIDTH_COL );
394 
395  m_trackWidthsGrid->EnableCellEditControl( true );
396  m_trackWidthsGrid->ShowCellEditControl();
397 }

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

416 {
417  AppendViaSize( 0, 0 );
418 
419  m_viaSizesGrid->MakeCellVisible( m_viaSizesGrid->GetNumberRows() - 1, VIA_SIZE_COL );
420  m_viaSizesGrid->SetGridCursor( m_viaSizesGrid->GetNumberRows() - 1, VIA_SIZE_COL );
421 
422  m_viaSizesGrid->EnableCellEditControl( true );
423  m_viaSizesGrid->ShowCellEditControl();
424 }
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 454 of file panel_setup_tracks_and_vias.cpp.

455 {
456  int curRow = m_diffPairsGrid->GetGridCursorRow();
457 
458  if( curRow < 0 || m_diffPairsGrid->GetNumberRows() <= curRow )
459  return;
460 
461  m_diffPairsGrid->DeleteRows( curRow, 1 );
462 
463  curRow = std::max( 0, curRow - 1 );
464  m_diffPairsGrid->MakeCellVisible( curRow, m_diffPairsGrid->GetGridCursorCol() );
465  m_diffPairsGrid->SetGridCursor( curRow, m_diffPairsGrid->GetGridCursorCol() );
466 }
#define max(a, b)
Definition: auxiliary.h:86

References PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid, and max.

◆ OnRemoveTrackWidthsClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnRemoveTrackWidthsClick ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_SETUP_TRACKS_AND_VIAS_BASE.

Definition at line 400 of file panel_setup_tracks_and_vias.cpp.

401 {
402  int curRow = m_trackWidthsGrid->GetGridCursorRow();
403 
404  if( curRow < 0 || m_trackWidthsGrid->GetNumberRows() <= curRow )
405  return;
406 
407  m_trackWidthsGrid->DeleteRows( curRow, 1 );
408 
409  curRow = std::max( 0, curRow - 1 );
410  m_trackWidthsGrid->MakeCellVisible( curRow, m_trackWidthsGrid->GetGridCursorCol() );
411  m_trackWidthsGrid->SetGridCursor( curRow, m_trackWidthsGrid->GetGridCursorCol() );
412 }
#define max(a, b)
Definition: auxiliary.h:86

References PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsGrid, and max.

◆ OnRemoveViaSizesClick()

void PANEL_SETUP_TRACKS_AND_VIAS::OnRemoveViaSizesClick ( wxCommandEvent &  event)
overrideprotectedvirtual

Reimplemented from PANEL_SETUP_TRACKS_AND_VIAS_BASE.

Definition at line 427 of file panel_setup_tracks_and_vias.cpp.

428 {
429  int curRow = m_viaSizesGrid->GetGridCursorRow();
430 
431  if( curRow < 0 || m_viaSizesGrid->GetNumberRows() <= curRow )
432  return;
433 
434  m_viaSizesGrid->DeleteRows( curRow, 1 );
435 
436  curRow = std::max( 0, curRow - 1 );
437  m_viaSizesGrid->MakeCellVisible( curRow, m_viaSizesGrid->GetGridCursorCol() );
438  m_viaSizesGrid->SetGridCursor( curRow, m_viaSizesGrid->GetGridCursorCol() );
439 }
#define max(a, b)
Definition: auxiliary.h:86

References PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid, and max.

◆ TransferDataFromWindow()

bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow ( )
override

Definition at line 133 of file panel_setup_tracks_and_vias.cpp.

134 {
135  if( !validateData() )
136  return false;
137 
138  wxString msg;
139  std::vector<int> trackWidths;
140  std::vector<VIA_DIMENSION> vias;
141  std::vector<DIFF_PAIR_DIMENSION> diffPairs;
142 
146  {
147  return false;
148  }
149 
150  for( int row = 0; row < m_trackWidthsGrid->GetNumberRows(); ++row )
151  {
152  msg = m_trackWidthsGrid->GetCellValue( row, TR_WIDTH_COL );
153 
154  if( !msg.IsEmpty() )
155  trackWidths.push_back( ValueFromString( m_Frame->GetUserUnits(), msg, true ) );
156  }
157 
158  for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row )
159  {
160  msg = m_viaSizesGrid->GetCellValue( row, VIA_SIZE_COL );
161 
162  if( !msg.IsEmpty() )
163  {
164  VIA_DIMENSION via_dim;
165  via_dim.m_Diameter = ValueFromString( m_Frame->GetUserUnits(), msg, true );
166 
167  msg = m_viaSizesGrid->GetCellValue( row, VIA_DRILL_COL );
168 
169  if( !msg.IsEmpty() )
170  via_dim.m_Drill = ValueFromString( m_Frame->GetUserUnits(), msg, true );
171 
172  vias.push_back( via_dim );
173  }
174  }
175 
176  for( int row = 0; row < m_diffPairsGrid->GetNumberRows(); ++row )
177  {
178  msg = m_diffPairsGrid->GetCellValue( row, DP_WIDTH_COL );
179 
180  if( !msg.IsEmpty() )
181  {
182  DIFF_PAIR_DIMENSION diffPair_dim;
183  diffPair_dim.m_Width = ValueFromString( m_Frame->GetUserUnits(), msg, true );
184 
185  msg = m_diffPairsGrid->GetCellValue( row, DP_GAP_COL );
186  diffPair_dim.m_Gap = ValueFromString( m_Frame->GetUserUnits(), msg, true );
187 
188  msg = m_diffPairsGrid->GetCellValue( row, DP_VIA_GAP_COL );
189 
190  if( !msg.IsEmpty() )
191  diffPair_dim.m_ViaGap = ValueFromString( m_Frame->GetUserUnits(), msg, true );
192 
193  diffPairs.push_back( diffPair_dim );
194  }
195  }
196 
197  // Sort lists by increasing value
198  sort( trackWidths.begin(), trackWidths.end() );
199  sort( vias.begin(), vias.end() );
200  sort( diffPairs.begin(), diffPairs.end() );
201 
202  trackWidths.insert( trackWidths.begin(), m_BrdSettings->m_TrackWidthList[ 0 ] );
203  m_BrdSettings->m_TrackWidthList = trackWidths;
204 
205  vias.insert( vias.begin(), m_BrdSettings->m_ViasDimensionsList[ 0 ] );
207 
208  diffPairs.insert( diffPairs.begin(), m_BrdSettings->m_DiffPairDimensionsList[ 0 ] );
210 
211  return true;
212 }
Struct VIA_DIMENSION is a small helper container to handle a stock of specific vias each with unique ...
std::vector< int > m_TrackWidthList
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
int ValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue, bool aUseMils)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
Definition: base_units.cpp:409
Struct DIFF_PAIR_DIMENSION is a small helper container to handle a stock of specific differential pai...
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:289
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:167
std::vector< VIA_DIMENSION > m_ViasDimensionsList

References WX_GRID::CommitPendingChanges(), DP_GAP_COL, DP_VIA_GAP_COL, DP_WIDTH_COL, EDA_DRAW_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, validateData(), ValueFromString(), VIA_DRILL_COL, and VIA_SIZE_COL.

◆ TransferDataToWindow()

bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataToWindow ( )
override

Definition at line 97 of file panel_setup_tracks_and_vias.cpp.

98 {
99  if( m_trackWidthsGrid->GetNumberRows() > 0 )
100  m_trackWidthsGrid->DeleteRows( 0, m_trackWidthsGrid->GetNumberRows() );
101 
102  if( m_viaSizesGrid->GetNumberRows() > 0 )
103  m_viaSizesGrid->DeleteRows( 0, m_viaSizesGrid->GetNumberRows() );
104 
105  if( m_diffPairsGrid->GetNumberRows() > 0 )
106  m_diffPairsGrid->DeleteRows( 0, m_diffPairsGrid->GetNumberRows() );
107 
108  // Skip the first item, which is the current netclass value
109  for( unsigned ii = 1; ii < m_BrdSettings->m_TrackWidthList.size(); ii++ )
110  {
112  }
113 
114  // Skip the first item, which is the current netclass value
115  for( unsigned ii = 1; ii < m_BrdSettings->m_ViasDimensionsList.size(); ii++ )
116  {
118  m_BrdSettings->m_ViasDimensionsList[ii].m_Drill );
119  }
120 
121  // Skip the first item, which is the current netclass value
122  for( unsigned ii = 1; ii < m_BrdSettings->m_DiffPairDimensionsList.size(); ii++ )
123  {
126  m_BrdSettings->m_DiffPairDimensionsList[ii].m_ViaGap );
127  }
128 
129  return true;
130 }
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 AppendDiffPairs(const int aWidth, const int aGap, const int aViaGap)

References AppendDiffPairs(), AppendTrackWidth(), AppendViaSize(), 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().

◆ validateData()

bool PANEL_SETUP_TRACKS_AND_VIAS::validateData ( )
private

Definition at line 215 of file panel_setup_tracks_and_vias.cpp.

216 {
220  {
221  return false;
222  }
223 
224  wxString msg;
225  int minViaDia = m_ConstraintsPanel->m_viaMinSize.GetValue();
226  int minViaDrill = m_ConstraintsPanel->m_viaMinDrill.GetValue();
227  int minTrackWidth = m_ConstraintsPanel->m_trackMinWidth.GetValue();
228 
229  // Test tracks
230  for( int row = 0; row < m_trackWidthsGrid->GetNumberRows(); ++row )
231  {
232  wxString tvalue = m_trackWidthsGrid->GetCellValue( row, TR_WIDTH_COL );
233 
234  if( tvalue.IsEmpty() )
235  continue;
236 
237  if( ValueFromString( m_Frame->GetUserUnits(), tvalue ) < minTrackWidth )
238  {
239  msg.Printf( _( "Track width less than minimum track width (%s)." ),
240  StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) );
241  m_Parent->SetError( msg, this, m_trackWidthsGrid, row, TR_WIDTH_COL );
242  return false;
243  }
244  }
245 
246  // Test vias
247  for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row )
248  {
249  wxString viaDia = m_viaSizesGrid->GetCellValue( row, VIA_SIZE_COL );
250 
251  if( viaDia.IsEmpty() )
252  continue;
253 
254  if( ValueFromString( m_Frame->GetUserUnits(), viaDia ) < minViaDia )
255  {
256  msg.Printf( _( "Via diameter less than minimum via diameter (%s)." ),
257  StringFromValue( m_Frame->GetUserUnits(), minViaDia, true, true ) );
258  m_Parent->SetError( msg, this, m_viaSizesGrid, row, VIA_SIZE_COL );
259  return false;
260  }
261 
262  wxString viaDrill = m_viaSizesGrid->GetCellValue( row, VIA_DRILL_COL );
263 
264  if( viaDrill.IsEmpty() )
265  {
266  msg = _( "No via drill defined." );
267  m_Parent->SetError( msg, this, m_viaSizesGrid, row, VIA_DRILL_COL );
268  return false;
269  }
270 
271  if( ValueFromString( m_Frame->GetUserUnits(), viaDrill ) < minViaDrill )
272  {
273  msg.Printf( _( "Via drill less than minimum via drill (%s)." ),
274  StringFromValue( m_Frame->GetUserUnits(), minViaDrill, true, true ) );
275  m_Parent->SetError( msg, this, m_viaSizesGrid, row, VIA_DRILL_COL );
276  return false;
277  }
278 
279  if( ValueFromString( m_Frame->GetUserUnits(), viaDrill )
280  >= ValueFromString( m_Frame->GetUserUnits(), viaDia ) )
281  {
282  msg = _( "Via drill larger than via diameter." );
283  m_Parent->SetError( msg, this, m_viaSizesGrid, row, VIA_DRILL_COL );
284  return false;
285  }
286  }
287 
288  // Test diff pairs
289  for( int row = 0; row < m_diffPairsGrid->GetNumberRows(); ++row )
290  {
291  wxString tvalue = m_diffPairsGrid->GetCellValue( row, 0 );
292 
293  if( tvalue.IsEmpty() )
294  continue;
295 
296  if( ValueFromString( m_Frame->GetUserUnits(), tvalue ) < minTrackWidth )
297  {
298  msg.Printf( _( "Differential pair track width less than minimum track width (%s)." ),
299  StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) );
300  m_Parent->SetError( msg, this, m_diffPairsGrid, row, 0 );
301  return false;
302  }
303 
304  wxString gap = m_diffPairsGrid->GetCellValue( row, 1 );
305 
306  if( gap.IsEmpty() )
307  {
308  msg = _( "No differential pair gap defined." );
309  m_Parent->SetError( msg, this, m_diffPairsGrid, row, 1 );
310  return false;
311  }
312 
313  if( ValueFromString( m_Frame->GetUserUnits(), gap ) < 0 )
314  {
315  msg.Printf( _( "Differential pair gap cannot be negative." ) );
316  m_Parent->SetError( msg, this, m_diffPairsGrid, row, 1 );
317  return false;
318  }
319 
320  wxString viaGap = m_diffPairsGrid->GetCellValue( row, 2 );
321 
322  if( viaGap.IsEmpty() )
323  continue;
324 
325  if( ValueFromString( m_Frame->GetUserUnits(), viaGap ) < 0 )
326  {
327  msg.Printf( _( "Differential pair via gap cannot be negative." ) );
328  m_Parent->SetError( msg, this, m_diffPairsGrid, row, 2 );
329  return false;
330  }
331  }
332 
333  return true;
334 }
PANEL_SETUP_FEATURE_CONSTRAINTS * m_ConstraintsPanel
int ValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue, bool aUseMils)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
Definition: base_units.cpp:409
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:289
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:167
void SetError(const wxString &aMessage, wxWindow *aPage, wxObject *aCtrl, int aRow=-1, int aCol=-1)
wxString StringFromValue(EDA_UNITS_T aUnits, int aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:210

References WX_GRID::CommitPendingChanges(), EDA_DRAW_FRAME::GetUserUnits(), UNIT_BINDER::GetValue(), m_ConstraintsPanel, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_diffPairsGrid, m_Frame, m_Parent, PANEL_SETUP_FEATURE_CONSTRAINTS::m_trackMinWidth, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_trackWidthsGrid, PANEL_SETUP_FEATURE_CONSTRAINTS::m_viaMinDrill, PANEL_SETUP_FEATURE_CONSTRAINTS::m_viaMinSize, PANEL_SETUP_TRACKS_AND_VIAS_BASE::m_viaSizesGrid, PAGED_DIALOG::SetError(), StringFromValue(), TR_WIDTH_COL, ValueFromString(), VIA_DRILL_COL, and VIA_SIZE_COL.

Referenced by TransferDataFromWindow().

Member Data Documentation

◆ m_BrdSettings

BOARD_DESIGN_SETTINGS* PANEL_SETUP_TRACKS_AND_VIAS::m_BrdSettings
private

◆ m_ConstraintsPanel

PANEL_SETUP_FEATURE_CONSTRAINTS* PANEL_SETUP_TRACKS_AND_VIAS::m_ConstraintsPanel
private

Definition at line 49 of file panel_setup_tracks_and_vias.h.

Referenced by PANEL_SETUP_TRACKS_AND_VIAS(), and validateData().

◆ 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 42 of file panel_setup_tracks_and_vias.h.

Referenced by PANEL_SETUP_TRACKS_AND_VIAS(), and validateData().

◆ m_Pcb

BOARD* PANEL_SETUP_TRACKS_AND_VIAS::m_Pcb
private

Definition at line 44 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: