ReactOS 0.4.15-dev-6068-g8061a6f
mouse.cpp File Reference
#include "precomp.h"
Include dependency graph for mouse.cpp:

Go to the source code of this file.

Classes

struct  FreeSelTool
 
struct  RectSelTool
 
struct  GenericDrawTool
 
struct  RubberTool
 
struct  FillTool
 
struct  ColorTool
 
struct  ZoomTool
 
struct  PenTool
 
struct  BrushTool
 
struct  AirBrushTool
 
struct  TextTool
 
struct  LineTool
 
struct  BezierTool
 
struct  RectTool
 
struct  ShapeTool
 
struct  EllipseTool
 
struct  RRectTool
 

Functions

void regularize (LONG x0, LONG y0, LONG &x1, LONG &y1)
 
void roundTo8Directions (LONG x0, LONG y0, LONG &x1, LONG &y1)
 
BOOL nearlyEqualPoints (INT x0, INT y0, INT x1, INT y1)
 
void updateStartAndLast (LONG x, LONG y)
 
void updateLast (LONG x, LONG y)
 

Function Documentation

◆ nearlyEqualPoints()

BOOL nearlyEqualPoints ( INT  x0,
INT  y0,
INT  x1,
INT  y1 
)

Definition at line 47 of file mouse.cpp.

48{
51 return (abs(x1 - x0) <= cxThreshold) && (abs(y1 - y0) <= cyThreshold);
52}
int GetLineWidth() const
Definition: toolsmodel.cpp:43
#define abs(i)
Definition: fconv.c:206
ToolsModel toolsModel
Definition: toolsmodel.cpp:11
GLint y0
Definition: linetemp.h:96
GLint x0
Definition: linetemp.h:95
static int UnZoomed(int xy)
Definition: toolsmodel.h:131
int32_t INT
Definition: typedefs.h:58
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
#define SM_CXDRAG
Definition: winuser.h:1022
#define SM_CYDRAG
Definition: winuser.h:1023
int WINAPI GetSystemMetrics(_In_ int)

Referenced by ShapeTool::OnButtonUp().

◆ regularize()

void regularize ( LONG  x0,
LONG  y0,
LONG x1,
LONG y1 
)

Definition at line 20 of file mouse.cpp.

21{
22 if (abs(x1 - x0) >= abs(y1 - y0))
23 y1 = y0 + (y1 > y0 ? abs(x1 - x0) : -abs(x1 - x0));
24 else
25 x1 = x0 + (x1 > x0 ? abs(y1 - y0) : -abs(y1 - y0));
26}

Referenced by RectTool::draw(), EllipseTool::draw(), and RRectTool::draw().

◆ roundTo8Directions()

void roundTo8Directions ( LONG  x0,
LONG  y0,
LONG x1,
LONG y1 
)

Definition at line 29 of file mouse.cpp.

30{
31 if (abs(x1 - x0) >= abs(y1 - y0))
32 {
33 if (abs(y1 - y0) * 5 < abs(x1 - x0) * 2)
34 y1 = y0;
35 else
36 y1 = y0 + (y1 > y0 ? abs(x1 - x0) : -abs(x1 - x0));
37 }
38 else
39 {
40 if (abs(x1 - x0) * 5 < abs(y1 - y0) * 2)
41 x1 = x0;
42 else
43 x1 = x0 + (x1 > x0 ? abs(y1 - y0) : -abs(y1 - y0));
44 }
45}

Referenced by LineTool::draw(), ShapeTool::OnButtonUp(), and ShapeTool::OnMouseMove().

◆ updateLast()

void updateLast ( LONG  x,
LONG  y 
)

Definition at line 60 of file mouse.cpp.

61{
62 last.x = x;
63 last.y = y;
64}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
POINT last
Definition: font.c:46
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48

Referenced by ToolsModel::OnButtonUp(), and ToolsModel::OnMouseMove().

◆ updateStartAndLast()

void updateStartAndLast ( LONG  x,
LONG  y 
)

Definition at line 54 of file mouse.cpp.

55{
56 start.x = last.x = x;
57 start.y = last.y = y;
58}
GLuint start
Definition: gl.h:1545

Referenced by ToolsModel::OnButtonDown().