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.

197 lines
6.6 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 The 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. * @brief Common command IDs shared by more than one of the KiCad applications.
  29. *
  30. * Only place command IDs used in base window class event tables or shared
  31. * across multiple applications such as the zoom, grid, and language IDs.
  32. * Application specific IDs should be defined in the appropriate header
  33. * file to prevent the entire project from being rebuilt.
  34. *
  35. * However, we must avoid duplicate IDs in menus and toolbar items, when wxUpdateUIEvent
  36. * are associated to menuitems and/or toolbar items
  37. * The reason is the fact wxWidgets try to send a wxUpdateUIEvent event to a given window and,
  38. * if a wxUpdateUIEvent event function is not defined for a menuitem, wxWidgets
  39. * propagates this event ID to parents of the given window.
  40. * Therefore duplicate IDs could create strange behavior in menus and subtle bugs, depending
  41. * on the code inside the wxUpdateUIEvent event functions called in parent frames.
  42. * I did not seen this propagation to child frames, only to parent frames
  43. *
  44. * Issues exist only if 2 menus have the same ID, and only one menu is associated to
  45. * a wxUpdateUIEvent event, and this one is defined in a parent Window.
  46. * The probability it happens is low, but not null.
  47. *
  48. * Therefore we reserve room in ID list for each sub application.
  49. * Please, change these values if needed
  50. */
  51. #ifndef ID_H_
  52. #define ID_H_
  53. #include <wx/defs.h>
  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. /// IDs range for menuitems file history:
  59. /// The default range file history size is 9 (compatible with default wxWidget range).
  60. #define DEFAULT_FILE_HISTORY_SIZE 9
  61. #define MAX_FILE_HISTORY_SIZE 99
  62. enum main_id
  63. {
  64. ID_LOAD_FILE = wxID_HIGHEST,
  65. ID_NEW_BOARD,
  66. ID_SAVE_BOARD,
  67. ID_SAVE_BOARD_AS,
  68. ID_AUTO_SAVE_TIMER,
  69. // ID for menuitems used in our file history management,
  70. // when we do not use wxFILE_ID (restricted to 9 items)
  71. ID_FILE,
  72. ID_FILE1,
  73. ID_FILEMAX = ID_FILE + MAX_FILE_HISTORY_SIZE,
  74. ID_FILE_LIST_EMPTY,
  75. ID_FILE_LIST_CLEAR,
  76. ID_PREFERENCES_RESET_PANEL,
  77. ID_GEN_PLOT,
  78. ID_GEN_PLOT_PS,
  79. ID_GEN_PLOT_HPGL,
  80. ID_GEN_PLOT_GERBER,
  81. ID_GEN_PLOT_SVG,
  82. ID_GEN_PLOT_DXF,
  83. ID_GEN_PLOT_PDF,
  84. // id for toolbars
  85. ID_H_TOOLBAR,
  86. ID_V_TOOLBAR,
  87. ID_OPT_TOOLBAR,
  88. ID_AUX_TOOLBAR,
  89. ID_LANGUAGE_CHOICE,
  90. ID_LANGUAGE_DANISH,
  91. ID_LANGUAGE_DEFAULT,
  92. ID_LANGUAGE_ENGLISH,
  93. ID_LANGUAGE_FRENCH,
  94. ID_LANGUAGE_FINNISH,
  95. ID_LANGUAGE_HEBREW,
  96. ID_LANGUAGE_SPANISH,
  97. ID_LANGUAGE_SPANISH_MEXICAN,
  98. ID_LANGUAGE_GERMAN,
  99. ID_LANGUAGE_GREEK,
  100. ID_LANGUAGE_NORWEGIAN,
  101. ID_LANGUAGE_RUSSIAN,
  102. ID_LANGUAGE_PORTUGUESE,
  103. ID_LANGUAGE_PORTUGUESE_BRAZILIAN,
  104. ID_LANGUAGE_TURKISH,
  105. ID_LANGUAGE_INDONESIAN,
  106. ID_LANGUAGE_ITALIAN,
  107. ID_LANGUAGE_SLOVENIAN,
  108. ID_LANGUAGE_SLOVAK,
  109. ID_LANGUAGE_HUNGARIAN,
  110. ID_LANGUAGE_POLISH,
  111. ID_LANGUAGE_CZECH,
  112. ID_LANGUAGE_KOREAN,
  113. ID_LANGUAGE_CATALAN,
  114. ID_LANGUAGE_CHINESE_SIMPLIFIED,
  115. ID_LANGUAGE_CHINESE_TRADITIONAL,
  116. ID_LANGUAGE_DUTCH,
  117. ID_LANGUAGE_JAPANESE,
  118. ID_LANGUAGE_BULGARIAN,
  119. ID_LANGUAGE_LATVIAN,
  120. ID_LANGUAGE_LITHUANIAN,
  121. ID_LANGUAGE_VIETNAMESE,
  122. ID_LANGUAGE_SERBIAN,
  123. ID_LANGUAGE_THAI,
  124. ID_LANGUAGE_SWEDISH,
  125. ID_LANGUAGE_UKRANIAN,
  126. ID_LANGUAGE_CHOICE_END,
  127. ID_ON_ZOOM_SELECT,
  128. ID_ON_GRID_SELECT,
  129. // Popup Menu (mouse Right button) (id consecutifs)
  130. /* Reserve IDs for popup menu zoom levels. If you need more
  131. * levels of zoom, change ID_POPUP_ZOOM_LEVEL_END. Note that more
  132. * than 15 entries in a context submenu may get too large to display
  133. * cleanly. Add any additional popup zoom IDs above here or the
  134. * zoom event handler will not work properly.
  135. */
  136. ID_POPUP_ZOOM_LEVEL_START,
  137. ID_POPUP_ZOOM_LEVEL_END = ID_POPUP_ZOOM_LEVEL_START + 99,
  138. ID_POPUP_GRID_START,
  139. ID_POPUP_GRID_END = ID_POPUP_ZOOM_LEVEL_START + 99,
  140. // KiFace server for standalone operation
  141. ID_EDA_SOCKET_EVENT_SERV,
  142. ID_EDA_SOCKET_EVENT,
  143. // IDs specifics to a sub-application (Eeschema, Kicad manager....) start here
  144. //
  145. // We reserve here Ids for each sub-application, to avoid duplicate IDs
  146. // between them.
  147. // mainly we experienced issues related to wxUpdateUIEvent calls when 2 (or more) wxFrames
  148. // share the same ID in menus, mainly in menubars/toolbars
  149. // The reason is the fact wxWidgets propagates the wxUpdateUIEvent to all parent windows
  150. // to find wxUpdateUIEvent event functions matching the menuitem IDs found when activate a
  151. // menu in the first frame.
  152. // Reserve ROOM_FOR_KICADMANAGER IDs, for Kicad manager
  153. // Change it if this count is too small.
  154. ID_KICAD_MANAGER_START,
  155. ID_KICAD_MANAGER_END = ID_KICAD_MANAGER_START + ROOM_FOR_KICADMANAGER,
  156. // Reserve ROOM_FOR_KICADMANAGER IDs, for Kicad manager
  157. // Change it if this count is too small.
  158. ID_KICAD_3D_VIEWER_START,
  159. ID_KICAD_3D_VIEWER_END = ID_KICAD_3D_VIEWER_START + ROOM_FOR_3D_VIEWER,
  160. ID_KICAD_PANEL_PREV_MODEL_START,
  161. ID_KICAD_PANEL_PREV_MODEL_END = ID_KICAD_PANEL_PREV_MODEL_START + ROOM_FOR_PANEL_PREV_MODEL,
  162. // Reserve ID for popup menus, when we need to know a menu item is inside a popup menu
  163. ID_POPUP_MENU_START,
  164. // The extra here need to minimum be larger than MAX_BUS_UNFOLD_MENU_ITEMS +
  165. // MAX_UNIT_COUNT_PER_PACKAGE.
  166. // These values are stored in eeschema_id.h
  167. ID_POPUP_MENU_END = ID_POPUP_MENU_START + 2048,
  168. ID_END_LIST
  169. };
  170. #endif // ID_H_