Added option to not test other pins when setting pin parameters

- On loading from file, other pins are not LINKED and thus can be ignored
- 90% reduction in library load time when launching eeschema
This commit is contained in:
Oliver Walters 2017-09-28 19:47:02 +10:00 committed by Wayne Stambaugh
parent ded4ad9b17
commit 948dfe88ce
3 changed files with 52 additions and 28 deletions

View File

@ -156,7 +156,7 @@ LIB_PIN::LIB_PIN( LIB_PART* aParent ) :
}
void LIB_PIN::SetName( const wxString& aName )
void LIB_PIN::SetName( const wxString& aName, bool aTestOtherPins )
{
wxString tmp = ( aName.IsEmpty() ) ? wxT( "~" ) : aName;
@ -168,6 +168,9 @@ void LIB_PIN::SetName( const wxString& aName )
SetModified();
}
if( !aTestOtherPins )
return;
if( GetParent() == NULL )
return;
@ -185,7 +188,7 @@ void LIB_PIN::SetName( const wxString& aName )
}
void LIB_PIN::SetNameTextSize( int size )
void LIB_PIN::SetNameTextSize( int size, bool aTestOtherPins )
{
if( size != m_nameTextSize )
{
@ -193,6 +196,9 @@ void LIB_PIN::SetNameTextSize( int size )
SetModified();
}
if( !aTestOtherPins )
return;
if( GetParent() == NULL )
return;
@ -210,7 +216,7 @@ void LIB_PIN::SetNameTextSize( int size )
}
void LIB_PIN::SetNumberTextSize( int size )
void LIB_PIN::SetNumberTextSize( int size, bool aTestOtherPins )
{
if( size != m_numTextSize )
{
@ -218,6 +224,9 @@ void LIB_PIN::SetNumberTextSize( int size )
SetModified();
}
if( !aTestOtherPins )
return;
if( GetParent() == NULL )
return;
@ -235,7 +244,7 @@ void LIB_PIN::SetNumberTextSize( int size )
}
void LIB_PIN::SetOrientation( int orientation )
void LIB_PIN::SetOrientation( int orientation, bool aTestOtherPins )
{
if( m_orientation != orientation )
{
@ -243,6 +252,9 @@ void LIB_PIN::SetOrientation( int orientation )
SetModified();
}
if( !aTestOtherPins )
return;
if( GetParent() == NULL )
return;
@ -290,7 +302,7 @@ void LIB_PIN::SetShape( GRAPHIC_PINSHAPE aShape )
}
void LIB_PIN::SetType( ELECTRICAL_PINTYPE aType )
void LIB_PIN::SetType( ELECTRICAL_PINTYPE aType, bool aTestOtherPins )
{
assert( aType >= 0 && aType < (int)PINTYPE_COUNT );
@ -306,6 +318,9 @@ void LIB_PIN::SetType( ELECTRICAL_PINTYPE aType )
SetModified();
}
if( !aTestOtherPins )
return;
if( GetParent() == NULL )
return;
@ -323,7 +338,7 @@ void LIB_PIN::SetType( ELECTRICAL_PINTYPE aType )
}
void LIB_PIN::SetLength( int length )
void LIB_PIN::SetLength( int length, bool aTestOtherPins )
{
if( m_length != length )
{
@ -331,6 +346,9 @@ void LIB_PIN::SetLength( int length )
SetModified();
}
if( !aTestOtherPins )
return;
if( GetParent() == NULL )
return;

View File

@ -170,8 +170,9 @@ public:
* This will also all of the pin names marked by EnableEditMode().
*
* @param aName New pin name.
* @param aTestOtherPins determines if other pins need to be updated
*/
void SetName( const wxString& aName );
void SetName( const wxString& aName, bool aTestOtherPins = true );
/**
* Set the \a aSize of the pin name text.
@ -180,8 +181,9 @@ public:
* by EnableEditMode().
*
* @param aSize The text size of the pin name in schematic units ( mils ).
* @param aTestOtherPins determines if other pins need to be updated
*/
void SetNameTextSize( int aSize );
void SetNameTextSize( int aSize, bool aTestOtherPins = true );
int GetNameTextSize() const { return m_nameTextSize; }
@ -209,8 +211,9 @@ public:
* by EnableEditMode().
*
* @param aSize The text size of the pin number in schematic units ( mils ).
* @param aTestOtherPins determines if other pins need to be updated
*/
void SetNumberTextSize( int aSize );
void SetNumberTextSize( int aSize, bool aTestOtherPins = true );
int GetNumberTextSize() const { return m_numTextSize; }
@ -222,8 +225,9 @@ public:
* This will also update the orientation of the pins marked by EnableEditMode().
*
* @param aOrientation - The orientation of the pin.
* @param aTestOtherPins determines if other pins need to be updated
*/
void SetOrientation( int aOrientation );
void SetOrientation( int aOrientation, bool aTestOtherPins = true );
void Rotate() override;
@ -279,8 +283,9 @@ public:
* EnableEditMode().
*
* @param aType - The electrical type of the pin(see enun ELECTRICAL_PINTYPE for values).
* @param aTestOtherPins determines if other pins need to be updated
*/
void SetType( ELECTRICAL_PINTYPE aType );
void SetType( ELECTRICAL_PINTYPE aType, bool aTestOtherPins = true );
/**
* Set the pin length.
@ -288,8 +293,9 @@ public:
* This will also update the length of the pins marked by EnableEditMode().
*
* @param aLength - The length of the pin in mils.
* @param aTestOtherPins determines if other pins need to be updated
*/
void SetLength( int aLength );
void SetLength( int aLength, bool aTestOtherPins = true );
int GetLength() { return m_length; }

View File

@ -3026,7 +3026,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr< LIB_PART >& aPart,
parseUnquotedString( name, aReader, line, &line );
parseUnquotedString( number, aReader, line, &line );
pin->SetName( name );
pin->SetName( name, false );
pin->SetNumber( number );
wxPoint pos;
@ -3034,10 +3034,10 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr< LIB_PART >& aPart,
pos.x = parseInt( aReader, line, &line );
pos.y = parseInt( aReader, line, &line );
pin->SetPosition( pos );
pin->SetLength( parseInt( aReader, line, &line ) );
pin->SetOrientation( parseChar( aReader, line, &line ) );
pin->SetNumberTextSize( parseInt( aReader, line, &line ) );
pin->SetNameTextSize( parseInt( aReader, line, &line ) );
pin->SetLength( parseInt( aReader, line, &line ), false );
pin->SetOrientation( parseChar( aReader, line, &line ), false );
pin->SetNumberTextSize( parseInt( aReader, line, &line ), false );
pin->SetNameTextSize( parseInt( aReader, line, &line ), false );
pin->SetUnit( parseInt( aReader, line, &line ) );
pin->SetConvert( parseInt( aReader, line, &line ) );
@ -3051,47 +3051,47 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr< LIB_PART >& aPart,
switch( type )
{
case 'I':
pin->SetType( PIN_INPUT );
pin->SetType( PIN_INPUT, false );
break;
case 'O':
pin->SetType( PIN_OUTPUT );
pin->SetType( PIN_OUTPUT, false );
break;
case 'B':
pin->SetType( PIN_BIDI );
pin->SetType( PIN_BIDI, false );
break;
case 'T':
pin->SetType( PIN_TRISTATE );
pin->SetType( PIN_TRISTATE, false );
break;
case 'P':
pin->SetType( PIN_PASSIVE );
pin->SetType( PIN_PASSIVE, false );
break;
case 'U':
pin->SetType( PIN_UNSPECIFIED );
pin->SetType( PIN_UNSPECIFIED, false );
break;
case 'W':
pin->SetType( PIN_POWER_IN );
pin->SetType( PIN_POWER_IN, false );
break;
case 'w':
pin->SetType( PIN_POWER_OUT );
pin->SetType( PIN_POWER_OUT, false );
break;
case 'C':
pin->SetType( PIN_OPENCOLLECTOR );
pin->SetType( PIN_OPENCOLLECTOR, false );
break;
case 'E':
pin->SetType( PIN_OPENEMITTER );
pin->SetType( PIN_OPENEMITTER, false );
break;
case 'N':
pin->SetType( PIN_NC );
pin->SetType( PIN_NC, false );
break;
default: