Fix a bunch more issues with sheetpaths and allowExtraText.
A sheetpath is required to correctly resolve text variables. Depending on currentSheet is rife with bugs. There are many places where we do *not* want to be prepending field names to the field values, such as netlisting, building PDF hypertext menus, etc. Also, Find/Replace needs to work on unresolved text, as that's what we're going to display (and if replace nuked your variable references you wouldn't be happy).
This commit is contained in:
parent
fb6b8eaeea
commit
b41d446f58
|
@ -89,7 +89,7 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
|
|||
callback_gal.SetIsFill( font->IsOutline() );
|
||||
callback_gal.SetIsStroke( font->IsStroke() );
|
||||
callback_gal.SetLineWidth( attrs.m_StrokeWidth );
|
||||
font->Draw( &callback_gal, aText->GetShownText(), aText->GetDrawPos(), attrs );
|
||||
font->Draw( &callback_gal, aText->GetShownText( true ), aText->GetDrawPos(), attrs );
|
||||
|
||||
SHAPE_POLY_SET finalPoly;
|
||||
int margin = attrs.m_StrokeWidth * 1.5 +
|
||||
|
@ -135,7 +135,7 @@ void BOARD_ADAPTER::addText( const EDA_TEXT* aText, CONTAINER_2D_BASE* aContaine
|
|||
|
||||
attrs.m_Angle = aText->GetDrawRotation();
|
||||
|
||||
font->Draw( &callback_gal, aText->GetShownText(), aText->GetDrawPos(), attrs );
|
||||
font->Draw( &callback_gal, aText->GetShownText( true ), aText->GetDrawPos(), attrs );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2013 Jean-Pierre Charras <jp.charras at wanadoo.fr>.
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -118,8 +118,12 @@ void DS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
|
|||
break;
|
||||
|
||||
case DS_DATA_ITEM::DS_TEXT:
|
||||
aList.emplace_back( _( "Text" ), static_cast<DS_DRAW_ITEM_TEXT*>( this )->GetShownText() );
|
||||
{
|
||||
DS_DRAW_ITEM_TEXT* textItem = static_cast<DS_DRAW_ITEM_TEXT*>( this );
|
||||
// Don't use GetShownText(); we want to see the variable references here
|
||||
aList.emplace_back( _( "Text" ), KIUI::EllipsizeStatusText( aFrame, textItem->GetText() ) );
|
||||
break;
|
||||
}
|
||||
|
||||
case DS_DATA_ITEM::DS_POLYPOLYGON:
|
||||
aList.emplace_back( _( "Imported Shape" ), wxEmptyString );
|
||||
|
@ -190,7 +194,7 @@ bool DS_DRAW_ITEM_TEXT::HitTest( const BOX2I& aRect, bool aContains, int aAccura
|
|||
|
||||
wxString DS_DRAW_ITEM_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Text '%s'" ), GetShownText() );
|
||||
return wxString::Format( _( "Text '%s'" ), KIUI::EllipsizeMenuText( GetText() ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ void KIGFX::DS_PAINTER::draw( const DS_DRAW_ITEM_TEXT* aItem, int aLayer ) const
|
|||
attrs.m_StrokeWidth = std::max( aItem->GetEffectiveTextPenWidth(),
|
||||
m_renderSettings.GetDefaultPenWidth() );
|
||||
|
||||
font->Draw( m_gal, aItem->GetShownText(), aItem->GetTextPos(), attrs );
|
||||
font->Draw( m_gal, aItem->GetShownText( true ), aItem->GetTextPos(), attrs );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -479,7 +479,7 @@ EDA_TEXT::GetRenderCache( const KIFONT::FONT* aFont, const wxString& forResolved
|
|||
|
||||
attrs.m_Angle = resolvedAngle;
|
||||
|
||||
font->GetLinesAsGlyphs( &m_render_cache, GetShownText(), GetDrawPos() + aOffset,
|
||||
font->GetLinesAsGlyphs( &m_render_cache, forResolvedText, GetDrawPos() + aOffset,
|
||||
attrs );
|
||||
m_render_cache_angle = resolvedAngle;
|
||||
m_render_cache_text = forResolvedText;
|
||||
|
@ -527,7 +527,7 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
|
|||
|
||||
BOX2I bbox;
|
||||
wxArrayString strings;
|
||||
wxString text = GetShownText();
|
||||
wxString text = GetShownText( true );
|
||||
int thickness = GetEffectiveTextPenWidth();
|
||||
|
||||
if( IsMultilineAllowed() )
|
||||
|
@ -665,7 +665,7 @@ void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
|
|||
{
|
||||
std::vector<VECTOR2I> positions;
|
||||
wxArrayString strings;
|
||||
wxStringSplit( GetShownText(), strings, '\n' );
|
||||
wxStringSplit( GetShownText( true ), strings, '\n' );
|
||||
|
||||
positions.reserve( strings.Count() );
|
||||
|
||||
|
@ -676,7 +676,8 @@ void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
|
|||
}
|
||||
else
|
||||
{
|
||||
printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText(), GetDrawPos() );
|
||||
printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText( true ),
|
||||
GetDrawPos() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -897,7 +898,7 @@ std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( bool aTriangula
|
|||
shape->AddShape( triShape );
|
||||
} );
|
||||
|
||||
font->Draw( &callback_gal, GetShownText(), GetDrawPos(), attrs );
|
||||
font->Draw( &callback_gal, GetShownText( true ), GetDrawPos(), attrs );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -914,7 +915,7 @@ std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( bool aTriangula
|
|||
shape->AddShape( aPoly.Clone() );
|
||||
} );
|
||||
|
||||
font->Draw( &callback_gal, GetShownText(), GetDrawPos(), attrs );
|
||||
font->Draw( &callback_gal, GetShownText( true ), GetDrawPos(), attrs );
|
||||
}
|
||||
|
||||
return shape;
|
||||
|
|
|
@ -131,10 +131,10 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
|
|||
|
||||
int penWidth = std::max( text->GetEffectiveTextPenWidth(), defaultPenWidth );
|
||||
|
||||
plotter->Text( text->GetTextPos(), color, text->GetShownText(), text->GetTextAngle(),
|
||||
text->GetTextSize(), text->GetHorizJustify(), text->GetVertJustify(),
|
||||
penWidth, text->IsItalic(), text->IsBold(), text->IsMultilineAllowed(),
|
||||
font );
|
||||
plotter->Text( text->GetTextPos(), color, text->GetShownText( true ),
|
||||
text->GetTextAngle(), text->GetTextSize(), text->GetHorizJustify(),
|
||||
text->GetVertJustify(), penWidth, text->IsItalic(), text->IsBold(),
|
||||
text->IsMultilineAllowed(), font );
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -377,7 +377,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
|
|||
if( symbol->GetUnitCount() > 1 )
|
||||
{
|
||||
msg.Printf( _( "Updated %s (unit %s) from %s to %s." ),
|
||||
symbol->GetValueFieldText( true ),
|
||||
symbol->GetValueFieldText( true, sheet, false ),
|
||||
LIB_SYMBOL::SubReference( symbol->GetUnit(), false ),
|
||||
prevRef,
|
||||
newRef );
|
||||
|
@ -385,7 +385,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
|
|||
else
|
||||
{
|
||||
msg.Printf( _( "Updated %s from %s to %s." ),
|
||||
symbol->GetValueFieldText( true ),
|
||||
symbol->GetValueFieldText( true, sheet, false ),
|
||||
prevRef,
|
||||
newRef );
|
||||
}
|
||||
|
@ -395,14 +395,14 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
|
|||
if( symbol->GetUnitCount() > 1 )
|
||||
{
|
||||
msg.Printf( _( "Annotated %s (unit %s) as %s." ),
|
||||
symbol->GetValueFieldText( true ),
|
||||
symbol->GetValueFieldText( true, sheet, false ),
|
||||
LIB_SYMBOL::SubReference( symbol->GetUnit(), false ),
|
||||
newRef );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "Annotated %s as %s." ),
|
||||
symbol->GetValueFieldText( true ),
|
||||
symbol->GetValueFieldText( true, sheet, false ),
|
||||
newRef );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -337,12 +337,15 @@ wxString CONNECTION_SUBGRAPH::driverName( SCH_ITEM* aItem ) const
|
|||
case SCH_LABEL_T:
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
case SCH_HIER_LABEL_T:
|
||||
return EscapeString( static_cast<SCH_TEXT*>( aItem )->GetShownText( &m_sheet ),
|
||||
return EscapeString( static_cast<SCH_TEXT*>( aItem )->GetShownText( &m_sheet, false ),
|
||||
CTX_NETNAME );
|
||||
|
||||
case SCH_SHEET_PIN_T:
|
||||
// Sheet pins need to use their parent sheet as their starting sheet or they will
|
||||
// resolve variables on the current sheet first
|
||||
return EscapeString( static_cast<SCH_TEXT*>( aItem )->GetShownText(), CTX_NETNAME );
|
||||
return EscapeString( static_cast<SCH_TEXT*>( aItem )->GetShownText( nullptr, false ),
|
||||
CTX_NETNAME );
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( wxS( "Unhandled item type in GetNameForDriver" ) );
|
||||
break;
|
||||
|
@ -1379,7 +1382,7 @@ void CONNECTION_GRAPH::generateGlobalPowerPinSubGraphs()
|
|||
// in the symbol, but we support legacy non-power symbols with global
|
||||
// power connections based on invisible, power-in, pin's names.
|
||||
if( pin->GetLibPin()->GetParent()->IsPower() )
|
||||
connection->SetName( pin->GetParentSymbol()->GetValueFieldText( true, &sheet ) );
|
||||
connection->SetName( pin->GetParentSymbol()->GetValueFieldText( true, &sheet, false ) );
|
||||
else
|
||||
connection->SetName( pin->GetShownName() );
|
||||
|
||||
|
@ -2593,11 +2596,11 @@ std::vector<const CONNECTION_SUBGRAPH*> CONNECTION_GRAPH::GetBusesNeedingMigrati
|
|||
if( labels.size() > 1 )
|
||||
{
|
||||
bool different = false;
|
||||
wxString first = static_cast<SCH_TEXT*>( labels.at( 0 ) )->GetShownText();
|
||||
wxString first = static_cast<SCH_TEXT*>( labels.at( 0 ) )->GetShownText( false );
|
||||
|
||||
for( unsigned i = 1; i < labels.size(); ++i )
|
||||
{
|
||||
if( static_cast<SCH_TEXT*>( labels.at( i ) )->GetShownText() != first )
|
||||
if( static_cast<SCH_TEXT*>( labels.at( i ) )->GetShownText( false ) != first )
|
||||
{
|
||||
different = true;
|
||||
break;
|
||||
|
@ -2937,7 +2940,7 @@ bool CONNECTION_GRAPH::ercCheckBusToNetConflicts( const CONNECTION_SUBGRAPH* aSu
|
|||
case SCH_HIER_LABEL_T:
|
||||
{
|
||||
SCH_TEXT* text = static_cast<SCH_TEXT*>( item );
|
||||
conn.ConfigureFromLabel( EscapeString( text->GetShownText(), CTX_NETNAME ) );
|
||||
conn.ConfigureFromLabel( EscapeString( text->GetShownText( false ), CTX_NETNAME ) );
|
||||
|
||||
if( conn.IsBus() )
|
||||
bus_item = ( !bus_item ) ? item : bus_item;
|
||||
|
|
|
@ -75,7 +75,7 @@ DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBO
|
|||
|
||||
m_newId->ChangeValue( UnescapeString( m_symbol->GetLibId().Format() ) );
|
||||
m_specifiedReference->ChangeValue( m_symbol->GetRef( currentSheet ) );
|
||||
m_specifiedValue->ChangeValue( m_symbol->GetValueFieldText( false ) );
|
||||
m_specifiedValue->ChangeValue( UnescapeString( m_symbol->GetField( VALUE_FIELD )->GetText() ) );
|
||||
m_specifiedId->ChangeValue( UnescapeString( m_symbol->GetLibId().Format() ) );
|
||||
}
|
||||
else
|
||||
|
@ -426,12 +426,14 @@ bool DIALOG_CHANGE_SYMBOLS::isMatch( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aInsta
|
|||
else if( m_matchByReference->GetValue() )
|
||||
{
|
||||
return WildCompareString( m_specifiedReference->GetValue(),
|
||||
aSymbol->GetRef( aInstance, false ), false );
|
||||
UnescapeString( aSymbol->GetRef( aInstance, false ) ),
|
||||
false );
|
||||
}
|
||||
else if( m_matchByValue->GetValue() )
|
||||
{
|
||||
return WildCompareString( m_specifiedValue->GetValue(),
|
||||
aSymbol->GetValueFieldText( false ), false );
|
||||
UnescapeString( aSymbol->GetField( VALUE_FIELD )->GetText() ),
|
||||
false );
|
||||
}
|
||||
else if( m_matchById )
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -287,7 +287,7 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
|
|||
// Ensure the symbol has the Power (i.e. equivalent to a global label
|
||||
// before adding its value in list
|
||||
if( power->IsSymbolLikePowerGlobalLabel() )
|
||||
existingLabels.insert( UnescapeString( power->GetValueFieldText( false ) ) );
|
||||
existingLabels.insert( UnescapeString( power->GetField( VALUE_FIELD )->GetText() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -855,7 +855,7 @@ void DIALOG_SHEET_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
|
||||
m_dummySheet.SetFields( *m_fields );
|
||||
m_dummySheetNameField.SetText( sheetName );
|
||||
path += m_dummySheetNameField.GetShownText();
|
||||
path += m_dummySheetNameField.GetShownText( false );
|
||||
|
||||
editor->DecRef();
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ int ERC_TESTER::TestDuplicateSheetNames( bool aCreateMarker )
|
|||
// We have found a second sheet: compare names
|
||||
// we are using case insensitive comparison to avoid mistakes between
|
||||
// similar names like Mysheet and mysheet
|
||||
if( sheet->GetShownName().CmpNoCase( test_item->GetShownName() ) == 0 )
|
||||
if( sheet->GetShownName( false ).CmpNoCase( test_item->GetShownName( false ) ) == 0 )
|
||||
{
|
||||
if( aCreateMarker )
|
||||
{
|
||||
|
@ -206,7 +206,7 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
|
|||
|
||||
for( SCH_FIELD& field : symbol->GetFields() )
|
||||
{
|
||||
if( unresolved( field.GetShownText() ) )
|
||||
if( unresolved( field.GetShownText( true ) ) )
|
||||
{
|
||||
std::shared_ptr<ERC_ITEM> ercItem =
|
||||
ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
|
||||
|
@ -223,7 +223,7 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
|
|||
|
||||
for( SCH_FIELD& field : subSheet->GetFields() )
|
||||
{
|
||||
if( unresolved( field.GetShownText() ) )
|
||||
if( unresolved( field.GetShownText( true ) ) )
|
||||
{
|
||||
std::shared_ptr<ERC_ITEM> ercItem =
|
||||
ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
|
||||
|
@ -236,7 +236,7 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
|
|||
|
||||
for( SCH_SHEET_PIN* pin : static_cast<SCH_SHEET*>( item )->GetPins() )
|
||||
{
|
||||
if( pin->GetShownText().Matches( wxT( "*${*}*" ) ) )
|
||||
if( pin->GetShownText( true ).Matches( wxT( "*${*}*" ) ) )
|
||||
{
|
||||
std::shared_ptr<ERC_ITEM> ercItem =
|
||||
ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
|
||||
|
@ -249,7 +249,7 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
|
|||
}
|
||||
else if( SCH_TEXT* text = dynamic_cast<SCH_TEXT*>( item ) )
|
||||
{
|
||||
if( text->GetShownText().Matches( wxT( "*${*}*" ) ) )
|
||||
if( text->GetShownText( true ).Matches( wxT( "*${*}*" ) ) )
|
||||
{
|
||||
std::shared_ptr<ERC_ITEM> ercItem =
|
||||
ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
|
||||
|
@ -261,7 +261,7 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
|
|||
}
|
||||
else if( SCH_TEXTBOX* textBox = dynamic_cast<SCH_TEXTBOX*>( item ) )
|
||||
{
|
||||
if( textBox->GetShownText().Matches( wxT( "*${*}*" ) ) )
|
||||
if( textBox->GetShownText( true ).Matches( wxT( "*${*}*" ) ) )
|
||||
{
|
||||
std::shared_ptr<ERC_ITEM> ercItem =
|
||||
ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
|
||||
|
@ -277,7 +277,7 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
|
|||
{
|
||||
if( DS_DRAW_ITEM_TEXT* text = dynamic_cast<DS_DRAW_ITEM_TEXT*>( item ) )
|
||||
{
|
||||
if( text->GetShownText().Matches( wxT( "*${*}*" ) ) )
|
||||
if( text->GetShownText( true ).Matches( wxT( "*${*}*" ) ) )
|
||||
{
|
||||
std::shared_ptr<ERC_ITEM> erc = ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
|
||||
erc->SetErrorMessage( _( "Unresolved text variable in drawing sheet" ) );
|
||||
|
@ -819,14 +819,14 @@ int ERC_TESTER::TestSimilarLabels()
|
|||
{
|
||||
SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( item );
|
||||
|
||||
wxString normalized = label->GetShownText().Lower();
|
||||
wxString normalized = label->GetShownText( false ).Lower();
|
||||
|
||||
if( !labelMap.count( normalized ) )
|
||||
{
|
||||
labelMap[normalized] = std::make_pair( label, subgraph->GetSheet() );
|
||||
}
|
||||
else if( labelMap.at( normalized ).first->GetShownText()
|
||||
!= label->GetShownText() )
|
||||
else if( labelMap.at( normalized ).first->GetShownText( false )
|
||||
!= label->GetShownText( false ) )
|
||||
{
|
||||
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_SIMILAR_LABELS );
|
||||
ercItem->SetItems( label, labelMap.at( normalized ).first );
|
||||
|
|
|
@ -71,9 +71,9 @@ static wxString netList( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH& aSheetPath )
|
|||
*/
|
||||
wxString netlist;
|
||||
|
||||
netlist << EscapeString( aSymbol->GetFootprintFieldText( true ), CTX_LINE ) << wxS( "\r" );
|
||||
netlist << EscapeString( aSymbol->GetFootprintFieldText( true, &aSheetPath, false ), CTX_LINE ) << wxS( "\r" );
|
||||
netlist << EscapeString( aSymbol->GetRef( &aSheetPath ), CTX_LINE ) << wxS( "\r" );
|
||||
netlist << EscapeString( aSymbol->GetValueFieldText( true ), CTX_LINE );
|
||||
netlist << EscapeString( aSymbol->GetValueFieldText( true, &aSheetPath, false ), CTX_LINE );
|
||||
|
||||
for( SCH_PIN* pin : aSymbol->GetPins( &aSheetPath ) )
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
|
||||
* Copyright (C) 2017-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
|
@ -166,7 +166,7 @@ protected:
|
|||
switch( aField.GetId() )
|
||||
{
|
||||
case DATASHEET_FIELD:
|
||||
text = m_symbol->GetDatasheetField().GetShownText( 0, false );
|
||||
text = m_symbol->GetDatasheetField().GetShownText( false );
|
||||
|
||||
if( text.IsEmpty() || text == wxT( "~" ) )
|
||||
{
|
||||
|
@ -197,7 +197,7 @@ protected:
|
|||
break;
|
||||
|
||||
default:
|
||||
text = aField.GetShownText( 0, false );
|
||||
text = aField.GetShownText( false );
|
||||
fieldhtml.Replace( wxS( "__VALUE__" ), EscapeHTML( text ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -391,7 +391,7 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
|
|||
attrs.m_Angle = orient;
|
||||
attrs.m_Multiline = false;
|
||||
|
||||
aPlotter->PlotText( textpos, color, GetShownText(), attrs, font );
|
||||
aPlotter->PlotText( textpos, color, GetShownText( true ), attrs, font );
|
||||
}
|
||||
|
||||
|
||||
|
@ -412,9 +412,9 @@ wxString LIB_FIELD::GetFullText( int unit ) const
|
|||
}
|
||||
|
||||
|
||||
wxString LIB_FIELD::GetShownText( int aDepth, bool aAllowExtraText ) const
|
||||
wxString LIB_FIELD::GetShownText( bool aAllowExtraText, int aDepth ) const
|
||||
{
|
||||
wxString text = EDA_TEXT::GetShownText( aDepth );
|
||||
wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
|
||||
|
||||
if( IsNameShown() )
|
||||
text = GetName() << wxT( ": " ) << text;
|
||||
|
@ -517,7 +517,9 @@ void LIB_FIELD::SetName( const wxString& aName )
|
|||
|
||||
wxString LIB_FIELD::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( "%s '%s'", GetName(), KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
return wxString::Format( "%s '%s'",
|
||||
UnescapeString( GetName() ),
|
||||
KIUI::EllipsizeMenuText( GetText() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -539,10 +541,11 @@ void LIB_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
|
||||
LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
|
||||
|
||||
aList.emplace_back( _( "Field" ), GetName() );
|
||||
// Don't use GetShownText(); we want to see the variable references here
|
||||
aList.emplace_back( _( "Field" ), UnescapeString( GetName() ) );
|
||||
|
||||
// Don't use GetShownText() here; we want to show the user the variable references
|
||||
aList.emplace_back( _( "Text" ), UnescapeString( GetText() ) );
|
||||
aList.emplace_back( _( "Text" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
|
||||
|
||||
aList.emplace_back( _( "Visible" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ public:
|
|||
*/
|
||||
wxString GetFullText( int unit = 1 ) const;
|
||||
|
||||
wxString GetShownText( int aDepth = 0, bool aAllowExtraText = true ) const override;
|
||||
wxString GetShownText( bool aAllowExtraText, int aDepth = 0 ) const override;
|
||||
|
||||
SCH_LAYER_ID GetDefaultLayer() const;
|
||||
|
||||
|
|
|
@ -925,7 +925,7 @@ void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, bool
|
|||
|
||||
// The reference is a special case: we should change the basic text
|
||||
// to add '?' and the part id
|
||||
wxString tmp = field.GetShownText();
|
||||
wxString tmp = field.GetShownText( true );
|
||||
|
||||
if( field.GetId() == REFERENCE_FIELD )
|
||||
{
|
||||
|
|
|
@ -406,8 +406,9 @@ void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
|
|||
// Calculate pos according to mirror/rotation.
|
||||
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
|
||||
|
||||
GRPrintText( DC, txtpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_H_ALIGN_CENTER,
|
||||
GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(), font );
|
||||
GRPrintText( DC, txtpos, color, GetShownText( true ), orient, GetTextSize(),
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(),
|
||||
font );
|
||||
}
|
||||
|
||||
|
||||
|
@ -418,7 +419,7 @@ void LIB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
|
|||
LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
|
||||
|
||||
// Don't use GetShownText() here; we want to show the user the variable references
|
||||
aList.emplace_back( _( "Text" ), UnescapeString( GetText() ) );
|
||||
aList.emplace_back( _( "Text" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
|
||||
|
||||
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
||||
|
||||
|
@ -473,7 +474,7 @@ const BOX2I LIB_TEXT::GetBoundingBox() const
|
|||
|
||||
wxString LIB_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Graphic Text '%s'" ), KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
return wxString::Format( _( "Graphic Text '%s'" ), KIUI::EllipsizeMenuText( GetText() ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -321,15 +321,15 @@ void LIB_TEXTBOX::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffs
|
|||
text.SetStart( VECTOR2I( pt1.x, -pt1.y ) );
|
||||
text.SetEnd( VECTOR2I( pt2.x, -pt2.y ) );
|
||||
|
||||
GRPrintText( DC, text.GetDrawPos(), color, text.GetShownText(), text.GetTextAngle(),
|
||||
GRPrintText( DC, text.GetDrawPos(), color, text.GetShownText( true ), text.GetTextAngle(),
|
||||
text.GetTextSize(), text.GetHorizJustify(), text.GetVertJustify(), penWidth,
|
||||
text.IsItalic(), text.IsBold(), font );
|
||||
}
|
||||
|
||||
|
||||
wxString LIB_TEXTBOX::GetShownText( int aDepth, bool aAllowExtraText ) const
|
||||
wxString LIB_TEXTBOX::GetShownText( bool aAllowExtraText, int aDepth ) const
|
||||
{
|
||||
wxString text = EDA_TEXT::GetShownText();
|
||||
wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
|
||||
|
||||
KIFONT::FONT* font = GetFont();
|
||||
VECTOR2D size = GetEnd() - GetStart();
|
||||
|
@ -461,7 +461,7 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOf
|
|||
|
||||
std::vector<VECTOR2I> positions;
|
||||
wxArrayString strings_list;
|
||||
wxStringSplit( GetShownText(), strings_list, '\n' );
|
||||
wxStringSplit( GetShownText( true ), strings_list, '\n' );
|
||||
positions.reserve( strings_list.Count() );
|
||||
|
||||
text.GetLinePositions( positions, (int) strings_list.Count() );
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
|
||||
VECTOR2I GetDrawPos() const override;
|
||||
|
||||
wxString GetShownText( int aDepth = 0, bool aAllowExtraText = true ) const override;
|
||||
wxString GetShownText( bool aAllowExtraText, int aDepth = 0 ) const override;
|
||||
|
||||
void MirrorHorizontally( const VECTOR2I& center );
|
||||
void MirrorVertically( const VECTOR2I& center );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 1992-2018 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -79,7 +79,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName,
|
|||
if( !symbol->GetIncludeOnBoard() )
|
||||
continue;
|
||||
|
||||
footprint = symbol->GetFootprintFieldText( true );
|
||||
footprint = symbol->GetFootprintFieldText( true, &sheetList[ i ], false );
|
||||
|
||||
if( footprint.IsEmpty() )
|
||||
footprint = "$noname";
|
||||
|
@ -88,7 +88,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName,
|
|||
ret |= fprintf( f, "%s ", TO_UTF8( StartCmpDesc ) );
|
||||
ret |= fprintf( f, "%s", TO_UTF8( msg ) );
|
||||
|
||||
msg = symbol->GetValueFieldText( true );
|
||||
msg = symbol->GetValueFieldText( true, &sheetList[ i ], false );
|
||||
msg.Replace( wxT( " " ), wxT( "_" ) );
|
||||
ret |= fprintf( f, " \"%s\"", TO_UTF8( msg ) );
|
||||
ret |= fprintf( f, " \"%s\"", TO_UTF8( footprint ) );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 1992-2018 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -88,7 +88,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
|
|||
sheet ) );
|
||||
}
|
||||
|
||||
footprint = symbol->GetFootprintFieldText( true );
|
||||
footprint = symbol->GetFootprintFieldText( true, &sheet, false );
|
||||
footprint.Replace( wxT( " " ), wxT( "_" ) );
|
||||
|
||||
if( footprint.IsEmpty() )
|
||||
|
@ -102,7 +102,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
|
|||
|
||||
ret |= fprintf( f, " %s", TO_UTF8( field ) );
|
||||
|
||||
field = symbol->GetValueFieldText( true );
|
||||
field = symbol->GetValueFieldText( true, &sheet, false );
|
||||
field.Replace( wxT( " " ), wxT( "_" ) );
|
||||
|
||||
ret |= fprintf( f, " %s", TO_UTF8( field ) );
|
||||
|
|
|
@ -223,7 +223,7 @@ bool NETLIST_EXPORTER_SPICE::ReadSchematicAndLibraries( unsigned aNetlistOptions
|
|||
if( field.GetId() == REFERENCE_FIELD )
|
||||
spiceItem.fields.back().SetText( symbol->GetRef( &sheet ) );
|
||||
else
|
||||
spiceItem.fields.back().SetText( field.GetShownText( &sheet, 0, false ) );
|
||||
spiceItem.fields.back().SetText( field.GetShownText( &sheet, false ) );
|
||||
}
|
||||
|
||||
readRefName( sheet, *symbol, spiceItem, refNames );
|
||||
|
@ -335,9 +335,9 @@ void NETLIST_EXPORTER_SPICE::ReadDirectives( unsigned aNetlistOptions )
|
|||
continue;
|
||||
|
||||
if( item->Type() == SCH_TEXT_T )
|
||||
text = static_cast<SCH_TEXT*>( item )->GetShownText();
|
||||
text = static_cast<SCH_TEXT*>( item )->GetShownText( &sheet, false );
|
||||
else if( item->Type() == SCH_TEXTBOX_T )
|
||||
text = static_cast<SCH_TEXTBOX*>( item )->GetShownText();
|
||||
text = static_cast<SCH_TEXTBOX*>( item )->GetShownText( &sheet, false );
|
||||
else
|
||||
continue;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013-2017 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -127,18 +127,18 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
|||
int unit = symbol2->GetUnitSelection( aSheet );
|
||||
|
||||
// The lowest unit number wins. User should only set fields in any one unit.
|
||||
candidate = symbol2->GetValueFieldText( m_resolveTextVars );
|
||||
candidate = symbol2->GetValueFieldText( m_resolveTextVars, &sheetList[i], false );
|
||||
|
||||
if( !candidate.IsEmpty() && ( unit < minUnit || value.IsEmpty() ) )
|
||||
value = candidate;
|
||||
|
||||
candidate = symbol2->GetFootprintFieldText( m_resolveTextVars );
|
||||
candidate = symbol2->GetFootprintFieldText( m_resolveTextVars, &sheetList[i], false );
|
||||
|
||||
if( !candidate.IsEmpty() && ( unit < minUnit || footprint.IsEmpty() ) )
|
||||
footprint = candidate;
|
||||
|
||||
candidate = m_resolveTextVars
|
||||
? symbol2->GetField( DATASHEET_FIELD )->GetShownText( aSheet, 0, false )
|
||||
? symbol2->GetField( DATASHEET_FIELD )->GetShownText( &sheetList[i], false )
|
||||
: symbol2->GetField( DATASHEET_FIELD )->GetText();
|
||||
|
||||
if( !candidate.IsEmpty() && ( unit < minUnit || datasheet.IsEmpty() ) )
|
||||
|
@ -152,7 +152,7 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
|||
&& ( unit < minUnit || userFields.count( f.GetName() ) == 0 ) )
|
||||
{
|
||||
if( m_resolveTextVars )
|
||||
userFields[ f.GetName() ] = f.GetShownText( aSheet, 0, false );
|
||||
userFields[ f.GetName() ] = f.GetShownText( aSheet, false );
|
||||
else
|
||||
userFields[ f.GetName() ] = f.GetText();
|
||||
}
|
||||
|
@ -164,11 +164,11 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
|||
}
|
||||
else
|
||||
{
|
||||
value = aSymbol->GetValueFieldText( m_resolveTextVars );
|
||||
footprint = aSymbol->GetFootprintFieldText( m_resolveTextVars );
|
||||
value = aSymbol->GetValueFieldText( m_resolveTextVars, aSheet, false );
|
||||
footprint = aSymbol->GetFootprintFieldText( m_resolveTextVars, aSheet, false );
|
||||
|
||||
if( m_resolveTextVars )
|
||||
datasheet = aSymbol->GetField( DATASHEET_FIELD )->GetShownText( aSheet, 0, false );
|
||||
datasheet = aSymbol->GetField( DATASHEET_FIELD )->GetShownText( aSheet, false );
|
||||
else
|
||||
datasheet = aSymbol->GetField( DATASHEET_FIELD )->GetText();
|
||||
|
||||
|
@ -179,7 +179,7 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
|
|||
if( f.GetText().size() )
|
||||
{
|
||||
if( m_resolveTextVars )
|
||||
userFields[ f.GetName() ] = f.GetShownText( aSheet, 0, false );
|
||||
userFields[ f.GetName() ] = f.GetShownText( aSheet, false );
|
||||
else
|
||||
userFields[ f.GetName() ] = f.GetText();
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
|
|||
xproperty->AddAttribute( wxT( "name" ), fields[jj].GetCanonicalName() );
|
||||
|
||||
if( m_resolveTextVars )
|
||||
xproperty->AddAttribute( wxT( "value" ), fields[jj].GetShownText( &sheet, 0, false ) );
|
||||
xproperty->AddAttribute( wxT( "value" ), fields[jj].GetShownText( &sheet, false ) );
|
||||
else
|
||||
xproperty->AddAttribute( wxT( "value" ), fields[jj].GetText() );
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
|
|||
if( m_resolveTextVars )
|
||||
// do not allow GetShownText() to add any prefix useful only when displaying
|
||||
// the field on screen
|
||||
xproperty->AddAttribute( wxT( "value" ), sheetField.GetShownText( &sheet, 0, false ) );
|
||||
xproperty->AddAttribute( wxT( "value" ), sheetField.GetShownText( &sheet, false ) );
|
||||
else
|
||||
xproperty->AddAttribute( wxT( "value" ), sheetField.GetText() );
|
||||
}
|
||||
|
|
|
@ -1066,22 +1066,25 @@ void SCH_EDIT_FRAME::ShowFindReplaceDialog( bool aReplace )
|
|||
switch( front->Type() )
|
||||
{
|
||||
case SCH_SYMBOL_T:
|
||||
findString = static_cast<SCH_SYMBOL*>( front )->GetValueFieldText( true );
|
||||
{
|
||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( front );
|
||||
findString = UnescapeString( symbol->GetField( VALUE_FIELD )->GetText() );
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_FIELD_T:
|
||||
findString = static_cast<SCH_FIELD*>( front )->GetShownText();
|
||||
findString = UnescapeString( static_cast<SCH_FIELD*>( front )->GetText() );
|
||||
break;
|
||||
|
||||
case SCH_LABEL_T:
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
case SCH_HIER_LABEL_T:
|
||||
case SCH_SHEET_PIN_T:
|
||||
findString = static_cast<SCH_LABEL_BASE*>( front )->GetShownText();
|
||||
findString = UnescapeString( static_cast<SCH_LABEL_BASE*>( front )->GetText() );
|
||||
break;
|
||||
|
||||
case SCH_TEXT_T:
|
||||
findString = static_cast<SCH_TEXT*>( front )->GetShownText();
|
||||
findString = UnescapeString( static_cast<SCH_TEXT*>( front )->GetText() );
|
||||
|
||||
if( findString.Contains( wxT( "\n" ) ) )
|
||||
findString = findString.Before( '\n' );
|
||||
|
@ -1096,9 +1099,10 @@ void SCH_EDIT_FRAME::ShowFindReplaceDialog( bool aReplace )
|
|||
if( m_findReplaceDialog )
|
||||
m_findReplaceDialog->Destroy();
|
||||
|
||||
m_findReplaceDialog = new DIALOG_SCH_FIND(
|
||||
this, static_cast<SCH_SEARCH_DATA*>( m_findReplaceData.get() ), wxDefaultPosition,
|
||||
wxDefaultSize, aReplace ? wxFR_REPLACEDIALOG : 0 );
|
||||
m_findReplaceDialog = new DIALOG_SCH_FIND( this,
|
||||
static_cast<SCH_SEARCH_DATA*>( m_findReplaceData.get() ),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
aReplace ? wxFR_REPLACEDIALOG : 0 );
|
||||
|
||||
m_findReplaceDialog->SetFindEntries( m_findStringHistoryList, findString );
|
||||
m_findReplaceDialog->SetReplaceEntries( m_replaceStringHistoryList );
|
||||
|
|
|
@ -172,13 +172,14 @@ void SCH_FIELD::SetId( int aId )
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_FIELD::GetShownText( const SCH_SHEET_PATH* aPath, int aDepth,
|
||||
bool aAllowExtraText ) const
|
||||
wxString SCH_FIELD::GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
|
||||
int aDepth ) const
|
||||
{
|
||||
std::function<bool( wxString* )> symbolResolver =
|
||||
[&]( wxString* token ) -> bool
|
||||
{
|
||||
return static_cast<SCH_SYMBOL*>( m_parent )->ResolveTextVar( token, aDepth + 1, aPath );
|
||||
return static_cast<SCH_SYMBOL*>( m_parent )->ResolveTextVar( token, aDepth + 1,
|
||||
aPath );
|
||||
};
|
||||
|
||||
std::function<bool( wxString* )> sheetResolver =
|
||||
|
@ -194,7 +195,7 @@ wxString SCH_FIELD::GetShownText( const SCH_SHEET_PATH* aPath, int aDepth,
|
|||
aDepth + 1 );
|
||||
};
|
||||
|
||||
wxString text = EDA_TEXT::GetShownText();
|
||||
wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
|
||||
|
||||
if( IsNameShown() && aAllowExtraText )
|
||||
text = GetName() << wxS( ": " ) << text;
|
||||
|
@ -322,7 +323,7 @@ void SCH_FIELD::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
|||
VECTOR2I textpos;
|
||||
int penWidth = GetEffectiveTextPenWidth( aSettings->GetDefaultPenWidth() );
|
||||
|
||||
if( ( !IsVisible() && !IsForceVisible() ) || GetShownText().IsEmpty() )
|
||||
if( ( !IsVisible() && !IsForceVisible() ) || GetShownText( true ).IsEmpty() )
|
||||
return;
|
||||
|
||||
COLOR4D bg = aSettings->GetBackgroundColor();
|
||||
|
@ -375,8 +376,9 @@ void SCH_FIELD::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
|||
*/
|
||||
textpos = GetBoundingBox().Centre() + aOffset;
|
||||
|
||||
GRPrintText( DC, textpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_H_ALIGN_CENTER,
|
||||
GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(), font );
|
||||
GRPrintText( DC, textpos, color, GetShownText( true ), orient, GetTextSize(),
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(),
|
||||
font );
|
||||
}
|
||||
|
||||
|
||||
|
@ -580,7 +582,7 @@ bool SCH_FIELD::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) co
|
|||
{
|
||||
}
|
||||
|
||||
wxString text = GetShownText();
|
||||
wxString text = UnescapeString( GetText() );
|
||||
|
||||
if( !IsVisible() && !searchHiddenFields )
|
||||
return false;
|
||||
|
@ -643,7 +645,6 @@ bool SCH_FIELD::Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData )
|
|||
}
|
||||
|
||||
wxString text;
|
||||
bool resolve = false; // Replace in source text, not shown text
|
||||
bool isReplaced = false;
|
||||
|
||||
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
|
||||
|
@ -669,7 +670,7 @@ bool SCH_FIELD::Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData )
|
|||
case VALUE_FIELD:
|
||||
wxCHECK_MSG( aAuxData, false, wxT( "Need sheetpath to replace in value field." ) );
|
||||
|
||||
text = parentSymbol->GetValueFieldText( resolve );
|
||||
text = parentSymbol->GetField( VALUE_FIELD )->GetText();
|
||||
isReplaced = EDA_ITEM::Replace( aSearchData, text );
|
||||
|
||||
if( isReplaced )
|
||||
|
@ -680,7 +681,7 @@ bool SCH_FIELD::Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData )
|
|||
case FOOTPRINT_FIELD:
|
||||
wxCHECK_MSG( aAuxData, false, wxT( "Need sheetpath to replace in footprint field." ) );
|
||||
|
||||
text = parentSymbol->GetFootprintFieldText( resolve );
|
||||
text = parentSymbol->GetField( FOOTPRINT_FIELD )->GetText();
|
||||
isReplaced = EDA_ITEM::Replace( aSearchData, text );
|
||||
|
||||
if( isReplaced )
|
||||
|
@ -722,7 +723,7 @@ void SCH_FIELD::Rotate( const VECTOR2I& aCenter )
|
|||
|
||||
wxString SCH_FIELD::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( "%s '%s'", GetName(), KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
return wxString::Format( "%s '%s'", GetName(), KIUI::EllipsizeMenuText( GetText() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -730,10 +731,10 @@ void SCH_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
{
|
||||
wxString msg;
|
||||
|
||||
aList.emplace_back( _( "Symbol Field" ), GetName() );
|
||||
aList.emplace_back( _( "Symbol Field" ), UnescapeString( GetName() ) );
|
||||
|
||||
// Don't use GetShownText() here; we want to show the user the variable references
|
||||
aList.emplace_back( _( "Text" ), UnescapeString( GetText() ) );
|
||||
aList.emplace_back( _( "Text" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
|
||||
|
||||
aList.emplace_back( _( "Visible" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
|
||||
|
||||
|
@ -901,7 +902,7 @@ BITMAPS SCH_FIELD::GetMenuImage() const
|
|||
bool SCH_FIELD::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||
{
|
||||
// Do not hit test hidden or empty fields.
|
||||
if( !IsVisible() || GetShownText().IsEmpty() )
|
||||
if( !IsVisible() || GetShownText( true ).IsEmpty() )
|
||||
return false;
|
||||
|
||||
BOX2I rect = GetBoundingBox();
|
||||
|
@ -921,7 +922,7 @@ bool SCH_FIELD::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
|||
bool SCH_FIELD::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
|
||||
{
|
||||
// Do not hit test hidden fields.
|
||||
if( !IsVisible() || GetShownText().IsEmpty() )
|
||||
if( !IsVisible() || GetShownText( true ).IsEmpty() )
|
||||
return false;
|
||||
|
||||
BOX2I rect = aRect;
|
||||
|
@ -943,7 +944,7 @@ bool SCH_FIELD::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) co
|
|||
|
||||
void SCH_FIELD::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||
{
|
||||
if( GetShownText().IsEmpty() || aBackground )
|
||||
if( GetShownText( true ).IsEmpty() || aBackground )
|
||||
return;
|
||||
|
||||
RENDER_SETTINGS* settings = aPlotter->RenderSettings();
|
||||
|
@ -1023,7 +1024,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
attrs.m_Angle = orient;
|
||||
attrs.m_Multiline = false;
|
||||
|
||||
aPlotter->PlotText( textpos, color, GetShownText(), attrs, font );
|
||||
aPlotter->PlotText( textpos, color, GetShownText( true ), attrs, font );
|
||||
|
||||
if( IsHypertext() )
|
||||
{
|
||||
|
|
|
@ -126,12 +126,12 @@ public:
|
|||
|
||||
void SetId( int aId );
|
||||
|
||||
wxString GetShownText( const SCH_SHEET_PATH* aPath, int aDepth = 0,
|
||||
bool aAllowExtraText = true ) const;
|
||||
wxString GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
|
||||
int aDepth = 0 ) const;
|
||||
|
||||
wxString GetShownText( int aDepth = 0, bool aAllowExtraText = true ) const override
|
||||
wxString GetShownText( bool aAllowExtraText, int aDepth = 0 ) const override
|
||||
{
|
||||
return GetShownText( nullptr, aDepth, aAllowExtraText );
|
||||
return GetShownText( nullptr, aAllowExtraText, aDepth );
|
||||
}
|
||||
|
||||
COLOR4D GetFieldColor() const;
|
||||
|
|
|
@ -587,7 +587,7 @@ bool SCH_LABEL_BASE::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* toke
|
|||
{
|
||||
if( token->IsSameAs( field.GetName() ) )
|
||||
{
|
||||
*token = field.GetShownText( aDepth + 1 );
|
||||
*token = field.GetShownText( false, aDepth + 1 );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -616,7 +616,8 @@ bool SCH_LABEL_BASE::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* toke
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_LABEL_BASE::GetShownText( const SCH_SHEET_PATH* aPath, int aDepth, bool aAllowExtraText ) const
|
||||
wxString SCH_LABEL_BASE::GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
|
||||
int aDepth ) const
|
||||
{
|
||||
std::function<bool( wxString* )> textResolver =
|
||||
[&]( wxString* token ) -> bool
|
||||
|
@ -624,7 +625,7 @@ wxString SCH_LABEL_BASE::GetShownText( const SCH_SHEET_PATH* aPath, int aDepth,
|
|||
return ResolveTextVar( aPath, token, aDepth );
|
||||
};
|
||||
|
||||
wxString text = EDA_TEXT::GetShownText();
|
||||
wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
|
||||
|
||||
if( text == wxS( "~" ) ) // Legacy placeholder for empty string
|
||||
{
|
||||
|
@ -998,7 +999,7 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
}
|
||||
else
|
||||
{
|
||||
aPlotter->PlotText( textpos, color, GetShownText(), attrs, font );
|
||||
aPlotter->PlotText( textpos, color, GetShownText( true ), attrs, font );
|
||||
|
||||
if( s_poly.size() )
|
||||
aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth );
|
||||
|
@ -1008,8 +1009,8 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
|
||||
if( connection )
|
||||
{
|
||||
properties.emplace_back(
|
||||
wxString::Format( wxT( "!%s = %s" ), _( "Net" ), connection->Name() ) );
|
||||
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ), _( "Net" ),
|
||||
connection->Name() ) );
|
||||
|
||||
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ), _( "Resolved netclass" ),
|
||||
GetEffectiveNetClass()->GetName() ) );
|
||||
|
@ -1017,8 +1018,8 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
|
||||
for( const SCH_FIELD& field : GetFields() )
|
||||
{
|
||||
properties.emplace_back(
|
||||
wxString::Format( wxT( "!%s = %s" ), field.GetName(), field.GetShownText() ) );
|
||||
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ), field.GetName(),
|
||||
field.GetShownText( false ) ) );
|
||||
}
|
||||
|
||||
if( !properties.empty() )
|
||||
|
@ -1026,7 +1027,8 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
|
||||
if( Type() == SCH_HIER_LABEL_T )
|
||||
{
|
||||
aPlotter->Bookmark( GetBodyBoundingBox(), GetShownText(), _( "Hierarchical Labels" ) );
|
||||
aPlotter->Bookmark( GetBodyBoundingBox(), GetShownText( false ),
|
||||
_( "Hierarchical Labels" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1111,7 +1113,7 @@ const BOX2I SCH_LABEL::GetBodyBoundingBox() const
|
|||
|
||||
wxString SCH_LABEL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Label '%s'" ), KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
return wxString::Format( _( "Label '%s'" ), KIUI::EllipsizeMenuText( GetText() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1289,8 +1291,8 @@ wxString SCH_DIRECTIVE_LABEL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider
|
|||
else
|
||||
{
|
||||
return wxString::Format( _( "Directive Label [%s %s]" ),
|
||||
m_fields[0].GetName(),
|
||||
m_fields[0].GetShownText() );
|
||||
UnescapeString( m_fields[0].GetName() ),
|
||||
KIUI::EllipsizeMenuText( m_fields[0].GetText() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1565,7 +1567,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings
|
|||
|
||||
wxString SCH_GLOBALLABEL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Global Label '%s'" ), KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
return wxString::Format( _( "Global Label '%s'" ), KIUI::EllipsizeMenuText( GetText() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1699,7 +1701,7 @@ VECTOR2I SCH_HIERLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings
|
|||
wxString SCH_HIERLABEL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Hierarchical Label '%s'" ),
|
||||
KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
KIUI::EllipsizeMenuText( GetText() ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -143,12 +143,12 @@ public:
|
|||
*/
|
||||
virtual bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth ) const;
|
||||
|
||||
wxString GetShownText( const SCH_SHEET_PATH* aPath, int aDepth = 0,
|
||||
bool aAllowExtraText = true ) const override;
|
||||
wxString GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
|
||||
int aDepth = 0 ) const override;
|
||||
|
||||
wxString GetShownText( int aDepth = 0, bool aAllowExtraText = true ) const override
|
||||
wxString GetShownText( bool aAllowExtraText, int aDepth = 0 ) const override
|
||||
{
|
||||
return GetShownText( nullptr, aDepth, aAllowExtraText );
|
||||
return GetShownText( nullptr, aAllowExtraText, aDepth );
|
||||
}
|
||||
|
||||
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
|
||||
|
|
|
@ -1057,7 +1057,7 @@ void SCH_PAINTER::draw( const LIB_FIELD *aField, int aLayer, bool aDimmed )
|
|||
if( drawingShadows )
|
||||
attrs.m_StrokeWidth += getShadowWidth( !aField->IsSelected() );
|
||||
|
||||
strokeText( UnescapeString( aField->GetShownText() ), textpos, attrs );
|
||||
strokeText( UnescapeString( aField->GetShownText( true ) ), textpos, attrs );
|
||||
}
|
||||
|
||||
// Draw the umbilical line when in the schematic editor
|
||||
|
@ -1108,7 +1108,7 @@ void SCH_PAINTER::draw( const LIB_TEXT* aText, int aLayer, bool aDimmed )
|
|||
}
|
||||
else
|
||||
{
|
||||
wxString shownText( aText->GetShownText() );
|
||||
wxString shownText( aText->GetShownText( true ) );
|
||||
VECTOR2D pos = bBox.Centre();
|
||||
TEXT_ATTRIBUTES attrs = aText->GetAttributes();
|
||||
|
||||
|
@ -1165,7 +1165,7 @@ void SCH_PAINTER::draw( const LIB_TEXTBOX* aTextBox, int aLayer, bool aDimmed )
|
|||
auto drawText =
|
||||
[&]()
|
||||
{
|
||||
wxString shownText = aTextBox->GetShownText();
|
||||
wxString shownText = aTextBox->GetShownText( true );
|
||||
TEXT_ATTRIBUTES attrs = aTextBox->GetAttributes();
|
||||
|
||||
attrs.m_Angle = aTextBox->GetDrawRotation();
|
||||
|
@ -2089,7 +2089,7 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
|
|||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetFillColor( color );
|
||||
|
||||
wxString shownText( aText->GetShownText() );
|
||||
wxString shownText( aText->GetShownText( true ) );
|
||||
VECTOR2I text_offset = aText->GetSchematicTextOffset( &m_schSettings );
|
||||
TEXT_ATTRIBUTES attrs = aText->GetAttributes();
|
||||
KIFONT::FONT* font = getFont( aText );
|
||||
|
@ -2185,7 +2185,7 @@ void SCH_PAINTER::draw( const SCH_TEXTBOX* aTextBox, int aLayer )
|
|||
auto drawText =
|
||||
[&]()
|
||||
{
|
||||
wxString shownText = aTextBox->GetShownText();
|
||||
wxString shownText = aTextBox->GetShownText( true );
|
||||
TEXT_ATTRIBUTES attrs = aTextBox->GetAttributes();
|
||||
|
||||
attrs.m_Angle = aTextBox->GetDrawRotation();
|
||||
|
@ -2488,7 +2488,7 @@ void SCH_PAINTER::draw( const SCH_FIELD* aField, int aLayer, bool aDimmed )
|
|||
return;
|
||||
}
|
||||
|
||||
wxString shownText = aField->GetShownText();
|
||||
wxString shownText = aField->GetShownText( true );
|
||||
|
||||
if( shownText.IsEmpty() )
|
||||
return;
|
||||
|
|
|
@ -195,7 +195,7 @@ SCH_SYMBOL* SCH_PIN::GetParentSymbol() const
|
|||
wxString SCH_PIN::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( "Symbol %s %s",
|
||||
GetParentSymbol()->GetField( REFERENCE_FIELD )->GetShownText(),
|
||||
UnescapeString( GetParentSymbol()->GetField( REFERENCE_FIELD )->GetText() ),
|
||||
m_libPin->GetItemDescription( aUnitsProvider ) );
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,9 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
|
|||
SCH_SHEET_PATH* currentSheet = schframe ? &schframe->GetCurrentSheet() : nullptr;
|
||||
SCH_SYMBOL* symbol = GetParentSymbol();
|
||||
|
||||
aList.emplace_back( symbol->GetRef( currentSheet ), symbol->GetValueFieldText( true ) );
|
||||
// Don't use GetShownText(); we want to see the variable references here
|
||||
aList.emplace_back( symbol->GetRef( currentSheet ),
|
||||
UnescapeString( symbol->GetField( VALUE_FIELD )->GetText() ) );
|
||||
|
||||
#if defined(DEBUG)
|
||||
if( !IsConnectivityDirty() && dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
|
||||
|
@ -274,11 +276,15 @@ wxString SCH_PIN::GetDefaultNetName( const SCH_SHEET_PATH& aPath, bool aForceNoC
|
|||
if( IsGlobalPower() )
|
||||
{
|
||||
if( GetLibPin()->GetParent()->IsPower() )
|
||||
return EscapeString( GetParentSymbol()->GetValueFieldText( true, &aPath ),
|
||||
{
|
||||
return EscapeString( GetParentSymbol()->GetValueFieldText( true, &aPath, false ),
|
||||
CTX_NETNAME );
|
||||
}
|
||||
else
|
||||
{
|
||||
return EscapeString( m_libPin->GetName(), CTX_NETNAME );
|
||||
}
|
||||
}
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lock( m_netmap_mutex );
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ void SCH_PLOTTER::createPDFFile( const SCH_PLOT_SETTINGS& aPlotSettings,
|
|||
plotter->ClosePage();
|
||||
setupPlotPagePDF( plotter, screen, aPlotSettings );
|
||||
plotter->StartPage( sheetList[i].GetPageNumber(),
|
||||
sheetList[i].Last()->GetFields()[SHEETNAME].GetShownText() );
|
||||
sheetList[i].Last()->GetFields()[SHEETNAME].GetShownText( false ) );
|
||||
}
|
||||
|
||||
plotOneSheetPDF( plotter, screen, aPlotSettings );
|
||||
|
|
|
@ -752,11 +752,11 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSchema
|
|||
}
|
||||
else if( id == VALUE_FIELD )
|
||||
{
|
||||
field.SetText( aSymbol->GetValueFieldText( false ) );
|
||||
field.SetText( aSymbol->GetField( VALUE_FIELD )->GetText() );
|
||||
}
|
||||
else if( id == FOOTPRINT_FIELD )
|
||||
{
|
||||
field.SetText( aSymbol->GetFootprintFieldText( false ) );
|
||||
field.SetText( aSymbol->GetField( FOOTPRINT_FIELD )->GetText() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -822,7 +822,7 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_SYMBOL* aSymbol, LIB_SYMBOL* aLibSymbol,
|
|||
m_libPart = aLibSymbol; // Warning: can be nullptr for orphan symbols
|
||||
// (i.e. with a symbol library not found)
|
||||
m_unit = aSymbol->GetUnitSelection( &aSheetPath );
|
||||
m_footprint = aSymbol->GetFootprintFieldText( true );
|
||||
m_footprint = aSymbol->GetFootprintFieldText( true, &aSheetPath, false );
|
||||
m_sheetPath = aSheetPath;
|
||||
m_isNew = false;
|
||||
m_flag = 0;
|
||||
|
@ -838,10 +838,10 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_SYMBOL* aSymbol, LIB_SYMBOL* aLibSymbol,
|
|||
|
||||
m_numRef = -1;
|
||||
|
||||
if( aSymbol->GetValueFieldText( false ).IsEmpty() )
|
||||
if( aSymbol->GetValueFieldText( false, &aSheetPath, false ).IsEmpty() )
|
||||
aSymbol->SetValueFieldText( wxT( "~" ) );
|
||||
|
||||
m_value = aSymbol->GetValueFieldText( false );
|
||||
m_value = aSymbol->GetValueFieldText( false, &aSheetPath, false );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
|
|||
{
|
||||
if( token->IsSameAs( m_fields[i].GetCanonicalName().Upper() ) )
|
||||
{
|
||||
*token = m_fields[i].GetShownText( aDepth + 1 );
|
||||
*token = m_fields[i].GetShownText( nullptr, false, aDepth + 1 );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
|
|||
{
|
||||
if( token->IsSameAs( m_fields[i].GetName() ) )
|
||||
{
|
||||
*token = m_fields[i].GetShownText( aDepth + 1 );
|
||||
*token = m_fields[i].GetShownText( nullptr, false, aDepth + 1 );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -795,7 +795,9 @@ int SCH_SHEET::CountSheets() const
|
|||
|
||||
void SCH_SHEET::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
aList.emplace_back( _( "Sheet Name" ), m_fields[ SHEETNAME ].GetText() );
|
||||
// Don't use GetShownText(); we want to see the variable references here
|
||||
aList.emplace_back( _( "Sheet Name" ),
|
||||
KIUI::EllipsizeStatusText( aFrame, m_fields[ SHEETNAME ].GetText() ) );
|
||||
|
||||
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
|
||||
{
|
||||
|
@ -805,7 +807,9 @@ void SCH_SHEET::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
aList.emplace_back( _( "Hierarchical Path" ), path.PathHumanReadable( false, true ) );
|
||||
}
|
||||
|
||||
aList.emplace_back( _( "File Name" ), m_fields[ SHEETFILENAME ].GetText() );
|
||||
// Don't use GetShownText(); we want to see the variable references here
|
||||
aList.emplace_back( _( "File Name" ),
|
||||
KIUI::EllipsizeStatusText( aFrame, m_fields[ SHEETFILENAME ].GetText() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1052,7 +1056,7 @@ void SCH_SHEET::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction
|
|||
wxString SCH_SHEET::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Hierarchical Sheet %s" ),
|
||||
m_fields[ SHEETNAME ].GetText() );
|
||||
KIUI::EllipsizeMenuText( m_fields[ SHEETNAME ].GetText() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1123,7 +1127,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
{
|
||||
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
|
||||
field.GetName(),
|
||||
field.GetShownText() ) );
|
||||
field.GetShownText( false ) ) );
|
||||
}
|
||||
|
||||
aPlotter->HyperlinkMenu( GetBoundingBox(), properties );
|
||||
|
|
|
@ -100,7 +100,10 @@ public:
|
|||
*/
|
||||
void SetFields( const std::vector<SCH_FIELD>& aFields );
|
||||
|
||||
wxString GetShownName() const { return m_fields[SHEETNAME].GetShownText(); }
|
||||
wxString GetShownName( bool aAllowExtraText ) const
|
||||
{
|
||||
return m_fields[SHEETNAME].GetShownText( aAllowExtraText );
|
||||
}
|
||||
wxString GetName() const { return m_fields[ SHEETNAME ].GetText(); }
|
||||
void SetName( const wxString& aName ) { m_fields[ SHEETNAME ].SetText( aName ); }
|
||||
|
||||
|
|
|
@ -311,7 +311,7 @@ wxString SCH_SHEET_PATH::PathHumanReadable( bool aUseShortRootName,
|
|||
|
||||
// Start at 1 since we've already processed the root sheet.
|
||||
for( unsigned i = 1; i < size(); i++ )
|
||||
s << at( i )->GetFields()[SHEETNAME].GetShownText() << wxS( "/" );
|
||||
s << at( i )->GetFields()[SHEETNAME].GetShownText( false ) << wxS( "/" );
|
||||
|
||||
if( aStripTrailingSeparator && s.EndsWith( "/" ) )
|
||||
s = s.Left( s.length() - 1 );
|
||||
|
|
|
@ -328,7 +328,7 @@ void SCH_SHEET_PIN::GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList )
|
|||
wxString SCH_SHEET_PIN::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Hierarchical Sheet Pin %s" ),
|
||||
KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
KIUI::EllipsizeMenuText( GetText() ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -856,10 +856,11 @@ void SCH_SYMBOL::SetUnitSelection( int aUnitSelection )
|
|||
}
|
||||
|
||||
|
||||
const wxString SCH_SYMBOL::GetValueFieldText( bool aResolve, const SCH_SHEET_PATH* aPath ) const
|
||||
const wxString SCH_SYMBOL::GetValueFieldText( bool aResolve, const SCH_SHEET_PATH* aPath,
|
||||
bool aAllowExtraText ) const
|
||||
{
|
||||
if( aResolve )
|
||||
return GetField( VALUE_FIELD )->GetShownText( aPath );
|
||||
return GetField( VALUE_FIELD )->GetShownText( aPath, aAllowExtraText );
|
||||
|
||||
return GetField( VALUE_FIELD )->GetText();
|
||||
}
|
||||
|
@ -871,10 +872,11 @@ void SCH_SYMBOL::SetValueFieldText( const wxString& aValue )
|
|||
}
|
||||
|
||||
|
||||
const wxString SCH_SYMBOL::GetFootprintFieldText( bool aResolve ) const
|
||||
const wxString SCH_SYMBOL::GetFootprintFieldText( bool aResolve, const SCH_SHEET_PATH* aPath,
|
||||
bool aAllowExtraText ) const
|
||||
{
|
||||
if( aResolve )
|
||||
return GetField( FOOTPRINT_FIELD )->GetShownText();
|
||||
return GetField( FOOTPRINT_FIELD )->GetShownText( aPath, aAllowExtraText );
|
||||
|
||||
return GetField( FOOTPRINT_FIELD )->GetText();
|
||||
}
|
||||
|
@ -928,7 +930,7 @@ void SCH_SYMBOL::GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly
|
|||
{
|
||||
if( aVisibleOnly )
|
||||
{
|
||||
if( !field.IsVisible() || field.GetShownText().IsEmpty() )
|
||||
if( !field.IsVisible() || field.GetShownText( nullptr, true ).IsEmpty() )
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1239,11 +1241,11 @@ bool SCH_SYMBOL::ResolveTextVar( wxString* token, int aDepth, const SCH_SHEET_PA
|
|||
if( i == REFERENCE_FIELD )
|
||||
*token = GetRef( &schematic->CurrentSheet(), true );
|
||||
else if( i == VALUE_FIELD )
|
||||
*token = GetValueFieldText( true );
|
||||
*token = GetValueFieldText( true, aPath, false );
|
||||
else if( i == FOOTPRINT_FIELD )
|
||||
*token = GetFootprintFieldText( true );
|
||||
*token = GetFootprintFieldText( true, aPath, false );
|
||||
else
|
||||
*token = m_fields[ i ].GetShownText( aDepth + 1 );
|
||||
*token = m_fields[ i ].GetShownText( aPath, false, aDepth + 1 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1254,7 +1256,7 @@ bool SCH_SYMBOL::ResolveTextVar( wxString* token, int aDepth, const SCH_SHEET_PA
|
|||
if( token->IsSameAs( m_fields[ i ].GetName() )
|
||||
|| token->IsSameAs( m_fields[ i ].GetName().Upper() ) )
|
||||
{
|
||||
*token = m_fields[ i ].GetShownText( aDepth + 1 );
|
||||
*token = m_fields[ i ].GetShownText( aPath, false, aDepth + 1 );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1276,7 +1278,7 @@ bool SCH_SYMBOL::ResolveTextVar( wxString* token, int aDepth, const SCH_SHEET_PA
|
|||
{
|
||||
wxString footprint;
|
||||
|
||||
footprint = GetFootprintFieldText( true );
|
||||
footprint = GetFootprintFieldText( true, aPath, false );
|
||||
|
||||
wxArrayString parts = wxSplit( footprint, ':' );
|
||||
|
||||
|
@ -1287,7 +1289,7 @@ bool SCH_SYMBOL::ResolveTextVar( wxString* token, int aDepth, const SCH_SHEET_PA
|
|||
{
|
||||
wxString footprint;
|
||||
|
||||
footprint = GetFootprintFieldText( true );
|
||||
footprint = GetFootprintFieldText( true, aPath, false );
|
||||
|
||||
wxArrayString parts = wxSplit( footprint, ':' );
|
||||
|
||||
|
@ -1750,14 +1752,21 @@ void SCH_SYMBOL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
|
|||
{
|
||||
if( m_part->IsPower() )
|
||||
{
|
||||
aList.emplace_back( _( "Power symbol" ), GetValueFieldText( true ) );
|
||||
// Don't use GetShownText(); we want to see the variable references here
|
||||
aList.emplace_back( _( "Power symbol" ),
|
||||
KIUI::EllipsizeStatusText( aFrame, GetField( VALUE_FIELD )->GetText() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aList.emplace_back( _( "Reference" ), GetRef( currentSheet ) );
|
||||
aList.emplace_back( _( "Value" ), GetValueFieldText( true ) );
|
||||
aList.emplace_back( _( "Reference" ),
|
||||
UnescapeString( GetRef( currentSheet ) ) );
|
||||
|
||||
// Don't use GetShownText(); we want to see the variable references here
|
||||
aList.emplace_back( _( "Value" ),
|
||||
KIUI::EllipsizeStatusText( aFrame, GetField( VALUE_FIELD )->GetText() ) );
|
||||
addExcludes();
|
||||
aList.emplace_back( _( "Name" ), UnescapeString( GetLibId().GetLibItemName() ) );
|
||||
aList.emplace_back( _( "Name" ),
|
||||
KIUI::EllipsizeStatusText( aFrame, GetLibId().GetLibItemName() ) );
|
||||
}
|
||||
|
||||
#if 0 // Display symbol flags, for debug only
|
||||
|
@ -1785,7 +1794,8 @@ void SCH_SYMBOL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
|
|||
}
|
||||
|
||||
// Display the current associated footprint, if exists.
|
||||
msg = GetFootprintFieldText( true );
|
||||
// Don't use GetShownText(); we want to see the variable references here
|
||||
msg = KIUI::EllipsizeStatusText( aFrame, GetField( FOOTPRINT_FIELD )->GetText() );
|
||||
|
||||
if( msg.IsEmpty() )
|
||||
msg = _( "<Unknown>" );
|
||||
|
@ -1800,9 +1810,12 @@ void SCH_SYMBOL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
|
|||
else
|
||||
{
|
||||
aList.emplace_back( _( "Reference" ), GetRef( currentSheet ) );
|
||||
aList.emplace_back( _( "Value" ), GetValueFieldText( true ) );
|
||||
// Don't use GetShownText(); we want to see the variable references here
|
||||
aList.emplace_back( _( "Value" ),
|
||||
KIUI::EllipsizeStatusText( aFrame, GetField( VALUE_FIELD )->GetText() ) );
|
||||
addExcludes();
|
||||
aList.emplace_back( _( "Name" ), UnescapeString( GetLibId().GetLibItemName() ) );
|
||||
aList.emplace_back( _( "Name" ),
|
||||
KIUI::EllipsizeStatusText( aFrame, GetLibId().GetLibItemName() ) );
|
||||
|
||||
wxString libNickname = GetLibId().GetLibNickname();
|
||||
|
||||
|
@ -1999,8 +2012,8 @@ LIB_ITEM* SCH_SYMBOL::GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType )
|
|||
wxString SCH_SYMBOL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Symbol %s [%s]" ),
|
||||
GetField( REFERENCE_FIELD )->GetShownText(),
|
||||
UnescapeString( GetLibId().GetLibItemName() ) );
|
||||
KIUI::EllipsizeMenuText( GetField( REFERENCE_FIELD )->GetText() ),
|
||||
KIUI::EllipsizeMenuText( GetLibId().GetLibItemName() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2264,12 +2277,13 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
|
||||
// Plot attributes to a hypertext menu
|
||||
std::vector<wxString> properties;
|
||||
SCH_SHEET_PATH* sheet = &Schematic()->CurrentSheet();
|
||||
|
||||
for( const SCH_FIELD& field : GetFields() )
|
||||
{
|
||||
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
|
||||
field.GetName(),
|
||||
field.GetShownText() ) );
|
||||
field.GetShownText( sheet, false) ) );
|
||||
}
|
||||
|
||||
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
|
||||
|
@ -2287,7 +2301,7 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
aPlotter->EndBlock( nullptr );
|
||||
|
||||
if( !m_part->IsPower() )
|
||||
aPlotter->Bookmark( GetBoundingBox(), GetField( REFERENCE_FIELD )->GetShownText(), _("Symbols") );
|
||||
aPlotter->Bookmark( GetBoundingBox(), GetRef( sheet ), _( "Symbols" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -465,10 +465,12 @@ public:
|
|||
m_fields = aFields; // vector copying, length is changed possibly
|
||||
}
|
||||
|
||||
const wxString GetValueFieldText( bool aResolve, const SCH_SHEET_PATH* aPath = nullptr ) const;
|
||||
const wxString GetValueFieldText( bool aResolve, const SCH_SHEET_PATH* aPath,
|
||||
bool aAllowExtraText ) const;
|
||||
void SetValueFieldText( const wxString& aValue );
|
||||
|
||||
const wxString GetFootprintFieldText( bool aResolve ) const;
|
||||
const wxString GetFootprintFieldText( bool aResolve, const SCH_SHEET_PATH* aPath,
|
||||
bool aAllowExtraText ) const;
|
||||
void SetFootprintFieldText( const wxString& aFootprint );
|
||||
|
||||
/**
|
||||
|
|
|
@ -346,7 +346,8 @@ const BOX2I SCH_TEXT::GetBoundingBox() const
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_TEXT::GetShownText( const SCH_SHEET_PATH* aPath, int aDepth, bool aAllowExtraText ) const
|
||||
wxString SCH_TEXT::GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
|
||||
int aDepth ) const
|
||||
{
|
||||
SCH_SHEET* sheet = nullptr;
|
||||
|
||||
|
@ -367,7 +368,7 @@ wxString SCH_TEXT::GetShownText( const SCH_SHEET_PATH* aPath, int aDepth, bool a
|
|||
return false;
|
||||
};
|
||||
|
||||
wxString text = EDA_TEXT::GetShownText();
|
||||
wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
|
||||
|
||||
if( text == wxS( "~" ) ) // Legacy placeholder for empty string
|
||||
{
|
||||
|
@ -395,7 +396,7 @@ void SCH_TEXT::DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const
|
|||
|
||||
wxString SCH_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Graphic Text '%s'" ), KIUI::EllipsizeMenuText( GetShownText() ) );
|
||||
return wxString::Format( _( "Graphic Text '%s'" ), KIUI::EllipsizeMenuText( GetText() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -471,7 +472,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
|
||||
std::vector<VECTOR2I> positions;
|
||||
wxArrayString strings_list;
|
||||
wxStringSplit( GetShownText(), strings_list, '\n' );
|
||||
wxStringSplit( GetShownText( true ), strings_list, '\n' );
|
||||
positions.reserve( strings_list.Count() );
|
||||
|
||||
GetLinePositions( positions, (int) strings_list.Count() );
|
||||
|
|
|
@ -128,12 +128,12 @@ public:
|
|||
return wxT( "SCH_TEXT" );
|
||||
}
|
||||
|
||||
virtual wxString GetShownText( const SCH_SHEET_PATH* aPath, int aDepth = 0,
|
||||
bool aAllowExtraText = true ) const;
|
||||
virtual wxString GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
|
||||
int aDepth = 0 ) const;
|
||||
|
||||
wxString GetShownText( int aDepth = 0, bool aAllowExtraText = true ) const override
|
||||
wxString GetShownText( bool aAllowExtraText, int aDepth = 0 ) const override
|
||||
{
|
||||
return GetShownText( nullptr, aDepth, aAllowExtraText );
|
||||
return GetShownText( nullptr, aAllowExtraText, aDepth );
|
||||
}
|
||||
|
||||
bool IsHypertext() const override
|
||||
|
|
|
@ -285,12 +285,20 @@ void SCH_TEXTBOX::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffs
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_TEXTBOX::GetShownText( int aDepth, bool aAllowExtraText ) const
|
||||
wxString SCH_TEXTBOX::GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
|
||||
int aDepth ) const
|
||||
{
|
||||
SCH_SHEET* sheet = nullptr;
|
||||
|
||||
if( aPath )
|
||||
sheet = aPath->Last();
|
||||
else if( Schematic() )
|
||||
sheet = Schematic()->CurrentSheet().Last();
|
||||
|
||||
std::function<bool( wxString* )> textResolver =
|
||||
[&]( wxString* token ) -> bool
|
||||
{
|
||||
if( SCH_SHEET* sheet = Schematic()->CurrentSheet().Last() )
|
||||
if( sheet )
|
||||
{
|
||||
if( sheet->ResolveTextVar( token, aDepth + 1 ) )
|
||||
return true;
|
||||
|
@ -299,7 +307,7 @@ wxString SCH_TEXTBOX::GetShownText( int aDepth, bool aAllowExtraText ) const
|
|||
return false;
|
||||
};
|
||||
|
||||
wxString text = EDA_TEXT::GetShownText();
|
||||
wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
|
||||
|
||||
if( HasTextVars() )
|
||||
{
|
||||
|
@ -412,7 +420,7 @@ void SCH_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
|||
|
||||
std::vector<VECTOR2I> positions;
|
||||
wxArrayString strings_list;
|
||||
wxStringSplit( GetShownText(), strings_list, '\n' );
|
||||
wxStringSplit( GetShownText( true ), strings_list, '\n' );
|
||||
positions.reserve( strings_list.Count() );
|
||||
|
||||
GetLinePositions( positions, (int) strings_list.Count() );
|
||||
|
|
|
@ -55,7 +55,13 @@ public:
|
|||
|
||||
VECTOR2I GetDrawPos() const override;
|
||||
|
||||
wxString GetShownText( int aDepth = 0, bool aAllowExtraText = true ) const override;
|
||||
virtual wxString GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
|
||||
int aDepth = 0 ) const;
|
||||
|
||||
wxString GetShownText( bool aAllowExtraText, int aDepth = 0 ) const override
|
||||
{
|
||||
return GetShownText( nullptr, aAllowExtraText, aDepth );
|
||||
}
|
||||
|
||||
bool IsHypertext() const override
|
||||
{
|
||||
|
|
|
@ -200,7 +200,7 @@ SIM_LIBRARY::MODEL SIM_LIB_MGR::CreateModel( const SCH_SHEET_PATH* aSheetPath, S
|
|||
if( field.GetId() == REFERENCE_FIELD )
|
||||
fields.back().SetText( aSymbol.GetRef( aSheetPath ) );
|
||||
else
|
||||
fields.back().SetText( field.GetShownText( aSheetPath, 0, false ) );
|
||||
fields.back().SetText( field.GetShownText( aSheetPath, false ) );
|
||||
}
|
||||
|
||||
wxString deviceType;
|
||||
|
|
|
@ -627,7 +627,7 @@ std::string SIM_MODEL::GetFieldValue( const std::vector<T>* aFields, const wxStr
|
|||
{
|
||||
if( field.GetName() == aFieldName )
|
||||
{
|
||||
return aResolve ? field.GetShownText( 0, false ).ToStdString()
|
||||
return aResolve ? field.GetShownText( false ).ToStdString()
|
||||
: field.GetText().ToStdString();
|
||||
}
|
||||
}
|
||||
|
@ -1420,7 +1420,7 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
|
|||
// SPICE. Here we remap them to 'r0' and 'r1'.
|
||||
if( T_field* deviceType = aSymbol.FindField( SIM_TYPE_FIELD ) )
|
||||
{
|
||||
if( deviceType->GetShownText( 0, false ).Lower() == wxS( "pot" ) )
|
||||
if( deviceType->GetShownText( false ).Lower() == wxS( "pot" ) )
|
||||
{
|
||||
if( T_field* pins = aSymbol.FindField( SIM_PINS_FIELD ) )
|
||||
{
|
||||
|
|
|
@ -418,13 +418,9 @@ int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
|
|||
|
||||
SCH_SYMBOL* symbol = (SCH_SYMBOL*) selection.Front();
|
||||
|
||||
// Use GetShownText() to resolve any text variables, but uve only field value
|
||||
// (do not allow adding field name )
|
||||
SCH_FIELD* tmp = symbol->GetField( DATASHEET_FIELD );
|
||||
bool name_shown = tmp->IsNameShown();
|
||||
tmp->SetNameShown( false );
|
||||
datasheet = tmp->GetShownText();
|
||||
tmp->SetNameShown( name_shown );
|
||||
// Use GetShownText() to resolve any text variables, but don't allow adding extra text
|
||||
// (ie: the field name)
|
||||
datasheet = symbol->GetField( DATASHEET_FIELD )->GetShownText( false );
|
||||
}
|
||||
|
||||
if( datasheet.IsEmpty() || datasheet == wxS( "~" ) )
|
||||
|
|
|
@ -124,7 +124,7 @@ void HIERARCHY_PANE::buildHierarchyTree( SCH_SHEET_PATH* aList, const wxTreeItem
|
|||
SCH_SHEET* sheet = static_cast<SCH_SHEET*>( aItem );
|
||||
aList->push_back( sheet );
|
||||
|
||||
wxString sheetName = formatPageString( sheet->GetFields()[SHEETNAME].GetShownText(),
|
||||
wxString sheetName = formatPageString( sheet->GetFields()[SHEETNAME].GetShownText( false ),
|
||||
aList->GetPageNumber() );
|
||||
wxTreeItemId child = m_tree->AppendItem( aParent, sheetName, 0, 1 );
|
||||
m_tree->SetItemData( child, new TREE_ITEM_DATA( *aList ) );
|
||||
|
|
|
@ -89,13 +89,13 @@ public:
|
|||
/**
|
||||
* Return the string actually shown after processing of the base text.
|
||||
*
|
||||
* @param aDepth is used to prevent infinite recursions and loops when expanding
|
||||
* text variables.
|
||||
* @param aAllowExtraText is true to allow adding more text than the initial expanded text,
|
||||
* for intance a title, a prefix for texts in display functions.
|
||||
* False to disable any added text (for instance when writing the shown text in netlists).
|
||||
* @param aDepth is used to prevent infinite recursions and loops when expanding
|
||||
* text variables.
|
||||
*/
|
||||
virtual wxString GetShownText( int aDepth = 0, bool aAllowExtraText = true ) const
|
||||
virtual wxString GetShownText( bool aAllowExtraText, int aDepth = 0 ) const
|
||||
{
|
||||
return m_shown_text;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009-2014 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -133,7 +133,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
|
|||
&& curEntry->m_FPID == footprint->GetFPID() )
|
||||
{
|
||||
curEntry->m_Ref.Append( wxT( ", " ), 1 );
|
||||
curEntry->m_Ref.Append( footprint->Reference().GetShownText() );
|
||||
curEntry->m_Ref.Append( footprint->Reference().GetShownText( false ) );
|
||||
curEntry->m_Count++;
|
||||
|
||||
valExist = true;
|
||||
|
@ -146,8 +146,8 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
|
|||
{
|
||||
BOM_ENTRY* newEntry = new BOM_ENTRY();
|
||||
newEntry->m_Id = i++;
|
||||
newEntry->m_Val = footprint->Value().GetShownText();
|
||||
newEntry->m_Ref = footprint->Reference().GetShownText();
|
||||
newEntry->m_Val = footprint->Value().GetShownText( false );
|
||||
newEntry->m_Ref = footprint->Reference().GetShownText( false );
|
||||
newEntry->m_FPID = footprint->GetFPID();
|
||||
newEntry->m_Count = 1;
|
||||
list.Append( newEntry );
|
||||
|
|
|
@ -442,5 +442,5 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( PCB_DIMENSION_BASE*
|
|||
void DIALOG_DIMENSION_PROPERTIES::updatePreviewText()
|
||||
{
|
||||
updateDimensionFromDialog( m_previewDimension );
|
||||
m_staticTextPreview->SetLabel( m_previewDimension->GetShownText() );
|
||||
m_staticTextPreview->SetLabel( m_previewDimension->GetShownText( true ) );
|
||||
}
|
||||
|
|
|
@ -499,8 +499,8 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
|||
|
||||
// Display parent footprint info
|
||||
msg.Printf( _("Footprint %s (%s), %s, rotated %g deg"),
|
||||
footprint->Reference().GetShownText(),
|
||||
footprint->Value().GetShownText(),
|
||||
footprint->Reference().GetShownText( false ),
|
||||
footprint->Value().GetShownText( false ),
|
||||
footprint->IsFlipped() ? _( "back side (mirrored)" ) : _( "front side" ),
|
||||
footprint->GetOrientation().AsDegrees() );
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ void DRC_TEST_PROVIDER_MISC::testTextVars()
|
|||
|
||||
wxCHECK( boardItem, false );
|
||||
|
||||
if( text && text->GetShownText().Matches( wxT( "*${*}*" ) ) )
|
||||
if( text && text->GetShownText( true ).Matches( wxT( "*${*}*" ) ) )
|
||||
{
|
||||
std::shared_ptr<DRC_ITEM>drcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE );
|
||||
drcItem->SetItems( item );
|
||||
|
@ -323,7 +323,7 @@ void DRC_TEST_PROVIDER_MISC::testTextVars()
|
|||
|
||||
DS_DRAW_ITEM_TEXT* text = dynamic_cast<DS_DRAW_ITEM_TEXT*>( item );
|
||||
|
||||
if( text && text->GetShownText().Matches( wxT( "*${*}*" ) ) )
|
||||
if( text && text->GetShownText( true ).Matches( wxT( "*${*}*" ) ) )
|
||||
{
|
||||
std::shared_ptr<DRC_ITEM> drcItem = DRC_ITEM::Create( DRCE_UNRESOLVED_VARIABLE );
|
||||
drcItem->SetItems( drawingSheet );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2021-2022 KiCad Developers.
|
||||
* Copyright (C) 2021-2023 KiCad Developers.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -152,7 +152,7 @@ bool DRC_TEST_PROVIDER_TEXT_DIMS::Run()
|
|||
if( !constraint.Value().HasMin() )
|
||||
return true;
|
||||
|
||||
auto* glyphs = text->GetRenderCache( font, text->GetShownText() );
|
||||
auto* glyphs = text->GetRenderCache( font, text->GetShownText( true ) );
|
||||
bool collapsedStroke = false;
|
||||
bool collapsedArea = false;
|
||||
|
||||
|
|
|
@ -271,7 +271,7 @@ UseBoundingBox:
|
|||
static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD& aIDFBoard )
|
||||
{
|
||||
// Reference Designator
|
||||
std::string crefdes = TO_UTF8( aFootprint->Reference().GetShownText() );
|
||||
std::string crefdes = TO_UTF8( aFootprint->Reference().GetShownText( false ) );
|
||||
|
||||
wxString libraryName = aFootprint->GetFPID().GetLibNickname();
|
||||
wxString footprintBasePath = wxEmptyString;
|
||||
|
@ -295,7 +295,7 @@ static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD
|
|||
|
||||
if( crefdes.empty() || !crefdes.compare( "~" ) )
|
||||
{
|
||||
std::string cvalue = TO_UTF8( aFootprint->Value().GetShownText() );
|
||||
std::string cvalue = TO_UTF8( aFootprint->Value().GetShownText( false ) );
|
||||
|
||||
// if both the RefDes and Value are empty or set to '~' the board owns the part,
|
||||
// otherwise associated parts of the footprint must be marked NOREFDES.
|
||||
|
@ -440,7 +440,7 @@ static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD
|
|||
|
||||
if( refdes.empty() )
|
||||
{
|
||||
refdes = TO_UTF8( aFootprint->Reference().GetShownText() );
|
||||
refdes = TO_UTF8( aFootprint->Reference().GetShownText( false ) );
|
||||
|
||||
// NOREFDES cannot be used or else the software gets confused
|
||||
// when writing out the placement data due to conflicting
|
||||
|
|
|
@ -131,7 +131,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
|
|||
|
||||
// Add object attribute: component reference to flash (mainly useful for users)
|
||||
// using quoted UTF8 string
|
||||
wxString ref = ConvertNotAllowedCharsInGerber( footprint->Reference().GetShownText(),
|
||||
wxString ref = ConvertNotAllowedCharsInGerber( footprint->Reference().GetShownText( false ),
|
||||
allowUtf8, true );
|
||||
|
||||
gbr_metadata.SetCmpReference( ref );
|
||||
|
@ -152,7 +152,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
|
|||
pnpAttrib.m_MountType = GBR_CMP_PNP_METADATA::MOUNT_TYPE_SMD;
|
||||
|
||||
// Add component value info:
|
||||
pnpAttrib.m_Value = ConvertNotAllowedCharsInGerber( footprint->Value().GetShownText(),
|
||||
pnpAttrib.m_Value = ConvertNotAllowedCharsInGerber( footprint->Value().GetShownText( false ),
|
||||
allowUtf8, true );
|
||||
|
||||
// Add component footprint info:
|
||||
|
|
|
@ -146,8 +146,8 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
|
|||
|
||||
LIST_MOD item;
|
||||
item.m_Footprint = footprint;
|
||||
item.m_Reference = footprint->Reference().GetShownText();
|
||||
item.m_Value = footprint->Value().GetShownText();
|
||||
item.m_Reference = footprint->Reference().GetShownText( false );
|
||||
item.m_Value = footprint->Value().GetShownText( false );
|
||||
item.m_Layer = footprint->GetLayer();
|
||||
list.push_back( item );
|
||||
|
||||
|
@ -331,13 +331,14 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
|
|||
|
||||
for( FOOTPRINT* footprint : sortedFootprints )
|
||||
{
|
||||
wxString ref = footprint->Reference().GetShownText();
|
||||
wxString ref = footprint->Reference().GetShownText( false );
|
||||
wxString value = footprint->Value().GetShownText( false );
|
||||
|
||||
snprintf( line, sizeof(line), "$MODULE %s\n", TO_UTF8( ref ) );
|
||||
buffer += line;
|
||||
|
||||
snprintf( line, sizeof(line), "reference %s\n", TO_UTF8( ref ) );
|
||||
snprintf( line, sizeof(line), "value %s\n", EscapedUTF8( footprint->Value().GetShownText() ).c_str() );
|
||||
snprintf( line, sizeof(line), "value %s\n", TO_UTF8( value ) );
|
||||
snprintf( line, sizeof(line), "footprint %s\n", footprint->GetFPID().Format().c_str() );
|
||||
buffer += line;
|
||||
|
||||
|
|
|
@ -498,12 +498,12 @@ bool FOOTPRINT::ResolveTextVar( wxString* token, int aDepth ) const
|
|||
|
||||
if( token->IsSameAs( wxT( "REFERENCE" ) ) )
|
||||
{
|
||||
*token = m_reference->GetShownText( aDepth + 1 );
|
||||
*token = m_reference->GetShownText( false, aDepth + 1 );
|
||||
return true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "VALUE" ) ) )
|
||||
{
|
||||
*token = m_value->GetShownText( aDepth + 1 );
|
||||
*token = m_value->GetShownText( false, aDepth + 1 );
|
||||
return true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "LAYER" ) ) )
|
||||
|
@ -1024,7 +1024,9 @@ void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
|
|||
{
|
||||
wxString msg, msg2;
|
||||
|
||||
aList.emplace_back( m_reference->GetShownText(), m_value->GetShownText() );
|
||||
// Don't use GetShownText(); we want to see the variable references here
|
||||
aList.emplace_back( UnescapeString( m_reference->GetText() ),
|
||||
UnescapeString( m_value->GetText() ) );
|
||||
|
||||
if( aFrame->IsType( FRAME_FOOTPRINT_VIEWER )
|
||||
|| aFrame->IsType( FRAME_FOOTPRINT_VIEWER_MODAL )
|
||||
|
|
|
@ -295,7 +295,8 @@ void PCB_DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
|
|||
|
||||
wxCHECK_RET( m_parent != nullptr, wxT( "PCB_TEXT::GetMsgPanelInfo() m_Parent is NULL." ) );
|
||||
|
||||
aList.emplace_back( _( "Dimension" ), GetShownText() );
|
||||
// Don't use GetShownText(); we want to see the variable references here
|
||||
aList.emplace_back( _( "Dimension" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
|
||||
|
||||
aList.emplace_back( _( "Prefix" ), GetPrefix() );
|
||||
|
||||
|
@ -449,7 +450,9 @@ const BOX2I PCB_DIMENSION_BASE::GetBoundingBox() const
|
|||
|
||||
wxString PCB_DIMENSION_BASE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Dimension '%s' on %s" ), GetText(), GetLayerName() );
|
||||
return wxString::Format( _( "Dimension '%s' on %s" ),
|
||||
KIUI::EllipsizeMenuText( GetText() ),
|
||||
GetLayerName() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1082,7 +1085,8 @@ void PCB_DIM_LEADER::updateGeometry()
|
|||
|
||||
void PCB_DIM_LEADER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
aList.emplace_back( _( "Leader" ), GetShownText() );
|
||||
// Don't use GetShownText(); we want to see the variable references here
|
||||
aList.emplace_back( _( "Leader" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
|
||||
|
||||
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms();
|
||||
|
||||
|
|
|
@ -1696,11 +1696,11 @@ void PCB_EDIT_FRAME::ShowFindDialog()
|
|||
switch( front->Type() )
|
||||
{
|
||||
case PCB_FOOTPRINT_T:
|
||||
findString = static_cast<FOOTPRINT*>( front )->GetValue();
|
||||
findString = UnescapeString( static_cast<FOOTPRINT*>( front )->GetValue() );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
findString = static_cast<PCB_TEXT*>( front )->GetShownText();
|
||||
findString = UnescapeString( static_cast<PCB_TEXT*>( front )->GetText() );
|
||||
|
||||
if( findString.Contains( wxT( "\n" ) ) )
|
||||
findString = findString.Before( '\n' );
|
||||
|
|
|
@ -1915,7 +1915,7 @@ void PCB_PAINTER::draw( const PCB_BITMAP* aBitmap, int aLayer )
|
|||
|
||||
void PCB_PAINTER::draw( const PCB_TEXT* aText, int aLayer )
|
||||
{
|
||||
wxString resolvedText( aText->GetShownText() );
|
||||
wxString resolvedText( aText->GetShownText( true ) );
|
||||
|
||||
if( resolvedText.Length() == 0 )
|
||||
return;
|
||||
|
@ -2030,7 +2030,7 @@ void PCB_PAINTER::draw( const PCB_TEXTBOX* aTextBox, int aLayer )
|
|||
const COLOR4D& color = m_pcbSettings.GetColor( aTextBox, aLayer );
|
||||
int thickness = getLineThickness( aTextBox->GetWidth() );
|
||||
PLOT_DASH_TYPE lineStyle = aTextBox->GetStroke().GetPlotStyle();
|
||||
wxString resolvedText( aTextBox->GetShownText() );
|
||||
wxString resolvedText( aTextBox->GetShownText( true ) );
|
||||
|
||||
KIFONT::FONT* font = aTextBox->GetFont();
|
||||
|
||||
|
@ -2407,7 +2407,7 @@ void PCB_PAINTER::draw( const PCB_DIMENSION_BASE* aDimension, int aLayer )
|
|||
}
|
||||
|
||||
// Draw text
|
||||
wxString resolvedText = aDimension->GetShownText();
|
||||
wxString resolvedText = aDimension->GetShownText( true );
|
||||
TEXT_ATTRIBUTES attrs = aDimension->GetAttributes();
|
||||
|
||||
if( m_gal->IsFlippedX() && !( aDimension->GetLayerSet() & LSET::SideSpecificMask() ).any() )
|
||||
|
|
|
@ -77,7 +77,7 @@ PCB_TEXT::~PCB_TEXT()
|
|||
}
|
||||
|
||||
|
||||
wxString PCB_TEXT::GetShownText( int aDepth, bool aAllowExtraText ) const
|
||||
wxString PCB_TEXT::GetShownText( bool aAllowExtraText, int aDepth ) const
|
||||
{
|
||||
const FOOTPRINT* parentFootprint = GetParentFootprint();
|
||||
const BOARD* board = GetBoard();
|
||||
|
@ -100,7 +100,7 @@ wxString PCB_TEXT::GetShownText( int aDepth, bool aAllowExtraText ) const
|
|||
return false;
|
||||
};
|
||||
|
||||
wxString text = EDA_TEXT::GetShownText();
|
||||
wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
|
||||
|
||||
if( HasTextVars() )
|
||||
{
|
||||
|
@ -112,6 +112,12 @@ wxString PCB_TEXT::GetShownText( int aDepth, bool aAllowExtraText ) const
|
|||
}
|
||||
|
||||
|
||||
bool PCB_TEXT::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const
|
||||
{
|
||||
return BOARD_ITEM::Matches( UnescapeString( GetText() ), aSearchData );
|
||||
}
|
||||
|
||||
|
||||
EDA_ANGLE PCB_TEXT::GetDrawRotation() const
|
||||
{
|
||||
EDA_ANGLE rotation = GetTextAngle();
|
||||
|
@ -390,19 +396,19 @@ wxString PCB_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
|||
|
||||
case TEXT_is_VALUE:
|
||||
return wxString::Format( _( "Value '%s' of %s" ),
|
||||
GetShownText(),
|
||||
KIUI::EllipsizeMenuText( GetText() ),
|
||||
parentFP->GetReference() );
|
||||
|
||||
case TEXT_is_DIVERS:
|
||||
return wxString::Format( _( "Footprint Text '%s' of %s" ),
|
||||
KIUI::EllipsizeMenuText( GetShownText() ),
|
||||
KIUI::EllipsizeMenuText( GetText() ),
|
||||
parentFP->GetReference() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxString::Format( _( "PCB Text '%s' on %s"),
|
||||
KIUI::EllipsizeMenuText( GetShownText() ),
|
||||
KIUI::EllipsizeMenuText( GetText() ),
|
||||
GetLayerName() );
|
||||
}
|
||||
|
||||
|
@ -487,7 +493,7 @@ void PCB_TEXT::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLa
|
|||
buffer.Append( point.x, point.y );
|
||||
} );
|
||||
|
||||
font->Draw( &callback_gal, GetShownText(), GetTextPos(), attrs );
|
||||
font->Draw( &callback_gal, GetShownText( true ), GetTextPos(), attrs );
|
||||
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
if( IsKnockout() )
|
||||
|
|
|
@ -83,15 +83,12 @@ public:
|
|||
*/
|
||||
void KeepUpright( const EDA_ANGLE& aOldOrientation, const EDA_ANGLE& aNewOrientation );
|
||||
|
||||
wxString GetShownText( int aDepth = 0, bool aAllowExtraText = true ) const override;
|
||||
wxString GetShownText( bool aAllowExtraText, int aDepth = 0 ) const override;
|
||||
|
||||
void SetType( TEXT_TYPE aType ) { m_type = aType; }
|
||||
TEXT_TYPE GetType() const { return m_type; }
|
||||
|
||||
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override
|
||||
{
|
||||
return BOARD_ITEM::Matches( GetShownText(), aSearchData );
|
||||
}
|
||||
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
|
||||
|
||||
virtual VECTOR2I GetPosition() const override
|
||||
{
|
||||
|
|
|
@ -248,7 +248,7 @@ double PCB_TEXTBOX::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
|||
}
|
||||
|
||||
|
||||
wxString PCB_TEXTBOX::GetShownText( int aDepth, bool aAllowExtraText ) const
|
||||
wxString PCB_TEXTBOX::GetShownText( bool aAllowExtraText, int aDepth ) const
|
||||
{
|
||||
BOARD* board = dynamic_cast<BOARD*>( GetParent() );
|
||||
|
||||
|
@ -269,7 +269,7 @@ wxString PCB_TEXTBOX::GetShownText( int aDepth, bool aAllowExtraText ) const
|
|||
return false;
|
||||
};
|
||||
|
||||
wxString text = EDA_TEXT::GetShownText();
|
||||
wxString text = EDA_TEXT::GetShownText( aAllowExtraText, aDepth );
|
||||
|
||||
if( board && HasTextVars() && aDepth < 10 )
|
||||
text = ExpandTextVars( text, &pcbTextResolver );
|
||||
|
@ -285,6 +285,12 @@ wxString PCB_TEXTBOX::GetShownText( int aDepth, bool aAllowExtraText ) const
|
|||
}
|
||||
|
||||
|
||||
bool PCB_TEXTBOX::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const
|
||||
{
|
||||
return BOARD_ITEM::Matches( UnescapeString( GetText() ), aSearchData );
|
||||
}
|
||||
|
||||
|
||||
void PCB_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
// Don't use GetShownText() here; we want to show the user the variable references
|
||||
|
@ -471,7 +477,7 @@ void PCB_TEXTBOX::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID
|
|||
buffer.Append( point.x, point.y );
|
||||
} );
|
||||
|
||||
font->Draw( &callback_gal, GetShownText(), GetDrawPos(), GetAttributes() );
|
||||
font->Draw( &callback_gal, GetShownText( true ), GetDrawPos(), GetAttributes() );
|
||||
|
||||
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
aBuffer.Append( buffer );
|
||||
|
|
|
@ -76,16 +76,13 @@ public:
|
|||
|
||||
void SetTextAngle( const EDA_ANGLE& aAngle ) override;
|
||||
|
||||
wxString GetShownText( int aDepth = 0, bool aAllowExtraText = true ) const override;
|
||||
wxString GetShownText( bool aAllowExtraText, int aDepth = 0 ) const override;
|
||||
|
||||
/// PCB_TEXTBOXes are always visible:
|
||||
void SetVisible( bool aVisible ) override { /* do nothing */}
|
||||
bool IsVisible() const override { return true; }
|
||||
|
||||
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override
|
||||
{
|
||||
return BOARD_ITEM::Matches( GetShownText(), aSearchData );
|
||||
}
|
||||
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
|
||||
|
||||
std::vector<VECTOR2I> GetAnchorAndOppositeCorner() const;
|
||||
|
||||
|
|
|
@ -89,11 +89,11 @@ void PlotInteractiveLayer( BOARD* aBoard, PLOTTER* aPlotter, const PCB_PLOT_PARA
|
|||
|
||||
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
|
||||
_( "Reference designator" ),
|
||||
fp->Reference().GetShownText() ) );
|
||||
fp->Reference().GetShownText( false ) ) );
|
||||
|
||||
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
|
||||
_( "Value" ),
|
||||
fp->Value().GetShownText() ) );
|
||||
fp->Value().GetShownText( false ) ) );
|
||||
|
||||
for( const auto& [ name, value ] : fp->GetProperties() )
|
||||
properties.emplace_back( wxString::Format( wxT( "!%s = %s" ), name, value ) );
|
||||
|
|
|
@ -447,7 +447,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( const PCB_TEXT* aText, const COLOR
|
|||
|
||||
callback_gal.SetIsFill( font->IsOutline() );
|
||||
callback_gal.SetIsStroke( font->IsStroke() );
|
||||
font->Draw( &callback_gal, aText->GetShownText(), aText->GetDrawPos(), attrs );
|
||||
font->Draw( &callback_gal, aText->GetShownText( true ), aText->GetDrawPos(), attrs );
|
||||
|
||||
SHAPE_POLY_SET finalPoly;
|
||||
int margin = attrs.m_StrokeWidth * 1.5
|
||||
|
@ -461,7 +461,9 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( const PCB_TEXT* aText, const COLOR
|
|||
m_plotter->PlotPoly( finalPoly.Outline( ii ), FILL_T::FILLED_SHAPE, 0, &gbr_metadata );
|
||||
}
|
||||
else
|
||||
m_plotter->PlotText( pos, aColor, aText->GetShownText(), attrs, font, &gbr_metadata );
|
||||
{
|
||||
m_plotter->PlotText( pos, aColor, aText->GetShownText( true ), attrs, font, &gbr_metadata );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -644,7 +646,7 @@ void BRDITEMS_PLOTTER::PlotPcbText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer,
|
|||
aText->IsBold(), aText->IsItalic() );
|
||||
}
|
||||
|
||||
wxString shownText( aText->GetShownText() );
|
||||
wxString shownText( aText->GetShownText( true ) );
|
||||
|
||||
if( shownText.IsEmpty() )
|
||||
return;
|
||||
|
|
|
@ -480,7 +480,7 @@ void PCB_PLUGIN::formatPolyPts( const SHAPE_LINE_CHAIN& outline, int aNestLevel,
|
|||
|
||||
void PCB_PLUGIN::formatRenderCache( const EDA_TEXT* aText, int aNestLevel ) const
|
||||
{
|
||||
const wxString& shownText = aText->GetShownText();
|
||||
const wxString& shownText = aText->GetShownText( true );
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = aText->GetRenderCache( aText->GetFont(),
|
||||
shownText );
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ wxString TEXT_SEARCH_HANDLER::GetResultCell( int aRow, int aCol )
|
|||
if( PCB_TEXT::ClassOf( text ) )
|
||||
return UnescapeString( static_cast<PCB_TEXT*>( text )->GetText() );
|
||||
else if( PCB_TEXTBOX::ClassOf( text ) )
|
||||
return UnescapeString( static_cast<PCB_TEXTBOX*>( text )->GetShownText() );
|
||||
return UnescapeString( static_cast<PCB_TEXTBOX*>( text )->GetText() );
|
||||
}
|
||||
if( aCol == 2 )
|
||||
return text->GetLayerName();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
* Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -47,7 +47,8 @@ struct LEGACY_POWER_SYMBOLS_TEST_FIXTURE
|
|||
&& symbol->GetAllLibPins()[0]->IsGlobalPower()
|
||||
&& !symbol->GetAllLibPins()[0]->IsVisible() )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( symbol->GetValueFieldText(true), symbol->GetAllLibPins()[0]->GetName() );
|
||||
BOOST_CHECK_EQUAL( symbol->GetField( VALUE_FIELD )->GetText(),
|
||||
symbol->GetAllLibPins()[0]->GetName() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue