mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[ui] misc. UI improvements
* improved ISO selection * set default FS according to ISO boot method * fix exFAT selection
This commit is contained in:
		
							parent
							
								
									3cd83869c4
								
							
						
					
					
						commit
						c79bfa0cb4
					
				
					 2 changed files with 71 additions and 35 deletions
				
			
		
							
								
								
									
										60
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										60
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -384,6 +384,25 @@ static BOOL GetDriveInfo(void) | ||||||
| 	return SetClusterSizes((int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))); | 	return SetClusterSizes((int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static void SetFSFromISO(void) | ||||||
|  | { | ||||||
|  | 	int i, fs; | ||||||
|  | 
 | ||||||
|  | 	if (iso_path == NULL) | ||||||
|  | 		return; | ||||||
|  | 
 | ||||||
|  | 	for (i=ComboBox_GetCount(hFileSystem)-1; i>=0; i--) { | ||||||
|  | 		fs = ComboBox_GetItemData(hFileSystem, i); | ||||||
|  | 		if ( ((iso_report.has_bootmgr) && (fs == FS_NTFS)) | ||||||
|  | 			|| ((iso_report.has_isolinux) && ((fs == FS_FAT32) || (fs == FS_FAT16))) ) { | ||||||
|  | 			IGNORE_RETVAL(ComboBox_SetCurSel(hFileSystem, i)); | ||||||
|  | 			break; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM, | ||||||
|  | 		ComboBox_GetCurSel(hFileSystem)); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Populate the UI properties |  * Populate the UI properties | ||||||
|  */ |  */ | ||||||
|  | @ -411,8 +430,9 @@ static BOOL PopulateProperties(int ComboIndex) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	SelectedDrive.DeviceNumber = (DWORD)ComboBox_GetItemData(hDeviceList, ComboIndex); | 	SelectedDrive.DeviceNumber = (DWORD)ComboBox_GetItemData(hDeviceList, ComboIndex); | ||||||
| 	if (!GetDriveInfo()) | 	if (!GetDriveInfo())	// This also populates FS
 | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
|  | 	SetFSFromISO(); | ||||||
| 
 | 
 | ||||||
| 	HumanReadableSize = (double)SelectedDrive.DiskSize; | 	HumanReadableSize = (double)SelectedDrive.DiskSize; | ||||||
| 	for (i=0; i<ARRAYSIZE(suffix); i++) { | 	for (i=0; i<ARRAYSIZE(suffix); i++) { | ||||||
|  | @ -426,7 +446,8 @@ static BOOL PopulateProperties(int ComboIndex) | ||||||
| 	IGNORE_RETVAL(ComboBox_SetCurSel(hCapacity, 0)); | 	IGNORE_RETVAL(ComboBox_SetCurSel(hCapacity, 0)); | ||||||
| 	hDeviceTooltip = CreateTooltip(hDeviceList, DriveID.Table[ComboIndex], -1); | 	hDeviceTooltip = CreateTooltip(hDeviceList, DriveID.Table[ComboIndex], -1); | ||||||
| 
 | 
 | ||||||
| 	// If no existing label is available, propose one according to the size (eg: "256MB", "8GB")
 | 	// If no existing label is available and no ISO is selected, propose one according to the size (eg: "256MB", "8GB")
 | ||||||
|  | 	if ((iso_path == NULL) || (iso_report.label[0] == 0)) { | ||||||
| 		if (safe_strcmp(no_label, DriveLabel.Table[ComboIndex]) == 0) { | 		if (safe_strcmp(no_label, DriveLabel.Table[ComboIndex]) == 0) { | ||||||
| 			if (HumanReadableSize < 1.0) { | 			if (HumanReadableSize < 1.0) { | ||||||
| 				HumanReadableSize *= 1024.0; | 				HumanReadableSize *= 1024.0; | ||||||
|  | @ -438,9 +459,12 @@ static BOOL PopulateProperties(int ComboIndex) | ||||||
| 			} else { | 			} else { | ||||||
| 				safe_sprintf(proposed_label, sizeof(proposed_label), "%0.1f%s", HumanReadableSize, suffix[i]); | 				safe_sprintf(proposed_label, sizeof(proposed_label), "%0.1f%s", HumanReadableSize, suffix[i]); | ||||||
| 			} | 			} | ||||||
| 		SetWindowTextA(hLabel, proposed_label); | 			SetWindowTextU(hLabel, proposed_label); | ||||||
| 		} else { | 		} else { | ||||||
| 		SetWindowTextA(hLabel, DriveLabel.Table[ComboIndex]); | 			SetWindowTextU(hLabel, DriveLabel.Table[ComboIndex]); | ||||||
|  | 		} | ||||||
|  | 	} else { | ||||||
|  | 		SetWindowTextU(hLabel, iso_report.label); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return TRUE; | 	return TRUE; | ||||||
|  | @ -962,6 +986,7 @@ DWORD WINAPI ISOScanThread(LPVOID param) | ||||||
| 	PrintStatus(0, TRUE, "Scanning ISO image...\n"); | 	PrintStatus(0, TRUE, "Scanning ISO image...\n"); | ||||||
| 	if (!ExtractISO(iso_path, "", TRUE)) { | 	if (!ExtractISO(iso_path, "", TRUE)) { | ||||||
| 		PrintStatus(0, TRUE, "Failed to scan ISO image."); | 		PrintStatus(0, TRUE, "Failed to scan ISO image."); | ||||||
|  | 		safe_free(iso_path); | ||||||
| 		goto out; | 		goto out; | ||||||
| 	} | 	} | ||||||
| 	uprintf("ISO label: '%s'\n size: %lld bytes, 4GB:%c, bootmgr:%c, isolinux:%c\n", | 	uprintf("ISO label: '%s'\n size: %lld bytes, 4GB:%c, bootmgr:%c, isolinux:%c\n", | ||||||
|  | @ -973,6 +998,9 @@ DWORD WINAPI ISOScanThread(LPVOID param) | ||||||
| 			"This ISO image doesn't appear to use either...", "Unsupported ISO", MB_OK|MB_ICONINFORMATION); | 			"This ISO image doesn't appear to use either...", "Unsupported ISO", MB_OK|MB_ICONINFORMATION); | ||||||
| 		safe_free(iso_path); | 		safe_free(iso_path); | ||||||
| 	} else { | 	} else { | ||||||
|  | 		// Enable DOS, set DOS Type to ISO (last item) and set FS accordingly
 | ||||||
|  | 		CheckDlgButton(hMainDialog, IDC_DOS, BST_CHECKED); | ||||||
|  | 		SetFSFromISO(); | ||||||
| 		for (i=(int)safe_strlen(iso_path); (i>0)&&(iso_path[i]!='\\'); i--); | 		for (i=(int)safe_strlen(iso_path); (i>0)&&(iso_path[i]!='\\'); i--); | ||||||
| 		PrintStatus(0, TRUE, "Using ISO: %s\n", &iso_path[i+1]); | 		PrintStatus(0, TRUE, "Using ISO: %s\n", &iso_path[i+1]); | ||||||
| 		// Some Linux distros, such as Arch Linux, require the USB drive to have
 | 		// Some Linux distros, such as Arch Linux, require the USB drive to have
 | ||||||
|  | @ -980,6 +1008,10 @@ DWORD WINAPI ISOScanThread(LPVOID param) | ||||||
| 		if (iso_report.label[0] != 0) { | 		if (iso_report.label[0] != 0) { | ||||||
| 			SetWindowTextU(hLabel, iso_report.label); | 			SetWindowTextU(hLabel, iso_report.label); | ||||||
| 		} | 		} | ||||||
|  | 		// Lose the focus on the select ISO (but place it on Close)
 | ||||||
|  | 		SendMessage(hMainDialog, WM_NEXTDLGCTL,  (WPARAM)FALSE, 0); | ||||||
|  | 		// Lose the focus from Close and set it back to Start
 | ||||||
|  | 		SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hMainDialog, IDC_START), TRUE); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| out: | out: | ||||||
|  | @ -1217,14 +1249,16 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 				break; | 				break; | ||||||
| 			fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | 			fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); | ||||||
| 			SetClusterSizes(fs); | 			SetClusterSizes(fs); | ||||||
| 			if (((fs == FS_EXFAT) || (fs <0)) && IsWindowEnabled(hDOS)) { | 			if ((fs == FS_EXFAT) || (fs <0)) { | ||||||
|  | 				if (IsWindowEnabled(hDOS)) { | ||||||
| 					// unlikely to be supported by BIOSes => don't bother
 | 					// unlikely to be supported by BIOSes => don't bother
 | ||||||
| 					IGNORE_RETVAL(ComboBox_SetCurSel(hDOSType, 0)); | 					IGNORE_RETVAL(ComboBox_SetCurSel(hDOSType, 0)); | ||||||
| 					uDOSChecked = IsDlgButtonChecked(hMainDialog, IDC_DOS); | 					uDOSChecked = IsDlgButtonChecked(hMainDialog, IDC_DOS); | ||||||
| 					CheckDlgButton(hDlg, IDC_DOS, BST_UNCHECKED); | 					CheckDlgButton(hDlg, IDC_DOS, BST_UNCHECKED); | ||||||
| 					EnableWindow(hDOS, FALSE); | 					EnableWindow(hDOS, FALSE); | ||||||
| 					EnableWindow(hDOSType, FALSE); | 					EnableWindow(hDOSType, FALSE); | ||||||
| 				ShowWindow(hSelectISO, SW_HIDE); | 					EnableWindow(hSelectISO, FALSE); | ||||||
|  | 				} | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
| 			IGNORE_RETVAL(ComboBox_ResetContent(hDOSType)); | 			IGNORE_RETVAL(ComboBox_ResetContent(hDOSType)); | ||||||
|  | @ -1238,23 +1272,25 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 			if (fs == FS_NTFS) { | 			if (fs == FS_NTFS) { | ||||||
| 				IGNORE_RETVAL(ComboBox_SetItemData(hDOSType, ComboBox_AddStringU(hDOSType, "ISO Image"), DT_ISO_NTFS)); | 				IGNORE_RETVAL(ComboBox_SetItemData(hDOSType, ComboBox_AddStringU(hDOSType, "ISO Image"), DT_ISO_NTFS)); | ||||||
| 			} | 			} | ||||||
|  | 			if (iso_path != NULL) | ||||||
|  | 				IGNORE_RETVAL(ComboBox_SetCurSel(hDOSType, ComboBox_GetCount(hDOSType) - 1)); | ||||||
|  | 			else | ||||||
| 				IGNORE_RETVAL(ComboBox_SetCurSel(hDOSType, (bWithFreeDOS && (fs != FS_NTFS))?1:0)); | 				IGNORE_RETVAL(ComboBox_SetCurSel(hDOSType, (bWithFreeDOS && (fs != FS_NTFS))?1:0)); | ||||||
| 			if (!IsWindowEnabled(hDOS)) { | 			if (!IsWindowEnabled(hDOS)) { | ||||||
| 				EnableWindow(hDOS, TRUE); | 				EnableWindow(hDOS, TRUE); | ||||||
| 				EnableWindow(hDOSType, TRUE); | 				EnableWindow(hDOSType, TRUE); | ||||||
|  | 				EnableWindow(hSelectISO, TRUE); | ||||||
| 				CheckDlgButton(hDlg, IDC_DOS, uDOSChecked); | 				CheckDlgButton(hDlg, IDC_DOS, uDOSChecked); | ||||||
| 			} | 			} | ||||||
| 			// Fall through to enable/disable the ISO selection
 | 			break; | ||||||
| 		case IDC_DOSTYPE: | 		case IDC_DOSTYPE: | ||||||
| 			if (HIWORD(wParam) != CBN_SELCHANGE) | 			if (HIWORD(wParam) != CBN_SELCHANGE) | ||||||
| 				break; | 				break; | ||||||
| 			dt = (int)ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType)); | 			dt = (int)ComboBox_GetItemData(hDOSType, ComboBox_GetCurSel(hDOSType)); | ||||||
| 			if ((dt != DT_ISO_NTFS) && (dt != DT_ISO_FAT)) { | 			if ((dt == DT_ISO_NTFS) || (dt == DT_ISO_FAT)) { | ||||||
| 				ShowWindow(hSelectISO, SW_HIDE); | 				SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)hSelectISO, TRUE); | ||||||
| 				break; |  | ||||||
| 			} | 			} | ||||||
| 			ShowWindow(hSelectISO, SW_SHOW); | 			return (INT_PTR)TRUE; | ||||||
| 			break; |  | ||||||
| 		case IDC_SELECT_ISO: | 		case IDC_SELECT_ISO: | ||||||
| 			DestroyTooltip(hISOToolTip); | 			DestroyTooltip(hISOToolTip); | ||||||
| 			safe_free(iso_path); | 			safe_free(iso_path); | ||||||
|  |  | ||||||
							
								
								
									
										14
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL | ||||||
| IDD_DIALOG DIALOGEX 12, 12, 206, 278 | IDD_DIALOG DIALOGEX 12, 12, 206, 278 | ||||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||||
| EXSTYLE WS_EX_APPWINDOW | EXSTYLE WS_EX_APPWINDOW | ||||||
| CAPTION "Rufus v1.1.1.135" | CAPTION "Rufus v1.1.1.136" | ||||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||||
| BEGIN | BEGIN | ||||||
|     DEFPUSHBUTTON   "Start",IDC_START,94,236,50,14 |     DEFPUSHBUTTON   "Start",IDC_START,94,236,50,14 | ||||||
|  | @ -57,7 +57,7 @@ BEGIN | ||||||
|     COMBOBOX        IDC_DOSTYPE,119,183,49,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |     COMBOBOX        IDC_DOSTYPE,119,183,49,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | ||||||
|     COMBOBOX        IDC_NBPASSES,119,159,49,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |     COMBOBOX        IDC_NBPASSES,119,159,49,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | ||||||
|     PUSHBUTTON      "Test",IDC_TEST,62,236,20,14,NOT WS_VISIBLE |     PUSHBUTTON      "Test",IDC_TEST,62,236,20,14,NOT WS_VISIBLE | ||||||
|     PUSHBUTTON      "...",IDC_SELECT_ISO,171,182,22,14,BS_ICON | NOT WS_VISIBLE |     PUSHBUTTON      "...",IDC_SELECT_ISO,171,182,22,14,BS_ICON | ||||||
| END | END | ||||||
| 
 | 
 | ||||||
| IDD_ABOUTBOX DIALOGEX 0, 0, 287, 195 | IDD_ABOUTBOX DIALOGEX 0, 0, 287, 195 | ||||||
|  | @ -71,7 +71,7 @@ BEGIN | ||||||
|     DEFPUSHBUTTON   "OK",IDOK,231,175,50,14,WS_GROUP |     DEFPUSHBUTTON   "OK",IDOK,231,175,50,14,WS_GROUP | ||||||
|     CONTROL         "<a href=""http://rufus.akeo.ie"">http://rufus.akeo.ie</a>",IDC_ABOUT_RUFUS_URL, |     CONTROL         "<a href=""http://rufus.akeo.ie"">http://rufus.akeo.ie</a>",IDC_ABOUT_RUFUS_URL, | ||||||
|                     "SysLink",WS_TABSTOP,46,47,114,9 |                     "SysLink",WS_TABSTOP,46,47,114,9 | ||||||
|     LTEXT           "Version 1.1.1 (Build 135)",IDC_STATIC,46,19,78,8 |     LTEXT           "Version 1.1.1 (Build 136)",IDC_STATIC,46,19,78,8 | ||||||
|     PUSHBUTTON      "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP |     PUSHBUTTON      "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP | ||||||
|     EDITTEXT        IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL |     EDITTEXT        IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL | ||||||
|     LTEXT           "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8 |     LTEXT           "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8 | ||||||
|  | @ -222,8 +222,8 @@ END | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 1,1,1,135 |  FILEVERSION 1,1,1,136 | ||||||
|  PRODUCTVERSION 1,1,1,135 |  PRODUCTVERSION 1,1,1,136 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -240,13 +240,13 @@ BEGIN | ||||||
|         BEGIN |         BEGIN | ||||||
|             VALUE "CompanyName", "akeo.ie" |             VALUE "CompanyName", "akeo.ie" | ||||||
|             VALUE "FileDescription", "Rufus" |             VALUE "FileDescription", "Rufus" | ||||||
|             VALUE "FileVersion", "1.1.1.135" |             VALUE "FileVersion", "1.1.1.136" | ||||||
|             VALUE "InternalName", "Rufus" |             VALUE "InternalName", "Rufus" | ||||||
|             VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)" |             VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)" | ||||||
|             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" |             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" | ||||||
|             VALUE "OriginalFilename", "rufus.exe" |             VALUE "OriginalFilename", "rufus.exe" | ||||||
|             VALUE "ProductName", "Rufus" |             VALUE "ProductName", "Rufus" | ||||||
|             VALUE "ProductVersion", "1.1.1.135" |             VALUE "ProductVersion", "1.1.1.136" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue