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.

76 lines
2.4 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2017 Jon Evans <jon@craftyjon.com>
  5. * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software: you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation, either version 3 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #include <tool/tool_manager.h>
  21. #include <tool/common_tools.h>
  22. #include <tool/zoom_tool.h>
  23. #include <gerbview_id.h>
  24. #include "gerbview_actions.h"
  25. #include "selection_tool.h"
  26. #include "gerbview_control.h"
  27. void GERBVIEW_ACTIONS::RegisterAllTools( TOOL_MANAGER* aToolManager )
  28. {
  29. aToolManager->RegisterTool( new COMMON_TOOLS );
  30. aToolManager->RegisterTool( new GERBVIEW_SELECTION_TOOL );
  31. aToolManager->RegisterTool( new GERBVIEW_CONTROL );
  32. aToolManager->RegisterTool( new ZOOM_TOOL );
  33. }
  34. OPT<TOOL_EVENT> GERBVIEW_ACTIONS::TranslateLegacyId( int aId )
  35. {
  36. switch( aId )
  37. {
  38. case ID_ZOOM_IN: // toolbar button "Zoom In"
  39. return ACTIONS::zoomInCenter.MakeEvent();
  40. case ID_ZOOM_OUT: // toolbar button "Zoom In"
  41. return ACTIONS::zoomOutCenter.MakeEvent();
  42. case ID_ZOOM_PAGE: // toolbar button "Fit on Screen"
  43. return ACTIONS::zoomFitScreen.MakeEvent();
  44. case ID_ZOOM_SELECTION:
  45. return ACTIONS::zoomTool.MakeEvent();
  46. case ID_TB_MEASUREMENT_TOOL:
  47. return GERBVIEW_ACTIONS::measureTool.MakeEvent();
  48. case ID_NO_TOOL_SELECTED:
  49. return GERBVIEW_ACTIONS::selectionTool.MakeEvent();
  50. case ID_HIGHLIGHT_REMOVE_ALL:
  51. return GERBVIEW_ACTIONS::highlightClear.MakeEvent();
  52. case ID_HIGHLIGHT_CMP_ITEMS:
  53. return GERBVIEW_ACTIONS::highlightComponent.MakeEvent();
  54. case ID_HIGHLIGHT_NET_ITEMS:
  55. return GERBVIEW_ACTIONS::highlightNet.MakeEvent();
  56. case ID_HIGHLIGHT_APER_ATTRIBUTE_ITEMS:
  57. return GERBVIEW_ACTIONS::highlightAttribute.MakeEvent();
  58. break;
  59. }
  60. return OPT<TOOL_EVENT>();
  61. }