When checking for duplicate aliases look in the dialog not the symbol.
Fixes: lp:1821543
* https://bugs.launchpad.net/kicad/+bug/1821543
(cherry picked from commit e90452d0e2
)
This commit is contained in:
parent
9fc7281fab
commit
cb5948d3a5
|
@ -657,6 +657,14 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName( const wxString& aName )
|
||||||
if( aName.IsEmpty() )
|
if( aName.IsEmpty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if( m_SymbolNameCtrl->GetValue().CmpNoCase( aName ) == 0 )
|
||||||
|
{
|
||||||
|
wxString msg;
|
||||||
|
msg.Printf( _( "Alias can not have same name as symbol." ) );
|
||||||
|
DisplayInfoMessage( this, msg );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for( int i = 0; i < (int)m_aliasListBox->GetCount(); ++i )
|
for( int i = 0; i < (int)m_aliasListBox->GetCount(); ++i )
|
||||||
{
|
{
|
||||||
if( i == m_aliasListBox->GetSelection() )
|
if( i == m_aliasListBox->GetSelection() )
|
||||||
|
@ -700,7 +708,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddAlias( wxCommandEvent& event )
|
||||||
wxString aliasname = _( "untitled" );
|
wxString aliasname = _( "untitled" );
|
||||||
int suffix = 1;
|
int suffix = 1;
|
||||||
|
|
||||||
while( m_libEntry->HasAlias( aliasname ) )
|
while( m_aliasListBox->FindString( aliasname ) != wxNOT_FOUND )
|
||||||
aliasname = wxString::Format( _( "untitled%i" ), suffix++ );
|
aliasname = wxString::Format( _( "untitled%i" ), suffix++ );
|
||||||
|
|
||||||
LIB_ALIAS* alias = new LIB_ALIAS( aliasname, m_libEntry );
|
LIB_ALIAS* alias = new LIB_ALIAS( aliasname, m_libEntry );
|
||||||
|
|
Loading…
Reference in New Issue