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.

249 lines
7.8 KiB

7 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2019 CERN
  5. * Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. #ifndef EESCHEMA_ACTIONS_H
  25. #define EESCHEMA_ACTIONS_H
  26. #include <tool/tool_action.h>
  27. #include <tool/actions.h>
  28. #include <core/optional.h>
  29. class TOOL_EVENT;
  30. class TOOL_MANAGER;
  31. /**
  32. * EESCHEMA_ACTIONS
  33. *
  34. * Gathers all the actions that are shared by tools. The instance of SCH_ACTIONS is created
  35. * inside of ACTION_MANAGER object that registers the actions.
  36. */
  37. class EE_ACTIONS : public ACTIONS
  38. {
  39. public:
  40. // Selection Tool
  41. /// Activation of the selection tool
  42. static TOOL_ACTION selectionActivate;
  43. /// Select the junction, wire or bus segment under the cursor.
  44. static TOOL_ACTION selectNode;
  45. /// If current selection is a wire or bus, expand to entire connection.
  46. /// Otherwise, select connection under cursor.
  47. static TOOL_ACTION selectConnection;
  48. /// Clears the current selection
  49. static TOOL_ACTION clearSelection;
  50. /// Selects an item (specified as the event parameter).
  51. static TOOL_ACTION addItemToSel;
  52. static TOOL_ACTION removeItemFromSel;
  53. /// Selects a list of items (specified as the event parameter)
  54. static TOOL_ACTION addItemsToSel;
  55. static TOOL_ACTION removeItemsFromSel;
  56. /// Runs a selection menu to select from a list of items
  57. static TOOL_ACTION selectionMenu;
  58. // Locking
  59. static TOOL_ACTION toggleLock;
  60. static TOOL_ACTION lock;
  61. static TOOL_ACTION unlock;
  62. // Schematic Tools
  63. static TOOL_ACTION addNeededJunctions;
  64. static TOOL_ACTION pickerTool;
  65. static TOOL_ACTION placeSymbol;
  66. static TOOL_ACTION placePower;
  67. static TOOL_ACTION drawWire;
  68. static TOOL_ACTION drawBus;
  69. static TOOL_ACTION unfoldBus;
  70. static TOOL_ACTION placeNoConnect;
  71. static TOOL_ACTION placeJunction;
  72. static TOOL_ACTION placeBusWireEntry;
  73. static TOOL_ACTION placeLabel;
  74. static TOOL_ACTION placeGlobalLabel;
  75. static TOOL_ACTION placeHierLabel;
  76. static TOOL_ACTION drawSheet;
  77. static TOOL_ACTION placeSheetPin;
  78. static TOOL_ACTION importSheetPin;
  79. static TOOL_ACTION placeSchematicText;
  80. static TOOL_ACTION drawLines;
  81. static TOOL_ACTION placeImage;
  82. static TOOL_ACTION finishLineWireOrBus;
  83. static TOOL_ACTION finishWire;
  84. static TOOL_ACTION finishBus;
  85. static TOOL_ACTION finishLine;
  86. static TOOL_ACTION finishSheet;
  87. // Symbol Tools
  88. static TOOL_ACTION placeSymbolPin;
  89. static TOOL_ACTION placeSymbolText;
  90. static TOOL_ACTION drawSymbolRectangle;
  91. static TOOL_ACTION drawSymbolCircle;
  92. static TOOL_ACTION drawSymbolArc;
  93. static TOOL_ACTION drawSymbolLines;
  94. static TOOL_ACTION placeSymbolAnchor;
  95. static TOOL_ACTION finishDrawing;
  96. // Interactive Editing
  97. static TOOL_ACTION alignToGrid;
  98. static TOOL_ACTION symbolMoveActivate; // Symbol editor move tool activate
  99. static TOOL_ACTION moveActivate; // Schematic editor move tool activate
  100. static TOOL_ACTION move;
  101. static TOOL_ACTION drag;
  102. static TOOL_ACTION repeatDrawItem;
  103. static TOOL_ACTION rotateCW;
  104. static TOOL_ACTION rotateCCW;
  105. static TOOL_ACTION mirrorX;
  106. static TOOL_ACTION mirrorY;
  107. static TOOL_ACTION properties;
  108. static TOOL_ACTION editReference;
  109. static TOOL_ACTION editValue;
  110. static TOOL_ACTION editFootprint;
  111. static TOOL_ACTION autoplaceFields;
  112. static TOOL_ACTION toggleDeMorgan;
  113. static TOOL_ACTION showDeMorganStandard;
  114. static TOOL_ACTION showDeMorganAlternate;
  115. static TOOL_ACTION editSymbolUnit;
  116. static TOOL_ACTION toLabel;
  117. static TOOL_ACTION toHLabel;
  118. static TOOL_ACTION toGLabel;
  119. static TOOL_ACTION toText;
  120. static TOOL_ACTION breakWire;
  121. static TOOL_ACTION breakBus;
  122. static TOOL_ACTION pointEditorAddCorner;
  123. static TOOL_ACTION pointEditorRemoveCorner;
  124. /// Inspection and Editing
  125. static TOOL_ACTION showDatasheet;
  126. static TOOL_ACTION runERC;
  127. static TOOL_ACTION annotate;
  128. static TOOL_ACTION editSymbolFields;
  129. static TOOL_ACTION editSymbolLibraryLinks;
  130. static TOOL_ACTION symbolProperties;
  131. static TOOL_ACTION pinTable;
  132. static TOOL_ACTION changeSymbols;
  133. static TOOL_ACTION updateSymbols;
  134. static TOOL_ACTION changeSymbol;
  135. static TOOL_ACTION updateSymbol;
  136. static TOOL_ACTION assignFootprints;
  137. static TOOL_ACTION assignNetclass;
  138. static TOOL_ACTION showBusManager;
  139. static TOOL_ACTION schematicSetup;
  140. static TOOL_ACTION editPageNumber;
  141. static TOOL_ACTION checkSymbol;
  142. static TOOL_ACTION rescueSymbols;
  143. static TOOL_ACTION remapSymbols;
  144. // Suite operations
  145. static TOOL_ACTION editWithLibEdit;
  146. static TOOL_ACTION showPcbNew;
  147. static TOOL_ACTION importFPAssignments;
  148. static TOOL_ACTION exportNetlist;
  149. static TOOL_ACTION generateBOM;
  150. static TOOL_ACTION addSymbolToSchematic;
  151. // Library management
  152. static TOOL_ACTION newSymbol;
  153. static TOOL_ACTION editSymbol;
  154. static TOOL_ACTION duplicateSymbol;
  155. static TOOL_ACTION deleteSymbol;
  156. static TOOL_ACTION cutSymbol;
  157. static TOOL_ACTION copySymbol;
  158. static TOOL_ACTION pasteSymbol;
  159. static TOOL_ACTION importSymbol;
  160. static TOOL_ACTION exportSymbol;
  161. // Library editor tool actions
  162. static TOOL_ACTION saveInSchematic;
  163. // Hierarchy navigation
  164. static TOOL_ACTION enterSheet;
  165. static TOOL_ACTION leaveSheet;
  166. static TOOL_ACTION navigateHierarchy;
  167. static TOOL_ACTION hypertextCommand;
  168. // Global edit tools
  169. static TOOL_ACTION cleanupSheetPins;
  170. static TOOL_ACTION editTextAndGraphics;
  171. // Miscellaneous
  172. static TOOL_ACTION toggleHiddenPins;
  173. static TOOL_ACTION toggleHiddenFields;
  174. static TOOL_ACTION toggleSyncedPinsMode;
  175. static TOOL_ACTION restartMove;
  176. static TOOL_ACTION explicitCrossProbe;
  177. static TOOL_ACTION pushPinLength;
  178. static TOOL_ACTION pushPinNameSize;
  179. static TOOL_ACTION pushPinNumSize;
  180. static TOOL_ACTION showElectricalTypes;
  181. static TOOL_ACTION showComponentTree;
  182. static TOOL_ACTION toggleForceHV;
  183. static TOOL_ACTION drawSheetOnClipboard;
  184. static TOOL_ACTION exportSymbolView;
  185. static TOOL_ACTION exportSymbolAsSVG;
  186. // SPICE
  187. static TOOL_ACTION runSimulation;
  188. static TOOL_ACTION simProbe;
  189. static TOOL_ACTION simTune;
  190. // Net highlighting
  191. static TOOL_ACTION highlightNet;
  192. static TOOL_ACTION clearHighlight;
  193. static TOOL_ACTION updateNetHighlighting;
  194. static TOOL_ACTION highlightNetTool;
  195. ///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
  196. virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override
  197. {
  198. return OPT<TOOL_EVENT>();
  199. }
  200. };
  201. //
  202. // For LibEdit
  203. //
  204. inline VECTOR2I mapCoords( const wxPoint& aCoord )
  205. {
  206. return VECTOR2I( aCoord.x, -aCoord.y );
  207. }
  208. inline wxPoint mapCoords( const VECTOR2I& aCoord )
  209. {
  210. return wxPoint( aCoord.x, -aCoord.y );
  211. }
  212. inline wxPoint mapCoords( const int x, const int y )
  213. {
  214. return wxPoint( x, -y );
  215. }
  216. #endif