Commit a5ce4ee7 authored by Mike Hearn's avatar Mike Hearn Committed by Alexandre Julliard

- introduce keypath() function

- rewrite and clean up appdefaults.c, use a listview rather than treeview - usability tweak: reverse windows version combo so more recent versions come first - usability tweak: improve the add application open dialog box - add accelerator keys - enable/disable controls correctly - begin to standardise on underscore_style for consistency with the rest of wine - comment out the translations for now, the UI will be changing more - begin phasing out libc malloc in favour of the win32 heap
parent c10e3cbf
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* *
* Copyright 2002 Jaco Greeff * Copyright 2002 Jaco Greeff
* Copyright 2003 Dimitrie O. Paun * Copyright 2003 Dimitrie O. Paun
* Copyright 2003-2004 Mike Hearn
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -42,15 +43,16 @@ STYLE WS_CHILD | WS_DISABLED ...@@ -42,15 +43,16 @@ STYLE WS_CHILD | WS_DISABLED
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
GROUPBOX "Application Settings",IDC_STATIC, 8,4,244,240 GROUPBOX "Application Settings",IDC_STATIC, 8,4,244,240
LTEXT "Wine provides the ability for Windows applications to mimic various Windows versions and styles", LTEXT "Wine can mimic different Windows versions for each application.",
IDC_STATIC,15,20,227,20 IDC_STATIC,15,20,227,20
CONTROL "Applications",IDC_APP_TREEVIEW,"SysTreeView32",WS_BORDER | WS_TABSTOP | TVS_LINESATROOT | TVS_HASLINES | TVS_SHOWSELALWAYS | TVS_HASBUTTONS, 15,40,142,145 CONTROL "Applications",IDC_APP_LISTVIEW,"SysListView32",WS_BORDER | WS_TABSTOP | LVS_LIST | LVS_SINGLESEL | LVS_SHOWSELALWAYS,
PUSHBUTTON "Add application...",IDC_APP_ADDAPP, 163,40,82,60 15,40,230,140
PUSHBUTTON "Remove application",IDC_APP_REMOVEAPP, 163,125,82,60 PUSHBUTTON "&Add application...",IDC_APP_ADDAPP, 90,184,75,14
LTEXT "Windows Version:",IDC_STATIC,17,192,58,8 PUSHBUTTON "&Remove application",IDC_APP_REMOVEAPP, 170,184,75,14
LTEXT "DOS Version:",IDC_STATIC,17,211,57,8 LTEXT "&Windows Version:",IDC_STATIC,17,204,58,8
COMBOBOX IDC_WINVER,83,190,158,56,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_WINVER,83,202,163,56,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_DOSVER,83,208,158,56,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "&DOS Version:",IDC_STATIC,17,223,57,8
COMBOBOX IDC_DOSVER,83,224,163,56,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END END
IDD_GRAPHCFG DIALOG DISCARDABLE 0, 0, 260, 250 IDD_GRAPHCFG DIALOG DISCARDABLE 0, 0, 260, 250
......
...@@ -25,35 +25,25 @@ ...@@ -25,35 +25,25 @@
#include "properties.h" #include "properties.h"
static VERSION_DESC sWinVersions[] = { static VERSION_DESC sWinVersions[] = {
{"", "Use default(Global setting)"},
{"win20", "Windows 2.0"},
{"win30", "Windows 3.0"},
{"win31", "Windows 3.1"},
{"nt351", "Windows NT 3.5"},
{"nt40", "Windows NT 4.0"},
{"win95", "Windows 95"},
{"win98", "Windows 98"},
{"winme", "Windows ME"},
{"win2k", "Windows 2000"},
{"winxp", "Windows XP"},
{"win2003", "Windows 2003"}, {"win2003", "Windows 2003"},
{"winxp", "Windows XP"},
{"win2k", "Windows 2000"},
{"winme", "Windows ME"},
{"win98", "Windows 98"},
{"win95", "Windows 95"},
{"nt40", "Windows NT 4.0"},
{"nt351", "Windows NT 3.5"},
{"win31", "Windows 3.1"},
{"win30", "Windows 3.0"},
{"win20", "Windows 2.0"},
{"", ""} {"", ""}
}; };
static VERSION_DESC sDOSVersions[] = { static VERSION_DESC sDOSVersions[] = {
{"", "Use default(Global setting)"},
{"6.22", "MS-DOS 6.22"}, {"6.22", "MS-DOS 6.22"},
{"", ""} {"", ""}
}; };
#if 0
static VERSION_DESC sWineDrivers[] = {
{"x11drv", "X11 Interface"},
{"ttydrv", "TTY Interface"},
{"", ""}
};
#endif
static DLL_DESC sDLLType[] = { static DLL_DESC sDLLType[] = {
{"oleaut32", DLL_BUILTIN}, {"oleaut32", DLL_BUILTIN},
{"ole32", DLL_BUILTIN}, {"ole32", DLL_BUILTIN},
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* Copyright 2002 Jaco Greeff * Copyright 2002 Jaco Greeff
* Copyright 2003 Dimitrie O. Paun * Copyright 2003 Dimitrie O. Paun
* Copyright 2003 Mark Westcott * Copyright 2003 Mark Westcott
* Copyright 2004 Mike Hearn
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -119,7 +120,7 @@ ...@@ -119,7 +120,7 @@
#define IDC_DOUBLE_BUFFER 1104 #define IDC_DOUBLE_BUFFER 1104
/* applications tab */ /* applications tab */
#define IDC_APP_TREEVIEW 1200 #define IDC_APP_LISTVIEW 1200
#define IDC_APP_ADDAPP 1201 #define IDC_APP_ADDAPP 1201
#define IDC_APP_REMOVEAPP 1202 #define IDC_APP_REMOVEAPP 1202
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright 2002 Jaco Greeff * Copyright 2002 Jaco Greeff
* Copyright 2003 Dimitrie O. Paun * Copyright 2003 Dimitrie O. Paun
* Copyright 2003 Mike Hearn * Copyright 2003-2004 Mike Hearn
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -86,7 +86,7 @@ char *getConfigValue (const char *subkey, const char *valueName, const char *def ...@@ -86,7 +86,7 @@ char *getConfigValue (const char *subkey, const char *valueName, const char *def
if( res==ERROR_FILE_NOT_FOUND ) if( res==ERROR_FILE_NOT_FOUND )
{ {
WINE_TRACE("Section key not present - using default\n"); WINE_TRACE("Section key not present - using default\n");
return strdup(defaultResult); return defaultResult ? strdup(defaultResult) : NULL;
} }
else else
{ {
...@@ -98,7 +98,7 @@ char *getConfigValue (const char *subkey, const char *valueName, const char *def ...@@ -98,7 +98,7 @@ char *getConfigValue (const char *subkey, const char *valueName, const char *def
res = RegQueryValueExA( hSubKey, valueName, NULL, NULL, NULL, &dataLength); res = RegQueryValueExA( hSubKey, valueName, NULL, NULL, NULL, &dataLength);
if( res == ERROR_FILE_NOT_FOUND ) { if( res == ERROR_FILE_NOT_FOUND ) {
WINE_TRACE("Value not present - using default\n"); WINE_TRACE("Value not present - using default\n");
buffer = strdup(defaultResult); buffer = defaultResult ? strdup(defaultResult) : NULL;
goto end; goto end;
} else if( res!=ERROR_SUCCESS ) { } else if( res!=ERROR_SUCCESS ) {
WINE_ERR("Couldn't query value's length (res=%ld)\n", res ); WINE_ERR("Couldn't query value's length (res=%ld)\n", res );
...@@ -123,7 +123,8 @@ end: ...@@ -123,7 +123,8 @@ end:
} }
/***************************************************************************** /*****************************************************************************
* setConfigValue : Sets a configuration key in the registry. Section will be created if it doesn't already exist * setConfigValue : Sets a configuration key in the registry. Section
* will be created if it doesn't already exist
* *
* HKEY hCurrent : the registry key that the configuration is rooted at * HKEY hCurrent : the registry key that the configuration is rooted at
* const char *subKey : the name of the config section * const char *subKey : the name of the config section
...@@ -285,6 +286,28 @@ void processTransQueue(void) ...@@ -285,6 +286,28 @@ void processTransQueue(void)
/* ================================== utility functions ============================ */ /* ================================== utility functions ============================ */
char *currentApp = NULL; /* the app we are currently editing, or NULL if editing global */
/* returns a registry key path suitable for passing to addTransaction */
char *keypath(char *section)
{
static char *result = NULL;
if (result) release(result);
if (currentApp)
{
result = alloc(strlen("AppDefaults\\") + strlen(currentApp) + 2 /* \\ */ + strlen(section) + 1 /* terminator */);
sprintf(result, "AppDefaults\\%s\\%s", currentApp, section);
}
else
{
result = strdupA(section);
}
return result;
}
/* returns a string with the window text of the dialog item. user is responsible for freeing the result */ /* returns a string with the window text of the dialog item. user is responsible for freeing the result */
char *getDialogItemText(HWND hDlg, WORD controlID) { char *getDialogItemText(HWND hDlg, WORD controlID) {
HWND item = GetDlgItem(hDlg, controlID); HWND item = GetDlgItem(hDlg, controlID);
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright 2002 Jaco Greeff * Copyright 2002 Jaco Greeff
* Copyright 2003 Dimitrie O. Paun * Copyright 2003 Dimitrie O. Paun
* Copyright 2004 Mike Hearn
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -67,9 +68,14 @@ extern int instantApply; /* non-zero means apply all changes instantly */ ...@@ -67,9 +68,14 @@ extern int instantApply; /* non-zero means apply all changes instantly */
#define EDITING_APP 1 #define EDITING_APP 1
extern int appSettings; /* non-zero means we are editing appdefault settings */ extern int appSettings; /* non-zero means we are editing appdefault settings */
/* returns a string of the form AppDefaults\\appname.exe\\section */ extern char *currentApp; /* NULL means editing global settings */
/* no explicit free is needed of the string returned by this function */
char *getSectionForApp(char *section); /* returns a string of the form "AppDefaults\\appname.exe\\section", or just "section" if
* the user is editing the global settings.
*
* no explicit free is needed of the string returned by this function
*/
char *keypath(char *section);
/* Commits a transaction to the registry */ /* Commits a transaction to the registry */
void processTransaction(struct transaction *trans); void processTransaction(struct transaction *trans);
...@@ -91,6 +97,7 @@ void destroyTransaction(struct transaction *trans); ...@@ -91,6 +97,7 @@ void destroyTransaction(struct transaction *trans);
int initialize(void); int initialize(void);
extern HKEY configKey; extern HKEY configKey;
/* don't use these directly! */
int setConfigValue (const char *subkey, const char *valueName, const char *value); int setConfigValue (const char *subkey, const char *valueName, const char *value);
char *getConfigValue (const char *subkey, const char *valueName, const char *defaultResult); char *getConfigValue (const char *subkey, const char *valueName, const char *defaultResult);
HRESULT doesConfigValueExist (const char *subkey, const char *valueName); HRESULT doesConfigValueExist (const char *subkey, const char *valueName);
...@@ -118,8 +125,18 @@ INT_PTR CALLBACK AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara ...@@ -118,8 +125,18 @@ INT_PTR CALLBACK AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
char *getDialogItemText(HWND hDlg, WORD controlID); char *getDialogItemText(HWND hDlg, WORD controlID);
#define disable(id) EnableWindow(GetDlgItem(dialog, id), 0); #define disable(id) EnableWindow(GetDlgItem(dialog, id), 0);
#define enable(id) EnableWindow(GetDlgItem(dialog, id), 1); #define enable(id) EnableWindow(GetDlgItem(dialog, id), 1);
#define alloc(size) HeapAlloc(GetProcessHeap(), 0, size);
#define release(ptr) HeapFree(GetProcessHeap(), 0, ptr);
void PRINTERROR(void); /* WINE_TRACE() the plaintext error message from GetLastError() */ void PRINTERROR(void); /* WINE_TRACE() the plaintext error message from GetLastError() */
/* returns a string in the win32 heap */
static inline char *strdupA(char *s)
{
char *r = alloc(strlen(s));
return strcpy(r, s);
}
#define WINE_KEY_ROOT "Software\\Wine\\Wine\\Config" #define WINE_KEY_ROOT "Software\\Wine\\Wine\\Config"
#endif #endif
...@@ -28,12 +28,12 @@ ...@@ -28,12 +28,12 @@
#include "resource.h" #include "resource.h"
#include "En.rc" #include "En.rc"
#include "Es.rc" /* #include "Es.rc" */
#include "It.rc" /* #include "It.rc" */
#include "Nl.rc" /* #include "Nl.rc" */
#include "Pt.rc" /* #include "Pt.rc" */
#include "Ru.rc" /* #include "Ru.rc" */
#include "Si.rc" /* #include "Si.rc" */
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Graphics configuration code * Graphics configuration code
* *
* Copyright 2003 Mark Westcott * Copyright 2003 Mark Westcott
* Copyright 2003 Mike Hearn * Copyright 2003-2004 Mike Hearn
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -35,21 +35,10 @@ ...@@ -35,21 +35,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(winecfg); WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
#define RES_MAXLEN 5 /* the maximum number of characters in a screen dimension. 5 digits should be plenty, what kind of crazy person runs their screen >10,000 pixels across? */ #define RES_MAXLEN 5 /* the maximum number of characters in a screen dimension. 5 digits should be plenty, what kind of crazy person runs their screen >10,000 pixels across? */
#define section (appSettings == EDITING_GLOBAL ? "graphics" : (getSectionForApp("graphics")))
int updatingUI; int updatingUI;
int appSettings = EDITING_GLOBAL; /* start by editing global */ int appSettings = EDITING_GLOBAL; /* start by editing global */
char *currentApp; /* the app we are currently editing, or NULL if editing global */
char *getSectionForApp(char *pSection)
{
static char *lastResult = NULL;
if (lastResult) HeapFree(GetProcessHeap(), 0, lastResult);
lastResult = HeapAlloc(GetProcessHeap(), 0, strlen("AppDefaults\\") + strlen(currentApp) + 2 /* \\ */ + strlen(pSection) + 1 /* terminator */);
sprintf(lastResult, "AppDefaults\\%s\\%s", currentApp, pSection);
return lastResult;
}
void updateGUIForDesktopMode(HWND dialog) { void updateGUIForDesktopMode(HWND dialog) {
WINE_TRACE("\n"); WINE_TRACE("\n");
...@@ -57,7 +46,7 @@ void updateGUIForDesktopMode(HWND dialog) { ...@@ -57,7 +46,7 @@ void updateGUIForDesktopMode(HWND dialog) {
updatingUI = TRUE; updatingUI = TRUE;
/* do we have desktop mode enabled? */ /* do we have desktop mode enabled? */
if (doesConfigValueExist(section, "Desktop") == S_OK) { if (doesConfigValueExist(keypath("x11drv"), "Desktop") == S_OK) {
CheckDlgButton(dialog, IDC_ENABLE_DESKTOP, BST_CHECKED); CheckDlgButton(dialog, IDC_ENABLE_DESKTOP, BST_CHECKED);
/* enable the controls */ /* enable the controls */
enable(IDC_DESKTOP_WIDTH); enable(IDC_DESKTOP_WIDTH);
...@@ -95,7 +84,7 @@ void initGraphDlg (HWND hDlg) ...@@ -95,7 +84,7 @@ void initGraphDlg (HWND hDlg)
updatingUI = TRUE; updatingUI = TRUE;
/* desktop size */ /* desktop size */
buf = getConfigValue(section, "Desktop", default_desktop); buf = getConfigValue(keypath("x11drv"), "Desktop", default_desktop);
bufindex = strchr(buf, 'x'); bufindex = strchr(buf, 'x');
if(!bufindex) /* handle invalid "Desktop" values */ if(!bufindex) /* handle invalid "Desktop" values */
{ {
...@@ -115,7 +104,7 @@ void initGraphDlg (HWND hDlg) ...@@ -115,7 +104,7 @@ void initGraphDlg (HWND hDlg)
SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "24 bit"); SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "24 bit");
SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "32 bit"); /* is this valid? */ SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "32 bit"); /* is this valid? */
buf = getConfigValue(section, "ScreenDepth", "24"); buf = getConfigValue(keypath("x11drv"), "ScreenDepth", "24");
if (strcmp(buf, "8") == 0) if (strcmp(buf, "8") == 0)
SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_SETCURSEL, 0, 0); SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_SETCURSEL, 0, 0);
else if (strcmp(buf, "16") == 0) else if (strcmp(buf, "16") == 0)
...@@ -131,14 +120,14 @@ void initGraphDlg (HWND hDlg) ...@@ -131,14 +120,14 @@ void initGraphDlg (HWND hDlg)
SendDlgItemMessage(hDlg, IDC_DESKTOP_WIDTH, EM_LIMITTEXT, RES_MAXLEN, 0); SendDlgItemMessage(hDlg, IDC_DESKTOP_WIDTH, EM_LIMITTEXT, RES_MAXLEN, 0);
SendDlgItemMessage(hDlg, IDC_DESKTOP_HEIGHT, EM_LIMITTEXT, RES_MAXLEN, 0); SendDlgItemMessage(hDlg, IDC_DESKTOP_HEIGHT, EM_LIMITTEXT, RES_MAXLEN, 0);
buf = getConfigValue(section, "DXGrab", "Y"); buf = getConfigValue(keypath("x11drv"), "DXGrab", "Y");
if (IS_OPTION_TRUE(*buf)) if (IS_OPTION_TRUE(*buf))
CheckDlgButton(hDlg, IDC_DX_MOUSE_GRAB, BST_CHECKED); CheckDlgButton(hDlg, IDC_DX_MOUSE_GRAB, BST_CHECKED);
else else
CheckDlgButton(hDlg, IDC_DX_MOUSE_GRAB, BST_UNCHECKED); CheckDlgButton(hDlg, IDC_DX_MOUSE_GRAB, BST_UNCHECKED);
free(buf); free(buf);
buf = getConfigValue(section, "DesktopDoubleBuffered", "Y"); buf = getConfigValue(keypath("x11drv"), "DesktopDoubleBuffered", "Y");
if (IS_OPTION_TRUE(*buf)) if (IS_OPTION_TRUE(*buf))
CheckDlgButton(hDlg, IDC_DOUBLE_BUFFER, BST_CHECKED); CheckDlgButton(hDlg, IDC_DOUBLE_BUFFER, BST_CHECKED);
else else
...@@ -166,7 +155,7 @@ void setFromDesktopSizeEdits(HWND hDlg) { ...@@ -166,7 +155,7 @@ void setFromDesktopSizeEdits(HWND hDlg) {
if (strcmp(height, "") == 0) strcpy(height, "480"); if (strcmp(height, "") == 0) strcpy(height, "480");
sprintf(newStr, "%sx%s", width, height); sprintf(newStr, "%sx%s", width, height);
addTransaction(section, "Desktop", ACTION_SET, newStr); addTransaction(keypath("x11drv"), "Desktop", ACTION_SET, newStr);
free(width); free(width);
free(height); free(height);
...@@ -180,7 +169,7 @@ void onEnableDesktopClicked(HWND hDlg) { ...@@ -180,7 +169,7 @@ void onEnableDesktopClicked(HWND hDlg) {
setFromDesktopSizeEdits(hDlg); setFromDesktopSizeEdits(hDlg);
} else { } else {
/* it was just checked, so remove the config values */ /* it was just checked, so remove the config values */
addTransaction(section, "Desktop", ACTION_REMOVE, NULL); addTransaction(keypath("x11drv"), "Desktop", ACTION_REMOVE, NULL);
} }
updateGUIForDesktopMode(hDlg); updateGUIForDesktopMode(hDlg);
} }
...@@ -193,23 +182,23 @@ void onScreenDepthChanged(HWND hDlg) { ...@@ -193,23 +182,23 @@ void onScreenDepthChanged(HWND hDlg) {
if (updatingUI) return; if (updatingUI) return;
*spaceIndex = '\0'; *spaceIndex = '\0';
addTransaction(section, "ScreenDepth", ACTION_SET, newvalue); addTransaction(keypath("x11drv"), "ScreenDepth", ACTION_SET, newvalue);
free(newvalue); free(newvalue);
} }
void onDXMouseGrabClicked(HWND hDlg) { void onDXMouseGrabClicked(HWND hDlg) {
if (IsDlgButtonChecked(hDlg, IDC_DX_MOUSE_GRAB) == BST_CHECKED) if (IsDlgButtonChecked(hDlg, IDC_DX_MOUSE_GRAB) == BST_CHECKED)
addTransaction(section, "DXGrab", ACTION_SET, "Y"); addTransaction(keypath("x11drv"), "DXGrab", ACTION_SET, "Y");
else else
addTransaction(section, "DXGrab", ACTION_SET, "N"); addTransaction(keypath("x11drv"), "DXGrab", ACTION_SET, "N");
} }
void onDoubleBufferClicked(HWND hDlg) { void onDoubleBufferClicked(HWND hDlg) {
if (IsDlgButtonChecked(hDlg, IDC_DOUBLE_BUFFER) == BST_CHECKED) if (IsDlgButtonChecked(hDlg, IDC_DOUBLE_BUFFER) == BST_CHECKED)
addTransaction(section, "DesktopDoubleBuffered", ACTION_SET, "Y"); addTransaction(keypath("x11drv"), "DesktopDoubleBuffered", ACTION_SET, "Y");
else else
addTransaction(section, "DesktopDoubleBuffered", ACTION_SET, "N"); addTransaction(keypath("x11drv"), "DesktopDoubleBuffered", ACTION_SET, "N");
} }
INT_PTR CALLBACK INT_PTR CALLBACK
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment