diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index ac356d61a8..4853df2a60 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -665,6 +665,26 @@ wxString SCH_TEXT::GetShownText( int aDepth, bool aAllowExtraText ) const } +bool SCH_TEXT::Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const +{ + return SCH_ITEM::Matches( UnescapeString( GetText() ), aSearchData ); +} + + +bool SCH_TEXT::Replace( const wxFindReplaceData& aSearchData, void* aAuxData ) +{ + wxFindReplaceData localSearchData( aSearchData ); + + if( Type() == SCH_LABEL_T || Type() == SCH_HIER_LABEL_T || Type() == SCH_GLOBAL_LABEL_T ) + { + localSearchData.SetFindString( EscapeString( aSearchData.GetFindString(), CTX_NETNAME ) ); + localSearchData.SetReplaceString( EscapeString( aSearchData.GetReplaceString(), CTX_NETNAME ) ); + } + + return EDA_TEXT::Replace( localSearchData ); +} + + wxString SCH_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Graphic Text '%s'" ), ShortenedShownText() ); diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index 00c7c4208d..c38421af4a 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -210,15 +210,8 @@ public: virtual void Rotate90( bool aClockwise ); virtual void MirrorSpinStyle( bool aLeftRight ); - bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override - { - return SCH_ITEM::Matches( GetText(), aSearchData ); - } - - bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData ) override - { - return EDA_TEXT::Replace( aSearchData ); - } + bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override; + bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData ) override; virtual bool IsReplaceable() const override { return true; }