You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
3.4 KiB

6 years ago
6 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
  5. * Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. #include <bitmaps.h>
  25. #include <menus_helpers.h>
  26. #include <tool/actions.h>
  27. #include <tool/common_control.h>
  28. #include <tool/conditional_menu.h>
  29. #include <tool/tool_manager.h>
  30. #include <cvpcb_mainframe.h>
  31. #include <tools/cvpcb_actions.h>
  32. #include <widgets/wx_menubar.h>
  33. void CVPCB_MAINFRAME::ReCreateMenuBar()
  34. {
  35. COMMON_CONTROL* tool = m_toolManager->GetTool<COMMON_CONTROL>();
  36. // wxWidgets handles the Mac Application menu behind the scenes, but that means
  37. // we always have to start from scratch with a new wxMenuBar.
  38. wxMenuBar* oldMenuBar = GetMenuBar();
  39. WX_MENUBAR* menuBar = new WX_MENUBAR();
  40. //-- File menu -----------------------------------------------------------
  41. //
  42. ACTION_MENU* fileMenu = new ACTION_MENU( false, tool );
  43. fileMenu->Add( CVPCB_ACTIONS::saveAssociationsToSchematic );
  44. fileMenu->AppendSeparator();
  45. fileMenu->AddClose( _( "Assign Footprints" ) );
  46. //-- Edit menu -----------------------------------------------------------
  47. //
  48. ACTION_MENU* editMenu = new ACTION_MENU( false, tool );
  49. editMenu->Add( ACTIONS::undo );
  50. editMenu->Add( ACTIONS::redo );
  51. editMenu->AppendSeparator();
  52. editMenu->Add( ACTIONS::cut );
  53. editMenu->Add( ACTIONS::copy );
  54. editMenu->Add( ACTIONS::paste );
  55. //-- Preferences menu ----------------------------------------------------
  56. //
  57. ACTION_MENU* prefsMenu = new ACTION_MENU( false, tool );
  58. prefsMenu->Add( ACTIONS::configurePaths );
  59. prefsMenu->Add( ACTIONS::showFootprintLibTable );
  60. // We can't use ACTIONS::showPreferences yet because wxWidgets moves this on
  61. // Mac, and it needs the wxID_PREFERENCES id to find it.
  62. prefsMenu->Add( _( "Preferences..." ) + "\tCtrl+,",
  63. _( "Show preferences for all open tools" ),
  64. wxID_PREFERENCES,
  65. BITMAPS::preference );
  66. prefsMenu->AppendSeparator();
  67. prefsMenu->Add( CVPCB_ACTIONS::showEquFileTable);
  68. prefsMenu->AppendSeparator();
  69. AddMenuLanguageList( prefsMenu, tool );
  70. //-- Menubar -------------------------------------------------------------
  71. //
  72. menuBar->Append( fileMenu, _( "&File" ) );
  73. menuBar->Append( editMenu, _( "&Edit" ) );
  74. menuBar->Append( prefsMenu, _( "&Preferences" ) );
  75. AddStandardHelpMenu( menuBar );
  76. SetMenuBar( menuBar );
  77. delete oldMenuBar;
  78. }