mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-20 15:01:41 +00:00
schematic: convert RunOnChildren to also take recursion mode argument
Prepping for SCH_GROUPS, making consistent with the PCB code.
This commit is contained in:
parent
a90b8ec57a
commit
c67924ccac
eeschema
connection_graph.cpp
dialogs
erc
lib_symbol.cpplib_symbol.hsch_commit.cppsch_edit_frame.cppsch_io/kicad_sexpr
sch_item.cppsch_item.hsch_label.cppsch_label.hsch_marker.cppsch_rule_area.cppsch_screen.cppsch_sheet.cppsch_sheet.hsch_sheet_path.cppsch_symbol.cppsch_symbol.hsch_table.cppsch_table.htools
include
@ -478,7 +478,8 @@ CONNECTION_SUBGRAPH::GetNetclassesForDriver( SCH_ITEM* aItem ) const
|
||||
foundNetclasses.push_back( { netclass, aItem } );
|
||||
}
|
||||
}
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
|
||||
std::sort(
|
||||
foundNetclasses.begin(), foundNetclasses.end(),
|
||||
|
@ -146,7 +146,8 @@ DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, SCH_PIN
|
||||
m_dummyParent->RunOnChildren( [&]( SCH_ITEM* child )
|
||||
{
|
||||
child->SetUnit( 1 );
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
|
||||
m_dummyPin = new SCH_PIN( *m_pin );
|
||||
m_dummyPin->SetUnit( 2 );
|
||||
|
@ -327,7 +327,8 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
|
||||
testAssertion( symbol, sheet, screen, textboxItem->GetText(),
|
||||
textboxItem->GetPosition() );
|
||||
}
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
}
|
||||
else if( SCH_LABEL_BASE* label = dynamic_cast<SCH_LABEL_BASE*>( item ) )
|
||||
@ -723,7 +724,8 @@ int ERC_TESTER::TestMissingNetclasses()
|
||||
}
|
||||
|
||||
return true;
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1192,7 +1192,7 @@ wxString LIB_SYMBOL::GetPrefix()
|
||||
}
|
||||
|
||||
|
||||
void LIB_SYMBOL::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction )
|
||||
void LIB_SYMBOL::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode )
|
||||
{
|
||||
for( SCH_ITEM& item : m_drawings )
|
||||
aFunction( &item );
|
||||
|
@ -378,7 +378,7 @@ public:
|
||||
*/
|
||||
void AutoplaceFields( SCH_SCREEN* aScreen, AUTOPLACE_ALGO aAlgo ) override;
|
||||
|
||||
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
|
||||
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode ) override;
|
||||
|
||||
/**
|
||||
* Resolve any references to system tokens supported by the symbol.
|
||||
|
@ -137,7 +137,8 @@ void SCH_COMMIT::pushLibEdit( const wxString& aMessage, int aCommitFlags )
|
||||
[&]( SCH_ITEM* aChild )
|
||||
{
|
||||
view->Update( aChild );
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
|
||||
if( !( aCommitFlags & SKIP_UNDO ) )
|
||||
@ -220,7 +221,8 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
|
||||
{
|
||||
if( aChild->IsSelected() )
|
||||
selectedModified = true;
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
|
||||
auto updateConnectivityFlag = [&]()
|
||||
@ -580,7 +582,7 @@ void SCH_COMMIT::Revert()
|
||||
if( unselect )
|
||||
{
|
||||
item->ClearSelected();
|
||||
item->RunOnChildren( []( SCH_ITEM* aChild ) { aChild->ClearSelected(); } );
|
||||
item->RunOnChildren( []( SCH_ITEM* aChild ) { aChild->ClearSelected(); }, RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
|
||||
// Special cases for items which have instance data
|
||||
|
@ -1544,7 +1544,8 @@ void SCH_EDIT_FRAME::RefreshOperatingPointDisplay()
|
||||
{
|
||||
if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
|
||||
invalidateTextVars( text );
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
|
||||
if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem ) )
|
||||
@ -2069,7 +2070,8 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_COMMIT* aCommit, SCH_CLEANUP_FL
|
||||
{
|
||||
if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
|
||||
invalidateTextVars( text );
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
|
||||
if( flags & KIGFX::GEOMETRY )
|
||||
GetScreen()->Update( item, false ); // Refresh RTree
|
||||
@ -2464,7 +2466,8 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
|
||||
[&]( SCH_ITEM* aChild )
|
||||
{
|
||||
visit( aChild );
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
|
||||
if( !screen->m_zoomInitialized )
|
||||
|
@ -280,7 +280,8 @@ LIB_SYMBOL* SCH_IO_KICAD_SEXPR_PARSER::ParseSymbol( LIB_SYMBOL_MAP& aSymbolLibMa
|
||||
{
|
||||
if( EDA_TEXT* textItem = dynamic_cast<EDA_TEXT*>( aChild ) )
|
||||
textItem->ResolveFont( embeddedFonts );
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -623,7 +624,8 @@ LIB_SYMBOL* SCH_IO_KICAD_SEXPR_PARSER::parseLibSymbol( LIB_SYMBOL_MAP& aSymbolLi
|
||||
{
|
||||
if( EDA_TEXT* textItem = dynamic_cast<EDA_TEXT*>( aChild ) )
|
||||
textItem->ResolveFont( embeddedFonts );
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
|
||||
return symbol.release();
|
||||
}
|
||||
|
@ -146,7 +146,8 @@ SCH_ITEM* SCH_ITEM::Duplicate( bool doClone ) const
|
||||
[]( SCH_ITEM* aChild )
|
||||
{
|
||||
aChild->ClearFlags( SELECTED | BRIGHTENED );
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
|
||||
return newItem;
|
||||
}
|
||||
@ -409,7 +410,7 @@ void SCH_ITEM::ClearCaches()
|
||||
|
||||
clearTextCaches( this );
|
||||
|
||||
RunOnChildren( clearTextCaches );
|
||||
RunOnChildren( clearTextCaches, RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
|
||||
|
||||
|
@ -567,7 +567,7 @@ public:
|
||||
|
||||
virtual void AutoplaceFields( SCH_SCREEN* aScreen, AUTOPLACE_ALGO aAlgo ) { }
|
||||
|
||||
virtual void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) { }
|
||||
virtual void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode ) { }
|
||||
|
||||
virtual void ClearCaches();
|
||||
|
||||
|
@ -843,7 +843,7 @@ wxString SCH_LABEL_BASE::GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowE
|
||||
}
|
||||
|
||||
|
||||
void SCH_LABEL_BASE::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction )
|
||||
void SCH_LABEL_BASE::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode )
|
||||
{
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
aFunction( &field );
|
||||
|
@ -281,7 +281,7 @@ public:
|
||||
bool HasCachedDriverName() const override;
|
||||
const wxString& GetCachedDriverName() const override;
|
||||
|
||||
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
|
||||
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode ) override;
|
||||
|
||||
INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
|
||||
const std::vector<KICAD_T>& scanTypes ) override;
|
||||
|
@ -174,7 +174,8 @@ SCH_MARKER* SCH_MARKER::DeserializeFromString( const SCH_SHEET_LIST& aSheetList,
|
||||
if( text_item->GetText() == props[4] )
|
||||
uuid = child->m_Uuid;
|
||||
}
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
|
||||
// If it's a symbol, we must also check non-overridden LIB_SYMBOL text children
|
||||
if( uuid == niluuid && parent->Type() == SCH_SYMBOL_T )
|
||||
@ -191,7 +192,8 @@ SCH_MARKER* SCH_MARKER::DeserializeFromString( const SCH_SHEET_LIST& aSheetList,
|
||||
if( text_item->GetText() == props[4] )
|
||||
uuid = child->m_Uuid;
|
||||
}
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
|
||||
if( uuid != niluuid )
|
||||
|
@ -354,7 +354,8 @@ const std::vector<std::pair<wxString, SCH_ITEM*>> SCH_RULE_AREA::GetResolvedNetc
|
||||
}
|
||||
|
||||
return true;
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
|
||||
return resolvedNetclasses;
|
||||
|
@ -1138,7 +1138,7 @@ void SCH_SCREEN::TestDanglingEnds( const SCH_SHEET_PATH* aPath,
|
||||
for( SCH_ITEM* item : Items() )
|
||||
{
|
||||
get_ends( item );
|
||||
item->RunOnChildren( get_ends );
|
||||
item->RunOnChildren( get_ends, RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
|
||||
PROF_TIMER sortTimer( "SCH_SCREEN::TestDanglingEnds pre-sort" );
|
||||
@ -1152,7 +1152,7 @@ void SCH_SCREEN::TestDanglingEnds( const SCH_SHEET_PATH* aPath,
|
||||
for( SCH_ITEM* item : Items() )
|
||||
{
|
||||
update_state( item );
|
||||
item->RunOnChildren( update_state );
|
||||
item->RunOnChildren( update_state, RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
|
||||
if( wxLog::IsAllowedTraceMask( DanglingProfileMask ) )
|
||||
@ -1365,7 +1365,8 @@ void SCH_SCREEN::FixupEmbeddedData()
|
||||
{
|
||||
if( EDA_TEXT* textItem = dynamic_cast<EDA_TEXT*>( aChild ) )
|
||||
textItem->ResolveFont( embeddedFonts );
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
|
||||
std::vector<SCH_ITEM*> items_to_update;
|
||||
@ -1382,7 +1383,8 @@ void SCH_SCREEN::FixupEmbeddedData()
|
||||
{
|
||||
if( EDA_TEXT* textItem = dynamic_cast<EDA_TEXT*>( aChild ) )
|
||||
update |= textItem->ResolveFont( embeddedFonts );
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
|
||||
if( update )
|
||||
items_to_update.push_back( item );
|
||||
|
@ -1156,7 +1156,7 @@ INSPECT_RESULT SCH_SHEET::Visit( INSPECTOR aInspector, void* testData,
|
||||
}
|
||||
|
||||
|
||||
void SCH_SHEET::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction )
|
||||
void SCH_SHEET::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode )
|
||||
{
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
aFunction( &field );
|
||||
|
@ -376,7 +376,7 @@ public:
|
||||
INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
|
||||
const std::vector<KICAD_T>& aScanTypes ) override;
|
||||
|
||||
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
|
||||
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode ) override;
|
||||
|
||||
/**
|
||||
* Set or clear the exclude from simulation flag.
|
||||
|
@ -978,7 +978,8 @@ SCH_ITEM* SCH_SHEET_PATH::GetItem( const KIID& aID ) const
|
||||
{
|
||||
if( aChild->m_Uuid == aID )
|
||||
childMatch = aChild;
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
|
||||
if( childMatch )
|
||||
return childMatch;
|
||||
@ -1002,7 +1003,8 @@ void SCH_SHEET_LIST::FillItemMap( std::map<KIID, EDA_ITEM*>& aMap )
|
||||
[&]( SCH_ITEM* aChild )
|
||||
{
|
||||
aMap[ aChild->m_Uuid ] = aChild;
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1083,7 +1083,7 @@ void SCH_SYMBOL::SyncOtherUnits( const SCH_SHEET_PATH& aSourceSheet, SCH_COMMIT&
|
||||
}
|
||||
|
||||
|
||||
void SCH_SYMBOL::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction )
|
||||
void SCH_SYMBOL::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode )
|
||||
{
|
||||
for( const std::unique_ptr<SCH_PIN>& pin : m_pins )
|
||||
aFunction( pin.get() );
|
||||
|
@ -580,7 +580,7 @@ public:
|
||||
*/
|
||||
void AutoplaceFields( SCH_SCREEN* aScreen, AUTOPLACE_ALGO aAlgo ) override;
|
||||
|
||||
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
|
||||
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode ) override;
|
||||
|
||||
|
||||
//-----</Fields>----------------------------------------------------------
|
||||
|
@ -245,7 +245,7 @@ bool SCH_TABLE::operator<( const SCH_ITEM& aItem ) const
|
||||
}
|
||||
|
||||
|
||||
void SCH_TABLE::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction )
|
||||
void SCH_TABLE::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode )
|
||||
{
|
||||
for( SCH_TABLECELL* cell : m_cells )
|
||||
aFunction( cell );
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
void SetStrokeRows( bool aDoStroke ) { m_strokeRows = aDoStroke; }
|
||||
bool StrokeRows() const { return m_strokeRows; }
|
||||
|
||||
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
|
||||
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction, RECURSE_MODE aMode ) override;
|
||||
|
||||
bool operator<( const SCH_ITEM& aItem ) const override;
|
||||
|
||||
|
@ -1852,7 +1852,8 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||
item->RunOnChildren( [&]( SCH_ITEM* aChild )
|
||||
{
|
||||
m_view->AddToPreview( aChild, false );
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
m_frame->SetMsgPanel( item );
|
||||
};
|
||||
|
||||
|
@ -1058,7 +1058,8 @@ int SCH_EDITOR_CONTROL::AssignNetclass( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
|
||||
invalidateTextVars( text );
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
|
||||
if( flags & KIGFX::GEOMETRY )
|
||||
m_frame->GetScreen()->Update( item, false ); // Refresh RTree
|
||||
@ -2659,7 +2660,8 @@ int SCH_EDITOR_CONTROL::MarkSimExclusions( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aChild ) )
|
||||
invalidateTextVars( text );
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
|
||||
if( item->GetExcludedFromSim() )
|
||||
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
|
||||
@ -2822,7 +2824,8 @@ int SCH_EDITOR_CONTROL::RepairSchematic( const TOOL_EVENT& aEvent )
|
||||
[&]( SCH_ITEM* aChild )
|
||||
{
|
||||
processItem( item );
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,8 @@ int SCH_FIND_REPLACE_TOOL::UpdateFind( const TOOL_EVENT& aEvent )
|
||||
[&]( SCH_ITEM* aChild )
|
||||
{
|
||||
visit( aChild, &m_frame->GetCurrentSheet() );
|
||||
} );
|
||||
},
|
||||
RECURSE_MODE::NO_RECURSE );
|
||||
}
|
||||
};
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user