Check for duplicate field names.
Fixes https://gitlab.com/kicad/code/kicad/issues/4219
This commit is contained in:
parent
c01046c12f
commit
5d493abea7
|
@ -369,6 +369,25 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnGridCellChanging( wxGridEvent& event )
|
|||
m_delayedFocusColumn = event.GetCol();
|
||||
m_delayedFocusPage = 0;
|
||||
}
|
||||
else if( event.GetCol() == FDC_NAME )
|
||||
{
|
||||
wxString newName = event.GetString();
|
||||
|
||||
for( int i = 0; i < m_grid->GetNumberRows(); ++i )
|
||||
{
|
||||
if( i == event.GetRow() )
|
||||
continue;
|
||||
|
||||
if( newName.CmpNoCase( m_grid->GetCellValue( i, FDC_NAME ) ) == 0 )
|
||||
{
|
||||
DisplayError( this, wxString::Format( _( "The name '%s' is already in use." ),
|
||||
newName ) );
|
||||
event.Veto();
|
||||
m_delayedFocusRow = event.GetRow();
|
||||
m_delayedFocusColumn = event.GetCol();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( event.GetRow() == VALUE && event.GetCol() == FDC_VALUE )
|
||||
m_SymbolNameCtrl->ChangeValue( event.GetString() );
|
||||
|
||||
|
|
|
@ -553,6 +553,25 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnGridCellChanging( wxGridEvent& event
|
|||
m_delayedFocusRow = event.GetRow();
|
||||
m_delayedFocusColumn = event.GetCol();
|
||||
}
|
||||
else if( event.GetCol() == FDC_NAME )
|
||||
{
|
||||
wxString newName = event.GetString();
|
||||
|
||||
for( int i = 0; i < m_grid->GetNumberRows(); ++i )
|
||||
{
|
||||
if( i == event.GetRow() )
|
||||
continue;
|
||||
|
||||
if( newName.CmpNoCase( m_grid->GetCellValue( i, FDC_NAME ) ) == 0 )
|
||||
{
|
||||
DisplayError( this, wxString::Format( _( "The name '%s' is already in use." ),
|
||||
newName ) );
|
||||
event.Veto();
|
||||
m_delayedFocusRow = event.GetRow();
|
||||
m_delayedFocusColumn = event.GetCol();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
editor->DecRef();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue