Eeschema: fix library naming bugs in symbol rescuer and re-mapper.
File names with spaces were causing invalid symbol names in both the rescue library and the cache which would cause both libraries to fail to load because library symbol names are not escaped so the spaces tripped up the library parser. Replace the spaces in the file names with hyphens and in both the rescuer and the remapping code so the library nickname in the symbol library table does not contain spaces. Update the symbol library table dialog to prevent users from defining library nicknames with spaces. This is different than the footprint library table which allows nicknames with spaces. This solution is a temporary fix until the new symbol library and schematic file formats are implemented. Fix off by one row in illegal nickname error message in the symbol library table editor.
This commit is contained in:
parent
5051dc8848
commit
998d9179e9
|
@ -266,11 +266,11 @@ bool DIALOG_SYMBOL_LIB_TABLE::verifyTables()
|
|||
// button.
|
||||
model.DeleteRows( r, 1 );
|
||||
}
|
||||
else if( nick.find( ':' ) != size_t( -1 ) )
|
||||
else if( nick.find( ':' ) != size_t( -1 ) || nick.find( ' ' ) != size_t( -1 ) )
|
||||
{
|
||||
wxString msg = wxString::Format(
|
||||
_( "Illegal character \"%s\" found in Nickname: \"%s\" in row %d" ),
|
||||
":", GetChars( nick ), r );
|
||||
( nick.find( ':' ) != size_t( -1 ) ) ? ":" : " ", GetChars( nick ), r + 1 );
|
||||
|
||||
// show the tabbed panel holding the grid we have flunked:
|
||||
if( &model != cur_model() )
|
||||
|
|
|
@ -153,6 +153,10 @@ void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter )
|
|||
int libNameInc = 1;
|
||||
int libNameLen = libName.Length();
|
||||
|
||||
// Spaces in the file name will break the symbol name because they are not
|
||||
// quoted in the symbol library file format.
|
||||
libName.Replace( " ", "-" );
|
||||
|
||||
// Don't create duplicate table entries.
|
||||
while( std::find( libNames.begin(), libNames.end(), libName ) != libNames.end() )
|
||||
{
|
||||
|
|
|
@ -395,8 +395,12 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
|
|||
|
||||
// Differentiate symbol name in the resue library by appending the symbol library
|
||||
// table nickname to the symbol name to prevent name clashes in the rescue library.
|
||||
LIB_ID new_id( GetRescueLibraryFileName().GetName(),
|
||||
new_name + "-" + part_id.GetLibNickname().wx_str() );
|
||||
wxString libNickname = GetRescueLibraryFileName().GetName();
|
||||
|
||||
// Spaces in the file name will break the symbol name because they are not
|
||||
// quoted in the symbol library file format.
|
||||
libNickname.Replace( " ", "-" );
|
||||
LIB_ID new_id( libNickname, new_name + "-" + part_id.GetLibNickname().wx_str() );
|
||||
|
||||
RESCUE_SYMBOL_LIB_TABLE_CANDIDATE candidate( part_id, new_id, cache_match, lib_match );
|
||||
|
||||
|
@ -808,7 +812,13 @@ bool SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary( SCH_EDIT_FRAME *aEditFrame )
|
|||
}
|
||||
|
||||
wxString uri = "${KIPRJMOD}/" + fn.GetFullName();
|
||||
SYMBOL_LIB_TABLE_ROW* row = new SYMBOL_LIB_TABLE_ROW( fn.GetName(), uri,
|
||||
wxString libNickname = fn.GetName();
|
||||
|
||||
// Spaces in the file name will break the symbol name because they are not
|
||||
// quoted in the symbol library file format.
|
||||
libNickname.Replace( " ", "-" );
|
||||
|
||||
SYMBOL_LIB_TABLE_ROW* row = new SYMBOL_LIB_TABLE_ROW( libNickname, uri,
|
||||
wxString( "Legacy" ) );
|
||||
m_prj->SchSymbolLibTable()->InsertRow( row );
|
||||
|
||||
|
|
Loading…
Reference in New Issue