52 config.m_ConnectivityEngine =
true;
53 config.m_IncrementalConnectivity =
true;
56 SCH_SCREEN* screen = schematic->GetTopLevelSheets().front()->GetScreen();
61 auto* candidate =
static_cast<SCH_SYMBOL*
>( item );
63 if( candidate->GetLibSymbolRef() && candidate->GetPins().size() >= 2 )
72 manager.
SetEnvironment( schematic.get(),
nullptr,
nullptr,
nullptr,
nullptr );
73 schematic->RebuildConnectivity();
75 const auto verify = [&]()
78 rebuilt.
Update( *schematic,
true );
85 const wxString number =
pin->GetNumber();
92 for(
SCH_PIN* libPin : updated->GetPinsByNumber( number ) )
96 replacement.
Modify( symbol, screen );
99 replacement.
Push(
"Replace native symbol pin set",
SKIP_UNDO );
100 BOOST_CHECK( !schematic->Connectivity().Connection(
id,
path ) );
104 restoration.
Modify( symbol, screen );
108 BOOST_CHECK( restored->
GetParent() == symbol );
109 BOOST_CHECK( restored == symbol->
GetPin( number ) );
110 restoration.
Push(
"Restore native symbol pin set",
SKIP_UNDO );
119 SCH_SCREEN* screen = schematic->GetTopLevelSheets().front()->GetScreen();
125 auto* candidate =
static_cast<SCH_SYMBOL*
>( item );
127 for(
SCH_PIN* candidatePin : candidate->GetPins() )
129 if( !candidatePin->GetAlt().IsEmpty() )
143 const wxString alternate =
pin->GetAlt();
144 const auto type =
pin->GetType();
146 auto copy = std::make_unique<SCH_SYMBOL>( *symbol );
152 BOOST_CHECK( updated->GetType() == type );
153 BOOST_CHECK( updated->GetLibPin()->GetParent() == symbol->
GetLibSymbolRef().get() );
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
EDA_ITEM * GetParent() const
EE_TYPE OfType(KICAD_T aType) const
void RemoveDrawItem(SCH_ITEM *aItem)
Remove draw aItem from list.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
Commit for the schematic and symbol editors.
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
Model-owned source resolver.
void Update(SCHEMATIC &aSchematic, bool aRebuild=false)
Base class for any item which can be embedded within the SCHEMATIC container class,...
void SwapItemData(SCH_ITEM *aImage)
Swap data between aItem and aImage.
EE_RTREE & Items()
Get the full RTree, usually for iterating.
SCH_ITEM * GetConnectivityItem(const KIID &aId) const
Resolve a drawing item or a connectable child on this screen; ambiguous IDs return null.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
void SetLibSymbol(LIB_SYMBOL *aLibSymbol)
Set this schematic symbol library symbol reference to aLibSymbol.
RAII class that sets an value at construction and resets it to the original value at destruction.
void LoadSchematic(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< SCHEMATIC > &aSchematic)
std::string Dump(SCHEMATIC &aSchematic)
Canonical, pointer-free connectivity rows for migration and rebuild comparisons.
std::unique_ptr< SCHEMATIC > schematic
SETTINGS_MANAGER settings
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_CASE(ScreenIndexTracksSymbolPinReplacementAndUndo)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL(result, "25.4")