Clean up undo when cancelling block operation.
Fixes: lp:1809444 * https://bugs.launchpad.net/kicad/+bug/1809444
This commit is contained in:
parent
51e6f56300
commit
4c184f07a6
|
@ -180,20 +180,15 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
||||||
{
|
{
|
||||||
BASE_SCREEN* screen = aPanel->GetScreen();
|
BASE_SCREEN* screen = aPanel->GetScreen();
|
||||||
|
|
||||||
if( aPanel->IsMouseCaptured() ) // Erase current drawing on screen
|
if( aPanel->IsMouseCaptured() )
|
||||||
{
|
{
|
||||||
aPanel->SetMouseCapture( NULL, NULL );
|
aPanel->SetMouseCapture( NULL, NULL );
|
||||||
screen->SetCurItem( NULL );
|
screen->SetCurItem( NULL );
|
||||||
|
|
||||||
// Delete the picked wrapper if this is a picked list.
|
|
||||||
screen->m_BlockLocate.ClearItemsList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->m_BlockLocate.SetState( STATE_NO_BLOCK );
|
|
||||||
screen->m_BlockLocate.SetCommand( BLOCK_ABORT );
|
screen->m_BlockLocate.SetCommand( BLOCK_ABORT );
|
||||||
aPanel->GetParent()->HandleBlockEnd( aDC );
|
aPanel->GetParent()->HandleBlockEnd( aDC );
|
||||||
|
|
||||||
screen->m_BlockLocate.SetCommand( BLOCK_IDLE );
|
|
||||||
aPanel->GetParent()->DisplayToolMsg( wxEmptyString );
|
aPanel->GetParent()->DisplayToolMsg( wxEmptyString );
|
||||||
|
|
||||||
// ugly, but temporary
|
// ugly, but temporary
|
||||||
|
|
|
@ -130,10 +130,6 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
||||||
{
|
{
|
||||||
// This calls the block-abort command routine on cleanup
|
// This calls the block-abort command routine on cleanup
|
||||||
m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor() );
|
m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor() );
|
||||||
|
|
||||||
// We set the dangling ends to the block-scope, so we must set them back to
|
|
||||||
// schematic-socpe.
|
|
||||||
TestDanglingEnds();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,10 +338,24 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( block->GetCommand() == BLOCK_ABORT )
|
||||||
|
{
|
||||||
|
if( block->AppendUndo() )
|
||||||
|
{
|
||||||
|
PICKED_ITEMS_LIST* undo = GetScreen()->PopCommandFromUndoList();
|
||||||
|
PutDataInPreviousState( undo, false );
|
||||||
|
undo->ClearListAndDeleteItems();
|
||||||
|
delete undo;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We set the dangling ends to the block-scope, so we must set them back to
|
||||||
|
// schematic-scope.
|
||||||
|
TestDanglingEnds();
|
||||||
|
}
|
||||||
|
|
||||||
if( !nextcmd )
|
if( !nextcmd )
|
||||||
{
|
{
|
||||||
block->SetState( STATE_NO_BLOCK );
|
GetScreen()->ClearBlockCommand();
|
||||||
block->SetCommand( BLOCK_IDLE );
|
|
||||||
GetScreen()->ClearDrawingState();
|
GetScreen()->ClearDrawingState();
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString,
|
m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString,
|
||||||
|
|
|
@ -389,8 +389,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
|
||||||
if( block->GetCommand() != BLOCK_SELECT_ITEMS_ONLY && GetCurPart() )
|
if( block->GetCommand() != BLOCK_SELECT_ITEMS_ONLY && GetCurPart() )
|
||||||
BlockClearSelectedItems( GetCurPart(), block );
|
BlockClearSelectedItems( GetCurPart(), block );
|
||||||
|
|
||||||
block->SetState( STATE_NO_BLOCK );
|
GetScreen()->ClearBlockCommand();
|
||||||
block->SetCommand( BLOCK_IDLE );
|
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString,
|
m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString,
|
||||||
false );
|
false );
|
||||||
|
|
Loading…
Reference in New Issue