[winecfg 4] Drive management bugfixes and extra editing support

Mike Hearn mike at theoretic.com
Thu Aug 28 12:04:04 CDT 2003


Mike Hearn <mike at theoretic.com>
* Path changes are saved to the struct correctly.
* Rename enable_cdrom_box to enable_labelserial_box to better reflect purpose
* Rename IDC_BOX_CDROM to IDC_BOX_LABELSERIAL
* Support for editing label for all drives, allow editing of serial/device for CD-ROMS

I'll probably wait for the other patches to be merged in before doing more work.....



diff -ur --exclude-from=diff-exclusions ../head/programs/winecfg/drive.c programs/winecfg/drive.c
--- ../head/programs/winecfg/drive.c	2003-08-28 16:23:05.000000000 +0100
+++ programs/winecfg/drive.c	2003-08-28 17:53:53.000000000 +0100
@@ -44,6 +44,9 @@
 void initDriveDlg (HWND hDlg)
 {
     int i;
+
+    /* Clear the listbox */
+    SendMessageA(GetDlgItem(hDlg, IDC_LIST_DRIVES), LB_RESETCONTENT, 0, 0);
     for (i = 0; i < config.driveCount; i++) {
 	int itemIndex;
 	DRIVE_DESC *drive = DPA_GetPtr(config.pDrives, i);
@@ -52,7 +55,7 @@
 	WINE_TRACE("Iterating, item %d of %d, drive=%p\n", i, config.driveCount, drive);
 	assert(drive);
 
-	WINE_TRACE("Adding %s to the listbox\n", drive->szName);
+	WINE_TRACE("Adding %s (%s) to the listbox\n", drive->szName, drive->szLabel);
 
 	/* the first SendMessage call adds the string and returns the index, the second associates that index with it */
 	snprintf(title, MAX_NAME_LENGTH, "Drive %s (%s)", drive->szName, drive->szLabel);
@@ -150,15 +153,16 @@
 }
 
 
-void enable_cdrom_box(HWND hDlg, int bEnable)
+/* if bEnable is 1 then we are editing a CDROM, so can enable all controls, otherwise we want to disable
+ * "detect from device" and "serial number", but still allow the user to manually set the path. The UI
+ * for this could be somewhat better -mike
+ */
+void enable_labelserial_box(HWND hDlg, int bEnable)
 {
-  EnableWindow( GetDlgItem( hDlg, IDC_BOX_CDROM ), bEnable );
   EnableWindow( GetDlgItem( hDlg, IDC_RADIO_AUTODETECT ), bEnable );
-  EnableWindow( GetDlgItem( hDlg, IDC_RADIO_ASSIGN ), bEnable );
   EnableWindow( GetDlgItem( hDlg, IDC_EDIT_DEVICE ), bEnable );
   EnableWindow( GetDlgItem( hDlg, IDC_BUTTON_BROWSE_DEVICE ), bEnable );
   EnableWindow( GetDlgItem( hDlg, IDC_EDIT_SERIAL ), bEnable );
-  EnableWindow( GetDlgItem( hDlg, IDC_EDIT_LABEL ), bEnable );
   EnableWindow( GetDlgItem( hDlg, IDC_STATIC_SERIAL ), bEnable );
   EnableWindow( GetDlgItem( hDlg, IDC_STATIC_LABEL ), bEnable );
 }
@@ -222,10 +226,11 @@
 	    selection = IDC_RADIO_AUTODETECT;
 	  }
 	
-	  enable_cdrom_box( hDlg, 1 );
+	  enable_labelserial_box( hDlg, 1 );
 	}
 	else {
-	  enable_cdrom_box( hDlg, 0 );
+	  enable_labelserial_box( hDlg, 0 );
+	  selection = IDC_RADIO_ASSIGN;
 	}
 	
 	CheckRadioButton( hDlg, IDC_RADIO_AUTODETECT, IDC_RADIO_ASSIGN, selection );
