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

[ui] ui improvements

* fixed DOS selected on init for exFAT and NTFS in certain cases
* improved progress and status reports
* other minor improvements
This commit is contained in:
Pete Batard 2011-12-09 12:57:32 +00:00
parent 17132c35a4
commit e78f07cda6
6 changed files with 39 additions and 40 deletions

1
TODO
View file

@ -1,5 +1,4 @@
o create a report file with failed block details when bad blocks are found
o progress bar during quick format / partitioning / MS-DOS files copy
o use the umount/remount trick to make the volume reappear post formatting
o set keyboard according to locale in DOS
o allow selection of one of the existing compatible volume (keep existing MBR) / full repartitioning (overwrite MBR)

View file

@ -361,9 +361,8 @@ static void print_status(void)
percent = calc_percent((unsigned long) currently_testing,
(unsigned long) num_blocks);
percent = (percent/2.0f) + ((cur_op==OP_READ)? 50.0f : 0.0f);
PrintStatus(0, "BB PASS %d/%d(%c): %0.2f%% done. (%d/%d/%d errors)",
PrintStatus(0, "Bad Blocks: PASS %d/%d - %0.2f%% (%d/%d/%d errors)",
cur_pattern, nr_pattern,
(cur_op==OP_READ)?'R':'W',
percent,
num_read_errors,
num_write_errors,
@ -393,8 +392,8 @@ static void pattern_fill(unsigned char *buffer, unsigned int pattern,
for (ptr = buffer; ptr < buffer + n; ptr++) {
(*ptr) = rand() % (1 << (8 * sizeof(char)));
}
PrintStatus(3500, "Testing with random pattern: ");
uprintf("Testing with random pattern: ");
PrintStatus(3500, "Bad Blocks: Testing with random pattern.");
uprintf("Bad Blocks: Testing with random pattern.");
} else {
bpattern[0] = 0;
for (i = 0; i < sizeof(bpattern); i++) {
@ -411,8 +410,8 @@ static void pattern_fill(unsigned char *buffer, unsigned int pattern,
else
i--;
}
PrintStatus(3500, "Testing with pattern 0x%02X", bpattern[i]);
uprintf("Testing with pattern 0x%02X", bpattern[i]);
PrintStatus(3500, "Bad Blocks: Testing with pattern 0x%02X.", bpattern[i]);
uprintf("Bad Blocks: Testing with pattern 0x%02X.", bpattern[i]);
cur_pattern++;
}
}

View file

@ -47,7 +47,8 @@ badblocks_report report;
static float format_percent = 0.0f;
static int task_number = 0;
/* Number of steps for each FS for FCC_STRUCTURE_PROGRESS */
const int nb_steps[FS_MAX] = { 4, 4, 11, 9 };
const int nb_steps[FS_MAX] = { 5, 5, 12, 10 };
static int fs_index = 0;
/*
* FormatEx callback. Return FALSE to halt operations
@ -62,30 +63,30 @@ static BOOLEAN __stdcall FormatExCallback(FILE_SYSTEM_CALLBACK_COMMAND Command,
case FCC_PROGRESS:
// TODO: send this percentage to the status bar
percent = (DWORD*)pData;
uprintf("%d percent completed.\n", *percent);
format_percent = 1.0f * (*percent);
UpdateProgress(OP_FORMAT_LONG, format_percent);
PrintStatus(0, "Formatting: %d%% completed.\n", *percent);
// uprintf("%d percent completed.\n", *percent);
UpdateProgress(OP_FORMAT, 1.0f * (*percent));
break;
case FCC_STRUCTURE_PROGRESS: // No progress on quick format
uprintf("Format task %d/%d completed.\n", ++task_number,
nb_steps[ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))]);
// TODO: figure out likely values
format_percent += 100.0f / (1.0f * nb_steps[ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))]);
UpdateProgress(OP_FORMAT_QUICK, format_percent);
PrintStatus(0, "Creating file system: Task %d/%d completed.\n", ++task_number, nb_steps[fs_index]);
uprintf("Create FS: Task %d/%d completed.\n", task_number, nb_steps[fs_index]);
format_percent += 100.0f / (1.0f * nb_steps[fs_index]);
UpdateProgress(OP_CREATE_FS, format_percent);
break;
case FCC_DONE:
PrintStatus(0, "Creating file system: Task %d/%d completed.\n", nb_steps[fs_index], nb_steps[fs_index]);
uprintf("Create FS: Task %d/%d completed.\n", nb_steps[fs_index], nb_steps[fs_index]);
UpdateProgress(OP_CREATE_FS, 100.0f);
if(*(BOOLEAN*)pData == FALSE) {
uprintf("Error while formatting.\n");
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_GEN_FAILURE;
}
UpdateProgress(OP_FORMAT_DONE, 100.0f);
break;
case FCC_DONE_WITH_STRUCTURE: // We get this message when formatting Small FAT16
// pData Seems to be a struct with at least one (32 BIT!!!) string pointer to the size in MB
uprintf("Done with that sort of things: Action=%d pData=%0p\n", Action, pData);
DumpBufferHex(pData, 8);
uprintf("Volume size: %s MB\n", (char*)(LONG_PTR)(*(ULONG32*)pData));
UpdateProgress(OP_FORMAT_DONE, 100.0f);
break;
case FCC_INCOMPATIBLE_FILE_SYSTEM:
uprintf("Incompatible File System\n");
@ -163,6 +164,7 @@ static BOOL FormatDrive(char DriveLetter)
uprintf("Using cluster size: %d bytes\n", ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize)));
format_percent = 0.0f;
task_number = 0;
fs_index = ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
pfFormatEx(wDriveRoot, SelectedDrive.Geometry.MediaType, wFSType, wLabel,
IsChecked(IDC_QUICKFORMAT), (ULONG)ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize)),
FormatExCallback);

View file

@ -558,7 +558,8 @@ static BOOL GetUSBDevices(void)
}
IGNORE_RETVAL(ComboBox_SetCurSel(hDeviceList, 0));
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_DEVICE, 0);
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM,
ComboBox_GetCurSel(hFileSystem));
return TRUE;
}
@ -584,11 +585,10 @@ static void InitProgress(void)
}
nb_slots[OP_PARTITION] = 1;
nb_slots[OP_FIX_MBR] = 1;
nb_slots[OP_FORMAT_QUICK] =
nb_slots[OP_CREATE_FS] =
nb_steps[ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))];
nb_slots[OP_FORMAT_DONE] = 1;
if (!IsChecked(IDC_QUICKFORMAT)) {
nb_slots[OP_FORMAT_LONG] = -1;
nb_slots[OP_FORMAT] = -1;
}
for (i=0; i<OP_MAX; i++) {
@ -866,14 +866,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
KillTimer(hMainDialog, TID_APP_TIMER);
// Close the cancel MessageBox if active
SendMessage(FindWindowA(MAKEINTRESOURCEA(32770), RUFUS_CANCELBOX_TITLE), WM_COMMAND, IDNO, 0);
if (FormatStatus) {
SendMessage(hProgress, PBM_SETPOS, 0, 0);
} else {
// This is the only way to achieve instantenous progress transition
SendMessage(hProgress, PBM_SETRANGE, 0, (MAX_PROGRESS+1)<<16);
SendMessage(hProgress, PBM_SETPOS, (MAX_PROGRESS+1), 0);
SendMessage(hProgress, PBM_SETRANGE, 0, MAX_PROGRESS<<16);
}
EnableControls(TRUE);
GetUSBDevices();
if (!IS_ERROR(FormatStatus)) {
@ -885,6 +877,14 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
PrintStatus(0, "FAILED");
Notification(MSG_ERROR, "Error", "Error: %s", StrError(FormatStatus));
}
if (FormatStatus) {
SendMessage(hProgress, PBM_SETPOS, 0, 0);
} else {
// This is the only way to achieve instantenous progress transition
SendMessage(hProgress, PBM_SETRANGE, 0, (MAX_PROGRESS+1)<<16);
SendMessage(hProgress, PBM_SETPOS, (MAX_PROGRESS+1), 0);
SendMessage(hProgress, PBM_SETRANGE, 0, MAX_PROGRESS<<16);
}
return (INT_PTR)TRUE;
}
return (INT_PTR)FALSE;

View file

@ -94,9 +94,8 @@ enum action_type {
OP_BADBLOCKS,
OP_ZERO_MBR,
OP_PARTITION,
OP_FORMAT_LONG,
OP_FORMAT_QUICK,
OP_FORMAT_DONE,
OP_FORMAT,
OP_CREATE_FS,
OP_FIX_MBR,
OP_DOS,
OP_MAX

View file

@ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 278
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Rufus v1.0.2.85 (Beta)"
CAPTION "Rufus v1.0.2.86 (Beta)"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,236,50,14
@ -47,7 +47,7 @@ BEGIN
GROUPBOX "Format Options",IDC_STATIC,7,149,189,52
EDITTEXT IDC_LABEL,7,131,190,13,ES_AUTOHSCROLL
CONTROL "&Quick Format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,58,10
CONTROL "Create an &MS-DOS startup disk",IDC_DOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,173,115,10
CONTROL "Create a &DOS bootable disk",IDC_DOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,173,115,10
LTEXT "New volume &label",IDC_STATIC,9,121,105,10
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,210,189,9
CONTROL "Check device for bad blocks",IDC_BADBLOCKS,
@ -65,7 +65,7 @@ BEGIN
DEFPUSHBUTTON "OK",IDOK,231,175,50,14,WS_GROUP
CONTROL "<a href=""https://github.com/pbatard/rufus/wiki/Rufus"">https://github.com/pbatard/rufus</a>",IDC_ABOUT_RUFUS_URL,
"SysLink",WS_TABSTOP,46,47,114,9
LTEXT "Version 1.0.2 (Build 85)",IDC_STATIC,46,19,78,8
LTEXT "Version 1.0.2 (Build 86)",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
@ -164,8 +164,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,2,85
PRODUCTVERSION 1,0,2,85
FILEVERSION 1,0,2,86
PRODUCTVERSION 1,0,2,86
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -182,13 +182,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "akeo.ie"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.0.2.85"
VALUE "FileVersion", "1.0.2.86"
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.0.2.85"
VALUE "ProductVersion", "1.0.2.86"
END
END
BLOCK "VarFileInfo"