2009-05-12 14:15:48 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: PAINT for ReactOS
|
|
|
|
* LICENSE: LGPL
|
2009-10-21 15:44:31 +00:00
|
|
|
* FILE: base/applications/paint/winproc.c
|
2009-05-12 14:15:48 +00:00
|
|
|
* PURPOSE: Window procedure of the main window and all children apart from
|
|
|
|
* hPalWin, hToolSettings and hSelection
|
|
|
|
* PROGRAMMERS: Benedikt Freisen
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *********************************************************/
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <commctrl.h>
|
|
|
|
//#include <htmlhelp.h>
|
|
|
|
#include <stdio.h>
|
2009-05-27 17:56:50 +00:00
|
|
|
#include <tchar.h>
|
2009-05-12 14:15:48 +00:00
|
|
|
#include "definitions.h"
|
|
|
|
#include "globalvar.h"
|
|
|
|
#include "dialogs.h"
|
2009-05-27 12:03:18 +00:00
|
|
|
#include "dib.h"
|
|
|
|
#include "drawing.h"
|
2009-05-12 14:15:48 +00:00
|
|
|
#include "history.h"
|
2009-05-27 12:03:18 +00:00
|
|
|
#include "mouse.h"
|
2009-05-29 19:36:35 +00:00
|
|
|
#include "registry.h"
|
2009-05-12 14:15:48 +00:00
|
|
|
|
|
|
|
/* FUNCTIONS ********************************************************/
|
|
|
|
|
2009-10-21 15:44:31 +00:00
|
|
|
void
|
|
|
|
selectTool(int tool)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
|
|
|
ShowWindow(hSelection, SW_HIDE);
|
|
|
|
activeTool = tool;
|
2009-10-21 15:44:31 +00:00
|
|
|
pointSP = 0; // resets the point-buffer of the polygon and bezier functions
|
2009-05-12 14:15:48 +00:00
|
|
|
SendMessage(hToolSettings, WM_PAINT, 0, 0);
|
2009-10-21 15:44:31 +00:00
|
|
|
ShowWindow(hTrackbarZoom, (tool == 6) ? SW_SHOW : SW_HIDE);
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
|
2009-10-21 15:44:31 +00:00
|
|
|
void
|
|
|
|
updateCanvasAndScrollbars()
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
|
|
|
ShowWindow(hSelection, SW_HIDE);
|
2009-10-21 15:44:31 +00:00
|
|
|
MoveWindow(hImageArea, 3, 3, imgXRes * zoom / 1000, imgYRes * zoom / 1000, FALSE);
|
2009-05-12 14:15:48 +00:00
|
|
|
InvalidateRect(hScrollbox, NULL, TRUE);
|
|
|
|
InvalidateRect(hImageArea, NULL, FALSE);
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
SetScrollPos(hScrollbox, SB_HORZ, 0, TRUE);
|
|
|
|
SetScrollPos(hScrollbox, SB_VERT, 0, TRUE);
|
|
|
|
}
|
|
|
|
|
2009-10-21 15:44:31 +00:00
|
|
|
void
|
|
|
|
zoomTo(int newZoom, int mouseX, int mouseY)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-10-19 17:46:29 +00:00
|
|
|
int tbPos = 0;
|
|
|
|
int tempZoom = newZoom;
|
|
|
|
|
2009-10-18 18:36:46 +00:00
|
|
|
long clientRectScrollbox[4];
|
|
|
|
long clientRectImageArea[4];
|
2009-10-19 17:46:29 +00:00
|
|
|
int x, y, w, h;
|
2009-10-21 15:44:31 +00:00
|
|
|
GetClientRect(hScrollbox, (LPRECT) &clientRectScrollbox);
|
|
|
|
GetClientRect(hImageArea, (LPRECT) &clientRectImageArea);
|
2009-10-18 18:36:46 +00:00
|
|
|
w = clientRectImageArea[2] * clientRectScrollbox[2] / (clientRectImageArea[2] * newZoom / zoom);
|
|
|
|
h = clientRectImageArea[3] * clientRectScrollbox[3] / (clientRectImageArea[3] * newZoom / zoom);
|
|
|
|
x = max(0, min(clientRectImageArea[2] - w, mouseX - w / 2)) * newZoom / zoom;
|
|
|
|
y = max(0, min(clientRectImageArea[3] - h, mouseY - h / 2)) * newZoom / zoom;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
zoom = newZoom;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-10-18 18:36:46 +00:00
|
|
|
ShowWindow(hSelection, SW_HIDE);
|
2009-10-21 15:44:31 +00:00
|
|
|
MoveWindow(hImageArea, 3, 3, imgXRes * zoom / 1000, imgYRes * zoom / 1000, FALSE);
|
2009-10-18 18:36:46 +00:00
|
|
|
InvalidateRect(hScrollbox, NULL, TRUE);
|
|
|
|
InvalidateRect(hImageArea, NULL, FALSE);
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-10-18 18:36:46 +00:00
|
|
|
SendMessage(hScrollbox, WM_HSCROLL, SB_THUMBPOSITION | (x << 16), 0);
|
|
|
|
SendMessage(hScrollbox, WM_VSCROLL, SB_THUMBPOSITION | (y << 16), 0);
|
2009-10-21 15:44:31 +00:00
|
|
|
|
|
|
|
while (tempZoom > 125)
|
2009-10-03 16:33:41 +00:00
|
|
|
{
|
|
|
|
tbPos++;
|
2009-10-21 15:44:31 +00:00
|
|
|
tempZoom = tempZoom >> 1;
|
2009-10-03 16:33:41 +00:00
|
|
|
}
|
2009-10-21 15:44:31 +00:00
|
|
|
SendMessage(hTrackbarZoom, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) tbPos);
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
|
2009-10-21 15:44:31 +00:00
|
|
|
void
|
|
|
|
drawZoomFrame(int mouseX, int mouseY)
|
2009-10-18 18:36:46 +00:00
|
|
|
{
|
2009-10-19 17:46:29 +00:00
|
|
|
HDC hdc;
|
|
|
|
HPEN oldPen;
|
|
|
|
HBRUSH oldBrush;
|
|
|
|
LOGBRUSH logbrush;
|
|
|
|
int rop;
|
|
|
|
|
2009-10-18 18:36:46 +00:00
|
|
|
long clientRectScrollbox[4];
|
|
|
|
long clientRectImageArea[4];
|
2009-10-19 17:46:29 +00:00
|
|
|
int x, y, w, h;
|
2009-10-21 15:44:31 +00:00
|
|
|
GetClientRect(hScrollbox, (LPRECT) &clientRectScrollbox);
|
|
|
|
GetClientRect(hImageArea, (LPRECT) &clientRectImageArea);
|
2009-10-18 18:36:46 +00:00
|
|
|
w = clientRectImageArea[2] * clientRectScrollbox[2] / (clientRectImageArea[2] * 2);
|
|
|
|
h = clientRectImageArea[3] * clientRectScrollbox[3] / (clientRectImageArea[3] * 2);
|
|
|
|
x = max(0, min(clientRectImageArea[2] - w, mouseX - w / 2));
|
|
|
|
y = max(0, min(clientRectImageArea[3] - h, mouseY - h / 2));
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-10-18 18:36:46 +00:00
|
|
|
hdc = GetDC(hImageArea);
|
|
|
|
oldPen = SelectObject(hdc, CreatePen(PS_SOLID, 0, 0));
|
|
|
|
logbrush.lbStyle = BS_HOLLOW;
|
|
|
|
oldBrush = 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(hImageArea, hdc);
|
|
|
|
}
|
|
|
|
|
2009-12-27 21:15:08 +00:00
|
|
|
void
|
|
|
|
alignChildrenToMainWindow()
|
|
|
|
{
|
|
|
|
int x, y, w, h;
|
|
|
|
RECT clientRect;
|
|
|
|
GetClientRect(hMainWnd, &clientRect);
|
|
|
|
|
|
|
|
if (IsWindowVisible(hToolBoxContainer))
|
|
|
|
{
|
|
|
|
x = 56;
|
|
|
|
w = clientRect.right - 56;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x = 0;
|
|
|
|
w = clientRect.right;
|
|
|
|
}
|
|
|
|
if (IsWindowVisible(hPalWin))
|
|
|
|
{
|
|
|
|
y = 49;
|
|
|
|
h = clientRect.bottom - 49;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
y = 3;
|
|
|
|
h = clientRect.bottom - 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
MoveWindow(hScrollbox, x, y, w, IsWindowVisible(hStatusBar) ? h - 23 : h, TRUE);
|
|
|
|
MoveWindow(hPalWin, x, 9, 255, 32, TRUE);
|
|
|
|
}
|
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
BOOL drawing;
|
|
|
|
|
2009-10-21 15:44:31 +00:00
|
|
|
LRESULT CALLBACK
|
|
|
|
WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-10-21 15:44:31 +00:00
|
|
|
switch (message) /* handle the messages */
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
|
|
|
case WM_DESTROY:
|
2009-10-21 15:44:31 +00:00
|
|
|
PostQuitMessage(0); /* send a WM_QUIT to the message queue */
|
2009-05-12 14:15:48 +00:00
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
case WM_CLOSE:
|
2009-10-21 15:44:31 +00:00
|
|
|
if (hwnd == hwndMiniature)
|
2009-07-01 19:24:17 +00:00
|
|
|
{
|
|
|
|
ShowWindow(hwndMiniature, SW_HIDE);
|
|
|
|
showMiniature = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2009-10-03 16:33:41 +00:00
|
|
|
if (!imageSaved)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-05-27 17:56:50 +00:00
|
|
|
TCHAR programname[20];
|
|
|
|
TCHAR saveprompttext[100];
|
2009-06-16 21:12:47 +00:00
|
|
|
TCHAR temptext[500];
|
2009-05-27 17:56:50 +00:00
|
|
|
LoadString(hProgInstance, IDS_PROGRAMNAME, programname, SIZEOF(programname));
|
|
|
|
LoadString(hProgInstance, IDS_SAVEPROMPTTEXT, saveprompttext, SIZEOF(saveprompttext));
|
|
|
|
_stprintf(temptext, saveprompttext, filename);
|
|
|
|
switch (MessageBox(hwnd, temptext, programname, MB_YESNOCANCEL | MB_ICONQUESTION))
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
|
|
|
case IDNO:
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
break;
|
|
|
|
case IDYES:
|
|
|
|
SendMessage(hwnd, WM_COMMAND, IDM_FILESAVEAS, 0);
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DestroyWindow(hwnd);
|
|
|
|
}
|
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
case WM_INITMENUPOPUP:
|
|
|
|
switch (lParam)
|
|
|
|
{
|
|
|
|
case 0:
|
2009-05-29 19:36:35 +00:00
|
|
|
if (isAFile)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-10-21 15:44:31 +00:00
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERPLANE,
|
|
|
|
MF_ENABLED | MF_BYCOMMAND);
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERCENTERED,
|
|
|
|
MF_ENABLED | MF_BYCOMMAND);
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERSTRETCHED,
|
|
|
|
MF_ENABLED | MF_BYCOMMAND);
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-10-21 15:44:31 +00:00
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERPLANE,
|
|
|
|
MF_GRAYED | MF_BYCOMMAND);
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERCENTERED,
|
|
|
|
MF_GRAYED | MF_BYCOMMAND);
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_FILEASWALLPAPERSTRETCHED,
|
|
|
|
MF_GRAYED | MF_BYCOMMAND);
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
2009-12-27 21:15:08 +00:00
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITUNDO,
|
|
|
|
(undoSteps > 0) ? (MF_ENABLED | MF_BYCOMMAND) : (MF_GRAYED | MF_BYCOMMAND));
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITREDO,
|
|
|
|
(redoSteps > 0) ? (MF_ENABLED | MF_BYCOMMAND) : (MF_GRAYED | MF_BYCOMMAND));
|
2009-05-12 14:15:48 +00:00
|
|
|
if (IsWindowVisible(hSelection))
|
|
|
|
{
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITCUT, MF_ENABLED | MF_BYCOMMAND);
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITCOPY, MF_ENABLED | MF_BYCOMMAND);
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITDELETESELECTION, MF_ENABLED | MF_BYCOMMAND);
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITINVERTSELECTION, MF_ENABLED | MF_BYCOMMAND);
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITCOPYTO, MF_ENABLED | MF_BYCOMMAND);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITCUT, MF_GRAYED | MF_BYCOMMAND);
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITCOPY, MF_GRAYED | MF_BYCOMMAND);
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITDELETESELECTION, MF_GRAYED | MF_BYCOMMAND);
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITINVERTSELECTION, MF_GRAYED | MF_BYCOMMAND);
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITCOPYTO, MF_GRAYED | MF_BYCOMMAND);
|
|
|
|
}
|
|
|
|
OpenClipboard(hMainWnd);
|
2009-10-21 15:44:31 +00:00
|
|
|
if (GetClipboardData(CF_BITMAP) != NULL)
|
2009-05-12 14:15:48 +00:00
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITPASTE, MF_ENABLED | MF_BYCOMMAND);
|
|
|
|
else
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_EDITPASTE, MF_GRAYED | MF_BYCOMMAND);
|
|
|
|
CloseClipboard();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (IsWindowVisible(hSelection))
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_IMAGECROP, MF_ENABLED | MF_BYCOMMAND);
|
|
|
|
else
|
|
|
|
EnableMenuItem(GetMenu(hMainWnd), IDM_IMAGECROP, MF_GRAYED | MF_BYCOMMAND);
|
2009-10-21 15:44:31 +00:00
|
|
|
CheckMenuItem(GetMenu(hMainWnd), IDM_IMAGEDRAWOPAQUE, (transpBg == 0) ?
|
|
|
|
(MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
|
2009-05-12 14:15:48 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-12-27 21:15:08 +00:00
|
|
|
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWTOOLBOX,
|
|
|
|
IsWindowVisible(hToolBoxContainer) ?
|
|
|
|
(MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
|
|
|
|
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWCOLORPALETTE,
|
|
|
|
IsWindowVisible(hPalWin) ?
|
|
|
|
(MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
|
|
|
|
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSTATUSBAR,
|
|
|
|
IsWindowVisible(hStatusBar) ?
|
|
|
|
(MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
|
2009-07-01 19:24:17 +00:00
|
|
|
|
2009-10-21 15:44:31 +00:00
|
|
|
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSHOWGRID,
|
|
|
|
showGrid ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
|
|
|
|
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWSHOWMINIATURE,
|
|
|
|
showMiniature ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
|
|
|
|
|
|
|
|
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM125,
|
|
|
|
(zoom == 125) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
|
|
|
|
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM25,
|
|
|
|
(zoom == 250) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
|
|
|
|
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM50,
|
|
|
|
(zoom == 500) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
|
|
|
|
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM100,
|
|
|
|
(zoom == 1000) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
|
|
|
|
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM200,
|
|
|
|
(zoom == 2000) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
|
|
|
|
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM400,
|
|
|
|
(zoom == 4000) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
|
|
|
|
CheckMenuItem(GetMenu(hMainWnd), IDM_VIEWZOOM800,
|
|
|
|
(zoom == 8000) ? (MF_CHECKED | MF_BYCOMMAND) : (MF_UNCHECKED | MF_BYCOMMAND));
|
2009-07-01 19:24:17 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
case WM_SIZE:
|
2009-10-21 15:44:31 +00:00
|
|
|
if (hwnd == hMainWnd)
|
|
|
|
{
|
|
|
|
int test[] = { LOWORD(lParam) - 260, LOWORD(lParam) - 140, LOWORD(lParam) - 20 };
|
2009-05-12 14:15:48 +00:00
|
|
|
SendMessage(hStatusBar, WM_SIZE, wParam, lParam);
|
2009-12-15 15:16:01 +00:00
|
|
|
SendMessage(hStatusBar, SB_SETPARTS, 3, (LPARAM)&test);
|
2009-12-27 21:15:08 +00:00
|
|
|
alignChildrenToMainWindow();
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
2009-10-21 15:44:31 +00:00
|
|
|
if (hwnd == hImageArea)
|
2009-07-02 17:02:37 +00:00
|
|
|
{
|
2009-10-21 15:44:31 +00:00
|
|
|
MoveWindow(hSizeboxLeftTop,
|
|
|
|
0,
|
|
|
|
0, 3, 3, TRUE);
|
|
|
|
MoveWindow(hSizeboxCenterTop,
|
|
|
|
imgXRes * zoom / 2000 + 3 * 3 / 4,
|
|
|
|
0, 3, 3, TRUE);
|
|
|
|
MoveWindow(hSizeboxRightTop,
|
|
|
|
imgXRes * zoom / 1000 + 3,
|
|
|
|
0, 3, 3, TRUE);
|
|
|
|
MoveWindow(hSizeboxLeftCenter,
|
|
|
|
0,
|
|
|
|
imgYRes * zoom / 2000 + 3 * 3 / 4, 3, 3, TRUE);
|
|
|
|
MoveWindow(hSizeboxRightCenter,
|
|
|
|
imgXRes * zoom / 1000 + 3,
|
|
|
|
imgYRes * zoom / 2000 + 3 * 3 / 4, 3, 3, TRUE);
|
|
|
|
MoveWindow(hSizeboxLeftBottom,
|
|
|
|
0,
|
|
|
|
imgYRes * zoom / 1000 + 3, 3, 3, TRUE);
|
|
|
|
MoveWindow(hSizeboxCenterBottom,
|
|
|
|
imgXRes * zoom / 2000 + 3 * 3 / 4,
|
|
|
|
imgYRes * zoom / 1000 + 3, 3, 3, TRUE);
|
|
|
|
MoveWindow(hSizeboxRightBottom,
|
|
|
|
imgXRes * zoom / 1000 + 3,
|
|
|
|
imgYRes * zoom / 1000 + 3, 3, 3, TRUE);
|
2009-07-02 17:02:37 +00:00
|
|
|
}
|
2009-10-21 15:44:31 +00:00
|
|
|
if ((hwnd == hImageArea) || (hwnd == hScrollbox))
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
|
|
|
long clientRectScrollbox[4];
|
|
|
|
long clientRectImageArea[4];
|
2009-10-21 15:44:31 +00:00
|
|
|
SCROLLINFO si;
|
|
|
|
GetClientRect(hScrollbox, (LPRECT) &clientRectScrollbox);
|
|
|
|
GetClientRect(hImageArea, (LPRECT) &clientRectImageArea);
|
|
|
|
si.cbSize = sizeof(SCROLLINFO);
|
|
|
|
si.fMask = SIF_PAGE | SIF_RANGE;
|
|
|
|
si.nMax = clientRectImageArea[2] + 6 - 1;
|
|
|
|
si.nMin = 0;
|
|
|
|
si.nPage = clientRectScrollbox[2];
|
|
|
|
SetScrollInfo(hScrollbox, SB_HORZ, &si, TRUE);
|
|
|
|
GetClientRect(hScrollbox, (LPRECT) clientRectScrollbox);
|
|
|
|
si.nMax = clientRectImageArea[3] + 6 - 1;
|
|
|
|
si.nPage = clientRectScrollbox[3];
|
|
|
|
SetScrollInfo(hScrollbox, SB_VERT, &si, TRUE);
|
|
|
|
MoveWindow(hScrlClient,
|
|
|
|
-GetScrollPos(hScrollbox, SB_HORZ), -GetScrollPos(hScrollbox, SB_VERT),
|
|
|
|
max(clientRectImageArea[2] + 6, clientRectScrollbox[2]),
|
|
|
|
max(clientRectImageArea[3] + 6, clientRectScrollbox[3]), TRUE);
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
case WM_HSCROLL:
|
2009-10-21 15:44:31 +00:00
|
|
|
if (hwnd == hScrollbox)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-10-18 18:36:46 +00:00
|
|
|
SCROLLINFO si;
|
|
|
|
si.cbSize = sizeof(SCROLLINFO);
|
|
|
|
si.fMask = SIF_ALL;
|
|
|
|
GetScrollInfo(hScrollbox, SB_HORZ, &si);
|
|
|
|
switch (LOWORD(wParam))
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-10-18 18:36:46 +00:00
|
|
|
case SB_THUMBTRACK:
|
|
|
|
case SB_THUMBPOSITION:
|
|
|
|
si.nPos = HIWORD(wParam);
|
|
|
|
break;
|
|
|
|
case SB_LINELEFT:
|
|
|
|
si.nPos -= 5;
|
|
|
|
break;
|
|
|
|
case SB_LINERIGHT:
|
|
|
|
si.nPos += 5;
|
|
|
|
break;
|
|
|
|
case SB_PAGELEFT:
|
|
|
|
si.nPos -= si.nPage;
|
|
|
|
break;
|
|
|
|
case SB_PAGERIGHT:
|
|
|
|
si.nPos += si.nPage;
|
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
2009-10-18 18:36:46 +00:00
|
|
|
SetScrollInfo(hScrollbox, SB_HORZ, &si, TRUE);
|
2009-10-21 15:44:31 +00:00
|
|
|
MoveWindow(hScrlClient, -GetScrollPos(hScrollbox, SB_HORZ),
|
|
|
|
-GetScrollPos(hScrollbox, SB_VERT), imgXRes * zoom / 1000 + 6,
|
|
|
|
imgYRes * zoom / 1000 + 6, TRUE);
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
case WM_VSCROLL:
|
2009-10-21 15:44:31 +00:00
|
|
|
if (hwnd == hScrollbox)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-10-18 18:36:46 +00:00
|
|
|
SCROLLINFO si;
|
|
|
|
si.cbSize = sizeof(SCROLLINFO);
|
|
|
|
si.fMask = SIF_ALL;
|
|
|
|
GetScrollInfo(hScrollbox, SB_VERT, &si);
|
|
|
|
switch (LOWORD(wParam))
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-10-18 18:36:46 +00:00
|
|
|
case SB_THUMBTRACK:
|
|
|
|
case SB_THUMBPOSITION:
|
|
|
|
si.nPos = HIWORD(wParam);
|
|
|
|
break;
|
|
|
|
case SB_LINEUP:
|
|
|
|
si.nPos -= 5;
|
|
|
|
break;
|
|
|
|
case SB_LINEDOWN:
|
|
|
|
si.nPos += 5;
|
|
|
|
break;
|
|
|
|
case SB_PAGEUP:
|
|
|
|
si.nPos -= si.nPage;
|
|
|
|
break;
|
|
|
|
case SB_PAGEDOWN:
|
|
|
|
si.nPos += si.nPage;
|
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
2009-10-18 18:36:46 +00:00
|
|
|
SetScrollInfo(hScrollbox, SB_VERT, &si, TRUE);
|
2009-10-21 15:44:31 +00:00
|
|
|
MoveWindow(hScrlClient, -GetScrollPos(hScrollbox, SB_HORZ),
|
|
|
|
-GetScrollPos(hScrollbox, SB_VERT), imgXRes * zoom / 1000 + 6,
|
|
|
|
imgYRes * zoom / 1000 + 6, TRUE);
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
case WM_GETMINMAXINFO:
|
2009-10-21 15:44:31 +00:00
|
|
|
if (hwnd == hMainWnd)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-10-21 15:44:31 +00:00
|
|
|
MINMAXINFO *mm = (LPMINMAXINFO) lParam;
|
2009-05-12 14:15:48 +00:00
|
|
|
(*mm).ptMinTrackSize.x = 330;
|
|
|
|
(*mm).ptMinTrackSize.y = 430;
|
|
|
|
}
|
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
case WM_PAINT:
|
2009-10-21 15:44:31 +00:00
|
|
|
DefWindowProc(hwnd, message, wParam, lParam);
|
|
|
|
if (hwnd == hImageArea)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
|
|
|
HDC hdc = GetDC(hImageArea);
|
2009-10-21 15:44:31 +00:00
|
|
|
StretchBlt(hdc, 0, 0, imgXRes * zoom / 1000, imgYRes * zoom / 1000, hDrawingDC, 0, 0, imgXRes,
|
|
|
|
imgYRes, SRCCOPY);
|
|
|
|
if (showGrid && (zoom >= 4000))
|
2009-07-01 19:24:17 +00:00
|
|
|
{
|
|
|
|
HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, 1, 0x00a0a0a0));
|
|
|
|
int counter;
|
2009-10-21 15:44:31 +00:00
|
|
|
for(counter = 0; counter <= imgYRes; counter++)
|
2009-07-01 19:24:17 +00:00
|
|
|
{
|
2009-10-21 15:44:31 +00:00
|
|
|
MoveToEx(hdc, 0, counter * zoom / 1000, NULL);
|
|
|
|
LineTo(hdc, imgXRes * zoom / 1000, counter * zoom / 1000);
|
2009-07-01 19:24:17 +00:00
|
|
|
}
|
2009-10-21 15:44:31 +00:00
|
|
|
for(counter = 0; counter <= imgXRes; counter++)
|
2009-07-01 19:24:17 +00:00
|
|
|
{
|
2009-10-21 15:44:31 +00:00
|
|
|
MoveToEx(hdc, counter * zoom / 1000, 0, NULL);
|
|
|
|
LineTo(hdc, counter * zoom / 1000, imgYRes * zoom / 1000);
|
2009-07-01 19:24:17 +00:00
|
|
|
}
|
|
|
|
DeleteObject(SelectObject(hdc, oldPen));
|
|
|
|
}
|
2009-05-12 14:15:48 +00:00
|
|
|
ReleaseDC(hImageArea, hdc);
|
|
|
|
SendMessage(hSelection, WM_PAINT, 0, 0);
|
2009-07-01 19:24:17 +00:00
|
|
|
SendMessage(hwndMiniature, WM_PAINT, 0, 0);
|
2009-10-21 15:44:31 +00:00
|
|
|
}
|
|
|
|
else if (hwnd == hwndMiniature)
|
2009-07-01 19:24:17 +00:00
|
|
|
{
|
|
|
|
long mclient[4];
|
2009-08-03 13:46:37 +00:00
|
|
|
HDC hdc;
|
2009-10-21 15:44:31 +00:00
|
|
|
GetClientRect(hwndMiniature, (LPRECT) &mclient);
|
2009-08-03 13:46:37 +00:00
|
|
|
hdc = GetDC(hwndMiniature);
|
2009-10-21 15:44:31 +00:00
|
|
|
BitBlt(hdc, -min(imgXRes * GetScrollPos(hScrollbox, SB_HORZ) / 10000, imgXRes - mclient[2]),
|
|
|
|
-min(imgYRes * GetScrollPos(hScrollbox, SB_VERT) / 10000, imgYRes - mclient[3]),
|
|
|
|
imgXRes, imgYRes, hDrawingDC, 0, 0, SRCCOPY);
|
2009-07-01 19:24:17 +00:00
|
|
|
ReleaseDC(hwndMiniature, hdc);
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
// mouse events used for drawing
|
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
case WM_SETCURSOR:
|
2009-10-21 15:44:31 +00:00
|
|
|
if (hwnd == hImageArea)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
|
|
|
switch (activeTool)
|
|
|
|
{
|
2010-05-27 12:21:50 +00:00
|
|
|
case TOOL_FILL:
|
2009-05-12 14:15:48 +00:00
|
|
|
SetCursor(hCurFill);
|
|
|
|
break;
|
2010-05-27 12:21:50 +00:00
|
|
|
case TOOL_COLOR:
|
2009-05-12 14:15:48 +00:00
|
|
|
SetCursor(hCurColor);
|
|
|
|
break;
|
2010-05-27 12:21:50 +00:00
|
|
|
case TOOL_ZOOM:
|
2009-05-12 14:15:48 +00:00
|
|
|
SetCursor(hCurZoom);
|
|
|
|
break;
|
2010-05-27 12:21:50 +00:00
|
|
|
case TOOL_PEN:
|
2009-05-12 14:15:48 +00:00
|
|
|
SetCursor(hCurPen);
|
|
|
|
break;
|
2010-05-27 12:21:50 +00:00
|
|
|
case TOOL_AIRBRUSH:
|
2009-05-12 14:15:48 +00:00
|
|
|
SetCursor(hCurAirbrush);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
SetCursor(LoadCursor(NULL, IDC_CROSS));
|
|
|
|
}
|
2009-10-21 15:44:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
DefWindowProc(hwnd, message, wParam, lParam);
|
2009-05-12 14:15:48 +00:00
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
case WM_LBUTTONDOWN:
|
2009-10-21 15:44:31 +00:00
|
|
|
if (hwnd == hImageArea)
|
|
|
|
{
|
2010-05-27 12:21:50 +00:00
|
|
|
if ((!drawing) || (activeTool == TOOL_COLOR))
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
|
|
|
SetCapture(hImageArea);
|
|
|
|
drawing = TRUE;
|
2009-10-21 15:44:31 +00:00
|
|
|
startPaintingL(hDrawingDC, LOWORD(lParam) * 1000 / zoom, HIWORD(lParam) * 1000 / zoom,
|
|
|
|
fgColor, bgColor);
|
|
|
|
}
|
|
|
|
else
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
|
|
|
SendMessage(hwnd, WM_LBUTTONUP, wParam, lParam);
|
|
|
|
undo();
|
|
|
|
}
|
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
2010-05-27 12:21:50 +00:00
|
|
|
if ((activeTool == TOOL_ZOOM) && (zoom < 8000))
|
2009-10-21 15:44:31 +00:00
|
|
|
zoomTo(zoom * 2, (short)LOWORD(lParam), (short)HIWORD(lParam));
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
case WM_RBUTTONDOWN:
|
2009-10-21 15:44:31 +00:00
|
|
|
if (hwnd == hImageArea)
|
|
|
|
{
|
2010-05-27 12:21:50 +00:00
|
|
|
if ((!drawing) || (activeTool == TOOL_COLOR))
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
|
|
|
SetCapture(hImageArea);
|
|
|
|
drawing = TRUE;
|
2009-10-21 15:44:31 +00:00
|
|
|
startPaintingR(hDrawingDC, LOWORD(lParam) * 1000 / zoom, HIWORD(lParam) * 1000 / zoom,
|
|
|
|
fgColor, bgColor);
|
|
|
|
}
|
|
|
|
else
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
|
|
|
SendMessage(hwnd, WM_RBUTTONUP, wParam, lParam);
|
|
|
|
undo();
|
|
|
|
}
|
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
2010-05-27 12:21:50 +00:00
|
|
|
if ((activeTool == TOOL_ZOOM) && (zoom > 125))
|
2009-10-21 15:44:31 +00:00
|
|
|
zoomTo(zoom / 2, (short)LOWORD(lParam), (short)HIWORD(lParam));
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
case WM_LBUTTONUP:
|
2009-10-21 15:44:31 +00:00
|
|
|
if ((hwnd == hImageArea) && drawing)
|
|
|
|
{
|
2009-05-12 14:15:48 +00:00
|
|
|
ReleaseCapture();
|
|
|
|
drawing = FALSE;
|
2009-10-21 15:44:31 +00:00
|
|
|
endPaintingL(hDrawingDC, LOWORD(lParam) * 1000 / zoom, HIWORD(lParam) * 1000 / zoom, fgColor,
|
|
|
|
bgColor);
|
2009-05-12 14:15:48 +00:00
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
2010-05-27 12:21:50 +00:00
|
|
|
if (activeTool == TOOL_COLOR)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-10-21 15:44:31 +00:00
|
|
|
int tempColor =
|
|
|
|
GetPixel(hDrawingDC, LOWORD(lParam) * 1000 / zoom, HIWORD(lParam) * 1000 / zoom);
|
|
|
|
if (tempColor != CLR_INVALID)
|
|
|
|
fgColor = tempColor;
|
2009-05-12 14:15:48 +00:00
|
|
|
SendMessage(hPalWin, WM_PAINT, 0, 0);
|
|
|
|
}
|
2009-10-21 15:44:31 +00:00
|
|
|
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) "");
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
case WM_RBUTTONUP:
|
2009-10-21 15:44:31 +00:00
|
|
|
if ((hwnd == hImageArea) && drawing)
|
|
|
|
{
|
2009-05-12 14:15:48 +00:00
|
|
|
ReleaseCapture();
|
|
|
|
drawing = FALSE;
|
2009-10-21 15:44:31 +00:00
|
|
|
endPaintingR(hDrawingDC, LOWORD(lParam) * 1000 / zoom, HIWORD(lParam) * 1000 / zoom, fgColor,
|
|
|
|
bgColor);
|
2009-05-12 14:15:48 +00:00
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
2010-05-27 12:21:50 +00:00
|
|
|
if (activeTool == TOOL_COLOR)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-10-21 15:44:31 +00:00
|
|
|
int tempColor =
|
|
|
|
GetPixel(hDrawingDC, LOWORD(lParam) * 1000 / zoom, HIWORD(lParam) * 1000 / zoom);
|
|
|
|
if (tempColor != CLR_INVALID)
|
|
|
|
bgColor = tempColor;
|
2009-05-12 14:15:48 +00:00
|
|
|
SendMessage(hPalWin, WM_PAINT, 0, 0);
|
|
|
|
}
|
2009-10-21 15:44:31 +00:00
|
|
|
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) "");
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
case WM_MOUSEMOVE:
|
2009-10-21 15:44:31 +00:00
|
|
|
if (hwnd == hImageArea)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2010-05-27 12:21:50 +00:00
|
|
|
short xNow = (short)LOWORD(lParam) * 1000 / zoom;
|
|
|
|
short yNow = (short)HIWORD(lParam) * 1000 / zoom;
|
|
|
|
if ((!drawing) || (activeTool <= TOOL_AIRBRUSH))
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-10-19 17:46:29 +00:00
|
|
|
TRACKMOUSEEVENT tme;
|
|
|
|
|
2010-05-27 12:21:50 +00:00
|
|
|
if (activeTool == TOOL_ZOOM)
|
2009-10-18 18:36:46 +00:00
|
|
|
{
|
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
|
|
|
drawZoomFrame((short)LOWORD(lParam), (short)HIWORD(lParam));
|
|
|
|
}
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-10-18 18:36:46 +00:00
|
|
|
tme.cbSize = sizeof(TRACKMOUSEEVENT);
|
|
|
|
tme.dwFlags = TME_LEAVE;
|
|
|
|
tme.hwndTrack = hImageArea;
|
|
|
|
tme.dwHoverTime = 0;
|
|
|
|
TrackMouseEvent(&tme);
|
2010-05-27 12:21:50 +00:00
|
|
|
|
|
|
|
if (!drawing)
|
|
|
|
{
|
|
|
|
TCHAR coordStr[100];
|
|
|
|
_stprintf(coordStr, _T("%d, %d"), xNow, yNow);
|
|
|
|
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) coordStr);
|
|
|
|
}
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
if (drawing)
|
|
|
|
{
|
2010-05-27 12:21:50 +00:00
|
|
|
/* values displayed in statusbar */
|
|
|
|
short xRel = xNow - startX;
|
|
|
|
short yRel = yNow - startY;
|
|
|
|
/* 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) ? -startX : xRel;
|
|
|
|
else if (xNow > imgXRes)
|
|
|
|
xRel = imgXRes-startX;
|
|
|
|
if (yRel < 0)
|
|
|
|
yRel = (yNow < 0) ? -startY : yRel;
|
|
|
|
else if (yNow > imgYRes)
|
|
|
|
yRel = imgYRes-startY;
|
|
|
|
}
|
|
|
|
/* 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("%d, %d"), xNow, yNow);
|
|
|
|
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) coordStr);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-10-21 15:44:31 +00:00
|
|
|
if ((wParam & MK_LBUTTON) != 0)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2010-05-27 12:21:50 +00:00
|
|
|
whilePaintingL(hDrawingDC, xNow, yNow, fgColor, bgColor);
|
2009-05-12 14:15:48 +00:00
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
2010-05-27 12:21:50 +00:00
|
|
|
if ((activeTool >= TOOL_TEXT) || (activeTool == TOOL_RECTSEL) || (activeTool == TOOL_FREESEL))
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-05-27 17:56:50 +00:00
|
|
|
TCHAR sizeStr[100];
|
2010-05-27 12:21:50 +00:00
|
|
|
_stprintf(sizeStr, _T("%d x %d"), xRel, yRel);
|
2009-10-21 15:44:31 +00:00
|
|
|
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) sizeStr);
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
2009-10-21 15:44:31 +00:00
|
|
|
if ((wParam & MK_RBUTTON) != 0)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2010-05-27 12:21:50 +00:00
|
|
|
whilePaintingR(hDrawingDC, xNow, yNow, fgColor, bgColor);
|
2009-05-12 14:15:48 +00:00
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
2010-05-27 12:21:50 +00:00
|
|
|
if (activeTool >= TOOL_TEXT)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-05-27 17:56:50 +00:00
|
|
|
TCHAR sizeStr[100];
|
2010-05-27 12:21:50 +00:00
|
|
|
_stprintf(sizeStr, _T("%d x %d"), xRel, yRel);
|
2009-10-21 15:44:31 +00:00
|
|
|
SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) sizeStr);
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-10-18 18:36:46 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-10-18 18:36:46 +00:00
|
|
|
case WM_MOUSELEAVE:
|
2009-10-21 15:44:31 +00:00
|
|
|
SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) _T(""));
|
2010-05-27 12:21:50 +00:00
|
|
|
if (activeTool == TOOL_ZOOM)
|
2009-10-21 15:44:31 +00:00
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
2009-05-12 14:15:48 +00:00
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
// menu and button events
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
case WM_COMMAND:
|
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
|
|
|
case IDM_HELPINFO:
|
2009-10-21 15:44:31 +00:00
|
|
|
{
|
|
|
|
HICON paintIcon = LoadIcon(hProgInstance, MAKEINTRESOURCE(IDI_APPICON));
|
|
|
|
TCHAR infotitle[100];
|
|
|
|
TCHAR infotext[200];
|
|
|
|
LoadString(hProgInstance, IDS_INFOTITLE, infotitle, SIZEOF(infotitle));
|
|
|
|
LoadString(hProgInstance, IDS_INFOTEXT, infotext, SIZEOF(infotext));
|
|
|
|
ShellAbout(hMainWnd, infotitle, infotext, paintIcon);
|
|
|
|
DeleteObject(paintIcon);
|
2009-05-12 14:15:48 +00:00
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
}
|
2009-05-12 14:15:48 +00:00
|
|
|
case IDM_HELPHELPTOPICS:
|
|
|
|
//HtmlHelp(hMainWnd, "help\\Paint.chm", 0, 0);
|
|
|
|
break;
|
|
|
|
case IDM_FILEEXIT:
|
|
|
|
SendMessage(hwnd, WM_CLOSE, wParam, lParam);
|
|
|
|
break;
|
|
|
|
case IDM_FILENEW:
|
2009-10-21 15:44:31 +00:00
|
|
|
Rectangle(hDrawingDC, 0 - 1, 0 - 1, imgXRes + 1, imgYRes + 1);
|
2009-05-12 14:15:48 +00:00
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
|
|
|
break;
|
|
|
|
case IDM_FILEOPEN:
|
2009-10-21 15:44:31 +00:00
|
|
|
if (GetOpenFileName(&ofn) != 0)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-10-18 18:36:46 +00:00
|
|
|
HBITMAP bmNew = NULL;
|
|
|
|
LoadDIBFromFile(&bmNew, ofn.lpstrFile, &fileTime, &fileSize, &fileHPPM, &fileVPPM);
|
2009-10-21 15:44:31 +00:00
|
|
|
if (bmNew != NULL)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-05-27 17:56:50 +00:00
|
|
|
TCHAR tempstr[1000];
|
|
|
|
TCHAR resstr[100];
|
2009-06-16 21:12:47 +00:00
|
|
|
insertReversible(bmNew);
|
|
|
|
updateCanvasAndScrollbars();
|
2009-05-27 12:03:18 +00:00
|
|
|
CopyMemory(filename, ofn.lpstrFileTitle, sizeof(filename));
|
|
|
|
CopyMemory(filepathname, ofn.lpstrFileTitle, sizeof(filepathname));
|
2009-05-27 17:56:50 +00:00
|
|
|
LoadString(hProgInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr));
|
|
|
|
_stprintf(tempstr, resstr, filename);
|
2009-05-12 14:15:48 +00:00
|
|
|
SetWindowText(hMainWnd, tempstr);
|
|
|
|
clearHistory();
|
|
|
|
isAFile = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IDM_FILESAVE:
|
|
|
|
if (isAFile)
|
2009-10-03 16:33:41 +00:00
|
|
|
{
|
2009-10-21 15:44:31 +00:00
|
|
|
SaveDIBToFile(hBms[currInd], filepathname, hDrawingDC, &fileTime, &fileSize, fileHPPM,
|
|
|
|
fileVPPM);
|
2009-10-03 16:33:41 +00:00
|
|
|
imageSaved = TRUE;
|
|
|
|
}
|
2009-05-12 14:15:48 +00:00
|
|
|
else
|
|
|
|
SendMessage(hwnd, WM_COMMAND, IDM_FILESAVEAS, 0);
|
|
|
|
break;
|
|
|
|
case IDM_FILESAVEAS:
|
2009-10-21 15:44:31 +00:00
|
|
|
if (GetSaveFileName(&sfn) != 0)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-05-27 17:56:50 +00:00
|
|
|
TCHAR tempstr[1000];
|
|
|
|
TCHAR resstr[100];
|
2009-10-21 15:44:31 +00:00
|
|
|
SaveDIBToFile(hBms[currInd], sfn.lpstrFile, hDrawingDC, &fileTime, &fileSize,
|
|
|
|
fileHPPM, fileVPPM);
|
2009-05-27 12:03:18 +00:00
|
|
|
CopyMemory(filename, sfn.lpstrFileTitle, sizeof(filename));
|
2009-10-03 16:33:41 +00:00
|
|
|
CopyMemory(filepathname, sfn.lpstrFile, sizeof(filepathname));
|
2009-05-27 17:56:50 +00:00
|
|
|
LoadString(hProgInstance, IDS_WINDOWTITLE, resstr, SIZEOF(resstr));
|
|
|
|
_stprintf(tempstr, resstr, filename);
|
2009-05-12 14:15:48 +00:00
|
|
|
SetWindowText(hMainWnd, tempstr);
|
|
|
|
isAFile = TRUE;
|
2009-10-03 16:33:41 +00:00
|
|
|
imageSaved = TRUE;
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-05-29 19:36:35 +00:00
|
|
|
case IDM_FILEASWALLPAPERPLANE:
|
2009-06-15 15:04:56 +00:00
|
|
|
SetWallpaper(filepathname, 1, 1);
|
2009-05-29 19:36:35 +00:00
|
|
|
break;
|
|
|
|
case IDM_FILEASWALLPAPERCENTERED:
|
2009-06-15 15:04:56 +00:00
|
|
|
SetWallpaper(filepathname, 1, 0);
|
2009-05-29 19:36:35 +00:00
|
|
|
break;
|
|
|
|
case IDM_FILEASWALLPAPERSTRETCHED:
|
2009-06-15 15:04:56 +00:00
|
|
|
SetWallpaper(filepathname, 2, 0);
|
2009-05-29 19:36:35 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case IDM_EDITUNDO:
|
|
|
|
undo();
|
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
|
|
|
break;
|
|
|
|
case IDM_EDITREDO:
|
|
|
|
redo();
|
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
|
|
|
break;
|
|
|
|
case IDM_EDITCOPY:
|
|
|
|
OpenClipboard(hMainWnd);
|
|
|
|
EmptyClipboard();
|
|
|
|
SetClipboardData(CF_BITMAP, CopyImage(hSelBm, IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG));
|
|
|
|
CloseClipboard();
|
|
|
|
break;
|
|
|
|
case IDM_EDITPASTE:
|
|
|
|
OpenClipboard(hMainWnd);
|
2009-10-21 15:44:31 +00:00
|
|
|
if (GetClipboardData(CF_BITMAP) != NULL)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-10-21 15:44:31 +00:00
|
|
|
DeleteObject(SelectObject(hSelDC, hSelBm = CopyImage(GetClipboardData(CF_BITMAP),
|
|
|
|
IMAGE_BITMAP, 0, 0,
|
|
|
|
LR_COPYRETURNORG)));
|
2009-05-12 14:15:48 +00:00
|
|
|
newReversible();
|
|
|
|
rectSel_src[0] = rectSel_src[1] = rectSel_src[2] = rectSel_src[3] = 0;
|
|
|
|
rectSel_dest[0] = rectSel_dest[1] = 0;
|
|
|
|
rectSel_dest[2] = GetDIBWidth(hSelBm);
|
|
|
|
rectSel_dest[3] = GetDIBHeight(hSelBm);
|
2009-10-21 15:44:31 +00:00
|
|
|
BitBlt(hDrawingDC, rectSel_dest[0], rectSel_dest[1], rectSel_dest[2], rectSel_dest[3],
|
|
|
|
hSelDC, 0, 0, SRCCOPY);
|
2009-05-12 14:15:48 +00:00
|
|
|
placeSelWin();
|
|
|
|
ShowWindow(hSelection, SW_SHOW);
|
|
|
|
}
|
|
|
|
CloseClipboard();
|
|
|
|
break;
|
|
|
|
case IDM_EDITDELETESELECTION:
|
2009-12-18 20:33:22 +00:00
|
|
|
{
|
2010-01-16 23:21:45 +00:00
|
|
|
/* remove selection window and already painted content using undo(),
|
|
|
|
paint Rect for rectangular selections and nothing for freeform selections */
|
|
|
|
undo();
|
2010-05-27 12:21:50 +00:00
|
|
|
if (activeTool == TOOL_RECTSEL)
|
2010-01-16 23:21:45 +00:00
|
|
|
{
|
|
|
|
newReversible();
|
|
|
|
Rect(hDrawingDC, rectSel_dest[0], rectSel_dest[1], rectSel_dest[2] + rectSel_dest[0],
|
|
|
|
rectSel_dest[3] + rectSel_dest[1], bgColor, bgColor, 0, TRUE);
|
|
|
|
}
|
2009-05-12 14:15:48 +00:00
|
|
|
break;
|
2009-12-18 20:33:22 +00:00
|
|
|
}
|
2009-05-12 14:15:48 +00:00
|
|
|
case IDM_EDITSELECTALL:
|
2010-05-27 12:21:50 +00:00
|
|
|
if (activeTool == TOOL_RECTSEL)
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-07-10 18:21:27 +00:00
|
|
|
startPaintingL(hDrawingDC, 0, 0, fgColor, bgColor);
|
|
|
|
whilePaintingL(hDrawingDC, imgXRes, imgYRes, fgColor, bgColor);
|
|
|
|
endPaintingL(hDrawingDC, imgXRes, imgYRes, fgColor, bgColor);
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IDM_EDITCOPYTO:
|
2009-10-21 15:44:31 +00:00
|
|
|
if (GetSaveFileName(&ofn) != 0)
|
|
|
|
SaveDIBToFile(hSelBm, ofn.lpstrFile, hDrawingDC, NULL, NULL, fileHPPM, fileVPPM);
|
2009-05-12 14:15:48 +00:00
|
|
|
break;
|
|
|
|
case IDM_COLORSEDITPALETTE:
|
|
|
|
if (ChooseColor(&choosecolor))
|
|
|
|
{
|
|
|
|
fgColor = choosecolor.rgbResult;
|
|
|
|
SendMessage(hPalWin, WM_PAINT, 0, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IDM_IMAGEINVERTCOLORS:
|
2009-10-21 15:44:31 +00:00
|
|
|
{
|
|
|
|
RECT tempRect;
|
|
|
|
newReversible();
|
|
|
|
SetRect(&tempRect, 0, 0, imgXRes, imgYRes);
|
|
|
|
InvertRect(hDrawingDC, &tempRect);
|
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
|
|
|
break;
|
|
|
|
}
|
2009-05-12 14:15:48 +00:00
|
|
|
case IDM_IMAGEDELETEIMAGE:
|
|
|
|
newReversible();
|
|
|
|
Rect(hDrawingDC, 0, 0, imgXRes, imgYRes, bgColor, bgColor, 0, TRUE);
|
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
|
|
|
break;
|
|
|
|
case IDM_IMAGEROTATEMIRROR:
|
|
|
|
switch (mirrorRotateDlg())
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
newReversible();
|
2009-10-21 15:44:31 +00:00
|
|
|
StretchBlt(hDrawingDC, imgXRes - 1, 0, -imgXRes, imgYRes, hDrawingDC, 0, 0,
|
|
|
|
imgXRes, imgYRes, SRCCOPY);
|
2009-05-12 14:15:48 +00:00
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
newReversible();
|
2009-10-21 15:44:31 +00:00
|
|
|
StretchBlt(hDrawingDC, 0, imgYRes - 1, imgXRes, -imgYRes, hDrawingDC, 0, 0,
|
|
|
|
imgXRes, imgYRes, SRCCOPY);
|
2009-05-12 14:15:48 +00:00
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
newReversible();
|
2009-10-21 15:44:31 +00:00
|
|
|
StretchBlt(hDrawingDC, imgXRes - 1, imgYRes - 1, -imgXRes, -imgYRes, hDrawingDC,
|
|
|
|
0, 0, imgXRes, imgYRes, SRCCOPY);
|
2009-05-12 14:15:48 +00:00
|
|
|
SendMessage(hImageArea, WM_PAINT, 0, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IDM_IMAGEATTRIBUTES:
|
2009-10-21 15:44:31 +00:00
|
|
|
{
|
|
|
|
int retVal = attributesDlg();
|
|
|
|
if ((LOWORD(retVal) != 0) && (HIWORD(retVal) != 0))
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-10-21 15:44:31 +00:00
|
|
|
cropReversible(LOWORD(retVal), HIWORD(retVal), 0, 0);
|
|
|
|
updateCanvasAndScrollbars();
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
}
|
2009-05-12 14:15:48 +00:00
|
|
|
case IDM_IMAGECHANGESIZE:
|
2009-10-21 15:44:31 +00:00
|
|
|
{
|
|
|
|
int retVal = changeSizeDlg();
|
|
|
|
if ((LOWORD(retVal) != 0) && (HIWORD(retVal) != 0))
|
2009-05-12 14:15:48 +00:00
|
|
|
{
|
2009-10-21 15:44:31 +00:00
|
|
|
insertReversible(CopyImage(hBms[currInd], IMAGE_BITMAP,
|
|
|
|
imgXRes * LOWORD(retVal) / 100,
|
|
|
|
imgYRes * HIWORD(retVal) / 100, 0));
|
|
|
|
updateCanvasAndScrollbars();
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
}
|
2009-05-12 14:15:48 +00:00
|
|
|
case IDM_IMAGEDRAWOPAQUE:
|
2009-10-21 15:44:31 +00:00
|
|
|
transpBg = 1 - transpBg;
|
2009-05-12 14:15:48 +00:00
|
|
|
SendMessage(hToolSettings, WM_PAINT, 0, 0);
|
|
|
|
break;
|
|
|
|
case IDM_IMAGECROP:
|
|
|
|
insertReversible(CopyImage(hSelBm, IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG));
|
|
|
|
updateCanvasAndScrollbars();
|
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-12-27 21:15:08 +00:00
|
|
|
case IDM_VIEWTOOLBOX:
|
|
|
|
ShowWindow(hToolBoxContainer, IsWindowVisible(hToolBoxContainer) ? SW_HIDE : SW_SHOW);
|
|
|
|
alignChildrenToMainWindow();
|
|
|
|
break;
|
|
|
|
case IDM_VIEWCOLORPALETTE:
|
|
|
|
ShowWindow(hPalWin, IsWindowVisible(hPalWin) ? SW_HIDE : SW_SHOW);
|
|
|
|
alignChildrenToMainWindow();
|
|
|
|
break;
|
2009-10-18 18:36:46 +00:00
|
|
|
case IDM_VIEWSTATUSBAR:
|
2009-10-21 15:44:31 +00:00
|
|
|
ShowWindow(hStatusBar, IsWindowVisible(hStatusBar) ? SW_HIDE : SW_SHOW);
|
2009-12-27 21:15:08 +00:00
|
|
|
alignChildrenToMainWindow();
|
2009-10-18 18:36:46 +00:00
|
|
|
break;
|
2009-07-01 19:24:17 +00:00
|
|
|
|
|
|
|
case IDM_VIEWSHOWGRID:
|
|
|
|
showGrid = !showGrid;
|
|
|
|
break;
|
|
|
|
case IDM_VIEWSHOWMINIATURE:
|
|
|
|
showMiniature = !showMiniature;
|
2009-10-21 15:44:31 +00:00
|
|
|
ShowWindow(hwndMiniature, showMiniature ? SW_SHOW : SW_HIDE);
|
2009-07-01 19:24:17 +00:00
|
|
|
break;
|
2009-10-21 15:44:31 +00:00
|
|
|
|
2009-05-12 14:15:48 +00:00
|
|
|
case IDM_VIEWZOOM125:
|
2009-10-18 18:36:46 +00:00
|
|
|
zoomTo(125, 0, 0);
|
2009-05-12 14:15:48 +00:00
|
|
|
break;
|
|
|
|
case IDM_VIEWZOOM25:
|
2009-10-18 18:36:46 +00:00
|
|
|
zoomTo(250, 0, 0);
|
2009-05-12 14:15:48 +00:00
|
|
|
break;
|
|
|
|
case IDM_VIEWZOOM50:
|
2009-10-18 18:36:46 +00:00
|
|
|
zoomTo(500, 0, 0);
|
2009-05-12 14:15:48 +00:00
|
|
|
break;
|
|
|
|
case IDM_VIEWZOOM100:
|
2009-10-18 18:36:46 +00:00
|
|
|
zoomTo(1000, 0, 0);
|
2009-05-12 14:15:48 +00:00
|
|
|
break;
|
|
|
|
case IDM_VIEWZOOM200:
|
2009-10-18 18:36:46 +00:00
|
|
|
zoomTo(2000, 0, 0);
|
2009-05-12 14:15:48 +00:00
|
|
|
break;
|
|
|
|
case IDM_VIEWZOOM400:
|
2009-10-18 18:36:46 +00:00
|
|
|
zoomTo(4000, 0, 0);
|
2009-05-12 14:15:48 +00:00
|
|
|
break;
|
|
|
|
case IDM_VIEWZOOM800:
|
2009-10-18 18:36:46 +00:00
|
|
|
zoomTo(8000, 0, 0);
|
2009-05-12 14:15:48 +00:00
|
|
|
break;
|
|
|
|
case ID_FREESEL:
|
|
|
|
selectTool(1);
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case ID_RECTSEL:
|
|
|
|
selectTool(2);
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case ID_RUBBER:
|
|
|
|
selectTool(3);
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case ID_FILL:
|
|
|
|
selectTool(4);
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case ID_COLOR:
|
|
|
|
selectTool(5);
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case ID_ZOOM:
|
|
|
|
selectTool(6);
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case ID_PEN:
|
|
|
|
selectTool(7);
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case ID_BRUSH:
|
|
|
|
selectTool(8);
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case ID_AIRBRUSH:
|
|
|
|
selectTool(9);
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case ID_TEXT:
|
|
|
|
selectTool(10);
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case ID_LINE:
|
|
|
|
selectTool(11);
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case ID_BEZIER:
|
|
|
|
selectTool(12);
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case ID_RECT:
|
|
|
|
selectTool(13);
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case ID_SHAPE:
|
|
|
|
selectTool(14);
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case ID_ELLIPSE:
|
|
|
|
selectTool(15);
|
2009-10-21 15:44:31 +00:00
|
|
|
break;
|
2009-05-12 14:15:48 +00:00
|
|
|
case ID_RRECT:
|
|
|
|
selectTool(16);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2009-10-21 15:44:31 +00:00
|
|
|
return DefWindowProc(hwnd, message, wParam, lParam);
|
2009-05-12 14:15:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|