KiCad PCB EDA Suite
panel_setup_netclasses.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2004-2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2009 Dick Hollenbeck, dick@softplc.com
6  * Copyright (C) 2009-2019 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 
27 #include <fctsys.h>
28 #include <class_drawpanel.h>
29 #include <base_units.h>
30 #include <confirm.h>
31 #include <pcb_edit_frame.h>
32 #include <board_design_settings.h>
33 #include <bitmaps.h>
34 #include <widgets/wx_grid.h>
35 #include <grid_tricks.h>
36 
37 #include <panel_setup_netclasses.h>
38 
39 
40 // Columns of netclasses grid
41 enum {
42  GRID_NAME = 0,
52 };
53 
54 
56  PANEL_SETUP_FEATURE_CONSTRAINTS* aConstraintsPanel ) :
57  PANEL_SETUP_NETCLASSES_BASE( aParent->GetTreebook() )
58 {
59  m_Parent = aParent;
60  m_Frame = aFrame;
61  m_Pcb = m_Frame->GetBoard();
63  m_ConstraintsPanel = aConstraintsPanel;
64 
65  m_netclassesDirty = true;
66 
67  m_originalColWidths = new int[ m_netclassGrid->GetNumberCols() ];
68  // Calculate a min best size to handle longest usual numeric values:
69  // (The 'M' large char is used to give a margin)
70  int min_best_width = m_netclassGrid->GetTextExtent( "555,555555 milsM" ).x;
71 
72  for( int i = 0; i < m_netclassGrid->GetNumberCols(); ++i )
73  {
74  // We calculate the column min size only from texts sizes, not using the initial col width
75  // as this initial width is sometimes strange depending on the language (wxGrid bug?)
76  int min_width = m_netclassGrid->GetVisibleWidth( i, true, true, false );
77  m_netclassGrid->SetColMinimalWidth( i, min_width );
78  // We use a "best size" >= min_best_width
79  m_originalColWidths[ i ] = std::max( min_width, min_best_width );
80  m_netclassGrid->SetColSize( i, m_originalColWidths[ i ] );
81  }
82 
83  // Be sure the column labels are readable
85 
86  // Membership combobox editors require a bit more room, so increase the row size of
87  // all our grids for consistency
88  m_netclassGrid->SetDefaultRowSize( m_netclassGrid->GetDefaultRowSize() + 4 );
89  m_membershipGrid->SetDefaultRowSize( m_membershipGrid->GetDefaultRowSize() + 4 );
90 
91  m_netclassGrid->PushEventHandler( new GRID_TRICKS( m_netclassGrid ) );
92  m_membershipGrid->PushEventHandler( new GRID_TRICKS( m_membershipGrid ) );
93 
94  m_netclassGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
95  m_membershipGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
96 
97  // Set up the net name column of the netclass membership grid to read-only
98  wxGridCellAttr* attr = new wxGridCellAttr;
99  attr->SetReadOnly( true );
100  m_membershipGrid->SetColAttr( 0, attr );
101 
102  m_addButton->SetBitmap( KiBitmap( small_plus_xpm ) );
103  m_removeButton->SetBitmap( KiBitmap( trash_xpm ) );
104 
105  // wxFormBuilder doesn't include this event...
106  m_netclassGrid->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging ), NULL, this );
107 }
108 
109 
111 {
112  delete [] m_originalColWidths;
113 
114  // Delete the GRID_TRICKS.
115  m_netclassGrid->PopEventHandler( true );
116  m_membershipGrid->PopEventHandler( true );
117 
118  m_netclassGrid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging ), NULL, this );
119 }
120 
121 
122 static void netclassToGridRow( EDA_UNITS_T aUnits, wxGrid* aGrid, int aRow, const NETCLASSPTR& nc )
123 {
124  aGrid->SetCellValue( aRow, GRID_NAME, nc->GetName() );
125 
126 #define SET_MILS_CELL( col, val ) \
127  aGrid->SetCellValue( aRow, col, StringFromValue( aUnits, val, true, true ) )
128 
129  SET_MILS_CELL( GRID_CLEARANCE, nc->GetClearance() );
130  SET_MILS_CELL( GRID_TRACKSIZE, nc->GetTrackWidth() );
131  SET_MILS_CELL( GRID_VIASIZE, nc->GetViaDiameter() );
132  SET_MILS_CELL( GRID_VIADRILL, nc->GetViaDrill() );
133  SET_MILS_CELL( GRID_uVIASIZE, nc->GetuViaDiameter() );
134  SET_MILS_CELL( GRID_uVIADRILL, nc->GetuViaDrill() );
135  SET_MILS_CELL( GRID_DIFF_PAIR_WIDTH, nc->GetDiffPairWidth() );
136  SET_MILS_CELL( GRID_DIFF_PAIR_GAP, nc->GetDiffPairGap() );
137  // 6.0 TODO: SET_MILS_CELL( GRID_DIFF_PAIR_VIA_GAP, nc->GetDiffPairViaGap() );
138 }
139 
140 
142 {
143  NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
144  NETCLASSPTR netclass = netclasses.GetDefault();
145 
146  if( m_netclassGrid->GetNumberRows() )
147  m_netclassGrid->DeleteRows( 0, m_netclassGrid->GetNumberRows() );
148  m_netclassGrid->AppendRows( netclasses.GetCount() + 1 ); // + 1 for default netclass
149 
150  // enter the Default NETCLASS.
152 
153  // make the Default NETCLASS name read-only
154  wxGridCellAttr* cellAttr = m_netclassGrid->GetOrCreateCellAttr( 0, GRID_NAME );
155  cellAttr->SetReadOnly();
156  cellAttr->DecRef();
157 
158  // enter other netclasses
159  int row = 1;
160 
161  for( NETCLASSES::iterator i = netclasses.begin(); i != netclasses.end(); ++i, ++row )
163 
164  // ensure that all nets have net classes assigned
166 
167  if( m_membershipGrid->GetNumberRows() )
168  m_membershipGrid->DeleteRows( 0, m_membershipGrid->GetNumberRows() );
169 
170  for( NETINFO_ITEM* net : m_Pcb->GetNetInfo() )
171  {
172  if( net->GetNet() > 0 && net->IsCurrent() )
173  addNet( net->GetNetname(), net->GetNetClass()->GetName() );
174  }
175 
176  return true;
177 }
178 
179 
180 void PANEL_SETUP_NETCLASSES::addNet( wxString netName, const wxString& netclass )
181 {
182  int i = m_membershipGrid->GetNumberRows();
183 
184  m_membershipGrid->AppendRows( 1 );
185 
186  m_membershipGrid->SetCellValue( i, 0, netName );
187  m_membershipGrid->SetCellValue( i, 1, netclass );
188 }
189 
190 
191 /* Populates drop-downs with the list of net classes
192  */
194 {
196 
197  wxArrayString netclassNames;
198 
199  for( int ii = 0; ii < m_netclassGrid->GetNumberRows(); ii++ )
200  {
201  wxString netclassName = m_netclassGrid->GetCellValue( ii, GRID_NAME );
202  if( !netclassName.IsEmpty() )
203  netclassNames.push_back( netclassName );
204  }
205 
206  wxGridCellAttr* attr = new wxGridCellAttr;
207  attr->SetEditor( new wxGridCellChoiceEditor( netclassNames ) );
208  m_membershipGrid->SetColAttr( 1, attr );
209 
210  m_assignNetClass->Set( netclassNames );
211 
212  netclassNames.Insert( wxEmptyString, 0 );
213  m_netClassFilter->Set( netclassNames );
214 }
215 
216 
217 static void gridRowToNetclass( EDA_UNITS_T aUnits, wxGrid* grid, int row, const NETCLASSPTR& nc )
218 {
219  nc->SetName( grid->GetCellValue( row, GRID_NAME ) );
220 
221 #define MYCELL( col ) \
222  ValueFromString( aUnits, grid->GetCellValue( row, col ), true )
223 
224  nc->SetClearance( MYCELL( GRID_CLEARANCE ) );
225  nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) );
226  nc->SetViaDiameter( MYCELL( GRID_VIASIZE ) );
227  nc->SetViaDrill( MYCELL( GRID_VIADRILL ) );
228  nc->SetuViaDiameter( MYCELL( GRID_uVIASIZE ) );
229  nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) );
230  nc->SetDiffPairWidth( MYCELL( GRID_DIFF_PAIR_WIDTH ) );
231  nc->SetDiffPairGap( MYCELL( GRID_DIFF_PAIR_GAP ) );
232  // 6.0 TODO: nc->SetDiffPairViaGap( MYCELL( GRID_DIFF_PAIR_VIA_GAP ) );
233 }
234 
235 
237 {
238  if( !validateData() )
239  return false;
240 
241  NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
242 
243  // Remove all netclasses from board. We'll copy new list after
244  netclasses.Clear();
245 
246  // Copy the default NetClass:
248 
249  // Copy other NetClasses :
250  for( int row = 1; row < m_netclassGrid->GetNumberRows(); ++row )
251  {
252  NETCLASSPTR nc = std::make_shared<NETCLASS>( m_netclassGrid->GetCellValue( row, GRID_NAME ) );
253 
254  if( m_BrdSettings->m_NetClasses.Add( nc ) )
256  }
257 
258  // Now read all nets and push them in the corresponding netclass net buffer
259  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
260  {
261  NETCLASSPTR nc = netclasses.Find( m_membershipGrid->GetCellValue( row, 1 ) );
262 
263  if( nc )
264  nc->Add( m_membershipGrid->GetCellValue( row, 0 ) );
265  }
266 
269 
270  return true;
271 }
272 
273 
274 bool PANEL_SETUP_NETCLASSES::validateNetclassName( int aRow, wxString aName, bool focusFirst )
275 {
276  aName.Trim( true );
277  aName.Trim( false );
278 
279  if( aName.IsEmpty() )
280  {
281  wxString msg = _( "Netclass must have a name." );
282  m_Parent->SetError( msg, this, m_netclassGrid, aRow, GRID_NAME );
283  return false;
284  }
285 
286  for( int ii = 0; ii < m_netclassGrid->GetNumberRows(); ii++ )
287  {
288  if( ii != aRow && m_netclassGrid->GetRowLabelValue( ii ).CmpNoCase( aName ) == 0 )
289  {
290  wxString msg = _( "Netclass name already in use." );
291  m_Parent->SetError( msg, this, m_netclassGrid, focusFirst ? aRow : ii, GRID_NAME );
292  return false;
293  }
294  }
295 
296  return true;
297 }
298 
299 
301 {
302  if( event.GetCol() == GRID_NAME )
303  {
304  if( validateNetclassName( event.GetRow(), event.GetString() ) )
305  m_netclassesDirty = true;
306  else
307  event.Veto();
308  }
309 }
310 
311 
312 void PANEL_SETUP_NETCLASSES::OnAddNetclassClick( wxCommandEvent& event )
313 {
315  return;
316 
317  int row = m_netclassGrid->GetNumberRows();
318  m_netclassGrid->AppendRows();
319 
320  // Copy values of the default class:
321  for( int col = 1; col < m_netclassGrid->GetNumberCols(); col++ )
322  m_netclassGrid->SetCellValue( row, col, m_netclassGrid->GetCellValue( 0, col ) );
323 
324  m_netclassGrid->MakeCellVisible( row, 0 );
325  m_netclassGrid->SetGridCursor( row, 0 );
326 
327  m_netclassGrid->EnableCellEditControl( true );
328  m_netclassGrid->ShowCellEditControl();
329 
330  m_netclassesDirty = true;
331 }
332 
333 
335 {
337  return;
338 
339  int curRow = m_netclassGrid->GetGridCursorRow();
340 
341  if( curRow < 0 )
342  return;
343  else if( curRow == 0 )
344  {
345  DisplayErrorMessage( this, _( "The default net class is required." ) );
346  return;
347  }
348 
349  // reset the net class to default for members of the removed class
350  wxString classname = m_netclassGrid->GetCellValue( curRow, GRID_NAME );
351 
352  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
353  {
354  if( m_membershipGrid->GetCellValue( row, 1 ) == classname )
355  m_membershipGrid->SetCellValue( row, 1, NETCLASS::Default );
356  }
357 
358  m_netclassGrid->DeleteRows( curRow, 1 );
359 
360  m_netclassGrid->MakeCellVisible( std::max( 0, curRow-1 ), m_netclassGrid->GetGridCursorCol() );
361  m_netclassGrid->SetGridCursor( std::max( 0, curRow-1 ), m_netclassGrid->GetGridCursorCol() );
362 
363  m_netclassesDirty = true;
364 }
365 
366 
368 {
369  // Account for scroll bars
370  aWidth -= ( m_netclassGrid->GetSize().x - m_netclassGrid->GetClientSize().x );
371 
372  for( int i = 1; i < m_netclassGrid->GetNumberCols(); i++ )
373  {
374  m_netclassGrid->SetColSize( i, m_originalColWidths[ i ] );
375  aWidth -= m_originalColWidths[ i ];
376  }
377 
378  m_netclassGrid->SetColSize( 0, std::max( aWidth, m_originalColWidths[ 0 ] ) );
379 }
380 
381 
383 {
384  AdjustNetclassGridColumns( event.GetSize().GetX() );
385 
386  event.Skip();
387 }
388 
389 
391 {
392  // Account for scroll bars
393  aWidth -= ( m_membershipGrid->GetSize().x - m_membershipGrid->GetClientSize().x );
394 
395  // Set className column width to original className width from netclasses grid
396  int classNameWidth = m_originalColWidths[ 0 ];
397  m_membershipGrid->SetColSize( 1, m_originalColWidths[ 0 ] );
398  m_membershipGrid->SetColSize( 0, std::max( aWidth - classNameWidth, classNameWidth ) );
399 }
400 
401 
403 {
404  AdjustMembershipGridColumns( event.GetSize().GetX() );
405 
406  event.Skip();
407 }
408 
409 
411 {
413  return;
414 
415  wxString netClassFilter = m_netClassFilter->GetStringSelection();
416  wxString netFilter = m_netNameFilter->GetValue().MakeLower();
417 
418  if( !netFilter.IsEmpty() )
419  netFilter = wxT( "*" ) + netFilter + wxT( "*" );
420 
421  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
422  {
423  wxString net = m_membershipGrid->GetCellValue( row, 0 );
424  wxString netClass = m_membershipGrid->GetCellValue( row, 1 );
425  bool show = true;
426 
427  if( !aShowAll )
428  {
429  if( !netFilter.IsEmpty() && !net.MakeLower().Matches( netFilter ) )
430  show = false;
431 
432  if( !netClassFilter.IsEmpty() && netClass != netClassFilter )
433  show = false;
434  }
435 
436  if( show )
437  m_membershipGrid->ShowRow( row );
438  else
439  m_membershipGrid->HideRow( row );
440  }
441 }
442 
443 
445 {
447  return;
448 
449  wxArrayInt selectedRows = m_membershipGrid->GetSelectedRows();
450 
451  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
452  {
453  if( !m_membershipGrid->IsRowShown( row ) )
454  continue;
455 
456  if( !aAssignAll && selectedRows.Index( row ) == wxNOT_FOUND )
457  continue;
458 
459  m_membershipGrid->SetCellValue( row, 1, m_assignNetClass->GetStringSelection() );
460  }
461 }
462 
463 
464 void PANEL_SETUP_NETCLASSES::OnUpdateUI( wxUpdateUIEvent& event )
465 {
466  if( m_netclassesDirty )
467  {
469  m_netclassesDirty = false;
470  }
471 }
472 
473 
475 {
476  return ValueFromString( m_Frame->GetUserUnits(), m_netclassGrid->GetCellValue( aRow, aCol ), true );
477 }
478 
479 
481 {
483  return false;
484 
485  wxString msg;
486  int minViaDia = m_ConstraintsPanel->m_viaMinSize.GetValue();
487  int minViaDrill = m_ConstraintsPanel->m_viaMinDrill.GetValue();
488  int minUViaDia = m_ConstraintsPanel->m_uviaMinSize.GetValue();
489  int minUViaDrill = m_ConstraintsPanel->m_uviaMinDrill.GetValue();
490  int minTrackWidth = m_ConstraintsPanel->m_trackMinWidth.GetValue();
491 
492  // Test net class parameters.
493  for( int row = 0; row < m_netclassGrid->GetNumberRows(); row++ )
494  {
495  wxString netclassName = m_netclassGrid->GetCellValue( row, GRID_NAME );
496  netclassName.Trim( true );
497  netclassName.Trim( false );
498 
499  if( !validateNetclassName( row, netclassName, false ) )
500  return false;
501 
502  if( getNetclassValue( row, GRID_TRACKSIZE ) < minTrackWidth )
503  {
504  msg.Printf( _( "Track width less than minimum track width (%s)." ),
505  StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) );
506  m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_TRACKSIZE );
507  return false;
508  }
509 
510  if( getNetclassValue( row, GRID_DIFF_PAIR_WIDTH ) < minTrackWidth )
511  {
512  msg.Printf( _( "Differential pair width less than minimum track width (%s)." ),
513  StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) );
515  return false;
516  }
517 
518  // Test vias
519  if( getNetclassValue( row, GRID_VIASIZE ) < minViaDia )
520  {
521  msg.Printf( _( "Via diameter less than minimum via diameter (%s)." ),
522  StringFromValue( m_Frame->GetUserUnits(), minViaDia, true, true ) );
523  m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIASIZE );
524  return false;
525  }
526 
528  {
529  msg = _( "Via drill larger than via diameter." );
530  m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIADRILL );
531  return false;
532  }
533 
534  if( getNetclassValue( row, GRID_VIADRILL ) < minViaDrill )
535  {
536  msg.Printf( _( "Via drill less than minimum via drill (%s)." ),
537  StringFromValue( m_Frame->GetUserUnits(), minViaDrill, true, true ) );
538  m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIADRILL );
539  return false;
540  }
541 
542  // Test Micro vias
543  if( getNetclassValue( row, GRID_uVIASIZE ) < minUViaDia )
544  {
545  msg.Printf( _( "Microvia diameter less than minimum microvia diameter (%s)." ),
546  StringFromValue( m_Frame->GetUserUnits(), minUViaDia, true, true ) );
547  m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_uVIASIZE );
548  return false;
549  }
550 
552  {
553  msg = _( "Microvia drill larger than microvia diameter." );
554  m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_uVIADRILL );
555  return false;
556  }
557 
558  if( getNetclassValue( row, GRID_uVIADRILL ) < minUViaDrill )
559  {
560  msg.Printf( _( "Microvia drill less than minimum microvia drill (%s)." ),
561  StringFromValue( m_Frame->GetUserUnits(), minUViaDrill, true, true ) );
562  m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_uVIADRILL );
563  return false;
564  }
565  }
566 
567  return true;
568 }
569 
570 
572 {
573  // Note: do not change the board, as we need to get the current nets from it for
574  // netclass memberships. All the netclass definitions and dimension lists are in
575  // the BOARD_DESIGN_SETTINGS.
576 
577  BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
578 
579  m_BrdSettings = &aBoard->GetDesignSettings();
581 
582  m_netclassGrid->ForceRefresh();
583  m_membershipGrid->ForceRefresh();
584 
585  m_BrdSettings = savedSettings;
586 }
587 
588 
void BuildListOfNets()
Definition: class_board.h:735
NETCLASSPTR Find(const wxString &aName) const
Function Find searches this container for a NETCLASS given by aName.
Definition: netclass.cpp:141
void OnSizeNetclassGrid(wxSizeEvent &event) override
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:257
Implementation of conversion functions that require both schematic and board internal units.
This file is part of the common library.
#define SET_MILS_CELL(col, val)
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
PANEL_SETUP_NETCLASSES(PAGED_DIALOG *aParent, PCB_EDIT_FRAME *aFrame, PANEL_SETUP_FEATURE_CONSTRAINTS *aConstraintsPanel)
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:539
iterator end()
Definition: netclass.h:249
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
int getNetclassValue(int aRow, int aCol)
static void netclassToGridRow(EDA_UNITS_T aUnits, wxGrid *aGrid, int aRow, const NETCLASSPTR &nc)
void doAssignments(bool aAssignAll)
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:223
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
void SynchronizeNetsAndNetClasses()
Function SynchronizeNetsAndNetClasses copies NETCLASS info to each NET, based on NET membership in a ...
Definition: netclass.cpp:155
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
NETCLASS_MAP::iterator iterator
Definition: netclass.h:247
iterator begin()
Definition: netclass.h:248
Class NETCLASSES is a container for NETCLASS instances.
Definition: netclass.h:224
static const char Default[]
the name of the default NETCLASS
Definition: netclass.h:80
void ImportSettingsFrom(BOARD *aBoard)
void addNet(wxString netName, const wxString &netclass)
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:291
void EnsureColLabelsVisible()
Ensure the height of the row displaying the column labels is enough, even if labels are multiline tex...
Definition: wx_grid.cpp:265
static void gridRowToNetclass(EDA_UNITS_T aUnits, wxGrid *grid, int row, const NETCLASSPTR &nc)
void OnNetclassGridCellChanging(wxGridEvent &event)
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:167
BOARD_DESIGN_SETTINGS * m_BrdSettings
NETINFO_LIST & GetNetInfo()
Definition: class_board.h:756
void SetError(const wxString &aMessage, wxWindow *aPage, wxObject *aCtrl, int aRow=-1, int aCol=-1)
Class PANEL_SETUP_NETCLASSES_BASE.
bool Add(const NETCLASSPTR &aNetclass)
Function Add takes aNetclass and puts it into this NETCLASSES container.
Definition: netclass.cpp:99
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:69
bool SetCurrentNetClass(const wxString &aNetClassName)
Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter ...
void Clear()
Function Clear destroys any contained NETCLASS instances except the Default one.
Definition: netclass.h:242
PANEL_SETUP_FEATURE_CONSTRAINTS * m_ConstraintsPanel
#define max(a, b)
Definition: auxiliary.h:86
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:171
size_t i
Definition: json11.cpp:597
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
unsigned GetCount() const
Function GetCount.
Definition: netclass.h:259
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
NETCLASSPTR GetDefault() const
Function GetDefault.
Definition: netclass.h:268
BOARD * GetBoard() const
void OnUpdateUI(wxUpdateUIEvent &event) override
bool validateNetclassName(int aRow, wxString aName, bool focusFirst=true)
#define MYCELL(col)
void OnSizeMembershipGrid(wxSizeEvent &event) override
EDA_UNITS_T
Definition: common.h:160
void OnRemoveNetclassClick(wxCommandEvent &event) override
void AdjustNetclassGridColumns(int aWidth)
void AdjustMembershipGridColumns(int aWidth)
void OnAddNetclassClick(wxCommandEvent &event) override
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
void doApplyFilters(bool aShowAll)