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.

220 lines
7.0 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2013-2016 CERN
  5. * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
  6. * @author Maciej Suminski <maciej.suminski@cern.ch>
  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. #ifndef __ACTIONS_H
  26. #define __ACTIONS_H
  27. #include <tool/tool_action.h>
  28. #include <tool/tool_event.h>
  29. #define LEGACY_HK_NAME( x ) x
  30. /**
  31. * Gather all the actions that are shared by tools.
  32. *
  33. * The instance of a subclass of ACTIONS is created inside of #ACTION_MANAGER object that
  34. * registers the actions.
  35. */
  36. class ACTIONS
  37. {
  38. public:
  39. virtual ~ACTIONS() {};
  40. // Generic document actions
  41. static TOOL_ACTION doNew; // sadly 'new' is a reserved word
  42. static TOOL_ACTION newLibrary;
  43. static TOOL_ACTION addLibrary;
  44. static TOOL_ACTION open;
  45. static TOOL_ACTION save;
  46. static TOOL_ACTION saveAs;
  47. static TOOL_ACTION saveCopyAs;
  48. static TOOL_ACTION saveAll;
  49. static TOOL_ACTION revert;
  50. static TOOL_ACTION pageSettings;
  51. static TOOL_ACTION print;
  52. static TOOL_ACTION plot;
  53. static TOOL_ACTION quit;
  54. // Generic edit actions
  55. static TOOL_ACTION cancelInteractive;
  56. static TOOL_ACTION showContextMenu;
  57. static TOOL_ACTION undo;
  58. static TOOL_ACTION redo;
  59. static TOOL_ACTION cut;
  60. static TOOL_ACTION copy;
  61. static TOOL_ACTION paste;
  62. static TOOL_ACTION pasteSpecial;
  63. static TOOL_ACTION selectAll;
  64. static TOOL_ACTION duplicate;
  65. static TOOL_ACTION doDelete; // sadly 'delete' is a reserved word
  66. static TOOL_ACTION deleteTool;
  67. // Find and Replace
  68. static TOOL_ACTION find;
  69. static TOOL_ACTION findAndReplace;
  70. static TOOL_ACTION findNext;
  71. static TOOL_ACTION findNextMarker;
  72. static TOOL_ACTION replaceAndFindNext;
  73. static TOOL_ACTION replaceAll;
  74. static TOOL_ACTION updateFind;
  75. // RC Lists
  76. static TOOL_ACTION prevMarker;
  77. static TOOL_ACTION nextMarker;
  78. static TOOL_ACTION excludeMarker;
  79. // View controls
  80. static TOOL_ACTION zoomRedraw;
  81. static TOOL_ACTION zoomIn;
  82. static TOOL_ACTION zoomOut;
  83. static TOOL_ACTION zoomInCenter;
  84. static TOOL_ACTION zoomOutCenter;
  85. static TOOL_ACTION zoomCenter;
  86. static TOOL_ACTION zoomFitScreen;
  87. static TOOL_ACTION zoomFitObjects; // Zooms to bbox of items on screen (except page border)
  88. static TOOL_ACTION zoomPreset;
  89. static TOOL_ACTION zoomTool;
  90. static TOOL_ACTION centerContents;
  91. static TOOL_ACTION toggleCursor;
  92. static TOOL_ACTION toggleCursorStyle;
  93. static TOOL_ACTION highContrastMode;
  94. static TOOL_ACTION highContrastModeCycle;
  95. static TOOL_ACTION refreshPreview; // Similar to a synthetic mouseMoved event, but also
  96. // used after a rotate, mirror, etc.
  97. static TOOL_ACTION pinLibrary;
  98. static TOOL_ACTION unpinLibrary;
  99. /// Cursor control with keyboard
  100. static TOOL_ACTION cursorUp;
  101. static TOOL_ACTION cursorDown;
  102. static TOOL_ACTION cursorLeft;
  103. static TOOL_ACTION cursorRight;
  104. static TOOL_ACTION cursorUpFast;
  105. static TOOL_ACTION cursorDownFast;
  106. static TOOL_ACTION cursorLeftFast;
  107. static TOOL_ACTION cursorRightFast;
  108. static TOOL_ACTION cursorClick;
  109. static TOOL_ACTION cursorDblClick;
  110. // Panning with keyboard
  111. static TOOL_ACTION panUp;
  112. static TOOL_ACTION panDown;
  113. static TOOL_ACTION panLeft;
  114. static TOOL_ACTION panRight;
  115. // Grid control
  116. static TOOL_ACTION gridFast1;
  117. static TOOL_ACTION gridFast2;
  118. static TOOL_ACTION gridNext;
  119. static TOOL_ACTION gridPrev;
  120. static TOOL_ACTION gridSetOrigin;
  121. static TOOL_ACTION gridResetOrigin;
  122. static TOOL_ACTION gridPreset;
  123. static TOOL_ACTION toggleGrid;
  124. static TOOL_ACTION gridProperties;
  125. // Units
  126. static TOOL_ACTION inchesUnits;
  127. static TOOL_ACTION milsUnits;
  128. static TOOL_ACTION millimetersUnits;
  129. static TOOL_ACTION updateUnits;
  130. static TOOL_ACTION toggleUnits;
  131. static TOOL_ACTION togglePolarCoords;
  132. static TOOL_ACTION resetLocalCoords;
  133. // Common Tools
  134. static TOOL_ACTION selectionTool;
  135. static TOOL_ACTION measureTool;
  136. static TOOL_ACTION pickerTool;
  137. // Misc
  138. static TOOL_ACTION show3DViewer;
  139. static TOOL_ACTION showSymbolBrowser;
  140. static TOOL_ACTION showSymbolEditor;
  141. static TOOL_ACTION showFootprintBrowser;
  142. static TOOL_ACTION showFootprintEditor;
  143. static TOOL_ACTION updatePcbFromSchematic;
  144. static TOOL_ACTION updateSchematicFromPcb;
  145. // Internal
  146. static TOOL_ACTION updateMenu;
  147. static TOOL_ACTION activatePointEditor;
  148. static TOOL_ACTION changeEditMethod;
  149. static TOOL_ACTION updatePreferences;
  150. // Suite
  151. static TOOL_ACTION openPreferences;
  152. static TOOL_ACTION configurePaths;
  153. static TOOL_ACTION showSymbolLibTable;
  154. static TOOL_ACTION showFootprintLibTable;
  155. static TOOL_ACTION gettingStarted;
  156. static TOOL_ACTION help;
  157. static TOOL_ACTION listHotKeys;
  158. static TOOL_ACTION donate;
  159. static TOOL_ACTION getInvolved;
  160. static TOOL_ACTION reportBug;
  161. ///< Cursor control event types
  162. enum CURSOR_EVENT_TYPE { CURSOR_NONE, CURSOR_UP, CURSOR_DOWN, CURSOR_LEFT, CURSOR_RIGHT,
  163. CURSOR_CLICK, CURSOR_DBL_CLICK, CURSOR_RIGHT_CLICK,
  164. CURSOR_FAST_MOVE = 0x8000 };
  165. ///< Remove event modifier flags
  166. enum class REMOVE_FLAGS { NORMAL = 0x00, ALT = 0x01, CUT = 0x02 };
  167. };
  168. /**
  169. * Gather all the events that are shared by tools.
  170. */
  171. class EVENTS
  172. {
  173. public:
  174. const static TOOL_EVENT SelectedEvent;
  175. const static TOOL_EVENT UnselectedEvent;
  176. const static TOOL_EVENT ClearedEvent;
  177. ///< Selected item had a property changed (except movement)
  178. const static TOOL_EVENT SelectedItemsModified;
  179. ///< Selected items were moved, this can be very high frequency on the canvas, use with care
  180. const static TOOL_EVENT SelectedItemsMoved;
  181. ///< Used to inform tools that the selection should temporarily be non-editable
  182. const static TOOL_EVENT InhibitSelectionEditing;
  183. const static TOOL_EVENT UninhibitSelectionEditing;
  184. ///< Used to inform tool that it should display the disambiguation menu
  185. const static TOOL_EVENT DisambiguatePoint;
  186. };
  187. #endif // __ACTIONS_H