Fix shadowed variables

This commit is contained in:
Seth Hillbrand 2022-08-15 08:03:30 -07:00
parent 9828360759
commit 4b3ac52b1d
2 changed files with 25 additions and 25 deletions

View File

@ -338,44 +338,44 @@ bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow()
int row = 0; int row = 0;
auto getCell = auto getCell =
[&]( int aRow, int aCol ) -> long long int [this, units]( int aRow, int aCol ) -> long long int
{ {
return ValueFromString( units, m_netclassGrid->GetCellValue( aRow, aCol ) ); return ValueFromString( units, m_netclassGrid->GetCellValue( aRow, aCol ) );
}; };
auto getCellStr = auto getCellStr =
[&]( int aRow, int aCol ) -> wxString [this]( int aRow, int aCol ) -> wxString
{ {
return m_netclassGrid->GetCellValue( aRow, aCol ); return m_netclassGrid->GetCellValue( aRow, aCol );
}; };
auto gridRowToNetclass = auto gridRowToNetclass =
[&]( int row, const std::shared_ptr<NETCLASS>& nc ) [&]( int aRow, const std::shared_ptr<NETCLASS>& nc )
{ {
nc->SetName( m_netclassGrid->GetCellValue( row, GRID_NAME ) ); nc->SetName( m_netclassGrid->GetCellValue( aRow, GRID_NAME ) );
if( m_isEEschema ) if( m_isEEschema )
{ {
nc->SetWireWidth( getCell( row, GRID_WIREWIDTH - EESCHEMA_COL_OFFSET ) ); nc->SetWireWidth( getCell( aRow, GRID_WIREWIDTH - EESCHEMA_COL_OFFSET ) );
nc->SetBusWidth( getCell( row, GRID_BUSWIDTH - EESCHEMA_COL_OFFSET ) ); nc->SetBusWidth( getCell( aRow, GRID_BUSWIDTH - EESCHEMA_COL_OFFSET ) );
wxString color = getCellStr( row, GRID_SCHEMATIC_COLOR - EESCHEMA_COL_OFFSET ); wxString color = getCellStr( aRow, GRID_SCHEMATIC_COLOR - EESCHEMA_COL_OFFSET );
nc->SetSchematicColor( wxColour( color ) ); nc->SetSchematicColor( wxColour( color ) );
wxString lineStyle = getCellStr( row, GRID_LINESTYLE - EESCHEMA_COL_OFFSET ); wxString lineStyle = getCellStr( aRow, GRID_LINESTYLE - EESCHEMA_COL_OFFSET );
nc->SetLineStyle( g_lineStyleNames.Index( lineStyle ) ); nc->SetLineStyle( g_lineStyleNames.Index( lineStyle ) );
wxASSERT_MSG( nc->GetLineStyle() >= 0, "Line style name not found." ); wxASSERT_MSG( nc->GetLineStyle() >= 0, "Line style name not found." );
} }
else else
{ {
nc->SetClearance( getCell( row, GRID_CLEARANCE ) ); nc->SetClearance( getCell( aRow, GRID_CLEARANCE ) );
nc->SetTrackWidth( getCell( row, GRID_TRACKSIZE ) ); nc->SetTrackWidth( getCell( aRow, GRID_TRACKSIZE ) );
nc->SetViaDiameter( getCell( row, GRID_VIASIZE ) ); nc->SetViaDiameter( getCell( aRow, GRID_VIASIZE ) );
nc->SetViaDrill( getCell( row, GRID_VIADRILL ) ); nc->SetViaDrill( getCell( aRow, GRID_VIADRILL ) );
nc->SetuViaDiameter( getCell( row, GRID_uVIASIZE ) ); nc->SetuViaDiameter( getCell( aRow, GRID_uVIASIZE ) );
nc->SetuViaDrill( getCell( row, GRID_uVIADRILL ) ); nc->SetuViaDrill( getCell( aRow, GRID_uVIADRILL ) );
nc->SetDiffPairWidth( getCell( row, GRID_DIFF_PAIR_WIDTH ) ); nc->SetDiffPairWidth( getCell( aRow, GRID_DIFF_PAIR_WIDTH ) );
nc->SetDiffPairGap( getCell( row, GRID_DIFF_PAIR_GAP ) ); nc->SetDiffPairGap( getCell( aRow, GRID_DIFF_PAIR_GAP ) );
} }
}; };

View File

@ -234,20 +234,20 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetclassesGrid()
row++; row++;
auto setNetclassValue = auto setNetclassValue =
[&]( int row, int col, int value ) [this, units]( int aRow, int aCol, int aVal )
{ {
m_netclassGrid->SetCellValue( row, col, StringFromValue( units, value, true ) ); m_netclassGrid->SetCellValue( aRow, aCol, StringFromValue( units, aVal, true ) );
}; };
auto buildRow = auto buildRow =
[&]( int row, const std::shared_ptr<NETCLASS>& nc ) [this, &setNetclassValue]( int aRow, const std::shared_ptr<NETCLASS>& aNc )
{ {
m_netclassGrid->SetCellValue( row, GRID_NAME, nc->GetName() ); m_netclassGrid->SetCellValue( aRow, GRID_NAME, aNc->GetName() );
setNetclassValue( row, GRID_TRACKSIZE, nc->GetTrackWidth() ); setNetclassValue( aRow, GRID_TRACKSIZE, aNc->GetTrackWidth() );
setNetclassValue( row, GRID_VIASIZE, nc->GetViaDiameter() ); setNetclassValue( aRow, GRID_VIASIZE, aNc->GetViaDiameter() );
setNetclassValue( row, GRID_VIADRILL, nc->GetViaDrill() ); setNetclassValue( aRow, GRID_VIADRILL, aNc->GetViaDrill() );
setNetclassValue( row, GRID_uVIASIZE, nc->GetuViaDiameter() ); setNetclassValue( aRow, GRID_uVIASIZE, aNc->GetuViaDiameter() );
setNetclassValue( row, GRID_uVIADRILL, nc->GetuViaDrill() ); setNetclassValue( aRow, GRID_uVIADRILL, aNc->GetuViaDrill() );
}; };
const std::shared_ptr<NET_SETTINGS>& settings = m_brd->GetDesignSettings().m_NetSettings; const std::shared_ptr<NET_SETTINGS>& settings = m_brd->GetDesignSettings().m_NetSettings;