Can't add to parent group without a commit.

We allow this only for file import, where we don't
need to handle group membership anyway.
This commit is contained in:
Jeff Young 2025-07-11 15:03:20 +01:00
parent 5d05c36d2e
commit dc0e211e1e
8 changed files with 26 additions and 8 deletions

View File

@ -570,7 +570,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// I can't put it right now because of the extra code that is above to convert legacy bus-bus
// entries to bus wires
if( schFileType == SCH_IO_MGR::SCH_LEGACY )
Schematic().FixupJunctions();
Schematic().FixupJunctionsAfterImport();
SyncView();
GetScreen()->ClearDrawingState();

View File

@ -164,7 +164,7 @@ SCH_SHEET* SCH_IO_CADSTAR_ARCHIVE::LoadSchematicFile( const wxString& aFi
}
// Need to fix up junctions after import to retain connectivity
aSchematic->FixupJunctions();
aSchematic->FixupJunctionsAfterImport();
return rootSheet;
}

View File

@ -641,7 +641,7 @@ SCH_SHEET* SCH_IO_EASYEDAPRO::LoadSchematicFile( const wxString& aFileName,
sch_plugin->SaveLibrary( libFileName.GetFullPath() );
aSchematic->CurrentSheet().UpdateAllScreenReferences();
aSchematic->FixupJunctions();
aSchematic->FixupJunctionsAfterImport();
return rootSheet;
}

View File

@ -142,7 +142,7 @@ SCH_SHEET* SCH_IO_LTSPICE::LoadSchematicFile( const wxString& aFileName, SCHEMAT
aSchematic->CurrentSheet().UpdateAllScreenReferences();
// fixing all junctions at the end
aSchematic->FixupJunctions();
aSchematic->FixupJunctionsAfterImport();
return rootSheet;
}

View File

@ -545,7 +545,19 @@ SCH_LINE* SCH_LINE::MergeOverlap( SCH_SCREEN* aScreen, SCH_LINE* aLine, bool aCh
SCH_LINE* SCH_LINE::BreakAt( SCH_COMMIT* aCommit, const VECTOR2I& aPoint )
{
SCH_LINE* newSegment = static_cast<SCH_LINE*>( Duplicate( true, aCommit ) );
SCH_LINE* newSegment = static_cast<SCH_LINE*>( Duplicate( true /* addToParentGroup */, aCommit ) );
newSegment->SetStartPoint( aPoint );
newSegment->SetConnectivityDirty( true );
SetEndPoint( aPoint );
return newSegment;
}
SCH_LINE* SCH_LINE::NonGroupAware_BreakAt( const VECTOR2I& aPoint )
{
SCH_LINE* newSegment = static_cast<SCH_LINE*>( Duplicate( false /* addToParentGroup */, nullptr ) );
newSegment->SetStartPoint( aPoint );
newSegment->SetConnectivityDirty( true );

View File

@ -259,6 +259,12 @@ public:
*/
SCH_LINE* BreakAt( SCH_COMMIT* aCommit, const VECTOR2I& aPoint );
/**
* This version should only be used when importing files. It cannot handle breaking wires
* that are part of groups (as it has no commit to modify the parent group within).
*/
SCH_LINE* NonGroupAware_BreakAt( const VECTOR2I& aPoint );
bool IsParallel( const SCH_LINE* aLine ) const;
/**

View File

@ -765,7 +765,7 @@ wxString SCHEMATIC::GetOperatingPoint( const wxString& aNetName, int aPrecision,
}
void SCHEMATIC::FixupJunctions()
void SCHEMATIC::FixupJunctionsAfterImport()
{
SCH_SCREENS screens( Root() );
@ -785,7 +785,7 @@ void SCHEMATIC::FixupJunctions()
// Breakup wires
for( SCH_LINE* wire : screen->GetBusesAndWires( point, true ) )
{
SCH_LINE* newSegment = wire->BreakAt( nullptr, point );
SCH_LINE* newSegment = wire->NonGroupAware_BreakAt( point );
screen->Append( newSegment );
}
}

View File

@ -284,7 +284,7 @@ public:
* This function is needed for some plugins (e.g. Legacy and Cadstar) in order to retain
* connectivity after loading.
*/
void FixupJunctions();
void FixupJunctionsAfterImport();
/**
* Break a single segment into two at the specified point.