diff options
Diffstat (limited to 'src/Format')
-rw-r--r-- | src/Format/Format.rc | 4 | ||||
-rw-r--r-- | src/Format/Resource.h | 3 | ||||
-rw-r--r-- | src/Format/Tcformat.c | 92 |
3 files changed, 77 insertions, 22 deletions
diff --git a/src/Format/Format.rc b/src/Format/Format.rc index 9584fe31..273cddcc 100644 --- a/src/Format/Format.rc +++ b/src/Format/Format.rc @@ -154,7 +154,8 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN COMBOBOX IDC_FILESYS,50,13,36,90,CBS_DROPDOWNLIST | WS_TABSTOP COMBOBOX IDC_CLUSTERSIZE,135,13,42,90,CBS_DROPDOWNLIST | WS_TABSTOP - CONTROL "Quick Format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,181,9,92,8 + COMBOBOX IDC_FORMAT_TYPE,181,8,93,131,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Dynamic",SPARSE_FILE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,181,22,92,8 CONTROL "",IDC_SHOW_KEYS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,265,38,9,8 PUSHBUTTON "Abort",IDC_ABORT_BUTTON,200,75,64,14 RTEXT "Header Key: ",IDT_HEADER_KEY,2,47,76,8 @@ -178,7 +179,6 @@ BEGIN CONTROL "",IDC_RANDOM_BYTES,"Static",SS_SIMPLE | WS_GROUP,83,38,177,8,WS_EX_TRANSPARENT GROUPBOX "Randomness Collected From Mouse Movements",IDT_ENTROPY_BAR,0,175,276,18 CONTROL "",IDC_ENTROPY_BAR,"msctls_progress32",WS_BORDER,20,184,235,6 - CONTROL "Dynamic",SPARSE_FILE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,181,21,92,8 END IDD_INTRO_PAGE_DLG DIALOGEX 0, 0, 276, 193 diff --git a/src/Format/Resource.h b/src/Format/Resource.h index c37a6f4a..d8fb8dc4 100644 --- a/src/Format/Resource.h +++ b/src/Format/Resource.h @@ -146,6 +146,7 @@ #define IDC_TB 1107 #define IDC_SKIP_RESCUE_VERIFICATION 1108 #define SPARSE_FILE 1109 +#define IDC_FORMAT_TYPE 1110 // Next default values for new objects // @@ -154,7 +155,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 134 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1110 +#define _APS_NEXT_CONTROL_VALUE 1111 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index efd95caf..9c8648a8 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -290,6 +290,7 @@ volatile BOOL quickFormat = FALSE; volatile BOOL fastCreateFile = FALSE; volatile BOOL dynamicFormat = FALSE; /* this variable represents the sparse file flag. */ volatile int fileSystem = FILESYS_NONE; +volatile int formatType = FORMAT_TYPE_FULL; volatile int clusterSize = 0; SYSENC_MULTIBOOT_CFG SysEncMultiBootCfg; @@ -4961,6 +4962,18 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa else SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("FORMAT_TITLE")); + /* Fill the format type combobox */ + SendMessage (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), CB_RESETCONTENT, 0, 0); + EnableWindow (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), TRUE); + + AddComboPair (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), GetString("FULL_FORMAT"), FORMAT_TYPE_FULL); + AddComboPair (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), GetString("IDC_QUICKFORMAT"), FORMAT_TYPE_QUICK); + if (!bDevice) // Fast Create only makes sens for file containers + AddComboPair (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), GetString("FAST_CREATE"), FORMAT_TYPE_FAST); + SendMessage (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), CB_SETCURSEL, 0, 0); + + formatType = FORMAT_TYPE_FULL; + /* Quick/Dynamic */ if (bHiddenVol) @@ -4972,8 +4985,18 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SetCheckBox (hwndDlg, SPARSE_FILE, FALSE); EnableWindow (GetDlgItem (hwndDlg, SPARSE_FILE), FALSE); - SetCheckBox (hwndDlg, IDC_QUICKFORMAT, quickFormat); - EnableWindow (GetDlgItem (hwndDlg, IDC_QUICKFORMAT), bHiddenVolHost); + if (quickFormat) + { + formatType = FORMAT_TYPE_QUICK; + SelectAlgo (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), (int *) &formatType); + } + else if (!bDevice && fastCreateFile) + { + formatType = FORMAT_TYPE_FAST; + quickFormat = TRUE; + SelectAlgo (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), (int *) &formatType); + } + EnableWindow (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), bHiddenVolHost); } else { @@ -4983,7 +5006,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa bSparseFileSwitch = FALSE; SetCheckBox (hwndDlg, SPARSE_FILE, FALSE); EnableWindow (GetDlgItem (hwndDlg, SPARSE_FILE), FALSE); - EnableWindow (GetDlgItem (hwndDlg, IDC_QUICKFORMAT), TRUE); + EnableWindow (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), TRUE); } else { @@ -5004,8 +5027,15 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa dynamicFormat = FALSE; SetCheckBox (hwndDlg, SPARSE_FILE, FALSE); } + + if (fastCreateFile) + { + formatType = FORMAT_TYPE_FAST; + quickFormat = TRUE; + SelectAlgo (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), (int *) &formatType); + } EnableWindow (GetDlgItem (hwndDlg, SPARSE_FILE), bSparseFileSwitch); - EnableWindow (GetDlgItem (hwndDlg, IDC_QUICKFORMAT), TRUE); + EnableWindow (GetDlgItem (hwndDlg, IDC_FORMAT_TYPE), TRUE); } } @@ -5959,29 +5989,50 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa } - if (lw == IDC_QUICKFORMAT) + if (lw == IDC_FORMAT_TYPE && hw == CBN_SELCHANGE) { - if (IsButtonChecked (GetDlgItem (hCurPage, IDC_QUICKFORMAT))) + formatType = (int) SendMessage (GetDlgItem (hCurPage, IDC_FORMAT_TYPE), CB_GETITEMDATA, + SendMessage (GetDlgItem (hCurPage, IDC_FORMAT_TYPE), CB_GETCURSEL, 0, 0) , 0); + + if (formatType == FORMAT_TYPE_QUICK) { if (AskWarnYesNo("WARN_QUICK_FORMAT", MainDlg) == IDNO) - SetCheckBox (hwndDlg, IDC_QUICKFORMAT, FALSE); + { + formatType = FORMAT_TYPE_FULL; + SelectAlgo(GetDlgItem (hCurPage, IDC_FORMAT_TYPE), (int *) &formatType); + } } - else if (IsButtonChecked (GetDlgItem (hCurPage, SPARSE_FILE))) + else if (formatType == FORMAT_TYPE_FAST) { - /* sparse file require quick format */ - SetCheckBox (hwndDlg, SPARSE_FILE, FALSE); + if (AskWarnYesNo("WARN_FAST_CREATE", MainDlg) == IDNO) + { + formatType = FORMAT_TYPE_FULL; + SelectAlgo(GetDlgItem (hCurPage, IDC_FORMAT_TYPE), (int *) &formatType); + } } + return 1; } - if (lw == SPARSE_FILE && IsButtonChecked (GetDlgItem (hCurPage, SPARSE_FILE))) + if (lw == SPARSE_FILE) { - if (AskWarnYesNo("CONFIRM_SPARSE_FILE", MainDlg) == IDNO) - SetCheckBox (hwndDlg, SPARSE_FILE, FALSE); - else if (!IsButtonChecked (GetDlgItem (hCurPage, IDC_QUICKFORMAT)) && IsWindowEnabled (GetDlgItem (hCurPage, IDC_QUICKFORMAT))) + if (IsButtonChecked (GetDlgItem (hCurPage, SPARSE_FILE))) + { + if (AskWarnYesNo("CONFIRM_SPARSE_FILE", MainDlg) == IDNO) + SetCheckBox (hwndDlg, SPARSE_FILE, FALSE); + else + { + /* sparse file require quick format */ + formatType = FORMAT_TYPE_QUICK; + SelectAlgo(GetDlgItem (hCurPage, IDC_FORMAT_TYPE), (int *) &formatType); + EnableWindow(GetDlgItem (hCurPage, IDC_FORMAT_TYPE), FALSE); + } + } + else { - /* sparse file require quick format */ - SetCheckBox (hwndDlg, IDC_QUICKFORMAT, TRUE); + EnableWindow(GetDlgItem (hCurPage, IDC_FORMAT_TYPE), TRUE); + formatType = FORMAT_TYPE_FULL; + SelectAlgo(GetDlgItem (hCurPage, IDC_FORMAT_TYPE), (int *) &formatType); } return 1; } @@ -6896,7 +6947,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { // Format has been aborted (did not finish) - EnableWindow (GetDlgItem (hCurPage, IDC_QUICKFORMAT), !(bHiddenVol && !bHiddenVolHost)); + EnableWindow (GetDlgItem (hCurPage, IDC_FORMAT_TYPE), !(bHiddenVol && !bHiddenVolHost)); EnableWindow (GetDlgItem (hCurPage, SPARSE_FILE), (bSparseFileSwitch) && !(bHiddenVol && !bHiddenVolHost)); EnableWindow (GetDlgItem (hCurPage, IDC_FILESYS), TRUE); EnableWindow (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), TRUE); @@ -8496,7 +8547,10 @@ retryCDDriveCheck: clusterSize = (int) SendMessage (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), CB_GETITEMDATA, SendMessage (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), CB_GETCURSEL, 0, 0) , 0); - quickFormat = IsButtonChecked (GetDlgItem (hCurPage, IDC_QUICKFORMAT)); + formatType = (int) SendMessage (GetDlgItem (hCurPage, IDC_FORMAT_TYPE), CB_GETITEMDATA, + SendMessage (GetDlgItem (hCurPage, IDC_FORMAT_TYPE), CB_GETCURSEL, 0, 0) , 0); + quickFormat = (formatType == FORMAT_TYPE_QUICK) || (formatType == FORMAT_TYPE_FAST); + fastCreateFile = (formatType == FORMAT_TYPE_FAST); dynamicFormat = IsButtonChecked (GetDlgItem (hCurPage, SPARSE_FILE)); if (!dynamicFormat && !bDevice && !(bHiddenVol && !bHiddenVolHost) && (nVolumeSize > (ULONGLONG) nAvailableFreeSpace)) @@ -8595,7 +8649,7 @@ retryCDDriveCheck: EnableWindow (GetDlgItem (hwndDlg, IDC_NEXT), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDHELP), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDCANCEL), FALSE); - EnableWindow (GetDlgItem (hCurPage, IDC_QUICKFORMAT), FALSE); + EnableWindow (GetDlgItem (hCurPage, IDC_FORMAT_TYPE), FALSE); EnableWindow (GetDlgItem (hCurPage, SPARSE_FILE), FALSE); EnableWindow (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), FALSE); EnableWindow (GetDlgItem (hCurPage, IDC_FILESYS), FALSE); |