ReactOS  0.4.15-dev-3193-g74513a7
winproc.cpp File Reference
#include "precomp.h"
#include "dialogs.h"
Include dependency graph for winproc.cpp:

Go to the source code of this file.


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

Function Documentation

◆ zoomTo()

BOOL zoomTo ( int  newZoom,
int  mouseX,
int  mouseY 

Definition at line 21 of file winproc.cpp.

22 {
23  RECT clientRectScrollbox;
24  RECT clientRectImageArea;
25  int x, y, w, h;
26  scrollboxWindow.GetClientRect(&clientRectScrollbox);
27  imageArea.GetClientRect(&clientRectImageArea);
28  w = clientRectImageArea.right * newZoom / toolsModel.GetZoom();
29  h = clientRectImageArea.bottom * newZoom / toolsModel.GetZoom();
30  if (!w || !h)
31  {
32  return FALSE;
33  }
34  w = clientRectImageArea.right * clientRectScrollbox.right / w;
35  h = clientRectImageArea.bottom * clientRectScrollbox.bottom / h;
36  x = max(0, min(clientRectImageArea.right - w, mouseX - w / 2)) * newZoom / toolsModel.GetZoom();
37  y = max(0, min(clientRectImageArea.bottom - h, mouseY - h / 2)) * newZoom / toolsModel.GetZoom();
39  toolsModel.SetZoom(newZoom);
41  selectionWindow.ShowWindow(SW_HIDE);
43  scrollboxWindow.Invalidate(TRUE);
48  return TRUE;
49 }
ToolsModel toolsModel
Definition: main.cpp:18
#define max(a, b)
Definition: svc.c:63
#define MAKEWPARAM(l, h)
Definition: winuser.h:3985
BOOL MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint=TRUE)
Definition: atlwin.h:961
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
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
int GetZoom()
Definition: toolsmodel.cpp:104
CImgAreaWindow imageArea
Definition: main.cpp:72
#define FALSE
Definition: types.h:117
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:507
Definition: winuser.h:572
int GetWidth()
Definition: history.cpp:194
int GetHeight()
Definition: history.cpp:199
ImageModel imageModel
Definition: main.cpp:32
void SetZoom(int nZoom)
Definition: toolsmodel.cpp:109
#define min(a, b)
#define WM_HSCROLL
Definition: winuser.h:1726
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:831
LONG bottom
Definition: windef.h:309
CSelectionWindow selectionWindow
Definition: main.cpp:71
#define WM_VSCROLL
Definition: winuser.h:1727

Referenced by CMainWindow::OnCommand(), CImgAreaWindow::OnLButtonDown(), CImgAreaWindow::OnRButtonDown(), and CToolSettingsWindow::OnVScroll().