Author: gedmurphy Date: Thu Apr 6 19:54:59 2006 New Revision: 21477
URL: http://svn.reactos.ru/svn/reactos?rev=21477&view=rev Log: Start a rewrite of an MDI WordPad.
Added: trunk/reactos/base/applications/wordpad/ trunk/reactos/base/applications/wordpad/En.rc trunk/reactos/base/applications/wordpad/about.c trunk/reactos/base/applications/wordpad/dialogs.c trunk/reactos/base/applications/wordpad/editwnd.c trunk/reactos/base/applications/wordpad/mainwnd.c trunk/reactos/base/applications/wordpad/manifest.xml trunk/reactos/base/applications/wordpad/misc.c trunk/reactos/base/applications/wordpad/opensave.c trunk/reactos/base/applications/wordpad/precomp.h trunk/reactos/base/applications/wordpad/res/ trunk/reactos/base/applications/wordpad/res/toolbar.bmp (with props) trunk/reactos/base/applications/wordpad/res/wordpad.ico (with props) trunk/reactos/base/applications/wordpad/resource.h trunk/reactos/base/applications/wordpad/wordpad.c trunk/reactos/base/applications/wordpad/wordpad.rbuild trunk/reactos/base/applications/wordpad/wordpad.rc
Added: trunk/reactos/base/applications/wordpad/En.rc URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/En... ============================================================================== --- trunk/reactos/base/applications/wordpad/En.rc (added) +++ trunk/reactos/base/applications/wordpad/En.rc Thu Apr 6 19:54:59 2006 @@ -1,0 +1,167 @@ +IDR_MAINMENU MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New...", ID_NEW + MENUITEM "&Open...", ID_OPEN + MENUITEM SEPARATOR + MENUITEM "&Close\tCtrl+F4", ID_CLOSE, GRAYED + MENUITEM "C&lose all", ID_CLOSEALL, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Save", ID_SAVE, GRAYED + MENUITEM "Save &As...", ID_SAVEAS, GRAYED + MENUITEM SEPARATOR + MENUITEM "Print Pre&view", ID_PRINTPRE, GRAYED + MENUITEM "&Print...", ID_PRINT, GRAYED + MENUITEM SEPARATOR + MENUITEM "Page Set&up...", ID_PAGESETUP, GRAYED + MENUITEM SEPARATOR + MENUITEM "E&xit\tAlt+F4", ID_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "&Undo", ID_UNDO, GRAYED + MENUITEM "&Redo", ID_REDO, GRAYED + MENUITEM SEPARATOR + MENUITEM "Cu&t", ID_CUT, GRAYED + MENUITEM "&Copy", ID_COPY, GRAYED + MENUITEM "&Paste", ID_PASTE, GRAYED + MENUITEM SEPARATOR + MENUITEM "Clear", -1, GRAYED + MENUITEM "Select &All", ID_SELALL, GRAYED + MENUITEM SEPARATOR + MENUITEM "&Find...\tCtrl+F",-1, GRAYED + MENUITEM "Find Next", -1, GRAYED + MENUITEM "Replace\tCtrl+H", -1, GRAYED + MENUITEM SEPARATOR + MENUITEM "Object Properties",-1, GRAYED + MENUITEM "Object", -1, GRAYED + END + POPUP "&View" + BEGIN + MENUITEM "&Toolbar", -1, CHECKED + MENUITEM "&Format Bar", -1, CHECKED + MENUITEM "&Ruler", -1, CHECKED + MENUITEM "&Status Bar", ID_STATUSBAR, CHECKED + END + POPUP "&Insert" + BEGIN + MENUITEM "&Date and Time...",-1, GRAYED + MENUITEM "&Object...", -1, GRAYED + END + POPUP "&Format" + BEGIN + MENUITEM "&Font...", -1 GRAYED + MENUITEM "Bulletstyle", -1, GRAYED + MENUITEM "Paragraph...", -1, GRAYED + MENUITEM "tabs...", -1, GRAYED + END + POPUP "&Window" + BEGIN + MENUITEM "&Cascade", ID_WINDOW_CASCADE + MENUITEM "Tile &Horizontally", ID_WINDOW_TILE_HORZ + MENUITEM "Tile &Vertiacally", ID_WINDOW_TILE_VERT + MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE + MENUITEM SEPARATOR + MENUITEM "Nex&t\tCtrl+F6", ID_WINDOW_NEXT + END + POPUP "&Help" + BEGIN + MENUITEM "&About...", ID_ABOUT + END +END + +IDR_POPUP MENU +BEGIN + POPUP "popup" + BEGIN + + MENUITEM SEPARATOR + + END +END + + +IDD_NEWDOCSEL DIALOGEX 6,6,159,67 +CAPTION "New" +FONT 8,"Tahoma",0,0 +STYLE WS_BORDER | WS_DLGFRAME | DS_MODALFRAME +BEGIN + LTEXT "New document Type:", IDC_STATIC, 4, 3, 72, 9 + LISTBOX IDC_LIST, 4, 16, 104, 46, WS_TABSTOP + PUSHBUTTON "&OK", IDOK, 112, 16, 44, 13 + PUSHBUTTON "&Cancel", IDCANCEL, 112, 33, 44, 13 +END + + +IDD_ABOUTBOX DIALOGEX 22,16,190,182 +CAPTION "About WordPad" +FONT 8,"Tahoma",0,0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +BEGIN + LTEXT "WordPad II v0.1\nCopyright (C) 2006\nGed Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "Close", IDOK, 65, 162, 44, 15 + ICON IDI_ICON, IDC_STATIC, 10, 10, 7, 30 + EDITTEXT IDC_LICENSE_EDIT, 8, 40, 174, 110, 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." + IDS_DEFAULT_NAME "Document %1!u!" + IDS_READY " Ready." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_DOC_TYPE_RICH_TEXT "Rich Text Document" + IDS_DOC_TYPE_UNICODE_TEXT "Text Document" + IDS_DOC_TYPE_TEXT "Unicode Text Document" +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 + +/* Hints */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_HINT_BLANK " " + IDS_HINT_NEW " Creates a new document." + IDS_HINT_OPEN " Opens an existing document." + IDS_HINT_CLOSE " Closes this window." + IDS_HINT_CLOSEALL " Closes all windows." + IDS_HINT_SAVE " Saves the active document." + IDS_HINT_SAVEAS " Saves the active document with a new name." + IDS_HINT_PRINT " Prints the active document." + IDS_HINT_PRINTPRE " Previews the printed document." + IDS_HINT_PAGESETUP " Changes page layout settings." + IDS_HINT_EXIT " Exits this application." + + IDS_HINT_CASCADE " Arrange windows so they overlap." + IDS_HINT_TILE_HORZ " Arrange windows as non-overlapping tiles." + IDS_HINT_TILE_VERT " Arrange windows as non-overlapping tiles." + IDS_HINT_ARRANGE " Arrange icons at the bottom of the window." + IDS_HINT_NEXT " Activates the next window." + + IDS_HINT_SYS_RESTORE " Restores this window to normal size." + IDS_HINT_SYS_MOVE " Moves this window." + IDS_HINT_SYS_SIZE " Resizes this window." + IDS_HINT_SYS_MINIMIZE " Collapses this window to an icon." + IDS_HINT_SYS_MAXIMIZE " Expands this window to fill this screen." +END +
Added: trunk/reactos/base/applications/wordpad/about.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/ab... ============================================================================== --- trunk/reactos/base/applications/wordpad/about.c (added) +++ trunk/reactos/base/applications/wordpad/about.c Thu Apr 6 19:54:59 2006 @@ -1,0 +1,54 @@ +#include "precomp.h" + +INT_PTR 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/wordpad/dialogs.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/di... ============================================================================== --- trunk/reactos/base/applications/wordpad/dialogs.c (added) +++ trunk/reactos/base/applications/wordpad/dialogs.c Thu Apr 6 19:54:59 2006 @@ -1,0 +1,131 @@ +#include "precomp.h" + +INT_PTR CALLBACK +NewDocSelDlgProc(HWND hDlg, + UINT message, + WPARAM wParam, + LPARAM lParam) +{ + switch (message) + { + static HWND hList; + + case WM_INITDIALOG: + { + LPTSTR lpDocType; + INT i; + + hList = GetDlgItem(hDlg, + IDC_LIST); + + for (i = IDS_DOC_TYPE_RICH_TEXT; i <= IDS_DOC_TYPE_TEXT; i++) + { + if (AllocAndLoadString(&lpDocType, + hInstance, + i)) + { + ListBox_AddString(hList, + lpDocType); + LocalFree((HLOCAL)lpDocType); + } + } + + SendMessage(hList, + LB_SETCURSEL, + 0, + 0); + + return TRUE; + } + + case WM_COMMAND: + { + INT LbSel; + + if (HIWORD(wParam) == LBN_DBLCLK) + { + LbSel = (INT)SendMessage(hList, + LB_GETCURSEL, + 0, + 0); + EndDialog(hDlg, + LbSel); + return TRUE; + } + + switch (LOWORD(wParam)) + { + case IDOK: + LbSel = (INT)SendMessage(hList, + LB_GETCURSEL, + 0, + 0); + EndDialog(hDlg, + LbSel); + return TRUE; + + case IDCANCEL: + EndDialog(hDlg, -1); + return TRUE; + } + } + } + + return FALSE; +} + + + +INT_PTR 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/wordpad/editwnd.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/ed... ============================================================================== --- trunk/reactos/base/applications/wordpad/editwnd.c (added) +++ trunk/reactos/base/applications/wordpad/editwnd.c Thu Apr 6 19:54:59 2006 @@ -1,0 +1,202 @@ +#include "precomp.h" + +static const TCHAR szEditWndClass[] = TEXT("WordPadEditWndClass"); + + +static BOOL +InitEditWnd(PEDIT_WND_INFO Info) +{ + HANDLE hDLL; + HFONT hfDefault; + + hDLL = LoadLibrary(_T("RICHED20.DLL")); + if (hDLL == NULL) + { + GetError(0); + return FALSE; + } + + Info->hEdit = CreateWindowEx(0, //WS_EX_CLIENTEDGE, + RICHEDIT_CLASS, + NULL, + WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | + ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL, + 0, + 0, + 100, + 100, + Info->hSelf, + NULL, + hInstance, + NULL); + if(Info->hEdit == NULL) + { + GetError(0); + + return FALSE; + } + + hfDefault = GetStockObject(DEFAULT_GUI_FONT); + SendMessage(Info->hEdit, + WM_SETFONT, + (WPARAM)hfDefault, + MAKELPARAM(FALSE, 0)); + + return TRUE; +} + + +static LRESULT CALLBACK +EditWndProc(HWND hwnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + PEDIT_WND_INFO Info; + LRESULT Ret = 0; + + /* Get the window context */ + Info = (PEDIT_WND_INFO)GetWindowLongPtr(hwnd, + GWLP_USERDATA); + if (Info == NULL && uMsg != WM_CREATE) + { + goto HandleDefaultMessage; + } + + switch (uMsg) + { + case WM_CREATE: + { + Info = (PEDIT_WND_INFO)(((LPMDICREATESTRUCT)((LPCREATESTRUCT)lParam)->lpCreateParams)->lParam); + Info->hSelf = hwnd; + + SetWindowLongPtr(hwnd, + GWLP_USERDATA, + (LONG_PTR)Info); + + if (!InitEditWnd(Info)) + { + Ret = (LRESULT)-1; + break; + } + break; + } + + case WM_SIZE: + { + RECT rcClient; + + if (GetClientRect(Info->hSelf, + &rcClient)) + { + SetWindowPos(Info->hEdit, + NULL, + 0, + 0, + rcClient.right, + rcClient.bottom, + SWP_NOZORDER); + } + } + + default: +HandleDefaultMessage: + Ret = DefMDIChildProc(hwnd, + uMsg, + wParam, + lParam); + break; + } + + return Ret; + +} + + +VOID +SetEditorEnvironment(PEDIT_WND_INFO Info, + BOOL Setup) +{ + if (Setup) + { + /* FIXME - setup editor environment (e.g. show toolbars, enable menus etc) */ + } + else + { + /* FIXME - cleanup editor environment (e.g. hide toolbars, disable menus etc) */ + } +} + + +BOOL +CreateEditWindow(struct _MAIN_WND_INFO *MainWnd, + POPEN_EDIT_INFO OpenInfo) +{ + PEDIT_WND_INFO Info; + HWND hWndEditor; + + Info = HeapAlloc(ProcessHeap, + 0, + sizeof(EDIT_WND_INFO)); + if (Info != NULL) + { + ZeroMemory(Info, + sizeof(EDIT_WND_INFO)); + Info->MainWnd = MainWnd; + Info->MdiEditorType = metImageEditor; + Info->OpenInfo = OpenInfo; + + hWndEditor = CreateMDIWindow(szEditWndClass, + OpenInfo->lpImageName, + WS_MAXIMIZE, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + MainWnd->hMdiClient, + hInstance, + (LPARAM)Info); + + if (hWndEditor != NULL) + return TRUE; + + + HeapFree(ProcessHeap, + 0, + Info); + } + + return FALSE; +} + +BOOL +InitEditWindowImpl(VOID) +{ + WNDCLASSEX wc = {0}; + + wc.cbSize = sizeof(WNDCLASSEX); + wc.lpfnWndProc = EditWndProc; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, + MAKEINTRESOURCE(IDI_ICON)); + wc.hCursor = LoadCursor(NULL, + IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + wc.lpszMenuName = NULL; + wc.lpszClassName = szEditWndClass; + wc.hIconSm = (HICON)LoadImage(hInstance, + MAKEINTRESOURCE(IDI_ICON), + IMAGE_ICON, + 16, + 16, + LR_SHARED); + + return RegisterClassEx(&wc) != (ATOM)0; +} + +VOID +UninitEditWindowImpl(VOID) +{ + UnregisterClass(szEditWndClass, + hInstance); +}
Added: trunk/reactos/base/applications/wordpad/mainwnd.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/ma... ============================================================================== --- trunk/reactos/base/applications/wordpad/mainwnd.c (added) +++ trunk/reactos/base/applications/wordpad/mainwnd.c Thu Apr 6 19:54:59 2006 @@ -1,0 +1,663 @@ +#include "precomp.h" + +static const TCHAR szMainWndClass[] = TEXT("WordPadMainWndClass"); + +#define ID_MDI_FIRSTCHILD 50000 +#define ID_MDI_WINDOWMENU 5 + +/* menu hints */ +static const MENU_HINT MainMenuHintTable[] = { + /* File Menu */ + {ID_BLANK, IDS_HINT_BLANK}, + {ID_NEW, IDS_HINT_NEW}, + {ID_OPEN, IDS_HINT_OPEN}, + {ID_CLOSE, IDS_HINT_CLOSE}, + {ID_CLOSEALL, IDS_HINT_CLOSEALL}, + {ID_SAVE, IDS_HINT_SAVE}, + {ID_SAVEAS, IDS_HINT_SAVEAS}, + {ID_PRINT, IDS_HINT_PRINT}, + {ID_PRINTPRE, IDS_HINT_PRINTPRE}, + {ID_PAGESETUP, IDS_HINT_PAGESETUP}, + {ID_EXIT, IDS_HINT_EXIT}, + + /* Window Menu */ + {ID_WINDOW_NEXT, IDS_HINT_NEXT}, + {ID_WINDOW_CASCADE, IDS_HINT_CASCADE}, + {ID_WINDOW_TILE_HORZ, IDS_HINT_TILE_HORZ}, + {ID_WINDOW_TILE_VERT, IDS_HINT_TILE_VERT}, + {ID_WINDOW_ARRANGE, IDS_HINT_ARRANGE} +}; + +static const MENU_HINT SystemMenuHintTable[] = { + {SC_RESTORE, IDS_HINT_SYS_RESTORE}, + {SC_MOVE, IDS_HINT_SYS_MOVE}, + {SC_SIZE, IDS_HINT_SYS_SIZE}, + {SC_MINIMIZE, IDS_HINT_SYS_MINIMIZE}, + {SC_MAXIMIZE, IDS_HINT_SYS_MAXIMIZE}, + {SC_CLOSE, IDS_HINT_CLOSE}, + {SC_NEXTWINDOW, IDS_HINT_NEXT}, +}; + + +static VOID +CreateToolbars(PMAIN_WND_INFO Info) +{ + +} + +static VOID CALLBACK +MainWndResize(PVOID Context, + WORD cx, + WORD cy) +{ + RECT rcClient = {0}; + RECT rcStatus = {0}; + HDWP dwp; + PMAIN_WND_INFO Info = (PMAIN_WND_INFO)Context; + + /* Calculate the MDI client rectangle */ + rcClient.right = cx; + rcClient.bottom = cy; + + if (Info->hStatus != NULL) + { + GetWindowRect(Info->hStatus, + &rcStatus); + rcClient.bottom -= (rcStatus.bottom - rcStatus.top); + } + + + dwp = BeginDeferWindowPos(2); + if (dwp != NULL) + { + /* Update the MDI client */ + if (Info->hMdiClient != NULL) + { + dwp = DeferWindowPos(dwp, + Info->hMdiClient, + NULL, + rcClient.left, + rcClient.top, + rcClient.right - rcClient.left, + rcClient.bottom - rcClient.top, + SWP_NOZORDER); + if (dwp == NULL) + return; + } + + /* Update the status bar */ + if (Info->hStatus != NULL) + { + dwp = DeferWindowPos(dwp, + Info->hStatus, + NULL, + 0, + cy - (rcStatus.bottom - rcStatus.top), + cx, + rcStatus.bottom - rcStatus.top, + SWP_NOZORDER); + if (dwp == NULL) + return; + } + + EndDeferWindowPos(dwp); + } +} + +static VOID +InitMainWnd(PMAIN_WND_INFO Info) +{ + CLIENTCREATESTRUCT ccs; + INT statwidths[] = {110, -1}; + + /* FIXME - create controls and initialize the application */ + + /* create the status bar */ + Info->hStatus = CreateWindowEx(0, + STATUSCLASSNAME, + NULL, + WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | CCS_NOPARENTALIGN | SBARS_SIZEGRIP, + 0, + 0, + 0, + 0, + Info->hSelf, + (HMENU)IDC_STATUSBAR, + hInstance, + NULL); + + if (Info->hStatus != NULL) + SendMessage(Info->hStatus, + SB_SETPARTS, + sizeof(statwidths)/sizeof(int), + (LPARAM)statwidths); + + /* create the MDI client window */ + ccs.hWindowMenu = GetSubMenu(GetMenu(Info->hSelf), + ID_MDI_WINDOWMENU); + ccs.idFirstChild = ID_MDI_FIRSTCHILD; + Info->hMdiClient = CreateWindowEx(WS_EX_ACCEPTFILES | WS_EX_CLIENTEDGE, + TEXT("MDICLIENT"), + NULL, + WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VSCROLL | WS_HSCROLL, + 0, + 0, + 0, + 0, + Info->hSelf, + NULL, + hInstance, + &ccs); + + CreateToolbars(Info); + + /* initialize file open/save structure */ + FileInitialize(Info->hSelf); +} + +static VOID +MainWndCommand(PMAIN_WND_INFO Info, + WORD CmdId, + HWND hControl) +{ + //static TCHAR szFileName[MAX_PATH]; + //static TCHAR szImageName[MAX_PATH]; + + UNREFERENCED_PARAMETER(hControl); + + switch (CmdId) + { + case ID_NEW: + { + OPEN_EDIT_INFO OpenInfo; + INT Ret; + + OpenInfo.CreateNew = TRUE; + + LoadAndFormatString(hInstance, + IDS_DEFAULT_NAME, + &OpenInfo.lpImageName, + ++Info->ImagesCreated); + + Ret = DialogBox(hInstance, + MAKEINTRESOURCE(IDD_NEWDOCSEL), + Info->hSelf, + NewDocSelDlgProc); + if (Ret != -1) + { + OpenInfo.DocType = Ret; + + CreateEditWindow(Info, + &OpenInfo); + } + + } + break; + + case ID_BOLD: + MessageBox(NULL, _T("Bingo"), NULL, 0); + break; + + case ID_OPEN: + { +/* OPEN_EDIT_INFO OpenInfo; + + if (DoOpenFile(Info->hSelf, + szFileName, / * full file path * / + szImageName)) / * file name * / + { + OpenInfo.CreateNew = FALSE; + + OpenInfo.Open.lpImagePath = szFileName; + OpenInfo.lpImageName = szImageName; + + CreateEditWindow(Info, + &OpenInfo); + } +*/ + } + break; + + case ID_EXIT: + SendMessage(Info->hSelf, + WM_CLOSE, + 0, + 0); + break; + + /* Window Menu */ + case ID_WINDOW_TILE_HORZ: + SendMessage(Info->hMdiClient, + WM_MDITILE, + MDITILE_HORIZONTAL, + 0); + break; + + case ID_WINDOW_TILE_VERT: + SendMessage(Info->hMdiClient, + WM_MDITILE, + MDITILE_VERTICAL, + 0); + break; + + case ID_WINDOW_CASCADE: + SendMessage(Info->hMdiClient, + WM_MDICASCADE, + 0, + 0); + break; + + case ID_WINDOW_ARRANGE: + SendMessage(Info->hMdiClient, + WM_MDIICONARRANGE, + 0, + 0); + break; + + case ID_WINDOW_NEXT: + SendMessage(Info->hMdiClient, + WM_MDINEXT, + 0, + 0); + break; + + /* Help Menu */ + case ID_ABOUT: + DialogBox(hInstance, + MAKEINTRESOURCE(IDD_ABOUTBOX), + Info->hSelf, + AboutDialogProc); + break; + } +} + +static VOID +DestroyMainWnd(PMAIN_WND_INFO Info) +{ + /* FIXME - cleanup allocated resources */ +} + + +static VOID +UpdateMainStatusBar(PMAIN_WND_INFO Info) +{ + if (Info->hStatus != NULL) + { + SendMessage(Info->hStatus, + SB_SIMPLE, + (WPARAM)Info->InMenuLoop, + 0); + } +} + +static BOOL +MainWndMenuHint(PMAIN_WND_INFO Info, + WORD CmdId, + const MENU_HINT *HintArray, + DWORD HintsCount, + UINT DefHintId) +{ + BOOL Found = FALSE; + const MENU_HINT *LastHint; + UINT HintId = DefHintId; + + LastHint = HintArray + HintsCount; + while (HintArray != LastHint) + { + if (HintArray->CmdId == CmdId) + { + HintId = HintArray->HintId; + Found = TRUE; + break; + } + HintArray++; + } + + StatusBarLoadString(Info->hStatus, + SB_SIMPLEID, + hInstance, + HintId); + + return Found; +} + +static LRESULT CALLBACK +MainWndProc(HWND hwnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + PMAIN_WND_INFO Info; + LRESULT Ret = 0; + static RECT wndOldPos; + + /* Get the window context */ + Info = (PMAIN_WND_INFO)GetWindowLongPtr(hwnd, + GWLP_USERDATA); + if (Info == NULL && uMsg != WM_CREATE) + { + goto HandleDefaultMessage; + } + + switch (uMsg) + { + case WM_CREATE: + { + Info = (PMAIN_WND_INFO)(((LPCREATESTRUCT)lParam)->lpCreateParams); + + /* Initialize the main window context */ + Info->hSelf = hwnd; + + SetWindowLongPtr(hwnd, + GWLP_USERDATA, + (LONG_PTR)Info); + + InitMainWnd(Info); + + /* Show the window */ + ShowWindow(hwnd, + Info->nCmdShow); + /* get the windows position */ + GetWindowRect(hwnd, + &wndOldPos); + + break; + } + + case WM_SIZE: + { + MainWndResize(Info, + LOWORD(lParam), + HIWORD(lParam)); + /* NOTE - do *not* forward this message to DefFrameProc! Otherwise the MDI client + will attempt to resize itself */ + + break; + } + + case WM_MOVE: + { + + } + break; + + case WM_NOTIFY: + { + + /* FIXME - handle other notifications */ + break; + } + + case WM_COMMAND: + { + MainWndCommand(Info, + LOWORD(wParam), + (HWND)lParam); + goto HandleDefaultMessage; + } + + case WM_MENUSELECT: + { + if (Info->hStatus != NULL) + { + if (!MainWndMenuHint(Info, + LOWORD(wParam), + MainMenuHintTable, + sizeof(MainMenuHintTable) / sizeof(MainMenuHintTable[0]), + IDS_HINT_BLANK)) + { + MainWndMenuHint(Info, + LOWORD(wParam), + SystemMenuHintTable, + sizeof(SystemMenuHintTable) / sizeof(SystemMenuHintTable[0]), + IDS_HINT_BLANK); + } + } + break; + } + + case WM_ENTERMENULOOP: + { + Info->InMenuLoop = TRUE; + UpdateMainStatusBar(Info); + break; + } + + case WM_EXITMENULOOP: + { + Info->InMenuLoop = FALSE; + UpdateMainStatusBar(Info); + break; + } + + case WM_CLOSE: + { + DestroyWindow(hwnd); + break; + } + + case WM_ENABLE: + { + + goto HandleDefaultMessage; + } + + case WM_NCACTIVATE: + { + + goto HandleDefaultMessage; + } + + case WM_ACTIVATEAPP: + { + + goto HandleDefaultMessage; + } + + case WM_DESTROY: + { + DestroyMainWnd(Info); + + /* FIXME: set the windows position in registry*/ + //wndOldPos + + HeapFree(ProcessHeap, + 0, + Info); + SetWindowLongPtr(hwnd, + GWLP_USERDATA, + 0); + + /* Break the message queue loop */ + PostQuitMessage(0); + break; + } + + default: + { +HandleDefaultMessage: + if (Info != NULL && Info->hMdiClient != NULL) + { + Ret = DefFrameProc(hwnd, + Info->hMdiClient, + uMsg, + wParam, + lParam); + } + else + { + Ret = DefWindowProc(hwnd, + uMsg, + wParam, + lParam); + } + break; + } + } + + return Ret; +} + +MDI_EDITOR_TYPE +MainWndGetCurrentEditor(PMAIN_WND_INFO MainWnd, + PVOID *Info) +{ + MDI_EDITOR_TYPE EditorType; + + if (MainWnd->ActiveEditor != NULL) + { + EditorType = *((PMDI_EDITOR_TYPE)MainWnd->ActiveEditor); + *Info = MainWnd->ActiveEditor; + } + else + { + EditorType = metUnknown; + *Info = NULL; + } + + return EditorType; +} + +VOID +MainWndSwitchEditorContext(PMAIN_WND_INFO Info, + HWND hDeactivate, + HWND hActivate) +{ + PMDI_EDITOR_TYPE EditorType; + + /* FIXME - optimize light weight switching + when switching from and to an editor of same type */ + + if (hDeactivate != NULL) + { + EditorType = (PMDI_EDITOR_TYPE)GetWindowLongPtr(hDeactivate, + GWLP_USERDATA); + if (EditorType != NULL) + { + switch (*EditorType) + { + case metImageEditor: + SetEditorEnvironment((PEDIT_WND_INFO)EditorType, + FALSE); + break; + + default: + break; + } + + Info->ActiveEditor = NULL; + } + } + + if (hActivate != NULL) + { + EditorType = (PMDI_EDITOR_TYPE)GetWindowLongPtr(hActivate, + GWLP_USERDATA); + if (EditorType != NULL) + { + Info->ActiveEditor = EditorType; + + switch (*EditorType) + { + case metImageEditor: + SetEditorEnvironment((PEDIT_WND_INFO)EditorType, + TRUE); + break; + + default: + break; + } + } + } +} + +HWND +CreateMainWindow(LPCTSTR lpCaption, + int nCmdShow) +{ + PMAIN_WND_INFO Info; + HWND hMainWnd = NULL; + + Info = HeapAlloc(ProcessHeap, + 0, + sizeof(MAIN_WND_INFO)); + if (Info != NULL) + { + ZeroMemory(Info, + sizeof(MAIN_WND_INFO)); + Info->nCmdShow = nCmdShow; + + /* FIXME - load the window position from the registry */ + + hMainWnd = CreateWindowEx(WS_EX_WINDOWEDGE, + szMainWndClass, + lpCaption, + WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + NULL, + NULL, + hInstance, + Info); + if (hMainWnd == NULL) + { + HeapFree(ProcessHeap, + 0, + Info); + } + } + + return hMainWnd; +} + +BOOL +MainWndTranslateMDISysAccel(HWND hwnd, + LPMSG lpMsg) +{ + PMAIN_WND_INFO Info; + + /* Get the window context */ + Info = (PMAIN_WND_INFO)GetWindowLongPtr(hwnd, + GWLP_USERDATA); + if (Info != NULL && Info->hMdiClient != NULL) + { + return TranslateMDISysAccel(Info->hMdiClient, + lpMsg); + } + + return FALSE; +} + +BOOL +InitMainWindowImpl(VOID) +{ + WNDCLASSEX wc = {0}; + + wc.cbSize = sizeof(WNDCLASSEX); + wc.lpfnWndProc = MainWndProc; + 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 = szMainWndClass; + wc.hIconSm = (HICON)LoadImage(hInstance, + MAKEINTRESOURCE(IDI_ICON), + IMAGE_ICON, + 16, + 16, + LR_SHARED); + + return RegisterClassEx(&wc) != (ATOM)0; +} + +VOID +UninitMainWindowImpl(VOID) +{ + UnregisterClass(szMainWndClass, + hInstance); +}
Added: trunk/reactos/base/applications/wordpad/manifest.xml URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/ma... ============================================================================== --- trunk/reactos/base/applications/wordpad/manifest.xml (added) +++ trunk/reactos/base/applications/wordpad/manifest.xml Thu Apr 6 19:54:59 2006 @@ -1,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <assemblyIdentity + version="1.0.0.0" + processorArchitecture="X86" + name="ReactOS.VMware.SVGA.Installer" + type="win32" + /> + <description>ReactOS VMware(r) SVGA driver Installer</description> + <dependency> + <dependentAssembly> + <assemblyIdentity + type="win32" + name="Microsoft.Windows.Common-Controls" + version="6.0.0.0" + processorArchitecture="X86" + publicKeyToken="6595b64144ccf1df" + language="*" + /> + </dependentAssembly> + </dependency> +</assembly> + +<!-- EOF -->
Added: trunk/reactos/base/applications/wordpad/misc.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/mi... ============================================================================== --- trunk/reactos/base/applications/wordpad/misc.c (added) +++ trunk/reactos/base/applications/wordpad/misc.c Thu Apr 6 19:54:59 2006 @@ -1,0 +1,204 @@ +#include "precomp.h" + +static INT +LengthOfStrResource(IN HINSTANCE hInst, + IN UINT uID) +{ + HRSRC hrSrc; + HGLOBAL hRes; + LPWSTR lpName, lpStr; + + if (hInst == NULL) + { + return -1; + } + + /* There are always blocks of 16 strings */ + lpName = (LPWSTR)MAKEINTRESOURCE((uID >> 4) + 1); + + /* Find the string table block */ + if ((hrSrc = FindResourceW(hInst, lpName, (LPWSTR)RT_STRING)) && + (hRes = LoadResource(hInst, hrSrc)) && + (lpStr = LockResource(hRes))) + { + UINT x; + + /* Find the string we're looking for */ + uID &= 0xF; /* position in the block, same as % 16 */ + for (x = 0; x < uID; x++) + { + lpStr += (*lpStr) + 1; + } + + /* Found the string */ + return (int)(*lpStr); + } + return -1; +} + +INT +AllocAndLoadString(OUT LPTSTR *lpTarget, + IN HINSTANCE hInst, + IN UINT uID) +{ + INT ln; + + ln = LengthOfStrResource(hInst, + uID); + if (ln++ > 0) + { + (*lpTarget) = (LPWSTR)LocalAlloc(LMEM_FIXED, + ln * sizeof(TCHAR)); + if ((*lpTarget) != NULL) + { + INT Ret; + if (!(Ret = LoadString(hInst, uID, *lpTarget, ln))) + { + LocalFree((HLOCAL)(*lpTarget)); + } + return Ret; + } + } + return 0; +} + +DWORD +LoadAndFormatString(IN HINSTANCE hInstance, + IN UINT uID, + OUT LPTSTR *lpTarget, + ...) +{ + DWORD Ret = 0; + LPTSTR lpFormat; + va_list lArgs; + + if (AllocAndLoadString(&lpFormat, + hInstance, + uID) > 0) + { + va_start(lArgs, lpTarget); + /* let's use FormatMessage to format it because it has the ability to allocate + memory automatically */ + Ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, + lpFormat, + 0, + 0, + (LPTSTR)lpTarget, + 0, + &lArgs); + va_end(lArgs); + + LocalFree((HLOCAL)lpFormat); + } + + return Ret; +} + +BOOL +StatusBarLoadAndFormatString(IN HWND hStatusBar, + IN INT PartId, + IN HINSTANCE hInstance, + IN UINT uID, + ...) +{ + BOOL Ret = FALSE; + LPTSTR lpFormat, lpStr; + va_list lArgs; + + if (AllocAndLoadString(&lpFormat, + hInstance, + uID) > 0) + { + va_start(lArgs, uID); + /* let's use FormatMessage to format it because it has the ability to allocate + memory automatically */ + Ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, + lpFormat, + 0, + 0, + (LPTSTR)&lpStr, + 0, + &lArgs); + va_end(lArgs); + + if (lpStr != NULL) + { + Ret = (BOOL)SendMessage(hStatusBar, + SB_SETTEXT, + (WPARAM)PartId, + (LPARAM)lpStr); + LocalFree((HLOCAL)lpStr); + } + + LocalFree((HLOCAL)lpFormat); + } + + return Ret; +} + +BOOL +StatusBarLoadString(IN HWND hStatusBar, + IN INT PartId, + IN HINSTANCE hInstance, + IN UINT uID) +{ + BOOL Ret = FALSE; + LPTSTR lpStr; + + if (AllocAndLoadString(&lpStr, + hInstance, + uID) > 0) + { + Ret = (BOOL)SendMessage(hStatusBar, + SB_SETTEXT, + (WPARAM)PartId, + (LPARAM)lpStr); + LocalFree((HLOCAL)lpStr); + } + + return Ret; +} + + +INT +GetTextFromEdit(OUT LPTSTR lpString, + IN HWND hDlg, + IN UINT Res) +{ + INT len = GetWindowTextLength(GetDlgItem(hDlg, Res)); + if(len > 0) + { + GetDlgItemText(hDlg, + Res, + lpString, + len + 1); + } + else + lpString = NULL; + + return len; +} + + +VOID GetError(DWORD err) +{ + LPVOID lpMsgBuf; + + if (err == 0) + err = GetLastError(); + + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + err, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, + 0, + NULL ); + + MessageBox(NULL, lpMsgBuf, _T("Error!"), MB_OK | MB_ICONERROR); + + LocalFree(lpMsgBuf); +} +
Added: trunk/reactos/base/applications/wordpad/opensave.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/op... ============================================================================== --- trunk/reactos/base/applications/wordpad/opensave.c (added) +++ trunk/reactos/base/applications/wordpad/opensave.c Thu Apr 6 19:54:59 2006 @@ -1,0 +1,87 @@ +#include "precomp.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"); +} + + +static BOOL +DoWriteFile(LPCTSTR pszFileName) +{ + return TRUE; +} + + +BOOL +DoOpenFile(HWND hwnd, + LPTSTR szFileName, + LPTSTR szTitleName) +{ + DWORD err; + /*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");*/ + + static TCHAR Filter[] = _T("Windows Bitmap (*.bmp)\0*.bmp\0"); + + ofn.lpstrFilter = Filter; + ofn.lpstrFile = szFileName; + ofn.lpstrFileTitle = szTitleName; + ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + + if (GetOpenFileName(&ofn)) + { + return TRUE; + } + + err = CommDlgExtendedError(); + + if (err != CDERR_GENERALCODES) + MessageBox(NULL, _T("Open file failed"), NULL, 0); + + return FALSE; +} + + + +BOOL +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 TRUE; + } + + if (CommDlgExtendedError() != CDERR_GENERALCODES) + MessageBox(NULL, _T("Save to file failed"), NULL, 0); + + return FALSE; +} +
Added: trunk/reactos/base/applications/wordpad/precomp.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/pr... ============================================================================== --- trunk/reactos/base/applications/wordpad/precomp.h (added) +++ trunk/reactos/base/applications/wordpad/precomp.h Thu Apr 6 19:54:59 2006 @@ -1,0 +1,160 @@ +#ifndef __WORDPAD_PRECOMP_H +#define __WORDPAD_PRECOMP_H + +//#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> /* GET_X/Y_LPARAM */ +#include <stdio.h> +#include <tchar.h> +#include <richedit.h> +#include <commctrl.h> +#include "resource.h" + +/* FIXME - add to headers !!! */ +#ifndef SB_SIMPLEID +#define SB_SIMPLEID 0xFF +#endif + +#define MAX_KEY_LENGTH 256 + +#define DOC_TYPE_RICH_TEXT 0 +#define DOC_TYPE_UNICODE_TEXT 1 +#define DOC_TYPE_TEXT 2 + +#ifdef _MSC_VER +#pragma warning(disable : 4100) +#endif + +/* generic definitions and forward declarations */ +struct _MAIN_WND_INFO; +struct _EDIT_WND_INFO; + +typedef enum _MDI_EDITOR_TYPE { + metUnknown = 0, + metImageEditor, +} MDI_EDITOR_TYPE, *PMDI_EDITOR_TYPE; + + +/* wordpad.c */ +extern HINSTANCE hInstance; +extern HANDLE ProcessHeap; + + +/* editwnd.c */ +typedef struct _OPEN_EDIT_INFO +{ + BOOL CreateNew; + union + { + UINT DocType; /* new */ + LPTSTR lpImagePath; /* open */ + }; + LPTSTR lpImageName; + +} OPEN_EDIT_INFO, *POPEN_EDIT_INFO; + +typedef struct _EDIT_WND_INFO +{ + MDI_EDITOR_TYPE MdiEditorType; /* Must be first member! */ + + HWND hSelf; + HWND hEdit; + struct _MAIN_WND_INFO *MainWnd; + struct _EDIT_WND_INFO *Next; + POINT ScrollPos; + USHORT Zoom; + + POPEN_EDIT_INFO OpenInfo; /* Only valid during initialization */ + + LONG Width; + LONG Height; + +} EDIT_WND_INFO, *PEDIT_WND_INFO; + +BOOL InitEditWindowImpl(VOID); +VOID UninitEditWindowImpl(VOID); +BOOL CreateEditWindow(struct _MAIN_WND_INFO *MainWnd, + POPEN_EDIT_INFO OpenInfo); +VOID SetEditorEnvironment(PEDIT_WND_INFO Info, + BOOL Setup); + + +/* mainwnd.c */ +typedef struct _MENU_HINT +{ + WORD CmdId; + UINT HintId; +} MENU_HINT, *PMENU_HINT; + +typedef struct _MAIN_WND_INFO +{ + HWND hSelf; + HWND hMdiClient; + HWND hStatus; + int nCmdShow; + + /* Editors */ + PEDIT_WND_INFO ImageEditors; + UINT ImagesCreated; + PVOID ActiveEditor; + + /* status flags */ + BOOL InMenuLoop : 1; +} MAIN_WND_INFO, *PMAIN_WND_INFO; + +BOOL InitMainWindowImpl(VOID); +VOID UninitMainWindowImpl(VOID); +HWND CreateMainWindow(LPCTSTR lpCaption, + int nCmdShow); +BOOL MainWndTranslateMDISysAccel(HWND hwnd, + LPMSG lpMsg); +VOID MainWndSwitchEditorContext(PMAIN_WND_INFO Info, + HWND hDeactivate, + HWND hActivate); +MDI_EDITOR_TYPE MainWndGetCurrentEditor(PMAIN_WND_INFO MainWnd, + PVOID *Info); + + + +/* misc.c */ +INT AllocAndLoadString(OUT LPTSTR *lpTarget, + IN HINSTANCE hInst, + IN UINT uID); + +DWORD LoadAndFormatString(IN HINSTANCE hInstance, + IN UINT uID, + OUT LPTSTR *lpTarget, + ...); + +BOOL StatusBarLoadAndFormatString(IN HWND hStatusBar, + IN INT PartId, + IN HINSTANCE hInstance, + IN UINT uID, + ...); + +BOOL StatusBarLoadString(IN HWND hStatusBar, + IN INT PartId, + IN HINSTANCE hInstance, + IN UINT uID); + +INT GetTextFromEdit(OUT LPTSTR lpString, + IN HWND hDlg, + IN UINT Res); + +VOID GetError(DWORD err); + + +/* opensave.c */ +VOID FileInitialize(HWND hwnd); +BOOL DoOpenFile(HWND hwnd, LPTSTR lpFileName, LPTSTR lpName); +BOOL DoSaveFile(HWND hwnd); + +/* about.c */ +INT_PTR CALLBACK +AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + +INT_PTR CALLBACK +NewDocSelDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + + +#endif /* __WORDPAD_PRECOMP_H */
Added: trunk/reactos/base/applications/wordpad/res/toolbar.bmp URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/re... ============================================================================== Binary file - no diff available.
Propchange: trunk/reactos/base/applications/wordpad/res/toolbar.bmp ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream
Added: trunk/reactos/base/applications/wordpad/res/wordpad.ico URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/re... ============================================================================== Binary file - no diff available.
Propchange: trunk/reactos/base/applications/wordpad/res/wordpad.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream
Added: trunk/reactos/base/applications/wordpad/resource.h URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/re... ============================================================================== --- trunk/reactos/base/applications/wordpad/resource.h (added) +++ trunk/reactos/base/applications/wordpad/resource.h Thu Apr 6 19:54:59 2006 @@ -1,0 +1,102 @@ +#define IDC_STATIC -1 + +#define IDI_ICON 50 + +#define IDS_APPNAME 101 +#define IDS_VERSION 102 +#define IDS_LICENSE 103 +#define IDS_DEFAULT_NAME 104 +#define IDS_READY 105 + +#define IDC_STATUSBAR 500 + +#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_PAGESETUP 2008 +#define ID_CUT 2009 +#define ID_COPY 2010 +#define ID_PASTE 2011 +#define ID_UNDO 2013 +#define ID_REDO 2014 +#define ID_SELALL 2015 +#define ID_EXIT 2016 +#define ID_STATUSBAR 2019 +#define ID_BOLD 2030 +#define ID_ITALIC 2031 +#define ID_ULINE 2032 +#define ID_TXTLEFT 2033 +#define ID_TXTCENTER 2034 +#define ID_TXTRIGHT 2035 +#define ID_BLANK 2036 + +#define ID_REFRESH 3000 +#define ID_HELP 3001 +#define ID_WINDOW_TILE_HORZ 3002 +#define ID_WINDOW_TILE_VERT 3003 +#define ID_WINDOW_CASCADE 3004 +#define ID_WINDOW_NEXT 3005 +#define ID_WINDOW_ARRANGE 3006 + + +/* menu hints */ +#define IDS_HINT_BLANK 20000 +#define IDS_HINT_NEW 20001 +#define IDS_HINT_OPEN 20002 +#define IDS_HINT_CLOSE 21006 +#define IDS_HINT_CLOSEALL 21007 +#define IDS_HINT_SAVE 20003 +#define IDS_HINT_SAVEAS 20004 +#define IDS_HINT_PRINT 20005 +#define IDS_HINT_PRINTPRE 20006 +#define IDS_HINT_PAGESETUP 20007 +#define IDS_HINT_EXIT 20008 + +#define IDS_HINT_CASCADE 21009 +#define IDS_HINT_TILE_HORZ 21010 +#define IDS_HINT_TILE_VERT 21011 +#define IDS_HINT_ARRANGE 21012 +#define IDS_HINT_NEXT 21013 + +/* system menu hints */ +#define IDS_HINT_SYS_RESTORE 21001 +#define IDS_HINT_SYS_MOVE 21002 +#define IDS_HINT_SYS_SIZE 21003 +#define IDS_HINT_SYS_MINIMIZE 21004 +#define IDS_HINT_SYS_MAXIMIZE 21005 +#define IDS_HINT_SYS_CLOSE 21006 + +/* 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 + + +/* about box info */ +#define IDD_ABOUTBOX 200 +#define IDC_LICENSE_EDIT 201 + +/* new doc type */ +#define IDD_NEWDOCSEL 220 +#define IDC_LIST 221 +#define IDS_DOC_TYPE_RICH_TEXT 230 +#define IDS_DOC_TYPE_UNICODE_TEXT 231 +#define IDS_DOC_TYPE_TEXT 232 + + +/* Menu */ +#define IDR_MAINMENU 102 +#define IDR_POPUP 103 +#define ID_ABOUT 4031
Added: trunk/reactos/base/applications/wordpad/wordpad.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/wo... ============================================================================== --- trunk/reactos/base/applications/wordpad/wordpad.c (added) +++ trunk/reactos/base/applications/wordpad/wordpad.c Thu Apr 6 19:54:59 2006 @@ -1,0 +1,84 @@ +#include "precomp.h" + +HINSTANCE hInstance; +HANDLE ProcessHeap; + +int WINAPI +WinMain(HINSTANCE hThisInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + LPTSTR lpAppName, lpVersion, lpTitle; + HWND hMainWnd; + MSG Msg; + BOOL bRet; + int Ret = 1; + size_t len; + INITCOMMONCONTROLSEX icex; + + hInstance = hThisInstance; + ProcessHeap = GetProcessHeap(); + + icex.dwSize = sizeof(INITCOMMONCONTROLSEX); + icex.dwICC = ICC_BAR_CLASSES | ICC_COOL_CLASSES; + InitCommonControlsEx(&icex); + + if (!AllocAndLoadString(&lpAppName, hInstance, IDS_APPNAME) || + !AllocAndLoadString(&lpVersion, hInstance, IDS_VERSION) ) + { + MessageBox(NULL, + _T("Error loading resource "), + NULL, + 0); + return 1; + } + + len = _tcslen(lpAppName) + _tcslen(lpVersion); + lpTitle = HeapAlloc(ProcessHeap, + 0, + (len + 2) * sizeof(TCHAR)); + + wsprintf(lpTitle, + _T("%s %s"), + lpAppName, + lpVersion); + + if (InitMainWindowImpl()) + { + if (InitEditWindowImpl()) + { + hMainWnd = CreateMainWindow(lpTitle, + nCmdShow); + if (hMainWnd != NULL) + { + /* pump the message queue */ + while((bRet = GetMessage(&Msg, + NULL, + 0, + 0) != 0)) + { + if (bRet != (BOOL)-1) + { + if (!MainWndTranslateMDISysAccel(hMainWnd, + &Msg)) + { + TranslateMessage(&Msg); + DispatchMessage(&Msg); + } + } + } + + Ret = 0; + } + + UninitEditWindowImpl(); + } + + UninitMainWindowImpl(); + } + + LocalFree((HLOCAL)lpAppName); + + return Ret; +}
Added: trunk/reactos/base/applications/wordpad/wordpad.rbuild URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/wo... ============================================================================== --- trunk/reactos/base/applications/wordpad/wordpad.rbuild (added) +++ trunk/reactos/base/applications/wordpad/wordpad.rbuild Thu Apr 6 19:54:59 2006 @@ -1,0 +1,28 @@ +<?xml version="1.0"?> +<rbuild xmlns:xi="http://www.w3.org/2001/XInclude"> + <module name="wordpad" type="win32gui" installbase="system32" installname="wordpad.exe"> + <include base="wordpad">.</include> + <define name="UNICODE" /> + <define name="_UNICODE" /> + <define name="__USE_W32API" /> + <define name="_WIN32_IE">0x0600</define> + <define name="_WIN32_WINNT">0x0501</define> + <library>kernel32</library> + <library>user32</library> + <library>gdi32</library> + <library>comdlg32</library> + <library>advapi32</library> + <library>shell32</library> + <library>comctl32</library> + <compilationunit name="unit.c"> + <file>dialogs.c</file> + <file>editwnd.c</file> + <file>mainwnd.c</file> + <file>misc.c</file> + <file>opensave.c</file> + <file>wordpad.c</file> + </compilationunit> + <file>wordpad.rc</file> + <pch>precomp.h</pch> + </module> +</rbuild>
Added: trunk/reactos/base/applications/wordpad/wordpad.rc URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/wo... ============================================================================== --- trunk/reactos/base/applications/wordpad/wordpad.rc (added) +++ trunk/reactos/base/applications/wordpad/wordpad.rc Thu Apr 6 19:54:59 2006 @@ -1,0 +1,26 @@ +#include <windows.h> +#include <commctrl.h> +#include "resource.h" + +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Document Editor\0" +#define REACTOS_STR_INTERNAL_NAME "wordpad\0" +#define REACTOS_STR_ORIGINAL_FILENAME "wordpad.exe\0" +//#include <reactos/version.rc> + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +1 24 DISCARDABLE "manifest.xml" + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APPNAME "WordPad" + IDS_VERSION "v0.1" +END + +IDI_ICON ICON "res/wordpad.ico" + +/* main toolbar icons */ +IDB_TEXTTOOLBAR BITMAP DISCARDABLE "res/toolbar.bmp" + +#include "En.rc" +/* please do not add any other languages whilst this is being developed */