From bd529a7cb0e3d7a5d3a1ccb9f6f52b325523f61b Mon Sep 17 00:00:00 2001 From: charras Date: Thu, 13 Aug 2009 05:52:53 +0000 Subject: [PATCH] fixed in pcbnew: abort function in track creation incompatible with new undo/redo functions --- include/wxPcbStruct.h | 4 +++- pcbnew/board_undo_redo.cpp | 6 ++++-- pcbnew/editrack.cpp | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 377539be4b..f75b028cf2 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -161,8 +161,10 @@ public: * Put data pointed by List in the previous state, i.e. the state memorised by List * @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo * @param aRedoCommand = a bool: true for redo, false for undo + * @param aRebuildRatsnet = a bool: true to rebuid ratsnet (normal use), false + * to just retrieve las state (used in abort commands that do not need to rebuild ratsnest) */ - void PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand ); + void PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand, bool aRebuildRatsnet = true ); /** Function GetBoardFromRedoList * Redo the last edition: * - Save the current board in Undo list diff --git a/pcbnew/board_undo_redo.cpp b/pcbnew/board_undo_redo.cpp index 38a56e95f1..6bafce4b8e 100644 --- a/pcbnew/board_undo_redo.cpp +++ b/pcbnew/board_undo_redo.cpp @@ -463,8 +463,10 @@ void WinEDA_PcbFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, * Put data pointed by List in the previous state, i.e. the state memorised by List * @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo * @param aRedoCommand = a bool: true for redo, false for undo + * @param aRebuildRatsnet = a bool: true to rebuid ratsnet (normal use, and default), false + * to just retrieve las state (used in abort commands that do not need to rebuild ratsnest) */ -void WinEDA_PcbFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand ) +void WinEDA_PcbFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand, bool aRebuildRatsnet ) { BOARD_ITEM* item; bool not_found = false; @@ -557,7 +559,7 @@ void WinEDA_PcbFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRe wxMessageBox( wxT( "Incomplete undo/redo operation: some items not found" ) ); // Rebuild pointers and rastnest that can be changed. - if( reBuild_ratsnest ) + if( reBuild_ratsnest && aRebuildRatsnet ) Compile_Ratsnest( NULL, true ); } diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index a55cef64e2..4dacbe1ff4 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -54,7 +54,8 @@ static void Exit_Editrack( WinEDA_DrawPanel* Panel, wxDC* DC ) frame->MsgPanel->EraseMsgBox(); - // Clear the undo picker list: + // Undo pending changes (mainly a lock point cretion) and clear the undo picker list: + frame->PutDataInPreviousState(&s_ItemsListPicker, false, false); s_ItemsListPicker.ClearListAndDeleteItems(); // Delete current (new) track