https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7e9f1e67f32544c0aa756…
commit 7e9f1e67f32544c0aa75616055bd63aa6554df67
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Nov 6 08:37:18 2022 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Nov 6 08:37:18 2022 +0900
[CHARMAP] Improve keyboard usability (#4839)
- Use IsDialogMessage function in message loop to enable Tab.
- Add WS_TABSTOP style to IDC_FONTCOMBO control.
- Set focus on create.
- Handle WM_KEYDOWN and WM_GETDLGCODE messages.
- Add UpdateCells, LimitCaretXY SetCaretXY, MoveUpDown, and MoveLeftRight helper
functions.
- Delete DrawGrid, and DrawActiveCell functions for simplicity.
- Add and delete some members in MAP structure.
CORE-13806
---
base/applications/charmap/charmap.c | 11 +-
base/applications/charmap/lang/bg-BG.rc | 2 +-
base/applications/charmap/lang/ca-ES.rc | 2 +-
base/applications/charmap/lang/cs-CZ.rc | 2 +-
base/applications/charmap/lang/de-DE.rc | 2 +-
base/applications/charmap/lang/el-GR.rc | 2 +-
base/applications/charmap/lang/en-US.rc | 2 +-
base/applications/charmap/lang/es-ES.rc | 2 +-
base/applications/charmap/lang/et-EE.rc | 2 +-
base/applications/charmap/lang/fr-FR.rc | 2 +-
base/applications/charmap/lang/he-IL.rc | 2 +-
base/applications/charmap/lang/id-ID.rc | 2 +-
base/applications/charmap/lang/it-IT.rc | 2 +-
base/applications/charmap/lang/ja-JP.rc | 2 +-
base/applications/charmap/lang/ko-KR.rc | 2 +-
base/applications/charmap/lang/lt-LT.rc | 2 +-
base/applications/charmap/lang/nl-NL.rc | 2 +-
base/applications/charmap/lang/no-NO.rc | 2 +-
base/applications/charmap/lang/pl-PL.rc | 2 +-
base/applications/charmap/lang/pt-BR.rc | 2 +-
base/applications/charmap/lang/ro-RO.rc | 2 +-
base/applications/charmap/lang/ru-RU.rc | 2 +-
base/applications/charmap/lang/sk-SK.rc | 2 +-
base/applications/charmap/lang/sq-AL.rc | 2 +-
base/applications/charmap/lang/sv-SE.rc | 2 +-
base/applications/charmap/lang/tr-TR.rc | 2 +-
base/applications/charmap/lang/uk-UA.rc | 2 +-
base/applications/charmap/lang/zh-CN.rc | 2 +-
base/applications/charmap/lang/zh-HK.rc | 2 +-
base/applications/charmap/lang/zh-TW.rc | 2 +-
base/applications/charmap/map.c | 603 +++++++++++++++++++-------------
base/applications/charmap/precomp.h | 4 +-
32 files changed, 407 insertions(+), 269 deletions(-)
diff --git a/base/applications/charmap/charmap.c b/base/applications/charmap/charmap.c
index 13ce8e2f1bc..6f30b3f0ec3 100644
--- a/base/applications/charmap/charmap.c
+++ b/base/applications/charmap/charmap.c
@@ -4,7 +4,6 @@
* FILE: base/applications/charmap/charmap.c
* PURPOSE: main dialog implementation
* COPYRIGHT: Copyright 2007 Ged Murphy <gedmurphy(a)reactos.org>
- *
*/
#include "precomp.h"
@@ -567,6 +566,8 @@ PanelOnCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
}
}
+ SetFocus(hCharmapDlg);
+
return 0;
}
@@ -710,6 +711,14 @@ wWinMain(HINSTANCE hInst,
break;
}
+ /* NOTE: CreateDialog needs IsDialogMessage call in message loop */
+ if (hCharmapDlg && IsDialogMessage(hCharmapDlg, &Msg))
+ continue;
+#ifndef REMOVE_ADVANCED
+ if (hAdvancedDlg && IsDialogMessage(hAdvancedDlg, &Msg))
+ continue;
+#endif
+
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
diff --git a/base/applications/charmap/lang/bg-BG.rc
b/base/applications/charmap/lang/bg-BG.rc
index fb1f1ff75ac..c370ed32518 100644
--- a/base/applications/charmap/lang/bg-BG.rc
+++ b/base/applications/charmap/lang/bg-BG.rc
@@ -8,7 +8,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Шрифт :", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Помощ", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/ca-ES.rc
b/base/applications/charmap/lang/ca-ES.rc
index c80905b9ef6..d3aaf612add 100644
--- a/base/applications/charmap/lang/ca-ES.rc
+++ b/base/applications/charmap/lang/ca-ES.rc
@@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Font:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Ajuda", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/cs-CZ.rc
b/base/applications/charmap/lang/cs-CZ.rc
index c30c75c0537..63ccbb7b7de 100644
--- a/base/applications/charmap/lang/cs-CZ.rc
+++ b/base/applications/charmap/lang/cs-CZ.rc
@@ -10,7 +10,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Písmo:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Nápověda", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/de-DE.rc
b/base/applications/charmap/lang/de-DE.rc
index e29798fd949..b88f90a8c8c 100644
--- a/base/applications/charmap/lang/de-DE.rc
+++ b/base/applications/charmap/lang/de-DE.rc
@@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Schrift:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "&Hilfe", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/el-GR.rc
b/base/applications/charmap/lang/el-GR.rc
index 8f8c416b5b2..24c705f669c 100644
--- a/base/applications/charmap/lang/el-GR.rc
+++ b/base/applications/charmap/lang/el-GR.rc
@@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Γραμματοσειρά :", IDC_STATIC, 6, 7, 60, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Βοήθεια", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/en-US.rc
b/base/applications/charmap/lang/en-US.rc
index afb222b68bf..d6881f8619f 100644
--- a/base/applications/charmap/lang/en-US.rc
+++ b/base/applications/charmap/lang/en-US.rc
@@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "&Font:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "&Help", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/es-ES.rc
b/base/applications/charmap/lang/es-ES.rc
index f1d912f8a8b..a8482fef8a7 100644
--- a/base/applications/charmap/lang/es-ES.rc
+++ b/base/applications/charmap/lang/es-ES.rc
@@ -8,7 +8,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Fuente:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Ayuda", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/et-EE.rc
b/base/applications/charmap/lang/et-EE.rc
index e914a7977a4..804fe8e4eb1 100644
--- a/base/applications/charmap/lang/et-EE.rc
+++ b/base/applications/charmap/lang/et-EE.rc
@@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "&Font:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "&Spikker", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/fr-FR.rc
b/base/applications/charmap/lang/fr-FR.rc
index 44046fa4f0a..0d47c1d27fb 100644
--- a/base/applications/charmap/lang/fr-FR.rc
+++ b/base/applications/charmap/lang/fr-FR.rc
@@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Police :", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Aide", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/he-IL.rc
b/base/applications/charmap/lang/he-IL.rc
index e1840774a19..9e2d814e16d 100644
--- a/base/applications/charmap/lang/he-IL.rc
+++ b/base/applications/charmap/lang/he-IL.rc
@@ -7,7 +7,7 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_LAYOUTRTL
BEGIN
LTEXT "גופן", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "עזרה", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/id-ID.rc
b/base/applications/charmap/lang/id-ID.rc
index 03b6a3d0a81..71b43b9867c 100644
--- a/base/applications/charmap/lang/id-ID.rc
+++ b/base/applications/charmap/lang/id-ID.rc
@@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Fon:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Bantuan", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/it-IT.rc
b/base/applications/charmap/lang/it-IT.rc
index fb663df9039..9a2930299ff 100644
--- a/base/applications/charmap/lang/it-IT.rc
+++ b/base/applications/charmap/lang/it-IT.rc
@@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Font:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Aiuto", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/ja-JP.rc
b/base/applications/charmap/lang/ja-JP.rc
index 1a00e46f0bf..e1f0bd3f6c6 100644
--- a/base/applications/charmap/lang/ja-JP.rc
+++ b/base/applications/charmap/lang/ja-JP.rc
@@ -5,7 +5,7 @@ FONT 9, "MS UI Gothic", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "フォント:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "ヘルプ", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/ko-KR.rc
b/base/applications/charmap/lang/ko-KR.rc
index dedc3d69335..cdee4c8b87f 100644
--- a/base/applications/charmap/lang/ko-KR.rc
+++ b/base/applications/charmap/lang/ko-KR.rc
@@ -9,7 +9,7 @@ FONT 9, "굴림", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "글꼴:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "도움말", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/lt-LT.rc
b/base/applications/charmap/lang/lt-LT.rc
index d6f62feaae1..cc2d1c7dd4d 100644
--- a/base/applications/charmap/lang/lt-LT.rc
+++ b/base/applications/charmap/lang/lt-LT.rc
@@ -14,7 +14,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Šriftas:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Pagalba", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/nl-NL.rc
b/base/applications/charmap/lang/nl-NL.rc
index b370b17cc03..6f78e3e7d45 100644
--- a/base/applications/charmap/lang/nl-NL.rc
+++ b/base/applications/charmap/lang/nl-NL.rc
@@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Lettertype:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Help", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/no-NO.rc
b/base/applications/charmap/lang/no-NO.rc
index 1d41bb4bf28..c532e057da7 100644
--- a/base/applications/charmap/lang/no-NO.rc
+++ b/base/applications/charmap/lang/no-NO.rc
@@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Skrift:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Hjelp", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/pl-PL.rc
b/base/applications/charmap/lang/pl-PL.rc
index 99510ec7bb6..2c513d91e70 100644
--- a/base/applications/charmap/lang/pl-PL.rc
+++ b/base/applications/charmap/lang/pl-PL.rc
@@ -14,7 +14,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Czci&onka:", IDC_STATIC, 7, 9, 32, 8
- COMBOBOX IDC_FONTCOMBO, 49, 7, 183, 60, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 49, 7, 183, 60, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Pomo&c", IDC_CMHELP, 237, 7, 50, 14
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/pt-BR.rc
b/base/applications/charmap/lang/pt-BR.rc
index a58d9f4e629..acf5c443c8f 100644
--- a/base/applications/charmap/lang/pt-BR.rc
+++ b/base/applications/charmap/lang/pt-BR.rc
@@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "&Fonte:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Aj&uda", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/ro-RO.rc
b/base/applications/charmap/lang/ro-RO.rc
index d59f6299825..392bd1ca63d 100644
--- a/base/applications/charmap/lang/ro-RO.rc
+++ b/base/applications/charmap/lang/ro-RO.rc
@@ -11,7 +11,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "F&ont:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "&Manual…", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/ru-RU.rc
b/base/applications/charmap/lang/ru-RU.rc
index e4b3872de5d..ff8373693a2 100644
--- a/base/applications/charmap/lang/ru-RU.rc
+++ b/base/applications/charmap/lang/ru-RU.rc
@@ -7,7 +7,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "&Шрифт:", IDC_STATIC, 6, 7, 27, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "&Справка", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/sk-SK.rc
b/base/applications/charmap/lang/sk-SK.rc
index e61403e7d9c..407308d3738 100644
--- a/base/applications/charmap/lang/sk-SK.rc
+++ b/base/applications/charmap/lang/sk-SK.rc
@@ -14,7 +14,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Pís&mo:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "&Pomocník", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/sq-AL.rc
b/base/applications/charmap/lang/sq-AL.rc
index d1f6b638b10..4f313d827bc 100644
--- a/base/applications/charmap/lang/sq-AL.rc
+++ b/base/applications/charmap/lang/sq-AL.rc
@@ -9,7 +9,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Font:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Ndihmë", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/sv-SE.rc
b/base/applications/charmap/lang/sv-SE.rc
index c99c309c4d2..c60af3d257f 100644
--- a/base/applications/charmap/lang/sv-SE.rc
+++ b/base/applications/charmap/lang/sv-SE.rc
@@ -12,7 +12,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Typsnitt:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Hjälp", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/tr-TR.rc
b/base/applications/charmap/lang/tr-TR.rc
index 01cf490e34c..8dd47ce6d66 100644
--- a/base/applications/charmap/lang/tr-TR.rc
+++ b/base/applications/charmap/lang/tr-TR.rc
@@ -10,7 +10,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Yazı Tipi:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Yardım", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/uk-UA.rc
b/base/applications/charmap/lang/uk-UA.rc
index a373a30d3d6..722c9975f96 100644
--- a/base/applications/charmap/lang/uk-UA.rc
+++ b/base/applications/charmap/lang/uk-UA.rc
@@ -13,7 +13,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "Шрифт :", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Довідка", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/zh-CN.rc
b/base/applications/charmap/lang/zh-CN.rc
index 3b32d48c28f..31fab9be9c6 100644
--- a/base/applications/charmap/lang/zh-CN.rc
+++ b/base/applications/charmap/lang/zh-CN.rc
@@ -13,7 +13,7 @@ FONT 9, "宋体", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "字体:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "说明", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/zh-HK.rc
b/base/applications/charmap/lang/zh-HK.rc
index 3fc68624bdd..a0bd760c6dc 100644
--- a/base/applications/charmap/lang/zh-HK.rc
+++ b/base/applications/charmap/lang/zh-HK.rc
@@ -13,7 +13,7 @@ FONT 9, "新細明體", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "字型:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "説明", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/lang/zh-TW.rc
b/base/applications/charmap/lang/zh-TW.rc
index 691e7042b12..64a7bd28c43 100644
--- a/base/applications/charmap/lang/zh-TW.rc
+++ b/base/applications/charmap/lang/zh-TW.rc
@@ -13,7 +13,7 @@ FONT 9, "新細明體", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN
LTEXT "字型:", IDC_STATIC, 6, 7, 24, 9
- COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE |
+ COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_TABSTOP |
WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "說明", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE |
WS_TABSTOP |
diff --git a/base/applications/charmap/map.c b/base/applications/charmap/map.c
index a351f74be37..29fc1360067 100644
--- a/base/applications/charmap/map.c
+++ b/base/applications/charmap/map.c
@@ -4,6 +4,7 @@
* FILE: base/applications/charmap/map.c
* PURPOSE: class implementation for painting glyph region
* COPYRIGHT: Copyright 2007 Ged Murphy <gedmurphy(a)reactos.org>
+ * Copyright 2022 Katayama Hirofumi MZ
<katayama.hirofumi.mz(a)gmail.com>
*
*/
@@ -17,128 +18,118 @@ static const WCHAR szLrgCellWndClass[] = L"LrgCellWnd";
#define MAX_ROWS (0xFFFF / XCELLS) + 1 - YCELLS
-
static
VOID
SetGrid(PMAP infoPtr)
{
INT x, y;
+ PCELL Cell;
for (y = 0; y < YCELLS; y++)
for (x = 0; x < XCELLS; x++)
{
- infoPtr->Cells[y][x].CellExt.left = x * infoPtr->CellSize.cx + 1;
- infoPtr->Cells[y][x].CellExt.top = y * infoPtr->CellSize.cy + 1;
- infoPtr->Cells[y][x].CellExt.right = (x + 1) * infoPtr->CellSize.cx + 2;
- infoPtr->Cells[y][x].CellExt.bottom = (y + 1) * infoPtr->CellSize.cy + 2;
+ Cell = &infoPtr->Cells[y][x];
+ Cell->CellExt.left = x * infoPtr->CellSize.cx + 1;
+ Cell->CellExt.top = y * infoPtr->CellSize.cy + 1;
+ Cell->CellExt.right = (x + 1) * infoPtr->CellSize.cx + 2;
+ Cell->CellExt.bottom = (y + 1) * infoPtr->CellSize.cy + 2;
- CopyRect(&infoPtr->Cells[y][x].CellInt,
- &infoPtr->Cells[y][x].CellExt);
+ Cell->CellInt = Cell->CellExt;
- InflateRect(&infoPtr->Cells[y][x].CellInt,
- -1,
- -1);
+ InflateRect(&Cell->CellInt, -1, -1);
}
}
-
-static
-VOID
-DrawActiveCell(PMAP infoPtr,
- HDC hdc)
-{
- Rectangle(hdc,
- infoPtr->pActiveCell->CellInt.left,
- infoPtr->pActiveCell->CellInt.top,
- infoPtr->pActiveCell->CellInt.right,
- infoPtr->pActiveCell->CellInt.bottom);
-
-}
-
-
static
VOID
-DrawGrid(PMAP infoPtr,
- PAINTSTRUCT *ps)
+UpdateCells(PMAP infoPtr)
{
INT x, y;
- RECT rc;
+ INT i = XCELLS * infoPtr->iYStart;
+ WCHAR ch;
PCELL Cell;
- for (y = 0; y < YCELLS; y++)
- for (x = 0; x < XCELLS; x++)
+ for (y = 0; y < YCELLS; ++y)
{
- Cell = &infoPtr->Cells[y][x];
-
- if (!IntersectRect(&rc,
- &ps->rcPaint,
- &Cell->CellExt))
+ for (x = 0; x < XCELLS; ++x, ++i)
{
- continue;
- }
-
- Rectangle(ps->hdc,
- Cell->CellExt.left,
- Cell->CellExt.top,
- Cell->CellExt.right,
- Cell->CellExt.bottom);
+ if (i < infoPtr->NumValidGlyphs)
+ ch = (WCHAR)infoPtr->ValidGlyphs[i];
+ else
+ ch = 0xFFFF;
- if (infoPtr->pActiveCell == Cell)
- {
- DrawActiveCell(infoPtr, ps->hdc);
+ Cell = &infoPtr->Cells[y][x];
+ Cell->ch = ch;
}
}
}
-
static
VOID
FillGrid(PMAP infoPtr,
PAINTSTRUCT *ps)
{
HFONT hOldFont;
- WCHAR ch;
INT x, y;
RECT rc;
PCELL Cell;
- INT i, added;
+ INT i;
+ HBRUSH hOldBrush, hbrGray = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
+ HPEN hOldPen, hPenGray = CreatePen(PS_SOLID, 1, RGB(140, 140, 140));
- hOldFont = SelectObject(ps->hdc,
- infoPtr->hFont);
+ UpdateCells(infoPtr);
- i = XCELLS * infoPtr->iYStart;
+ hOldFont = SelectObject(ps->hdc, infoPtr->hFont);
+ hOldPen = SelectObject(ps->hdc, GetStockObject(BLACK_PEN));
+ hOldBrush = SelectObject(ps->hdc, GetStockObject(WHITE_BRUSH));
- added = 0;
+ i = XCELLS * infoPtr->iYStart;
for (y = 0; y < YCELLS; y++)
- for (x = 0; x < XCELLS; x++)
{
- if (i >= infoPtr->NumValidGlyphs) break;
-
- ch = (WCHAR)infoPtr->ValidGlyphs[i];
-
- Cell = &infoPtr->Cells[y][x];
-
- if (IntersectRect(&rc,
- &ps->rcPaint,
- &Cell->CellExt))
+ for (x = 0; x < XCELLS; x++, i++)
{
- Cell->ch = ch;
+ Cell = &infoPtr->Cells[y][x];
+ if (!IntersectRect(&rc, &ps->rcPaint, &Cell->CellExt))
+ continue;
- DrawTextW(ps->hdc,
- &ch,
- 1,
- &Cell->CellInt,
- DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+ rc = Cell->CellExt;
+ Rectangle(ps->hdc, rc.left, rc.top, rc.right, rc.bottom);
- added++;
+ if (i < infoPtr->NumValidGlyphs)
+ {
+ DrawTextW(ps->hdc, &Cell->ch, 1, &Cell->CellInt,
+ DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+ if (Cell == infoPtr->pActiveCell)
+ {
+ rc = Cell->CellInt;
+
+ /* Draw gray box */
+ SelectObject(ps->hdc, GetStockObject(NULL_BRUSH));
+ SelectObject(ps->hdc, hPenGray);
+ Rectangle(ps->hdc, rc.left, rc.top, rc.right, rc.bottom);
+ SelectObject(ps->hdc, hOldPen);
+ SelectObject(ps->hdc, hOldBrush);
+
+ if (GetFocus() == infoPtr->hMapWnd)
+ {
+ /* Draw focus rectangle */
+ InflateRect(&rc, -1, -1);
+ DrawFocusRect(ps->hdc, &rc);
+ }
+ }
+ }
+ else
+ {
+ FillRect(ps->hdc, &Cell->CellInt, hbrGray);
+ }
}
-
- i++;
- ch = (WCHAR)i;
}
- SelectObject(ps->hdc,
- hOldFont);
+
+ SelectObject(ps->hdc, hOldFont);
+ SelectObject(ps->hdc, hOldPen);
+ SelectObject(ps->hdc, hOldBrush);
+ DeleteObject(hPenGray);
}
@@ -146,19 +137,11 @@ static
BOOL
CreateLargeCell(PMAP infoPtr)
{
- RECT rLarge;
+ RECT rLarge = infoPtr->pActiveCell->CellExt;
- CopyRect(&rLarge,
- &infoPtr->pActiveCell->CellExt);
+ MapWindowPoints(infoPtr->hMapWnd, infoPtr->hParent, (LPPOINT)&rLarge, 2);
- MapWindowPoints(infoPtr->hMapWnd,
- infoPtr->hParent,
- (VOID*)&rLarge,
- 2);
-
- InflateRect(&rLarge,
- XLARGE - XCELLS,
- YLARGE - YCELLS);
+ InflateRect(&rLarge, XLARGE - XCELLS, YLARGE - YCELLS);
infoPtr->hLrgWnd = CreateWindowExW(0,
szLrgCellWndClass,
@@ -183,19 +166,11 @@ static
VOID
MoveLargeCell(PMAP infoPtr)
{
- RECT rLarge;
-
- CopyRect(&rLarge,
- &infoPtr->pActiveCell->CellExt);
+ RECT rLarge = infoPtr->pActiveCell->CellExt;
- MapWindowPoints(infoPtr->hMapWnd,
- infoPtr->hParent,
- (VOID*)&rLarge,
- 2);
+ MapWindowPoints(infoPtr->hMapWnd, infoPtr->hParent, (LPPOINT)&rLarge, 2);
- InflateRect(&rLarge,
- XLARGE - XCELLS,
- YLARGE - YCELLS);
+ InflateRect(&rLarge, XLARGE - XCELLS, YLARGE - YCELLS);
MoveWindow(infoPtr->hLrgWnd,
rLarge.left,
@@ -204,9 +179,7 @@ MoveLargeCell(PMAP infoPtr)
rLarge.bottom - rLarge.top,
TRUE);
- InvalidateRect(infoPtr->hLrgWnd,
- NULL,
- TRUE);
+ InvalidateRect(infoPtr->hLrgWnd, NULL, TRUE);
}
@@ -216,7 +189,7 @@ GetPossibleCharacters(WCHAR* ch, INT chLen, INT codePageIdx)
{
INT i, j;
- memset(ch, 0, sizeof(ch[0]) * chLen);
+ ZeroMemory(ch, sizeof(ch[0]) * chLen);
if (codePageIdx <= 0 || codePageIdx > SIZEOF(codePages))
{
@@ -276,11 +249,6 @@ SetFont(PMAP infoPtr,
NULL,
TRUE);
- if (infoPtr->pActiveCell)
- infoPtr->pActiveCell->bActive = FALSE;
- infoPtr->pActiveCell = &infoPtr->Cells[0][0];
- infoPtr->pActiveCell->bActive = TRUE;
-
// Get all the valid glyphs in this font
SelectObject(hdc, infoPtr->hFont);
@@ -347,60 +315,97 @@ NotifyParentOfSelection(PMAP infoPtr,
static
VOID
-OnClick(PMAP infoPtr,
- WORD ptx,
- WORD pty)
+LimitCaretXY(PMAP infoPtr, INT *pX, INT *pY)
{
- INT x, y, i;
+ INT i, X = *pX, Y = *pY, iYStart = infoPtr->iYStart;
- /*
- * Find the cell the mouse pointer is over.
- * Since each cell is the same size, this can be done quickly using CellSize.
- * Clamp to XCELLS - 1 and YCELLS - 1 because the map can sometimes be slightly
- * larger than infoPtr.CellSize * XCELLS , due to the map size being a non integer
- * multiple of infoPtr.CellSize .
- */
- x = min(XCELLS - 1, ptx / max(1, infoPtr->CellSize.cx));
- y = min(YCELLS - 1, pty / max(1, infoPtr->CellSize.cy));
-
- /* Make sure the mouse is within a valid glyph */
- i = XCELLS * infoPtr->iYStart + y * XCELLS + x;
- if (i >= infoPtr->NumValidGlyphs)
+ i = XCELLS * (iYStart + Y) + X;
+ while (i >= infoPtr->NumValidGlyphs)
{
- if (infoPtr->pActiveCell)
- infoPtr->pActiveCell->bActive = FALSE;
- infoPtr->pActiveCell = NULL;
- return;
+ if (X > 0)
+ {
+ --X;
+ }
+ else
+ {
+ X = XCELLS - 1;
+ --Y;
+ }
+ i = XCELLS * (iYStart + Y) + X;
}
- /* if the cell is not already active */
- if (!infoPtr->Cells[y][x].bActive)
+ *pX = X;
+ *pY = Y;
+}
+
+static
+VOID
+SetCaretXY(PMAP infoPtr, INT X, INT Y, BOOL bLarge, BOOL bInvalidateAll)
+{
+
+ /* set previous active cell to inactive */
+ if (!bInvalidateAll)
{
- /* set previous active cell to inactive */
- if (infoPtr->pActiveCell)
- {
- /* invalidate normal cells, required when
- * moving a small active cell via keyboard */
- if (!infoPtr->pActiveCell->bLarge)
- {
- InvalidateRect(infoPtr->hMapWnd,
- &infoPtr->pActiveCell->CellInt,
- TRUE);
- }
+ InvalidateRect(infoPtr->hMapWnd,
+ &infoPtr->pActiveCell->CellInt,
+ FALSE);
+ }
- infoPtr->pActiveCell->bActive = FALSE;
- infoPtr->pActiveCell->bLarge = FALSE;
- }
+ LimitCaretXY(infoPtr, &X, &Y);
+ infoPtr->CaretX = X;
+ infoPtr->CaretY = Y;
+ UpdateCells(infoPtr);
- /* set new cell to active */
- infoPtr->pActiveCell = &infoPtr->Cells[y][x];
- infoPtr->pActiveCell->bActive = TRUE;
- infoPtr->pActiveCell->bLarge = TRUE;
+ /* set new cell to active */
+ infoPtr->pActiveCell = &infoPtr->Cells[Y][X];
+ if (!bInvalidateAll)
+ {
+ InvalidateRect(infoPtr->hMapWnd,
+ &infoPtr->pActiveCell->CellInt,
+ FALSE);
+ }
+
+ /* Create if needed */
+ if (bLarge)
+ {
if (infoPtr->hLrgWnd)
MoveLargeCell(infoPtr);
else
CreateLargeCell(infoPtr);
}
+ else
+ {
+ /* Destroy large window */
+ if (infoPtr->hLrgWnd)
+ {
+ DestroyWindow(infoPtr->hLrgWnd);
+ infoPtr->hLrgWnd = NULL;
+ }
+ }
+
+ if (bInvalidateAll)
+ InvalidateRect(infoPtr->hMapWnd, NULL, FALSE);
+
+ UpdateStatusBar(infoPtr->pActiveCell->ch);
+}
+
+static
+VOID
+OnClick(PMAP infoPtr,
+ WORD ptx,
+ WORD pty)
+{
+ /*
+ * Find the cell the mouse pointer is over.
+ * Since each cell is the same size, this can be done quickly using CellSize.
+ * Clamp to XCELLS - 1 and YCELLS - 1 because the map can sometimes be slightly
+ * larger than infoPtr.CellSize * XCELLS , due to the map size being a non integer
+ * multiple of infoPtr.CellSize .
+ */
+ INT x = min(XCELLS - 1, ptx / max(1, infoPtr->CellSize.cx));
+ INT y = min(YCELLS - 1, pty / max(1, infoPtr->CellSize.cy));
+
+ SetCaretXY(infoPtr, x, y, TRUE, FALSE);
}
@@ -411,45 +416,30 @@ MapOnCreate(PMAP infoPtr,
HWND hParent)
{
RECT rc;
- BOOL Ret = FALSE;
- infoPtr = HeapAlloc(GetProcessHeap(),
- 0,
- sizeof(MAP));
- if (infoPtr)
- {
- SetLastError(0);
- SetWindowLongPtrW(hwnd,
- 0,
- (DWORD_PTR)infoPtr);
- if (GetLastError() == 0)
- {
- ZeroMemory(infoPtr,
- sizeof(MAP));
+ infoPtr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MAP));
+ if (!infoPtr)
+ return FALSE;
- infoPtr->hMapWnd = hwnd;
- infoPtr->hParent = hParent;
+ SetWindowLongPtrW(hwnd, 0, (LONG_PTR)infoPtr);
- GetClientRect(hwnd, &rc);
- infoPtr->ClientSize.cx = rc.right;
- infoPtr->ClientSize.cy = rc.bottom;
- infoPtr->CellSize.cx = infoPtr->ClientSize.cx / XCELLS;
- infoPtr->CellSize.cy = infoPtr->ClientSize.cy / YCELLS;
+ infoPtr->hMapWnd = hwnd;
+ infoPtr->hParent = hParent;
- infoPtr->pActiveCell = NULL;
+ GetClientRect(hwnd, &rc);
+ infoPtr->ClientSize.cx = rc.right;
+ infoPtr->ClientSize.cy = rc.bottom;
+ infoPtr->CellSize.cx = infoPtr->ClientSize.cx / XCELLS;
+ infoPtr->CellSize.cy = infoPtr->ClientSize.cy / YCELLS;
- SetGrid(infoPtr);
+ infoPtr->pActiveCell = &infoPtr->Cells[0][0];
- SetScrollPos(infoPtr->hParent, SB_VERT, 0, TRUE);
+ SetGrid(infoPtr);
- Ret = TRUE;
- }
- }
-
- return Ret;
+ SetScrollPos(infoPtr->hParent, SB_VERT, 0, TRUE);
+ return TRUE;
}
-
static
VOID
OnVScroll(PMAP infoPtr,
@@ -457,6 +447,7 @@ OnVScroll(PMAP infoPtr,
INT Pos)
{
INT iYDiff, iOldYStart = infoPtr->iYStart;
+ INT X, Y;
switch (Value)
{
@@ -480,13 +471,30 @@ OnVScroll(PMAP infoPtr,
infoPtr->iYStart = Pos;
break;
- default:
+ case SB_TOP:
+ infoPtr->iYStart = 0;
+ SetCaretXY(infoPtr, 0, 0, FALSE, TRUE);
+ return;
+
+ case SB_BOTTOM:
+ infoPtr->iYStart = infoPtr->NumRows;
+ SetCaretXY(infoPtr, XCELLS - 1, YCELLS - 1, FALSE, TRUE);
+ break;
+
+ default:
break;
- }
+ }
infoPtr->iYStart = max(0, infoPtr->iYStart);
infoPtr->iYStart = min(infoPtr->iYStart, infoPtr->NumRows);
+ UpdateCells(infoPtr);
+
+ X = infoPtr->CaretX;
+ Y = infoPtr->CaretY;
+ LimitCaretXY(infoPtr, &X, &Y);
+ SetCaretXY(infoPtr, X, Y, IsWindow(infoPtr->hLrgWnd), FALSE);
+
iYDiff = iOldYStart - infoPtr->iYStart;
if (iYDiff)
{
@@ -505,7 +513,7 @@ OnVScroll(PMAP infoPtr,
RECT rect;
/* Invalidate the rect around the active cell since a new cell will become
active */
- if (infoPtr->pActiveCell && infoPtr->pActiveCell->bActive)
+ if (infoPtr->pActiveCell)
{
InvalidateRect(infoPtr->hMapWnd,
&infoPtr->pActiveCell->CellExt,
@@ -536,6 +544,8 @@ OnVScroll(PMAP infoPtr,
ShowWindow(infoPtr->hLrgWnd, SW_SHOW);
}
}
+
+ UpdateStatusBar(infoPtr->pActiveCell->ch);
}
@@ -547,38 +557,172 @@ OnPaint(PMAP infoPtr,
PAINTSTRUCT ps;
HDC hdc;
-
if (wParam != 0)
{
- if (!GetUpdateRect(infoPtr->hMapWnd,
- &ps.rcPaint,
- TRUE))
- {
+ if (!GetUpdateRect(infoPtr->hMapWnd, &ps.rcPaint, TRUE))
return;
- }
+
ps.hdc = (HDC)wParam;
}
else
{
- hdc = BeginPaint(infoPtr->hMapWnd,
- &ps);
+ hdc = BeginPaint(infoPtr->hMapWnd, &ps);
if (hdc == NULL)
+ return;
+ }
+
+ FillGrid(infoPtr, &ps);
+
+ if (wParam == 0)
+ {
+ EndPaint(infoPtr->hMapWnd, &ps);
+ }
+}
+
+static
+VOID
+MoveUpDown(PMAP infoPtr, INT DY)
+{
+ INT Y = infoPtr->CaretY;
+
+ if (DY < 0) /* Move Up */
+ {
+ if (Y <= 0)
{
+ SendMessageW(infoPtr->hMapWnd, WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0), 0);
return;
}
+
+ Y -= 1;
}
+ else if (DY > 0) /* Move Down */
+ {
+ if (Y + 1 >= YCELLS)
+ {
+ SendMessageW(infoPtr->hMapWnd, WM_VSCROLL, MAKEWPARAM(SB_LINEDOWN, 0),
0);
+ return;
+ }
- DrawGrid(infoPtr, &ps);
+ Y += 1;
+ }
- FillGrid(infoPtr, &ps);
+ SetCaretXY(infoPtr, infoPtr->CaretX, Y, IsWindow(infoPtr->hLrgWnd), FALSE);
+}
- if (wParam == 0)
+static
+VOID
+MoveLeftRight(PMAP infoPtr, INT DX)
+{
+ INT X = infoPtr->CaretX;
+ INT Y = infoPtr->CaretY;
+
+ if (DX < 0) /* Move Left */
+ {
+ if (X <= 0) /* at left edge */
+ {
+ if (Y <= 0) /* at top */
+ {
+ Y = 0;
+ if (infoPtr->iYStart > 0)
+ X = XCELLS - 1;
+ SendMessageW(infoPtr->hMapWnd, WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0),
0);
+ }
+ else
+ {
+ X = XCELLS - 1;
+ Y -= 1;
+ }
+ }
+ else /* Not at left edge */
+ {
+ X -= 1;
+ }
+ }
+ else if (DX > 0) /* Move Right */
{
- EndPaint(infoPtr->hMapWnd,
- &ps);
+ if (X + 1 >= XCELLS) /* at right edge */
+ {
+ if (Y + 1 >= YCELLS) /* at bottom */
+ {
+ Y = YCELLS - 1;
+ if (infoPtr->iYStart < infoPtr->NumRows)
+ X = 0;
+ SendMessageW(infoPtr->hMapWnd, WM_VSCROLL, MAKEWPARAM(SB_LINEDOWN, 0),
0);
+ }
+ else
+ {
+ X = 0;
+ Y += 1;
+ }
+ }
+ else
+ {
+ X += 1;
+ }
}
+
+ SetCaretXY(infoPtr, X, Y, IsWindow(infoPtr->hLrgWnd), FALSE);
}
+static
+VOID
+OnKeyDown(PMAP infoPtr, WPARAM wParam, LPARAM lParam)
+{
+ BOOL bCtrlDown = (GetKeyState(VK_CONTROL) < 0);
+
+ switch (wParam)
+ {
+ case VK_UP:
+ if (bCtrlDown)
+ SetCaretXY(infoPtr, infoPtr->CaretX, 0, FALSE, FALSE);
+ else
+ MoveUpDown(infoPtr, -1);
+ break;
+
+ case VK_DOWN:
+ if (bCtrlDown)
+ SetCaretXY(infoPtr, infoPtr->CaretX, YCELLS - 1, FALSE, FALSE);
+ else
+ MoveUpDown(infoPtr, +1);
+ break;
+
+ case VK_LEFT:
+ if (bCtrlDown)
+ SetCaretXY(infoPtr, 0, infoPtr->CaretY, FALSE, FALSE);
+ else
+ MoveLeftRight(infoPtr, -1);
+ break;
+
+ case VK_RIGHT:
+ if (bCtrlDown)
+ SetCaretXY(infoPtr, XCELLS - 1, infoPtr->CaretY, FALSE, FALSE);
+ else
+ MoveLeftRight(infoPtr, +1);
+ break;
+
+ case VK_PRIOR: /* Page Up */
+ SendMessageW(infoPtr->hMapWnd, WM_VSCROLL, MAKEWPARAM(SB_PAGEUP, 0), 0);
+ break;
+
+ case VK_NEXT: /* Page Down */
+ SendMessageW(infoPtr->hMapWnd, WM_VSCROLL, MAKEWPARAM(SB_PAGEDOWN, 0),
0);
+ break;
+
+ case VK_HOME:
+ if (bCtrlDown)
+ SendMessageW(infoPtr->hMapWnd, WM_VSCROLL, MAKEWPARAM(SB_TOP, 0), 0);
+ else
+ SetCaretXY(infoPtr, 0, infoPtr->CaretY, FALSE, FALSE);
+ break;
+
+ case VK_END:
+ if (bCtrlDown)
+ SendMessageW(infoPtr->hMapWnd, WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0),
0);
+ else
+ SetCaretXY(infoPtr, XCELLS - 1, infoPtr->CaretY, FALSE, FALSE);
+ break;
+ }
+}
LRESULT
CALLBACK
@@ -587,13 +731,10 @@ MapWndProc(HWND hwnd,
WPARAM wParam,
LPARAM lParam)
{
- PMAP infoPtr;
+ PMAP infoPtr = (PMAP)GetWindowLongPtrW(hwnd, 0);
LRESULT Ret = 0;
WCHAR lfFaceName[LF_FACESIZE];
- infoPtr = (PMAP)GetWindowLongPtrW(hwnd,
- 0);
-
switch (uMsg)
{
case WM_CREATE:
@@ -608,12 +749,16 @@ MapWndProc(HWND hwnd,
break;
}
- case WM_LBUTTONDOWN:
+ case WM_KEYDOWN:
{
- OnClick(infoPtr,
- LOWORD(lParam),
- HIWORD(lParam));
+ OnKeyDown(infoPtr, wParam, lParam);
+ break;
+ }
+ case WM_LBUTTONDOWN:
+ {
+ SetFocus(hwnd);
+ OnClick(infoPtr, LOWORD(lParam), HIWORD(lParam));
break;
}
@@ -621,43 +766,36 @@ MapWndProc(HWND hwnd,
{
if (wParam & MK_LBUTTON)
{
- OnClick(infoPtr,
- LOWORD(lParam),
- HIWORD(lParam));
+ OnClick(infoPtr, LOWORD(lParam), HIWORD(lParam));
}
break;
}
case WM_LBUTTONDBLCLK:
{
- if (!infoPtr->pActiveCell)
+ if (!infoPtr->pActiveCell || GetFocus() != hwnd)
break;
NotifyParentOfSelection(infoPtr,
FM_SETCHAR,
infoPtr->pActiveCell->ch);
- if (infoPtr->pActiveCell->bLarge)
+ if (infoPtr->hLrgWnd)
{
DestroyWindow(infoPtr->hLrgWnd);
infoPtr->hLrgWnd = NULL;
}
-
- infoPtr->pActiveCell->bLarge = FALSE;
-
break;
}
case WM_VSCROLL:
{
- OnVScroll(infoPtr,
- LOWORD(wParam),
- HIWORD(wParam));
-
+ OnVScroll(infoPtr, LOWORD(wParam), HIWORD(wParam));
break;
}
case FM_SETCHARMAP:
+ infoPtr->CaretX = infoPtr->CaretY = infoPtr->iYStart = 0;
infoPtr->CharMap = LOWORD(wParam);
wcsncpy(lfFaceName,
infoPtr->CurrentFont.lfFaceName,
@@ -666,6 +804,7 @@ MapWndProc(HWND hwnd,
break;
case FM_SETFONT:
+ infoPtr->CaretX = infoPtr->CaretY = infoPtr->iYStart = 0;
SetFont(infoPtr, (LPWSTR)lParam);
break;
@@ -679,32 +818,27 @@ MapWndProc(HWND hwnd,
return (LRESULT)infoPtr->hFont;
case WM_PAINT:
- {
- OnPaint(infoPtr,
- wParam);
+ OnPaint(infoPtr, wParam);
break;
- }
case WM_DESTROY:
- {
DeleteObject(infoPtr->hFont);
- HeapFree(GetProcessHeap(),
- 0,
- infoPtr);
- SetWindowLongPtrW(hwnd,
- 0,
- (DWORD_PTR)NULL);
+ HeapFree(GetProcessHeap(), 0, infoPtr);
+ SetWindowLongPtrW(hwnd, 0, (LONG_PTR)NULL);
+ break;
+
+ case WM_GETDLGCODE:
+ return DLGC_WANTARROWS;
+
+ case WM_SETFOCUS:
+ case WM_KILLFOCUS:
+ if (!infoPtr->hLrgWnd)
+ InvalidateRect(hwnd, &(infoPtr->pActiveCell->CellInt), FALSE);
break;
- }
default:
- {
- Ret = DefWindowProcW(hwnd,
- uMsg,
- wParam,
- lParam);
+ Ret = DefWindowProcW(hwnd, uMsg, wParam, lParam);
break;
- }
}
return Ret;
@@ -740,9 +874,6 @@ RegisterMapClasses(HINSTANCE hInstance)
VOID
UnregisterMapClasses(HINSTANCE hInstance)
{
- UnregisterClassW(szMapWndClass,
- hInstance);
-
- UnregisterClassW(szLrgCellWndClass,
- hInstance);
+ UnregisterClassW(szMapWndClass, hInstance);
+ UnregisterClassW(szLrgCellWndClass, hInstance);
}
diff --git a/base/applications/charmap/precomp.h b/base/applications/charmap/precomp.h
index d8573d5b09e..02521f09368 100644
--- a/base/applications/charmap/precomp.h
+++ b/base/applications/charmap/precomp.h
@@ -37,8 +37,6 @@ typedef struct _CELL
{
RECT CellExt;
RECT CellInt;
- BOOL bActive;
- BOOL bLarge;
WCHAR ch;
} CELL, *PCELL;
@@ -53,13 +51,13 @@ typedef struct _MAP
PCELL pActiveCell;
HFONT hFont;
LOGFONTW CurrentFont;
+ INT CaretX, CaretY;
INT iYStart;
INT NumRows;
INT CharMap;
USHORT ValidGlyphs[MAX_GLYPHS];
USHORT NumValidGlyphs;
-
} MAP, *PMAP;
typedef struct {