We no longer enforce either a non-empty value or name == value.

Fixes https://gitlab.com/kicad/code/kicad/issues/13424
This commit is contained in:
Jeff Young 2023-01-07 22:42:11 +00:00
parent 4794956804
commit ee0e90e3b0
1 changed files with 3 additions and 21 deletions

View File

@ -158,7 +158,6 @@ void DIALOG_FIELD_PROPERTIES::init()
// Predefined fields cannot contain some chars, or cannot be empty, // Predefined fields cannot contain some chars, or cannot be empty,
// and need a SCH_FIELD_VALIDATOR (m_StyledTextCtrl cannot use a SCH_FIELD_VALIDATOR). // and need a SCH_FIELD_VALIDATOR (m_StyledTextCtrl cannot use a SCH_FIELD_VALIDATOR).
bool use_validator = m_fieldId == REFERENCE_FIELD bool use_validator = m_fieldId == REFERENCE_FIELD
|| m_fieldId == VALUE_FIELD
|| m_fieldId == FOOTPRINT_FIELD || m_fieldId == FOOTPRINT_FIELD
|| m_fieldId == DATASHEET_FIELD || m_fieldId == DATASHEET_FIELD
|| m_fieldId == SHEETNAME_V || m_fieldId == SHEETNAME_V
@ -186,8 +185,8 @@ void DIALOG_FIELD_PROPERTIES::init()
// the text box and display an explanation. // the text box and display an explanation.
if( m_fieldId == VALUE_FIELD && m_isPower ) if( m_fieldId == VALUE_FIELD && m_isPower )
{ {
m_note->SetLabel( wxString::Format( m_note->GetLabel(), m_note->SetLabel( wxString::Format( m_note->GetLabel(), _( "Power symbol value field text "
_( "Power symbol value field text cannot be changed." ) ) ); "cannot be changed." ) ) );
m_note->Show( true ); m_note->Show( true );
m_TextCtrl->Enable( false ); m_TextCtrl->Enable( false );
} }
@ -363,14 +362,6 @@ bool DIALOG_FIELD_PROPERTIES::TransferDataFromWindow()
return false; return false;
} }
} }
else if( m_fieldId == VALUE_FIELD )
{
if( m_text.IsEmpty() )
{
DisplayError( this, _( "Value may not be empty." ) );
return false;
}
}
else if( m_fieldId == SHEETFILENAME_V ) else if( m_fieldId == SHEETFILENAME_V )
{ {
wxFileName fn( m_text ); wxFileName fn( m_text );
@ -454,16 +445,7 @@ DIALOG_LIB_FIELD_PROPERTIES::DIALOG_LIB_FIELD_PROPERTIES( SCH_BASE_FRAME* aParen
void DIALOG_LIB_FIELD_PROPERTIES::UpdateField( LIB_FIELD* aField ) void DIALOG_LIB_FIELD_PROPERTIES::UpdateField( LIB_FIELD* aField )
{ {
wxString value = m_text; aField->SetText( m_text );
if( m_fieldId == VALUE_FIELD )
value = EscapeString( value, CTX_LIBID );
aField->SetText( value );
// VALUE === symbol name, so update the parent symbol if it changes.
if( m_fieldId == VALUE_FIELD && aField->GetParent() )
aField->GetParent()->SetName( value );
updateText( aField ); updateText( aField );