* Create a branch for USB experiments.

svn path=/branches/usb-experiments/; revision=72629
This commit is contained in:
Amine Khaldi 2016-09-09 15:11:19 +00:00
parent 28d8ba0d3e
commit 0ee830d7a4
23049 changed files with 0 additions and 1313991 deletions

View file

@ -0,0 +1,17 @@
PROJECT(progman)
list(APPEND SOURCE
dialog.c
group.c
grpfile.c
main.c
program.c
string.c
progman.h)
add_executable(progman ${SOURCE} progman.rc)
set_module_type(progman win32gui UNICODE)
add_importlibs(progman advapi32 user32 gdi32 comctl32 comdlg32 shell32 msvcrt kernel32)
add_pch(progman progman.h SOURCE)
add_cd_file(TARGET progman DESTINATION reactos/system32 FOR all)

1079
base/shell/progman/dialog.c Normal file

File diff suppressed because it is too large Load diff

674
base/shell/progman/group.c Normal file
View file

@ -0,0 +1,674 @@
/*
* Program Manager
*
* Copyright 1996 Ulrich Schmid
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* PROJECT: ReactOS Program Manager
* COPYRIGHT: GPL - See COPYING in the top level directory
* FILE: base/shell/progman/group.c
* PURPOSE: Program group files helper functions
* PROGRAMMERS: Ulrich Schmid
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
*/
#include "progman.h"
/***********************************************************************
*
* UX Theming helpers, dropped from msconfig_new/comctl32ex/uxthemesupp.c
*
*/
static HMODULE hUxTheme = NULL;
typedef HRESULT (WINAPI* ETDTProc)(HWND, DWORD);
static ETDTProc fnEnableThemeDialogTexture = NULL;
typedef HRESULT (WINAPI* SWTProc)(HWND, LPCWSTR, LPCWSTR);
static SWTProc fnSetWindowTheme = NULL;
static BOOL
InitUxTheme(VOID)
{
if (hUxTheme) return TRUE;
hUxTheme = LoadLibraryW(L"uxtheme.dll");
if (hUxTheme == NULL) return FALSE;
fnEnableThemeDialogTexture =
(ETDTProc)GetProcAddress(hUxTheme, "EnableThemeDialogTexture");
fnSetWindowTheme =
(SWTProc)GetProcAddress(hUxTheme, "SetWindowTheme");
return TRUE;
}
#if 0
static VOID
CleanupUxTheme(VOID)
{
FreeLibrary(hUxTheme);
hUxTheme = NULL;
}
#endif
////////////////////////////////////////////////////////////////////////////////
// Taken from WinSpy++ 1.7
// http://www.catch22.net/software/winspy
// Copyright (c) 2002 by J Brown
//
HRESULT
WINAPI
EnableThemeDialogTexture(_In_ HWND hwnd,
_In_ DWORD dwFlags)
{
if (!InitUxTheme())
return HRESULT_FROM_WIN32(GetLastError());
if (!fnEnableThemeDialogTexture)
return HRESULT_FROM_WIN32(GetLastError());
return fnEnableThemeDialogTexture(hwnd, dwFlags);
}
HRESULT
WINAPI
SetWindowTheme(_In_ HWND hwnd,
_In_ LPCWSTR pszSubAppName,
_In_ LPCWSTR pszSubIdList)
{
if (!InitUxTheme())
return HRESULT_FROM_WIN32(GetLastError());
if (!fnSetWindowTheme)
return HRESULT_FROM_WIN32(GetLastError());
return fnSetWindowTheme(hwnd, pszSubAppName, pszSubIdList);
}
/***********************************************************************
*
* GROUP_GroupWndProc
*/
static
LRESULT
CALLBACK
GROUP_GroupWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
PROGGROUP* group;
INT iItem;
LVITEMW lvItem;
POINT pt;
group = (PROGGROUP*)GetWindowLongPtrW(hWnd, 0);
switch (uMsg)
{
case WM_NCCREATE:
{
LPCREATESTRUCTW pcs = (LPCREATESTRUCTW)lParam;
LPMDICREATESTRUCTW pMDIcs = (LPMDICREATESTRUCTW)pcs->lpCreateParams;
group = (PROGGROUP*)pMDIcs->lParam;
SetWindowLongPtrW(hWnd, 0, (LONG_PTR)group);
if (group->bIsCommonGroup)
{
DefMDIChildProcW(hWnd, WM_SETICON, ICON_BIG,
(LPARAM)CopyImage(Globals.hCommonGroupIcon,
IMAGE_ICON,
GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON),
LR_COPYFROMRESOURCE));
DefMDIChildProcW(hWnd, WM_SETICON, ICON_SMALL,
(LPARAM)CopyImage(Globals.hCommonGroupIcon,
IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
LR_COPYFROMRESOURCE));
}
else
{
DefMDIChildProcW(hWnd, WM_SETICON, ICON_BIG,
(LPARAM)CopyImage(Globals.hPersonalGroupIcon,
IMAGE_ICON,
GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON),
LR_COPYFROMRESOURCE));
DefMDIChildProcW(hWnd, WM_SETICON, ICON_SMALL,
(LPARAM)CopyImage(Globals.hPersonalGroupIcon,
IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
LR_COPYFROMRESOURCE));
}
break;
}
case WM_NCDESTROY:
SetWindowLongPtrW(hWnd, 0, 0);
break;
case WM_CREATE:
{
DWORD dwStyle;
RECT rect;
GetClientRect(hWnd, &rect);
group->hListView = CreateWindowW(WC_LISTVIEW,
NULL,
WS_CHILD | WS_VISIBLE | WS_OVERLAPPED,
0, 0,
rect.right - rect.left,
rect.bottom - rect.top,
hWnd,
NULL,
Globals.hInstance,
NULL);
dwStyle = (GetWindowLongPtrW(group->hListView, GWL_STYLE) | LVS_SHOWSELALWAYS) & ~LVS_AUTOARRANGE;
SetWindowLongPtrW(group->hListView, GWL_STYLE, dwStyle);
dwStyle = SendMessageA(group->hListView, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0) | LVS_EX_BORDERSELECT;
SendMessageA(group->hListView, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_SNAPTOGRID, dwStyle);
InitUxTheme();
SetWindowTheme(group->hListView, L"Explorer", NULL);
group->hListLarge = ImageList_Create(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), ILC_COLOR24 | ILC_MASK, 1, 1);
SendMessageA(group->hListView, LVM_SETIMAGELIST, 0, (LPARAM)group->hListLarge);
SendMessageA(group->hListView, LVM_SETICONSPACING, 0, MAKELPARAM(80, 64));
break;
}
case WM_DESTROY:
{
SendMessageA(group->hListView, LVM_SETIMAGELIST, 0, 0);
ImageList_Destroy(group->hListLarge);
DestroyWindow(group->hListView);
break;
}
case WM_SIZE:
{
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = LOWORD(lParam);
rect.bottom = HIWORD(lParam);
AdjustWindowRectEx(&rect, GetWindowLongPtrW(group->hListView, GWL_STYLE), FALSE, GetWindowLongPtrW(group->hListView, GWL_EXSTYLE));
MoveWindow(group->hListView, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE);
break;
}
case WM_CLOSE:
SendMessageW(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
break;
case WM_SYSCOMMAND:
if (wParam == SC_CLOSE) wParam = SC_MINIMIZE;
break;
case WM_CHILDACTIVATE:
case WM_NCLBUTTONDOWN:
Globals.hActiveGroup = (PROGGROUP*)GetWindowLongPtrW(hWnd, 0);
Globals.hActiveGroup->hActiveProgram = NULL;
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code)
{
case NM_CLICK:
{
iItem = ((LPNMITEMACTIVATE)lParam)->iItem;
if (iItem == -1)
{
group->hActiveProgram = NULL;
break;
}
lvItem.mask = LVIF_PARAM;
lvItem.iItem = iItem;
SendMessageW(group->hListView, LVM_GETITEMW, 0, (LPARAM)&lvItem);
group->hActiveProgram = (PROGRAM*)lvItem.lParam;
break;
}
case NM_DBLCLK:
{
iItem = ((LPNMITEMACTIVATE)lParam)->iItem;
if (iItem == -1)
break;
lvItem.mask = LVIF_PARAM;
lvItem.iItem = iItem;
SendMessageW(group->hListView, LVM_GETITEMW, 0, (LPARAM)&lvItem);
/* ... or use group->hActiveProgram */
PROGRAM_ExecuteProgram((PROGRAM*)lvItem.lParam);
break;
}
case LVN_BEGINDRAG:
{
POINT ptMin;
BOOL bFirst = TRUE;
for (iItem = SendMessageA(group->hListView, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
iItem != -1;
iItem = SendMessageA(group->hListView, LVM_GETNEXTITEM, iItem, LVNI_SELECTED))
{
if (bFirst)
{
group->hDragImageList = (HIMAGELIST)SendMessageA(group->hListView,
LVM_CREATEDRAGIMAGE,
iItem,
(LPARAM)&pt);
ptMin = pt;
bFirst = FALSE;
}
else
{
HIMAGELIST hOneImageList, hTempImageList;
hOneImageList = (HIMAGELIST)SendMessageA(group->hListView,
LVM_CREATEDRAGIMAGE,
iItem,
(LPARAM)&pt);
hTempImageList = ImageList_Merge(group->hDragImageList,
0,
hOneImageList,
0,
pt.x - ptMin.x,
pt.y - ptMin.y);
ImageList_Destroy(group->hDragImageList);
ImageList_Destroy(hOneImageList);
group->hDragImageList = hTempImageList;
ptMin.x = min(ptMin.x, pt.x);
ptMin.y = min(ptMin.y, pt.y);
}
}
// pt = ((LPNMLISTVIEW)lParam)->ptAction;
pt.x = ((LPNMLISTVIEW)lParam)->ptAction.x;
pt.y = ((LPNMLISTVIEW)lParam)->ptAction.y;
group->ptStart = pt;
pt.x -= ptMin.x;
pt.y -= ptMin.y;
ImageList_BeginDrag(group->hDragImageList, 0, pt.x, pt.y);
MapWindowPoints(group->hListView, Globals.hMDIWnd, &pt, 1);
ImageList_DragEnter(Globals.hMDIWnd, pt.x, pt.y);
group->bDragging = TRUE;
group->hOldCursor = GetCursor();
SetCapture(group->hWnd);
break;
}
}
break;
case WM_MOUSEMOVE:
if (group->bDragging)
{
pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam);
MapWindowPoints(group->hWnd, Globals.hMDIWnd, &pt, 1);
ImageList_DragMove(pt.x, pt.y);
}
break;
case WM_LBUTTONUP:
if (group->bDragging)
{
// LVHITTESTINFO lvhti;
POINT ptHit;
group->bDragging = FALSE;
ImageList_DragLeave(Globals.hMDIWnd);
ImageList_EndDrag();
ImageList_Destroy(group->hDragImageList);
ReleaseCapture();
SetCursor(group->hOldCursor);
ptHit.x = GET_X_LPARAM(lParam);
ptHit.y = GET_Y_LPARAM(lParam);
MapWindowPoints(group->hWnd, group->hListView, &ptHit, 1);
for (iItem = SendMessageA(group->hListView, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
iItem != -1;
iItem = SendMessageA(group->hListView, LVM_GETNEXTITEM, iItem, LVNI_SELECTED))
{
SendMessageA(group->hListView, LVM_GETITEMPOSITION, iItem, (LPARAM)&pt);
pt.x += ptHit.x - group->ptStart.x;
pt.y += ptHit.y - group->ptStart.y;
SendMessageA(group->hListView, LVM_SETITEMPOSITION, iItem, MAKELPARAM(pt.x, pt.y));
}
}
break;
}
return DefMDIChildProcW(hWnd, uMsg, wParam, lParam);
}
/***********************************************************************
*
* GROUP_RegisterGroupWinClass
*/
ATOM GROUP_RegisterGroupWinClass(VOID)
{
WNDCLASSW wndClass;
wndClass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
wndClass.lpfnWndProc = GROUP_GroupWndProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(LONG_PTR);
wndClass.hInstance = Globals.hInstance;
wndClass.hIcon = LoadIconW(Globals.hInstance, MAKEINTRESOURCEW(IDI_GROUP_ICON));
wndClass.hCursor = LoadCursorW(NULL, MAKEINTRESOURCEW(IDC_ARROW));
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = STRING_GROUP_WIN_CLASS_NAME;
return RegisterClassW(&wndClass);
}
/***********************************************************************
*
* GROUP_NewGroup
*/
VOID GROUP_NewGroup(GROUPFORMAT format, BOOL bIsCommonGroup)
{
HANDLE hFile;
WCHAR szGrpFile[MAX_PATHNAME_LEN] = L"";
WCHAR szTitle[MAX_PATHNAME_LEN] = L"";
// ZeroMemory(szTitle, sizeof(szTitle));
// ZeroMemory(szGrpFile, sizeof(szGrpFile));
if (!DIALOG_GroupAttributes(format, szTitle, szGrpFile, MAX_PATHNAME_LEN))
return;
/*
* Just check whether the group file does exist. If it does, close the handle, because GRPFILE_ReadGroupFile will
* reopen the file for loading. If it doesn't exist, we create a new one.
*/
hFile = CreateFileW(szGrpFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
/* File doesn't exist */
PROGGROUP* hGroup = GROUP_AddGroup(format, bIsCommonGroup, szTitle, szGrpFile,
DEF_GROUP_WIN_XPOS, DEF_GROUP_WIN_YPOS,
DEF_GROUP_WIN_XPOS + DEF_GROUP_WIN_WIDTH, DEF_GROUP_WIN_YPOS + DEF_GROUP_WIN_HEIGHT,
0, 0, SW_SHOWNORMAL, 0, 0, FALSE, FALSE);
if (hGroup)
GRPFILE_WriteGroupFile(hGroup);
}
else
{
/* File exist */
CloseHandle(hFile);
GRPFILE_ReadGroupFile(szGrpFile, bIsCommonGroup);
}
/* FIXME Update progman.ini */
}
/***********************************************************************
*
* GROUP_AddGroup
*/
PROGGROUP*
GROUP_AddGroup(GROUPFORMAT format, BOOL bIsCommonGroup, LPCWSTR lpszName, LPCWSTR lpszGrpFile,
INT left, INT top, INT right, INT bottom, INT xMin, INT yMin, INT nCmdShow,
WORD cxIcon, WORD cyIcon, BOOL bOverwriteFileOk,
/* FIXME shouldn't be necessary */
BOOL bSuppressShowWindow)
{
PROGGROUP* hGroup;
PROGGROUP* hPrior;
PROGGROUP** p;
LPWSTR hName;
LPWSTR hGrpFile;
LPCWSTR GroupFileName;
INT skip;
INT width;
INT height;
INT seqnum;
MDICREATESTRUCTW mcs;
WINDOWPLACEMENT WndPl;
WndPl.length = sizeof(WndPl);
// FIXME: Use system default position in case we don't place the window at a given (x,y) coordinate.
if (bIsCommonGroup)
{
if (swscanf(lpszGrpFile,
L"%d %d %d %d %d %d %d %n",
&WndPl.rcNormalPosition.left,
&WndPl.rcNormalPosition.top,
&WndPl.rcNormalPosition.right,
&WndPl.rcNormalPosition.bottom,
&WndPl.ptMinPosition,
&WndPl.ptMinPosition.y,
&WndPl.showCmd,
&skip) == 7)
{
WndPl.flags = WPF_SETMINPOSITION;
width = WndPl.rcNormalPosition.right - WndPl.rcNormalPosition.left;
height = WndPl.rcNormalPosition.bottom - WndPl.rcNormalPosition.top;
GroupFileName = &lpszGrpFile[skip];
}
else
{
#if 0 // FIXME!
WndPl.rcNormalPosition.top = CW_USEDEFAULT;
WndPl.rcNormalPosition.left = CW_USEDEFAULT;
WndPl.rcNormalPosition.right = 0;
WndPl.rcNormalPosition.bottom = 0;
width = CW_USEDEFAULT;
height = CW_USEDEFAULT;
WndPl.showCmd = SW_SHOWNORMAL;
GroupFileName = lpszGrpFile;
#else
WndPl.flags = WPF_SETMINPOSITION;
WndPl.ptMinPosition.x = xMin;
WndPl.ptMinPosition.y = yMin;
WndPl.rcNormalPosition.left = left;
WndPl.rcNormalPosition.top = top;
WndPl.rcNormalPosition.right = right;
WndPl.rcNormalPosition.bottom = bottom;
width = right - left;
height = bottom - top;
WndPl.showCmd = nCmdShow;
GroupFileName = lpszGrpFile;
#endif
}
}
else
{
WndPl.flags = WPF_SETMINPOSITION;
WndPl.ptMinPosition.x = xMin;
WndPl.ptMinPosition.y = yMin;
WndPl.rcNormalPosition.left = left;
WndPl.rcNormalPosition.top = top;
WndPl.rcNormalPosition.right = right;
WndPl.rcNormalPosition.bottom = bottom;
width = right - left;
height = bottom - top;
WndPl.showCmd = nCmdShow;
GroupFileName = lpszGrpFile;
}
hGroup = Alloc(HEAP_ZERO_MEMORY, sizeof(*hGroup));
hName = Alloc(HEAP_ZERO_MEMORY, (wcslen(lpszName) + 1) * sizeof(WCHAR));
hGrpFile = Alloc(HEAP_ZERO_MEMORY, (wcslen(GroupFileName) + 1) * sizeof(WCHAR));
if (!hGroup || !hName || !hGrpFile)
{
MAIN_MessageBoxIDS(IDS_OUT_OF_MEMORY, IDS_ERROR, MB_OK);
if (hGroup) Free(hGroup);
if (hName) Free(hName);
if (hGrpFile) Free(hGrpFile);
return NULL;
}
memcpy(hName , lpszName , (wcslen(lpszName) + 1) * sizeof(WCHAR));
memcpy(hGrpFile, GroupFileName, (wcslen(GroupFileName) + 1) * sizeof(WCHAR));
Globals.hActiveGroup = hGroup;
seqnum = 1;
hPrior = NULL;
for (p = &Globals.hGroups; *p; p = &hPrior->hNext)
{
hPrior = *p;
if (hPrior->seqnum >= seqnum)
seqnum = hPrior->seqnum + 1;
}
*p = hGroup;
hGroup->hPrior = hPrior;
hGroup->hNext = NULL;
hGroup->format = format;
hGroup->bIsCommonGroup = bIsCommonGroup;
hGroup->hName = hName;
hGroup->hGrpFile = hGrpFile;
hGroup->bOverwriteFileOk = bOverwriteFileOk;
hGroup->seqnum = seqnum;
hGroup->nCmdShow = nCmdShow;
#if 0
hGroup->x = x;
hGroup->y = y;
hGroup->width = width;
hGroup->height = height;
#endif
hGroup->iconx = cxIcon;
hGroup->icony = cyIcon;
hGroup->hPrograms = NULL;
hGroup->hActiveProgram = NULL;
hGroup->TagsSize = 0;
hGroup->Tags = NULL;
mcs.szClass = STRING_GROUP_WIN_CLASS_NAME;
mcs.szTitle = lpszName;
mcs.hOwner = NULL;
mcs.x = WndPl.rcNormalPosition.left;
mcs.y = WndPl.rcNormalPosition.top;
mcs.cx = width;
mcs.cy = height;
mcs.style = 0;
mcs.lParam = (LPARAM)hGroup;
hGroup->hWnd = (HWND)SendMessageW(Globals.hMDIWnd, WM_MDICREATE, 0, (LPARAM)&mcs);
SetWindowPlacement(hGroup->hWnd, &WndPl);
#if 1
if (!bSuppressShowWindow) /* FIXME shouldn't be necessary */
#endif
UpdateWindow(hGroup->hWnd);
return hGroup;
}
/***********************************************************************
*
* GROUP_ModifyGroup
*/
VOID GROUP_ModifyGroup(PROGGROUP* hGroup)
{
WCHAR Dest[MAX_PATHNAME_LEN]; // szName
WCHAR szGrpFile[MAX_PATHNAME_LEN]; // szFile
wcsncpy(Dest, hGroup->hName, ARRAYSIZE(Dest));
wcsncpy(szGrpFile, hGroup->hGrpFile, ARRAYSIZE(szGrpFile));
if (!DIALOG_GroupAttributes(hGroup->format, Dest, szGrpFile, MAX_PATHNAME_LEN))
return;
if (wcscmp(szGrpFile, hGroup->hGrpFile))
hGroup->bOverwriteFileOk = FALSE;
MAIN_ReplaceString(&hGroup->hName, Dest);
MAIN_ReplaceString(&hGroup->hGrpFile, szGrpFile);
GRPFILE_WriteGroupFile(hGroup);
/* FIXME Delete old GrpFile if GrpFile changed */
/* FIXME Update progman.ini */
SetWindowTextW(hGroup->hWnd, Dest);
}
/***********************************************************************
*
* GROUP_DeleteGroup
*/
VOID GROUP_DeleteGroup(PROGGROUP* hGroup)
{
if (Globals.hActiveGroup == hGroup)
Globals.hActiveGroup = NULL;
if (hGroup->hPrior)
hGroup->hPrior->hNext = hGroup->hNext;
else
Globals.hGroups = hGroup->hNext;
if (hGroup->hNext)
hGroup->hNext->hPrior = hGroup->hPrior;
while (hGroup->hPrograms)
PROGRAM_DeleteProgram(hGroup->hPrograms, FALSE);
/* FIXME Update progman.ini */
SendMessageW(Globals.hMDIWnd, WM_MDIDESTROY, (WPARAM)hGroup->hWnd, 0);
if (hGroup->Tags)
Free(hGroup->Tags);
Free(hGroup->hName);
Free(hGroup->hGrpFile);
Free(hGroup);
}
/***********************************************************************
*
* GROUP_ShowGroupWindow
*/
/* FIXME shouldn't be necessary */
VOID GROUP_ShowGroupWindow(PROGGROUP* hGroup)
{
ShowWindow(hGroup->hWnd, hGroup->nCmdShow);
UpdateWindow(hGroup->hWnd);
}
/***********************************************************************
*
* GROUP_ActiveGroup
*/
PROGGROUP* GROUP_ActiveGroup(VOID)
{
return Globals.hActiveGroup;
}

View file

@ -0,0 +1,752 @@
/*
* Program Manager
*
* Copyright 1996 Ulrich Schmid
* 1997 Peter Schlaile
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "progman.h"
#if 0
#define MALLOCHUNK 1000
#define GET_USHORT(buffer, i)\
(((BYTE)((buffer)[(i)]) + 0x100 * (BYTE)((buffer)[(i)+1])))
#define GET_SHORT(buffer, i)\
(((BYTE)((buffer)[(i)]) + 0x100 * (signed char)((buffer)[(i)+1])))
#define PUT_SHORT(buffer, i, s)\
(((buffer)[(i)] = (s) & 0xff, (buffer)[(i)+1] = ((s) >> 8) & 0xff))
static BOOL GRPFILE_ReadFileToBuffer(LPCSTR, HLOCAL*, INT*);
static HLOCAL GRPFILE_ScanGroup(LPCSTR, INT, LPCSTR, BOOL);
static HLOCAL GRPFILE_ScanProgram(LPCSTR, INT, LPCSTR, INT,
LPCSTR, HLOCAL,LPCSTR);
static BOOL GRPFILE_DoWriteGroupFile(HFILE file, PROGGROUP *group);
#endif
/***********************************************************************
*
* GRPFILE_ModifyFileName
*
* Change extension `.grp' to `.gr'
*/
#if 0
static VOID GRPFILE_ModifyFileName(LPSTR lpszNewName, LPCSTR lpszOrigName,
INT nSize, BOOL bModify)
{
lstrcpynA(lpszNewName, lpszOrigName, nSize);
lpszNewName[nSize-1] = '\0';
if (!bModify) return;
if (!lstrcmpiA(lpszNewName + strlen(lpszNewName) - 4, ".grp"))
lpszNewName[strlen(lpszNewName) - 1] = '\0';
}
#endif
/***********************************************************************
*
* GRPFILE_ReadGroupFile
*/
DWORD GRPFILE_ReadGroupFile(LPCWSTR lpszPath, BOOL bIsCommonGroup)
{
#if 0
CHAR szPath_gr[MAX_PATHNAME_LEN];
BOOL bFileNameModified = FALSE;
OFSTRUCT dummy;
HLOCAL hBuffer, hGroup;
INT size;
/* if `.gr' file exists use that */
GRPFILE_ModifyFileName(szPath_gr, lpszPath, MAX_PATHNAME_LEN, TRUE);
if (OpenFile(szPath_gr, &dummy, OF_EXIST) != HFILE_ERROR)
{
lpszPath = szPath_gr;
bFileNameModified = TRUE;
}
/* Read the whole file into a buffer */
if (!GRPFILE_ReadFileToBuffer(lpszPath, &hBuffer, &size))
{
MAIN_MessageBoxIDS_s(IDS_GRPFILE_READ_ERROR_s, lpszPath, IDS_ERROR, MB_YESNO);
return(0);
}
/* Interpret buffer */
hGroup = GRPFILE_ScanGroup(LocalLock(hBuffer), size,
lpszPath, bFileNameModified);
if (!hGroup)
MAIN_MessageBoxIDS_s(IDS_GRPFILE_READ_ERROR_s, lpszPath, IDS_ERROR, MB_YESNO);
LocalFree(hBuffer);
return(hGroup);
#else
return ERROR_SUCCESS;
#endif
}
/***********************************************************************
*
* GRPFILE_ReadFileToBuffer
*/
#if 0
static BOOL GRPFILE_ReadFileToBuffer(LPCSTR path, HLOCAL *phBuffer,
INT *piSize)
{
UINT len, size;
LPSTR buffer;
HLOCAL hBuffer, hNewBuffer;
HFILE file;
file=_lopen(path, OF_READ);
if (file == HFILE_ERROR) return FALSE;
size = 0;
hBuffer = LocalAlloc(LMEM_FIXED, MALLOCHUNK + 1);
if (!hBuffer) return FALSE;
buffer = LocalLock(hBuffer);
while ((len = _lread(file, buffer + size, MALLOCHUNK))
== MALLOCHUNK)
{
size += len;
hNewBuffer = LocalReAlloc(hBuffer, size + MALLOCHUNK + 1,
LMEM_MOVEABLE);
if (!hNewBuffer)
{
LocalFree(hBuffer);
return FALSE;
}
hBuffer = hNewBuffer;
buffer = LocalLock(hBuffer);
}
_lclose(file);
if (len == (UINT)HFILE_ERROR)
{
LocalFree(hBuffer);
return FALSE;
}
size += len;
buffer[size] = 0;
*phBuffer = hBuffer;
*piSize = size;
return TRUE;
}
#endif
/***********************************************************************
* GRPFILE_ScanGroup
*/
#if 0
static HLOCAL GRPFILE_ScanGroup(LPCSTR buffer, INT size,
LPCSTR lpszGrpFile,
BOOL bModifiedFileName)
{
HLOCAL hGroup;
INT i, seqnum;
LPCSTR extension;
LPCSTR lpszName;
INT x, y, width, height, iconx, icony, nCmdShow;
INT number_of_programs;
BOOL bOverwriteFileOk;
if (buffer[0] != 'P' || buffer[1] != 'M') return(0);
if (buffer[2] == 'C' && buffer[3] == 'C')
/* original with checksum */
bOverwriteFileOk = FALSE;
else if (buffer[2] == 'X' && buffer[3] == 'X')
/* modified without checksum */
bOverwriteFileOk = TRUE;
else return(0);
/* checksum = GET_USHORT(buffer, 4) (ignored) */
extension = buffer + GET_USHORT(buffer, 6);
if (extension == buffer + size) extension = 0;
else if (extension + 6 > buffer + size) return(0);
nCmdShow = GET_USHORT(buffer, 8);
x = GET_SHORT(buffer, 10);
y = GET_SHORT(buffer, 12);
width = GET_USHORT(buffer, 14);
height = GET_USHORT(buffer, 16);
iconx = GET_SHORT(buffer, 18);
icony = GET_SHORT(buffer, 20);
lpszName = buffer + GET_USHORT(buffer, 22);
if (lpszName >= buffer + size) return(0);
/* unknown bytes 24 - 31 ignored */
/*
Unknown bytes should be:
wLogPixelsX = GET_SHORT(buffer, 24);
wLogPixelsY = GET_SHORT(buffer, 26);
byBitsPerPixel = byte at 28;
byPlanes = byte at 29;
wReserved = GET_SHORT(buffer, 30);
*/
hGroup = GROUP_AddGroup(lpszName, lpszGrpFile, nCmdShow, x, y,
width, height, iconx, icony,
bModifiedFileName, bOverwriteFileOk,
TRUE);
if (!hGroup) return(0);
number_of_programs = GET_USHORT(buffer, 32);
if (2 * number_of_programs + 34 > size) return(0);
for (i=0, seqnum=0; i < number_of_programs; i++, seqnum++)
{
LPCSTR program_ptr = buffer + GET_USHORT(buffer, 34 + 2*i);
if (program_ptr + 24 > buffer + size) return(0);
if (!GET_USHORT(buffer, 34 + 2*i)) continue;
if (!GRPFILE_ScanProgram(buffer, size, program_ptr, seqnum,
extension, hGroup, lpszGrpFile))
{
GROUP_DeleteGroup(hGroup);
return(0);
}
}
/* FIXME shouldn't be necessary */
GROUP_ShowGroupWindow(hGroup);
return hGroup;
}
#endif
/***********************************************************************
* GRPFILE_ScanProgram
*/
#if 0
static HLOCAL GRPFILE_ScanProgram(LPCSTR buffer, INT size,
LPCSTR program_ptr, INT seqnum,
LPCSTR extension, HLOCAL hGroup,
LPCSTR lpszGrpFile)
{
INT icontype;
HICON hIcon;
LPCSTR lpszName, lpszCmdLine, lpszIconFile, lpszWorkDir;
LPCSTR iconinfo_ptr, iconANDbits_ptr, iconXORbits_ptr;
INT x, y, nIconIndex, iconANDsize, iconXORsize;
INT nHotKey, nCmdShow;
UINT width, height, planes, bpp;
x = GET_SHORT(program_ptr, 0);
y = GET_SHORT(program_ptr, 2);
nIconIndex = GET_USHORT(program_ptr, 4);
/* FIXME is this correct ?? */
icontype = GET_USHORT(program_ptr, 6);
switch (icontype)
{
default:
MAIN_MessageBoxIDS_s(IDS_UNKNOWN_FEATURE_s, lpszGrpFile,
IDS_WARNING, MB_OK);
case 0x048c:
iconXORsize = GET_USHORT(program_ptr, 8);
iconANDsize = GET_USHORT(program_ptr, 10) / 8;
iconinfo_ptr = buffer + GET_USHORT(program_ptr, 12);
iconXORbits_ptr = buffer + GET_USHORT(program_ptr, 14);
iconANDbits_ptr = buffer + GET_USHORT(program_ptr, 16);
width = GET_USHORT(iconinfo_ptr, 4);
height = GET_USHORT(iconinfo_ptr, 6);
planes = GET_USHORT(iconinfo_ptr, 10);
bpp = GET_USHORT(iconinfo_ptr, 11);
break;
case 0x000c:
iconANDsize = GET_USHORT(program_ptr, 8);
iconXORsize = GET_USHORT(program_ptr, 10);
iconinfo_ptr = buffer + GET_USHORT(program_ptr, 12);
iconANDbits_ptr = buffer + GET_USHORT(program_ptr, 14);
iconXORbits_ptr = buffer + GET_USHORT(program_ptr, 16);
width = GET_USHORT(iconinfo_ptr, 4);
height = GET_USHORT(iconinfo_ptr, 6);
planes = GET_USHORT(iconinfo_ptr, 10);
bpp = GET_USHORT(iconinfo_ptr, 11);
}
if (iconANDbits_ptr + iconANDsize > buffer + size ||
iconXORbits_ptr + iconXORsize > buffer + size) return(0);
hIcon = CreateIcon(Globals.hInstance, width, height, planes, bpp, (PBYTE)iconANDbits_ptr, (PBYTE)iconXORbits_ptr);
lpszName = buffer + GET_USHORT(program_ptr, 18);
lpszCmdLine = buffer + GET_USHORT(program_ptr, 20);
lpszIconFile = buffer + GET_USHORT(program_ptr, 22);
if (iconinfo_ptr + 6 > buffer + size ||
lpszName > buffer + size ||
lpszCmdLine > buffer + size ||
lpszIconFile > buffer + size) return(0);
/* Scan Extensions */
lpszWorkDir = "";
nHotKey = 0;
nCmdShow = SW_SHOWNORMAL;
if (extension)
{
LPCSTR ptr = extension;
while (ptr + 6 <= buffer + size)
{
UINT type = GET_USHORT(ptr, 0);
UINT number = GET_USHORT(ptr, 2);
UINT skip = GET_USHORT(ptr, 4);
if (number == seqnum)
{
switch (type)
{
case 0x8000:
if (ptr + 10 > buffer + size) return(0);
if (ptr[6] != 'P' || ptr[7] != 'M' ||
ptr[8] != 'C' || ptr[9] != 'C') return(0);
break;
case 0x8101:
lpszWorkDir = ptr + 6;
break;
case 0x8102:
if (ptr + 8 > buffer + size) return(0);
nHotKey = GET_USHORT(ptr, 6);
break;
case 0x8103:
if (ptr + 8 > buffer + size) return(0);
nCmdShow = GET_USHORT(ptr, 6);
break;
default:
MAIN_MessageBoxIDS_s(IDS_UNKNOWN_FEATURE_s,
lpszGrpFile, IDS_WARNING, MB_OK);
}
}
if (!skip) break;
ptr += skip;
}
}
return (PROGRAM_AddProgram(hGroup, hIcon, lpszName, x, y,
lpszCmdLine, lpszIconFile,
nIconIndex, lpszWorkDir,
nHotKey, nCmdShow));
}
#endif
/***********************************************************************
*
* GRPFILE_WriteGroupFile
*/
BOOL GRPFILE_WriteGroupFile(PROGGROUP* hGroup)
{
#if 0
CHAR szPath[MAX_PATHNAME_LEN];
PROGGROUP *group = LocalLock(hGroup);
OFSTRUCT dummy;
HFILE file;
BOOL ret;
GRPFILE_ModifyFileName(szPath, LocalLock(group->hGrpFile),
MAX_PATHNAME_LEN,
group->bFileNameModified);
/* Try not to overwrite original files */
/* group->bOverwriteFileOk == TRUE only if a file has the modified format */
if (!group->bOverwriteFileOk &&
OpenFile(szPath, &dummy, OF_EXIST) != HFILE_ERROR)
{
/* Original file exists, try `.gr' extension */
GRPFILE_ModifyFileName(szPath, LocalLock(group->hGrpFile),
MAX_PATHNAME_LEN, TRUE);
if (OpenFile(szPath, &dummy, OF_EXIST) != HFILE_ERROR)
{
/* File exists. Do not overwrite */
MAIN_MessageBoxIDS_s(IDS_FILE_NOT_OVERWRITTEN_s, szPath,
IDS_INFO, MB_OK);
return FALSE;
}
/* Inform about the modified file name */
if (IDCANCEL ==
MAIN_MessageBoxIDS_s(IDS_SAVE_GROUP_AS_s, szPath, IDS_INFO,
MB_OKCANCEL | MB_ICONINFORMATION))
return FALSE;
}
{
/* Warn about the (possible) incompatibility */
CHAR msg[MAX_PATHNAME_LEN + 200];
wsprintfA(msg,
"Group files written by this DRAFT Program Manager "
"possibly cannot be read by the Microsoft Program Manager!!\n"
"Are you sure to write %s?", szPath);
if (IDOK != MessageBoxA(Globals.hMainWnd, msg, "WARNING",
MB_OKCANCEL | MB_DEFBUTTON2)) return FALSE;
}
/* Open file */
file = _lcreat(szPath, 0);
if (file != HFILE_ERROR)
{
ret = GRPFILE_DoWriteGroupFile(file, group);
_lclose(file);
}
else ret = FALSE;
if (!ret)
MAIN_MessageBoxIDS_s(IDS_FILE_WRITE_ERROR_s, szPath, IDS_ERROR, MB_OK);
return(ret);
#else
return TRUE;
#endif
}
#if 0
/***********************************************************************
*
* GRPFILE_CalculateSizes
*/
static VOID GRPFILE_CalculateSizes(PROGRAM *program, INT *Progs, INT *Icons,
UINT *sizeAnd, UINT *sizeXor)
{
ICONINFO info;
BITMAP bmp;
GetIconInfo( program->hIcon, &info );
GetObjectW( info.hbmMask, sizeof(bmp), &bmp );
*sizeAnd = bmp.bmHeight * ((bmp.bmWidth + 15) / 16 * 2);
GetObjectW( info.hbmColor, sizeof(bmp), &bmp );
*sizeXor = bmp.bmHeight * bmp.bmWidthBytes;
DeleteObject( info.hbmMask );
DeleteObject( info.hbmColor );
*Progs += 24;
*Progs += strlen(LocalLock(program->hName)) + 1;
*Progs += strlen(LocalLock(program->hCmdLine)) + 1;
*Progs += strlen(LocalLock(program->hIconFile)) + 1;
*Icons += 12; /* IconInfo */
*Icons += *sizeAnd;
*Icons += *sizeXor;
}
/***********************************************************************/
UINT16 GRPFILE_checksum;
BOOL GRPFILE_checksum_half_word;
BYTE GRPFILE_checksum_last_byte;
/***********************************************************************
*
* GRPFILE_InitChecksum
*/
static void GRPFILE_InitChecksum(void)
{
GRPFILE_checksum = 0;
GRPFILE_checksum_half_word = 0;
}
/***********************************************************************
*
* GRPFILE_GetChecksum
*/
static UINT16 GRPFILE_GetChecksum(void)
{
return GRPFILE_checksum;
}
/***********************************************************************
*
* GRPFILE_WriteWithChecksum
*
* Looks crazier than it is:
*
* chksum = 0;
* chksum = cksum - 1. word;
* chksum = cksum - 2. word;
* ...
*
* if (filelen is even)
* great I'm finished
* else
* ignore last byte
*/
static UINT GRPFILE_WriteWithChecksum(HFILE file, LPCSTR str, UINT size)
{
UINT i;
if (GRPFILE_checksum_half_word) {
GRPFILE_checksum -= GRPFILE_checksum_last_byte;
}
for (i=0; i < size; i++) {
if (GRPFILE_checksum_half_word) {
GRPFILE_checksum -= str[i] << 8;
} else {
GRPFILE_checksum -= str[i];
}
GRPFILE_checksum_half_word ^= 1;
}
if (GRPFILE_checksum_half_word) {
GRPFILE_checksum_last_byte = str[size-1];
GRPFILE_checksum += GRPFILE_checksum_last_byte;
}
return _lwrite(file, str, size);
}
/***********************************************************************
*
* GRPFILE_DoWriteGroupFile
*/
static BOOL GRPFILE_DoWriteGroupFile(HFILE file, PROGGROUP *group)
{
CHAR buffer[34];
HLOCAL hProgram;
INT NumProg, Title, Progs, Icons, Extension;
INT CurrProg, CurrIcon, nCmdShow, ptr, seqnum;
UINT sizeAnd, sizeXor;
BOOL need_extension;
LPCSTR lpszTitle = LocalLock(group->hName);
UINT16 checksum;
GRPFILE_InitChecksum();
/* Calculate offsets */
NumProg = 0;
Icons = 0;
Extension = 0;
need_extension = FALSE;
hProgram = group->hPrograms;
while(hProgram)
{
PROGRAM *program = LocalLock(hProgram);
LPCSTR lpszWorkDir = LocalLock(program->hWorkDir);
NumProg++;
GRPFILE_CalculateSizes(program, &Icons, &Extension, &sizeAnd, &sizeXor);
/* Set a flag if an extension is needed */
if (lpszWorkDir[0] || program->nHotKey ||
program->nCmdShow != SW_SHOWNORMAL) need_extension = TRUE;
hProgram = program->hNext;
}
Title = 34 + NumProg * 2;
Progs = Title + strlen(lpszTitle) + 1;
Icons += Progs;
Extension += Icons;
/* Header */
buffer[0] = 'P';
buffer[1] = 'M';
buffer[2] = 'C';
buffer[3] = 'C';
PUT_SHORT(buffer, 4, 0); /* Checksum zero for now, written later */
PUT_SHORT(buffer, 6, Extension);
/* Update group->nCmdShow */
if (IsIconic(group->hWnd)) nCmdShow = SW_SHOWMINIMIZED;
else if (IsZoomed(group->hWnd)) nCmdShow = SW_SHOWMAXIMIZED;
else nCmdShow = SW_SHOWNORMAL;
PUT_SHORT(buffer, 8, nCmdShow);
PUT_SHORT(buffer, 10, group->x);
PUT_SHORT(buffer, 12, group->y);
PUT_SHORT(buffer, 14, group->width);
PUT_SHORT(buffer, 16, group->height);
PUT_SHORT(buffer, 18, group->iconx);
PUT_SHORT(buffer, 20, group->icony);
PUT_SHORT(buffer, 22, Title);
PUT_SHORT(buffer, 24, 0x0020); /* unknown */
PUT_SHORT(buffer, 26, 0x0020); /* unknown */
PUT_SHORT(buffer, 28, 0x0108); /* unknown */
PUT_SHORT(buffer, 30, 0x0000); /* unknown */
PUT_SHORT(buffer, 32, NumProg);
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 34)) return FALSE;
/* Program table */
CurrProg = Progs;
CurrIcon = Icons;
hProgram = group->hPrograms;
while(hProgram)
{
PROGRAM *program = LocalLock(hProgram);
PUT_SHORT(buffer, 0, CurrProg);
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 2))
return FALSE;
GRPFILE_CalculateSizes(program, &CurrProg, &CurrIcon, &sizeAnd, &sizeXor);
hProgram = program->hNext;
}
/* Title */
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, lpszTitle, strlen(lpszTitle) + 1))
return FALSE;
/* Program entries */
CurrProg = Progs;
CurrIcon = Icons;
hProgram = group->hPrograms;
while(hProgram)
{
PROGRAM *program = LocalLock(hProgram);
LPCSTR Name = LocalLock(program->hName);
LPCSTR CmdLine = LocalLock(program->hCmdLine);
LPCSTR IconFile = LocalLock(program->hIconFile);
INT next_prog = CurrProg;
INT next_icon = CurrIcon;
GRPFILE_CalculateSizes(program, &next_prog, &next_icon, &sizeAnd, &sizeXor);
PUT_SHORT(buffer, 0, program->x);
PUT_SHORT(buffer, 2, program->y);
PUT_SHORT(buffer, 4, program->nIconIndex);
PUT_SHORT(buffer, 6, 0x048c); /* unknown */
PUT_SHORT(buffer, 8, sizeXor);
PUT_SHORT(buffer, 10, sizeAnd * 8);
PUT_SHORT(buffer, 12, CurrIcon);
PUT_SHORT(buffer, 14, CurrIcon + 12 + sizeAnd);
PUT_SHORT(buffer, 16, CurrIcon + 12);
ptr = CurrProg + 24;
PUT_SHORT(buffer, 18, ptr);
ptr += strlen(Name) + 1;
PUT_SHORT(buffer, 20, ptr);
ptr += strlen(CmdLine) + 1;
PUT_SHORT(buffer, 22, ptr);
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 24) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, Name, strlen(Name) + 1) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, CmdLine, strlen(CmdLine) + 1) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, IconFile, strlen(IconFile) + 1))
return FALSE;
CurrProg = next_prog;
CurrIcon = next_icon;
hProgram = program->hNext;
}
/* Icons */
#if 0 /* FIXME: this is broken anyway */
hProgram = group->hPrograms;
while(hProgram)
{
PROGRAM *program = LocalLock(hProgram);
CURSORICONINFO *iconinfo = LocalLock(program->hIcon);
LPVOID XorBits, AndBits;
INT sizeXor = iconinfo->nHeight * iconinfo->nWidthBytes;
INT sizeAnd = iconinfo->nHeight * ((iconinfo->nWidth + 15) / 16 * 2);
/* DumpIcon16(LocalLock(program->hIcon), 0, &XorBits, &AndBits);*/
PUT_SHORT(buffer, 0, iconinfo->ptHotSpot.x);
PUT_SHORT(buffer, 2, iconinfo->ptHotSpot.y);
PUT_SHORT(buffer, 4, iconinfo->nWidth);
PUT_SHORT(buffer, 6, iconinfo->nHeight);
PUT_SHORT(buffer, 8, iconinfo->nWidthBytes);
buffer[10] = iconinfo->bPlanes;
buffer[11] = iconinfo->bBitsPerPixel;
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 12) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, AndBits, sizeAnd) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, XorBits, sizeXor)) return FALSE;
hProgram = program->hNext;
}
#endif
if (need_extension)
{
/* write `PMCC' extension */
PUT_SHORT(buffer, 0, 0x8000);
PUT_SHORT(buffer, 2, 0xffff);
PUT_SHORT(buffer, 4, 0x000a);
buffer[6] = 'P', buffer[7] = 'M';
buffer[8] = 'C', buffer[9] = 'C';
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 10))
return FALSE;
seqnum = 0;
hProgram = group->hPrograms;
while(hProgram)
{
PROGRAM *program = LocalLock(hProgram);
LPCSTR lpszWorkDir = LocalLock(program->hWorkDir);
/* Working directory */
if (lpszWorkDir[0])
{
PUT_SHORT(buffer, 0, 0x8101);
PUT_SHORT(buffer, 2, seqnum);
PUT_SHORT(buffer, 4, 7 + strlen(lpszWorkDir));
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 6) ||
(UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, lpszWorkDir, strlen(lpszWorkDir) + 1))
return FALSE;
}
/* Hot key */
if (program->nHotKey)
{
PUT_SHORT(buffer, 0, 0x8102);
PUT_SHORT(buffer, 2, seqnum);
PUT_SHORT(buffer, 4, 8);
PUT_SHORT(buffer, 6, program->nHotKey);
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 8)) return FALSE;
}
/* Show command */
if (program->nCmdShow)
{
PUT_SHORT(buffer, 0, 0x8103);
PUT_SHORT(buffer, 2, seqnum);
PUT_SHORT(buffer, 4, 8);
PUT_SHORT(buffer, 6, program->nCmdShow);
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 8)) return FALSE;
}
seqnum++;
hProgram = program->hNext;
}
/* Write `End' extension */
PUT_SHORT(buffer, 0, 0xffff);
PUT_SHORT(buffer, 2, 0xffff);
PUT_SHORT(buffer, 4, 0x0000);
if ((UINT)HFILE_ERROR == GRPFILE_WriteWithChecksum(file, buffer, 6)) return FALSE;
}
checksum = GRPFILE_GetChecksum();
_llseek(file, 4, SEEK_SET);
PUT_SHORT(buffer, 0, checksum);
_lwrite(file, buffer, 2);
return TRUE;
}
#endif

1205
base/shell/progman/main.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,299 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource_2.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Anglais (États-Unis) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource_2.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_NEW DIALOGEX 0, 0, 240, 70
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "New Object"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "",IDC_STATIC,5,5,165,44
CONTROL "Program &Group",PM_NEW_GROUP,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,10,4,66,11
CONTROL "&Personal",PM_PERSONAL_GROUP,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,20,15,44,14
CONTROL "&Common",PM_COMMON_GROUP,"Button",BS_AUTORADIOBUTTON,73,15,39,14
LTEXT "&Format:",PM_FORMAT_TXT,20,33,35,11
COMBOBOX PM_FORMAT,61,31,104,15,CBS_DROPDOWNLIST | WS_TABSTOP
CONTROL "Program &Item",PM_NEW_PROGRAM,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,10,52,59,12
DEFPUSHBUTTON "OK",IDOK,175,5,60,15
PUSHBUTTON "Cancel",IDCANCEL,175,25,60,15
PUSHBUTTON "&Help",IDHELP,175,49,60,15
END
IDD_COPY_MOVE DIALOGEX 0, 0, 250, 65
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Copy Program"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "Copy program:",PM_COPY_MOVE_TXT,5,5,70,10
LTEXT "P",PM_PROGRAM,80,5,100,10
LTEXT "From group:",IDC_STATIC,5,18,70,10
LTEXT "G",PM_FROM_GROUP,80,18,100,10
LTEXT "&To group:",IDC_STATIC,5,32,70,10
COMBOBOX PM_TO_GROUP,5,46,140,50,CBS_DROPDOWNLIST | WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,185,5,60,15
PUSHBUTTON "Cancel",IDCANCEL,185,25,60,15
PUSHBUTTON "&Help",IDHELP,185,45,60,15
END
IDD_GROUP DIALOGEX 0, 0, 250, 65
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Program Group Attributes"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "&Description:",IDC_STATIC,5,16,50,11
EDITTEXT PM_DESCRIPTION,60,14,120,15,ES_AUTOHSCROLL
LTEXT "&Group file:",IDC_STATIC,5,38,50,11
EDITTEXT PM_FILE,60,35,120,15,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,185,5,60,15
PUSHBUTTON "Cancel",IDCANCEL,185,25,60,15
PUSHBUTTON "&Help",IDHELP,185,45,60,15
END
IDD_PROGRAM DIALOGEX 0, 0, 270, 105
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Program Attributes"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "&Description:",IDC_STATIC,5,11,65,10
EDITTEXT PM_DESCRIPTION,75,7,115,15,ES_AUTOHSCROLL
LTEXT "&Command line:",IDC_STATIC,5,26,65,10
EDITTEXT PM_COMMAND_LINE,75,23,115,15,ES_AUTOHSCROLL
LTEXT "&Working directory:",IDC_STATIC,5,41,65,10
EDITTEXT PM_DIRECTORY,75,39,115,15,ES_AUTOHSCROLL
LTEXT "&Key combination:",IDC_STATIC,5,56,65,10
CONTROL "",PM_HOT_KEY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,75,55,115,15
ICON "",PM_ICON,24,72,20,20
CHECKBOX "&Run minimized",PM_SYMBOL,75,74,115,10
CONTROL "Run in separate &memory space",PM_NEW_VDM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,75,87,115,11
DEFPUSHBUTTON "OK",IDOK,195,5,70,15
PUSHBUTTON "Cancel",IDCANCEL,195,25,70,15
PUSHBUTTON "&Browse...",PM_BROWSE,195,45,70,15
PUSHBUTTON "Change &icon...",PM_OTHER_SYMBOL,195,65,70,15
PUSHBUTTON "&Help",IDHELP,195,85,70,15
END
IDD_SYMBOL DIALOGEX 0, 0, 240, 85
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Change Icon"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "&Filename:",IDC_STATIC,5,11,50,10
EDITTEXT PM_ICON_FILE,60,9,110,15,ES_AUTOHSCROLL
LTEXT "Current &icon:",IDC_STATIC,5,32,50,10
DEFPUSHBUTTON "OK",IDOK,175,5,60,15
PUSHBUTTON "Cancel",IDCANCEL,175,25,60,15
PUSHBUTTON "&Browse...",PM_BROWSE,175,45,60,15
PUSHBUTTON "&Help",IDHELP,175,65,60,15
LISTBOX PM_SYMBOL_LIST,5,45,165,35,LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | LBS_DISABLENOSCROLL | WS_HSCROLL | WS_TABSTOP
END
IDD_EXECUTE DIALOGEX 0, 0, 200, 85
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Execute Program"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "&Command line:",IDC_STATIC,5,15,125,10
COMBOBOX PM_COMMAND,5,26,125,15,CBS_DROPDOWN | CBS_HASSTRINGS | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CHECKBOX "&Run minimized",PM_SYMBOL,5,46,115,10
CONTROL "Run in separate &memory space",PM_NEW_VDM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,59,115,11
DEFPUSHBUTTON "OK",IDOK,135,5,60,15
PUSHBUTTON "Cancel",IDCANCEL,135,25,60,15
PUSHBUTTON "&Browse...",PM_BROWSE,135,45,60,15
PUSHBUTTON "&Help",IDHELP,135,65,60,15
END
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
MAIN_MENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New...", PM_NEW
MENUITEM "O&pen\tEnter", PM_OPEN
MENUITEM "&Move...\tF7", PM_MOVE
MENUITEM "&Copy...\tF8", PM_COPY
MENUITEM "&Delete\tDel", PM_DELETE
MENUITEM "&Properties\tAlt+Enter", PM_ATTRIBUTES
MENUITEM SEPARATOR
MENUITEM "&Execute...", PM_EXECUTE
MENUITEM SEPARATOR
MENUITEM "E&xit Windows", PM_EXIT
END
POPUP "&Options"
BEGIN
MENUITEM "&Arrange automatically", PM_AUTO_ARRANGE
MENUITEM "&Minimize on run", PM_MIN_ON_RUN
MENUITEM "&Save settings on exit", PM_SAVE_SETTINGS
MENUITEM SEPARATOR
MENUITEM "Save settings &now", PM_SAVE_SETTINGS_NOW
END
POPUP "&Windows"
BEGIN
MENUITEM "&Overlapped\tShift+F5", PM_OVERLAP
MENUITEM "&Side by side\tShift+F4", PM_SIDE_BY_SIDE
MENUITEM "&Arrange Icons", PM_ARRANGE
END
POPUP "&Help"
BEGIN
MENUITEM "&Contents\tF1", PM_CONTENTS
MENUITEM "&About Program Manager", PM_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDA_ACCEL ACCELERATORS
BEGIN
VK_RETURN, PM_ATTRIBUTES, VIRTKEY, ALT, NOINVERT
VK_F1, PM_CONTENTS, VIRTKEY, NOINVERT
VK_F4, PM_SIDE_BY_SIDE, VIRTKEY, SHIFT, NOINVERT
VK_F5, PM_OVERLAP, VIRTKEY, SHIFT, NOINVERT
VK_F7, PM_MOVE, VIRTKEY, NOINVERT
VK_F8, PM_COPY, VIRTKEY, NOINVERT
VK_DELETE, PM_DELETE, VIRTKEY, NOINVERT
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_NEW, DIALOG
BEGIN
END
IDD_COPY_MOVE, DIALOG
BEGIN
END
IDD_GROUP, DIALOG
BEGIN
END
IDD_PROGRAM, DIALOG
BEGIN
END
IDD_SYMBOL, DIALOG
BEGIN
END
IDD_EXECUTE, DIALOG
BEGIN
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_PROGRAM_MANAGER "Program Manager"
IDS_ERROR "ERROR"
IDS_WARNING "WARNING"
IDS_INFO "Information"
IDS_DELETE "Delete"
IDS_DELETE_GROUP_s "Delete group `%s'?"
IDS_DELETE_PROGRAM_s "Delete program `%s'?"
IDS_MOVE_PROGRAM_1 "Move Program"
IDS_MOVE_PROGRAM_2 "Move program:"
IDS_NOT_IMPLEMENTED "Not implemented"
IDS_FILE_READ_ERROR_s "Error reading `%s'."
IDS_FILE_WRITE_ERROR_s "Error writing `%s'."
IDS_GRPFILE_READ_ERROR_s
"The group file `%s' cannot be opened.\nShould it be tried further on?"
IDS_OUT_OF_MEMORY "Out of memory."
END
STRINGTABLE
BEGIN
IDS_WINHELP_ERROR "Help not available."
IDS_UNKNOWN_FEATURE_s "Unknown feature in %s"
IDS_FILE_NOT_OVERWRITTEN_s "File `%s' exists. Not overwritten."
IDS_SAVE_GROUP_AS_s "Save group as `%s' to prevent overwriting original files."
IDS_ALL_FILES "All files (*.*)"
IDS_PROGRAMS "Programs (*.exe)"
IDS_LIBRARIES_DLL "Libraries (*.dll)"
IDS_SYMBOL_FILES "Icon files (*.ico;*.exe;*.dll)"
IDS_SYMBOLS_ICO "Icons (*.ico)"
END
#endif // Anglais (États-Unis) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View file

