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.

284 lines
8.6 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_LOAD_PROJECT,
  67. ID_APPEND_PROJECT,
  68. ID_SAVE_PROJECT,
  69. ID_SAVE_PROJECT_AS,
  70. ID_LOAD_FILE,
  71. ID_NEW_BOARD,
  72. ID_SAVE_BOARD,
  73. ID_SAVE_BOARD_AS,
  74. ID_AUTO_SAVE_TIMER,
  75. // ID for menuitems used in our file history management,
  76. // when we do not use wxFILE_ID (restricted to 9 items)
  77. ID_FILE,
  78. ID_FILE1,
  79. ID_FILEMAX = ID_FILE + MAX_FILE_HISTORY_SIZE,
  80. ID_FILE_LIST_CLEAR,
  81. ID_MENU_CANVAS_OPENGL,
  82. ID_MENU_CANVAS_CAIRO,
  83. ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
  84. ID_PREFERENCES_CONFIGURE_PATHS,
  85. ID_EDIT_SYMBOL_LIBRARY_TABLE,
  86. ID_EDIT_FOOTPRINT_LIBRARY_TABLE,
  87. ID_GEN_PLOT,
  88. ID_GEN_PLOT_PS,
  89. ID_GEN_PLOT_HPGL,
  90. ID_GEN_PLOT_GERBER,
  91. ID_GEN_PLOT_SVG,
  92. ID_GEN_PLOT_DXF,
  93. ID_GEN_PLOT_PDF,
  94. ID_GEN_EXPORT_FILE,
  95. ID_GEN_IMPORT_FILE,
  96. ID_OPTIONS_SETUP,
  97. // id for toolbars
  98. ID_H_TOOLBAR,
  99. ID_V_TOOLBAR,
  100. ID_OPT_TOOLBAR,
  101. ID_AUX_TOOLBAR,
  102. ID_EDIT_HOTKEY,
  103. ID_NO_TOOL_SELECTED,
  104. ID_ZOOM_SELECTION,
  105. ID_SEL_BG_COLOR,
  106. ID_LANGUAGE_CHOICE,
  107. ID_LANGUAGE_DEFAULT,
  108. ID_LANGUAGE_ENGLISH,
  109. ID_LANGUAGE_FRENCH,
  110. ID_LANGUAGE_FINNISH,
  111. ID_LANGUAGE_SPANISH,
  112. ID_LANGUAGE_GERMAN,
  113. ID_LANGUAGE_GREEK,
  114. ID_LANGUAGE_RUSSIAN,
  115. ID_LANGUAGE_PORTUGUESE,
  116. ID_LANGUAGE_ITALIAN,
  117. ID_LANGUAGE_SLOVENIAN,
  118. ID_LANGUAGE_SLOVAK,
  119. ID_LANGUAGE_HUNGARIAN,
  120. ID_LANGUAGE_POLISH,
  121. ID_LANGUAGE_CZECH,
  122. ID_LANGUAGE_KOREAN,
  123. ID_LANGUAGE_CATALAN,
  124. ID_LANGUAGE_CHINESE_SIMPLIFIED,
  125. ID_LANGUAGE_CHINESE_TRADITIONAL,
  126. ID_LANGUAGE_DUTCH,
  127. ID_LANGUAGE_JAPANESE,
  128. ID_LANGUAGE_BULGARIAN,
  129. ID_LANGUAGE_LITHUANIAN,
  130. ID_LANGUAGE_CHOICE_END,
  131. ID_KICAD_SELECT_ICONS_OPTIONS,
  132. ID_KICAD_SELECT_ICONS_IN_MENUS,
  133. ID_KICAD_SELECT_ICON_OPTIONS_END,
  134. // Popup Menu (mouse Right button) (id consecutifs)
  135. ID_ON_ZOOM_SELECT,
  136. ID_POPUP_ZOOM_START_RANGE, // first zoom id
  137. ID_POPUP_CANCEL,
  138. ID_POPUP_ZOOM_IN,
  139. ID_POPUP_ZOOM_OUT,
  140. ID_POPUP_ZOOM_SELECT,
  141. ID_POPUP_ZOOM_CENTER,
  142. ID_POPUP_ZOOM_PAGE,
  143. ID_POPUP_ZOOM_REDRAW,
  144. ID_KEY_ZOOM_IN,
  145. ID_KEY_ZOOM_OUT,
  146. /* Reserve IDs for popup menu zoom levels. If you need more
  147. * levels of zoom, change ID_POPUP_ZOOM_LEVEL_END. Note that more
  148. * than 15 entries in a context submenu may get too large to display
  149. * cleanly. Add any additional popup zoom IDs above here or the
  150. * zoom event handler will not work properly.
  151. * currently room is provided for 32 levels (this is a very large value).
  152. * Pcbnew use 18 values. For schematic 15 is enought
  153. */
  154. ID_POPUP_ZOOM_LEVEL_START,
  155. ID_POPUP_ZOOM_LEVEL_END = ID_POPUP_ZOOM_LEVEL_START + 32,
  156. ID_POPUP_ZOOM_END_RANGE, // last zoom id
  157. ID_ON_GRID_SELECT,
  158. ID_POPUP_GRID_SELECT,
  159. ID_POPUP_GRID_FIRST,
  160. ID_POPUP_GRID_LEVEL_1000 = ID_POPUP_GRID_FIRST, // These must be in same order as menu
  161. ID_POPUP_GRID_LEVEL_500,
  162. ID_POPUP_GRID_LEVEL_250,
  163. ID_POPUP_GRID_LEVEL_200,
  164. ID_POPUP_GRID_LEVEL_100,
  165. ID_POPUP_GRID_LEVEL_50,
  166. ID_POPUP_GRID_LEVEL_25,
  167. ID_POPUP_GRID_LEVEL_20,
  168. ID_POPUP_GRID_LEVEL_10,
  169. ID_POPUP_GRID_LEVEL_5,
  170. ID_POPUP_GRID_LEVEL_2,
  171. ID_POPUP_GRID_LEVEL_1,
  172. ID_POPUP_GRID_LEVEL_5MM,
  173. ID_POPUP_GRID_LEVEL_2_5MM,
  174. ID_POPUP_GRID_LEVEL_1MM,
  175. ID_POPUP_GRID_LEVEL_0_5MM,
  176. ID_POPUP_GRID_LEVEL_0_25MM,
  177. ID_POPUP_GRID_LEVEL_0_2MM,
  178. ID_POPUP_GRID_LEVEL_0_1MM,
  179. ID_POPUP_GRID_LEVEL_0_0_5MM,
  180. ID_POPUP_GRID_LEVEL_0_0_25MM,
  181. ID_POPUP_GRID_LEVEL_0_0_1MM,
  182. ID_POPUP_GRID_USER,
  183. ID_POPUP_GRID_SEPARATOR,
  184. ID_POPUP_GRID_SETTINGS,
  185. ID_GRID_SETTINGS,
  186. ID_COMPONENT_BUTT,
  187. ID_ZOOM_BEGIN,
  188. ID_ZOOM_IN = ID_ZOOM_BEGIN,
  189. ID_ZOOM_OUT,
  190. ID_ZOOM_PAGE,
  191. ID_ZOOM_REDRAW,
  192. ID_VIEWER_ZOOM_IN,
  193. ID_VIEWER_ZOOM_OUT,
  194. ID_VIEWER_ZOOM_PAGE,
  195. ID_VIEWER_ZOOM_REDRAW,
  196. // zoom commands for non center zooming
  197. ID_OFFCENTER_ZOOM_IN,
  198. ID_OFFCENTER_ZOOM_OUT,
  199. ID_ZOOM_END,
  200. // Panning command event IDs.
  201. ID_PAN_UP,
  202. ID_PAN_DOWN,
  203. ID_PAN_LEFT,
  204. ID_PAN_RIGHT,
  205. ID_MOUSE_CLICK,
  206. ID_MOUSE_DOUBLECLICK,
  207. ID_FIND_ITEMS,
  208. ID_EDA_SOCKET_EVENT_SERV,
  209. ID_EDA_SOCKET_EVENT,
  210. // Common to all
  211. ID_HELP_GET_INVOLVED,
  212. // Common to Pcbnew and CvPcb
  213. ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
  214. ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
  215. ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH,
  216. ID_TB_OPTIONS_SHOW_PADS_SKETCH,
  217. ID_DIALOG_ERC, ///< eeschema ERC modeless dialog ID
  218. // IDs specifics to a sub-application (Eeschema, Kicad manager....) start here
  219. //
  220. // We reserve here Ids for each sub-application, to avoid duplicate IDs
  221. // between them.
  222. // mainly we experienced issues related to wxUpdateUIEvent calls when 2 (or more) wxFrames
  223. // share the same ID in menus, mainly in menubars/toolbars
  224. // The reason is the fact wxWidgets propagates the wxUpdateUIEvent to all parent windows
  225. // to find wxUpdateUIEvent event functions matching the menuitem IDs found when activate a
  226. // menu in the first frame.
  227. // Reserve ROOM_FOR_KICADMANAGER IDs, for Kicad manager
  228. // Change it if this count is too small.
  229. ID_KICAD_MANAGER_START,
  230. ID_KICAD_MANAGER_END = ID_KICAD_MANAGER_START + ROOM_FOR_KICADMANAGER,
  231. // Reserve ROOM_FOR_KICADMANAGER IDs, for Kicad manager
  232. // Change it if this count is too small.
  233. ID_KICAD_3D_VIEWER_START,
  234. ID_KICAD_3D_VIEWER_END = ID_KICAD_3D_VIEWER_START + ROOM_FOR_3D_VIEWER,
  235. ID_KICAD_PANEL_PREV_MODEL_START,
  236. ID_KICAD_PANEL_PREV_MODEL_END = ID_KICAD_PANEL_PREV_MODEL_START + ROOM_FOR_PANEL_PREV_MODEL,
  237. // Reseve ID for popup menus, when we need to know a menu item is inside a popup menu
  238. ID_POPUP_MENU_START,
  239. ID_POPUP_MENU_END = ID_POPUP_MENU_START + 1000,
  240. ID_END_LIST
  241. };
  242. #endif // ID_H_