Eeschema, LIB_PIN::SetNumber(): ensure spaces are replaced by _ and set modify flag on change.

Fixes: lp:1734187
https://bugs.launchpad.net/kicad/+bug/1734187
This commit is contained in:
jean-pierre charras 2017-11-28 21:02:00 +01:00
parent 0d57bfe71f
commit f992d144d9
2 changed files with 21 additions and 4 deletions

View File

@ -161,6 +161,7 @@ void LIB_PIN::SetName( const wxString& aName, bool aTestOtherPins )
{
wxString tmp = ( aName.IsEmpty() ) ? wxT( "~" ) : aName;
// pin name string does not support spaces
tmp.Replace( wxT( " " ), wxT( "_" ) );
if( m_name != tmp )
@ -217,6 +218,25 @@ void LIB_PIN::SetNameTextSize( int size, bool aTestOtherPins )
}
void LIB_PIN::SetNumber( const wxString& aNumber )
{
// Unlike SetName, others pin numbers marked by EnableEditMode() are
// not modified because each pin has its own number, so set number
// only for this.
wxString tmp = ( aNumber.IsEmpty() ) ? wxT( "~" ) : aNumber;
// pin number string does not support spaces
tmp.Replace( wxT( " " ), wxT( "_" ) );
if( m_number != tmp )
{
m_number = tmp;
SetModified();
}
}
void LIB_PIN::SetNumberTextSize( int size, bool aTestOtherPins )
{
if( size != m_numTextSize )

View File

@ -198,10 +198,7 @@ public:
* because each pin has its own number
* @param aNumber New pin number.
*/
void SetNumber( const wxString& aNumber )
{
m_number = aNumber;
}
void SetNumber( const wxString& aNumber );
/**
* Set the size of the pin number text.