Simplify and harmonize symbol editor and footprint editor menus.

Some differences are due to difference between libraries being files
in symbol editor and directories in footprint editor, but this unifies
most of the rest.

It also dispenses with the save-to-library vs save-to-document distinction
in the GUI because it makes for too much variability in the GUI, was
implemented differently between the two editors, and isn't needed as much
anymore now that we have the highly visible infobar.

There was also an issue that the save-to-board icon occupies the same
location and has the same size/shape/colours as the Board Setup icon in
PCBNew.

Fixes https://gitlab.com/kicad/code/kicad/issues/7215
This commit is contained in:
Jeff Young 2021-02-06 14:31:04 +00:00
parent 49a09f4c1c
commit c2dbd28101
14 changed files with 18 additions and 80 deletions

View File

@ -57,8 +57,6 @@ void SYMBOL_EDIT_FRAME::ReCreateMenuBar()
if( !IsSymbolFromSchematic() )
fileMenu->Add( ACTIONS::saveAll );
else
fileMenu->Add( EE_ACTIONS::saveInSchematic );
fileMenu->Add( ACTIONS::revert );

View File

@ -377,8 +377,6 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
ENABLE( schematicModifiedCond || libModifiedCondition ) );
mgr->SetConditions( ACTIONS::save,
ENABLE( schematicModifiedCond || libModifiedCondition ) );
mgr->SetConditions( EE_ACTIONS::saveInSchematic,
ENABLE( schematicModifiedCond ) );
mgr->SetConditions( EE_ACTIONS::saveLibraryAs, ENABLE( libSelectedCondition ) );
mgr->SetConditions( EE_ACTIONS::saveSymbolAs, ENABLE( haveSymbolCond ) );
mgr->SetConditions( EE_ACTIONS::newSymbol, ENABLE( !libSelectedCondition || canEditLib ) );

View File

@ -508,7 +508,11 @@ void SYMBOL_EDIT_FRAME::Save()
{
SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) Kiway().Player( FRAME_SCH, false );
if( schframe )
if( !schframe ) // happens when the schematic editor is not active (or closed)
{
DisplayErrorMessage( this, _( "No schematic currently open." ) );
}
else
{
schframe->UpdateSymbolFromEditor( *m_my_part );
GetScreen()->ClrModify();
@ -590,7 +594,7 @@ void SYMBOL_EDIT_FRAME::savePartAs()
itemsToDisplay.push_back( item );
}
EDA_LIST_DIALOG dlg( this, _( "Save Copy of Symbol" ), headers, itemsToDisplay, old_lib );
EDA_LIST_DIALOG dlg( this, _( "Save Symbol As" ), headers, itemsToDisplay, old_lib );
dlg.SetListLabel( _( "Save in library:" ) );
dlg.SetOKLabel( _( "Save" ) );

View File

@ -90,7 +90,7 @@ void SYMBOL_EDIT_FRAME::ReCreateHToolbar()
if( !IsSymbolFromSchematic() )
m_mainToolBar->Add( ACTIONS::saveAll );
else
m_mainToolBar->Add( EE_ACTIONS::saveInSchematic );
m_mainToolBar->Add( ACTIONS::save );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::undo );

View File

@ -113,12 +113,13 @@ TOOL_ACTION EE_ACTIONS::clearSelection( "eeschema.InteractiveSelection.ClearSele
// SYMBOL_EDITOR_CONTROL
//
TOOL_ACTION EE_ACTIONS::saveLibraryAs( "eeschema.SymbolLibraryControl.saveLibraryAs",
AS_GLOBAL, MD_SHIFT + MD_CTRL + 'S', LEGACY_HK_NAME( "Save As" ),
_( "Save Library As..." ),
_( "Save the current library to a new file." ) );
AS_GLOBAL,
MD_SHIFT + MD_CTRL + 'S', LEGACY_HK_NAME( "Save As" ),
_( "Save Library As..." ), _( "Save the current library to a new file." ) );
TOOL_ACTION EE_ACTIONS::newSymbol( "eeschema.SymbolLibraryControl.newSymbol",
AS_GLOBAL, 0, "",
AS_GLOBAL,
'N', "",
_( "New Symbol..." ), _( "Create a new symbol" ),
new_component_xpm );
@ -133,8 +134,8 @@ TOOL_ACTION EE_ACTIONS::duplicateSymbol( "eeschema.SymbolLibraryControl.duplicat
duplicate_xpm );
TOOL_ACTION EE_ACTIONS::saveSymbolAs( "eeschema.SymbolLibraryControl.saveSymbolAs",
AS_GLOBAL, 0, "", _( "Save Symbol As..." ),
_( "Save the current symbol to a different library." ) );
AS_GLOBAL, 0, "",
_( "Save As..." ), _( "Save the current symbol to a different library." ) );
TOOL_ACTION EE_ACTIONS::deleteSymbol( "eeschema.SymbolLibraryControl.deleteSymbol",
AS_GLOBAL, 0, "",
@ -199,11 +200,6 @@ TOOL_ACTION EE_ACTIONS::toggleSyncedPinsMode( "eeschema.SymbolLibraryControl.tog
"Enabled by default for multiunit parts with interchangeable units." ),
pin2pin_xpm );
TOOL_ACTION EE_ACTIONS::saveInSchematic( "eeschema.SymbolLibraryControl.saveInSchematic",
AS_GLOBAL, 0, "",
_( "Save In Schematic" ), _( "Save the current symbol in the schematic" ),
save_symbol_to_schematic_xpm );
// SYMBOL_EDITOR_DRAWING_TOOLS
//

View File

@ -177,9 +177,6 @@ public:
static TOOL_ACTION importSymbol;
static TOOL_ACTION exportSymbol;
// Library editor tool actions
static TOOL_ACTION saveInSchematic;
// Hierarchy navigation
static TOOL_ACTION enterSheet;
static TOOL_ACTION leaveSheet;

View File

@ -480,38 +480,6 @@ int SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic( const TOOL_EVENT& aEvent )
}
int SYMBOL_EDITOR_CONTROL::UpdateSymbolInSchematic( const TOOL_EVENT& aEvent )
{
wxCHECK( m_isSymbolEditor, 0 );
SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
wxCHECK( editFrame, 0 );
LIB_PART* currentPart = editFrame->GetCurPart();
wxCHECK( currentPart, 0 );
SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH, false );
if( !schframe ) // happens when the schematic editor is not active (or closed)
{
DisplayErrorMessage( m_frame, _( "No schematic currently open." ) );
return 0;
}
schframe->UpdateSymbolFromEditor( *currentPart );
SCH_SCREEN* currentScreen = editFrame->GetScreen();
wxCHECK( currentScreen, 0 );
currentScreen->ClrModify();
return 0;
}
void SYMBOL_EDITOR_CONTROL::setTransitions()
{
Go( &SYMBOL_EDITOR_CONTROL::AddLibrary, ACTIONS::newLibrary.MakeEvent() );
@ -525,7 +493,6 @@ void SYMBOL_EDITOR_CONTROL::setTransitions()
Go( &SYMBOL_EDITOR_CONTROL::Save, EE_ACTIONS::saveSymbolAs.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::Save, ACTIONS::saveAll.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::Revert, ACTIONS::revert.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::UpdateSymbolInSchematic, EE_ACTIONS::saveInSchematic.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::DuplicateSymbol, EE_ACTIONS::duplicateSymbol.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::CutCopyDelete, EE_ACTIONS::deleteSymbol.MakeEvent() );

View File

@ -59,7 +59,6 @@ public:
int ExportView( const TOOL_EVENT& aEvent );
int ExportSymbolAsSVG( const TOOL_EVENT& aEvent );
int AddSymbolToSchematic( const TOOL_EVENT& aEvent );
int UpdateSymbolInSchematic( const TOOL_EVENT& aEvent );
int OnDeMorgan( const TOOL_EVENT& aEvent );

View File

@ -986,8 +986,7 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::saveAs, ENABLE( footprintTargettedCond ) );
mgr->SetConditions( ACTIONS::revert, ENABLE( cond.ContentModified() ) );
mgr->SetConditions( PCB_ACTIONS::saveToBoard, ENABLE( cond.ContentModified() ) );
mgr->SetConditions( PCB_ACTIONS::saveToLibrary, ENABLE( cond.ContentModified() ) );
mgr->SetConditions( ACTIONS::save, ENABLE( cond.ContentModified() ) );
mgr->SetConditions( ACTIONS::undo, ENABLE( cond.UndoAvailable() ) );
mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );

View File

@ -946,7 +946,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( FOOTPRINT* aFootprint )
itemsToDisplay.push_back( item );
}
EDA_LIST_DIALOG dlg( this, _( "Save Footprint" ), headers, itemsToDisplay, libraryName );
EDA_LIST_DIALOG dlg( this, _( "Save Footprint As" ), headers, itemsToDisplay, libraryName );
dlg.SetListLabel( _( "Save in library:" ) );
dlg.SetOKLabel( _( "Save" ) );

View File

@ -58,11 +58,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
fileMenu->AppendSeparator();
if( IsCurrentFPFromBoard() )
fileMenu->Add( PCB_ACTIONS::saveToBoard );
else
fileMenu->Add( PCB_ACTIONS::saveToLibrary );
fileMenu->Add( ACTIONS::save );
fileMenu->Add( ACTIONS::saveAs );
fileMenu->Add( ACTIONS::revert );

View File

@ -59,11 +59,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
#ifdef KICAD_SCRIPTING
m_mainToolBar->Add( PCB_ACTIONS::createFootprint );
#endif
if( IsCurrentFPFromBoard() )
m_mainToolBar->Add( PCB_ACTIONS::saveToBoard );
else
m_mainToolBar->Add( PCB_ACTIONS::saveToLibrary );
m_mainToolBar->Add( ACTIONS::save );
m_mainToolBar->AddScaledSeparator( this );
m_mainToolBar->Add( ACTIONS::print );

View File

@ -502,8 +502,6 @@ void FOOTPRINT_EDITOR_CONTROL::setTransitions()
Go( &FOOTPRINT_EDITOR_CONTROL::NewFootprint, PCB_ACTIONS::newFootprint.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::CreateFootprint, PCB_ACTIONS::createFootprint.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::Save, PCB_ACTIONS::saveToBoard.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::Save, PCB_ACTIONS::saveToLibrary.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::SaveAs, ACTIONS::saveAs.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::SaveAs, ACTIONS::saveCopyAs.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::Revert, ACTIONS::revert.MakeEvent() );

View File

@ -333,16 +333,6 @@ TOOL_ACTION PCB_ACTIONS::createFootprint( "pcbnew.ModuleEditor.createFootprint",
_( "Create Footprint..." ), _( "Create a new footprint using the Footprint Wizard" ),
module_wizard_xpm );
TOOL_ACTION PCB_ACTIONS::saveToBoard( "pcbnew.ModuleEditor.saveToBoard",
AS_GLOBAL, 0, "",
_( "Save to Board" ), _( "Update footprint on board" ),
save_fp_to_board_xpm );
TOOL_ACTION PCB_ACTIONS::saveToLibrary( "pcbnew.ModuleEditor.saveToLibrary",
AS_GLOBAL, 0, "",
_( "Save to Library" ), _( "Save changes to library" ),
save_xpm );
TOOL_ACTION PCB_ACTIONS::editFootprint( "pcbnew.ModuleEditor.editFootprint",
AS_GLOBAL, 0, "",
_( "Edit Footprint" ), _( "Show selected footprint on editor canvas" ),