Fix some issues in PCB_SELECTION_TOOL::selectAllItemsOnSheet():
especially a typo that prevent working on root sheet.
Clearly, commit 6b2bb4d8
was very poorly designed and (or not even) tested.
This commit is contained in:
parent
f92d25e00b
commit
962df45b65
|
@ -1378,6 +1378,7 @@ int PCB_SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
|
||||||
void PCB_SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath )
|
void PCB_SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath )
|
||||||
{
|
{
|
||||||
std::list<FOOTPRINT*> footprintList;
|
std::list<FOOTPRINT*> footprintList;
|
||||||
|
bool isRootSheet = aSheetPath == wxT( "/" );
|
||||||
|
|
||||||
// store all footprints that are on that sheet path
|
// store all footprints that are on that sheet path
|
||||||
for( FOOTPRINT* footprint : board()->Footprints() )
|
for( FOOTPRINT* footprint : board()->Footprints() )
|
||||||
|
@ -1387,11 +1388,21 @@ void PCB_SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath )
|
||||||
|
|
||||||
wxString footprint_path = footprint->GetPath().AsString().BeforeLast('/');
|
wxString footprint_path = footprint->GetPath().AsString().BeforeLast('/');
|
||||||
|
|
||||||
if( aSheetPath.IsEmpty() )
|
if( footprint_path.IsEmpty() )
|
||||||
aSheetPath += '/';
|
footprint_path += '/';
|
||||||
|
|
||||||
if( footprint_path.StartsWith( aSheetPath ) )
|
if( isRootSheet )
|
||||||
|
{
|
||||||
|
// We are in the root sheet, so it makes no sense to select all footprints
|
||||||
|
// on board. So we select only footprints leaving in the root sheet
|
||||||
|
if( footprint_path == aSheetPath )
|
||||||
|
footprintList.push_back( footprint );
|
||||||
|
}
|
||||||
|
else if( footprint_path.StartsWith( aSheetPath ) )
|
||||||
|
{
|
||||||
|
// We are in a subsheet, select all footprints in this sheet and its subsheets
|
||||||
footprintList.push_back( footprint );
|
footprintList.push_back( footprint );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate a list of all pads, and of all nets they belong to.
|
// Generate a list of all pads, and of all nets they belong to.
|
||||||
|
|
Loading…
Reference in New Issue