the beginnings of a native image viewing and paint program
Added: trunk/reactos/base/applications/imagesoft/
Added: trunk/reactos/base/applications/imagesoft/about.c
Added: trunk/reactos/base/applications/imagesoft/en.rc
Added: trunk/reactos/base/applications/imagesoft/paint.c
Added: trunk/reactos/base/applications/imagesoft/paint.h
Added: trunk/reactos/base/applications/imagesoft/paint.rc
Added: trunk/reactos/base/applications/imagesoft/res/
Added: trunk/reactos/base/applications/imagesoft/res/imagesoft.ico
Added: trunk/reactos/base/applications/imagesoft/resource.h
_____
Added: trunk/reactos/base/applications/imagesoft/about.c
--- trunk/reactos/base/applications/imagesoft/about.c 2006-02-12
22:21:56 UTC (rev 112)
+++ trunk/reactos/base/applications/imagesoft/about.c 2006-02-14
17:39:13 UTC (rev 113)
@@ -0,0 +1,45 @@
+
+#include "paint.h"
+
+extern HINSTANCE hInstance;
+
+#ifdef _MSC_VER
+#pragma warning(disable : 4100)
+#endif
+BOOL CALLBACK
+AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ HWND hLicenseEditWnd;
+ HICON hIcon = NULL;
+ TCHAR strLicense[700];
+
+ switch (message)
+ {
+ case WM_INITDIALOG:
+
+ hIcon = LoadImage(hInstance, MAKEINTRESOURCE(IDI_ICON),
IMAGE_ICON, 16, 16, 0);
+ SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
+
+ hLicenseEditWnd = GetDlgItem(hDlg, IDC_LICENSE_EDIT);
+
+ LoadString(hInstance, IDS_LICENSE, strLicense,
+ sizeof(strLicense) / sizeof(TCHAR));
+
+ SetWindowText(hLicenseEditWnd, strLicense);
+
+ return TRUE;
+
+ case WM_COMMAND:
+
+ if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
+ {
+ DestroyIcon(hIcon);
+ EndDialog(hDlg, LOWORD(wParam));
+ return TRUE;
+ }
+
+ break;
+ }
+
+ return FALSE;
+}
_____
Added: trunk/reactos/base/applications/imagesoft/en.rc
--- trunk/reactos/base/applications/imagesoft/en.rc 2006-02-12
22:21:56 UTC (rev 112)
+++ trunk/reactos/base/applications/imagesoft/en.rc 2006-02-14
17:39:13 UTC (rev 113)
@@ -0,0 +1,87 @@
+IDR_MAINMENU MENU
+BEGIN
+ POPUP "&File"
+ BEGIN
+ MENUITEM "New...", ID_NEW
+ MENUITEM "Open...", ID_OPEN, GRAYED
+ MENUITEM "Close...", ID_CLOSE, GRAYED
+ MENUITEM SEPARATOR
+ MENUITEM "Save", ID_SAVE, GRAYED
+ MENUITEM "Save As", ID_SAVEAS, GRAYED
+ MENUITEM SEPARATOR
+ MENUITEM "Print Preview", ID_PRINTPRE, GRAYED
+ MENUITEM "Print...", ID_PRINT, GRAYED
+ MENUITEM SEPARATOR
+ MENUITEM "Properties...", ID_PROP, GRAYED
+ MENUITEM SEPARATOR
+ MENUITEM "E&xit", ID_EXIT
+ END
+ POPUP "Edit", GRAYED
+ BEGIN
+ MENUITEM "Undo", ID_UNDO, GRAYED
+ MENUITEM "Redo", ID_REDO, GRAYED
+ MENUITEM SEPARATOR
+ MENUITEM "Cut", ID_CUT, GRAYED
+ MENUITEM "Copy", ID_COPY, GRAYED
+ MENUITEM "Paste", ID_PASTE, GRAYED
+ MENUITEM "Paste as new image",ID_PASTENEWIMAGE, GRAYED
+ MENUITEM SEPARATOR
+ MENUITEM "Select All", ID_SELALL, GRAYED
+ END
+ POPUP "Image", GRAYED
+ BEGIN
+ MENUITEM "Crop", -1, GRAYED
+ MENUITEM "Resize", -1, GRAYED
+ MENUITEM "Rotate", -1, GRAYED
+ MENUITEM "Flip", -1, GRAYED
+ MENUITEM "Stretch", -1, GRAYED
+ MENUITEM "Skew", -1, GRAYED
+ MENUITEM "Invert Colours", -1, GRAYED
+ MENUITEM SEPARATOR
+ MENUITEM "Attributes", -1, GRAYED
+ END
+ POPUP "Window", GRAYED
+ BEGIN
+ MENUITEM "Tile", -1
+ MENUITEM "Cascade", -1
+ END
+ POPUP "Help"
+ BEGIN
+ MENUITEM "About...", ID_ABOUT
+ END
+END
+
+IDR_POPUP MENU
+BEGIN
+ POPUP "popup"
+ BEGIN
+
+ MENUITEM SEPARATOR
+
+ END
+END
+
+
+IDD_ABOUTBOX DIALOGEX 22,16,190,182
+CAPTION "About ImageSoft"
+FONT 8,"Tahoma",0,0
+STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
+BEGIN
+ LTEXT "ImageSoft v0.1\nCopyright (C) 2006\nby Ged Murphy
(gedmurphy(a)gmail.com)"quot;, IDC_STATIC, 48, 7, 130, 26
+ PUSHBUTTON "Close", IDOK, 75, 162, 44, 15
+ ICON IDI_ICON, IDC_STATIC, 10, 10, 7, 30
+ EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL |
WS_TABSTOP | ES_READONLY | ES_MULTILINE
+END
+
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_LICENSE "This program is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.\r\n\r\nThis program is
distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.\r\n\r\nYou should have received a copy of the GNU
General Public License along with this program; if not, write to the
Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA."
+END
+
+/* status bar info */
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_CURPOS "Cursor : %d,%d"
+ IDS_READY "Ready"
+END
_____
Added: trunk/reactos/base/applications/imagesoft/paint.c
--- trunk/reactos/base/applications/imagesoft/paint.c 2006-02-12
22:21:56 UTC (rev 112)
+++ trunk/reactos/base/applications/imagesoft/paint.c 2006-02-14
17:39:13 UTC (rev 113)
@@ -0,0 +1,646 @@
+/*
+ * PROJECT: ReactOS Services
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: base/system/servman/servman.c
+ * PURPOSE: Main window message handler
+ * COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy(a)gmail.com>
+ *
+ */
+
+#include "paint.h"
+
+#define ID_MDI_FIRSTCHILD 50000
+
+const TCHAR AppClassName[] = _T("Parent");
+const TCHAR ChildClassName[] = _T("Child");
+
+
+HINSTANCE hInstance;
+HWND hMainWnd;
+HWND hMDIClient;
+HWND hStatus;
+HWND hTool;
+HMENU hShortcutMenu;
+
+
+HWND CreateNewMDIChild(HWND hMDIClient)
+{
+ MDICREATESTRUCT mcs;
+ HWND hChild;
+ TCHAR Buf[15];
+ static DWORD MDINum = 1;
+
+ _sntprintf(Buf, sizeof(Buf) / sizeof(TCHAR), _T("Untitled%d"),
MDINum);
+
+ mcs.szTitle = Buf;
+ mcs.szClass = ChildClassName;
+ mcs.hOwner = hInstance;
+ mcs.x = mcs.cx = CW_USEDEFAULT;
+ mcs.y = mcs.cy = CW_USEDEFAULT;
+ mcs.style = MDIS_ALLCHILDSTYLES;
+
+ hChild = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0,
(LONG)&mcs);
+ if(!hChild)
+ {
+ MessageBox(hMDIClient, _T("MDI Child creation failed."),
_T("Error!"),
+ MB_ICONEXCLAMATION | MB_OK);
+ return hChild;
+ }
+
+ MDINum++;
+ return hChild;
+}
+
+
+
+LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
lParam)
+{
+ switch(msg)
+ {
+ case WM_CREATE:
+ {
+ CLIENTCREATESTRUCT ccs;
+ TBADDBITMAP tbab;
+ INT iImageOffset;
+ INT statwidths[] = {300, 450, 550, -1}; /* widths of status
bar */
+ TCHAR Buf[6];
+
+ /* Toolbar buttons */
+ TBBUTTON tbb [NUM_BUTTONS] =
+ { /* iBitmap, idCommand, fsState, fsStyle, bReserved[2],
dwData, iString */
+ {STD_FILENEW, ID_NEW, TBSTATE_ENABLED,
TBSTYLE_BUTTON, {0}, 0, 0}, /* new */
+ {STD_FILEOPEN, ID_OPEN, TBSTATE_ENABLED,
BTNS_BUTTON, {0}, 0, 0}, /* open */
+ {STD_FILESAVE, ID_SAVE, TBSTATE_ENABLED,
BTNS_BUTTON, {0}, 0, 0}, /* save */
+
+ /* Note: First item for a seperator is its width in
pixels */
+ {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
/* separator */
+
+ {STD_PRINTPRE, ID_PRINTPRE, TBSTATE_ENABLED,
BTNS_BUTTON, {0}, 0, 0 }, /* print */
+ {STD_PRINT, ID_PRINT, TBSTATE_ENABLED,
BTNS_BUTTON, {0}, 0, 0 }, /* print preview */
+
+ {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
/* separator */
+
+ {STD_CUT, ID_CUT, TBSTATE_ENABLED,
BTNS_BUTTON, {0}, 0, 0 }, /* cut */
+ {STD_COPY, ID_COPY, TBSTATE_ENABLED,
BTNS_BUTTON, {0}, 0, 0 }, /* copy */
+ {STD_PASTE, ID_PASTE, TBSTATE_ENABLED,
BTNS_BUTTON, {0}, 0, 0 }, /* paste */
+
+ {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},
/* separator */
+
+ {STD_UNDO, ID_UNDO, TBSTATE_ENABLED,
BTNS_BUTTON, {0}, 0, 0 }, /* undo */
+ {STD_REDOW, ID_REDO, TBSTATE_ENABLED,
BTNS_BUTTON, {0}, 0, 0 }, /* redo */
+ };
+
+
+/* ======================== Create Toolbar
============================== */
+
+ /* Create Toolbar */
+ hTool = CreateWindowEx(0,
+ TOOLBARCLASSNAME,
+ NULL,
+ WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT
| TBSTYLE_TOOLTIPS,
+ 0, 0, 0, 0,
+ hwnd,
+ (HMENU)IDC_TOOLBAR,
+ hInstance,
+ NULL);
+ if(hTool == NULL)
+ MessageBox(hwnd, _T("Could not create tool bar."),
_T("Error!"), MB_OK | MB_ICONERROR);
+
+ /* Send the TB_BUTTONSTRUCTSIZE message, which is required
for backward compatibility */
+ SendMessage(hTool, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON),
0);
+
+ /* Add custom images */
+ tbab.hInst = HINST_COMMCTRL;
+ tbab.nID = IDB_STD_SMALL_COLOR;
+ iImageOffset = (INT)SendMessage(hTool, TB_ADDBITMAP,
NUM_BUTTONS, (LPARAM)&tbab);
+ /* tbb[0].iBitmap += iImageOffset; / * properties * /
+ tbb[1].iBitmap += iImageOffset; / * refresh * /
+ tbb[2].iBitmap += iImageOffset; / * export * /
+ tbb[4].iBitmap += iImageOffset; / * create * /
+ tbb[6].iBitmap += iImageOffset; / * start * /
+ tbb[7].iBitmap += iImageOffset; / * stop * /
+ tbb[8].iBitmap += iImageOffset; / * pause * /
+ tbb[9].iBitmap += iImageOffset; / * restart * /
+ tbb[11].iBitmap += iImageOffset; / * help * /
+ tbb[12].iBitmap += iImageOffset; / * exit * /
+*/
+ /* Add buttons to toolbar */
+ SendMessage(hTool, TB_ADDBUTTONS, NUM_BUTTONS, (LPARAM)
&tbb);
+
+ /* Show toolbar */
+ ShowWindow(hTool, SW_SHOWNORMAL);
+
+
+
+/* ======================== Create Status Bar
============================== */
+
+ hStatus = CreateWindowEx(0,
+ STATUSCLASSNAME,
+ NULL,
+ WS_CHILD | WS_VISIBLE |
SBARS_SIZEGRIP,
+ 0, 0, 0, 0,
+ hwnd,
+ (HMENU)IDC_STATUSBAR,
+ hInstance,
+ NULL);
+ if(hStatus == NULL)
+ MessageBox(hwnd, _T("Could not create status
bar."),
+ _T("Error!"), MB_OK | MB_ICONERROR);
+
+ SendMessage(hStatus, SB_SETPARTS,
sizeof(statwidths)/sizeof(int), (LPARAM)statwidths);
+
+
+/* ======================== Create Popup Menu
============================== */
+
+ hShortcutMenu = LoadMenu(hInstance, MAKEINTRESOURCE
(IDR_POPUP));
+ hShortcutMenu = GetSubMenu(hShortcutMenu, 0);
+
+
+/* ======================= Create MDI Client
============================= */
+
+ /* Find window menu where children will be listed */
+ ccs.hWindowMenu = GetSubMenu(GetMenu(hwnd), 3);
+ ccs.idFirstChild = ID_MDI_FIRSTCHILD;
+
+ hMDIClient = CreateWindowEx(WS_EX_CLIENTEDGE,
+ _T("mdiclient"),
+ NULL,
+ WS_CHILD | WS_CLIPCHILDREN
| WS_VSCROLL | WS_HSCROLL | WS_VISIBLE,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ hwnd,
+ (HMENU)IDC_MAIN_MDI,
+ GetModuleHandle(NULL),
+ (LPVOID)&ccs);
+
+
+ if(hMDIClient == NULL)
+ MessageBox(hwnd, _T("Could not create MDI
client."),
+ _T("Error!"), MB_OK | MB_ICONERROR);
+
+
+ /* indicate program is ready in the status bar */
+ LoadString(hInstance, IDS_READY, Buf, sizeof(Buf) /
sizeof(TCHAR));
+ SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)Buf);
+
+ }
+ break;
+
+ case WM_SIZE:
+ {
+ RECT rcTool;
+ int iToolHeight;
+
+ RECT rcStatus;
+ int iStatusHeight;
+
+ HWND hMDI;
+ int iMDIHeight;
+ RECT rcClient;
+
+ /* Size toolbar and get height */
+ hTool = GetDlgItem(hwnd, IDC_TOOLBAR);
+ SendMessage(hTool, TB_AUTOSIZE, 0, 0);
+
+ GetWindowRect(hTool, &rcTool);
+ iToolHeight = rcTool.bottom - rcTool.top;
+
+ /* Size status bar and get height */
+ hStatus = GetDlgItem(hwnd, IDC_STATUSBAR);
+ SendMessage(hStatus, WM_SIZE, 0, 0);
+
+ GetWindowRect(hStatus, &rcStatus);
+ iStatusHeight = rcStatus.bottom - rcStatus.top;
+
+ /* Calculate remaining height and size list view */
+ GetClientRect(hwnd, &rcClient);
+
+ iMDIHeight = rcClient.bottom - iToolHeight -
iStatusHeight;
+
+ hMDI = GetDlgItem(hwnd, IDC_MAIN_MDI);
+ SetWindowPos(hMDIClient, NULL, 0, iToolHeight,
rcClient.right, iMDIHeight, SWP_NOZORDER);
+ }
+ break;
+
+ case WM_NOTIFY:
+ {
+ NMHDR* nm = (NMHDR*) lParam;
+
+ switch (nm->code)
+ {
+ case TTN_GETDISPINFO:
+ {
+ LPTOOLTIPTEXT lpttt;
+ UINT idButton;
+
+ lpttt = (LPTOOLTIPTEXT) lParam;
+
+ /* Specify the resource identifier of the
descriptive
+ * text for the given button. */
+ idButton = (UINT)lpttt->hdr.idFrom;
+ switch (idButton)
+ {
+ case ID_NEW:
+ lpttt->lpszText =
MAKEINTRESOURCE(IDS_TOOLTIP_PROP);
+ break;
+
+ case ID_OPEN:
+ lpttt->lpszText =
MAKEINTRESOURCE(IDS_TOOLTIP_REFRESH);
+ break;
+
+ case ID_SAVE:
+ lpttt->lpszText =
MAKEINTRESOURCE(IDS_TOOLTIP_EXPORT);
+ break;
+
+ case ID_PRINTPRE:
+ lpttt->lpszText =
MAKEINTRESOURCE(IDS_TOOLTIP_NEW);
+ break;
+
+ case ID_PRINT:
+ lpttt->lpszText =
MAKEINTRESOURCE(IDS_TOOLTIP_START);
+ break;
+
+ case ID_CUT:
+ lpttt->lpszText =
MAKEINTRESOURCE(IDS_TOOLTIP_STOP);
+ break;
+
+ case ID_COPY:
+ lpttt->lpszText =
MAKEINTRESOURCE(IDS_TOOLTIP_PAUSE);
+ break;
+
+ case ID_PASTE:
+ lpttt->lpszText =
MAKEINTRESOURCE(IDS_TOOLTIP_RESTART);
+ break;
+
+ case ID_UNDO:
+ lpttt->lpszText =
MAKEINTRESOURCE(IDS_TOOLTIP_HELP);
+ break;
+
+ case ID_REDO:
+ lpttt->lpszText =
MAKEINTRESOURCE(IDS_TOOLTIP_EXIT);
+ break;
+
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+
+ case WM_CONTEXTMENU:
+ {
+ int xPos, yPos;
+
+ xPos = GET_X_LPARAM(lParam);
+ yPos = GET_Y_LPARAM(lParam);
+
+ TrackPopupMenuEx(hShortcutMenu, TPM_RIGHTBUTTON,
+ xPos, yPos, hwnd, NULL);
+ }
+ break;
+
+ case WM_COMMAND:
+
+ switch(LOWORD(wParam))
+ {
+ case ID_NEW:
+ CreateNewMDIChild(hMDIClient);
+ break;
+
+ case ID_REFRESH:
+ break;
+
+
+ case ID_HELP:
+ MessageBox(NULL, _T("Help is not yet
implemented\n"),
+ _T("Note!"), MB_OK | MB_ICONINFORMATION);
+ break;
+
+ case ID_EXIT:
+ PostMessage(hwnd, WM_CLOSE, 0, 0);
+ break;
+
+ case ID_WINDOW_TILE:
+ SendMessage(hMDIClient,
WM_MDITILE, 0, 0);
+ break;
+
+ case ID_WINDOW_CASCADE:
+ SendMessage(hMDIClient,
WM_MDICASCADE, 0, 0);
+ break;
+
+ case ID_ABOUT:
+ DialogBox(hInstance,
+ MAKEINTRESOURCE(IDD_ABOUTBOX),
+ hMainWnd,
+ (DLGPROC)AboutDialogProc);
+ break;
+
+ default:
+ {
+ if(LOWORD(wParam) >=
ID_MDI_FIRSTCHILD)
+ {
+ DefFrameProc(hwnd,
hMDIClient, WM_COMMAND, wParam, lParam);
+ }
+ else
+ {
+ HWND hChild =
(HWND)SendMessage(hMDIClient, WM_MDIGETACTIVE,0,0);
+ if(hChild)
+ {
+
SendMessage(hChild, WM_COMMAND, wParam, lParam);
+ }
+ }
+ }
+ }
+ break;
+
+ case WM_CLOSE:
+ DestroyMenu(hShortcutMenu);
+ DestroyWindow(hwnd);
+ break;
+
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ break;
+
+ default:
+ return DefFrameProc(hwnd, hMDIClient, msg, wParam,
lParam);
+ }
+ return 0;
+}
+
+
+void GetLargestDisplayMode(int *pcxBitmap, int *pcyBitmap)
+{
+ DEVMODE devmode;
+ int iModeNum = 0;
+
+ *pcxBitmap = *pcyBitmap = 0;
+
+ ZeroMemory(&devmode, sizeof(DEVMODE));
+ devmode.dmSize = sizeof(DEVMODE);
+
+ while (EnumDisplaySettings (NULL, iModeNum++, &devmode))
+ {
+ *pcxBitmap = max (*pcxBitmap, (int) devmode.dmPelsWidth);
+ *pcyBitmap = max (*pcyBitmap, (int) devmode.dmPelsHeight);
+ }
+}
+
+
+
+LRESULT CALLBACK MDIChildWndProc(HWND hwnd, UINT msg, WPARAM wParam,
LPARAM lParam)
+{
+ static BOOL fLeftButtonDown, fRightButtonDown ;
+ static HBITMAP hBitmap;
+ static HDC hdcMem;
+ static int cxBitmap, cyBitmap, cxClient, cyClient, xMouse,
yMouse;
+ HDC hdc;
+ PAINTSTRUCT ps;
+
+ switch(msg)
+ {
+ case WM_CREATE:
+ break;
+
+ case WM_MDIACTIVATE:
+ {
+ HMENU hMenu, hFileMenu;
+ UINT EnableFlag;
+
+ hMenu = GetMenu(hMainWnd);
+ if(hwnd == (HWND)lParam)
+ { /* being activated, enable the menus */
+ EnableFlag = MF_ENABLED;
+ }
+ else
+ {
+ TCHAR Buf[6];
+ /* being de-activated, gray the menus */
+ EnableFlag = MF_GRAYED;
+
+ /* indicate program is ready in the status bar */
+ LoadString(hInstance, IDS_READY, Buf, sizeof(Buf) /
sizeof(TCHAR));
+ SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)Buf);
+ }
+
+ EnableMenuItem(hMenu, 1, MF_BYPOSITION | EnableFlag);
+ EnableMenuItem(hMenu, 2, MF_BYPOSITION | EnableFlag);
+ EnableMenuItem(hMenu, 3, MF_BYPOSITION | EnableFlag);
+
+ hFileMenu = GetSubMenu(hMenu, 0);
+// EnableMenuItem(hFileMenu, ID_FILE_SAVEAS,
MF_BYCOMMAND | EnableFlag);
+
+// EnableMenuItem(hFileMenu, ID_FILE_CLOSE,
MF_BYCOMMAND | EnableFlag);
+// EnableMenuItem(hFileMenu, ID_FILE_CLOSEALL,
MF_BYCOMMAND | EnableFlag);
+
+ DrawMenuBar(hMainWnd);
+ }
+ break;
+
+ case WM_MOUSEMOVE:
+ {
+ POINT pt;
+ TCHAR Buf[200];
+ TCHAR Cur[15];
+
+ pt.x = LOWORD(lParam);
+ pt.y = HIWORD(lParam);
+
+ /* set cursor location in the status bar */
+ LoadString(hInstance, IDS_CURPOS, Cur, sizeof(Cur) /
sizeof(TCHAR));
+ _sntprintf(Buf, sizeof(Buf) / sizeof(TCHAR), Cur, pt.x,
pt.y);
+ SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)Buf);
+
+ if (!fLeftButtonDown && !fRightButtonDown)
+ return 0;
+
+ hdc = GetDC(hwnd);
+
+ SelectObject(hdc,
+ GetStockObject(fLeftButtonDown ? BLACK_PEN : WHITE_PEN)
);
+
+ SelectObject(hdcMem,
+ GetStockObject(fLeftButtonDown ? BLACK_PEN : WHITE_PEN)
);
+
+ MoveToEx (hdc, xMouse, yMouse, NULL);
+ MoveToEx (hdcMem, xMouse, yMouse, NULL);
+
+ xMouse = (short) LOWORD(lParam);
+ yMouse = (short) HIWORD(lParam);
+
+ LineTo(hdc, xMouse, yMouse);
+ LineTo(hdcMem, xMouse, yMouse);
+
+ ReleaseDC(hwnd, hdc);
+ }
+ break;
+
+ case WM_LBUTTONDOWN:
+ if (!fRightButtonDown)
+ SetCapture(hwnd);
+
+ xMouse = LOWORD(lParam);
+ yMouse = HIWORD(lParam);
+ fLeftButtonDown = TRUE;
+ break;
+
+ case WM_LBUTTONUP:
+ if (fLeftButtonDown)
+ SetCapture(NULL);
+
+ fLeftButtonDown = FALSE;
+ break;
+
+ case WM_RBUTTONDOWN:
+ if (!fLeftButtonDown)
+ SetCapture(hwnd);
+
+ xMouse = LOWORD(lParam);
+ yMouse = HIWORD(lParam);
+ fRightButtonDown = TRUE;
+ break;
+
+ case WM_RBUTTONUP:
+ if (fRightButtonDown)
+ SetCapture(NULL);
+
+ fRightButtonDown = FALSE;
+ break;
+
+ case WM_PAINT:
+ hdc = BeginPaint(hwnd, &ps);
+
+ BitBlt(hdc, 0, 0, cxClient, cyClient, hdcMem, 0, 0,
SRCCOPY);
+
+ EndPaint(hwnd, &ps);
+ break;
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
+ {
+/* case ID_OPEN:
+ DoFileOpen(hwnd);
+ break;
+ case ID_SAVEAS:
+ DoFileSave(hwnd);
+ break;
+ case ID_CUT:
+ SendDlgItemMessage(hwnd,
IDC_CHILD_EDIT, WM_CUT, 0, 0);
+ break;
+ case ID_COPY:
+ SendDlgItemMessage(hwnd,
IDC_CHILD_EDIT, WM_COPY, 0, 0);
+ break;
+ case ID_PASTE:
+ SendDlgItemMessage(hwnd,
IDC_CHILD_EDIT, WM_PASTE, 0, 0);
+*/ break;
+ }
+ break;
+
+ case WM_SIZE:
+ return DefMDIChildProc(hwnd, msg, wParam, lParam);
+
+ default:
+ return DefMDIChildProc(hwnd, msg, wParam,
lParam);
+
+ }
+ return 0;
+}
+
+
+BOOL SetUpMDIChildWindowClass(HINSTANCE hInstance)
+{
+ WNDCLASSEX wc;
+
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = MDIChildWndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = hInstance;
+ wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = ChildClassName;
+ wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
+
+ if(!RegisterClassEx(&wc))
+ {
+ MessageBox(0, _T("Could Not Register Child Window"),
_T("Error!"),
+ MB_ICONEXCLAMATION | MB_OK);
+ return FALSE;
+ }
+ else
+ return TRUE;
+}
+
+#ifdef _MSC_VER
+#pragma warning(disable : 4100)
+#endif
+int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance,
+ LPSTR lpCmdLine, int nCmdShow)
+{
+ WNDCLASSEX wc;
+ MSG Msg;
+
+ hInstance = hThisInstance;
+
+ InitCommonControls();
+
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.style = 0;
+ wc.lpfnWndProc = WndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = hInstance;
+ wc.hIcon = LoadIcon(hInstance,
MAKEINTRESOURCE(IDI_ICON));
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
+ wc.lpszMenuName = MAKEINTRESOURCE(IDR_MAINMENU);
+ wc.lpszClassName = AppClassName;
+ wc.hIconSm = (HICON)LoadImage(hInstance,
+ MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16,
0);
+
+ if(!RegisterClassEx(&wc))
+ {
+ MessageBox(NULL, _T("Window Registration Failed!"),
_T("Error!"),
+ MB_ICONEXCLAMATION | MB_OK);
+ return 0;
+ }
+
+ if(!SetUpMDIChildWindowClass(hInstance))
+ return 0;
+
+ hMainWnd = CreateWindowEx(
+ 0,
+ AppClassName,
+ _T("ImageSoft"),
+ WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
+ CW_USEDEFAULT, CW_USEDEFAULT, 800, 600,
+ NULL, NULL, hInstance, NULL);
+
+ if(hMainWnd == NULL)
+ {
+ MessageBox(NULL, _T("Window Creation Failed!"),
_T("Error!"),
+ MB_ICONEXCLAMATION | MB_OK);
+ return 0;
+ }
+
+ ShowWindow(hMainWnd, nCmdShow);
+ UpdateWindow(hMainWnd);
+
+ while( GetMessage( &Msg, NULL, 0, 0 ) )
+ {
+ if (!TranslateMDISysAccel(hMDIClient, &Msg))
+ {
+ TranslateMessage(&Msg);
+ DispatchMessage(&Msg);
+ }
+ }
+ return (int)Msg.wParam;
+}
_____
Added: trunk/reactos/base/applications/imagesoft/paint.h
--- trunk/reactos/base/applications/imagesoft/paint.h 2006-02-12
22:21:56 UTC (rev 112)
+++ trunk/reactos/base/applications/imagesoft/paint.h 2006-02-14
17:39:13 UTC (rev 113)
@@ -0,0 +1,17 @@
+#ifndef __PAINT_H
+#define __PAINT_H
+
+//#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <windowsx.h> /* GET_X/Y_LPARAM */
+#include <stdio.h>
+#include <tchar.h>
+#include <commctrl.h>
+#include "resource.h"
+
+#define MAX_KEY_LENGTH 256
+#define NUM_BUTTONS 13
+
+BOOL CALLBACK AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam,
LPARAM lParam);
+
+#endif /* __SERVMAN_H */
_____
Added: trunk/reactos/base/applications/imagesoft/paint.rc
--- trunk/reactos/base/applications/imagesoft/paint.rc 2006-02-12
22:21:56 UTC (rev 112)
+++ trunk/reactos/base/applications/imagesoft/paint.rc 2006-02-14
17:39:13 UTC (rev 113)
@@ -0,0 +1,17 @@
+#include <windows.h>
+#include <commctrl.h>
+#include "resource.h"
+
+
+//#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Service Manager\0"
+//#define REACTOS_STR_INTERNAL_NAME "services\0"
+//#define REACTOS_STR_ORIGINAL_FILENAME "services.exe\0"
+//#include <reactos/version.rc>
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+IDI_ICON ICON "res/ImageSoft.ico"
+
+#include "En.rc"
+
+
_____
Added: trunk/reactos/base/applications/imagesoft/res/imagesoft.ico
(Binary files differ)
Property changes on:
trunk/reactos/base/applications/imagesoft/res/imagesoft.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
_____
Added: trunk/reactos/base/applications/imagesoft/resource.h
--- trunk/reactos/base/applications/imagesoft/resource.h
2006-02-12 22:21:56 UTC (rev 112)
+++ trunk/reactos/base/applications/imagesoft/resource.h
2006-02-14 17:39:13 UTC (rev 113)
@@ -0,0 +1,68 @@
+#define IDC_STATIC -1
+
+#define IDC_TOOLBAR 1001
+#define IDC_STATUSBAR 1002
+#define IDC_MAIN_MDI 1004
+
+#define ID_NEW 2000
+#define ID_OPEN 2001
+#define ID_CLOSE 2002
+#define ID_SAVE 2003
+#define ID_SAVEAS 2004
+#define ID_PRINTPRE 2005
+#define ID_PRINT 2006
+#define ID_PROP 2007
+#define ID_CUT 2008
+#define ID_COPY 2009
+#define ID_PASTE 2010
+#define ID_PASTENEWIMAGE 2011
+#define ID_UNDO 2012
+#define ID_REDO 2013
+#define ID_SELALL 2014
+#define ID_EXIT 2015
+
+#define ID_REFRESH 3000
+#define ID_HELP 3001
+#define ID_WINDOW_TILE 3002
+#define ID_WINDOW_CASCADE 3003
+
+/* Menu */
+#define IDR_MAINMENU 102
+#define IDR_POPUP 103
+#define ID_ABOUT 4031
+
+
+/* tooltips */
+#define IDS_TOOLTIP_PROP 6000
+#define IDS_TOOLTIP_REFRESH 6001
+#define IDS_TOOLTIP_EXPORT 6002
+#define IDS_TOOLTIP_START 6003
+#define IDS_TOOLTIP_STOP 6004
+#define IDS_TOOLTIP_PAUSE 6005
+#define IDS_TOOLTIP_RESTART 6006
+#define IDS_TOOLTIP_NEW 6007
+#define IDS_TOOLTIP_HELP 6008
+#define IDS_TOOLTIP_EXIT 6009
+
+#define IDI_ICON 50
+#define IDB_BUTTONS 51
+
+/* toolbar buttons */
+#define TBICON_PROP 0
+#define TBICON_REFRESH 1
+#define TBICON_EXPORT 2
+#define TBICON_CREATE 3
+#define TBICON_START 4
+#define TBICON_STOP 5
+#define TBICON_PAUSE 6
+#define TBICON_RESTART 7
+#define TBICON_HELP 8
+#define TBICON_EXIT 9
+
+/* about box info */
+#define IDD_ABOUTBOX 200
+#define IDC_LICENSE_EDIT 201
+#define IDS_LICENSE 202
+
+#define IDS_CURPOS 550
+#define IDS_READY 551