[PROGMAN] Properly import from Wine Staging 1.9.4. This fixes PCH usage, marks ReactOS specific diffs, reduces difference to upstream code, properly documents the sync in README.WINE, improves header inclusions and more. Changes should be sent upstream by their author (TM). CORE-10912

svn path=/trunk/; revision=70922
This commit is contained in:
Amine Khaldi 2016-03-05 08:45:08 +00:00
parent e5678878b7
commit 53f7b483b5
9 changed files with 91 additions and 51 deletions

View file

@ -22,6 +22,8 @@
#include "progman.h"
#include <commdlg.h>
/***********************************************************************
*
* DIALOG_Browse

View file

@ -58,8 +58,8 @@ ATOM GROUP_RegisterGroupWinClass(void)
class.cbClsExtra = 0;
class.cbWndExtra = sizeof(LONG_PTR);
class.hInstance = Globals.hInstance;
class.hIcon = LoadIconW(0, (LPWSTR)IDI_WINLOGO);
class.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
class.hIcon = LoadIconW (0, (LPWSTR)IDI_WINLOGO);
class.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
class.hbrBackground = GetStockObject (WHITE_BRUSH);
class.lpszMenuName = 0;
class.lpszClassName = STRING_GROUP_WIN_CLASS_NAME;
@ -170,7 +170,11 @@ HLOCAL GROUP_AddGroup(LPCSTR lpszName, LPCSTR lpszGrpFile, INT nCmdShow,
cs.style = 0;
cs.lParam = 0;
#ifdef __REACTOS__
group->hWnd = (HWND)SendMessageW(Globals.hMDIWnd, WM_MDICREATE, 0, (LPARAM)&cs);
#else
group->hWnd = (HWND)SendMessageA(Globals.hMDIWnd, WM_MDICREATE, 0, (LPARAM)&cs);
#endif
SetWindowTextA( group->hWnd, lpszName );
SetWindowLongPtrW(group->hWnd, 0, (LONG_PTR) hGroup);

View file

@ -20,7 +20,6 @@
*/
#include "progman.h"
// #include <mmsystem.h>
#define MALLOCHUNK 1000
@ -277,7 +276,11 @@ static HLOCAL GRPFILE_ScanProgram(LPCSTR buffer, INT size,
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 );
#ifdef __REACTOS__
hIcon = CreateIcon(Globals.hInstance, width, height, planes, bpp, (PBYTE)iconANDbits_ptr, (PBYTE)iconXORbits_ptr);
#else
hIcon = CreateIcon( Globals.hInstance, width, height, planes, bpp, iconANDbits_ptr, iconXORbits_ptr );
#endif
lpszName = buffer + GET_USHORT(program_ptr, 18);
lpszCmdLine = buffer + GET_USHORT(program_ptr, 20);
@ -508,7 +511,11 @@ static BOOL GRPFILE_DoWriteGroupFile(HFILE file, PROGGROUP *group)
HLOCAL hProgram;
INT NumProg, Title, Progs, Icons, Extension;
INT CurrProg, CurrIcon, nCmdShow, ptr, seqnum;
UINT sizeAnd, sizeXor;
#ifdef __REACTOS__
UINT sizeAnd, sizeXor;
#else
DWORD sizeAnd, sizeXor;
#endif
BOOL need_extension;
LPCSTR lpszTitle = LocalLock(group->hName);

View file

