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.

66 lines
2.3 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. * Copyright (C) 2017-2022 KiCad Developers, see AUTHORS.txt for contributors.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, you may find one here:
  17. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  18. * or you may search the http://www.gnu.org website for the version 2 license,
  19. * or you may write to the Free Software Foundation, Inc.,
  20. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  21. */
  22. #ifndef TOOL_EVENT_UTILS_H
  23. #define TOOL_EVENT_UTILS_H
  24. #include <tool/tool_interactive.h>
  25. #include <geometry/eda_angle.h>
  26. class PCB_BASE_EDIT_FRAME;
  27. /**
  28. * Namespace TOOL_EVT_UTILS
  29. *
  30. * Utility functions for dealing with various tool events. These are free functions, so they
  31. * interface with any classes exclusively via the public interfaces, so they don't need to be
  32. * subsumed into the "helped" classes.
  33. */
  34. namespace TOOL_EVT_UTILS
  35. {
  36. /**
  37. * Function isRotateToolEvt()
  38. *
  39. * @param aEvt event to check
  40. * @return true if the event is a rotation action tool event
  41. */
  42. bool IsRotateToolEvt( const TOOL_EVENT& aEvt );
  43. /**
  44. * Function getEventRotationAngle()
  45. *
  46. * Helper function to get a rotation angle based on a frame's configured angle and the
  47. * direction indicated by a rotation action event
  48. *
  49. * @param aFrame the PCB edit frame to use to get the base rotation step value from
  50. * @param aEvent the tool event - should be a rotation action event and should have a rotation
  51. * multiplier parameter
  52. *
  53. * @return the clockwise rotation angle
  54. */
  55. EDA_ANGLE GetEventRotationAngle( const PCB_BASE_EDIT_FRAME& aFrame, const TOOL_EVENT& aEvent );
  56. }
  57. #endif // TOOL_EVENT_UTILS_H