Sync Sheet Pins: Add checks for empty sheet paths and display an info message when no sub schematic is found

This commit is contained in:
Ethan Chien
2024-12-30 13:45:50 +08:00
parent 19c748048c
commit dea53b7b60
+10
View File
@@ -3182,7 +3182,9 @@ void SCH_DRAWING_TOOLS::sizeSheet( SCH_SHEET* aSheet, const VECTOR2I& aPos )
int SCH_DRAWING_TOOLS::doSyncSheetsPins( std::list<SCH_SHEET_PATH> sheetPaths )
{
if( !sheetPaths.size() )
{
return 0;
}
m_dialogSyncSheetPin = std::make_unique<DIALOG_SYNC_SHEET_PINS>(
m_frame, std::move( sheetPaths ),
@@ -3311,6 +3313,14 @@ int SCH_DRAWING_TOOLS::SyncAllSheetsPins( const TOOL_EVENT& aEvent )
SCH_SHEET_PATH current;
current.push_back( &m_frame->Schematic().Root() );
getSheetChildren( sheetPaths, m_frame->Schematic().Root().GetScreen(), visited, current );
if( sheetPaths.size() == 0 )
{
m_frame->ShowInfoBarMsg( _( "No sub schematic found in the current project" ) );
return 0;
}
return doSyncSheetsPins( std::move( sheetPaths ) );
}