Fix Bug #1445851: libedit field editor unnecessarily replaces spaces with underscores. Only reference and mainly value (in fact symbol name in lib) do not accept spaces in schematic libraries.

This commit is contained in:
unknown 2015-06-04 17:44:56 +02:00 committed by jean-pierre charras
parent 0cb649b3b0
commit c582cf5946
1 changed files with 20 additions and 2 deletions

View File

@ -161,8 +161,26 @@ void DIALOG_LIB_EDIT_ONE_FIELD::initDlg()
wxString DIALOG_LIB_EDIT_ONE_FIELD::GetTextField() wxString DIALOG_LIB_EDIT_ONE_FIELD::GetTextField()
{ {
wxString line = m_TextValue->GetValue(); wxString line = m_TextValue->GetValue();
// Spaces are not allowed in fields, so replace them by '_'
line.Replace( wxT( " " ), wxT( "_" ) ); // Spaces are not allowed in reference or value
if( m_field->GetId() == REFERENCE || m_field->GetId() == VALUE )
{
if( line.Replace( wxT( " " ), wxT( "_" ) ) )
{
wxString msg;
msg.Printf( _(
"Whitespace is not permitted inside references or values (symbol names in lib).\n"
"The text you entered has been converted to use underscores: %s" ),
line
);
wxMessageDialog dlg( this, msg );
dlg.ShowModal();
}
}
// Prevent the message from appearing twice by restuffing the text box.
m_TextValue->SetValue( line );
return line; return line;
} }