ReactOS  0.4.15-dev-4936-gc06ccce
ShapeTool Struct Reference
Inheritance diagram for ShapeTool:
Collaboration diagram for ShapeTool:

Public Member Functions

 ShapeTool ()
 
void draw (BOOL bLeftButton, LONG x, LONG y, BOOL bClosed=FALSE)
 
void OnButtonDown (BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
 
void OnMouseMove (BOOL bLeftButton, LONG x, LONG y)
 
void OnButtonUp (BOOL bLeftButton, LONG x, LONG y)
 
void OnCancelDraw ()
 
void OnFinishDraw ()
 
- Public Member Functions inherited from ToolBase
 ToolBase (TOOLTYPE tool)
 
virtual ~ToolBase ()
 
void beginEvent ()
 
void endEvent ()
 
void reset ()
 

Public Attributes

BOOL m_bLeftButton
 
- Public Attributes inherited from ToolBase
TOOLTYPE m_tool
 
HDC m_hdc
 
COLORREF m_fg
 
COLORREF m_bg
 

Additional Inherited Members

- Static Public Member Functions inherited from ToolBase
static ToolBasecreateToolObject (TOOLTYPE type)
 
- Static Public Attributes inherited from ToolBase
static INT pointSP = 0
 
static POINT pointStack [256] = { { 0 } }
 

Detailed Description

Definition at line 631 of file mouse.cpp.

Constructor & Destructor Documentation

◆ ShapeTool()

ShapeTool::ShapeTool ( )
inline

Definition at line 635 of file mouse.cpp.

636  {
637  }
#define FALSE
Definition: types.h:117
ToolBase(TOOLTYPE tool)
Definition: toolsmodel.h:42
BOOL m_bLeftButton
Definition: mouse.cpp:633

Member Function Documentation

◆ draw()

void ShapeTool::draw ( BOOL  bLeftButton,
LONG  x,
LONG  y,
BOOL  bClosed = FALSE 
)
inline

Definition at line 639 of file mouse.cpp.

640  {
641  if (pointSP + 1 >= 2)
642  {
643  if (bLeftButton)
645  else
647  }
648  m_bLeftButton = bLeftButton;
649  }
static POINT pointStack[256]
Definition: toolsmodel.h:40
ToolsModel toolsModel
Definition: main.cpp:18
HDC m_hdc
Definition: toolsmodel.h:37
#define FALSE
Definition: types.h:117
void Poly(HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed, BOOL inverted)
Definition: drawing.cpp:70
static INT pointSP
Definition: toolsmodel.h:39
int GetLineWidth() const
Definition: toolsmodel.cpp:43
COLORREF m_bg
Definition: toolsmodel.h:38
int GetShapeStyle() const
Definition: toolsmodel.cpp:54
BOOL m_bLeftButton
Definition: mouse.cpp:633
COLORREF m_fg
Definition: toolsmodel.h:38

Referenced by OnButtonDown(), OnButtonUp(), OnFinishDraw(), and OnMouseMove().

◆ OnButtonDown()

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

Reimplemented from ToolBase.

Definition at line 651 of file mouse.cpp.

652  {
653  pointStack[pointSP].x = x;
654  pointStack[pointSP].y = y;
655 
656  if (pointSP == 0 && !bDoubleClick)
657  {
659  draw(bLeftButton, x, y);
660  pointSP++;
661  }
662  else
663  {
664  draw(bLeftButton, x, y, bDoubleClick);
665  }
666  }
static POINT pointStack[256]
Definition: toolsmodel.h:40
void CopyPrevious(void)
Definition: history.cpp:47
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
void draw(BOOL bLeftButton, LONG x, LONG y, BOOL bClosed=FALSE)
Definition: mouse.cpp:639
static INT pointSP
Definition: toolsmodel.h:39
ImageModel imageModel
Definition: main.cpp:32
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ OnButtonUp()

void ShapeTool::OnButtonUp ( BOOL  bLeftButton,
LONG  x,
LONG  y 
)
inlinevirtual

Reimplemented from ToolBase.

Definition at line 678 of file mouse.cpp.

679  {
681  if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
683 
684  if (nearlyEqualPoints(x, y, pointStack[0].x, pointStack[0].y))
685  {
686  pointSP--;
687  draw(bLeftButton, x, y, TRUE);
688  pointSP = 0;
689  }
690  else
691  {
692  pointSP++;
693  pointStack[pointSP].x = x;
694  pointStack[pointSP].y = y;
695  draw(bLeftButton, x, y, FALSE);
696  }
697 
698  if (pointSP == _countof(pointStack))
699  pointSP--;
700  }
static POINT pointStack[256]
Definition: toolsmodel.h:40
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
void roundTo8Directions(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:39
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
void draw(BOOL bLeftButton, LONG x, LONG y, BOOL bClosed=FALSE)
Definition: mouse.cpp:639
#define FALSE
Definition: types.h:117
#define VK_SHIFT
Definition: winuser.h:2182
static INT pointSP
Definition: toolsmodel.h:39
#define _countof(array)
Definition: sndvol32.h:68
SHORT WINAPI GetAsyncKeyState(_In_ int)
ImageModel imageModel
Definition: main.cpp:32
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
void ResetToPrevious(void)
Definition: history.cpp:100
BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1)
Definition: mouse.cpp:57

◆ OnCancelDraw()

void ShapeTool::OnCancelDraw ( )
inlinevirtual

Reimplemented from ToolBase.

Definition at line 702 of file mouse.cpp.

703  {
706  }
#define TRUE
Definition: types.h:120
virtual void OnCancelDraw()
Definition: mouse.cpp:85
ImageModel imageModel
Definition: main.cpp:32
void Undo(BOOL bClearRedo=FALSE)
Definition: history.cpp:60

◆ OnFinishDraw()

void ShapeTool::OnFinishDraw ( )
inlinevirtual

Reimplemented from ToolBase.

Definition at line 708 of file mouse.cpp.

709  {
710  if (pointSP)
711  {
713  --pointSP;
714  draw(m_bLeftButton, -1, -1, TRUE);
715  pointSP = 0;
716  }
717  else
718  {
720  }
722  }
#define TRUE
Definition: types.h:120
void draw(BOOL bLeftButton, LONG x, LONG y, BOOL bClosed=FALSE)
Definition: mouse.cpp:639
static INT pointSP
Definition: toolsmodel.h:39
virtual void OnFinishDraw()
Definition: mouse.cpp:90
BOOL m_bLeftButton
Definition: mouse.cpp:633
ImageModel imageModel
Definition: main.cpp:32
void Undo(BOOL bClearRedo=FALSE)
Definition: history.cpp:60
void ResetToPrevious(void)
Definition: history.cpp:100

◆ OnMouseMove()

void ShapeTool::OnMouseMove ( BOOL  bLeftButton,
LONG  x,
LONG  y 
)
inlinevirtual

Reimplemented from ToolBase.

Definition at line 668 of file mouse.cpp.

669  {
671  pointStack[pointSP].x = x;
672  pointStack[pointSP].y = y;
673  if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
675  draw(bLeftButton, x, y, FALSE);
676  }
static POINT pointStack[256]
Definition: toolsmodel.h:40
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
void roundTo8Directions(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:39
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
void draw(BOOL bLeftButton, LONG x, LONG y, BOOL bClosed=FALSE)
Definition: mouse.cpp:639
#define FALSE
Definition: types.h:117
#define VK_SHIFT
Definition: winuser.h:2182
static INT pointSP
Definition: toolsmodel.h:39
SHORT WINAPI GetAsyncKeyState(_In_ int)
ImageModel imageModel
Definition: main.cpp:32
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
void ResetToPrevious(void)
Definition: history.cpp:100

Member Data Documentation

◆ m_bLeftButton

BOOL ShapeTool::m_bLeftButton

Definition at line 633 of file mouse.cpp.

Referenced by draw(), and OnFinishDraw().


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