Duplicate from selected or current
When double-clicking to open a symbol, it is no longer selected in the
tree. We need to use the `GetTargetLibId()` to pick the correct symbol
(first selected, then current) when using the duplicate command
Fixes https://gitlab.com/kicad/code/kicad/issues/11034
(cherry picked from commit 802d20c409
)
This commit is contained in:
parent
b5c2f0d39a
commit
7ecc70a79d
|
@ -828,8 +828,7 @@ void SYMBOL_EDIT_FRAME::CopySymbolToClipboard()
|
|||
|
||||
void SYMBOL_EDIT_FRAME::DuplicateSymbol( bool aFromClipboard )
|
||||
{
|
||||
int dummyUnit;
|
||||
LIB_ID libId = m_treePane->GetLibTree()->GetSelectedLibId( &dummyUnit );
|
||||
LIB_ID libId = GetTargetLibId();
|
||||
wxString lib = libId.GetLibNickname();
|
||||
|
||||
if( !m_libMgr->LibraryExists( lib ) )
|
||||
|
|
|
@ -160,7 +160,7 @@ int SYMBOL_EDITOR_CONTROL::AddSymbol( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( libName.IsEmpty() )
|
||||
{
|
||||
msg.Printf( _( "No symbol library selected." ), libName );
|
||||
msg.Printf( _( "No symbol library selected." ) );
|
||||
m_frame->ShowInfoBarError( msg );
|
||||
return 0;
|
||||
}
|
||||
|
@ -255,11 +255,18 @@ int SYMBOL_EDITOR_CONTROL::DuplicateSymbol( const TOOL_EVENT& aEvent )
|
|||
if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) )
|
||||
{
|
||||
SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
|
||||
|
||||
LIB_ID sel = editFrame->GetTreeLIBID();
|
||||
const wxString& libName = sel.GetLibNickname();
|
||||
LIB_ID sel = editFrame->GetTargetLibId();
|
||||
wxString msg;
|
||||
|
||||
if( !sel.IsValid() )
|
||||
{
|
||||
msg.Printf( _( "No symbol selected" ) );
|
||||
m_frame->ShowInfoBarError( msg );
|
||||
return 0;
|
||||
}
|
||||
|
||||
const wxString& libName = sel.GetLibNickname();
|
||||
|
||||
if( editFrame->GetLibManager().IsLibraryReadOnly( libName ) )
|
||||
{
|
||||
msg.Printf( _( "Symbol library '%s' is not writable." ), libName );
|
||||
|
|
Loading…
Reference in New Issue