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();
|
||||
|
||||
if( aPanel->IsMouseCaptured() ) // Erase current drawing on screen
|
||||
if( aPanel->IsMouseCaptured() )
|
||||
{
|
||||
aPanel->SetMouseCapture( NULL, 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 );
|
||||
aPanel->GetParent()->HandleBlockEnd( aDC );
|
||||
|
||||
screen->m_BlockLocate.SetCommand( BLOCK_IDLE );
|
||||
aPanel->GetParent()->DisplayToolMsg( wxEmptyString );
|
||||
|
||||
// ugly, but temporary
|
||||
|
|
|
@ -130,10 +130,6 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
|||
{
|
||||
// This calls the block-abort command routine on cleanup
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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 )
|
||||
{
|
||||
block->SetState( STATE_NO_BLOCK );
|
||||
block->SetCommand( BLOCK_IDLE );
|
||||
GetScreen()->ClearBlockCommand();
|
||||
GetScreen()->ClearDrawingState();
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString,
|
||||
|
|
|
@ -386,11 +386,10 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
|
|||
|
||||
if( !nextCmd )
|
||||
{
|
||||
if( block->GetCommand() != BLOCK_SELECT_ITEMS_ONLY && GetCurPart() )
|
||||
if( block->GetCommand() != BLOCK_SELECT_ITEMS_ONLY && GetCurPart() )
|
||||
BlockClearSelectedItems( GetCurPart(), block );
|
||||
|
||||
block->SetState( STATE_NO_BLOCK );
|
||||
block->SetCommand( BLOCK_IDLE );
|
||||
GetScreen()->ClearBlockCommand();
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString,
|
||||
false );
|
||||
|
|
Loading…
Reference in New Issue