Convert UNDO_REDO_T to an enum class
This commit is contained in:
parent
0b56dc09a6
commit
1082402b33
|
@ -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++ )
|
||||
{
|
||||
UNDO_REDO_T change_type = aItems.GetPickedItemStatus( i );
|
||||
UNDO_REDO change_type = aItems.GetPickedItemStatus( i );
|
||||
EDA_ITEM* item = aItems.GetPickedItem( i );
|
||||
EDA_ITEM* copy = NULL;
|
||||
|
||||
if( change_type == UR_UNSPECIFIED )
|
||||
if( change_type == UNDO_REDO::UNSPECIFIED )
|
||||
change_type = aItems.m_Status;
|
||||
|
||||
if( change_type == UR_UNSPECIFIED )
|
||||
if( change_type == UNDO_REDO::UNSPECIFIED )
|
||||
change_type = aModFlag;
|
||||
|
||||
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
|
||||
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 )
|
||||
{
|
||||
case UR_NEW:
|
||||
case UNDO_REDO::NEWITEM:
|
||||
return CHT_ADD;
|
||||
|
||||
case UR_DELETED:
|
||||
case UNDO_REDO::DELETED:
|
||||
return CHT_REMOVE;
|
||||
|
||||
default:
|
||||
assert( false );
|
||||
// fall through
|
||||
|
||||
case UR_CHANGED:
|
||||
case UR_MOVED:
|
||||
case UR_MIRRORED_X:
|
||||
case UR_MIRRORED_Y:
|
||||
case UR_ROTATED:
|
||||
case UR_ROTATED_CLOCKWISE:
|
||||
case UR_FLIPPED:
|
||||
case UNDO_REDO::CHANGED:
|
||||
case UNDO_REDO::MOVED:
|
||||
case UNDO_REDO::MIRRORED_X:
|
||||
case UNDO_REDO::MIRRORED_Y:
|
||||
case UNDO_REDO::ROTATED:
|
||||
case UNDO_REDO::ROTATED_CLOCKWISE:
|
||||
case UNDO_REDO::FLIPPED:
|
||||
return CHT_MODIFY;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
SetItem( aItem );
|
||||
|
@ -41,7 +41,7 @@ ITEM_PICKER::ITEM_PICKER( EDA_ITEM* aItem, UNDO_REDO_T aUndoRedoStatus )
|
|||
|
||||
ITEM_PICKER::ITEM_PICKER()
|
||||
{
|
||||
m_undoRedoStatus = UR_UNSPECIFIED;
|
||||
m_undoRedoStatus = UNDO_REDO::UNSPECIFIED;
|
||||
SetItem( nullptr );
|
||||
m_pickerFlags = 0;
|
||||
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;
|
||||
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()
|
||||
{
|
||||
m_Status = UR_UNSPECIFIED;
|
||||
m_Status = UNDO_REDO::UNSPECIFIED;
|
||||
}
|
||||
|
||||
PICKED_ITEMS_LIST::~PICKED_ITEMS_LIST()
|
||||
|
@ -121,7 +121,7 @@ void PICKED_ITEMS_LIST::ClearItemsList()
|
|||
|
||||
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 )
|
||||
{
|
||||
ITEM_PICKER wrapper = PopItem();
|
||||
|
@ -136,7 +136,7 @@ void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
|
|||
{
|
||||
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
|
||||
// (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() )
|
||||
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() )
|
||||
{
|
||||
|
@ -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() )
|
||||
{
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
* currently: do nothing in CvPcb.
|
||||
* 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
|
||||
{
|
||||
}
|
||||
|
@ -104,11 +104,11 @@ public:
|
|||
* Creates a new entry in undo list of commands.
|
||||
* add a list of pickers to handle a list of items
|
||||
* @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,
|
||||
* 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
|
||||
{
|
||||
// currently: do nothing in CvPcb.
|
||||
|
|
|
@ -67,7 +67,7 @@ void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly, bool* aAppendUndo
|
|||
{
|
||||
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
|
||||
|
||||
SaveCopyInUndoList( aScreen, component, UR_CHANGED, *aAppendUndo );
|
||||
SaveCopyInUndoList( aScreen, component, UNDO_REDO::CHANGED, *aAppendUndo );
|
||||
*aAppendUndo = true;
|
||||
component->ClearAnnotation( aSheet );
|
||||
|
||||
|
@ -199,7 +199,7 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
|
|||
SCH_COMPONENT* comp = ref.GetComp();
|
||||
SCH_SHEET_PATH* sheet = &ref.GetSheetPath();
|
||||
|
||||
SaveCopyInUndoList( sheet->LastScreen(), comp, UR_CHANGED, appendUndo );
|
||||
SaveCopyInUndoList( sheet->LastScreen(), comp, UNDO_REDO::CHANGED, appendUndo );
|
||||
appendUndo = true;
|
||||
ref.Annotate();
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ bool SCH_EDIT_FRAME::TrimWire( const wxPoint& aStart, const wxPoint& aEnd )
|
|||
if( IsPointOnSegment( return_line->GetStartPoint(), return_line->GetEndPoint(), aStart ) )
|
||||
line = return_line;
|
||||
|
||||
SaveCopyInUndoList( screen, line, UR_DELETED, true );
|
||||
SaveCopyInUndoList( screen, line, UNDO_REDO::DELETED, true );
|
||||
RemoveFromScreen( line, screen );
|
||||
|
||||
retval = true;
|
||||
|
@ -156,7 +156,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen )
|
|||
{
|
||||
changed = true;
|
||||
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 );
|
||||
};
|
||||
|
||||
|
@ -261,7 +261,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen )
|
|||
{
|
||||
remove_item( firstLine );
|
||||
remove_item( secondLine );
|
||||
itemList.PushItem( ITEM_PICKER( aScreen, mergedLine, UR_NEW ) );
|
||||
itemList.PushItem( ITEM_PICKER( aScreen, mergedLine, UNDO_REDO::NEWITEM ) );
|
||||
|
||||
AddToScreen( mergedLine, aScreen );
|
||||
|
||||
|
@ -283,7 +283,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen )
|
|||
}
|
||||
|
||||
if( itemList.GetCount() )
|
||||
SaveCopyInUndoList( itemList, UR_DELETED, true );
|
||||
SaveCopyInUndoList( itemList, UNDO_REDO::DELETED, true );
|
||||
|
||||
return itemList.GetCount() > 0;
|
||||
}
|
||||
|
@ -304,8 +304,8 @@ bool SCH_EDIT_FRAME::BreakSegment( SCH_LINE* aSegment, const wxPoint& aPoint,
|
|||
newSegment->SetStartPoint( aPoint );
|
||||
AddToScreen( newSegment, aScreen );
|
||||
|
||||
SaveCopyInUndoList( aScreen, newSegment, UR_NEW, true );
|
||||
SaveCopyInUndoList( aScreen, aSegment, UR_CHANGED, true );
|
||||
SaveCopyInUndoList( aScreen, newSegment, UNDO_REDO::NEWITEM, true );
|
||||
SaveCopyInUndoList( aScreen, aSegment, UNDO_REDO::CHANGED, true );
|
||||
|
||||
UpdateItem( aSegment );
|
||||
aSegment->SetEndPoint( aPoint );
|
||||
|
@ -378,7 +378,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
|
|||
auto remove_item = [ & ]( SCH_ITEM* aItem ) -> void
|
||||
{
|
||||
aItem->SetFlags( STRUCT_DELETED );
|
||||
undoList.PushItem( ITEM_PICKER( screen, aItem, UR_DELETED ) );
|
||||
undoList.PushItem( ITEM_PICKER( screen, aItem, UNDO_REDO::DELETED ) );
|
||||
};
|
||||
|
||||
remove_item( aJunction );
|
||||
|
@ -420,7 +420,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
|
|||
{
|
||||
remove_item( firstLine );
|
||||
remove_item( secondLine );
|
||||
undoList.PushItem( ITEM_PICKER( screen, line, UR_NEW ) );
|
||||
undoList.PushItem( ITEM_PICKER( screen, line, UNDO_REDO::NEWITEM ) );
|
||||
AddToScreen( line, screen );
|
||||
|
||||
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 )
|
||||
|
@ -452,7 +452,7 @@ SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( SCH_SCREEN* aScreen, const wxPoint& a
|
|||
SCH_JUNCTION* junction = new SCH_JUNCTION( aPos );
|
||||
|
||||
AddToScreen( junction, aScreen );
|
||||
SaveCopyInUndoList( aScreen, junction, UR_NEW, aUndoAppend );
|
||||
SaveCopyInUndoList( aScreen, junction, UNDO_REDO::NEWITEM, aUndoAppend );
|
||||
BreakSegments( aPos );
|
||||
|
||||
if( aFinal )
|
||||
|
|
|
@ -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
|
||||
// library symbols in the schematic file.
|
||||
aScreen->Remove( aSymbol );
|
||||
frame->SaveCopyInUndoList( aScreen, aSymbol, UR_CHANGED, aAppendToUndo );
|
||||
frame->SaveCopyInUndoList( aScreen, aSymbol, UNDO_REDO::CHANGED, aAppendToUndo );
|
||||
|
||||
if( aNewId != aSymbol->GetLibId() )
|
||||
aSymbol->SetLibId( aNewId );
|
||||
|
|
|
@ -306,7 +306,7 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow()
|
|||
return false;
|
||||
}
|
||||
|
||||
m_Parent->SaveCopyInUndoList( m_libEntry, UR_LIB_RENAME );
|
||||
m_Parent->SaveCopyInUndoList( m_libEntry, UNDO_REDO::LIB_RENAME );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -411,7 +411,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
|
|||
|
||||
// save old cmp in undo list if not already in edit, or moving ...
|
||||
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
|
||||
STATUS_FLAGS flags = m_cmp->GetFlags();
|
||||
|
@ -530,7 +530,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
|
|||
|
||||
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( FOOTPRINT )->SetText( m_fields->at( FOOTPRINT ).GetText() );
|
||||
otherUnit->GetField( DATASHEET )->SetText( m_fields->at( DATASHEET ).GetText() );
|
||||
|
|
|
@ -747,7 +747,7 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow()
|
|||
if( symbol == nullptr )
|
||||
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 = true;
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
|
|||
|
||||
/* save old text in undo list if not already in edit */
|
||||
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();
|
||||
|
||||
|
|
|
@ -144,9 +144,9 @@ bool DIALOG_EDIT_LINE_STYLE::TransferDataFromWindow()
|
|||
STROKE_PARAMS stroke;
|
||||
|
||||
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 )
|
||||
{
|
||||
|
|
|
@ -435,7 +435,7 @@ void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH*
|
|||
|
||||
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 );
|
||||
editFrame->UpdateItem( otherUnit );
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ bool DIALOG_EDIT_SHEET_PIN::TransferDataFromWindow()
|
|||
if( !m_sheetPin->IsNew() )
|
||||
{
|
||||
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 ) );
|
||||
|
|
|
@ -602,7 +602,7 @@ public:
|
|||
SCH_COMPONENT& comp = *m_componentRefs[i].GetComp();
|
||||
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];
|
||||
|
||||
|
|
|
@ -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 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 )
|
||||
{
|
||||
|
|
|
@ -96,9 +96,9 @@ bool DIALOG_JUNCTION_PROPS::TransferDataFromWindow()
|
|||
PICKED_ITEMS_LIST pickedItems;
|
||||
|
||||
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 )
|
||||
{
|
||||
|
|
|
@ -473,7 +473,7 @@ bool DIALOG_SCH_SHEET_PROPS::onSheetFilenameChanged( const wxString& aNewFilenam
|
|||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
|
|
|
@ -91,9 +91,9 @@ bool DIALOG_UPDATE_FIELDS::TransferDataFromWindow()
|
|||
PICKED_ITEMS_LIST itemsList;
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ void SCH_EDIT_FRAME::SelectUnit( SCH_COMPONENT* aComponent, int aUnit )
|
|||
STATUS_FLAGS savedFlags = aComponent->GetFlags();
|
||||
|
||||
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. */
|
||||
aComponent->SetUnitSelection( &GetCurrentSheet(), aUnit );
|
||||
|
|
|
@ -340,7 +340,7 @@ public:
|
|||
* 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.
|
||||
*/
|
||||
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 );
|
||||
|
||||
void GetComponentFromUndoList();
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <tools/ee_actions.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" );
|
||||
|
||||
|
@ -74,7 +74,7 @@ void LIB_EDIT_FRAME::GetComponentFromRedoList()
|
|||
LIB_PART* part = (LIB_PART*) redoWrapper.GetItem();
|
||||
wxCHECK( part, /* void */ );
|
||||
part->ClearFlags( UR_TRANSIENT );
|
||||
UNDO_REDO_T undoRedoType = redoWrapper.GetStatus();
|
||||
UNDO_REDO undoRedoType = redoWrapper.GetStatus();
|
||||
|
||||
// Store the current part in the undo buffer
|
||||
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
|
||||
m_my_part = part;
|
||||
|
||||
if( undoRedoType == UR_LIB_RENAME )
|
||||
if( undoRedoType == UNDO_REDO::LIB_RENAME )
|
||||
{
|
||||
wxString lib = GetCurLib();
|
||||
m_libMgr->UpdatePartAfterRename( part, oldPart->GetName(), lib );
|
||||
|
@ -122,7 +122,7 @@ void LIB_EDIT_FRAME::GetComponentFromUndoList()
|
|||
LIB_PART* part = (LIB_PART*) undoWrapper.GetItem();
|
||||
wxCHECK( part, /* void */ );
|
||||
part->ClearFlags( UR_TRANSIENT );
|
||||
UNDO_REDO_T undoRedoType = undoWrapper.GetStatus();
|
||||
UNDO_REDO undoRedoType = undoWrapper.GetStatus();
|
||||
|
||||
// Store the current part in the redo buffer
|
||||
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
|
||||
m_my_part = part;
|
||||
|
||||
if( undoRedoType == UR_LIB_RENAME )
|
||||
if( undoRedoType == UNDO_REDO::LIB_RENAME )
|
||||
{
|
||||
wxString lib = GetCurLib();
|
||||
m_libMgr->UpdatePartAfterRename( part, oldPart->GetName(), lib );
|
||||
|
|
|
@ -1043,7 +1043,7 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM*
|
|||
if( aItem->Type() == SCH_SHEET_PIN_T )
|
||||
{
|
||||
// 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 );
|
||||
}
|
||||
|
@ -1059,7 +1059,7 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM*
|
|||
AddToScreen( aItem, aScreen );
|
||||
|
||||
SaveCopyForRepeatItem( aItem );
|
||||
SaveCopyInUndoList( aScreen, undoItem, UR_NEW, aUndoAppend );
|
||||
SaveCopyInUndoList( aScreen, undoItem, UNDO_REDO::NEWITEM, aUndoAppend );
|
||||
}
|
||||
|
||||
// Update connectivity info for new item
|
||||
|
|
|
@ -800,14 +800,14 @@ public:
|
|||
* Create a copy of the current schematic item, and put it in the undo list.
|
||||
*
|
||||
* aTypeCommand =
|
||||
* UR_CHANGED
|
||||
* UR_NEW
|
||||
* UR_DELETED
|
||||
* CHANGED
|
||||
* NEWITEM
|
||||
* DELETED
|
||||
* UR_WIRE_IMAGE
|
||||
* UR_MOVED
|
||||
* MOVED
|
||||
*
|
||||
* If it is a delete command, items are put on list with the .Flags member
|
||||
* set to UR_DELETED.
|
||||
* set to DELETED.
|
||||
*
|
||||
* @note
|
||||
* Edit wires and buses is a bit complex.
|
||||
|
@ -816,13 +816,13 @@ public:
|
|||
* schebang.
|
||||
*
|
||||
* @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 aTransformPoint = the reference point of the transformation for commands like move
|
||||
*/
|
||||
void SaveCopyInUndoList( SCH_SCREEN* aScreen,
|
||||
SCH_ITEM* aItemToCopy,
|
||||
UNDO_REDO_T aTypeCommand,
|
||||
UNDO_REDO aTypeCommand,
|
||||
bool aAppend,
|
||||
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
|
||||
|
||||
|
@ -830,12 +830,12 @@ public:
|
|||
* Create a new entry in undo list of commands.
|
||||
*
|
||||
* @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 aTransformPoint = the reference point of the transformation for commands like move
|
||||
*/
|
||||
void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
||||
UNDO_REDO_T aTypeCommand,
|
||||
UNDO_REDO aTypeCommand,
|
||||
bool aAppend,
|
||||
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
|
||||
void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_SCREEN* aScreen,
|
||||
SCH_ITEM* aItem,
|
||||
UNDO_REDO_T aCommandType,
|
||||
UNDO_REDO aCommandType,
|
||||
bool aAppend,
|
||||
const wxPoint& aTransformPoint )
|
||||
{
|
||||
|
@ -122,15 +122,15 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_SCREEN* aScreen,
|
|||
|
||||
switch( aCommandType )
|
||||
{
|
||||
case UR_CHANGED: /* Create a copy of item */
|
||||
case UNDO_REDO::CHANGED: /* Create a copy of item */
|
||||
itemWrapper.SetLink( aItem->Duplicate( true ) );
|
||||
commandToUndo->PushItem( itemWrapper );
|
||||
break;
|
||||
|
||||
case UR_NEW:
|
||||
case UR_DELETED:
|
||||
case UR_ROTATED:
|
||||
case UR_MOVED:
|
||||
case UNDO_REDO::NEWITEM:
|
||||
case UNDO_REDO::DELETED:
|
||||
case UNDO_REDO::ROTATED:
|
||||
case UNDO_REDO::MOVED:
|
||||
commandToUndo->PushItem( itemWrapper );
|
||||
break;
|
||||
|
||||
|
@ -156,7 +156,7 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_SCREEN* aScreen,
|
|||
|
||||
|
||||
void SCH_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
||||
UNDO_REDO_T aTypeCommand,
|
||||
UNDO_REDO aTypeCommand,
|
||||
bool aAppend,
|
||||
const wxPoint& aTransformPoint )
|
||||
{
|
||||
|
@ -198,9 +198,9 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
|||
// Connectivity may change
|
||||
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;
|
||||
commandToUndo->SetPickedItemStatus( command, ii );
|
||||
|
@ -208,7 +208,7 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
|||
|
||||
switch( command )
|
||||
{
|
||||
case UR_CHANGED:
|
||||
case UNDO_REDO::CHANGED:
|
||||
|
||||
/* If needed, create a copy of item, and put in undo list
|
||||
* in the picker, as link
|
||||
|
@ -220,14 +220,14 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
|||
wxASSERT( commandToUndo->GetPickedItemLink( ii ) );
|
||||
break;
|
||||
|
||||
case UR_MOVED:
|
||||
case UR_MIRRORED_Y:
|
||||
case UR_MIRRORED_X:
|
||||
case UR_ROTATED:
|
||||
case UR_NEW:
|
||||
case UR_DELETED:
|
||||
case UR_EXCHANGE_T:
|
||||
case UR_PAGESETTINGS:
|
||||
case UNDO_REDO::MOVED:
|
||||
case UNDO_REDO::MIRRORED_Y:
|
||||
case UNDO_REDO::MIRRORED_X:
|
||||
case UNDO_REDO::ROTATED:
|
||||
case UNDO_REDO::NEWITEM:
|
||||
case UNDO_REDO::DELETED:
|
||||
case UNDO_REDO::EXCHANGE_T:
|
||||
case UNDO_REDO::PAGESETTINGS:
|
||||
break;
|
||||
|
||||
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).
|
||||
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->SetFlags( aList->GetPickerFlags( (unsigned) ii ) );
|
||||
eda_item->ClearEditFlags();
|
||||
eda_item->ClearTempFlags();
|
||||
|
||||
if( status == UR_NEW )
|
||||
if( status == UNDO_REDO::NEWITEM )
|
||||
{
|
||||
// new items are deleted on undo
|
||||
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
|
||||
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
|
||||
WS_PROXY_UNDO_ITEM alt_item( this );
|
||||
|
@ -295,23 +295,23 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
|
|||
|
||||
switch( status )
|
||||
{
|
||||
case UR_CHANGED:
|
||||
case UNDO_REDO::CHANGED:
|
||||
item->SwapData( alt_item );
|
||||
break;
|
||||
|
||||
case UR_MOVED:
|
||||
case UNDO_REDO::MOVED:
|
||||
item->Move( aRedoCommand ? aList->m_TransformPoint : -aList->m_TransformPoint );
|
||||
break;
|
||||
|
||||
case UR_MIRRORED_Y:
|
||||
case UNDO_REDO::MIRRORED_Y:
|
||||
item->MirrorY( aList->m_TransformPoint.x );
|
||||
break;
|
||||
|
||||
case UR_MIRRORED_X:
|
||||
case UNDO_REDO::MIRRORED_X:
|
||||
item->MirrorX( aList->m_TransformPoint.y );
|
||||
break;
|
||||
|
||||
case UR_ROTATED:
|
||||
case UNDO_REDO::ROTATED:
|
||||
if( aRedoCommand )
|
||||
item->Rotate( aList->m_TransformPoint );
|
||||
else
|
||||
|
@ -323,7 +323,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
|
|||
}
|
||||
break;
|
||||
|
||||
case UR_EXCHANGE_T:
|
||||
case UNDO_REDO::EXCHANGE_T:
|
||||
aList->SetPickedItem( alt_item, (unsigned) ii );
|
||||
aList->SetPickedItemLink( item, (unsigned) ii );
|
||||
item = alt_item;
|
||||
|
|
|
@ -402,7 +402,7 @@ void BACK_ANNOTATE::applyChangelist()
|
|||
|
||||
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;
|
||||
comp->SetRef( &ref.GetSheetPath(), module.m_ref );
|
||||
}
|
||||
|
@ -420,7 +420,7 @@ void BACK_ANNOTATE::applyChangelist()
|
|||
|
||||
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;
|
||||
ref.GetComp()->GetField( FOOTPRINT )->SetText( module.m_footprint );
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ void BACK_ANNOTATE::applyChangelist()
|
|||
|
||||
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;
|
||||
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 )
|
||||
{
|
||||
m_frame->SaveCopyInUndoList( aScreen, label, UR_CHANGED, m_appendUndo );
|
||||
m_frame->SaveCopyInUndoList( aScreen, label, UNDO_REDO::CHANGED, m_appendUndo );
|
||||
m_appendUndo = true;
|
||||
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 )
|
||||
{
|
||||
m_frame->SaveCopyInUndoList( screen, label, UR_CHANGED, m_appendUndo );
|
||||
m_frame->SaveCopyInUndoList( screen, label, UNDO_REDO::CHANGED, m_appendUndo );
|
||||
m_appendUndo = true;
|
||||
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 )
|
||||
{
|
||||
m_frame->SaveCopyInUndoList( screen, pin, UR_CHANGED, m_appendUndo );
|
||||
m_frame->SaveCopyInUndoList( screen, pin, UNDO_REDO::CHANGED, m_appendUndo );
|
||||
m_appendUndo = true;
|
||||
static_cast<SCH_TEXT*>( pin )->SetText( aNewName );
|
||||
}
|
||||
|
@ -645,7 +645,7 @@ void BACK_ANNOTATE::processNetNameChange( SCH_CONNECTION* aConn, const wxString&
|
|||
if( !m_dryRun )
|
||||
{
|
||||
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;
|
||||
static_cast<SCH_TEXT*>( driver )->SetText( aNewName );
|
||||
|
||||
|
|
|
@ -868,23 +868,23 @@ void EE_POINT_EDITOR::saveItemsToUndo()
|
|||
{
|
||||
if( m_isLibEdit )
|
||||
{
|
||||
saveCopyInUndoList( m_editPoints->GetParent()->GetParent(), UR_LIBEDIT );
|
||||
saveCopyInUndoList( m_editPoints->GetParent()->GetParent(), UNDO_REDO::LIBEDIT );
|
||||
}
|
||||
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 )
|
||||
{
|
||||
EDA_ITEM* connection = m_editPoints->Point( LINE_START ).GetConnection();
|
||||
|
||||
if( connection )
|
||||
saveCopyInUndoList( (SCH_ITEM*) connection, UR_CHANGED, true );
|
||||
saveCopyInUndoList( (SCH_ITEM*) connection, UNDO_REDO::CHANGED, true );
|
||||
|
||||
connection = m_editPoints->Point( LINE_END ).GetConnection();
|
||||
|
||||
if( connection )
|
||||
saveCopyInUndoList( (SCH_ITEM*) connection, UR_CHANGED, true );
|
||||
saveCopyInUndoList( (SCH_ITEM*) connection, UNDO_REDO::CHANGED, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ protected:
|
|||
|
||||
///> Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their
|
||||
///> 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();
|
||||
bool selected = aItem->IsSelected();
|
||||
|
@ -140,7 +140,7 @@ protected:
|
|||
{
|
||||
editFrame->SaveCopyInUndoList( editFrame->GetScreen(),
|
||||
static_cast<SCH_ITEM*>( aItem->GetParent() ),
|
||||
UR_CHANGED, aAppend );
|
||||
UNDO_REDO::CHANGED, aAppend );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -139,7 +139,7 @@ int LIB_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
LIB_ITEM* item = static_cast<LIB_ITEM*>( selection.Front() );
|
||||
|
||||
if( !item->IsMoving() )
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UR_LIBEDIT );
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UNDO_REDO::LIBEDIT );
|
||||
|
||||
if( selection.GetSize() == 1 )
|
||||
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() );
|
||||
|
||||
if( !item->IsMoving() )
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UR_LIBEDIT );
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UNDO_REDO::LIBEDIT );
|
||||
|
||||
if( selection.GetSize() == 1 )
|
||||
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
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
saveCopyInUndoList( part, UR_LIBEDIT );
|
||||
saveCopyInUndoList( part, UNDO_REDO::LIBEDIT );
|
||||
|
||||
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)
|
||||
if( item->GetEditFlags() == 0 )
|
||||
saveCopyInUndoList( item->GetParent(), UR_LIBEDIT );
|
||||
saveCopyInUndoList( item->GetParent(), UNDO_REDO::LIBEDIT );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
|
@ -508,9 +508,9 @@ void LIB_EDIT_TOOL::editFieldProperties( LIB_FIELD* aField )
|
|||
bool renamed = aField->GetId() == VALUE && newFieldValue != oldFieldValue;
|
||||
|
||||
if( renamed )
|
||||
saveCopyInUndoList( parent, UR_LIB_RENAME );
|
||||
saveCopyInUndoList( parent, UNDO_REDO::LIB_RENAME );
|
||||
else
|
||||
saveCopyInUndoList( parent, UR_LIBEDIT );
|
||||
saveCopyInUndoList( parent, UNDO_REDO::LIBEDIT );
|
||||
|
||||
dlg.UpdateField( aField );
|
||||
|
||||
|
@ -575,7 +575,7 @@ int LIB_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent )
|
|||
|
||||
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 );
|
||||
|
||||
|
@ -737,7 +737,7 @@ int LIB_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
|
||||
if( !selection.Front()->IsMoving() )
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UR_LIBEDIT );
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UNDO_REDO::LIBEDIT );
|
||||
|
||||
EDA_ITEMS newItems;
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
VECTOR2I prevPos;
|
||||
|
||||
if( !selection.Front()->IsNew() )
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UR_LIBEDIT );
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UNDO_REDO::LIBEDIT );
|
||||
|
||||
m_cursor = controls->GetCursorPosition();
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ int LIB_PIN_TOOL::PushPinProperties( const TOOL_EVENT& aEvent )
|
|||
if( !sourcePin )
|
||||
return 0;
|
||||
|
||||
saveCopyInUndoList( part, UR_LIBEDIT );
|
||||
saveCopyInUndoList( part, UNDO_REDO::LIBEDIT );
|
||||
|
||||
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
|
||||
{
|
||||
|
|
|
@ -426,7 +426,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
if( selection.GetSize() == 1 )
|
||||
{
|
||||
if( !moving )
|
||||
saveCopyInUndoList( item, UR_CHANGED );
|
||||
saveCopyInUndoList( item, UNDO_REDO::CHANGED );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
|
@ -533,7 +533,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
|
||||
|
||||
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 )
|
||||
{
|
||||
|
@ -610,7 +610,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
|||
if( selection.GetSize() == 1 )
|
||||
{
|
||||
if( !moving )
|
||||
saveCopyInUndoList( item, UR_CHANGED );
|
||||
saveCopyInUndoList( item, UNDO_REDO::CHANGED );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
|
@ -717,7 +717,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
|||
item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
|
||||
|
||||
if( !moving )
|
||||
saveCopyInUndoList( item, UR_CHANGED, ii > 0 );
|
||||
saveCopyInUndoList( item, UNDO_REDO::CHANGED, ii > 0 );
|
||||
|
||||
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();
|
||||
newItem->SetFlags( IS_NEW );
|
||||
newItems.push_back( newItem );
|
||||
saveCopyInUndoList( newItem, UR_NEW, ii > 0 );
|
||||
saveCopyInUndoList( newItem, UNDO_REDO::NEWITEM, ii > 0 );
|
||||
|
||||
switch( newItem->Type() )
|
||||
{
|
||||
|
@ -933,7 +933,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
|
|||
|
||||
newItem->SetFlags( IS_NEW );
|
||||
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 );
|
||||
|
||||
|
@ -1011,7 +1011,7 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
else
|
||||
{
|
||||
sch_item->SetFlags( STRUCT_DELETED );
|
||||
saveCopyInUndoList( item, UR_DELETED, appendToUndo );
|
||||
saveCopyInUndoList( item, UNDO_REDO::DELETED, appendToUndo );
|
||||
appendToUndo = true;
|
||||
|
||||
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.
|
||||
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() );
|
||||
|
||||
|
@ -1218,7 +1218,7 @@ int SCH_EDIT_TOOL::AutoplaceFields( const TOOL_EVENT& aEvent )
|
|||
SCH_COMPONENT* component = (SCH_COMPONENT*) selection.Front();
|
||||
|
||||
if( !component->IsNew() )
|
||||
saveCopyInUndoList( component, UR_CHANGED );
|
||||
saveCopyInUndoList( component, UNDO_REDO::CHANGED );
|
||||
|
||||
component->AutoplaceFields( m_frame->GetScreen(), /* aManual */ true );
|
||||
|
||||
|
@ -1282,7 +1282,7 @@ int SCH_EDIT_TOOL::ConvertDeMorgan( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
|
||||
if( !component->IsNew() )
|
||||
saveCopyInUndoList( component, UR_CHANGED );
|
||||
saveCopyInUndoList( component, UNDO_REDO::CHANGED );
|
||||
|
||||
m_frame->ConvertPart( component );
|
||||
|
||||
|
@ -1327,7 +1327,7 @@ int SCH_EDIT_TOOL::RefreshSymbolFromLibrary( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( !symbol->IsNew() )
|
||||
{
|
||||
saveCopyInUndoList( symbol, UR_CHANGED, appendToUndo );
|
||||
saveCopyInUndoList( symbol, UNDO_REDO::CHANGED, appendToUndo );
|
||||
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
|
||||
if( bitmap->GetEditFlags() == 0 )
|
||||
saveCopyInUndoList( bitmap, UR_CHANGED );
|
||||
saveCopyInUndoList( bitmap, UNDO_REDO::CHANGED );
|
||||
|
||||
dlg.TransferToImage( bitmap->GetImage() );
|
||||
|
||||
|
@ -1650,8 +1650,8 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( !text->IsNew() )
|
||||
{
|
||||
saveCopyInUndoList( text, UR_DELETED );
|
||||
saveCopyInUndoList( newtext, UR_NEW, true );
|
||||
saveCopyInUndoList( text, UNDO_REDO::DELETED );
|
||||
saveCopyInUndoList( newtext, UNDO_REDO::NEWITEM, true );
|
||||
|
||||
m_frame->RemoveFromScreen( text, 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?" ) ) )
|
||||
return 0;
|
||||
|
||||
saveCopyInUndoList( sheet, UR_CHANGED );
|
||||
saveCopyInUndoList( sheet, UNDO_REDO::CHANGED );
|
||||
|
||||
sheet->CleanupSheet();
|
||||
|
||||
|
|
|
@ -100,10 +100,10 @@ int SCH_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
PICKED_ITEMS_LIST undoCmd;
|
||||
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 );
|
||||
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 ) );
|
||||
dlg.SetWksFileName( BASE_SCREEN::m_PageLayoutDescrFileName );
|
||||
|
|
|
@ -834,15 +834,15 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
|
|||
if( IsPointOnSegment( wire->GetStartPoint(), wire->GetEndPoint(), 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 )
|
||||
{
|
||||
wxASSERT( m_busUnfold.entry && m_busUnfold.label );
|
||||
|
||||
itemList.PushItem( ITEM_PICKER( screen, m_busUnfold.entry, UR_NEW ) );
|
||||
itemList.PushItem( ITEM_PICKER( screen, m_busUnfold.label, UR_NEW ) );
|
||||
itemList.PushItem( ITEM_PICKER( screen, m_busUnfold.entry, UNDO_REDO::NEWITEM ) );
|
||||
itemList.PushItem( ITEM_PICKER( screen, m_busUnfold.label, UNDO_REDO::NEWITEM ) );
|
||||
m_busUnfold.label->ClearEditFlags();
|
||||
}
|
||||
|
||||
|
@ -864,7 +864,7 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
|
|||
getViewControls()->CaptureCursor( 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.
|
||||
m_frame->SchematicCleanUp();
|
||||
|
|
|
@ -243,7 +243,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
if( item->HasFlag( TEMP_SELECTED ) && m_isDragOperation )
|
||||
{
|
||||
// Item was added in getConnectedDragItems
|
||||
saveCopyInUndoList( (SCH_ITEM*) item, UR_NEW, appendUndo );
|
||||
saveCopyInUndoList( (SCH_ITEM*) item, UNDO_REDO::NEWITEM, appendUndo );
|
||||
appendUndo = true;
|
||||
}
|
||||
else
|
||||
|
@ -258,7 +258,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
saveCopyInUndoList( (SCH_ITEM*) item, UR_CHANGED, appendUndo );
|
||||
saveCopyInUndoList( (SCH_ITEM*) item, UNDO_REDO::CHANGED, appendUndo );
|
||||
appendUndo = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -536,7 +536,7 @@ public:
|
|||
* currently: do nothing in GerbView.
|
||||
*/
|
||||
void SaveCopyInUndoList( GERBER_DRAW_ITEM* aItemToCopy,
|
||||
UNDO_REDO_T aTypeCommand = UR_UNSPECIFIED,
|
||||
UNDO_REDO aTypeCommand = UNDO_REDO::UNSPECIFIED,
|
||||
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) { }
|
||||
|
||||
/**
|
||||
|
@ -544,12 +544,12 @@ public:
|
|||
* Creates a new entry in undo list of commands.
|
||||
* add a list of pickers to handle a list of items
|
||||
* @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,
|
||||
* for commands like move
|
||||
*/
|
||||
void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
|
||||
UNDO_REDO_T aTypeCommand,
|
||||
UNDO_REDO aTypeCommand,
|
||||
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
|
||||
{
|
||||
// currently: do nothing in GerbView.
|
||||
|
|
|
@ -127,7 +127,7 @@ public:
|
|||
|
||||
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.
|
||||
virtual void Push( const wxString& aMessage = wxT( "A commit" ),
|
||||
|
@ -176,7 +176,7 @@ protected:
|
|||
|
||||
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::vector<COMMIT_LINE> m_changes;
|
||||
|
|
|
@ -336,11 +336,11 @@ public:
|
|||
* Creates a new entry in undo list of commands.
|
||||
* add a picker to handle aItemToCopy
|
||||
* @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
|
||||
* 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;
|
||||
|
||||
/**
|
||||
|
@ -348,11 +348,11 @@ public:
|
|||
* Creates a new entry in undo list of commands.
|
||||
* add a list of pickers to handle a list of items
|
||||
* @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,
|
||||
* 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;
|
||||
|
||||
|
||||
|
|
|
@ -50,26 +50,26 @@ class BASE_SCREEN;
|
|||
/* Type of undo/redo operations
|
||||
* each type must be redo/undone by a specific operation
|
||||
*/
|
||||
enum UNDO_REDO_T {
|
||||
UR_UNSPECIFIED = 0, // illegal
|
||||
UR_CHANGED, // params of items have a value changed: undo is made by exchange
|
||||
// values with a copy of these values
|
||||
UR_NEW, // new item, undo by changing in deleted
|
||||
UR_DELETED, // deleted item, undo by changing in deleted
|
||||
UR_MOVED, // moved item, undo by move it
|
||||
UR_MIRRORED_X, // mirrored item, undo by mirror X
|
||||
UR_MIRRORED_Y, // mirrored item, undo by mirror Y
|
||||
UR_ROTATED, // Rotated item (counterclockwise), undo by rotating it
|
||||
UR_ROTATED_CLOCKWISE, // Rotated item (clockwise), undo by rotating it
|
||||
UR_FLIPPED, // flipped (board items only), undo by flipping it
|
||||
UR_LIBEDIT, // Specific to the component editor (libedit creates a full copy
|
||||
// of the current component when changed)
|
||||
UR_LIB_RENAME, // As UR_LIBEDIT, but old copy should be removed from library
|
||||
UR_EXCHANGE_T, // Use for changing the schematic text type where swapping
|
||||
// data structure is insufficient to restore the change.
|
||||
UR_DRILLORIGIN, // origin changed (like UR_CHANGED, contains the origin and a copy)
|
||||
UR_GRIDORIGIN, // origin changed (like UR_CHANGED, contains the origin and a copy)
|
||||
UR_PAGESETTINGS // page settings or title block changes
|
||||
enum class UNDO_REDO {
|
||||
UNSPECIFIED = 0, // illegal
|
||||
CHANGED, // params of items have a value changed: undo is made by exchange
|
||||
// values with a copy of these values
|
||||
NEWITEM, // new item, undo by changing in deleted
|
||||
DELETED, // deleted item, undo by changing in deleted
|
||||
MOVED, // moved item, undo by move it
|
||||
MIRRORED_X, // mirrored item, undo by mirror X
|
||||
MIRRORED_Y, // mirrored item, undo by mirror Y
|
||||
ROTATED, // Rotated item (counterclockwise), undo by rotating it
|
||||
ROTATED_CLOCKWISE, // Rotated item (clockwise), undo by rotating it
|
||||
FLIPPED, // flipped (board items only), undo by flipping it
|
||||
LIBEDIT, // Specific to the component editor (libedit creates a full copy
|
||||
// of the current component when changed)
|
||||
LIB_RENAME, // As LIBEDIT, but old copy should be removed from library
|
||||
EXCHANGE_T, // Use for changing the schematic text type where swapping
|
||||
// data structure is insufficient to restore the change.
|
||||
DRILLORIGIN, // origin changed (like CHANGED, contains the origin and a copy)
|
||||
GRIDORIGIN, // origin changed (like CHANGED, contains the origin and a copy)
|
||||
PAGESETTINGS // page settings or title block changes
|
||||
};
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@ class ITEM_PICKER
|
|||
private:
|
||||
STATUS_FLAGS m_pickerFlags; /* a copy of m_Flags member. useful in mode/drag
|
||||
* 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
|
||||
* (picked), or in undo redo commands, the copy of an
|
||||
* edited item. */
|
||||
|
@ -95,9 +95,9 @@ private:
|
|||
* be added to/removed from. */
|
||||
|
||||
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( 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; }
|
||||
|
||||
|
@ -109,9 +109,9 @@ public:
|
|||
|
||||
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; }
|
||||
|
||||
|
@ -133,8 +133,8 @@ public:
|
|||
class PICKED_ITEMS_LIST
|
||||
{
|
||||
public:
|
||||
UNDO_REDO_T m_Status; /* info about operation to undo/redo for this item. can be
|
||||
* UR_UNSPECIFIED */
|
||||
UNDO_REDO m_Status; /* info about operation to undo/redo for this item. can be
|
||||
* UNSPECIFIED */
|
||||
wxPoint m_TransformPoint; /* used to undo redo command by the same command: usually
|
||||
* need to know the rotate point or the move vector */
|
||||
|
||||
|
@ -236,10 +236,10 @@ public:
|
|||
/**
|
||||
* Function GetPickedItemStatus
|
||||
* @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
|
||||
*/
|
||||
UNDO_REDO_T GetPickedItemStatus( unsigned int aIdx ) const;
|
||||
UNDO_REDO GetPickedItemStatus( unsigned int aIdx ) const;
|
||||
|
||||
/**
|
||||
* Function GetPickerFlags
|
||||
|
@ -264,7 +264,7 @@ public:
|
|||
* @param aIdx Index of the picker in the picked list
|
||||
* @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
|
||||
|
@ -282,7 +282,7 @@ public:
|
|||
* @param aIdx Index of the picker in the picked list
|
||||
* @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
|
||||
|
|
|
@ -36,7 +36,7 @@ void PL_EDITOR_FRAME::SaveCopyInUndoList()
|
|||
{
|
||||
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
|
||||
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 );
|
||||
PushCommandToUndoList( lastcmd );
|
||||
|
|
|
@ -76,7 +76,7 @@ COMMIT& BOARD_COMMIT::Stage( std::vector<EDA_ITEM*>& container, CHANGE_TYPE aCha
|
|||
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 );
|
||||
}
|
||||
|
@ -123,10 +123,10 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
|
||||
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 );
|
||||
undoList.PushItem( itemWrapper );
|
||||
frame->SaveCopyInUndoList( undoList, UR_CHANGED );
|
||||
frame->SaveCopyInUndoList( undoList, UNDO_REDO::CHANGED );
|
||||
}
|
||||
|
||||
savedModules.insert( ent.m_item );
|
||||
|
@ -158,7 +158,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
else
|
||||
{
|
||||
if( aCreateUndoEntry )
|
||||
undoList.PushItem( ITEM_PICKER( nullptr, boardItem, UR_NEW ) );
|
||||
undoList.PushItem( ITEM_PICKER( nullptr, boardItem, UNDO_REDO::NEWITEM ) );
|
||||
|
||||
if( !( changeFlags & CHT_DONE ) )
|
||||
board->Add( boardItem ); // handles connectivity
|
||||
|
@ -173,7 +173,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
case CHT_REMOVE:
|
||||
{
|
||||
if( !m_editModules && aCreateUndoEntry )
|
||||
undoList.PushItem( ITEM_PICKER( nullptr, boardItem, UR_DELETED ) );
|
||||
undoList.PushItem( ITEM_PICKER( nullptr, boardItem, UNDO_REDO::DELETED ) );
|
||||
|
||||
if( boardItem->IsSelected() )
|
||||
{
|
||||
|
@ -261,7 +261,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
{
|
||||
if( !m_editModules && aCreateUndoEntry )
|
||||
{
|
||||
ITEM_PICKER itemWrapper( nullptr, boardItem, UR_CHANGED );
|
||||
ITEM_PICKER itemWrapper( nullptr, boardItem, UNDO_REDO::CHANGED );
|
||||
wxASSERT( ent.m_copy );
|
||||
itemWrapper.SetLink( ent.m_copy );
|
||||
undoList.PushItem( itemWrapper );
|
||||
|
@ -308,7 +308,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
|
||||
if( aCreateUndoEntry )
|
||||
{
|
||||
ITEM_PICKER itemWrapper( nullptr, boardItem, UR_CHANGED );
|
||||
ITEM_PICKER itemWrapper( nullptr, boardItem, UNDO_REDO::CHANGED );
|
||||
wxASSERT( ent.m_copy );
|
||||
itemWrapper.SetLink( ent.m_copy );
|
||||
undoList.PushItem( itemWrapper );
|
||||
|
@ -324,7 +324,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
}
|
||||
|
||||
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 } );
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
COMMIT& Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType ) override;
|
||||
COMMIT& Stage( std::vector<EDA_ITEM*>& container, CHANGE_TYPE aChangeType ) override;
|
||||
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.
|
||||
|
|
|
@ -1713,7 +1713,7 @@ ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode,
|
|||
|
||||
if( aNewZonesList )
|
||||
{
|
||||
ITEM_PICKER picker( nullptr, new_area, UR_NEW );
|
||||
ITEM_PICKER picker( nullptr, new_area, UNDO_REDO::NEWITEM );
|
||||
aNewZonesList->PushItem( picker );
|
||||
}
|
||||
|
||||
|
@ -1728,7 +1728,7 @@ void BOARD::RemoveArea( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_to
|
|||
|
||||
if( aDeletedList )
|
||||
{
|
||||
ITEM_PICKER picker( nullptr, area_to_remove, UR_DELETED );
|
||||
ITEM_PICKER picker( nullptr, area_to_remove, UNDO_REDO::DELETED );
|
||||
aDeletedList->PushItem( picker );
|
||||
Remove( area_to_remove ); // remove from zone list, but does not delete it
|
||||
}
|
||||
|
|
|
@ -305,7 +305,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem( PICKED_ITEMS_LIST* aUndoLi
|
|||
{
|
||||
if( aUndoList->FindItem( aItem ) < 0 )
|
||||
{
|
||||
ITEM_PICKER picker( nullptr, aItem, UR_CHANGED );
|
||||
ITEM_PICKER picker( nullptr, aItem, UNDO_REDO::CHANGED );
|
||||
picker.SetLink( aItem->Clone() );
|
||||
aUndoList->PushItem( picker );
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow()
|
|||
|
||||
if( itemsListPicker.GetCount() > 0 )
|
||||
{
|
||||
m_parent->SaveCopyInUndoList( itemsListPicker, UR_CHANGED );
|
||||
m_parent->SaveCopyInUndoList( itemsListPicker, UNDO_REDO::CHANGED );
|
||||
|
||||
for( auto segment : m_brd->Tracks() )
|
||||
m_parent->GetCanvas()->GetView()->Update( segment );
|
||||
|
|
|
@ -104,7 +104,7 @@ int PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
|
|||
if( aItemsListPicker )
|
||||
{
|
||||
aTrackItem->SetWidth( initial_width );
|
||||
ITEM_PICKER picker( nullptr, aTrackItem, UR_CHANGED );
|
||||
ITEM_PICKER picker( nullptr, aTrackItem, UNDO_REDO::CHANGED );
|
||||
picker.SetLink( aTrackItem->Clone() );
|
||||
aItemsListPicker->PushItem( picker );
|
||||
aTrackItem->SetWidth( new_width );
|
||||
|
|
|
@ -181,8 +181,8 @@ private:
|
|||
* Virtual functions, not used here, but needed by PCB_BASE_FRAME
|
||||
* (virtual pure functions )
|
||||
*/
|
||||
void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO_T, const wxPoint& ) override {}
|
||||
void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint &) override {}
|
||||
void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO, const wxPoint& ) override {}
|
||||
void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO, const wxPoint &) override {}
|
||||
|
||||
void updateView();
|
||||
|
||||
|
|
|
@ -220,8 +220,8 @@ private:
|
|||
* Virtual functions, not used here, but needed by PCB_BASE_FRAME
|
||||
* (virtual pure functions )
|
||||
*/
|
||||
void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO_T, const wxPoint& ) override {}
|
||||
void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint& ) override {}
|
||||
void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO, const wxPoint& ) override {}
|
||||
void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO, const wxPoint& ) override {}
|
||||
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
|
|
@ -471,11 +471,11 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, bool aRecreateRatsnest )
|
|||
|
||||
if( aModule->IsNew() )
|
||||
{
|
||||
SaveCopyInUndoList( aModule, UR_NEW );
|
||||
SaveCopyInUndoList( aModule, UNDO_REDO::NEWITEM );
|
||||
}
|
||||
else if( aModule->IsMoving() )
|
||||
{
|
||||
ITEM_PICKER picker( nullptr, aModule, UR_CHANGED );
|
||||
ITEM_PICKER picker( nullptr, aModule, UNDO_REDO::CHANGED );
|
||||
picker.SetLink( s_ModuleInitialCopy );
|
||||
s_PickedList.PushItem( picker );
|
||||
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() )
|
||||
{
|
||||
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
|
||||
// list and they therefore in use
|
||||
|
|
|
@ -86,11 +86,11 @@ public:
|
|||
* Creates a new entry in undo list of commands.
|
||||
* add a picker to handle aItemToCopy
|
||||
* @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
|
||||
* 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;
|
||||
|
||||
/**
|
||||
|
@ -98,11 +98,11 @@ public:
|
|||
* Creates a new entry in undo list of commands.
|
||||
* add a list of pickers to handle a list of items
|
||||
* @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,
|
||||
* 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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -217,38 +217,38 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
|
|||
BOARD* currentPcb = GetBoard();
|
||||
bool fromEmpty = false;
|
||||
|
||||
itemsList.m_Status = UR_CHANGED;
|
||||
itemsList.m_Status = UNDO_REDO::CHANGED;
|
||||
|
||||
// Append tracks:
|
||||
for( auto item : currentPcb->Tracks() )
|
||||
{
|
||||
ITEM_PICKER picker( nullptr, item, UR_CHANGED );
|
||||
ITEM_PICKER picker( nullptr, item, UNDO_REDO::CHANGED );
|
||||
itemsList.PushItem( picker );
|
||||
}
|
||||
|
||||
// Append modules:
|
||||
for( auto item : currentPcb->Modules() )
|
||||
{
|
||||
ITEM_PICKER picker( nullptr, item, UR_CHANGED );
|
||||
ITEM_PICKER picker( nullptr, item, UNDO_REDO::CHANGED );
|
||||
itemsList.PushItem( picker );
|
||||
}
|
||||
|
||||
// Append drawings
|
||||
for( auto item : currentPcb->Drawings() )
|
||||
{
|
||||
ITEM_PICKER picker( nullptr, item, UR_CHANGED );
|
||||
ITEM_PICKER picker( nullptr, item, UNDO_REDO::CHANGED );
|
||||
itemsList.PushItem( picker );
|
||||
}
|
||||
|
||||
// Append zones outlines
|
||||
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 );
|
||||
}
|
||||
|
||||
if( itemsList.GetCount() > 0 )
|
||||
SaveCopyInUndoList( itemsList, UR_CHANGED, wxPoint( 0.0, 0.0 ) );
|
||||
SaveCopyInUndoList( itemsList, UNDO_REDO::CHANGED, wxPoint( 0.0, 0.0 ) );
|
||||
else
|
||||
fromEmpty = true;
|
||||
|
||||
|
@ -265,7 +265,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
|
|||
if( fromEmpty )
|
||||
{
|
||||
oldBuffer = new PICKED_ITEMS_LIST();
|
||||
oldBuffer->m_Status = UR_NEW;
|
||||
oldBuffer->m_Status = UNDO_REDO::NEWITEM;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -298,7 +298,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
|
|||
for( unsigned int i = 0; i < oldBuffer->GetCount(); 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 );
|
||||
|
||||
|
@ -317,7 +317,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
|
|||
{
|
||||
if( !oldBuffer->ContainsItem( item ) )
|
||||
{
|
||||
ITEM_PICKER picker( nullptr, item, UR_NEW );
|
||||
ITEM_PICKER picker( nullptr, item, UNDO_REDO::NEWITEM );
|
||||
oldBuffer->PushItem( picker );
|
||||
}
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
|
|||
{
|
||||
if( !oldBuffer->ContainsItem( item ) )
|
||||
{
|
||||
ITEM_PICKER picker( nullptr, item, UR_NEW );
|
||||
ITEM_PICKER picker( nullptr, item, UNDO_REDO::NEWITEM );
|
||||
oldBuffer->PushItem( picker );
|
||||
}
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
|
|||
{
|
||||
if( !oldBuffer->ContainsItem( item ) )
|
||||
{
|
||||
ITEM_PICKER picker( nullptr, item, UR_NEW );
|
||||
ITEM_PICKER picker( nullptr, item, UNDO_REDO::NEWITEM );
|
||||
oldBuffer->PushItem( picker );
|
||||
}
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
|
|||
{
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -312,10 +312,10 @@ int PCB_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
PICKED_ITEMS_LIST undoCmd;
|
||||
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 );
|
||||
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,
|
||||
MAX_PAGE_SIZE_PCBNEW_MILS ) );
|
||||
|
@ -1571,7 +1571,7 @@ int PCB_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
|
|||
picker->SetClickHandler(
|
||||
[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 );
|
||||
return false; // drill origin is a one-shot; don't continue with tool
|
||||
} );
|
||||
|
|
|
@ -419,7 +419,7 @@ int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
|
|||
picker->SetClickHandler(
|
||||
[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 );
|
||||
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 )
|
||||
{
|
||||
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 ) );
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ static void SwapItemData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
|
|||
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 )
|
||||
{
|
||||
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,
|
||||
UNDO_REDO_T aTypeCommand,
|
||||
UNDO_REDO aTypeCommand,
|
||||
const wxPoint& aTransformPoint )
|
||||
{
|
||||
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++ )
|
||||
{
|
||||
if( commandToUndo->GetPickedItem( j ) == item
|
||||
&& commandToUndo->GetPickedItemStatus( j ) == UR_CHANGED )
|
||||
&& commandToUndo->GetPickedItemStatus( j ) == UNDO_REDO::CHANGED )
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
|
@ -248,7 +248,7 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
|
|||
clone->Reference().ClearEditFlags();
|
||||
clone->Value().ClearEditFlags();
|
||||
|
||||
ITEM_PICKER picker( nullptr, item, UR_CHANGED );
|
||||
ITEM_PICKER picker( nullptr, item, UNDO_REDO::CHANGED );
|
||||
picker.SetLink( clone );
|
||||
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++ )
|
||||
{
|
||||
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;
|
||||
commandToUndo->SetPickedItemStatus( command, ii );
|
||||
|
@ -281,9 +281,9 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
|
|||
|
||||
switch( command )
|
||||
{
|
||||
case UR_CHANGED:
|
||||
case UR_DRILLORIGIN:
|
||||
case UR_GRIDORIGIN:
|
||||
case UNDO_REDO::CHANGED:
|
||||
case UNDO_REDO::DRILLORIGIN:
|
||||
case UNDO_REDO::GRIDORIGIN:
|
||||
|
||||
/* If needed, create a copy of item, and put in undo list
|
||||
* in the picker, as link
|
||||
|
@ -296,13 +296,13 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
|
|||
}
|
||||
break;
|
||||
|
||||
case UR_MOVED:
|
||||
case UR_ROTATED:
|
||||
case UR_ROTATED_CLOCKWISE:
|
||||
case UR_FLIPPED:
|
||||
case UR_NEW:
|
||||
case UR_DELETED:
|
||||
case UR_PAGESETTINGS:
|
||||
case UNDO_REDO::MOVED:
|
||||
case UNDO_REDO::ROTATED:
|
||||
case UNDO_REDO::ROTATED_CLOCKWISE:
|
||||
case UNDO_REDO::FLIPPED:
|
||||
case UNDO_REDO::NEWITEM:
|
||||
case UNDO_REDO::DELETED:
|
||||
case UNDO_REDO::PAGESETTINGS:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -415,12 +415,12 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
|
|||
* This test avoids a Pcbnew crash
|
||||
* 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
|
||||
&& status != UR_DRILLORIGIN // origin markers never on board
|
||||
&& status != UR_GRIDORIGIN // origin markers never on board
|
||||
&& status != UR_PAGESETTINGS ) // nor are page settings proxy items
|
||||
if( status != UNDO_REDO::DELETED
|
||||
&& status != UNDO_REDO::DRILLORIGIN // origin markers never on board
|
||||
&& status != UNDO_REDO::GRIDORIGIN // origin markers never on board
|
||||
&& status != UNDO_REDO::PAGESETTINGS ) // nor are page settings proxy items
|
||||
{
|
||||
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 ) )
|
||||
{
|
||||
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* image = (BOARD_ITEM*) aList->GetPickedItemLink( ii );
|
||||
|
@ -484,8 +484,8 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
|
|||
}
|
||||
break;
|
||||
|
||||
case UR_NEW: /* new items are deleted */
|
||||
aList->SetPickedItemStatus( UR_DELETED, ii );
|
||||
case UNDO_REDO::NEWITEM: /* new items are deleted */
|
||||
aList->SetPickedItemStatus( UNDO_REDO::DELETED, ii );
|
||||
GetModel()->Remove( (BOARD_ITEM*) eda_item );
|
||||
|
||||
if( eda_item->Type() != PCB_NETINFO_T )
|
||||
|
@ -493,8 +493,8 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
|
|||
|
||||
break;
|
||||
|
||||
case UR_DELETED: /* deleted items are put in List, as new items */
|
||||
aList->SetPickedItemStatus( UR_NEW, ii );
|
||||
case UNDO_REDO::DELETED: /* deleted items are put in List, as new items */
|
||||
aList->SetPickedItemStatus( UNDO_REDO::NEWITEM, ii );
|
||||
GetModel()->Add( (BOARD_ITEM*) eda_item );
|
||||
|
||||
if( eda_item->Type() != PCB_NETINFO_T )
|
||||
|
@ -502,7 +502,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
|
|||
|
||||
break;
|
||||
|
||||
case UR_MOVED:
|
||||
case UNDO_REDO::MOVED:
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) eda_item;
|
||||
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;
|
||||
|
||||
case UR_ROTATED:
|
||||
case UNDO_REDO::ROTATED:
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) eda_item;
|
||||
item->Rotate( aList->m_TransformPoint,
|
||||
|
@ -523,7 +523,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
|
|||
}
|
||||
break;
|
||||
|
||||
case UR_ROTATED_CLOCKWISE:
|
||||
case UNDO_REDO::ROTATED_CLOCKWISE:
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) eda_item;
|
||||
item->Rotate( aList->m_TransformPoint,
|
||||
|
@ -534,7 +534,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
|
|||
}
|
||||
break;
|
||||
|
||||
case UR_FLIPPED:
|
||||
case UNDO_REDO::FLIPPED:
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) eda_item;
|
||||
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;
|
||||
|
||||
case UR_DRILLORIGIN:
|
||||
case UR_GRIDORIGIN:
|
||||
case UNDO_REDO::DRILLORIGIN:
|
||||
case UNDO_REDO::GRIDORIGIN:
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) eda_item;
|
||||
BOARD_ITEM* image = (BOARD_ITEM*) aList->GetPickedItemLink( ii );
|
||||
VECTOR2D origin = image->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 );
|
||||
else
|
||||
PCBNEW_CONTROL::DoSetGridOrigin( view, this, item, origin );
|
||||
}
|
||||
break;
|
||||
|
||||
case UR_PAGESETTINGS:
|
||||
case UNDO_REDO::PAGESETTINGS:
|
||||
{
|
||||
// swap current settings with stored settings
|
||||
WS_PROXY_UNDO_ITEM alt_item( this );
|
||||
|
|
|
@ -136,7 +136,7 @@ bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare )
|
|||
* Function SaveCopyOfZones
|
||||
* creates a copy of zones having a given netcode on a given layer,
|
||||
* 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
|
||||
* @param aPickList = the pick list
|
||||
* @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 );
|
||||
zoneDup->SetParent( aPcb );
|
||||
ITEM_PICKER picker( nullptr, zone, UR_CHANGED );
|
||||
ITEM_PICKER picker( nullptr, zone, UNDO_REDO::CHANGED );
|
||||
picker.SetLink( zoneDup );
|
||||
aPickList.PushItem( picker );
|
||||
copyCount++;
|
||||
|
@ -176,7 +176,7 @@ int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, LA
|
|||
/**
|
||||
* Function UpdateCopyOfZonesList
|
||||
* 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.
|
||||
* @param aPickList = the main pick list
|
||||
* @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.
|
||||
* >> 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:
|
||||
* its status becomes UR_DELETED
|
||||
* its status becomes DELETED
|
||||
* 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):
|
||||
* the picker is removed
|
||||
* the zone itself if really deleted
|
||||
* the aAuxiliaryList corresponding picker is removed (if not found : set an error)
|
||||
* 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,
|
||||
* 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,
|
||||
* when creating self intersecting contours, and after combined with an existing zone.
|
||||
* 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++ )
|
||||
{
|
||||
UNDO_REDO_T status = aPickList.GetPickedItemStatus( kk );
|
||||
UNDO_REDO status = aPickList.GetPickedItemStatus( kk );
|
||||
|
||||
ZONE_CONTAINER* ref = (ZONE_CONTAINER*) aPickList.GetPickedItem( kk );
|
||||
|
||||
|
@ -228,9 +228,9 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
|
|||
* it must be in aDeletedList:
|
||||
* search it and restore initial values
|
||||
* 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;
|
||||
ref = NULL;
|
||||
|
@ -240,7 +240,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
|
|||
else
|
||||
{
|
||||
ZONE_CONTAINER* zcopy = (ZONE_CONTAINER*) aPickList.GetPickedItemLink( kk );
|
||||
aPickList.SetPickedItemStatus( UR_DELETED, kk );
|
||||
aPickList.SetPickedItemStatus( UNDO_REDO::DELETED, kk );
|
||||
|
||||
wxASSERT_MSG( zcopy != NULL,
|
||||
wxT( "UpdateCopyOfZonesList() error: link = NULL" ) );
|
||||
|
@ -277,7 +277,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
|
|||
|
||||
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 );
|
||||
|
||||
|
@ -297,13 +297,13 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
|
|||
// Add new zones in main pick list, and remove pickers from Auxiliary List
|
||||
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 );
|
||||
aPickList.PushItem( picker );
|
||||
aAuxiliaryList.RemovePicker( ii );
|
||||
}
|
||||
else if( aAuxiliaryList.GetPickedItemStatus( ii ) == UR_DELETED )
|
||||
else if( aAuxiliaryList.GetPickedItemStatus( ii ) == UNDO_REDO::DELETED )
|
||||
{
|
||||
delete aAuxiliaryList.GetPickedItemLink( ii );
|
||||
aAuxiliaryList.RemovePicker( ii );
|
||||
|
|
|
@ -61,7 +61,7 @@ int SaveCopyOfZones(PICKED_ITEMS_LIST & aPickList, BOARD* aPcb, int aNetCode, LA
|
|||
/**
|
||||
* Function UpdateCopyOfZonesList
|
||||
* 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 aAuxiliaryList = the list of deleted or added (new created) items after calculations
|
||||
* @param aPcb = the Board
|
||||
|
|
Loading…
Reference in New Issue