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.

330 lines
11 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2019-2023 CERN
  5. * Copyright The 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. #pragma once
  25. #include <tool/tool_action.h>
  26. #include <tool/actions.h>
  27. class DESIGN_BLOCK;
  28. class SCH_SYMBOL;
  29. class TOOL_EVENT;
  30. class TOOL_MANAGER;
  31. /**
  32. * Gather all the actions that are shared by tools. The instance of SCH_ACTIONS is created
  33. * inside of ACTION_MANAGER object that registers the actions.
  34. */
  35. class SCH_ACTIONS : public ACTIONS
  36. {
  37. public:
  38. // Menu bar save curr sheet as command
  39. static TOOL_ACTION saveCurrSheetCopyAs;
  40. // Selection Tool
  41. /// Select the junction, wire or bus segment under the cursor.
  42. static TOOL_ACTION selectNode;
  43. /// If current selection is a wire or bus, expand to entire connection.
  44. /// Otherwise, select connection under cursor.
  45. static TOOL_ACTION selectConnection;
  46. /// Runs a selection menu to select from a list of items
  47. static TOOL_ACTION selectionMenu;
  48. /// Selection synchronization (PCB -> SCH)
  49. static TOOL_ACTION syncSelection;
  50. // Locking
  51. static TOOL_ACTION toggleLock;
  52. static TOOL_ACTION lock;
  53. static TOOL_ACTION unlock;
  54. // Schematic Tools
  55. static TOOL_ACTION pickerTool;
  56. static TOOL_ACTION placeSymbol;
  57. static TOOL_ACTION placeNextSymbolUnit;
  58. static TOOL_ACTION placePower;
  59. static TOOL_ACTION placeDesignBlock;
  60. static TOOL_ACTION placeLinkedDesignBlock;
  61. static TOOL_ACTION saveToLinkedDesignBlock;
  62. static TOOL_ACTION drawWire;
  63. static TOOL_ACTION drawBus;
  64. static TOOL_ACTION unfoldBus;
  65. static TOOL_ACTION placeNoConnect;
  66. static TOOL_ACTION placeJunction;
  67. static TOOL_ACTION placeBusWireEntry;
  68. static TOOL_ACTION placeLabel;
  69. static TOOL_ACTION placeClassLabel;
  70. static TOOL_ACTION placeGlobalLabel;
  71. static TOOL_ACTION placeHierLabel;
  72. static TOOL_ACTION drawSheet;
  73. static TOOL_ACTION drawSheetFromFile;
  74. static TOOL_ACTION drawSheetFromDesignBlock;
  75. static TOOL_ACTION placeSheetPin;
  76. static TOOL_ACTION autoplaceAllSheetPins;
  77. static TOOL_ACTION importSheet;
  78. // Sync sheet pins for selected sheet symbol
  79. static TOOL_ACTION syncSheetPins;
  80. // Sync sheet pins for all sheet symbols
  81. static TOOL_ACTION syncAllSheetsPins;
  82. static TOOL_ACTION placeSchematicText;
  83. static TOOL_ACTION drawTextBox;
  84. static TOOL_ACTION drawTable;
  85. static TOOL_ACTION drawRectangle;
  86. static TOOL_ACTION drawCircle;
  87. static TOOL_ACTION drawArc;
  88. static TOOL_ACTION drawBezier;
  89. static TOOL_ACTION drawLines;
  90. static TOOL_ACTION placeImage;
  91. static TOOL_ACTION undoLastSegment;
  92. static TOOL_ACTION switchSegmentPosture;
  93. static TOOL_ACTION drawRuleArea;
  94. static TOOL_ACTION deleteLastPoint;
  95. static TOOL_ACTION closeOutline;
  96. // Symbol Tools
  97. static TOOL_ACTION placeSymbolPin;
  98. static TOOL_ACTION placeSymbolText;
  99. static TOOL_ACTION drawSymbolTextBox;
  100. static TOOL_ACTION drawSymbolLines;
  101. static TOOL_ACTION drawSymbolPolygon;
  102. static TOOL_ACTION placeSymbolAnchor;
  103. // Interactive Editing
  104. static TOOL_ACTION alignToGrid;
  105. static TOOL_ACTION move;
  106. static TOOL_ACTION drag;
  107. static TOOL_ACTION repeatDrawItem;
  108. static TOOL_ACTION rotateCW;
  109. static TOOL_ACTION rotateCCW;
  110. static TOOL_ACTION mirrorV;
  111. static TOOL_ACTION mirrorH;
  112. static TOOL_ACTION swap;
  113. static TOOL_ACTION swapPinLabels;
  114. static TOOL_ACTION swapUnitLabels;
  115. static TOOL_ACTION properties;
  116. static TOOL_ACTION editReference;
  117. static TOOL_ACTION editValue;
  118. static TOOL_ACTION editFootprint;
  119. static TOOL_ACTION autoplaceFields;
  120. static TOOL_ACTION cycleBodyStyle;
  121. static TOOL_ACTION editSymbolUnit;
  122. static TOOL_ACTION toLabel;
  123. static TOOL_ACTION toDLabel;
  124. static TOOL_ACTION toHLabel;
  125. static TOOL_ACTION toGLabel;
  126. static TOOL_ACTION toText;
  127. static TOOL_ACTION toTextBox;
  128. static TOOL_ACTION breakWire;
  129. static TOOL_ACTION slice;
  130. static TOOL_ACTION pointEditorAddCorner;
  131. static TOOL_ACTION pointEditorRemoveCorner;
  132. /// Inspection and Editing
  133. static TOOL_ACTION runERC;
  134. static TOOL_ACTION annotate;
  135. static TOOL_ACTION incrementAnnotations;
  136. static TOOL_ACTION editSymbolFields;
  137. static TOOL_ACTION editSymbolLibraryLinks;
  138. static TOOL_ACTION symbolProperties;
  139. static TOOL_ACTION pinTable;
  140. static TOOL_ACTION convertStackedPins;
  141. static TOOL_ACTION explodeStackedPin;
  142. static TOOL_ACTION changeSymbols;
  143. static TOOL_ACTION updateSymbols;
  144. static TOOL_ACTION changeSymbol;
  145. static TOOL_ACTION updateSymbol;
  146. static TOOL_ACTION assignFootprints;
  147. static TOOL_ACTION assignNetclass;
  148. static TOOL_ACTION schematicSetup;
  149. static TOOL_ACTION editPageNumber;
  150. static TOOL_ACTION checkSymbol;
  151. static TOOL_ACTION diffSymbol;
  152. static TOOL_ACTION showBusSyntaxHelp;
  153. static TOOL_ACTION rescueSymbols;
  154. static TOOL_ACTION remapSymbols;
  155. static TOOL_ACTION nextNetItem;
  156. static TOOL_ACTION previousNetItem;
  157. // Suite operations
  158. static TOOL_ACTION editWithLibEdit;
  159. static TOOL_ACTION editLibSymbolWithLibEdit;
  160. static TOOL_ACTION showPcbNew;
  161. static TOOL_ACTION importFPAssignments;
  162. static TOOL_ACTION exportNetlist;
  163. static TOOL_ACTION generateBOM;
  164. static TOOL_ACTION generateBOMLegacy;
  165. static TOOL_ACTION generateBOMExternal;
  166. static TOOL_ACTION addSymbolToSchematic;
  167. static TOOL_ACTION exportSymbolsToLibrary;
  168. // Variant operations
  169. static TOOL_ACTION addVariant;
  170. static TOOL_ACTION removeVariant;
  171. // Attribute Toggles
  172. static TOOL_ACTION setExcludeFromBOM;
  173. static TOOL_ACTION setExcludeFromSimulation;
  174. static TOOL_ACTION setExcludeFromBoard;
  175. static TOOL_ACTION setDNP;
  176. // Design Block management
  177. static TOOL_ACTION showDesignBlockPanel;
  178. static TOOL_ACTION saveSheetAsDesignBlock;
  179. static TOOL_ACTION saveSelectionAsDesignBlock;
  180. static TOOL_ACTION saveSheetToDesignBlock;
  181. static TOOL_ACTION saveSelectionToDesignBlock;
  182. static TOOL_ACTION deleteDesignBlock;
  183. static TOOL_ACTION editDesignBlockProperties;
  184. // Library management
  185. static TOOL_ACTION saveLibraryAs;
  186. static TOOL_ACTION saveSymbolAs;
  187. static TOOL_ACTION saveSymbolCopyAs;
  188. static TOOL_ACTION newSymbol;
  189. static TOOL_ACTION deriveFromExistingSymbol;
  190. static TOOL_ACTION editSymbol;
  191. static TOOL_ACTION duplicateSymbol;
  192. static TOOL_ACTION renameSymbol;
  193. static TOOL_ACTION deleteSymbol;
  194. static TOOL_ACTION cutSymbol;
  195. static TOOL_ACTION copySymbol;
  196. static TOOL_ACTION pasteSymbol;
  197. static TOOL_ACTION importSymbol;
  198. static TOOL_ACTION exportSymbol;
  199. static TOOL_ACTION updateSymbolFields;
  200. static TOOL_ACTION flattenSymbol;
  201. // Hierarchy navigation
  202. static TOOL_ACTION changeSheet;
  203. static TOOL_ACTION enterSheet;
  204. static TOOL_ACTION leaveSheet;
  205. static TOOL_ACTION navigateUp;
  206. static TOOL_ACTION navigateForward;
  207. static TOOL_ACTION navigateBack;
  208. static TOOL_ACTION navigatePrevious;
  209. static TOOL_ACTION navigateNext;
  210. static TOOL_ACTION showHierarchy;
  211. static TOOL_ACTION hypertextCommand;
  212. // Global edit tools
  213. static TOOL_ACTION cleanupSheetPins;
  214. static TOOL_ACTION editTextAndGraphics;
  215. // Miscellaneous
  216. static TOOL_ACTION toggleHiddenPins;
  217. static TOOL_ACTION toggleHiddenFields;
  218. static TOOL_ACTION showHiddenPins;
  219. static TOOL_ACTION showHiddenFields;
  220. static TOOL_ACTION toggleDirectiveLabels;
  221. static TOOL_ACTION toggleERCWarnings;
  222. static TOOL_ACTION toggleERCErrors;
  223. static TOOL_ACTION toggleERCExclusions;
  224. static TOOL_ACTION markSimExclusions;
  225. static TOOL_ACTION toggleOPVoltages;
  226. static TOOL_ACTION toggleOPCurrents;
  227. static TOOL_ACTION togglePinAltIcons;
  228. static TOOL_ACTION toggleSyncedPinsMode;
  229. static TOOL_ACTION restartMove;
  230. static TOOL_ACTION selectOnPCB;
  231. static TOOL_ACTION pushPinLength;
  232. static TOOL_ACTION pushPinNameSize;
  233. static TOOL_ACTION pushPinNumSize;
  234. static TOOL_ACTION showElectricalTypes;
  235. static TOOL_ACTION showPinNumbers;
  236. static TOOL_ACTION symbolTreeSearch;
  237. static TOOL_ACTION drawSheetOnClipboard;
  238. static TOOL_ACTION importGraphics;
  239. static TOOL_ACTION exportSymbolView;
  240. static TOOL_ACTION exportSymbolAsSVG;
  241. static TOOL_ACTION showPythonConsole;
  242. static TOOL_ACTION repairSchematic;
  243. static TOOL_ACTION previousUnit;
  244. static TOOL_ACTION nextUnit;
  245. // Line modes
  246. static TOOL_ACTION lineModeFree;
  247. static TOOL_ACTION lineMode90;
  248. static TOOL_ACTION lineMode45;
  249. static TOOL_ACTION lineModeNext;
  250. // Notify listeners when angle snap/line mode changes
  251. static TOOL_ACTION angleSnapModeChanged;
  252. // Annotation
  253. static TOOL_ACTION toggleAnnotateAuto;
  254. // SPICE
  255. static TOOL_ACTION newAnalysisTab;
  256. static TOOL_ACTION openWorkbook;
  257. static TOOL_ACTION saveWorkbook;
  258. static TOOL_ACTION saveWorkbookAs;
  259. static TOOL_ACTION exportPlotAsPNG;
  260. static TOOL_ACTION exportPlotAsCSV;
  261. static TOOL_ACTION exportPlotToClipboard;
  262. static TOOL_ACTION exportPlotToSchematic;
  263. static TOOL_ACTION showSimulator;
  264. static TOOL_ACTION simProbe;
  265. static TOOL_ACTION simTune;
  266. static TOOL_ACTION toggleSimConsole;
  267. static TOOL_ACTION toggleSimSidePanel;
  268. static TOOL_ACTION toggleLegend;
  269. static TOOL_ACTION toggleDottedSecondary;
  270. static TOOL_ACTION toggleDarkModePlots;
  271. static TOOL_ACTION simAnalysisProperties;
  272. static TOOL_ACTION runSimulation;
  273. static TOOL_ACTION stopSimulation;
  274. static TOOL_ACTION editUserDefinedSignals;
  275. static TOOL_ACTION showNetlist;
  276. // Net highlighting
  277. static TOOL_ACTION highlightNet;
  278. static TOOL_ACTION clearHighlight;
  279. static TOOL_ACTION updateNetHighlighting;
  280. static TOOL_ACTION highlightNetTool;
  281. static TOOL_ACTION showNetNavigator;
  282. // Drag and drop
  283. static TOOL_ACTION ddAppendFile;
  284. static TOOL_ACTION ddAddImage;
  285. static TOOL_ACTION ddImportGraphics;
  286. struct PLACE_SYMBOL_PARAMS
  287. {
  288. ///< Provide a symbol to place
  289. SCH_SYMBOL* m_Symbol = nullptr;
  290. ///< If a symbol is provide, reannotate it?
  291. bool m_Reannotate = true;
  292. };
  293. struct PLACE_SYMBOL_UNIT_PARAMS
  294. {
  295. ///< Symbol used as reference for unit placement
  296. SCH_SYMBOL* m_Symbol = nullptr;
  297. ///< Unit number to place; 0 means next available unit
  298. int m_Unit = 0;
  299. };
  300. };