Save library when it's selected in lib tree.
Fixes https://gitlab.com/kicad/code/kicad/issues/14220
(cherry picked from commit 05185ec81a
)
This commit is contained in:
parent
37a42a3fb7
commit
3573b97bfc
|
@ -463,48 +463,32 @@ void SYMBOL_EDIT_FRAME::CreateNewSymbol()
|
||||||
|
|
||||||
void SYMBOL_EDIT_FRAME::Save()
|
void SYMBOL_EDIT_FRAME::Save()
|
||||||
{
|
{
|
||||||
if( getTargetSymbol() == m_symbol )
|
wxString libName;
|
||||||
{
|
|
||||||
if( IsSymbolFromSchematic() )
|
|
||||||
{
|
|
||||||
SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) Kiway().Player( FRAME_SCH, false );
|
|
||||||
|
|
||||||
if( !schframe ) // happens when the schematic editor is not active (or closed)
|
if( IsSymbolTreeShown() )
|
||||||
{
|
libName = GetTreeLIBID().GetLibNickname();
|
||||||
DisplayErrorMessage( this, _( "No schematic currently open." ) );
|
|
||||||
}
|
if( libName.empty() )
|
||||||
else
|
{
|
||||||
{
|
saveCurrentSymbol();
|
||||||
schframe->SaveSymbolToSchematic( *m_symbol, m_schematicSymbolUUID );
|
|
||||||
GetScreen()->SetContentModified( false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
saveCurrentSymbol();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if( !GetTargetLibId().GetLibNickname().empty() )
|
else if( m_libMgr->IsLibraryReadOnly( libName ) )
|
||||||
{
|
{
|
||||||
LIB_ID libId = GetTargetLibId();
|
wxString msg = wxString::Format( _( "Symbol library '%s' is not writable." ),
|
||||||
const wxString& libName = libId.GetLibNickname();
|
libName );
|
||||||
|
wxString msg2 = _( "You must save to a different location." );
|
||||||
|
|
||||||
if( m_libMgr->IsLibraryReadOnly( libName ) )
|
if( OKOrCancelDialog( this, _( "Warning" ), msg, msg2 ) == wxID_OK )
|
||||||
{
|
saveLibrary( libName, true );
|
||||||
wxString msg = wxString::Format( _( "Symbol library '%s' is not writable." ),
|
}
|
||||||
libName );
|
else
|
||||||
wxString msg2 = _( "You must save to a different location." );
|
{
|
||||||
|
saveLibrary( libName, false );
|
||||||
if( OKOrCancelDialog( this, _( "Warning" ), msg, msg2 ) == wxID_OK )
|
|
||||||
saveLibrary( libName, true );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
saveLibrary( libName, false );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_treePane->GetLibTree()->RefreshLibTree();
|
if( IsSymbolTreeShown() )
|
||||||
|
m_treePane->GetLibTree()->RefreshLibTree();
|
||||||
|
|
||||||
updateTitle();
|
updateTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue