Commit 6f33e6da authored by Dick Hollenbeck's avatar Dick Hollenbeck

SetName() was broken

parent e7eef8cf
...@@ -511,7 +511,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers() ...@@ -511,7 +511,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
{ {
D( printf( "add template:%s\n", TO_UTF8( it->m_Name ) ); ) D( printf( "add template:%s\n", TO_UTF8( it->m_Name ) ); )
fld.SetName( it->m_Name ); fld.SetName( it->m_Name );
fld.m_Text = it->m_Value; // empty? ok too. fld.m_Text = it->m_Value; // empty? ok too.
if( !it->m_Visible ) if( !it->m_Visible )
......
...@@ -710,6 +710,8 @@ void SCH_EDIT_FRAME::SaveSettings() ...@@ -710,6 +710,8 @@ void SCH_EDIT_FRAME::SaveSettings()
m_TemplateFieldNames.Format( &sf, 0 ); m_TemplateFieldNames.Format( &sf, 0 );
D(printf("saving formatted template fieldnames:'%s'\n", sf.GetString().c_str() );)
wxString record = FROM_UTF8( sf.GetString().c_str() ); wxString record = FROM_UTF8( sf.GetString().c_str() );
record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines
record.Replace( wxT(" "), wxT(" "), true ); // double space to single record.Replace( wxT(" "), wxT(" "), true ); // double space to single
......
...@@ -631,8 +631,12 @@ void LIB_FIELD::SetName( const wxString& aName ) ...@@ -631,8 +631,12 @@ void LIB_FIELD::SetName( const wxString& aName )
// Mandatory field names are fixed. // Mandatory field names are fixed.
// So what? Why should the low level code be in charge of such a policy issue? // So what? Why should the low level code be in charge of such a policy issue?
if( m_id < MANDATORY_FIELDS ) // Besides, m_id is a relic that is untrustworthy now.
if( m_id >=0 && m_id < MANDATORY_FIELDS )
{
D(printf( "trying to set a MANDATORY_FIELD's name\n" );)
return; return;
}
if( m_name != aName ) if( m_name != aName )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment