SetName() was broken
This commit is contained in:
parent
e7eef8cf7b
commit
6f33e6da0c
|
@ -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()
|
||||||
|
|
||||||
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 )
|
||||||
// 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 )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue