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

[ui] fix missing labels for accessibility

* Closes #1467
* Also ensure that previous element is set when repositioning a
  control to preserve tabbing order
* Also fix x64 version being able to download x86 BETA
This commit is contained in:
Pete Batard 2020-07-02 22:55:01 +01:00
parent 2d6a73e4f4
commit 0dc13e5283
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
9 changed files with 77 additions and 24 deletions

View file

@ -12,6 +12,14 @@ o v3.*
- *NEW* MSG_309 "Compressed archive"
// TODO: Add a test ISO for this.
- *NEW* MSG_310 "The ISO you have selected uses UEFI and is small enough to be written as (...)"
- *NEW* MSG_311 "Use %s in the main application window to enable."
- *NEW* MSG_312 "Extra hashes (SHA512)"
// The following are accessibility labels for some UI elements
- *NEW* MSG_313 "Save to VHD"
- *NEW* MSG_314 "Compute image checksums"
- *NEW* MSG_315 "Multiple buttons"
- *NEW* MSG_316 "Number of passes"
- *NEW* MSG_317 "Disk ID"
o v3.5 (2019.03.12)
The following 3 messages can be tested by creating a UEFI:NTFS drive in Rufus ('Show advanced drive properties' must be enabled

View file

@ -572,6 +572,11 @@ t MSG_310 "The ISO you have selected uses UEFI and is small enough to be written
"for some types of installations.\n\nPlease select the mode that you want to use to write this image:"
t MSG_311 "Use %s in the main application window to enable."
t MSG_312 "Extra hashes (SHA512)"
t MSG_313 "Save to VHD"
t MSG_314 "Compute image checksums"
t MSG_315 "Multiple buttons"
t MSG_316 "Number of passes"
t MSG_317 "Disk ID"
#########################################################################
l "ar-SA" "Arabic (العربية)" 0x0401, 0x0801, 0x0c01, 0x1001, 0x1401, 0x1801, 0x1c01, 0x2001, 0x2401, 0x2801, 0x2c01, 0x3001, 0x3401, 0x3801, 0x3c01, 0x4001

View file

@ -1082,7 +1082,6 @@ DWORD WINAPI IndividualSumThread(void* param)
{
SUM_CONTEXT sum_ctx = { {0} }; // There's a memset in sum_init, but static analyzers still bug us
uint32_t i = (uint32_t)(uintptr_t)param, j;
char val[3] = { 0 };
sum_init[i](&sum_ctx);
// Signal that we're ready to service requests

View file

@ -1614,6 +1614,10 @@ static void InitDialog(HWND hDlg)
GetHalfDropwdownWidth(hDlg);
GetFullWidth(hDlg);
// Set some missing labels
SetAccessibleName(hNBPasses, lmprintf(MSG_316));
SetAccessibleName(hDiskID, lmprintf(MSG_317));
// Create the font and brush for the progress messages
hInfoFont = CreateFontA(lfHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
0, 0, PROOF_QUALITY, 0, "Segoe UI");

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.12.1685"
CAPTION "Rufus 3.12.1686"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -397,8 +397,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,12,1685,0
PRODUCTVERSION 3,12,1685,0
FILEVERSION 3,12,1686,0
PRODUCTVERSION 3,12,1686,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -416,13 +416,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.12.1685"
VALUE "FileVersion", "3.12.1686"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.12.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.12.1685"
VALUE "ProductVersion", "3.12.1686"
END
END
BLOCK "VarFileInfo"

View file

@ -64,11 +64,12 @@ HWND hFidoDlg = NULL;
BOOL close_fido_cookie_prompts = FALSE;
static int update_settings_reposition_ids[] = {
IDI_ICON,
IDC_POLICY,
IDS_UPDATE_SETTINGS_GRP,
IDS_UPDATE_FREQUENCY_TXT,
IDS_INCLUDE_BETAS_TXT,
IDC_UPDATE_FREQUENCY,
IDS_INCLUDE_BETAS_TXT,
IDC_INCLUDE_BETAS,
IDS_CHECK_NOW_GRP,
IDC_CHECK_NOW,
@ -1312,15 +1313,16 @@ BOOL SetTaskbarProgressValue(ULONGLONG ullCompleted, ULONGLONG ullTotal)
return !FAILED(ITaskbarList3_SetProgressValue(ptbl, hMainDialog, ullCompleted, ullTotal));
}
static void Reposition(HWND hDlg, int id, int dx, int dw)
static void Reposition(HWND hDlg, int id, int prev_id, int dx, int dw)
{
HWND hCtrl;
HWND hCtrl, hPrevCtrl;
RECT rc;
hCtrl = GetDlgItem(hDlg, id);
hPrevCtrl = (prev_id > 0) ? GetDlgItem(hDlg, prev_id) : HWND_TOP;
GetWindowRect(hCtrl, &rc);
MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2);
SetWindowPos(hCtrl, HWND_TOP, rc.left + dx, rc.top, rc.right - rc.left + dw, rc.bottom - rc.top, 0);
SetWindowPos(hCtrl, hPrevCtrl, rc.left + dx, rc.top, rc.right - rc.left + dw, rc.bottom - rc.top, 0);
}
static void PositionControls(HWND hDlg)
@ -1338,8 +1340,9 @@ static void PositionControls(HWND hDlg)
if (dw > 0) {
GetWindowRect(hDlg, &rc);
SetWindowPos(hDlg, NULL, -1, -1, rc.right - rc.left + dw, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER);
for (i = 0; i < ARRAYSIZE(update_settings_reposition_ids); i++)
Reposition(hDlg, update_settings_reposition_ids[i], (i < 4) ? 0 : dw, (i >= 4) ? 0 : dw);
for (i = 1; i < ARRAYSIZE(update_settings_reposition_ids); i++)
Reposition(hDlg, update_settings_reposition_ids[i], update_settings_reposition_ids[i-1],
((i < 5) && (i != 4)) ? 0 : dw, ((i >= 5) || (i == 4)) ? 0 : dw);
}
hCtrl = GetDlgItem(hDlg, IDC_UPDATE_FREQUENCY);
@ -1357,10 +1360,11 @@ static void PositionControls(HWND hDlg)
if (dw > 0) {
GetWindowRect(hDlg, &rc);
SetWindowPos(hDlg, NULL, -1, -1, rc.right - rc.left + dw, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER);
for (i = 0; i < ARRAYSIZE(update_settings_reposition_ids); i++) {
if ((i >= 2) && (i <= 3))
for (i = 1; i < ARRAYSIZE(update_settings_reposition_ids); i++) {
if ((i == 3) || (i == 5))
continue;
Reposition(hDlg, update_settings_reposition_ids[i], (i < 6) ? 0 : dw, (i >= 6) ? 0 : dw);
Reposition(hDlg, update_settings_reposition_ids[i], update_settings_reposition_ids[i-1],
(i < 7) ? 0 : dw, (i >= 7) ? 0 : dw);
}
}
@ -1372,10 +1376,10 @@ static void PositionControls(HWND hDlg)
if (dw > 0) {
GetWindowRect(hDlg, &rc);
SetWindowPos(hDlg, NULL, -1, -1, rc.right - rc.left + dw, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER);
for (i = 0; i < ARRAYSIZE(update_settings_reposition_ids); i++) {
if ((i >= 1) && (i <= 5))
for (i = 1; i < ARRAYSIZE(update_settings_reposition_ids); i++) {
if ((i >= 2) && (i <= 6))
continue;
Reposition(hDlg, update_settings_reposition_ids[i], 0, dw);
Reposition(hDlg, update_settings_reposition_ids[i], update_settings_reposition_ids[i-1], 0, dw);
}
}
hCtrl = GetDlgItem(hDlg, IDC_CHECK_NOW);
@ -1464,7 +1468,7 @@ INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
dy -= rsz->rc.bottom - rsz->rc.top + 6; // add the border
ResizeMoveCtrl(hDlg, hDlg, 0, 0, 0, -dy, 1.0f);
ResizeMoveCtrl(hDlg, hPolicy, 0, 0, 0, -dy, 1.0f);
for (i = 1; i < ARRAYSIZE(update_settings_reposition_ids); i++)
for (i = 2; i < ARRAYSIZE(update_settings_reposition_ids); i++)
ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, update_settings_reposition_ids[i]), 0, -dy, 0, 0, 1.0f);
}
break;
@ -1484,7 +1488,7 @@ INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
break;
freq = (int32_t)ComboBox_GetItemData(hFrequency, ComboBox_GetCurSel(hFrequency));
WriteSetting32(SETTING_UPDATE_INTERVAL, (DWORD)freq);
EnableWindow(hBeta, (freq >= 0));
EnableWindow(hBeta, (freq >= 0) && is_x86_32);
return (INT_PTR)TRUE;
case IDC_INCLUDE_BETAS:
if (HIWORD(wParam) != CBN_SELCHANGE)

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* UI-related function calls
* Copyright © 2018-2019 Pete Batard <pete@akeo.ie>
* Copyright © 2018-2020 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -28,6 +28,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <oleacc.h>
#include <winioctl.h>
#include <assert.h>
@ -54,6 +55,7 @@ static int rh, ddh, bw, hw, fw;
static int sw, mw, bsw, sbw, ssw, tw, dbw;
static WNDPROC progress_original_proc = NULL;
static wchar_t wtbtext[2][128];
static IAccPropServices* pfaps = NULL;
/*
* The following is used to allocate slots within the progress bar
@ -67,6 +69,21 @@ static int nb_slots[OP_MAX];
static float slot_end[OP_MAX+1]; // shifted +1 so that we can subtract 1 to OP indexes
static float previous_end;
void SetAccessibleName(HWND hCtrl, const char* name)
{
const MSAAPROPID props[] = { Name_Property_GUID };
wchar_t* wname = utf8_to_wchar(name);
SetWindowTextW(hCtrl, wname);
if (pfaps == NULL)
CoCreateInstance(&CLSID_AccPropServices, NULL, CLSCTX_INPROC, &IID_IAccPropServices, (LPVOID)&pfaps);
if (pfaps != NULL) {
IAccPropServices_ClearHwndProps(pfaps, hCtrl, OBJID_CLIENT, CHILDID_SELF, props, ARRAYSIZE(props));
IAccPropServices_SetHwndPropStr(pfaps, hCtrl, OBJID_CLIENT, CHILDID_SELF, Name_Property_GUID, wname);
}
free(wname);
}
// Set the combo selection according to the data
void SetComboEntry(HWND hDlg, int data)
{
@ -438,7 +455,7 @@ void PositionMainControls(HWND hDlg)
// Still need to adjust the width of the device selection dropdown
GetWindowRect(hDeviceList, &rc);
MapWindowPoints(NULL, hMainDialog, (POINT*)&rc, 2);
SetWindowPos(hDeviceList, HWND_TOP, rc.left, rc.top, fw - ssw - sbw, rc.bottom - rc.top, 0);
SetWindowPos(hDeviceList, GetDlgItem(hDlg, IDS_DEVICE_TXT), rc.left, rc.top, fw - ssw - sbw, rc.bottom - rc.top, 0);
}
// Resize the full width controls
@ -605,7 +622,7 @@ void ToggleAdvancedDeviceOptions(BOOL enable)
GetWindowRect(hDeviceList, &rc);
MapWindowPoints(NULL, hMainDialog, (POINT*)&rc, 2);
SetWindowPos(hDeviceList, HWND_TOP, rc.left, rc.top, enable ? fw - ssw - sbw : fw, rc.bottom - rc.top, 0);
SetWindowPos(hDeviceList, GetDlgItem(hMainDialog, IDS_DEVICE_TXT), rc.left, rc.top, enable ? fw - ssw - sbw : fw, rc.bottom - rc.top, 0);
// Resize the main dialog and log window
ResizeDialogs(shift);
@ -841,6 +858,7 @@ void CreateSmallButtons(HWND hDlg)
tbToolbarButtons[0].fsState = TBSTATE_ENABLED;
tbToolbarButtons[0].iBitmap = 0;
SendMessage(hSaveToolbar, TB_ADDBUTTONS, (WPARAM)1, (LPARAM)&tbToolbarButtons);
SetAccessibleName(hSaveToolbar, lmprintf(MSG_313));
hHashToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, TOOLBAR_STYLE,
0, 0, 0, 0, hMainDialog, (HMENU)IDC_HASH_TOOLBAR, hMainInstance, NULL);
@ -857,6 +875,7 @@ void CreateSmallButtons(HWND hDlg)
tbToolbarButtons[0].fsState = TBSTATE_ENABLED;
tbToolbarButtons[0].iBitmap = 0;
SendMessage(hHashToolbar, TB_ADDBUTTONS, (WPARAM)1, (LPARAM)&tbToolbarButtons);
SetAccessibleName(hHashToolbar, lmprintf(MSG_314));
}
static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam, LPARAM lParam)
@ -1058,6 +1077,7 @@ void CreateAdditionalControls(HWND hDlg)
if (sz.cx < 16)
sz.cx = fw;
SetWindowPos(hAdvancedDeviceToolbar, hTargetSystem, rc.left + toolbar_dx, rc.top, sz.cx, rc.bottom - rc.top, 0);
SetAccessibleName(hAdvancedDeviceToolbar, lmprintf(MSG_119));
utf8_to_wchar_no_alloc(lmprintf((advanced_mode_format) ? MSG_122 : MSG_121, lmprintf(MSG_120)), wtbtext[1], ARRAYSIZE(wtbtext[1]));
hAdvancedFormatToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, TOOLBAR_STYLE,
@ -1078,6 +1098,7 @@ void CreateAdditionalControls(HWND hDlg)
if (sz.cx < 16)
sz.cx = fw;
SetWindowPos(hAdvancedFormatToolbar, hClusterSize, rc.left + toolbar_dx, rc.top, sz.cx, rc.bottom - rc.top, 0);
SetAccessibleName(hAdvancedFormatToolbar, lmprintf(MSG_120));
// Create the multi toolbar
hMultiToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, TOOLBAR_STYLE,
@ -1126,6 +1147,7 @@ void CreateAdditionalControls(HWND hDlg)
tbToolbarButtons[6].iBitmap = 3;
SendMessage(hMultiToolbar, TB_ADDBUTTONS, (WPARAM)7, (LPARAM)&tbToolbarButtons);
SendMessage(hMultiToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(i16, ddbh));
SetAccessibleName(hMultiToolbar, lmprintf(MSG_315));
// Subclass the progress bar so that we can write on it
progress_original_proc = (WNDPROC)SetWindowLongPtr(hProgress, GWLP_WNDPROC, (LONG_PTR)ProgressCallback);

View file

@ -83,6 +83,7 @@ extern int advanced_device_section_height, advanced_format_section_height;
extern int windows_to_go_selection, persistence_unit_selection;
extern int selection_default, cbw, ddw, ddbh, bh, update_progress_type;
extern void SetAccessibleName(HWND hCtrl, const char* name);
extern void SetComboEntry(HWND hDlg, int data);
extern void GetBasicControlsWidth(HWND hDlg);
extern void GetMainButtonsWidth(HWND hDlg);

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* UI element lists
* Copyright © 2018 Pete Batard <pete@akeo.ie>
* Copyright © 2018-2020 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,6 +22,16 @@
#pragma once
// GUIDs needed to set a control's accessibility props
#if defined(_MSC_VER)
const GUID DECLSPEC_SELECTANY CLSID_AccPropServices =
{ 0xb5f8350b, 0x0548, 0x48b1, { 0xa6, 0xee, 0x88, 0xbd, 0x00, 0xb4, 0xa5, 0xe7 } };
#endif
const GUID DECLSPEC_SELECTANY Name_Property_GUID =
{ 0xc3a6921b, 0x4a99, 0x44f1, { 0xbc, 0xa6, 0x61, 0x18, 0x70, 0x52, 0xc4, 0x31 } };
const GUID DECLSPEC_SELECTANY HelpText_Property_GUID =
{ 0x08555685, 0x0977, 0x45c7, { 0xa7, 0xa6, 0xab, 0xaf, 0x56, 0x84, 0x12, 0x1a } };
static int section_control_ids[] = {
IDS_DRIVE_PROPERTIES_TXT,
IDS_FORMAT_OPTIONS_TXT,