ReactOS  0.4.15-dev-4853-g3a72a52
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 placeSelWin ()
 
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 57 of file mouse.cpp.

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

Referenced by ShapeTool::OnButtonUp().

◆ placeSelWin()

void placeSelWin ( void  )

Definition at line 20 of file mouse.cpp.

21 {
25  selectionWindow.BringWindowToTop();
27 }
static int Zoomed(int xy)
Definition: common.h:37
LONG GetDestRectLeft() const
#define TRUE
Definition: types.h:120
SelectionModel selectionModel
Definition: main.cpp:20
LONG GetDestRectWidth() const
BOOL InvalidateRect(LPCRECT lpRect, BOOL bErase=TRUE)
Definition: atlwin.h:868
CImgAreaWindow imageArea
Definition: main.cpp:72
#define FALSE
Definition: types.h:117
#define GRIP_SIZE
Definition: common.h:13
LONG GetDestRectHeight() const
#define NULL
Definition: types.h:112
LONG GetDestRectTop() const
CSelectionWindow selectionWindow
Definition: main.cpp:71

Referenced by CMainWindow::InsertSelectionFromHBITMAP(), FreeSelTool::OnButtonUp(), RectSelTool::OnButtonUp(), CSelectionWindow::OnCaptureChanged(), CSelectionWindow::OnLButtonUp(), CSelectionWindow::OnToolsModelZoomChanged(), SelectionModel::RotateNTimes90Degrees(), and SelectionModel::StretchSkew().

◆ regularize()

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

Definition at line 30 of file mouse.cpp.

31 {
32  if (abs(x1 - x0) >= abs(y1 - y0))
33  y1 = y0 + (y1 > y0 ? abs(x1 - x0) : -abs(x1 - x0));
34  else
35  x1 = x0 + (x1 > x0 ? abs(y1 - y0) : -abs(y1 - y0));
36 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
#define abs(i)
Definition: fconv.c:206
GLint x0
Definition: linetemp.h:95
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
GLint y0
Definition: linetemp.h:96

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

◆ roundTo8Directions()

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

Definition at line 39 of file mouse.cpp.

40 {
41  if (abs(x1 - x0) >= abs(y1 - y0))
42  {
43  if (abs(y1 - y0) * 5 < abs(x1 - x0) * 2)
44  y1 = y0;
45  else
46  y1 = y0 + (y1 > y0 ? abs(x1 - x0) : -abs(x1 - x0));
47  }
48  else
49  {
50  if (abs(x1 - x0) * 5 < abs(y1 - y0) * 2)
51  x1 = x0;
52  else
53  x1 = x0 + (x1 > x0 ? abs(y1 - y0) : -abs(y1 - y0));
54  }
55 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
#define abs(i)
Definition: fconv.c:206
GLint x0
Definition: linetemp.h:95
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
GLint y0
Definition: linetemp.h:96

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

◆ updateLast()

void updateLast ( LONG  x,
LONG  y 
)

Definition at line 70 of file mouse.cpp.

71 {
72  last.x = x;
73  last.y = y;
74 }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
POINT last
Definition: font.c:46
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

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

◆ updateStartAndLast()

void updateStartAndLast ( LONG  x,
LONG  y 
)

Definition at line 64 of file mouse.cpp.

65 {
66  start.x = last.x = x;
67  start.y = last.y = y;
68 }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
POINT last
Definition: font.c:46
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint start
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by ToolsModel::OnButtonDown().