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