Change Save Symbol As... to Save Symbol Copy As...

See details in the bug report.  (It's very complicated.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12504
This commit is contained in:
Jeff Young 2023-10-28 22:25:33 +01:00
parent 72c44d7fa3
commit 14d6ff8946
7 changed files with 41 additions and 43 deletions

View File

@ -52,7 +52,7 @@ void SYMBOL_EDIT_FRAME::doReCreateMenuBar()
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Add( ACTIONS::save ); fileMenu->Add( ACTIONS::save );
fileMenu->Add( EE_ACTIONS::saveSymbolAs ); fileMenu->Add( EE_ACTIONS::saveSymbolCopyAs );
if( !IsSymbolFromSchematic() ) if( !IsSymbolFromSchematic() )
fileMenu->Add( ACTIONS::saveAll ); fileMenu->Add( ACTIONS::saveAll );

View File

@ -430,7 +430,7 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::saveAll, ENABLE( SELECTION_CONDITIONS::ShowAlways ) ); mgr->SetConditions( ACTIONS::saveAll, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( ACTIONS::save, ENABLE( SELECTION_CONDITIONS::ShowAlways ) ); mgr->SetConditions( ACTIONS::save, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( EE_ACTIONS::saveLibraryAs, ENABLE( libSelectedCondition ) ); mgr->SetConditions( EE_ACTIONS::saveLibraryAs, ENABLE( libSelectedCondition ) );
mgr->SetConditions( EE_ACTIONS::saveSymbolAs, ENABLE( saveSymbolAsCondition ) ); mgr->SetConditions( EE_ACTIONS::saveSymbolCopyAs, ENABLE( saveSymbolAsCondition ) );
mgr->SetConditions( EE_ACTIONS::newSymbol, ENABLE( SELECTION_CONDITIONS::ShowAlways ) ); mgr->SetConditions( EE_ACTIONS::newSymbol, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
mgr->SetConditions( EE_ACTIONS::importSymbol, ENABLE( SELECTION_CONDITIONS::ShowAlways ) ); mgr->SetConditions( EE_ACTIONS::importSymbol, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );

View File

@ -150,7 +150,7 @@ public:
/** /**
* Save the currently selected symbol to a new name and/or location. * Save the currently selected symbol to a new name and/or location.
*/ */
void SaveSymbolAs(); void SaveSymbolCopyAs();
/** /**
* Save the currently selected library to a new file. * Save the currently selected library to a new file.
@ -421,7 +421,7 @@ private:
// Set up the tool framework // Set up the tool framework
void setupTools(); void setupTools();
void saveSymbolAs(); void saveSymbolCopyAs();
/** /**
* Save the changes to the current library. * Save the changes to the current library.

View File

@ -548,9 +548,9 @@ void SYMBOL_EDIT_FRAME::SaveLibraryAs()
} }
void SYMBOL_EDIT_FRAME::SaveSymbolAs() void SYMBOL_EDIT_FRAME::SaveSymbolCopyAs()
{ {
saveSymbolAs(); saveSymbolCopyAs();
m_treePane->GetLibTree()->RefreshLibTree(); m_treePane->GetLibTree()->RefreshLibTree();
} }
@ -662,7 +662,7 @@ private:
}; };
void SYMBOL_EDIT_FRAME::saveSymbolAs() void SYMBOL_EDIT_FRAME::saveSymbolCopyAs()
{ {
LIB_SYMBOL* symbol = getTargetSymbol(); LIB_SYMBOL* symbol = getTargetSymbol();
@ -745,8 +745,6 @@ void SYMBOL_EDIT_FRAME::saveSymbolAs()
m_libMgr->UpdateSymbol( &new_symbol, libraryName ); m_libMgr->UpdateSymbol( &new_symbol, libraryName );
SyncLibraries( false ); SyncLibraries( false );
m_treePane->GetLibTree()->SelectLibId( LIB_ID( libraryName, new_symbol.GetName() ) );
LoadSymbol( symbolName, libraryName, m_unit );
} }

View File

@ -197,11 +197,11 @@ TOOL_ACTION EE_ACTIONS::renameSymbol( TOOL_ACTION_ARGS()
.Tooltip( _( "Rename the selected symbol" ) ) .Tooltip( _( "Rename the selected symbol" ) )
.Icon( BITMAPS::edit ) ); .Icon( BITMAPS::edit ) );
TOOL_ACTION EE_ACTIONS::saveSymbolAs( TOOL_ACTION_ARGS() TOOL_ACTION EE_ACTIONS::saveSymbolCopyAs( TOOL_ACTION_ARGS()
.Name( "eeschema.SymbolLibraryControl.saveSymbolAs" ) .Name( "eeschema.SymbolLibraryControl.saveSymbolCopyAs" )
.Scope( AS_GLOBAL ) .Scope( AS_GLOBAL )
.FriendlyName( _( "Save As..." ) ) .FriendlyName( _( "Save Copy As..." ) )
.Tooltip( _( "Save the current symbol to a different library." ) ) .Tooltip( _( "Save a copy of the current symbol to a different library." ) )
.Icon( BITMAPS::save_as ) ); .Icon( BITMAPS::save_as ) );
TOOL_ACTION EE_ACTIONS::deleteSymbol( TOOL_ACTION_ARGS() TOOL_ACTION EE_ACTIONS::deleteSymbol( TOOL_ACTION_ARGS()

View File

@ -196,7 +196,7 @@ public:
// Library management // Library management
static TOOL_ACTION saveLibraryAs; static TOOL_ACTION saveLibraryAs;
static TOOL_ACTION saveSymbolAs; static TOOL_ACTION saveSymbolCopyAs;
static TOOL_ACTION newSymbol; static TOOL_ACTION newSymbol;
static TOOL_ACTION deriveFromExistingSymbol; static TOOL_ACTION deriveFromExistingSymbol;
static TOOL_ACTION editSymbol; static TOOL_ACTION editSymbol;

View File

@ -107,7 +107,7 @@ bool SYMBOL_EDITOR_CONTROL::Init()
ctxMenu.AddSeparator(); ctxMenu.AddSeparator();
ctxMenu.AddItem( ACTIONS::save, symbolSelectedCondition || libInferredCondition ); ctxMenu.AddItem( ACTIONS::save, symbolSelectedCondition || libInferredCondition );
ctxMenu.AddItem( EE_ACTIONS::saveLibraryAs, libSelectedCondition ); ctxMenu.AddItem( EE_ACTIONS::saveLibraryAs, libSelectedCondition );
ctxMenu.AddItem( EE_ACTIONS::saveSymbolAs, saveSymbolAsCondition ); ctxMenu.AddItem( EE_ACTIONS::saveSymbolCopyAs, saveSymbolAsCondition );
ctxMenu.AddItem( ACTIONS::revert, symbolSelectedCondition || libInferredCondition ); ctxMenu.AddItem( ACTIONS::revert, symbolSelectedCondition || libInferredCondition );
ctxMenu.AddSeparator(); ctxMenu.AddSeparator();
@ -218,8 +218,8 @@ int SYMBOL_EDITOR_CONTROL::Save( const TOOL_EVENT& aEvt )
editFrame->Save(); editFrame->Save();
else if( aEvt.IsAction( &EE_ACTIONS::saveLibraryAs ) ) else if( aEvt.IsAction( &EE_ACTIONS::saveLibraryAs ) )
editFrame->SaveLibraryAs(); editFrame->SaveLibraryAs();
else if( aEvt.IsAction( &EE_ACTIONS::saveSymbolAs ) ) else if( aEvt.IsAction( &EE_ACTIONS::saveSymbolCopyAs ) )
editFrame->SaveSymbolAs(); editFrame->SaveSymbolCopyAs();
else if( aEvt.IsAction( &EE_ACTIONS::saveAll ) ) else if( aEvt.IsAction( &EE_ACTIONS::saveAll ) )
editFrame->SaveAll(); editFrame->SaveAll();
} }
@ -722,7 +722,7 @@ void SYMBOL_EDITOR_CONTROL::setTransitions()
Go( &SYMBOL_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() ); Go( &SYMBOL_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::Save, EE_ACTIONS::saveLibraryAs.MakeEvent() ); Go( &SYMBOL_EDITOR_CONTROL::Save, EE_ACTIONS::saveLibraryAs.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::Save, EE_ACTIONS::saveSymbolAs.MakeEvent() ); Go( &SYMBOL_EDITOR_CONTROL::Save, EE_ACTIONS::saveSymbolCopyAs.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::Save, ACTIONS::saveAll.MakeEvent() ); Go( &SYMBOL_EDITOR_CONTROL::Save, ACTIONS::saveAll.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::Revert, ACTIONS::revert.MakeEvent() ); Go( &SYMBOL_EDITOR_CONTROL::Revert, ACTIONS::revert.MakeEvent() );