mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-27 13:14:26 -04:00
[ui] fix keyboard accessibility
* The tab and arrow keys can now be used to navigate around the various dialogs. * This should fix part of #243 * Closes #491
This commit is contained in:
parent
5669c3c885
commit
629cfa68ad
2 changed files with 48 additions and 38 deletions
38
src/rufus.c
38
src/rufus.c
|
@ -144,7 +144,7 @@ StrArray DriveID, DriveLabel;
|
|||
extern char* szStatusMessage;
|
||||
|
||||
static HANDLE format_thid = NULL;
|
||||
static HWND hBoot = NULL, hSelectISO = NULL;
|
||||
static HWND hBoot = NULL, hSelectISO = NULL, hStart = NULL;
|
||||
static HICON hIconDisc, hIconDown, hIconUp, hIconLang;
|
||||
static char szTimer[12] = "00:00:00";
|
||||
static unsigned int timer;
|
||||
|
@ -451,7 +451,7 @@ static BOOL SetDriveInfo(int ComboIndex)
|
|||
}
|
||||
|
||||
// At least one filesystem is go => enable formatting
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_START), TRUE);
|
||||
EnableWindow(hStart, TRUE);
|
||||
|
||||
return SetClusterSizes((int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)));
|
||||
}
|
||||
|
@ -609,7 +609,7 @@ static BOOL PopulateProperties(int ComboIndex)
|
|||
IGNORE_RETVAL(ComboBox_ResetContent(hPartitionScheme));
|
||||
IGNORE_RETVAL(ComboBox_ResetContent(hFileSystem));
|
||||
IGNORE_RETVAL(ComboBox_ResetContent(hClusterSize));
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_START), FALSE);
|
||||
EnableWindow(hStart, FALSE);
|
||||
SetWindowTextA(hLabel, "");
|
||||
memset(&SelectedDrive, 0, sizeof(SelectedDrive));
|
||||
|
||||
|
@ -782,7 +782,7 @@ void UpdateProgress(int op, float percent)
|
|||
static void EnableControls(BOOL bEnable)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_DEVICE), bEnable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_START), (ComboBox_GetCurSel(hDeviceList)<0)?FALSE:bEnable);
|
||||
EnableWindow(hStart, (ComboBox_GetCurSel(hDeviceList)<0)?FALSE:bEnable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_ABOUT), bEnable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_BADBLOCKS), bEnable);
|
||||
EnableBootOptions(bEnable, FALSE);
|
||||
|
@ -826,7 +826,9 @@ BOOL CALLBACK LogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
hf = CreateFontA(lfHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
|
||||
DEFAULT_CHARSET, 0, 0, PROOF_QUALITY, 0, "Arial Unicode MS");
|
||||
SendDlgItemMessageA(hDlg, IDC_LOG_EDIT, WM_SETFONT, (WPARAM)hf, TRUE);
|
||||
return TRUE;
|
||||
// Set 'Close Log' as the selected button
|
||||
SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hDlg, IDCANCEL), TRUE);
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDCANCEL:
|
||||
|
@ -1020,9 +1022,9 @@ DWORD WINAPI ISOScanThread(LPVOID param)
|
|||
for (i=(int)safe_strlen(image_path); (i>0)&&(image_path[i]!='\\'); i--);
|
||||
PrintStatusDebug(0, MSG_205, &image_path[i+1]);
|
||||
// Lose the focus on the select ISO (but place it on Close)
|
||||
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0);
|
||||
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0);
|
||||
// Lose the focus from Close and set it back to Start
|
||||
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hMainDialog, IDC_START), TRUE);
|
||||
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)hStart, TRUE);
|
||||
}
|
||||
|
||||
// Need to invalidate as we may have changed the UI and may get artifacts if we don't
|
||||
|
@ -1584,6 +1586,7 @@ void InitDialog(HWND hDlg)
|
|||
hSelectISO = GetDlgItem(hDlg, IDC_SELECT_ISO);
|
||||
hNBPasses = GetDlgItem(hDlg, IDC_NBPASSES);
|
||||
hDiskID = GetDlgItem(hDlg, IDC_DISK_ID);
|
||||
hStart = GetDlgItem(hDlg, IDC_START);
|
||||
|
||||
// High DPI scaling
|
||||
i16 = GetSystemMetrics(SM_CXSMICON);
|
||||
|
@ -1702,7 +1705,7 @@ void InitDialog(HWND hDlg)
|
|||
|
||||
// Create the language toolbar
|
||||
// NB: We don't make it a tabstop as it would become the default selected button otherwise
|
||||
hLangToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | TBSTYLE_TRANSPARENT | CCS_NOPARENTALIGN |
|
||||
hLangToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_TABSTOP | TBSTYLE_TRANSPARENT | CCS_NOPARENTALIGN |
|
||||
CCS_NORESIZE | CCS_NODIVIDER, 0, 0, 0, 0, hMainDialog, NULL, hMainInstance, NULL);
|
||||
if ((pfImageList_Create != NULL) && (pfImageList_AddIcon != NULL)) {
|
||||
hLangToolbarImageList = pfImageList_Create(i16, i16, ILC_COLOR32, 1, 0);
|
||||
|
@ -1778,7 +1781,7 @@ void InitDialog(HWND hDlg)
|
|||
CreateTooltip(hDiskID, lmprintf(MSG_168), 10000);
|
||||
CreateTooltip(GetDlgItem(hDlg, IDC_EXTRA_PARTITION), lmprintf(MSG_169), -1);
|
||||
CreateTooltip(GetDlgItem(hDlg, IDC_ENABLE_FIXED_DISKS), lmprintf(MSG_170), -1);
|
||||
CreateTooltip(GetDlgItem(hDlg, IDC_START), lmprintf(MSG_171), -1);
|
||||
CreateTooltip(hStart, lmprintf(MSG_171), -1);
|
||||
CreateTooltip(GetDlgItem(hDlg, IDC_ABOUT), lmprintf(MSG_172), -1);
|
||||
CreateTooltip(GetDlgItem(hDlg, IDC_WINDOWS_INSTALL), lmprintf(MSG_199), -1);
|
||||
CreateTooltip(GetDlgItem(hDlg, IDC_WINDOWS_TO_GO), lmprintf(MSG_200), -1);
|
||||
|
@ -1971,12 +1974,15 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
SetWindowPos(hMainDialog, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
|
||||
SetWindowPos(hMainDialog, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
|
||||
|
||||
// Set 'Start' as the selected button if it's enabled, otherwise use 'Select ISO', instead
|
||||
SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)(IsWindowEnabled(hStart) ? hStart : hSelectISO), TRUE);
|
||||
|
||||
#if defined(ALPHA)
|
||||
// Add a VERY ANNOYING popup for Alpha releases, so that people don't start redistributing them
|
||||
Notification(MSG_INFO, NULL, "ALPHA VERSION", "This is an Alpha version of " APPLICATION_NAME
|
||||
" - It is meant to be used for testing ONLY and should NOT be distributed as a release.");
|
||||
#endif
|
||||
return (INT_PTR)TRUE;
|
||||
return (INT_PTR)FALSE;
|
||||
|
||||
// The things one must do to get an ellipsis on the status bar...
|
||||
case WM_DRAWITEM:
|
||||
|
@ -2085,7 +2091,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
log_displayed = !log_displayed;
|
||||
// Set focus on the start button
|
||||
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0);
|
||||
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hMainDialog, IDC_START), TRUE);
|
||||
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)hStart, TRUE);
|
||||
// Must come last for the log window to get focus
|
||||
ShowWindow(hLogDlg, log_displayed?SW_SHOW:SW_HIDE);
|
||||
break;
|
||||
|
@ -2259,7 +2265,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
}
|
||||
// Set focus on the start button
|
||||
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)FALSE, 0);
|
||||
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hMainDialog, IDC_START), TRUE);
|
||||
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)hStart, TRUE);
|
||||
// For non ISO, if the user manually set a label, try to preserve it
|
||||
if (!user_changed_label)
|
||||
SetWindowTextU(hLabel, SelectedDrive.proposed_label);
|
||||
|
@ -2927,8 +2933,12 @@ relaunch:
|
|||
SHDeleteDirectoryExU(NULL, tmp_path, FOF_SILENT | FOF_NOERRORUI | FOF_NOCONFIRMATION);
|
||||
continue;
|
||||
}
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
|
||||
// Let the system handle dialog messages (e.g. those from the tab key)
|
||||
if (!IsDialogMessage(hDlg, &msg) && !IsDialogMessage(hLogDlg, &msg)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
if (relaunch) {
|
||||
relaunch = FALSE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue