SCH_SHEET_PATH::IsContainedWithin() didn't do what I thought it did....
This commit is contained in:
parent
c0ee987e8b
commit
d8c2929163
|
@ -452,7 +452,7 @@ void SCH_EDIT_FRAME::SendCrossProbeClearHighlight()
|
||||||
|
|
||||||
|
|
||||||
bool findSymbolsAndPins(
|
bool findSymbolsAndPins(
|
||||||
const SCHEMATIC& aSchematic, const SCH_SHEET_PATH& aSheetPath,
|
const SCH_SHEET_LIST& aSchematicSheetList, const SCH_SHEET_PATH& aSheetPath,
|
||||||
std::unordered_map<wxString, std::vector<SCH_REFERENCE>>& aSyncSymMap,
|
std::unordered_map<wxString, std::vector<SCH_REFERENCE>>& aSyncSymMap,
|
||||||
std::unordered_map<wxString, std::unordered_map<wxString, SCH_PIN*>>& aSyncPinMap,
|
std::unordered_map<wxString, std::unordered_map<wxString, SCH_PIN*>>& aSyncPinMap,
|
||||||
bool aRecursive = false )
|
bool aRecursive = false )
|
||||||
|
@ -460,8 +460,14 @@ bool findSymbolsAndPins(
|
||||||
if( aRecursive )
|
if( aRecursive )
|
||||||
{
|
{
|
||||||
// Iterate over children
|
// Iterate over children
|
||||||
for( const SCH_SHEET_PATH& sheet : SCH_SHEET_LIST( aSheetPath.Last() ) )
|
for( const SCH_SHEET_PATH& candidate : aSchematicSheetList )
|
||||||
findSymbolsAndPins( aSchematic, sheet, aSyncSymMap, aSyncPinMap, aRecursive );
|
{
|
||||||
|
if( candidate == aSheetPath || !candidate.IsContainedWithin( aSheetPath ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
findSymbolsAndPins( aSchematicSheetList, candidate, aSyncSymMap, aSyncPinMap,
|
||||||
|
aRecursive );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SCH_REFERENCE_LIST references;
|
SCH_REFERENCE_LIST references;
|
||||||
|
@ -526,7 +532,7 @@ bool findSymbolsAndPins(
|
||||||
|
|
||||||
|
|
||||||
bool sheetContainsOnlyWantedItems(
|
bool sheetContainsOnlyWantedItems(
|
||||||
const SCHEMATIC& aSchematic, const SCH_SHEET_PATH& aSheetPath,
|
const SCH_SHEET_LIST& aSchematicSheetList, const SCH_SHEET_PATH& aSheetPath,
|
||||||
std::unordered_map<wxString, std::vector<SCH_REFERENCE>>& aSyncSymMap,
|
std::unordered_map<wxString, std::vector<SCH_REFERENCE>>& aSyncSymMap,
|
||||||
std::unordered_map<wxString, std::unordered_map<wxString, SCH_PIN*>>& aSyncPinMap,
|
std::unordered_map<wxString, std::unordered_map<wxString, SCH_PIN*>>& aSyncPinMap,
|
||||||
std::unordered_map<SCH_SHEET_PATH, bool>& aCache )
|
std::unordered_map<SCH_SHEET_PATH, bool>& aCache )
|
||||||
|
@ -537,9 +543,12 @@ bool sheetContainsOnlyWantedItems(
|
||||||
return cacheIt->second;
|
return cacheIt->second;
|
||||||
|
|
||||||
// Iterate over children
|
// Iterate over children
|
||||||
for( const SCH_SHEET_PATH& sheet : SCH_SHEET_LIST( aSheetPath.Last() ) )
|
for( const SCH_SHEET_PATH& candidate : aSchematicSheetList )
|
||||||
{
|
{
|
||||||
bool childRet = sheetContainsOnlyWantedItems( aSchematic, sheet, aSyncSymMap,
|
if( candidate == aSheetPath || !candidate.IsContainedWithin( aSheetPath ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bool childRet = sheetContainsOnlyWantedItems( aSchematicSheetList, candidate, aSyncSymMap,
|
||||||
aSyncPinMap, aCache );
|
aSyncPinMap, aCache );
|
||||||
|
|
||||||
if( !childRet )
|
if( !childRet )
|
||||||
|
@ -609,7 +618,7 @@ findItemsFromSyncSelection( const SCHEMATIC& aSchematic, const std::string aSync
|
||||||
std::optional<std::pair<wxString, wxString>> focusPin;
|
std::optional<std::pair<wxString, wxString>> focusPin;
|
||||||
std::unordered_map<SCH_SHEET_PATH, std::vector<SCH_ITEM*>> focusItemResults;
|
std::unordered_map<SCH_SHEET_PATH, std::vector<SCH_ITEM*>> focusItemResults;
|
||||||
|
|
||||||
const SCH_SHEET_LIST allSheetsList = aSchematic.BuildSheetListSortedByPageNumbers();
|
const SCH_SHEET_LIST allSheetsList = aSchematic.BuildUnorderedSheetList();
|
||||||
|
|
||||||
// In orderedSheets, the current sheet comes first.
|
// In orderedSheets, the current sheet comes first.
|
||||||
std::vector<SCH_SHEET_PATH> orderedSheets;
|
std::vector<SCH_SHEET_PATH> orderedSheets;
|
||||||
|
@ -751,7 +760,7 @@ findItemsFromSyncSelection( const SCHEMATIC& aSchematic, const std::string aSync
|
||||||
clearSyncMaps();
|
clearSyncMaps();
|
||||||
|
|
||||||
// Fill sync maps
|
// Fill sync maps
|
||||||
findSymbolsAndPins( aSchematic, aSheet, syncSymMap, syncPinMap );
|
findSymbolsAndPins( allSheetsList, aSheet, syncSymMap, syncPinMap );
|
||||||
std::vector<SCH_ITEM*> itemsVector = flattenSyncMaps();
|
std::vector<SCH_ITEM*> itemsVector = flattenSyncMaps();
|
||||||
|
|
||||||
// Add fully wanted sheets to vector
|
// Add fully wanted sheets to vector
|
||||||
|
@ -766,7 +775,7 @@ findItemsFromSyncSelection( const SCHEMATIC& aSchematic, const std::string aSync
|
||||||
if( !subsheetPath )
|
if( !subsheetPath )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( sheetContainsOnlyWantedItems( aSchematic, *subsheetPath, syncSymMap, syncPinMap,
|
if( sheetContainsOnlyWantedItems( allSheetsList, *subsheetPath, syncSymMap, syncPinMap,
|
||||||
fullyWantedCache ) )
|
fullyWantedCache ) )
|
||||||
{
|
{
|
||||||
itemsVector.push_back( item );
|
itemsVector.push_back( item );
|
||||||
|
@ -782,7 +791,7 @@ findItemsFromSyncSelection( const SCHEMATIC& aSchematic, const std::string aSync
|
||||||
{
|
{
|
||||||
clearSyncMaps();
|
clearSyncMaps();
|
||||||
|
|
||||||
findSymbolsAndPins( aSchematic, sheetPath, syncSymMap, syncPinMap );
|
findSymbolsAndPins( allSheetsList, sheetPath, syncSymMap, syncPinMap );
|
||||||
|
|
||||||
checkFocusItems( sheetPath );
|
checkFocusItems( sheetPath );
|
||||||
}
|
}
|
||||||
|
@ -804,7 +813,7 @@ findItemsFromSyncSelection( const SCHEMATIC& aSchematic, const std::string aSync
|
||||||
{
|
{
|
||||||
clearSyncMaps();
|
clearSyncMaps();
|
||||||
|
|
||||||
findSymbolsAndPins( aSchematic, sheetPath, syncSymMap, syncPinMap );
|
findSymbolsAndPins( allSheetsList, sheetPath, syncSymMap, syncPinMap );
|
||||||
|
|
||||||
if( !syncMapsValuesEmpty() )
|
if( !syncMapsValuesEmpty() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue