mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-18 19:29:17 +00:00
Lib editors: avoid bogus overwrite prompt when renaming to self
Just accept the dialog and then early-return.
This commit is contained in:
parent
78cf47bd00
commit
84f4f7f724
@ -483,7 +483,8 @@ int SYMBOL_EDITOR_CONTROL::RenameSymbol( const TOOL_EVENT& aEvent )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( libMgr.SymbolExists( newName, libName ) )
|
||||
// If no change, accept it without prompting
|
||||
if( newName != oldName && libMgr.SymbolExists( newName, libName ) )
|
||||
{
|
||||
msg = wxString::Format( _( "Symbol '%s' already exists in library '%s'." ),
|
||||
newName, libName );
|
||||
@ -501,6 +502,9 @@ int SYMBOL_EDITOR_CONTROL::RenameSymbol( const TOOL_EVENT& aEvent )
|
||||
return 0; // cancelled by user
|
||||
}
|
||||
|
||||
if( newName == oldName )
|
||||
return 0;
|
||||
|
||||
LIB_SYMBOL* libSymbol = libMgr.GetBufferedSymbol( oldName, libName );
|
||||
|
||||
if( !libSymbol )
|
||||
|
@ -461,7 +461,8 @@ int FOOTPRINT_EDITOR_CONTROL::RenameFootprint( const TOOL_EVENT& aEvent )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( tbl->FootprintExists( libraryName, newName ) )
|
||||
// If no change, accept it without prompting
|
||||
if( oldName != newName && tbl->FootprintExists( libraryName, newName ) )
|
||||
{
|
||||
msg = wxString::Format( _( "Footprint '%s' already exists in library '%s'." ),
|
||||
newName, libraryName );
|
||||
@ -479,6 +480,9 @@ int FOOTPRINT_EDITOR_CONTROL::RenameFootprint( const TOOL_EVENT& aEvent )
|
||||
return 0; // cancelled by user
|
||||
}
|
||||
|
||||
if( newName == oldName )
|
||||
return 0;
|
||||
|
||||
FOOTPRINT* footprint = nullptr;
|
||||
|
||||
if( fpID == m_frame->GetLoadedFPID() )
|
||||
|
Loading…
Reference in New Issue
Block a user