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-2020 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 <netclass.h>
29 #include <confirm.h>
30 #include <grid_tricks.h>
31 #include <panel_setup_netclasses.h>
32 #include <tool/tool_manager.h>
33 #include <widgets/grid_combobox.h>
34 #include <widgets/wx_grid.h>
35 #include <kicad_string.h>
39 
40 #include <algorithm>
41 
42 // PCBNEW columns of netclasses grid
43 enum {
44  GRID_NAME = 0,
45 
55 
61 
63 };
64 
65 
66 // These are conceptually constexpr
67 std::vector<BITMAP_DEF> g_lineStyleIcons;
68 wxArrayString g_lineStyleNames;
69 
70 
72  const std::vector<wxString>& aNetNames,
73  bool aIsEEschema ) :
74  PANEL_SETUP_NETCLASSES_BASE( aParent->GetTreebook() ),
75  m_Parent( aParent ),
76  m_netclasses( aNetclasses ),
77  m_netNames( aNetNames )
78 {
79  if( g_lineStyleIcons.empty() )
80  {
82  g_lineStyleNames.push_back( _( "Solid" ) );
83  g_lineStyleIcons.push_back( stroke_dash_xpm );
84  g_lineStyleNames.push_back( _( "Dashed" ) );
85  g_lineStyleIcons.push_back( stroke_dot_xpm );
86  g_lineStyleNames.push_back( _( "Dotted" ) );
88  g_lineStyleNames.push_back( _( "Dash-Dot" ) );
89  }
90 
91  m_netclassesDirty = true;
92 
93  // Figure out the smallest the netclass membership pane can ever be so that nothing is cutoff
94  // and force it to be that size.
95  m_membershipSize = GetSize();
96  m_membershipSize.y -= m_netclassesPane->GetSize().y;
97  m_membershipSize.x = -1;
98  m_membershipPane->SetMinSize( m_membershipSize );
99  m_membershipPane->SetMaxSize( m_membershipSize );
100 
101  // Prevent Size events from firing before we are ready
102  Freeze();
103  m_netclassGrid->BeginBatch();
104  m_membershipGrid->BeginBatch();
105 
106  m_originalColWidths = new int[ m_netclassGrid->GetNumberCols() ];
107  // Calculate a min best size to handle longest usual numeric values:
108  int min_best_width = m_netclassGrid->GetTextExtent( "555,555555 mils" ).x;
109 
110  for( int i = 0; i < m_netclassGrid->GetNumberCols(); ++i )
111  {
112  // We calculate the column min size only from texts sizes, not using the initial col width
113  // as this initial width is sometimes strange depending on the language (wxGrid bug?)
114  int min_width = m_netclassGrid->GetVisibleWidth( i, true, true, false );
115 
116  if( i == GRID_LINESTYLE )
117  min_best_width *= 1.5;
118 
119  m_netclassGrid->SetColMinimalWidth( i, min_width );
120 
121  // We use a "best size" >= min_best_width
122  m_originalColWidths[ i ] = std::max( min_width, min_best_width );
123  m_netclassGrid->SetColSize( i, m_originalColWidths[ i ] );
124  }
125 
126  if( aIsEEschema )
127  {
128  for( int i = GRID_FIRST_PCBNEW; i < GRID_FIRST_EESCHEMA; ++i )
129  {
130  m_netclassGrid->HideCol( i );
131  m_originalColWidths[ i ] = 0;
132  }
133 
134  wxGridCellAttr* attr = new wxGridCellAttr;
135  attr->SetRenderer( new GRID_CELL_COLOR_RENDERER( aParent ) );
136  attr->SetEditor( new GRID_CELL_COLOR_SELECTOR( aParent, m_netclassGrid ) );
137  m_netclassGrid->SetColAttr( GRID_SCHEMATIC_COLOR, attr );
138 
139  attr = new wxGridCellAttr;
142  m_netclassGrid->SetColAttr( GRID_LINESTYLE, attr );
143  }
144  else
145  {
146  for( int i = GRID_FIRST_EESCHEMA; i < GRID_END; ++i )
147  {
148  m_netclassGrid->HideCol( i );
149  m_originalColWidths[ i ] = 0;
150  }
151  }
152 
153  // Be sure the column labels are readable
155 
156  // Membership combobox editors require a bit more room, so increase the row size of
157  // all our grids for consistency
158  m_netclassGrid->SetDefaultRowSize( m_netclassGrid->GetDefaultRowSize() + 4 );
159  m_membershipGrid->SetDefaultRowSize( m_membershipGrid->GetDefaultRowSize() + 4 );
160 
161  m_netclassGrid->PushEventHandler( new GRID_TRICKS( m_netclassGrid ) );
162  m_membershipGrid->PushEventHandler( new GRID_TRICKS( m_membershipGrid ) );
163 
164  m_netclassGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
165  m_membershipGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
166 
167  // Set up the net name column of the netclass membership grid to read-only
168  wxGridCellAttr* attr = new wxGridCellAttr;
169  attr->SetReadOnly( true );
170  attr->SetRenderer( new GRID_CELL_ESCAPED_TEXT_RENDERER );
171  m_membershipGrid->SetColAttr( 0, attr );
172 
173  m_addButton->SetBitmap( KiBitmap( small_plus_xpm ) );
174  m_removeButton->SetBitmap( KiBitmap( trash_xpm ) );
175 
176  // wxFormBuilder doesn't include this event...
177  m_netclassGrid->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging ), NULL, this );
178 
179  m_netclassGrid->EndBatch();
180  m_membershipGrid->EndBatch();
181  Thaw();
182 }
183 
184 
186 {
187  delete [] m_originalColWidths;
188 
189  // Delete the GRID_TRICKS.
190  m_netclassGrid->PopEventHandler( true );
191  m_membershipGrid->PopEventHandler( true );
192 
193  m_netclassGrid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging ), NULL, this );
194 }
195 
196 
197 static void netclassToGridRow( EDA_UNITS aUnits, wxGrid* aGrid, int aRow, const NETCLASSPTR& nc )
198 {
199  aGrid->SetCellValue( aRow, GRID_NAME, nc->GetName() );
200 
201 #define SET_MILS_CELL( col, val ) \
202  aGrid->SetCellValue( aRow, col, StringFromValue( aUnits, val, true, true ) )
203 
204  SET_MILS_CELL( GRID_CLEARANCE, nc->GetClearance() );
205  SET_MILS_CELL( GRID_TRACKSIZE, nc->GetTrackWidth() );
206  SET_MILS_CELL( GRID_VIASIZE, nc->GetViaDiameter() );
207  SET_MILS_CELL( GRID_VIADRILL, nc->GetViaDrill() );
208  SET_MILS_CELL( GRID_uVIASIZE, nc->GetuViaDiameter() );
209  SET_MILS_CELL( GRID_uVIADRILL, nc->GetuViaDrill() );
210  SET_MILS_CELL( GRID_DIFF_PAIR_WIDTH, nc->GetDiffPairWidth() );
211  SET_MILS_CELL( GRID_DIFF_PAIR_GAP, nc->GetDiffPairGap() );
212 
213  SET_MILS_CELL( GRID_WIREWIDTH, nc->GetWireWidth() );
214  SET_MILS_CELL( GRID_BUSWIDTH, nc->GetBusWidth() );
215 
216  wxString colorAsString = nc->GetSchematicColor().ToWxString( wxC2S_CSS_SYNTAX );
217  aGrid->SetCellValue( aRow, GRID_SCHEMATIC_COLOR, colorAsString );
218  aGrid->SetCellValue( aRow, GRID_LINESTYLE, g_lineStyleNames[ nc->GetLineStyle() ] );
219 }
220 
221 
223 {
224  std::map<wxString, wxString> netToNetclassMap;
225  std::map<wxString, wxString> staleNetMap;
226 
227  for( const wxString& candidate : m_netNames )
228  netToNetclassMap[ candidate ] = wxEmptyString;
229 
230  if( m_netclassGrid->GetNumberRows() )
231  m_netclassGrid->DeleteRows( 0, m_netclassGrid->GetNumberRows() );
232 
233  m_netclassGrid->AppendRows((int) m_netclasses->GetCount() + 1 ); // + 1 for default netclass
234 
235  // enter the Default NETCLASS.
237 
238  // make the Default NETCLASS name read-only
239  wxGridCellAttr* cellAttr = m_netclassGrid->GetOrCreateCellAttr( 0, GRID_NAME );
240  cellAttr->SetReadOnly();
241  cellAttr->DecRef();
242 
243  // enter other netclasses
244  int row = 1;
245 
246  for( NETCLASSES::iterator i = m_netclasses->begin(); i != m_netclasses->end(); ++i, ++row )
247  {
248  NETCLASSPTR netclass = i->second;
249 
251 
252  for( const wxString& net : *netclass )
253  {
254  if( netToNetclassMap.count( net ) )
255  netToNetclassMap[ net ] = i->second->GetName();
256  else
257  staleNetMap[ net ] = i->second->GetName();
258  }
259  }
260 
261  if( m_membershipGrid->GetNumberRows() )
262  m_membershipGrid->DeleteRows( 0, m_membershipGrid->GetNumberRows() );
263 
264  // add currently-assigned and candidate netnames to membership lists
265  for( const std::pair<const wxString, wxString>& ii : netToNetclassMap )
266  addNet( ii.first, ii.second, false );
267 
268  for( const std::pair<const wxString, wxString>& ii : staleNetMap )
269  addNet( ii.first, ii.second, true );
270 
271  return true;
272 }
273 
274 
275 void PANEL_SETUP_NETCLASSES::addNet( const wxString& netName, const wxString& netclass,
276  bool aStale )
277 {
278  int i = m_membershipGrid->GetNumberRows();
279 
280  m_membershipGrid->AppendRows( 1 );
281 
282  m_membershipGrid->SetCellValue( i, 0, netName );
283 
284  if( aStale )
285  {
286  wxColour color = wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT );
287  m_membershipGrid->SetCellTextColour( i, 0, color );
288  }
289 
290  if( netclass.IsEmpty() )
291  m_membershipGrid->SetCellValue( i, 1, NETCLASS::Default );
292  else
293  m_membershipGrid->SetCellValue( i, 1, netclass );
294 }
295 
296 
297 /*
298  * Populates drop-downs with the list of net classes
299  */
301 {
303 
304  wxArrayString netclassNames;
305 
306  for( int ii = 0; ii < m_netclassGrid->GetNumberRows(); ii++ )
307  {
308  wxString netclassName = m_netclassGrid->GetCellValue( ii, GRID_NAME );
309 
310  if( !netclassName.IsEmpty() )
311  netclassNames.push_back( netclassName );
312  }
313 
314  wxGridCellAttr* attr = new wxGridCellAttr;
315  attr->SetEditor( new wxGridCellChoiceEditor( netclassNames ) );
316  m_membershipGrid->SetColAttr( 1, attr );
317 
318  m_assignNetClass->Set( netclassNames );
319 
320  netclassNames.Insert( wxEmptyString, 0 );
321  m_netClassFilter->Set( netclassNames );
322 }
323 
324 
325 static void gridRowToNetclass( EDA_UNITS aUnits, wxGrid* grid, int row, const NETCLASSPTR& nc )
326 {
327  nc->SetName( grid->GetCellValue( row, GRID_NAME ) );
328 
329 #define MYCELL( col ) \
330  ValueFromString( aUnits, grid->GetCellValue( row, col ), true )
331 
332  nc->SetClearance( MYCELL( GRID_CLEARANCE ) );
333  nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) );
334  nc->SetViaDiameter( MYCELL( GRID_VIASIZE ) );
335  nc->SetViaDrill( MYCELL( GRID_VIADRILL ) );
336  nc->SetuViaDiameter( MYCELL( GRID_uVIASIZE ) );
337  nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) );
338  nc->SetDiffPairWidth( MYCELL( GRID_DIFF_PAIR_WIDTH ) );
339  nc->SetDiffPairGap( MYCELL( GRID_DIFF_PAIR_GAP ) );
340 
341  nc->SetWireWidth( MYCELL( GRID_WIREWIDTH ) );
342  nc->SetBusWidth( MYCELL( GRID_BUSWIDTH ) );
343 
344  nc->SetSchematicColor( wxColour( grid->GetCellValue( row, GRID_SCHEMATIC_COLOR ) ) );
345  nc->SetLineStyle( g_lineStyleNames.Index( grid->GetCellValue( row, GRID_LINESTYLE ) ) );
346 }
347 
348 
350 {
351  if( !validateData() )
352  return false;
353 
354  m_netclasses->Clear();
355 
356  // Copy the default NetClass:
358 
359  // Copy other NetClasses:
360  for( int row = 1; row < m_netclassGrid->GetNumberRows(); ++row )
361  {
362  NETCLASSPTR nc = std::make_shared<NETCLASS>( m_netclassGrid->GetCellValue( row, GRID_NAME ) );
363 
364  if( m_netclasses->Add( nc ) )
366  }
367 
368  // Now read all nets and push them in the corresponding netclass net buffer
369  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
370  {
371  const wxString& netname = m_membershipGrid->GetCellValue( row, 0 );
372  const wxString& classname = m_membershipGrid->GetCellValue( row, 1 );
373 
374  if( classname != NETCLASS::Default )
375  {
376  const NETCLASSPTR& nc = m_netclasses->Find( classname );
377 
378  if( nc )
379  nc->Add( netname );
380  }
381  }
382 
383  return true;
384 }
385 
386 
387 bool PANEL_SETUP_NETCLASSES::validateNetclassName( int aRow, wxString aName, bool focusFirst )
388 {
389  aName.Trim( true );
390  aName.Trim( false );
391 
392  if( aName.IsEmpty() )
393  {
394  wxString msg = _( "Netclass must have a name." );
395  m_Parent->SetError( msg, this, m_netclassGrid, aRow, GRID_NAME );
396  return false;
397  }
398 
399  for( int ii = 0; ii < m_netclassGrid->GetNumberRows(); ii++ )
400  {
401  if( ii != aRow && m_netclassGrid->GetCellValue( ii, GRID_NAME ).CmpNoCase( aName ) == 0 )
402  {
403  wxString msg = _( "Netclass name already in use." );
404  m_Parent->SetError( msg, this, m_netclassGrid, focusFirst ? aRow : ii, GRID_NAME );
405  return false;
406  }
407  }
408 
409  return true;
410 }
411 
412 
414 {
415  if( event.GetCol() == GRID_NAME )
416  {
417  if( validateNetclassName( event.GetRow(), event.GetString() ) )
418  {
419  wxString oldName = m_netclassGrid->GetCellValue( event.GetRow(), GRID_NAME );
420  wxString newName = event.GetString();
421 
422  if( !oldName.IsEmpty() )
423  {
424  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
425  {
426  if( m_membershipGrid->GetCellValue( row, 1 ) == oldName )
427  m_membershipGrid->SetCellValue( row, 1, newName );
428  }
429  }
430 
431  m_netclassesDirty = true;
432  }
433  else
434  {
435  event.Veto();
436  }
437  }
438 }
439 
440 
441 void PANEL_SETUP_NETCLASSES::OnAddNetclassClick( wxCommandEvent& event )
442 {
444  return;
445 
446  int row = m_netclassGrid->GetNumberRows();
447  m_netclassGrid->AppendRows();
448 
449  // Copy values of the default class:
450  for( int col = 1; col < m_netclassGrid->GetNumberCols(); col++ )
451  m_netclassGrid->SetCellValue( row, col, m_netclassGrid->GetCellValue( 0, col ) );
452 
453  m_netclassGrid->MakeCellVisible( row, 0 );
454  m_netclassGrid->SetGridCursor( row, 0 );
455 
456  m_netclassGrid->EnableCellEditControl( true );
457  m_netclassGrid->ShowCellEditControl();
458 
459  m_netclassesDirty = true;
460 }
461 
462 
464 {
466  return;
467 
468  int curRow = m_netclassGrid->GetGridCursorRow();
469 
470  if( curRow < 0 )
471  return;
472  else if( curRow == 0 )
473  {
474  DisplayErrorMessage( this, _( "The default net class is required." ) );
475  return;
476  }
477 
478  // reset the net class to default for members of the removed class
479  wxString classname = m_netclassGrid->GetCellValue( curRow, GRID_NAME );
480 
481  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
482  {
483  if( m_membershipGrid->GetCellValue( row, 1 ) == classname )
484  m_membershipGrid->SetCellValue( row, 1, NETCLASS::Default );
485  }
486 
487  m_netclassGrid->DeleteRows( curRow, 1 );
488 
489  m_netclassGrid->MakeCellVisible( std::max( 0, curRow-1 ), m_netclassGrid->GetGridCursorCol() );
490  m_netclassGrid->SetGridCursor( std::max( 0, curRow-1 ), m_netclassGrid->GetGridCursorCol() );
491 
492  m_netclassesDirty = true;
493 }
494 
495 
497 {
498  // Account for scroll bars
499  aWidth -= ( m_netclassGrid->GetSize().x - m_netclassGrid->GetClientSize().x );
500 
501  for( int i = 1; i < m_netclassGrid->GetNumberCols(); i++ )
502  {
503  m_netclassGrid->SetColSize( i, m_originalColWidths[ i ] );
504  aWidth -= m_originalColWidths[ i ];
505  }
506 
507  m_netclassGrid->SetColSize( 0, std::max( aWidth - 2, m_originalColWidths[ 0 ] ) );
508 }
509 
510 
512 {
513  AdjustNetclassGridColumns( event.GetSize().GetX() );
514 
515  event.Skip();
516 }
517 
518 
520 {
521  // Account for scroll bars
522  aWidth -= ( m_membershipGrid->GetSize().x - m_membershipGrid->GetClientSize().x );
523 
524  // Set className column width to original className width from netclasses grid
525  int classNameWidth = m_originalColWidths[ 0 ];
526  m_membershipGrid->SetColSize( 1, m_originalColWidths[ 0 ] );
527  m_membershipGrid->SetColSize( 0, std::max( aWidth - classNameWidth, classNameWidth ) );
528 }
529 
530 
532 {
533  AdjustMembershipGridColumns( event.GetSize().GetX() );
534 
535  event.Skip();
536 }
537 
538 
540 {
542  return;
543 
544  wxString netClassFilter = m_netClassFilter->GetStringSelection();
545  wxString netFilter = m_netNameFilter->GetValue().MakeLower();
546 
547  if( !netFilter.IsEmpty() )
548  netFilter = wxT( "*" ) + netFilter + wxT( "*" );
549 
550  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
551  {
552  wxString net = m_membershipGrid->GetCellValue( row, 0 );
553  wxString netClass = m_membershipGrid->GetCellValue( row, 1 );
554  bool show = true;
555 
556  if( !aShowAll )
557  {
558  if( !netFilter.IsEmpty() && !net.MakeLower().Matches( netFilter ) )
559  show = false;
560 
561  if( !netClassFilter.IsEmpty() && netClass != netClassFilter )
562  show = false;
563  }
564 
565  if( show )
566  m_membershipGrid->ShowRow( row );
567  else
568  m_membershipGrid->HideRow( row );
569  }
570 }
571 
572 
574 {
576  return;
577 
578  wxArrayInt selectedRows = m_membershipGrid->GetSelectedRows();
579 
580  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
581  {
582  if( !m_membershipGrid->IsRowShown( row ) )
583  continue;
584 
585  if( !aAssignAll && selectedRows.Index( row ) == wxNOT_FOUND )
586  continue;
587 
588  m_membershipGrid->SetCellValue( row, 1, m_assignNetClass->GetStringSelection() );
589  }
590 }
591 
592 
593 void PANEL_SETUP_NETCLASSES::OnUpdateUI( wxUpdateUIEvent& event )
594 {
595  if( m_netclassesDirty )
596  {
598  m_netclassesDirty = false;
599  }
600 
601  // Recompute the desired size for the two content panes. We cannot leave this sizing to
602  // wxWidgets because it wants to shrink the membership panel to an unusable size when the
603  // netlist panel grows, and also it introduces undesired artifacts when the window is resized
604  // and the panes can grow/shrink.
605  wxSize netclassSize = GetClientSize();
606  netclassSize.y -= m_membershipSize.y;
607 
608  // Modify m_netclassesPane size only if needed, because calling Layout() has the annoying
609  // effect of closing any open wxChoice dropdowns. So it cannot blindly called inside each
610  // wxUpdateUIEvent event, at least on Windows + wxWidgets 3.0 (not an issue with 3.1.1).
611  if( netclassSize.y != m_netclassesPane->GetSize().y )
612  {
613  m_netclassesPane->SetMinSize( netclassSize );
614  m_netclassesPane->SetMaxSize( netclassSize );
615  Layout();
616  }
617 }
618 
619 
621 {
623  return false;
624 
625  wxString msg;
626 
627  // Test net class parameters.
628  for( int row = 0; row < m_netclassGrid->GetNumberRows(); row++ )
629  {
630  wxString netclassName = m_netclassGrid->GetCellValue( row, GRID_NAME );
631  netclassName.Trim( true );
632  netclassName.Trim( false );
633 
634  if( !validateNetclassName( row, netclassName, false ) )
635  return false;
636  }
637 
638  return true;
639 }
640 
641 
643 {
644  NETCLASSES* savedSettings = m_netclasses;
645 
646  m_netclasses = aNetclasses;
648 
650 
651  m_netclassGrid->ForceRefresh();
652  m_membershipGrid->ForceRefresh();
653 
654  m_netclasses = savedSettings;
655 }
656 
657 
EDA_UNITS
Definition: common.h:198
PANEL_SETUP_NETCLASSES(PAGED_DIALOG *aParent, NETCLASSES *aNetclasses, const std::vector< wxString > &aNetNames, bool isEEschema)
const BITMAP_OPAQUE trash_xpm[1]
Definition: trash.cpp:46
const BITMAP_OPAQUE stroke_dot_xpm[1]
Definition: stroke_dot.cpp:29
NETCLASSPTR Find(const wxString &aName) const
Function Find searches this container for a NETCLASS given by aName.
Definition: netclass.cpp:132
void OnSizeNetclassGrid(wxSizeEvent &event) override
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:252
Implementation of conversion functions that require both schematic and board internal units.
This file is part of the common library.
int color
Definition: DXF_plotter.cpp:61
#define SET_MILS_CELL(col, val)
GRID_TRICKS is used to add mouse and command handling (such as cut, copy, and paste) to a WX_GRID ins...
Definition: grid_tricks.h:51
iterator end()
Definition: netclass.h:245
void SetError(const wxString &aMessage, const wxString &aPageName, int aCtrlId, int aRow=-1, int aCol=-1)
void addNet(const wxString &netName, const wxString &netclass, bool aStale)
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:236
std::vector< wxString > m_netNames
EDA_UNITS GetUserUnits() const
Definition: dialog_shim.h:131
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
NETCLASS_MAP::iterator iterator
Definition: netclass.h:243
iterator begin()
Definition: netclass.h:244
NETCLASSES is a container for NETCLASS instances.
Definition: netclass.h:222
#define NULL
std::vector< BITMAP_DEF > g_lineStyleIcons
static const char Default[]
the name of the default NETCLASS
Definition: netclass.h:80
const BITMAP_OPAQUE stroke_dash_xpm[1]
Definition: stroke_dash.cpp:25
void EnsureColLabelsVisible()
Ensure the height of the row displaying the column labels is enough, even if labels are multiline tex...
Definition: wx_grid.cpp:278
void OnNetclassGridCellChanging(wxGridEvent &event)
static void gridRowToNetclass(EDA_UNITS aUnits, wxGrid *grid, int row, const NETCLASSPTR &nc)
const BITMAP_OPAQUE stroke_dashdot_xpm[1]
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:180
Class PANEL_SETUP_NETCLASSES_BASE.
bool Add(const NETCLASSPTR &aNetclass)
Function Add takes aNetclass and puts it into this NETCLASSES container.
Definition: netclass.cpp:90
void Clear()
Function Clear destroys any contained NETCLASS instances except the Default one, and clears any membe...
Definition: netclass.h:237
#define _(s)
Definition: 3d_actions.cpp:33
unsigned GetCount() const
Function GetCount.
Definition: netclass.h:255
static void netclassToGridRow(EDA_UNITS aUnits, wxGrid *aGrid, int aRow, const NETCLASSPTR &nc)
NETCLASSPTR GetDefault() const
Function GetDefault.
Definition: netclass.h:264
wxArrayString g_lineStyleNames
const BITMAP_OPAQUE stroke_solid_xpm[1]
void ImportSettingsFrom(NETCLASSES *aBoard)
void OnUpdateUI(wxUpdateUIEvent &event) override
bool validateNetclassName(int aRow, wxString aName, bool focusFirst=true)
#define MYCELL(col)
const BITMAP_OPAQUE small_plus_xpm[1]
Definition: small_plus.cpp:20
void OnSizeMembershipGrid(wxSizeEvent &event) override
void OnRemoveNetclassClick(wxCommandEvent &event) override
void AdjustNetclassGridColumns(int aWidth)
void AdjustMembershipGridColumns(int aWidth)
void OnAddNetclassClick(wxCommandEvent &event) override
A text renderer that can unescape text for display This is useful where it's desired to keep the unde...
void doApplyFilters(bool aShowAll)