From 7bfa8575faffc457d48d888923404f85784d4990 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Sat, 27 Mar 2021 18:47:48 +0000 Subject: [PATCH] Remove redundant information from import/export menu item labels Saying "Import/Export" on the labels when the submenu has "Import" or "Export" in it is redundant. Note that we can't just update the action text with the new name, because that is used in the hotkey list and would become too confusing without the "Import"/"Export" text. --- common/tool/action_menu.cpp | 8 ++++++-- eeschema/menubar.cpp | 8 ++++---- eeschema/symbol_editor/menubar_symbol_editor.cpp | 6 +++--- include/tool/action_menu.h | 9 +++++++-- kicad/menubar.cpp | 4 ++-- pcbnew/menubar_footprint_editor.cpp | 10 +++++----- pcbnew/menubar_pcb_editor.cpp | 10 +++++----- pcbnew/tools/pcb_actions.cpp | 10 +++++----- 8 files changed, 37 insertions(+), 28 deletions(-) diff --git a/common/tool/action_menu.cpp b/common/tool/action_menu.cpp index e9f708051c..bf1ac20106 100644 --- a/common/tool/action_menu.cpp +++ b/common/tool/action_menu.cpp @@ -163,12 +163,16 @@ wxMenuItem* ACTION_MENU::Add( const wxString& aLabel, const wxString& aTooltip, } -wxMenuItem* ACTION_MENU::Add( const TOOL_ACTION& aAction, bool aIsCheckmarkEntry ) +wxMenuItem* ACTION_MENU::Add( const TOOL_ACTION& aAction, bool aIsCheckmarkEntry, + const wxString& aOverrideLabel ) { /// ID numbers for tool actions are assigned above ACTION_BASE_UI_ID inside TOOL_EVENT BITMAPS icon = aAction.GetIcon(); - wxMenuItem* item = new wxMenuItem( this, aAction.GetUIId(), aAction.GetMenuItem(), + // Allow the label to be overriden at point of use + wxString menuLabel = aOverrideLabel.IsEmpty() ? aAction.GetMenuItem() : aOverrideLabel; + + wxMenuItem* item = new wxMenuItem( this, aAction.GetUIId(), menuLabel, aAction.GetDescription(), aIsCheckmarkEntry ? wxITEM_CHECK : wxITEM_NORMAL ); if( !!icon ) diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 8a9a446c67..8c47be04f0 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -98,12 +98,12 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() submenuImport->SetTool( selTool ); submenuImport->SetTitle( _( "Import" ) ); submenuImport->SetIcon( BITMAPS::import ); - submenuImport->Add( _( "Import Non KiCad Schematic..." ), + submenuImport->Add( _( "Non-KiCad Schematic..." ), _( "Replace current schematic sheet with one imported from another application" ), ID_IMPORT_NON_KICAD_SCH, BITMAPS::import_document ); - submenuImport->Add( EE_ACTIONS::importFPAssignments ); + submenuImport->Add( EE_ACTIONS::importFPAssignments, ACTION_MENU::NORMAL, _( "Footprint Assignments..." ) ); fileMenu->Add( submenuImport ); @@ -112,8 +112,8 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() submenuExport->SetTool( selTool ); submenuExport->SetTitle( _( "Export" ) ); submenuExport->SetIcon( BITMAPS::export_file ); - submenuExport->Add( EE_ACTIONS::drawSheetOnClipboard ); - submenuExport->Add( EE_ACTIONS::exportNetlist ); + submenuExport->Add( EE_ACTIONS::drawSheetOnClipboard, ACTION_MENU::NORMAL, _( "Drawing to Clipboard" ) ); + submenuExport->Add( EE_ACTIONS::exportNetlist, ACTION_MENU::NORMAL, _( "Netlist..." ) ); fileMenu->Add( submenuExport ); fileMenu->AppendSeparator(); diff --git a/eeschema/symbol_editor/menubar_symbol_editor.cpp b/eeschema/symbol_editor/menubar_symbol_editor.cpp index 46c952e7cb..eecab692a2 100644 --- a/eeschema/symbol_editor/menubar_symbol_editor.cpp +++ b/eeschema/symbol_editor/menubar_symbol_editor.cpp @@ -69,9 +69,9 @@ void SYMBOL_EDIT_FRAME::ReCreateMenuBar() submenuExport->SetTool( selTool ); submenuExport->SetTitle( _( "Export" ) ); submenuExport->SetIcon( BITMAPS::export_file ); - submenuExport->Add( EE_ACTIONS::exportSymbol ); - submenuExport->Add( EE_ACTIONS::exportSymbolView ); - submenuExport->Add( EE_ACTIONS::exportSymbolAsSVG ); + submenuExport->Add( EE_ACTIONS::exportSymbol, ACTION_MENU::NORMAL, _( "Symbol..." ) ); + submenuExport->Add( EE_ACTIONS::exportSymbolView, ACTION_MENU::NORMAL, _( "View as PNG..." ) ); + submenuExport->Add( EE_ACTIONS::exportSymbolAsSVG, ACTION_MENU::NORMAL, _( "Symbol as SVG..." ) ); fileMenu->Add( submenuExport ); fileMenu->AppendSeparator(); diff --git a/include/tool/action_menu.h b/include/tool/action_menu.h index 4b952dd089..10ab56ef6f 100644 --- a/include/tool/action_menu.h +++ b/include/tool/action_menu.h @@ -90,8 +90,12 @@ public: * After selecting the entry, a #TOOL_EVENT command containing name of the action is sent. * * @param aAction is the action to be added to menu entry. + * @param aIsCheckmarkEntry is true to indicate a check menu entry, false for normal menu entry + * @param aOverrideLabel is the label to show in the menu (overriding the action's menu text) + * when non-empty */ - wxMenuItem* Add( const TOOL_ACTION& aAction, bool aIsCheckmarkEntry = false ); + wxMenuItem* Add( const TOOL_ACTION& aAction, bool aIsCheckmarkEntry = false, + const wxString& aOverrideLabel = wxEmptyString ); /** * Add an action menu as a submenu. @@ -174,7 +178,8 @@ public: virtual bool PassHelpTextToHandler() { return false; } - static constexpr bool CHECK = true; + static constexpr bool NORMAL = false; + static constexpr bool CHECK = true; protected: ///< Return an instance of this class. It has to be overridden in inheriting classes. diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp index d006417deb..2f78f6ea52 100644 --- a/kicad/menubar.cpp +++ b/kicad/menubar.cpp @@ -91,12 +91,12 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() importMenu->SetTitle( _( "Import Non-KiCad Project..." ) ); importMenu->SetIcon( BITMAPS::import_project ); - importMenu->Add( _( "Import CADSTAR Project..." ), + importMenu->Add( _( "CADSTAR Project..." ), _( "Import CADSTAR Archive Schematic and PCB (*.csa, *.cpa)" ), ID_IMPORT_CADSTAR_ARCHIVE_PROJECT, BITMAPS::import_project ); - importMenu->Add( _( "Import EAGLE Project..." ), + importMenu->Add( _( "EAGLE Project..." ), _( "Import EAGLE CAD XML schematic and board" ), ID_IMPORT_EAGLE_PROJECT, BITMAPS::import_project ); diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index 57817bc6df..4931ad8217 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -69,9 +69,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() submenuImport->SetTitle( _( "Import" ) ); submenuImport->SetIcon( BITMAPS::import ); - submenuImport->Add( PCB_ACTIONS::importFootprint ); - submenuImport->Add( _( "&Import Graphics..." ), - _( "Import 2D Drawing file to Footprint Editor on Drawings layer" ), + submenuImport->Add( PCB_ACTIONS::importFootprint, ACTION_MENU::NORMAL, _( "Footprint..." ) ); + submenuImport->Add( _( "&Graphics..." ), + _( "Import 2D drawing file to current footprint" ), ID_GEN_IMPORT_GRAPHICS_FILE, BITMAPS::import_vector ); @@ -81,8 +81,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() submenuExport->SetTitle( _( "Export" ) ); submenuExport->SetIcon( BITMAPS::export_file ); - submenuExport->Add( PCB_ACTIONS::exportFootprint ); - submenuExport->Add( _( "Export View as &PNG..." ), + submenuExport->Add( PCB_ACTIONS::exportFootprint, ACTION_MENU::NORMAL, _( "Footprint..." ) ); + submenuExport->Add( _( "View as &PNG..." ), _( "Create a PNG file from the current view" ), ID_FPEDIT_SAVE_PNG, BITMAPS::export_png ); diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index 251dbb321b..7e48261a86 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -107,8 +107,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() submenuImport->SetTitle( _( "Import" ) ); submenuImport->SetIcon( BITMAPS::import ); - submenuImport->Add( PCB_ACTIONS::importNetlist ); - submenuImport->Add( PCB_ACTIONS::importSpecctraSession ); + submenuImport->Add( PCB_ACTIONS::importNetlist, ACTION_MENU::NORMAL, _( "Netlist..." ) ); + submenuImport->Add( PCB_ACTIONS::importSpecctraSession, ACTION_MENU::NORMAL, _( "Specctra Session..." ) ); submenuImport->Add( _( "Graphics..." ), _( "Import 2D drawing file" ), ID_GEN_IMPORT_GRAPHICS_FILE, BITMAPS::import_vector ); @@ -128,7 +128,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() submenuExport->SetTitle( _( "Export" ) ); submenuExport->SetIcon( BITMAPS::export_file ); - submenuExport->Add( PCB_ACTIONS::exportSpecctraDSN ); + submenuExport->Add( PCB_ACTIONS::exportSpecctraDSN, ACTION_MENU::NORMAL, _( "Specctra DSN..." ) ); submenuExport->Add( _( "GenCAD..." ), _( "Export GenCAD board representation" ), ID_GEN_EXPORT_FILE_GENCADFORMAT, BITMAPS::post_gencad ); submenuExport->Add( _( "VRML..." ), _( "Export VRML 3D board representation" ), @@ -146,12 +146,12 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ID_GEN_EXPORT_FILE_HYPERLYNX, BITMAPS::export_step ); submenuExport->AppendSeparator(); - submenuExport->Add( _( "Export Footprints to Library..." ), + submenuExport->Add( _( "Footprints to Library..." ), _( "Add footprints used on board to an existing footprint library\n" "(does not remove other footprints from this library)" ), ID_MENU_EXPORT_FOOTPRINTS_TO_LIBRARY, BITMAPS::library_archive ); - submenuExport->Add( _( "Export Footprints to New Library..." ), + submenuExport->Add( _( "Footprints to New Library..." ), _( "Create a new footprint library containing the footprints used on board\n" "(if the library already exists it will be replaced)" ), ID_MENU_EXPORT_FOOTPRINTS_TO_NEW_LIBRARY, BITMAPS::library_archive_as ); diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index 7a4ef08984..4fc4b0a778 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -384,12 +384,12 @@ TOOL_ACTION PCB_ACTIONS::pasteFootprint( "pcbnew.ModuleEditor.pasteFootprint", TOOL_ACTION PCB_ACTIONS::importFootprint( "pcbnew.ModuleEditor.importFootprint", AS_GLOBAL, 0, "", - _( "Import Footprint..." ), "", + _( "Import Footprint..." ), _( "Import footprint from file" ), BITMAPS::import_module ); TOOL_ACTION PCB_ACTIONS::exportFootprint( "pcbnew.ModuleEditor.exportFootprint", AS_GLOBAL, 0, "", - _( "Export Footprint..." ), "", + _( "Export Footprint..." ), _( "Export footprint to file" ), BITMAPS::export_module ); TOOL_ACTION PCB_ACTIONS::footprintProperties( "pcbnew.ModuleEditor.footprintProperties", @@ -555,17 +555,17 @@ TOOL_ACTION PCB_ACTIONS::boardSetup( "pcbnew.EditorControl.boardSetup", TOOL_ACTION PCB_ACTIONS::importNetlist( "pcbnew.EditorControl.importNetlist", AS_GLOBAL, 0, "", - _( "Netlist..." ), _( "Read netlist and update board connectivity" ), + _( "Import Netlist..." ), _( "Read netlist and update board connectivity" ), BITMAPS::netlist ); TOOL_ACTION PCB_ACTIONS::importSpecctraSession( "pcbnew.EditorControl.importSpecctraSession", AS_GLOBAL, 0, "", - _( "Specctra Session..." ), _( "Import routed Specctra session (*.ses) file" ), + _( "Import Specctra Session..." ), _( "Import routed Specctra session (*.ses) file" ), BITMAPS::import ); TOOL_ACTION PCB_ACTIONS::exportSpecctraDSN( "pcbnew.EditorControl.exportSpecctraDSN", AS_GLOBAL, 0, "", - _( "Specctra DSN..." ), _( "Export Specctra DSN routing info" ), + _( "Export Specctra DSN..." ), _( "Export Specctra DSN routing info" ), BITMAPS::export_dsn ); TOOL_ACTION PCB_ACTIONS::generateGerbers( "pcbnew.EditorControl.generateGerbers",