Counter Strike : Global Offensive Source Code
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.

85 lines
2.5 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "stdafx.h"
  8. #include "MapDoc.h"
  9. #include "MapView2D.h"
  10. #include "resource.h"
  11. #include "ToolMagnify.h"
  12. #include "HammerVGui.h"
  13. #include <VGuiMatSurface/IMatSystemSurface.h>
  14. // memdbgon must be the last include file in a .cpp file!!!
  15. #include <tier0/memdbgon.h>
  16. //-----------------------------------------------------------------------------
  17. // Purpose: Loads the cursor (only once).
  18. //-----------------------------------------------------------------------------
  19. CToolMagnify::CToolMagnify(void)
  20. {
  21. }
  22. //-----------------------------------------------------------------------------
  23. // Purpose:
  24. // Input : *pView -
  25. // nFlags -
  26. // point -
  27. // Output : Returns true on success, false on failure.
  28. //-----------------------------------------------------------------------------
  29. bool CToolMagnify::OnContextMenu2D(CMapView2D *pView, UINT nFlags, const Vector2D &vPoint)
  30. {
  31. // Return true to suppress the default view context menu behavior.
  32. return true;
  33. }
  34. //-----------------------------------------------------------------------------
  35. // Purpose:
  36. // Input : pView -
  37. // nFlags -
  38. // point -
  39. // Output : Returns true to indicate that the message was handled.
  40. //-----------------------------------------------------------------------------
  41. bool CToolMagnify::OnLMouseDown2D(CMapView2D *pView, UINT nFlags, const Vector2D &vPoint)
  42. {
  43. pView->SetZoom(pView->GetZoom() * 2);
  44. pView->Invalidate();
  45. return true;
  46. }
  47. //-----------------------------------------------------------------------------
  48. // Purpose:
  49. // Input : pView -
  50. // nFlags -
  51. // point -
  52. // Output : Returns true to indicate that the message was handled.
  53. //-----------------------------------------------------------------------------
  54. bool CToolMagnify::OnMouseMove2D(CMapView2D *pView, UINT nFlags, const Vector2D &vPoint)
  55. {
  56. // cursors are cached by surface
  57. pView->SetCursor( "Resource/magnify.cur" );
  58. return true;
  59. }
  60. //-----------------------------------------------------------------------------
  61. // Purpose:
  62. // Input : pView -
  63. // nFlags -
  64. // point -
  65. // Output : Returns true to indicate that the message was handled.
  66. //-----------------------------------------------------------------------------
  67. bool CToolMagnify::OnRMouseDown2D(CMapView2D *pView, UINT nFlags, const Vector2D &vPoint)
  68. {
  69. pView->SetZoom(pView->GetZoom() * 0.5f);
  70. return true;
  71. }