From f6e07f575a567f0a390871319425b6e0344e0119 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 9 May 2019 08:57:07 +0100 Subject: [PATCH] Rename for clarity. SetOffset() didn't set anything; it performed an action. Move() suggests a delta, when it in fact does a SetPosition(). --- eeschema/class_libentry.cpp | 2 +- eeschema/lib_arc.cpp | 6 +++--- eeschema/lib_arc.h | 4 ++-- eeschema/lib_bezier.cpp | 6 +++--- eeschema/lib_bezier.h | 4 ++-- eeschema/lib_circle.cpp | 8 ++++---- eeschema/lib_circle.h | 4 ++-- eeschema/lib_draw_item.h | 6 +++--- eeschema/lib_field.cpp | 6 +++--- eeschema/lib_field.h | 4 ++-- eeschema/lib_pin.cpp | 6 +++--- eeschema/lib_pin.h | 4 ++-- eeschema/lib_polyline.cpp | 8 ++++---- eeschema/lib_polyline.h | 4 ++-- eeschema/lib_rectangle.cpp | 6 +++--- eeschema/lib_rectangle.h | 4 ++-- eeschema/lib_text.cpp | 6 +++--- eeschema/lib_text.h | 4 ++-- eeschema/sch_component.cpp | 2 +- eeschema/sch_painter.cpp | 4 ++-- eeschema/tools/lib_move_tool.cpp | 2 +- eeschema/tools/lib_pin_tool.cpp | 6 +++--- 22 files changed, 53 insertions(+), 53 deletions(-) diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index f2d70bff13..8f0e3eda75 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -896,7 +896,7 @@ bool LIB_PART::LoadDateAndTime( char* aLine ) void LIB_PART::SetOffset( const wxPoint& aOffset ) { for( LIB_ITEM& item : m_drawings ) - item.SetOffset( aOffset ); + item.Offset( aOffset ); } diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index 4c357df1a3..8e11a72cd6 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -150,7 +150,7 @@ int LIB_ARC::compare( const LIB_ITEM& aOther ) const } -void LIB_ARC::SetOffset( const wxPoint& aOffset ) +void LIB_ARC::Offset( const wxPoint& aOffset ) { m_Pos += aOffset; m_ArcStart += aOffset; @@ -165,7 +165,7 @@ bool LIB_ARC::Inside( EDA_RECT& aRect ) const } -void LIB_ARC::Move( const wxPoint& aPosition ) +void LIB_ARC::MoveTo( const wxPoint& aPosition ) { wxPoint offset = aPosition - m_Pos; m_Pos = aPosition; @@ -539,7 +539,7 @@ void LIB_ARC::CalcEdit( const wxPoint& aPosition ) } else if( IsMoving() ) { - Move( m_initialPos + aPosition - m_initialCursorPos ); + MoveTo( m_initialPos + aPosition - m_initialCursorPos ); } } diff --git a/eeschema/lib_arc.h b/eeschema/lib_arc.h index df21467705..28ab0d5ca8 100644 --- a/eeschema/lib_arc.h +++ b/eeschema/lib_arc.h @@ -94,11 +94,11 @@ public: bool ContinueEdit( const wxPoint aNextPoint ) override; void EndEdit( const wxPoint& aPosition ) override; - void SetOffset( const wxPoint& aOffset ) override; + void Offset( const wxPoint& aOffset ) override; bool Inside( EDA_RECT& aRect ) const override; - void Move( const wxPoint& aPosition ) override; + void MoveTo( const wxPoint& aPosition ) override; wxPoint GetPosition() const override { return m_Pos; } diff --git a/eeschema/lib_bezier.cpp b/eeschema/lib_bezier.cpp index b43509b35d..85fe6592fc 100644 --- a/eeschema/lib_bezier.cpp +++ b/eeschema/lib_bezier.cpp @@ -77,7 +77,7 @@ int LIB_BEZIER::compare( const LIB_ITEM& aOther ) const } -void LIB_BEZIER::SetOffset( const wxPoint& aOffset ) +void LIB_BEZIER::Offset( const wxPoint& aOffset ) { size_t i; @@ -101,14 +101,14 @@ bool LIB_BEZIER::Inside( EDA_RECT& aRect ) const } -void LIB_BEZIER::Move( const wxPoint& aPosition ) +void LIB_BEZIER::MoveTo( const wxPoint& aPosition ) { if ( !m_PolyPoints.size() ) { m_PolyPoints.push_back( wxPoint(0, 0) ); } - SetOffset( aPosition - m_PolyPoints[0] ); + Offset( aPosition - m_PolyPoints[ 0 ] ); } const wxPoint LIB_BEZIER::GetOffset() const diff --git a/eeschema/lib_bezier.h b/eeschema/lib_bezier.h index 29be7f0649..0a8350d59d 100644 --- a/eeschema/lib_bezier.h +++ b/eeschema/lib_bezier.h @@ -65,7 +65,7 @@ public: void Reserve( size_t aCount ) { m_BezierPoints.reserve( aCount ); } void AddPoint( const wxPoint& aPoint ) { m_BezierPoints.push_back( aPoint ); } - void SetOffset( const wxPoint& aOffset ) override; + void Offset( const wxPoint& aOffset ) override; const wxPoint GetOffset() const; /** @@ -85,7 +85,7 @@ public: bool Inside( EDA_RECT& aRect ) const override; - void Move( const wxPoint& aPosition ) override; + void MoveTo( const wxPoint& aPosition ) override; wxPoint GetPosition() const override; diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index 59d52032e1..77cab3b651 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -108,7 +108,7 @@ int LIB_CIRCLE::compare( const LIB_ITEM& aOther ) const } -void LIB_CIRCLE::SetOffset( const wxPoint& aOffset ) +void LIB_CIRCLE::Offset( const wxPoint& aOffset ) { m_Pos += aOffset; m_EndPos += aOffset; @@ -122,9 +122,9 @@ bool LIB_CIRCLE::Inside( EDA_RECT& aRect ) const } -void LIB_CIRCLE::Move( const wxPoint& aPosition ) +void LIB_CIRCLE::MoveTo( const wxPoint& aPosition ) { - SetOffset( aPosition - m_Pos ); + Offset( aPosition - m_Pos ); } @@ -281,6 +281,6 @@ void LIB_CIRCLE::CalcEdit( const wxPoint& aPosition ) } else if( IsMoving() ) { - Move( m_initialPos + aPosition - m_initialCursorPos ); + MoveTo( m_initialPos + aPosition - m_initialCursorPos ); } } diff --git a/eeschema/lib_circle.h b/eeschema/lib_circle.h index a6800a04dd..a9f90fdbbb 100644 --- a/eeschema/lib_circle.h +++ b/eeschema/lib_circle.h @@ -70,11 +70,11 @@ public: void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint ) override; void CalcEdit( const wxPoint& aPosition ) override; - void SetOffset( const wxPoint& aOffset ) override; + void Offset( const wxPoint& aOffset ) override; bool Inside( EDA_RECT& aRect ) const override; - void Move( const wxPoint& aPosition ) override; + void MoveTo( const wxPoint& aPosition ) override; wxPoint GetPosition() const override { return m_Pos; } diff --git a/eeschema/lib_draw_item.h b/eeschema/lib_draw_item.h index f43227ae45..793934054f 100644 --- a/eeschema/lib_draw_item.h +++ b/eeschema/lib_draw_item.h @@ -265,7 +265,7 @@ public: * * @param aOffset Coordinates to offset the item position. */ - virtual void SetOffset( const wxPoint& aOffset ) = 0; + virtual void Offset( const wxPoint& aOffset ) = 0; /** * Test if any part of the draw object is inside rectangle bounds of \a aRect. @@ -280,7 +280,7 @@ public: * * @param aPosition Position to move draw item to. */ - virtual void Move( const wxPoint& aPosition ) = 0; + virtual void MoveTo( const wxPoint& aPosition ) = 0; /** * Return the current draw object position. @@ -289,7 +289,7 @@ public: */ virtual wxPoint GetPosition() const = 0; - void SetPosition( const wxPoint& aPosition ) { Move( aPosition ); } + void SetPosition( const wxPoint& aPosition ) { MoveTo( aPosition ); } /** * Mirror the draw object along the horizontal (X) axis about \a aCenter point. diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index 038cdae8d9..b9a87803da 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -241,7 +241,7 @@ int LIB_FIELD::compare( const LIB_ITEM& other ) const } -void LIB_FIELD::SetOffset( const wxPoint& aOffset ) +void LIB_FIELD::Offset( const wxPoint& aOffset ) { EDA_TEXT::Offset( aOffset ); } @@ -253,7 +253,7 @@ bool LIB_FIELD::Inside( EDA_RECT& rect ) const } -void LIB_FIELD::Move( const wxPoint& newPosition ) +void LIB_FIELD::MoveTo( const wxPoint& newPosition ) { EDA_TEXT::SetTextPos( newPosition ); } @@ -522,7 +522,7 @@ void LIB_FIELD::CalcEdit( const wxPoint& aPosition ) } else if( IsMoving() ) { - Move( m_initialPos + aPosition - m_initialCursorPos ); + MoveTo( m_initialPos + aPosition - m_initialCursorPos ); } } diff --git a/eeschema/lib_field.h b/eeschema/lib_field.h index 52db80b579..060132ae3d 100644 --- a/eeschema/lib_field.h +++ b/eeschema/lib_field.h @@ -206,11 +206,11 @@ public: */ void SetText( const wxString& aText ) override; - void SetOffset( const wxPoint& aOffset ) override; + void Offset( const wxPoint& aOffset ) override; bool Inside( EDA_RECT& aRect ) const override; - void Move( const wxPoint& aPosition ) override; + void MoveTo( const wxPoint& aPosition ) override; wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); } diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index f85bfddaea..346832c7da 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -1314,7 +1314,7 @@ int LIB_PIN::compare( const LIB_ITEM& other ) const } -void LIB_PIN::SetOffset( const wxPoint& aOffset ) +void LIB_PIN::Offset( const wxPoint& aOffset ) { m_position += aOffset; } @@ -1328,7 +1328,7 @@ bool LIB_PIN::Inside( EDA_RECT& rect ) const } -void LIB_PIN::Move( const wxPoint& newPosition ) +void LIB_PIN::MoveTo( const wxPoint& newPosition ) { if( m_position != newPosition ) { @@ -1715,6 +1715,6 @@ void LIB_PIN::CalcEdit( const wxPoint& aPosition ) if( IsMoving() ) { DBG(printf("MOVEPIN\n");) - Move( aPosition ); + MoveTo( aPosition ); } } diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h index a77d320bde..6ad300736f 100644 --- a/eeschema/lib_pin.h +++ b/eeschema/lib_pin.h @@ -423,11 +423,11 @@ public: */ static int GetOrientationIndex( int aCode ); - void SetOffset( const wxPoint& aOffset ) override; + void Offset( const wxPoint& aOffset ) override; bool Inside( EDA_RECT& aRect ) const override; - void Move( const wxPoint& aPosition ) override; + void MoveTo( const wxPoint& aPosition ) override; wxPoint GetPosition() const override { return m_position; } diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp index 35b0f8b0ab..01249f62d6 100644 --- a/eeschema/lib_polyline.cpp +++ b/eeschema/lib_polyline.cpp @@ -79,7 +79,7 @@ int LIB_POLYLINE::compare( const LIB_ITEM& aOther ) const } -void LIB_POLYLINE::SetOffset( const wxPoint& aOffset ) +void LIB_POLYLINE::Offset( const wxPoint& aOffset ) { for( size_t i = 0; i < m_PolyPoints.size(); i++ ) m_PolyPoints[i] += aOffset; @@ -98,9 +98,9 @@ bool LIB_POLYLINE::Inside( EDA_RECT& aRect ) const } -void LIB_POLYLINE::Move( const wxPoint& aPosition ) +void LIB_POLYLINE::MoveTo( const wxPoint& aPosition ) { - SetOffset( aPosition - m_PolyPoints[0] ); + Offset( aPosition - m_PolyPoints[ 0 ] ); } @@ -472,6 +472,6 @@ void LIB_POLYLINE::CalcEdit( const wxPoint& aPosition ) } else if( IsMoving() ) { - Move( m_initialPos + aPosition - m_initialCursorPos ); + MoveTo( m_initialPos + aPosition - m_initialCursorPos ); } } diff --git a/eeschema/lib_polyline.h b/eeschema/lib_polyline.h index e4cea8f2a7..46997d9253 100644 --- a/eeschema/lib_polyline.h +++ b/eeschema/lib_polyline.h @@ -92,11 +92,11 @@ public: bool ContinueEdit( const wxPoint aNextPoint ) override; void EndEdit( const wxPoint& aPosition ) override; - void SetOffset( const wxPoint& aOffset ) override; + void Offset( const wxPoint& aOffset ) override; bool Inside( EDA_RECT& aRect ) const override; - void Move( const wxPoint& aPosition ) override; + void MoveTo( const wxPoint& aPosition ) override; wxPoint GetPosition() const override { return m_PolyPoints[0]; } diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index 0df3bf6b36..bc5af21817 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -81,7 +81,7 @@ int LIB_RECTANGLE::compare( const LIB_ITEM& aOther ) const } -void LIB_RECTANGLE::SetOffset( const wxPoint& aOffset ) +void LIB_RECTANGLE::Offset( const wxPoint& aOffset ) { m_Pos += aOffset; m_End += aOffset; @@ -94,7 +94,7 @@ bool LIB_RECTANGLE::Inside( EDA_RECT& aRect ) const } -void LIB_RECTANGLE::Move( const wxPoint& aPosition ) +void LIB_RECTANGLE::MoveTo( const wxPoint& aPosition ) { wxPoint size = m_End - m_Pos; m_Pos = aPosition; @@ -310,6 +310,6 @@ void LIB_RECTANGLE::CalcEdit( const wxPoint& aPosition ) } else if( IsMoving() ) { - Move( m_initialPos + aPosition - m_initialCursorPos ); + MoveTo( m_initialPos + aPosition - m_initialCursorPos ); } } diff --git a/eeschema/lib_rectangle.h b/eeschema/lib_rectangle.h index 15df22d613..54cebfed79 100644 --- a/eeschema/lib_rectangle.h +++ b/eeschema/lib_rectangle.h @@ -75,11 +75,11 @@ public: void CalcEdit( const wxPoint& aPosition ) override; void EndEdit( const wxPoint& aPosition ) override; - void SetOffset( const wxPoint& aOffset ) override; + void Offset( const wxPoint& aOffset ) override; bool Inside( EDA_RECT& aRect ) const override; - void Move( const wxPoint& aPosition ) override; + void MoveTo( const wxPoint& aPosition ) override; wxPoint GetPosition() const override { return m_Pos; } diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index 2e7d793885..290163a922 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -117,7 +117,7 @@ int LIB_TEXT::compare( const LIB_ITEM& other ) const } -void LIB_TEXT::SetOffset( const wxPoint& aOffset ) +void LIB_TEXT::Offset( const wxPoint& aOffset ) { EDA_TEXT::Offset( aOffset ); } @@ -129,7 +129,7 @@ bool LIB_TEXT::Inside( EDA_RECT& rect ) const } -void LIB_TEXT::Move( const wxPoint& newPosition ) +void LIB_TEXT::MoveTo( const wxPoint& newPosition ) { SetTextPos( newPosition ); } @@ -386,7 +386,7 @@ void LIB_TEXT::CalcEdit( const wxPoint& aPosition ) } else if( IsMoving() ) { - Move( m_initialPos + aPosition - m_initialCursorPos ); + MoveTo( m_initialPos + aPosition - m_initialCursorPos ); DBG(printf("%p: move %d %d\n", this, GetPosition().x, GetPosition().y );) } diff --git a/eeschema/lib_text.h b/eeschema/lib_text.h index f7e3c06fc7..ac58b2628b 100644 --- a/eeschema/lib_text.h +++ b/eeschema/lib_text.h @@ -101,11 +101,11 @@ public: void CalcEdit( const wxPoint& aPosition ) override; void EndEdit( const wxPoint& aPosition ) override; - void SetOffset( const wxPoint& aOffset ) override; + void Offset( const wxPoint& aOffset ) override; bool Inside( EDA_RECT& aRect ) const override; - void Move( const wxPoint& aPosition ) override; + void MoveTo( const wxPoint& aPosition ) override; wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); } diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 1872cd5d78..4e82593ea5 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -97,7 +97,7 @@ static LIB_PART* dummy() LIB_RECTANGLE* square = new LIB_RECTANGLE( part ); - square->Move( wxPoint( -200, 200 ) ); + square->MoveTo( wxPoint( -200, 200 )); square->SetEndPosition( wxPoint( 200, -200 ) ); LIB_TEXT* text = new LIB_TEXT( part ); diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index a0feca7788..a3c98c5d1d 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -116,7 +116,7 @@ static LIB_PART* dummy() LIB_RECTANGLE* square = new LIB_RECTANGLE( part ); - square->Move( wxPoint( -200, 200 ) ); + square->MoveTo( wxPoint( -200, 200 )); square->SetEndPosition( wxPoint( 200, -200 ) ); LIB_TEXT* text = new LIB_TEXT( part ); @@ -1095,7 +1095,7 @@ void SCH_PAINTER::draw( SCH_COMPONENT *aComp, int aLayer ) for( auto& tempItem : tempPart.GetDrawItems() ) { tempItem.SetFlags( aComp->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED - tempItem.Move( tempItem.GetPosition() + (wxPoint) mapCoords( aComp->GetPosition() ) ); + tempItem.MoveTo( tempItem.GetPosition() + (wxPoint) mapCoords( aComp->GetPosition())); } // Copy the pin info from the component to the temp pins diff --git a/eeschema/tools/lib_move_tool.cpp b/eeschema/tools/lib_move_tool.cpp index 48fa8e3ec0..7ea79cf211 100644 --- a/eeschema/tools/lib_move_tool.cpp +++ b/eeschema/tools/lib_move_tool.cpp @@ -313,7 +313,7 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent ) void LIB_MOVE_TOOL::moveItem( EDA_ITEM* aItem, VECTOR2I aDelta ) { - static_cast( aItem )->Move( mapCoords( aDelta ) ); + static_cast( aItem )->Offset( mapCoords( aDelta )); aItem->SetFlags( IS_MOVED ); } diff --git a/eeschema/tools/lib_pin_tool.cpp b/eeschema/tools/lib_pin_tool.cpp index b9491eae74..c6e3816eb7 100644 --- a/eeschema/tools/lib_pin_tool.cpp +++ b/eeschema/tools/lib_pin_tool.cpp @@ -226,7 +226,7 @@ bool LIB_PIN_TOOL::PlacePin( LIB_PIN* aPin ) if( pin->GetEditFlags() == 0 ) continue; - pin->Move( aPin->GetPosition() ); + pin->MoveTo( aPin->GetPosition() ); pin->ClearFlags(); } @@ -252,7 +252,7 @@ LIB_PIN* LIB_PIN_TOOL::CreatePin( const VECTOR2I& aPosition, LIB_PART* aPart ) if( m_frame->SynchronizePins() ) pin->SetFlags( IS_LINKED ); - pin->Move( (wxPoint) aPosition ); + pin->MoveTo((wxPoint) aPosition ); pin->SetLength( GetLastPinLength() ); pin->SetOrientation( g_LastPinOrient ); pin->SetType( g_LastPinType ); @@ -362,7 +362,7 @@ LIB_PIN* LIB_PIN_TOOL::RepeatPin( const LIB_PIN* aSourcePin ) case PIN_RIGHT: step.y = -m_frame->GetRepeatPinStep(); break; } - pin->SetOffset( step ); + pin->Offset( step ); wxString nextName = pin->GetName(); IncrementLabelMember( nextName, m_frame->GetRepeatDeltaLabel() );