Remove some dead code. A little bit of comment cleanup as well.
This commit is contained in:
parent
b08862e445
commit
cf42d692bf
|
@ -796,9 +796,8 @@ public:
|
||||||
* Restore an undo or redo command to put data pointed by \a aList in the previous state.
|
* Restore an undo or redo command to put data pointed by \a aList in the previous state.
|
||||||
*
|
*
|
||||||
* @param aList a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
|
* @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
|
|
||||||
*/
|
*/
|
||||||
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand );
|
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free the undo or redo list from \a aList element.
|
* Free the undo or redo list from \a aList element.
|
||||||
|
|
|
@ -252,7 +252,7 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand )
|
void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
||||||
{
|
{
|
||||||
// Undo in the reverse order of list creation: (this can allow stacked changes like the
|
// Undo in the reverse order of list creation: (this can allow stacked changes like the
|
||||||
// same item can be changed and deleted in the same complex command).
|
// same item can be changed and deleted in the same complex command).
|
||||||
|
@ -348,7 +348,7 @@ void SCH_EDIT_FRAME::RollbackSchematicFromUndo()
|
||||||
|
|
||||||
if( undo )
|
if( undo )
|
||||||
{
|
{
|
||||||
PutDataInPreviousState( undo, false );
|
PutDataInPreviousState( undo );
|
||||||
undo->ClearListAndDeleteItems();
|
undo->ClearListAndDeleteItems();
|
||||||
delete undo;
|
delete undo;
|
||||||
|
|
||||||
|
|
|
@ -1159,7 +1159,7 @@ int SCH_EDITOR_CONTROL::Undo( const TOOL_EVENT& aEvent )
|
||||||
PICKED_ITEMS_LIST* List = m_frame->PopCommandFromUndoList();
|
PICKED_ITEMS_LIST* List = m_frame->PopCommandFromUndoList();
|
||||||
|
|
||||||
/* Undo the command */
|
/* Undo the command */
|
||||||
m_frame->PutDataInPreviousState( List, false );
|
m_frame->PutDataInPreviousState( List );
|
||||||
|
|
||||||
/* Put the old list in RedoList */
|
/* Put the old list in RedoList */
|
||||||
List->ReversePickersListOrder();
|
List->ReversePickersListOrder();
|
||||||
|
@ -1189,14 +1189,14 @@ int SCH_EDITOR_CONTROL::Redo( const TOOL_EVENT& aEvent )
|
||||||
m_toolMgr->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
|
m_toolMgr->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
|
||||||
|
|
||||||
/* Get the old list */
|
/* Get the old list */
|
||||||
PICKED_ITEMS_LIST* List = m_frame->PopCommandFromRedoList();
|
PICKED_ITEMS_LIST* list = m_frame->PopCommandFromRedoList();
|
||||||
|
|
||||||
/* Redo the command: */
|
/* Redo the command: */
|
||||||
m_frame->PutDataInPreviousState( List, true );
|
m_frame->PutDataInPreviousState( list );
|
||||||
|
|
||||||
/* Put the old list in UndoList */
|
/* Put the old list in UndoList */
|
||||||
List->ReversePickersListOrder();
|
list->ReversePickersListOrder();
|
||||||
m_frame->PushCommandToUndoList( List );
|
m_frame->PushCommandToUndoList( list );
|
||||||
|
|
||||||
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
||||||
selTool->RebuildSelection();
|
selTool->RebuildSelection();
|
||||||
|
|
|
@ -95,9 +95,9 @@ public:
|
||||||
* Add a list of pickers to handle a list of items.
|
* Add a list of pickers to handle a list of items.
|
||||||
*
|
*
|
||||||
* @param aItemsList the list of items modified by the command to undo.
|
* @param aItemsList the list of items modified by the command to undo.
|
||||||
* @param aTypeCommand command type (see enum UNDO_REDO).
|
* @param aCommandType command type (see enum UNDO_REDO).
|
||||||
*/
|
*/
|
||||||
void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aTypeCommand ) override;
|
void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aCommandType ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redo the last edit:
|
* Redo the last edit:
|
||||||
|
@ -125,13 +125,8 @@ public:
|
||||||
* Put data pointed by List in the previous state, i.e. the state memorized by \a aList.
|
* Put data pointed by List in the previous state, i.e. the state memorized by \a aList.
|
||||||
*
|
*
|
||||||
* @param aList a PICKED_ITEMS_LIST pointer to the list of items to undo/redo.
|
* @param aList a PICKED_ITEMS_LIST pointer to the list of items to undo/redo.
|
||||||
* @param aRedoCommand true for redo, false for undo.
|
|
||||||
* @param aRebuildRatsnet a bool: true to rebuild ratsnest (normal use), false to just
|
|
||||||
* retrieve last 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 aRebuildRatsnet = true );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the undo and redo operations are currently blocked.
|
* Check if the undo and redo operations are currently blocked.
|
||||||
|
|
|
@ -851,7 +851,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
if( undo )
|
if( undo )
|
||||||
{
|
{
|
||||||
m_frame->PutDataInPreviousState( undo, false );
|
m_frame->PutDataInPreviousState( undo );
|
||||||
undo->ClearListAndDeleteItems();
|
undo->ClearListAndDeleteItems();
|
||||||
delete undo;
|
delete undo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,15 +96,13 @@ using namespace std::placeholders;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function TestForExistingItem
|
* Function TestForExistingItem
|
||||||
* test if aItem exists somewhere in lists of items
|
* Test if aItem exists somewhere in undo/redo lists of items. Used by PutDataInPreviousState
|
||||||
* This is a function used by PutDataInPreviousState to be sure an item was not deleted
|
* to be sure an item was not deleted since an undo or redo.
|
||||||
* since an undo or redo.
|
|
||||||
* This could be possible:
|
* This could be possible:
|
||||||
* - if a call to SaveCopyInUndoList was forgotten in Pcbnew
|
* - if a call to SaveCopyInUndoList was forgotten in Pcbnew
|
||||||
* - in zones outlines, when a change in one zone merges this zone with an other
|
* - in zones outlines, when a change in one zone merges this zone with an other
|
||||||
* This function avoids a Pcbnew crash
|
* Before using this function to test existence of items, it must be called with aItem = NULL to
|
||||||
* Before using this function to test existence of items,
|
* prepare the list
|
||||||
* it must be called with aItem = NULL to prepare the list
|
|
||||||
* @param aPcb = board to test
|
* @param aPcb = board to test
|
||||||
* @param aItem = item to find
|
* @param aItem = item to find
|
||||||
* = NULL to build the list of existing items
|
* = NULL to build the list of existing items
|
||||||
|
@ -185,7 +183,7 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO aComman
|
||||||
|
|
||||||
|
|
||||||
void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
||||||
UNDO_REDO aTypeCommand )
|
UNDO_REDO aCommandType )
|
||||||
{
|
{
|
||||||
PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST();
|
PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST();
|
||||||
|
|
||||||
|
@ -257,7 +255,7 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
|
||||||
|
|
||||||
if( command == UNDO_REDO::UNSPECIFIED )
|
if( command == UNDO_REDO::UNSPECIFIED )
|
||||||
{
|
{
|
||||||
command = aTypeCommand;
|
command = aCommandType;
|
||||||
commandToUndo->SetPickedItemStatus( command, ii );
|
commandToUndo->SetPickedItemStatus( command, ii );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,14 +324,14 @@ void PCB_BASE_EDIT_FRAME::RestoreCopyFromUndoList( wxCommandEvent& aEvent )
|
||||||
m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
|
m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
|
||||||
|
|
||||||
// Get the old list
|
// Get the old list
|
||||||
PICKED_ITEMS_LIST* List = PopCommandFromUndoList();
|
PICKED_ITEMS_LIST* list = PopCommandFromUndoList();
|
||||||
|
|
||||||
// Undo the command
|
// Undo the command
|
||||||
PutDataInPreviousState( List, false );
|
PutDataInPreviousState( list );
|
||||||
|
|
||||||
// Put the old list in RedoList
|
// Put the old list in RedoList
|
||||||
List->ReversePickersListOrder();
|
list->ReversePickersListOrder();
|
||||||
PushCommandToRedoList( List );
|
PushCommandToRedoList( list );
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
||||||
|
@ -355,14 +353,14 @@ void PCB_BASE_EDIT_FRAME::RestoreCopyFromRedoList( wxCommandEvent& aEvent )
|
||||||
m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
|
m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
|
||||||
|
|
||||||
// Get the old list
|
// Get the old list
|
||||||
PICKED_ITEMS_LIST* List = PopCommandFromRedoList();
|
PICKED_ITEMS_LIST* list = PopCommandFromRedoList();
|
||||||
|
|
||||||
// Redo the command
|
// Redo the command
|
||||||
PutDataInPreviousState( List, true );
|
PutDataInPreviousState( list );
|
||||||
|
|
||||||
// Put the old list in UndoList
|
// Put the old list in UndoList
|
||||||
List->ReversePickersListOrder();
|
list->ReversePickersListOrder();
|
||||||
PushCommandToUndoList( List );
|
PushCommandToUndoList( list );
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
||||||
|
@ -372,8 +370,7 @@ void PCB_BASE_EDIT_FRAME::RestoreCopyFromRedoList( wxCommandEvent& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand,
|
void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
||||||
bool aRebuildRatsnet )
|
|
||||||
{
|
{
|
||||||
bool not_found = false;
|
bool not_found = false;
|
||||||
bool reBuild_ratsnest = false;
|
bool reBuild_ratsnest = false;
|
||||||
|
@ -580,7 +577,7 @@ void PCB_BASE_EDIT_FRAME::ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aIt
|
||||||
void PCB_BASE_EDIT_FRAME::RollbackFromUndo()
|
void PCB_BASE_EDIT_FRAME::RollbackFromUndo()
|
||||||
{
|
{
|
||||||
PICKED_ITEMS_LIST* undo = PopCommandFromUndoList();
|
PICKED_ITEMS_LIST* undo = PopCommandFromUndoList();
|
||||||
PutDataInPreviousState( undo, false );
|
PutDataInPreviousState( undo );
|
||||||
|
|
||||||
undo->ClearListAndDeleteItems();
|
undo->ClearListAndDeleteItems();
|
||||||
delete undo;
|
delete undo;
|
||||||
|
|
Loading…
Reference in New Issue