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.

206 lines
6.5 KiB

11 years ago
11 years ago
11 years ago
  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 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. #include "pcb_actions.h"
  26. #include <pcbnew_id.h>
  27. OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
  28. {
  29. switch( aId )
  30. {
  31. case ID_PCB_MODULE_BUTT:
  32. return PCB_ACTIONS::placeModule.MakeEvent();
  33. case ID_TRACK_BUTT:
  34. return PCB_ACTIONS::routerActivateSingle.MakeEvent();
  35. case ID_DIFF_PAIR_BUTT:
  36. return PCB_ACTIONS::routerActivateDiffPair.MakeEvent();
  37. case ID_TUNE_SINGLE_TRACK_LEN_BUTT:
  38. return PCB_ACTIONS::routerActivateTuneSingleTrace.MakeEvent();
  39. case ID_TUNE_DIFF_PAIR_LEN_BUTT:
  40. return PCB_ACTIONS::routerActivateTuneDiffPair.MakeEvent();
  41. case ID_TUNE_DIFF_PAIR_SKEW_BUTT:
  42. return PCB_ACTIONS::routerActivateTuneDiffPairSkew.MakeEvent();
  43. case ID_MENU_INTERACTIVE_ROUTER_SETTINGS:
  44. return PCB_ACTIONS::routerActivateSettingsDialog.MakeEvent();
  45. case ID_MENU_DIFF_PAIR_DIMENSIONS:
  46. return PCB_ACTIONS::routerActivateDpDimensionsDialog.MakeEvent();
  47. case ID_PCB_ZONES_BUTT:
  48. return PCB_ACTIONS::drawZone.MakeEvent();
  49. case ID_PCB_DRAW_VIA_BUTT:
  50. return PCB_ACTIONS::drawVia.MakeEvent();
  51. case ID_PCB_KEEPOUT_AREA_BUTT:
  52. return PCB_ACTIONS::drawZoneKeepout.MakeEvent();
  53. case ID_PCB_ADD_LINE_BUTT:
  54. case ID_MODEDIT_LINE_TOOL:
  55. return PCB_ACTIONS::drawLine.MakeEvent();
  56. case ID_PCB_ADD_POLYGON_BUTT:
  57. case ID_MODEDIT_POLYGON_TOOL:
  58. return PCB_ACTIONS::drawGraphicPolygon.MakeEvent();
  59. case ID_PCB_CIRCLE_BUTT:
  60. case ID_MODEDIT_CIRCLE_TOOL:
  61. return PCB_ACTIONS::drawCircle.MakeEvent();
  62. case ID_PCB_ARC_BUTT:
  63. case ID_MODEDIT_ARC_TOOL:
  64. return PCB_ACTIONS::drawArc.MakeEvent();
  65. case ID_PCB_ADD_TEXT_BUTT:
  66. case ID_MODEDIT_TEXT_TOOL:
  67. return PCB_ACTIONS::placeText.MakeEvent();
  68. case ID_PCB_DIMENSION_BUTT:
  69. return PCB_ACTIONS::drawDimension.MakeEvent();
  70. case ID_PCB_TARGET_BUTT:
  71. return PCB_ACTIONS::placeTarget.MakeEvent();
  72. case ID_MODEDIT_PAD_TOOL:
  73. return PCB_ACTIONS::placePad.MakeEvent();
  74. case ID_GEN_IMPORT_DXF_FILE:
  75. return PCB_ACTIONS::placeDXF.MakeEvent();
  76. case ID_MODEDIT_ANCHOR_TOOL:
  77. return PCB_ACTIONS::setAnchor.MakeEvent();
  78. case ID_PCB_PLACE_GRID_COORD_BUTT:
  79. case ID_MODEDIT_PLACE_GRID_COORD:
  80. return ACTIONS::gridSetOrigin.MakeEvent();
  81. case ID_ZOOM_IN: // toolbar button "Zoom In"
  82. case ID_VIEWER_ZOOM_IN:
  83. return ACTIONS::zoomInCenter.MakeEvent();
  84. case ID_ZOOM_OUT: // toolbar button "Zoom In"
  85. case ID_VIEWER_ZOOM_OUT:
  86. return ACTIONS::zoomOutCenter.MakeEvent();
  87. case ID_ZOOM_PAGE: // toolbar button "Fit on Screen"
  88. case ID_VIEWER_ZOOM_PAGE:
  89. return ACTIONS::zoomFitScreen.MakeEvent();
  90. case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
  91. return PCB_ACTIONS::trackDisplayMode.MakeEvent();
  92. case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
  93. return PCB_ACTIONS::padDisplayMode.MakeEvent();
  94. case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
  95. return PCB_ACTIONS::viaDisplayMode.MakeEvent();
  96. case ID_TB_OPTIONS_SHOW_ZONES:
  97. return PCB_ACTIONS::zoneDisplayEnable.MakeEvent();
  98. case ID_TB_OPTIONS_SHOW_ZONES_DISABLE:
  99. return PCB_ACTIONS::zoneDisplayDisable.MakeEvent();
  100. case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY:
  101. return PCB_ACTIONS::zoneDisplayOutlines.MakeEvent();
  102. case ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH:;
  103. return PCB_ACTIONS::graphicDisplayMode.MakeEvent();
  104. case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
  105. return PCB_ACTIONS::moduleEdgeOutlines.MakeEvent();
  106. case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:;
  107. return PCB_ACTIONS::moduleTextOutlines.MakeEvent();
  108. case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
  109. return PCB_ACTIONS::highContrastMode.MakeEvent();
  110. case ID_FIND_ITEMS:
  111. return PCB_ACTIONS::find.MakeEvent();
  112. case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST:
  113. return PCB_ACTIONS::findMove.MakeEvent();
  114. case ID_NO_TOOL_SELECTED:
  115. return PCB_ACTIONS::selectionTool.MakeEvent();
  116. case ID_ZOOM_SELECTION:
  117. return ACTIONS::zoomTool.MakeEvent();
  118. case ID_PCB_DELETE_ITEM_BUTT:
  119. case ID_MODEDIT_DELETE_TOOL:
  120. return PCB_ACTIONS::deleteItemCursor.MakeEvent();
  121. case ID_PCB_PLACE_OFFSET_COORD_BUTT:
  122. return PCB_ACTIONS::drillOrigin.MakeEvent();
  123. case ID_PCB_MEASUREMENT_TOOL:
  124. case ID_MODEDIT_MEASUREMENT_TOOL:
  125. return PCB_ACTIONS::measureTool.MakeEvent();
  126. case ID_PCB_HIGHLIGHT_BUTT:
  127. return PCB_ACTIONS::highlightNetCursor.MakeEvent();
  128. case ID_APPEND_FILE:
  129. return PCB_ACTIONS::appendBoard.MakeEvent();
  130. case ID_PCB_SHOW_1_RATSNEST_BUTT:
  131. return PCB_ACTIONS::showLocalRatsnest.MakeEvent();
  132. case ID_PCB_MUWAVE_TOOL_GAP_CMD:
  133. return PCB_ACTIONS::microwaveCreateGap.MakeEvent();
  134. case ID_PCB_MUWAVE_TOOL_STUB_CMD:
  135. return PCB_ACTIONS::microwaveCreateStub.MakeEvent();
  136. case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
  137. return PCB_ACTIONS::microwaveCreateStubArc.MakeEvent();
  138. case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
  139. return PCB_ACTIONS::microwaveCreateFunctionShape.MakeEvent();
  140. case ID_PCB_MUWAVE_TOOL_SELF_CMD:
  141. return PCB_ACTIONS::microwaveCreateLine.MakeEvent();
  142. case ID_EDIT_CUT:
  143. return PCB_ACTIONS::cutToClipboard.MakeEvent();
  144. case ID_EDIT_COPY:
  145. return PCB_ACTIONS::copyToClipboard.MakeEvent();
  146. case ID_EDIT_PASTE:
  147. return PCB_ACTIONS::pasteFromClipboard.MakeEvent();
  148. }
  149. return OPT<TOOL_EVENT>();
  150. }