ReactOS 0.4.15-dev-7958-gcd0bb1a
ShapeTool Struct Reference
Inheritance diagram for ShapeTool:
Collaboration diagram for ShapeTool:

Public Member Functions

void OnDrawOverlayOnImage (HDC hdc)
 
void OnButtonDown (BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
 
BOOL OnMouseMove (BOOL bLeftButton, LONG &x, LONG &y) override
 
BOOL OnButtonUp (BOOL bLeftButton, LONG &x, LONG &y) override
 
void OnEndDraw (BOOL bCancel) override
 
void OnSpecialTweak (BOOL bMinus) override
 
- Public Member Functions inherited from ToolBase
 ToolBase ()
 
virtual ~ToolBase ()
 
virtual void OnButtonDown (BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
 
virtual BOOL OnMouseMove (BOOL bLeftButton, LONG &x, LONG &y)
 
virtual BOOL OnButtonUp (BOOL bLeftButton, LONG &x, LONG &y)
 
virtual void OnDrawOverlayOnImage (HDC hdc)
 
virtual void OnDrawOverlayOnCanvas (HDC hdc)
 
virtual void OnSpecialTweak (BOOL bMinus)
 
virtual void OnEndDraw (BOOL bCancel)
 
void beginEvent ()
 
void endEvent ()
 
void reset ()
 

Public Attributes

BOOL m_bLeftButton = FALSE
 
BOOL m_bClosed = FALSE
 
- Public Attributes inherited from ToolBase
HDC m_hdc
 
COLORREF m_fg
 
COLORREF m_bg
 

Additional Inherited Members

- Static Public Member Functions inherited from ToolBase
static ToolBasecreateToolObject (TOOLTYPE type)
 

Detailed Description

Definition at line 1000 of file mouse.cpp.

Member Function Documentation

◆ OnButtonDown()

void ShapeTool::OnButtonDown ( BOOL  bLeftButton,
LONG  x,
LONG  y,
BOOL  bDoubleClick 
)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 1016 of file mouse.cpp.

1017 {
1018 m_bLeftButton = bLeftButton;
1019 m_bClosed = FALSE;
1020
1021 if ((s_cPoints > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
1023
1024 pushToPoints(x, y);
1025
1026 if (s_cPoints > 1 && bDoubleClick)
1027 {
1029 return;
1030 }
1031
1032 if (s_cPoints == 1)
1033 pushToPoints(x, y); // We have to draw the first point
1034
1036 }
static LPPOINT s_pPoints
Definition: mouse.cpp:16
static void pushToPoints(LONG x, LONG y)
Definition: mouse.cpp:143
void roundTo8Directions(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:31
static SIZE_T s_cPoints
Definition: mouse.cpp:12
void NotifyImageChanged()
Definition: history.cpp:23
#define FALSE
Definition: types.h:117
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
ImageModel imageModel
Definition: history.cpp:11
BOOL m_bClosed
Definition: mouse.cpp:1003
void OnEndDraw(BOOL bCancel) override
Definition: mouse.cpp:1069
BOOL m_bLeftButton
Definition: mouse.cpp:1002
#define VK_SHIFT
Definition: winuser.h:2202
SHORT WINAPI GetAsyncKeyState(_In_ int)

◆ OnButtonUp()

BOOL ShapeTool::OnButtonUp ( BOOL  bLeftButton,
LONG x,
LONG y 
)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 1052 of file mouse.cpp.

1053 {
1054 if ((s_cPoints > 1) && (GetAsyncKeyState(VK_SHIFT) < 0))
1056
1057 m_bClosed = FALSE;
1058 if (nearlyEqualPoints(x, y, s_pPoints[0].x, s_pPoints[0].y))
1059 {
1061 return TRUE;
1062 }
1063
1064 pushToPoints(x, y);
1066 return TRUE;
1067 }
BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1)
Definition: mouse.cpp:49
#define TRUE
Definition: types.h:120

◆ OnDrawOverlayOnImage()

void ShapeTool::OnDrawOverlayOnImage ( HDC  hdc)
inlinevirtual

Reimplemented from ToolBase.

Definition at line 1005 of file mouse.cpp.

1006 {
1007 if (s_cPoints <= 0)
1008 return;
1009
1010 if (m_bLeftButton)
1012 else
1014 }
ToolsModel toolsModel
Definition: toolsmodel.cpp:10
int GetLineWidth() const
Definition: toolsmodel.cpp:46
int GetShapeStyle() const
Definition: toolsmodel.cpp:112
void Poly(HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed, BOOL inverted)
Definition: drawing.cpp:68
HDC hdc
Definition: main.c:9
COLORREF m_fg
Definition: toolsmodel.h:44
COLORREF m_bg
Definition: toolsmodel.h:44
int32_t INT
Definition: typedefs.h:58

Referenced by OnEndDraw().

◆ OnEndDraw()

void ShapeTool::OnEndDraw ( BOOL  bCancel)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 1069 of file mouse.cpp.

1070 {
1071 if (!bCancel && s_cPoints > 1)
1072 {
1073 CRect rcPartial;
1075
1077 rcPartial.InflateRect((size.cx + 1) / 2, (size.cy + 1) / 2);
1078
1079 imageModel.PushImageForUndo(rcPartial);
1080
1081 m_bClosed = TRUE;
1083 }
1084 m_bClosed = FALSE;
1085 ToolBase::OnEndDraw(bCancel);
1086 }
void getBoundaryOfPoints(RECT &rcBoundary, SIZE_T cPoints, const POINT *pPoints)
Definition: mouse.cpp:56
void InflateRect(int x, int y) noexcept
Definition: atltypes.h:323
void PushImageForUndo()
Definition: history.cpp:127
SIZE GetToolSize() const
Definition: toolsmodel.cpp:205
GLsizeiptr size
Definition: glext.h:5919
void OnDrawOverlayOnImage(HDC hdc)
Definition: mouse.cpp:1005
HDC m_hdc
Definition: toolsmodel.h:43
virtual void OnEndDraw(BOOL bCancel)
Definition: mouse.cpp:125

Referenced by OnButtonDown(), and OnButtonUp().

◆ OnMouseMove()

BOOL ShapeTool::OnMouseMove ( BOOL  bLeftButton,
LONG x,
LONG y 
)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 1038 of file mouse.cpp.

1039 {
1040 if (s_cPoints > 1)
1041 {
1042 if (GetAsyncKeyState(VK_SHIFT) < 0)
1044
1045 s_pPoints[s_cPoints - 1] = { x, y };
1046 }
1047
1049 return TRUE;
1050 }

◆ OnSpecialTweak()

void ShapeTool::OnSpecialTweak ( BOOL  bMinus)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 1088 of file mouse.cpp.

1089 {
1091 }
void MakeLineThickerOrThinner(BOOL bThinner)
Definition: toolsmodel.cpp:82

Member Data Documentation

◆ m_bClosed

BOOL ShapeTool::m_bClosed = FALSE

Definition at line 1003 of file mouse.cpp.

Referenced by OnButtonDown(), OnButtonUp(), OnDrawOverlayOnImage(), and OnEndDraw().

◆ m_bLeftButton

BOOL ShapeTool::m_bLeftButton = FALSE

Definition at line 1002 of file mouse.cpp.

Referenced by OnButtonDown(), and OnDrawOverlayOnImage().


The documentation for this struct was generated from the following file: