Handle multiple annotation in search

New schematic format needs to search client screen paths instead of
maintaining multiple copies in a flat format.
This commit is contained in:
Seth Hillbrand 2021-08-20 10:24:08 -07:00
parent 6470be11c3
commit 75e4fa9b75
1 changed files with 18 additions and 14 deletions

View File

@ -425,6 +425,8 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
SCH_SHEET_LIST schematic = m_frame->Schematic().GetSheets(); SCH_SHEET_LIST schematic = m_frame->Schematic().GetSheets();
SCH_SCREENS screens( m_frame->Schematic().Root() ); SCH_SCREENS screens( m_frame->Schematic().Root() );
screens.BuildClientSheetPathList();
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() ) for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
{ {
if( afterScreen ) if( afterScreen )
@ -435,15 +437,13 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
continue; continue;
} }
SCH_SHEET_PATH* sheet = schematic.FindSheetForScreen( screen ); for( SCH_SHEET_PATH sheet : screen->GetClientSheetPaths() )
{
item = nextMatch( screen, sheet, nullptr, data ); item = nextMatch( screen, &sheet, nullptr, data );
if( item ) if( item )
{ {
wxCHECK_MSG( sheet, 0, "Sheet not found for " + screen->GetFileName() ); m_frame->Schematic().SetCurrentSheet( sheet );
m_frame->Schematic().SetCurrentSheet( *sheet );
m_frame->GetCurrentSheet().UpdateAllScreenReferences(); m_frame->GetCurrentSheet().UpdateAllScreenReferences();
screen->TestDanglingEnds(); screen->TestDanglingEnds();
@ -454,6 +454,10 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
break; break;
} }
} }
if( item )
break;
}
} }
if( item ) if( item )