Move '~' pin name processing to LIB_PIN and SCH_PIN.
This will also allow us to do variable processing in the future if desired.
This commit is contained in:
parent
ceb23c3aac
commit
bcdec0dea7
|
@ -945,7 +945,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
if( connection->SubgraphCode() > 0 )
|
if( connection->SubgraphCode() > 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
connection->SetName( pin->GetName() );
|
connection->SetName( pin->GetShownName() );
|
||||||
|
|
||||||
int code = assignNewNetCode( *connection );
|
int code = assignNewNetCode( *connection );
|
||||||
|
|
||||||
|
@ -1241,7 +1241,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
{
|
{
|
||||||
auto pin = static_cast<SCH_PIN*>( driver );
|
auto pin = static_cast<SCH_PIN*>( driver );
|
||||||
|
|
||||||
if( pin->IsPowerConnection() && pin->GetName() == test_name )
|
if( pin->IsPowerConnection() && pin->GetShownName() == test_name )
|
||||||
{
|
{
|
||||||
match = true;
|
match = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -168,6 +168,15 @@ int LIB_PIN::GetPenWidth() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString LIB_PIN::GetShownName() const
|
||||||
|
{
|
||||||
|
if( m_name == "~" )
|
||||||
|
return wxEmptyString;
|
||||||
|
else
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
const TRANSFORM& aTransform )
|
const TRANSFORM& aTransform )
|
||||||
{
|
{
|
||||||
|
@ -349,9 +358,15 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
|
||||||
case PIN_RIGHT: x1 += m_length; break;
|
case PIN_RIGHT: x1 += m_length; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_name.IsEmpty() )
|
wxString name = GetShownName();
|
||||||
|
wxString number = GetShownNumber();
|
||||||
|
|
||||||
|
if( name.IsEmpty() )
|
||||||
aDrawPinName = false;
|
aDrawPinName = false;
|
||||||
|
|
||||||
|
if( number.IsEmpty() )
|
||||||
|
aDrawPinNum = false;
|
||||||
|
|
||||||
if( aTextInside ) // Draw the text inside, but the pin numbers outside.
|
if( aTextInside ) // Draw the text inside, but the pin numbers outside.
|
||||||
{
|
{
|
||||||
if(( aPinOrient == PIN_LEFT) || ( aPinOrient == PIN_RIGHT) )
|
if(( aPinOrient == PIN_LEFT) || ( aPinOrient == PIN_RIGHT) )
|
||||||
|
@ -362,22 +377,22 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
|
||||||
if( aPinOrient == PIN_RIGHT )
|
if( aPinOrient == PIN_RIGHT )
|
||||||
{
|
{
|
||||||
x = x1 + aTextInside;
|
x = x1 + aTextInside;
|
||||||
GRText( DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ANGLE_HORIZ,
|
GRText( DC, wxPoint( x, y1 ), NameColor, name, TEXT_ANGLE_HORIZ, PinNameSize,
|
||||||
PinNameSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, namePenWidth, false,
|
||||||
namePenWidth, false, false );
|
false );
|
||||||
}
|
}
|
||||||
else // Orient == PIN_LEFT
|
else // Orient == PIN_LEFT
|
||||||
{
|
{
|
||||||
x = x1 - aTextInside;
|
x = x1 - aTextInside;
|
||||||
GRText( DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ANGLE_HORIZ,
|
GRText( DC, wxPoint( x, y1 ), NameColor, name, TEXT_ANGLE_HORIZ, PinNameSize,
|
||||||
PinNameSize, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, namePenWidth, false,
|
||||||
namePenWidth, false, false );
|
false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
GRText( DC, wxPoint(( x1 + aPinPos.x) / 2, y1 - num_offset ), NumColor, m_number,
|
GRText( DC, wxPoint(( x1 + aPinPos.x) / 2, y1 - num_offset ), NumColor, number,
|
||||||
TEXT_ANGLE_HORIZ, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
TEXT_ANGLE_HORIZ, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false );
|
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false );
|
||||||
}
|
}
|
||||||
|
@ -391,7 +406,7 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
|
||||||
|
|
||||||
if( aDrawPinName )
|
if( aDrawPinName )
|
||||||
{
|
{
|
||||||
GRText( DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ANGLE_VERT, PinNameSize,
|
GRText( DC, wxPoint( x1, y ), NameColor, name, TEXT_ANGLE_VERT, PinNameSize,
|
||||||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, namePenWidth, false,
|
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, namePenWidth, false,
|
||||||
false );
|
false );
|
||||||
}
|
}
|
||||||
|
@ -399,7 +414,7 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
GRText( DC, wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor,
|
GRText( DC, wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor,
|
||||||
m_number, TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
number, TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false );
|
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -409,7 +424,7 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
|
||||||
|
|
||||||
if( aDrawPinName )
|
if( aDrawPinName )
|
||||||
{
|
{
|
||||||
GRText( DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ANGLE_VERT, PinNameSize,
|
GRText( DC, wxPoint( x1, y ), NameColor, name, TEXT_ANGLE_VERT, PinNameSize,
|
||||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, namePenWidth, false,
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, namePenWidth, false,
|
||||||
false );
|
false );
|
||||||
}
|
}
|
||||||
|
@ -417,7 +432,7 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
GRText( DC, wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor,
|
GRText( DC, wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor,
|
||||||
m_number, TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
number, TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false );
|
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -431,14 +446,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
|
||||||
if( aDrawPinName )
|
if( aDrawPinName )
|
||||||
{
|
{
|
||||||
x = ( x1 + aPinPos.x) / 2;
|
x = ( x1 + aPinPos.x) / 2;
|
||||||
GRText( DC, wxPoint( x, y1 - name_offset ), NameColor, m_name, TEXT_ANGLE_HORIZ,
|
GRText( DC, wxPoint( x, y1 - name_offset ), NameColor, name, TEXT_ANGLE_HORIZ,
|
||||||
PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
|
PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
|
||||||
namePenWidth, false, false );
|
namePenWidth, false, false );
|
||||||
}
|
}
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
x = ( x1 + aPinPos.x) / 2;
|
x = ( x1 + aPinPos.x) / 2;
|
||||||
GRText( DC, wxPoint( x, y1 + num_offset ), NumColor, m_number, TEXT_ANGLE_HORIZ,
|
GRText( DC, wxPoint( x, y1 + num_offset ), NumColor, number, TEXT_ANGLE_HORIZ,
|
||||||
PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, numPenWidth,
|
PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, numPenWidth,
|
||||||
false, false );
|
false, false );
|
||||||
}
|
}
|
||||||
|
@ -448,14 +463,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
|
||||||
if( aDrawPinName )
|
if( aDrawPinName )
|
||||||
{
|
{
|
||||||
y = ( y1 + aPinPos.y) / 2;
|
y = ( y1 + aPinPos.y) / 2;
|
||||||
GRText( DC, wxPoint( x1 - name_offset, y ), NameColor, m_name, TEXT_ANGLE_VERT,
|
GRText( DC, wxPoint( x1 - name_offset, y ), NameColor, name, TEXT_ANGLE_VERT,
|
||||||
PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
|
PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
|
||||||
namePenWidth, false, false );
|
namePenWidth, false, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
GRText( DC, wxPoint( x1 + num_offset, ( y1 + aPinPos.y) / 2 ), NumColor, m_number,
|
GRText( DC, wxPoint( x1 + num_offset, ( y1 + aPinPos.y) / 2 ), NumColor, number,
|
||||||
TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP,
|
TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP,
|
||||||
numPenWidth, false, false );
|
numPenWidth, false, false );
|
||||||
}
|
}
|
||||||
|
@ -650,10 +665,13 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
|
||||||
void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinOrient, int aTextInside,
|
void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinOrient, int aTextInside,
|
||||||
bool aDrawPinNum, bool aDrawPinName ) const
|
bool aDrawPinNum, bool aDrawPinName ) const
|
||||||
{
|
{
|
||||||
if( m_name.IsEmpty() || m_name == wxT( "~" ) )
|
wxString name = GetShownName();
|
||||||
|
wxString number = GetShownNumber();
|
||||||
|
|
||||||
|
if( name.IsEmpty() )
|
||||||
aDrawPinName = false;
|
aDrawPinName = false;
|
||||||
|
|
||||||
if( m_number.IsEmpty() )
|
if( number.IsEmpty() )
|
||||||
aDrawPinNum = false;
|
aDrawPinNum = false;
|
||||||
|
|
||||||
if( !aDrawPinNum && !aDrawPinName )
|
if( !aDrawPinNum && !aDrawPinName )
|
||||||
|
@ -705,14 +723,14 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO
|
||||||
hjustify = GR_TEXT_HJUSTIFY_RIGHT;
|
hjustify = GR_TEXT_HJUSTIFY_RIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
aPlotter->Text( wxPoint( x, y1 ), nameColor, m_name, TEXT_ANGLE_HORIZ, pinNameSize,
|
aPlotter->Text( wxPoint( x, y1 ), nameColor, name, TEXT_ANGLE_HORIZ, pinNameSize,
|
||||||
hjustify, GR_TEXT_VJUSTIFY_CENTER, namePenWidth,
|
hjustify, GR_TEXT_VJUSTIFY_CENTER, namePenWidth,
|
||||||
false, false );
|
false, false );
|
||||||
}
|
}
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
aPlotter->Text( wxPoint( ( x1 + aPinPos.x) / 2, y1 - num_offset ), numColor,
|
aPlotter->Text( wxPoint( ( x1 + aPinPos.x) / 2, y1 - num_offset ), numColor,
|
||||||
m_number, TEXT_ANGLE_HORIZ, pinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
number, TEXT_ANGLE_HORIZ, pinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false );
|
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -723,14 +741,14 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO
|
||||||
y = y1 + aTextInside;
|
y = y1 + aTextInside;
|
||||||
|
|
||||||
if( aDrawPinName )
|
if( aDrawPinName )
|
||||||
aPlotter->Text( wxPoint( x1, y ), nameColor, m_name, TEXT_ANGLE_VERT,
|
aPlotter->Text( wxPoint( x1, y ), nameColor, name, TEXT_ANGLE_VERT,
|
||||||
pinNameSize, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER,
|
pinNameSize, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER,
|
||||||
namePenWidth, false, false );
|
namePenWidth, false, false );
|
||||||
|
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
aPlotter->Text( wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
|
aPlotter->Text( wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
|
||||||
m_number, TEXT_ANGLE_VERT, pinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
number, TEXT_ANGLE_VERT, pinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false );
|
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -740,7 +758,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO
|
||||||
|
|
||||||
if( aDrawPinName )
|
if( aDrawPinName )
|
||||||
{
|
{
|
||||||
aPlotter->Text( wxPoint( x1, y ), nameColor, m_name, TEXT_ANGLE_VERT,
|
aPlotter->Text( wxPoint( x1, y ), nameColor, name, TEXT_ANGLE_VERT,
|
||||||
pinNameSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
pinNameSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
||||||
namePenWidth, false, false );
|
namePenWidth, false, false );
|
||||||
}
|
}
|
||||||
|
@ -748,7 +766,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
aPlotter->Text( wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
|
aPlotter->Text( wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
|
||||||
m_number, TEXT_ANGLE_VERT, pinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
number, TEXT_ANGLE_VERT, pinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false );
|
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -762,7 +780,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO
|
||||||
if( aDrawPinName )
|
if( aDrawPinName )
|
||||||
{
|
{
|
||||||
x = ( x1 + aPinPos.x) / 2;
|
x = ( x1 + aPinPos.x) / 2;
|
||||||
aPlotter->Text( wxPoint( x, y1 - name_offset ), nameColor, m_name,
|
aPlotter->Text( wxPoint( x, y1 - name_offset ), nameColor, name,
|
||||||
TEXT_ANGLE_HORIZ, pinNameSize, GR_TEXT_HJUSTIFY_CENTER,
|
TEXT_ANGLE_HORIZ, pinNameSize, GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM, namePenWidth, false, false );
|
GR_TEXT_VJUSTIFY_BOTTOM, namePenWidth, false, false );
|
||||||
}
|
}
|
||||||
|
@ -770,7 +788,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
x = ( x1 + aPinPos.x ) / 2;
|
x = ( x1 + aPinPos.x ) / 2;
|
||||||
aPlotter->Text( wxPoint( x, y1 + num_offset ), numColor, m_number,
|
aPlotter->Text( wxPoint( x, y1 + num_offset ), numColor, number,
|
||||||
TEXT_ANGLE_HORIZ, pinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
TEXT_ANGLE_HORIZ, pinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_TOP, numPenWidth, false, false );
|
GR_TEXT_VJUSTIFY_TOP, numPenWidth, false, false );
|
||||||
}
|
}
|
||||||
|
@ -780,7 +798,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO
|
||||||
if( aDrawPinName )
|
if( aDrawPinName )
|
||||||
{
|
{
|
||||||
y = ( y1 + aPinPos.y ) / 2;
|
y = ( y1 + aPinPos.y ) / 2;
|
||||||
aPlotter->Text( wxPoint( x1 - name_offset, y ), nameColor, m_name,
|
aPlotter->Text( wxPoint( x1 - name_offset, y ), nameColor, name,
|
||||||
TEXT_ANGLE_VERT, pinNameSize, GR_TEXT_HJUSTIFY_CENTER,
|
TEXT_ANGLE_VERT, pinNameSize, GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM, namePenWidth, false, false );
|
GR_TEXT_VJUSTIFY_BOTTOM, namePenWidth, false, false );
|
||||||
}
|
}
|
||||||
|
@ -788,7 +806,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO
|
||||||
if( aDrawPinNum )
|
if( aDrawPinNum )
|
||||||
{
|
{
|
||||||
aPlotter->Text( wxPoint( x1 + num_offset, ( y1 + aPinPos.y ) / 2 ), numColor,
|
aPlotter->Text( wxPoint( x1 + num_offset, ( y1 + aPinPos.y ) / 2 ), numColor,
|
||||||
m_number, TEXT_ANGLE_VERT, pinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
number, TEXT_ANGLE_VERT, pinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_TOP, numPenWidth, false, false );
|
GR_TEXT_VJUSTIFY_TOP, numPenWidth, false, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1002,20 +1020,16 @@ void LIB_PIN::Plot( PLOTTER* aPlotter, const wxPoint& aPffset, bool aFill,
|
||||||
|
|
||||||
void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
||||||
{
|
{
|
||||||
wxString text = m_number.IsEmpty() ? wxT( "?" ) : m_number;
|
|
||||||
|
|
||||||
LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
|
LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
|
||||||
|
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), m_name ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetShownName() ) );
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Number" ), text ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Number" ), GetShownNumber() ) );
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), ElectricalPinTypeGetText( m_type ) ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), ElectricalPinTypeGetText( m_type ) ) );
|
||||||
|
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), PinShapeGetText( m_shape ) ) );
|
||||||
|
|
||||||
text = PinShapeGetText( m_shape );
|
wxString text = IsVisible() ? _( "Yes" ) : _( "No" );
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), text ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), text ) );
|
||||||
|
|
||||||
text = IsVisible() ? _( "Yes" ) : _( "No" );
|
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), text ) );
|
|
||||||
|
|
||||||
// Display pin length
|
// Display pin length
|
||||||
text = StringFromValue( aFrame->GetUserUnits(), m_length );
|
text = StringFromValue( aFrame->GetUserUnits(), m_length );
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text ) );
|
||||||
|
@ -1041,8 +1055,10 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles, bool aPinOnly )
|
||||||
wxPoint begin;
|
wxPoint begin;
|
||||||
wxPoint end;
|
wxPoint end;
|
||||||
int nameTextOffset = 0;
|
int nameTextOffset = 0;
|
||||||
bool showName = !m_name.IsEmpty() && ( m_name != wxT( "~" ) );
|
wxString name = GetShownName();
|
||||||
bool showNum = !m_number.IsEmpty();
|
wxString number = GetShownNumber();
|
||||||
|
bool showName = !name.IsEmpty();
|
||||||
|
bool showNum = !number.IsEmpty();
|
||||||
int minsizeV = TARGET_PIN_RADIUS;
|
int minsizeV = TARGET_PIN_RADIUS;
|
||||||
|
|
||||||
if( !aIncludeInvisibles && !IsVisible() )
|
if( !aIncludeInvisibles && !IsVisible() )
|
||||||
|
@ -1066,7 +1082,7 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles, bool aPinOnly )
|
||||||
}
|
}
|
||||||
|
|
||||||
// First, calculate boundary box corners position
|
// First, calculate boundary box corners position
|
||||||
int numberTextLength = showNum ? m_numTextSize * m_number.Len() : 0;
|
int numberTextLength = showNum ? m_numTextSize * number.Len() : 0;
|
||||||
|
|
||||||
// Actual text height is bigger than text size
|
// Actual text height is bigger than text size
|
||||||
int numberTextHeight = showNum ? KiROUND( m_numTextSize * 1.1 ) : 0;
|
int numberTextHeight = showNum ? KiROUND( m_numTextSize * 1.1 ) : 0;
|
||||||
|
@ -1085,12 +1101,9 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles, bool aPinOnly )
|
||||||
|
|
||||||
if( showName )
|
if( showName )
|
||||||
{
|
{
|
||||||
int length = m_name.Len();
|
int length = name.Len();
|
||||||
|
|
||||||
// Don't count the line over text symbol.
|
|
||||||
if( m_name.Left( 1 ) == wxT( "~" ) )
|
|
||||||
length -= 1;
|
|
||||||
|
|
||||||
|
// TODO: exclude markup characters!
|
||||||
nameTextLength = ( m_nameTextSize * length ) + nameTextOffset;
|
nameTextLength = ( m_nameTextSize * length ) + nameTextOffset;
|
||||||
|
|
||||||
// Actual text height are bigger than text size
|
// Actual text height are bigger than text size
|
||||||
|
@ -1196,7 +1209,5 @@ void LIB_PIN::Show( int nestLevel, std::ostream& os ) const
|
||||||
void LIB_PIN::CalcEdit( const wxPoint& aPosition )
|
void LIB_PIN::CalcEdit( const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
if( IsMoving() )
|
if( IsMoving() )
|
||||||
{
|
|
||||||
MoveTo( aPosition );
|
MoveTo( aPosition );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxString& GetName() const { return m_name; }
|
const wxString& GetName() const { return m_name; }
|
||||||
|
wxString GetShownName() const;
|
||||||
void SetName( const wxString& aName )
|
void SetName( const wxString& aName )
|
||||||
{
|
{
|
||||||
m_name = aName;
|
m_name = aName;
|
||||||
|
@ -113,6 +114,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxString& GetNumber() const { return m_number; }
|
const wxString& GetNumber() const { return m_number; }
|
||||||
|
wxString GetShownNumber() const { return m_number; }
|
||||||
void SetNumber( const wxString& aNumber )
|
void SetNumber( const wxString& aNumber )
|
||||||
{
|
{
|
||||||
m_number = aNumber;
|
m_number = aNumber;
|
||||||
|
|
|
@ -583,8 +583,8 @@ XNODE* NETLIST_EXPORTER_XML::makeLibParts()
|
||||||
XNODE* pin;
|
XNODE* pin;
|
||||||
|
|
||||||
pins->AddChild( pin = node( "pin" ) );
|
pins->AddChild( pin = node( "pin" ) );
|
||||||
pin->AddAttribute( "num", pinList[i]->GetNumber() );
|
pin->AddAttribute( "num", pinList[i]->GetShownNumber() );
|
||||||
pin->AddAttribute( "name", pinList[i]->GetName() );
|
pin->AddAttribute( "name", pinList[i]->GetShownName() );
|
||||||
pin->AddAttribute( "type", pinList[i]->GetCanonicalElectricalTypeName() );
|
pin->AddAttribute( "type", pinList[i]->GetCanonicalElectricalTypeName() );
|
||||||
|
|
||||||
// caution: construction work site here, drive slowly
|
// caution: construction work site here, drive slowly
|
||||||
|
@ -738,7 +738,7 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
|
||||||
xnode->AddAttribute( "ref", refText );
|
xnode->AddAttribute( "ref", refText );
|
||||||
xnode->AddAttribute( "pin", pinText );
|
xnode->AddAttribute( "pin", pinText );
|
||||||
|
|
||||||
wxString pinName = netNode.m_Pin->GetName();
|
wxString pinName = netNode.m_Pin->GetShownName();
|
||||||
wxString pinType = netNode.m_Pin->GetCanonicalElectricalTypeName();
|
wxString pinType = netNode.m_Pin->GetCanonicalElectricalTypeName();
|
||||||
|
|
||||||
// ~ is a char used to code empty strings in libs.
|
// ~ is a char used to code empty strings in libs.
|
||||||
|
|
|
@ -980,12 +980,12 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
|
||||||
size [INSIDE] = libEntry->ShowPinNames() ? aPin->GetNameTextSize() : 0;
|
size [INSIDE] = libEntry->ShowPinNames() ? aPin->GetNameTextSize() : 0;
|
||||||
thickness[INSIDE] = nameLineWidth;
|
thickness[INSIDE] = nameLineWidth;
|
||||||
colour [INSIDE] = getRenderColor( aPin, LAYER_PINNAM, drawingShadows );
|
colour [INSIDE] = getRenderColor( aPin, LAYER_PINNAM, drawingShadows );
|
||||||
text [INSIDE] = aPin->GetName();
|
text [INSIDE] = aPin->GetShownName();
|
||||||
|
|
||||||
size [ABOVE] = libEntry->ShowPinNumbers() ? aPin->GetNumberTextSize() : 0;
|
size [ABOVE] = libEntry->ShowPinNumbers() ? aPin->GetNumberTextSize() : 0;
|
||||||
thickness[ABOVE] = numLineWidth;
|
thickness[ABOVE] = numLineWidth;
|
||||||
colour [ABOVE] = getRenderColor( aPin, LAYER_PINNUM, drawingShadows );
|
colour [ABOVE] = getRenderColor( aPin, LAYER_PINNUM, drawingShadows );
|
||||||
text [ABOVE] = aPin->GetNumber();
|
text [ABOVE] = aPin->GetShownNumber();
|
||||||
}
|
}
|
||||||
// Otherwise pin NAMES go above and pin NUMBERS go below
|
// Otherwise pin NAMES go above and pin NUMBERS go below
|
||||||
else
|
else
|
||||||
|
@ -993,12 +993,12 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
|
||||||
size [ABOVE] = libEntry->ShowPinNames() ? aPin->GetNameTextSize() : 0;
|
size [ABOVE] = libEntry->ShowPinNames() ? aPin->GetNameTextSize() : 0;
|
||||||
thickness[ABOVE] = nameLineWidth;
|
thickness[ABOVE] = nameLineWidth;
|
||||||
colour [ABOVE] = getRenderColor( aPin, LAYER_PINNAM, drawingShadows );
|
colour [ABOVE] = getRenderColor( aPin, LAYER_PINNAM, drawingShadows );
|
||||||
text [ABOVE] = aPin->GetName();
|
text [ABOVE] = aPin->GetShownName();
|
||||||
|
|
||||||
size [BELOW] = libEntry->ShowPinNumbers() ? aPin->GetNumberTextSize() : 0;
|
size [BELOW] = libEntry->ShowPinNumbers() ? aPin->GetNumberTextSize() : 0;
|
||||||
thickness[BELOW] = numLineWidth;
|
thickness[BELOW] = numLineWidth;
|
||||||
colour [BELOW] = getRenderColor( aPin, LAYER_PINNUM, drawingShadows );
|
colour [BELOW] = getRenderColor( aPin, LAYER_PINNUM, drawingShadows );
|
||||||
text [BELOW] = aPin->GetNumber();
|
text [BELOW] = aPin->GetShownNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_schSettings.m_ShowPinsElectricalType )
|
if( m_schSettings.m_ShowPinsElectricalType )
|
||||||
|
@ -1472,7 +1472,7 @@ void SCH_PAINTER::draw( SCH_SYMBOL* aSymbol, int aLayer )
|
||||||
tempPin->ClearFlags();
|
tempPin->ClearFlags();
|
||||||
tempPin->SetFlags( symbolPin->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
|
tempPin->SetFlags( symbolPin->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
|
||||||
|
|
||||||
tempPin->SetName( symbolPin->GetName() );
|
tempPin->SetName( symbolPin->GetShownName() );
|
||||||
tempPin->SetType( symbolPin->GetType() );
|
tempPin->SetType( symbolPin->GetType() );
|
||||||
tempPin->SetShape( symbolPin->GetShape() );
|
tempPin->SetShape( symbolPin->GetShape() );
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,15 @@ wxString SCH_PIN::GetName() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString SCH_PIN::GetShownName() const
|
||||||
|
{
|
||||||
|
if( !m_alt.IsEmpty() )
|
||||||
|
return m_alt;
|
||||||
|
|
||||||
|
return m_libPin->GetShownName();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ELECTRICAL_PINTYPE SCH_PIN::GetType() const
|
ELECTRICAL_PINTYPE SCH_PIN::GetType() const
|
||||||
{
|
{
|
||||||
if( !m_alt.IsEmpty() )
|
if( !m_alt.IsEmpty() )
|
||||||
|
@ -174,8 +183,8 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
||||||
|
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Converted" ), msg ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Converted" ), msg ) );
|
||||||
|
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetName() ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetShownName() ) );
|
||||||
msg = GetNumber().IsEmpty() ? wxT( "?" ) : GetNumber();
|
msg = GetNumber().IsEmpty() ? wxT( "?" ) : GetShownNumber();
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Number" ), msg ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Number" ), msg ) );
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), ElectricalPinTypeGetText( GetType() ) ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), ElectricalPinTypeGetText( GetType() ) ) );
|
||||||
|
|
||||||
|
|
|
@ -103,8 +103,11 @@ public:
|
||||||
bool IsVisible() const { return m_libPin->IsVisible(); }
|
bool IsVisible() const { return m_libPin->IsVisible(); }
|
||||||
|
|
||||||
wxString GetName() const;
|
wxString GetName() const;
|
||||||
|
wxString GetShownName() const;
|
||||||
|
|
||||||
wxString GetNumber() const { return m_number; }
|
wxString GetNumber() const { return m_number; }
|
||||||
|
wxString GetShownNumber() const { return m_number; }
|
||||||
|
|
||||||
void SetNumber( const wxString& aNumber ) { m_number = aNumber; }
|
void SetNumber( const wxString& aNumber ) { m_number = aNumber; }
|
||||||
|
|
||||||
ELECTRICAL_PINTYPE GetType() const;
|
ELECTRICAL_PINTYPE GetType() const;
|
||||||
|
|
|
@ -659,7 +659,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
||||||
else if( primitive == "d" )
|
else if( primitive == "d" )
|
||||||
param = wxT( "Id" );
|
param = wxT( "Id" );
|
||||||
else
|
else
|
||||||
param = wxString::Format( wxT( "I%s" ), pin->GetName().Lower() );
|
param = wxString::Format( wxT( "I%s" ), pin->GetShownName().Lower() );
|
||||||
|
|
||||||
simFrame->AddCurrentPlot( symbol->GetRef( &m_frame->GetCurrentSheet() ),
|
simFrame->AddCurrentPlot( symbol->GetRef( &m_frame->GetCurrentSheet() ),
|
||||||
param );
|
param );
|
||||||
|
|
Loading…
Reference in New Issue