@ -19,9 +19,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
// #define OEMRESOURCE
#include "progman.h"
#include <shellapi.h>
GLOBALS Globals;
static VOID MAIN_CreateGroups(void);
@ -38,11 +39,18 @@ static VOID MAIN_AutoStart(void);
* WinMain
*/
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
#ifdef __REACTOS__
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
#else
int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
#endif
{
MSG msg;
Globals.lpszIniFile = "progman.ini";
#ifndef __REACTOS__
Globals.lpszIcoFile = "progman.ico";
#endif
Globals.hInstance = hInstance;
Globals.hGroups = 0;
@ -57,9 +65,15 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show
GetPrivateProfileIntA("Settings", "SaveSettings", 0, Globals.lpszIniFile);
/* Load default icons */
Globals.hMainIcon = LoadIconW(Globals.hInstance, MAKEINTRESOURCEW(IDI_APPICON));
Globals.hGroupIcon = Globals.hMainIcon; // ExtractIconA(Globals.hInstance, Globals.lpszIcoFile, 0);
Globals.hDefaultIcon = Globals.hMainIcon; // ExtractIconA(Globals.hInstance, Globals.lpszIcoFile, 0);
#ifdef __REACTOS__
Globals.hMainIcon = LoadIconW(Globals.hInstance, MAKEINTRESOURCEW(IDI_APPICON));
Globals.hGroupIcon = Globals.hMainIcon;
Globals.hDefaultIcon = Globals.hMainIcon;
#else
Globals.hMainIcon = ExtractIconA(Globals.hInstance, Globals.lpszIcoFile, 0);
Globals.hGroupIcon = ExtractIconA(Globals.hInstance, Globals.lpszIcoFile, 0);
Globals.hDefaultIcon = ExtractIconA(Globals.hInstance, Globals.lpszIcoFile, 0);
#endif
if (!Globals.hMainIcon) Globals.hMainIcon = LoadIconW(0, (LPWSTR)DEFAULTICON);
if (!Globals.hGroupIcon) Globals.hGroupIcon = LoadIconW(0, (LPWSTR)DEFAULTICON);
if (!Globals.hDefaultIcon) Globals.hDefaultIcon = LoadIconW(0, (LPWSTR)DEFAULTICON);
@ -310,12 +324,17 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
break;
case PM_ABOUT_WINE:
#ifdef __REACTOS__
{
WCHAR szTitle[MAX_STRING_LEN];
LoadStringW(Globals.hInstance, IDS_PROGRAM_MANAGER, szTitle, ARRAYSIZE(szTitle));
ShellAboutW(hWnd, szTitle, NULL, NULL);
break;
}
#else
ShellAboutA(hWnd, "WINE", "Program Manager", 0);
break;
#endif
default:
MAIN_MessageBoxIDS(IDS_NOT_IMPLEMENTED, IDS_ERROR, MB_OK);
@ -338,7 +357,7 @@ static ATOM MAIN_RegisterMainWinClass(void)
class.cbWndExtra = 0;
class.hInstance = Globals.hInstance;
class.hIcon = Globals.hMainIcon;
class.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
class.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
class.hbrBackground = GetStockObject (NULL_BRUSH);
class.lpszMenuName = 0;
class.lpszClassName = STRING_MAIN_WIN_CLASS_NAME;

View file

@ -23,21 +23,17 @@
#define PROGMAN_H
#include <stdio.h>
#include <string.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define WIN32_NO_STATUS
#include <windef.h>
#include <commdlg.h>
#include <shellapi.h>
#include <winbase.h>
#include <wingdi.h>
#include <winuser.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 */
@ -138,6 +134,9 @@ typedef struct
HMENU hWindowsMenu;
HMENU hLanguageMenu;
LPCSTR lpszIniFile;
#ifndef __REACTOS__
LPCSTR lpszIcoFile;
#endif
BOOL bAutoArrange;
BOOL bSaveSettings;
BOOL bMinOnRun;
@ -206,3 +205,7 @@ extern WCHAR STRING_GROUP_WIN_CLASS_NAME[];
extern WCHAR STRING_PROGRAM_WIN_CLASS_NAME[];
#endif /* PROGMAN_H */
/* Local Variables: */
/* c-file-style: "GNU" */
/* End: */

View file

@ -21,23 +21,18 @@
#include <windef.h>
#include <winuser.h>
// #include <commctrl.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"
#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"
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
MAIN_MENU MENU
@ -188,7 +183,11 @@ 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

View file

@ -77,7 +77,7 @@ ATOM PROGRAM_RegisterProgramWinClass(void)
class.cbWndExtra = sizeof(LONG_PTR);
class.hInstance = Globals.hInstance;
class.hIcon = 0;
class.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
class.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
class.hbrBackground = GetStockObject (WHITE_BRUSH);
class.lpszMenuName = 0;
class.lpszClassName = STRING_PROGRAM_WIN_CLASS_NAME;

View file

@ -30,31 +30,36 @@ WCHAR STRING_PROGRAM_WIN_CLASS_NAME[] = {'P','M','P','r','o','g','r','a','m',0};
VOID STRING_LoadMenus(VOID)
{
WCHAR caption[MAX_STRING_LEN];
HMENU hMainMenu;
#ifdef __REACTOS__
WCHAR caption[MAX_STRING_LEN];
#else
CHAR caption[MAX_STRING_LEN];
#endif
HMENU hMainMenu;
/* Set frame caption */
LoadStringW(Globals.hInstance, IDS_PROGRAM_MANAGER, caption, sizeof(caption));
SetWindowTextW(Globals.hMainWnd, caption);
/* Set frame caption */
#ifdef __REACTOS__
LoadStringW(Globals.hInstance, IDS_PROGRAM_MANAGER, caption, sizeof(caption));
SetWindowTextW(Globals.hMainWnd, caption);
#else
LoadStringA(Globals.hInstance, IDS_PROGRAM_MANAGER, caption, sizeof(caption));
SetWindowTextA(Globals.hMainWnd, caption);
#endif
/* Create 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);
/* Create 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);
}
if (Globals.hMDIWnd)
SendMessageW(Globals.hMDIWnd, WM_MDISETMENU,
(WPARAM) hMainMenu,
(LPARAM) Globals.hWindowsMenu);
else SetMenu(Globals.hMainWnd, hMainMenu);
/* Destroy old menu */
if (Globals.hMainMenu) DestroyMenu(Globals.hMainMenu);
Globals.hMainMenu = hMainMenu;
/* Destroy old menu */
if (Globals.hMainMenu) DestroyMenu(Globals.hMainMenu);
Globals.hMainMenu = hMainMenu;
}

View file

@ -242,6 +242,7 @@ reactos/base/applications/regedit # Out of sync
reactos/base/applications/winhlp32 # Synced to WineStaging-1.9.4
reactos/base/applications/wordpad # Synced to WineStaging-1.7.55
reactos/base/services/rpcss # Synced to WineStaging-1.7.55
reactos/base/shell/progman # Synced to WineStaging-1.9.4
reactos/base/system/expand # Synced to WineStaging-1.7.55
reactos/base/system/msiexec # Synced to WineStaging-1.9.4
reactos/modules/rosapps/winfile # Autosync