ReactOS  0.4.15-dev-4616-g17e0e44
common.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define GRIP_SIZE   3
 
#define MIN_ZOOM   125
 
#define MAX_ZOOM   8000
 
#define RECT_WIDTH(a)   ((a).right - (a).left)
 
#define RECT_HEIGHT(a)   ((a).bottom - (a).top)
 
#define CHECKED_IF(a)   ((a) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND))
 
#define ENABLED_IF(a)   ((a) ? (MF_ENABLED | MF_BYCOMMAND) : (MF_GRAYED | MF_BYCOMMAND))
 

Functions

BOOL zoomTo (int newZoom, int mouseX, int mouseY)
 
BOOL nearlyEqualPoints (INT x0, INT y0, INT x1, INT y1)
 
void placeSelWin (void)
 
void updateStartAndLast (LONG x, LONG y)
 
void updateLast (LONG x, LONG y)
 
static int Zoomed (int xy)
 
static int UnZoomed (int xy)
 

Macro Definition Documentation

◆ CHECKED_IF

#define CHECKED_IF (   a)    ((a) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND))

Definition at line 24 of file common.h.

◆ ENABLED_IF

#define ENABLED_IF (   a)    ((a) ? (MF_ENABLED | MF_BYCOMMAND) : (MF_GRAYED | MF_BYCOMMAND))

Definition at line 27 of file common.h.

◆ GRIP_SIZE

#define GRIP_SIZE   3

Definition at line 13 of file common.h.

◆ MAX_ZOOM

#define MAX_ZOOM   8000

Definition at line 15 of file common.h.

◆ MIN_ZOOM

#define MIN_ZOOM   125

Definition at line 14 of file common.h.

◆ RECT_HEIGHT

#define RECT_HEIGHT (   a)    ((a).bottom - (a).top)

Definition at line 21 of file common.h.

◆ RECT_WIDTH

#define RECT_WIDTH (   a)    ((a).right - (a).left)

Definition at line 18 of file common.h.

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().

◆ UnZoomed()

◆ 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().

◆ Zoomed()

◆ zoomTo()

BOOL zoomTo ( int  newZoom,
int  mouseX,
int  mouseY 
)

Definition at line 19 of file winproc.cpp.

20 {
21  RECT clientRectScrollbox;
22  RECT clientRectImageArea;
23  int x, y, w, h;
24  scrollboxWindow.GetClientRect(&clientRectScrollbox);
25  imageArea.GetClientRect(&clientRectImageArea);
26  w = clientRectImageArea.right * newZoom / toolsModel.GetZoom();
27  h = clientRectImageArea.bottom * newZoom / toolsModel.GetZoom();
28  if (!w || !h)
29  {
30  return FALSE;
31  }
32  w = clientRectImageArea.right * clientRectScrollbox.right / w;
33  h = clientRectImageArea.bottom * clientRectScrollbox.bottom / h;
34  x = max(0, min(clientRectImageArea.right - w, mouseX - w / 2)) * newZoom / toolsModel.GetZoom();
35  y = max(0, min(clientRectImageArea.bottom - h, mouseY - h / 2)) * newZoom / toolsModel.GetZoom();
36 
37  toolsModel.SetZoom(newZoom);
38 
40  scrollboxWindow.Invalidate(TRUE);
42 
45  return TRUE;
46 }
static int Zoomed(int xy)
Definition: common.h:37
ToolsModel toolsModel
Definition: main.cpp:18
#define max(a, b)
Definition: svc.c:63
#define MAKEWPARAM(l, h)
Definition: winuser.h:3989
BOOL MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint=TRUE)
Definition: atlwin.h:992
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define TRUE
Definition: types.h:120
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG right
Definition: windef.h:308
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
CImgAreaWindow imageArea
Definition: main.cpp:72
#define FALSE
Definition: types.h:117
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:507
#define SB_THUMBPOSITION
Definition: winuser.h:572
int GetWidth() const
Definition: history.cpp:215
int GetZoom() const
Definition: toolsmodel.cpp:148
#define GRIP_SIZE
Definition: common.h:13
ImageModel imageModel
Definition: main.cpp:32
void SetZoom(int nZoom)
Definition: toolsmodel.cpp:153
int GetHeight() const
Definition: history.cpp:220
#define min(a, b)
Definition: monoChain.cc:55
#define WM_HSCROLL
Definition: winuser.h:1730
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
CScrollboxWindow scrollboxWindow
Definition: main.cpp:69
BOOL Invalidate(BOOL bErase=TRUE)
Definition: atlwin.h:862
LONG bottom
Definition: windef.h:309
#define WM_VSCROLL
Definition: winuser.h:1731

Referenced by ZoomTool::OnButtonDown(), CMainWindow::OnCommand(), CMainWindow::OnMouseWheel(), and CToolSettingsWindow::OnVScroll().