diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 9968ffb25f..3b8bf3f1f9 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -52,6 +52,13 @@ EDA_TEXT::~EDA_TEXT() } +void EDA_TEXT::SetText( const wxString& aText ) +{ + m_Text = aText; + m_shown_text = UnescapeString( aText ); +} + + void EDA_TEXT::SetEffects( const EDA_TEXT& aSrc ) { m_e = aSrc.m_e; diff --git a/include/eda_text.h b/include/eda_text.h index 4fad55c91b..252351d41f 100644 --- a/include/eda_text.h +++ b/include/eda_text.h @@ -150,13 +150,13 @@ public: /** * Returns the string actually shown after processing of the base * text. Default is no processing */ - virtual wxString GetShownText() const { return UnescapeString( m_Text ); } + virtual wxString GetShownText() const { return m_shown_text; } /** * Returns a shortened version (max 15 characters) of the shown text */ wxString ShortenedShownText() const; - virtual void SetText( const wxString& aText ) { m_Text = aText; } + virtual void SetText( const wxString& aText ); /** * Function SetThickness @@ -412,6 +412,9 @@ private: TE_MULTILINE, TE_VISIBLE, }; + + /// Cache of unescaped text for efficient access + wxString m_shown_text; };