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.

248 lines
7.6 KiB

* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2009-2013 Wayne Stambaugh <stambaughw@verizon.net>
  6. * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, you may find one here:
  20. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  21. * or you may search the http://www.gnu.org website for the version 2 license,
  22. * or you may write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  24. */
  25. /**
  26. * @file gerbview/menubar.cpp
  27. * @brief (Re)Create the main menubar for GerbView
  28. */
  29. #include <fctsys.h>
  30. #include <pgm_base.h>
  31. #include <kiface_i.h>
  32. #include <gerbview.h>
  33. #include <gerbview_frame.h>
  34. #include <gerbview_id.h>
  35. #include <hotkeys.h>
  36. #include <menus_helpers.h>
  37. void GERBVIEW_FRAME::ReCreateMenuBar()
  38. {
  39. // Create and try to get the current menubar
  40. wxMenuBar* menuBar = GetMenuBar();
  41. if( !menuBar )
  42. menuBar = new wxMenuBar();
  43. // Delete all existing menus so they can be rebuilt.
  44. // This allows language changes of the menu text on the fly.
  45. menuBar->Freeze();
  46. while( menuBar->GetMenuCount() )
  47. delete menuBar->Remove( 0 );
  48. // Recreate all menus:
  49. // Menu File:
  50. wxMenu* fileMenu = new wxMenu;
  51. // Load
  52. AddMenuItem( fileMenu,
  53. wxID_FILE,
  54. _( "Load &Gerber File" ),
  55. _( "Load a new Gerber file on the current layer. Previous data will be deleted" ),
  56. KiBitmap( gerber_file_xpm ) );
  57. // Excellon
  58. AddMenuItem( fileMenu,
  59. ID_GERBVIEW_LOAD_DRILL_FILE,
  60. _( "Load &EXCELLON Drill File" ),
  61. _( "Load excellon drill file" ),
  62. KiBitmap( gerbview_drill_file_xpm ) );
  63. // Recent gerber files
  64. static wxMenu* openRecentGbrMenu;
  65. // Add this menu to list menu managed by m_fileHistory
  66. // (the file history will be updated when adding/removing files in history
  67. if( openRecentGbrMenu )
  68. Kiface().GetFileHistory().RemoveMenu( openRecentGbrMenu );
  69. openRecentGbrMenu = new wxMenu();
  70. Kiface().GetFileHistory().UseMenu( openRecentGbrMenu );
  71. Kiface().GetFileHistory().AddFilesToMenu();
  72. AddMenuItem( fileMenu, openRecentGbrMenu,
  73. wxID_ANY,
  74. _( "Open &Recent Gerber File" ),
  75. _( "Open a recent opened Gerber file" ),
  76. KiBitmap( gerber_recent_files_xpm ) );
  77. // Recent drill files
  78. static wxMenu* openRecentDrlMenu;
  79. if( openRecentDrlMenu )
  80. m_drillFileHistory.RemoveMenu( openRecentDrlMenu );
  81. openRecentDrlMenu = new wxMenu();
  82. m_drillFileHistory.UseMenu( openRecentDrlMenu );
  83. m_drillFileHistory.AddFilesToMenu( );
  84. AddMenuItem( fileMenu, openRecentDrlMenu,
  85. wxID_ANY,
  86. _( "Open Recent Dri&ll File" ),
  87. _( "Open a recent opened drill file" ),
  88. KiBitmap( gerbview_open_recent_drill_files_xpm ) );
  89. // Separator
  90. fileMenu->AppendSeparator();
  91. // Clear all
  92. AddMenuItem( fileMenu,
  93. ID_GERBVIEW_ERASE_ALL,
  94. _( "&Clear All" ),
  95. _( "Clear all layers. All data will be deleted" ),
  96. KiBitmap( gerbview_clear_layers_xpm ) );
  97. // Separator
  98. fileMenu->AppendSeparator();
  99. // Export to Pcbnew
  100. AddMenuItem( fileMenu,
  101. ID_GERBVIEW_EXPORT_TO_PCBNEW,
  102. _( "E&xport to Pcbnew" ),
  103. _( "Export data in Pcbnew format" ),
  104. KiBitmap( export_xpm ) );
  105. // Separator
  106. fileMenu->AppendSeparator();
  107. // Print
  108. AddMenuItem( fileMenu,
  109. wxID_PRINT,
  110. _( "&Print" ),
  111. _( "Print gerber" ),
  112. KiBitmap( print_button_xpm ) );
  113. // Separator
  114. fileMenu->AppendSeparator();
  115. // Exit
  116. AddMenuItem( fileMenu,
  117. wxID_EXIT,
  118. _( "E&xit" ),
  119. _( "Quit GerbView" ),
  120. KiBitmap( exit_xpm ) );
  121. // Menu for configuration and preferences
  122. wxMenu* configMenu = new wxMenu;
  123. // Hide layer manager
  124. AddMenuItem( configMenu,
  125. ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
  126. _( "Hide &Layers Manager" ),
  127. m_show_layer_manager_tools ?
  128. _( "Hide &Layers Manager" ) : _("Show &Layers Manager" ),
  129. KiBitmap( layers_manager_xpm ) );
  130. // Options (Preferences on WXMAC)
  131. #ifdef __WXMAC__
  132. configMenu->Append(wxID_PREFERENCES);
  133. #else
  134. AddMenuItem( configMenu,
  135. wxID_PREFERENCES,
  136. _( "&Options" ),
  137. _( "Set options to draw items" ),
  138. KiBitmap( preference_xpm ) );
  139. #endif // __WXMAC__
  140. // Language submenu
  141. Pgm().AddMenuLanguageList( configMenu );
  142. // Hotkey submenu
  143. AddHotkeyConfigMenu( configMenu );
  144. // Menu miscellaneous
  145. wxMenu* miscellaneousMenu = new wxMenu;
  146. // List dcodes
  147. AddMenuItem( miscellaneousMenu,
  148. ID_GERBVIEW_SHOW_LIST_DCODES,
  149. _( "&List DCodes" ),
  150. _( "List and edit D-codes" ),
  151. KiBitmap( show_dcodenumber_xpm ) );
  152. // Show source
  153. AddMenuItem( miscellaneousMenu,
  154. ID_GERBVIEW_SHOW_SOURCE,
  155. _( "&Show Source" ),
  156. _( "Show source file for the current layer" ),
  157. KiBitmap( tools_xpm ) );
  158. // Separator
  159. miscellaneousMenu->AppendSeparator();
  160. // Clear layer
  161. AddMenuItem( miscellaneousMenu,
  162. ID_GERBVIEW_GLOBAL_DELETE,
  163. _( "&Clear Layer" ),
  164. _( "Clear current layer" ),
  165. KiBitmap( general_deletions_xpm ) );
  166. // Separator
  167. miscellaneousMenu->AppendSeparator();
  168. // Text editor
  169. AddMenuItem( miscellaneousMenu,
  170. ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR,
  171. _( "&Text Editor" ),
  172. _( "Select your preferred text editor" ),
  173. KiBitmap( editor_xpm ) );
  174. // Menu Help
  175. wxMenu* helpMenu = new wxMenu;
  176. // Version info
  177. AddHelpVersionInfoMenuEntry( helpMenu );
  178. // Contents
  179. AddMenuItem( helpMenu,
  180. wxID_HELP,
  181. _( "&Contents" ),
  182. _( "Open the GerbView handbook" ),
  183. KiBitmap( help_xpm ) );
  184. // About GerbView
  185. AddMenuItem( helpMenu,
  186. wxID_ABOUT,
  187. _( "&About GerbView" ),
  188. _( "About GerbView gerber and drill viewer" ),
  189. KiBitmap( online_help_xpm ) );
  190. // Append menus to the menubar
  191. menuBar->Append( fileMenu, _( "&File" ) );
  192. menuBar->Append( configMenu, _( "&Preferences" ) );
  193. menuBar->Append( miscellaneousMenu, _( "&Miscellaneous" ) );
  194. menuBar->Append( helpMenu, _( "&Help" ) );
  195. menuBar->Thaw();
  196. // Associate the menu bar with the frame, if no previous menubar
  197. if( GetMenuBar() == NULL )
  198. SetMenuBar( menuBar );
  199. else
  200. menuBar->Refresh();
  201. }