Commit 409d6e8e authored by Wayne Stambaugh's avatar Wayne Stambaugh

Eeschema schematic object improvements.

* Remove unnecessary copy constructors from schematic and component
  library objects.
* Add comment to class definitions where the default copy constructor
  generated by the compiler was adequate.
* Add assignment operator to EDA_ITEM, SCH_ITEM, and all schematic
  objects where the default assignment operator generated by the
  compiler would not be adequate.
parent d000d486
......@@ -212,6 +212,27 @@ bool EDA_ITEM::operator<( const EDA_ITEM& aItem ) const
}
EDA_ITEM& EDA_ITEM::operator=( const EDA_ITEM& aItem )
{
wxCHECK_MSG( Type() == aItem.Type(), *this,
wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
GetClass() );
if( &aItem != this )
{
// Do not assign the linked list pointers.
m_StructType = aItem.m_StructType;
m_Parent = aItem.m_Parent;
m_Son = aItem.m_Son;
m_Flags = aItem.m_Flags;
SetTimeStamp( aItem.m_TimeStamp );
m_Status = aItem.m_Status;
}
return *this;
}
#if defined(DEBUG)
// A function that should have been in wxWidgets
......
......@@ -102,6 +102,23 @@ bool SCH_ITEM::operator < ( const SCH_ITEM& aItem ) const
}
SCH_ITEM& SCH_ITEM::operator=( const SCH_ITEM& aItem )
{
wxCHECK_MSG( Type() == aItem.Type(), *this,
wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
GetClass() );
if( &aItem != this )
{
EDA_ITEM::operator=( aItem );
m_Layer = aItem.m_Layer;
m_connections = aItem.m_connections;
}
return *this;
}
void SCH_ITEM::doPlot( PLOTTER* aPlotter )
{
wxFAIL_MSG( wxT( "doPlot() method not implemented for class " ) + GetClass() );
......
/**
* @file edit_bitmap.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
......@@ -26,6 +22,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file edit_bitmap.cpp
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "macros.h"
......@@ -39,6 +39,9 @@
#include "sch_bitmap.h"
#include "dialog_image_editor.h"
#include <algorithm>
static void abortMoveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
......@@ -67,7 +70,7 @@ static void abortMoveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
// Never delete existing item, because it can be referenced by an undo/redo command
// Just restore its data
item->SwapData( olditem );
swap( *item, *olditem );
}
screen->SetCurItem( item );
......
......@@ -92,19 +92,6 @@ LIB_ARC::LIB_ARC( LIB_COMPONENT* aParent ) : LIB_ITEM( LIB_ARC_T, aParent )
}
LIB_ARC::LIB_ARC( const LIB_ARC& aArc ) : LIB_ITEM( aArc )
{
m_Radius = aArc.m_Radius;
m_t1 = aArc.m_t1;
m_t2 = aArc.m_t2;
m_Width = aArc.m_Width;
m_Fill = aArc.m_Fill;
m_Pos = aArc.m_Pos;
m_ArcStart = aArc.m_ArcStart;
m_ArcEnd = aArc.m_ArcEnd;
}
bool LIB_ARC::Save( OUTPUTFORMATTER& aFormatter )
{
int x1 = m_t1;
......
......@@ -85,7 +85,9 @@ class LIB_ARC : public LIB_ITEM
public:
LIB_ARC( LIB_COMPONENT * aParent );
LIB_ARC( const LIB_ARC& aArc );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~LIB_ARC() { }
virtual wxString GetClass() const
......
......@@ -53,15 +53,6 @@ LIB_BEZIER::LIB_BEZIER( LIB_COMPONENT* aParent ) :
}
LIB_BEZIER::LIB_BEZIER( const LIB_BEZIER& aBezier ) : LIB_ITEM( aBezier )
{
m_PolyPoints = aBezier.m_PolyPoints;
m_BezierPoints = aBezier.m_BezierPoints; // Vector copy
m_Width = aBezier.m_Width;
m_Fill = aBezier.m_Fill;
}
bool LIB_BEZIER::Save( OUTPUTFORMATTER& aFormatter )
{
int ccount = GetCornerCount();
......
......@@ -51,7 +51,9 @@ class LIB_BEZIER : public LIB_ITEM
public:
LIB_BEZIER( LIB_COMPONENT * aParent );
LIB_BEZIER( const LIB_BEZIER& aBezier );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~LIB_BEZIER() { }
virtual wxString GetClass() const
......
......@@ -54,16 +54,6 @@ LIB_CIRCLE::LIB_CIRCLE( LIB_COMPONENT* aParent ) :
}
LIB_CIRCLE::LIB_CIRCLE( const LIB_CIRCLE& aCircle ) :
LIB_ITEM( aCircle )
{
m_Pos = aCircle.m_Pos;
m_Radius = aCircle.m_Radius;
m_Fill = aCircle.m_Fill;
m_Width = aCircle.m_Width;
}
bool LIB_CIRCLE::Save( OUTPUTFORMATTER& aFormatter )
{
aFormatter.Print( 0, "C %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y,
......
......@@ -54,7 +54,9 @@ class LIB_CIRCLE : public LIB_ITEM
public:
LIB_CIRCLE( LIB_COMPONENT * aParent );
LIB_CIRCLE( const LIB_CIRCLE& aCircle );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~LIB_CIRCLE() { }
virtual wxString GetClass() const
......
......@@ -58,18 +58,6 @@ LIB_ITEM::LIB_ITEM( KICAD_T aType,
}
LIB_ITEM::LIB_ITEM( const LIB_ITEM& aItem ) :
EDA_ITEM( aItem )
{
m_Unit = aItem.m_Unit;
m_Convert = aItem.m_Convert;
m_Fill = aItem.m_Fill;
m_typeName = aItem.m_typeName;
m_isFillable = aItem.m_isFillable;
m_eraseLastDrawItem = false;
}
void LIB_ITEM::DisplayInfo( EDA_DRAW_FRAME* aFrame )
{
wxString msg;
......@@ -81,6 +69,7 @@ void LIB_ITEM::DisplayInfo( EDA_DRAW_FRAME* aFrame )
msg = _( "All" );
else
msg.Printf( wxT( "%d" ), m_Unit );
aFrame->AppendMsgPanel( _( "Unit" ), msg, BROWN );
if( m_Convert == 0 )
......@@ -91,6 +80,7 @@ void LIB_ITEM::DisplayInfo( EDA_DRAW_FRAME* aFrame )
msg = _( "yes" );
else
msg = wxT( "?" );
aFrame->AppendMsgPanel( _( "Convert" ), msg, BROWN );
}
......
......@@ -143,7 +143,7 @@ public:
int aConvert = 0,
FILL_T aFillType = NO_FILL );
LIB_ITEM( const LIB_ITEM& aItem );
// Do not create a copy constructor. The one generated by the compiler is adequate.
virtual ~LIB_ITEM() { }
......
......@@ -59,23 +59,6 @@ LIB_FIELD::LIB_FIELD( int idfield ) : LIB_ITEM( LIB_FIELD_T, NULL )
}
LIB_FIELD::LIB_FIELD( const LIB_FIELD& field ) : LIB_ITEM( field )
{
m_id = field.m_id;
m_Pos = field.m_Pos;
m_Size = field.m_Size;
m_Thickness = field.m_Thickness;
m_Orient = field.m_Orient;
m_Attributs = field.m_Attributs;
m_Text = field.m_Text;
m_name = field.m_name;
m_HJustify = field.m_HJustify;
m_VJustify = field.m_VJustify;
m_Italic = field.m_Italic;
m_Bold = field.m_Bold;
}
LIB_FIELD::~LIB_FIELD()
{
}
......
......@@ -83,8 +83,11 @@ class LIB_FIELD : public LIB_ITEM, public EDA_TEXT
public:
LIB_FIELD( int idfield = 2 );
LIB_FIELD( LIB_COMPONENT * aParent, int idfield = 2 );
LIB_FIELD( const LIB_FIELD& field );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~LIB_FIELD();
virtual wxString GetClass() const
......
......@@ -198,22 +198,6 @@ LIB_PIN::LIB_PIN( LIB_COMPONENT* aParent ) :
}
LIB_PIN::LIB_PIN( const LIB_PIN& pin ) : LIB_ITEM( pin )
{
m_position = pin.m_position;
m_length = pin.m_length;
m_orientation = pin.m_orientation;
m_shape = pin.m_shape;
m_type = pin.m_type;
m_attributes = pin.m_attributes;
m_number = pin.m_number;
m_numTextSize = pin.m_numTextSize;
m_nameTextSize = pin.m_nameTextSize;
m_width = pin.m_width;
m_name = pin.m_name;
}
void LIB_PIN::SetName( const wxString& aName )
{
wxString tmp = ( aName.IsEmpty() ) ? wxT( "~" ) : aName;
......
......@@ -125,7 +125,9 @@ class LIB_PIN : public LIB_ITEM
public:
LIB_PIN( LIB_COMPONENT* aParent );
LIB_PIN( const LIB_PIN& aPin );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~LIB_PIN() { }
virtual wxString GetClass() const
......
......@@ -54,14 +54,6 @@ LIB_POLYLINE::LIB_POLYLINE( LIB_COMPONENT* aParent ) :
}
LIB_POLYLINE::LIB_POLYLINE( const LIB_POLYLINE& polyline ) :
LIB_ITEM( polyline )
{
m_PolyPoints = polyline.m_PolyPoints; // Vector copy
m_Width = polyline.m_Width;
}
bool LIB_POLYLINE::Save( OUTPUTFORMATTER& aFormatter )
{
int ccount = GetCornerCount();
......
......@@ -55,7 +55,9 @@ class LIB_POLYLINE : public LIB_ITEM
public:
LIB_POLYLINE( LIB_COMPONENT * aParent );
LIB_POLYLINE( const LIB_POLYLINE& aPolyline );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~LIB_POLYLINE() { }
virtual wxString GetClass() const
......
......@@ -55,16 +55,6 @@ LIB_RECTANGLE::LIB_RECTANGLE( LIB_COMPONENT* aParent ) :
}
LIB_RECTANGLE::LIB_RECTANGLE( const LIB_RECTANGLE& aRect ) :
LIB_ITEM( aRect )
{
m_Pos = aRect.m_Pos;
m_End = aRect.m_End;
m_Width = aRect.m_Width;
m_Fill = aRect.m_Fill;
}
bool LIB_RECTANGLE::Save( OUTPUTFORMATTER& aFormatter )
{
aFormatter.Print( 0, "S %d %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y,
......
......@@ -55,10 +55,11 @@ class LIB_RECTANGLE : public LIB_ITEM
*/
void calcEdit( const wxPoint& aPosition );
public:
public:
LIB_RECTANGLE( LIB_COMPONENT * aParent );
LIB_RECTANGLE( const LIB_RECTANGLE& aRect );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~LIB_RECTANGLE() { }
virtual wxString GetClass() const
......
......@@ -44,7 +44,7 @@
#include "lib_text.h"
LIB_TEXT::LIB_TEXT(LIB_COMPONENT * aParent) :
LIB_TEXT::LIB_TEXT( LIB_COMPONENT * aParent ) :
LIB_ITEM( LIB_TEXT_T, aParent ),
EDA_TEXT()
{
......
......@@ -62,7 +62,9 @@ class LIB_TEXT : public LIB_ITEM, public EDA_TEXT
public:
LIB_TEXT( LIB_COMPONENT * aParent );
LIB_TEXT( const LIB_TEXT& aText );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~LIB_TEXT() { }
virtual wxString GetClass() const
......
......@@ -67,6 +67,27 @@ SCH_BITMAP::SCH_BITMAP( const SCH_BITMAP& aSchBitmap ) :
}
SCH_ITEM& SCH_BITMAP::operator=( const SCH_ITEM& aItem )
{
wxCHECK_MSG( Type() == aItem.Type(), *this,
wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
GetClass() );
if( &aItem != this )
{
SCH_ITEM::operator=( aItem );
SCH_BITMAP* bitmap = (SCH_BITMAP*) &aItem;
delete m_Image;
m_Image = new BITMAP_BASE( *bitmap->m_Image );
m_Pos = bitmap->m_Pos;
}
return *this;
}
bool SCH_BITMAP::ReadImageFile( const wxString& aFullFilename )
{
return m_Image->ReadImageFile( aFullFilename );
......
......@@ -53,6 +53,7 @@ public:
delete m_Image;
}
SCH_ITEM& operator=( const SCH_ITEM& aItem );
/*
* Accessors:
......
......@@ -61,15 +61,6 @@ SCH_BUS_ENTRY::SCH_BUS_ENTRY( const wxPoint& pos, int shape, int id ) :
}
SCH_BUS_ENTRY::SCH_BUS_ENTRY( const SCH_BUS_ENTRY& aBusEntry ) :
SCH_ITEM( aBusEntry )
{
m_pos = aBusEntry.m_pos;
m_size = aBusEntry.m_size;
m_width = aBusEntry.m_width;
}
EDA_ITEM* SCH_BUS_ENTRY::doClone() const
{
return new SCH_BUS_ENTRY( *this );
......
......@@ -53,7 +53,7 @@ class SCH_BUS_ENTRY : public SCH_ITEM
public:
SCH_BUS_ENTRY( const wxPoint& pos = wxPoint( 0, 0 ), int shape = '\\', int id = WIRE_TO_BUS );
SCH_BUS_ENTRY( const SCH_BUS_ENTRY& aBusEntry );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~SCH_BUS_ENTRY() { }
......
......@@ -1780,6 +1780,37 @@ bool SCH_COMPONENT::operator <( const SCH_ITEM& aItem ) const
}
SCH_ITEM& SCH_COMPONENT::operator=( const SCH_ITEM& aItem )
{
wxCHECK_MSG( Type() == aItem.Type(), *this,
wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
GetClass() );
if( &aItem != this )
{
SCH_ITEM::operator=( aItem );
SCH_COMPONENT* component = (SCH_COMPONENT*) &aItem;
m_ChipName = component->m_ChipName;
m_Pos = component->m_Pos;
m_unit = component->m_unit;
m_convert = component->m_convert;
m_transform = component->m_transform;
m_PathsAndReferences = component->m_PathsAndReferences;
m_Fields = component->m_Fields; // std::vector's assignment operator.
// Reparent fields after assignment to new component.
for( int ii = 0; ii < GetFieldCount(); ++ii )
{
GetField( ii )->SetParent( this );
}
}
return *this;
}
bool SCH_COMPONENT::doHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
EDA_RECT bBox = GetBodyBoundingBox();
......
......@@ -401,6 +401,8 @@ public:
virtual bool operator <( const SCH_ITEM& aItem ) const;
SCH_ITEM& operator=( const SCH_ITEM& aItem );
/**
* @copydoc EDA_ITEM::IsReplaceable()
*/
......
......@@ -80,15 +80,6 @@ SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent,
}
SCH_FIELD::SCH_FIELD( const SCH_FIELD& aField ) :
SCH_ITEM( aField ),
EDA_TEXT( aField )
{
m_id = aField.m_id;
m_name = aField.m_name;
}
SCH_FIELD::~SCH_FIELD()
{
}
......
......@@ -50,7 +50,7 @@ class LIB_FIELD;
* <li>Field 1 is reserved for the component value.</li>
* <li>Field 2 is reserved for the component footprint.</li>
* <li>Field 3 is reserved for the component data sheet file.</li>
* <li>Fields 4 and higher are user defineable.</li></ul>
* <li>Field 4 and higher are user defineable.</li></ul>
*/
class SCH_FIELD : public SCH_ITEM, public EDA_TEXT
......@@ -63,7 +63,7 @@ public:
SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent,
wxString aName = wxEmptyString );
SCH_FIELD( const SCH_FIELD& aField );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~SCH_FIELD();
......
......@@ -53,14 +53,6 @@ SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) :
}
SCH_JUNCTION::SCH_JUNCTION( const SCH_JUNCTION& aJunction ) :
SCH_ITEM( aJunction )
{
m_pos = aJunction.m_pos;
m_size = aJunction.m_size;
}
bool SCH_JUNCTION::Save( FILE* aFile ) const
{
bool success = true;
......
......@@ -42,7 +42,7 @@ class SCH_JUNCTION : public SCH_ITEM
public:
SCH_JUNCTION( const wxPoint& pos = wxPoint( 0, 0 ) );
SCH_JUNCTION( const SCH_JUNCTION& aJunction );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~SCH_JUNCTION() { }
......
......@@ -49,7 +49,9 @@ class SCH_LINE : public SCH_ITEM
public:
SCH_LINE( const wxPoint& pos = wxPoint( 0, 0 ), int layer = LAYER_NOTES );
SCH_LINE( const SCH_LINE& aLine );
~SCH_LINE() { }
SCH_LINE* Next() const { return (SCH_LINE*) Pnext; }
......
......@@ -43,13 +43,6 @@ SCH_MARKER::SCH_MARKER( const wxPoint& pos, const wxString& text ) :
}
SCH_MARKER::SCH_MARKER( const SCH_MARKER& aMarker ) :
SCH_ITEM( aMarker ),
MARKER_BASE( aMarker )
{
}
SCH_MARKER::~SCH_MARKER()
{
}
......
......@@ -55,8 +55,11 @@ class SCH_MARKER : public SCH_ITEM, public MARKER_BASE
{
public:
SCH_MARKER();
SCH_MARKER( const wxPoint& aPos, const wxString& aText );
SCH_MARKER( const SCH_MARKER& aMarker );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~SCH_MARKER();
virtual wxString GetClass() const
......
......@@ -55,14 +55,6 @@ SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) :
}
SCH_NO_CONNECT::SCH_NO_CONNECT( const SCH_NO_CONNECT& aNoConnect ) :
SCH_ITEM( aNoConnect )
{
m_pos = aNoConnect.m_pos;
m_size = aNoConnect.m_size;
}
EDA_ITEM* SCH_NO_CONNECT::doClone() const
{
return new SCH_NO_CONNECT( *this );
......
......@@ -42,7 +42,7 @@ class SCH_NO_CONNECT : public SCH_ITEM
public:
SCH_NO_CONNECT( const wxPoint& pos = wxPoint( 0, 0 ) );
SCH_NO_CONNECT( const SCH_NO_CONNECT& aNoConnect );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~SCH_NO_CONNECT() { }
......
......@@ -60,14 +60,6 @@ SCH_POLYLINE::SCH_POLYLINE( int layer ) :
}
SCH_POLYLINE::SCH_POLYLINE( const SCH_POLYLINE& aPolyLine ) :
SCH_ITEM( aPolyLine )
{
m_width = aPolyLine.m_width;
m_points = aPolyLine.m_points;
}
SCH_POLYLINE::~SCH_POLYLINE()
{
}
......
......@@ -43,7 +43,7 @@ class SCH_POLYLINE : public SCH_ITEM
public:
SCH_POLYLINE( int layer = LAYER_NOTES );
SCH_POLYLINE( const SCH_POLYLINE& aPolyLine );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~SCH_POLYLINE();
......
......@@ -1181,6 +1181,39 @@ void SCH_SHEET::doPlot( PLOTTER* aPlotter )
}
SCH_ITEM& SCH_SHEET::operator=( const SCH_ITEM& aItem )
{
wxLogDebug( wxT( "Sheet assignment operator." ) );
wxCHECK_MSG( Type() == aItem.Type(), *this,
wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
GetClass() );
if( &aItem != this )
{
SCH_ITEM::operator=( aItem );
SCH_SHEET* sheet = (SCH_SHEET*) &aItem;
m_pos = sheet->m_pos;
m_size = sheet->m_size;
m_name = sheet->m_name;
m_sheetNameSize = sheet->m_sheetNameSize;
m_fileNameSize = sheet->m_fileNameSize;
m_pins = sheet->m_pins;
// Ensure sheet labels have their #m_Parent member pointing really on their
// parent, after assigning.
BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, m_pins )
{
sheetPin.SetParent( this );
}
}
return *this;
}
#if defined(DEBUG)
void SCH_SHEET::Show( int nestLevel, std::ostream& os ) const
......
......@@ -88,7 +88,7 @@ public:
const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
SCH_SHEET_PIN( const SCH_SHEET_PIN& aSheetLabel );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~SCH_SHEET_PIN() { }
......@@ -273,6 +273,11 @@ class SCH_SHEET : public SCH_ITEM
public:
SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) );
/**
* Copy Constructor
* clones \a aSheet into a new object. All sheet pins are copied as is except and
* the SCH_SHEET_PIN's #m_Parent pointers are set to the new copied parent object.
*/
SCH_SHEET( const SCH_SHEET& aSheet );
~SCH_SHEET();
......@@ -625,6 +630,8 @@ public:
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath );
SCH_ITEM& operator=( const SCH_ITEM& aSheet );
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override
#endif
......
......@@ -62,14 +62,6 @@ SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos, const wxStr
}
SCH_SHEET_PIN::SCH_SHEET_PIN( const SCH_SHEET_PIN& aSheetLabel ) :
SCH_HIERLABEL( aSheetLabel )
{
m_number = aSheetLabel.m_number;
m_edge = aSheetLabel.m_edge;
}
EDA_ITEM* SCH_SHEET_PIN::doClone() const
{
return new SCH_SHEET_PIN( *this );
......
......@@ -759,12 +759,6 @@ SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) :
}
SCH_LABEL::SCH_LABEL( const SCH_LABEL& aLabel ) :
SCH_TEXT( aLabel )
{
}
EDA_ITEM* SCH_LABEL::doClone() const
{
return new SCH_LABEL( *this );
......@@ -967,12 +961,6 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) :
}
SCH_GLOBALLABEL::SCH_GLOBALLABEL( const SCH_GLOBALLABEL& aGlobalLabel ) :
SCH_TEXT( aGlobalLabel )
{
}
EDA_ITEM* SCH_GLOBALLABEL::doClone() const
{
return new SCH_GLOBALLABEL( *this );
......@@ -1402,12 +1390,6 @@ SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T
}
SCH_HIERLABEL::SCH_HIERLABEL( const SCH_HIERLABEL& aHierLabel ) :
SCH_TEXT( aHierLabel )
{
}
EDA_ITEM* SCH_HIERLABEL::doClone() const
{
return new SCH_HIERLABEL( *this );
......
......@@ -79,6 +79,13 @@ public:
const wxString& text = wxEmptyString,
KICAD_T aType = SCH_TEXT_T );
/**
* Copy Constructor
* clones \a aText into a new object. All members are copied as is except
* for the #m_isDangling member which is set to false. This prevents newly
* copied objects derived from #SCH_TEXT from having their connection state
* improperly set.
*/
SCH_TEXT( const SCH_TEXT& aText );
~SCH_TEXT() { }
......@@ -257,7 +264,7 @@ class SCH_LABEL : public SCH_TEXT
public:
SCH_LABEL( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
SCH_LABEL( const SCH_LABEL& aLabel );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~SCH_LABEL() { }
......@@ -352,7 +359,7 @@ class SCH_GLOBALLABEL : public SCH_TEXT
public:
SCH_GLOBALLABEL( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
SCH_GLOBALLABEL( const SCH_GLOBALLABEL& aGlobalLabel );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~SCH_GLOBALLABEL() { }
......@@ -458,7 +465,7 @@ public:
const wxString& text = wxEmptyString,
KICAD_T aType = SCH_HIERARCHICAL_LABEL_T );
SCH_HIERLABEL( const SCH_HIERLABEL& aHierLabel );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~SCH_HIERLABEL() { }
......
......@@ -698,6 +698,15 @@ public:
*/
static bool Sort( const EDA_ITEM* aLeft, const EDA_ITEM* aRight ) { return *aLeft < *aRight; }
/**
* 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 );
#if defined(DEBUG)
/**
......
......@@ -141,7 +141,7 @@ public:
SCH_ITEM* Clone() const { return ( SCH_ITEM* ) EDA_ITEM::Clone(); }
/**
* Function SwapDate
* Function SwapData
* swap the internal data structures \a aItem with the schematic item.
* Obviously, aItem must have the same type than me
* @param aItem The item to swap the data structures with.
......@@ -352,6 +352,8 @@ public:
virtual bool operator <( const SCH_ITEM& aItem ) const;
virtual SCH_ITEM& operator=( const SCH_ITEM& aItem );
/**
* @note - The DoXXX() functions below are used to enforce the interface while retaining
* the ability of change the implementation behavior of derived classes. See
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment