diff --git a/reactos/base/applications/applications.rbuild b/reactos/base/applications/applications.rbuild
index 9b0700758f0..632c8ce9bc2 100644
--- a/reactos/base/applications/applications.rbuild
+++ b/reactos/base/applications/applications.rbuild
@@ -19,6 +19,9 @@
+
+
+
diff --git a/reactos/base/applications/imagesoft/about.c b/reactos/base/applications/imagesoft/about.c
new file mode 100644
index 00000000000..9ebb069b236
--- /dev/null
+++ b/reactos/base/applications/imagesoft/about.c
@@ -0,0 +1,44 @@
+#include "imagesoft.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;
+}
diff --git a/reactos/base/applications/imagesoft/en.rc b/reactos/base/applications/imagesoft/en.rc
new file mode 100644
index 00000000000..cedd8ed533a
--- /dev/null
+++ b/reactos/base/applications/imagesoft/en.rc
@@ -0,0 +1,107 @@
+IDR_MAINMENU MENU
+BEGIN
+ POPUP "&File"
+ BEGIN
+ MENUITEM "New...", ID_NEW
+ MENUITEM "Open...", ID_OPEN
+ MENUITEM "Close", ID_CLOSE, GRAYED
+ MENUITEM "Close all", ID_CLOSEALL, 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"
+ 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"
+ 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 "Colours"
+ BEGIN
+ MENUITEM "Edit Colours...", ID_EDITCOLOURS
+ END
+ POPUP "Window"
+ 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@gmail.com)", 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
+
+/* Tooltips */
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_TOOLTIP_NEW "New"
+ IDS_TOOLTIP_OPEN "Open"
+ IDS_TOOLTIP_SAVE "Save"
+ IDS_TOOLTIP_PRINTPRE "Print preview"
+ IDS_TOOLTIP_PRINT "Print"
+ IDS_TOOLTIP_CUT "Cut"
+ IDS_TOOLTIP_COPY "Copy"
+ IDS_TOOLTIP_PASTE "Paste"
+ IDS_TOOLTIP_UNDO "Undo"
+ IDS_TOOLTIP_REDO "Redo"
+END
diff --git a/reactos/base/applications/imagesoft/imagesoft.c b/reactos/base/applications/imagesoft/imagesoft.c
new file mode 100644
index 00000000000..7929df02c70
--- /dev/null
+++ b/reactos/base/applications/imagesoft/imagesoft.c
@@ -0,0 +1,682 @@
+#include "imagesoft.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;
+HWND hwndRebar;
+HMENU hShortcutMenu;
+
+
+/*
+ * Initialize the structure and send a message to the MDI
+ * frame requesting a new new child window.
+ */
+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;
+}
+
+
+/*
+ * Main program message handler
+ */
+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_INDETERMINATE, 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_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* print */
+ {STD_PRINT, ID_PRINT, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* print preview */
+
+ {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
+
+ {STD_CUT, ID_CUT, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* cut */
+ {STD_COPY, ID_COPY, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* copy */
+ {STD_PASTE, ID_PASTE, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* paste */
+
+ {10, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
+
+ {STD_UNDO, ID_UNDO, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* undo */
+ {STD_REDOW, ID_REDO, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* redo */
+ };
+
+
+/* ======================== Create Std 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 Floating Toolbar ============================== */
+
+
+
+
+/* ======================== 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), 4);
+ 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);
+
+
+/* ======================= Miscelaneous ============================= */
+
+ /* indicate program is ready in the status bar */
+ LoadString(hInstance, IDS_READY, Buf, sizeof(Buf) / sizeof(TCHAR));
+ SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)Buf);
+
+ /* inilalize file open/save structure */
+ FileInitialize(hwnd);
+
+ }
+ 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 for the MDI frame */
+ 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_NEW);
+ break;
+
+ case ID_OPEN:
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_OPEN);
+ break;
+
+ case ID_SAVE:
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_SAVE);
+ break;
+
+ case ID_PRINTPRE:
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PRINTPRE);
+ break;
+
+ case ID_PRINT:
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PRINT);
+ break;
+
+ case ID_CUT:
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_CUT);
+ break;
+
+ case ID_COPY:
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_COPY);
+ break;
+
+ case ID_PASTE:
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PASTE);
+ break;
+
+ case ID_UNDO:
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_UNDO);
+ break;
+
+ case ID_REDO:
+ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_REDO);
+ 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_OPEN:
+ DoOpenFile(hwnd);
+ break;
+
+ case ID_SAVEAS:
+ DoSaveFile(hwnd);
+ break;
+
+ case ID_CLOSE:
+ {
+ /* close the active child window */
+ HWND hChild = (HWND)SendMessage(hMDIClient, WM_MDIGETACTIVE,0,0);
+ if(hChild)
+ {
+ SendMessage(hChild, WM_CLOSE, 0, 0);
+ }
+ }
+ break;
+
+ case ID_CLOSEALL:
+ {
+ HWND hChild;
+ /* loop until all windows have been closed */
+ while ((hChild = (HWND)SendMessage(hMDIClient, WM_MDIGETACTIVE,0,0)) != NULL)
+ {
+ SendMessage(hChild, WM_CLOSE, 0, 0);
+ }
+ }
+ break;
+
+ case ID_EXIT:
+ PostMessage(hwnd, WM_CLOSE, 0, 0);
+ break;
+
+ case ID_EDITCOLOURS:
+ {
+ /* open up the colour selection dialog */
+
+ static CHOOSECOLOR cc;
+ static COLORREF crCustColors[16];
+
+ cc.lStructSize = sizeof(CHOOSECOLOR);
+ cc.hwndOwner = hwnd;
+ cc.hInstance = NULL;
+ cc.rgbResult = RGB(0x80, 0x80, 0x80);
+ cc.lpCustColors = crCustColors;
+ cc.Flags = CC_RGBINIT | CC_FULLOPEN;
+ cc.lCustData = 0;
+ cc.lpfnHook = NULL;
+ cc.lpTemplateName = NULL;
+
+ ChooseColor(&cc);
+ }
+ 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:
+ /* Catch all commands that I didn't process directly and do
+ * a check to see if the value is greater than or equal to
+ * ID_MDI_FIRSTCHILD. If it is, then the user has clicked
+ * on one of the Window menu items and we send the message
+ * on to DefFrameProc() for processing.
+ */
+ 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;
+}
+
+
+/*
+ * MDI child window message handler
+ */
+LRESULT CALLBACK MDIChildWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ static BOOL fLeftButtonDown, fRightButtonDown;
+ static HDC hdcMem;
+ static INT 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); /* edit */
+ EnableMenuItem(hMenu, 2, MF_BYPOSITION | EnableFlag); /* image */
+ EnableMenuItem(hMenu, 3, MF_BYPOSITION | EnableFlag); /* colours */
+ EnableMenuItem(hMenu, 4, MF_BYPOSITION | EnableFlag); /* window */
+
+ hFileMenu = GetSubMenu(hMenu, 0);
+ EnableMenuItem(hFileMenu, ID_SAVEAS, MF_BYCOMMAND | EnableFlag);
+
+ EnableMenuItem(hFileMenu, ID_CLOSE, MF_BYCOMMAND | EnableFlag);
+ EnableMenuItem(hFileMenu, ID_CLOSEALL, MF_BYCOMMAND | EnableFlag);
+
+ SendMessage(hTool, TB_SETSTATE, ID_COPY,
+ (LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
+
+ 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))
+ {
+
+ }
+ break;
+
+ case WM_SIZE:
+ return DefMDIChildProc(hwnd, msg, wParam, lParam);
+
+ default:
+ {
+ TCHAR Buf[6];
+
+ /* indicate program is ready in the status bar */
+ LoadString(hInstance, IDS_READY, Buf, sizeof(Buf) / sizeof(TCHAR));
+ SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)Buf);
+
+ return DefMDIChildProc(hwnd, msg, wParam, lParam);
+ }
+
+ }
+ return 0;
+}
+
+/*
+ * Register the MDI child window class
+ */
+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 = (HICON)LoadImage(hInstance,
+ MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16, 0);
+
+ 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;
+ INITCOMMONCONTROLSEX icex;
+
+ hInstance = hThisInstance;
+
+ icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
+ icex.dwICC = ICC_BAR_CLASSES;
+ InitCommonControlsEx(&icex);
+
+ 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;
+}
diff --git a/reactos/base/applications/imagesoft/imagesoft.h b/reactos/base/applications/imagesoft/imagesoft.h
new file mode 100644
index 00000000000..8e7210a249e
--- /dev/null
+++ b/reactos/base/applications/imagesoft/imagesoft.h
@@ -0,0 +1,21 @@
+#ifndef __IMAGESOFT_H
+#define __IMAGESOFT_H
+
+//#define WIN32_LEAN_AND_MEAN
+#include
+#include /* GET_X/Y_LPARAM */
+#include
+#include
+#include
+#include "resource.h"
+
+#define MAX_KEY_LENGTH 256
+#define NUM_BUTTONS 13
+
+BOOL CALLBACK AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
+
+VOID FileInitialize (HWND hwnd);
+VOID DoOpenFile(HWND hwnd);
+VOID DoSaveFile(HWND hwnd);
+
+#endif /* __IMAGESOFT_H */
diff --git a/reactos/base/applications/imagesoft/imagesoft.rbuild b/reactos/base/applications/imagesoft/imagesoft.rbuild
new file mode 100644
index 00000000000..e6ffe6fe96b
--- /dev/null
+++ b/reactos/base/applications/imagesoft/imagesoft.rbuild
@@ -0,0 +1,27 @@
+
+
+
+ .
+
+
+
+
+ 0x600
+ 0x501
+ kernel32
+ gdi32
+ user32
+ advapi32
+ version
+ comctl32
+ shell32
+ comdlg32
+
+ imagesoft.c
+ about.c
+ opensave.c
+
+ imagesoft.rc
+ imagesoft.h
+
+
diff --git a/reactos/base/applications/imagesoft/imagesoft.rc b/reactos/base/applications/imagesoft/imagesoft.rc
new file mode 100644
index 00000000000..bae7340d263
--- /dev/null
+++ b/reactos/base/applications/imagesoft/imagesoft.rc
@@ -0,0 +1,16 @@
+#include
+#include
+#include "resource.h"
+
+#define REACTOS_STR_FILE_DESCRIPTION "ReactOS image editor\0"
+#define REACTOS_STR_INTERNAL_NAME "imagesoft\0"
+#define REACTOS_STR_ORIGINAL_FILENAME "imagesoft.exe\0"
+#include
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+IDI_ICON ICON "res/imagesoft.ico"
+
+#include "En.rc"
+
+
diff --git a/reactos/base/applications/imagesoft/opensave.c b/reactos/base/applications/imagesoft/opensave.c
new file mode 100644
index 00000000000..ee0db016209
--- /dev/null
+++ b/reactos/base/applications/imagesoft/opensave.c
@@ -0,0 +1,90 @@
+#include "imagesoft.h"
+
+static OPENFILENAME ofn;
+
+/*
+ * Initialize file open / save structure
+ */
+VOID FileInitialize(HWND hwnd)
+{
+ ZeroMemory(&ofn, sizeof(ofn));
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.hwndOwner = hwnd;
+ ofn.nMaxFile = MAX_PATH;
+ ofn.nMaxFileTitle = MAX_PATH;
+ ofn.lpstrDefExt = _T("bmp");
+
+}
+
+/*
+ * Write the file to disk
+ */
+BOOL DoWriteFile(LPCTSTR pszFileName)
+{
+ return TRUE;
+}
+
+/*
+ * Read the file from disk
+ */
+BOOL DoReadFile(LPCTSTR pszFileName)
+{
+ return TRUE;
+}
+
+
+/*
+ * Show the file open dialog
+ */
+VOID DoOpenFile(HWND hwnd)
+{
+ TCHAR szFileName[MAX_PATH] = _T("");
+ static TCHAR Filter[] = _T("All image files (*.gif,*.bmp,*.jpg,*.jpeg,*.tif,*.png)\0*.gif,*.bmp,*.jpg,*.jpeg,*.tif,*.png\0") \
+ _T("All files (*.*)\0*.*\0") \
+ _T("Graphics Interchange format (*gif)\0*.gif\0") \
+ _T("Windows Bitmap (*bmp)\0*.bmp\0") \
+ _T("JPEG File Interchange Format (*jpg,*.jpeg)\0*.jpg,*.jpeg\0") \
+ _T("TAG Image File Format (*tif)\0*.tif\0") \
+ _T("Portable Network Graphics (*png)\0*.png\0\0");
+
+ ofn.lpstrFilter = Filter;
+ ofn.lpstrFile = szFileName;
+ ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
+
+ if (GetOpenFileName(&ofn))
+ {
+ if (DoReadFile(szFileName))
+ return;
+ }
+
+ if (CommDlgExtendedError() != CDERR_GENERALCODES)
+ MessageBox(NULL, _T("Open file failed"), NULL, 0);
+}
+
+
+/*
+ * Show the file saveas dialog
+ */
+VOID DoSaveFile(HWND hwnd)
+{
+ TCHAR szFileName[MAX_PATH] = _T("");
+ static TCHAR Filter[] = _T("Graphics Interchange format (*gif)\0*.gif\0") \
+ _T("Windows Bitmap (*bmp)\0*.bmp\0") \
+ _T("JPEG File Interchange Format (*jpg,*.jpeg)\0*.jpg,*.jpeg\0") \
+ _T("TAG Image File Format (*tif)\0*.tif\0") \
+ _T("Portable Network Graphics (*png)\0*.png\0\0");
+
+ ofn.lpstrFilter = Filter;
+ ofn.lpstrFile = szFileName;
+ ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
+
+ if (GetSaveFileName(&ofn))
+ {
+ if (DoWriteFile(szFileName))
+ return;
+ }
+
+ if (CommDlgExtendedError() != CDERR_GENERALCODES)
+ MessageBox(NULL, _T("Save to file failed"), NULL, 0);
+}
+
diff --git a/reactos/base/applications/imagesoft/res/imagesoft.ico b/reactos/base/applications/imagesoft/res/imagesoft.ico
new file mode 100644
index 00000000000..860f861bae2
Binary files /dev/null and b/reactos/base/applications/imagesoft/res/imagesoft.ico differ
diff --git a/reactos/base/applications/imagesoft/resource.h b/reactos/base/applications/imagesoft/resource.h
new file mode 100644
index 00000000000..3026be1b2a4
--- /dev/null
+++ b/reactos/base/applications/imagesoft/resource.h
@@ -0,0 +1,70 @@
+#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_CLOSEALL 2003
+#define ID_SAVE 2004
+#define ID_SAVEAS 2005
+#define ID_PRINTPRE 2006
+#define ID_PRINT 2007
+#define ID_PROP 2008
+#define ID_CUT 2009
+#define ID_COPY 2010
+#define ID_PASTE 2011
+#define ID_PASTENEWIMAGE 2012
+#define ID_UNDO 2013
+#define ID_REDO 2014
+#define ID_SELALL 2015
+#define ID_EXIT 2016
+#define ID_EDITCOLOURS 2017
+
+#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_NEW 6000
+#define IDS_TOOLTIP_OPEN 6001
+#define IDS_TOOLTIP_SAVE 6002
+#define IDS_TOOLTIP_PRINTPRE 6003
+#define IDS_TOOLTIP_PRINT 6004
+#define IDS_TOOLTIP_CUT 6005
+#define IDS_TOOLTIP_COPY 6006
+#define IDS_TOOLTIP_PASTE 6007
+#define IDS_TOOLTIP_UNDO 6008
+#define IDS_TOOLTIP_REDO 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