Rename for clarity.

SetOffset() didn't set anything; it performed an action.
Move() suggests a delta, when it in fact does a SetPosition().
This commit is contained in:
Jeff Young 2019-05-09 08:57:07 +01:00
parent ea0941cab3
commit f6e07f575a
22 changed files with 53 additions and 53 deletions

View File

@ -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 );
}

View File

@ -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 );
}
}

View File

@ -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; }

View File

@ -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

View File

@ -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;

View File

@ -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 );
}
}

View File

@ -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; }

View File

@ -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.

View File

@ -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 );
}
}

View File

@ -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(); }

View File

@ -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 );
}
}

View File

@ -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; }

View File

@ -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 );
}
}

View File

@ -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]; }

View File

@ -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 );
}
}

View File

@ -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; }

View File

@ -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 );)
}

View File

@ -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(); }

View File

@ -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 );

View File

@ -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

View File

@ -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<LIB_ITEM*>( aItem )->Move( mapCoords( aDelta ) );
static_cast<LIB_ITEM*>( aItem )->Offset( mapCoords( aDelta ));
aItem->SetFlags( IS_MOVED );
}

View File

@ -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() );