[winecfg] changed the dll tab

Felix Nawothnig felix.nawothnig at t-online.de
Mon Jul 4 22:52:13 CDT 2005


The old libraries tab was confusing and ugly. It was not clear which 
button affects what control and since "n,b" is what you usually want 
when you add an override the radio-buttons cluttered the interface for 
no reason - and another reason I removed them from the tab is that we 
have some space now we can use to display information about the selected 
dll like:

   ADVAPI32.DLL provides registry and security features.
   Using the native version may or may not work.

(having some default entries then would be nice for obvious reasons)

This is the first time I ever touched the source of a Win32 app so it 
would be nice if someone tells me what I did wrong (if I did :).

ChangeLog:
Changed layout of libraries tab, moved load-order setting into extra dialog.
-------------- next part --------------
? x
Index: En.rc
===================================================================
RCS file: /home/wine/wine/programs/winecfg/En.rc,v
retrieving revision 1.42
diff -u -r1.42 En.rc
--- En.rc	28 Jun 2005 19:12:52 -0000	1.42
+++ En.rc	5 Jul 2005 03:08:51 -0000
@@ -81,17 +81,29 @@
 BEGIN
     GROUPBOX        " DLL Overrides ",IDC_STATIC,8,4,244,240
     LTEXT           "Dynamic Link Libraries can be specified individually to be either builtin (provided by Wine) or native (taken from Windows or provided by the application)."
-                    ,  IDC_STATIC,15,17,228,32
-    LISTBOX         IDC_DLLS_LIST,15,50,142,187,WS_BORDER | WS_TABSTOP | WS_VSCROLL
-    LTEXT           "Load order:",IDC_STATIC,163,50,37,8
-    CONTROL         "&Builtin (Wine)",IDC_RAD_BUILTIN,"Button", BS_AUTORADIOBUTTON | WS_GROUP,163,65,75,10
-    CONTROL         "&Native (Windows)",IDC_RAD_NATIVE,"Button", BS_AUTORADIOBUTTON,163,80,75,10
-    CONTROL         "Bui&ltin then Native",IDC_RAD_BUILTIN_NATIVE,"Button", BS_AUTORADIOBUTTON,163,95,75,10
-    CONTROL         "Nati&ve then Builtin",IDC_RAD_NATIVE_BUILTIN,"Button", BS_AUTORADIOBUTTON,163,110,75,10
-    CONTROL         "&Disable",IDC_RAD_DISABLE,"Button", BS_AUTORADIOBUTTON,163,125,75,10
-    PUSHBUTTON	    "&Add DLL override for:",IDC_DLLS_ADDDLL, 163,184,82,14
-    COMBOBOX        IDC_DLLCOMBO,163,204,82,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP | CBS_SORT | CBS_LOWERCASE
-    PUSHBUTTON	    "&Remove DLL override",IDC_DLLS_REMOVEDLL,163,224,82,14
+                    ,IDC_STATIC,16,16,220,32
+    LTEXT           "New override for library:",IDC_STATIC,16,58,100,8
+    COMBOBOX        IDC_DLLCOMBO,16,68,140,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP | CBS_SORT | CBS_LOWERCASE
+    PUSHBUTTON      "&Add",IDC_DLLS_ADDDLL, 164,68,82,13,BS_DEFPUSHBUTTON 
+    LTEXT           "Existing overrides:",IDC_STATIC,16,86,100,8
+    LISTBOX         IDC_DLLS_LIST,16,96,140,140,WS_BORDER | WS_TABSTOP | WS_VSCROLL
+    PUSHBUTTON      "&Edit",IDC_DLLS_EDITDLL,164,96,82,14
+    PUSHBUTTON      "&Remove",IDC_DLLS_REMOVEDLL,164,114,82,14 
+END
+
+IDD_LOADORDER DIALOG DISCARDABLE 80, 90, 110, 92
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Edit Override"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    GROUPBOX        " Load Order ",IDC_STATIC,8,4,94,66
+    CONTROL         "&Builtin (Wine)",IDC_RAD_BUILTIN,"Button", BS_AUTORADIOBUTTON | WS_GROUP,16,14,75,10
+    CONTROL         "&Native (Windows)",IDC_RAD_NATIVE,"Button", BS_AUTORADIOBUTTON,16,24,75,10
+    CONTROL         "Bui&ltin then Native",IDC_RAD_BUILTIN_NATIVE,"Button", BS_AUTORADIOBUTTON,16,34,75,10
+    CONTROL         "Nati&ve then Builtin",IDC_RAD_NATIVE_BUILTIN,"Button", BS_AUTORADIOBUTTON,16,44,75,10
+    CONTROL         "&Disable",IDC_RAD_DISABLE,"Button", BS_AUTORADIOBUTTON,16,54,75,10
+    DEFPUSHBUTTON   "OK",IDOK,8,74,45,14,WS_GROUP
+    PUSHBUTTON      "Cancel",IDCANCEL,57,74,45,14,WS_GROUP
 END
 
 IDD_DRIVECFG DIALOG DISCARDABLE  0, 0, 260, 250
Index: libraries.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/libraries.c,v
retrieving revision 1.9
diff -u -r1.9 libraries.c
--- libraries.c	23 Jun 2005 11:42:54 -0000	1.9
+++ libraries.c	5 Jul 2005 03:08:52 -0000
@@ -127,33 +127,9 @@
 
 static void set_controls_from_selection(HWND dialog)
 {
-    int index = SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_GETCURSEL, 0, 0);
-    struct dll *dll;
-    DWORD id;
-    int i;
-    
-    if (index == -1) /* no selection  */
-    {
-        for (i = IDC_RAD_BUILTIN; i <= IDC_RAD_DISABLE; i++)
-            disable(i);
-
-        CheckRadioButton(dialog, IDC_RAD_BUILTIN, IDC_RAD_DISABLE, -1);
-        
-        return;
-    }
-
-    /* enable the controls  */
-    for (i = IDC_RAD_BUILTIN; i <= IDC_RAD_DISABLE; i++)
-        enable(i);
-
-    dll = (struct dll *) SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_GETITEMDATA, index, 0);
-   
-    id = mode_to_id(dll->mode);
-
-    CheckRadioButton(dialog, IDC_RAD_BUILTIN, IDC_RAD_DISABLE, id);
+    /* FIXME: display/update some information about the selected dll (purpose, recommended loadorder) maybe? */
 }
 
-
 static void clear_settings(HWND dialog)
 {
     int count = SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_GETCOUNT, 0, 0);
@@ -187,11 +163,13 @@
     if (!overrides || *overrides == NULL)
     {
         set_controls_from_selection(dialog);
+        disable(IDC_DLLS_EDITDLL);
         disable(IDC_DLLS_REMOVEDLL);
         HeapFree(GetProcessHeap(), 0, overrides);
         return;
     }
 
+    enable(IDC_DLLS_EDITDLL);
     enable(IDC_DLLS_REMOVEDLL);
     
     for (p = overrides; *p != NULL; p++)
@@ -242,7 +220,6 @@
     disable(IDC_DLLS_ADDDLL);
 }
 
-
 static void on_add_combo_change(HWND dialog)
 {
     char buffer[1024];
@@ -301,6 +278,58 @@
     set_controls_from_selection(dialog);
 }
 
+static INT_PTR CALLBACK loadorder_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    static WORD sel;
+
+    switch(uMsg) 
+    {
+    case WM_INITDIALOG:
+        CheckRadioButton(hwndDlg, IDC_RAD_BUILTIN, IDC_RAD_DISABLE, lParam);
+        sel = lParam;
+        return TRUE;
+
+    case WM_COMMAND:
+        if(HIWORD(wParam) != BN_CLICKED) break;
+        switch (LOWORD(wParam))
+        {
+        case IDC_RAD_BUILTIN:
+        case IDC_RAD_NATIVE:
+        case IDC_RAD_BUILTIN_NATIVE:
+        case IDC_RAD_NATIVE_BUILTIN:
+        case IDC_RAD_DISABLE:
+            sel = LOWORD(wParam);
+            return TRUE;
+        case IDOK:
+            EndDialog(hwndDlg, sel);
+            return TRUE;
+        case IDCANCEL:
+            EndDialog(hwndDlg, wParam);
+            return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+static void on_edit_click(HWND hwnd)
+{
+    INT_PTR ret; 
+    int index = SendDlgItemMessage(hwnd, IDC_DLLS_LIST, LB_GETCURSEL, 0, 0);
+    struct dll *dll;
+    DWORD id;
+
+    /* if no override is selected the edit button should be disabled... */
+    assert(index != -1);
+
+    dll = (struct dll *) SendDlgItemMessage(hwnd, IDC_DLLS_LIST, LB_GETITEMDATA, index, 0);
+    id = mode_to_id(dll->mode);
+    
+    ret = DialogBoxParam(0, MAKEINTRESOURCE(IDD_LOADORDER), hwnd, loadorder_dlgproc, id);
+    
+    if(ret != IDCANCEL)
+        set_dllmode(hwnd, ret);
+}
+
 static void on_remove_click(HWND dialog)
 {
     int sel = SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_GETCURSEL, 0, 0);
@@ -321,7 +350,10 @@
     if (SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_GETCOUNT, 0, 0) > 0)
         SendDlgItemMessage(dialog, IDC_DLLS_LIST, LB_SETCURSEL, max(sel - 1, 0), 0);
     else
+    {
+        disable(IDC_DLLS_EDITDLL);
         disable(IDC_DLLS_REMOVEDLL);
+    }
 
     set_controls_from_selection(dialog);
 }
@@ -357,20 +389,15 @@
                             on_add_combo_change(hDlg);
                             break;
                         }
-                    
+
 		case BN_CLICKED:
 			switch(LOWORD(wParam)) {
-			case IDC_RAD_BUILTIN:
-			case IDC_RAD_NATIVE:
-			case IDC_RAD_BUILTIN_NATIVE:
-			case IDC_RAD_NATIVE_BUILTIN:
-			case IDC_RAD_DISABLE:
-                            set_dllmode(hDlg, LOWORD(wParam));
-                            break;
-                            
 			case IDC_DLLS_ADDDLL:
                             on_add_click(hDlg);
                             break;
+			case IDC_DLLS_EDITDLL:
+			    on_edit_click(hDlg);
+			    break;
 			case IDC_DLLS_REMOVEDLL:
                             on_remove_click(hDlg);
                             break;
Index: resource.h
===================================================================
RCS file: /home/wine/wine/programs/winecfg/resource.h,v
retrieving revision 1.25
diff -u -r1.25 resource.h
--- resource.h	28 Jun 2005 19:12:52 -0000	1.25
+++ resource.h	5 Jul 2005 03:08:53 -0000
@@ -63,8 +63,10 @@
 #define IDC_RAD_DISABLE                 1033
 #define IDC_DLLS_LIST                   1034
 #define IDC_DLLS_ADDDLL                 8001
+#define IDC_DLLS_EDITDLL                8002
 #define IDC_DLLS_REMOVEDLL              8003
 #define IDC_DLLCOMBO                    8004
+#define IDD_LOADORDER                   8005
 
 /* drive editing */
 #define IDC_LIST_DRIVES                 1042
Index: winecfg.rc
===================================================================
RCS file: /home/wine/wine/programs/winecfg/winecfg.rc,v
retrieving revision 1.17
diff -u -r1.17 winecfg.rc
--- winecfg.rc	21 Jun 2005 09:42:56 -0000	1.17
+++ winecfg.rc	5 Jul 2005 03:08:56 -0000
@@ -27,13 +27,13 @@
 #include "winresrc.h"
 #include "resource.h"
 
-#include "De.rc"
+/* #include "De.rc" */
 /* #include "Fr.rc" */
 #include "En.rc"
 /* #include "Cs.rc" */
 /* #include "Es.rc" */
 /* #include "It.rc" */
-#include "Nl.rc"
+/* #include "Nl.rc" */
 /* #include "Pt.rc" */
 /* #include "Ru.rc" */
 /* #include "Si.rc" */


More information about the wine-patches mailing list