From 66b1f8006e1fa7e525a95932a048fb5c750135db Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Sun, 4 Nov 2012 21:39:25 +0000 Subject: [PATCH] [ui] fix bootlist and label issues * Fixes only MS-DOS option being proposed when no drive is present * Fixes only MS-DOS available when an empty card reader is detected first * Fixes loss of user input label when switching between boot options NB: ISO label is forced over user input as distros such as Arch Linux want to see a specific label for the USB * Closes #95 * Closes #96 --- src/rufus.c | 16 +++++++++++++--- src/rufus.rc | 12 ++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/rufus.c b/src/rufus.c index 0e07230a..be793388 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -1440,7 +1440,9 @@ void InitDialog(HWND hDlg) CreateTooltip(hNBPasses, "Pattern: 0x55, 0xAA", -1); // Fill up the DOS type dropdown IGNORE_RETVAL(ComboBox_SetItemData(hDOSType, ComboBox_AddStringU(hDOSType, "MS-DOS"), DT_WINME)); - IGNORE_RETVAL(ComboBox_SetCurSel(hDOSType, DT_WINME)); + IGNORE_RETVAL(ComboBox_SetItemData(hDOSType, ComboBox_AddStringU(hDOSType, "FreeDOS"), DT_FREEDOS)); + IGNORE_RETVAL(ComboBox_SetItemData(hDOSType, ComboBox_AddStringU(hDOSType, "ISO Image"), DT_ISO)); + IGNORE_RETVAL(ComboBox_SetCurSel(hDOSType, selection_default)); // Fill up the MBR masqueraded disk IDs ("8 disks should be enough for anybody") IGNORE_RETVAL(ComboBox_SetItemData(hDiskID, ComboBox_AddStringU(hDiskID, "0x80 (default)"), 0x80)); for (i=1; i<=7; i++) { @@ -1523,7 +1525,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA static DWORD DeviceNum = 0; wchar_t wtmp[128], wstr[MAX_PATH]; static UINT uDOSChecked = BST_CHECKED, uQFChecked; - static BOOL first_log_display = TRUE; + static BOOL first_log_display = TRUE, user_changed_label = FALSE; switch (message) { @@ -1531,6 +1533,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA if ( (format_thid == NULL) && ((wParam == DBT_DEVICEARRIVAL) || (wParam == DBT_DEVICEREMOVECOMPLETE)) ) { GetUSBDevices((DWORD)ComboBox_GetItemData(hDeviceList, ComboBox_GetCurSel(hDeviceList))); + user_changed_label = FALSE; return (INT_PTR)TRUE; } break; @@ -1629,6 +1632,10 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM, ComboBox_GetCurSel(hFileSystem)); break; + case IDC_LABEL: + if (HIWORD(wParam) == EN_CHANGE) + user_changed_label = TRUE; + break; case IDC_DEVICE: if (HIWORD(wParam) != CBN_SELCHANGE) break; @@ -1734,13 +1741,16 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0); SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)hSelectISO, TRUE); } else { + // Some distros (eg. Arch Linux) want to see a specific label => ignore user one SetWindowTextU(hLabel, iso_report.label); } } else { // Set focus on the start button SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0); SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hMainDialog, IDC_START), TRUE); - SetWindowTextU(hLabel, SelectedDrive.proposed_label); + // For non ISO, if the user manually set a label, try to preserve it + if (!user_changed_label) + SetWindowTextU(hLabel, SelectedDrive.proposed_label); // Reset disk ID to 0x80 if Rufus MBR is used IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, 0)); } diff --git a/src/rufus.rc b/src/rufus.rc index 6eb2d1ce..9791d097 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 206, 316 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW -CAPTION "Rufus v1.2.0.189" +CAPTION "Rufus v1.2.0.190" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,278,50,14 @@ -77,7 +77,7 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,231,175,50,14,WS_GROUP CONTROL "http://rufus.akeo.ie",IDC_ABOUT_RUFUS_URL, "SysLink",WS_TABSTOP,46,47,114,9 - LTEXT "Version 1.2.0 (Build 189)",IDC_STATIC,46,19,78,8 + LTEXT "Version 1.2.0 (Build 190)",IDC_STATIC,46,19,78,8 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 LTEXT "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8 @@ -237,8 +237,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,2,0,189 - PRODUCTVERSION 1,2,0,189 + FILEVERSION 1,2,0,190 + PRODUCTVERSION 1,2,0,190 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -255,13 +255,13 @@ BEGIN BEGIN VALUE "CompanyName", "akeo.ie" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.2.0.189" + VALUE "FileVersion", "1.2.0.190" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "1.2.0.189" + VALUE "ProductVersion", "1.2.0.190" END END BLOCK "VarFileInfo"