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