Formatting.

This commit is contained in:
Jeff Young 2024-06-07 12:05:43 +01:00
parent d8c2929163
commit cb7d51dbe4
1 changed files with 109 additions and 109 deletions

View File

@ -653,6 +653,7 @@ findItemsFromSyncSelection( const SCHEMATIC& aSchematic, const std::string aSync
syncSymMap[symRef] = std::vector<SCH_REFERENCE>();
break;
}
case 'P': // Select by pad: P<Footprint reference>/<Pad number>
{
wxString symRef = UnescapeString( syncData.BeforeFirst( '/' ) );
@ -664,64 +665,63 @@ findItemsFromSyncSelection( const SCHEMATIC& aSchematic, const std::string aSync
syncPinMap[symRef][padNum] = nullptr;
break;
}
default: break;
default:
break;
}
}
// Lambda definitions
auto flattenSyncMaps = [&syncSymMap, &syncPinMap]() -> std::vector<SCH_ITEM*>
auto flattenSyncMaps =
[&syncSymMap, &syncPinMap]() -> std::vector<SCH_ITEM*>
{
std::vector<SCH_ITEM*> allVec;
for( auto const& pairSym : syncSymMap )
{
for( const SCH_REFERENCE& ref : pairSym.second )
for( const auto& [symRef, symbols] : syncSymMap )
{
for( const SCH_REFERENCE& ref : symbols )
allVec.push_back( ref.GetSymbol() );
}
}
for( auto const& pairSym : syncPinMap )
for( const auto& [symRef, pinMap] : syncPinMap )
{
for( auto const& pairPin : pairSym.second )
for( const auto& [padNum, pin] : pinMap )
{
if( pairPin.second )
allVec.push_back( pairPin.second );
if( pin )
allVec.push_back( pin );
}
}
return allVec;
};
auto clearSyncMaps = [&syncSymMap, &syncPinMap]()
auto clearSyncMaps =
[&syncSymMap, &syncPinMap]()
{
for( auto& pairSym : syncSymMap )
{
pairSym.second.clear();
}
for( auto& [symRef, symbols] : syncSymMap )
symbols.clear();
for( auto& pairSym : syncPinMap )
for( auto& [reference, pins] : syncPinMap )
{
for( auto& pairPin : pairSym.second )
{
pairPin.second = nullptr;
}
for( auto& [number, pin] : pins )
pin = nullptr;
}
};
auto syncMapsValuesEmpty = [&syncSymMap, &syncPinMap]() -> bool
auto syncMapsValuesEmpty =
[&syncSymMap, &syncPinMap]() -> bool
{
for( auto const& pairSym : syncSymMap )
for( const auto& [symRef, symbols] : syncSymMap )
{
if( pairSym.second.size() > 0 )
if( symbols.size() > 0 )
return false;
}
for( auto const& pairSym : syncPinMap )
for( const auto& [symRef, pins] : syncPinMap )
{
for( auto const& pairPin : pairSym.second )
for( const auto& [padNum, pin] : pins )
{
if( pairPin.second )
if( pin )
return false;
}
}
@ -729,33 +729,33 @@ findItemsFromSyncSelection( const SCHEMATIC& aSchematic, const std::string aSync
return true;
};
auto checkFocusItems = [&]( const SCH_SHEET_PATH& aSheetPath )
auto checkFocusItems =
[&]( const SCH_SHEET_PATH& aSheet )
{
if( focusSymbol )
{
auto findIt = syncSymMap.find( *focusSymbol );
if( findIt != syncSymMap.end() )
{
if( findIt->second.size() > 0 )
{
focusItemResults[aSheetPath].push_back( findIt->second.front().GetSymbol() );
}
focusItemResults[aSheet].push_back( findIt->second.front().GetSymbol() );
}
}
else if( focusPin )
{
auto findIt = syncPinMap.find( focusPin->first );
if( findIt != syncPinMap.end() )
{
if( findIt->second[focusPin->second] )
{
focusItemResults[aSheetPath].push_back( findIt->second[focusPin->second] );
}
focusItemResults[aSheet].push_back( findIt->second[focusPin->second] );
}
}
};
auto makeRetForSheet = [&]( const SCH_SHEET_PATH& aSheet, SCH_ITEM* aFocusItem )
auto makeRetForSheet =
[&]( const SCH_SHEET_PATH& aSheet, SCH_ITEM* aFocusItem )
{
clearSyncMaps();
@ -775,8 +775,8 @@ findItemsFromSyncSelection( const SCHEMATIC& aSchematic, const std::string aSync
if( !subsheetPath )
continue;
if( sheetContainsOnlyWantedItems( allSheetsList, *subsheetPath, syncSymMap, syncPinMap,
fullyWantedCache ) )
if( sheetContainsOnlyWantedItems( allSheetsList, *subsheetPath, syncSymMap,
syncPinMap, fullyWantedCache ) )
{
itemsVector.push_back( item );
}
@ -800,10 +800,10 @@ findItemsFromSyncSelection( const SCHEMATIC& aSchematic, const std::string aSync
{
for( const SCH_SHEET_PATH& sheetPath : orderedSheets )
{
auto vec = focusItemResults[sheetPath];
const std::vector<SCH_ITEM*>& items = focusItemResults[sheetPath];
if( !vec.empty() )
return makeRetForSheet( sheetPath, vec.front() );
if( !items.empty() )
return makeRetForSheet( sheetPath, items.front() );
}
}
}