Here is a patch that recreates the "Global settings" entry in the app defaults
tab if the user removes it. It also fixes some indenting and removes a
while() loop that was inside of another identical while().
Mike, it doesn't look like I'll have time test this and I've been sitting on
it for a couple of months. Feel free to do so and submit it to wine-patches.
Chris
On Sunday 01 August 2004 10:53 am, Mike Hearn wrote:
> On Thu, 29 Jul 2004 23:19:11 -0500, Alexandre Julliard wrote:
> > Log message:
> > James Hawkins <[EMAIL PROTECTED]>
> > Under the Drives tab, remove the 'Windows Drive' section.
>
> You probably want to increase the size of the drive mappings list so it
> fills the tab, currently there is just a lot of empty space at the top of
> the pane now you removed the old stuff.
>
> Also we should kill the autodetect button. This is done by
> wineprefixcreate these days, or should be.
>
> Other things are:
>
> - Drive editing seems broken. The list box only updates the second time I
> hit edit. err:winecfg:applyDriveChanges unable to set volume label for
> devicename of 'H:\', label of ''
>
> - Browse in the "Add/Edit drive" dialog is a WRITEME
>
> - Build system isn't right: I did a cvs update but the res files weren't
> recreated properly. I had to do a make clean to get the gui updates.
>
> - "Add Application" has poor usability: we always use a file browser
> dialog box even though the most common use case is just "foo.exe", ie
> the user knows the name and doesn't care about the location. Worse we
> start in the c:\windows\desktop folder for some reason, meaning users
> might accidentally select a .lnk file!
>
> Ditto for Libraries tab.
>
> - The Add/Remove application buttons are *way* too big!
>
> - Obviously, once audio autodetection has been moved into the drivers we
> need to kill the audio tab.
>
> - Libraries tab just has generally poor usability, actually. The first
> item in the radio group is "Builtin" meaning that's the one users are
> most likely to select, it should be "builtin, native" followed by "native,
> builtin"
>
> - We ask the user to understand a magic * symbol to set the default - what
> is up with that?
>
> - There are no helpful default entries in the drop down box for setting a
> DLL override, and when you add one the tree does not expand so to actually
> *set* it you have to expand the tree then select the new override.
>
> - We have way too many (eg, more than zero) tree controls in this app.
>
> - Drive mappings list is really unclear, there's no separation between the
> "Drive X:" label and the unix path its mapped to.
>
> Basically I'd recommend reading the GNOME HIG:
> http://developer.gnome.org/projects/gup/hig/
>
> it's a very informative read. Obviously we have to use Win32 UI
> conventions at least at first, but there's a lot of generically good
> advice there. Well worth reading for anybody who is going to work on
> winecfg.
>
> thanks -mike
Index: programs/winecfg/appdefaults.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/appdefaults.c,v
retrieving revision 1.4
diff -u -r1.4 appdefaults.c
--- programs/winecfg/appdefaults.c 1 Apr 2004 21:06:14 -0000 1.4
+++ programs/winecfg/appdefaults.c 1 Aug 2004 15:08:21 -0000
@@ -110,7 +110,8 @@
HeapFree(GetProcessHeap(), 0, lpit);
}
-static VOID LoadAppSettings(LPAPPL appl /*DON'T FREE, treeview will own this*/, HWND hDlg, HWND hwndTV)
+static VOID LoadAppSettings(LPAPPL appl /*DON'T FREE, treeview will own this*/,
+ HWND hDlg, HWND hwndTV)
{
HKEY key;
int i;
@@ -135,48 +136,61 @@
lpIt->lpAppl = appl;
tis.hParent = NULL;
- tis.hInsertAfter = TVI_LAST;
+
+ if(strcmp(appl->lpcVersionSection, "Global Settings") == 0)
+ tis.hInsertAfter = TVI_FIRST;
+ else
+ tis.hInsertAfter = TVI_LAST;
+
tis.u.item.mask = TVIF_TEXT | TVIF_PARAM;
tis.u.item.pszText = appl->lpcApplication;
tis.u.item.lParam = (LPARAM)lpIt;
- hParent = TreeView_InsertItem(hwndTV,&tis);
+ hParent = TreeView_InsertItem(hwndTV,&tis); /* save a handle to the newly inserted item, it's the parent of the child items */
tis.hParent = hParent;
/* insert version entries */
- if(RegOpenKey (configKey, appl->lpcVersionSection, &key) == ERROR_SUCCESS)
+ while (RegEnumValue(key, i, name, &size, NULL, NULL, read, &readSize) == ERROR_SUCCESS)
{
- while (RegEnumValue(key, i, name, &size, NULL, NULL, read, &readSize) == ERROR_SUCCESS)
- {
- char itemtext[128];
+ char itemtext[128];
- WINE_TRACE("Reading value %s, namely %s\n", name, read);
+ WINE_TRACE("Reading value %s, namely %s\n", name, read);
- lpIt = CreateItemTag();
- lpas = CreateAppSetting(name, read);
- lpIt->lpSetting = lpas;
- lpIt->lpAppl = appl;
- tis.u.item.lParam = (LPARAM)lpIt;
-
- /* convert the value for 'dosver or winver' to human readable form */
- description = getDescriptionFromVersion(getWinVersions(), read);
- if(!description)
- {
- description = getDescriptionFromVersion(getDOSVersions(), read);
- if(!description)
- description = "Not found";
- }
-
- sprintf(itemtext, "%s - %s", name, description);
- tis.u.item.pszText = itemtext;
-
- TreeView_InsertItem(hwndTV,&tis);
- i++; size = 255; readSize = 255;
- }
- RegCloseKey(key);
- } else
- {
- WINE_TRACE("no version section found\n");
+ lpIt = CreateItemTag();
+ lpas = CreateAppSetting(name, read);
+ lpIt->lpSetting = lpas;
+ lpIt->lpAppl = appl;
+ tis.u.item.lParam = (LPARAM)lpIt;
+
+ /* convert the value for 'dosver or winver' to human readable form */
+ description = getDescriptionFromVersion(getWinVersions(), read);
+ if(!description)
+ {
+ description = getDescriptionFromVersion(getDOSVersions(), read);
+ if(!description)
+ description = "Not found";
+ }
+
+ sprintf(itemtext, "%s - %s", name, description);
+ tis.u.item.pszText = itemtext;
+
+ TreeView_InsertItem(hwndTV,&tis);
+ i++; size = 255; readSize = 255;
}
+ RegCloseKey(key);
+ } else if(strcmp(appl->lpcApplication, "Global Settings") == 0)
+ {
+ lpIt = CreateItemTag();
+ lpIt->lpAppl = appl;
+
+ tis.hParent = NULL;
+ tis.hInsertAfter = TVI_FIRST;
+ tis.u.item.mask = TVIF_TEXT | TVIF_PARAM;
+ tis.u.item.pszText = appl->lpcApplication;
+ tis.u.item.lParam = (LPARAM)lpIt;
+ hParent = TreeView_InsertItem(hwndTV,&tis);
+ } else
+ {
+ WINE_TRACE("no version section found\n");
}
}
@@ -206,13 +220,13 @@
WINE_TRACE("Windows version\n");
for (i = 0; *pVer->szVersion || *pVer->szDescription; i++, pVer++)
{
- WINE_TRACE("pVer->szVersion == %s\n", pVer->szVersion);
- if (!strcasecmp (pVer->szVersion, curWinVer))
- {
- SendDlgItemMessage (hDlg, IDC_WINVER, CB_SETCURSEL,
- (WPARAM) i, 0);
- WINE_TRACE("match with %s\n", pVer->szVersion);
- }
+ WINE_TRACE("pVer->szVersion == %s\n", pVer->szVersion);
+ if (!strcasecmp (pVer->szVersion, curWinVer))
+ {
+ SendDlgItemMessage (hDlg, IDC_WINVER, CB_SETCURSEL,
+ (WPARAM) i, 0);
+ WINE_TRACE("match with %s\n", pVer->szVersion);
+ }
}
}
} else /* clear selection */
@@ -229,13 +243,13 @@
WINE_TRACE("DOS version\n");
for (i = 0; *pVer->szVersion || *pVer->szDescription; i++, pVer++)
{
- WINE_TRACE("pVer->szVersion == %s\n", pVer->szVersion);
- if (!strcasecmp (pVer->szVersion, curDOSVer))
- {
- SendDlgItemMessage (hDlg, IDC_DOSVER, CB_SETCURSEL,
- (WPARAM) i, 0);
- WINE_TRACE("match with %s\n", pVer->szVersion);
- }
+ WINE_TRACE("pVer->szVersion == %s\n", pVer->szVersion);
+ if (!strcasecmp (pVer->szVersion, curDOSVer))
+ {
+ SendDlgItemMessage (hDlg, IDC_DOSVER, CB_SETCURSEL,
+ (WPARAM) i, 0);
+ WINE_TRACE("match with %s\n", pVer->szVersion);
+ }
}
}
} else
@@ -285,6 +299,7 @@
char lpcVersionKey [255];
FILETIME ft;
+ /* add a pseudo app that holds the global settings */
hwndTV = GetDlgItem(hDlg,IDC_APP_TREEVIEW);
lpAppl = CreateAppl(TRUE, "Global Settings", "Version");
LoadAppSettings(lpAppl, hDlg, hwndTV);
@@ -384,9 +399,27 @@
lpit = (LPITEMTAG) ti.lParam;
if (lpit->lpAppl)
{
+ BOOL wasGlobalSettings = (strcmp(lpit->lpAppl->lpcApplication,
+ "Global Settings") ? 0 : 1);
+
+ WINE_TRACE("removing application '%s', section '%s'\n",
+ lpit->lpAppl->lpcApplication,
+ lpit->lpAppl->lpcVersionSection);
+
+ WINE_TRACE("wasGlobalSettings == %d\n", wasGlobalSettings);
+
/* add transactions to remove all entries for this application */
addTransaction(lpit->lpAppl->lpcVersionSection, NULL, ACTION_REMOVE, NULL);
TreeView_DeleteItem(hTV,ti.hItem);
+
+ /* re-add the global settings if the user removed it */
+ if(wasGlobalSettings)
+ {
+ LPAPPL lpAppl;
+ hTV = GetDlgItem(hDlg, IDC_APP_TREEVIEW);
+ lpAppl = CreateAppl(TRUE, "Global Settings", "Version");
+ LoadAppSettings(lpAppl, hDlg, hTV);
+ }
}
}
}
@@ -398,6 +431,8 @@
VERSION_DESC *pVer = NULL;
HWND hTV = GetDlgItem(hDlg, IDC_APP_TREEVIEW);
+ WINE_TRACE("selection of '%d'\n", selection);
+
ti.mask = TVIF_PARAM;
ti.hItem = TreeView_GetSelection(hTV);
if (TreeView_GetItem (hTV, &ti))
@@ -491,22 +526,22 @@
case CBN_SELCHANGE:
switch(LOWORD(wParam)) {
case IDC_WINVER:
- selection = SendDlgItemMessage( hDlg, IDC_WINVER, CB_GETCURSEL, 0, 0);
- UpdateWinverSelection(hDlg, selection);
- break;
+ selection = SendDlgItemMessage( hDlg, IDC_WINVER, CB_GETCURSEL, 0, 0);
+ UpdateWinverSelection(hDlg, selection);
+ break;
case IDC_DOSVER:
- selection = SendDlgItemMessage( hDlg, IDC_DOSVER, CB_GETCURSEL, 0, 0);
- UpdateDosverSelection(hDlg, selection);
- break;
+ selection = SendDlgItemMessage( hDlg, IDC_DOSVER, CB_GETCURSEL, 0, 0);
+ UpdateDosverSelection(hDlg, selection);
+ break;
}
case BN_CLICKED:
switch(LOWORD(wParam)) {
case IDC_APP_ADDAPP:
- OnAddApplicationClick(hDlg);
- break;
+ OnAddApplicationClick(hDlg);
+ break;
case IDC_APP_REMOVEAPP:
- OnRemoveApplicationClick(hDlg);
- break;
+ OnRemoveApplicationClick(hDlg);
+ break;
}
break;
}