Handle nested unescaping (for buses in particular).
Also adds a few missing unescape() calls when showing netnames to the user. Fixes https://gitlab.com/kicad/code/kicad/issues/6400
This commit is contained in:
parent
e6a8ae7dfc
commit
3d852372ca
|
@ -170,10 +170,16 @@ wxString UnescapeString( const wxString& aSource )
|
||||||
else if( aSource[i] == '{' )
|
else if( aSource[i] == '{' )
|
||||||
{
|
{
|
||||||
wxString token;
|
wxString token;
|
||||||
|
int depth = 1;
|
||||||
|
|
||||||
for( i = i + 1; i < sourceLen; ++i )
|
for( i = i + 1; i < sourceLen; ++i )
|
||||||
{
|
{
|
||||||
if( aSource[i] == '}' )
|
if( aSource[i] == '{' )
|
||||||
|
depth++;
|
||||||
|
else if( aSource[i] == '}' )
|
||||||
|
depth--;
|
||||||
|
|
||||||
|
if( depth <= 0 )
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
token.append( aSource[i] );
|
token.append( aSource[i] );
|
||||||
|
@ -194,7 +200,7 @@ wxString UnescapeString( const wxString& aSource )
|
||||||
else if( token == wxS( "brace" ) ) newbuf.append( wxS( "{" ) );
|
else if( token == wxS( "brace" ) ) newbuf.append( wxS( "{" ) );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newbuf.append( "{" + token + "}" );
|
newbuf.append( "{" + UnescapeString( token ) + "}" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -2320,13 +2320,15 @@ bool CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts( const CONNECTION_SUBGRAPH
|
||||||
|
|
||||||
// In some cases, the connection list (SCH_CONNECTION*) can be null.
|
// In some cases, the connection list (SCH_CONNECTION*) can be null.
|
||||||
// Skip null connections.
|
// Skip null connections.
|
||||||
if( bus_entry->Connection( &sheet ) && bus_wire->Type() == SCH_LINE_T
|
if( bus_entry->Connection( &sheet )
|
||||||
&& bus_wire->Connection( &sheet ) )
|
&& bus_wire->Type() == SCH_LINE_T
|
||||||
|
&& bus_wire->Connection( &sheet ) )
|
||||||
{
|
{
|
||||||
conflict = true;
|
conflict = true; // Assume a conflict; we'll reset if we find it's OK
|
||||||
|
|
||||||
bus_name = bus_wire->Connection( &sheet )->Name( true );
|
bus_name = bus_wire->Connection( &sheet )->Name( true );
|
||||||
|
|
||||||
auto test_name = bus_entry->Connection( &sheet )->Name( true );
|
wxString test_name = bus_entry->Connection( &sheet )->Name( true );
|
||||||
|
|
||||||
for( const auto& member : bus_wire->Connection( &sheet )->Members() )
|
for( const auto& member : bus_wire->Connection( &sheet )->Members() )
|
||||||
{
|
{
|
||||||
|
@ -2354,10 +2356,11 @@ bool CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts( const CONNECTION_SUBGRAPH
|
||||||
|
|
||||||
if( conflict )
|
if( conflict )
|
||||||
{
|
{
|
||||||
|
wxString netName = aSubgraph->m_driver_connection->Name( true );
|
||||||
wxString msg = wxString::Format( _( "Net %s is graphically connected to bus %s but is not a"
|
wxString msg = wxString::Format( _( "Net %s is graphically connected to bus %s but is not a"
|
||||||
" member of that bus" ),
|
" member of that bus" ),
|
||||||
aSubgraph->m_driver_connection->Name( true ),
|
UnescapeString( netName ),
|
||||||
bus_name );
|
UnescapeString( bus_name ) );
|
||||||
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_BUS_ENTRY_CONFLICT );
|
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_BUS_ENTRY_CONFLICT );
|
||||||
ercItem->SetItems( bus_entry, bus_wire );
|
ercItem->SetItems( bus_entry, bus_wire );
|
||||||
ercItem->SetErrorMessage( msg );
|
ercItem->SetErrorMessage( msg );
|
||||||
|
@ -2726,11 +2729,13 @@ int CONNECTION_GRAPH::ercCheckHierSheets()
|
||||||
|
|
||||||
for( const std::pair<const wxString, SCH_SHEET_PIN*>& unmatched : pins )
|
for( const std::pair<const wxString, SCH_SHEET_PIN*>& unmatched : pins )
|
||||||
{
|
{
|
||||||
|
wxString msg = wxString::Format( _( "Sheet pin %s has no matching hierarchical "
|
||||||
|
"label inside the sheet" ),
|
||||||
|
UnescapeString( unmatched.first ) );
|
||||||
|
|
||||||
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_HIERACHICAL_LABEL );
|
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_HIERACHICAL_LABEL );
|
||||||
ercItem->SetItems( unmatched.second );
|
ercItem->SetItems( unmatched.second );
|
||||||
ercItem->SetErrorMessage( wxString::Format(
|
ercItem->SetErrorMessage( msg );
|
||||||
_( "Sheet port %s has no matching hierarchical label inside the sheet" ),
|
|
||||||
unmatched.first ) );
|
|
||||||
|
|
||||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, unmatched.second->GetPosition() );
|
SCH_MARKER* marker = new SCH_MARKER( ercItem, unmatched.second->GetPosition() );
|
||||||
sheet.LastScreen()->Append( marker );
|
sheet.LastScreen()->Append( marker );
|
||||||
|
|
|
@ -552,8 +552,7 @@ wxString SCH_TEXT::GetShownText( int aDepth ) const
|
||||||
|
|
||||||
if( processTextVars )
|
if( processTextVars )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( Schematic(), wxEmptyString,
|
wxCHECK_MSG( Schematic(), wxEmptyString, "No parent SCHEMATIC set for SCH_TEXT!" );
|
||||||
"No parent SCHEMATIC set for SCH_TEXT!" );
|
|
||||||
|
|
||||||
PROJECT* project = nullptr;
|
PROJECT* project = nullptr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue