mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
[MSPAINT_NEW] split CMainWindow: factor out CImgAreaWindow and CMiniatureWindow (second batch of git commits)
svn path=/trunk/; revision=68366
This commit is contained in:
parent
0dcecd61fc
commit
ae313a0aee
10 changed files with 453 additions and 366 deletions
|
@ -9,7 +9,9 @@ list(APPEND SOURCE
|
|||
dib.cpp
|
||||
drawing.cpp
|
||||
history.cpp
|
||||
imgarea.cpp
|
||||
main.cpp
|
||||
miniature.cpp
|
||||
mouse.cpp
|
||||
palette.cpp
|
||||
registry.cpp
|
||||
|
|
|
@ -96,22 +96,24 @@ extern BOOL showGrid;
|
|||
extern BOOL showMiniature;
|
||||
|
||||
class CMainWindow;
|
||||
class CMiniatureWindow;
|
||||
class CToolSettingsWindow;
|
||||
class CPaletteWindow;
|
||||
class CScrollboxWindow;
|
||||
class CSelectionWindow;
|
||||
class CImgAreaWindow;
|
||||
class CSizeboxWindow;
|
||||
class CTextEditWindow;
|
||||
|
||||
extern CMainWindow mainWindow;
|
||||
extern CMainWindow miniature;
|
||||
extern CMiniatureWindow miniature;
|
||||
extern CMainWindow toolBoxContainer;
|
||||
extern CToolSettingsWindow toolSettingsWindow;
|
||||
extern CPaletteWindow paletteWindow;
|
||||
extern CScrollboxWindow scrollboxWindow;
|
||||
extern CScrollboxWindow scrlClientWindow;
|
||||
extern CSelectionWindow selectionWindow;
|
||||
extern CMainWindow imageArea;
|
||||
extern CImgAreaWindow imageArea;
|
||||
extern CSizeboxWindow sizeboxLeftTop;
|
||||
extern CSizeboxWindow sizeboxCenterTop;
|
||||
extern CSizeboxWindow sizeboxRightTop;
|
||||
|
|
323
reactos/base/applications/mspaint_new/imgarea.cpp
Normal file
323
reactos/base/applications/mspaint_new/imgarea.cpp
Normal file
|
@ -0,0 +1,323 @@
|
|||
/*
|
||||
* PROJECT: PAINT for ReactOS
|
||||
* LICENSE: LGPL
|
||||
* FILE: base/applications/mspaint_new/imgarea.cpp
|
||||
* PURPOSE: Window procedure of the main window and all children apart from
|
||||
* hPalWin, hToolSettings and hSelection
|
||||
* PROGRAMMERS: Benedikt Freisen
|
||||
*/
|
||||
|
||||
/* INCLUDES *********************************************************/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
#include "dialogs.h"
|
||||
#include "registry.h"
|
||||
|
||||
/* FUNCTIONS ********************************************************/
|
||||
|
||||
extern void
|
||||
zoomTo(int newZoom, int mouseX, int mouseY);
|
||||
|
||||
void CImgAreaWindow::drawZoomFrame(int mouseX, int mouseY)
|
||||
{
|
||||
HDC hdc;
|
||||
HPEN oldPen;
|
||||
HBRUSH oldBrush;
|
||||
LOGBRUSH logbrush;
|
||||
int rop;
|
||||
|
||||
RECT clientRectScrollbox;
|
||||
RECT clientRectImageArea;
|
||||
int x, y, w, h;
|
||||
scrollboxWindow.GetClientRect(&clientRectScrollbox);
|
||||
GetClientRect(&clientRectImageArea);
|
||||
w = clientRectImageArea.right * clientRectScrollbox.right / (clientRectImageArea.right * 2);
|
||||
h = clientRectImageArea.bottom * clientRectScrollbox.bottom / (clientRectImageArea.bottom * 2);
|
||||
x = max(0, min(clientRectImageArea.right - w, mouseX - w / 2));
|
||||
y = max(0, min(clientRectImageArea.bottom - h, mouseY - h / 2));
|
||||
|
||||
hdc = GetDC();
|
||||
oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, 0, 0));
|
||||
logbrush.lbStyle = BS_HOLLOW;
|
||||
oldBrush = (HBRUSH) SelectObject(hdc, CreateBrushIndirect(&logbrush));
|
||||
rop = SetROP2(hdc, R2_NOT);
|
||||
Rectangle(hdc, x, y, x + w, y + h);
|
||||
SetROP2(hdc, rop);
|
||||
DeleteObject(SelectObject(hdc, oldBrush));
|
||||
DeleteObject(SelectObject(hdc, oldPen));
|
||||
ReleaseDC(hdc);
|
||||
}
|
||||
|
||||
LRESULT CImgAreaWindow::OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
sizeboxLeftTop.MoveWindow(
|
||||
0,
|
||||
0, 3, 3, TRUE);
|
||||
sizeboxCenterTop.MoveWindow(
|
||||
imgXRes * zoom / 2000 + 3 * 3 / 4,
|
||||
0, 3, 3, TRUE);
|
||||
sizeboxRightTop.MoveWindow(
|
||||
imgXRes * zoom / 1000 + 3,
|
||||
0, 3, 3, TRUE);
|
||||
sizeboxLeftCenter.MoveWindow(
|
||||
0,
|
||||
imgYRes * zoom / 2000 + 3 * 3 / 4, 3, 3, TRUE);
|
||||
sizeboxRightCenter.MoveWindow(
|
||||
imgXRes * zoom / 1000 + 3,
|
||||
imgYRes * zoom / 2000 + 3 * 3 / 4, 3, 3, TRUE);
|
||||
sizeboxLeftBottom.MoveWindow(
|
||||
0,
|
||||
imgYRes * zoom / 1000 + 3, 3, 3, TRUE);
|
||||
sizeboxCenterBottom.MoveWindow(
|
||||
imgXRes * zoom / 2000 + 3 * 3 / 4,
|
||||
imgYRes * zoom / 1000 + 3, 3, 3, TRUE);
|
||||
sizeboxRightBottom.MoveWindow(
|
||||
imgXRes * zoom / 1000 + 3,
|
||||
imgYRes * zoom / 1000 + 3, 3, 3, TRUE);
|
||||
UpdateScrollbox();
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CImgAreaWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
DefWindowProc(WM_PAINT, wParam, lParam);
|
||||
HDC hdc = imageArea.GetDC();
|
||||
StretchBlt(hdc, 0, 0, imgXRes * zoom / 1000, imgYRes * zoom / 1000, hDrawingDC, 0, 0, imgXRes,
|
||||
imgYRes, SRCCOPY);
|
||||
if (showGrid && (zoom >= 4000))
|
||||
{
|
||||
HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, 1, 0x00a0a0a0));
|
||||
int counter;
|
||||
for(counter = 0; counter <= imgYRes; counter++)
|
||||
{
|
||||
MoveToEx(hdc, 0, counter * zoom / 1000, NULL);
|
||||
LineTo(hdc, imgXRes * zoom / 1000, counter * zoom / 1000);
|
||||
}
|
||||
for(counter = 0; counter <= imgXRes; counter++)
|
||||
{
|
||||
MoveToEx(hdc, counter * zoom / 1000, 0, NULL);
|
||||
LineTo(hdc, counter * zoom / 1000, imgYRes * zoom / 1000);
|
||||
}
|
||||
DeleteObject(SelectObject(hdc, oldPen));
|
||||
}
|
||||
imageArea.ReleaseDC(hdc);
|
||||
selectionWindow.Invalidate(FALSE);
|
||||
miniature.Invalidate(FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CImgAreaWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
switch (activeTool)
|
||||
{
|
||||
case TOOL_FILL:
|
||||
SetCursor(hCurFill);
|
||||
break;
|
||||
case TOOL_COLOR:
|
||||
SetCursor(hCurColor);
|
||||
break;
|
||||
case TOOL_ZOOM:
|
||||
SetCursor(hCurZoom);
|
||||
break;
|
||||
case TOOL_PEN:
|
||||
SetCursor(hCurPen);
|
||||
break;
|
||||
case TOOL_AIRBRUSH:
|
||||
SetCursor(hCurAirbrush);
|
||||
break;
|
||||
default:
|
||||
SetCursor(LoadCursor(NULL, IDC_CROSS));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CImgAreaWindow::OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if ((!drawing) || (activeTool == TOOL_COLOR))
|
||||
{
|
||||
SetCapture();
|
||||
drawing = TRUE;
|
||||
startPaintingL(hDrawingDC, GET_X_LPARAM(lParam) * 1000 / zoom, GET_Y_LPARAM(lParam) * 1000 / zoom,
|
||||
fgColor, bgColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage(WM_LBUTTONUP, wParam, lParam);
|
||||
undo();
|
||||
}
|
||||
Invalidate(FALSE);
|
||||
if ((activeTool == TOOL_ZOOM) && (zoom < 8000))
|
||||
zoomTo(zoom * 2, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CImgAreaWindow::OnRButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if ((!drawing) || (activeTool == TOOL_COLOR))
|
||||
{
|
||||
SetCapture();
|
||||
drawing = TRUE;
|
||||
startPaintingR(hDrawingDC, GET_X_LPARAM(lParam) * 1000 / zoom, GET_Y_LPARAM(lParam) * 1000 / zoom,
|
||||
fgColor, bgColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage(WM_RBUTTONUP, wParam, lParam);
|
||||
undo();
|
||||
}
|
||||
Invalidate(FALSE);
|
||||
if ((activeTool == TOOL_ZOOM) && (zoom > 125))
|
||||
zoomTo(zoom / 2, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CImgAreaWindow::OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if (drawing)
|
||||
{
|
||||
ReleaseCapture();
|
||||
drawing = FALSE;
|
||||
endPaintingL(hDrawingDC, GET_X_LPARAM(lParam) * 1000 / zoom, GET_Y_LPARAM(lParam) * 1000 / zoom, fgColor,
|
||||
bgColor);
|
||||
Invalidate(FALSE);
|
||||
if (activeTool == TOOL_COLOR)
|
||||
{
|
||||
COLORREF tempColor =
|
||||
GetPixel(hDrawingDC, GET_X_LPARAM(lParam) * 1000 / zoom, GET_Y_LPARAM(lParam) * 1000 / zoom);
|
||||
if (tempColor != CLR_INVALID)
|
||||
fgColor = tempColor;
|
||||
paletteWindow.Invalidate(FALSE);
|
||||
}
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) "");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CImgAreaWindow::OnRButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if (drawing)
|
||||
{
|
||||
ReleaseCapture();
|
||||
drawing = FALSE;
|
||||
endPaintingR(hDrawingDC, GET_X_LPARAM(lParam) * 1000 / zoom, GET_Y_LPARAM(lParam) * 1000 / zoom, fgColor,
|
||||
bgColor);
|
||||
Invalidate(FALSE);
|
||||
if (activeTool == TOOL_COLOR)
|
||||
{
|
||||
COLORREF tempColor =
|
||||
GetPixel(hDrawingDC, GET_X_LPARAM(lParam) * 1000 / zoom, GET_Y_LPARAM(lParam) * 1000 / zoom);
|
||||
if (tempColor != CLR_INVALID)
|
||||
bgColor = tempColor;
|
||||
paletteWindow.Invalidate(FALSE);
|
||||
}
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) "");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CImgAreaWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
LONG xNow = GET_X_LPARAM(lParam) * 1000 / zoom;
|
||||
LONG yNow = GET_Y_LPARAM(lParam) * 1000 / zoom;
|
||||
if ((!drawing) || (activeTool <= TOOL_AIRBRUSH))
|
||||
{
|
||||
TRACKMOUSEEVENT tme;
|
||||
|
||||
if (activeTool == TOOL_ZOOM)
|
||||
{
|
||||
Invalidate(FALSE);
|
||||
UpdateWindow();
|
||||
drawZoomFrame(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
}
|
||||
|
||||
tme.cbSize = sizeof(TRACKMOUSEEVENT);
|
||||
tme.dwFlags = TME_LEAVE;
|
||||
tme.hwndTrack = imageArea.m_hWnd;
|
||||
tme.dwHoverTime = 0;
|
||||
TrackMouseEvent(&tme);
|
||||
|
||||
if (!drawing)
|
||||
{
|
||||
TCHAR coordStr[100];
|
||||
_stprintf(coordStr, _T("%ld, %ld"), xNow, yNow);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) coordStr);
|
||||
}
|
||||
}
|
||||
if (drawing)
|
||||
{
|
||||
/* values displayed in statusbar */
|
||||
LONG xRel = xNow - start.x;
|
||||
LONG yRel = yNow - start.y;
|
||||
/* freesel, rectsel and text tools always show numbers limited to fit into image area */
|
||||
if ((activeTool == TOOL_FREESEL) || (activeTool == TOOL_RECTSEL) || (activeTool == TOOL_TEXT))
|
||||
{
|
||||
if (xRel < 0)
|
||||
xRel = (xNow < 0) ? -start.x : xRel;
|
||||
else if (xNow > imgXRes)
|
||||
xRel = imgXRes-start.x;
|
||||
if (yRel < 0)
|
||||
yRel = (yNow < 0) ? -start.y : yRel;
|
||||
else if (yNow > imgYRes)
|
||||
yRel = imgYRes-start.y;
|
||||
}
|
||||
/* rectsel and shape tools always show non-negative numbers when drawing */
|
||||
if ((activeTool == TOOL_RECTSEL) || (activeTool == TOOL_SHAPE))
|
||||
{
|
||||
if (xRel < 0)
|
||||
xRel = -xRel;
|
||||
if (yRel < 0)
|
||||
yRel = -yRel;
|
||||
}
|
||||
/* while drawing, update cursor coordinates only for tools 3, 7, 8, 9, 14 */
|
||||
switch(activeTool)
|
||||
{
|
||||
case TOOL_RUBBER:
|
||||
case TOOL_PEN:
|
||||
case TOOL_BRUSH:
|
||||
case TOOL_AIRBRUSH:
|
||||
case TOOL_SHAPE:
|
||||
{
|
||||
TCHAR coordStr[100];
|
||||
_stprintf(coordStr, _T("%ld, %ld"), xNow, yNow);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) coordStr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((wParam & MK_LBUTTON) != 0)
|
||||
{
|
||||
whilePaintingL(hDrawingDC, xNow, yNow, fgColor, bgColor);
|
||||
Invalidate(FALSE);
|
||||
if ((activeTool >= TOOL_TEXT) || (activeTool == TOOL_RECTSEL) || (activeTool == TOOL_FREESEL))
|
||||
{
|
||||
TCHAR sizeStr[100];
|
||||
if ((activeTool >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0))
|
||||
yRel = xRel;
|
||||
_stprintf(sizeStr, _T("%ld x %ld"), xRel, yRel);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) sizeStr);
|
||||
}
|
||||
}
|
||||
if ((wParam & MK_RBUTTON) != 0)
|
||||
{
|
||||
whilePaintingR(hDrawingDC, xNow, yNow, fgColor, bgColor);
|
||||
Invalidate(FALSE);
|
||||
if (activeTool >= TOOL_TEXT)
|
||||
{
|
||||
TCHAR sizeStr[100];
|
||||
if ((activeTool >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0))
|
||||
yRel = xRel;
|
||||
_stprintf(sizeStr, _T("%ld x %ld"), xRel, yRel);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) sizeStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CImgAreaWindow::OnMouseLeave(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) _T(""));
|
||||
if (activeTool == TOOL_ZOOM)
|
||||
imageArea.Invalidate(FALSE);
|
||||
return 0;
|
||||
}
|
41
reactos/base/applications/mspaint_new/imgarea.h
Normal file
41
reactos/base/applications/mspaint_new/imgarea.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* PROJECT: PAINT for ReactOS
|
||||
* LICENSE: LGPL
|
||||
* FILE: base/applications/mspaint_new/imgarea.h
|
||||
* PURPOSE: Window procedure of the main window and all children apart from
|
||||
* hPalWin, hToolSettings and hSelection
|
||||
* PROGRAMMERS: Benedikt Freisen
|
||||
*/
|
||||
|
||||
class CImgAreaWindow : public CWindowImpl<CMainWindow>
|
||||
{
|
||||
public:
|
||||
DECLARE_WND_CLASS_EX(_T("ImgAreaWindow"), CS_DBLCLKS, COLOR_BTNFACE)
|
||||
|
||||
BEGIN_MSG_MAP(CPaletteWindow)
|
||||
MESSAGE_HANDLER(WM_SIZE, OnSize)
|
||||
MESSAGE_HANDLER(WM_PAINT, OnPaint)
|
||||
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
|
||||
MESSAGE_HANDLER(WM_RBUTTONDOWN, OnRButtonDown)
|
||||
MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
|
||||
MESSAGE_HANDLER(WM_RBUTTONUP, OnRButtonUp)
|
||||
MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
|
||||
MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave)
|
||||
END_MSG_MAP()
|
||||
|
||||
BOOL drawing;
|
||||
|
||||
private:
|
||||
LRESULT OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnRButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnRButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnMouseLeave(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
|
||||
void drawZoomFrame(int mouseX, int mouseY);
|
||||
};
|
|
@ -104,14 +104,14 @@ BOOL showGrid = FALSE;
|
|||
BOOL showMiniature = FALSE;
|
||||
|
||||
CMainWindow mainWindow;
|
||||
CMainWindow miniature;
|
||||
CMiniatureWindow miniature;
|
||||
CMainWindow toolBoxContainer;
|
||||
CToolSettingsWindow toolSettingsWindow;
|
||||
CPaletteWindow paletteWindow;
|
||||
CScrollboxWindow scrollboxWindow;
|
||||
CScrollboxWindow scrlClientWindow;
|
||||
CSelectionWindow selectionWindow;
|
||||
CMainWindow imageArea;
|
||||
CImgAreaWindow imageArea;
|
||||
CSizeboxWindow sizeboxLeftTop;
|
||||
CSizeboxWindow sizeboxCenterTop;
|
||||
CSizeboxWindow sizeboxRightTop;
|
||||
|
|
39
reactos/base/applications/mspaint_new/miniature.cpp
Normal file
39
reactos/base/applications/mspaint_new/miniature.cpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* PROJECT: PAINT for ReactOS
|
||||
* LICENSE: LGPL
|
||||
* FILE: base/applications/mspaint_new/miniature.cpp
|
||||
* PURPOSE: Window procedure of the main window and all children apart from
|
||||
* hPalWin, hToolSettings and hSelection
|
||||
* PROGRAMMERS: Benedikt Freisen
|
||||
*/
|
||||
|
||||
/* INCLUDES *********************************************************/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
/* FUNCTIONS ********************************************************/
|
||||
|
||||
LRESULT CMiniatureWindow::OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
miniature.ShowWindow(SW_HIDE);
|
||||
showMiniature = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMiniatureWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
DefWindowProc(WM_PAINT, wParam, lParam);
|
||||
RECT mclient;
|
||||
HDC hdc;
|
||||
miniature.GetClientRect(&mclient);
|
||||
hdc = miniature.GetDC();
|
||||
StretchBlt(hdc, 0, 0, mclient.right, mclient.bottom, hDrawingDC, 0, 0, imgXRes, imgYRes, SRCCOPY);
|
||||
miniature.ReleaseDC(hdc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMiniatureWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
||||
return 0;
|
||||
}
|
24
reactos/base/applications/mspaint_new/miniature.h
Normal file
24
reactos/base/applications/mspaint_new/miniature.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* PROJECT: PAINT for ReactOS
|
||||
* LICENSE: LGPL
|
||||
* FILE: base/applications/mspaint_new/miniature.h
|
||||
* PURPOSE: Window procedure of the main window and all children apart from
|
||||
* hPalWin, hToolSettings and hSelection
|
||||
* PROGRAMMERS: Benedikt Freisen
|
||||
*/
|
||||
|
||||
class CMiniatureWindow : public CWindowImpl<CMiniatureWindow>
|
||||
{
|
||||
public:
|
||||
DECLARE_WND_CLASS_EX(_T("MiniatureWindow"), CS_DBLCLKS, COLOR_BTNFACE)
|
||||
|
||||
BEGIN_MSG_MAP(CPaletteWindow)
|
||||
MESSAGE_HANDLER(WM_CLOSE, OnClose)
|
||||
MESSAGE_HANDLER(WM_PAINT, OnPaint)
|
||||
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
};
|
|
@ -23,6 +23,8 @@
|
|||
#include "dib.h"
|
||||
#include "globalvar.h"
|
||||
#include "history.h"
|
||||
#include "imgarea.h"
|
||||
#include "miniature.h"
|
||||
#include "mouse.h"
|
||||
#include "palette.h"
|
||||
#include "scrollbox.h"
|
||||
|
|
|
@ -16,14 +16,13 @@
|
|||
|
||||
/* FUNCTIONS ********************************************************/
|
||||
|
||||
void
|
||||
selectTool(int tool)
|
||||
void CMainWindow::selectTool(int tool)
|
||||
{
|
||||
selectionWindow.ShowWindow(SW_HIDE);
|
||||
activeTool = tool;
|
||||
pointSP = 0; // resets the point-buffer of the polygon and bezier functions
|
||||
toolSettingsWindow.Invalidate(TRUE);
|
||||
ShowWindow(hTrackbarZoom, (tool == TOOL_ZOOM) ? SW_SHOW : SW_HIDE);
|
||||
::ShowWindow(hTrackbarZoom, (tool == TOOL_ZOOM) ? SW_SHOW : SW_HIDE);
|
||||
textEditWindow.ShowWindow((tool == TOOL_TEXT) ? SW_SHOW : SW_HIDE);
|
||||
}
|
||||
|
||||
|
@ -73,39 +72,7 @@ zoomTo(int newZoom, int mouseX, int mouseY)
|
|||
SendMessage(hTrackbarZoom, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) tbPos);
|
||||
}
|
||||
|
||||
void
|
||||
drawZoomFrame(int mouseX, int mouseY)
|
||||
{
|
||||
HDC hdc;
|
||||
HPEN oldPen;
|
||||
HBRUSH oldBrush;
|
||||
LOGBRUSH logbrush;
|
||||
int rop;
|
||||
|
||||
RECT clientRectScrollbox;
|
||||
RECT clientRectImageArea;
|
||||
int x, y, w, h;
|
||||
scrollboxWindow.GetClientRect(&clientRectScrollbox);
|
||||
imageArea.GetClientRect(&clientRectImageArea);
|
||||
w = clientRectImageArea.right * clientRectScrollbox.right / (clientRectImageArea.right * 2);
|
||||
h = clientRectImageArea.bottom * clientRectScrollbox.bottom / (clientRectImageArea.bottom * 2);
|
||||
x = max(0, min(clientRectImageArea.right - w, mouseX - w / 2));
|
||||
y = max(0, min(clientRectImageArea.bottom - h, mouseY - h / 2));
|
||||
|
||||
hdc = imageArea.GetDC();
|
||||
oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, 0, 0));
|
||||
logbrush.lbStyle = BS_HOLLOW;
|
||||
oldBrush = (HBRUSH) SelectObject(hdc, CreateBrushIndirect(&logbrush));
|
||||
rop = SetROP2(hdc, R2_NOT);
|
||||
Rectangle(hdc, x, y, x + w, y + h);
|
||||
SetROP2(hdc, rop);
|
||||
DeleteObject(SelectObject(hdc, oldBrush));
|
||||
DeleteObject(SelectObject(hdc, oldPen));
|
||||
imageArea.ReleaseDC(hdc);
|
||||
}
|
||||
|
||||
void
|
||||
alignChildrenToMainWindow()
|
||||
void CMainWindow::alignChildrenToMainWindow()
|
||||
{
|
||||
int x, y, w, h;
|
||||
RECT clientRect;
|
||||
|
@ -132,12 +99,11 @@ alignChildrenToMainWindow()
|
|||
h = clientRect.bottom - 3;
|
||||
}
|
||||
|
||||
scrollboxWindow.MoveWindow(x, y, w, IsWindowVisible(hStatusBar) ? h - 23 : h, TRUE);
|
||||
scrollboxWindow.MoveWindow(x, y, w, ::IsWindowVisible(hStatusBar) ? h - 23 : h, TRUE);
|
||||
paletteWindow.MoveWindow(x, 9, 255, 32, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
saveImage(BOOL overwrite)
|
||||
void CMainWindow::saveImage(BOOL overwrite)
|
||||
{
|
||||
if (isAFile && overwrite)
|
||||
{
|
||||
|
@ -161,8 +127,7 @@ saveImage(BOOL overwrite)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
UpdateApplicationProperties(HBITMAP bitmap, LPTSTR newfilename, LPTSTR newfilepathname)
|
||||
void CMainWindow::UpdateApplicationProperties(HBITMAP bitmap, LPTSTR newfilename, LPTSTR newfilepathname)
|
||||
{
|
||||
TCHAR tempstr[1000];
|
||||
TCHAR resstr[100];
|
||||
|
@ -172,13 +137,12 @@ UpdateApplicationProperties(HBITMAP bitmap, LPTSTR newfilename, LPTSTR newfilepa
|
|||
CopyMemory(filepathname, newfilepathname, sizeof(filepathname));
|
||||
LoadString(hProgInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr));
|
||||
_stprintf(tempstr, resstr, filename);
|
||||
mainWindow.SetWindowText(tempstr);
|
||||
SetWindowText(tempstr);
|
||||
clearHistory();
|
||||
isAFile = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
InsertSelectionFromHBITMAP(HBITMAP bitmap, HWND window)
|
||||
void CMainWindow::InsertSelectionFromHBITMAP(HBITMAP bitmap, HWND window)
|
||||
{
|
||||
HDC hTempDC;
|
||||
HBITMAP hTempMask;
|
||||
|
@ -209,8 +173,6 @@ InsertSelectionFromHBITMAP(HBITMAP bitmap, HWND window)
|
|||
ForceRefreshSelectionContents();
|
||||
}
|
||||
|
||||
BOOL drawing;
|
||||
|
||||
LRESULT CMainWindow::OnDropFiles(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
HDROP drophandle;
|
||||
|
@ -247,12 +209,6 @@ LRESULT CMainWindow::OnDestroy(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
|||
|
||||
LRESULT CMainWindow::OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if (m_hWnd == miniature.m_hWnd)
|
||||
{
|
||||
miniature.ShowWindow(SW_HIDE);
|
||||
showMiniature = FALSE;
|
||||
return 0;
|
||||
}
|
||||
if (!imageSaved)
|
||||
{
|
||||
TCHAR programname[20];
|
||||
|
@ -342,37 +298,6 @@ LRESULT CMainWindow::OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHand
|
|||
alignChildrenToMainWindow();
|
||||
Invalidate(TRUE);
|
||||
}
|
||||
if (m_hWnd == imageArea.m_hWnd)
|
||||
{
|
||||
sizeboxLeftTop.MoveWindow(
|
||||
0,
|
||||
0, 3, 3, TRUE);
|
||||
sizeboxCenterTop.MoveWindow(
|
||||
imgXRes * zoom / 2000 + 3 * 3 / 4,
|
||||
0, 3, 3, TRUE);
|
||||
sizeboxRightTop.MoveWindow(
|
||||
imgXRes * zoom / 1000 + 3,
|
||||
0, 3, 3, TRUE);
|
||||
sizeboxLeftCenter.MoveWindow(
|
||||
0,
|
||||
imgYRes * zoom / 2000 + 3 * 3 / 4, 3, 3, TRUE);
|
||||
sizeboxRightCenter.MoveWindow(
|
||||
imgXRes * zoom / 1000 + 3,
|
||||
imgYRes * zoom / 2000 + 3 * 3 / 4, 3, 3, TRUE);
|
||||
sizeboxLeftBottom.MoveWindow(
|
||||
0,
|
||||
imgYRes * zoom / 1000 + 3, 3, 3, TRUE);
|
||||
sizeboxCenterBottom.MoveWindow(
|
||||
imgXRes * zoom / 2000 + 3 * 3 / 4,
|
||||
imgYRes * zoom / 1000 + 3, 3, 3, TRUE);
|
||||
sizeboxRightBottom.MoveWindow(
|
||||
imgXRes * zoom / 1000 + 3,
|
||||
imgYRes * zoom / 1000 + 3, 3, 3, TRUE);
|
||||
}
|
||||
if (m_hWnd == imageArea.m_hWnd)
|
||||
{
|
||||
UpdateScrollbox();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -387,171 +312,17 @@ LRESULT CMainWindow::OnGetMinMaxInfo(UINT nMsg, WPARAM wParam, LPARAM lParam, BO
|
|||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
DefWindowProc(WM_PAINT, wParam, lParam);
|
||||
if (m_hWnd == imageArea.m_hWnd)
|
||||
{
|
||||
HDC hdc = imageArea.GetDC();
|
||||
StretchBlt(hdc, 0, 0, imgXRes * zoom / 1000, imgYRes * zoom / 1000, hDrawingDC, 0, 0, imgXRes,
|
||||
imgYRes, SRCCOPY);
|
||||
if (showGrid && (zoom >= 4000))
|
||||
{
|
||||
HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, 1, 0x00a0a0a0));
|
||||
int counter;
|
||||
for(counter = 0; counter <= imgYRes; counter++)
|
||||
{
|
||||
MoveToEx(hdc, 0, counter * zoom / 1000, NULL);
|
||||
LineTo(hdc, imgXRes * zoom / 1000, counter * zoom / 1000);
|
||||
}
|
||||
for(counter = 0; counter <= imgXRes; counter++)
|
||||
{
|
||||
MoveToEx(hdc, counter * zoom / 1000, 0, NULL);
|
||||
LineTo(hdc, counter * zoom / 1000, imgYRes * zoom / 1000);
|
||||
}
|
||||
DeleteObject(SelectObject(hdc, oldPen));
|
||||
}
|
||||
imageArea.ReleaseDC(hdc);
|
||||
selectionWindow.Invalidate(FALSE);
|
||||
miniature.Invalidate(FALSE);
|
||||
}
|
||||
else if (m_hWnd == miniature.m_hWnd)
|
||||
{
|
||||
RECT mclient;
|
||||
HDC hdc;
|
||||
miniature.GetClientRect(&mclient);
|
||||
hdc = miniature.GetDC();
|
||||
StretchBlt(hdc, 0, 0, mclient.right, mclient.bottom, hDrawingDC, 0, 0, imgXRes, imgYRes, SRCCOPY);
|
||||
miniature.ReleaseDC(hdc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if (m_hWnd == imageArea.m_hWnd)
|
||||
{
|
||||
switch (activeTool)
|
||||
{
|
||||
case TOOL_FILL:
|
||||
SetCursor(hCurFill);
|
||||
break;
|
||||
case TOOL_COLOR:
|
||||
SetCursor(hCurColor);
|
||||
break;
|
||||
case TOOL_ZOOM:
|
||||
SetCursor(hCurZoom);
|
||||
break;
|
||||
case TOOL_PEN:
|
||||
SetCursor(hCurPen);
|
||||
break;
|
||||
case TOOL_AIRBRUSH:
|
||||
SetCursor(hCurAirbrush);
|
||||
break;
|
||||
default:
|
||||
SetCursor(LoadCursor(NULL, IDC_CROSS));
|
||||
}
|
||||
}
|
||||
else
|
||||
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainWindow::OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if (m_hWnd == imageArea.m_hWnd)
|
||||
{
|
||||
if ((!drawing) || (activeTool == TOOL_COLOR))
|
||||
{
|
||||
SetCapture();
|
||||
drawing = TRUE;
|
||||
startPaintingL(hDrawingDC, GET_X_LPARAM(lParam) * 1000 / zoom, GET_Y_LPARAM(lParam) * 1000 / zoom,
|
||||
fgColor, bgColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage(WM_LBUTTONUP, wParam, lParam);
|
||||
undo();
|
||||
}
|
||||
Invalidate(FALSE);
|
||||
if ((activeTool == TOOL_ZOOM) && (zoom < 8000))
|
||||
zoomTo(zoom * 2, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainWindow::OnRButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if (m_hWnd == imageArea.m_hWnd)
|
||||
{
|
||||
if ((!drawing) || (activeTool == TOOL_COLOR))
|
||||
{
|
||||
SetCapture();
|
||||
drawing = TRUE;
|
||||
startPaintingR(hDrawingDC, GET_X_LPARAM(lParam) * 1000 / zoom, GET_Y_LPARAM(lParam) * 1000 / zoom,
|
||||
fgColor, bgColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage(WM_RBUTTONUP, wParam, lParam);
|
||||
undo();
|
||||
}
|
||||
Invalidate(FALSE);
|
||||
if ((activeTool == TOOL_ZOOM) && (zoom > 125))
|
||||
zoomTo(zoom / 2, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainWindow::OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if ((m_hWnd == imageArea.m_hWnd) && drawing)
|
||||
{
|
||||
ReleaseCapture();
|
||||
drawing = FALSE;
|
||||
endPaintingL(hDrawingDC, GET_X_LPARAM(lParam) * 1000 / zoom, GET_Y_LPARAM(lParam) * 1000 / zoom, fgColor,
|
||||
bgColor);
|
||||
Invalidate(FALSE);
|
||||
if (activeTool == TOOL_COLOR)
|
||||
{
|
||||
COLORREF tempColor =
|
||||
GetPixel(hDrawingDC, GET_X_LPARAM(lParam) * 1000 / zoom, GET_Y_LPARAM(lParam) * 1000 / zoom);
|
||||
if (tempColor != CLR_INVALID)
|
||||
fgColor = tempColor;
|
||||
paletteWindow.Invalidate(FALSE);
|
||||
}
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) "");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainWindow::OnRButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if ((m_hWnd == imageArea.m_hWnd) && drawing)
|
||||
{
|
||||
ReleaseCapture();
|
||||
drawing = FALSE;
|
||||
endPaintingR(hDrawingDC, GET_X_LPARAM(lParam) * 1000 / zoom, GET_Y_LPARAM(lParam) * 1000 / zoom, fgColor,
|
||||
bgColor);
|
||||
Invalidate(FALSE);
|
||||
if (activeTool == TOOL_COLOR)
|
||||
{
|
||||
COLORREF tempColor =
|
||||
GetPixel(hDrawingDC, GET_X_LPARAM(lParam) * 1000 / zoom, GET_Y_LPARAM(lParam) * 1000 / zoom);
|
||||
if (tempColor != CLR_INVALID)
|
||||
bgColor = tempColor;
|
||||
paletteWindow.Invalidate(FALSE);
|
||||
}
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) "");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainWindow::OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if (wParam == VK_ESCAPE)
|
||||
{
|
||||
if (!drawing)
|
||||
if (!imageArea.drawing)
|
||||
{
|
||||
/* Deselect */
|
||||
if ((activeTool == TOOL_RECTSEL) || (activeTool == TOOL_FREESEL))
|
||||
|
@ -567,115 +338,6 @@ LRESULT CMainWindow::OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
|||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if (m_hWnd == imageArea.m_hWnd)
|
||||
{
|
||||
LONG xNow = GET_X_LPARAM(lParam) * 1000 / zoom;
|
||||
LONG yNow = GET_Y_LPARAM(lParam) * 1000 / zoom;
|
||||
if ((!drawing) || (activeTool <= TOOL_AIRBRUSH))
|
||||
{
|
||||
TRACKMOUSEEVENT tme;
|
||||
|
||||
if (activeTool == TOOL_ZOOM)
|
||||
{
|
||||
Invalidate(FALSE);
|
||||
UpdateWindow();
|
||||
drawZoomFrame(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
}
|
||||
|
||||
tme.cbSize = sizeof(TRACKMOUSEEVENT);
|
||||
tme.dwFlags = TME_LEAVE;
|
||||
tme.hwndTrack = imageArea.m_hWnd;
|
||||
tme.dwHoverTime = 0;
|
||||
TrackMouseEvent(&tme);
|
||||
|
||||
if (!drawing)
|
||||
{
|
||||
TCHAR coordStr[100];
|
||||
_stprintf(coordStr, _T("%ld, %ld"), xNow, yNow);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) coordStr);
|
||||
}
|
||||
}
|
||||
if (drawing)
|
||||
{
|
||||
/* values displayed in statusbar */
|
||||
LONG xRel = xNow - start.x;
|
||||
LONG yRel = yNow - start.y;
|
||||
/* freesel, rectsel and text tools always show numbers limited to fit into image area */
|
||||
if ((activeTool == TOOL_FREESEL) || (activeTool == TOOL_RECTSEL) || (activeTool == TOOL_TEXT))
|
||||
{
|
||||
if (xRel < 0)
|
||||
xRel = (xNow < 0) ? -start.x : xRel;
|
||||
else if (xNow > imgXRes)
|
||||
xRel = imgXRes-start.x;
|
||||
if (yRel < 0)
|
||||
yRel = (yNow < 0) ? -start.y : yRel;
|
||||
else if (yNow > imgYRes)
|
||||
yRel = imgYRes-start.y;
|
||||
}
|
||||
/* rectsel and shape tools always show non-negative numbers when drawing */
|
||||
if ((activeTool == TOOL_RECTSEL) || (activeTool == TOOL_SHAPE))
|
||||
{
|
||||
if (xRel < 0)
|
||||
xRel = -xRel;
|
||||
if (yRel < 0)
|
||||
yRel = -yRel;
|
||||
}
|
||||
/* while drawing, update cursor coordinates only for tools 3, 7, 8, 9, 14 */
|
||||
switch(activeTool)
|
||||
{
|
||||
case TOOL_RUBBER:
|
||||
case TOOL_PEN:
|
||||
case TOOL_BRUSH:
|
||||
case TOOL_AIRBRUSH:
|
||||
case TOOL_SHAPE:
|
||||
{
|
||||
TCHAR coordStr[100];
|
||||
_stprintf(coordStr, _T("%ld, %ld"), xNow, yNow);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) coordStr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((wParam & MK_LBUTTON) != 0)
|
||||
{
|
||||
whilePaintingL(hDrawingDC, xNow, yNow, fgColor, bgColor);
|
||||
Invalidate(FALSE);
|
||||
if ((activeTool >= TOOL_TEXT) || (activeTool == TOOL_RECTSEL) || (activeTool == TOOL_FREESEL))
|
||||
{
|
||||
TCHAR sizeStr[100];
|
||||
if ((activeTool >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0))
|
||||
yRel = xRel;
|
||||
_stprintf(sizeStr, _T("%ld x %ld"), xRel, yRel);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) sizeStr);
|
||||
}
|
||||
}
|
||||
if ((wParam & MK_RBUTTON) != 0)
|
||||
{
|
||||
whilePaintingR(hDrawingDC, xNow, yNow, fgColor, bgColor);
|
||||
Invalidate(FALSE);
|
||||
if (activeTool >= TOOL_TEXT)
|
||||
{
|
||||
TCHAR sizeStr[100];
|
||||
if ((activeTool >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0))
|
||||
yRel = xRel;
|
||||
_stprintf(sizeStr, _T("%ld x %ld"), xRel, yRel);
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) sizeStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainWindow::OnMouseLeave(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) _T(""));
|
||||
if (activeTool == TOOL_ZOOM)
|
||||
imageArea.Invalidate(FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainWindow::OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
/* Redirect message to common controls */
|
||||
|
|
|
@ -20,15 +20,8 @@ public:
|
|||
MESSAGE_HANDLER(WM_INITMENUPOPUP, OnInitMenuPopup)
|
||||
MESSAGE_HANDLER(WM_SIZE, OnSize)
|
||||
MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo)
|
||||
MESSAGE_HANDLER(WM_PAINT, OnPaint)
|
||||
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
|
||||
MESSAGE_HANDLER(WM_RBUTTONDOWN, OnRButtonDown)
|
||||
MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
|
||||
MESSAGE_HANDLER(WM_RBUTTONUP, OnRButtonUp)
|
||||
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
|
||||
MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
|
||||
MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave)
|
||||
MESSAGE_HANDLER(WM_SYSCOLORCHANGE, OnSysColorChange)
|
||||
MESSAGE_HANDLER(WM_COMMAND, OnCommand)
|
||||
END_MSG_MAP()
|
||||
|
@ -40,15 +33,14 @@ public:
|
|||
LRESULT OnInitMenuPopup(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnGetMinMaxInfo(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnLButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnRButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnRButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnMouseLeave(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
|
||||
void selectTool(int tool);
|
||||
void alignChildrenToMainWindow();
|
||||
void saveImage(BOOL overwrite);
|
||||
void UpdateApplicationProperties(HBITMAP bitmap, LPTSTR newfilename, LPTSTR newfilepathname);
|
||||
void InsertSelectionFromHBITMAP(HBITMAP bitmap, HWND window);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue