Undo redo change and code cleanup.

This commit is contained in:
jean-pierre charras 2012-02-05 14:02:46 +01:00
parent 8e846082bb
commit 08ef741770
23 changed files with 102 additions and 125 deletions

View File

@ -33,11 +33,10 @@
ITEM_PICKER::ITEM_PICKER( EDA_ITEM* aItem, UNDO_REDO_T aUndoRedoStatus )
{
m_UndoRedoStatus = aUndoRedoStatus;
m_PickedItem = aItem;
m_PickedItemType = TYPE_NOT_INIT;
m_PickerFlags = 0;
m_Link = NULL;
m_undoRedoStatus = aUndoRedoStatus;
SetItem( aItem );
m_pickerFlags = 0;
m_link = NULL;
}
@ -75,7 +74,7 @@ bool PICKED_ITEMS_LIST::ContainsItem( EDA_ITEM* aItem ) const
{
for( size_t i = 0; i < m_ItemsList.size(); i++ )
{
if( m_ItemsList[ i ].m_PickedItem == aItem )
if( m_ItemsList[ i ].GetItem() == aItem )
return true;
}
@ -97,9 +96,9 @@ void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
while( GetCount() > 0 )
{
ITEM_PICKER wrapper = PopItem();
if( wrapper.m_PickedItem == NULL ) // No more item in list.
if( wrapper.GetItem() == NULL ) // No more item in list.
break;
switch( wrapper.m_UndoRedoStatus )
switch( wrapper.GetStatus() )
{
case UR_UNSPECIFIED:
if( show_error_message )
@ -112,7 +111,7 @@ void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
{
// Specific to eeschema: a linked list of wires is stored. The wrapper picks only
// the first item (head of list), and is owner of all picked items.
EDA_ITEM* item = wrapper.m_PickedItem;
EDA_ITEM* item = wrapper.GetItem();
while( item )
{
@ -135,7 +134,7 @@ void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
case UR_CHANGED:
case UR_EXCHANGE_T:
delete wrapper.m_Link; // the picker is owner of this item
delete wrapper.GetLink(); // the picker is owner of this item
break;
case UR_DELETED: // the picker is owner of this item
@ -146,12 +145,12 @@ void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
* copy of the current module when changed),
* and the picker is owner of this item
*/
delete wrapper.m_PickedItem;
delete wrapper.GetItem();
break;
default:
wxFAIL_MSG( wxString::Format( wxT( "Cannot clear unknown undo/redo command %d" ),
wrapper.m_UndoRedoStatus ) );
wrapper.GetStatus() ) );
break;
}
}
@ -172,7 +171,7 @@ ITEM_PICKER PICKED_ITEMS_LIST::GetItemWrapper( unsigned int aIdx )
EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItem( unsigned int aIdx )
{
if( aIdx < m_ItemsList.size() )
return m_ItemsList[aIdx].m_PickedItem;
return m_ItemsList[aIdx].GetItem();
else
return NULL;
}
@ -181,7 +180,7 @@ EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItem( unsigned int aIdx )
EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItemLink( unsigned int aIdx )
{
if( aIdx < m_ItemsList.size() )
return m_ItemsList[aIdx].m_Link;
return m_ItemsList[aIdx].GetLink();
else
return NULL;
}
@ -190,7 +189,7 @@ EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItemLink( unsigned int aIdx )
UNDO_REDO_T PICKED_ITEMS_LIST::GetPickedItemStatus( unsigned int aIdx )
{
if( aIdx < m_ItemsList.size() )
return m_ItemsList[aIdx].m_UndoRedoStatus;
return m_ItemsList[aIdx].GetStatus();
else
return UR_UNSPECIFIED;
}
@ -199,7 +198,7 @@ UNDO_REDO_T PICKED_ITEMS_LIST::GetPickedItemStatus( unsigned int aIdx )
int PICKED_ITEMS_LIST::GetPickerFlags( unsigned aIdx )
{
if( aIdx < m_ItemsList.size() )
return m_ItemsList[aIdx].m_PickerFlags;
return m_ItemsList[aIdx].GetFlags();
else
return 0;
}
@ -209,7 +208,7 @@ bool PICKED_ITEMS_LIST::SetPickedItem( EDA_ITEM* aItem, unsigned aIdx )
{
if( aIdx < m_ItemsList.size() )
{
m_ItemsList[aIdx].m_PickedItem = aItem;
m_ItemsList[aIdx].SetItem( aItem );
return true;
}
else
@ -221,7 +220,7 @@ bool PICKED_ITEMS_LIST::SetPickedItemLink( EDA_ITEM* aLink, unsigned aIdx )
{
if( aIdx < m_ItemsList.size() )
{
m_ItemsList[aIdx].m_Link = aLink;
m_ItemsList[aIdx].SetLink( aLink );
return true;
}
else
@ -233,8 +232,8 @@ bool PICKED_ITEMS_LIST::SetPickedItem( EDA_ITEM* aItem, UNDO_REDO_T aStatus, uns
{
if( aIdx < m_ItemsList.size() )
{
m_ItemsList[aIdx].m_PickedItem = aItem;
m_ItemsList[aIdx].m_UndoRedoStatus = aStatus;
m_ItemsList[aIdx].SetItem( aItem );
m_ItemsList[aIdx].SetStatus( aStatus );
return true;
}
else
@ -246,7 +245,7 @@ bool PICKED_ITEMS_LIST::SetPickedItemStatus( UNDO_REDO_T aStatus, unsigned aIdx
{
if( aIdx < m_ItemsList.size() )
{
m_ItemsList[aIdx].m_UndoRedoStatus = aStatus;
m_ItemsList[aIdx].SetStatus( aStatus );
return true;
}
else
@ -258,7 +257,7 @@ bool PICKED_ITEMS_LIST::SetPickerFlags( int aFlags, unsigned aIdx )
{
if( aIdx < m_ItemsList.size() )
{
m_ItemsList[aIdx].m_PickerFlags = aFlags;
m_ItemsList[aIdx].SetFlags( aFlags );
return true;
}
else

View File

@ -263,12 +263,12 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
}
// Prepare undo command for delete old text
picker.m_UndoRedoStatus = UR_DELETED;
picker.SetStatus( UR_DELETED );
picker.SetLink( NULL );
pickList.PushItem( picker );
// Prepare undo command for new text
picker.m_UndoRedoStatus = UR_NEW;
picker.SetStatus( UR_NEW );
picker.SetItem(newtext);
pickList.PushItem( picker );

View File

@ -48,7 +48,7 @@ void LIB_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& event )
lastcmd = GetScreen()->PopCommandFromRedoList();
wrapper = lastcmd->PopItem();
m_component = (LIB_COMPONENT*) wrapper.m_PickedItem;
m_component = (LIB_COMPONENT*) wrapper.GetItem();
if( m_component == NULL )
return;
@ -84,7 +84,7 @@ void LIB_EDIT_FRAME::GetComponentFromUndoList( wxCommandEvent& event )
lastcmd = GetScreen()->PopCommandFromUndoList();
wrapper = lastcmd->PopItem();
m_component = (LIB_COMPONENT*) wrapper.m_PickedItem;
m_component = (LIB_COMPONENT*) wrapper.GetItem();
if( m_component == NULL )
return;

View File

@ -872,7 +872,6 @@ void SCH_SCREEN::addConnectedItemsToBlock( const wxPoint& position )
for( item = GetDrawItems(); item != NULL; item = item->Next() )
{
picker.SetItem( item );
picker.SetItemType( item->Type() );
if( !item->IsConnectable() || !item->IsConnected( position )
|| (item->GetFlags() & SKIP_STRUCT) )
@ -901,7 +900,7 @@ void SCH_SCREEN::addConnectedItemsToBlock( const wxPoint& position )
if( addinlist )
{
picker.m_PickerFlags = item->GetFlags();
picker.SetFlags( item->GetFlags() );
m_BlockLocate.m_ItemsSelection.PushItem( picker );
}
}
@ -922,7 +921,6 @@ int SCH_SCREEN::UpdatePickList()
if( item->HitTest( area ) )
{
picker.SetItem( item );
picker.SetItemType( item->Type() );
m_BlockLocate.PushItem( picker );
}
}

View File

@ -121,24 +121,18 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem,
if( aItem == NULL && ( aCommandType != UR_WIRE_IMAGE ) )
return;
SCH_ITEM* CopyOfItem;
PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST();
commandToUndo->m_TransformPoint = aTransformPoint;
ITEM_PICKER itemWrapper( aItem, aCommandType );
if( aItem )
{
itemWrapper.m_PickedItemType = aItem->Type();
itemWrapper.m_PickerFlags = aItem->GetFlags();
}
itemWrapper.SetFlags( aItem->GetFlags() );
switch( aCommandType )
{
case UR_CHANGED: /* Create a copy of item */
CopyOfItem = DuplicateStruct( aItem, true );
itemWrapper.m_Link = CopyOfItem;
if( CopyOfItem )
itemWrapper.SetLink( DuplicateStruct( aItem, true ) );
commandToUndo->PushItem( itemWrapper );
break;

View File

@ -80,18 +80,16 @@ enum UNDO_REDO_T {
class ITEM_PICKER
{
friend class PICKED_ITEMS_LIST;
public:
UNDO_REDO_T 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
private:
int 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 */
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. */
KICAD_T m_PickedItemType; /* type of schematic or board item that is concerned */
KICAD_T m_pickedItemType; /* type of schematic or board item that is concerned */
int m_PickerFlags; /* a copy of m_Flags member. useful in mode/drag
* undo/redo commands */
EDA_ITEM* m_Link; /* Pointer on an other item. Used in undo redo command
EDA_ITEM* m_link; /* Pointer on an other item. Used in undo redo command
* used when a duplicate exists i.e. when an item is
* modified, and the copy of initial item exists (the
* duplicate) m_Item points the duplicate (i.e the old
@ -101,19 +99,27 @@ public:
public:
ITEM_PICKER( EDA_ITEM* aItem = NULL, UNDO_REDO_T aUndoRedoStatus = UR_UNSPECIFIED );
EDA_ITEM* GetItem() const { return m_PickedItem; }
EDA_ITEM* GetItem() const { return m_pickedItem; }
void SetItem( EDA_ITEM* aItem ) { m_PickedItem = aItem; }
void SetItem( EDA_ITEM* aItem )
{
m_pickedItem = aItem;
m_pickedItemType = aItem ? aItem->Type() : TYPE_NOT_INIT;
}
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_T aStatus ) { m_undoRedoStatus = aStatus; }
void SetItemType( KICAD_T aType ) { m_PickedItemType = aType; }
UNDO_REDO_T GetStatus() { return m_undoRedoStatus; }
void SetLink( EDA_ITEM* aItem ) { m_Link = aItem; }
void SetFlags( int aFlags ) { m_pickerFlags = aFlags; }
EDA_ITEM* GetLink() const { return m_Link; }
int GetFlags() { return m_pickerFlags; }
void SetLink( EDA_ITEM* aItem ) { m_link = aItem; }
EDA_ITEM* GetLink() const { return m_link; }
};

View File

@ -264,8 +264,8 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
}
// Undo: add copy of old Module to undo
picker.m_Link = Module->Clone();
picker.m_PickedItemType = Module->Type();
picker.SetItem( Module );
picker.SetLink( Module->Clone() );
if( current.x > (Xsize_allowed + start.x) )
{
@ -282,7 +282,6 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
PlaceModule( Module, NULL, true );
// Undo: add new Module to undo
picker.m_PickedItem = Module;
newList.PushItem( picker );
current.x += Module->m_BoundaryBox.GetWidth() + pas_grille;

View File

@ -181,8 +181,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
if( ThisModule == Module )
{
// Module will be placed, add to undo.
picker.m_PickedItem = ThisModule;
picker.m_PickedItemType = ThisModule->Type();
picker.SetItem( ThisModule );
newList.PushItem( picker );
Module->m_ModuleStatus |= MODULE_to_PLACE;
@ -199,8 +198,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
if( !bbbox.Contains( Module->m_Pos ) )
{
// Module will be placed, add to undo.
picker.m_PickedItem = Module;
picker.m_PickedItemType = Module->Type();
picker.SetItem( Module );
newList.PushItem( picker );
Module->m_ModuleStatus |= MODULE_to_PLACE;
@ -215,8 +213,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
break;
// Module will be placed, add to undo.
picker.m_PickedItem = Module;
picker.m_PickedItemType = Module->Type();
picker.SetItem( Module );
newList.PushItem( picker );
Module->m_ModuleStatus |= MODULE_to_PLACE;
@ -232,8 +229,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
if( !(Module->m_ModuleStatus & MODULE_is_PLACED) )
{
// Module will be placed, add to undo.
picker.m_PickedItem = Module;
picker.m_PickedItemType = Module->Type();
picker.SetItem( Module );
newList.PushItem( picker );
Module->m_ModuleStatus |= MODULE_to_PLACE;

View File

@ -398,8 +398,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
{
if( blockIncludeItemsOnInvisibleLayers || m_Pcb->IsModuleLayerVisible( layer ) )
{
picker.m_PickedItem = module;
picker.m_PickedItemType = module->Type();
picker.SetItem ( module );
itemsList->PushItem( picker );
}
}
@ -416,8 +415,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
if( blockIncludeItemsOnInvisibleLayers
|| m_Pcb->IsLayerVisible( pt_segm->GetLayer() ) )
{
picker.m_PickedItem = pt_segm;
picker.m_PickedItemType = pt_segm->Type();
picker.SetItem ( pt_segm );
itemsList->PushItem( picker );
}
}
@ -486,8 +484,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
if( select_me )
{
picker.m_PickedItem = PtStruct;
picker.m_PickedItemType = PtStruct->Type();
picker.SetItem ( PtStruct );
itemsList->PushItem( picker );
}
}
@ -505,8 +502,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
|| m_Pcb->IsLayerVisible( area->GetLayer() ) )
{
BOARD_ITEM* zone_c = (BOARD_ITEM*) area;
picker.m_PickedItem = zone_c;
picker.m_PickedItemType = zone_c->Type();
picker.SetItem ( zone_c );
itemsList->PushItem( picker );
}
}
@ -854,8 +850,7 @@ void PCB_EDIT_FRAME::Block_Duplicate()
if( newitem )
{
newitem->Move( MoveVector );
picker.m_PickedItem = newitem;
picker.m_PickedItemType = newitem->Type();
picker.SetItem ( newitem );
newList.PushItem( picker );
}
}

View File

@ -312,17 +312,13 @@ void PCB_EDIT_FRAME::SaveCopyInUndoList( BOARD_ITEM* aItem,
commandToUndo->m_TransformPoint = aTransformPoint;
ITEM_PICKER itemWrapper( aItem, aCommandType );
itemWrapper.m_PickedItemType = aItem->Type();
switch( aCommandType )
{
case UR_CHANGED: /* Create a copy of schematic */
if( itemWrapper.m_Link == NULL ) // When not null, the copy is already done
itemWrapper.m_Link = aItem->Clone();;
if( itemWrapper.m_Link )
case UR_CHANGED: // Create a copy of item
if( itemWrapper.GetLink() == NULL ) // When not null, the copy is already done
itemWrapper.SetLink( aItem->Clone() );
commandToUndo->PushItem( itemWrapper );
break;
case UR_NEW:
@ -466,10 +462,10 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
* - if a call to SaveCopyInUndoList was forgotten in Pcbnew
* - in zones outlines, when a change in one zone merges this zone with an other
* This test avoids a Pcbnew crash
* the test is made only to avoid crashes, so it is not needed for deleted or new items
* Obviouly, this test is not made for deleted items
*/
UNDO_REDO_T status = aList->GetPickedItemStatus( ii );
if( status != UR_DELETED && status != UR_NEW )
if( status != UR_DELETED )
{
if( build_item_list )
// Build list of existing items, for integrity test

View File

@ -177,8 +177,7 @@ void PCB_EDIT_FRAME::Delete_net( wxDC* DC, TRACK* aTrack )
// redraw the area where the track was
m_canvas->RefreshDrawingRect( segm->GetBoundingBox() );
picker.m_PickedItem = segm;
picker.m_PickedItemType = segm->Type();
picker.SetItem( segm );
itemsList.PushItem( picker );
}
@ -223,8 +222,7 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
// redraw the area where the track was
m_canvas->RefreshDrawingRect( tracksegment->GetBoundingBox() );
picker.m_PickedItem = tracksegment;
picker.m_PickedItemType = tracksegment->Type();
picker.SetItem( tracksegment );
itemsList.PushItem( picker );
}

View File

@ -88,7 +88,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
while( pcb->GetAreaCount() )
{
item = pcb->GetArea( 0 );
itemPicker.m_PickedItem = item;
itemPicker.SetItem( item );
pickersList.PushItem( itemPicker );
pcb->Remove( item );
}
@ -118,7 +118,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
if( removeme )
{
itemPicker.m_PickedItem = item;
itemPicker.SetItem( item );
pickersList.PushItem( itemPicker );
item->UnLink();
}
@ -131,7 +131,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
for( item = pcb->m_Modules; item; item = nextitem )
{
nextitem = item->Next();
itemPicker.m_PickedItem = item;
itemPicker.SetItem( item );
pickersList.PushItem( itemPicker );
item->UnLink();
}
@ -165,7 +165,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
if( (track->ReturnMaskLayer() & layers_filter) == 0 )
continue;
itemPicker.m_PickedItem = track;
itemPicker.SetItem( track );
pickersList.PushItem( itemPicker );
track->UnLink();
gen_rastnest = true;

View File

@ -100,7 +100,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
{
aTrackItem->m_Width = initial_width;
ITEM_PICKER picker( aTrackItem, UR_CHANGED );
picker.m_Link = aTrackItem->Clone();
picker.SetLink( aTrackItem->Clone() );
aItemsListPicker->PushItem( picker );
aTrackItem->m_Width = new_width;

View File

@ -173,7 +173,7 @@ void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( int aLayer )
if( item->GetLayer() == aLayer )
{
item->UnLink();
picker.m_PickedItem = item;
picker.SetItem( item );
pickList.PushItem( picker );
}

View File

@ -366,14 +366,12 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
PICKED_ITEMS_LIST undoItemList;
unsigned int ii;
itemWrapper.m_PickedItemType = PCB_MODULE_T;
module = GetBoard()->m_Modules;
// Prepare undo list
while( module )
{
itemWrapper.m_PickedItem = module;
itemWrapper.SetItem( module );
switch( aType )
{
@ -388,7 +386,8 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
case TEXT_is_VALUE:
item = module->m_Value;
if( item->GetSize() != GetDesignSettings().m_ModuleTextSize || item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
if( item->GetSize() != GetDesignSettings().m_ModuleTextSize ||
item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
undoItemList.PushItem( itemWrapper );
break;

View File

@ -265,7 +265,6 @@ void PCB_BASE_FRAME::GlobalChange_PadSettings( D_PAD* aPad,
if( saveMe )
{
ITEM_PICKER itemWrapper( Module, UR_CHANGED );
itemWrapper.m_PickedItemType = Module->Type();
itemsList.PushItem( itemWrapper );
}
}

View File

@ -63,7 +63,7 @@ void FOOTPRINT_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& event )
// Retrieve last module state from undo list
lastcmd = GetScreen()->PopCommandFromRedoList();
wrapper = lastcmd->PopItem();
module = (MODULE *)wrapper.m_PickedItem;
module = (MODULE *)wrapper.GetItem();
delete lastcmd;
if( module )
@ -91,7 +91,7 @@ void FOOTPRINT_EDIT_FRAME::GetComponentFromUndoList( wxCommandEvent& event )
// Retrieve last module state from undo list
lastcmd = GetScreen()->PopCommandFromUndoList();
wrapper = lastcmd->PopItem();
module = (MODULE *)wrapper.m_PickedItem;
module = (MODULE *)wrapper.GetItem();
delete lastcmd;
if( module )

View File

@ -121,9 +121,9 @@ void PCB_EDIT_FRAME::StartMove_Module( MODULE* module, wxDC* DC )
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{
TRACK* segm = g_DragSegmentList[ii].m_Segm;
itemWrapper.m_PickedItem = segm;
itemWrapper.m_Link = segm->Clone();
itemWrapper.m_Link->SetState( IN_EDIT, OFF );
itemWrapper.SetItem( segm );
itemWrapper.SetLink( segm->Clone() );
itemWrapper.GetLink()->SetState( IN_EDIT, OFF );
s_PickedList.PushItem( itemWrapper );
}
}
@ -376,7 +376,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat
else if( aModule->IsMoving() )
{
ITEM_PICKER picker( aModule, UR_CHANGED );
picker.m_Link = s_ModuleInitialCopy;
picker.SetLink( s_ModuleInitialCopy );
s_PickedList.PushItem( picker );
s_ModuleInitialCopy = NULL; // the picker is now owner of s_ModuleInitialCopy.
}

View File

@ -320,7 +320,7 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC )
if( g_DragSegmentList[ii].m_Pad_End )
Track->m_End = Pad_OldPos;
picker.m_PickedItem = Track;
picker.SetItem( Track );
pickList.PushItem( picker );
}
@ -333,7 +333,7 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC )
SaveCopyInUndoList( Module, UR_CHANGED );
else
{
picker.m_PickedItem = Module;
picker.SetItem( Module );
pickList.PushItem( picker );
SaveCopyInUndoList( pickList, UR_CHANGED );
}

View File

@ -758,16 +758,16 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
// Prepare the Undo command
ITEM_PICKER picker( aTrack, UR_CHANGED );
picker.m_Link = aTrack->Clone();
picker.SetLink( aTrack->Clone() );
s_ItemsListPicker.PushItem( picker );
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{
TRACK* draggedtrack = g_DragSegmentList[ii].m_Segm;
picker.m_PickedItem = draggedtrack;
picker.m_Link = draggedtrack->Clone();
picker.SetItem( draggedtrack );
picker.SetLink( draggedtrack->Clone() );
s_ItemsListPicker.PushItem( picker );
draggedtrack = (TRACK*) picker.m_Link;
draggedtrack = (TRACK*) picker.GetLink();
draggedtrack->SetStatus( 0 );
draggedtrack->ClearFlags();
}
@ -979,10 +979,10 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{
TRACK* draggedtrack = g_DragSegmentList[ii].m_Segm;
picker.m_PickedItem = draggedtrack;
picker.m_Link = draggedtrack->Clone();
picker.SetItem( draggedtrack);
picker.SetLink ( draggedtrack->Clone() );
s_ItemsListPicker.PushItem( picker );
draggedtrack = (TRACK*) picker.m_Link;
draggedtrack = (TRACK*) picker.GetLink();
draggedtrack->SetStatus( 0 );
draggedtrack->ClearFlags();
}

View File

@ -549,11 +549,12 @@ void DIALOG_PLOT::applyPlotSettings()
{
msg = ReturnStringFromValue( g_UserUnit, m_PSWidthAdjust, PCB_INTERNAL_UNIT );
m_PSFineAdjustWidthOpt->SetValue( msg );
msg.Printf( _( "Width correction constrained!\nThe reasonable width correction value must be in a range of [%+f; %+f]" ),
msg.Printf( _( "Width correction constrained!\n"
"The reasonable width correction value must be in a range of\n"
" [%+f; %+f] (%s) for current design rules!\n" ),
To_User_Unit( g_UserUnit, m_WidthAdjustMinValue, PCB_INTERNAL_UNIT ),
To_User_Unit( g_UserUnit, m_WidthAdjustMaxValue, PCB_INTERNAL_UNIT ) );
msg += ( g_UserUnit == INCHES )? _(" (\")") : _(" (mm)");
msg += _( " for current design rules!\n" );
To_User_Unit( g_UserUnit, m_WidthAdjustMaxValue, PCB_INTERNAL_UNIT ),
( g_UserUnit == INCHES )? wxT("\"") : wxT("mm") );
m_messagesBox->AppendText( msg );
}

View File

@ -138,8 +138,7 @@ int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, in
ZONE_CONTAINER* zoneDup = new ZONE_CONTAINER( *zone );
zoneDup->SetParent( aPcb );
ITEM_PICKER picker( zone, UR_CHANGED );
picker.m_Link = zoneDup;
picker.m_PickedItemType = zone->Type();
picker.SetLink( zoneDup );
aPickList.PushItem( picker );
copyCount++;
}

View File

@ -44,7 +44,6 @@ ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode,
if( aNewZonesList )
{
ITEM_PICKER picker( new_area, UR_NEW );
picker.m_PickedItemType = new_area->Type();
aNewZonesList->PushItem( picker );
}
return new_area;
@ -66,7 +65,6 @@ void BOARD::RemoveArea( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_to
if( aDeletedList )
{
ITEM_PICKER picker( area_to_remove, UR_DELETED );
picker.m_PickedItemType = area_to_remove->Type();
aDeletedList->PushItem( picker );
Remove( area_to_remove ); // remove from zone list, but does not delete it
}