ReactOS 0.4.15-dev-6068-g8061a6f
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 MAX_LONG_PATH   512
 
#define WM_TOOLSMODELTOOLCHANGED   (WM_APP + 0)
 
#define WM_TOOLSMODELSETTINGSCHANGED   (WM_APP + 1)
 
#define WM_TOOLSMODELZOOMCHANGED   (WM_APP + 2)
 
#define WM_PALETTEMODELCOLORCHANGED   (WM_APP + 3)
 
#define WM_PALETTEMODELPALETTECHANGED   (WM_APP + 4)
 
#define WM_IMAGEMODELDIMENSIONSCHANGED   (WM_APP + 5)
 
#define WM_IMAGEMODELIMAGECHANGED   (WM_APP + 6)
 
#define WM_SELECTIONMODELREFRESHNEEDED   (WM_APP + 7)
 
#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))
 

Enumerations

enum  CANVAS_HITTEST {
  HIT_NONE = 0 , HIT_UPPER_LEFT , HIT_UPPER_CENTER , HIT_UPPER_RIGHT ,
  HIT_MIDDLE_LEFT , HIT_MIDDLE_RIGHT , HIT_LOWER_LEFT , HIT_LOWER_CENTER ,
  HIT_LOWER_RIGHT , HIT_BORDER , HIT_INNER
}
 

Functions

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

Macro Definition Documentation

◆ CHECKED_IF

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

Definition at line 35 of file common.h.

◆ ENABLED_IF

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

Definition at line 38 of file common.h.

◆ GRIP_SIZE

#define GRIP_SIZE   3

Definition at line 13 of file common.h.

◆ MAX_LONG_PATH

#define MAX_LONG_PATH   512

Definition at line 17 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 32 of file common.h.

◆ RECT_WIDTH

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

Definition at line 29 of file common.h.

◆ WM_IMAGEMODELDIMENSIONSCHANGED

#define WM_IMAGEMODELDIMENSIONSCHANGED   (WM_APP + 5)

Definition at line 24 of file common.h.

◆ WM_IMAGEMODELIMAGECHANGED

#define WM_IMAGEMODELIMAGECHANGED   (WM_APP + 6)

Definition at line 25 of file common.h.

◆ WM_PALETTEMODELCOLORCHANGED

#define WM_PALETTEMODELCOLORCHANGED   (WM_APP + 3)

Definition at line 22 of file common.h.

◆ WM_PALETTEMODELPALETTECHANGED

#define WM_PALETTEMODELPALETTECHANGED   (WM_APP + 4)

Definition at line 23 of file common.h.

◆ WM_SELECTIONMODELREFRESHNEEDED

#define WM_SELECTIONMODELREFRESHNEEDED   (WM_APP + 7)

Definition at line 26 of file common.h.

◆ WM_TOOLSMODELSETTINGSCHANGED

#define WM_TOOLSMODELSETTINGSCHANGED   (WM_APP + 1)

Definition at line 20 of file common.h.

◆ WM_TOOLSMODELTOOLCHANGED

#define WM_TOOLSMODELTOOLCHANGED   (WM_APP + 0)

Definition at line 19 of file common.h.

◆ WM_TOOLSMODELZOOMCHANGED

#define WM_TOOLSMODELZOOMCHANGED   (WM_APP + 2)

Definition at line 21 of file common.h.

Enumeration Type Documentation

◆ CANVAS_HITTEST

Enumerator
HIT_NONE 
HIT_UPPER_LEFT 
HIT_UPPER_CENTER 
HIT_UPPER_RIGHT 
HIT_MIDDLE_LEFT 
HIT_MIDDLE_RIGHT 
HIT_LOWER_LEFT 
HIT_LOWER_CENTER 
HIT_LOWER_RIGHT 
HIT_BORDER 
HIT_INNER 

Definition at line 40 of file common.h.

41{
42 HIT_NONE = 0, // Nothing hit or outside
53};
@ HIT_NONE
Definition: common.h:42
@ HIT_BORDER
Definition: common.h:51
@ HIT_LOWER_RIGHT
Definition: common.h:50
@ HIT_LOWER_CENTER
Definition: common.h:49
@ HIT_UPPER_LEFT
Definition: common.h:43
@ HIT_INNER
Definition: common.h:52
@ HIT_LOWER_LEFT
Definition: common.h:48
@ HIT_UPPER_CENTER
Definition: common.h:44
@ HIT_UPPER_RIGHT
Definition: common.h:45
@ HIT_MIDDLE_RIGHT
Definition: common.h:47
@ HIT_MIDDLE_LEFT
Definition: common.h:46

Function Documentation

◆ nearlyEqualPoints()

BOOL nearlyEqualPoints ( INT  x0,
INT  y0,
INT  x1,
INT  y1 
)

Definition at line 47 of file mouse.cpp.

48{
51 return (abs(x1 - x0) <= cxThreshold) && (abs(y1 - y0) <= cyThreshold);
52}
int GetLineWidth() const
Definition: toolsmodel.cpp:43
#define abs(i)
Definition: fconv.c:206
ToolsModel toolsModel
Definition: toolsmodel.cpp:11
GLint y0
Definition: linetemp.h:96
GLint x0
Definition: linetemp.h:95
static int UnZoomed(int xy)
Definition: toolsmodel.h:131
int32_t INT
Definition: typedefs.h:58
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
#define SM_CXDRAG
Definition: winuser.h:1022
#define SM_CYDRAG
Definition: winuser.h:1023
int WINAPI GetSystemMetrics(_In_ int)

Referenced by ShapeTool::OnButtonUp().

◆ updateLast()

void updateLast ( LONG  x,
LONG  y 
)

Definition at line 60 of file mouse.cpp.

61{
62 last.x = x;
63 last.y = y;
64}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
POINT last
Definition: font.c:46
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48

Referenced by ToolsModel::OnButtonUp(), and ToolsModel::OnMouseMove().

◆ updateStartAndLast()

void updateStartAndLast ( LONG  x,
LONG  y 
)

Definition at line 54 of file mouse.cpp.

55{
56 start.x = last.x = x;
57 start.y = last.y = y;
58}
GLuint start
Definition: gl.h:1545

Referenced by ToolsModel::OnButtonDown().

◆ zoomTo()

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

Definition at line 46 of file winproc.cpp.

47{
48 int x, y, w, h;
49 RECT clientRectScrollbox;
50 canvasWindow.GetClientRect(&clientRectScrollbox);
51
52 RECT clientRectImageArea;
53 ::SetRect(&clientRectImageArea, 0, 0, imageModel.GetWidth(), imageModel.GetHeight());
54 Zoomed(clientRectImageArea);
55
56 w = clientRectImageArea.right * newZoom / toolsModel.GetZoom();
57 h = clientRectImageArea.bottom * newZoom / toolsModel.GetZoom();
58 if (!w || !h)
59 {
60 return FALSE;
61 }
62 w = clientRectImageArea.right * clientRectScrollbox.right / w;
63 h = clientRectImageArea.bottom * clientRectScrollbox.bottom / h;
64 x = max(0, min(clientRectImageArea.right - w, mouseX - w / 2)) * newZoom / toolsModel.GetZoom();
65 y = max(0, min(clientRectImageArea.bottom - h, mouseY - h / 2)) * newZoom / toolsModel.GetZoom();
66
67 toolsModel.SetZoom(newZoom);
68
69 canvasWindow.Invalidate(TRUE);
70
73 return TRUE;
74}
CCanvasWindow canvasWindow
Definition: canvas.cpp:11
int GetWidth() const
Definition: history.cpp:215
int GetHeight() const
Definition: history.cpp:220
int GetZoom() const
Definition: toolsmodel.cpp:148
void SetZoom(int nZoom)
Definition: toolsmodel.cpp:153
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
ImageModel imageModel
Definition: history.cpp:11
#define min(a, b)
Definition: monoChain.cc:55
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
#define max(a, b)
Definition: svc.c:63
static int Zoomed(int xy)
Definition: toolsmodel.h:126
#define MAKEWPARAM(l, h)
Definition: winuser.h:3999
#define WM_HSCROLL
Definition: winuser.h:1733
#define WM_VSCROLL
Definition: winuser.h:1734
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define SB_THUMBPOSITION
Definition: winuser.h:572

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