1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[ui] add fixed disk detection to the advanced options

* Tie unpartitioned drive listing to the fixed disk option
* Also ensure that the log and main dialog windows are the same size
This commit is contained in:
Pete Batard 2013-06-03 21:32:22 +01:00
parent 22808893bc
commit a17acd1a22
4 changed files with 68 additions and 39 deletions

View file

@ -330,9 +330,8 @@ BOOL GetDriveLabel(DWORD DriveIndex, char* letter, char** label)
*letter = GetDriveLetter(DriveIndex); *letter = GetDriveLetter(DriveIndex);
if (*letter == ' ') { if (*letter == ' ') {
// Drive without volume assigned // Drive without volume assigned - Tie to the display of fixed disks
// TODO: only with fixed? return enable_fixed_disks;
return TRUE;
} }
AutorunPath[0] = *letter; AutorunPath[0] = *letter;
wDrivePath[0] = *letter; wDrivePath[0] = *letter;

View file

@ -67,6 +67,7 @@
#define IDC_ISO_ABORT 1021 #define IDC_ISO_ABORT 1021
#define IDC_DISK_ID 1022 #define IDC_DISK_ID 1022
#define IDC_EXTRA_PARTITION 1023 #define IDC_EXTRA_PARTITION 1023
#define IDC_ENABLE_FIXED_DISKS 1024
#define IDC_ABOUT_LICENSE 1030 #define IDC_ABOUT_LICENSE 1030
#define IDC_ABOUT_ICON 1031 #define IDC_ABOUT_ICON 1031
#define IDC_ABOUT_UPDATES 1032 #define IDC_ABOUT_UPDATES 1032

View file

@ -844,6 +844,7 @@ static void EnableControls(BOOL bEnable)
EnableWindow(hNBPasses, bEnable); EnableWindow(hNBPasses, bEnable);
EnableWindow(GetDlgItem(hMainDialog, IDC_SET_ICON), bEnable); EnableWindow(GetDlgItem(hMainDialog, IDC_SET_ICON), bEnable);
EnableWindow(GetDlgItem(hMainDialog, IDC_ADVANCED), bEnable); EnableWindow(GetDlgItem(hMainDialog, IDC_ADVANCED), bEnable);
EnableWindow(GetDlgItem(hMainDialog, IDC_ENABLE_FIXED_DISKS), bEnable);
SetDlgItemTextA(hMainDialog, IDCANCEL, bEnable?"Close":"Cancel"); SetDlgItemTextA(hMainDialog, IDCANCEL, bEnable?"Close":"Cancel");
} }
@ -1092,17 +1093,17 @@ out:
ExitThread(0); ExitThread(0);
} }
void MoveControl(int nID, float vertical_shift) void MoveControl(HWND hDlg, int nID, float vertical_shift)
{ {
RECT rect; RECT rect;
POINT point; POINT point;
HWND hControl; HWND hControl;
hControl = GetDlgItem(hMainDialog, nID); hControl = GetDlgItem(hDlg, nID);
GetWindowRect(hControl, &rect); GetWindowRect(hControl, &rect);
point.x = rect.left; point.x = rect.left;
point.y = rect.top; point.y = rect.top;
ScreenToClient(hMainDialog, &point); ScreenToClient(hDlg, &point);
GetClientRect(hControl, &rect); GetClientRect(hControl, &rect);
MoveWindow(hControl, point.x, point.y + (int)(fScale*(advanced_mode?vertical_shift:-vertical_shift)), MoveWindow(hControl, point.x, point.y + (int)(fScale*(advanced_mode?vertical_shift:-vertical_shift)),
(rect.right - rect.left), (rect.bottom - rect.top), TRUE); (rect.right - rect.left), (rect.bottom - rect.top), TRUE);
@ -1119,7 +1120,7 @@ void SetPassesTooltip(void)
// Toggle "advanced" mode // Toggle "advanced" mode
void ToggleAdvanced(void) void ToggleAdvanced(void)
{ {
float dialog_shift = 59.0f; float dialog_shift = 80.0f;
RECT rect; RECT rect;
POINT point; POINT point;
int toggle; int toggle;
@ -1134,18 +1135,35 @@ void ToggleAdvanced(void)
point.y + (int)(fScale*(advanced_mode?dialog_shift:-dialog_shift)), TRUE); point.y + (int)(fScale*(advanced_mode?dialog_shift:-dialog_shift)), TRUE);
// Move the status bar up or down // Move the status bar up or down
MoveControl(IDC_STATUS, dialog_shift); MoveControl(hMainDialog, IDC_STATUS, dialog_shift);
MoveControl(IDC_START, dialog_shift); MoveControl(hMainDialog, IDC_START, dialog_shift);
MoveControl(IDC_PROGRESS, dialog_shift); MoveControl(hMainDialog, IDC_PROGRESS, dialog_shift);
MoveControl(IDC_ABOUT, dialog_shift); MoveControl(hMainDialog, IDC_ABOUT, dialog_shift);
MoveControl(IDC_LOG, dialog_shift); MoveControl(hMainDialog, IDC_LOG, dialog_shift);
MoveControl(IDCANCEL, dialog_shift); MoveControl(hMainDialog, IDCANCEL, dialog_shift);
#ifdef RUFUS_TEST #ifdef RUFUS_TEST
MoveControl(IDC_TEST, dialog_shift); MoveControl(hMainDialogm, IDC_TEST, dialog_shift);
#endif #endif
// And do the same for the log dialog while we're at it
GetWindowRect(hLogDlg, &rect);
point.x = (rect.right - rect.left);
point.y = (rect.bottom - rect.top);
MoveWindow(hLogDlg, rect.left, rect.top, point.x,
point.y + (int)(fScale*(advanced_mode?dialog_shift:-dialog_shift)), TRUE);
MoveControl(hLogDlg, IDC_LOG_CLEAR, dialog_shift);
MoveControl(hLogDlg, IDC_LOG_SAVE, dialog_shift);
MoveControl(hLogDlg, IDCANCEL, dialog_shift);
GetWindowRect(hLog, &rect);
point.x = (rect.right - rect.left);
point.y = (rect.bottom - rect.top) + (int)(fScale*(advanced_mode?dialog_shift:-dialog_shift));
SetWindowPos(hLog, 0, 0, 0, point.x, point.y, 0);
// Don't forget to scroll the edit to the bottom after resize
SendMessage(hLog, EM_LINESCROLL, 0, SendMessage(hLog, EM_GETLINECOUNT, 0, 0));
// Hide or show the various advanced options // Hide or show the various advanced options
toggle = advanced_mode?SW_SHOW:SW_HIDE; toggle = advanced_mode?SW_SHOW:SW_HIDE;
ShowWindow(GetDlgItem(hMainDialog, IDC_ENABLE_FIXED_DISKS), toggle);
ShowWindow(GetDlgItem(hMainDialog, IDC_EXTRA_PARTITION), toggle); ShowWindow(GetDlgItem(hMainDialog, IDC_EXTRA_PARTITION), toggle);
ShowWindow(GetDlgItem(hMainDialog, IDC_RUFUS_MBR), toggle); ShowWindow(GetDlgItem(hMainDialog, IDC_RUFUS_MBR), toggle);
ShowWindow(GetDlgItem(hMainDialog, IDC_DISK_ID), toggle); ShowWindow(GetDlgItem(hMainDialog, IDC_DISK_ID), toggle);
@ -1346,6 +1364,8 @@ void InitDialog(HWND hDlg)
"This should only be necessary for XP installation" , 10000); "This should only be necessary for XP installation" , 10000);
CreateTooltip(GetDlgItem(hDlg, IDC_EXTRA_PARTITION), "Create an extra hidden partition and try to align partitions boundaries.\n" CreateTooltip(GetDlgItem(hDlg, IDC_EXTRA_PARTITION), "Create an extra hidden partition and try to align partitions boundaries.\n"
"This can improve boot detection for older BIOSes", -1); "This can improve boot detection for older BIOSes", -1);
CreateTooltip(GetDlgItem(hDlg, IDC_ENABLE_FIXED_DISKS), "Enable detection for disks not normally detected by Rufus. "
"USE AT YOUR OWN RISKS!!!", -1);
CreateTooltip(GetDlgItem(hDlg, IDC_START), "Start the formatting operation.\nThis will DESTROY any data on the target!", -1); CreateTooltip(GetDlgItem(hDlg, IDC_START), "Start the formatting operation.\nThis will DESTROY any data on the target!", -1);
CreateTooltip(GetDlgItem(hDlg, IDC_ABOUT), "Licensing information and credits", -1); CreateTooltip(GetDlgItem(hDlg, IDC_ABOUT), "Licensing information and credits", -1);
@ -1358,6 +1378,11 @@ void InitDialog(HWND hDlg)
} }
} }
static void PrintStatus2000(const char* str, BOOL val)
{
PrintStatus(2000, FALSE, "%s %s.", str, (val)?"enabled":"disabled");
}
/* /*
* Main dialog callback * Main dialog callback
*/ */
@ -1645,6 +1670,13 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
if ((HIWORD(wParam)) == BN_CLICKED) if ((HIWORD(wParam)) == BN_CLICKED)
mbr_selected_by_user = IsChecked(IDC_RUFUS_MBR); mbr_selected_by_user = IsChecked(IDC_RUFUS_MBR);
break; break;
case IDC_ENABLE_FIXED_DISKS:
if ((HIWORD(wParam)) == BN_CLICKED) {
enable_fixed_disks = !enable_fixed_disks;
PrintStatus2000("Fixed disks detection", enable_fixed_disks);
GetUSBDevices(0);
}
break;
case IDC_START: case IDC_START:
if (format_thid != NULL) { if (format_thid != NULL) {
return (INT_PTR)TRUE; return (INT_PTR)TRUE;
@ -1749,11 +1781,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
return (INT_PTR)FALSE; return (INT_PTR)FALSE;
} }
static void PrintStatus2000(const char* str, BOOL val)
{
PrintStatus(2000, FALSE, "%s %s.", str, (val)?"enabled":"disabled");
}
static void PrintUsage(char* appname) static void PrintUsage(char* appname)
{ {
char fname[_MAX_FNAME]; char fname[_MAX_FNAME];

View file

@ -27,14 +27,14 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
// Dialog // Dialog
// //
IDD_DIALOG DIALOGEX 12, 12, 206, 316 IDD_DIALOG DIALOGEX 12, 12, 206, 329
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.3.3.244" CAPTION "Rufus v1.3.3.245"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,278,50,14 DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
PUSHBUTTON "Close",IDCANCEL,148,278,50,14 PUSHBUTTON "Close",IDCANCEL,148,291,50,14
COMBOBOX IDC_DEVICE,8,17,190,33,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_DEVICE,8,17,190,33,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Device",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,9,6,22,8 CONTROL "Device",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,9,6,22,8
COMBOBOX IDC_FILESYSTEM,8,75,190,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_FILESYSTEM,8,75,190,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@ -43,7 +43,7 @@ BEGIN
LTEXT "Partition scheme and target system type",IDC_STATIC,9,35,176,8 LTEXT "Partition scheme and target system type",IDC_STATIC,9,35,176,8
COMBOBOX IDC_CLUSTERSIZE,8,104,190,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_CLUSTERSIZE,8,104,190,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Cluster size",IDC_STATIC,9,93,105,10 LTEXT "Cluster size",IDC_STATIC,9,93,105,10
PUSHBUTTON "About...",IDC_ABOUT,8,278,50,14 PUSHBUTTON "About...",IDC_ABOUT,8,291,50,14
GROUPBOX "Format Options ",IDC_STATIC,7,149,192,66 GROUPBOX "Format Options ",IDC_STATIC,7,149,192,66
EDITTEXT IDC_LABEL,7,131,190,13,ES_AUTOHSCROLL EDITTEXT IDC_LABEL,7,131,190,13,ES_AUTOHSCROLL
CONTROL "Check device for bad blocks:",IDC_BADBLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,101,10 CONTROL "Check device for bad blocks:",IDC_BADBLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,101,10
@ -52,18 +52,20 @@ BEGIN
CONTROL "Create extended label and icon files",IDC_SET_ICON, CONTROL "Create extended label and icon files",IDC_SET_ICON,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,198,131,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,198,131,10
LTEXT "New volume label",IDC_STATIC,9,121,105,10 LTEXT "New volume label",IDC_STATIC,9,121,105,10
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,259,189,9 CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,272,189,9
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
COMBOBOX IDC_BOOTTYPE,119,183,49,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_BOOTTYPE,119,183,49,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDC_SELECT_ISO,171,182,22,14,BS_ICON PUSHBUTTON "...",IDC_SELECT_ISO,171,182,22,14,BS_ICON
PUSHBUTTON "T",IDC_TEST,80,278,12,14,NOT WS_VISIBLE PUSHBUTTON "T",IDC_TEST,80,291,12,14,NOT WS_VISIBLE
CONTROL "Use Rufus MBR with BIOS ID:",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,13,222,106,10 CONTROL "Use Rufus MBR with BIOS ID:",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,13,248,106,10
PUSHBUTTON "",IDC_ADVANCED,63,148,14,10,BS_TOP | BS_FLAT PUSHBUTTON "",IDC_ADVANCED,63,148,14,10,BS_TOP | BS_FLAT
GROUPBOX "Advanced Options",IDC_ADVANCED_GROUP,7,210,192,42,NOT WS_VISIBLE GROUPBOX "Advanced Options",IDC_ADVANCED_GROUP,7,210,192,54,NOT WS_VISIBLE
COMBOBOX IDC_DISK_ID,119,220,73,30,CBS_DROPDOWNLIST | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_DISK_ID,119,246,73,30,CBS_DROPDOWNLIST | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
CONTROL "Add fixes for old BIOSes (extra partition, align, etc.)",IDC_EXTRA_PARTITION, CONTROL "Add fixes for old BIOSes (extra partition, align, etc.)",IDC_EXTRA_PARTITION,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,235,184,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,235,184,10
PUSHBUTTON "Log",IDC_LOG,62,278,18,14 CONTROL "List fixed (non-flash) or unpartitionned USB disks",IDC_ENABLE_FIXED_DISKS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,222,185,10
PUSHBUTTON "Log",IDC_LOG,62,291,18,14
END END
IDD_ABOUTBOX DIALOGEX 0, 0, 287, 201 IDD_ABOUTBOX DIALOGEX 0, 0, 287, 201
@ -98,15 +100,15 @@ BEGIN
EDITTEXT IDC_LICENSE_TEXT,7,7,321,176,ES_MULTILINE | ES_READONLY | WS_VSCROLL EDITTEXT IDC_LICENSE_TEXT,7,7,321,176,ES_MULTILINE | ES_READONLY | WS_VSCROLL
END END
IDD_LOG DIALOGEX 0, 0, 366, 280 IDD_LOG DIALOGEX 0, 0, 366, 329
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION
CAPTION "Log" CAPTION "Log"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
EDITTEXT IDC_LOG_EDIT,0,0,366,252,ES_MULTILINE | ES_READONLY | NOT WS_BORDER | WS_VSCROLL,WS_EX_STATICEDGE EDITTEXT IDC_LOG_EDIT,0,0,366,301,ES_MULTILINE | ES_READONLY | NOT WS_BORDER | WS_VSCROLL,WS_EX_STATICEDGE
PUSHBUTTON "Clear Log",IDC_LOG_CLEAR,198,259,50,14 PUSHBUTTON "Clear Log",IDC_LOG_CLEAR,198,308,50,14
PUSHBUTTON "Save Log",IDC_LOG_SAVE,253,259,50,14 PUSHBUTTON "Save Log",IDC_LOG_SAVE,253,308,50,14
DEFPUSHBUTTON "Close Log",IDCANCEL,308,259,50,14 DEFPUSHBUTTON "Close Log",IDCANCEL,308,308,50,14
END END
IDD_NOTIFICATION DIALOGEX 0, 0, 263, 63 IDD_NOTIFICATION DIALOGEX 0, 0, 263, 63
@ -274,8 +276,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,3,244 FILEVERSION 1,3,3,245
PRODUCTVERSION 1,3,3,244 PRODUCTVERSION 1,3,3,245
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -292,13 +294,13 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.3.3.244" VALUE "FileVersion", "1.3.3.245"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "(c) 2011-2013 Pete Batard (GPL v3)" VALUE "LegalCopyright", "(c) 2011-2013 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.3.3.244" VALUE "ProductVersion", "1.3.3.245"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"