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>
38 
39 #include <algorithm>
40 
41 // PCBNEW columns of netclasses grid
42 enum {
43  GRID_NAME = 0,
44 
54 
60 
62 };
63 
64 
65 // These are conceptually constexpr
66 std::vector<BITMAP_DEF> g_lineStyleIcons;
67 wxArrayString g_lineStyleNames;
68 
69 
70 #define NO_NETCLASS_ASSIGNMENT _( "<unassigned>" )
71 
73  const std::vector<wxString>& aCandidateNetNames,
74  bool aIsEEschema ) :
75  PANEL_SETUP_NETCLASSES_BASE( aParent->GetTreebook() ),
76  m_Parent( aParent ),
77  m_netclasses( aNetclasses ),
78  m_candidateNetNames( aCandidateNetNames )
79 {
80  if( g_lineStyleIcons.empty() )
81  {
83  g_lineStyleNames.push_back( _( "Solid" ) );
84  g_lineStyleIcons.push_back( stroke_dash_xpm );
85  g_lineStyleNames.push_back( _( "Dashed" ) );
86  g_lineStyleIcons.push_back( stroke_dot_xpm );
87  g_lineStyleNames.push_back( _( "Dotted" ) );
89  g_lineStyleNames.push_back( _( "Dash-Dot" ) );
90  }
91 
92  m_netclassesDirty = true;
93 
94  // Figure out the smallest the netclass membership pane can ever be so that nothing is cutoff
95  // and force it to be that size.
96  m_membershipSize = GetSize();
97  m_membershipSize.y -= m_netclassesPane->GetSize().y;
98  m_membershipSize.x = -1;
99  m_membershipPane->SetMinSize( m_membershipSize );
100  m_membershipPane->SetMaxSize( m_membershipSize );
101 
102  // Prevent Size events from firing before we are ready
103  Freeze();
104  m_netclassGrid->BeginBatch();
105  m_membershipGrid->BeginBatch();
106 
107  m_originalColWidths = new int[ m_netclassGrid->GetNumberCols() ];
108  // Calculate a min best size to handle longest usual numeric values:
109  int min_best_width = m_netclassGrid->GetTextExtent( "555,555555 mils" ).x;
110 
111  for( int i = 0; i < m_netclassGrid->GetNumberCols(); ++i )
112  {
113  // We calculate the column min size only from texts sizes, not using the initial col width
114  // as this initial width is sometimes strange depending on the language (wxGrid bug?)
115  int min_width = m_netclassGrid->GetVisibleWidth( i, true, true, false );
116 
117  if( i == GRID_LINESTYLE )
118  min_best_width *= 1.5;
119 
120  m_netclassGrid->SetColMinimalWidth( i, min_width );
121 
122  // We use a "best size" >= min_best_width
123  m_originalColWidths[ i ] = std::max( min_width, min_best_width );
124  m_netclassGrid->SetColSize( i, m_originalColWidths[ i ] );
125  }
126 
127  if( aIsEEschema )
128  {
129  for( int i = GRID_FIRST_PCBNEW; i < GRID_FIRST_EESCHEMA; ++i )
130  {
131  m_netclassGrid->HideCol( i );
132  m_originalColWidths[ i ] = 0;
133  }
134 
135  wxGridCellAttr* attr = new wxGridCellAttr;
136  attr->SetRenderer( new GRID_CELL_COLOR_RENDERER() );
137  attr->SetEditor( new GRID_CELL_COLOR_SELECTOR( aParent, m_netclassGrid ) );
138  m_netclassGrid->SetColAttr( GRID_SCHEMATIC_COLOR, attr );
139 
140  attr = new wxGridCellAttr;
143  m_netclassGrid->SetColAttr( GRID_LINESTYLE, attr );
144  }
145  else
146  {
147  for( int i = GRID_FIRST_EESCHEMA; i < GRID_END; ++i )
148  {
149  m_netclassGrid->HideCol( i );
150  m_originalColWidths[ i ] = 0;
151  }
152  }
153 
154  // Be sure the column labels are readable
156 
157  // Membership combobox editors require a bit more room, so increase the row size of
158  // all our grids for consistency
159  m_netclassGrid->SetDefaultRowSize( m_netclassGrid->GetDefaultRowSize() + 4 );
160  m_membershipGrid->SetDefaultRowSize( m_membershipGrid->GetDefaultRowSize() + 4 );
161 
162  m_netclassGrid->PushEventHandler( new GRID_TRICKS( m_netclassGrid ) );
163  m_membershipGrid->PushEventHandler( new GRID_TRICKS( m_membershipGrid ) );
164 
165  m_netclassGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
166  m_membershipGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
167 
168  // Set up the net name column of the netclass membership grid to read-only
169  wxGridCellAttr* attr = new wxGridCellAttr;
170  attr->SetReadOnly( true );
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_candidateNetNames )
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  // While we currently only store shortNames as members, legacy versions stored
255  // fully-qualified names so we don't know which kind we're going to find.
256  wxString shortName = net.AfterLast( '/' );
257 
258  if( netToNetclassMap.count( shortName ) )
259  netToNetclassMap[ shortName ] = i->second->GetName();
260  else
261  staleNetMap[ shortName ] = i->second->GetName();
262  }
263  }
264 
265  if( m_membershipGrid->GetNumberRows() )
266  m_membershipGrid->DeleteRows( 0, m_membershipGrid->GetNumberRows() );
267 
268  // add currently-assigned and candidate netnames to membership lists
269  for( const std::pair<const wxString, wxString>& ii : netToNetclassMap )
270  addNet( UnescapeString( ii.first ), ii.second, false );
271 
272  for( const std::pair<const wxString, wxString>& ii : staleNetMap )
273  addNet( UnescapeString( ii.first ), ii.second, true );
274 
275  return true;
276 }
277 
278 
279 void PANEL_SETUP_NETCLASSES::addNet( const wxString& netName, const wxString& netclass,
280  bool aStale )
281 {
282  int i = m_membershipGrid->GetNumberRows();
283 
284  m_membershipGrid->AppendRows( 1 );
285 
286  m_membershipGrid->SetCellValue( i, 0, netName );
287 
288  if( aStale )
289  {
290  wxColour color = wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT );
291  m_membershipGrid->SetCellTextColour( i, 0, color );
292  }
293 
294  m_membershipGrid->SetCellValue( i, 1, netclass );
295 }
296 
297 
298 /*
299  * Populates drop-downs with the list of net classes
300  */
302 {
304 
305  wxArrayString netclassNames;
306 
307  netclassNames.push_back( NO_NETCLASS_ASSIGNMENT );
308 
309  for( int ii = 0; ii < m_netclassGrid->GetNumberRows(); ii++ )
310  {
311  wxString netclassName = m_netclassGrid->GetCellValue( ii, GRID_NAME );
312  if( !netclassName.IsEmpty() )
313  netclassNames.push_back( netclassName );
314  }
315 
316  wxGridCellAttr* attr = new wxGridCellAttr;
317  attr->SetEditor( new GRID_CELL_COMBOBOX( netclassNames ) );
318  m_membershipGrid->SetColAttr( 1, attr );
319 
320  m_assignNetClass->Set( netclassNames );
321 
322  netclassNames.Insert( wxEmptyString, 0 );
323  m_netClassFilter->Set( netclassNames );
324 }
325 
326 
327 static void gridRowToNetclass( EDA_UNITS aUnits, wxGrid* grid, int row, const NETCLASSPTR& nc )
328 {
329  nc->SetName( grid->GetCellValue( row, GRID_NAME ) );
330 
331 #define MYCELL( col ) \
332  ValueFromString( aUnits, grid->GetCellValue( row, col ), true )
333 
334  nc->SetClearance( MYCELL( GRID_CLEARANCE ) );
335  nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) );
336  nc->SetViaDiameter( MYCELL( GRID_VIASIZE ) );
337  nc->SetViaDrill( MYCELL( GRID_VIADRILL ) );
338  nc->SetuViaDiameter( MYCELL( GRID_uVIASIZE ) );
339  nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) );
340  nc->SetDiffPairWidth( MYCELL( GRID_DIFF_PAIR_WIDTH ) );
341  nc->SetDiffPairGap( MYCELL( GRID_DIFF_PAIR_GAP ) );
342 
343  nc->SetWireWidth( MYCELL( GRID_WIREWIDTH ) );
344  nc->SetBusWidth( MYCELL( GRID_BUSWIDTH ) );
345 
346  nc->SetSchematicColor( wxColour( grid->GetCellValue( row, GRID_SCHEMATIC_COLOR ) ) );
347  nc->SetLineStyle( g_lineStyleNames.Index( grid->GetCellValue( row, GRID_LINESTYLE ) ) );
348 }
349 
350 
352 {
353  if( !validateData() )
354  return false;
355 
356  m_netclasses->Clear();
357 
358  // Copy the default NetClass:
360 
361  // Copy other NetClasses:
362  for( int row = 1; row < m_netclassGrid->GetNumberRows(); ++row )
363  {
364  NETCLASSPTR nc = std::make_shared<NETCLASS>( m_netclassGrid->GetCellValue( row, GRID_NAME ) );
365 
366  if( m_netclasses->Add( nc ) )
368  }
369 
370  // Now read all nets and push them in the corresponding netclass net buffer
371  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
372  {
373  const wxString& netname = m_membershipGrid->GetCellValue( row, 0 );
374  const wxString& classname = m_membershipGrid->GetCellValue( row, 1 );
375 
376  if( classname != NO_NETCLASS_ASSIGNMENT )
377  {
378  const NETCLASSPTR& nc = m_netclasses->Find( classname );
379 
380  if( nc )
381  nc->Add( EscapeString( netname, CTX_NETNAME ) );
382  }
383  }
384 
385  return true;
386 }
387 
388 
389 bool PANEL_SETUP_NETCLASSES::validateNetclassName( int aRow, wxString aName, bool focusFirst )
390 {
391  aName.Trim( true );
392  aName.Trim( false );
393 
394  if( aName.IsEmpty() )
395  {
396  wxString msg = _( "Netclass must have a name." );
397  m_Parent->SetError( msg, this, m_netclassGrid, aRow, GRID_NAME );
398  return false;
399  }
400 
401  for( int ii = 0; ii < m_netclassGrid->GetNumberRows(); ii++ )
402  {
403  if( ii != aRow && m_netclassGrid->GetCellValue( ii, GRID_NAME ).CmpNoCase( aName ) == 0 )
404  {
405  wxString msg = _( "Netclass name already in use." );
406  m_Parent->SetError( msg, this, m_netclassGrid, focusFirst ? aRow : ii, GRID_NAME );
407  return false;
408  }
409  }
410 
411  return true;
412 }
413 
414 
416 {
417  if( event.GetCol() == GRID_NAME )
418  {
419  if( validateNetclassName( event.GetRow(), event.GetString() ) )
420  {
421  wxString oldName = m_netclassGrid->GetCellValue( event.GetRow(), GRID_NAME );
422  wxString newName = event.GetString();
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  m_netclassesDirty = true;
431  }
432  else
433  event.Veto();
434  }
435 }
436 
437 
438 void PANEL_SETUP_NETCLASSES::OnAddNetclassClick( wxCommandEvent& event )
439 {
441  return;
442 
443  int row = m_netclassGrid->GetNumberRows();
444  m_netclassGrid->AppendRows();
445 
446  // Copy values of the default class:
447  for( int col = 1; col < m_netclassGrid->GetNumberCols(); col++ )
448  m_netclassGrid->SetCellValue( row, col, m_netclassGrid->GetCellValue( 0, col ) );
449 
450  m_netclassGrid->MakeCellVisible( row, 0 );
451  m_netclassGrid->SetGridCursor( row, 0 );
452 
453  m_netclassGrid->EnableCellEditControl( true );
454  m_netclassGrid->ShowCellEditControl();
455 
456  m_netclassesDirty = true;
457 }
458 
459 
461 {
463  return;
464 
465  int curRow = m_netclassGrid->GetGridCursorRow();
466 
467  if( curRow < 0 )
468  return;
469  else if( curRow == 0 )
470  {
471  DisplayErrorMessage( this, _( "The default net class is required." ) );
472  return;
473  }
474 
475  // reset the net class to default for members of the removed class
476  wxString classname = m_netclassGrid->GetCellValue( curRow, GRID_NAME );
477 
478  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
479  {
480  if( m_membershipGrid->GetCellValue( row, 1 ) == classname )
481  m_membershipGrid->SetCellValue( row, 1, NETCLASS::Default );
482  }
483 
484  m_netclassGrid->DeleteRows( curRow, 1 );
485 
486  m_netclassGrid->MakeCellVisible( std::max( 0, curRow-1 ), m_netclassGrid->GetGridCursorCol() );
487  m_netclassGrid->SetGridCursor( std::max( 0, curRow-1 ), m_netclassGrid->GetGridCursorCol() );
488 
489  m_netclassesDirty = true;
490 }
491 
492 
494 {
495  // Account for scroll bars
496  aWidth -= ( m_netclassGrid->GetSize().x - m_netclassGrid->GetClientSize().x );
497 
498  for( int i = 1; i < m_netclassGrid->GetNumberCols(); i++ )
499  {
500  m_netclassGrid->SetColSize( i, m_originalColWidths[ i ] );
501  aWidth -= m_originalColWidths[ i ];
502  }
503 
504  m_netclassGrid->SetColSize( 0, std::max( aWidth - 2, m_originalColWidths[ 0 ] ) );
505 }
506 
507 
509 {
510  AdjustNetclassGridColumns( event.GetSize().GetX() );
511 
512  event.Skip();
513 }
514 
515 
517 {
518  // Account for scroll bars
519  aWidth -= ( m_membershipGrid->GetSize().x - m_membershipGrid->GetClientSize().x );
520 
521  // Set className column width to original className width from netclasses grid
522  int classNameWidth = m_originalColWidths[ 0 ];
523  m_membershipGrid->SetColSize( 1, m_originalColWidths[ 0 ] );
524  m_membershipGrid->SetColSize( 0, std::max( aWidth - classNameWidth, classNameWidth ) );
525 }
526 
527 
529 {
530  AdjustMembershipGridColumns( event.GetSize().GetX() );
531 
532  event.Skip();
533 }
534 
535 
537 {
539  return;
540 
541  wxString netClassFilter = m_netClassFilter->GetStringSelection();
542  wxString netFilter = m_netNameFilter->GetValue().MakeLower();
543 
544  if( !netFilter.IsEmpty() )
545  netFilter = wxT( "*" ) + netFilter + wxT( "*" );
546 
547  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
548  {
549  wxString net = m_membershipGrid->GetCellValue( row, 0 );
550  wxString netClass = m_membershipGrid->GetCellValue( row, 1 );
551  bool show = true;
552 
553  if( !aShowAll )
554  {
555  if( !netFilter.IsEmpty() && !net.MakeLower().Matches( netFilter ) )
556  show = false;
557 
558  if( !netClassFilter.IsEmpty() && netClass != netClassFilter )
559  show = false;
560  }
561 
562  if( show )
563  m_membershipGrid->ShowRow( row );
564  else
565  m_membershipGrid->HideRow( row );
566  }
567 }
568 
569 
571 {
573  return;
574 
575  wxArrayInt selectedRows = m_membershipGrid->GetSelectedRows();
576 
577  for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
578  {
579  if( !m_membershipGrid->IsRowShown( row ) )
580  continue;
581 
582  if( !aAssignAll && selectedRows.Index( row ) == wxNOT_FOUND )
583  continue;
584 
585  m_membershipGrid->SetCellValue( row, 1, m_assignNetClass->GetStringSelection() );
586  }
587 }
588 
589 
590 void PANEL_SETUP_NETCLASSES::OnUpdateUI( wxUpdateUIEvent& event )
591 {
592  if( m_netclassesDirty )
593  {
595  m_netclassesDirty = false;
596  }
597 
598  // Recompute the desired size for the two content panes. We cannot leave this sizing to
599  // wxWidgets because it wants to shrink the membership panel to an unusable size when the
600  // netlist panel grows, and also it introduces undesired artifacts when the window is resized
601  // and the panes can grow/shrink.
602  wxSize netclassSize = GetClientSize();
603  netclassSize.y -= m_membershipSize.y;
604 
605  // Modify m_netclassesPane size only if needed, because calling Layout() has the annoying
606  // effect of closing any open wxChoice dropdowns. So it cannot blindly called inside each
607  // wxUpdateUIEvent event, at least on Windows + wxWidgets 3.0 (not an issue with 3.1.1).
608  if( netclassSize.y != m_netclassesPane->GetSize().y )
609  {
610  m_netclassesPane->SetMinSize( netclassSize );
611  m_netclassesPane->SetMaxSize( netclassSize );
612  Layout();
613  }
614 }
615 
616 
618 {
620  return false;
621 
622  wxString msg;
623 
624  // Test net class parameters.
625  for( int row = 0; row < m_netclassGrid->GetNumberRows(); row++ )
626  {
627  wxString netclassName = m_netclassGrid->GetCellValue( row, GRID_NAME );
628  netclassName.Trim( true );
629  netclassName.Trim( false );
630 
631  if( !validateNetclassName( row, netclassName, false ) )
632  return false;
633  }
634 
635  return true;
636 }
637 
638 
640 {
641  NETCLASSES* savedSettings = m_netclasses;
642 
643  m_netclasses = aNetclasses;
645 
647 
648  m_netclassGrid->ForceRefresh();
649  m_membershipGrid->ForceRefresh();
650 
651  m_netclasses = savedSettings;
652 }
653 
654 
EDA_UNITS
Definition: common.h:198
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.
#define NO_NETCLASS_ASSIGNMENT
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
PANEL_SETUP_NETCLASSES(PAGED_DIALOG *aParent, NETCLASSES *aNetclasses, const std::vector< wxString > &aCandidateNetNames, bool isEEschema)
iterator end()
Definition: netclass.h:243
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:230
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:241
iterator begin()
Definition: netclass.h:242
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:272
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:174
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.
Definition: netclass.h:236
#define _(s)
Definition: 3d_actions.cpp:33
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:131
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
These Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which ar...
Definition: string.cpp:50
unsigned GetCount() const
Function GetCount.
Definition: netclass.h:253
static void netclassToGridRow(EDA_UNITS aUnits, wxGrid *aGrid, int aRow, const NETCLASSPTR &nc)
NETCLASSPTR GetDefault() const
Function GetDefault.
Definition: netclass.h:262
wxArrayString g_lineStyleNames
const BITMAP_OPAQUE stroke_solid_xpm[1]
void ImportSettingsFrom(NETCLASSES *aBoard)
void OnUpdateUI(wxUpdateUIEvent &event) override
std::vector< wxString > m_candidateNetNames
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
void doApplyFilters(bool aShowAll)