Allow sheet recursion, fix sheet paths in "Highlight on PCB".
"Highlight on PCB" and "Select" - "Items in Same Hierarchical Sheet" actions were extended to select items on subsheets too. "Highlight on PCB" now uses a proper full sheet path, allowing it to work in subsheets. Fixes https://gitlab.com/kicad/code/kicad/issues/11493
This commit is contained in:
parent
8cd289cf69
commit
6b2bb4d808
|
@ -379,7 +379,8 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
|||
}
|
||||
|
||||
|
||||
std::string FormatProbeItem( EDA_ITEM* aItem, SCH_SYMBOL* aSymbol )
|
||||
std::string FormatProbeItem( const SCH_SHEET_PATH& aCurrentSheet, EDA_ITEM* aItem,
|
||||
SCH_SYMBOL* aSymbol )
|
||||
{
|
||||
// This is a keyword followed by a quoted string.
|
||||
|
||||
|
@ -403,20 +404,8 @@ std::string FormatProbeItem( EDA_ITEM* aItem, SCH_SYMBOL* aSymbol )
|
|||
{
|
||||
// For cross probing, we need the full path of the sheet, because
|
||||
// in complex hierarchies the sheet uuid of not unique
|
||||
SCH_SHEET* sheet = (SCH_SHEET*)aItem;
|
||||
wxString full_path;
|
||||
|
||||
SCH_SHEET* parent = sheet;
|
||||
while( (parent = dynamic_cast<SCH_SHEET*>( parent->GetParent() ) ) )
|
||||
{
|
||||
if( parent->GetParent() ) // The root sheet has no parent and path is just "/"
|
||||
{
|
||||
full_path.Prepend( parent->m_Uuid.AsString() );
|
||||
full_path.Prepend( "/" );
|
||||
}
|
||||
}
|
||||
|
||||
full_path += "/" + sheet->m_Uuid.AsString();
|
||||
wxString full_path = aCurrentSheet.PathAsString() + aItem->m_Uuid.AsString();
|
||||
|
||||
return StrPrintf( "$SHEET: \"%s\"", TO_UTF8( full_path ) );
|
||||
}
|
||||
|
@ -454,7 +443,7 @@ void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* aObjectToSync, SCH_SYMBOL* a
|
|||
if( !aObjectToSync )
|
||||
return;
|
||||
|
||||
std::string packet = FormatProbeItem( aObjectToSync, aLibItem );
|
||||
std::string packet = FormatProbeItem( GetCurrentSheet(), aObjectToSync, aLibItem );
|
||||
|
||||
if( !packet.empty() )
|
||||
{
|
||||
|
|
|
@ -1366,7 +1366,7 @@ void PCB_SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath )
|
|||
if( aSheetPath.IsEmpty() )
|
||||
aSheetPath += '/';
|
||||
|
||||
if( footprint_path == aSheetPath )
|
||||
if( footprint_path.StartsWith( aSheetPath ) )
|
||||
footprintList.push_back( footprint );
|
||||
}
|
||||
|
||||
|
|
|
@ -315,7 +315,7 @@ private:
|
|||
void selectAllItemsOnNet( int aNetCode, bool aSelect = true );
|
||||
|
||||
/**
|
||||
* Select all items with the given sheet timestamp/UUID name (the sheet path).
|
||||
* Select all items on a sheet and its subsheets, given the full sheet path.
|
||||
*
|
||||
* The path of the root sheet is "/".
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue