Replaced Copy() method with operator=. Removed Copy() where default copy ctor was enough.

This commit is contained in:
Maciej Suminski 2016-05-31 10:27:52 +02:00
parent 2c08ff1d59
commit 09e0311d4e
25 changed files with 167 additions and 370 deletions

View File

@ -65,13 +65,7 @@ EDA_ITEM::EDA_ITEM( KICAD_T idType )
EDA_ITEM::EDA_ITEM( const EDA_ITEM& base )
{
initVars();
m_StructType = base.m_StructType;
m_Parent = base.m_Parent;
m_Flags = base.m_Flags;
// A copy of an item cannot have the same time stamp as the original item.
SetTimeStamp( GetNewTimeStamp() );
m_Status = base.m_Status;
*this = base;
}
@ -224,23 +218,23 @@ bool EDA_ITEM::operator<( const EDA_ITEM& aItem ) const
return false;
}
#ifdef USE_EDA_ITEM_OP_EQ // see base_struct.h for explanations
EDA_ITEM& EDA_ITEM::operator=( const EDA_ITEM& aItem )
{
if( &aItem != this )
{
m_Image = aItem.m_Image;
// do not call initVars()
m_StructType = aItem.m_StructType;
m_Parent = aItem.m_Parent;
m_Flags = aItem.m_Flags;
m_TimeStamp = aItem.m_TimeStamp;
m_Status = aItem.m_Status;
m_Parent = aItem.m_Parent;
m_forceVisible = aItem.m_forceVisible;
}
// A copy of an item cannot have the same time stamp as the original item.
SetTimeStamp( GetNewTimeStamp() );
// do not copy list related fields (Pnext, Pback, m_List)
return *this;
}
#endif
const BOX2I EDA_ITEM::ViewBBox() const
{

View File

@ -482,17 +482,11 @@ public:
*/
static bool Sort( const EDA_ITEM* aLeft, const EDA_ITEM* aRight ) { return *aLeft < *aRight; }
#if 0
/**
* Operator assignment
* is used to assign the members of \a aItem to another object.
*
* @warning This is still a work in progress and not ready for prime time. Do not use
* as there is a known issue with wxString buffers.
*/
virtual EDA_ITEM& operator=( const EDA_ITEM& aItem );
#define USE_EDA_ITEM_OP_EQ
#endif
EDA_ITEM& operator=( const EDA_ITEM& aItem );
/// @copydoc VIEW_ITEM::ViewBBox()
virtual const BOX2I ViewBBox() const;

View File

@ -88,7 +88,8 @@ public:
{
}
// Do not create a copy constructor. The one generated by the compiler is adequate.
// Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate.
virtual const wxPoint& GetPosition() const = 0;

View File

@ -207,21 +207,11 @@ void BOARD_ITEM::SwapData( BOARD_ITEM* aImage )
switch( Type() )
{
case PCB_MODULE_T:
{
MODULE* tmp = (MODULE*) aImage->Clone();
( (MODULE*) aImage )->Copy( (MODULE*) this );
( (MODULE*) this )->Copy( tmp );
delete tmp;
}
std::swap( *((MODULE*) this), *((MODULE*) aImage) );
break;
case PCB_ZONE_AREA_T:
{
ZONE_CONTAINER* tmp = (ZONE_CONTAINER*) aImage->Clone();
( (ZONE_CONTAINER*) aImage )->Copy( (ZONE_CONTAINER*) this );
( (ZONE_CONTAINER*) this )->Copy( tmp );
delete tmp;
}
std::swap( *((ZONE_CONTAINER*) this), *((ZONE_CONTAINER*) aImage) );
break;
case PCB_LINE_T:
@ -229,57 +219,11 @@ void BOARD_ITEM::SwapData( BOARD_ITEM* aImage )
break;
case PCB_TRACE_T:
std::swap( *((TRACK*) this), *((TRACK*) aImage) );
break;
case PCB_VIA_T:
{
TRACK* track = (TRACK*) this;
TRACK* image = (TRACK*) aImage;
std::swap(track->m_Layer, image->m_Layer );
// swap start, end, width and shape for track and image.
wxPoint exchp = track->GetStart();
track->SetStart( image->GetStart() );
image->SetStart( exchp );
exchp = track->GetEnd();
track->SetEnd( image->GetEnd() );
image->SetEnd( exchp );
int atmp = track->GetWidth();
track->SetWidth( image->GetWidth() );
image->SetWidth( atmp );
if( Type() == PCB_VIA_T )
{
VIA *via = static_cast<VIA*>( this );
VIA *viaimage = static_cast<VIA*>( aImage );
VIATYPE_T viatmp = via->GetViaType();
via->SetViaType( viaimage->GetViaType() );
viaimage->SetViaType( viatmp );
int drilltmp = via->GetDrillValue();
if( via->IsDrillDefault() )
drilltmp = -1;
int itmp = viaimage->GetDrillValue();
if( viaimage->IsDrillDefault() )
itmp = -1;
std::swap(itmp, drilltmp );
if( drilltmp > 0 )
via->SetDrill( drilltmp );
else
via->SetDrillDefault();
if( itmp > 0 )
viaimage->SetDrill( itmp );
else
viaimage->SetDrillDefault();
}
}
std::swap( *((VIA*) this), *((VIA*) aImage) );
break;
case PCB_TEXT_T:
@ -572,6 +516,7 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
MODULE* oldModule = static_cast<MODULE*>( item );
oldModule->RunOnChildren( std::bind( &KIGFX::VIEW::Remove, view, _1 ) );
}
view->Remove( item );
ratsnest->Remove( item );
@ -583,11 +528,12 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
{
MODULE* newModule = static_cast<MODULE*>( item );
newModule->RunOnChildren( std::bind( &KIGFX::VIEW::Add, view, _1 ) );
newModule->RunOnChildren( std::bind( &BOARD_ITEM::ClearFlags, _1, EDA_ITEM_ALL_FLAGS ));
}
view->Add( item );
ratsnest->Add( item );
item->ClearFlags( SELECTED );
item->ClearFlags();
item->ViewUpdate( KIGFX::VIEW_ITEM::LAYERS );
}
break;

View File

@ -89,30 +89,6 @@ void DIMENSION::SetLayer( LAYER_ID aLayer )
}
void DIMENSION::Copy( DIMENSION* source )
{
m_Value = source->m_Value;
SetLayer( source->GetLayer() );
m_Width = source->m_Width;
m_Shape = source->m_Shape;
m_Height = source->m_Height;
m_Unit = source->m_Unit;
SetTimeStamp( GetNewTimeStamp() );
m_Text.Copy( &source->m_Text );
m_crossBarO = source->m_crossBarO;
m_crossBarF = source->m_crossBarF;
m_featureLineGO = source->m_featureLineGO;
m_featureLineGF = source->m_featureLineGF;
m_featureLineDO = source->m_featureLineDO;
m_featureLineDF = source->m_featureLineDF;
m_arrowD1F = source->m_arrowD1F;
m_arrowD2F = source->m_arrowD2F;
m_arrowG1F = source->m_arrowG1F;
m_arrowG2F = source->m_arrowG2F;
}
void DIMENSION::Move( const wxPoint& offset )
{
m_Text.SetTextPosition( m_Text.GetTextPosition() + offset );

View File

@ -78,7 +78,8 @@ public:
DIMENSION( BOARD_ITEM* aParent );
// Do not create a copy constructor. The one generated by the compiler is adequate.
// Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate.
~DIMENSION();
@ -182,8 +183,6 @@ public:
TEXTE_PCB& Text() { return m_Text; }
TEXTE_PCB& Text() const { return *(const_cast<TEXTE_PCB*> (&m_Text)); }
void Copy( DIMENSION* source );
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE aColorMode, const wxPoint& offset = ZeroOffset );

View File

@ -69,16 +69,6 @@ PCB_TARGET::~PCB_TARGET()
{
}
void PCB_TARGET::Copy( PCB_TARGET* source )
{
m_Layer = source->m_Layer;
m_Width = source->m_Width;
m_Pos = source->m_Pos;
m_Shape = source->m_Shape;
m_Size = source->m_Size;
SetTimeStamp( GetNewTimeStamp() );
}
/* Draw PCB_TARGET object: 2 segments + 1 circle
* The circle radius is half the radius of the target

View File

@ -54,6 +54,9 @@ public:
PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_ID aLayer,
const wxPoint& aPos, int aSize, int aWidth );
// Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate.
~PCB_TARGET();
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; } // override
@ -77,8 +80,6 @@ public:
void Flip( const wxPoint& aCentre );
void Copy( PCB_TARGET* source );
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset );

View File

@ -83,7 +83,6 @@ MODULE::MODULE( const MODULE& aModule ) :
{
m_Pos = aModule.m_Pos;
m_fpid = aModule.m_fpid;
m_Layer = aModule.m_Layer;
m_Attributs = aModule.m_Attributs;
m_ModuleStatus = aModule.m_ModuleStatus;
m_Orient = aModule.m_Orient;
@ -105,35 +104,27 @@ MODULE::MODULE( const MODULE& aModule ) :
// Copy reference and value.
m_Reference = new TEXTE_MODULE( *aModule.m_Reference );
m_Reference->SetParent( this );
m_Value = new TEXTE_MODULE( *aModule.m_Value );
m_Value->SetParent( this );
// Copy auxiliary data: Pads
for( D_PAD* pad = aModule.m_Pads; pad; pad = pad->Next() )
{
D_PAD* newpad = new D_PAD( *pad );
assert( newpad->GetNet() == pad->GetNet() );
newpad->SetParent( this );
m_Pads.PushBack( newpad );
Add( new D_PAD( *pad ) );
}
// Copy auxiliary data: Drawings
for( BOARD_ITEM* item = aModule.m_Drawings; item; item = item->Next() )
{
BOARD_ITEM* newItem;
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
case PCB_MODULE_EDGE_T:
newItem = static_cast<BOARD_ITEM*>( item->Clone() );
newItem->SetParent( this );
m_Drawings.PushBack( newItem );
Add( static_cast<BOARD_ITEM*>( item->Clone() ) );
break;
default:
wxLogMessage( wxT( "MODULE::Copy() Internal Err: unknown type" ) );
wxLogMessage( wxT( "Class MODULE copy constructor internal error: unknown type" ) );
break;
}
}
@ -161,6 +152,76 @@ MODULE::~MODULE()
delete m_initial_comments;
}
MODULE& MODULE::operator=( const MODULE& aOther )
{
BOARD_ITEM::operator=( aOther );
m_Pos = aOther.m_Pos;
m_fpid = aOther.m_fpid;
m_Attributs = aOther.m_Attributs;
m_ModuleStatus = aOther.m_ModuleStatus;
m_Orient = aOther.m_Orient;
m_BoundaryBox = aOther.m_BoundaryBox;
m_CntRot90 = aOther.m_CntRot90;
m_CntRot180 = aOther.m_CntRot180;
m_LastEditTime = aOther.m_LastEditTime;
m_Link = aOther.m_Link;
m_Path = aOther.m_Path; //is this correct behavior?
m_LocalClearance = aOther.m_LocalClearance;
m_LocalSolderMaskMargin = aOther.m_LocalSolderMaskMargin;
m_LocalSolderPasteMargin = aOther.m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = aOther.m_LocalSolderPasteMarginRatio;
m_ZoneConnection = aOther.m_ZoneConnection;
m_ThermalWidth = aOther.m_ThermalWidth;
m_ThermalGap = aOther.m_ThermalGap;
// Copy reference and value
*m_Reference = *aOther.m_Reference;
m_Reference->SetParent( this );
*m_Value = *aOther.m_Value;
m_Value->SetParent( this );
// Copy auxiliary data: Pads
m_Pads.DeleteAll();
for( D_PAD* pad = aOther.m_Pads; pad; pad = pad->Next() )
{
Add( new D_PAD( *pad ) );
}
// Copy auxiliary data: Drawings
m_Drawings.DeleteAll();
for( BOARD_ITEM* item = aOther.m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
case PCB_MODULE_EDGE_T:
Add( static_cast<BOARD_ITEM*>( item->Clone() ) );
break;
default:
wxLogMessage( wxT( "MODULE::operator=() internal error: unknown type" ) );
break;
}
}
// Copy auxiliary data: 3D_Drawings info
m_3D_Drawings.clear();
m_3D_Drawings = aOther.m_3D_Drawings;
m_Doc = aOther.m_Doc;
m_KeyWord = aOther.m_KeyWord;
// Ensure auxiliary data is up to date
CalculateBoundingBox();
return *this;
}
/**
* Function ClearAllNets
* Clear (i.e. force the ORPHANED dummy net info) the net info which
@ -195,85 +256,6 @@ void MODULE::DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
}
void MODULE::Copy( MODULE* aModule )
{
m_Pos = aModule->m_Pos;
m_Layer = aModule->m_Layer;
m_fpid = aModule->m_fpid;
m_Attributs = aModule->m_Attributs;
m_ModuleStatus = aModule->m_ModuleStatus;
m_Orient = aModule->m_Orient;
m_BoundaryBox = aModule->m_BoundaryBox;
m_CntRot90 = aModule->m_CntRot90;
m_CntRot180 = aModule->m_CntRot180;
m_LastEditTime = aModule->m_LastEditTime;
m_Link = aModule->m_Link;
m_Path = aModule->m_Path; //is this correct behavior?
SetTimeStamp( GetNewTimeStamp() );
m_LocalClearance = aModule->m_LocalClearance;
m_LocalSolderMaskMargin = aModule->m_LocalSolderMaskMargin;
m_LocalSolderPasteMargin = aModule->m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = aModule->m_LocalSolderPasteMarginRatio;
m_ZoneConnection = aModule->m_ZoneConnection;
m_ThermalWidth = aModule->m_ThermalWidth;
m_ThermalGap = aModule->m_ThermalGap;
// Copy reference and value.
m_Reference->Copy( aModule->m_Reference );
m_Value->Copy( aModule->m_Value );
// Copy auxiliary data: Pads
m_Pads.DeleteAll();
for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() )
{
D_PAD* newpad = new D_PAD( this );
newpad->Copy( pad );
m_Pads.PushBack( newpad );
}
// Copy auxiliary data: Drawings
m_Drawings.DeleteAll();
for( BOARD_ITEM* item = aModule->m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* textm = new TEXTE_MODULE( this );
textm->Copy( static_cast<TEXTE_MODULE*>( item ) );
m_Drawings.PushBack( textm );
break;
}
case PCB_MODULE_EDGE_T:
{
EDGE_MODULE * edge;
edge = new EDGE_MODULE( this );
edge->Copy( (EDGE_MODULE*) item );
m_Drawings.PushBack( edge );
break;
}
default:
wxLogMessage( wxT( "MODULE::Copy() Internal Err: unknown type" ) );
break;
}
}
// Copy auxiliary data: 3D_Drawings info
m_3D_Drawings.clear();
m_3D_Drawings = aModule->m_3D_Drawings;
m_Doc = aModule->m_Doc;
m_KeyWord = aModule->m_KeyWord;
// Ensure auxiliary data is up to date
CalculateBoundingBox();
}
void MODULE::Add( BOARD_ITEM* aBoardItem, bool doAppend )
{
switch( aBoardItem->Type() )

View File

@ -84,6 +84,8 @@ public:
~MODULE();
MODULE& operator=( const MODULE& aOther );
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return PCB_MODULE_T == aItem->Type();
@ -92,8 +94,6 @@ public:
MODULE* Next() const { return static_cast<MODULE*>( Pnext ); }
MODULE* Back() const { return static_cast<MODULE*>( Pback ); }
void Copy( MODULE* Module ); // Copy structure
/**
* Function Add
* adds the given item to this MODULE and takes ownership of its memory.

View File

@ -423,41 +423,6 @@ bool D_PAD::IncrementPadName( bool aSkipUnconnectable, bool aFillSequenceGaps )
}
void D_PAD::Copy( D_PAD* source )
{
if( source == NULL )
return;
m_Pos = source->m_Pos;
m_layerMask = source->m_layerMask;
m_NumPadName = source->m_NumPadName;
m_netinfo = source->m_netinfo;
m_Drill = source->m_Drill;
m_drillShape = source->m_drillShape;
m_Offset = source->m_Offset;
m_Size = source->m_Size;
m_DeltaSize = source->m_DeltaSize;
m_Pos0 = source->m_Pos0;
m_boundingRadius = source->m_boundingRadius;
m_padShape = source->m_padShape;
m_Attribute = source->m_Attribute;
m_Orient = source->m_Orient;
m_LengthPadToDie = source->m_LengthPadToDie;
m_LocalClearance = source->m_LocalClearance;
m_LocalSolderMaskMargin = source->m_LocalSolderMaskMargin;
m_LocalSolderPasteMargin = source->m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = source->m_LocalSolderPasteMarginRatio;
m_ZoneConnection = source->m_ZoneConnection;
m_ThermalWidth = source->m_ThermalWidth;
m_ThermalGap = source->m_ThermalGap;
m_padRoundRectRadiusScale = source->m_padRoundRectRadiusScale;
SetSubRatsnest( 0 );
SetSubNet( 0 );
}
void D_PAD::CopyNetlistSettings( D_PAD* aPad, bool aCopyLocalSettings )
{
// Don't do anything foolish like trying to copy to yourself.

View File

@ -82,8 +82,8 @@ public:
public:
D_PAD( MODULE* parent );
// Do not create a copy constructor. The one generated by the compiler is adequate.
// D_PAD( const D_PAD& o );
// Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate.
/* Default layers used for pads, according to the pad type.
* this is default values only, they can be changed for a given pad
@ -99,8 +99,6 @@ public:
return aItem && PCB_PAD_T == aItem->Type();
}
void Copy( D_PAD* source );
D_PAD* Next() const { return static_cast<D_PAD*>( Pnext ); }
MODULE* GetParent() const { return (MODULE*) m_Parent; }

View File

@ -60,27 +60,6 @@ TEXTE_PCB:: ~TEXTE_PCB()
}
void TEXTE_PCB::Copy( TEXTE_PCB* source )
{
m_Parent = source->m_Parent;
Pback = Pnext = NULL;
m_Mirror = source->m_Mirror;
m_Size = source->m_Size;
m_Orient = source->m_Orient;
m_Pos = source->m_Pos;
m_Layer = source->m_Layer;
m_Thickness = source->m_Thickness;
m_Attributs = source->m_Attributs;
m_Italic = source->m_Italic;
m_Bold = source->m_Bold;
m_HJustify = source->m_HJustify;
m_VJustify = source->m_VJustify;
m_MultilineAllowed = source->m_MultilineAllowed;
m_Text = source->m_Text;
}
void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE DrawMode, const wxPoint& offset )
{

View File

@ -45,7 +45,8 @@ class TEXTE_PCB : public BOARD_ITEM, public EDA_TEXT
public:
TEXTE_PCB( BOARD_ITEM* parent );
// Do not create a copy constructor. The one generated by the compiler is adequate.
// Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate.
~TEXTE_PCB();
@ -73,9 +74,6 @@ public:
void Flip( const wxPoint& aCentre );
/* duplicate structure */
void Copy( TEXTE_PCB* source );
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset );

View File

@ -124,27 +124,6 @@ void TEXTE_MODULE::Move( const wxPoint& aMoveVector )
}
void TEXTE_MODULE::Copy( TEXTE_MODULE* source )
{
if( source == NULL )
return;
m_Pos = source->m_Pos;
SetLayer( source->GetLayer() );
m_Mirror = source->m_Mirror;
m_NoShow = source->m_NoShow;
m_Type = source->m_Type;
m_Orient = source->m_Orient;
m_Pos0 = source->m_Pos0;
m_Size = source->m_Size;
m_Thickness = source->m_Thickness;
m_Italic = source->m_Italic;
m_Bold = source->m_Bold;
m_Text = source->m_Text;
}
int TEXTE_MODULE::GetLength() const
{
return m_Text.Len();

View File

@ -64,7 +64,8 @@ public:
TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type = TEXT_is_DIVERS );
// Do not create a copy constructor. The one generated by the compiler is adequate.
// Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate.
~TEXTE_MODULE();
@ -112,8 +113,6 @@ public:
void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; SetDrawCoord(); }
const wxPoint& GetPos0() const { return m_Pos0; }
void Copy( TEXTE_MODULE* source ); // copy structure
int GetLength() const; // text length
/**

View File

@ -105,6 +105,32 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :
}
ZONE_CONTAINER& ZONE_CONTAINER::operator=( const ZONE_CONTAINER& aOther )
{
BOARD_CONNECTED_ITEM::operator=( aOther );
m_Poly->RemoveAllContours();
m_Poly->Copy( aOther.m_Poly ); // copy outlines
m_CornerSelection = -1; // for corner moving, corner index to drag or -1 if no selection
m_ZoneClearance = aOther.m_ZoneClearance; // clearance value
m_ZoneMinThickness = aOther.m_ZoneMinThickness;
m_FillMode = aOther.m_FillMode; // filling mode (segments/polygons)
m_ArcToSegmentsCount = aOther.m_ArcToSegmentsCount;
m_PadConnection = aOther.m_PadConnection;
m_ThermalReliefGap = aOther.m_ThermalReliefGap;
m_ThermalReliefCopperBridge = aOther.m_ThermalReliefCopperBridge;
m_Poly->SetHatchStyle( aOther.m_Poly->GetHatchStyle() );
m_Poly->SetHatchPitch( aOther.m_Poly->GetHatchPitch() );
m_Poly->m_HatchLines = aOther.m_Poly->m_HatchLines; // copy vector <CSegment>
m_FilledPolysList.RemoveAllContours();
m_FilledPolysList.Append( aOther.m_FilledPolysList );
m_FillSegmList.clear();
m_FillSegmList = aOther.m_FillSegmList;
return *this;
}
ZONE_CONTAINER::~ZONE_CONTAINER()
{
delete m_Poly;
@ -751,33 +777,6 @@ void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref )
}
void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src )
{
m_Parent = src->m_Parent;
m_Layer = src->m_Layer;
SetNetCode( src->GetNetCode() );
SetTimeStamp( src->m_TimeStamp );
m_Poly->RemoveAllContours();
m_Poly->Copy( src->m_Poly ); // copy outlines
m_CornerSelection = -1; // For corner moving, corner index to drag,
// or -1 if no selection
m_ZoneClearance = src->m_ZoneClearance; // clearance value
m_ZoneMinThickness = src->m_ZoneMinThickness;
m_FillMode = src->m_FillMode; // Filling mode (segments/polygons)
m_ArcToSegmentsCount = src->m_ArcToSegmentsCount;
m_PadConnection = src->m_PadConnection;
m_ThermalReliefGap = src->m_ThermalReliefGap;
m_ThermalReliefCopperBridge = src->m_ThermalReliefCopperBridge;
m_Poly->SetHatchStyle( src->m_Poly->GetHatchStyle() );
m_Poly->SetHatchPitch( src->m_Poly->GetHatchPitch() );
m_Poly->m_HatchLines = src->m_Poly->m_HatchLines; // Copy vector <CSegment>
m_FilledPolysList.RemoveAllContours();
m_FilledPolysList.Append( src->m_FilledPolysList );
m_FillSegmList.clear();
m_FillSegmList = src->m_FillSegmList;
}
ZoneConnection ZONE_CONTAINER::GetPadConnection( D_PAD* aPad ) const
{
if( aPad == NULL || aPad->GetZoneConnection() == PAD_ZONE_CONN_INHERITED )

View File

@ -82,6 +82,7 @@ public:
ZONE_CONTAINER( BOARD* parent );
ZONE_CONTAINER( const ZONE_CONTAINER& aZone );
ZONE_CONTAINER& operator=( const ZONE_CONTAINER &aOther );
~ZONE_CONTAINER();
@ -104,13 +105,6 @@ public:
*/
unsigned GetPriority() const { return m_priority; }
/**
* Function copy
* copy useful data from the source.
* flags and linked list pointers are NOT copied
*/
void Copy( ZONE_CONTAINER* src );
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
/**

View File

@ -325,10 +325,10 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
}
m_ReferenceCopy = new TEXTE_MODULE( NULL );
m_ValueCopy = new TEXTE_MODULE( NULL );
m_ReferenceCopy->Copy( &m_CurrentModule->Reference() );
m_ValueCopy->Copy( &m_CurrentModule->Value() );
m_ReferenceCopy = new TEXTE_MODULE( m_CurrentModule->Reference() );
m_ReferenceCopy->SetParent( m_CurrentModule );
m_ValueCopy = new TEXTE_MODULE( m_CurrentModule->Value() );
m_ValueCopy->SetParent( m_CurrentModule );
m_ReferenceCtrl->SetValue( m_ReferenceCopy->GetText() );
m_ValueCtrl->SetValue( m_ValueCopy->GetText() );
@ -634,8 +634,10 @@ bool DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow()
}
// Init Fields (should be first, because they can be moved or/and flipped later):
m_CurrentModule->Reference().Copy( m_ReferenceCopy );
m_CurrentModule->Value().Copy( m_ValueCopy );
TEXTE_MODULE& reference = m_CurrentModule->Reference();
reference = *m_ReferenceCopy;
TEXTE_MODULE& value = m_CurrentModule->Value();
value = *m_ValueCopy;
// Initialize masks clearances
m_CurrentModule->SetLocalClearance( ValueFromTextCtrl( *m_NetClearanceValueCtrl ) );

View File

@ -165,10 +165,10 @@ void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
m_DocCtrl->SetValue( m_currentModule->GetDescription() );
m_KeywordCtrl->SetValue( m_currentModule->GetKeywords() );
m_referenceCopy = new TEXTE_MODULE( NULL );
m_valueCopy = new TEXTE_MODULE( NULL );
m_referenceCopy->Copy( &m_currentModule->Reference() );
m_valueCopy->Copy( &m_currentModule->Value() );
m_referenceCopy = new TEXTE_MODULE( m_currentModule->Reference() );
m_referenceCopy->SetParent( m_currentModule );
m_valueCopy = new TEXTE_MODULE( m_currentModule->Value() );
m_valueCopy->SetParent( m_currentModule );
m_ReferenceCtrl->SetValue( m_referenceCopy->GetText() );
m_ValueCtrl->SetValue( m_valueCopy->GetText() );
m_FootprintNameCtrl->SetValue( m_currentModule->GetFPID().Format() );
@ -493,8 +493,10 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
m_currentModule->SetFPID( FPID( footprintName ) );
// Init Fields:
m_currentModule->Reference().Copy( m_referenceCopy );
m_currentModule->Value().Copy( m_valueCopy );
TEXTE_MODULE& reference = m_currentModule->Reference();
reference = *m_referenceCopy;
TEXTE_MODULE& value = m_currentModule->Value();
value = *m_valueCopy;
// Initialize masks clearances
m_currentModule->SetLocalClearance( ValueFromTextCtrl( *m_NetClearanceValueCtrl ) );

View File

@ -117,9 +117,9 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP
m_dummyPad = new D_PAD( (MODULE*) NULL );
if( aPad )
m_dummyPad->Copy( aPad );
*m_dummyPad = *aPad;
else // We are editing a "master" pad, i.e. a template to create new pads
m_dummyPad->Copy( m_padMaster );
*m_dummyPad = *m_padMaster;
// Show the X and Y axis. It is usefull because pad shape can have an offset
// or be a complex shape.

View File

@ -136,7 +136,7 @@ void PCB_EDIT_FRAME::StartMoveTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC, bool aE
// if it is an existing item: prepare a copy to undo/abort command
if( !aTextePcb->IsNew() )
s_TextCopy.Copy( aTextePcb );
s_TextCopy = *aTextePcb;
aTextePcb->SetFlags( IS_MOVED );
SetMsgPanel( aTextePcb );
@ -192,7 +192,7 @@ TEXTE_PCB* PCB_EDIT_FRAME::CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText )
if( aText )
{
textePcb->Copy( aText );
*textePcb = *aText;
GetBoard()->Add( textePcb );
textePcb->SetFlags( IS_NEW );
if( aDC )

View File

@ -52,7 +52,7 @@ void PCB_BASE_FRAME::Export_Pad_Settings( D_PAD* aPad )
D_PAD& mp = GetDesignSettings().m_Pad_Master;
// Copy all settings. Some of them are not used, but they break anything
mp.Copy( aPad );
mp = *aPad;
// The pad orientation, for historical reasons is the
// pad rotation + parent rotation.
// store only the pad rotation.

View File

@ -108,8 +108,7 @@ void PCB_EDIT_FRAME::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* aZone )
void PCB_EDIT_FRAME::duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone )
{
ZONE_CONTAINER* newZone = new ZONE_CONTAINER( GetBoard() );
newZone->Copy( aZone );
ZONE_CONTAINER* newZone = new ZONE_CONTAINER( *aZone );
newZone->UnFill();
ZONE_SETTINGS zoneSettings;
zoneSettings << *aZone;

View File

@ -237,7 +237,7 @@ void UpdateCopyOfZonesList( PICKED_ITEMS_LIST& aPickList,
wxASSERT_MSG( zcopy != NULL,
wxT( "UpdateCopyOfZonesList() error: link = NULL" ) );
ref->Copy( zcopy );
*ref = *zcopy;
// the copy was deleted; the link does not exists now.
aPickList.SetPickedItemLink( NULL, kk );