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] == '{' )
|
||||
{
|
||||
wxString token;
|
||||
int depth = 1;
|
||||
|
||||
for( i = i + 1; i < sourceLen; ++i )
|
||||
{
|
||||
if( aSource[i] == '}' )
|
||||
if( aSource[i] == '{' )
|
||||
depth++;
|
||||
else if( aSource[i] == '}' )
|
||||
depth--;
|
||||
|
||||
if( depth <= 0 )
|
||||
break;
|
||||
else
|
||||
token.append( aSource[i] );
|
||||
|
@ -194,7 +200,7 @@ wxString UnescapeString( const wxString& aSource )
|
|||
else if( token == wxS( "brace" ) ) newbuf.append( wxS( "{" ) );
|
||||
else
|
||||
{
|
||||
newbuf.append( "{" + token + "}" );
|
||||
newbuf.append( "{" + UnescapeString( token ) + "}" );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -2320,13 +2320,15 @@ bool CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts( const CONNECTION_SUBGRAPH
|
|||
|
||||
// In some cases, the connection list (SCH_CONNECTION*) can be null.
|
||||
// Skip null connections.
|
||||
if( bus_entry->Connection( &sheet ) && bus_wire->Type() == SCH_LINE_T
|
||||
&& bus_wire->Connection( &sheet ) )
|
||||
if( bus_entry->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 );
|
||||
|
||||
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() )
|
||||
{
|
||||
|
@ -2354,10 +2356,11 @@ bool CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts( const CONNECTION_SUBGRAPH
|
|||
|
||||
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"
|
||||
" member of that bus" ),
|
||||
aSubgraph->m_driver_connection->Name( true ),
|
||||
bus_name );
|
||||
UnescapeString( netName ),
|
||||
UnescapeString( bus_name ) );
|
||||
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_BUS_ENTRY_CONFLICT );
|
||||
ercItem->SetItems( bus_entry, bus_wire );
|
||||
ercItem->SetErrorMessage( msg );
|
||||
|
@ -2726,11 +2729,13 @@ int CONNECTION_GRAPH::ercCheckHierSheets()
|
|||
|
||||
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 );
|
||||
ercItem->SetItems( unmatched.second );
|
||||
ercItem->SetErrorMessage( wxString::Format(
|
||||
_( "Sheet port %s has no matching hierarchical label inside the sheet" ),
|
||||
unmatched.first ) );
|
||||
ercItem->SetErrorMessage( msg );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, unmatched.second->GetPosition() );
|
||||
sheet.LastScreen()->Append( marker );
|
||||
|
|
|
@ -552,8 +552,7 @@ wxString SCH_TEXT::GetShownText( int aDepth ) const
|
|||
|
||||
if( processTextVars )
|
||||
{
|
||||
wxCHECK_MSG( Schematic(), wxEmptyString,
|
||||
"No parent SCHEMATIC set for SCH_TEXT!" );
|
||||
wxCHECK_MSG( Schematic(), wxEmptyString, "No parent SCHEMATIC set for SCH_TEXT!" );
|
||||
|
||||
PROJECT* project = nullptr;
|
||||
|
||||
|
|
Loading…
Reference in New Issue