static void gridRow2class( wxGrid* grid, int row, NETCLASSPTR nc ) { #define MYCELL( col ) \ ValueFromString( g_UserUnit, grid->GetCellValue( row, col ) ) nc->SetClearance( MYCELL( GRID_CLEARANCE ) ); nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) ); nc->SetViaDiameter( MYCELL( GRID_VIASIZE ) ); nc->SetViaDrill( MYCELL( GRID_VIADRILL ) ); nc->SetuViaDiameter( MYCELL( GRID_uVIASIZE ) ); nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) ); }
void ReadParam( wxConfigBase* aConfig ) const override { if( !m_Pt_param || !aConfig ) return; wxString oldPath = aConfig->GetPath(); m_Pt_param->Clear(); for( int index = 0; ; ++index ) { wxString path = ""; NETCLASSPTR netclass; wxString netclassName; if( index == 0 ) path = "Default"; else path << index; aConfig->SetPath( oldPath ); aConfig->SetPath( m_Ident ); aConfig->SetPath( path ); if( !aConfig->Read( NetclassNameKey, &netclassName ) ) break; if( index == 0 ) netclass = m_Pt_param->GetDefault(); else netclass = std::make_shared<NETCLASS>( netclassName ); #define READ_MM( aKey, aDefault ) Millimeter2iu( aConfig->ReadDouble( aKey, aDefault ) ) netclass->SetClearance( READ_MM( ClearanceKey, netclass->GetClearance() ) ); netclass->SetTrackWidth( READ_MM( TrackWidthKey, netclass->GetTrackWidth() ) ); netclass->SetViaDiameter( READ_MM( ViaDiameterKey, netclass->GetViaDiameter() ) ); netclass->SetViaDrill( READ_MM( ViaDrillKey, netclass->GetViaDrill() ) ); netclass->SetuViaDiameter( READ_MM( uViaDiameterKey, netclass->GetuViaDiameter() ) ); netclass->SetuViaDrill( READ_MM( uViaDrillKey, netclass->GetuViaDrill() ) ); netclass->SetDiffPairWidth( READ_MM( dPairWidthKey, netclass->GetDiffPairWidth() ) ); netclass->SetDiffPairGap( READ_MM( dPairGapKey, netclass->GetDiffPairGap() ) ); netclass->SetDiffPairViaGap( READ_MM( dPairViaGapKey, netclass->GetDiffPairViaGap() ) ); if( index > 0 ) m_Pt_param->Add( netclass ); } aConfig->SetPath( oldPath ); }