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.

216 lines
7.0 KiB

7 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2009-2016 Wayne Stambaugh <stambaughw@verizon.net>
  6. * Copyright (C) 1992-2017 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 id.h
  27. */
  28. #ifndef ID_H_
  29. #define ID_H_
  30. #include <wx/defs.h>
  31. /**
  32. * Common command IDs shared by more than one of the KiCad applications.
  33. *
  34. * Only place command IDs used in base window class event tables or shared
  35. * across multple applications such as the zoom, grid, and language IDs.
  36. * Application specific IDs should be defined in the appropriate header
  37. * file to prevent the entire project from being rebuilt.
  38. *
  39. * However, we must avoid duplicate IDs in menus and toolbar items, when wxUpdateUIEvent
  40. * are associated to menuitems and/or toolbar items
  41. * The reason is the fact wxWidgets try to send a wxUpdateUIEvent event to a given window and,
  42. * if a wxUpdateUIEvent event function is not defined for a menuitem, wxWidgets
  43. * propagates this event ID to parents of the given window.
  44. * Therefore duplicate IDs could create strange behavior in menus and subtle bugs, depending
  45. * on the code inside the wxUpdateUIEvent event functions called in parent frames.
  46. * I did not seen this propagation to child frames, only to parent frames
  47. *
  48. * Issues exist only if 2 menus have the same ID, and only one menu is associated to
  49. * a wxUpdateUIEvent event, and this one is defined in a parent Window.
  50. * The probability it happens is low, but not null.
  51. *
  52. * Therefore we reserve room in ID list for each sub application.
  53. * Please, change these values if needed
  54. */
  55. // Define room for IDs, for each sub application
  56. #define ROOM_FOR_KICADMANAGER 50
  57. #define ROOM_FOR_3D_VIEWER 100
  58. #define ROOM_FOR_PANEL_PREV_MODEL 50
  59. /// IDs range for menuitems file history:
  60. /// The default range file history size is 9 (compatible with default wxWidget range).
  61. #define DEFAULT_FILE_HISTORY_SIZE 9
  62. #define MAX_FILE_HISTORY_SIZE 99
  63. enum main_id
  64. {
  65. ID_RUN_PCB = wxID_HIGHEST,
  66. ID_APPEND_PROJECT,
  67. ID_SAVE_PROJECT,
  68. ID_LOAD_FILE,
  69. ID_NEW_BOARD,
  70. ID_SAVE_BOARD,
  71. ID_SAVE_BOARD_AS,
  72. ID_AUTO_SAVE_TIMER,
  73. // ID for menuitems used in our file history management,
  74. // when we do not use wxFILE_ID (restricted to 9 items)
  75. ID_FILE,
  76. ID_FILE1,
  77. ID_FILEMAX = ID_FILE + MAX_FILE_HISTORY_SIZE,
  78. ID_FILE_LIST_EMPTY,
  79. ID_FILE_LIST_CLEAR,
  80. ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
  81. ID_PREFERENCES_CONFIGURE_PATHS,
  82. ID_EDIT_SYMBOL_LIBRARY_TABLE,
  83. ID_EDIT_FOOTPRINT_LIBRARY_TABLE,
  84. ID_GEN_PLOT,
  85. ID_GEN_PLOT_PS,
  86. ID_GEN_PLOT_HPGL,
  87. ID_GEN_PLOT_GERBER,
  88. ID_GEN_PLOT_SVG,
  89. ID_GEN_PLOT_DXF,
  90. ID_GEN_PLOT_PDF,
  91. ID_GEN_EXPORT_FILE,
  92. ID_GEN_IMPORT_FILE,
  93. // id for toolbars
  94. ID_H_TOOLBAR,
  95. ID_V_TOOLBAR,
  96. ID_OPT_TOOLBAR,
  97. ID_AUX_TOOLBAR,
  98. ID_EDIT_HOTKEY,
  99. ID_NO_TOOL_SELECTED,
  100. ID_LANGUAGE_CHOICE,
  101. ID_LANGUAGE_DEFAULT,
  102. ID_LANGUAGE_ENGLISH,
  103. ID_LANGUAGE_FRENCH,
  104. ID_LANGUAGE_FINNISH,
  105. ID_LANGUAGE_SPANISH,
  106. ID_LANGUAGE_GERMAN,
  107. ID_LANGUAGE_GREEK,
  108. ID_LANGUAGE_RUSSIAN,
  109. ID_LANGUAGE_PORTUGUESE,
  110. ID_LANGUAGE_ITALIAN,
  111. ID_LANGUAGE_SLOVENIAN,
  112. ID_LANGUAGE_SLOVAK,
  113. ID_LANGUAGE_HUNGARIAN,
  114. ID_LANGUAGE_POLISH,
  115. ID_LANGUAGE_CZECH,
  116. ID_LANGUAGE_KOREAN,
  117. ID_LANGUAGE_CATALAN,
  118. ID_LANGUAGE_CHINESE_SIMPLIFIED,
  119. ID_LANGUAGE_CHINESE_TRADITIONAL,
  120. ID_LANGUAGE_DUTCH,
  121. ID_LANGUAGE_JAPANESE,
  122. ID_LANGUAGE_BULGARIAN,
  123. ID_LANGUAGE_LITHUANIAN,
  124. ID_LANGUAGE_CHOICE_END,
  125. // Popup Menu (mouse Right button) (id consecutifs)
  126. ID_ON_ZOOM_SELECT,
  127. ID_POPUP_ZOOM_START_RANGE, // first zoom id
  128. ID_POPUP_CANCEL,
  129. ID_POPUP_ZOOM_IN,
  130. ID_POPUP_ZOOM_OUT,
  131. ID_POPUP_ZOOM_SELECT,
  132. ID_POPUP_ZOOM_CENTER,
  133. ID_POPUP_ZOOM_PAGE,
  134. ID_POPUP_ZOOM_REDRAW,
  135. /* Reserve IDs for popup menu zoom levels. If you need more
  136. * levels of zoom, change ID_POPUP_ZOOM_LEVEL_END. Note that more
  137. * than 15 entries in a context submenu may get too large to display
  138. * cleanly. Add any additional popup zoom IDs above here or the
  139. * zoom event handler will not work properly.
  140. */
  141. ID_POPUP_ZOOM_LEVEL_START,
  142. ID_POPUP_ZOOM_LEVEL_END = ID_POPUP_ZOOM_LEVEL_START + 99,
  143. ID_POPUP_GRID_START,
  144. ID_POPUP_GRID_END = ID_POPUP_ZOOM_LEVEL_START + 99,
  145. ID_ON_GRID_SELECT,
  146. ID_GRID_SETTINGS,
  147. ID_ZOOM_BEGIN,
  148. ID_VIEWER_ZOOM_IN = ID_ZOOM_BEGIN,
  149. ID_VIEWER_ZOOM_OUT,
  150. ID_VIEWER_ZOOM_PAGE,
  151. ID_VIEWER_ZOOM_REDRAW,
  152. // zoom commands for non center zooming
  153. ID_OFFCENTER_ZOOM_IN,
  154. ID_OFFCENTER_ZOOM_OUT,
  155. ID_ZOOM_END,
  156. // KiFace server for standalone operation
  157. ID_EDA_SOCKET_EVENT_SERV,
  158. ID_EDA_SOCKET_EVENT,
  159. ID_DIALOG_ERC, ///< eeschema ERC modeless dialog ID
  160. // IDs specifics to a sub-application (Eeschema, Kicad manager....) start here
  161. //
  162. // We reserve here Ids for each sub-application, to avoid duplicate IDs
  163. // between them.
  164. // mainly we experienced issues related to wxUpdateUIEvent calls when 2 (or more) wxFrames
  165. // share the same ID in menus, mainly in menubars/toolbars
  166. // The reason is the fact wxWidgets propagates the wxUpdateUIEvent to all parent windows
  167. // to find wxUpdateUIEvent event functions matching the menuitem IDs found when activate a
  168. // menu in the first frame.
  169. // Reserve ROOM_FOR_KICADMANAGER IDs, for Kicad manager
  170. // Change it if this count is too small.
  171. ID_KICAD_MANAGER_START,
  172. ID_KICAD_MANAGER_END = ID_KICAD_MANAGER_START + ROOM_FOR_KICADMANAGER,
  173. // Reserve ROOM_FOR_KICADMANAGER IDs, for Kicad manager
  174. // Change it if this count is too small.
  175. ID_KICAD_3D_VIEWER_START,
  176. ID_KICAD_3D_VIEWER_END = ID_KICAD_3D_VIEWER_START + ROOM_FOR_3D_VIEWER,
  177. ID_KICAD_PANEL_PREV_MODEL_START,
  178. ID_KICAD_PANEL_PREV_MODEL_END = ID_KICAD_PANEL_PREV_MODEL_START + ROOM_FOR_PANEL_PREV_MODEL,
  179. // Reseve ID for popup menus, when we need to know a menu item is inside a popup menu
  180. ID_POPUP_MENU_START,
  181. ID_POPUP_MENU_END = ID_POPUP_MENU_START + 1000,
  182. ID_END_LIST
  183. };
  184. #endif // ID_H_