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.

209 lines
6.4 KiB

6 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, you may find one here:
  18. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. * or you may search the http://www.gnu.org website for the version 2 license,
  20. * or you may write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  22. */
  23. #ifndef EESCHEMA_ACTIONS_H
  24. #define EESCHEMA_ACTIONS_H
  25. #include <tool/tool_action.h>
  26. #include <tool/actions.h>
  27. #include <core/optional.h>
  28. class TOOL_EVENT;
  29. class TOOL_MANAGER;
  30. extern char g_lastBusEntryShape;
  31. /**
  32. * Class 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 selectionTool;
  64. static TOOL_ACTION pickerTool;
  65. static TOOL_ACTION placeSymbol;
  66. static TOOL_ACTION placePower;
  67. static TOOL_ACTION startWire;
  68. static TOOL_ACTION drawWire;
  69. static TOOL_ACTION startBus;
  70. static TOOL_ACTION drawBus;
  71. static TOOL_ACTION unfoldBus;
  72. static TOOL_ACTION placeNoConnect;
  73. static TOOL_ACTION placeJunction;
  74. static TOOL_ACTION placeBusWireEntry;
  75. static TOOL_ACTION placeBusBusEntry;
  76. static TOOL_ACTION placeLabel;
  77. static TOOL_ACTION placeGlobalLabel;
  78. static TOOL_ACTION placeHierarchicalLabel;
  79. static TOOL_ACTION drawSheet;
  80. static TOOL_ACTION placeSheetPin;
  81. static TOOL_ACTION importSheetPin;
  82. static TOOL_ACTION placeSchematicText;
  83. static TOOL_ACTION startLines;
  84. static TOOL_ACTION drawLines;
  85. static TOOL_ACTION placeImage;
  86. static TOOL_ACTION finishLineWireOrBus;
  87. static TOOL_ACTION finishWire;
  88. static TOOL_ACTION finishBus;
  89. static TOOL_ACTION finishLine;
  90. static TOOL_ACTION finishSheet;
  91. // Symbol Tools
  92. static TOOL_ACTION placeSymbolPin;
  93. static TOOL_ACTION placeSymbolText;
  94. static TOOL_ACTION drawSymbolRectangle;
  95. static TOOL_ACTION drawSymbolCircle;
  96. static TOOL_ACTION drawSymbolArc;
  97. static TOOL_ACTION drawSymbolLines;
  98. static TOOL_ACTION placeSymbolAnchor;
  99. static TOOL_ACTION finishDrawing;
  100. // Editing
  101. static TOOL_ACTION moveActivate;
  102. static TOOL_ACTION move;
  103. static TOOL_ACTION drag;
  104. static TOOL_ACTION repeatDrawItem;
  105. static TOOL_ACTION rotateCW;
  106. static TOOL_ACTION rotateCCW;
  107. static TOOL_ACTION mirrorX;
  108. static TOOL_ACTION mirrorY;
  109. static TOOL_ACTION properties;
  110. static TOOL_ACTION editReference;
  111. static TOOL_ACTION editValue;
  112. static TOOL_ACTION editFootprint;
  113. static TOOL_ACTION autoplaceFields;
  114. static TOOL_ACTION convertDeMorgan;
  115. static TOOL_ACTION editSymbolUnit;
  116. static TOOL_ACTION addJunction;
  117. static TOOL_ACTION addLabel;
  118. static TOOL_ACTION addGlobalLabel;
  119. static TOOL_ACTION addHierLabel;
  120. static TOOL_ACTION addSheetPin;
  121. static TOOL_ACTION addImportedSheetPin;
  122. static TOOL_ACTION toShapeSlash;
  123. static TOOL_ACTION toShapeBackslash;
  124. static TOOL_ACTION toLabel;
  125. static TOOL_ACTION toHLabel;
  126. static TOOL_ACTION toGLabel;
  127. static TOOL_ACTION toText;
  128. static TOOL_ACTION breakWire;
  129. static TOOL_ACTION breakBus;
  130. static TOOL_ACTION pointEditorAddCorner;
  131. static TOOL_ACTION pointEditorRemoveCorner;
  132. /// Inspection
  133. static TOOL_ACTION showDatasheet;
  134. static TOOL_ACTION showMarkerInfo;
  135. static TOOL_ACTION showSymbolEditor;
  136. static TOOL_ACTION editWithLibEdit;
  137. static TOOL_ACTION showLibraryBrowser;
  138. // Miscellaneous
  139. static TOOL_ACTION enterSheet;
  140. static TOOL_ACTION leaveSheet;
  141. static TOOL_ACTION navigateHierarchy;
  142. static TOOL_ACTION cleanupSheetPins;
  143. static TOOL_ACTION toggleHiddenPins;
  144. static TOOL_ACTION symbolProperties;
  145. static TOOL_ACTION pinTable;
  146. static TOOL_ACTION deleteItemCursor;
  147. static TOOL_ACTION refreshPreview;
  148. static TOOL_ACTION explicitCrossProbe;
  149. static TOOL_ACTION pushPinLength;
  150. static TOOL_ACTION pushPinNameSize;
  151. static TOOL_ACTION pushPinNumSize;
  152. static TOOL_ACTION showElectricalTypes;
  153. static TOOL_ACTION showComponentTree;
  154. static TOOL_ACTION toggleForceHV;
  155. // SPICE
  156. static TOOL_ACTION simProbe;
  157. static TOOL_ACTION simTune;
  158. // Net highlighting
  159. static TOOL_ACTION highlightNet;
  160. static TOOL_ACTION clearHighlight;
  161. static TOOL_ACTION updateNetHighlighting;
  162. static TOOL_ACTION highlightNetCursor;
  163. ///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
  164. virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override;
  165. };
  166. //
  167. // For LibEdit
  168. //
  169. inline VECTOR2I mapCoords( const wxPoint& aCoord )
  170. {
  171. return VECTOR2I( aCoord.x, -aCoord.y );
  172. }
  173. inline wxPoint mapCoords( const VECTOR2I& aCoord )
  174. {
  175. return wxPoint( aCoord.x, -aCoord.y );
  176. }
  177. inline wxPoint mapCoords( const int x, const int y )
  178. {
  179. return wxPoint( x, -y );
  180. }
  181. #endif