@ -0,0 +1,253 @@
/*
* Program Manager
*
* Copyright 1996 Ulrich Schmid
* Copyright 2002 Sylvain Petreolle
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* PROJECT: ReactOS Program Manager
* COPYRIGHT: GPL - See COPYING in the top level directory
* FILE: base/shell/progman/progman.h
* PURPOSE: ProgMan header
* PROGRAMMERS: Ulrich Schmid
* Sylvain Petreolle
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
*/
#ifndef PROGMAN_H
#define PROGMAN_H
#include <stdio.h>
#include <stdlib.h>
#define WIN32_NO_STATUS
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <wingdi.h>
#include <winuser.h>
#include <shellapi.h>
#include <commctrl.h>
#include <richedit.h>
#include <windowsx.h>
#define MAX_STRING_LEN 255
#define MAX_PATHNAME_LEN 1024
#define MAX_LANGUAGE_NUMBER (PM_LAST_LANGUAGE - PM_FIRST_LANGUAGE)
#include "resource.h"
/* Fallback icon */
#define DEFAULTICON OIC_WINLOGO
#define DEF_GROUP_WIN_XPOS 100
#define DEF_GROUP_WIN_YPOS 100
#define DEF_GROUP_WIN_WIDTH 300
#define DEF_GROUP_WIN_HEIGHT 200
/*
* windowsx.h extensions
*/
#define EnableDlgItem(hDlg, nID, bEnable) \
EnableWindow(GetDlgItem((hDlg), (nID)), (bEnable))
typedef struct _PROGRAM PROGRAM, *PPROGRAM;
typedef struct _PROGGROUP PROGGROUP, *PPROGGROUP;
struct _PROGRAM
{
PROGGROUP* hGroup;
PROGRAM* hPrior;
PROGRAM* hNext;
HWND hWnd;
INT iItem;
INT x;
INT y;
INT nIconIndex;
HICON hIcon;
LPWSTR hName;
LPWSTR hCmdLine;
LPWSTR hIconFile;
LPWSTR hWorkDir; /* Extension 0x8101 */
INT nHotKey; /* Extension 0x8102 */
INT nCmdShow; /* Extension 0x8103 */
BOOL bNewVDM; /* Extension 0x8104 */
SIZE_T TagsSize;
PVOID Tags;
}; // PROGRAM, *PPROGRAM;
typedef enum _GROUPFORMAT
{
Win_311 = 0x0,
NT_Ansi = 0x1, // 0x02
NT_Unicode = 0x2, // 0x03
} GROUPFORMAT;
struct _PROGGROUP
{
PROGGROUP* hPrior;
PROGGROUP* hNext;
HWND hWnd;
HWND hListView;
HIMAGELIST hListLarge;
HIMAGELIST hDragImageList;
HICON hOldCursor;
POINT ptStart;
BOOL bDragging;
GROUPFORMAT format;
BOOL bIsCommonGroup;
// BOOL bFileNameModified;
BOOL bOverwriteFileOk;
LPWSTR hGrpFile;
INT seqnum;
INT nCmdShow;
INT x;
INT y;
INT width;
INT height;
INT iconx;
INT icony;
LPWSTR hName;
PROGRAM* hPrograms;
PROGRAM* hActiveProgram;
SIZE_T TagsSize;
PVOID Tags;
}; // PROGGROUP, *PPROGGROUP;
typedef struct _GLOBALS
{
HINSTANCE hInstance;
HACCEL hAccel;
HWND hMainWnd;
HWND hMDIWnd;
HICON hDefaultIcon;
HICON hMainIcon;
// HICON hGroupIcon;
HICON hPersonalGroupIcon;
HICON hCommonGroupIcon;
HMENU hMainMenu;
HMENU hFileMenu;
HMENU hOptionMenu;
HMENU hWindowsMenu;
HMENU hLanguageMenu;
HKEY hKeyProgMan;
HKEY hKeyPMSettings;
HKEY hKeyPMCommonGroups;
HKEY hKeyPMAnsiGroups;
HKEY hKeyPMUnicodeGroups;
HKEY hKeyAnsiGroups;
HKEY hKeyUnicodeGroups;
HKEY hKeyCommonGroups;
BOOL bAutoArrange;
BOOL bSaveSettings;
BOOL bMinOnRun;
PROGGROUP* hGroups;
PROGGROUP* hActiveGroup;
// int field_74;
// int field_78;
// PROGGROUP* field_79;
} GLOBALS, *PGLOBALS;
extern GLOBALS Globals;
extern WCHAR szTitle[256];
/*
* Memory management functions
*/
PVOID
Alloc(IN DWORD dwFlags,
IN SIZE_T dwBytes);
BOOL
Free(IN PVOID lpMem);
PVOID
ReAlloc(IN DWORD dwFlags,
IN PVOID lpMem,
IN SIZE_T dwBytes);
PVOID
AppendToBuffer(IN PVOID pBuffer,
IN PSIZE_T pdwBufferSize,
IN PVOID pData,
IN SIZE_T dwDataSize);
INT MAIN_MessageBoxIDS(UINT ids_text, UINT ids_title, WORD type);
INT MAIN_MessageBoxIDS_s(UINT ids_text, LPCWSTR str, UINT ids_title, WORD type);
VOID MAIN_ReplaceString(LPWSTR* string, LPWSTR replace);
DWORD GRPFILE_ReadGroupFile(LPCWSTR lpszPath, BOOL bIsCommonGroup);
BOOL GRPFILE_WriteGroupFile(PROGGROUP* hGroup);
ATOM GROUP_RegisterGroupWinClass(VOID);
PROGGROUP* GROUP_AddGroup(GROUPFORMAT format, BOOL bIsCommonGroup, LPCWSTR lpszName, LPCWSTR lpszGrpFile,
INT left, INT top, INT right, INT bottom, INT xMin, INT yMin, INT nCmdShow,
WORD cxIcon, WORD cyIcon, BOOL bOverwriteFileOk,
/* FIXME shouldn't be necessary */
BOOL bSuppressShowWindow);
VOID GROUP_NewGroup(GROUPFORMAT format, BOOL bIsCommonGroup);
VOID GROUP_ModifyGroup(PROGGROUP* hGroup);
VOID GROUP_DeleteGroup(PROGGROUP* hGroup);
/* FIXME shouldn't be necessary */
VOID GROUP_ShowGroupWindow(PROGGROUP* hGroup);
PROGGROUP* GROUP_ActiveGroup(VOID);
PROGRAM* PROGRAM_AddProgram(PROGGROUP* hGroup, HICON hIcon, LPCWSTR lpszName,
INT x, INT y, LPCWSTR lpszCmdLine, LPCWSTR lpszIconFile, INT nIconIndex,
LPCWSTR lpszWorkDir, INT nHotKey, INT nCmdShow, BOOL bNewVDM);
VOID PROGRAM_NewProgram(PROGGROUP* hGroup);
VOID PROGRAM_ModifyProgram(PROGRAM* hProgram);
VOID PROGRAM_CopyMoveProgram(PROGRAM* hProgram, BOOL bMove);
VOID PROGRAM_DeleteProgram(PROGRAM* hProgram, BOOL bUpdateGrpFile);
VOID PROGRAM_ExecuteProgram(PROGRAM* hProgram);
PROGRAM* PROGRAM_ActiveProgram(PROGGROUP* hGroup);
BOOL DIALOG_New(INT nDefault, PINT pnResult);
PROGGROUP* DIALOG_CopyMove(PROGRAM* hProgram, BOOL bMove);
BOOL DIALOG_Delete(UINT ids_text_s, LPCWSTR lpszName);
BOOL DIALOG_GroupAttributes(GROUPFORMAT format, LPWSTR lpszTitle, LPWSTR lpszGrpFile, INT nSize);
BOOL DIALOG_ProgramAttributes(LPWSTR lpszTitle, LPWSTR lpszCmdLine, LPWSTR lpszWorkDir, LPWSTR lpszIconFile,
HICON* lphIcon, INT* lpnIconIndex, INT* lpnHotKey, INT* lpnCmdShow, BOOL* lpbNewVDM, INT nSize);
VOID DIALOG_Execute(VOID);
VOID STRING_LoadStrings(VOID);
VOID STRING_LoadMenus(VOID);
/* Class names */
#define STRING_MAIN_WIN_CLASS_NAME L"PMMain"
#define STRING_GROUP_WIN_CLASS_NAME L"PMGroup"
#endif /* PROGMAN_H */

