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

Go to the source code of this file.




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

Macro Definition Documentation



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();
37  toolsModel.SetZoom(newZoom);
40  scrollboxWindow.Invalidate(TRUE);
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:3999
BOOL MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint=TRUE)
Definition: atlwin.h:1020
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:535
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)
#define WM_HSCROLL
Definition: winuser.h:1733
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:890
LONG bottom
Definition: windef.h:309
#define WM_VSCROLL
Definition: winuser.h:1734

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