ReactOS 0.4.17-dev-357-ga8f14ff
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 1004 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 1020 of file mouse.cpp.

1021 {
1022 m_bLeftButton = bLeftButton;
1023 m_bClosed = FALSE;
1024
1025 if ((s_cPoints > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
1027
1028 pushToPoints(x, y);
1029
1030 if (s_cPoints > 1 && bDoubleClick)
1031 {
1033 return;
1034 }
1035
1036 if (s_cPoints == 1)
1037 pushToPoints(x, y); // We have to draw the first point
1038
1040 }
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:1007
void OnEndDraw(BOOL bCancel) override
Definition: mouse.cpp:1073
BOOL m_bLeftButton
Definition: mouse.cpp:1006
#define VK_SHIFT
Definition: winuser.h:2238
SHORT WINAPI GetAsyncKeyState(_In_ int)

◆ OnButtonUp()

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

Reimplemented from ToolBase.

Definition at line 1056 of file mouse.cpp.

1057 {
1058 if ((s_cPoints > 1) && (GetAsyncKeyState(VK_SHIFT) < 0))
1060
1061 m_bClosed = FALSE;
1062 if (nearlyEqualPoints(x, y, s_pPoints[0].x, s_pPoints[0].y))
1063 {
1065 return TRUE;
1066 }
1067
1068 pushToPoints(x, y);
1070 return TRUE;
1071 }
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 1009 of file mouse.cpp.

1010 {
1011 if (s_cPoints <= 0)
1012 return;
1013
1014 if (m_bLeftButton)
1016 else
1018 }
ToolsModel toolsModel
Definition: toolsmodel.cpp:10
int GetLineWidth() const
Definition: toolsmodel.cpp:46
int GetShapeStyle() const
Definition: toolsmodel.cpp:119
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 1073 of file mouse.cpp.

1074 {
1075 if (!bCancel && s_cPoints > 1)
1076 {
1077 CRect rcPartial;
1079
1081 rcPartial.InflateRect((size.cx + 1) / 2, (size.cy + 1) / 2);
1082
1083 imageModel.PushImageForUndo(rcPartial);
1084
1085 m_bClosed = TRUE;
1087 }
1088 m_bClosed = FALSE;
1089 ToolBase::OnEndDraw(bCancel);
1090 }
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:125
SIZE GetToolSize() const
Definition: toolsmodel.cpp:214
GLsizeiptr size
Definition: glext.h:5919
void OnDrawOverlayOnImage(HDC hdc)
Definition: mouse.cpp:1009
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 1042 of file mouse.cpp.

1043 {
1044 if (s_cPoints > 1)
1045 {
1046 if (GetAsyncKeyState(VK_SHIFT) < 0)
1048
1049 s_pPoints[s_cPoints - 1] = { x, y };
1050 }
1051
1053 return TRUE;
1054 }

◆ OnSpecialTweak()

void ShapeTool::OnSpecialTweak ( BOOL  bMinus)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 1092 of file mouse.cpp.

1093 {
1095 }
void MakeLineThickerOrThinner(BOOL bThinner)
Definition: toolsmodel.cpp:89

Member Data Documentation

◆ m_bClosed

BOOL ShapeTool::m_bClosed = FALSE

Definition at line 1007 of file mouse.cpp.

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

◆ m_bLeftButton

BOOL ShapeTool::m_bLeftButton = FALSE

Definition at line 1006 of file mouse.cpp.

Referenced by OnButtonDown(), and OnDrawOverlayOnImage().


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