diff --git a/common/base_struct.cpp b/common/base_struct.cpp index 97abdc851b..a2119ab66b 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -99,17 +99,10 @@ void EDA_ITEM::SetModified() } -EDA_ITEM* EDA_ITEM::doClone() const -{ - wxCHECK_MSG( false, NULL, wxT( "doClone not implemented in derived class " ) + GetClass() + - wxT( ". Bad programmer." ) ); -} - - EDA_ITEM* EDA_ITEM::Clone() const { - // save about 6 bytes per call by hiding the virtual function in this non-inline function. - return doClone(); + wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() + + wxT( ". Bad programmer!" ) ); } @@ -272,9 +265,9 @@ std::ostream& EDA_ITEM::NestedSpace( int nestLevel, std::ostream& os ) #endif -/**************************************************/ -/* EDA_TEXT (basic class, not directly used */ -/**************************************************/ +/*******************************************/ +/* EDA_TEXT (base class, not directly used */ +/*******************************************/ EDA_TEXT::EDA_TEXT( const wxString& text ) { m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; // Width and height of font. diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 25d5c0f2e4..0440b6efb8 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -476,7 +476,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) if( m_itemToRepeat == NULL ) return; - m_itemToRepeat = m_itemToRepeat->Clone(); + m_itemToRepeat = (SCH_ITEM*) m_itemToRepeat->Clone(); if( m_itemToRepeat->Type() == SCH_COMPONENT_T ) // If repeat component then put in move mode { diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index a91c76778d..17007ca0ae 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -221,7 +221,7 @@ bool LIB_ARC::HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTran } -EDA_ITEM* LIB_ARC::doClone() const +EDA_ITEM* LIB_ARC::Clone() const { return new LIB_ARC( *this ); } diff --git a/eeschema/lib_arc.h b/eeschema/lib_arc.h index ecef241c86..a5a1e74986 100644 --- a/eeschema/lib_arc.h +++ b/eeschema/lib_arc.h @@ -106,12 +106,7 @@ public: virtual bool Load( LINE_READER& aLineReader, wxString& aErrorMsg ); - /** - * Tests if the given wxPoint is within the bounds of this object. - * - * @param aPosition - Coordinates to test - * @return - True if a hit, else false - */ + /** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ virtual bool HitTest( const wxPoint& aPosition ); /** @@ -204,8 +199,10 @@ public: /** @copydoc EDA_ITEM::GetMenuImage() */ virtual BITMAP_DEF GetMenuImage() const { return add_arc_xpm; } + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + private: - virtual EDA_ITEM* doClone() const; /** * Function compare diff --git a/eeschema/lib_bezier.cpp b/eeschema/lib_bezier.cpp index 4b5e51cdb8..0587b859bd 100644 --- a/eeschema/lib_bezier.cpp +++ b/eeschema/lib_bezier.cpp @@ -132,7 +132,7 @@ bool LIB_BEZIER::Load( LINE_READER& aLineReader, wxString& aErrorMsg ) } -EDA_ITEM* LIB_BEZIER::doClone() const +EDA_ITEM* LIB_BEZIER::Clone() const { return new LIB_BEZIER( *this ); } diff --git a/eeschema/lib_bezier.h b/eeschema/lib_bezier.h index 083ac5e1c6..084b4918cd 100644 --- a/eeschema/lib_bezier.h +++ b/eeschema/lib_bezier.h @@ -84,13 +84,8 @@ public: */ unsigned GetCornerCount() const { return m_PolyPoints.size(); } - /** - * Test if the given point is within the bounds of this object. - * - * @param aRefPos - A wxPoint to test - * @return true if a hit, else false - */ - virtual bool HitTest( const wxPoint& aRefPos ); + /** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ + virtual bool HitTest( const wxPoint& aPosition ); /** * @param aPosRef = a wxPoint to test @@ -160,8 +155,10 @@ public: virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame ); + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + private: - virtual EDA_ITEM* doClone() const; /** * Function compare diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index 2009248f0f..1c945c9a42 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -114,7 +114,7 @@ bool LIB_CIRCLE::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTra } -EDA_ITEM* LIB_CIRCLE::doClone() const +EDA_ITEM* LIB_CIRCLE::Clone() const { return new LIB_CIRCLE( *this ); } diff --git a/eeschema/lib_circle.h b/eeschema/lib_circle.h index 2385acb845..854aa9e385 100644 --- a/eeschema/lib_circle.h +++ b/eeschema/lib_circle.h @@ -75,13 +75,8 @@ public: virtual bool Load( LINE_READER& aLineReader, wxString& aErrorMsg ); - /** - * Test if the given point is within the bounds of this object. - * - * @param aPosRef - A wxPoint to test - * @return bool - true if a hit, else false - */ - virtual bool HitTest( const wxPoint& aPosRef ); + /** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ + virtual bool HitTest( const wxPoint& aPosition ); /** * @param aPosRef - a wxPoint to test @@ -174,8 +169,10 @@ public: /** @copydoc EDA_ITEM::GetMenuImage() */ virtual BITMAP_DEF GetMenuImage() const { return add_circle_xpm; } + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + private: - virtual EDA_ITEM* doClone() const; /** * Function compare diff --git a/eeschema/lib_draw_item.h b/eeschema/lib_draw_item.h index f099189ba5..930547464c 100644 --- a/eeschema/lib_draw_item.h +++ b/eeschema/lib_draw_item.h @@ -227,14 +227,7 @@ public: return (LIB_COMPONENT *)m_Parent; } - /** - * Tests if the given point is within the bounds of this object. - * - * Derived classes should override this function. - * - * @param aPosition - The coordinates to test. - * @return - true if a hit, else false - */ + /** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ virtual bool HitTest( const wxPoint& aPosition ) { return false; diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index bca677fcb9..0e6228eb39 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -369,7 +369,7 @@ bool LIB_FIELD::HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTr } -EDA_ITEM* LIB_FIELD::doClone() const +EDA_ITEM* LIB_FIELD::Clone() const { LIB_FIELD* newfield = new LIB_FIELD( m_id ); diff --git a/eeschema/lib_field.h b/eeschema/lib_field.h index adfe8034db..1bcfa2ddb9 100644 --- a/eeschema/lib_field.h +++ b/eeschema/lib_field.h @@ -187,13 +187,8 @@ public: */ virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame ); - /** - * Test if the given point is within the bounds of this object. - * - * @param aPosition A point to test in field coordinate system - * @return True if a hit, else false - */ - bool HitTest( const wxPoint& aPosition ); + /** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ + virtual bool HitTest( const wxPoint& aPosition ); /** * @param aPosition = a wxPoint to test @@ -325,8 +320,10 @@ public: /** @copydoc EDA_ITEM::GetMenuImage() */ virtual BITMAP_DEF GetMenuImage() const { return move_field_xpm; } + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + private: - virtual EDA_ITEM* doClone() const; /** * Function compare diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 4639c7b788..9034ec0e59 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -1670,7 +1670,7 @@ void LIB_PIN::SetPinNumFromString( wxString& buffer ) } -EDA_ITEM* LIB_PIN::doClone() const +EDA_ITEM* LIB_PIN::Clone() const { return new LIB_PIN( *this ); } diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h index be0e8f5abd..993ea559fa 100644 --- a/eeschema/lib_pin.h +++ b/eeschema/lib_pin.h @@ -149,17 +149,8 @@ public: virtual bool Load( LINE_READER& aLineReader, wxString& aErrorMsg ); - /** - * Function HitTest - * verifies that \a aRefPos within the bounds of this pin attached to \a aComponent. - *
- * The coordinates of the pin are calculated relative to \a aComponent if not NULL. - * Otherwise, the pin coordinates are relative to the library anchor position. - *
- * @param aRefPos A wxPoint to test - * @return True \a aRefPos lies within the pin bounding box else false. - */ - virtual bool HitTest( const wxPoint& aRefPos ); + /** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ + virtual bool HitTest( const wxPoint& aPosition ); /** * @param aPosRef - a wxPoint to test @@ -575,8 +566,10 @@ public: /** @copydoc EDA_ITEM::GetSelectMenuText() */ virtual wxString GetSelectMenuText() const; + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + private: - virtual EDA_ITEM* doClone() const; /** * Function compare diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp index 36a8e1f95c..3022fbb4c1 100644 --- a/eeschema/lib_polyline.cpp +++ b/eeschema/lib_polyline.cpp @@ -133,7 +133,7 @@ bool LIB_POLYLINE::Load( LINE_READER& aLineReader, wxString& aErrorMsg ) } -EDA_ITEM* LIB_POLYLINE::doClone() const +EDA_ITEM* LIB_POLYLINE::Clone() const { return new LIB_POLYLINE( *this ); } diff --git a/eeschema/lib_polyline.h b/eeschema/lib_polyline.h index 874172254e..d56156af31 100644 --- a/eeschema/lib_polyline.h +++ b/eeschema/lib_polyline.h @@ -88,12 +88,7 @@ public: */ unsigned GetCornerCount() const { return m_PolyPoints.size(); } - /** - * Test if the given point is within the bounds of this object. - * - * @param aPosition - A wxPoint to test - * @return - true if a hit, else false - */ + /** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ virtual bool HitTest( const wxPoint& aPosition ); /** @@ -190,8 +185,10 @@ public: /** @copydoc EDA_ITEM::GetMenuImage() */ virtual BITMAP_DEF GetMenuImage() const { return add_polygon_xpm; } + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + private: - virtual EDA_ITEM* doClone() const; /** * Function compare diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index d70e69ea40..bdab1b5f03 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -88,7 +88,7 @@ bool LIB_RECTANGLE::Load( LINE_READER& aLineReader, wxString& aErrorMsg ) } -EDA_ITEM* LIB_RECTANGLE::doClone() const +EDA_ITEM* LIB_RECTANGLE::Clone() const { return new LIB_RECTANGLE( *this ); } diff --git a/eeschema/lib_rectangle.h b/eeschema/lib_rectangle.h index 97b9191f25..5f1dd6c090 100644 --- a/eeschema/lib_rectangle.h +++ b/eeschema/lib_rectangle.h @@ -79,12 +79,7 @@ public: virtual bool Load( LINE_READER& aLineReader, wxString& aErrorMsg ); - /** - * Test if the given point is within the bounds of this object. - * - * @param aPosition - A wxPoint to test - * @return - true if a hit, else false - */ + /** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ virtual bool HitTest( const wxPoint& aPosition ); /** @@ -178,8 +173,10 @@ public: /** @copydoc EDA_ITEM::GetMenuImage() */ virtual BITMAP_DEF GetMenuImage() const { return add_rectangle_xpm; } + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + private: - virtual EDA_ITEM* doClone() const; /** * Function compare diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index 03ef17ca8a..2d34bfff6e 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -214,7 +214,7 @@ bool LIB_TEXT::HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTra } -EDA_ITEM* LIB_TEXT::doClone() const +EDA_ITEM* LIB_TEXT::Clone() const { LIB_TEXT* newitem = new LIB_TEXT(NULL); diff --git a/eeschema/lib_text.h b/eeschema/lib_text.h index bf3e9a613d..86eeba4905 100644 --- a/eeschema/lib_text.h +++ b/eeschema/lib_text.h @@ -94,12 +94,7 @@ public: virtual bool Load( LINE_READER& aLineReader, wxString& aErrorMsg ); - /** - * Test if the given point is within the bounds of this object. - * - * @param aPosition - A wxPoint to test - * @return - true if a hit, else false - */ + /** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ virtual bool HitTest( const wxPoint& aPosition ); /** @@ -210,8 +205,10 @@ public: /** @copydoc EDA_ITEM::GetMenuImage() */ virtual BITMAP_DEF GetMenuImage() const { return add_text_xpm; } + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + private: - virtual EDA_ITEM* doClone() const; /** * Function compare diff --git a/eeschema/netlist_control.h b/eeschema/netlist_control.h index b5373e1d5c..64dcbf392e 100644 --- a/eeschema/netlist_control.h +++ b/eeschema/netlist_control.h @@ -65,8 +65,6 @@ public: * @param id_NetType = netlist type id * @param idCheckBox = event ID attached to the "format is default" check box * @param idCreateFile = event ID attached to the "create netlist" button - * @param selected = true to have this notebook page selected when the dialog is opened - * Only one page can be created with selected = true. */ NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title, int id_NetType, int idCheckBox, int idCreateFile ); diff --git a/eeschema/operations_on_items_lists.cpp b/eeschema/operations_on_items_lists.cpp index 461e22ed73..c7cad1af69 100644 --- a/eeschema/operations_on_items_lists.cpp +++ b/eeschema/operations_on_items_lists.cpp @@ -237,7 +237,7 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* aDrawStruct, bool aClone ) wxCHECK_MSG( aDrawStruct != NULL, NULL, wxT( "Cannot duplicate NULL schematic item! Bad programmer." ) ); - SCH_ITEM* NewDrawStruct = aDrawStruct->Clone(); + SCH_ITEM* NewDrawStruct = (SCH_ITEM*) aDrawStruct->Clone(); if( aClone ) NewDrawStruct->SetTimeStamp( aDrawStruct->GetTimeStamp() ); diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp index ea725d2785..c42476e7f3 100644 --- a/eeschema/sch_bitmap.cpp +++ b/eeschema/sch_bitmap.cpp @@ -122,7 +122,7 @@ bool SCH_BITMAP::Save( FILE* aFile ) const } -EDA_ITEM* SCH_BITMAP::doClone() const +EDA_ITEM* SCH_BITMAP::Clone() const { return new SCH_BITMAP( *this ); } diff --git a/eeschema/sch_bitmap.h b/eeschema/sch_bitmap.h index 743938a4a6..1439b24ec6 100644 --- a/eeschema/sch_bitmap.h +++ b/eeschema/sch_bitmap.h @@ -163,22 +163,22 @@ public: /** @copydoc SCH_ITEM::SetPosition() */ virtual void SetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; } - /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */ + /** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; - /** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */ + /** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const; /** @copydoc SCH_ITEM::Plot() */ virtual void Plot( PLOTTER* aPlotter ); + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const; // override #endif - -private: - virtual EDA_ITEM* doClone() const; }; diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index 980043f86e..ac9d8bd46a 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -60,7 +60,7 @@ SCH_BUS_ENTRY::SCH_BUS_ENTRY( const wxPoint& pos, int shape, int id ) : } -EDA_ITEM* SCH_BUS_ENTRY::doClone() const +EDA_ITEM* SCH_BUS_ENTRY::Clone() const { return new SCH_BUS_ENTRY( *this ); } diff --git a/eeschema/sch_bus_entry.h b/eeschema/sch_bus_entry.h index f8c8d036c7..036dbf0037 100644 --- a/eeschema/sch_bus_entry.h +++ b/eeschema/sch_bus_entry.h @@ -161,22 +161,22 @@ public: /** @copydoc SCH_ITEM::SetPosition() */ virtual void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; } - /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */ + /** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; - /** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */ + /** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const; /** @copydoc SCH_ITEM::Plot() */ virtual void Plot( PLOTTER* aPlotter ); + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override #endif - -private: - virtual EDA_ITEM* doClone() const; }; diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 70f44399d7..212fdd59a2 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -231,7 +231,7 @@ void SCH_COMPONENT::Init( const wxPoint& pos ) } -EDA_ITEM* SCH_COMPONENT::doClone() const +EDA_ITEM* SCH_COMPONENT::Clone() const { return new SCH_COMPONENT( *this ); } diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h index fece3e917c..f97da88269 100644 --- a/eeschema/sch_component.h +++ b/eeschema/sch_component.h @@ -407,16 +407,19 @@ public: /** @copydoc SCH_ITEM::SetPosition() */ virtual void SetPosition( const wxPoint& aPosition ) { Move( aPosition - m_Pos ); } - /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */ + /** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; - /** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */ + /** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const; /** @copydoc SCH_ITEM::Plot() */ virtual void Plot( PLOTTER* aPlotter ); + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const; // override #endif @@ -424,8 +427,6 @@ public: private: /** @copydoc SCH_ITEM::doIsConnected() */ virtual bool doIsConnected( const wxPoint& aPosition ) const; - - virtual EDA_ITEM* doClone() const; }; diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 1123a07fcc..c32f6e7f29 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -84,7 +84,7 @@ SCH_FIELD::~SCH_FIELD() } -EDA_ITEM* SCH_FIELD::doClone() const +EDA_ITEM* SCH_FIELD::Clone() const { return new SCH_FIELD( *this ); } diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h index 68bd96b538..eafc76173f 100644 --- a/eeschema/sch_field.h +++ b/eeschema/sch_field.h @@ -223,22 +223,22 @@ public: /** @copydoc SCH_ITEM::SetPosition() */ virtual void SetPosition( const wxPoint& aPosition ); - /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */ + /** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; - /** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */ + /** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const; /** @copydoc SCH_ITEM::Plot() */ virtual void Plot( PLOTTER* aPlotter ); + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override #endif - -private: - virtual EDA_ITEM* doClone() const; }; diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp index 8374c5f9c2..ab0bbb252d 100644 --- a/eeschema/sch_junction.cpp +++ b/eeschema/sch_junction.cpp @@ -65,7 +65,7 @@ bool SCH_JUNCTION::Save( FILE* aFile ) const } -EDA_ITEM* SCH_JUNCTION::doClone() const +EDA_ITEM* SCH_JUNCTION::Clone() const { return new SCH_JUNCTION( *this ); } diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h index 1a37387581..5725ed3cbd 100644 --- a/eeschema/sch_junction.h +++ b/eeschema/sch_junction.h @@ -122,23 +122,24 @@ public: /** @copydoc SCH_ITEM::SetPosition() */ virtual void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; } - /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */ + /** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; - /** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */ + /** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const; /** @copydoc SCH_ITEM::Plot() */ virtual void Plot( PLOTTER* aPlotter ); + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const; // override #endif private: - virtual EDA_ITEM* doClone() const; - /** @copydoc SCH_ITEM::doIsConnected() */ virtual bool doIsConnected( const wxPoint& aPosition ) const; }; diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index 37c2f0981f..934381f1fb 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -78,7 +78,7 @@ SCH_LINE::SCH_LINE( const SCH_LINE& aLine ) : } -EDA_ITEM* SCH_LINE::doClone() const +EDA_ITEM* SCH_LINE::Clone() const { return new SCH_LINE( *this ); } diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h index a9e04cbef1..743a51f886 100644 --- a/eeschema/sch_line.h +++ b/eeschema/sch_line.h @@ -175,16 +175,19 @@ public: /** @copydoc SCH_ITEM::SetPosition() */ virtual void SetPosition( const wxPoint& aPosition ); - /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */ + /** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; - /** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */ + /** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const; /** @copydoc SCH_ITEM::Plot() */ virtual void Plot( PLOTTER* aPlotter ); + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const; // override #endif @@ -192,8 +195,6 @@ public: private: /** @copydoc SCH_ITEM::doIsConnected() */ virtual bool doIsConnected( const wxPoint& aPosition ) const; - - virtual EDA_ITEM* doClone() const; }; diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index 094e4b3d53..7381c18fb7 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -73,7 +73,7 @@ SCH_MARKER::~SCH_MARKER() } -EDA_ITEM* SCH_MARKER::doClone() const +EDA_ITEM* SCH_MARKER::Clone() const { return new SCH_MARKER( *this ); } diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h index 877496b36c..4e66bb7b16 100644 --- a/eeschema/sch_marker.h +++ b/eeschema/sch_marker.h @@ -135,14 +135,15 @@ public: /** @copydoc SCH_ITEM::SetPosition() */ virtual void SetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; } - /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */ + /** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const; // override #endif - - virtual EDA_ITEM* doClone() const; }; #endif // TYPE_SCH_MARKER_H_ diff --git a/eeschema/sch_no_connect.cpp b/eeschema/sch_no_connect.cpp index d7214b0964..3a397a7f17 100644 --- a/eeschema/sch_no_connect.cpp +++ b/eeschema/sch_no_connect.cpp @@ -54,7 +54,7 @@ SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) : } -EDA_ITEM* SCH_NO_CONNECT::doClone() const +EDA_ITEM* SCH_NO_CONNECT::Clone() const { return new SCH_NO_CONNECT( *this ); } diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h index 68ceccd01a..8e3813764d 100644 --- a/eeschema/sch_no_connect.h +++ b/eeschema/sch_no_connect.h @@ -128,16 +128,19 @@ public: /** @copydoc SCH_ITEM::SetPosition() */ virtual void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; } - /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */ + /** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; - /** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */ + /** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const; /** @copydoc SCH_ITEM::Plot() */ virtual void Plot( PLOTTER* aPlotter ); + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override #endif @@ -145,8 +148,6 @@ public: private: /** @copydoc SCH_ITEM::doIsConnected() */ virtual bool doIsConnected( const wxPoint& aPosition ) const; - - virtual EDA_ITEM* doClone() const; }; diff --git a/eeschema/sch_polyline.cpp b/eeschema/sch_polyline.cpp index c1bd84d2ec..25e571b83c 100644 --- a/eeschema/sch_polyline.cpp +++ b/eeschema/sch_polyline.cpp @@ -64,7 +64,7 @@ SCH_POLYLINE::~SCH_POLYLINE() } -EDA_ITEM* SCH_POLYLINE::doClone() const +EDA_ITEM* SCH_POLYLINE::Clone() const { return new SCH_POLYLINE( *this ); } diff --git a/eeschema/sch_polyline.h b/eeschema/sch_polyline.h index 9328ca0d9a..ecdf0fde2e 100644 --- a/eeschema/sch_polyline.h +++ b/eeschema/sch_polyline.h @@ -155,19 +155,19 @@ public: /** @copydoc SCH_ITEM::SetPosition() */ virtual void SetPosition( const wxPoint& aPosition ); - /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */ + /** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; - /** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */ + /** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const; + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override #endif - -private: - virtual EDA_ITEM* doClone() const; }; diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index abbf723742..e4ae8eb9ab 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -259,7 +259,7 @@ void SCH_SCREEN::ExtractWires( DLIST< SCH_ITEM >& aList, bool aCreateCopy ) aList.Append( item ); if( aCreateCopy ) - m_drawList.Insert( item->Clone(), next_item ); + m_drawList.Insert( (SCH_ITEM*) item->Clone(), next_item ); break; diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index e6dec56b58..cfdd28caa9 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -98,7 +98,7 @@ SCH_SHEET::~SCH_SHEET() } -EDA_ITEM* SCH_SHEET::doClone() const +EDA_ITEM* SCH_SHEET::Clone() const { return new SCH_SHEET( *this ); } diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index 425a856159..b54328886f 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -78,8 +78,6 @@ private: */ int m_edge; - virtual EDA_ITEM* doClone() const; - public: SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos = wxPoint( 0, 0 ), @@ -221,8 +219,11 @@ public: virtual void SetPosition( const wxPoint& aPosition ) { ConstrainOnEdge( aPosition ); } - /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */ + /** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; + + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; }; @@ -632,16 +633,19 @@ public: /** @copydoc SCH_ITEM::SetPosition() */ virtual void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; } - /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */ + /** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; - /** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */ + /** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const; /** @copydoc SCH_ITEM::Plot() */ virtual void Plot( PLOTTER* aPlotter ); + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const; // override #endif @@ -656,9 +660,6 @@ protected: * sheet pin is added or removed. */ void renumberPins(); - -private: - virtual EDA_ITEM* doClone() const; }; diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp index 7a54ce5de4..096fd7718c 100644 --- a/eeschema/sch_sheet_pin.cpp +++ b/eeschema/sch_sheet_pin.cpp @@ -61,7 +61,7 @@ SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos, const wxStr } -EDA_ITEM* SCH_SHEET_PIN::doClone() const +EDA_ITEM* SCH_SHEET_PIN::Clone() const { return new SCH_SHEET_PIN( *this ); } diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index b3c487ffe0..5c8dfebbce 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -122,7 +122,7 @@ SCH_TEXT::SCH_TEXT( const SCH_TEXT& aText ) : } -EDA_ITEM* SCH_TEXT::doClone() const +EDA_ITEM* SCH_TEXT::Clone() const { return new SCH_TEXT( *this ); } @@ -758,7 +758,7 @@ SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) : } -EDA_ITEM* SCH_LABEL::doClone() const +EDA_ITEM* SCH_LABEL::Clone() const { return new SCH_LABEL( *this ); } @@ -960,7 +960,7 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) : } -EDA_ITEM* SCH_GLOBALLABEL::doClone() const +EDA_ITEM* SCH_GLOBALLABEL::Clone() const { return new SCH_GLOBALLABEL( *this ); } @@ -1389,7 +1389,7 @@ SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T } -EDA_ITEM* SCH_HIERLABEL::doClone() const +EDA_ITEM* SCH_HIERLABEL::Clone() const { return new SCH_HIERLABEL( *this ); } diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index 260d9634e6..c407579c5b 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -247,22 +247,22 @@ public: /** @copydoc SCH_ITEM::SetPosition() */ virtual void SetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; } - /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */ + /** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; - /** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */ + /** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const; /** @copydoc SCH_ITEM::Plot() */ virtual void Plot( PLOTTER* aPlotter ); + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const; // override #endif - -private: - virtual EDA_ITEM* doClone() const; }; @@ -358,14 +358,15 @@ public: */ virtual bool IsReplaceable() const { return true; } - /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */ + /** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + private: /** @copydoc SCH_ITEM::doIsConnected() */ virtual bool doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; } - - virtual EDA_ITEM* doClone() const; }; @@ -467,14 +468,15 @@ public: /** @copydoc EDA_ITEM::GetMenuImage() */ virtual BITMAP_DEF GetMenuImage() const { return add_glabel_xpm; } - /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */ + /** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + private: /** @copydoc SCH_ITEM::doIsConnected() */ virtual bool doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; } - - virtual EDA_ITEM* doClone() const; }; @@ -578,14 +580,15 @@ public: /** @copydoc EDA_ITEM::GetMenuImage() */ virtual BITMAP_DEF GetMenuImage() const { return add_hierarchical_label_xpm; } - /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */ + /** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; + /** @copydoc EDA_ITEM::Clone() */ + virtual EDA_ITEM* Clone() const; + private: /** @copydoc SCH_ITEM::doIsConnected() */ virtual bool doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; } - - virtual EDA_ITEM* doClone() const; }; #endif /* CLASS_TEXT_LABEL_H */ diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 445c8b9ff7..8c75d3dad4 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -391,7 +391,7 @@ void SCH_EDIT_FRAME::SetUndoItem( const SCH_ITEM* aItem ) m_undoItem = NULL; if( aItem ) - m_undoItem = aItem->Clone(); + m_undoItem = (SCH_ITEM*) aItem->Clone(); } diff --git a/include/base_struct.h b/include/base_struct.h index 993f3b8e6a..85c28d991b 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -389,22 +389,8 @@ protected: EDA_ITEM* m_Image; private: - void InitVars(); - /** - * Function doClone - * is used by the derived class to actually implement the cloning. - * - * The default version will return NULL in release builds and likely crash the - * program. In debug builds, an warning message indicating the derived class - * has not implemented cloning. This really should be a pure virtual function. - * Due to the fact that there are so many objects derived from EDA_ITEM, the - * decision was made to return NULL until all the objects derived from EDA_ITEM - * implement cloning. Once that happens, this function should be made pure. - * - * @return A clone of the item. - */ - virtual EDA_ITEM* doClone() const; + void InitVars(); public: @@ -542,14 +528,16 @@ public: * Function Clone * creates a duplicate of this item with linked list members set to NULL. * - * The Clone() function only calls the private virtual doClone() which actually - * does the cloning for the derived object. - * - * @todo: use this instead of Copy() everywhere, then kill Copy(). + * The default version will return NULL in release builds and likely crash the + * program. In debug builds, a warning message indicating the derived class + * has not implemented cloning. This really should be a pure virtual function. + * Due to the fact that there are so many objects derived from EDA_ITEM, the + * decision was made to return NULL until all the objects derived from EDA_ITEM + * implement cloning. Once that happens, this function should be made pure. * * @return A clone of the item. */ - EDA_ITEM* Clone() const; // should not be inline, to save the ~ 6 bytes per call site. + virtual EDA_ITEM* Clone() const; // should not be inline, to save the ~ 6 bytes per call site. /** * Function IterateForward diff --git a/include/common.h b/include/common.h index c2eb72ca0a..cfb9abd940 100644 --- a/include/common.h +++ b/include/common.h @@ -276,7 +276,7 @@ extern bool g_ShowPageLimits; ///< true to display the page limits /// Name of default configuration file. (kicad.pro) extern wxString g_Prj_Default_Config_FullFilename; -/// Name of local configuration file. (