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