@@ -242,10 +247,10 @@
 	    case CBN_SELCHANGE:
 	      selection = SendDlgItemMessage( hDlg, IDC_COMBO_TYPE, CB_GETCURSEL, 0, 0);
 	      if( selection == 2 || selection == 3 ) { /* cdrom or floppy */
-		enable_cdrom_box( hDlg, 1 );
+		enable_labelserial_box( hDlg, 1 );
 	      }
 	      else {
-		enable_cdrom_box( hDlg, 0 );
+		enable_labelserial_box( hDlg, 0 );
 	      }
 	      break;
 	    }
@@ -262,7 +267,7 @@
 	    ZeroMemory(&buffer[0], MAX_NAME_LENGTH);
 	    GetWindowText(GetDlgItem(hDlg, IDC_EDIT_PATH), buffer, MAX_NAME_LENGTH);
 	    if (strlen(buffer) > 0) {
-	      strncpy(pDrive->szName, buffer, MAX_NAME_LENGTH);
+	      strncpy(pDrive->szPath, buffer, MAX_NAME_LENGTH);
 	      
 	      /* only fill in the other values if we have a path */
 	      selection = SendDlgItemMessage( hDlg, IDC_COMBO_TYPE, CB_GETCURSEL, 0, 0);
@@ -295,9 +300,9 @@
 		}
 	      }
 	      else {
-		pDrive->szLabel[0] = 0;
-		pDrive->szSerial[0] = 0;
-		pDrive->szDevice[0] = 0;
+		GetWindowText(GetDlgItem(hDlg, IDC_EDIT_LABEL), pDrive->szLabel, MAX_NAME_LENGTH);
+		GetWindowText(GetDlgItem(hDlg, IDC_EDIT_SERIAL), pDrive->szSerial, MAX_NAME_LENGTH);
+		GetWindowText(GetDlgItem(hDlg, IDC_EDIT_DEVICE), pDrive->szDevice, MAX_NAME_LENGTH);
 	      }
 	      EndDialog(hDlg, wParam);
 	    }
@@ -380,6 +385,8 @@
 	      DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_DRIVE_EDIT2),
 			     NULL, (DLGPROC) DriveEditDlgProc, (LPARAM) pDrive );
 	      SetProp(hDlg, "PDRIVE", pDrive);
+	      WINE_TRACE("refreshing main dialog\n");
+	      initDriveDlg(hDlg);
 	    }
 	  }
 	  break;
diff -ur --exclude-from=diff-exclusions ../head/programs/winecfg/En.rc programs/winecfg/En.rc
--- ../head/programs/winecfg/En.rc	2003-08-28 16:23:05.000000000 +0100
+++ programs/winecfg/En.rc	2003-08-28 17:39:15.000000000 +0100
@@ -186,7 +186,7 @@
     PUSHBUTTON      "Browse...",IDC_BUTTON_BROWSE_DEVICE,148,89,40,13
     CONTROL         "Manually Assign:",IDC_RADIO_ASSIGN,"Button",
                     BS_AUTORADIOBUTTON,21,104,69,10
-    GROUPBOX        "Label and Serial Number",IDC_BOX_CDROM,15,68,180,79
+    GROUPBOX        "Label and Serial Number",IDC_BOX_LABELSERIAL,15,68,180,79
 END
 
 STRINGTABLE DISCARDABLE 
diff -ur --exclude-from=diff-exclusions ../head/programs/winecfg/resource.h programs/winecfg/resource.h
--- ../head/programs/winecfg/resource.h	2003-08-28 16:23:05.000000000 +0100
+++ programs/winecfg/resource.h	2003-08-28 17:39:25.000000000 +0100
@@ -98,6 +98,6 @@
 #define IDC_RADIO_AUTODETECT            1068
 #define IDC_RADIO_ASSIGN                1069
 #define IDC_BUTTON_BROWSE_DEVICE        1070
-#define IDC_BOX_CDROM                   1071
+#define IDC_BOX_LABELSERIAL             1071
 #define IDC_STATIC_SERIAL               1072
 #define IDC_STATIC_LABEL                1073





More information about the wine-patches mailing list