Fine-tune SCH_COMMIT handling of child objects.
While a SCH_SHEET does indeed have a SCH_SHEET parent, it's not one of the children that gets added as a CHT_MODIFY of its parent. Also fixes a bug where the newly drawn sheet gets removed from the preview before running the dialog. Fixes https://gitlab.com/kicad/code/kicad/-/issues/14976
This commit is contained in:
parent
9199d7a781
commit
e9046076a6
|
@ -73,8 +73,14 @@ COMMIT& SCH_COMMIT::Stage( EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN
|
|||
|
||||
// If aItem belongs a symbol, the full symbol will be saved because undo/redo does
|
||||
// not handle "sub items" modifications.
|
||||
if( aItem->GetParent() && aItem->GetParent()->IsType( { SCH_SYMBOL_T, LIB_SYMBOL_T,
|
||||
SCH_SHEET_T } ) )
|
||||
if( aItem->GetParent() && aItem->GetParent()->IsType( { SCH_SYMBOL_T, LIB_SYMBOL_T } ) )
|
||||
{
|
||||
aItem->SetFlags( IS_MODIFIED_CHILD );
|
||||
aItem = aItem->GetParent();
|
||||
aChangeType = CHT_MODIFY;
|
||||
}
|
||||
// Same for fields of a sheet or label
|
||||
else if( aItem->Type() == SCH_FIELD_T && aItem->GetParent() )
|
||||
{
|
||||
aItem->SetFlags( IS_MODIFIED_CHILD );
|
||||
aItem = aItem->GetParent();
|
||||
|
@ -237,7 +243,7 @@ void SCH_COMMIT::pushSchEdit( const wxString& aMessage, int aCommitFlags )
|
|||
|
||||
if( !( changeFlags & CHT_DONE ) )
|
||||
{
|
||||
if( !schItem->GetParent() )
|
||||
if( !screen->CheckIfOnDrawList( schItem ) ) // don't want a loop!
|
||||
screen->Append( schItem );
|
||||
|
||||
if( view )
|
||||
|
|
|
@ -1898,13 +1898,14 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
|| isSyntheticClick
|
||||
|| evt->IsAction( &EE_ACTIONS::finishSheet ) ) )
|
||||
{
|
||||
m_view->ClearPreview();
|
||||
getViewControls()->SetAutoPan( false );
|
||||
getViewControls()->CaptureCursor( false );
|
||||
|
||||
if( m_frame->EditSheetProperties( static_cast<SCH_SHEET*>( sheet ),
|
||||
&m_frame->GetCurrentSheet(), nullptr ) )
|
||||
{
|
||||
m_view->ClearPreview();
|
||||
|
||||
sheet->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
|
||||
|
||||
SCH_COMMIT commit( m_toolMgr );
|
||||
|
@ -1916,6 +1917,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_view->ClearPreview();
|
||||
delete sheet;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue