Convert UNDO_REDO_T to an enum class

This commit is contained in:
Mark Roszko 2020-08-26 18:04:32 +00:00 committed by Seth Hillbrand
parent 0b56dc09a6
commit 1082402b33
54 changed files with 283 additions and 283 deletions

View File

@ -98,23 +98,23 @@ COMMIT& COMMIT::Stage( std::vector<EDA_ITEM*>& container, CHANGE_TYPE aChangeTyp
} }
COMMIT& COMMIT::Stage( const PICKED_ITEMS_LIST& aItems, UNDO_REDO_T aModFlag ) COMMIT& COMMIT::Stage( const PICKED_ITEMS_LIST& aItems, UNDO_REDO aModFlag )
{ {
for( unsigned int i = 0; i < aItems.GetCount(); i++ ) for( unsigned int i = 0; i < aItems.GetCount(); i++ )
{ {
UNDO_REDO_T change_type = aItems.GetPickedItemStatus( i ); UNDO_REDO change_type = aItems.GetPickedItemStatus( i );
EDA_ITEM* item = aItems.GetPickedItem( i ); EDA_ITEM* item = aItems.GetPickedItem( i );
EDA_ITEM* copy = NULL; EDA_ITEM* copy = NULL;
if( change_type == UR_UNSPECIFIED ) if( change_type == UNDO_REDO::UNSPECIFIED )
change_type = aItems.m_Status; change_type = aItems.m_Status;
if( change_type == UR_UNSPECIFIED ) if( change_type == UNDO_REDO::UNSPECIFIED )
change_type = aModFlag; change_type = aModFlag;
if( ( copy = aItems.GetPickedItemLink( i ) ) ) if( ( copy = aItems.GetPickedItemLink( i ) ) )
{ {
assert( change_type == UR_CHANGED ); assert( change_type == UNDO_REDO::CHANGED );
// There was already a copy created, so use it // There was already a copy created, so use it
Modified( item, copy ); Modified( item, copy );
@ -199,27 +199,27 @@ COMMIT::COMMIT_LINE* COMMIT::findEntry( EDA_ITEM* aItem )
} }
CHANGE_TYPE COMMIT::convert( UNDO_REDO_T aType ) const CHANGE_TYPE COMMIT::convert( UNDO_REDO aType ) const
{ {
switch( aType ) switch( aType )
{ {
case UR_NEW: case UNDO_REDO::NEWITEM:
return CHT_ADD; return CHT_ADD;
case UR_DELETED: case UNDO_REDO::DELETED:
return CHT_REMOVE; return CHT_REMOVE;
default: default:
assert( false ); assert( false );
// fall through // fall through
case UR_CHANGED: case UNDO_REDO::CHANGED:
case UR_MOVED: case UNDO_REDO::MOVED:
case UR_MIRRORED_X: case UNDO_REDO::MIRRORED_X:
case UR_MIRRORED_Y: case UNDO_REDO::MIRRORED_Y:
case UR_ROTATED: case UNDO_REDO::ROTATED:
case UR_ROTATED_CLOCKWISE: case UNDO_REDO::ROTATED_CLOCKWISE:
case UR_FLIPPED: case UNDO_REDO::FLIPPED:
return CHT_MODIFY; return CHT_MODIFY;
} }
} }

View File

@ -29,7 +29,7 @@
/* /*
ITEM_PICKER::ITEM_PICKER( EDA_ITEM* aItem, UNDO_REDO_T aUndoRedoStatus ) ITEM_PICKER::ITEM_PICKER( EDA_ITEM* aItem, UNDO_REDO aUndoRedoStatus )
{ {
m_undoRedoStatus = aUndoRedoStatus; m_undoRedoStatus = aUndoRedoStatus;
SetItem( aItem ); SetItem( aItem );
@ -41,7 +41,7 @@ ITEM_PICKER::ITEM_PICKER( EDA_ITEM* aItem, UNDO_REDO_T aUndoRedoStatus )
ITEM_PICKER::ITEM_PICKER() ITEM_PICKER::ITEM_PICKER()
{ {
m_undoRedoStatus = UR_UNSPECIFIED; m_undoRedoStatus = UNDO_REDO::UNSPECIFIED;
SetItem( nullptr ); SetItem( nullptr );
m_pickerFlags = 0; m_pickerFlags = 0;
m_link = NULL; m_link = NULL;
@ -49,7 +49,7 @@ ITEM_PICKER::ITEM_PICKER()
} }
ITEM_PICKER::ITEM_PICKER( BASE_SCREEN* aScreen, EDA_ITEM* aItem, UNDO_REDO_T aUndoRedoStatus ) ITEM_PICKER::ITEM_PICKER( BASE_SCREEN* aScreen, EDA_ITEM* aItem, UNDO_REDO aUndoRedoStatus )
{ {
m_undoRedoStatus = aUndoRedoStatus; m_undoRedoStatus = aUndoRedoStatus;
SetItem( aItem ); SetItem( aItem );
@ -61,7 +61,7 @@ ITEM_PICKER::ITEM_PICKER( BASE_SCREEN* aScreen, EDA_ITEM* aItem, UNDO_REDO_T aUn
PICKED_ITEMS_LIST::PICKED_ITEMS_LIST() PICKED_ITEMS_LIST::PICKED_ITEMS_LIST()
{ {
m_Status = UR_UNSPECIFIED; m_Status = UNDO_REDO::UNSPECIFIED;
} }
PICKED_ITEMS_LIST::~PICKED_ITEMS_LIST() PICKED_ITEMS_LIST::~PICKED_ITEMS_LIST()
@ -121,7 +121,7 @@ void PICKED_ITEMS_LIST::ClearItemsList()
void PICKED_ITEMS_LIST::ClearListAndDeleteItems() void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
{ {
// Delete items is they are not flagged UR_NEW, or if this is a block operation // Delete items is they are not flagged NEWITEM, or if this is a block operation
while( GetCount() > 0 ) while( GetCount() > 0 )
{ {
ITEM_PICKER wrapper = PopItem(); ITEM_PICKER wrapper = PopItem();
@ -136,7 +136,7 @@ void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
{ {
delete wrapper.GetItem(); delete wrapper.GetItem();
} }
else if( wrapper.GetStatus() == UR_DELETED ) else if( wrapper.GetStatus() == UNDO_REDO::DELETED )
{ {
// This should really be replaced with UR_TRANSIENT, but currently many clients // This should really be replaced with UR_TRANSIENT, but currently many clients
// (eeschema in particular) abuse this to achieve non-undo-related deletions. // (eeschema in particular) abuse this to achieve non-undo-related deletions.
@ -184,12 +184,12 @@ EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItemLink( unsigned int aIdx ) const
} }
UNDO_REDO_T PICKED_ITEMS_LIST::GetPickedItemStatus( unsigned int aIdx ) const UNDO_REDO PICKED_ITEMS_LIST::GetPickedItemStatus( unsigned int aIdx ) const
{ {
if( aIdx < m_ItemsList.size() ) if( aIdx < m_ItemsList.size() )
return m_ItemsList[aIdx].GetStatus(); return m_ItemsList[aIdx].GetStatus();
return UR_UNSPECIFIED; return UNDO_REDO::UNSPECIFIED;
} }
@ -226,7 +226,7 @@ bool PICKED_ITEMS_LIST::SetPickedItemLink( EDA_ITEM* aLink, unsigned aIdx )
} }
bool PICKED_ITEMS_LIST::SetPickedItem( EDA_ITEM* aItem, UNDO_REDO_T aStatus, unsigned aIdx ) bool PICKED_ITEMS_LIST::SetPickedItem( EDA_ITEM* aItem, UNDO_REDO aStatus, unsigned aIdx )
{ {
if( aIdx < m_ItemsList.size() ) if( aIdx < m_ItemsList.size() )
{ {
@ -239,7 +239,7 @@ bool PICKED_ITEMS_LIST::SetPickedItem( EDA_ITEM* aItem, UNDO_REDO_T aStatus, uns
} }
bool PICKED_ITEMS_LIST::SetPickedItemStatus( UNDO_REDO_T aStatus, unsigned aIdx ) bool PICKED_ITEMS_LIST::SetPickedItemStatus( UNDO_REDO aStatus, unsigned aIdx )
{ {
if( aIdx < m_ItemsList.size() ) if( aIdx < m_ItemsList.size() )
{ {

View File

@ -93,7 +93,7 @@ public:
* currently: do nothing in CvPcb. * currently: do nothing in CvPcb.
* but but be defined because it is a pure virtual in PCB_BASE_FRAME * but but be defined because it is a pure virtual in PCB_BASE_FRAME
*/ */
void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, UNDO_REDO_T aTypeCommand = UR_UNSPECIFIED, void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, UNDO_REDO aTypeCommand = UNDO_REDO::UNSPECIFIED,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override
{ {
} }
@ -104,11 +104,11 @@ public:
* Creates a new entry in undo list of commands. * Creates a new entry in undo list of commands.
* 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_T) * @param aTypeCommand = command type (see enum UNDO_REDO)
* @param aTransformPoint = the reference point of the transformation, * @param aTransformPoint = the reference point of the transformation,
* for commands like move * for commands like move
*/ */
void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO_T aTypeCommand, void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override
{ {
// currently: do nothing in CvPcb. // currently: do nothing in CvPcb.

View File

@ -67,7 +67,7 @@ void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly, bool* aAppendUndo
{ {
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item ); SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
SaveCopyInUndoList( aScreen, component, UR_CHANGED, *aAppendUndo ); SaveCopyInUndoList( aScreen, component, UNDO_REDO::CHANGED, *aAppendUndo );
*aAppendUndo = true; *aAppendUndo = true;
component->ClearAnnotation( aSheet ); component->ClearAnnotation( aSheet );
@ -199,7 +199,7 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
SCH_COMPONENT* comp = ref.GetComp(); SCH_COMPONENT* comp = ref.GetComp();
SCH_SHEET_PATH* sheet = &ref.GetSheetPath(); SCH_SHEET_PATH* sheet = &ref.GetSheetPath();
SaveCopyInUndoList( sheet->LastScreen(), comp, UR_CHANGED, appendUndo ); SaveCopyInUndoList( sheet->LastScreen(), comp, UNDO_REDO::CHANGED, appendUndo );
appendUndo = true; appendUndo = true;
ref.Annotate(); ref.Annotate();

View File

@ -129,7 +129,7 @@ bool SCH_EDIT_FRAME::TrimWire( const wxPoint& aStart, const wxPoint& aEnd )
if( IsPointOnSegment( return_line->GetStartPoint(), return_line->GetEndPoint(), aStart ) ) if( IsPointOnSegment( return_line->GetStartPoint(), return_line->GetEndPoint(), aStart ) )
line = return_line; line = return_line;
SaveCopyInUndoList( screen, line, UR_DELETED, true ); SaveCopyInUndoList( screen, line, UNDO_REDO::DELETED, true );
RemoveFromScreen( line, screen ); RemoveFromScreen( line, screen );
retval = true; retval = true;
@ -156,7 +156,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen )
{ {
changed = true; changed = true;
aItem->SetFlags( STRUCT_DELETED ); aItem->SetFlags( STRUCT_DELETED );
itemList.PushItem( ITEM_PICKER( aScreen, aItem, UR_DELETED ) ); itemList.PushItem( ITEM_PICKER( aScreen, aItem, UNDO_REDO::DELETED ) );
deletedItems.push_back( aItem ); deletedItems.push_back( aItem );
}; };
@ -261,7 +261,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen )
{ {
remove_item( firstLine ); remove_item( firstLine );
remove_item( secondLine ); remove_item( secondLine );
itemList.PushItem( ITEM_PICKER( aScreen, mergedLine, UR_NEW ) ); itemList.PushItem( ITEM_PICKER( aScreen, mergedLine, UNDO_REDO::NEWITEM ) );
AddToScreen( mergedLine, aScreen ); AddToScreen( mergedLine, aScreen );
@ -283,7 +283,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen )
} }
if( itemList.GetCount() ) if( itemList.GetCount() )
SaveCopyInUndoList( itemList, UR_DELETED, true ); SaveCopyInUndoList( itemList, UNDO_REDO::DELETED, true );
return itemList.GetCount() > 0; return itemList.GetCount() > 0;
} }
@ -304,8 +304,8 @@ bool SCH_EDIT_FRAME::BreakSegment( SCH_LINE* aSegment, const wxPoint& aPoint,
newSegment->SetStartPoint( aPoint ); newSegment->SetStartPoint( aPoint );
AddToScreen( newSegment, aScreen ); AddToScreen( newSegment, aScreen );
SaveCopyInUndoList( aScreen, newSegment, UR_NEW, true ); SaveCopyInUndoList( aScreen, newSegment, UNDO_REDO::NEWITEM, true );
SaveCopyInUndoList( aScreen, aSegment, UR_CHANGED, true ); SaveCopyInUndoList( aScreen, aSegment, UNDO_REDO::CHANGED, true );
UpdateItem( aSegment ); UpdateItem( aSegment );
aSegment->SetEndPoint( aPoint ); aSegment->SetEndPoint( aPoint );
@ -378,7 +378,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
auto remove_item = [ & ]( SCH_ITEM* aItem ) -> void auto remove_item = [ & ]( SCH_ITEM* aItem ) -> void
{ {
aItem->SetFlags( STRUCT_DELETED ); aItem->SetFlags( STRUCT_DELETED );
undoList.PushItem( ITEM_PICKER( screen, aItem, UR_DELETED ) ); undoList.PushItem( ITEM_PICKER( screen, aItem, UNDO_REDO::DELETED ) );
}; };
remove_item( aJunction ); remove_item( aJunction );
@ -420,7 +420,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
{ {
remove_item( firstLine ); remove_item( firstLine );
remove_item( secondLine ); remove_item( secondLine );
undoList.PushItem( ITEM_PICKER( screen, line, UR_NEW ) ); undoList.PushItem( ITEM_PICKER( screen, line, UNDO_REDO::NEWITEM ) );
AddToScreen( line, screen ); AddToScreen( line, screen );
if( line->IsSelected() ) if( line->IsSelected() )
@ -430,7 +430,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
} }
} ); } );
SaveCopyInUndoList( undoList, UR_DELETED, aAppend ); SaveCopyInUndoList( undoList, UNDO_REDO::DELETED, aAppend );
for( auto line : lines ) for( auto line : lines )
@ -452,7 +452,7 @@ SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( SCH_SCREEN* aScreen, const wxPoint& a
SCH_JUNCTION* junction = new SCH_JUNCTION( aPos ); SCH_JUNCTION* junction = new SCH_JUNCTION( aPos );
AddToScreen( junction, aScreen ); AddToScreen( junction, aScreen );
SaveCopyInUndoList( aScreen, junction, UR_NEW, aUndoAppend ); SaveCopyInUndoList( aScreen, junction, UNDO_REDO::NEWITEM, aUndoAppend );
BreakSegments( aPos ); BreakSegments( aPos );
if( aFinal ) if( aFinal )

View File

@ -334,7 +334,7 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_COMPONENT* aSymbol, SCH_SCREEN* a
// Removing the symbol needs to be done before the LIB_PART is changed to prevent stale // Removing the symbol needs to be done before the LIB_PART is changed to prevent stale
// library symbols in the schematic file. // library symbols in the schematic file.
aScreen->Remove( aSymbol ); aScreen->Remove( aSymbol );
frame->SaveCopyInUndoList( aScreen, aSymbol, UR_CHANGED, aAppendToUndo ); frame->SaveCopyInUndoList( aScreen, aSymbol, UNDO_REDO::CHANGED, aAppendToUndo );
if( aNewId != aSymbol->GetLibId() ) if( aNewId != aSymbol->GetLibId() )
aSymbol->SetLibId( aNewId ); aSymbol->SetLibId( aNewId );

View File

@ -306,7 +306,7 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow()
return false; return false;
} }
m_Parent->SaveCopyInUndoList( m_libEntry, UR_LIB_RENAME ); m_Parent->SaveCopyInUndoList( m_libEntry, UNDO_REDO::LIB_RENAME );
} }
else else
{ {

View File

@ -411,7 +411,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
// save old cmp in undo list if not already in edit, or moving ... // save old cmp in undo list if not already in edit, or moving ...
if( m_cmp->GetEditFlags() == 0 ) if( m_cmp->GetEditFlags() == 0 )
GetParent()->SaveCopyInUndoList( currentScreen, m_cmp, UR_CHANGED, false ); GetParent()->SaveCopyInUndoList( currentScreen, m_cmp, UNDO_REDO::CHANGED, false );
// Save current flags which could be modified by next change settings // Save current flags which could be modified by next change settings
STATUS_FLAGS flags = m_cmp->GetFlags(); STATUS_FLAGS flags = m_cmp->GetFlags();
@ -530,7 +530,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
for( SCH_COMPONENT* otherUnit : otherUnits ) for( SCH_COMPONENT* otherUnit : otherUnits )
{ {
GetParent()->SaveCopyInUndoList( screen, otherUnit, UR_CHANGED, true /* append */); GetParent()->SaveCopyInUndoList( screen, otherUnit, UNDO_REDO::CHANGED, true /* append */);
otherUnit->GetField( VALUE )->SetText( m_fields->at( VALUE ).GetText() ); otherUnit->GetField( VALUE )->SetText( m_fields->at( VALUE ).GetText() );
otherUnit->GetField( FOOTPRINT )->SetText( m_fields->at( FOOTPRINT ).GetText() ); otherUnit->GetField( FOOTPRINT )->SetText( m_fields->at( FOOTPRINT ).GetText() );
otherUnit->GetField( DATASHEET )->SetText( m_fields->at( DATASHEET ).GetText() ); otherUnit->GetField( DATASHEET )->SetText( m_fields->at( DATASHEET ).GetText() );

View File

@ -747,7 +747,7 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow()
if( symbol == nullptr ) if( symbol == nullptr )
continue; continue;
GetParent()->SaveCopyInUndoList( cmp.m_Screen, cmp.m_Component, UR_CHANGED, GetParent()->SaveCopyInUndoList( cmp.m_Screen, cmp.m_Component, UNDO_REDO::CHANGED,
m_isModified ); m_isModified );
m_isModified = true; m_isModified = true;

View File

@ -291,7 +291,7 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
/* save old text in undo list if not already in edit */ /* save old text in undo list if not already in edit */
if( m_CurrentText->GetEditFlags() == 0 ) if( m_CurrentText->GetEditFlags() == 0 )
m_Parent->SaveCopyInUndoList( m_Parent->GetScreen(), m_CurrentText, UR_CHANGED, false ); m_Parent->SaveCopyInUndoList( m_Parent->GetScreen(), m_CurrentText, UNDO_REDO::CHANGED, false );
m_Parent->GetCanvas()->Refresh(); m_Parent->GetCanvas()->Refresh();

View File

@ -144,9 +144,9 @@ bool DIALOG_EDIT_LINE_STYLE::TransferDataFromWindow()
STROKE_PARAMS stroke; STROKE_PARAMS stroke;
for( SCH_ITEM* strokeItem : m_strokeItems ) for( SCH_ITEM* strokeItem : m_strokeItems )
pickedItems.PushItem( ITEM_PICKER( m_frame->GetScreen(), strokeItem, UR_CHANGED ) ); pickedItems.PushItem( ITEM_PICKER( m_frame->GetScreen(), strokeItem, UNDO_REDO::CHANGED ) );
m_frame->SaveCopyInUndoList( pickedItems, UR_CHANGED, false ); m_frame->SaveCopyInUndoList( pickedItems, UNDO_REDO::CHANGED, false );
for( auto& strokeItem : m_strokeItems ) for( auto& strokeItem : m_strokeItems )
{ {

View File

@ -435,7 +435,7 @@ void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH*
for( SCH_COMPONENT* otherUnit : otherUnits ) for( SCH_COMPONENT* otherUnit : otherUnits )
{ {
editFrame->SaveCopyInUndoList( screen, otherUnit, UR_CHANGED, true /* append */); editFrame->SaveCopyInUndoList( screen, otherUnit, UNDO_REDO::CHANGED, true /* append */);
otherUnit->GetField( fieldType )->SetText( m_text ); otherUnit->GetField( fieldType )->SetText( m_text );
editFrame->UpdateItem( otherUnit ); editFrame->UpdateItem( otherUnit );
} }

View File

@ -99,7 +99,7 @@ bool DIALOG_EDIT_SHEET_PIN::TransferDataFromWindow()
if( !m_sheetPin->IsNew() ) if( !m_sheetPin->IsNew() )
{ {
SCH_SHEET* parentSheet = m_sheetPin->GetParent(); SCH_SHEET* parentSheet = m_sheetPin->GetParent();
m_frame->SaveCopyInUndoList( m_frame->GetScreen(), parentSheet, UR_CHANGED, false ); m_frame->SaveCopyInUndoList( m_frame->GetScreen(), parentSheet, UNDO_REDO::CHANGED, false );
} }
m_sheetPin->SetText( EscapeString( m_comboName->GetValue(), CTX_NETNAME ) ); m_sheetPin->SetText( EscapeString( m_comboName->GetValue(), CTX_NETNAME ) );

View File

@ -602,7 +602,7 @@ public:
SCH_COMPONENT& comp = *m_componentRefs[i].GetComp(); SCH_COMPONENT& comp = *m_componentRefs[i].GetComp();
SCH_SCREEN* screen = m_componentRefs[i].GetSheetPath().LastScreen(); SCH_SCREEN* screen = m_componentRefs[i].GetSheetPath().LastScreen();
m_frame->SaveCopyInUndoList( screen, &comp, UR_CHANGED, true ); m_frame->SaveCopyInUndoList( screen, &comp, UNDO_REDO::CHANGED, true );
const std::map<wxString, wxString>& fieldStore = m_dataStore[comp.m_Uuid]; const std::map<wxString, wxString>& fieldStore = m_dataStore[comp.m_Uuid];

View File

@ -218,7 +218,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( const SCH_SHEET_PATH& aS
auto sch_text = dynamic_cast<SCH_TEXT*>( aItem ); auto sch_text = dynamic_cast<SCH_TEXT*>( aItem );
auto lineItem = dynamic_cast<SCH_LINE*>( aItem ); auto lineItem = dynamic_cast<SCH_LINE*>( aItem );
m_parent->SaveCopyInUndoList( aSheetPath.LastScreen(), aItem, UR_CHANGED, m_hasChange ); m_parent->SaveCopyInUndoList( aSheetPath.LastScreen(), aItem, UNDO_REDO::CHANGED, m_hasChange );
if( eda_text ) if( eda_text )
{ {

View File

@ -96,9 +96,9 @@ bool DIALOG_JUNCTION_PROPS::TransferDataFromWindow()
PICKED_ITEMS_LIST pickedItems; PICKED_ITEMS_LIST pickedItems;
for( SCH_JUNCTION* junction : m_junctions ) for( SCH_JUNCTION* junction : m_junctions )
pickedItems.PushItem( ITEM_PICKER( m_frame->GetScreen(), junction, UR_CHANGED ) ); pickedItems.PushItem( ITEM_PICKER( m_frame->GetScreen(), junction, UNDO_REDO::CHANGED ) );
m_frame->SaveCopyInUndoList( pickedItems, UR_CHANGED, false ); m_frame->SaveCopyInUndoList( pickedItems, UNDO_REDO::CHANGED, false );
for( SCH_JUNCTION* junction : m_junctions ) for( SCH_JUNCTION* junction : m_junctions )
{ {

View File

@ -473,7 +473,7 @@ bool DIALOG_SCH_SHEET_PROPS::onSheetFilenameChanged( const wxString& aNewFilenam
} }
if( isUndoable ) if( isUndoable )
m_frame->SaveCopyInUndoList( m_frame->GetScreen(), m_sheet, UR_CHANGED, false ); m_frame->SaveCopyInUndoList( m_frame->GetScreen(), m_sheet, UNDO_REDO::CHANGED, false );
if( renameFile ) if( renameFile )
{ {

View File

@ -91,9 +91,9 @@ bool DIALOG_UPDATE_FIELDS::TransferDataFromWindow()
PICKED_ITEMS_LIST itemsList; PICKED_ITEMS_LIST itemsList;
for( std::pair<SCH_SCREEN*, SCH_COMPONENT*>& component : m_components ) for( std::pair<SCH_SCREEN*, SCH_COMPONENT*>& component : m_components )
itemsList.PushItem( ITEM_PICKER( component.first, component.second, UR_CHANGED ) ); itemsList.PushItem( ITEM_PICKER( component.first, component.second, UNDO_REDO::CHANGED ) );
m_frame->SaveCopyInUndoList( itemsList, UR_CHANGED, true ); m_frame->SaveCopyInUndoList( itemsList, UNDO_REDO::CHANGED, true );
} }

View File

@ -211,7 +211,7 @@ void SCH_EDIT_FRAME::SelectUnit( SCH_COMPONENT* aComponent, int aUnit )
STATUS_FLAGS savedFlags = aComponent->GetFlags(); STATUS_FLAGS savedFlags = aComponent->GetFlags();
if( !aComponent->GetEditFlags() ) // No command in progress: save in undo list if( !aComponent->GetEditFlags() ) // No command in progress: save in undo list
SaveCopyInUndoList( GetScreen(), aComponent, UR_CHANGED, false ); SaveCopyInUndoList( GetScreen(), aComponent, UNDO_REDO::CHANGED, false );
/* Update the unit number. */ /* Update the unit number. */
aComponent->SetUnitSelection( &GetCurrentSheet(), aUnit ); aComponent->SetUnitSelection( &GetCurrentSheet(), aUnit );

View File

@ -340,7 +340,7 @@ public:
* Because a component in library editor does not have a lot of primitives, * Because a component in library editor does not have a lot of primitives,
* the full data is duplicated. It is not worth to try to optimize this save function. * the full data is duplicated. It is not worth to try to optimize this save function.
*/ */
void SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO_T undoType = UR_LIBEDIT, void SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO undoType = UNDO_REDO::LIBEDIT,
bool aAppend = false ); bool aAppend = false );
void GetComponentFromUndoList(); void GetComponentFromUndoList();

View File

@ -34,7 +34,7 @@
#include <tools/ee_actions.h> #include <tools/ee_actions.h>
#include <tools/ee_selection_tool.h> #include <tools/ee_selection_tool.h>
void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO_T undoType, bool aAppend ) void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO undoType, bool aAppend )
{ {
wxASSERT_MSG( !aAppend, "Append not needed/supported for LibEdit" ); wxASSERT_MSG( !aAppend, "Append not needed/supported for LibEdit" );
@ -74,7 +74,7 @@ void LIB_EDIT_FRAME::GetComponentFromRedoList()
LIB_PART* part = (LIB_PART*) redoWrapper.GetItem(); LIB_PART* part = (LIB_PART*) redoWrapper.GetItem();
wxCHECK( part, /* void */ ); wxCHECK( part, /* void */ );
part->ClearFlags( UR_TRANSIENT ); part->ClearFlags( UR_TRANSIENT );
UNDO_REDO_T undoRedoType = redoWrapper.GetStatus(); UNDO_REDO undoRedoType = redoWrapper.GetStatus();
// Store the current part in the undo buffer // Store the current part in the undo buffer
PICKED_ITEMS_LIST* undoCommand = new PICKED_ITEMS_LIST(); PICKED_ITEMS_LIST* undoCommand = new PICKED_ITEMS_LIST();
@ -90,7 +90,7 @@ void LIB_EDIT_FRAME::GetComponentFromRedoList()
// Just set the current part to the part which come from the redo list // Just set the current part to the part which come from the redo list
m_my_part = part; m_my_part = part;
if( undoRedoType == UR_LIB_RENAME ) if( undoRedoType == UNDO_REDO::LIB_RENAME )
{ {
wxString lib = GetCurLib(); wxString lib = GetCurLib();
m_libMgr->UpdatePartAfterRename( part, oldPart->GetName(), lib ); m_libMgr->UpdatePartAfterRename( part, oldPart->GetName(), lib );
@ -122,7 +122,7 @@ void LIB_EDIT_FRAME::GetComponentFromUndoList()
LIB_PART* part = (LIB_PART*) undoWrapper.GetItem(); LIB_PART* part = (LIB_PART*) undoWrapper.GetItem();
wxCHECK( part, /* void */ ); wxCHECK( part, /* void */ );
part->ClearFlags( UR_TRANSIENT ); part->ClearFlags( UR_TRANSIENT );
UNDO_REDO_T undoRedoType = undoWrapper.GetStatus(); UNDO_REDO undoRedoType = undoWrapper.GetStatus();
// Store the current part in the redo buffer // Store the current part in the redo buffer
PICKED_ITEMS_LIST* redoCommand = new PICKED_ITEMS_LIST(); PICKED_ITEMS_LIST* redoCommand = new PICKED_ITEMS_LIST();
@ -138,7 +138,7 @@ void LIB_EDIT_FRAME::GetComponentFromUndoList()
// Just set the current part to the part which come from the undo list // Just set the current part to the part which come from the undo list
m_my_part = part; m_my_part = part;
if( undoRedoType == UR_LIB_RENAME ) if( undoRedoType == UNDO_REDO::LIB_RENAME )
{ {
wxString lib = GetCurLib(); wxString lib = GetCurLib();
m_libMgr->UpdatePartAfterRename( part, oldPart->GetName(), lib ); m_libMgr->UpdatePartAfterRename( part, oldPart->GetName(), lib );

View File

@ -1043,7 +1043,7 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM*
if( aItem->Type() == SCH_SHEET_PIN_T ) if( aItem->Type() == SCH_SHEET_PIN_T )
{ {
// Sheet pins are owned by their parent sheet. // Sheet pins are owned by their parent sheet.
SaveCopyInUndoList( aScreen, undoItem, UR_CHANGED, aUndoAppend ); SaveCopyInUndoList( aScreen, undoItem, UNDO_REDO::CHANGED, aUndoAppend );
parentSheet->AddPin( (SCH_SHEET_PIN*) aItem ); parentSheet->AddPin( (SCH_SHEET_PIN*) aItem );
} }
@ -1059,7 +1059,7 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM*
AddToScreen( aItem, aScreen ); AddToScreen( aItem, aScreen );
SaveCopyForRepeatItem( aItem ); SaveCopyForRepeatItem( aItem );
SaveCopyInUndoList( aScreen, undoItem, UR_NEW, aUndoAppend ); SaveCopyInUndoList( aScreen, undoItem, UNDO_REDO::NEWITEM, aUndoAppend );
} }
// Update connectivity info for new item // Update connectivity info for new item

View File

@ -800,14 +800,14 @@ public:
* Create a copy of the current schematic item, and put it in the undo list. * Create a copy of the current schematic item, and put it in the undo list.
* *
* aTypeCommand = * aTypeCommand =
* UR_CHANGED * CHANGED
* UR_NEW * NEWITEM
* UR_DELETED * DELETED
* UR_WIRE_IMAGE * UR_WIRE_IMAGE
* UR_MOVED * MOVED
* *
* If it is a delete command, items are put on list with the .Flags member * If it is a delete command, items are put on list with the .Flags member
* set to UR_DELETED. * set to DELETED.
* *
* @note * @note
* Edit wires and buses is a bit complex. * Edit wires and buses is a bit complex.
@ -816,13 +816,13 @@ public:
* schebang. * schebang.
* *
* @param aItemToCopy = the schematic item modified by the command to undo * @param aItemToCopy = the schematic item modified by the command to undo
* @param aTypeCommand = command type (see enum UNDO_REDO_T) * @param aTypeCommand = command type (see enum UNDO_REDO)
* @param aAppend = add the item to the previous undo list * @param aAppend = add the item to the previous undo list
* @param aTransformPoint = the reference point of the transformation for commands like move * @param aTransformPoint = the reference point of the transformation for commands like move
*/ */
void SaveCopyInUndoList( SCH_SCREEN* aScreen, void SaveCopyInUndoList( SCH_SCREEN* aScreen,
SCH_ITEM* aItemToCopy, SCH_ITEM* aItemToCopy,
UNDO_REDO_T aTypeCommand, UNDO_REDO aTypeCommand,
bool aAppend, bool aAppend,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ); const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
@ -830,12 +830,12 @@ public:
* Create a new entry in undo list of commands. * Create a new entry in undo list of commands.
* *
* @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_T) * @param aTypeCommand = command type (see enum UNDO_REDO)
* @param aAppend = add the item to the previous undo list * @param aAppend = add the item to the previous undo list
* @param aTransformPoint = the reference point of the transformation for commands like move * @param aTransformPoint = the reference point of the transformation for commands like move
*/ */
void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
UNDO_REDO_T aTypeCommand, UNDO_REDO aTypeCommand,
bool aAppend, bool aAppend,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ); const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );

View File

@ -96,7 +96,7 @@
void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_SCREEN* aScreen, void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_SCREEN* aScreen,
SCH_ITEM* aItem, SCH_ITEM* aItem,
UNDO_REDO_T aCommandType, UNDO_REDO aCommandType,
bool aAppend, bool aAppend,
const wxPoint& aTransformPoint ) const wxPoint& aTransformPoint )
{ {
@ -122,15 +122,15 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_SCREEN* aScreen,
switch( aCommandType ) switch( aCommandType )
{ {
case UR_CHANGED: /* Create a copy of item */ case UNDO_REDO::CHANGED: /* Create a copy of item */
itemWrapper.SetLink( aItem->Duplicate( true ) ); itemWrapper.SetLink( aItem->Duplicate( true ) );
commandToUndo->PushItem( itemWrapper ); commandToUndo->PushItem( itemWrapper );
break; break;
case UR_NEW: case UNDO_REDO::NEWITEM:
case UR_DELETED: case UNDO_REDO::DELETED:
case UR_ROTATED: case UNDO_REDO::ROTATED:
case UR_MOVED: case UNDO_REDO::MOVED:
commandToUndo->PushItem( itemWrapper ); commandToUndo->PushItem( itemWrapper );
break; break;
@ -156,7 +156,7 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_SCREEN* aScreen,
void SCH_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, void SCH_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
UNDO_REDO_T aTypeCommand, UNDO_REDO aTypeCommand,
bool aAppend, bool aAppend,
const wxPoint& aTransformPoint ) const wxPoint& aTransformPoint )
{ {
@ -198,9 +198,9 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
// Connectivity may change // Connectivity may change
sch_item->SetConnectivityDirty(); sch_item->SetConnectivityDirty();
UNDO_REDO_T command = commandToUndo->GetPickedItemStatus( ii ); UNDO_REDO command = commandToUndo->GetPickedItemStatus( ii );
if( command == UR_UNSPECIFIED ) if( command == UNDO_REDO::UNSPECIFIED )
{ {
command = aTypeCommand; command = aTypeCommand;
commandToUndo->SetPickedItemStatus( command, ii ); commandToUndo->SetPickedItemStatus( command, ii );
@ -208,7 +208,7 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
switch( command ) switch( command )
{ {
case UR_CHANGED: case UNDO_REDO::CHANGED:
/* If needed, create a copy of item, and put in undo list /* If needed, create a copy of item, and put in undo list
* in the picker, as link * in the picker, as link
@ -220,14 +220,14 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
wxASSERT( commandToUndo->GetPickedItemLink( ii ) ); wxASSERT( commandToUndo->GetPickedItemLink( ii ) );
break; break;
case UR_MOVED: case UNDO_REDO::MOVED:
case UR_MIRRORED_Y: case UNDO_REDO::MIRRORED_Y:
case UR_MIRRORED_X: case UNDO_REDO::MIRRORED_X:
case UR_ROTATED: case UNDO_REDO::ROTATED:
case UR_NEW: case UNDO_REDO::NEWITEM:
case UR_DELETED: case UNDO_REDO::DELETED:
case UR_EXCHANGE_T: case UNDO_REDO::EXCHANGE_T:
case UR_PAGESETTINGS: case UNDO_REDO::PAGESETTINGS:
break; break;
default: default:
@ -257,26 +257,26 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
// same item can be changed and deleted in the same complex command). // same item can be changed and deleted in the same complex command).
for( int ii = aList->GetCount() - 1; ii >= 0; ii-- ) for( int ii = aList->GetCount() - 1; ii >= 0; ii-- )
{ {
UNDO_REDO_T status = aList->GetPickedItemStatus((unsigned) ii ); UNDO_REDO status = aList->GetPickedItemStatus((unsigned) ii );
EDA_ITEM* eda_item = aList->GetPickedItem( (unsigned) ii ); EDA_ITEM* eda_item = aList->GetPickedItem( (unsigned) ii );
eda_item->SetFlags( aList->GetPickerFlags( (unsigned) ii ) ); eda_item->SetFlags( aList->GetPickerFlags( (unsigned) ii ) );
eda_item->ClearEditFlags(); eda_item->ClearEditFlags();
eda_item->ClearTempFlags(); eda_item->ClearTempFlags();
if( status == UR_NEW ) if( status == UNDO_REDO::NEWITEM )
{ {
// new items are deleted on undo // new items are deleted on undo
RemoveFromScreen( eda_item, (SCH_SCREEN*) aList->GetScreenForItem( (unsigned) ii ) ); RemoveFromScreen( eda_item, (SCH_SCREEN*) aList->GetScreenForItem( (unsigned) ii ) );
aList->SetPickedItemStatus( UR_DELETED, (unsigned) ii ); aList->SetPickedItemStatus( UNDO_REDO::DELETED, (unsigned) ii );
} }
else if( status == UR_DELETED ) else if( status == UNDO_REDO::DELETED )
{ {
// deleted items are re-inserted on undo // deleted items are re-inserted on undo
AddToScreen( eda_item, (SCH_SCREEN*) aList->GetScreenForItem( (unsigned) ii ) ); AddToScreen( eda_item, (SCH_SCREEN*) aList->GetScreenForItem( (unsigned) ii ) );
aList->SetPickedItemStatus( UR_NEW, (unsigned) ii ); aList->SetPickedItemStatus( UNDO_REDO::NEWITEM, (unsigned) ii );
} }
else if( status == UR_PAGESETTINGS ) else if( status == UNDO_REDO::PAGESETTINGS )
{ {
// swap current settings with stored settings // swap current settings with stored settings
WS_PROXY_UNDO_ITEM alt_item( this ); WS_PROXY_UNDO_ITEM alt_item( this );
@ -295,23 +295,23 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
switch( status ) switch( status )
{ {
case UR_CHANGED: case UNDO_REDO::CHANGED:
item->SwapData( alt_item ); item->SwapData( alt_item );
break; break;
case UR_MOVED: case UNDO_REDO::MOVED:
item->Move( aRedoCommand ? aList->m_TransformPoint : -aList->m_TransformPoint ); item->Move( aRedoCommand ? aList->m_TransformPoint : -aList->m_TransformPoint );
break; break;
case UR_MIRRORED_Y: case UNDO_REDO::MIRRORED_Y:
item->MirrorY( aList->m_TransformPoint.x ); item->MirrorY( aList->m_TransformPoint.x );
break; break;
case UR_MIRRORED_X: case UNDO_REDO::MIRRORED_X:
item->MirrorX( aList->m_TransformPoint.y ); item->MirrorX( aList->m_TransformPoint.y );
break; break;
case UR_ROTATED: case UNDO_REDO::ROTATED:
if( aRedoCommand ) if( aRedoCommand )
item->Rotate( aList->m_TransformPoint ); item->Rotate( aList->m_TransformPoint );
else else
@ -323,7 +323,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
} }
break; break;
case UR_EXCHANGE_T: case UNDO_REDO::EXCHANGE_T:
aList->SetPickedItem( alt_item, (unsigned) ii ); aList->SetPickedItem( alt_item, (unsigned) ii );
aList->SetPickedItemLink( item, (unsigned) ii ); aList->SetPickedItemLink( item, (unsigned) ii );
item = alt_item; item = alt_item;

View File

@ -402,7 +402,7 @@ void BACK_ANNOTATE::applyChangelist()
if( !m_dryRun ) if( !m_dryRun )
{ {
m_frame->SaveCopyInUndoList( screen, comp, UR_CHANGED, m_appendUndo ); m_frame->SaveCopyInUndoList( screen, comp, UNDO_REDO::CHANGED, m_appendUndo );
m_appendUndo = true; m_appendUndo = true;
comp->SetRef( &ref.GetSheetPath(), module.m_ref ); comp->SetRef( &ref.GetSheetPath(), module.m_ref );
} }
@ -420,7 +420,7 @@ void BACK_ANNOTATE::applyChangelist()
if( !m_dryRun ) if( !m_dryRun )
{ {
m_frame->SaveCopyInUndoList( screen, comp, UR_CHANGED, m_appendUndo ); m_frame->SaveCopyInUndoList( screen, comp, UNDO_REDO::CHANGED, m_appendUndo );
m_appendUndo = true; m_appendUndo = true;
ref.GetComp()->GetField( FOOTPRINT )->SetText( module.m_footprint ); ref.GetComp()->GetField( FOOTPRINT )->SetText( module.m_footprint );
} }
@ -438,7 +438,7 @@ void BACK_ANNOTATE::applyChangelist()
if( !m_dryRun ) if( !m_dryRun )
{ {
m_frame->SaveCopyInUndoList( screen, comp, UR_CHANGED, m_appendUndo ); m_frame->SaveCopyInUndoList( screen, comp, UNDO_REDO::CHANGED, m_appendUndo );
m_appendUndo = true; m_appendUndo = true;
comp->GetField( VALUE )->SetText( module.m_value ); comp->GetField( VALUE )->SetText( module.m_value );
} }
@ -561,7 +561,7 @@ void BACK_ANNOTATE::processNetNameChange( SCH_CONNECTION* aConn, const wxString&
if( EscapeString( label->GetShownText(), CTX_NETNAME ) == oldName ) if( EscapeString( label->GetShownText(), CTX_NETNAME ) == oldName )
{ {
m_frame->SaveCopyInUndoList( aScreen, label, UR_CHANGED, m_appendUndo ); m_frame->SaveCopyInUndoList( aScreen, label, UNDO_REDO::CHANGED, m_appendUndo );
m_appendUndo = true; m_appendUndo = true;
static_cast<SCH_TEXT*>( label )->SetText( newName ); static_cast<SCH_TEXT*>( label )->SetText( newName );
} }
@ -584,7 +584,7 @@ void BACK_ANNOTATE::processNetNameChange( SCH_CONNECTION* aConn, const wxString&
if( conn && conn->Driver() == driver ) if( conn && conn->Driver() == driver )
{ {
m_frame->SaveCopyInUndoList( screen, label, UR_CHANGED, m_appendUndo ); m_frame->SaveCopyInUndoList( screen, label, UNDO_REDO::CHANGED, m_appendUndo );
m_appendUndo = true; m_appendUndo = true;
static_cast<SCH_TEXT*>( label )->SetText( aNewName ); static_cast<SCH_TEXT*>( label )->SetText( aNewName );
} }
@ -628,7 +628,7 @@ void BACK_ANNOTATE::processNetNameChange( SCH_CONNECTION* aConn, const wxString&
{ {
if( EscapeString( pin->GetShownText(), CTX_NETNAME ) == aOldName ) if( EscapeString( pin->GetShownText(), CTX_NETNAME ) == aOldName )
{ {
m_frame->SaveCopyInUndoList( screen, pin, UR_CHANGED, m_appendUndo ); m_frame->SaveCopyInUndoList( screen, pin, UNDO_REDO::CHANGED, m_appendUndo );
m_appendUndo = true; m_appendUndo = true;
static_cast<SCH_TEXT*>( pin )->SetText( aNewName ); static_cast<SCH_TEXT*>( pin )->SetText( aNewName );
} }
@ -645,7 +645,7 @@ void BACK_ANNOTATE::processNetNameChange( SCH_CONNECTION* aConn, const wxString&
if( !m_dryRun ) if( !m_dryRun )
{ {
SCH_SCREEN* screen = aConn->Sheet().LastScreen(); SCH_SCREEN* screen = aConn->Sheet().LastScreen();
m_frame->SaveCopyInUndoList( screen, driver, UR_CHANGED, m_appendUndo ); m_frame->SaveCopyInUndoList( screen, driver, UNDO_REDO::CHANGED, m_appendUndo );
m_appendUndo = true; m_appendUndo = true;
static_cast<SCH_TEXT*>( driver )->SetText( aNewName ); static_cast<SCH_TEXT*>( driver )->SetText( aNewName );

View File

@ -868,23 +868,23 @@ void EE_POINT_EDITOR::saveItemsToUndo()
{ {
if( m_isLibEdit ) if( m_isLibEdit )
{ {
saveCopyInUndoList( m_editPoints->GetParent()->GetParent(), UR_LIBEDIT ); saveCopyInUndoList( m_editPoints->GetParent()->GetParent(), UNDO_REDO::LIBEDIT );
} }
else else
{ {
saveCopyInUndoList( (SCH_ITEM*) m_editPoints->GetParent(), UR_CHANGED ); saveCopyInUndoList( (SCH_ITEM*) m_editPoints->GetParent(), UNDO_REDO::CHANGED );
if( m_editPoints->GetParent()->Type() == SCH_LINE_T ) if( m_editPoints->GetParent()->Type() == SCH_LINE_T )
{ {
EDA_ITEM* connection = m_editPoints->Point( LINE_START ).GetConnection(); EDA_ITEM* connection = m_editPoints->Point( LINE_START ).GetConnection();
if( connection ) if( connection )
saveCopyInUndoList( (SCH_ITEM*) connection, UR_CHANGED, true ); saveCopyInUndoList( (SCH_ITEM*) connection, UNDO_REDO::CHANGED, true );
connection = m_editPoints->Point( LINE_END ).GetConnection(); connection = m_editPoints->Point( LINE_END ).GetConnection();
if( connection ) if( connection )
saveCopyInUndoList( (SCH_ITEM*) connection, UR_CHANGED, true ); saveCopyInUndoList( (SCH_ITEM*) connection, UNDO_REDO::CHANGED, true );
} }
} }
} }

View File

@ -114,7 +114,7 @@ protected:
///> Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their ///> Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their
///> parents. ///> parents.
void saveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO_T aType, bool aAppend = false ) void saveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO aType, bool aAppend = false )
{ {
KICAD_T itemType = aItem->Type(); KICAD_T itemType = aItem->Type();
bool selected = aItem->IsSelected(); bool selected = aItem->IsSelected();
@ -140,7 +140,7 @@ protected:
{ {
editFrame->SaveCopyInUndoList( editFrame->GetScreen(), editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
static_cast<SCH_ITEM*>( aItem->GetParent() ), static_cast<SCH_ITEM*>( aItem->GetParent() ),
UR_CHANGED, aAppend ); UNDO_REDO::CHANGED, aAppend );
} }
else else
{ {

View File

@ -139,7 +139,7 @@ int LIB_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
LIB_ITEM* item = static_cast<LIB_ITEM*>( selection.Front() ); LIB_ITEM* item = static_cast<LIB_ITEM*>( selection.Front() );
if( !item->IsMoving() ) if( !item->IsMoving() )
saveCopyInUndoList( m_frame->GetCurPart(), UR_LIBEDIT ); saveCopyInUndoList( m_frame->GetCurPart(), UNDO_REDO::LIBEDIT );
if( selection.GetSize() == 1 ) if( selection.GetSize() == 1 )
rotPoint = item->GetPosition(); rotPoint = item->GetPosition();
@ -181,7 +181,7 @@ int LIB_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
LIB_ITEM* item = static_cast<LIB_ITEM*>( selection.Front() ); LIB_ITEM* item = static_cast<LIB_ITEM*>( selection.Front() );
if( !item->IsMoving() ) if( !item->IsMoving() )
saveCopyInUndoList( m_frame->GetCurPart(), UR_LIBEDIT ); saveCopyInUndoList( m_frame->GetCurPart(), UNDO_REDO::LIBEDIT );
if( selection.GetSize() == 1 ) if( selection.GetSize() == 1 )
mirrorPoint = item->GetPosition(); mirrorPoint = item->GetPosition();
@ -241,7 +241,7 @@ int LIB_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
// Don't leave a freed pointer in the selection // Don't leave a freed pointer in the selection
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
saveCopyInUndoList( part, UR_LIBEDIT ); saveCopyInUndoList( part, UNDO_REDO::LIBEDIT );
std::set<LIB_ITEM *> toDelete; std::set<LIB_ITEM *> toDelete;
@ -385,7 +385,7 @@ int LIB_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
// Save copy for undo if not in edit (edit command already handle the save copy) // Save copy for undo if not in edit (edit command already handle the save copy)
if( item->GetEditFlags() == 0 ) if( item->GetEditFlags() == 0 )
saveCopyInUndoList( item->GetParent(), UR_LIBEDIT ); saveCopyInUndoList( item->GetParent(), UNDO_REDO::LIBEDIT );
switch( item->Type() ) switch( item->Type() )
{ {
@ -508,9 +508,9 @@ void LIB_EDIT_TOOL::editFieldProperties( LIB_FIELD* aField )
bool renamed = aField->GetId() == VALUE && newFieldValue != oldFieldValue; bool renamed = aField->GetId() == VALUE && newFieldValue != oldFieldValue;
if( renamed ) if( renamed )
saveCopyInUndoList( parent, UR_LIB_RENAME ); saveCopyInUndoList( parent, UNDO_REDO::LIB_RENAME );
else else
saveCopyInUndoList( parent, UR_LIBEDIT ); saveCopyInUndoList( parent, UNDO_REDO::LIBEDIT );
dlg.UpdateField( aField ); dlg.UpdateField( aField );
@ -575,7 +575,7 @@ int LIB_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
saveCopyInUndoList( part, UR_LIBEDIT ); saveCopyInUndoList( part, UNDO_REDO::LIBEDIT );
DIALOG_LIB_EDIT_PIN_TABLE dlg( m_frame, part ); DIALOG_LIB_EDIT_PIN_TABLE dlg( m_frame, part );
@ -737,7 +737,7 @@ int LIB_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
return 0; return 0;
if( !selection.Front()->IsMoving() ) if( !selection.Front()->IsMoving() )
saveCopyInUndoList( m_frame->GetCurPart(), UR_LIBEDIT ); saveCopyInUndoList( m_frame->GetCurPart(), UNDO_REDO::LIBEDIT );
EDA_ITEMS newItems; EDA_ITEMS newItems;

View File

@ -95,7 +95,7 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
VECTOR2I prevPos; VECTOR2I prevPos;
if( !selection.Front()->IsNew() ) if( !selection.Front()->IsNew() )
saveCopyInUndoList( m_frame->GetCurPart(), UR_LIBEDIT ); saveCopyInUndoList( m_frame->GetCurPart(), UNDO_REDO::LIBEDIT );
m_cursor = controls->GetCursorPosition(); m_cursor = controls->GetCursorPosition();

View File

@ -342,7 +342,7 @@ int LIB_PIN_TOOL::PushPinProperties( const TOOL_EVENT& aEvent )
if( !sourcePin ) if( !sourcePin )
return 0; return 0;
saveCopyInUndoList( part, UR_LIBEDIT ); saveCopyInUndoList( part, UNDO_REDO::LIBEDIT );
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) ) for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
{ {

View File

@ -426,7 +426,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
if( selection.GetSize() == 1 ) if( selection.GetSize() == 1 )
{ {
if( !moving ) if( !moving )
saveCopyInUndoList( item, UR_CHANGED ); saveCopyInUndoList( item, UNDO_REDO::CHANGED );
switch( item->Type() ) switch( item->Type() )
{ {
@ -533,7 +533,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) ); item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
if( !moving ) if( !moving )
saveCopyInUndoList( item, UR_CHANGED, ii > 0 ); saveCopyInUndoList( item, UNDO_REDO::CHANGED, ii > 0 );
for( int i = 0; clockwise ? i < 1 : i < 3; ++i ) for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
{ {
@ -610,7 +610,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
if( selection.GetSize() == 1 ) if( selection.GetSize() == 1 )
{ {
if( !moving ) if( !moving )
saveCopyInUndoList( item, UR_CHANGED ); saveCopyInUndoList( item, UNDO_REDO::CHANGED );
switch( item->Type() ) switch( item->Type() )
{ {
@ -717,7 +717,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) ); item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
if( !moving ) if( !moving )
saveCopyInUndoList( item, UR_CHANGED, ii > 0 ); saveCopyInUndoList( item, UNDO_REDO::CHANGED, ii > 0 );
if( item->Type() == SCH_SHEET_PIN_T ) if( item->Type() == SCH_SHEET_PIN_T )
{ {
@ -812,7 +812,7 @@ int SCH_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
SCH_ITEM* newItem = oldItem->Duplicate(); SCH_ITEM* newItem = oldItem->Duplicate();
newItem->SetFlags( IS_NEW ); newItem->SetFlags( IS_NEW );
newItems.push_back( newItem ); newItems.push_back( newItem );
saveCopyInUndoList( newItem, UR_NEW, ii > 0 ); saveCopyInUndoList( newItem, UNDO_REDO::NEWITEM, ii > 0 );
switch( newItem->Type() ) switch( newItem->Type() )
{ {
@ -933,7 +933,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
newItem->SetFlags( IS_NEW ); newItem->SetFlags( IS_NEW );
m_frame->AddToScreen( newItem, m_frame->GetScreen() ); m_frame->AddToScreen( newItem, m_frame->GetScreen() );
m_frame->SaveCopyInUndoList( m_frame->GetScreen(), newItem, UR_NEW, false ); m_frame->SaveCopyInUndoList( m_frame->GetScreen(), newItem, UNDO_REDO::NEWITEM, false );
m_selectionTool->AddItemToSel( newItem ); m_selectionTool->AddItemToSel( newItem );
@ -1011,7 +1011,7 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
else else
{ {
sch_item->SetFlags( STRUCT_DELETED ); sch_item->SetFlags( STRUCT_DELETED );
saveCopyInUndoList( item, UR_DELETED, appendToUndo ); saveCopyInUndoList( item, UNDO_REDO::DELETED, appendToUndo );
appendToUndo = true; appendToUndo = true;
if( sch_item && sch_item->IsConnectable() ) if( sch_item && sch_item->IsConnectable() )
@ -1139,7 +1139,7 @@ void SCH_EDIT_TOOL::editFieldText( SCH_FIELD* aField )
{ {
// Save old component in undo list if not already in edit, or moving. // Save old component in undo list if not already in edit, or moving.
if( aField->GetEditFlags() == 0 ) // i.e. not edited, or moved if( aField->GetEditFlags() == 0 ) // i.e. not edited, or moved
saveCopyInUndoList( aField, UR_CHANGED ); saveCopyInUndoList( aField, UNDO_REDO::CHANGED );
wxString title = wxString::Format( _( "Edit %s Field" ), aField->GetName() ); wxString title = wxString::Format( _( "Edit %s Field" ), aField->GetName() );
@ -1218,7 +1218,7 @@ int SCH_EDIT_TOOL::AutoplaceFields( const TOOL_EVENT& aEvent )
SCH_COMPONENT* component = (SCH_COMPONENT*) selection.Front(); SCH_COMPONENT* component = (SCH_COMPONENT*) selection.Front();
if( !component->IsNew() ) if( !component->IsNew() )
saveCopyInUndoList( component, UR_CHANGED ); saveCopyInUndoList( component, UNDO_REDO::CHANGED );
component->AutoplaceFields( m_frame->GetScreen(), /* aManual */ true ); component->AutoplaceFields( m_frame->GetScreen(), /* aManual */ true );
@ -1282,7 +1282,7 @@ int SCH_EDIT_TOOL::ConvertDeMorgan( const TOOL_EVENT& aEvent )
return 0; return 0;
if( !component->IsNew() ) if( !component->IsNew() )
saveCopyInUndoList( component, UR_CHANGED ); saveCopyInUndoList( component, UNDO_REDO::CHANGED );
m_frame->ConvertPart( component ); m_frame->ConvertPart( component );
@ -1327,7 +1327,7 @@ int SCH_EDIT_TOOL::RefreshSymbolFromLibrary( const TOOL_EVENT& aEvent )
if( !symbol->IsNew() ) if( !symbol->IsNew() )
{ {
saveCopyInUndoList( symbol, UR_CHANGED, appendToUndo ); saveCopyInUndoList( symbol, UNDO_REDO::CHANGED, appendToUndo );
appendToUndo = true; appendToUndo = true;
} }
@ -1510,7 +1510,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
{ {
// save old image in undo list if not already in edit // save old image in undo list if not already in edit
if( bitmap->GetEditFlags() == 0 ) if( bitmap->GetEditFlags() == 0 )
saveCopyInUndoList( bitmap, UR_CHANGED ); saveCopyInUndoList( bitmap, UNDO_REDO::CHANGED );
dlg.TransferToImage( bitmap->GetImage() ); dlg.TransferToImage( bitmap->GetImage() );
@ -1650,8 +1650,8 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
if( !text->IsNew() ) if( !text->IsNew() )
{ {
saveCopyInUndoList( text, UR_DELETED ); saveCopyInUndoList( text, UNDO_REDO::DELETED );
saveCopyInUndoList( newtext, UR_NEW, true ); saveCopyInUndoList( newtext, UNDO_REDO::NEWITEM, true );
m_frame->RemoveFromScreen( text, m_frame->GetScreen() ); m_frame->RemoveFromScreen( text, m_frame->GetScreen() );
m_frame->AddToScreen( newtext, m_frame->GetScreen() ); m_frame->AddToScreen( newtext, m_frame->GetScreen() );
@ -1722,7 +1722,7 @@ int SCH_EDIT_TOOL::CleanupSheetPins( const TOOL_EVENT& aEvent )
if( !IsOK( m_frame, _( "Do you wish to delete the unreferenced pins from this sheet?" ) ) ) if( !IsOK( m_frame, _( "Do you wish to delete the unreferenced pins from this sheet?" ) ) )
return 0; return 0;
saveCopyInUndoList( sheet, UR_CHANGED ); saveCopyInUndoList( sheet, UNDO_REDO::CHANGED );
sheet->CleanupSheet(); sheet->CleanupSheet();

View File

@ -100,10 +100,10 @@ int SCH_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent )
{ {
PICKED_ITEMS_LIST undoCmd; PICKED_ITEMS_LIST undoCmd;
WS_PROXY_UNDO_ITEM* undoItem = new WS_PROXY_UNDO_ITEM( m_frame ); WS_PROXY_UNDO_ITEM* undoItem = new WS_PROXY_UNDO_ITEM( m_frame );
ITEM_PICKER wrapper( m_frame->GetScreen(), undoItem, UR_PAGESETTINGS ); ITEM_PICKER wrapper( m_frame->GetScreen(), undoItem, UNDO_REDO::PAGESETTINGS );
undoCmd.PushItem( wrapper ); undoCmd.PushItem( wrapper );
m_frame->SaveCopyInUndoList( undoCmd, UR_PAGESETTINGS, false ); m_frame->SaveCopyInUndoList( undoCmd, UNDO_REDO::PAGESETTINGS, false );
DIALOG_PAGES_SETTINGS dlg( m_frame, wxSize( MAX_PAGE_SIZE_MILS, MAX_PAGE_SIZE_MILS ) ); DIALOG_PAGES_SETTINGS dlg( m_frame, wxSize( MAX_PAGE_SIZE_MILS, MAX_PAGE_SIZE_MILS ) );
dlg.SetWksFileName( BASE_SCREEN::m_PageLayoutDescrFileName ); dlg.SetWksFileName( BASE_SCREEN::m_PageLayoutDescrFileName );

View File

@ -834,15 +834,15 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
if( IsPointOnSegment( wire->GetStartPoint(), wire->GetEndPoint(), i ) ) if( IsPointOnSegment( wire->GetStartPoint(), wire->GetEndPoint(), i ) )
new_ends.push_back( i ); new_ends.push_back( i );
} }
itemList.PushItem( ITEM_PICKER( screen, wire, UR_NEW ) ); itemList.PushItem( ITEM_PICKER( screen, wire, UNDO_REDO::NEWITEM ) );
} }
if( m_busUnfold.in_progress && m_busUnfold.label_placed ) if( m_busUnfold.in_progress && m_busUnfold.label_placed )
{ {
wxASSERT( m_busUnfold.entry && m_busUnfold.label ); wxASSERT( m_busUnfold.entry && m_busUnfold.label );
itemList.PushItem( ITEM_PICKER( screen, m_busUnfold.entry, UR_NEW ) ); itemList.PushItem( ITEM_PICKER( screen, m_busUnfold.entry, UNDO_REDO::NEWITEM ) );
itemList.PushItem( ITEM_PICKER( screen, m_busUnfold.label, UR_NEW ) ); itemList.PushItem( ITEM_PICKER( screen, m_busUnfold.label, UNDO_REDO::NEWITEM ) );
m_busUnfold.label->ClearEditFlags(); m_busUnfold.label->ClearEditFlags();
} }
@ -864,7 +864,7 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
getViewControls()->CaptureCursor( false ); getViewControls()->CaptureCursor( false );
getViewControls()->SetAutoPan( false ); getViewControls()->SetAutoPan( false );
m_frame->SaveCopyInUndoList( itemList, UR_NEW, false ); m_frame->SaveCopyInUndoList( itemList, UNDO_REDO::NEWITEM, false );
// Correct and remove segments that need to be merged. // Correct and remove segments that need to be merged.
m_frame->SchematicCleanUp(); m_frame->SchematicCleanUp();

View File

@ -243,7 +243,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
if( item->HasFlag( TEMP_SELECTED ) && m_isDragOperation ) if( item->HasFlag( TEMP_SELECTED ) && m_isDragOperation )
{ {
// Item was added in getConnectedDragItems // Item was added in getConnectedDragItems
saveCopyInUndoList( (SCH_ITEM*) item, UR_NEW, appendUndo ); saveCopyInUndoList( (SCH_ITEM*) item, UNDO_REDO::NEWITEM, appendUndo );
appendUndo = true; appendUndo = true;
} }
else else
@ -258,7 +258,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
} }
else else
{ {
saveCopyInUndoList( (SCH_ITEM*) item, UR_CHANGED, appendUndo ); saveCopyInUndoList( (SCH_ITEM*) item, UNDO_REDO::CHANGED, appendUndo );
appendUndo = true; appendUndo = true;
} }

View File

@ -536,7 +536,7 @@ public:
* currently: do nothing in GerbView. * currently: do nothing in GerbView.
*/ */
void SaveCopyInUndoList( GERBER_DRAW_ITEM* aItemToCopy, void SaveCopyInUndoList( GERBER_DRAW_ITEM* aItemToCopy,
UNDO_REDO_T aTypeCommand = UR_UNSPECIFIED, UNDO_REDO aTypeCommand = UNDO_REDO::UNSPECIFIED,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) { } const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) { }
/** /**
@ -544,12 +544,12 @@ public:
* Creates a new entry in undo list of commands. * Creates a new entry in undo list of commands.
* 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_T) * @param aTypeCommand = command type (see enum UNDO_REDO)
* @param aTransformPoint = the reference point of the transformation, * @param aTransformPoint = the reference point of the transformation,
* for commands like move * for commands like move
*/ */
void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
UNDO_REDO_T aTypeCommand, UNDO_REDO aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
{ {
// currently: do nothing in GerbView. // currently: do nothing in GerbView.

View File

@ -127,7 +127,7 @@ public:
virtual COMMIT& Stage( std::vector<EDA_ITEM*>& container, CHANGE_TYPE aChangeType ); virtual COMMIT& Stage( std::vector<EDA_ITEM*>& container, CHANGE_TYPE aChangeType );
virtual COMMIT& Stage( const PICKED_ITEMS_LIST& aItems, UNDO_REDO_T aModFlag = UR_UNSPECIFIED ); virtual COMMIT& Stage( const PICKED_ITEMS_LIST& aItems, UNDO_REDO aModFlag = UNDO_REDO::UNSPECIFIED );
///> Executes the changes. ///> Executes the changes.
virtual void Push( const wxString& aMessage = wxT( "A commit" ), virtual void Push( const wxString& aMessage = wxT( "A commit" ),
@ -176,7 +176,7 @@ protected:
virtual EDA_ITEM* parentObject( EDA_ITEM* aItem ) const = 0; virtual EDA_ITEM* parentObject( EDA_ITEM* aItem ) const = 0;
CHANGE_TYPE convert( UNDO_REDO_T aType ) const; CHANGE_TYPE convert( UNDO_REDO aType ) const;
std::set<EDA_ITEM*> m_changedItems; std::set<EDA_ITEM*> m_changedItems;
std::vector<COMMIT_LINE> m_changes; std::vector<COMMIT_LINE> m_changes;

View File

@ -336,11 +336,11 @@ public:
* Creates a new entry in undo list of commands. * Creates a new entry in undo list of commands.
* add a picker to handle aItemToCopy * add a picker to handle aItemToCopy
* @param aItemToCopy = the board item modified by the command to undo * @param aItemToCopy = the board item modified by the command to undo
* @param aTypeCommand = command type (see enum UNDO_REDO_T) * @param aTypeCommand = command type (see enum UNDO_REDO)
* @param aTransformPoint = the reference point of the transformation, for * @param aTransformPoint = the reference point of the transformation, for
* commands like move * commands like move
*/ */
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, UNDO_REDO_T aTypeCommand, virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, UNDO_REDO aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0; const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0;
/** /**
@ -348,11 +348,11 @@ public:
* Creates a new entry in undo list of commands. * Creates a new entry in undo list of commands.
* 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_T) * @param aTypeCommand = command type (see enum UNDO_REDO)
* @param aTransformPoint = the reference point of the transformation, * @param aTransformPoint = the reference point of the transformation,
* for commands like move * for commands like move
*/ */
virtual void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO_T aTypeCommand, virtual void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0; const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0;

View File

@ -50,26 +50,26 @@ class BASE_SCREEN;
/* Type of undo/redo operations /* Type of undo/redo operations
* each type must be redo/undone by a specific operation * each type must be redo/undone by a specific operation
*/ */
enum UNDO_REDO_T { enum class UNDO_REDO {
UR_UNSPECIFIED = 0, // illegal UNSPECIFIED = 0, // illegal
UR_CHANGED, // params of items have a value changed: undo is made by exchange CHANGED, // params of items have a value changed: undo is made by exchange
// values with a copy of these values // values with a copy of these values
UR_NEW, // new item, undo by changing in deleted NEWITEM, // new item, undo by changing in deleted
UR_DELETED, // deleted item, undo by changing in deleted DELETED, // deleted item, undo by changing in deleted
UR_MOVED, // moved item, undo by move it MOVED, // moved item, undo by move it
UR_MIRRORED_X, // mirrored item, undo by mirror X MIRRORED_X, // mirrored item, undo by mirror X
UR_MIRRORED_Y, // mirrored item, undo by mirror Y MIRRORED_Y, // mirrored item, undo by mirror Y
UR_ROTATED, // Rotated item (counterclockwise), undo by rotating it ROTATED, // Rotated item (counterclockwise), undo by rotating it
UR_ROTATED_CLOCKWISE, // Rotated item (clockwise), undo by rotating it ROTATED_CLOCKWISE, // Rotated item (clockwise), undo by rotating it
UR_FLIPPED, // flipped (board items only), undo by flipping it FLIPPED, // flipped (board items only), undo by flipping it
UR_LIBEDIT, // Specific to the component editor (libedit creates a full copy LIBEDIT, // Specific to the component editor (libedit creates a full copy
// of the current component when changed) // of the current component when changed)
UR_LIB_RENAME, // As UR_LIBEDIT, but old copy should be removed from library LIB_RENAME, // As LIBEDIT, but old copy should be removed from library
UR_EXCHANGE_T, // Use for changing the schematic text type where swapping EXCHANGE_T, // Use for changing the schematic text type where swapping
// data structure is insufficient to restore the change. // data structure is insufficient to restore the change.
UR_DRILLORIGIN, // origin changed (like UR_CHANGED, contains the origin and a copy) DRILLORIGIN, // origin changed (like CHANGED, contains the origin and a copy)
UR_GRIDORIGIN, // origin changed (like UR_CHANGED, contains the origin and a copy) GRIDORIGIN, // origin changed (like CHANGED, contains the origin and a copy)
UR_PAGESETTINGS // page settings or title block changes PAGESETTINGS // page settings or title block changes
}; };
@ -78,7 +78,7 @@ class ITEM_PICKER
private: private:
STATUS_FLAGS m_pickerFlags; /* a copy of m_Flags member. useful in mode/drag STATUS_FLAGS m_pickerFlags; /* a copy of m_Flags member. useful in mode/drag
* undo/redo commands */ * undo/redo commands */
UNDO_REDO_T m_undoRedoStatus; /* type of operation to undo/redo for this item */ UNDO_REDO m_undoRedoStatus; /* type of operation to undo/redo for this item */
EDA_ITEM* m_pickedItem; /* Pointer on the schematic or board item that is concerned EDA_ITEM* m_pickedItem; /* Pointer on the schematic or board item that is concerned
* (picked), or in undo redo commands, the copy of an * (picked), or in undo redo commands, the copy of an
* edited item. */ * edited item. */
@ -95,9 +95,9 @@ private:
* be added to/removed from. */ * be added to/removed from. */
public: public:
// ITEM_PICKER( EDA_ITEM* aItem = NULL, UNDO_REDO_T aStatus = UR_UNSPECIFIED ); // ITEM_PICKER( EDA_ITEM* aItem = NULL, UNDO_REDO aStatus = UNSPECIFIED );
ITEM_PICKER(); ITEM_PICKER();
ITEM_PICKER( BASE_SCREEN* aScreen, EDA_ITEM* aItem, UNDO_REDO_T aStatus = UR_UNSPECIFIED ); ITEM_PICKER( BASE_SCREEN* aScreen, EDA_ITEM* aItem, UNDO_REDO aStatus = UNDO_REDO::UNSPECIFIED );
EDA_ITEM* GetItem() const { return m_pickedItem; } EDA_ITEM* GetItem() const { return m_pickedItem; }
@ -109,9 +109,9 @@ public:
KICAD_T GetItemType() const { return m_pickedItemType; } KICAD_T GetItemType() const { return m_pickedItemType; }
void SetStatus( UNDO_REDO_T aStatus ) { m_undoRedoStatus = aStatus; } void SetStatus( UNDO_REDO aStatus ) { m_undoRedoStatus = aStatus; }
UNDO_REDO_T GetStatus() const { return m_undoRedoStatus; } UNDO_REDO GetStatus() const { return m_undoRedoStatus; }
void SetFlags( STATUS_FLAGS aFlags ) { m_pickerFlags = aFlags; } void SetFlags( STATUS_FLAGS aFlags ) { m_pickerFlags = aFlags; }
@ -133,8 +133,8 @@ public:
class PICKED_ITEMS_LIST class PICKED_ITEMS_LIST
{ {
public: public:
UNDO_REDO_T m_Status; /* info about operation to undo/redo for this item. can be UNDO_REDO m_Status; /* info about operation to undo/redo for this item. can be
* UR_UNSPECIFIED */ * UNSPECIFIED */
wxPoint m_TransformPoint; /* used to undo redo command by the same command: usually wxPoint m_TransformPoint; /* used to undo redo command by the same command: usually
* need to know the rotate point or the move vector */ * need to know the rotate point or the move vector */
@ -236,10 +236,10 @@ public:
/** /**
* Function GetPickedItemStatus * Function GetPickedItemStatus
* @return The type of undo/redo operation associated to the picked item, * @return The type of undo/redo operation associated to the picked item,
* or UR_UNSPECIFIED if does not exist * or UNSPECIFIED if does not exist
* @param aIdx Index of the picked item in the picked list * @param aIdx Index of the picked item in the picked list
*/ */
UNDO_REDO_T GetPickedItemStatus( unsigned int aIdx ) const; UNDO_REDO GetPickedItemStatus( unsigned int aIdx ) const;
/** /**
* Function GetPickerFlags * Function GetPickerFlags
@ -264,7 +264,7 @@ public:
* @param aIdx Index of the picker in the picked list * @param aIdx Index of the picker in the picked list
* @return True if the picker exists or false if does not exist * @return True if the picker exists or false if does not exist
*/ */
bool SetPickedItem( EDA_ITEM* aItem, UNDO_REDO_T aStatus, unsigned aIdx ); bool SetPickedItem( EDA_ITEM* aItem, UNDO_REDO aStatus, unsigned aIdx );
/** /**
* Function SetPickedItemLink * Function SetPickedItemLink
@ -282,7 +282,7 @@ public:
* @param aIdx Index of the picker in the picked list * @param aIdx Index of the picker in the picked list
* @return True if the picker exists or false if does not exist * @return True if the picker exists or false if does not exist
*/ */
bool SetPickedItemStatus( UNDO_REDO_T aStatus, unsigned aIdx ); bool SetPickedItemStatus( UNDO_REDO aStatus, unsigned aIdx );
/** /**
* Function SetPickerFlags * Function SetPickerFlags

View File

@ -36,7 +36,7 @@ void PL_EDITOR_FRAME::SaveCopyInUndoList()
{ {
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST(); PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
WS_PROXY_UNDO_ITEM* copyItem = new WS_PROXY_UNDO_ITEM( this ); WS_PROXY_UNDO_ITEM* copyItem = new WS_PROXY_UNDO_ITEM( this );
ITEM_PICKER wrapper( GetScreen(), copyItem, UR_LIBEDIT ); ITEM_PICKER wrapper( GetScreen(), copyItem, UNDO_REDO::LIBEDIT );
lastcmd->PushItem( wrapper ); lastcmd->PushItem( wrapper );
PushCommandToUndoList( lastcmd ); PushCommandToUndoList( lastcmd );

View File

@ -76,7 +76,7 @@ COMMIT& BOARD_COMMIT::Stage( std::vector<EDA_ITEM*>& container, CHANGE_TYPE aCha
return COMMIT::Stage( container, aChangeType ); return COMMIT::Stage( container, aChangeType );
} }
COMMIT& BOARD_COMMIT::Stage( const PICKED_ITEMS_LIST& aItems, UNDO_REDO_T aModFlag ) COMMIT& BOARD_COMMIT::Stage( const PICKED_ITEMS_LIST& aItems, UNDO_REDO aModFlag )
{ {
return COMMIT::Stage( aItems, aModFlag ); return COMMIT::Stage( aItems, aModFlag );
} }
@ -123,10 +123,10 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
if( aCreateUndoEntry ) if( aCreateUndoEntry )
{ {
ITEM_PICKER itemWrapper( nullptr, ent.m_item, UR_CHANGED ); ITEM_PICKER itemWrapper( nullptr, ent.m_item, UNDO_REDO::CHANGED );
itemWrapper.SetLink( ent.m_copy ); itemWrapper.SetLink( ent.m_copy );
undoList.PushItem( itemWrapper ); undoList.PushItem( itemWrapper );
frame->SaveCopyInUndoList( undoList, UR_CHANGED ); frame->SaveCopyInUndoList( undoList, UNDO_REDO::CHANGED );
} }
savedModules.insert( ent.m_item ); savedModules.insert( ent.m_item );
@ -158,7 +158,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
else else
{ {
if( aCreateUndoEntry ) if( aCreateUndoEntry )
undoList.PushItem( ITEM_PICKER( nullptr, boardItem, UR_NEW ) ); undoList.PushItem( ITEM_PICKER( nullptr, boardItem, UNDO_REDO::NEWITEM ) );
if( !( changeFlags & CHT_DONE ) ) if( !( changeFlags & CHT_DONE ) )
board->Add( boardItem ); // handles connectivity board->Add( boardItem ); // handles connectivity
@ -173,7 +173,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
case CHT_REMOVE: case CHT_REMOVE:
{ {
if( !m_editModules && aCreateUndoEntry ) if( !m_editModules && aCreateUndoEntry )
undoList.PushItem( ITEM_PICKER( nullptr, boardItem, UR_DELETED ) ); undoList.PushItem( ITEM_PICKER( nullptr, boardItem, UNDO_REDO::DELETED ) );
if( boardItem->IsSelected() ) if( boardItem->IsSelected() )
{ {
@ -261,7 +261,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
{ {
if( !m_editModules && aCreateUndoEntry ) if( !m_editModules && aCreateUndoEntry )
{ {
ITEM_PICKER itemWrapper( nullptr, boardItem, UR_CHANGED ); ITEM_PICKER itemWrapper( nullptr, boardItem, UNDO_REDO::CHANGED );
wxASSERT( ent.m_copy ); wxASSERT( ent.m_copy );
itemWrapper.SetLink( ent.m_copy ); itemWrapper.SetLink( ent.m_copy );
undoList.PushItem( itemWrapper ); undoList.PushItem( itemWrapper );
@ -308,7 +308,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
if( aCreateUndoEntry ) if( aCreateUndoEntry )
{ {
ITEM_PICKER itemWrapper( nullptr, boardItem, UR_CHANGED ); ITEM_PICKER itemWrapper( nullptr, boardItem, UNDO_REDO::CHANGED );
wxASSERT( ent.m_copy ); wxASSERT( ent.m_copy );
itemWrapper.SetLink( ent.m_copy ); itemWrapper.SetLink( ent.m_copy );
undoList.PushItem( itemWrapper ); undoList.PushItem( itemWrapper );
@ -324,7 +324,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
} }
if( !m_editModules && aCreateUndoEntry ) if( !m_editModules && aCreateUndoEntry )
frame->SaveCopyInUndoList( undoList, UR_UNSPECIFIED ); frame->SaveCopyInUndoList( undoList, UNDO_REDO::UNSPECIFIED );
m_toolMgr->PostEvent( { TC_MESSAGE, TA_MODEL_CHANGE, AS_GLOBAL } ); m_toolMgr->PostEvent( { TC_MESSAGE, TA_MODEL_CHANGE, AS_GLOBAL } );

View File

@ -49,7 +49,7 @@ public:
COMMIT& Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType ) override; COMMIT& Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType ) override;
COMMIT& Stage( std::vector<EDA_ITEM*>& container, CHANGE_TYPE aChangeType ) override; COMMIT& Stage( std::vector<EDA_ITEM*>& container, CHANGE_TYPE aChangeType ) override;
COMMIT& Stage( COMMIT& Stage(
const PICKED_ITEMS_LIST& aItems, UNDO_REDO_T aModFlag = UR_UNSPECIFIED ) override; const PICKED_ITEMS_LIST& aItems, UNDO_REDO aModFlag = UNDO_REDO::UNSPECIFIED ) override;
/* /*
* @return true iff the commit has an entry to remove aItem. * @return true iff the commit has an entry to remove aItem.

View File

@ -1713,7 +1713,7 @@ ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode,
if( aNewZonesList ) if( aNewZonesList )
{ {
ITEM_PICKER picker( nullptr, new_area, UR_NEW ); ITEM_PICKER picker( nullptr, new_area, UNDO_REDO::NEWITEM );
aNewZonesList->PushItem( picker ); aNewZonesList->PushItem( picker );
} }
@ -1728,7 +1728,7 @@ void BOARD::RemoveArea( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_to
if( aDeletedList ) if( aDeletedList )
{ {
ITEM_PICKER picker( nullptr, area_to_remove, UR_DELETED ); ITEM_PICKER picker( nullptr, area_to_remove, UNDO_REDO::DELETED );
aDeletedList->PushItem( picker ); aDeletedList->PushItem( picker );
Remove( area_to_remove ); // remove from zone list, but does not delete it Remove( area_to_remove ); // remove from zone list, but does not delete it
} }

View File

@ -305,7 +305,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem( PICKED_ITEMS_LIST* aUndoLi
{ {
if( aUndoList->FindItem( aItem ) < 0 ) if( aUndoList->FindItem( aItem ) < 0 )
{ {
ITEM_PICKER picker( nullptr, aItem, UR_CHANGED ); ITEM_PICKER picker( nullptr, aItem, UNDO_REDO::CHANGED );
picker.SetLink( aItem->Clone() ); picker.SetLink( aItem->Clone() );
aUndoList->PushItem( picker ); aUndoList->PushItem( picker );
} }
@ -364,7 +364,7 @@ bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow()
if( itemsListPicker.GetCount() > 0 ) if( itemsListPicker.GetCount() > 0 )
{ {
m_parent->SaveCopyInUndoList( itemsListPicker, UR_CHANGED ); m_parent->SaveCopyInUndoList( itemsListPicker, UNDO_REDO::CHANGED );
for( auto segment : m_brd->Tracks() ) for( auto segment : m_brd->Tracks() )
m_parent->GetCanvas()->GetView()->Update( segment ); m_parent->GetCanvas()->GetView()->Update( segment );

View File

@ -104,7 +104,7 @@ int PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
if( aItemsListPicker ) if( aItemsListPicker )
{ {
aTrackItem->SetWidth( initial_width ); aTrackItem->SetWidth( initial_width );
ITEM_PICKER picker( nullptr, aTrackItem, UR_CHANGED ); ITEM_PICKER picker( nullptr, aTrackItem, UNDO_REDO::CHANGED );
picker.SetLink( aTrackItem->Clone() ); picker.SetLink( aTrackItem->Clone() );
aItemsListPicker->PushItem( picker ); aItemsListPicker->PushItem( picker );
aTrackItem->SetWidth( new_width ); aTrackItem->SetWidth( new_width );

View File

@ -181,8 +181,8 @@ private:
* Virtual functions, not used here, but needed by PCB_BASE_FRAME * Virtual functions, not used here, but needed by PCB_BASE_FRAME
* (virtual pure functions ) * (virtual pure functions )
*/ */
void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO_T, const wxPoint& ) override {} void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO, const wxPoint& ) override {}
void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint &) override {} void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO, const wxPoint &) override {}
void updateView(); void updateView();

View File

@ -220,8 +220,8 @@ private:
* Virtual functions, not used here, but needed by PCB_BASE_FRAME * Virtual functions, not used here, but needed by PCB_BASE_FRAME
* (virtual pure functions ) * (virtual pure functions )
*/ */
void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO_T, const wxPoint& ) override {} void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO, const wxPoint& ) override {}
void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint& ) override {} void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO, const wxPoint& ) override {}
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View File

@ -471,11 +471,11 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, bool aRecreateRatsnest )
if( aModule->IsNew() ) if( aModule->IsNew() )
{ {
SaveCopyInUndoList( aModule, UR_NEW ); SaveCopyInUndoList( aModule, UNDO_REDO::NEWITEM );
} }
else if( aModule->IsMoving() ) else if( aModule->IsMoving() )
{ {
ITEM_PICKER picker( nullptr, aModule, UR_CHANGED ); ITEM_PICKER picker( nullptr, aModule, UNDO_REDO::CHANGED );
picker.SetLink( s_ModuleInitialCopy ); picker.SetLink( s_ModuleInitialCopy );
s_PickedList.PushItem( picker ); s_PickedList.PushItem( picker );
s_ModuleInitialCopy = NULL; // the picker is now owner of s_ModuleInitialCopy. s_ModuleInitialCopy = NULL; // the picker is now owner of s_ModuleInitialCopy.
@ -483,7 +483,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, bool aRecreateRatsnest )
if( s_PickedList.GetCount() ) if( s_PickedList.GetCount() )
{ {
SaveCopyInUndoList( s_PickedList, UR_UNSPECIFIED ); SaveCopyInUndoList( s_PickedList, UNDO_REDO::UNSPECIFIED );
// Clear list, but DO NOT delete items, because they are owned by the saved undo // Clear list, but DO NOT delete items, because they are owned by the saved undo
// list and they therefore in use // list and they therefore in use

View File

@ -86,11 +86,11 @@ public:
* Creates a new entry in undo list of commands. * Creates a new entry in undo list of commands.
* add a picker to handle aItemToCopy * add a picker to handle aItemToCopy
* @param aItemToCopy = the board item modified by the command to undo * @param aItemToCopy = the board item modified by the command to undo
* @param aTypeCommand = command type (see enum UNDO_REDO_T) * @param aTypeCommand = command type (see enum UNDO_REDO)
* @param aTransformPoint = the reference point of the transformation, for * @param aTransformPoint = the reference point of the transformation, for
* commands like move * commands like move
*/ */
void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, UNDO_REDO_T aTypeCommand, void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, UNDO_REDO aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override; const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override;
/** /**
@ -98,11 +98,11 @@ public:
* Creates a new entry in undo list of commands. * Creates a new entry in undo list of commands.
* 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_T) * @param aTypeCommand = command type (see enum UNDO_REDO)
* @param aTransformPoint = the reference point of the transformation, * @param aTransformPoint = the reference point of the transformation,
* for commands like move * for commands like move
*/ */
void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO_T aTypeCommand, void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override; const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override;
/** /**

View File

@ -217,38 +217,38 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
BOARD* currentPcb = GetBoard(); BOARD* currentPcb = GetBoard();
bool fromEmpty = false; bool fromEmpty = false;
itemsList.m_Status = UR_CHANGED; itemsList.m_Status = UNDO_REDO::CHANGED;
// Append tracks: // Append tracks:
for( auto item : currentPcb->Tracks() ) for( auto item : currentPcb->Tracks() )
{ {
ITEM_PICKER picker( nullptr, item, UR_CHANGED ); ITEM_PICKER picker( nullptr, item, UNDO_REDO::CHANGED );
itemsList.PushItem( picker ); itemsList.PushItem( picker );
} }
// Append modules: // Append modules:
for( auto item : currentPcb->Modules() ) for( auto item : currentPcb->Modules() )
{ {
ITEM_PICKER picker( nullptr, item, UR_CHANGED ); ITEM_PICKER picker( nullptr, item, UNDO_REDO::CHANGED );
itemsList.PushItem( picker ); itemsList.PushItem( picker );
} }
// Append drawings // Append drawings
for( auto item : currentPcb->Drawings() ) for( auto item : currentPcb->Drawings() )
{ {
ITEM_PICKER picker( nullptr, item, UR_CHANGED ); ITEM_PICKER picker( nullptr, item, UNDO_REDO::CHANGED );
itemsList.PushItem( picker ); itemsList.PushItem( picker );
} }
// Append zones outlines // Append zones outlines
for( int ii = 0; ii < currentPcb->GetAreaCount(); ii++ ) for( int ii = 0; ii < currentPcb->GetAreaCount(); ii++ )
{ {
ITEM_PICKER picker( nullptr, (EDA_ITEM*) currentPcb->GetArea( ii ), UR_CHANGED ); ITEM_PICKER picker( nullptr, (EDA_ITEM*) currentPcb->GetArea( ii ), UNDO_REDO::CHANGED );
itemsList.PushItem( picker ); itemsList.PushItem( picker );
} }
if( itemsList.GetCount() > 0 ) if( itemsList.GetCount() > 0 )
SaveCopyInUndoList( itemsList, UR_CHANGED, wxPoint( 0.0, 0.0 ) ); SaveCopyInUndoList( itemsList, UNDO_REDO::CHANGED, wxPoint( 0.0, 0.0 ) );
else else
fromEmpty = true; fromEmpty = true;
@ -265,7 +265,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
if( fromEmpty ) if( fromEmpty )
{ {
oldBuffer = new PICKED_ITEMS_LIST(); oldBuffer = new PICKED_ITEMS_LIST();
oldBuffer->m_Status = UR_NEW; oldBuffer->m_Status = UNDO_REDO::NEWITEM;
} }
else else
{ {
@ -298,7 +298,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
for( unsigned int i = 0; i < oldBuffer->GetCount(); i++ ) for( unsigned int i = 0; i < oldBuffer->GetCount(); i++ )
{ {
BOARD_ITEM* item = (BOARD_ITEM*) oldBuffer->GetPickedItem( i ); BOARD_ITEM* item = (BOARD_ITEM*) oldBuffer->GetPickedItem( i );
ITEM_PICKER picker( nullptr, item, UR_DELETED ); ITEM_PICKER picker( nullptr, item, UNDO_REDO::DELETED );
wxASSERT( item ); wxASSERT( item );
@ -317,7 +317,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
{ {
if( !oldBuffer->ContainsItem( item ) ) if( !oldBuffer->ContainsItem( item ) )
{ {
ITEM_PICKER picker( nullptr, item, UR_NEW ); ITEM_PICKER picker( nullptr, item, UNDO_REDO::NEWITEM );
oldBuffer->PushItem( picker ); oldBuffer->PushItem( picker );
} }
} }
@ -326,7 +326,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
{ {
if( !oldBuffer->ContainsItem( item ) ) if( !oldBuffer->ContainsItem( item ) )
{ {
ITEM_PICKER picker( nullptr, item, UR_NEW ); ITEM_PICKER picker( nullptr, item, UNDO_REDO::NEWITEM );
oldBuffer->PushItem( picker ); oldBuffer->PushItem( picker );
} }
} }
@ -335,7 +335,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
{ {
if( !oldBuffer->ContainsItem( item ) ) if( !oldBuffer->ContainsItem( item ) )
{ {
ITEM_PICKER picker( nullptr, item, UR_NEW ); ITEM_PICKER picker( nullptr, item, UNDO_REDO::NEWITEM );
oldBuffer->PushItem( picker ); oldBuffer->PushItem( picker );
} }
} }
@ -344,7 +344,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
{ {
if( !oldBuffer->ContainsItem( (EDA_ITEM*) currentPcb->GetArea( ii ) ) ) if( !oldBuffer->ContainsItem( (EDA_ITEM*) currentPcb->GetArea( ii ) ) )
{ {
ITEM_PICKER picker( nullptr, (EDA_ITEM*) currentPcb->GetArea( ii ), UR_NEW ); ITEM_PICKER picker( nullptr, (EDA_ITEM*) currentPcb->GetArea( ii ), UNDO_REDO::NEWITEM );
oldBuffer->PushItem( picker ); oldBuffer->PushItem( picker );
} }
} }

View File

@ -312,10 +312,10 @@ int PCB_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent )
{ {
PICKED_ITEMS_LIST undoCmd; PICKED_ITEMS_LIST undoCmd;
WS_PROXY_UNDO_ITEM* undoItem = new WS_PROXY_UNDO_ITEM( m_frame ); WS_PROXY_UNDO_ITEM* undoItem = new WS_PROXY_UNDO_ITEM( m_frame );
ITEM_PICKER wrapper( nullptr, undoItem, UR_PAGESETTINGS ); ITEM_PICKER wrapper( nullptr, undoItem, UNDO_REDO::PAGESETTINGS );
undoCmd.PushItem( wrapper ); undoCmd.PushItem( wrapper );
m_frame->SaveCopyInUndoList( undoCmd, UR_PAGESETTINGS ); m_frame->SaveCopyInUndoList( undoCmd, UNDO_REDO::PAGESETTINGS );
DIALOG_PAGES_SETTINGS dlg( m_frame, wxSize( MAX_PAGE_SIZE_PCBNEW_MILS, DIALOG_PAGES_SETTINGS dlg( m_frame, wxSize( MAX_PAGE_SIZE_PCBNEW_MILS,
MAX_PAGE_SIZE_PCBNEW_MILS ) ); MAX_PAGE_SIZE_PCBNEW_MILS ) );
@ -1571,7 +1571,7 @@ int PCB_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
picker->SetClickHandler( picker->SetClickHandler(
[this] ( const VECTOR2D& pt ) -> bool [this] ( const VECTOR2D& pt ) -> bool
{ {
m_frame->SaveCopyInUndoList( m_placeOrigin.get(), UR_DRILLORIGIN ); m_frame->SaveCopyInUndoList( m_placeOrigin.get(), UNDO_REDO::DRILLORIGIN );
DoSetDrillOrigin( getView(), m_frame, m_placeOrigin.get(), pt ); DoSetDrillOrigin( getView(), m_frame, m_placeOrigin.get(), pt );
return false; // drill origin is a one-shot; don't continue with tool return false; // drill origin is a one-shot; don't continue with tool
} ); } );

View File

@ -419,7 +419,7 @@ int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
picker->SetClickHandler( picker->SetClickHandler(
[this] ( const VECTOR2D& pt ) -> bool [this] ( const VECTOR2D& pt ) -> bool
{ {
m_frame->SaveCopyInUndoList( m_gridOrigin.get(), UR_GRIDORIGIN ); m_frame->SaveCopyInUndoList( m_gridOrigin.get(), UNDO_REDO::GRIDORIGIN );
DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), pt ); DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), pt );
return false; // drill origin is a one-shot; don't continue with tool return false; // drill origin is a one-shot; don't continue with tool
} ); } );
@ -433,7 +433,7 @@ int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::GridResetOrigin( const TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::GridResetOrigin( const TOOL_EVENT& aEvent )
{ {
m_frame->SaveCopyInUndoList( m_gridOrigin.get(), UR_GRIDORIGIN ); m_frame->SaveCopyInUndoList( m_gridOrigin.get(), UNDO_REDO::GRIDORIGIN );
DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), VECTOR2D( 0, 0 ) ); DoSetGridOrigin( getView(), m_frame, m_gridOrigin.get(), VECTOR2D( 0, 0 ) );
return 0; return 0;
} }

View File

@ -181,7 +181,7 @@ static void SwapItemData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
aItem->SetParent( parent ); aItem->SetParent( parent );
} }
void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( BOARD_ITEM* aItem, UNDO_REDO_T aCommandType, void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( BOARD_ITEM* aItem, UNDO_REDO aCommandType,
const wxPoint& aTransformPoint ) const wxPoint& aTransformPoint )
{ {
PICKED_ITEMS_LIST commandToUndo; PICKED_ITEMS_LIST commandToUndo;
@ -191,7 +191,7 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( BOARD_ITEM* aItem, UNDO_REDO_T aCo
void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
UNDO_REDO_T aTypeCommand, UNDO_REDO aTypeCommand,
const wxPoint& aTransformPoint ) const wxPoint& aTransformPoint )
{ {
static KICAD_T moduleChildren[] = { PCB_MODULE_TEXT_T, PCB_MODULE_EDGE_T, PCB_PAD_T, EOT }; static KICAD_T moduleChildren[] = { PCB_MODULE_TEXT_T, PCB_MODULE_EDGE_T, PCB_PAD_T, EOT };
@ -224,7 +224,7 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
for( unsigned j = 0; j < commandToUndo->GetCount(); j++ ) for( unsigned j = 0; j < commandToUndo->GetCount(); j++ )
{ {
if( commandToUndo->GetPickedItem( j ) == item if( commandToUndo->GetPickedItem( j ) == item
&& commandToUndo->GetPickedItemStatus( j ) == UR_CHANGED ) && commandToUndo->GetPickedItemStatus( j ) == UNDO_REDO::CHANGED )
{ {
found = true; found = true;
break; break;
@ -248,7 +248,7 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
clone->Reference().ClearEditFlags(); clone->Reference().ClearEditFlags();
clone->Value().ClearEditFlags(); clone->Value().ClearEditFlags();
ITEM_PICKER picker( nullptr, item, UR_CHANGED ); ITEM_PICKER picker( nullptr, item, UNDO_REDO::CHANGED );
picker.SetLink( clone ); picker.SetLink( clone );
commandToUndo->PushItem( picker ); commandToUndo->PushItem( picker );
@ -269,9 +269,9 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
for( unsigned ii = 0; ii < commandToUndo->GetCount(); ii++ ) for( unsigned ii = 0; ii < commandToUndo->GetCount(); ii++ )
{ {
EDA_ITEM* item = aItemsList.GetPickedItem( ii ); EDA_ITEM* item = aItemsList.GetPickedItem( ii );
UNDO_REDO_T command = commandToUndo->GetPickedItemStatus( ii ); UNDO_REDO command = commandToUndo->GetPickedItemStatus( ii );
if( command == UR_UNSPECIFIED ) if( command == UNDO_REDO::UNSPECIFIED )
{ {
command = aTypeCommand; command = aTypeCommand;
commandToUndo->SetPickedItemStatus( command, ii ); commandToUndo->SetPickedItemStatus( command, ii );
@ -281,9 +281,9 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
switch( command ) switch( command )
{ {
case UR_CHANGED: case UNDO_REDO::CHANGED:
case UR_DRILLORIGIN: case UNDO_REDO::DRILLORIGIN:
case UR_GRIDORIGIN: case UNDO_REDO::GRIDORIGIN:
/* If needed, create a copy of item, and put in undo list /* If needed, create a copy of item, and put in undo list
* in the picker, as link * in the picker, as link
@ -296,13 +296,13 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
} }
break; break;
case UR_MOVED: case UNDO_REDO::MOVED:
case UR_ROTATED: case UNDO_REDO::ROTATED:
case UR_ROTATED_CLOCKWISE: case UNDO_REDO::ROTATED_CLOCKWISE:
case UR_FLIPPED: case UNDO_REDO::FLIPPED:
case UR_NEW: case UNDO_REDO::NEWITEM:
case UR_DELETED: case UNDO_REDO::DELETED:
case UR_PAGESETTINGS: case UNDO_REDO::PAGESETTINGS:
break; break;
default: default:
@ -415,12 +415,12 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
* This test avoids a Pcbnew crash * This test avoids a Pcbnew crash
* Obviously, this test is not made for deleted items * Obviously, this test is not made for deleted items
*/ */
UNDO_REDO_T status = aList->GetPickedItemStatus( ii ); UNDO_REDO status = aList->GetPickedItemStatus( ii );
if( status != UR_DELETED if( status != UNDO_REDO::DELETED
&& status != UR_DRILLORIGIN // origin markers never on board && status != UNDO_REDO::DRILLORIGIN // origin markers never on board
&& status != UR_GRIDORIGIN // origin markers never on board && status != UNDO_REDO::GRIDORIGIN // origin markers never on board
&& status != UR_PAGESETTINGS ) // nor are page settings proxy items && status != UNDO_REDO::PAGESETTINGS ) // nor are page settings proxy items
{ {
if( !TestForExistingItem( GetBoard(), (BOARD_ITEM*) eda_item ) ) if( !TestForExistingItem( GetBoard(), (BOARD_ITEM*) eda_item ) )
{ {
@ -466,7 +466,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
switch( aList->GetPickedItemStatus( ii ) ) switch( aList->GetPickedItemStatus( ii ) )
{ {
case UR_CHANGED: /* Exchange old and new data for each item */ case UNDO_REDO::CHANGED: /* Exchange old and new data for each item */
{ {
BOARD_ITEM* item = (BOARD_ITEM*) eda_item; BOARD_ITEM* item = (BOARD_ITEM*) eda_item;
BOARD_ITEM* image = (BOARD_ITEM*) aList->GetPickedItemLink( ii ); BOARD_ITEM* image = (BOARD_ITEM*) aList->GetPickedItemLink( ii );
@ -484,8 +484,8 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
} }
break; break;
case UR_NEW: /* new items are deleted */ case UNDO_REDO::NEWITEM: /* new items are deleted */
aList->SetPickedItemStatus( UR_DELETED, ii ); aList->SetPickedItemStatus( UNDO_REDO::DELETED, ii );
GetModel()->Remove( (BOARD_ITEM*) eda_item ); GetModel()->Remove( (BOARD_ITEM*) eda_item );
if( eda_item->Type() != PCB_NETINFO_T ) if( eda_item->Type() != PCB_NETINFO_T )
@ -493,8 +493,8 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
break; break;
case UR_DELETED: /* deleted items are put in List, as new items */ case UNDO_REDO::DELETED: /* deleted items are put in List, as new items */
aList->SetPickedItemStatus( UR_NEW, ii ); aList->SetPickedItemStatus( UNDO_REDO::NEWITEM, ii );
GetModel()->Add( (BOARD_ITEM*) eda_item ); GetModel()->Add( (BOARD_ITEM*) eda_item );
if( eda_item->Type() != PCB_NETINFO_T ) if( eda_item->Type() != PCB_NETINFO_T )
@ -502,7 +502,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
break; break;
case UR_MOVED: case UNDO_REDO::MOVED:
{ {
BOARD_ITEM* item = (BOARD_ITEM*) eda_item; BOARD_ITEM* item = (BOARD_ITEM*) eda_item;
item->Move( aRedoCommand ? aList->m_TransformPoint : -aList->m_TransformPoint ); item->Move( aRedoCommand ? aList->m_TransformPoint : -aList->m_TransformPoint );
@ -512,7 +512,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
} }
break; break;
case UR_ROTATED: case UNDO_REDO::ROTATED:
{ {
BOARD_ITEM* item = (BOARD_ITEM*) eda_item; BOARD_ITEM* item = (BOARD_ITEM*) eda_item;
item->Rotate( aList->m_TransformPoint, item->Rotate( aList->m_TransformPoint,
@ -523,7 +523,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
} }
break; break;
case UR_ROTATED_CLOCKWISE: case UNDO_REDO::ROTATED_CLOCKWISE:
{ {
BOARD_ITEM* item = (BOARD_ITEM*) eda_item; BOARD_ITEM* item = (BOARD_ITEM*) eda_item;
item->Rotate( aList->m_TransformPoint, item->Rotate( aList->m_TransformPoint,
@ -534,7 +534,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
} }
break; break;
case UR_FLIPPED: case UNDO_REDO::FLIPPED:
{ {
BOARD_ITEM* item = (BOARD_ITEM*) eda_item; BOARD_ITEM* item = (BOARD_ITEM*) eda_item;
item->Flip( aList->m_TransformPoint, m_Settings->m_FlipLeftRight ); item->Flip( aList->m_TransformPoint, m_Settings->m_FlipLeftRight );
@ -544,22 +544,22 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
} }
break; break;
case UR_DRILLORIGIN: case UNDO_REDO::DRILLORIGIN:
case UR_GRIDORIGIN: case UNDO_REDO::GRIDORIGIN:
{ {
BOARD_ITEM* item = (BOARD_ITEM*) eda_item; BOARD_ITEM* item = (BOARD_ITEM*) eda_item;
BOARD_ITEM* image = (BOARD_ITEM*) aList->GetPickedItemLink( ii ); BOARD_ITEM* image = (BOARD_ITEM*) aList->GetPickedItemLink( ii );
VECTOR2D origin = image->GetPosition(); VECTOR2D origin = image->GetPosition();
image->SetPosition( eda_item->GetPosition() ); image->SetPosition( eda_item->GetPosition() );
if( aList->GetPickedItemStatus( ii ) == UR_DRILLORIGIN ) if( aList->GetPickedItemStatus( ii ) == UNDO_REDO::DRILLORIGIN )
PCB_EDITOR_CONTROL::DoSetDrillOrigin( view, this, item, origin ); PCB_EDITOR_CONTROL::DoSetDrillOrigin( view, this, item, origin );
else else
PCBNEW_CONTROL::DoSetGridOrigin( view, this, item, origin ); PCBNEW_CONTROL::DoSetGridOrigin( view, this, item, origin );
} }
break; break;
case UR_PAGESETTINGS: case UNDO_REDO::PAGESETTINGS:
{ {
// swap current settings with stored settings // swap current settings with stored settings
WS_PROXY_UNDO_ITEM alt_item( this ); WS_PROXY_UNDO_ITEM alt_item( this );

View File

@ -136,7 +136,7 @@ bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare )
* Function SaveCopyOfZones * Function SaveCopyOfZones
* creates a copy of zones having a given netcode on a given layer, * creates a copy of zones having a given netcode on a given layer,
* and fill a pick list with pickers to handle these copies * and fill a pick list with pickers to handle these copies
* the UndoRedo status is set to UR_CHANGED for all items in list * the UndoRedo status is set to CHANGED for all items in list
* Later, UpdateCopyOfZonesList will change and update these pickers after a zone editing * Later, UpdateCopyOfZonesList will change and update these pickers after a zone editing
* @param aPickList = the pick list * @param aPickList = the pick list
* @param aPcb = the Board * @param aPcb = the Board
@ -163,7 +163,7 @@ int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, LA
ZONE_CONTAINER* zoneDup = new ZONE_CONTAINER( *zone ); ZONE_CONTAINER* zoneDup = new ZONE_CONTAINER( *zone );
zoneDup->SetParent( aPcb ); zoneDup->SetParent( aPcb );
ITEM_PICKER picker( nullptr, zone, UR_CHANGED ); ITEM_PICKER picker( nullptr, zone, UNDO_REDO::CHANGED );
picker.SetLink( zoneDup ); picker.SetLink( zoneDup );
aPickList.PushItem( picker ); aPickList.PushItem( picker );
copyCount++; copyCount++;
@ -176,7 +176,7 @@ int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, LA
/** /**
* Function UpdateCopyOfZonesList * Function UpdateCopyOfZonesList
* Check a pick list to remove zones identical to their copies and set the type of operation in * Check a pick list to remove zones identical to their copies and set the type of operation in
* picker (UR_DELETED, UR_CHANGED). If an item is deleted, the initial values are retrievered, * picker (DELETED, CHANGED). If an item is deleted, the initial values are retrievered,
* because they can have changed during editing. * because they can have changed during editing.
* @param aPickList = the main pick list * @param aPickList = the main pick list
* @param aAuxiliaryList = the list of deleted or added (new created) items after calculations * @param aAuxiliaryList = the list of deleted or added (new created) items after calculations
@ -189,18 +189,18 @@ int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, LA
* before any change. * before any change.
* >> if the picked zone is not changed, it is removed from list * >> if the picked zone is not changed, it is removed from list
* >> if the picked zone was deleted (i.e. not found in board list), the picker is modified: * >> if the picked zone was deleted (i.e. not found in board list), the picker is modified:
* its status becomes UR_DELETED * its status becomes DELETED
* the aAuxiliaryList corresponding picker is removed (if not found : set an error) * the aAuxiliaryList corresponding picker is removed (if not found : set an error)
* >> if the picked zone was flagged as UR_NEW, and was after deleted , * >> if the picked zone was flagged as NEWITEM, and was after deleted ,
* perhaps combined with another zone (i.e. not found in board list): * perhaps combined with another zone (i.e. not found in board list):
* the picker is removed * the picker is removed
* the zone itself if really deleted * the zone itself if really deleted
* the aAuxiliaryList corresponding picker is removed (if not found : set an error) * the aAuxiliaryList corresponding picker is removed (if not found : set an error)
* After aPickList is cleaned, the aAuxiliaryList is read * After aPickList is cleaned, the aAuxiliaryList is read
* All pickers flagged UR_NEW are moved to aPickList * All pickers flagged NEWITEM are moved to aPickList
* (the corresponding zones are zone that were created by the zone normalize and combine process, * (the corresponding zones are zone that were created by the zone normalize and combine process,
* mainly when adding cutout areas, or creating self intersecting contours) * mainly when adding cutout areas, or creating self intersecting contours)
* All pickers flagged UR_DELETED are removed, and the coresponding zones actually deleted * All pickers flagged DELETED are removed, and the coresponding zones actually deleted
* (the corresponding zones are new zone that were created by the zone normalize process, * (the corresponding zones are new zone that were created by the zone normalize process,
* when creating self intersecting contours, and after combined with an existing zone. * when creating self intersecting contours, and after combined with an existing zone.
* At the end of the update process the aAuxiliaryList must be void, * At the end of the update process the aAuxiliaryList must be void,
@ -214,7 +214,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
{ {
for( unsigned kk = 0; kk < aPickList.GetCount(); kk++ ) for( unsigned kk = 0; kk < aPickList.GetCount(); kk++ )
{ {
UNDO_REDO_T status = aPickList.GetPickedItemStatus( kk ); UNDO_REDO status = aPickList.GetPickedItemStatus( kk );
ZONE_CONTAINER* ref = (ZONE_CONTAINER*) aPickList.GetPickedItem( kk ); ZONE_CONTAINER* ref = (ZONE_CONTAINER*) aPickList.GetPickedItem( kk );
@ -228,9 +228,9 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
* it must be in aDeletedList: * it must be in aDeletedList:
* search it and restore initial values * search it and restore initial values
* or * or
* if flagged UR_NEW: remove it definitively * if flagged NEWITEM: remove it definitively
*/ */
if( status == UR_NEW ) if( status == UNDO_REDO::NEWITEM )
{ {
delete ref; delete ref;
ref = NULL; ref = NULL;
@ -240,7 +240,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
else else
{ {
ZONE_CONTAINER* zcopy = (ZONE_CONTAINER*) aPickList.GetPickedItemLink( kk ); ZONE_CONTAINER* zcopy = (ZONE_CONTAINER*) aPickList.GetPickedItemLink( kk );
aPickList.SetPickedItemStatus( UR_DELETED, kk ); aPickList.SetPickedItemStatus( UNDO_REDO::DELETED, kk );
wxASSERT_MSG( zcopy != NULL, wxASSERT_MSG( zcopy != NULL,
wxT( "UpdateCopyOfZonesList() error: link = NULL" ) ); wxT( "UpdateCopyOfZonesList() error: link = NULL" ) );
@ -277,7 +277,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
if( zone == ref ) // picked zone found if( zone == ref ) // picked zone found
{ {
if( aPickList.GetPickedItemStatus( kk ) != UR_NEW ) if( aPickList.GetPickedItemStatus( kk ) != UNDO_REDO::NEWITEM )
{ {
ZONE_CONTAINER* zcopy = (ZONE_CONTAINER*) aPickList.GetPickedItemLink( kk ); ZONE_CONTAINER* zcopy = (ZONE_CONTAINER*) aPickList.GetPickedItemLink( kk );
@ -297,13 +297,13 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
// Add new zones in main pick list, and remove pickers from Auxiliary List // Add new zones in main pick list, and remove pickers from Auxiliary List
for( unsigned ii = 0; ii < aAuxiliaryList.GetCount(); ) for( unsigned ii = 0; ii < aAuxiliaryList.GetCount(); )
{ {
if( aAuxiliaryList.GetPickedItemStatus( ii ) == UR_NEW ) if( aAuxiliaryList.GetPickedItemStatus( ii ) == UNDO_REDO::NEWITEM )
{ {
ITEM_PICKER picker = aAuxiliaryList.GetItemWrapper( ii ); ITEM_PICKER picker = aAuxiliaryList.GetItemWrapper( ii );
aPickList.PushItem( picker ); aPickList.PushItem( picker );
aAuxiliaryList.RemovePicker( ii ); aAuxiliaryList.RemovePicker( ii );
} }
else if( aAuxiliaryList.GetPickedItemStatus( ii ) == UR_DELETED ) else if( aAuxiliaryList.GetPickedItemStatus( ii ) == UNDO_REDO::DELETED )
{ {
delete aAuxiliaryList.GetPickedItemLink( ii ); delete aAuxiliaryList.GetPickedItemLink( ii );
aAuxiliaryList.RemovePicker( ii ); aAuxiliaryList.RemovePicker( ii );

View File

@ -61,7 +61,7 @@ int SaveCopyOfZones(PICKED_ITEMS_LIST & aPickList, BOARD* aPcb, int aNetCode, LA
/** /**
* Function UpdateCopyOfZonesList * Function UpdateCopyOfZonesList
* check a pick list to remove zones identical to their copies * check a pick list to remove zones identical to their copies
* and set the type of operation in picker (UR_DELETED, UR_CHANGED) * and set the type of operation in picker (DELETED, CHANGED)
* @param aPickList = the main pick list * @param aPickList = the main pick list
* @param aAuxiliaryList = the list of deleted or added (new created) items after calculations * @param aAuxiliaryList = the list of deleted or added (new created) items after calculations
* @param aPcb = the Board * @param aPcb = the Board