Eagle SCH importer: fix slash characters when fixing symbol names
Even though slash is a valid character in symbol names, it is a revision
separator, but is not the case with Eagle symbol names.
Fixes: lp:1791653
* https://bugs.launchpad.net/kicad/+bug/1791653
(cherry-picked from commit 2c217499
)
This commit is contained in:
parent
650ff5e5fe
commit
a149960faa
|
@ -1067,7 +1067,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
|||
wxString gatename = epart->deviceset + epart->device + einstance.gate;
|
||||
wxString symbolname = wxString( epart->deviceset + epart->device );
|
||||
symbolname.Replace( "*", "" );
|
||||
wxString kisymbolname = LIB_ID::FixIllegalChars( symbolname, LIB_ID::ID_SCH );
|
||||
wxString kisymbolname = fixSymbolName( symbolname );
|
||||
|
||||
int unit = m_eagleLibs[libraryname].GateUnit[gatename];
|
||||
|
||||
|
@ -1263,7 +1263,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode,
|
|||
wxString symbolName = edeviceset.name + edevice.name;
|
||||
symbolName.Replace( "*", "" );
|
||||
wxASSERT( !symbolName.IsEmpty() );
|
||||
symbolName = LIB_ID::FixIllegalChars( symbolName, LIB_ID::ID_SCH );
|
||||
symbolName = fixSymbolName( symbolName );
|
||||
|
||||
if( edevice.package )
|
||||
aEagleLibrary->package[symbolName] = edevice.package.Get();
|
||||
|
@ -1307,7 +1307,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode,
|
|||
if( gates_count == 1 && ispower )
|
||||
kpart->SetPower();
|
||||
|
||||
wxString name = LIB_ID::FixIllegalChars( kpart->GetName(), LIB_ID::ID_SCH );
|
||||
wxString name = fixSymbolName( kpart->GetName() );
|
||||
kpart->SetName( name );
|
||||
m_pi->SaveSymbol( getLibFileName().GetFullPath(), new LIB_PART( *kpart.get() ),
|
||||
m_properties.get() );
|
||||
|
@ -2579,3 +2579,17 @@ void SCH_EAGLE_PLUGIN::addImplicitConnections( SCH_COMPONENT* aComponent,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxString SCH_EAGLE_PLUGIN::fixSymbolName( const wxString& aName )
|
||||
{
|
||||
wxString ret = LIB_ID::FixIllegalChars( aName, LIB_ID::ID_ALIAS );
|
||||
|
||||
for( auto ch = ret.begin(); ch != ret.end(); ++ch )
|
||||
{
|
||||
if( *ch == '/' )
|
||||
*ch = '_';
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -250,6 +250,15 @@ private:
|
|||
* @param aUpdateSet decides whether the missing units data should be updated.
|
||||
*/
|
||||
void addImplicitConnections( SCH_COMPONENT* aComponent, SCH_SCREEN* aScreen, bool aUpdateSet );
|
||||
|
||||
/**
|
||||
* Fixes invalid characters in Eagle symbol names. It changes invalid characters
|
||||
* to underscores.
|
||||
*
|
||||
* @param aName is the symbol name to be fixed.
|
||||
* @return Fixed symbol name.
|
||||
*/
|
||||
static wxString fixSymbolName( const wxString& aName );
|
||||
};
|
||||
|
||||
#endif // _SCH_EAGLE_PLUGIN_H_
|
||||
|
|
Loading…
Reference in New Issue