Restore accidentally-removed allowsSpaces architecture.

Fixes https://gitlab.com/kicad/code/kicad/issues/6252
This commit is contained in:
Jeff Young 2020-11-08 00:33:15 +00:00
parent f33e44e630
commit 1f5213946e
4 changed files with 22 additions and 4 deletions

View File

@ -317,13 +317,22 @@ bool LIB_ID_VALIDATOR::Validate( wxWindow *aParent )
NETNAME_VALIDATOR::NETNAME_VALIDATOR( wxString *aVal ) :
wxTextValidator()
wxTextValidator(),
m_allowSpaces( false )
{
}
NETNAME_VALIDATOR::NETNAME_VALIDATOR( const NETNAME_VALIDATOR& aValidator ) :
wxTextValidator( aValidator )
wxTextValidator( aValidator ),
m_allowSpaces( aValidator.m_allowSpaces )
{
}
NETNAME_VALIDATOR::NETNAME_VALIDATOR( bool aAllowSpaces ) :
wxTextValidator(),
m_allowSpaces( aAllowSpaces )
{
}
@ -357,7 +366,7 @@ wxString NETNAME_VALIDATOR::IsValid( const wxString& str ) const
if( str.Contains( '\r' ) || str.Contains( '\n' ) )
return _( "Signal names cannot contain CR or LF characters" );
if( str.Contains( ' ' ) || str.Contains( '\t' ) )
if( !m_allowSpaces && ( str.Contains( ' ' ) || str.Contains( '\t' ) ) )
return _( "Signal names cannot contain spaces" );
return wxString();

View File

@ -48,7 +48,7 @@ class SCH_TEXT;
DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTextItem ) :
DIALOG_LABEL_EDITOR_BASE( aParent ),
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, false ),
m_netNameValidator(),
m_netNameValidator( true ),
m_scintillaTricks( nullptr ),
m_helpWindow( nullptr )
{

View File

@ -81,6 +81,10 @@ public:
NETNAME_VALIDATOR( aVal )
{ }
SCH_NETNAME_VALIDATOR( bool aAllowSpaces ) :
NETNAME_VALIDATOR( aAllowSpaces )
{ }
SCH_NETNAME_VALIDATOR( const SCH_NETNAME_VALIDATOR& aValidator ) :
NETNAME_VALIDATOR( aValidator )
{ }

View File

@ -200,6 +200,8 @@ class NETNAME_VALIDATOR : public wxTextValidator
public:
NETNAME_VALIDATOR( wxString *aVal = nullptr );
NETNAME_VALIDATOR( bool aAllowSpaces );
NETNAME_VALIDATOR( const NETNAME_VALIDATOR& aValidator );
virtual wxObject* Clone() const override { return new NETNAME_VALIDATOR( *this ); }
@ -213,6 +215,9 @@ public:
protected:
// returns the error message if the contents of 'val' are invalid
wxString IsValid( const wxString& aVal ) const override;
private:
bool m_allowSpaces;
};