[winecfg 12] Add screen depth option

Mike Hearn mike at theoretic.com
Fri Sep 19 12:48:03 CDT 2003


Add screen depth option and remove "Allocated System Colors" setting



diff -ur --exclude-from=diff-exclusions ../head/programs/winecfg/En.rc programs/winecfg/En.rc
--- ../head/programs/winecfg/En.rc	2003-09-19 13:32:48.000000000 +0100
+++ programs/winecfg/En.rc	2003-09-19 18:37:56.000000000 +0100
@@ -68,14 +68,11 @@
                     BS_AUTOCHECKBOX | WS_TABSTOP,145,44,97,10
  */
 
+    LTEXT	    "Screen color depth: ",IDC_STATIC,8,10,60,30
+    COMBOBOX	    IDC_SCREEN_DEPTH,70,8,180,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ 
     EDITTEXT        IDC_DESKTOP_WIDTH,64,125,40,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
     EDITTEXT        IDC_DESKTOP_HEIGHT,117,125,40,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
-    GROUPBOX        " Render Settings ",IDC_STATIC,8,4,244,60
-    LTEXT           "The driver color and render settings are used to optimise the way in which colors and applications are displayed.",
-                    IDC_STATIC,15,17,228,22
-		    
-    LTEXT           "Allocated system colors:",IDC_STATIC,15,43,76,8
-    EDITTEXT        IDC_SYSCOLORS,90,41,40,14,ES_AUTOHSCROLL | ES_NUMBER
     
     GROUPBOX        " Window settings ",IDC_STATIC,8,65,244,170
 
diff -ur --exclude-from=diff-exclusions ../head/programs/winecfg/resource.h programs/winecfg/resource.h
--- ../head/programs/winecfg/resource.h	2003-09-19 13:36:43.000000000 +0100
+++ programs/winecfg/resource.h	2003-09-19 18:23:28.000000000 +0100
@@ -103,3 +103,4 @@
 #define IDC_ENABLE_DESKTOP              1074
 #define IDS_DRIVE_NO_C                  1075
 #define IDC_ENABLE_MANAGED              1076
+#define IDC_SCREEN_DEPTH                1077
diff -ur --exclude-from=diff-exclusions ../head/programs/winecfg/winecfg.c programs/winecfg/winecfg.c
--- ../head/programs/winecfg/winecfg.c	2003-09-19 13:37:01.000000000 +0100
+++ programs/winecfg/winecfg.c	2003-09-19 18:16:35.000000000 +0100
@@ -31,6 +31,7 @@
  *   - Make a list of prefs that have been dropped from the UI/should be eliminated
  *   - Multimedia page
  *   - Settings migration code (from old configs)
+ *   - Clean up resource.h, it's a bog
  *
  *   Minor things that should be done someday:
  *   - Make the desktop size UI a combo box, with a Custom option, so it's more obvious what you might want to choose here
@@ -292,3 +293,5 @@
     if (GetWindowText(item, result, len) == 0) return NULL;
     return result;
 }
+
+
diff -ur --exclude-from=diff-exclusions ../head/programs/winecfg/x11drvdlg.c programs/winecfg/x11drvdlg.c
--- ../head/programs/winecfg/x11drvdlg.c	2003-09-19 13:32:55.000000000 +0100
+++ programs/winecfg/x11drvdlg.c	2003-09-19 18:43:15.000000000 +0100
@@ -73,7 +73,7 @@
 void initX11DrvDlg (HWND hDlg)
 {
     char *buf;
-    char *i;
+    char *bufindex;
 
     updatingUI = TRUE;
     
@@ -81,20 +81,34 @@
     
     /* desktop size */
     buf = getConfigValue("x11drv", "Desktop", "640x480");
-    i = strchr(buf, 'x');
-    *i = '\0';
-    i++;
+    bufindex = strchr(buf, 'x');
+    *bufindex = '\0';
+    bufindex++;
     SetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_WIDTH), buf);
-    SetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_HEIGHT), i);
+    SetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_HEIGHT), bufindex);
+    free(buf);
+    
+    SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "8 bit");
+    SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "16 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? */
+
+    buf = getConfigValue("x11drv", "ScreenDepth", "24");
+    if (strcmp(buf, "8") == 0)
+	SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_SETCURSEL, 0, 0);
+    else if (strcmp(buf, "16") == 0)
+	SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_SETCURSEL, 1, 0);
+    else if (strcmp(buf, "24") == 0)
+	SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_SETCURSEL, 2, 0);
+    else if (strcmp(buf, "32") == 0)
+	SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_SETCURSEL, 3, 0);
+    else
+	WINE_ERR("Invalid screen depth read from registry (%s)\n", buf);
     free(buf);
 
     SendDlgItemMessage(hDlg, IDC_DESKTOP_WIDTH, EM_LIMITTEXT, RES_MAXLEN, 0);
     SendDlgItemMessage(hDlg, IDC_DESKTOP_HEIGHT, EM_LIMITTEXT, RES_MAXLEN, 0);
 
-    buf = getConfigValue("x11drv", "AllocSysColors", "100");
-    SetWindowText(GetDlgItem(hDlg, IDC_SYSCOLORS), buf);
-    free(buf);
-
     buf = getConfigValue("x11drv", "Managed", "Y");
     if (IS_OPTION_TRUE(*buf))
 	CheckDlgButton(hDlg, IDC_ENABLE_MANAGED, BST_CHECKED);
@@ -141,14 +155,15 @@
     updateGUIForDesktopMode(hDlg);
 }
 
-void onSysColorsChange(HWND hDlg) {
-    char *newvalue = getDialogItemText(hDlg, IDC_SYSCOLORS);
+void onScreenDepthChanged(HWND hDlg) {
+    char *newvalue = getDialogItemText(hDlg, IDC_SCREEN_DEPTH);
+    char *spaceIndex = strchr(newvalue, ' ');
     
-    WINE_TRACE("\n");
+    WINE_TRACE("newvalue=%s\n", newvalue);
     if (updatingUI) return;
-    if (!newvalue) return;
 
-    addTransaction("x11drv", "AllocSystemColors", ACTION_SET, newvalue);
+    *spaceIndex = '\0';
+    addTransaction("x11drv", "ScreenDepth", ACTION_SET, newvalue);
     free(newvalue);
 }
 
@@ -171,7 +186,6 @@
 		case EN_CHANGE: {
 		    SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
 		    if ( (LOWORD(wParam) == IDC_DESKTOP_WIDTH) || (LOWORD(wParam) == IDC_DESKTOP_HEIGHT) ) setFromDesktopSizeEdits(hDlg);
-		    if (LOWORD(wParam) == IDC_SYSCOLORS) onSysColorsChange(hDlg);
 		    break;
 		}
 		case BN_CLICKED: {
@@ -182,6 +196,10 @@
 		    };
 		    break;
 		}
+		case CBN_SELCHANGE: {
+		    if (LOWORD(wParam) == IDC_SCREEN_DEPTH) onScreenDepthChanged(hDlg);
+		    break;
+		}
 		    
 		default:
 		    break;





More information about the wine-patches mailing list