Eeschema: fix an issue in netlists when using "<root sheet>" as root sheet path name.
Netlists do not accept any char in netnames (especially spice). They must use only "/" as root sheet path name. Especially _( "<root sheet>" ) breaks netlists because: - there is a space in name, and special chars (< and >) - it is a translatable name. so the actual name cannot be managed. - most of netlist code in Kicad expects a "/" as root path.
This commit is contained in:
parent
251e0ca19c
commit
710a82bc51
|
@ -72,6 +72,7 @@ void NETLIST_EXPORTER_PSPICE::ReplaceForbiddenChars( wxString &aNetName )
|
||||||
|
|
||||||
aNetName.Replace( "(", "_" );
|
aNetName.Replace( "(", "_" );
|
||||||
aNetName.Replace( ")", "_" );
|
aNetName.Replace( ")", "_" );
|
||||||
|
aNetName.Replace( " ", "_" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -602,8 +602,8 @@ wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet()
|
||||||
wxString filename = fn.GetName();
|
wxString filename = fn.GetName();
|
||||||
wxString sheetFullName = g_CurrentSheet->PathHumanReadable();
|
wxString sheetFullName = g_CurrentSheet->PathHumanReadable();
|
||||||
|
|
||||||
if( sheetFullName == "<root sheet>" || sheetFullName == _( "<root sheet>" ) ||
|
if( sheetFullName == SCH_SHEET_PATH::GetRootPathName( false ) ||
|
||||||
sheetFullName == "/" )
|
sheetFullName == SCH_SHEET_PATH::GetRootPathName( true ) )
|
||||||
{
|
{
|
||||||
// For the root sheet, use root schematic file name.
|
// For the root sheet, use root schematic file name.
|
||||||
sheetFullName.clear();
|
sheetFullName.clear();
|
||||||
|
|
|
@ -166,12 +166,22 @@ wxString SCH_SHEET_PATH::Path() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString SCH_SHEET_PATH::GetRootPathName( bool aUseShortName )
|
||||||
|
{
|
||||||
|
// return a PathName for the root sheet (like "/" or "<root>"
|
||||||
|
// DO NOT use it in netlists, because it can easily break these netlists
|
||||||
|
// especially after translation, because many netlists (i.e. spice) do not accept any char
|
||||||
|
// Use only the short name ("/") and the full name only in messages
|
||||||
|
return aUseShortName ? wxT( "/" ) : _( "<root_sheet>" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString SCH_SHEET_PATH::PathHumanReadable() const
|
wxString SCH_SHEET_PATH::PathHumanReadable() const
|
||||||
{
|
{
|
||||||
wxString s;
|
wxString s;
|
||||||
|
|
||||||
if( size() == 1 )
|
if( size() == 1 )
|
||||||
return _( "<root sheet>" );
|
return GetRootPathName( true ); // Use only the short name in netlists
|
||||||
|
|
||||||
s = wxT( "/" );
|
s = wxT( "/" );
|
||||||
|
|
||||||
|
|
|
@ -229,6 +229,12 @@ public:
|
||||||
*/
|
*/
|
||||||
wxString PathHumanReadable() const;
|
wxString PathHumanReadable() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a PathName for the root sheet (like "/" or "<root>"
|
||||||
|
* @param aUseShortName: true to return "/", false to return a longer name
|
||||||
|
*/
|
||||||
|
static wxString GetRootPathName( bool aUseShortName = true );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function UpdateAllScreenReferences
|
* Function UpdateAllScreenReferences
|
||||||
* updates the reference and the m_Multi parameter (part selection) for all
|
* updates the reference and the m_Multi parameter (part selection) for all
|
||||||
|
|
Loading…
Reference in New Issue