Implement cross-references for labels.
Fixes https://gitlab.com/kicad/code/kicad/issues/11564
(cherry picked from commit f9f0f6fe24
)
This commit is contained in:
parent
5b24003f6c
commit
8524042352
|
@ -176,17 +176,22 @@ bool DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataToWindow()
|
|||
if( !wxDialog::TransferDataToWindow() )
|
||||
return false;
|
||||
|
||||
SCHEMATIC& schematic = m_Parent->Schematic();
|
||||
|
||||
if( m_CurrentText->Type() == SCH_TEXT_T )
|
||||
{
|
||||
SCHEMATIC& schematic = m_Parent->Schematic();
|
||||
|
||||
// show text variable cross-references in a human-readable format
|
||||
m_valueMultiLine->SetValue( schematic.ConvertKIIDsToRefs( m_CurrentText->GetText() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// show control characters in a human-readable format
|
||||
m_activeTextEntry->SetValue( UnescapeString( m_CurrentText->GetText() ) );
|
||||
wxString text = UnescapeString( m_CurrentText->GetText() );
|
||||
|
||||
// show text variable cross-references in a human-readable format
|
||||
text = schematic.ConvertKIIDsToRefs( text );
|
||||
|
||||
m_activeTextEntry->SetValue( text );
|
||||
}
|
||||
|
||||
if( m_valueCombo->IsShown() )
|
||||
|
@ -315,7 +320,8 @@ bool DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow()
|
|||
if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MILLIMETRES ) )
|
||||
return false;
|
||||
|
||||
wxString text;
|
||||
SCHEMATIC& schematic = m_Parent->Schematic();
|
||||
wxString text;
|
||||
|
||||
/* save old text in undo list if not already in edit */
|
||||
if( m_CurrentText->GetEditFlags() == 0 )
|
||||
|
@ -325,8 +331,7 @@ bool DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
if( m_CurrentText->Type() == SCH_TEXT_T )
|
||||
{
|
||||
// convert any text variable cross-references to their UUIDs
|
||||
text = m_Parent->Schematic().ConvertRefsToKIIDs( m_valueMultiLine->GetValue() );
|
||||
text = m_valueMultiLine->GetValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -334,6 +339,9 @@ bool DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow()
|
|||
text = EscapeString( m_activeTextEntry->GetValue(), CTX_NETNAME );
|
||||
}
|
||||
|
||||
// convert any text variable cross-references to their UUIDs
|
||||
text = schematic.ConvertRefsToKIIDs( text );
|
||||
|
||||
if( !text.IsEmpty() )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
|
|
|
@ -619,21 +619,18 @@ wxString SCH_TEXT::GetShownText( int aDepth ) const
|
|||
return true;
|
||||
}
|
||||
|
||||
if( Type() == SCH_TEXT_T )
|
||||
if( token->Contains( ':' ) )
|
||||
{
|
||||
if( token->Contains( ':' ) )
|
||||
{
|
||||
if( Schematic()->ResolveCrossReference( token, aDepth ) )
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
SCHEMATIC* schematic = Schematic();
|
||||
SCH_SHEET* sheet = schematic ? schematic->CurrentSheet().Last() : nullptr;
|
||||
if( Schematic()->ResolveCrossReference( token, aDepth ) )
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
SCHEMATIC* schematic = Schematic();
|
||||
SCH_SHEET* sheet = schematic ? schematic->CurrentSheet().Last() : nullptr;
|
||||
|
||||
if( sheet && sheet->ResolveTextVar( token, aDepth + 1 ) )
|
||||
return true;
|
||||
}
|
||||
if( sheet && sheet->ResolveTextVar( token, aDepth + 1 ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue