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.

241 lines
7.5 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 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. extern char g_lastBusEntryShape;
  32. /**
  33. * EESCHEMA_ACTIONS
  34. *
  35. * Gathers all the actions that are shared by tools. The instance of SCH_ACTIONS is created
  36. * inside of ACTION_MANAGER object that registers the actions.
  37. */
  38. class EE_ACTIONS : public ACTIONS
  39. {
  40. public:
  41. // Selection Tool
  42. /// Activation of the selection tool
  43. static TOOL_ACTION selectionActivate;
  44. /// Select the junction, wire or bus segment under the cursor.
  45. static TOOL_ACTION selectNode;
  46. /// If current selection is a wire or bus, expand to entire connection.
  47. /// Otherwise, select connection under cursor.
  48. static TOOL_ACTION selectConnection;
  49. /// Clears the current selection
  50. static TOOL_ACTION clearSelection;
  51. /// Selects an item (specified as the event parameter).
  52. static TOOL_ACTION addItemToSel;
  53. static TOOL_ACTION removeItemFromSel;
  54. /// Selects a list of items (specified as the event parameter)
  55. static TOOL_ACTION addItemsToSel;
  56. static TOOL_ACTION removeItemsFromSel;
  57. /// Runs a selection menu to select from a list of items
  58. static TOOL_ACTION selectionMenu;
  59. // Locking
  60. static TOOL_ACTION toggleLock;
  61. static TOOL_ACTION lock;
  62. static TOOL_ACTION unlock;
  63. // Schematic Tools
  64. static TOOL_ACTION addNeededJunctions;
  65. static TOOL_ACTION pickerTool;
  66. static TOOL_ACTION placeSymbol;
  67. static TOOL_ACTION placePower;
  68. static TOOL_ACTION drawWire;
  69. static TOOL_ACTION drawBus;
  70. static TOOL_ACTION unfoldBus;
  71. static TOOL_ACTION placeNoConnect;
  72. static TOOL_ACTION placeJunction;
  73. static TOOL_ACTION placeBusWireEntry;
  74. static TOOL_ACTION placeBusBusEntry;
  75. static TOOL_ACTION placeLabel;
  76. static TOOL_ACTION placeGlobalLabel;
  77. static TOOL_ACTION placeHierLabel;
  78. static TOOL_ACTION drawSheet;
  79. static TOOL_ACTION placeSheetPin;
  80. static TOOL_ACTION importSheetPin;
  81. static TOOL_ACTION placeSchematicText;
  82. static TOOL_ACTION drawLines;
  83. static TOOL_ACTION placeImage;
  84. static TOOL_ACTION finishLineWireOrBus;
  85. static TOOL_ACTION finishWire;
  86. static TOOL_ACTION finishBus;
  87. static TOOL_ACTION finishLine;
  88. static TOOL_ACTION finishSheet;
  89. // Symbol Tools
  90. static TOOL_ACTION placeSymbolPin;
  91. static TOOL_ACTION placeSymbolText;
  92. static TOOL_ACTION drawSymbolRectangle;
  93. static TOOL_ACTION drawSymbolCircle;
  94. static TOOL_ACTION drawSymbolArc;
  95. static TOOL_ACTION drawSymbolLines;
  96. static TOOL_ACTION placeSymbolAnchor;
  97. static TOOL_ACTION finishDrawing;
  98. // Interactive Editing
  99. static TOOL_ACTION symbolMoveActivate; // Symbol editor move tool activate
  100. static TOOL_ACTION moveActivate; // Schematic editor move tool activate
  101. static TOOL_ACTION move;
  102. static TOOL_ACTION drag;
  103. static TOOL_ACTION repeatDrawItem;
  104. static TOOL_ACTION rotateCW;
  105. static TOOL_ACTION rotateCCW;
  106. static TOOL_ACTION mirrorX;
  107. static TOOL_ACTION mirrorY;
  108. static TOOL_ACTION properties;
  109. static TOOL_ACTION editReference;
  110. static TOOL_ACTION editValue;
  111. static TOOL_ACTION editFootprint;
  112. static TOOL_ACTION autoplaceFields;
  113. static TOOL_ACTION toggleDeMorgan;
  114. static TOOL_ACTION showDeMorganStandard;
  115. static TOOL_ACTION showDeMorganAlternate;
  116. static TOOL_ACTION editSymbolUnit;
  117. static TOOL_ACTION toShapeSlash;
  118. static TOOL_ACTION toShapeBackslash;
  119. static TOOL_ACTION toLabel;
  120. static TOOL_ACTION toHLabel;
  121. static TOOL_ACTION toGLabel;
  122. static TOOL_ACTION toText;
  123. static TOOL_ACTION breakWire;
  124. static TOOL_ACTION breakBus;
  125. static TOOL_ACTION pointEditorAddCorner;
  126. static TOOL_ACTION pointEditorRemoveCorner;
  127. /// Inspection and Editing
  128. static TOOL_ACTION showDatasheet;
  129. static TOOL_ACTION runERC;
  130. static TOOL_ACTION annotate;
  131. static TOOL_ACTION editSymbolFields;
  132. static TOOL_ACTION editSymbolLibraryLinks;
  133. static TOOL_ACTION symbolProperties;
  134. static TOOL_ACTION pinTable;
  135. static TOOL_ACTION updateFieldsFromLibrary;
  136. static TOOL_ACTION assignFootprints;
  137. static TOOL_ACTION showBusManager;
  138. static TOOL_ACTION schematicSetup;
  139. static TOOL_ACTION rescueSymbols;
  140. static TOOL_ACTION remapSymbols;
  141. // Suite operations
  142. static TOOL_ACTION editWithLibEdit;
  143. static TOOL_ACTION showPcbNew;
  144. static TOOL_ACTION importFPAssignments;
  145. static TOOL_ACTION exportNetlist;
  146. static TOOL_ACTION generateBOM;
  147. static TOOL_ACTION runSimulation;
  148. static TOOL_ACTION addSymbolToSchematic;
  149. // Library management
  150. static TOOL_ACTION newSymbol;
  151. static TOOL_ACTION editSymbol;
  152. static TOOL_ACTION duplicateSymbol;
  153. static TOOL_ACTION deleteSymbol;
  154. static TOOL_ACTION cutSymbol;
  155. static TOOL_ACTION copySymbol;
  156. static TOOL_ACTION pasteSymbol;
  157. static TOOL_ACTION importSymbol;
  158. static TOOL_ACTION exportSymbol;
  159. // Hierarchy navigation
  160. static TOOL_ACTION enterSheet;
  161. static TOOL_ACTION leaveSheet;
  162. static TOOL_ACTION navigateHierarchy;
  163. // Miscellaneous
  164. static TOOL_ACTION cleanupSheetPins;
  165. static TOOL_ACTION editTextAndGraphics;
  166. static TOOL_ACTION toggleHiddenPins;
  167. static TOOL_ACTION toggleHiddenFields;
  168. static TOOL_ACTION toggleSyncedPinsMode;
  169. static TOOL_ACTION restartMove;
  170. static TOOL_ACTION explicitCrossProbe;
  171. static TOOL_ACTION pushPinLength;
  172. static TOOL_ACTION pushPinNameSize;
  173. static TOOL_ACTION pushPinNumSize;
  174. static TOOL_ACTION showElectricalTypes;
  175. static TOOL_ACTION showComponentTree;
  176. static TOOL_ACTION toggleForceHV;
  177. static TOOL_ACTION drawSheetOnClipboard;
  178. static TOOL_ACTION exportSymbolView;
  179. static TOOL_ACTION exportSymbolAsSVG;
  180. // SPICE
  181. static TOOL_ACTION simProbe;
  182. static TOOL_ACTION simTune;
  183. // Net highlighting
  184. static TOOL_ACTION highlightNet;
  185. static TOOL_ACTION clearHighlight;
  186. static TOOL_ACTION updateNetHighlighting;
  187. static TOOL_ACTION highlightNetTool;
  188. ///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
  189. virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override
  190. {
  191. return OPT<TOOL_EVENT>();
  192. }
  193. };
  194. //
  195. // For LibEdit
  196. //
  197. inline VECTOR2I mapCoords( const wxPoint& aCoord )
  198. {
  199. return VECTOR2I( aCoord.x, -aCoord.y );
  200. }
  201. inline wxPoint mapCoords( const VECTOR2I& aCoord )
  202. {
  203. return wxPoint( aCoord.x, -aCoord.y );
  204. }
  205. inline wxPoint mapCoords( const int x, const int y )
  206. {
  207. return wxPoint( x, -y );
  208. }
  209. #endif