Make sure undo/redo of pagesetup is done to correct sheet.

Fixes https://gitlab.com/kicad/code/kicad/issues/9999
This commit is contained in:
Jeff Young 2021-12-21 21:06:52 +00:00
parent 8b52e969d6
commit aa4dcb2bf1
1 changed files with 5 additions and 3 deletions

View File

@ -266,10 +266,9 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
// same item can be changed and deleted in the same complex command).
for( int ii = aList->GetCount() - 1; ii >= 0; ii-- )
{
UNDO_REDO status = aList->GetPickedItemStatus((unsigned) ii );
UNDO_REDO status = aList->GetPickedItemStatus( (unsigned) ii );
EDA_ITEM* eda_item = aList->GetPickedItem( (unsigned) ii );
SCH_SCREEN* screen =
dynamic_cast< SCH_SCREEN* >( aList->GetScreenForItem( (unsigned) ii ) );
SCH_SCREEN* screen = dynamic_cast<SCH_SCREEN*>( aList->GetScreenForItem( (unsigned) ii ) );
wxCHECK( screen, /* void */ );
@ -295,6 +294,9 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
}
else if( status == UNDO_REDO::PAGESETTINGS )
{
SetCurrentSheet( *m_schematic->GetSheets().FindSheetForScreen( screen ) );
DisplayCurrentSheet();
// swap current settings with stored settings
DS_PROXY_UNDO_ITEM alt_item( this );
DS_PROXY_UNDO_ITEM* item = static_cast<DS_PROXY_UNDO_ITEM*>( eda_item );