From b5060d29513bb239aca7537db2a81cf7a12ffd05 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 6 Mar 2023 14:13:35 +0000 Subject: [PATCH] Support both wxWidgets APIs for excluded characters. (Sadly they're mutually incompatible.) Fixes https://gitlab.com/kicad/code/kicad/issues/14153 --- eeschema/sch_validators.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/eeschema/sch_validators.cpp b/eeschema/sch_validators.cpp index deb9d1275e..c107ed8b2e 100644 --- a/eeschema/sch_validators.cpp +++ b/eeschema/sch_validators.cpp @@ -142,6 +142,7 @@ bool SCH_FIELD_VALIDATOR::Validate( wxWindow* aParent ) { wxArrayString badCharsFound; +#if wxCHECK_VERSION( 3, 1, 3 ) for( const wxUniCharRef& excludeChar : GetCharExcludes() ) { if( val.Find( excludeChar ) != wxNOT_FOUND ) @@ -158,6 +159,24 @@ bool SCH_FIELD_VALIDATOR::Validate( wxWindow* aParent ) badCharsFound.Add( wxString::Format( wxT( "'%s'" ), excludeChar ) ); } } +#else + for( const wxString& excludeChar : GetExcludes() ) + { + if( val.Find( excludeChar ) != wxNOT_FOUND ) + { + if( excludeChar == wxT( "\r" ) ) + badCharsFound.Add( _( "carriage return" ) ); + else if( excludeChar == wxT( "\n" ) ) + badCharsFound.Add( _( "line feed" ) ); + else if( excludeChar == wxT( "\t" ) ) + badCharsFound.Add( _( "tab" ) ); + else if( excludeChar == wxT( " " ) ) + badCharsFound.Add( _( "space" ) ); + else + badCharsFound.Add( wxString::Format( wxT( "'%s'" ), excludeChar ) ); + } + } +#endif wxString badChars;