View file

@ -0,0 +1,184 @@
/*
* Program Manager
*
* Copyright 1996 Ulrich Schmid
* Copyright 2002 Sylvain Petreolle
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <windef.h>
#include <winuser.h>
#include "resource.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Program Manager"
#define REACTOS_STR_INTERNAL_NAME "progman"
#define REACTOS_STR_ORIGINAL_FILENAME "progman.exe"
#include <reactos/version.rc>
IDI_APPICON ICON "res/progman.ico"
IDI_GROUP_PERSONAL_ICON ICON "res/group_personal.ico"
IDI_GROUP_COMMON_ICON ICON "res/group_common.ico"
IDI_ROSLOGO ICON "res/roslogo.ico"
IDI_GROUP_ICON ICON "res/group.ico"
IDI_TERMINAL ICON "res/terminal.ico"
#include <reactos/manifest_exe.rc>
/* UTF-8 */
#pragma code_page(65001)
#if 0 // Work in progress! See "new_resources.rc"
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
/* Dialog `New' */
IDD_NEW DIALOG 0, 0, 170, 65
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
CAPTION "New"
{
RADIOBUTTON "", PM_NEW_GROUP, 10, 15, 10, 15
LTEXT "Program &group", -1, 20, 18, 80, 15
RADIOBUTTON "", PM_NEW_PROGRAM, 10, 35, 10, 15
LTEXT "&Program", -1, 20, 38, 80, 15
DEFPUSHBUTTON "OK", IDOK, 105, 5, 60, 15, WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 105, 25, 60, 15, WS_TABSTOP
PUSHBUTTON "&Help", PM_HELP, 105, 45, 60, 15, WS_TABSTOP
}
/* Dialog `Move' */
IDD_COPY_MOVE DIALOG 0, 0, 250, 65
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
CAPTION "Move Program"
{
LTEXT "Move program:", -1, 5, 5, 90, 15
LTEXT "", PM_PROGRAM, 95, 5, 90, 15
LTEXT "From group:", -1, 5, 13, 90, 15
LTEXT "", PM_FROM_GROUP, 95, 13, 90, 15
LTEXT "&To group:", PM_TO_GROUP_TXT, 5, 28, 140, 15
COMBOBOX PM_TO_GROUP, 5, 38, 140, 50, WS_TABSTOP | CBS_DROPDOWNLIST
DEFPUSHBUTTON "OK", IDOK, 185, 5, 60, 15, WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 185, 25, 60, 15, WS_TABSTOP
PUSHBUTTON "&Help", PM_HELP, 185, 45, 60, 15, WS_TABSTOP
}
/* Dialog `Copy' */
IDD_COPY DIALOG 0, 0, 250, 65
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
CAPTION "Copy Program"
{
LTEXT "Copy program:", -1, 5, 5, 90, 15
LTEXT "", PM_PROGRAM, 95, 5, 90, 15
LTEXT "From group:", -1, 5, 13, 90, 15
LTEXT "", PM_FROM_GROUP, 95, 13, 90, 15
LTEXT "&To group:", PM_TO_GROUP_TXT, 5, 28, 140, 15
COMBOBOX PM_TO_GROUP, 5, 38, 140, 50, WS_TABSTOP | CBS_DROPDOWNLIST
DEFPUSHBUTTON "OK", IDOK, 185, 5, 60, 15, WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 185, 25, 60, 15, WS_TABSTOP
PUSHBUTTON "&Help", PM_HELP, 185, 45, 60, 15, WS_TABSTOP
}
/* Dialog `Group attributes' */
IDD_GROUP DIALOG 0, 0, 250, 65
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
CAPTION "Program Group Attributes"
{
LTEXT "&Description:", PM_DESCRIPTION_TXT, 5, 18, 60, 15
EDITTEXT PM_DESCRIPTION, 70, 18, 110, 15, WS_TABSTOP
LTEXT "&Group file:", PM_FILE_TXT, 5, 38, 60, 15
EDITTEXT PM_FILE, 70, 38, 110, 15, WS_TABSTOP
DEFPUSHBUTTON "OK", IDOK, 185, 5, 60, 15, WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 185, 25, 60, 15, WS_TABSTOP
PUSHBUTTON "&Help", PM_HELP, 185, 45, 60, 15, WS_TABSTOP
}
/* Dialog `Program attributes' */
IDD_PROGRAM DIALOG 0, 0, 275, 105
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
CAPTION "Program Attributes"
{
LTEXT "&Description:", PM_DESCRIPTION_TXT, 5, 10, 75, 10
EDITTEXT PM_DESCRIPTION, 95, 10, 90, 15, WS_TABSTOP
LTEXT "&Command line:", PM_COMMAND_LINE_TXT, 5, 25, 75, 10
EDITTEXT PM_COMMAND_LINE, 95, 25, 90, 15, WS_TABSTOP
LTEXT "&Working directory:", PM_DIRECTORY_TXT, 5, 40, 75, 10
EDITTEXT PM_DIRECTORY, 95, 40, 90, 15, WS_TABSTOP
LTEXT "&Key combination:", PM_HOT_KEY_TXT, 5, 55, 75, 10
EDITTEXT PM_HOT_KEY, 95, 55, 90, 15, WS_TABSTOP
#ifdef __REACTOS__
ICON "", PM_ICON, 20, 70, 20, 20
#else
ICON "", PM_ICON, 20, 70
#endif
CHECKBOX "&Minimize at launch", PM_SYMBOL, 95, 75, 90, 10, WS_TABSTOP
DEFPUSHBUTTON "OK", IDOK, 200, 5, 70, 15, WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 200, 25, 70, 15, WS_TABSTOP
PUSHBUTTON "&Browse...", PM_BROWSE, 200, 45, 70, 15, WS_TABSTOP
PUSHBUTTON "Change &icon...", PM_OTHER_SYMBOL, 200, 65, 70, 15, WS_TABSTOP
PUSHBUTTON "&Help", PM_HELP, 200, 85, 70, 15, WS_TABSTOP
}
/* Dialog `Symbol' */
IDD_SYMBOL DIALOG 0, 0, 240, 85
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
CAPTION "Change Icon"
{
LTEXT "&Filename:", PM_ICON_FILE_TXT, 5, 15, 60, 10
EDITTEXT PM_ICON_FILE, 65, 15, 105, 15, WS_TABSTOP
LTEXT "Current &icon:", PM_SYMBOL_LIST_TXT, 5, 30, 60, 10
COMBOBOX PM_SYMBOL_LIST, 5, 40, 60, 50,
CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_OWNERDRAWFIXED | WS_TABSTOP
DEFPUSHBUTTON "OK", IDOK, 175, 5, 60, 15, WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 175, 25, 60, 15, WS_TABSTOP
PUSHBUTTON "&Browse...", PM_BROWSE, 175, 45, 60, 15, WS_TABSTOP
PUSHBUTTON "&Help", PM_HELP, 175, 65, 60, 15, WS_TABSTOP
}
/* Dialog `Execute' */
IDD_EXECUTE DIALOG 0, 0, 200, 85
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
CAPTION "Execute Program"
{
LTEXT "&Command line:", -1, 05, 15, 120, 10
EDITTEXT PM_COMMAND, 05, 25, 120, 15, WS_TABSTOP
CHECKBOX "", PM_SYMBOL, 05, 45, 10, 10, WS_TABSTOP
LTEXT "&Minimize at launch", -1, 20, 45, 120, 10
DEFPUSHBUTTON "OK", IDOK, 135, 5, 60, 15, WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 135, 25, 60, 15, WS_TABSTOP
PUSHBUTTON "&Browse...", PM_BROWSE, 135, 45, 60, 15, WS_TABSTOP
PUSHBUTTON "&Help", PM_HELP, 135, 65, 60, 15, WS_TABSTOP
}
#endif
#include "new_resources.rc"

View file

@ -0,0 +1,336 @@
/*
* Program Manager
*
* Copyright 1996 Ulrich Schmid
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* PROJECT: ReactOS Program Manager
* COPYRIGHT: GPL - See COPYING in the top level directory
* FILE: base/shell/progman/program.c
* PURPOSE: Program items helper functions
* PROGRAMMERS: Ulrich Schmid
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
*/
#include "progman.h"
#if 0
static LRESULT CALLBACK PROGRAM_ProgramWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_NCLBUTTONDOWN:
{
HLOCAL hProgram = (HLOCAL) GetWindowLongPtrW(hWnd, 0);
PROGRAM *program = LocalLock(hProgram);
PROGGROUP *group = LocalLock(program->hGroup);
group->hActiveProgram = hProgram;
EnableMenuItem(Globals.hFileMenu, PM_MOVE , MF_ENABLED);
EnableMenuItem(Globals.hFileMenu, PM_COPY , MF_ENABLED);
break;
}
case WM_NCLBUTTONDBLCLK:
{
PROGRAM_ExecuteProgram((HLOCAL) GetWindowLongPtrW(hWnd, 0));
return(0);
}
case WM_PAINTICON:
case WM_NCPAINT:
{
PROGRAM *program;
PAINTSTRUCT ps;
HDC hdc;
hdc = BeginPaint(hWnd,&ps);
program = LocalLock((HLOCAL) GetWindowLongPtrW(hWnd, 0));
if (program->hIcon)
DrawIcon(hdc, 0, 0, program->hIcon);
EndPaint(hWnd,&ps);
break;
}
}
return DefWindowProcW(hWnd, msg, wParam, lParam);
}
#endif
/***********************************************************************
*
* PROGRAM_NewProgram
*/
VOID PROGRAM_NewProgram(PROGGROUP* hGroup)
{
HICON hIcon = NULL;
INT nIconIndex = 0;
INT nHotKey = 0;
INT nCmdShow = SW_SHOWNORMAL;
BOOL bNewVDM = FALSE;
WCHAR szTitle[MAX_PATHNAME_LEN] = L"";
WCHAR szCmdLine[MAX_PATHNAME_LEN] = L"";
WCHAR szIconFile[MAX_PATHNAME_LEN] = L"";
WCHAR szWorkDir[MAX_PATHNAME_LEN] = L"";
if (!DIALOG_ProgramAttributes(szTitle, szCmdLine, szWorkDir, szIconFile,
&hIcon, &nIconIndex, &nHotKey, &nCmdShow, &bNewVDM,
MAX_PATHNAME_LEN))
{
return;
}
if (!hIcon)
hIcon = LoadIconW(NULL, MAKEINTRESOURCEW(IDI_WINLOGO));
if (!PROGRAM_AddProgram(hGroup, hIcon, szTitle, -1, -1, szCmdLine, szIconFile,
nIconIndex, szWorkDir, nHotKey, nCmdShow, bNewVDM))
{
return;
}
GRPFILE_WriteGroupFile(hGroup);
}
/***********************************************************************
*
* PROGRAM_ModifyProgram
*/
VOID PROGRAM_ModifyProgram(PROGRAM* hProgram)
{
LVITEMW lvItem;
WCHAR szName[MAX_PATHNAME_LEN];
WCHAR szWorkDir[MAX_PATHNAME_LEN];
WCHAR szCmdLine[MAX_PATHNAME_LEN];
WCHAR szIconFile[MAX_PATHNAME_LEN];
lstrcpynW(szName , hProgram->hName , ARRAYSIZE(szName));
lstrcpynW(szCmdLine , hProgram->hCmdLine , ARRAYSIZE(szCmdLine));
lstrcpynW(szIconFile, hProgram->hIconFile, ARRAYSIZE(szIconFile));
lstrcpynW(szWorkDir , hProgram->hWorkDir , ARRAYSIZE(szWorkDir));
if (!DIALOG_ProgramAttributes(szName, szCmdLine, szWorkDir, szIconFile,
&hProgram->hIcon, &hProgram->nIconIndex,
&hProgram->nHotKey, &hProgram->nCmdShow,
&hProgram->bNewVDM, MAX_PATHNAME_LEN))
{
return;
}
MAIN_ReplaceString(&hProgram->hName , szName);
MAIN_ReplaceString(&hProgram->hCmdLine , szCmdLine);
MAIN_ReplaceString(&hProgram->hIconFile, szIconFile);
MAIN_ReplaceString(&hProgram->hWorkDir , szWorkDir);
ZeroMemory(&lvItem, sizeof(lvItem));
lvItem.mask = LVIF_TEXT;
lvItem.iSubItem = 0;
lvItem.pszText = szName;
SendMessageW(hProgram->hGroup->hListView, LVM_SETITEMTEXTW, hProgram->iItem, (LPARAM)&lvItem);
GRPFILE_WriteGroupFile(hProgram->hGroup);
}
/***********************************************************************
*
* PROGRAM_AddProgram
*/
PROGRAM*
PROGRAM_AddProgram(PROGGROUP* hGroup, HICON hIcon, LPCWSTR lpszName,
INT x, INT y, LPCWSTR lpszCmdLine, LPCWSTR lpszIconFile, INT nIconIndex,
LPCWSTR lpszWorkDir, INT nHotKey, INT nCmdShow, BOOL bNewVDM)
{
PROGRAM* hProgram;
PROGRAM* hPrior;
PROGRAM** p;
LPWSTR hCmdLine;
LPWSTR hIconFile;
LPWSTR hName;
LPWSTR hWorkDir;
LVITEMW lvItem;
INT iItem;
hProgram = Alloc(HEAP_ZERO_MEMORY, sizeof(*hProgram));
hName = Alloc(HEAP_ZERO_MEMORY, (wcslen(lpszName) + 1) * sizeof(WCHAR));
hCmdLine = Alloc(HEAP_ZERO_MEMORY, (wcslen(lpszCmdLine) + 1) * sizeof(WCHAR));
hIconFile = Alloc(HEAP_ZERO_MEMORY, (wcslen(lpszIconFile) + 1) * sizeof(WCHAR));
hWorkDir = Alloc(HEAP_ZERO_MEMORY, (wcslen(lpszWorkDir) + 1) * sizeof(WCHAR));
if (!hProgram || !hName || !hCmdLine || !hIconFile || !hWorkDir)
{
MAIN_MessageBoxIDS(IDS_OUT_OF_MEMORY, IDS_ERROR, MB_OK);
if (hProgram) Free(hProgram);
if (hName) Free(hName);
if (hCmdLine) Free(hCmdLine);
if (hIconFile) Free(hIconFile);
if (hWorkDir) Free(hWorkDir);
return NULL;
}
memcpy(hName , lpszName , (wcslen(lpszName) + 1) * sizeof(WCHAR));
memcpy(hCmdLine , lpszCmdLine , (wcslen(lpszCmdLine) + 1) * sizeof(WCHAR));
memcpy(hIconFile, lpszIconFile, (wcslen(lpszIconFile) + 1) * sizeof(WCHAR));
memcpy(hWorkDir , lpszWorkDir , (wcslen(lpszWorkDir) + 1) * sizeof(WCHAR));
hGroup->hActiveProgram = hProgram;
hPrior = NULL;
for (p = &hGroup->hPrograms; *p; p = &hPrior->hNext)
hPrior = *p;
*p = hProgram;
hProgram->hGroup = hGroup;
hProgram->hPrior = hPrior;
hProgram->hNext = NULL;
hProgram->hName = hName;
hProgram->hCmdLine = hCmdLine;
hProgram->hIconFile = hIconFile;
hProgram->nIconIndex = nIconIndex;
hProgram->hWorkDir = hWorkDir;
hProgram->hIcon = hIcon;
hProgram->nCmdShow = nCmdShow;
hProgram->nHotKey = nHotKey;
hProgram->bNewVDM = bNewVDM;
hProgram->TagsSize = 0;
hProgram->Tags = NULL;
ZeroMemory(&lvItem, sizeof(lvItem));
lvItem.mask = LVIF_PARAM | LVIF_IMAGE | LVIF_TEXT;
lvItem.pszText = (LPWSTR)lpszName;
lvItem.lParam = (LPARAM)hProgram;
lvItem.iImage = ImageList_ReplaceIcon(hGroup->hListLarge, -1, hIcon);
DestroyIcon(hIcon);
lvItem.iItem = SendMessageA(hGroup->hListView, LVM_GETITEMCOUNT, 0, 0);
iItem = SendMessageW(hGroup->hListView, LVM_INSERTITEMW, 0, (LPARAM)&lvItem);
hProgram->iItem = iItem;
if (x != -1 && y != -1)
SendMessageA(hGroup->hListView, LVM_SETITEMPOSITION, lvItem.iItem, MAKELPARAM(x, y));
return hProgram;
}
/***********************************************************************
*
* PROGRAM_CopyMoveProgram
*/
VOID PROGRAM_CopyMoveProgram(PROGRAM* hProgram, BOOL bMove)
{
PROGGROUP* hGroup;
hGroup = DIALOG_CopyMove(hProgram, bMove);
if (!hGroup)
return;
/* FIXME: shouldn't be necessary */
OpenIcon(hGroup->hWnd);
if (!PROGRAM_AddProgram(hGroup,
hProgram->hIcon,
hProgram->hName,
hProgram->x,
hProgram->y,
hProgram->hCmdLine,
hProgram->hIconFile,
hProgram->nIconIndex,
hProgram->hWorkDir,
hProgram->nHotKey,
hProgram->nCmdShow,
hProgram->bNewVDM))
{
return;
}
GRPFILE_WriteGroupFile(hGroup);
if (bMove)
PROGRAM_DeleteProgram(hProgram, TRUE);
}
/***********************************************************************
*
* PROGRAM_ExecuteProgram
*/
VOID PROGRAM_ExecuteProgram(PROGRAM* hProgram)
{
// TODO: Use a (private?) shell API with which one can use hProgram->bNewVDM
ShellExecuteW(NULL, NULL, hProgram->hCmdLine, NULL, hProgram->hWorkDir, hProgram->nCmdShow);
if (Globals.bMinOnRun)
CloseWindow(Globals.hMainWnd);
}
/***********************************************************************
*
* PROGRAM_DeleteProgram
*/
VOID PROGRAM_DeleteProgram(PROGRAM* hProgram, BOOL bUpdateGrpFile)
{
PROGGROUP* group;
group = hProgram->hGroup;
if (hProgram->hGroup->hActiveProgram == hProgram)
group->hActiveProgram = NULL;
SendMessageA(group->hListView, LVM_DELETEITEM, hProgram->iItem, 0);
if (hProgram->hPrior)
hProgram->hPrior->hNext = hProgram->hNext;
else
hProgram->hGroup->hPrograms = hProgram->hNext;
if (hProgram->hNext)
hProgram->hNext->hPrior = hProgram->hPrior;
if (bUpdateGrpFile)
GRPFILE_WriteGroupFile(hProgram->hGroup);
#if 0
DestroyWindow(program->hWnd);
if (program->hIcon)
DestroyIcon(program->hIcon);
#endif
if (hProgram->Tags)
Free(hProgram->Tags);
Free(hProgram->hName);
Free(hProgram->hCmdLine);
Free(hProgram->hIconFile);
Free(hProgram->hWorkDir);
Free(hProgram);
}
/***********************************************************************
*
* PROGRAM_ActiveProgram
*/
PROGRAM* PROGRAM_ActiveProgram(PROGGROUP* hGroup)
{
if (!hGroup) return NULL;
if (IsIconic(hGroup->hWnd)) return NULL;
return hGroup->hActiveProgram;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View file

@ -0,0 +1,149 @@
/*
* Program Manager
*
* Copyright 1996 Ulrich Schmid
* Copyright 2002 Sylvain Petreolle
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* PROJECT: ReactOS Program Manager
* COPYRIGHT: GPL - See COPYING in the top level directory
* FILE: base/shell/progman/resource.h
* PURPOSE: ProgMan resource header
* PROGRAMMERS: Ulrich Schmid
* Sylvain Petreolle
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
*/
#pragma once
#ifndef IDC_STATIC
#define IDC_STATIC -1
#endif
/* Icons */
#define IDI_APPICON 1
#define IDI_GROUP_PERSONAL_ICON 8
#define IDI_GROUP_COMMON_ICON 9
#define IDI_ROSLOGO 10
#define IDI_GROUP_ICON 48
#define IDI_TERMINAL 49
/* Accelerators */
#define IDA_ACCEL 1
/* String table index */
#define IDS_PROGRAM_MANAGER 0x02
#define IDS_ERROR 0x03
#define IDS_WARNING 0x04
#define IDS_INFO 0x05
#define IDS_DELETE 0x06
#define IDS_DELETE_GROUP_s 0x07
#define IDS_DELETE_PROGRAM_s 0x08
#define IDS_MOVE_PROGRAM_1 0x09 // FIXME: rename me!
#define IDS_MOVE_PROGRAM_2 0x0a // FIXME: rename me!
#define IDS_NOT_IMPLEMENTED 0x0b
#define IDS_FILE_READ_ERROR_s 0x0c
#define IDS_FILE_WRITE_ERROR_s 0x0d
#define IDS_GRPFILE_READ_ERROR_s 0x0e
#define IDS_OUT_OF_MEMORY 0x0f
#define IDS_WINHELP_ERROR 0x10
#define IDS_UNKNOWN_FEATURE_s 0x11
#define IDS_FILE_NOT_OVERWRITTEN_s 0x12
#define IDS_SAVE_GROUP_AS_s 0x13
#define IDS_ALL_FILES 0x14
#define IDS_PROGRAMS 0x15
#define IDS_LIBRARIES_DLL 0x16
#define IDS_SYMBOL_FILES 0x17
#define IDS_SYMBOLS_ICO 0x18
/* Menu */
#define MAIN_MENU 0x109
#define PM_NEW 0x100
#define PM_OPEN 0x101
#define PM_MOVE 0x102
#define PM_COPY 0x103
#define PM_DELETE 0x104
#define PM_ATTRIBUTES 0x105
#define PM_EXECUTE 0x107
#define PM_EXIT 0x108
#define PM_AUTO_ARRANGE 0x110
#define PM_MIN_ON_RUN 0x111
#define PM_SAVE_SETTINGS 0x112
#define PM_SAVE_SETTINGS_NOW 0x113
#define PM_OVERLAP 0x120
#define PM_SIDE_BY_SIDE 0x121
#define PM_ARRANGE 0x122
#define PM_FIRST_CHILD 0x3030
/*
*#define PM_FIRST_LANGUAGE 0x400
*#define PM_LAST_LANGUAGE 0x499
*/
#define PM_CONTENTS 0x131
#define PM_ABOUT 0x142
/* Dialogs */
#define IDD_MAIN 1
#define IDD_NEW 2
#define IDD_COPY_MOVE 4
#define IDD_GROUP 6
#define IDD_PROGRAM 7
#define IDD_SYMBOL 8
#define IDD_EXECUTE 9
/* Dialog `New' */
/* RADIOBUTTON: The next two must be in sequence */
#define PM_NEW_GROUP 0x150
#define PM_NEW_PROGRAM 0x151
#define PM_PERSONAL_GROUP 1001
#define PM_COMMON_GROUP 1002
#define PM_FORMAT_TXT 1003
#define PM_FORMAT 1004
/* Dialogs `Copy', `Move' */
#define PM_COPY_MOVE_TXT 0x160
#define PM_PROGRAM 0x161
#define PM_FROM_GROUP 0x162
#define PM_TO_GROUP 0x163
/* Dialogs `Group attributes' */
#define PM_DESCRIPTION 0x170
#define PM_FILE 0x172
/* Dialogs `Program attributes' */
#define PM_COMMAND_LINE 0x180
#define PM_DIRECTORY 0x182
#define PM_HOT_KEY 0x184
#define PM_ICON 0x186
#define PM_OTHER_SYMBOL 0x187
/* Dialog `Symbol' */
#define PM_ICON_FILE 0x190
#define PM_SYMBOL_LIST 0x192
/* Dialog `Execute' */
#define PM_COMMAND 0x1a0 // FIXME: May be merged with PM_COMMAND_LINE ?
#define PM_SYMBOL 0x1a1 // FIXME: Rename: PM_RUN_MINIMIZED
#define PM_NEW_VDM 0x1a2
#define PM_BROWSE 0x1a3

View file

@ -0,0 +1,138 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by new_resources.rc
//
#include <winuser.h>
#define IDHELP 9
#ifndef IDC_STATIC
#define IDC_STATIC -1
#endif
/* Icons */
#define IDI_APPICON 1
#define IDI_GROUP_PERSONAL_ICON 8
#define IDI_GROUP_COMMON_ICON 9
#define IDI_ROSLOGO 10
#define IDI_GROUP_ICON 48
#define IDI_TERMINAL 49
/* Accelerators */
#define IDA_ACCEL 1
/* String table index */
#define IDS_PROGRAM_MANAGER 0x02
#define IDS_ERROR 0x03
#define IDS_WARNING 0x04
#define IDS_INFO 0x05
#define IDS_DELETE 0x06
#define IDS_DELETE_GROUP_s 0x07
#define IDS_DELETE_PROGRAM_s 0x08
#define IDS_MOVE_PROGRAM_1 0x09 // FIXME: rename me!
#define IDS_MOVE_PROGRAM_2 0x0a // FIXME: rename me!
#define IDS_NOT_IMPLEMENTED 0x0b
#define IDS_FILE_READ_ERROR_s 0x0c
#define IDS_FILE_WRITE_ERROR_s 0x0d
#define IDS_GRPFILE_READ_ERROR_s 0x0e
#define IDS_OUT_OF_MEMORY 0x0f
#define IDS_WINHELP_ERROR 0x10
#define IDS_UNKNOWN_FEATURE_s 0x11
#define IDS_FILE_NOT_OVERWRITTEN_s 0x12
#define IDS_SAVE_GROUP_AS_s 0x13
#define IDS_ALL_FILES 0x14
#define IDS_PROGRAMS 0x15
#define IDS_LIBRARIES_DLL 0x16
#define IDS_SYMBOL_FILES 0x17
#define IDS_SYMBOLS_ICO 0x18
/* Menu */
#define MAIN_MENU 0x109
#define PM_NEW 0x100
#define PM_OPEN 0x101
#define PM_MOVE 0x102
#define PM_COPY 0x103
#define PM_DELETE 0x104
#define PM_ATTRIBUTES 0x105
#define PM_EXECUTE 0x107
#define PM_EXIT 0x108
#define PM_AUTO_ARRANGE 0x110
#define PM_MIN_ON_RUN 0x111
#define PM_SAVE_SETTINGS 0x112
#define PM_SAVE_SETTINGS_NOW 0x113
#define PM_OVERLAP 0x120
#define PM_SIDE_BY_SIDE 0x121
#define PM_ARRANGE 0x122
#define PM_FIRST_CHILD 0x3030
/*
*#define PM_FIRST_LANGUAGE 0x400
*#define PM_LAST_LANGUAGE 0x499
*/
#define PM_CONTENTS 0x131
#define PM_ABOUT 0x142
/* Dialogs */
#define IDD_MAIN 1
#define IDD_NEW 2
#define IDD_COPY_MOVE 4
#define IDD_GROUP 6
#define IDD_PROGRAM 7
#define IDD_SYMBOL 8
#define IDD_EXECUTE 9
/* Dialog `New' */
/* RADIOBUTTON: The next two must be in sequence */
#define PM_NEW_GROUP 0x150
#define PM_NEW_PROGRAM 0x151
#define PM_PERSONAL_GROUP 1001
#define PM_COMMON_GROUP 1002
#define PM_FORMAT_TXT 1003
#define PM_FORMAT 1004
/* Dialogs `Copy', `Move' */
#define PM_COPY_MOVE_TXT 0x160
#define PM_PROGRAM 0x161
#define PM_FROM_GROUP 0x162
#define PM_TO_GROUP 0x163
/* Dialogs `Group attributes' */
#define PM_DESCRIPTION 0x170
#define PM_FILE 0x172
/* Dialogs `Program attributes' */
#define PM_COMMAND_LINE 0x180
#define PM_DIRECTORY 0x182
#define PM_HOT_KEY 0x184
#define PM_ICON 0x186
#define PM_OTHER_SYMBOL 0x187
/* Dialog `Symbol' */
#define PM_ICON_FILE 0x190
#define PM_SYMBOL_LIST 0x192
/* Dialog `Execute' */
#define PM_COMMAND 0x1a0 // FIXME: May be merged with PM_COMMAND_LINE ?
#define PM_SYMBOL 0x1a1 // FIXME: Rename: PM_RUN_MINIMIZED
#define PM_NEW_VDM 0x1a2
#define PM_BROWSE 0x1a3
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40002
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View file

@ -0,0 +1,61 @@
/*
* Program Manager
*
* Copyright 1996 Ulrich Schmid
* Copyright 2002 Sylvain Petreolle
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* PROJECT: ReactOS Program Manager
* COPYRIGHT: GPL - See COPYING in the top level directory
* FILE: base/shell/progman/string.c
* PURPOSE: String utility functions
* PROGRAMMERS: Ulrich Schmid
* Sylvain Petreolle
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
*/
#include "progman.h"
WCHAR szTitle[256]; // MAX_STRING_LEN ?
VOID STRING_LoadStrings(VOID)
{
LoadStringW(Globals.hInstance, IDS_PROGRAM_MANAGER, szTitle, ARRAYSIZE(szTitle));
}
VOID STRING_LoadMenus(VOID)
{
HMENU hMainMenu;
/* Create the menu */
hMainMenu = LoadMenuW(Globals.hInstance, MAKEINTRESOURCEW(MAIN_MENU));
Globals.hFileMenu = GetSubMenu(hMainMenu, 0);
Globals.hOptionMenu = GetSubMenu(hMainMenu, 1);
Globals.hWindowsMenu = GetSubMenu(hMainMenu, 2);
Globals.hLanguageMenu = GetSubMenu(hMainMenu, 3);
if (Globals.hMDIWnd)
SendMessageW(Globals.hMDIWnd, WM_MDISETMENU, (WPARAM)hMainMenu, (LPARAM)Globals.hWindowsMenu);
else
SetMenu(Globals.hMainWnd, hMainMenu);
/* Destroy the old menu */
if (Globals.hMainMenu)
DestroyMenu(Globals.hMainMenu);
Globals.hMainMenu = hMainMenu;
}