PointerTool.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (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, see <http://www.gnu.org/licenses/>.
  17. */
  18. // PointerTool.h
  19. // Texture tiling tools for worldbuilder.
  20. // Author: John Ahlquist, April 2001
  21. #pragma once
  22. #ifndef POINTER_TOOL_H
  23. #define POINTER_TOOL_H
  24. #include "PolygonTool.h"
  25. class WorldHeightMapEdit;
  26. #include "../../gameengine/include/common/MapObject.h"
  27. class ModifyObjectUndoable;
  28. /*************************************************************************/
  29. /** PointerTool
  30. Does the select/move tool operation.
  31. ***************************************************************************/
  32. /// Blend edges out tool.
  33. class PointerTool : public PolygonTool
  34. {
  35. protected:
  36. enum {HYSTERESIS = 3};
  37. CPoint m_downPt2d;
  38. Coord3D m_downPt3d;
  39. MapObject *m_curObject;
  40. Bool m_moving; ///< True if we are drag moving an object.
  41. Bool m_rotating; ///< True if we are rotating an object.
  42. Bool m_dragSelect; ///< True if we are drag selecting.
  43. Bool m_doPolyTool; ///< True if we are using the polygon tool to modify a polygon triggter.
  44. ModifyObjectUndoable *m_modifyUndoable; ///< The modify undoable that is in progress while we track the mouse.
  45. Bool m_mouseUpRotate;///< True if we are over the "rotate" hotspot.
  46. HCURSOR m_rotateCursor;
  47. Bool m_mouseUpMove;///< True if we are over the "move" hotspot.
  48. HCURSOR m_moveCursor;
  49. protected:
  50. void checkForPropertiesPanel(void);
  51. public:
  52. PointerTool(void);
  53. ~PointerTool(void);
  54. public:
  55. /// Clear the selection on activate or deactivate.
  56. virtual void activate();
  57. virtual void deactivate();
  58. virtual void setCursor(void);
  59. virtual void mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
  60. virtual void mouseMoved(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
  61. virtual void mouseUp(TTrackingMode m, CPoint viewPt, WbView* pView, CWorldBuilderDoc *pDoc);
  62. public:
  63. static void clearSelection(void); ///< Clears the selected objects selected flags.
  64. static Bool allowPick(MapObject* pMapObj, WbView* pView);
  65. };
  66. #endif //POINTER_TOOL_H