You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

589 lines
20 KiB

  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. #include <fctsys.h>
  26. #include <base_units.h>
  27. #include <confirm.h>
  28. #include <pcb_edit_frame.h>
  29. #include <board_design_settings.h>
  30. #include <bitmaps.h>
  31. #include <widgets/wx_grid.h>
  32. #include <grid_tricks.h>
  33. #include <panel_setup_netclasses.h>
  34. // Columns of netclasses grid
  35. enum {
  36. GRID_NAME = 0,
  37. GRID_CLEARANCE,
  38. GRID_TRACKSIZE,
  39. GRID_VIASIZE,
  40. GRID_VIADRILL,
  41. GRID_uVIASIZE,
  42. GRID_uVIADRILL,
  43. GRID_DIFF_PAIR_WIDTH,
  44. GRID_DIFF_PAIR_GAP,
  45. GRID_DIFF_PAIR_VIA_GAP
  46. };
  47. PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame,
  48. PANEL_SETUP_FEATURE_CONSTRAINTS* aConstraintsPanel ) :
  49. PANEL_SETUP_NETCLASSES_BASE( aParent->GetTreebook() )
  50. {
  51. m_Parent = aParent;
  52. m_Frame = aFrame;
  53. m_Pcb = m_Frame->GetBoard();
  54. m_BrdSettings = &m_Pcb->GetDesignSettings();
  55. m_ConstraintsPanel = aConstraintsPanel;
  56. m_netclassesDirty = true;
  57. // Prevent Size events from firing before we are ready
  58. Freeze();
  59. m_originalColWidths = new int[ m_netclassGrid->GetNumberCols() ];
  60. // Calculate a min best size to handle longest usual numeric values:
  61. // (The 'M' large char is used to give a margin)
  62. int min_best_width = m_netclassGrid->GetTextExtent( "555,555555 milsM" ).x;
  63. for( int i = 0; i < m_netclassGrid->GetNumberCols(); ++i )
  64. {
  65. // We calculate the column min size only from texts sizes, not using the initial col width
  66. // as this initial width is sometimes strange depending on the language (wxGrid bug?)
  67. int min_width = m_netclassGrid->GetVisibleWidth( i, true, true, false );
  68. m_netclassGrid->SetColMinimalWidth( i, min_width );
  69. // We use a "best size" >= min_best_width
  70. m_originalColWidths[ i ] = std::max( min_width, min_best_width );
  71. m_netclassGrid->SetColSize( i, m_originalColWidths[ i ] );
  72. }
  73. // Be sure the column labels are readable
  74. m_netclassGrid->EnsureColLabelsVisible();
  75. // Membership combobox editors require a bit more room, so increase the row size of
  76. // all our grids for consistency
  77. m_netclassGrid->SetDefaultRowSize( m_netclassGrid->GetDefaultRowSize() + 4 );
  78. m_membershipGrid->SetDefaultRowSize( m_membershipGrid->GetDefaultRowSize() + 4 );
  79. m_netclassGrid->PushEventHandler( new GRID_TRICKS( m_netclassGrid ) );
  80. m_membershipGrid->PushEventHandler( new GRID_TRICKS( m_membershipGrid ) );
  81. m_netclassGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
  82. m_membershipGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
  83. // Set up the net name column of the netclass membership grid to read-only
  84. wxGridCellAttr* attr = new wxGridCellAttr;
  85. attr->SetReadOnly( true );
  86. m_membershipGrid->SetColAttr( 0, attr );
  87. m_addButton->SetBitmap( KiBitmap( small_plus_xpm ) );
  88. m_removeButton->SetBitmap( KiBitmap( trash_xpm ) );
  89. // wxFormBuilder doesn't include this event...
  90. m_netclassGrid->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging ), NULL, this );
  91. Thaw();
  92. }
  93. PANEL_SETUP_NETCLASSES::~PANEL_SETUP_NETCLASSES()
  94. {
  95. delete [] m_originalColWidths;
  96. // Delete the GRID_TRICKS.
  97. m_netclassGrid->PopEventHandler( true );
  98. m_membershipGrid->PopEventHandler( true );
  99. m_netclassGrid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging ), NULL, this );
  100. }
  101. static void netclassToGridRow( EDA_UNITS_T aUnits, wxGrid* aGrid, int aRow, const NETCLASSPTR& nc )
  102. {
  103. aGrid->SetCellValue( aRow, GRID_NAME, nc->GetName() );
  104. #define SET_MILS_CELL( col, val ) \
  105. aGrid->SetCellValue( aRow, col, StringFromValue( aUnits, val, true, true ) )
  106. SET_MILS_CELL( GRID_CLEARANCE, nc->GetClearance() );
  107. SET_MILS_CELL( GRID_TRACKSIZE, nc->GetTrackWidth() );
  108. SET_MILS_CELL( GRID_VIASIZE, nc->GetViaDiameter() );
  109. SET_MILS_CELL( GRID_VIADRILL, nc->GetViaDrill() );
  110. SET_MILS_CELL( GRID_uVIASIZE, nc->GetuViaDiameter() );
  111. SET_MILS_CELL( GRID_uVIADRILL, nc->GetuViaDrill() );
  112. SET_MILS_CELL( GRID_DIFF_PAIR_WIDTH, nc->GetDiffPairWidth() );
  113. SET_MILS_CELL( GRID_DIFF_PAIR_GAP, nc->GetDiffPairGap() );
  114. // 6.0 TODO: SET_MILS_CELL( GRID_DIFF_PAIR_VIA_GAP, nc->GetDiffPairViaGap() );
  115. }
  116. bool PANEL_SETUP_NETCLASSES::TransferDataToWindow()
  117. {
  118. NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
  119. NETCLASSPTR netclass = netclasses.GetDefault();
  120. if( m_netclassGrid->GetNumberRows() )
  121. m_netclassGrid->DeleteRows( 0, m_netclassGrid->GetNumberRows() );
  122. m_netclassGrid->AppendRows( netclasses.GetCount() + 1 ); // + 1 for default netclass
  123. // enter the Default NETCLASS.
  124. netclassToGridRow( m_Frame->GetUserUnits(), m_netclassGrid, 0, netclass );
  125. // make the Default NETCLASS name read-only
  126. wxGridCellAttr* cellAttr = m_netclassGrid->GetOrCreateCellAttr( 0, GRID_NAME );
  127. cellAttr->SetReadOnly();
  128. cellAttr->DecRef();
  129. // enter other netclasses
  130. int row = 1;
  131. for( NETCLASSES::iterator i = netclasses.begin(); i != netclasses.end(); ++i, ++row )
  132. netclassToGridRow( m_Frame->GetUserUnits(), m_netclassGrid, row, i->second );
  133. // ensure that all nets have net classes assigned
  134. m_Pcb->BuildListOfNets();
  135. if( m_membershipGrid->GetNumberRows() )
  136. m_membershipGrid->DeleteRows( 0, m_membershipGrid->GetNumberRows() );
  137. for( NETINFO_ITEM* net : m_Pcb->GetNetInfo() )
  138. {
  139. if( net->GetNet() > 0 && net->IsCurrent() )
  140. addNet( UnescapeString( net->GetNetname() ), net->GetNetClass()->GetName() );
  141. }
  142. return true;
  143. }
  144. void PANEL_SETUP_NETCLASSES::addNet( wxString netName, const wxString& netclass )
  145. {
  146. int i = m_membershipGrid->GetNumberRows();
  147. m_membershipGrid->AppendRows( 1 );
  148. m_membershipGrid->SetCellValue( i, 0, netName );
  149. m_membershipGrid->SetCellValue( i, 1, netclass );
  150. }
  151. /* Populates drop-downs with the list of net classes
  152. */
  153. void PANEL_SETUP_NETCLASSES::rebuildNetclassDropdowns()
  154. {
  155. m_membershipGrid->CommitPendingChanges( true );
  156. wxArrayString netclassNames;
  157. for( int ii = 0; ii < m_netclassGrid->GetNumberRows(); ii++ )
  158. {
  159. wxString netclassName = m_netclassGrid->GetCellValue( ii, GRID_NAME );
  160. if( !netclassName.IsEmpty() )
  161. netclassNames.push_back( netclassName );
  162. }
  163. wxGridCellAttr* attr = new wxGridCellAttr;
  164. attr->SetEditor( new wxGridCellChoiceEditor( netclassNames ) );
  165. m_membershipGrid->SetColAttr( 1, attr );
  166. m_assignNetClass->Set( netclassNames );
  167. netclassNames.Insert( wxEmptyString, 0 );
  168. m_netClassFilter->Set( netclassNames );
  169. }
  170. static void gridRowToNetclass( EDA_UNITS_T aUnits, wxGrid* grid, int row, const NETCLASSPTR& nc )
  171. {
  172. nc->SetName( grid->GetCellValue( row, GRID_NAME ) );
  173. #define MYCELL( col ) \
  174. ValueFromString( aUnits, grid->GetCellValue( row, col ), true )
  175. nc->SetClearance( MYCELL( GRID_CLEARANCE ) );
  176. nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) );
  177. nc->SetViaDiameter( MYCELL( GRID_VIASIZE ) );
  178. nc->SetViaDrill( MYCELL( GRID_VIADRILL ) );
  179. nc->SetuViaDiameter( MYCELL( GRID_uVIASIZE ) );
  180. nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) );
  181. nc->SetDiffPairWidth( MYCELL( GRID_DIFF_PAIR_WIDTH ) );
  182. nc->SetDiffPairGap( MYCELL( GRID_DIFF_PAIR_GAP ) );
  183. // 6.0 TODO: nc->SetDiffPairViaGap( MYCELL( GRID_DIFF_PAIR_VIA_GAP ) );
  184. }
  185. bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow()
  186. {
  187. if( !validateData() )
  188. return false;
  189. NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
  190. // Remove all netclasses from board. We'll copy new list after
  191. netclasses.Clear();
  192. // Copy the default NetClass:
  193. gridRowToNetclass( m_Frame->GetUserUnits(), m_netclassGrid, 0, netclasses.GetDefault());
  194. // Copy other NetClasses :
  195. for( int row = 1; row < m_netclassGrid->GetNumberRows(); ++row )
  196. {
  197. NETCLASSPTR nc = std::make_shared<NETCLASS>( m_netclassGrid->GetCellValue( row, GRID_NAME ) );
  198. if( m_BrdSettings->m_NetClasses.Add( nc ) )
  199. gridRowToNetclass( m_Frame->GetUserUnits(), m_netclassGrid, row, nc );
  200. }
  201. // Now read all nets and push them in the corresponding netclass net buffer
  202. for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
  203. {
  204. NETCLASSPTR nc = netclasses.Find( m_membershipGrid->GetCellValue( row, 1 ) );
  205. if( nc )
  206. nc->Add( m_membershipGrid->GetCellValue( row, 0 ) );
  207. }
  208. m_Pcb->SynchronizeNetsAndNetClasses();
  209. m_BrdSettings->SetCurrentNetClass( NETCLASS::Default );
  210. return true;
  211. }
  212. bool PANEL_SETUP_NETCLASSES::validateNetclassName( int aRow, wxString aName, bool focusFirst )
  213. {
  214. aName.Trim( true );
  215. aName.Trim( false );
  216. if( aName.IsEmpty() )
  217. {
  218. wxString msg = _( "Netclass must have a name." );
  219. m_Parent->SetError( msg, this, m_netclassGrid, aRow, GRID_NAME );
  220. return false;
  221. }
  222. for( int ii = 0; ii < m_netclassGrid->GetNumberRows(); ii++ )
  223. {
  224. if( ii != aRow && m_netclassGrid->GetRowLabelValue( ii ).CmpNoCase( aName ) == 0 )
  225. {
  226. wxString msg = _( "Netclass name already in use." );
  227. m_Parent->SetError( msg, this, m_netclassGrid, focusFirst ? aRow : ii, GRID_NAME );
  228. return false;
  229. }
  230. }
  231. return true;
  232. }
  233. void PANEL_SETUP_NETCLASSES::OnNetclassGridCellChanging( wxGridEvent& event )
  234. {
  235. if( event.GetCol() == GRID_NAME )
  236. {
  237. if( validateNetclassName( event.GetRow(), event.GetString() ) )
  238. m_netclassesDirty = true;
  239. else
  240. event.Veto();
  241. }
  242. }
  243. void PANEL_SETUP_NETCLASSES::OnAddNetclassClick( wxCommandEvent& event )
  244. {
  245. if( !m_netclassGrid->CommitPendingChanges() )
  246. return;
  247. int row = m_netclassGrid->GetNumberRows();
  248. m_netclassGrid->AppendRows();
  249. // Copy values of the default class:
  250. for( int col = 1; col < m_netclassGrid->GetNumberCols(); col++ )
  251. m_netclassGrid->SetCellValue( row, col, m_netclassGrid->GetCellValue( 0, col ) );
  252. m_netclassGrid->MakeCellVisible( row, 0 );
  253. m_netclassGrid->SetGridCursor( row, 0 );
  254. m_netclassGrid->EnableCellEditControl( true );
  255. m_netclassGrid->ShowCellEditControl();
  256. m_netclassesDirty = true;
  257. }
  258. void PANEL_SETUP_NETCLASSES::OnRemoveNetclassClick( wxCommandEvent& event )
  259. {
  260. if( !m_netclassGrid->CommitPendingChanges() )
  261. return;
  262. int curRow = m_netclassGrid->GetGridCursorRow();
  263. if( curRow < 0 )
  264. return;
  265. else if( curRow == 0 )
  266. {
  267. DisplayErrorMessage( this, _( "The default net class is required." ) );
  268. return;
  269. }
  270. // reset the net class to default for members of the removed class
  271. wxString classname = m_netclassGrid->GetCellValue( curRow, GRID_NAME );
  272. for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
  273. {
  274. if( m_membershipGrid->GetCellValue( row, 1 ) == classname )
  275. m_membershipGrid->SetCellValue( row, 1, NETCLASS::Default );
  276. }
  277. m_netclassGrid->DeleteRows( curRow, 1 );
  278. m_netclassGrid->MakeCellVisible( std::max( 0, curRow-1 ), m_netclassGrid->GetGridCursorCol() );
  279. m_netclassGrid->SetGridCursor( std::max( 0, curRow-1 ), m_netclassGrid->GetGridCursorCol() );
  280. m_netclassesDirty = true;
  281. }
  282. void PANEL_SETUP_NETCLASSES::AdjustNetclassGridColumns( int aWidth )
  283. {
  284. // Account for scroll bars
  285. aWidth -= ( m_netclassGrid->GetSize().x - m_netclassGrid->GetClientSize().x );
  286. for( int i = 1; i < m_netclassGrid->GetNumberCols(); i++ )
  287. {
  288. m_netclassGrid->SetColSize( i, m_originalColWidths[ i ] );
  289. aWidth -= m_originalColWidths[ i ];
  290. }
  291. m_netclassGrid->SetColSize( 0, std::max( aWidth, m_originalColWidths[ 0 ] ) );
  292. }
  293. void PANEL_SETUP_NETCLASSES::OnSizeNetclassGrid( wxSizeEvent& event )
  294. {
  295. AdjustNetclassGridColumns( event.GetSize().GetX() );
  296. event.Skip();
  297. }
  298. void PANEL_SETUP_NETCLASSES::AdjustMembershipGridColumns( int aWidth )
  299. {
  300. // Account for scroll bars
  301. aWidth -= ( m_membershipGrid->GetSize().x - m_membershipGrid->GetClientSize().x );
  302. // Set className column width to original className width from netclasses grid
  303. int classNameWidth = m_originalColWidths[ 0 ];
  304. m_membershipGrid->SetColSize( 1, m_originalColWidths[ 0 ] );
  305. m_membershipGrid->SetColSize( 0, std::max( aWidth - classNameWidth, classNameWidth ) );
  306. }
  307. void PANEL_SETUP_NETCLASSES::OnSizeMembershipGrid( wxSizeEvent& event )
  308. {
  309. AdjustMembershipGridColumns( event.GetSize().GetX() );
  310. event.Skip();
  311. }
  312. void PANEL_SETUP_NETCLASSES::doApplyFilters( bool aShowAll )
  313. {
  314. if( !m_membershipGrid->CommitPendingChanges() )
  315. return;
  316. wxString netClassFilter = m_netClassFilter->GetStringSelection();
  317. wxString netFilter = m_netNameFilter->GetValue().MakeLower();
  318. if( !netFilter.IsEmpty() )
  319. netFilter = wxT( "*" ) + netFilter + wxT( "*" );
  320. for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
  321. {
  322. wxString net = m_membershipGrid->GetCellValue( row, 0 );
  323. wxString netClass = m_membershipGrid->GetCellValue( row, 1 );
  324. bool show = true;
  325. if( !aShowAll )
  326. {
  327. if( !netFilter.IsEmpty() && !net.MakeLower().Matches( netFilter ) )
  328. show = false;
  329. if( !netClassFilter.IsEmpty() && netClass != netClassFilter )
  330. show = false;
  331. }
  332. if( show )
  333. m_membershipGrid->ShowRow( row );
  334. else
  335. m_membershipGrid->HideRow( row );
  336. }
  337. }
  338. void PANEL_SETUP_NETCLASSES::doAssignments( bool aAssignAll )
  339. {
  340. if( !m_membershipGrid->CommitPendingChanges() )
  341. return;
  342. wxArrayInt selectedRows = m_membershipGrid->GetSelectedRows();
  343. for( int row = 0; row < m_membershipGrid->GetNumberRows(); ++row )
  344. {
  345. if( !m_membershipGrid->IsRowShown( row ) )
  346. continue;
  347. if( !aAssignAll && selectedRows.Index( row ) == wxNOT_FOUND )
  348. continue;
  349. m_membershipGrid->SetCellValue( row, 1, m_assignNetClass->GetStringSelection() );
  350. }
  351. }
  352. void PANEL_SETUP_NETCLASSES::OnUpdateUI( wxUpdateUIEvent& event )
  353. {
  354. if( m_netclassesDirty )
  355. {
  356. rebuildNetclassDropdowns();
  357. m_netclassesDirty = false;
  358. }
  359. }
  360. int PANEL_SETUP_NETCLASSES::getNetclassValue( int aRow, int aCol )
  361. {
  362. return ValueFromString( m_Frame->GetUserUnits(), m_netclassGrid->GetCellValue( aRow, aCol ), true );
  363. }
  364. bool PANEL_SETUP_NETCLASSES::validateData()
  365. {
  366. if( !m_netclassGrid->CommitPendingChanges() || !m_membershipGrid->CommitPendingChanges() )
  367. return false;
  368. wxString msg;
  369. int minViaDia = m_ConstraintsPanel->m_viaMinSize.GetValue();
  370. int minViaDrill = m_ConstraintsPanel->m_viaMinDrill.GetValue();
  371. int minUViaDia = m_ConstraintsPanel->m_uviaMinSize.GetValue();
  372. int minUViaDrill = m_ConstraintsPanel->m_uviaMinDrill.GetValue();
  373. int minTrackWidth = m_ConstraintsPanel->m_trackMinWidth.GetValue();
  374. // Test net class parameters.
  375. for( int row = 0; row < m_netclassGrid->GetNumberRows(); row++ )
  376. {
  377. wxString netclassName = m_netclassGrid->GetCellValue( row, GRID_NAME );
  378. netclassName.Trim( true );
  379. netclassName.Trim( false );
  380. if( !validateNetclassName( row, netclassName, false ) )
  381. return false;
  382. if( getNetclassValue( row, GRID_TRACKSIZE ) < minTrackWidth )
  383. {
  384. msg.Printf( _( "Track width less than minimum track width (%s)." ),
  385. StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) );
  386. m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_TRACKSIZE );
  387. return false;
  388. }
  389. if( getNetclassValue( row, GRID_DIFF_PAIR_WIDTH ) < minTrackWidth )
  390. {
  391. msg.Printf( _( "Differential pair width less than minimum track width (%s)." ),
  392. StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) );
  393. m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_DIFF_PAIR_WIDTH );
  394. return false;
  395. }
  396. // Test vias
  397. if( getNetclassValue( row, GRID_VIASIZE ) < minViaDia )
  398. {
  399. msg.Printf( _( "Via diameter less than minimum via diameter (%s)." ),
  400. StringFromValue( m_Frame->GetUserUnits(), minViaDia, true, true ) );
  401. m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIASIZE );
  402. return false;
  403. }
  404. if( getNetclassValue( row, GRID_VIADRILL ) >= getNetclassValue( row, GRID_VIASIZE ) )
  405. {
  406. msg = _( "Via drill larger than via diameter." );
  407. m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIADRILL );
  408. return false;
  409. }
  410. if( getNetclassValue( row, GRID_VIADRILL ) < minViaDrill )
  411. {
  412. msg.Printf( _( "Via drill less than minimum via drill (%s)." ),
  413. StringFromValue( m_Frame->GetUserUnits(), minViaDrill, true, true ) );
  414. m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_VIADRILL );
  415. return false;
  416. }
  417. // Test Micro vias
  418. if( getNetclassValue( row, GRID_uVIASIZE ) < minUViaDia )
  419. {
  420. msg.Printf( _( "Microvia diameter less than minimum microvia diameter (%s)." ),
  421. StringFromValue( m_Frame->GetUserUnits(), minUViaDia, true, true ) );
  422. m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_uVIASIZE );
  423. return false;
  424. }
  425. if( getNetclassValue( row, GRID_uVIADRILL ) >= getNetclassValue( row, GRID_uVIASIZE ) )
  426. {
  427. msg = _( "Microvia drill larger than microvia diameter." );
  428. m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_uVIADRILL );
  429. return false;
  430. }
  431. if( getNetclassValue( row, GRID_uVIADRILL ) < minUViaDrill )
  432. {
  433. msg.Printf( _( "Microvia drill less than minimum microvia drill (%s)." ),
  434. StringFromValue( m_Frame->GetUserUnits(), minUViaDrill, true, true ) );
  435. m_Parent->SetError( msg, this, m_netclassGrid, row, GRID_uVIADRILL );
  436. return false;
  437. }
  438. }
  439. return true;
  440. }
  441. void PANEL_SETUP_NETCLASSES::ImportSettingsFrom( BOARD* aBoard )
  442. {
  443. // Note: do not change the board, as we need to get the current nets from it for
  444. // netclass memberships. All the netclass definitions and dimension lists are in
  445. // the BOARD_DESIGN_SETTINGS.
  446. BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
  447. m_BrdSettings = &aBoard->GetDesignSettings();
  448. TransferDataToWindow();
  449. m_netclassGrid->ForceRefresh();
  450. m_membershipGrid->ForceRefresh();
  451. m_BrdSettings = savedSettings;
  452. }