[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
This commit is contained in:
Katayama Hirofumi MZ 2022-11-06 08:37:18 +09:00 committed by GitHub
parent c8ef276778
commit 7e9f1e67f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 419 additions and 281 deletions

View file

@ -4,7 +4,6 @@
* FILE: base/applications/charmap/charmap.c * FILE: base/applications/charmap/charmap.c
* PURPOSE: main dialog implementation * PURPOSE: main dialog implementation
* COPYRIGHT: Copyright 2007 Ged Murphy <gedmurphy@reactos.org> * COPYRIGHT: Copyright 2007 Ged Murphy <gedmurphy@reactos.org>
*
*/ */
#include "precomp.h" #include "precomp.h"
@ -567,6 +566,8 @@ PanelOnCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
} }
} }
SetFocus(hCharmapDlg);
return 0; return 0;
} }
@ -710,6 +711,14 @@ wWinMain(HINSTANCE hInst,
break; 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); TranslateMessage(&Msg);
DispatchMessage(&Msg); DispatchMessage(&Msg);
} }

View file

@ -8,7 +8,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Шрифт :", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Помощ", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Помощ", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Font:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Ajuda", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Ajuda", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -10,7 +10,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Písmo:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Nápověda", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Nápověda", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Schrift:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "&Hilfe", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "&Hilfe", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Γραμματοσειρά :", IDC_STATIC, 6, 7, 60, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Βοήθεια", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Βοήθεια", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "&Font:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "&Help", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "&Help", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -8,7 +8,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Fuente:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Ayuda", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Ayuda", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "&Font:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "&Spikker", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "&Spikker", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Police :", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Aide", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Aide", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -7,7 +7,7 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_LAYOUTRTL EXSTYLE WS_EX_LAYOUTRTL
BEGIN BEGIN
LTEXT "גופן", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "עזרה", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "עזרה", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Fon:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Bantuan", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Bantuan", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Font:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Aiuto", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Aiuto", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -5,7 +5,7 @@ FONT 9, "MS UI Gothic", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "フォント:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "ヘルプ", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "ヘルプ", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -9,7 +9,7 @@ FONT 9, "굴림", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "글꼴:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "도움말", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "도움말", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -14,7 +14,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Šriftas:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Pagalba", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Pagalba", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Lettertype:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Help", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Help", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Skrift:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Hjelp", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Hjelp", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -14,7 +14,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Czci&onka:", IDC_STATIC, 7, 9, 32, 8 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Pomo&c", IDC_CMHELP, 237, 7, 50, 14 PUSHBUTTON "Pomo&c", IDC_CMHELP, 237, 7, 50, 14
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -5,7 +5,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "&Fonte:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Aj&uda", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Aj&uda", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -11,7 +11,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "F&ont:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "&Manual…", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "&Manual…", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -7,7 +7,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "&Шрифт:", IDC_STATIC, 6, 7, 27, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "&Справка", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "&Справка", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -14,7 +14,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Pís&mo:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "&Pomocník", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "&Pomocník", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -9,7 +9,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Font:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Ndihmë", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Ndihmë", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -12,7 +12,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Typsnitt:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Hjälp", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Hjälp", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -10,7 +10,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Yazı Tipi:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Yardım", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Yardım", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -13,7 +13,7 @@ FONT 8, "MS Shell Dlg", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "Шрифт :", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "Довідка", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "Довідка", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -13,7 +13,7 @@ FONT 9, "宋体", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "字体:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "说明", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "说明", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -13,7 +13,7 @@ FONT 9, "新細明體", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "字型:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "説明", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "説明", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -13,7 +13,7 @@ FONT 9, "新細明體", 0, 0
STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE
BEGIN BEGIN
LTEXT "字型:", IDC_STATIC, 6, 7, 24, 9 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 WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
PUSHBUTTON "說明", IDC_CMHELP, 249, 5, 35, 13 PUSHBUTTON "說明", IDC_CMHELP, 249, 5, 35, 13
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP |

View file

@ -4,6 +4,7 @@
* FILE: base/applications/charmap/map.c * FILE: base/applications/charmap/map.c
* PURPOSE: class implementation for painting glyph region * PURPOSE: class implementation for painting glyph region
* COPYRIGHT: Copyright 2007 Ged Murphy <gedmurphy@reactos.org> * COPYRIGHT: Copyright 2007 Ged Murphy <gedmurphy@reactos.org>
* Copyright 2022 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
* *
*/ */
@ -17,79 +18,51 @@ static const WCHAR szLrgCellWndClass[] = L"LrgCellWnd";
#define MAX_ROWS (0xFFFF / XCELLS) + 1 - YCELLS #define MAX_ROWS (0xFFFF / XCELLS) + 1 - YCELLS
static static
VOID VOID
SetGrid(PMAP infoPtr) SetGrid(PMAP infoPtr)
{ {
INT x, y; INT x, y;
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;
CopyRect(&infoPtr->Cells[y][x].CellInt,
&infoPtr->Cells[y][x].CellExt);
InflateRect(&infoPtr->Cells[y][x].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)
{
INT x, y;
RECT rc;
PCELL Cell; PCELL Cell;
for (y = 0; y < YCELLS; y++) for (y = 0; y < YCELLS; y++)
for (x = 0; x < XCELLS; x++) for (x = 0; x < XCELLS; x++)
{ {
Cell = &infoPtr->Cells[y][x]; 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;
if (!IntersectRect(&rc, Cell->CellInt = Cell->CellExt;
&ps->rcPaint,
&Cell->CellExt))
{
continue;
}
Rectangle(ps->hdc, InflateRect(&Cell->CellInt, -1, -1);
Cell->CellExt.left,
Cell->CellExt.top,
Cell->CellExt.right,
Cell->CellExt.bottom);
if (infoPtr->pActiveCell == Cell)
{
DrawActiveCell(infoPtr, ps->hdc);
}
} }
} }
static
VOID
UpdateCells(PMAP infoPtr)
{
INT x, y;
INT i = XCELLS * infoPtr->iYStart;
WCHAR ch;
PCELL Cell;
for (y = 0; y < YCELLS; ++y)
{
for (x = 0; x < XCELLS; ++x, ++i)
{
if (i < infoPtr->NumValidGlyphs)
ch = (WCHAR)infoPtr->ValidGlyphs[i];
else
ch = 0xFFFF;
Cell = &infoPtr->Cells[y][x];
Cell->ch = ch;
}
}
}
static static
VOID VOID
@ -97,48 +70,66 @@ FillGrid(PMAP infoPtr,
PAINTSTRUCT *ps) PAINTSTRUCT *ps)
{ {
HFONT hOldFont; HFONT hOldFont;
WCHAR ch;
INT x, y; INT x, y;
RECT rc; RECT rc;
PCELL Cell; 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, UpdateCells(infoPtr);
infoPtr->hFont);
hOldFont = SelectObject(ps->hdc, infoPtr->hFont);
hOldPen = SelectObject(ps->hdc, GetStockObject(BLACK_PEN));
hOldBrush = SelectObject(ps->hdc, GetStockObject(WHITE_BRUSH));
i = XCELLS * infoPtr->iYStart; i = XCELLS * infoPtr->iYStart;
added = 0;
for (y = 0; y < YCELLS; y++) for (y = 0; y < YCELLS; y++)
for (x = 0; x < XCELLS; x++)
{ {
if (i >= infoPtr->NumValidGlyphs) break; for (x = 0; x < XCELLS; x++, i++)
{
ch = (WCHAR)infoPtr->ValidGlyphs[i];
Cell = &infoPtr->Cells[y][x]; Cell = &infoPtr->Cells[y][x];
if (!IntersectRect(&rc, &ps->rcPaint, &Cell->CellExt))
continue;
if (IntersectRect(&rc, rc = Cell->CellExt;
&ps->rcPaint, Rectangle(ps->hdc, rc.left, rc.top, rc.right, rc.bottom);
&Cell->CellExt))
if (i < infoPtr->NumValidGlyphs)
{ {
Cell->ch = ch; DrawTextW(ps->hdc, &Cell->ch, 1, &Cell->CellInt,
DrawTextW(ps->hdc,
&ch,
1,
&Cell->CellInt,
DT_CENTER | DT_VCENTER | DT_SINGLELINE); DT_CENTER | DT_VCENTER | DT_SINGLELINE);
if (Cell == infoPtr->pActiveCell)
{
rc = Cell->CellInt;
added++; /* 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++; SelectObject(ps->hdc, hOldFont);
ch = (WCHAR)i; SelectObject(ps->hdc, hOldPen);
} SelectObject(ps->hdc, hOldBrush);
SelectObject(ps->hdc, DeleteObject(hPenGray);
hOldFont);
} }
@ -146,19 +137,11 @@ static
BOOL BOOL
CreateLargeCell(PMAP infoPtr) CreateLargeCell(PMAP infoPtr)
{ {
RECT rLarge; RECT rLarge = infoPtr->pActiveCell->CellExt;
CopyRect(&rLarge, MapWindowPoints(infoPtr->hMapWnd, infoPtr->hParent, (LPPOINT)&rLarge, 2);
&infoPtr->pActiveCell->CellExt);
MapWindowPoints(infoPtr->hMapWnd, InflateRect(&rLarge, XLARGE - XCELLS, YLARGE - YCELLS);
infoPtr->hParent,
(VOID*)&rLarge,
2);
InflateRect(&rLarge,
XLARGE - XCELLS,
YLARGE - YCELLS);
infoPtr->hLrgWnd = CreateWindowExW(0, infoPtr->hLrgWnd = CreateWindowExW(0,
szLrgCellWndClass, szLrgCellWndClass,
@ -183,19 +166,11 @@ static
VOID VOID
MoveLargeCell(PMAP infoPtr) MoveLargeCell(PMAP infoPtr)
{ {
RECT rLarge; RECT rLarge = infoPtr->pActiveCell->CellExt;
CopyRect(&rLarge, MapWindowPoints(infoPtr->hMapWnd, infoPtr->hParent, (LPPOINT)&rLarge, 2);
&infoPtr->pActiveCell->CellExt);
MapWindowPoints(infoPtr->hMapWnd, InflateRect(&rLarge, XLARGE - XCELLS, YLARGE - YCELLS);
infoPtr->hParent,
(VOID*)&rLarge,
2);
InflateRect(&rLarge,
XLARGE - XCELLS,
YLARGE - YCELLS);
MoveWindow(infoPtr->hLrgWnd, MoveWindow(infoPtr->hLrgWnd,
rLarge.left, rLarge.left,
@ -204,9 +179,7 @@ MoveLargeCell(PMAP infoPtr)
rLarge.bottom - rLarge.top, rLarge.bottom - rLarge.top,
TRUE); TRUE);
InvalidateRect(infoPtr->hLrgWnd, InvalidateRect(infoPtr->hLrgWnd, NULL, TRUE);
NULL,
TRUE);
} }
@ -216,7 +189,7 @@ GetPossibleCharacters(WCHAR* ch, INT chLen, INT codePageIdx)
{ {
INT i, j; INT i, j;
memset(ch, 0, sizeof(ch[0]) * chLen); ZeroMemory(ch, sizeof(ch[0]) * chLen);
if (codePageIdx <= 0 || codePageIdx > SIZEOF(codePages)) if (codePageIdx <= 0 || codePageIdx > SIZEOF(codePages))
{ {
@ -276,11 +249,6 @@ SetFont(PMAP infoPtr,
NULL, NULL,
TRUE); 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 // Get all the valid glyphs in this font
SelectObject(hdc, infoPtr->hFont); SelectObject(hdc, infoPtr->hFont);
@ -345,14 +313,88 @@ NotifyParentOfSelection(PMAP infoPtr,
} }
static
VOID
LimitCaretXY(PMAP infoPtr, INT *pX, INT *pY)
{
INT i, X = *pX, Y = *pY, iYStart = infoPtr->iYStart;
i = XCELLS * (iYStart + Y) + X;
while (i >= infoPtr->NumValidGlyphs)
{
if (X > 0)
{
--X;
}
else
{
X = XCELLS - 1;
--Y;
}
i = XCELLS * (iYStart + Y) + X;
}
*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)
{
InvalidateRect(infoPtr->hMapWnd,
&infoPtr->pActiveCell->CellInt,
FALSE);
}
LimitCaretXY(infoPtr, &X, &Y);
infoPtr->CaretX = X;
infoPtr->CaretY = Y;
UpdateCells(infoPtr);
/* 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 static
VOID VOID
OnClick(PMAP infoPtr, OnClick(PMAP infoPtr,
WORD ptx, WORD ptx,
WORD pty) WORD pty)
{ {
INT x, y, i;
/* /*
* Find the cell the mouse pointer is over. * Find the cell the mouse pointer is over.
* Since each cell is the same size, this can be done quickly using CellSize. * Since each cell is the same size, this can be done quickly using CellSize.
@ -360,47 +402,10 @@ OnClick(PMAP infoPtr,
* larger than infoPtr.CellSize * XCELLS , due to the map size being a non integer * larger than infoPtr.CellSize * XCELLS , due to the map size being a non integer
* multiple of infoPtr.CellSize . * multiple of infoPtr.CellSize .
*/ */
x = min(XCELLS - 1, ptx / max(1, infoPtr->CellSize.cx)); INT x = min(XCELLS - 1, ptx / max(1, infoPtr->CellSize.cx));
y = min(YCELLS - 1, pty / max(1, infoPtr->CellSize.cy)); INT y = min(YCELLS - 1, pty / max(1, infoPtr->CellSize.cy));
/* Make sure the mouse is within a valid glyph */ SetCaretXY(infoPtr, x, y, TRUE, FALSE);
i = XCELLS * infoPtr->iYStart + y * XCELLS + x;
if (i >= infoPtr->NumValidGlyphs)
{
if (infoPtr->pActiveCell)
infoPtr->pActiveCell->bActive = FALSE;
infoPtr->pActiveCell = NULL;
return;
}
/* if the cell is not already active */
if (!infoPtr->Cells[y][x].bActive)
{
/* 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);
}
infoPtr->pActiveCell->bActive = FALSE;
infoPtr->pActiveCell->bLarge = FALSE;
}
/* set new cell to active */
infoPtr->pActiveCell = &infoPtr->Cells[y][x];
infoPtr->pActiveCell->bActive = TRUE;
infoPtr->pActiveCell->bLarge = TRUE;
if (infoPtr->hLrgWnd)
MoveLargeCell(infoPtr);
else
CreateLargeCell(infoPtr);
}
} }
@ -411,21 +416,12 @@ MapOnCreate(PMAP infoPtr,
HWND hParent) HWND hParent)
{ {
RECT rc; RECT rc;
BOOL Ret = FALSE;
infoPtr = HeapAlloc(GetProcessHeap(), infoPtr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MAP));
0, if (!infoPtr)
sizeof(MAP)); return FALSE;
if (infoPtr)
{ SetWindowLongPtrW(hwnd, 0, (LONG_PTR)infoPtr);
SetLastError(0);
SetWindowLongPtrW(hwnd,
0,
(DWORD_PTR)infoPtr);
if (GetLastError() == 0)
{
ZeroMemory(infoPtr,
sizeof(MAP));
infoPtr->hMapWnd = hwnd; infoPtr->hMapWnd = hwnd;
infoPtr->hParent = hParent; infoPtr->hParent = hParent;
@ -436,20 +432,14 @@ MapOnCreate(PMAP infoPtr,
infoPtr->CellSize.cx = infoPtr->ClientSize.cx / XCELLS; infoPtr->CellSize.cx = infoPtr->ClientSize.cx / XCELLS;
infoPtr->CellSize.cy = infoPtr->ClientSize.cy / YCELLS; infoPtr->CellSize.cy = infoPtr->ClientSize.cy / YCELLS;
infoPtr->pActiveCell = NULL; infoPtr->pActiveCell = &infoPtr->Cells[0][0];
SetGrid(infoPtr); SetGrid(infoPtr);
SetScrollPos(infoPtr->hParent, SB_VERT, 0, TRUE); SetScrollPos(infoPtr->hParent, SB_VERT, 0, TRUE);
return TRUE;
Ret = TRUE;
}
}
return Ret;
} }
static static
VOID VOID
OnVScroll(PMAP infoPtr, OnVScroll(PMAP infoPtr,
@ -457,6 +447,7 @@ OnVScroll(PMAP infoPtr,
INT Pos) INT Pos)
{ {
INT iYDiff, iOldYStart = infoPtr->iYStart; INT iYDiff, iOldYStart = infoPtr->iYStart;
INT X, Y;
switch (Value) switch (Value)
{ {
@ -480,6 +471,16 @@ OnVScroll(PMAP infoPtr,
infoPtr->iYStart = Pos; infoPtr->iYStart = Pos;
break; break;
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: default:
break; break;
} }
@ -487,6 +488,13 @@ OnVScroll(PMAP infoPtr,
infoPtr->iYStart = max(0, infoPtr->iYStart); infoPtr->iYStart = max(0, infoPtr->iYStart);
infoPtr->iYStart = min(infoPtr->iYStart, infoPtr->NumRows); 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; iYDiff = iOldYStart - infoPtr->iYStart;
if (iYDiff) if (iYDiff)
{ {
@ -505,7 +513,7 @@ OnVScroll(PMAP infoPtr,
RECT rect; RECT rect;
/* Invalidate the rect around the active cell since a new cell will become active */ /* 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, InvalidateRect(infoPtr->hMapWnd,
&infoPtr->pActiveCell->CellExt, &infoPtr->pActiveCell->CellExt,
@ -536,6 +544,8 @@ OnVScroll(PMAP infoPtr,
ShowWindow(infoPtr->hLrgWnd, SW_SHOW); ShowWindow(infoPtr->hLrgWnd, SW_SHOW);
} }
} }
UpdateStatusBar(infoPtr->pActiveCell->ch);
} }
@ -547,38 +557,172 @@ OnPaint(PMAP infoPtr,
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hdc; HDC hdc;
if (wParam != 0) if (wParam != 0)
{ {
if (!GetUpdateRect(infoPtr->hMapWnd, if (!GetUpdateRect(infoPtr->hMapWnd, &ps.rcPaint, TRUE))
&ps.rcPaint,
TRUE))
{
return; return;
}
ps.hdc = (HDC)wParam; ps.hdc = (HDC)wParam;
} }
else else
{ {
hdc = BeginPaint(infoPtr->hMapWnd, hdc = BeginPaint(infoPtr->hMapWnd, &ps);
&ps);
if (hdc == NULL) if (hdc == NULL)
{
return; return;
} }
}
DrawGrid(infoPtr, &ps);
FillGrid(infoPtr, &ps); FillGrid(infoPtr, &ps);
if (wParam == 0) if (wParam == 0)
{ {
EndPaint(infoPtr->hMapWnd, EndPaint(infoPtr->hMapWnd, &ps);
&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;
}
Y += 1;
}
SetCaretXY(infoPtr, infoPtr->CaretX, Y, IsWindow(infoPtr->hLrgWnd), FALSE);
}
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 */
{
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 LRESULT
CALLBACK CALLBACK
@ -587,13 +731,10 @@ MapWndProc(HWND hwnd,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
PMAP infoPtr; PMAP infoPtr = (PMAP)GetWindowLongPtrW(hwnd, 0);
LRESULT Ret = 0; LRESULT Ret = 0;
WCHAR lfFaceName[LF_FACESIZE]; WCHAR lfFaceName[LF_FACESIZE];
infoPtr = (PMAP)GetWindowLongPtrW(hwnd,
0);
switch (uMsg) switch (uMsg)
{ {
case WM_CREATE: case WM_CREATE:
@ -608,12 +749,16 @@ MapWndProc(HWND hwnd,
break; break;
} }
case WM_KEYDOWN:
{
OnKeyDown(infoPtr, wParam, lParam);
break;
}
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
{ {
OnClick(infoPtr, SetFocus(hwnd);
LOWORD(lParam), OnClick(infoPtr, LOWORD(lParam), HIWORD(lParam));
HIWORD(lParam));
break; break;
} }
@ -621,43 +766,36 @@ MapWndProc(HWND hwnd,
{ {
if (wParam & MK_LBUTTON) if (wParam & MK_LBUTTON)
{ {
OnClick(infoPtr, OnClick(infoPtr, LOWORD(lParam), HIWORD(lParam));
LOWORD(lParam),
HIWORD(lParam));
} }
break; break;
} }
case WM_LBUTTONDBLCLK: case WM_LBUTTONDBLCLK:
{ {
if (!infoPtr->pActiveCell) if (!infoPtr->pActiveCell || GetFocus() != hwnd)
break; break;
NotifyParentOfSelection(infoPtr, NotifyParentOfSelection(infoPtr,
FM_SETCHAR, FM_SETCHAR,
infoPtr->pActiveCell->ch); infoPtr->pActiveCell->ch);
if (infoPtr->pActiveCell->bLarge) if (infoPtr->hLrgWnd)
{ {
DestroyWindow(infoPtr->hLrgWnd); DestroyWindow(infoPtr->hLrgWnd);
infoPtr->hLrgWnd = NULL; infoPtr->hLrgWnd = NULL;
} }
infoPtr->pActiveCell->bLarge = FALSE;
break; break;
} }
case WM_VSCROLL: case WM_VSCROLL:
{ {
OnVScroll(infoPtr, OnVScroll(infoPtr, LOWORD(wParam), HIWORD(wParam));
LOWORD(wParam),
HIWORD(wParam));
break; break;
} }
case FM_SETCHARMAP: case FM_SETCHARMAP:
infoPtr->CaretX = infoPtr->CaretY = infoPtr->iYStart = 0;
infoPtr->CharMap = LOWORD(wParam); infoPtr->CharMap = LOWORD(wParam);
wcsncpy(lfFaceName, wcsncpy(lfFaceName,
infoPtr->CurrentFont.lfFaceName, infoPtr->CurrentFont.lfFaceName,
@ -666,6 +804,7 @@ MapWndProc(HWND hwnd,
break; break;
case FM_SETFONT: case FM_SETFONT:
infoPtr->CaretX = infoPtr->CaretY = infoPtr->iYStart = 0;
SetFont(infoPtr, (LPWSTR)lParam); SetFont(infoPtr, (LPWSTR)lParam);
break; break;
@ -679,33 +818,28 @@ MapWndProc(HWND hwnd,
return (LRESULT)infoPtr->hFont; return (LRESULT)infoPtr->hFont;
case WM_PAINT: case WM_PAINT:
{ OnPaint(infoPtr, wParam);
OnPaint(infoPtr,
wParam);
break; break;
}
case WM_DESTROY: case WM_DESTROY:
{
DeleteObject(infoPtr->hFont); DeleteObject(infoPtr->hFont);
HeapFree(GetProcessHeap(), HeapFree(GetProcessHeap(), 0, infoPtr);
0, SetWindowLongPtrW(hwnd, 0, (LONG_PTR)NULL);
infoPtr); break;
SetWindowLongPtrW(hwnd,
0, case WM_GETDLGCODE:
(DWORD_PTR)NULL); return DLGC_WANTARROWS;
case WM_SETFOCUS:
case WM_KILLFOCUS:
if (!infoPtr->hLrgWnd)
InvalidateRect(hwnd, &(infoPtr->pActiveCell->CellInt), FALSE);
break; break;
}
default: default:
{ Ret = DefWindowProcW(hwnd, uMsg, wParam, lParam);
Ret = DefWindowProcW(hwnd,
uMsg,
wParam,
lParam);
break; break;
} }
}
return Ret; return Ret;
} }
@ -740,9 +874,6 @@ RegisterMapClasses(HINSTANCE hInstance)
VOID VOID
UnregisterMapClasses(HINSTANCE hInstance) UnregisterMapClasses(HINSTANCE hInstance)
{ {
UnregisterClassW(szMapWndClass, UnregisterClassW(szMapWndClass, hInstance);
hInstance); UnregisterClassW(szLrgCellWndClass, hInstance);
UnregisterClassW(szLrgCellWndClass,
hInstance);
} }

View file

@ -37,8 +37,6 @@ typedef struct _CELL
{ {
RECT CellExt; RECT CellExt;
RECT CellInt; RECT CellInt;
BOOL bActive;
BOOL bLarge;
WCHAR ch; WCHAR ch;
} CELL, *PCELL; } CELL, *PCELL;
@ -53,13 +51,13 @@ typedef struct _MAP
PCELL pActiveCell; PCELL pActiveCell;
HFONT hFont; HFONT hFont;
LOGFONTW CurrentFont; LOGFONTW CurrentFont;
INT CaretX, CaretY;
INT iYStart; INT iYStart;
INT NumRows; INT NumRows;
INT CharMap; INT CharMap;
USHORT ValidGlyphs[MAX_GLYPHS]; USHORT ValidGlyphs[MAX_GLYPHS];
USHORT NumValidGlyphs; USHORT NumValidGlyphs;
} MAP, *PMAP; } MAP, *PMAP;
typedef struct { typedef struct {