Implement cross-references for labels.
Fixes https://gitlab.com/kicad/code/kicad/issues/11564
This commit is contained in:
parent
ecf6773f74
commit
f9f0f6fe24
|
@ -228,7 +228,12 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
|
||||||
if( m_activeTextEntry )
|
if( m_activeTextEntry )
|
||||||
{
|
{
|
||||||
// show control characters in a human-readable format
|
// show control characters in a human-readable format
|
||||||
m_activeTextEntry->SetValue( UnescapeString( m_currentLabel->GetText() ) );
|
wxString text = UnescapeString( m_currentLabel->GetText() );
|
||||||
|
|
||||||
|
// show text variable cross-references in a human-readable format
|
||||||
|
text = m_currentLabel->Schematic()->ConvertKIIDsToRefs( text );
|
||||||
|
|
||||||
|
m_activeTextEntry->SetValue( text );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_currentLabel->Type() == SCH_GLOBAL_LABEL_T || m_currentLabel->Type() == SCH_LABEL_T )
|
if( m_currentLabel->Type() == SCH_GLOBAL_LABEL_T || m_currentLabel->Type() == SCH_LABEL_T )
|
||||||
|
@ -403,6 +408,9 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataFromWindow()
|
||||||
// labels need escaping
|
// labels need escaping
|
||||||
text = EscapeString( m_activeTextEntry->GetValue(), CTX_NETNAME );
|
text = EscapeString( m_activeTextEntry->GetValue(), CTX_NETNAME );
|
||||||
|
|
||||||
|
// convert any text variable cross-references to their UUIDs
|
||||||
|
text = m_currentLabel->Schematic()->ConvertRefsToKIIDs( text );
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
// On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting
|
// On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting
|
||||||
text.Replace( "\r", "\n" );
|
text.Replace( "\r", "\n" );
|
||||||
|
|
|
@ -447,6 +447,12 @@ void SCH_LABEL_BASE::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
|
||||||
|
|
||||||
bool SCH_LABEL_BASE::ResolveTextVar( wxString* token, int aDepth ) const
|
bool SCH_LABEL_BASE::ResolveTextVar( wxString* token, int aDepth ) const
|
||||||
{
|
{
|
||||||
|
if( token->Contains( ':' ) )
|
||||||
|
{
|
||||||
|
if( Schematic()->ResolveCrossReference( token, aDepth ) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if( ( Type() == SCH_GLOBAL_LABEL_T || Type() == SCH_HIER_LABEL_T || Type() == SCH_SHEET_PIN_T )
|
if( ( Type() == SCH_GLOBAL_LABEL_T || Type() == SCH_HIER_LABEL_T || Type() == SCH_SHEET_PIN_T )
|
||||||
&& token->IsSameAs( wxT( "CONNECTION_TYPE" ) ) )
|
&& token->IsSameAs( wxT( "CONNECTION_TYPE" ) ) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue