mirror of
https://github.com/reactos/reactos.git
synced 2025-05-25 12:14:32 +00:00
[MSPAINT] Add Zoomed and UnZoomed and use them (#4188)
- Define Zoomed and UnZoomed helper functions. - Use them. CORE-17931
This commit is contained in:
parent
50cb4b3cb7
commit
9e1386db43
10 changed files with 59 additions and 48 deletions
|
@ -5,10 +5,21 @@
|
||||||
* PURPOSE: Commonly used functions
|
* PURPOSE: Commonly used functions
|
||||||
* PROGRAMMERS: Benedikt Freisen
|
* PROGRAMMERS: Benedikt Freisen
|
||||||
* Stanislav Motylkov
|
* Stanislav Motylkov
|
||||||
|
* Katayama Hirofumi MZ
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/* FUNCTIONS ********************************************************/
|
/* FUNCTIONS ********************************************************/
|
||||||
|
|
||||||
extern BOOL zoomTo(int, int, int);
|
BOOL zoomTo(int newZoom, int mouseX, int mouseY);
|
||||||
|
|
||||||
|
static inline int Zoomed(int xy)
|
||||||
|
{
|
||||||
|
return xy * toolsModel.GetZoom() / 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int UnZoomed(int xy)
|
||||||
|
{
|
||||||
|
return xy * 1000 / toolsModel.GetZoom();
|
||||||
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ updateCanvasAndScrollbars()
|
||||||
{
|
{
|
||||||
selectionWindow.ShowWindow(SW_HIDE);
|
selectionWindow.ShowWindow(SW_HIDE);
|
||||||
|
|
||||||
int zoomedWidth = imageModel.GetWidth() * toolsModel.GetZoom() / 1000;
|
int zoomedWidth = Zoomed(imageModel.GetWidth());
|
||||||
int zoomedHeight = imageModel.GetHeight() * toolsModel.GetZoom() / 1000;
|
int zoomedHeight = Zoomed(imageModel.GetHeight());
|
||||||
imageArea.MoveWindow(3, 3, zoomedWidth, zoomedHeight, FALSE);
|
imageArea.MoveWindow(3, 3, zoomedWidth, zoomedHeight, FALSE);
|
||||||
|
|
||||||
scrollboxWindow.Invalidate(TRUE);
|
scrollboxWindow.Invalidate(TRUE);
|
||||||
|
@ -76,26 +76,26 @@ LRESULT CImgAreaWindow::OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||||
0,
|
0,
|
||||||
0, 3, 3, TRUE);
|
0, 3, 3, TRUE);
|
||||||
sizeboxCenterTop.MoveWindow(
|
sizeboxCenterTop.MoveWindow(
|
||||||
imgXRes * toolsModel.GetZoom() / 2000 + 3 * 3 / 4,
|
Zoomed(imgXRes) / 2 + 3 * 3 / 4,
|
||||||
0, 3, 3, TRUE);
|
0, 3, 3, TRUE);
|
||||||
sizeboxRightTop.MoveWindow(
|
sizeboxRightTop.MoveWindow(
|
||||||
imgXRes * toolsModel.GetZoom() / 1000 + 3,
|
Zoomed(imgXRes) + 3,
|
||||||
0, 3, 3, TRUE);
|
0, 3, 3, TRUE);
|
||||||
sizeboxLeftCenter.MoveWindow(
|
sizeboxLeftCenter.MoveWindow(
|
||||||
0,
|
0,
|
||||||
imgYRes * toolsModel.GetZoom() / 2000 + 3 * 3 / 4, 3, 3, TRUE);
|
Zoomed(imgYRes) / 2 + 3 * 3 / 4, 3, 3, TRUE);
|
||||||
sizeboxRightCenter.MoveWindow(
|
sizeboxRightCenter.MoveWindow(
|
||||||
imgXRes * toolsModel.GetZoom() / 1000 + 3,
|
Zoomed(imgXRes) + 3,
|
||||||
imgYRes * toolsModel.GetZoom() / 2000 + 3 * 3 / 4, 3, 3, TRUE);
|
Zoomed(imgYRes) / 2 + 3 * 3 / 4, 3, 3, TRUE);
|
||||||
sizeboxLeftBottom.MoveWindow(
|
sizeboxLeftBottom.MoveWindow(
|
||||||
0,
|
0,
|
||||||
imgYRes * toolsModel.GetZoom() / 1000 + 3, 3, 3, TRUE);
|
Zoomed(imgYRes) + 3, 3, 3, TRUE);
|
||||||
sizeboxCenterBottom.MoveWindow(
|
sizeboxCenterBottom.MoveWindow(
|
||||||
imgXRes * toolsModel.GetZoom() / 2000 + 3 * 3 / 4,
|
Zoomed(imgXRes) / 2 + 3 * 3 / 4,
|
||||||
imgYRes * toolsModel.GetZoom() / 1000 + 3, 3, 3, TRUE);
|
Zoomed(imgYRes) + 3, 3, 3, TRUE);
|
||||||
sizeboxRightBottom.MoveWindow(
|
sizeboxRightBottom.MoveWindow(
|
||||||
imgXRes * toolsModel.GetZoom() / 1000 + 3,
|
Zoomed(imgXRes) + 3,
|
||||||
imgYRes * toolsModel.GetZoom() / 1000 + 3, 3, 3, TRUE);
|
Zoomed(imgYRes) + 3, 3, 3, TRUE);
|
||||||
UpdateScrollbox();
|
UpdateScrollbox();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ LRESULT CImgAreaWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b
|
||||||
HDC hdc = GetDC();
|
HDC hdc = GetDC();
|
||||||
int imgXRes = imageModel.GetWidth();
|
int imgXRes = imageModel.GetWidth();
|
||||||
int imgYRes = imageModel.GetHeight();
|
int imgYRes = imageModel.GetHeight();
|
||||||
StretchBlt(hdc, 0, 0, imgXRes * toolsModel.GetZoom() / 1000, imgYRes * toolsModel.GetZoom() / 1000, imageModel.GetDC(), 0, 0, imgXRes,
|
StretchBlt(hdc, 0, 0, Zoomed(imgXRes), Zoomed(imgYRes), imageModel.GetDC(), 0, 0, imgXRes,
|
||||||
imgYRes, SRCCOPY);
|
imgYRes, SRCCOPY);
|
||||||
if (showGrid && (toolsModel.GetZoom() >= 4000))
|
if (showGrid && (toolsModel.GetZoom() >= 4000))
|
||||||
{
|
{
|
||||||
|
@ -114,13 +114,13 @@ LRESULT CImgAreaWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b
|
||||||
int counter;
|
int counter;
|
||||||
for(counter = 0; counter <= imgYRes; counter++)
|
for(counter = 0; counter <= imgYRes; counter++)
|
||||||
{
|
{
|
||||||
MoveToEx(hdc, 0, counter * toolsModel.GetZoom() / 1000, NULL);
|
MoveToEx(hdc, 0, Zoomed(counter), NULL);
|
||||||
LineTo(hdc, imgXRes * toolsModel.GetZoom() / 1000, counter * toolsModel.GetZoom() / 1000);
|
LineTo(hdc, Zoomed(imgXRes), Zoomed(counter));
|
||||||
}
|
}
|
||||||
for(counter = 0; counter <= imgXRes; counter++)
|
for(counter = 0; counter <= imgXRes; counter++)
|
||||||
{
|
{
|
||||||
MoveToEx(hdc, counter * toolsModel.GetZoom() / 1000, 0, NULL);
|
MoveToEx(hdc, Zoomed(counter), 0, NULL);
|
||||||
LineTo(hdc, counter * toolsModel.GetZoom() / 1000, imgYRes * toolsModel.GetZoom() / 1000);
|
LineTo(hdc, Zoomed(counter), Zoomed(imgYRes));
|
||||||
}
|
}
|
||||||
DeleteObject(SelectObject(hdc, oldPen));
|
DeleteObject(SelectObject(hdc, oldPen));
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ LRESULT CImgAreaWindow::OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, B
|
||||||
{
|
{
|
||||||
SetCapture();
|
SetCapture();
|
||||||
drawing = TRUE;
|
drawing = TRUE;
|
||||||
startPaintingL(imageModel.GetDC(), GET_X_LPARAM(lParam) * 1000 / toolsModel.GetZoom(), GET_Y_LPARAM(lParam) * 1000 / toolsModel.GetZoom(),
|
startPaintingL(imageModel.GetDC(), UnZoomed(GET_X_LPARAM(lParam)), UnZoomed(GET_Y_LPARAM(lParam)),
|
||||||
paletteModel.GetFgColor(), paletteModel.GetBgColor());
|
paletteModel.GetFgColor(), paletteModel.GetBgColor());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -181,7 +181,7 @@ LRESULT CImgAreaWindow::OnRButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, B
|
||||||
{
|
{
|
||||||
SetCapture();
|
SetCapture();
|
||||||
drawing = TRUE;
|
drawing = TRUE;
|
||||||
startPaintingR(imageModel.GetDC(), GET_X_LPARAM(lParam) * 1000 / toolsModel.GetZoom(), GET_Y_LPARAM(lParam) * 1000 / toolsModel.GetZoom(),
|
startPaintingR(imageModel.GetDC(), UnZoomed(GET_X_LPARAM(lParam)), UnZoomed(GET_Y_LPARAM(lParam)),
|
||||||
paletteModel.GetFgColor(), paletteModel.GetBgColor());
|
paletteModel.GetFgColor(), paletteModel.GetBgColor());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -199,13 +199,13 @@ LRESULT CImgAreaWindow::OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||||
{
|
{
|
||||||
if (drawing)
|
if (drawing)
|
||||||
{
|
{
|
||||||
endPaintingL(imageModel.GetDC(), GET_X_LPARAM(lParam) * 1000 / toolsModel.GetZoom(), GET_Y_LPARAM(lParam) * 1000 / toolsModel.GetZoom(), paletteModel.GetFgColor(),
|
endPaintingL(imageModel.GetDC(), UnZoomed(GET_X_LPARAM(lParam)), UnZoomed(GET_Y_LPARAM(lParam)), paletteModel.GetFgColor(),
|
||||||
paletteModel.GetBgColor());
|
paletteModel.GetBgColor());
|
||||||
Invalidate(FALSE);
|
Invalidate(FALSE);
|
||||||
if (toolsModel.GetActiveTool() == TOOL_COLOR)
|
if (toolsModel.GetActiveTool() == TOOL_COLOR)
|
||||||
{
|
{
|
||||||
COLORREF tempColor =
|
COLORREF tempColor =
|
||||||
GetPixel(imageModel.GetDC(), GET_X_LPARAM(lParam) * 1000 / toolsModel.GetZoom(), GET_Y_LPARAM(lParam) * 1000 / toolsModel.GetZoom());
|
GetPixel(imageModel.GetDC(), UnZoomed(GET_X_LPARAM(lParam)), UnZoomed(GET_Y_LPARAM(lParam)));
|
||||||
if (tempColor != CLR_INVALID)
|
if (tempColor != CLR_INVALID)
|
||||||
paletteModel.SetFgColor(tempColor);
|
paletteModel.SetFgColor(tempColor);
|
||||||
}
|
}
|
||||||
|
@ -234,12 +234,12 @@ void CImgAreaWindow::cancelDrawing()
|
||||||
// FIXME: dirty hack
|
// FIXME: dirty hack
|
||||||
if (GetKeyState(VK_LBUTTON) < 0)
|
if (GetKeyState(VK_LBUTTON) < 0)
|
||||||
{
|
{
|
||||||
endPaintingL(imageModel.GetDC(), pt.x * 1000 / toolsModel.GetZoom(), pt.y * 1000 / toolsModel.GetZoom(), paletteModel.GetFgColor(),
|
endPaintingL(imageModel.GetDC(), UnZoomed(pt.x), UnZoomed(pt.y), paletteModel.GetFgColor(),
|
||||||
paletteModel.GetBgColor());
|
paletteModel.GetBgColor());
|
||||||
}
|
}
|
||||||
else if (GetKeyState(VK_RBUTTON) < 0)
|
else if (GetKeyState(VK_RBUTTON) < 0)
|
||||||
{
|
{
|
||||||
endPaintingR(imageModel.GetDC(), pt.x * 1000 / toolsModel.GetZoom(), pt.y * 1000 / toolsModel.GetZoom(), paletteModel.GetFgColor(),
|
endPaintingR(imageModel.GetDC(), UnZoomed(pt.x), UnZoomed(pt.y), paletteModel.GetFgColor(),
|
||||||
paletteModel.GetBgColor());
|
paletteModel.GetBgColor());
|
||||||
}
|
}
|
||||||
imageModel.Undo();
|
imageModel.Undo();
|
||||||
|
@ -283,13 +283,13 @@ LRESULT CImgAreaWindow::OnRButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||||
{
|
{
|
||||||
if (drawing)
|
if (drawing)
|
||||||
{
|
{
|
||||||
endPaintingR(imageModel.GetDC(), GET_X_LPARAM(lParam) * 1000 / toolsModel.GetZoom(), GET_Y_LPARAM(lParam) * 1000 / toolsModel.GetZoom(), paletteModel.GetFgColor(),
|
endPaintingR(imageModel.GetDC(), UnZoomed(GET_X_LPARAM(lParam)), UnZoomed(GET_Y_LPARAM(lParam)), paletteModel.GetFgColor(),
|
||||||
paletteModel.GetBgColor());
|
paletteModel.GetBgColor());
|
||||||
Invalidate(FALSE);
|
Invalidate(FALSE);
|
||||||
if (toolsModel.GetActiveTool() == TOOL_COLOR)
|
if (toolsModel.GetActiveTool() == TOOL_COLOR)
|
||||||
{
|
{
|
||||||
COLORREF tempColor =
|
COLORREF tempColor =
|
||||||
GetPixel(imageModel.GetDC(), GET_X_LPARAM(lParam) * 1000 / toolsModel.GetZoom(), GET_Y_LPARAM(lParam) * 1000 / toolsModel.GetZoom());
|
GetPixel(imageModel.GetDC(), UnZoomed(GET_X_LPARAM(lParam)), UnZoomed(GET_Y_LPARAM(lParam)));
|
||||||
if (tempColor != CLR_INVALID)
|
if (tempColor != CLR_INVALID)
|
||||||
paletteModel.SetBgColor(tempColor);
|
paletteModel.SetBgColor(tempColor);
|
||||||
}
|
}
|
||||||
|
@ -302,8 +302,8 @@ LRESULT CImgAreaWindow::OnRButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||||
|
|
||||||
LRESULT CImgAreaWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT CImgAreaWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
LONG xNow = GET_X_LPARAM(lParam) * 1000 / toolsModel.GetZoom();
|
LONG xNow = UnZoomed(GET_X_LPARAM(lParam));
|
||||||
LONG yNow = GET_Y_LPARAM(lParam) * 1000 / toolsModel.GetZoom();
|
LONG yNow = UnZoomed(GET_Y_LPARAM(lParam));
|
||||||
if ((!drawing) || (toolsModel.GetActiveTool() <= TOOL_AIRBRUSH))
|
if ((!drawing) || (toolsModel.GetActiveTool() <= TOOL_AIRBRUSH))
|
||||||
{
|
{
|
||||||
TRACKMOUSEEVENT tme;
|
TRACKMOUSEEVENT tme;
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
void
|
void
|
||||||
placeSelWin()
|
placeSelWin()
|
||||||
{
|
{
|
||||||
selectionWindow.MoveWindow(selectionModel.GetDestRectLeft() * toolsModel.GetZoom() / 1000, selectionModel.GetDestRectTop() * toolsModel.GetZoom() / 1000,
|
selectionWindow.MoveWindow(Zoomed(selectionModel.GetDestRectLeft()), Zoomed(selectionModel.GetDestRectTop()),
|
||||||
selectionModel.GetDestRectWidth() * toolsModel.GetZoom() / 1000 + 6, selectionModel.GetDestRectHeight() * toolsModel.GetZoom() / 1000 + 6, TRUE);
|
Zoomed(selectionModel.GetDestRectWidth()) + 6, Zoomed(selectionModel.GetDestRectHeight()) + 6, TRUE);
|
||||||
selectionWindow.BringWindowToTop();
|
selectionWindow.BringWindowToTop();
|
||||||
imageArea.InvalidateRect(NULL, FALSE);
|
imageArea.InvalidateRect(NULL, FALSE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include <htmlhelp.h>
|
#include <htmlhelp.h>
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
#include "definitions.h"
|
#include "definitions.h"
|
||||||
#include "drawing.h"
|
#include "drawing.h"
|
||||||
#include "dib.h"
|
#include "dib.h"
|
||||||
|
@ -43,5 +42,6 @@
|
||||||
#include "toolsettings.h"
|
#include "toolsettings.h"
|
||||||
#include "toolsmodel.h"
|
#include "toolsmodel.h"
|
||||||
#include "winproc.h"
|
#include "winproc.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
#endif /* _MSPAINT_H */
|
#endif /* _MSPAINT_H */
|
||||||
|
|
|
@ -132,8 +132,8 @@ LRESULT CScrollboxWindow::OnHScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||||
}
|
}
|
||||||
scrollboxWindow.SetScrollInfo(SB_HORZ, &si);
|
scrollboxWindow.SetScrollInfo(SB_HORZ, &si);
|
||||||
scrlClientWindow.MoveWindow(-scrollboxWindow.GetScrollPos(SB_HORZ),
|
scrlClientWindow.MoveWindow(-scrollboxWindow.GetScrollPos(SB_HORZ),
|
||||||
-scrollboxWindow.GetScrollPos(SB_VERT), imageModel.GetWidth() * toolsModel.GetZoom() / 1000 + 6,
|
-scrollboxWindow.GetScrollPos(SB_VERT), Zoomed(imageModel.GetWidth()) + 6,
|
||||||
imageModel.GetHeight() * toolsModel.GetZoom() / 1000 + 6, TRUE);
|
Zoomed(imageModel.GetHeight()) + 6, TRUE);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -167,8 +167,8 @@ LRESULT CScrollboxWindow::OnVScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||||
}
|
}
|
||||||
scrollboxWindow.SetScrollInfo(SB_VERT, &si);
|
scrollboxWindow.SetScrollInfo(SB_VERT, &si);
|
||||||
scrlClientWindow.MoveWindow(-scrollboxWindow.GetScrollPos(SB_HORZ),
|
scrlClientWindow.MoveWindow(-scrollboxWindow.GetScrollPos(SB_HORZ),
|
||||||
-scrollboxWindow.GetScrollPos(SB_VERT), imageModel.GetWidth() * toolsModel.GetZoom() / 1000 + 6,
|
-scrollboxWindow.GetScrollPos(SB_VERT), Zoomed(imageModel.GetWidth()) + 6,
|
||||||
imageModel.GetHeight() * toolsModel.GetZoom() / 1000 + 6, TRUE);
|
Zoomed(imageModel.GetHeight()) + 6, TRUE);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,8 +99,8 @@ LRESULT CSelectionWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
|
||||||
{
|
{
|
||||||
HDC hDC = GetDC();
|
HDC hDC = GetDC();
|
||||||
DefWindowProc(WM_PAINT, wParam, lParam);
|
DefWindowProc(WM_PAINT, wParam, lParam);
|
||||||
SelectionFrame(hDC, 1, 1, selectionModel.GetDestRectWidth() * toolsModel.GetZoom() / 1000 + 5,
|
SelectionFrame(hDC, 1, 1, Zoomed(selectionModel.GetDestRectWidth()) + 5,
|
||||||
selectionModel.GetDestRectHeight() * toolsModel.GetZoom() / 1000 + 5,
|
Zoomed(selectionModel.GetDestRectHeight()) + 5,
|
||||||
m_dwSystemSelectionColor);
|
m_dwSystemSelectionColor);
|
||||||
ReleaseDC(hDC);
|
ReleaseDC(hDC);
|
||||||
}
|
}
|
||||||
|
@ -161,8 +161,8 @@ LRESULT CSelectionWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, B
|
||||||
imageModel.ResetToPrevious();
|
imageModel.ResetToPrevious();
|
||||||
m_ptFrac.x += GET_X_LPARAM(lParam) - m_ptPos.x;
|
m_ptFrac.x += GET_X_LPARAM(lParam) - m_ptPos.x;
|
||||||
m_ptFrac.y += GET_Y_LPARAM(lParam) - m_ptPos.y;
|
m_ptFrac.y += GET_Y_LPARAM(lParam) - m_ptPos.y;
|
||||||
m_ptDelta.x += m_ptFrac.x * 1000 / toolsModel.GetZoom();
|
m_ptDelta.x += UnZoomed(m_ptFrac.x);
|
||||||
m_ptDelta.y += m_ptFrac.y * 1000 / toolsModel.GetZoom();
|
m_ptDelta.y += UnZoomed(m_ptFrac.y);
|
||||||
if (toolsModel.GetZoom() < 1000)
|
if (toolsModel.GetZoom() < 1000)
|
||||||
{
|
{
|
||||||
m_ptFrac.x = 0;
|
m_ptFrac.x = 0;
|
||||||
|
@ -170,8 +170,8 @@ LRESULT CSelectionWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, B
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_ptFrac.x -= (m_ptFrac.x * 1000 / toolsModel.GetZoom()) * toolsModel.GetZoom() / 1000;
|
m_ptFrac.x -= Zoomed(UnZoomed(m_ptFrac.x));
|
||||||
m_ptFrac.y -= (m_ptFrac.y * 1000 / toolsModel.GetZoom()) * toolsModel.GetZoom() / 1000;
|
m_ptFrac.y -= Zoomed(UnZoomed(m_ptFrac.y));
|
||||||
}
|
}
|
||||||
selectionModel.ModifyDestRect(m_ptDelta, m_iAction);
|
selectionModel.ModifyDestRect(m_ptDelta, m_iAction);
|
||||||
|
|
||||||
|
@ -197,8 +197,8 @@ LRESULT CSelectionWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, B
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int w = selectionModel.GetDestRectWidth() * toolsModel.GetZoom() / 1000 + 6;
|
int w = Zoomed(selectionModel.GetDestRectWidth()) + 6;
|
||||||
int h = selectionModel.GetDestRectHeight() * toolsModel.GetZoom() / 1000 + 6;
|
int h = Zoomed(selectionModel.GetDestRectHeight()) + 6;
|
||||||
m_ptPos.x = GET_X_LPARAM(lParam);
|
m_ptPos.x = GET_X_LPARAM(lParam);
|
||||||
m_ptPos.y = GET_Y_LPARAM(lParam);
|
m_ptPos.y = GET_Y_LPARAM(lParam);
|
||||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) NULL);
|
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) NULL);
|
||||||
|
|
|
@ -48,8 +48,8 @@ LRESULT CSizeboxWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||||
short yRel;
|
short yRel;
|
||||||
int imgXRes = imageModel.GetWidth();
|
int imgXRes = imageModel.GetWidth();
|
||||||
int imgYRes = imageModel.GetHeight();
|
int imgYRes = imageModel.GetHeight();
|
||||||
xRel = (GET_X_LPARAM(lParam) - xOrig) * 1000 / toolsModel.GetZoom();
|
xRel = UnZoomed(GET_X_LPARAM(lParam) - xOrig);
|
||||||
yRel = (GET_Y_LPARAM(lParam) - yOrig) * 1000 / toolsModel.GetZoom();
|
yRel = UnZoomed(GET_Y_LPARAM(lParam) - yOrig);
|
||||||
if (m_hWnd == sizeboxLeftTop.m_hWnd)
|
if (m_hWnd == sizeboxLeftTop.m_hWnd)
|
||||||
strSize.Format(_T("%d x %d"), imgXRes - xRel, imgYRes - yRel);
|
strSize.Format(_T("%d x %d"), imgXRes - xRel, imgYRes - yRel);
|
||||||
if (m_hWnd == sizeboxCenterTop.m_hWnd)
|
if (m_hWnd == sizeboxCenterTop.m_hWnd)
|
||||||
|
|
|
@ -101,7 +101,7 @@ void ToolsModel::SetBackgroundTransparent(BOOL bTransparent)
|
||||||
NotifyToolSettingsChanged();
|
NotifyToolSettingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ToolsModel::GetZoom()
|
int ToolsModel::GetZoom() const
|
||||||
{
|
{
|
||||||
return m_zoom;
|
return m_zoom;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,6 @@ public:
|
||||||
void SetRubberRadius(int nRubberRadius);
|
void SetRubberRadius(int nRubberRadius);
|
||||||
BOOL IsBackgroundTransparent();
|
BOOL IsBackgroundTransparent();
|
||||||
void SetBackgroundTransparent(BOOL bTransparent);
|
void SetBackgroundTransparent(BOOL bTransparent);
|
||||||
int GetZoom();
|
int GetZoom() const;
|
||||||
void SetZoom(int nZoom);
|
void SetZoom(int nZoom);
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,7 +39,7 @@ zoomTo(int newZoom, int mouseX, int mouseY)
|
||||||
toolsModel.SetZoom(newZoom);
|
toolsModel.SetZoom(newZoom);
|
||||||
|
|
||||||
selectionWindow.ShowWindow(SW_HIDE);
|
selectionWindow.ShowWindow(SW_HIDE);
|
||||||
imageArea.MoveWindow(3, 3, imageModel.GetWidth() * toolsModel.GetZoom() / 1000, imageModel.GetHeight() * toolsModel.GetZoom() / 1000, FALSE);
|
imageArea.MoveWindow(3, 3, Zoomed(imageModel.GetWidth()), Zoomed(imageModel.GetHeight()), FALSE);
|
||||||
scrollboxWindow.Invalidate(TRUE);
|
scrollboxWindow.Invalidate(TRUE);
|
||||||
imageArea.Invalidate(FALSE);
|
imageArea.Invalidate(FALSE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue