mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
Add legacy empty-string token handling to EDA_TEXT.
This commit is contained in:
parent
5d9c1dd75a
commit
74cefecaac
@ -94,13 +94,7 @@ EDA_TEXT::EDA_TEXT( const wxString& text ) :
|
|||||||
{
|
{
|
||||||
int sz = Mils2iu( DEFAULT_SIZE_TEXT );
|
int sz = Mils2iu( DEFAULT_SIZE_TEXT );
|
||||||
SetTextSize( wxSize( sz, sz ) );
|
SetTextSize( wxSize( sz, sz ) );
|
||||||
m_shown_text_has_text_var_refs = false;
|
cacheShownText();
|
||||||
|
|
||||||
if( !text.IsEmpty() )
|
|
||||||
{
|
|
||||||
m_shown_text = UnescapeString( text );
|
|
||||||
m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -108,8 +102,7 @@ EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText ) :
|
|||||||
m_text( aText.m_text ),
|
m_text( aText.m_text ),
|
||||||
m_e( aText.m_e )
|
m_e( aText.m_e )
|
||||||
{
|
{
|
||||||
m_shown_text = UnescapeString( m_text );
|
cacheShownText();
|
||||||
m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -121,8 +114,7 @@ EDA_TEXT::~EDA_TEXT()
|
|||||||
void EDA_TEXT::SetText( const wxString& aText )
|
void EDA_TEXT::SetText( const wxString& aText )
|
||||||
{
|
{
|
||||||
m_text = aText;
|
m_text = aText;
|
||||||
m_shown_text = UnescapeString( aText );
|
cacheShownText();
|
||||||
m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -178,13 +170,27 @@ int EDA_TEXT::GetEffectiveTextPenWidth( int aDefaultWidth ) const
|
|||||||
bool EDA_TEXT::Replace( const wxFindReplaceData& aSearchData )
|
bool EDA_TEXT::Replace( const wxFindReplaceData& aSearchData )
|
||||||
{
|
{
|
||||||
bool retval = EDA_ITEM::Replace( aSearchData, m_text );
|
bool retval = EDA_ITEM::Replace( aSearchData, m_text );
|
||||||
m_shown_text = UnescapeString( m_text );
|
cacheShownText();
|
||||||
m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_TEXT::cacheShownText()
|
||||||
|
{
|
||||||
|
if( m_text.IsEmpty() || m_text == wxT( "~" ) ) // ~ is legacy empty-string token
|
||||||
|
{
|
||||||
|
m_shown_text = wxEmptyString;
|
||||||
|
m_shown_text_has_text_var_refs = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_shown_text = UnescapeString( m_text );
|
||||||
|
m_shown_text_has_text_var_refs = m_shown_text.Contains( wxT( "${" ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDA_TEXT::LenSize( const wxString& aLine, int aThickness ) const
|
int EDA_TEXT::LenSize( const wxString& aLine, int aThickness ) const
|
||||||
{
|
{
|
||||||
basic_gal.SetFontItalic( IsItalic() );
|
basic_gal.SetFontItalic( IsItalic() );
|
||||||
|
@ -374,6 +374,8 @@ public:
|
|||||||
virtual double GetDrawRotation() const;
|
virtual double GetDrawRotation() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void cacheShownText();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print each line of this EDA_TEXT..
|
* Print each line of this EDA_TEXT..
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user