[ui] fix disabling of Quick Format checkbox

* Closes #1211
* Also fix MBR analysis report displayed each time the user changes boot selection
This commit is contained in:
Pete Batard 2018-10-03 19:14:40 +02:00
parent 204908f8e0
commit 790b188b3d
6 changed files with 30 additions and 28 deletions

View file

@ -687,17 +687,18 @@ static void EnableQuickFormat(BOOL enable)
// Disable/restore the quick format control depending on large FAT32 or ReFS
if (((fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32))) || (fs == FS_REFS)) {
if (IsWindowEnabled(hCtrl)) {
uQFChecked = IsChecked(IDC_QUICK_FORMAT);
CheckDlgButton(hMainDialog, IDC_QUICK_FORMAT, BST_CHECKED);
EnableWindow(hCtrl, FALSE);
}
} else {
if (!IsWindowEnabled(hCtrl)) {
CheckDlgButton(hMainDialog, IDC_QUICK_FORMAT, uQFChecked);
EnableWindow(hCtrl, enable);
}
enable = FALSE;
}
if (IsWindowEnabled(hCtrl) && !enable) {
uQFChecked = IsChecked(IDC_QUICK_FORMAT);
CheckDlgButton(hMainDialog, IDC_QUICK_FORMAT, BST_CHECKED);
} else if (!IsWindowEnabled(hCtrl) && enable) {
CheckDlgButton(hMainDialog, IDC_QUICK_FORMAT, uQFChecked);
}
// Now enable or disable the control
EnableWindow(hCtrl, enable);
}
static void EnableBootOptions(BOOL enable, BOOL remove_checkboxes)
@ -2106,9 +2107,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
if ((HIWORD(wParam) != CBN_SELCHANGE) && (HIWORD(wParam) != CBN_SELCHANGE_INTERNAL))
break;
set_selected_fs = (HIWORD(wParam) == CBN_SELCHANGE);
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
fs = IsWindowEnabled(hFileSystem) ? (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)) : -1;
SetClusterSizes(fs);
EnableQuickFormat(TRUE);
if (fs < 0) {
EnableBootOptions(TRUE, TRUE);
SetMBRProps();
@ -2119,9 +2119,11 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, 1));
}
break;
} else if (set_selected_fs) {
} else {
EnableQuickFormat(TRUE);
// Try to keep track of user selection
selected_fs = fs;
if (set_selected_fs)
selected_fs = fs;
}
EnableMBRBootOptions(TRUE, FALSE);
SetMBRProps();