Commit 70937bd8 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

user32: Add support for legacy access keys.

parent ebd18109
......@@ -773,15 +773,18 @@ static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU hmenu,
if( !forceMenuChar )
{
UINT i;
BOOL cjk = GetSystemMetrics( SM_DBCSENABLED );
for (i = 0; i < menu->nItems; i++, item++)
{
if( item->text)
{
WCHAR *p = item->text - 2;
const WCHAR *p = item->text - 2;
do
{
p = strchrW (p + 2, '&');
const WCHAR *q = p + 2;
p = strchrW (q, '&');
if (!p && cjk) p = strchrW (q, '\036'); /* Japanese Win16 */
}
while (p != NULL && p [1] == '&');
if (p && (toupperW(p[1]) == toupperW(key))) return i;
......
......@@ -87,6 +87,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(text);
#define CR 13
#define SPACE 32
#define PREFIX 38
#define ALPHA_PREFIX 30 /* Win16: Alphabet prefix */
#define KANA_PREFIX 31 /* Win16: Katakana prefix */
#define FORWARD_SLASH '/'
#define BACK_SLASH '\\'
......@@ -472,8 +474,9 @@ static void TEXT_SkipChars (int *new_count, const WCHAR **new_str,
max -= n;
while (n--)
{
if (*start_str++ == PREFIX && max--)
if ((*start_str == PREFIX || *start_str == ALPHA_PREFIX) && max--)
start_str++;
start_str++;
}
start_count -= (start_str - str_on_entry);
}
......@@ -507,10 +510,10 @@ static int TEXT_Reprefix (const WCHAR *str, unsigned int ns,
const ellipsis_data *pe)
{
int result = -1;
unsigned int i = 0;
unsigned int i;
unsigned int n = pe->before + pe->under + pe->after;
assert (n <= ns);
while (i < n)
for (i = 0; i < n; i++, str++)
{
if (i == pe->before)
{
......@@ -523,16 +526,15 @@ static int TEXT_Reprefix (const WCHAR *str, unsigned int ns,
}
if (!ns) break;
ns--;
if (*str++ == PREFIX)
if (*str == PREFIX || *str == ALPHA_PREFIX)
{
str++;
if (!ns) break;
if (*str != PREFIX)
result = (i < pe->before || pe->under == 0) ? i : i - pe->under + pe->len;
/* pe->len may be non-zero while pe_under is zero */
str++;
ns--;
}
i++;
}
return result;
}
......@@ -631,8 +633,13 @@ static const WCHAR *TEXT_NextLineW( HDC hdc, const WCHAR *str, int *count,
(str[i] != TAB || !(format & DT_EXPANDTABS)) &&
((str[i] != CR && str[i] != LF) || (format & DT_SINGLELINE)))
{
if (str[i] == PREFIX && !(format & DT_NOPREFIX) && *count > 1)
if ((format & DT_NOPREFIX) || *count <= 1)
{
(*count)--; if (j < maxl) dest[j++] = str[i++]; else i++;
continue;
}
if (str[i] == PREFIX || str[i] == ALPHA_PREFIX) {
(*count)--, i++; /* Throw away the prefix itself */
if (str[i] == PREFIX)
{
......@@ -648,6 +655,12 @@ static const WCHAR *TEXT_NextLineW( HDC hdc, const WCHAR *str, int *count,
* one.
*/
}
else if (str[i] == KANA_PREFIX)
{
/* Throw away katakana access keys */
(*count)--, i++; /* skip the prefix */
(*count)--, i++; /* skip the letter */
}
else
{
(*count)--; if (j < maxl) dest[j++] = str[i++]; else i++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment