From c2dbd28101a25ea0f23c4d3f35aa1c0532bdc2da Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 6 Feb 2021 14:31:04 +0000 Subject: [PATCH] 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 --- .../symbol_editor/menubar_symbol_editor.cpp | 2 -- eeschema/symbol_editor/symbol_edit_frame.cpp | 2 -- eeschema/symbol_editor/symbol_editor.cpp | 8 +++-- .../symbol_editor/toolbars_symbol_editor.cpp | 2 +- eeschema/tools/ee_actions.cpp | 18 ++++------ eeschema/tools/ee_actions.h | 3 -- eeschema/tools/symbol_editor_control.cpp | 33 ------------------- eeschema/tools/symbol_editor_control.h | 1 - pcbnew/footprint_edit_frame.cpp | 3 +- pcbnew/footprint_libraries_utils.cpp | 2 +- pcbnew/menubar_footprint_editor.cpp | 6 +--- pcbnew/toolbars_footprint_editor.cpp | 6 +--- pcbnew/tools/footprint_editor_control.cpp | 2 -- pcbnew/tools/pcb_actions.cpp | 10 ------ 14 files changed, 18 insertions(+), 80 deletions(-) diff --git a/eeschema/symbol_editor/menubar_symbol_editor.cpp b/eeschema/symbol_editor/menubar_symbol_editor.cpp index 829dd5d72c..30cbcd614b 100644 --- a/eeschema/symbol_editor/menubar_symbol_editor.cpp +++ b/eeschema/symbol_editor/menubar_symbol_editor.cpp @@ -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 ); diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index 5d5f95ffc8..be962e3103 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -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 ) ); diff --git a/eeschema/symbol_editor/symbol_editor.cpp b/eeschema/symbol_editor/symbol_editor.cpp index 1901284079..264dc33358 100644 --- a/eeschema/symbol_editor/symbol_editor.cpp +++ b/eeschema/symbol_editor/symbol_editor.cpp @@ -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" ) ); diff --git a/eeschema/symbol_editor/toolbars_symbol_editor.cpp b/eeschema/symbol_editor/toolbars_symbol_editor.cpp index 15ed76b651..e25ea9e151 100644 --- a/eeschema/symbol_editor/toolbars_symbol_editor.cpp +++ b/eeschema/symbol_editor/toolbars_symbol_editor.cpp @@ -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 ); diff --git a/eeschema/tools/ee_actions.cpp b/eeschema/tools/ee_actions.cpp index 1e71a1b183..e77e7f3d26 100644 --- a/eeschema/tools/ee_actions.cpp +++ b/eeschema/tools/ee_actions.cpp @@ -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 // diff --git a/eeschema/tools/ee_actions.h b/eeschema/tools/ee_actions.h index c9971a92a8..806af1851d 100644 --- a/eeschema/tools/ee_actions.h +++ b/eeschema/tools/ee_actions.h @@ -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; diff --git a/eeschema/tools/symbol_editor_control.cpp b/eeschema/tools/symbol_editor_control.cpp index 3819efcb46..43a8e20382 100644 --- a/eeschema/tools/symbol_editor_control.cpp +++ b/eeschema/tools/symbol_editor_control.cpp @@ -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(); - - 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() ); diff --git a/eeschema/tools/symbol_editor_control.h b/eeschema/tools/symbol_editor_control.h index 2f31e6d457..c6c555076d 100644 --- a/eeschema/tools/symbol_editor_control.h +++ b/eeschema/tools/symbol_editor_control.h @@ -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 ); diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 350e005074..76f8ee9c33 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -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() ) ); diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index 65f86f687b..271964f063 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -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" ) ); diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index 35b3103e04..0ee00aa37f 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -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 ); diff --git a/pcbnew/toolbars_footprint_editor.cpp b/pcbnew/toolbars_footprint_editor.cpp index e910f02478..9b4077ab31 100644 --- a/pcbnew/toolbars_footprint_editor.cpp +++ b/pcbnew/toolbars_footprint_editor.cpp @@ -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 ); diff --git a/pcbnew/tools/footprint_editor_control.cpp b/pcbnew/tools/footprint_editor_control.cpp index 3f0ea59fba..568bbee653 100644 --- a/pcbnew/tools/footprint_editor_control.cpp +++ b/pcbnew/tools/footprint_editor_control.cpp @@ -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() ); diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index 83ebb012fa..78cb0e5941 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -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" ),