ReactOS 0.4.15-dev-7994-gb388cb6
ZoomTool Struct Reference
Inheritance diagram for ZoomTool:
Collaboration diagram for ZoomTool:

Public Member Functions

BOOL getNewZoomRect (CRect &rcView, INT newZoom)
 
void OnDrawOverlayOnCanvas (HDC hdc) override
 
void OnButtonDown (BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
 
BOOL OnButtonUp (BOOL bLeftButton, LONG &x, LONG &y) 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_bZoomed = 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 644 of file mouse.cpp.

Member Function Documentation

◆ getNewZoomRect()

BOOL ZoomTool::getNewZoomRect ( CRect rcView,
INT  newZoom 
)

Definition at line 688 of file mouse.cpp.

689{
690 CPoint pt;
692 canvasWindow.ScreenToClient(&pt);
693
694 canvasWindow.getNewZoomRect(rcView, newZoom, pt);
695
696 CRect rc;
699
700 return rc.PtInRect(pt);
701}
CCanvasWindow canvasWindow
Definition: canvas.cpp:10
VOID ImageToCanvas(POINT &pt)
Definition: canvas.cpp:40
VOID GetImageRect(RECT &rc)
Definition: canvas.cpp:66
VOID getNewZoomRect(CRect &rcView, INT newZoom, CPoint ptTarget)
Definition: canvas.cpp:79
BOOL PtInRect(POINT point) const noexcept
Definition: atltypes.h:418
#define pt(x, y)
Definition: drawing.c:79
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2701

Referenced by OnButtonDown(), and OnDrawOverlayOnCanvas().

◆ OnButtonDown()

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

Reimplemented from ToolBase.

Definition at line 658 of file mouse.cpp.

659 {
660 INT newZoom, oldZoom = toolsModel.GetZoom();
661 if (bLeftButton)
662 newZoom = (oldZoom < MAX_ZOOM) ? (oldZoom * 2) : MIN_ZOOM;
663 else
664 newZoom = (oldZoom > MIN_ZOOM) ? (oldZoom / 2) : MAX_ZOOM;
665
667
668 if (oldZoom != newZoom)
669 {
670 CRect rcView;
671 if (getNewZoomRect(rcView, newZoom))
672 {
673 canvasWindow.zoomTo(newZoom, rcView.left, rcView.top);
674 m_bZoomed = TRUE;
675 }
676 }
677 }
ToolsModel toolsModel
Definition: toolsmodel.cpp:10
#define MAX_ZOOM
Definition: precomp.h:45
#define MIN_ZOOM
Definition: precomp.h:44
VOID zoomTo(INT newZoom, LONG left=0, LONG top=0)
Definition: canvas.cpp:107
int GetZoom() const
Definition: toolsmodel.cpp:261
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL getNewZoomRect(CRect &rcView, INT newZoom)
Definition: mouse.cpp:688
BOOL m_bZoomed
Definition: mouse.cpp:646
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58

◆ OnButtonUp()

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

Reimplemented from ToolBase.

Definition at line 679 of file mouse.cpp.

680 {
681 if (m_bZoomed)
683
684 return TRUE;
685 }
TOOLTYPE GetOldActiveTool() const
Definition: toolsmodel.cpp:139
void SetActiveTool(TOOLTYPE nActiveTool)
Definition: toolsmodel.cpp:144

◆ OnDrawOverlayOnCanvas()

void ZoomTool::OnDrawOverlayOnCanvas ( HDC  hdc)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 650 of file mouse.cpp.

651 {
652 CRect rcView;
653 INT oldZoom = toolsModel.GetZoom();
654 if (oldZoom < MAX_ZOOM && getNewZoomRect(rcView, oldZoom * 2))
655 DrawXorRect(hdc, &rcView);
656 }
void DrawXorRect(HDC hdc, const RECT *prc)
Definition: drawing.cpp:362
HDC hdc
Definition: main.c:9

Member Data Documentation

◆ m_bZoomed

BOOL ZoomTool::m_bZoomed = FALSE

Definition at line 646 of file mouse.cpp.

Referenced by OnButtonDown(), and OnButtonUp().


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