ReactOS  0.4.15-dev-3723-g8d70159
winproc.cpp File Reference
#include "precomp.h"
Include dependency graph for winproc.cpp:

Go to the source code of this file.

Macros

#define SPI_GETWHEELSCROLLCHARS   0x006C
 

Functions

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

Macro Definition Documentation

◆ SPI_GETWHEELSCROLLCHARS

#define SPI_GETWHEELSCROLLCHARS   0x006C

Function Documentation

◆ 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:199
int GetZoom() const
Definition: toolsmodel.cpp:149
#define GRIP_SIZE
Definition: common.h:13
ImageModel imageModel
Definition: main.cpp:32
void SetZoom(int nZoom)
Definition: toolsmodel.cpp:154
int GetHeight() const
Definition: history.cpp:204
#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().