Eeschema: Changing pin length adjusts offset according to orientation
ADDED: When pin length is changed now, the pin position is adjusted according to its orientation such that the connection point for wires moves instead of the other side of the stem base. For pins coming out of component boxes, etc. this keeps them attached to the box while the length is changed.
This commit is contained in:
parent
6a74ecbffd
commit
e454595348
|
@ -355,7 +355,7 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_LENGTH:
|
case COL_LENGTH:
|
||||||
pin->SetLength( ValueFromString( m_frame->GetUserUnits(), aValue ) );
|
pin->ChangeLength( ValueFromString( m_frame->GetUserUnits(), aValue ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COL_POSX:
|
case COL_POSX:
|
||||||
|
|
|
@ -345,8 +345,8 @@ bool DIALOG_PIN_PROPERTIES::TransferDataFromWindow()
|
||||||
m_pin->SetNameTextSize( m_nameSize.GetValue() );
|
m_pin->SetNameTextSize( m_nameSize.GetValue() );
|
||||||
m_pin->SetNumberTextSize( m_numberSize.GetValue() );
|
m_pin->SetNumberTextSize( m_numberSize.GetValue() );
|
||||||
m_pin->SetOrientation( PinOrientationCode( m_choiceOrientation->GetSelection() ) );
|
m_pin->SetOrientation( PinOrientationCode( m_choiceOrientation->GetSelection() ) );
|
||||||
m_pin->SetLength( m_pinLength.GetValue() );
|
|
||||||
m_pin->SetPosition( newPos );
|
m_pin->SetPosition( newPos );
|
||||||
|
m_pin->ChangeLength( m_pinLength.GetValue() );
|
||||||
m_pin->SetType( m_choiceElectricalType->GetPinTypeSelection() );
|
m_pin->SetType( m_choiceElectricalType->GetPinTypeSelection() );
|
||||||
m_pin->SetShape( m_choiceStyle->GetPinShapeSelection() );
|
m_pin->SetShape( m_choiceStyle->GetPinShapeSelection() );
|
||||||
m_pin->SetConvert( m_checkApplyToAllConversions->GetValue() ? 0 : m_frame->GetConvert() );
|
m_pin->SetConvert( m_checkApplyToAllConversions->GetValue() ? 0 : m_frame->GetConvert() );
|
||||||
|
|
|
@ -963,6 +963,33 @@ int LIB_PIN::compare( const LIB_ITEM& aOther, int aCompareFlags ) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LIB_PIN::ChangeLength( int aLength )
|
||||||
|
{
|
||||||
|
int lengthChange = m_length - aLength;
|
||||||
|
int offsetX = 0;
|
||||||
|
int offsetY = 0;
|
||||||
|
|
||||||
|
switch( m_orientation )
|
||||||
|
{
|
||||||
|
case PIN_RIGHT:
|
||||||
|
offsetX = lengthChange;
|
||||||
|
break;
|
||||||
|
case PIN_LEFT:
|
||||||
|
offsetX = -1 * lengthChange;
|
||||||
|
break;
|
||||||
|
case PIN_UP:
|
||||||
|
offsetY = lengthChange;
|
||||||
|
break;
|
||||||
|
case PIN_DOWN:
|
||||||
|
offsetY = -1 * lengthChange;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxPoint offset = wxPoint( offsetX, offsetY );
|
||||||
|
Offset( offset );
|
||||||
|
|
||||||
|
m_length = aLength;
|
||||||
|
}
|
||||||
|
|
||||||
void LIB_PIN::Offset( const VECTOR2I& aOffset )
|
void LIB_PIN::Offset( const VECTOR2I& aOffset )
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,6 +81,13 @@ public:
|
||||||
int GetLength() const { return m_length; }
|
int GetLength() const { return m_length; }
|
||||||
void SetLength( int aLength ) { m_length = aLength; }
|
void SetLength( int aLength ) { m_length = aLength; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the length of a pin and adjust its position based on orientation.
|
||||||
|
*
|
||||||
|
* @param aLength New length of pin
|
||||||
|
*/
|
||||||
|
void ChangeLength( int aLength );
|
||||||
|
|
||||||
ELECTRICAL_PINTYPE GetType() const { return m_type; }
|
ELECTRICAL_PINTYPE GetType() const { return m_type; }
|
||||||
void SetType( ELECTRICAL_PINTYPE aType ) { m_type = aType; }
|
void SetType( ELECTRICAL_PINTYPE aType ) { m_type = aType; }
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
|
||||||
else if( other->GetConvert() == aPin->GetConvert() )
|
else if( other->GetConvert() == aPin->GetConvert() )
|
||||||
{
|
{
|
||||||
other->SetPosition( aPin->GetPosition() );
|
other->SetPosition( aPin->GetPosition() );
|
||||||
other->SetLength( aPin->GetLength() );
|
other->ChangeLength( aPin->GetLength() );
|
||||||
other->SetShape( aPin->GetShape() );
|
other->SetShape( aPin->GetShape() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ int SYMBOL_EDITOR_PIN_TOOL::PushPinProperties( const TOOL_EVENT& aEvent )
|
||||||
if( aEvent.IsAction( &EE_ACTIONS::pushPinLength ) )
|
if( aEvent.IsAction( &EE_ACTIONS::pushPinLength ) )
|
||||||
{
|
{
|
||||||
if( !pin->GetConvert() || pin->GetConvert() == m_frame->GetConvert() )
|
if( !pin->GetConvert() || pin->GetConvert() == m_frame->GetConvert() )
|
||||||
pin->SetLength( sourcePin->GetLength() );
|
pin->ChangeLength( sourcePin->GetLength() );
|
||||||
}
|
}
|
||||||
else if( aEvent.IsAction( &EE_ACTIONS::pushPinNameSize ) )
|
else if( aEvent.IsAction( &EE_ACTIONS::pushPinNameSize ) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue