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 #include <base_units.h>
27 #include <bitmaps.h>
28 #include <board_design_settings.h>
29 #include <confirm.h>
30 #include <grid_tricks.h>
31 #include <panel_setup_netclasses.h>
32 #include <pcb_edit_frame.h>
33 #include <tool/tool_manager.h>
34 #include <widgets/wx_grid.h>
35 
36 // Columns of netclasses grid
37 enum {
38  GRID_NAME = 0,
48 };
49 
50 
52  PANEL_SETUP_FEATURE_CONSTRAINTS* aConstraintsPanel ) :
53  PANEL_SETUP_NETCLASSES_BASE( aParent->GetTreebook() )
54 {
55  m_Parent = aParent;
56  m_Frame = aFrame;
57  m_Pcb = m_Frame->GetBoard();
59  m_ConstraintsPanel = aConstraintsPanel;
60 
61  m_netclassesDirty = true;
62 
63  // Figure out the smallest the netclass membership pane can ever be so that nothing is cutoff
64  // and force it to be that size.
65  m_membershipSize = GetSize();
66  m_membershipSize.y -= m_netclassesPane->GetSize().y;
67  m_membershipSize.x = -1;
68  m_membershipPane->SetMinSize( m_membershipSize );
69  m_membershipPane->SetMaxSize( m_membershipSize );
70 
71  // Prevent Size events from firing before we are ready
72  Freeze();
73  m_originalColWidths = new int[ m_netclassGrid->GetNumberCols() ];
74  // Calculate a min best size to handle longest usual numeric values:
75  // (The 'M' large char is used to give a margin)
76  int min_best_width = m_netclassGrid->GetTextExtent( "555,555555 milsM" ).x;
77 
78  for( int i = 0; i < m_netclassGrid->GetNumberCols(); ++i )
79  {
80  // We calculate the column min size only from texts sizes, not using the initial col width
81  // as this initial width is sometimes strange depending on the language (wxGrid bug?)
82  int min_width = m_netclassGrid->GetVisibleWidth( i, true, true, false );
83  m_netclassGrid->SetColMinimalWidth( i, min_width );
84  // We use a "best size" >= min_best_width
85  m_originalColWidths[ i ] = std::max( min_width, min_best_width );
86  m_netclassGrid->SetColSize( i, m_originalColWidths[ i ] );
87  }
88 
89  // Be sure the column labels are readable
91 
92  // Membership combobox editors require a bit more room, so increase the row size of
93  // all our grids for consistency
94  m_netclassGrid->SetDefaultRowSize( m_netclassGrid->GetDefaultRowSize() + 4 );
95  m_membershipGrid->SetDefaultRowSize( m_membershipGrid->GetDefaultRowSize() + 4 );
96 
97  m_netclassGrid->PushEventHandler( new GRID_TRICKS( m_netclassGrid ) );
98  m_membershipGrid->PushEventHandler( new GRID_TRICKS( m_membershipGrid ) );
99 
100  m_netclassGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
101  m_membershipGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
102 
103  // Set up the net name column of the netclass membership grid to read-only
104  wxGridCellAttr* attr = new wxGridCellAttr;
105  attr->SetReadOnly( true );
106  m_membershipGrid->SetColAttr( 0, attr );
107 
108  m_addButton->SetBitmap( KiBitmap( small_plus_xpm ) );
109  m_removeButton->SetBitmap( KiBitmap( trash_xpm ) );
110 
111  // wxFormBuilder doesn't include this event...
112  m_netclassGrid->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging ), NULL, this );
113 
114  Thaw();
115 }
116 
117 
119 {
120  delete [] m_originalColWidths;
121 
122  // Delete the GRID_TRICKS.
123  m_netclassGrid->PopEventHandler( true );
124  m_membershipGrid->PopEventHandler( true );
125 
126  m_netclassGrid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging ), NULL, this );
127 }
128 
129 
130 static void netclassToGridRow( EDA_UNITS_T aUnits, wxGrid* aGrid, int aRow, const NETCLASSPTR& nc )
131 {
132  aGrid->SetCellValue( aRow, GRID_NAME, nc->GetName() );
133 
134 #define SET_MILS_CELL( col, val ) \
135  aGrid->SetCellValue( aRow, col, StringFromValue( aUnits, val, true, true ) )
136 
137  SET_MILS_CELL( GRID_CLEARANCE, nc->GetClearance() );
138  SET_MILS_CELL( GRID_TRACKSIZE, nc->GetTrackWidth() );
139  SET_MILS_CELL( GRID_VIASIZE, nc->GetViaDiameter() );
140  SET_MILS_CELL( GRID_VIADRILL, nc->GetViaDrill() );
141  SET_MILS_CELL( GRID_uVIASIZE, nc->GetuViaDiameter() );
142  SET_MILS_CELL( GRID_uVIADRILL, nc->GetuViaDrill() );
143  SET_MILS_CELL( GRID_DIFF_PAIR_WIDTH, nc->GetDiffPairWidth() );
144  SET_MILS_CELL( GRID_DIFF_PAIR_GAP, nc->GetDiffPairGap() );
145  // 6.0 TODO: SET_MILS_CELL( GRID_DIFF_PAIR_VIA_GAP, nc->GetDiffPairViaGap() );
146 }
147 
148 
150 {
151  NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
152  NETCLASSPTR netclass = netclasses.GetDefault();
153 
154  if( m_netclassGrid->GetNumberRows() )
155  m_netclassGrid->DeleteRows( 0, m_netclassGrid->GetNumberRows() );
156  m_netclassGrid->AppendRows( netclasses.GetCount() + 1 ); // + 1 for default netclass
157 
158  // enter the Default NETCLASS.
160 
161  // make the Default NETCLASS name read-only
162  wxGridCellAttr* cellAttr = m_netclassGrid->GetOrCreateCellAttr( 0, GRID_NAME );
163  cellAttr->SetReadOnly();
164  cellAttr->DecRef();
165 
166  // enter other netclasses
167  int row = 1;
168 
169  for( NETCLASSES::iterator i = netclasses.begin(); i != netclasses.end(); ++i, ++row )
171 
172  // ensure that all nets have net classes assigned
174 
175  if( m_membershipGrid->GetNumberRows() )
176  m_membershipGrid->DeleteRows( 0, m_membershipGrid->GetNumberRows() );
177 
178  for( NETINFO_ITEM* net : m_Pcb->GetNetInfo() )
179  {
180  if( net->GetNet() > 0 && net->IsCurrent() )
181  addNet( UnescapeString( net->GetNetname() ), net->GetNetClass()->GetName() );
182  }
183 
184  return true;
185 }
186 
187 
188 void PANEL_SETUP_NETCLASSES::addNet( wxString netName, const wxString& netclass )
189 {
190  int i = m_membershipGrid->GetNumberRows();
191 
192  m_membershipGrid->AppendRows( 1 );
193 
194  m_membershipGrid->SetCellValue( i, 0, netName );
195  m_membershipGrid->SetCellValue( i, 1, netclass );
196 }
197 
198 
199 /* Populates drop-downs with the list of net classes
200  */
202 {
204 
205  wxArrayString netclassNames;
206 
207  for( int ii = 0; ii < m_netclassGrid->GetNumberRows(); ii++ )
208  {
209  wxString netclassName = m_netclassGrid->GetCellValue( ii, GRID_NAME );
210  if( !netclassName.IsEmpty() )
211  netclassNames.push_back( netclassName );
212  }
213 
214  wxGridCellAttr* attr = new wxGridCellAttr;
215  attr->SetEditor( new wxGridCellChoiceEditor( netclassNames ) );
216  m_membershipGrid->SetColAttr( 1, attr );
217 
218  m_assignNetClass->Set( netclassNames );
219 
220  netclassNames.Insert( wxEmptyString, 0 );
221  m_netClassFilter->Set( netclassNames );
222 }
223 
224 
225 static void gridRowToNetclass( EDA_UNITS_T aUnits, wxGrid* grid, int row, const NETCLASSPTR& nc )
226 {
227  nc->SetName( grid->GetCellValue( row, GRID_NAME ) );
228 
229 #define MYCELL( col ) \
230  ValueFromString( aUnits, grid->GetCellValue( row, col ), true )
231 
232  nc->SetClearance( MYCELL( GRID_CLEARANCE ) );
233  nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) );
234  nc->SetViaDiameter( MYCELL( GRID_VIASIZE ) );
235  nc->SetViaDrill( MYCELL( GRID_VIADRILL ) );
236  nc->SetuViaDiameter( MYCELL( GRID_uVIASIZE ) );
237  nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) );
238  nc->SetDiffPairWidth( MYCELL( GRID_DIFF_PAIR_WIDTH ) );
239  nc->SetDiffPairGap( MYCELL( GRID_DIFF_PAIR_GAP ) );
240  // 6.0 TODO: nc->SetDiffPairViaGap( MYCELL( GRID_DIFF_PAIR_VIA_GAP ) );
241 }
242 
243 
245 {
246  if( !validateData() )
247  return false;
248 
249  NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
250 
251  // Remove all netclasses from board. We'll copy new list after
252  netclasses.Clear();
253 
254  // Copy the default NetClass:
256 
257  // Copy other NetClasses :
258  for( int row = 1; row < m_netclassGrid->GetNumberRows(); ++row )
259  {
260  NETCLASSPTR nc = std::make_shared<NETCLASS>( m_netclassGrid->GetCellValue( row, GRID_NAME ) );
261 
262  if( m_BrdSettings->m_NetClasses.Add( nc ) )
264  }
265 
266  // Now read all nets and push them in the corresponding netclass net buffer
267  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
268  {
269  NETCLASSPTR nc = netclasses.Find( m_membershipGrid->GetCellValue( row, 1 ) );
270 
271  if( nc )
272  nc->Add( m_membershipGrid->GetCellValue( row, 0 ) );
273  }
274 
277 
278  if( auto toolmgr = m_Frame->GetToolManager() )
279  toolmgr->ResetTools( TOOL_BASE::MODEL_RELOAD );
280 
281  return true;
282 }
283 
284 
285 bool PANEL_SETUP_NETCLASSES::validateNetclassName( int aRow, wxString aName, bool focusFirst )
286 {
287  aName.Trim( true );
288  aName.Trim( false );
289 
290  if( aName.IsEmpty() )
291  {
292  wxString msg = _( "Netclass must have a name." );
293  m_Parent->SetError( msg, this, m_netclassGrid, aRow, GRID_NAME );
294  return false;
295  }
296 
297  for( int ii = 0; ii < m_netclassGrid->GetNumberRows(); ii++ )
298  {
299  if( ii != aRow && m_netclassGrid->GetRowLabelValue( ii ).CmpNoCase( aName ) == 0 )
300  {
301  wxString msg = _( "Netclass name already in use." );
302  m_Parent->SetError( msg, this, m_netclassGrid, focusFirst ? aRow : ii, GRID_NAME );
303  return false;
304  }
305  }
306 
307  return true;
308 }
309 
310 
312 {
313  if( event.GetCol() == GRID_NAME )
314  {
315  if( validateNetclassName( event.GetRow(), event.GetString() ) )
316  m_netclassesDirty = true;
317  else
318  event.Veto();
319  }
320 }
321 
322 
323 void PANEL_SETUP_NETCLASSES::OnAddNetclassClick( wxCommandEvent& event )
324 {
326  return;
327 
328  int row = m_netclassGrid->GetNumberRows();
329  m_netclassGrid->AppendRows();
330 
331  // Copy values of the default class:
332  for( int col = 1; col < m_netclassGrid->GetNumberCols(); col++ )
333  m_netclassGrid->SetCellValue( row, col, m_netclassGrid->GetCellValue( 0, col ) );
334 
335  m_netclassGrid->MakeCellVisible( row, 0 );
336  m_netclassGrid->SetGridCursor( row, 0 );
337 
338  m_netclassGrid->EnableCellEditControl( true );
339  m_netclassGrid->ShowCellEditControl();
340 
341  m_netclassesDirty = true;
342 }
343 
344 
346 {
348  return;
349 
350  int curRow = m_netclassGrid->GetGridCursorRow();
351 
352  if( curRow < 0 )
353  return;
354  else if( curRow == 0 )
355  {
356  DisplayErrorMessage( this, _( "The default net class is required." ) );
357  return;
358  }
359 
360  // reset the net class to default for members of the removed class
361  wxString classname = m_netclassGrid->GetCellValue( curRow, GRID_NAME );
362 
363  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
364  {
365  if( m_membershipGrid->GetCellValue( row, 1 ) == classname )
366  m_membershipGrid->SetCellValue( row, 1, NETCLASS::Default );
367  }
368 
369  m_netclassGrid->DeleteRows( curRow, 1 );
370 
371  m_netclassGrid->MakeCellVisible( std::max( 0, curRow-1 ), m_netclassGrid->GetGridCursorCol() );
372  m_netclassGrid->SetGridCursor( std::max( 0, curRow-1 ), m_netclassGrid->GetGridCursorCol() );
373 
374  m_netclassesDirty = true;
375 }
376 
377 
379 {
380  // Account for scroll bars
381  aWidth -= ( m_netclassGrid->GetSize().x - m_netclassGrid->GetClientSize().x );
382 
383  for( int i = 1; i < m_netclassGrid->GetNumberCols(); i++ )
384  {
385  m_netclassGrid->SetColSize( i, m_originalColWidths[ i ] );
386  aWidth -= m_originalColWidths[ i ];
387  }
388 
389  m_netclassGrid->SetColSize( 0, std::max( aWidth, m_originalColWidths[ 0 ] ) );
390 }
391 
392 
394 {
395  AdjustNetclassGridColumns( event.GetSize().GetX() );
396 
397  event.Skip();
398 }
399 
400 
402 {
403  // Account for scroll bars
404  aWidth -= ( m_membershipGrid->GetSize().x - m_membershipGrid->GetClientSize().x );
405 
406  // Set className column width to original className width from netclasses grid
407  int classNameWidth = m_originalColWidths[ 0 ];
408  m_membershipGrid->SetColSize( 1, m_originalColWidths[ 0 ] );
409  m_membershipGrid->SetColSize( 0, std::max( aWidth - classNameWidth, classNameWidth ) );
410 }
411 
412 
414 {
415  AdjustMembershipGridColumns( event.GetSize().GetX() );
416 
417  event.Skip();
418 }
419 
420 
422 {
424  return;
425 
426  wxString netClassFilter = m_netClassFilter->GetStringSelection();
427  wxString netFilter = m_netNameFilter->GetValue().MakeLower();
428 
429  if( !netFilter.IsEmpty() )
430  netFilter = wxT( "*" ) + netFilter + wxT( "*" );
431 
432  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
433  {
434  wxString net = m_membershipGrid->GetCellValue( row, 0 );
435  wxString netClass = m_membershipGrid->GetCellValue( row, 1 );
436  bool show = true;
437 
438  if( !aShowAll )
439  {
440  if( !netFilter.IsEmpty() && !net.MakeLower().Matches( netFilter ) )
441  show = false;
442 
443  if( !netClassFilter.IsEmpty() && netClass != netClassFilter )
444  show = false;
445  }
446 
447  if( show )
448  m_membershipGrid->ShowRow( row );
449  else
450  m_membershipGrid->HideRow( row );
451  }
452 }
453 
454 
456 {
458  return;
459 
460  wxArrayInt selectedRows = m_membershipGrid->GetSelectedRows();
461 
462  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
463  {
464  if( !m_membershipGrid->IsRowShown( row ) )
465  continue;
466 
467  if( !aAssignAll && selectedRows.Index( row ) == wxNOT_FOUND )
468  continue;
469 
470  m_membershipGrid->SetCellValue( row, 1, m_assignNetClass->GetStringSelection() );
471  }
472 }
473 
474 
475 void PANEL_SETUP_NETCLASSES::OnUpdateUI( wxUpdateUIEvent& event )
476 {
477  if( m_netclassesDirty )
478  {
480  m_netclassesDirty = false;
481  }
482 
483  // Recompute the desired size for the two content panes. We cannot leave this sizing to
484  // wxWidgets because it wants to shrink the membership panel to an unusable size when the
485  // netlist panel grows, and also it introduces undesired artifacts when the window is resized
486  // and the panes can grow/shrink.
487  wxSize netclassSize = GetClientSize();
488  netclassSize.y -= m_membershipSize.y;
489 
490  m_netclassesPane->SetMinSize( netclassSize );
491  m_netclassesPane->SetMaxSize( netclassSize );
492  Layout();
493 }
494 
495 
497 {
498  return ValueFromString( m_Frame->GetUserUnits(), m_netclassGrid->GetCellValue( aRow, aCol ), true );
499 }
500 
501 
503 {
505  return false;
506 
507  wxString msg;
508  int minViaDia = m_ConstraintsPanel->m_viaMinSize.GetValue();
509  int minViaDrill = m_ConstraintsPanel->m_viaMinDrill.GetValue();
510  int minUViaDia = m_ConstraintsPanel->m_uviaMinSize.GetValue();
511  int minUViaDrill = m_ConstraintsPanel->m_uviaMinDrill.GetValue();
512  int minTrackWidth = m_ConstraintsPanel->m_trackMinWidth.GetValue();
513 
514  // Test net class parameters.
515  for( int row = 0; row < m_netclassGrid->GetNumberRows(); row++ )
516  {
517  wxString netclassName = m_netclassGrid->GetCellValue( row, GRID_NAME );
518  netclassName.Trim( true );
519  netclassName.Trim( false );
520 
521  if( !validateNetclassName( row, netclassName, false ) )
522  return false;
523 
524  if( getNetclassValue( row, GRID_TRACKSIZE ) < minTrackWidth )
525  {
526  msg.Printf( _( "Track width less than minimum track width (%s)." ),
527  StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) );
528  m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_TRACKSIZE );
529  return false;
530  }
531 
532  if( getNetclassValue( row, GRID_DIFF_PAIR_WIDTH ) < minTrackWidth )
533  {
534  msg.Printf( _( "Differential pair width less than minimum track width (%s)." ),
535  StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) );
537  return false;
538  }
539 
540  // Test vias
541  if( getNetclassValue( row, GRID_VIASIZE ) < minViaDia )
542  {
543  msg.Printf( _( "Via diameter less than minimum via diameter (%s)." ),
544  StringFromValue( m_Frame->GetUserUnits(), minViaDia, true, true ) );
545  m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIASIZE );
546  return false;
547  }
548 
550  {
551  msg = _( "Via drill larger than via diameter." );
552  m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIADRILL );
553  return false;
554  }
555 
556  if( getNetclassValue( row, GRID_VIADRILL ) < minViaDrill )
557  {
558  msg.Printf( _( "Via drill less than minimum via drill (%s)." ),
559  StringFromValue( m_Frame->GetUserUnits(), minViaDrill, true, true ) );
560  m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIADRILL );
561  return false;
562  }
563 
564  // Test Micro vias
565  if( getNetclassValue( row, GRID_uVIASIZE ) < minUViaDia )
566  {
567  msg.Printf( _( "Microvia diameter less than minimum microvia diameter (%s)." ),
568  StringFromValue( m_Frame->GetUserUnits(), minUViaDia, true, true ) );
569  m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_uVIASIZE );
570  return false;
571  }
572 
574  {
575  msg = _( "Microvia drill larger than microvia diameter." );
576  m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_uVIADRILL );
577  return false;
578  }
579 
580  if( getNetclassValue( row, GRID_uVIADRILL ) < minUViaDrill )
581  {
582  msg.Printf( _( "Microvia drill less than minimum microvia drill (%s)." ),
583  StringFromValue( m_Frame->GetUserUnits(), minUViaDrill, true, true ) );
584  m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_uVIADRILL );
585  return false;
586  }
587  }
588 
589  return true;
590 }
591 
592 
594 {
595  // Note: do not change the board, as we need to get the current nets from it for
596  // netclass memberships. All the netclass definitions and dimension lists are in
597  // the BOARD_DESIGN_SETTINGS.
598 
599  BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
600 
601  m_BrdSettings = &aBoard->GetDesignSettings();
603 
604  m_netclassGrid->ForceRefresh();
605  m_membershipGrid->ForceRefresh();
606 
607  m_BrdSettings = savedSettings;
608 }
609 
610 
void BuildListOfNets()
Definition: class_board.h:729
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
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)
Display an error message with aMessage.
Definition: confirm.cpp:258
Model changes (required full reload)
Definition: tool_base.h:82
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:540
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:414
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)
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:750
#define _(s)
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:65
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
EDA_UNITS_T GetUserUnits() const
Return the user units currently in use.
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:161
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:123
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:154
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)