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.

313 lines
9.5 KiB

  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. /**
  31. * Common command IDs shared by more than one of the KiCad applications.
  32. *
  33. * Only place command IDs used in base window class event tables or shared
  34. * across multple applications such as the zoom, grid, and language IDs.
  35. * Application specific IDs should be defined in the appropriate header
  36. * file to prevent the entire project from being rebuilt.
  37. *
  38. * However, we must avoid duplicate IDs in menus and toolbar items, when wxUpdateUIEvent
  39. * are associated to menuitems and/or toolbar items
  40. * The reason is the fact wxWidgets try to send a wxUpdateUIEvent event to a given window and,
  41. * if a wxUpdateUIEvent event function is not defined for a menuitem, wxWidgets
  42. * propagates this event ID to parents of the given window.
  43. * Therefore duplicate IDs could create strange behavior in menus and subtle bugs, depending
  44. * on the code inside the wxUpdateUIEvent event functions called in parent frames.
  45. * I did not seen this propagation to child frames, only to parent frames
  46. *
  47. * Issues exist only if 2 menus have the same ID, and only one menu is associated to
  48. * a wxUpdateUIEvent event, and this one is defined in a parent Window.
  49. * The probability it happens is low, but not null.
  50. *
  51. * Therefore we reserve room in ID list for each sub application.
  52. * Please, change these values if needed
  53. */
  54. // Define room for IDs, for each sub application
  55. #define ROOM_FOR_KICADMANAGER 50
  56. #define ROOM_FOR_3D_VIEWER 100
  57. #define ROOM_FOR_PANEL_PREV_MODEL 50
  58. enum main_id
  59. {
  60. ID_RUN_PCB = wxID_HIGHEST,
  61. ID_RUN_PCB_MODULE_EDITOR,
  62. ID_RUN_CVPCB,
  63. ID_RUN_LIBRARY, // pcbnew & eeschema each use this internally to load their respective lib editors
  64. ID_LOAD_PROJECT,
  65. ID_APPEND_PROJECT,
  66. ID_NEW_PROJECT,
  67. ID_NEW_PROJECT_FROM_TEMPLATE,
  68. ID_SAVE_PROJECT,
  69. ID_SAVE_PROJECT_AS,
  70. ID_LOAD_FILE,
  71. ID_APPEND_FILE,
  72. ID_NEW_BOARD,
  73. ID_SAVE_BOARD,
  74. ID_SAVE_BOARD_AS,
  75. ID_AUTO_SAVE_TIMER,
  76. ID_CONFIG_REQ,
  77. ID_CONFIG_SAVE,
  78. ID_CONFIG_READ,
  79. ID_MENU_CANVAS_LEGACY,
  80. ID_MENU_CANVAS_OPENGL,
  81. ID_MENU_CANVAS_CAIRO,
  82. ID_PREFERENCES_HOTKEY_START,
  83. ID_PREFERENCES_HOTKEY_EXPORT_CONFIG,
  84. ID_PREFERENCES_HOTKEY_IMPORT_CONFIG,
  85. ID_PREFERENCES_HOTKEY_SHOW_EDITOR,
  86. ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
  87. ID_PREFERENCES_HOTKEY_END,
  88. ID_PREFERENCES_CONFIGURE_PATHS,
  89. ID_GEN_PLOT,
  90. ID_GEN_PLOT_PS,
  91. ID_GEN_PLOT_HPGL,
  92. ID_GEN_PLOT_GERBER,
  93. ID_GEN_PLOT_SVG,
  94. ID_GEN_PLOT_DXF,
  95. ID_GEN_PLOT_PDF,
  96. ID_GEN_COPY_SHEET_TO_CLIPBOARD,
  97. ID_GEN_COPY_BLOCK_TO_CLIPBOARD,
  98. ID_GEN_EXPORT_FILE,
  99. ID_GEN_IMPORT_FILE,
  100. ID_EXIT,
  101. ID_OPTIONS_SETUP,
  102. // id for toolbars
  103. ID_H_TOOLBAR,
  104. ID_V_TOOLBAR,
  105. ID_OPT_TOOLBAR,
  106. ID_AUX_TOOLBAR,
  107. ID_EDIT,
  108. ID_NO_TOOL_SELECTED,
  109. ID_ZOOM_SELECTION,
  110. ID_MENU_ZOOM_SELECTION, // similar to ID_ZOOM_SELECTION, used in main memubar
  111. ID_SEL_BG_COLOR,
  112. ID_REPEAT_BUTT,
  113. ID_LANGUAGE_CHOICE,
  114. ID_LANGUAGE_DEFAULT,
  115. ID_LANGUAGE_ENGLISH,
  116. ID_LANGUAGE_FRENCH,
  117. ID_LANGUAGE_FINNISH,
  118. ID_LANGUAGE_SPANISH,
  119. ID_LANGUAGE_GERMAN,
  120. ID_LANGUAGE_GREEK,
  121. ID_LANGUAGE_RUSSIAN,
  122. ID_LANGUAGE_PORTUGUESE,
  123. ID_LANGUAGE_ITALIAN,
  124. ID_LANGUAGE_SLOVENIAN,
  125. ID_LANGUAGE_SLOVAK,
  126. ID_LANGUAGE_HUNGARIAN,
  127. ID_LANGUAGE_POLISH,
  128. ID_LANGUAGE_CZECH,
  129. ID_LANGUAGE_KOREAN,
  130. ID_LANGUAGE_CATALAN,
  131. ID_LANGUAGE_CHINESE_SIMPLIFIED,
  132. ID_LANGUAGE_DUTCH,
  133. ID_LANGUAGE_JAPANESE,
  134. ID_LANGUAGE_BULGARIAN,
  135. ID_LANGUAGE_LITHUANIAN,
  136. ID_LANGUAGE_CHOICE_END,
  137. ID_KICAD_SELECT_ICONS_OPTIONS,
  138. ID_KICAD_SELECT_ICONS_IN_MENUS,
  139. ID_KICAD_SELECT_ICON_OPTIONS_END,
  140. ID_SET_REPEAT_OPTION,
  141. // Popup Menu (mouse Right button) (id consecutifs)
  142. ID_POPUP_GENERAL_START_RANGE, // first number
  143. ID_POPUP_CANCEL_CURRENT_COMMAND,
  144. ID_POPUP_CLOSE_CURRENT_TOOL,
  145. ID_POPUP_MOVE_BLOCK,
  146. ID_POPUP_MOVE_BLOCK_EXACT,
  147. ID_POPUP_DRAG_BLOCK,
  148. ID_POPUP_COPY_BLOCK,
  149. ID_POPUP_CUT_BLOCK,
  150. ID_POPUP_DUPLICATE_BLOCK,
  151. ID_POPUP_ROTATE_BLOCK,
  152. ID_POPUP_DELETE_BLOCK,
  153. ID_POPUP_FLIP_BLOCK,
  154. ID_POPUP_PLACE_BLOCK,
  155. ID_POPUP_ZOOM_BLOCK,
  156. ID_POPUP_SELECT_ITEMS_BLOCK,
  157. ID_POPUP_MIRROR_X_BLOCK,
  158. ID_POPUP_MIRROR_Y_BLOCK,
  159. ID_POPUP_OTHER_COMMANDS,
  160. ID_POPUP_GENERAL_END_RANGE, // last number
  161. ID_POPUP_ENTER_MENU,
  162. ID_ON_ZOOM_SELECT,
  163. ID_POPUP_ZOOM_START_RANGE, // first zoom id
  164. ID_POPUP_CANCEL,
  165. ID_POPUP_ZOOM_IN,
  166. ID_POPUP_ZOOM_OUT,
  167. ID_POPUP_ZOOM_SELECT,
  168. ID_POPUP_ZOOM_CENTER,
  169. ID_POPUP_ZOOM_PAGE,
  170. ID_POPUP_ZOOM_REDRAW,
  171. ID_KEY_ZOOM_IN,
  172. ID_KEY_ZOOM_OUT,
  173. /* Reserve IDs for popup menu zoom levels. If you need more
  174. * levels of zoom, change ID_POPUP_ZOOM_LEVEL_END. Note that more
  175. * than 15 entries in a context submenu may get too large to display
  176. * cleanly. Add any additional popup zoom IDs above here or the
  177. * zoom event handler will not work properly.
  178. * currently room is provided for 32 levels (this is a very large value).
  179. * Pcbnew use 18 values. For schematic 15 is enought
  180. */
  181. ID_POPUP_ZOOM_LEVEL_START,
  182. ID_POPUP_ZOOM_LEVEL_END = ID_POPUP_ZOOM_LEVEL_START + 32,
  183. ID_POPUP_ZOOM_END_RANGE, // last zoom id
  184. ID_ON_GRID_SELECT,
  185. ID_POPUP_GRID_PLUS,
  186. ID_POPUP_GRID_MOINS,
  187. ID_POPUP_GRID_SELECT,
  188. ID_POPUP_GRID_LEVEL_1000, // id for first predefined grid in inches (1000 * 0.0001 inch)
  189. ID_POPUP_GRID_LEVEL_500,
  190. ID_POPUP_GRID_LEVEL_250,
  191. ID_POPUP_GRID_LEVEL_200,
  192. ID_POPUP_GRID_LEVEL_100,
  193. ID_POPUP_GRID_LEVEL_50,
  194. ID_POPUP_GRID_LEVEL_25,
  195. ID_POPUP_GRID_LEVEL_20,
  196. ID_POPUP_GRID_LEVEL_10,
  197. ID_POPUP_GRID_LEVEL_5,
  198. ID_POPUP_GRID_LEVEL_2,
  199. ID_POPUP_GRID_LEVEL_1, // id for last predefined grid in inches ( 0.0001 inch)
  200. ID_POPUP_GRID_LEVEL_5MM,
  201. ID_POPUP_GRID_LEVEL_2_5MM,
  202. ID_POPUP_GRID_LEVEL_1MM, // id for first predefined grid in mm (1mm)
  203. ID_POPUP_GRID_LEVEL_0_5MM,
  204. ID_POPUP_GRID_LEVEL_0_25MM,
  205. ID_POPUP_GRID_LEVEL_0_2MM,
  206. ID_POPUP_GRID_LEVEL_0_1MM,
  207. ID_POPUP_GRID_LEVEL_0_0_5MM,
  208. ID_POPUP_GRID_LEVEL_0_0_25MM,
  209. ID_POPUP_GRID_LEVEL_0_0_1MM,
  210. ID_POPUP_GRID_USER,
  211. ID_SHEET_SET,
  212. ID_COMPONENT_BUTT,
  213. ID_ZOOM_BEGIN,
  214. ID_ZOOM_IN = ID_ZOOM_BEGIN,
  215. ID_ZOOM_OUT,
  216. ID_ZOOM_PAGE,
  217. ID_ZOOM_REDRAW,
  218. ID_VIEWER_ZOOM_IN,
  219. ID_VIEWER_ZOOM_OUT,
  220. ID_VIEWER_ZOOM_PAGE,
  221. ID_VIEWER_ZOOM_REDRAW,
  222. // zoom commands for non center zooming
  223. ID_OFFCENTER_ZOOM_IN,
  224. ID_OFFCENTER_ZOOM_OUT,
  225. ID_ZOOM_END,
  226. // Panning command event IDs.
  227. ID_PAN_UP,
  228. ID_PAN_DOWN,
  229. ID_PAN_LEFT,
  230. ID_PAN_RIGHT,
  231. ID_MOUSE_DOUBLECLICK,
  232. ID_GET_NETLIST,
  233. ID_OPEN_CMP_TABLE,
  234. ID_GET_TOOLS,
  235. ID_FIND_ITEMS,
  236. ID_EDA_SOCKET_EVENT_SERV,
  237. ID_EDA_SOCKET_EVENT,
  238. // Common to all
  239. ID_TB_OPTIONS_SELECT_UNIT_MM,
  240. ID_TB_OPTIONS_SELECT_UNIT_INCH,
  241. ID_TB_OPTIONS_SELECT_CURSOR,
  242. ID_TB_OPTIONS_SHOW_POLAR_COORD,
  243. ID_TB_OPTIONS_SHOW_GRID,
  244. ID_HELP_GET_INVOLVED,
  245. // Common to Pcbnew and CvPcb
  246. ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
  247. ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
  248. ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH,
  249. ID_TB_OPTIONS_SHOW_PADS_SKETCH,
  250. ID_DIALOG_ERC, ///< eeschema ERC modeless dialog ID
  251. // IDs specifics to a sub-application (Eeschema, Kicad manager....) start here
  252. //
  253. // We reserve here Ids for each sub-application, to avoid duplicate IDs
  254. // between them.
  255. // mainly we experienced issues related to wxUpdateUIEvent calls when 2 (or more) wxFrames
  256. // share the same ID in menus, mainly in menubars/toolbars
  257. // The reason is the fact wxWidgets propagates the wxUpdateUIEvent to all parent windows
  258. // to find wxUpdateUIEvent event functions matching the menuitem IDs found when activate a
  259. // menu in the first frame.
  260. // Reserve ROOM_FOR_KICADMANAGER IDs, for Kicad manager
  261. // Change it if this count is too small.
  262. ID_KICAD_MANAGER_START,
  263. ID_KICAD_MANAGER_END = ID_KICAD_MANAGER_START + ROOM_FOR_KICADMANAGER,
  264. // Reserve ROOM_FOR_KICADMANAGER IDs, for Kicad manager
  265. // Change it if this count is too small.
  266. ID_KICAD_3D_VIEWER_START,
  267. ID_KICAD_3D_VIEWER_END = ID_KICAD_3D_VIEWER_START + ROOM_FOR_3D_VIEWER,
  268. ID_KICAD_PANEL_PREV_MODEL_START,
  269. ID_KICAD_PANEL_PREV_MODEL_END = ID_KICAD_PANEL_PREV_MODEL_START + ROOM_FOR_PANEL_PREV_MODEL,
  270. ID_END_LIST
  271. };
  272. #endif // ID_H_