From 28705d7c6da9f646819bd1a5c367c4e9a97dfce8 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 14 Feb 2018 22:50:41 +0000 Subject: [PATCH] Fix up file menu and hotkeys --- pcbnew/hotkeys.cpp | 17 ++++--- pcbnew/hotkeys.h | 4 -- pcbnew/hotkeys_board_editor.cpp | 4 +- pcbnew/menubar_footprint_editor.cpp | 2 +- pcbnew/menubar_pcb_editor.cpp | 77 +++++++++++++++-------------- 5 files changed, 53 insertions(+), 51 deletions(-) diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index 6aa372e72e..4171d613a4 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -93,10 +93,6 @@ static EDA_HOTKEY HkSwitch2NextCopperLayer( _HKI( "Switch to Next Layer" ), static EDA_HOTKEY HkSwitch2PreviousCopperLayer( _HKI( "Switch to Previous Layer" ), HK_SWITCH_LAYER_TO_PREVIOUS, '-' ); -static EDA_HOTKEY HkSaveModule( _HKI( "Save Footprint" ), HK_SAVE_MODULE, 'S' + GR_KB_CTRL ); -static EDA_HOTKEY HkSavefile( _HKI( "Save Board" ), HK_SAVE_BOARD, 'S' + GR_KB_CTRL ); -static EDA_HOTKEY HkSavefileAs( _HKI( "Save Board As" ), HK_SAVE_BOARD_AS, 'S' + GR_KB_CTRL + GR_KB_SHIFT ); -static EDA_HOTKEY HkLoadfile( _HKI( "Load Board" ), HK_LOAD_BOARD, 'L' + GR_KB_CTRL ); static EDA_HOTKEY HkFindItem( _HKI( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL ); static EDA_HOTKEY HkBackspace( _HKI( "Delete Track Segment" ), HK_BACK_SPACE, WXK_BACK ); static EDA_HOTKEY HkAddNewTrack( _HKI( "Add New Track" ), HK_ADD_NEW_TRACK, 'X' ); @@ -238,6 +234,12 @@ static EDA_HOTKEY HkViaSizeInc( _HKI( "Increase Via Size" ), HK_VIA_SIZE_INC, '\ static EDA_HOTKEY HkViaSizeDec( _HKI( "Decrease Via Size" ), HK_VIA_SIZE_DEC, '\\' ); +// Common: hotkeys_basic.h +static EDA_HOTKEY HkNew( _HKI( "New" ), HK_NEW, GR_KB_CTRL + 'N', (int) wxID_NEW ); +static EDA_HOTKEY HkOpen( _HKI( "Open" ), HK_OPEN, GR_KB_CTRL + 'O', (int) wxID_OPEN ); +static EDA_HOTKEY HkSave( _HKI( "Save" ), HK_SAVE, GR_KB_CTRL + 'S', (int) wxID_SAVE ); +static EDA_HOTKEY HkSaveAs( _HKI( "Save As" ), HK_SAVEAS, GR_KB_SHIFT + GR_KB_CTRL + 'S', (int) wxID_SAVEAS ); +static EDA_HOTKEY HkPrint( _HKI( "Print" ), HK_PRINT, GR_KB_CTRL + 'P', (int) wxID_PRINT ); static EDA_HOTKEY HkUndo( _HKI( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO ); @@ -256,6 +258,7 @@ static EDA_HOTKEY HkEditPaste( _HKI( "Paste" ), HK_EDIT_PASTE, GR_KB_CTRL + 'V', // List of common hotkey descriptors EDA_HOTKEY* common_Hotkey_List[] = { + &HkNew, &HkOpen, &HkSave, &HkSaveAs, &HkPrint, &HkUndo, &HkRedo, &HkEditCut, &HkEditCopy, &HkEditPaste, &HkHelp, &HkZoomIn, &HkZoomOut, @@ -294,8 +297,8 @@ EDA_HOTKEY* board_edit_Hotkey_List[] = &HkRotateItem, &HkMoveItemExact, &HkPositionItemRelative, &HkDuplicateItem, &HkDuplicateItemAndIncrement, &HkCreateArray, &HkDragFootprint, - &HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile, &HkSavefileAs, - &HkLoadfile, &HkFindItem, &HkEditBoardItem, + &HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, + &HkFindItem, &HkEditBoardItem, &HkEditWithModedit, &HkSwitch2CopperLayer, &HkSwitch2InnerLayer1, &HkSwitch2InnerLayer2, &HkSwitch2InnerLayer3, &HkSwitch2InnerLayer4, @@ -316,7 +319,7 @@ EDA_HOTKEY* board_edit_Hotkey_List[] = EDA_HOTKEY* module_edit_Hotkey_List[] = { &HkMoveItem, &HkRotateItem, &HkEditBoardItem, &HkMoveItemExact, &HkDuplicateItem, &HkDuplicateItemAndIncrement, - &HkCreateArray, &HkDelete, &HkSaveModule, + &HkCreateArray, &HkDelete, &HkCanvasDefault, &HkCanvasCairo, &HkCanvasOpenGL, NULL }; diff --git a/pcbnew/hotkeys.h b/pcbnew/hotkeys.h index ec49663ecc..5ccca9c3fa 100644 --- a/pcbnew/hotkeys.h +++ b/pcbnew/hotkeys.h @@ -54,10 +54,6 @@ enum hotkey_id_commnand { HK_ADD_MICROVIA, HK_SWITCH_TRACK_POSTURE, HK_DRAG_TRACK_KEEP_SLOPE, - HK_SAVE_BOARD, - HK_SAVE_BOARD_AS, - HK_LOAD_BOARD, - HK_SAVE_MODULE, HK_SWITCH_UNITS, HK_SWITCH_TRACK_DISPLAY_MODE, HK_3D_VIEWER, diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index 3d6572ada5..8dc8853980 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -335,13 +335,13 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit break; - case HK_LOAD_BOARD: + case HK_OPEN: if( !itemCurrentlyEdited ) evt_type = ID_LOAD_FILE ; break; - case HK_SAVE_BOARD: + case HK_SAVE: if( !itemCurrentlyEdited ) evt_type = ID_SAVE_BOARD; diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index 9cab6006a3..0ca2f50bea 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -108,7 +108,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // Save module text = AddHotkeyName( _( "&Save Footprint in Active Library" ), - m_hotkeysDescrList, HK_SAVE_MODULE ); + m_hotkeysDescrList, HK_SAVE ); AddMenuItem( fileMenu, ID_MODEDIT_SAVE_LIBMODULE, text, _( "Save footprint in active library" ), diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index 53636f21b8..90942f2ef2 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -653,18 +653,6 @@ void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject ) // Some commands are available only if Pcbnew is run outside a project (run alone). // aIsOutsideProject is false when Pcbnew is run from Kicad manager. - if( aIsOutsideProject ) - { - AddMenuItem( aParentMenu, ID_NEW_BOARD, - _( "&New" ), - _( "Create new board" ), - KiBitmap( new_board_xpm ) ); - - text = AddHotkeyName( _( "&Open..." ), g_Pcbnew_Editor_Hotkeys_Descr, HK_LOAD_BOARD ); - AddMenuItem( aParentMenu, ID_LOAD_FILE, text, - _( "Open existing board" ), - KiBitmap( open_brd_file_xpm ) ); - } wxFileHistory& fhist = Kiface().GetFileHistory(); @@ -683,25 +671,25 @@ void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject ) if( aIsOutsideProject ) { + text = AddHotkeyName( _( "&New" ), g_Pcbnew_Editor_Hotkeys_Descr, HK_NEW ); + AddMenuItem( aParentMenu, ID_NEW_BOARD, + text, _( "Create new board" ), + KiBitmap( new_board_xpm ) ); + + text = AddHotkeyName( _( "&Open..." ), g_Pcbnew_Editor_Hotkeys_Descr, HK_OPEN ); + AddMenuItem( aParentMenu, ID_LOAD_FILE, text, + _( "Open existing board" ), + KiBitmap( open_brd_file_xpm ) ); + AddMenuItem( aParentMenu, openRecentMenu, -1, _( "Open &Recent" ), _( "Open recently opened board" ), KiBitmap( recent_xpm ) ); - AddMenuItem( aParentMenu, ID_APPEND_FILE, - _( "&Append Board..." ), - _( "Append another board to currently loaded board" ), - KiBitmap( add_board_xpm ) ); - - AddMenuItem( aParentMenu, ID_IMPORT_NON_KICAD_BOARD, - _( "Import Non-Kicad Board File..." ), - _( "Import board file from other applications" ), - KiBitmap( import_brd_file_xpm ) ); - aParentMenu->AppendSeparator(); } - text = AddHotkeyName( _( "&Save" ), g_Pcbnew_Editor_Hotkeys_Descr, HK_SAVE_BOARD ); + text = AddHotkeyName( _( "&Save" ), g_Pcbnew_Editor_Hotkeys_Descr, HK_SAVE ); AddMenuItem( aParentMenu, ID_SAVE_BOARD, text, _( "Save current board" ), KiBitmap( save_xpm ) ); @@ -713,7 +701,7 @@ void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject ) // when not under a project mgr, we are free to change filenames, cwd ... if( Kiface().IsSingle() ) // not when under a project mgr (pcbnew is run as stand alone) { - text = AddHotkeyName( _( "Sa&ve As..." ), g_Pcbnew_Editor_Hotkeys_Descr, HK_SAVE_BOARD_AS ); + text = AddHotkeyName( _( "Sa&ve As..." ), g_Pcbnew_Editor_Hotkeys_Descr, HK_SAVEAS ); AddMenuItem( aParentMenu, ID_SAVE_BOARD_AS, text, _( "Save current board with new name" ), KiBitmap( save_as_xpm ) ); @@ -722,7 +710,7 @@ void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject ) // but do not change the current board file name else { - text = AddHotkeyName( _( "Sa&ve Copy As..." ), g_Pcbnew_Editor_Hotkeys_Descr, HK_SAVE_BOARD_AS ); + text = AddHotkeyName( _( "Sa&ve Copy As..." ), g_Pcbnew_Editor_Hotkeys_Descr, HK_SAVEAS ); AddMenuItem( aParentMenu, ID_COPY_BOARD_AS, text, _( "Save copy of the current board" ), KiBitmap( save_as_xpm ) ); @@ -730,15 +718,29 @@ void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject ) aParentMenu->AppendSeparator(); + AddMenuItem( aParentMenu, ID_MENU_RECOVER_BOARD_AUTOSAVE, + _( "Resc&ue" ), + _( "Clear board and get last rescue file automatically saved by Pcbnew" ), + KiBitmap( rescue_xpm ) ); + + if( aIsOutsideProject ) + { + AddMenuItem( aParentMenu, ID_APPEND_FILE, + _( "&Append Board..." ), + _( "Append another board to currently loaded board" ), + KiBitmap( add_board_xpm ) ); + + AddMenuItem( aParentMenu, ID_IMPORT_NON_KICAD_BOARD, + _( "Import Non-Kicad Board File..." ), + _( "Import board file from other applications" ), + KiBitmap( import_brd_file_xpm ) ); + } + AddMenuItem( aParentMenu, ID_MENU_READ_BOARD_BACKUP_FILE, _( "Revert to Las&t Backup" ), _( "Clear board and get previous backup version of board" ), KiBitmap( undo_xpm ) ); - AddMenuItem( aParentMenu, ID_MENU_RECOVER_BOARD_AUTOSAVE, - _( "Resc&ue" ), - _( "Clear board and get last rescue file automatically saved by Pcbnew" ), - KiBitmap( rescue_xpm ) ); aParentMenu->AppendSeparator(); //----- Fabrication Outputs submenu ----------------------------------------- @@ -806,15 +808,11 @@ void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject ) _( "Settings for sheet size and frame references" ), KiBitmap( sheetset_xpm ) ); - AddMenuItem( aParentMenu, wxID_PRINT, - _( "&Print..." ), _( "Print board" ), + text = AddHotkeyName( _( "&Print..." ), g_Pcbnew_Editor_Hotkeys_Descr, HK_PRINT ); + AddMenuItem( aParentMenu, wxID_PRINT, text, + _( "Print board" ), KiBitmap( print_button_xpm ) ); - AddMenuItem( aParentMenu, ID_GEN_PLOT_SVG, - _( "Export SV&G..." ), - _( "Export board file in Scalable Vector Graphics format" ), - KiBitmap( plot_svg_xpm ) ); - AddMenuItem( aParentMenu, ID_GEN_PLOT, _( "P&lot..." ), _( "Plot board in HPGL, PostScript or Gerber RS-274X format)" ), @@ -852,7 +850,7 @@ void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject ) void prepareExportMenu( wxMenu* aParentMenu ) { AddMenuItem( aParentMenu, ID_GEN_EXPORT_SPECCTRA, - _( "&Specctra DSN..." ), + _( "S&pecctra DSN..." ), _( "Export current board to \"Specctra DSN\" file" ), KiBitmap( export_dsn_xpm ) ); @@ -873,6 +871,11 @@ void prepareExportMenu( wxMenu* aParentMenu ) _( "S&TEP..." ), _( "STEP export" ), KiBitmap( export_step_xpm ) ); + AddMenuItem( aParentMenu, ID_GEN_PLOT_SVG, + _( "&SVG..." ), + _( "Export board file in Scalable Vector Graphics format" ), + KiBitmap( plot_svg_xpm ) ); + AddMenuItem( aParentMenu, ID_PCB_GEN_CMP_FILE, _( "&Footprint Association (.cmp) File..." ), _( "Export footprint association file (*.cmp) for schematic back annotation" ),