Check for duplicate field names.
Fixes https://gitlab.com/kicad/code/kicad/issues/4219
(cherry picked from commit 5d493abea7
)
This commit is contained in:
parent
78d66a9ac3
commit
b681af4556
|
@ -393,6 +393,25 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnGridCellChanging( wxGridEvent& event )
|
||||||
m_delayedFocusColumn = event.GetCol();
|
m_delayedFocusColumn = event.GetCol();
|
||||||
m_delayedFocusPage = 0;
|
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 )
|
else if( event.GetRow() == VALUE && event.GetCol() == FDC_VALUE )
|
||||||
m_SymbolNameCtrl->ChangeValue( event.GetString() );
|
m_SymbolNameCtrl->ChangeValue( event.GetString() );
|
||||||
|
|
||||||
|
|
|
@ -526,6 +526,25 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnGridCellChanging( wxGridEvent& event
|
||||||
m_delayedFocusRow = event.GetRow();
|
m_delayedFocusRow = event.GetRow();
|
||||||
m_delayedFocusColumn = event.GetCol();
|
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();
|
editor->DecRef();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue