ReactOS 0.4.16-dev-336-gb667d82
map.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Character Map
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/applications/charmap/map.c
5 * PURPOSE: class implementation for painting glyph region
6 * COPYRIGHT: Copyright 2007 Ged Murphy <gedmurphy@reactos.org>
7 * Copyright 2022 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
8 *
9 */
10
11#include "precomp.h"
12
13#include <stdlib.h>
14#include <winnls.h>
15
16static const WCHAR szMapWndClass[] = L"FontMapWnd";
17static const WCHAR szLrgCellWndClass[] = L"LrgCellWnd";
18
19#define MAX_ROWS (0xFFFF / XCELLS) + 1 - YCELLS
20
21static
22VOID
23SetGrid(PMAP infoPtr)
24{
25 INT x, y;
26 PCELL Cell;
27
28 for (y = 0; y < YCELLS; y++)
29 for (x = 0; x < XCELLS; x++)
30 {
31 Cell = &infoPtr->Cells[y][x];
32 Cell->CellExt.left = x * infoPtr->CellSize.cx + 1;
33 Cell->CellExt.top = y * infoPtr->CellSize.cy + 1;
34 Cell->CellExt.right = (x + 1) * infoPtr->CellSize.cx + 2;
35 Cell->CellExt.bottom = (y + 1) * infoPtr->CellSize.cy + 2;
36
37 Cell->CellInt = Cell->CellExt;
38
39 InflateRect(&Cell->CellInt, -1, -1);
40 }
41}
42
43static
44VOID
46{
47 INT x, y;
48 INT i = XCELLS * infoPtr->iYStart;
49 WCHAR ch;
50 PCELL Cell;
51
52 for (y = 0; y < YCELLS; ++y)
53 {
54 for (x = 0; x < XCELLS; ++x, ++i)
55 {
56 if (i < infoPtr->NumValidGlyphs)
57 ch = (WCHAR)infoPtr->ValidGlyphs[i];
58 else
59 ch = 0xFFFF;
60
61 Cell = &infoPtr->Cells[y][x];
62 Cell->ch = ch;
63 }
64 }
65}
66
67static
68VOID
69FillGrid(PMAP infoPtr,
70 PAINTSTRUCT *ps)
71{
72 HFONT hOldFont;
73 INT x, y;
74 RECT rc;
75 PCELL Cell;
76 INT i;
77 HBRUSH hOldBrush, hbrGray = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
78 HPEN hOldPen, hPenGray = CreatePen(PS_SOLID, 1, RGB(140, 140, 140));
79
80 UpdateCells(infoPtr);
81
82 hOldFont = SelectObject(ps->hdc, infoPtr->hFont);
84 hOldBrush = SelectObject(ps->hdc, GetStockObject(WHITE_BRUSH));
85
86 i = XCELLS * infoPtr->iYStart;
87
88 for (y = 0; y < YCELLS; y++)
89 {
90 for (x = 0; x < XCELLS; x++, i++)
91 {
92 Cell = &infoPtr->Cells[y][x];
93 if (!IntersectRect(&rc, &ps->rcPaint, &Cell->CellExt))
94 continue;
95
96 rc = Cell->CellExt;
97 Rectangle(ps->hdc, rc.left, rc.top, rc.right, rc.bottom);
98
99 if (i < infoPtr->NumValidGlyphs)
100 {
101 DrawTextW(ps->hdc, &Cell->ch, 1, &Cell->CellInt,
103 if (Cell == infoPtr->pActiveCell)
104 {
105 rc = Cell->CellInt;
106
107 /* Draw gray box */
109 SelectObject(ps->hdc, hPenGray);
110 Rectangle(ps->hdc, rc.left, rc.top, rc.right, rc.bottom);
111 SelectObject(ps->hdc, hOldPen);
112 SelectObject(ps->hdc, hOldBrush);
113
114 if (GetFocus() == infoPtr->hMapWnd)
115 {
116 /* Draw focus rectangle */
117 InflateRect(&rc, -1, -1);
118 DrawFocusRect(ps->hdc, &rc);
119 }
120 }
121 }
122 else
123 {
124 FillRect(ps->hdc, &Cell->CellInt, hbrGray);
125 }
126 }
127 }
128
129 SelectObject(ps->hdc, hOldFont);
130 SelectObject(ps->hdc, hOldPen);
131 SelectObject(ps->hdc, hOldBrush);
132 DeleteObject(hPenGray);
133}
134
135
136static
137BOOL
139{
140 RECT rLarge = infoPtr->pActiveCell->CellExt;
141
142 MapWindowPoints(infoPtr->hMapWnd, infoPtr->hParent, (LPPOINT)&rLarge, 2);
143
144 InflateRect(&rLarge, XLARGE - XCELLS, YLARGE - YCELLS);
145
146 infoPtr->hLrgWnd = CreateWindowExW(0,
148 NULL,
150 rLarge.left,
151 rLarge.top,
152 rLarge.right - rLarge.left,
153 rLarge.bottom - rLarge.top,
154 infoPtr->hParent,
155 NULL,
156 hInstance,
157 infoPtr);
158 if (!infoPtr->hLrgWnd)
159 return FALSE;
160
161 return TRUE;
162}
163
164
165static
166VOID
168{
169 RECT rLarge = infoPtr->pActiveCell->CellExt;
170
171 MapWindowPoints(infoPtr->hMapWnd, infoPtr->hParent, (LPPOINT)&rLarge, 2);
172
173 InflateRect(&rLarge, XLARGE - XCELLS, YLARGE - YCELLS);
174
175 MoveWindow(infoPtr->hLrgWnd,
176 rLarge.left,
177 rLarge.top,
178 rLarge.right - rLarge.left,
179 rLarge.bottom - rLarge.top,
180 TRUE);
181
182 InvalidateRect(infoPtr->hLrgWnd, NULL, TRUE);
183}
184
185
186static
187VOID
188GetPossibleCharacters(WCHAR* ch, INT chLen, INT codePageIdx)
189{
190 INT i, j;
191
192 ZeroMemory(ch, sizeof(ch[0]) * chLen);
193
194 if (codePageIdx <= 0 || codePageIdx > SIZEOF(codePages))
195 {
196 /* this is unicode, so just load up the first MAX_GLYPHS characters
197 start at 0x21 to bypass whitespace characters */
198 INT len = min(MAX_GLYPHS, chLen);
199 for (i = 0x21, j = 0; i < len; i++)
200 ch[j++] = (WCHAR)i;
201 }
202 else
203 {
204 /* This is a codepage, so use NLS to translate the first 256 characters */
205 CHAR multiByteString[256] = { 0 };
206 for (i = 0x21; i < SIZEOF(multiByteString); i++)
207 multiByteString[i] = (CHAR)i;
208
209 if (!MultiByteToWideChar(codePages[codePageIdx - 1], 0, multiByteString, sizeof(multiByteString), ch, chLen))
210 {
211 /* Failed for some reason, so clear the array */
212 memset(ch, 0, sizeof(ch[0]) * chLen);
213 }
214 }
215}
216
217
218static
219VOID
220SetFont(PMAP infoPtr,
221 LPWSTR lpFontName)
222{
223 HDC hdc;
224 WCHAR ch[MAX_GLYPHS];
226 DWORD i, j;
227
228 /* Destroy Zoom window, since it was created with older font */
229 DestroyWindow(infoPtr->hLrgWnd);
230 infoPtr->hLrgWnd = NULL;
231
232 if (infoPtr->hFont)
233 DeleteObject(infoPtr->hFont);
234
235 ZeroMemory(&infoPtr->CurrentFont,
236 sizeof(LOGFONTW));
237
238 hdc = GetDC(infoPtr->hMapWnd);
240
243 lpFontName,
244 SIZEOF(infoPtr->CurrentFont.lfFaceName));
245
246 infoPtr->hFont = CreateFontIndirectW(&infoPtr->CurrentFont);
247
248 InvalidateRect(infoPtr->hMapWnd,
249 NULL,
250 TRUE);
251
252 // Get all the valid glyphs in this font
253
254 SelectObject(hdc, infoPtr->hFont);
255
256 // Get the code page associated with the selected 'character set'
258
260 ch,
262 out,
264 {
265 j = 0;
266 for (i = 0; i < MAX_GLYPHS; i++)
267 {
268 if (out[i] != 0xffff && out[i] != 0x0000 && ch[i] != 0x0000)
269 {
270 infoPtr->ValidGlyphs[j] = ch[i];
271 j++;
272 }
273 }
274 infoPtr->NumValidGlyphs = j;
275 }
276
277 ReleaseDC(infoPtr->hMapWnd, hdc);
278
279 infoPtr->NumRows = infoPtr->NumValidGlyphs / XCELLS;
280 if (infoPtr->NumValidGlyphs % XCELLS)
281 infoPtr->NumRows += 1;
282 infoPtr->NumRows = (infoPtr->NumRows > YCELLS) ? infoPtr->NumRows - YCELLS : 0;
283
284 SetScrollRange(infoPtr->hMapWnd, SB_VERT, 0, infoPtr->NumRows, FALSE);
285 SetScrollPos(infoPtr->hMapWnd, SB_VERT, 0, TRUE);
286 infoPtr->iYStart = 0;
287}
288
289
290static
293 UINT code,
294 WCHAR ch)
295{
296 LRESULT Ret = 0;
297
298 if (infoPtr->hParent != NULL)
299 {
300 DWORD dwIdc = GetWindowLongPtr(infoPtr->hMapWnd, GWLP_ID);
301 /*
302 * Push directly into the event queue instead of waiting
303 * the parent to be unlocked.
304 * High word of LPARAM is still available for future needs...
305 */
306 Ret = PostMessage(infoPtr->hParent,
308 MAKELPARAM((WORD)dwIdc, (WORD)code),
309 (LPARAM)LOWORD(ch));
310 }
311
312 return Ret;
313}
314
315
316static
317VOID
318LimitCaretXY(PMAP infoPtr, INT *pX, INT *pY)
319{
320 INT i, X = *pX, Y = *pY, iYStart = infoPtr->iYStart;
321
322 i = XCELLS * (iYStart + Y) + X;
323 while (i >= infoPtr->NumValidGlyphs)
324 {
325 if (X > 0)
326 {
327 --X;
328 }
329 else
330 {
331 X = XCELLS - 1;
332 --Y;
333 }
334 i = XCELLS * (iYStart + Y) + X;
335 }
336
337 *pX = X;
338 *pY = Y;
339}
340
341static
342VOID
343SetCaretXY(PMAP infoPtr, INT X, INT Y, BOOL bLarge, BOOL bInvalidateAll)
344{
345
346 /* set previous active cell to inactive */
347 if (!bInvalidateAll)
348 {
349 InvalidateRect(infoPtr->hMapWnd,
350 &infoPtr->pActiveCell->CellInt,
351 FALSE);
352 }
353
354 LimitCaretXY(infoPtr, &X, &Y);
355 infoPtr->CaretX = X;
356 infoPtr->CaretY = Y;
357 UpdateCells(infoPtr);
358
359 /* set new cell to active */
360 infoPtr->pActiveCell = &infoPtr->Cells[Y][X];
361 if (!bInvalidateAll)
362 {
363 InvalidateRect(infoPtr->hMapWnd,
364 &infoPtr->pActiveCell->CellInt,
365 FALSE);
366 }
367
368 /* Create if needed */
369 if (bLarge)
370 {
371 if (infoPtr->hLrgWnd)
372 MoveLargeCell(infoPtr);
373 else
374 CreateLargeCell(infoPtr);
375 }
376 else
377 {
378 /* Destroy large window */
379 if (infoPtr->hLrgWnd)
380 {
381 DestroyWindow(infoPtr->hLrgWnd);
382 infoPtr->hLrgWnd = NULL;
383 }
384 }
385
386 if (bInvalidateAll)
387 InvalidateRect(infoPtr->hMapWnd, NULL, FALSE);
388
389 UpdateStatusBar(infoPtr->pActiveCell->ch);
390}
391
392static
393VOID
394OnClick(PMAP infoPtr,
395 WORD ptx,
396 WORD pty)
397{
398 /*
399 * Find the cell the mouse pointer is over.
400 * Since each cell is the same size, this can be done quickly using CellSize.
401 * Clamp to XCELLS - 1 and YCELLS - 1 because the map can sometimes be slightly
402 * larger than infoPtr.CellSize * XCELLS , due to the map size being a non integer
403 * multiple of infoPtr.CellSize .
404 */
405 INT x = min(XCELLS - 1, ptx / max(1, infoPtr->CellSize.cx));
406 INT y = min(YCELLS - 1, pty / max(1, infoPtr->CellSize.cy));
407
408 SetCaretXY(infoPtr, x, y, TRUE, FALSE);
409}
410
411
412static
413BOOL
415 HWND hwnd,
416 HWND hParent)
417{
418 RECT rc;
419
420 infoPtr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MAP));
421 if (!infoPtr)
422 return FALSE;
423
424 SetWindowLongPtrW(hwnd, 0, (LONG_PTR)infoPtr);
425
426 infoPtr->hMapWnd = hwnd;
427 infoPtr->hParent = hParent;
428
429 GetClientRect(hwnd, &rc);
430 infoPtr->ClientSize.cx = rc.right;
431 infoPtr->ClientSize.cy = rc.bottom;
432 infoPtr->CellSize.cx = infoPtr->ClientSize.cx / XCELLS;
433 infoPtr->CellSize.cy = infoPtr->ClientSize.cy / YCELLS;
434
435 infoPtr->pActiveCell = &infoPtr->Cells[0][0];
436
437 SetGrid(infoPtr);
438
439 SetScrollPos(infoPtr->hParent, SB_VERT, 0, TRUE);
440 return TRUE;
441}
442
443static
444VOID
446 INT Value,
447 INT Pos)
448{
449 INT iYDiff, iOldYStart = infoPtr->iYStart;
450 INT X, Y;
451
452 switch (Value)
453 {
454 case SB_LINEUP:
455 infoPtr->iYStart -= 1;
456 break;
457
458 case SB_LINEDOWN:
459 infoPtr->iYStart += 1;
460 break;
461
462 case SB_PAGEUP:
463 infoPtr->iYStart -= YCELLS;
464 break;
465
466 case SB_PAGEDOWN:
467 infoPtr->iYStart += YCELLS;
468 break;
469
470 case SB_THUMBTRACK:
471 infoPtr->iYStart = Pos;
472 break;
473
474 case SB_TOP:
475 infoPtr->iYStart = 0;
476 SetCaretXY(infoPtr, 0, 0, FALSE, TRUE);
477 return;
478
479 case SB_BOTTOM:
480 infoPtr->iYStart = infoPtr->NumRows;
481 SetCaretXY(infoPtr, XCELLS - 1, YCELLS - 1, FALSE, TRUE);
482 break;
483
484 default:
485 break;
486 }
487
488 infoPtr->iYStart = max(0, infoPtr->iYStart);
489 infoPtr->iYStart = min(infoPtr->iYStart, infoPtr->NumRows);
490
491 UpdateCells(infoPtr);
492
493 X = infoPtr->CaretX;
494 Y = infoPtr->CaretY;
495 LimitCaretXY(infoPtr, &X, &Y);
496 SetCaretXY(infoPtr, X, Y, IsWindow(infoPtr->hLrgWnd), FALSE);
497
498 iYDiff = iOldYStart - infoPtr->iYStart;
499 if (iYDiff)
500 {
501 if (infoPtr->hLrgWnd != NULL)
502 {
503 ShowWindow(infoPtr->hLrgWnd, SW_HIDE);
504 }
505
506 SetScrollPos(infoPtr->hMapWnd,
507 SB_VERT,
508 infoPtr->iYStart,
509 TRUE);
510
511 if (abs(iYDiff) < YCELLS)
512 {
513 RECT rect;
514
515 /* Invalidate the rect around the active cell since a new cell will become active */
516 if (infoPtr->pActiveCell)
517 {
518 InvalidateRect(infoPtr->hMapWnd,
519 &infoPtr->pActiveCell->CellExt,
520 TRUE);
521 }
522
523 GetClientRect(infoPtr->hMapWnd, &rect);
524 rect.top += 2;
525 rect.bottom -= 2;
526 ScrollWindowEx(infoPtr->hMapWnd,
527 0,
528 iYDiff * infoPtr->CellSize.cy,
529 &rect,
530 &rect,
531 NULL,
532 NULL,
534 }
535 else
536 {
537 InvalidateRect(infoPtr->hMapWnd,
538 NULL,
539 TRUE);
540 }
541
542 if (infoPtr->hLrgWnd != NULL)
543 {
544 ShowWindow(infoPtr->hLrgWnd, SW_SHOW);
545 }
546 }
547
548 UpdateStatusBar(infoPtr->pActiveCell->ch);
549}
550
551
552static
553VOID
554OnPaint(PMAP infoPtr,
556{
557 PAINTSTRUCT ps;
558 HDC hdc;
559
560 if (wParam != 0)
561 {
562 if (!GetUpdateRect(infoPtr->hMapWnd, &ps.rcPaint, TRUE))
563 return;
564
565 ps.hdc = (HDC)wParam;
566 }
567 else
568 {
569 hdc = BeginPaint(infoPtr->hMapWnd, &ps);
570 if (hdc == NULL)
571 return;
572 }
573
574 FillGrid(infoPtr, &ps);
575
576 if (wParam == 0)
577 {
578 EndPaint(infoPtr->hMapWnd, &ps);
579 }
580}
581
582static
583VOID
584MoveUpDown(PMAP infoPtr, INT DY)
585{
586 INT Y = infoPtr->CaretY;
587
588 if (DY < 0) /* Move Up */
589 {
590 if (Y <= 0)
591 {
593 return;
594 }
595
596 Y -= 1;
597 }
598 else if (DY > 0) /* Move Down */
599 {
600 if (Y + 1 >= YCELLS)
601 {
603 return;
604 }
605
606 Y += 1;
607 }
608
609 SetCaretXY(infoPtr, infoPtr->CaretX, Y, IsWindow(infoPtr->hLrgWnd), FALSE);
610}
611
612static
613VOID
615{
616 INT X = infoPtr->CaretX;
617 INT Y = infoPtr->CaretY;
618
619 if (DX < 0) /* Move Left */
620 {
621 if (X <= 0) /* at left edge */
622 {
623 if (Y <= 0) /* at top */
624 {
625 Y = 0;
626 if (infoPtr->iYStart > 0)
627 X = XCELLS - 1;
629 }
630 else
631 {
632 X = XCELLS - 1;
633 Y -= 1;
634 }
635 }
636 else /* Not at left edge */
637 {
638 X -= 1;
639 }
640 }
641 else if (DX > 0) /* Move Right */
642 {
643 if (X + 1 >= XCELLS) /* at right edge */
644 {
645 if (Y + 1 >= YCELLS) /* at bottom */
646 {
647 Y = YCELLS - 1;
648 if (infoPtr->iYStart < infoPtr->NumRows)
649 X = 0;
651 }
652 else
653 {
654 X = 0;
655 Y += 1;
656 }
657 }
658 else
659 {
660 X += 1;
661 }
662 }
663
664 SetCaretXY(infoPtr, X, Y, IsWindow(infoPtr->hLrgWnd), FALSE);
665}
666
667static
668VOID
670{
671 BOOL bCtrlDown = (GetKeyState(VK_CONTROL) < 0);
672
673 switch (wParam)
674 {
675 case VK_UP:
676 if (bCtrlDown)
677 SetCaretXY(infoPtr, infoPtr->CaretX, 0, FALSE, FALSE);
678 else
679 MoveUpDown(infoPtr, -1);
680 break;
681
682 case VK_DOWN:
683 if (bCtrlDown)
684 SetCaretXY(infoPtr, infoPtr->CaretX, YCELLS - 1, FALSE, FALSE);
685 else
686 MoveUpDown(infoPtr, +1);
687 break;
688
689 case VK_LEFT:
690 if (bCtrlDown)
691 SetCaretXY(infoPtr, 0, infoPtr->CaretY, FALSE, FALSE);
692 else
693 MoveLeftRight(infoPtr, -1);
694 break;
695
696 case VK_RIGHT:
697 if (bCtrlDown)
698 SetCaretXY(infoPtr, XCELLS - 1, infoPtr->CaretY, FALSE, FALSE);
699 else
700 MoveLeftRight(infoPtr, +1);
701 break;
702
703 case VK_PRIOR: /* Page Up */
705 break;
706
707 case VK_NEXT: /* Page Down */
709 break;
710
711 case VK_HOME:
712 if (bCtrlDown)
714 else
715 SetCaretXY(infoPtr, 0, infoPtr->CaretY, FALSE, FALSE);
716 break;
717
718 case VK_END:
719 if (bCtrlDown)
721 else
722 SetCaretXY(infoPtr, XCELLS - 1, infoPtr->CaretY, FALSE, FALSE);
723 break;
724 }
725}
726
730 UINT uMsg,
733{
734 PMAP infoPtr = (PMAP)GetWindowLongPtrW(hwnd, 0);
735 LRESULT Ret = 0;
736 WCHAR lfFaceName[LF_FACESIZE];
737
738 switch (uMsg)
739 {
740 case WM_CREATE:
741 {
742 if (!MapOnCreate(infoPtr,
743 hwnd,
745 {
746 return (LRESULT)-1;
747 }
748
749 break;
750 }
751
752 case WM_KEYDOWN:
753 {
754 OnKeyDown(infoPtr, wParam, lParam);
755 break;
756 }
757
758 case WM_LBUTTONDOWN:
759 {
760 SetFocus(hwnd);
761 OnClick(infoPtr, LOWORD(lParam), HIWORD(lParam));
762 break;
763 }
764
765 case WM_MOUSEMOVE:
766 {
767 if (wParam & MK_LBUTTON)
768 {
769 OnClick(infoPtr, LOWORD(lParam), HIWORD(lParam));
770 }
771 break;
772 }
773
774 case WM_LBUTTONDBLCLK:
775 {
776 if (!infoPtr->pActiveCell || GetFocus() != hwnd)
777 break;
778
781 infoPtr->pActiveCell->ch);
782
783 if (infoPtr->hLrgWnd)
784 {
785 DestroyWindow(infoPtr->hLrgWnd);
786 infoPtr->hLrgWnd = NULL;
787 }
788 break;
789 }
790
791 case WM_VSCROLL:
792 {
793 OnVScroll(infoPtr, LOWORD(wParam), HIWORD(wParam));
794 break;
795 }
796
797 case FM_SETCHARMAP:
798 infoPtr->CaretX = infoPtr->CaretY = infoPtr->iYStart = 0;
799 infoPtr->CharMap = LOWORD(wParam);
800 wcsncpy(lfFaceName,
801 infoPtr->CurrentFont.lfFaceName,
802 SIZEOF(lfFaceName));
803 SetFont(infoPtr, lfFaceName);
804 break;
805
806 case FM_SETFONT:
807 infoPtr->CaretX = infoPtr->CaretY = infoPtr->iYStart = 0;
808 SetFont(infoPtr, (LPWSTR)lParam);
809 break;
810
811 case FM_GETCHAR:
812 {
813 if (!infoPtr->pActiveCell) return 0;
814 return infoPtr->pActiveCell->ch;
815 }
816
817 case FM_GETHFONT:
818 return (LRESULT)infoPtr->hFont;
819
820 case WM_PAINT:
821 OnPaint(infoPtr, wParam);
822 break;
823
824 case WM_DESTROY:
825 DeleteObject(infoPtr->hFont);
826 HeapFree(GetProcessHeap(), 0, infoPtr);
828 break;
829
830 case WM_GETDLGCODE:
831 return DLGC_WANTARROWS;
832
833 case WM_SETFOCUS:
834 case WM_KILLFOCUS:
835 if (!infoPtr->hLrgWnd)
837 break;
838
839 default:
840 Ret = DefWindowProcW(hwnd, uMsg, wParam, lParam);
841 break;
842 }
843
844 return Ret;
845}
846
847
848BOOL
850{
851 WNDCLASSW wc = {0};
852
853 wc.style = CS_DBLCLKS;
855 wc.cbWndExtra = sizeof(PMAP);
856 wc.hInstance = hInstance;
859 wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
861
862 if (RegisterClassW(&wc))
863 {
865 wc.cbWndExtra = 0;
867
868 return RegisterClassW(&wc) != 0;
869 }
870
871 return FALSE;
872}
873
874VOID
876{
879}
#define FM_GETHFONT
Definition: precomp.h:25
#define MAX_GLYPHS
Definition: precomp.h:15
#define YCELLS
Definition: precomp.h:18
struct _MAP * PMAP
#define XLARGE
Definition: precomp.h:19
#define XCELLS
Definition: precomp.h:17
static const UINT codePages[]
Definition: precomp.h:29
#define FM_SETFONT
Definition: precomp.h:22
#define FM_GETCHAR
Definition: precomp.h:23
#define YLARGE
Definition: precomp.h:20
#define FM_SETCHAR
Definition: precomp.h:24
#define FM_SETCHARMAP
Definition: precomp.h:26
#define SIZEOF(_ar)
Definition: calc.h:97
HINSTANCE hInstance
Definition: charmap.c:19
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static HWND hwndParent
Definition: cryptui.c:300
ush Pos
Definition: deflate.h:92
#define LF_FACESIZE
Definition: dimm.idl:39
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define Y(I)
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define MultiByteToWideChar
Definition: compat.h:110
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define lstrcpynW
Definition: compat.h:738
#define RGB(r, g, b)
Definition: precomp.h:71
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
pKey DeleteObject()
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define X(b, s)
#define DX
Definition: i386-dis.c:425
LRESULT CALLBACK LrgCellWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: lrgcell.c:68
static VOID GetPossibleCharacters(WCHAR *ch, INT chLen, INT codePageIdx)
Definition: map.c:188
static VOID OnKeyDown(PMAP infoPtr, WPARAM wParam, LPARAM lParam)
Definition: map.c:669
static VOID MoveLargeCell(PMAP infoPtr)
Definition: map.c:167
static const WCHAR szMapWndClass[]
Definition: map.c:16
static BOOL CreateLargeCell(PMAP infoPtr)
Definition: map.c:138
static VOID OnVScroll(PMAP infoPtr, INT Value, INT Pos)
Definition: map.c:445
static VOID MoveLeftRight(PMAP infoPtr, INT DX)
Definition: map.c:614
VOID UnregisterMapClasses(HINSTANCE hInstance)
Definition: map.c:875
static const WCHAR szLrgCellWndClass[]
Definition: map.c:17
static VOID SetFont(PMAP infoPtr, LPWSTR lpFontName)
Definition: map.c:220
static VOID FillGrid(PMAP infoPtr, PAINTSTRUCT *ps)
Definition: map.c:69
static VOID SetCaretXY(PMAP infoPtr, INT X, INT Y, BOOL bLarge, BOOL bInvalidateAll)
Definition: map.c:343
LRESULT CALLBACK MapWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: map.c:729
BOOL RegisterMapClasses(HINSTANCE hInstance)
Definition: map.c:849
static VOID OnClick(PMAP infoPtr, WORD ptx, WORD pty)
Definition: map.c:394
static VOID UpdateCells(PMAP infoPtr)
Definition: map.c:45
static VOID OnPaint(PMAP infoPtr, WPARAM wParam)
Definition: map.c:554
static BOOL MapOnCreate(PMAP infoPtr, HWND hwnd, HWND hParent)
Definition: map.c:414
static LRESULT NotifyParentOfSelection(PMAP infoPtr, UINT code, WCHAR ch)
Definition: map.c:292
static VOID SetGrid(PMAP infoPtr)
Definition: map.c:23
static VOID MoveUpDown(PMAP infoPtr, INT DY)
Definition: map.c:584
static VOID LimitCaretXY(PMAP infoPtr, INT *pX, INT *pY)
Definition: map.c:318
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define min(a, b)
Definition: monoChain.cc:55
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_CHILDWINDOW
Definition: pedump.c:639
static FILE * out
Definition: regtests2xml.c:44
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
#define memset(x, y, z)
Definition: compat.h:39
void UpdateStatusBar(void)
Definition: solitaire.cpp:150
& rect
Definition: startmenu.cpp:1413
LONG lfHeight
Definition: dimm.idl:59
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
BYTE lfCharSet
Definition: dimm.idl:67
Definition: precomp.h:37
RECT CellExt
Definition: precomp.h:38
WCHAR ch
Definition: precomp.h:40
RECT CellInt
Definition: precomp.h:39
Definition: precomp.h:44
HWND hLrgWnd
Definition: precomp.h:47
INT iYStart
Definition: precomp.h:55
INT NumRows
Definition: precomp.h:56
SIZE ClientSize
Definition: precomp.h:48
USHORT ValidGlyphs[MAX_GLYPHS]
Definition: precomp.h:59
CELL Cells[YCELLS][XCELLS]
Definition: precomp.h:50
HWND hMapWnd
Definition: precomp.h:45
HFONT hFont
Definition: precomp.h:52
INT CaretX
Definition: precomp.h:54
HWND hParent
Definition: precomp.h:46
INT CaretY
Definition: precomp.h:54
SIZE CellSize
Definition: precomp.h:49
INT CharMap
Definition: precomp.h:57
LOGFONTW CurrentFont
Definition: precomp.h:53
USHORT NumValidGlyphs
Definition: precomp.h:60
PCELL pActiveCell
Definition: precomp.h:51
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
LPCWSTR lpszClassName
Definition: winuser.h:3188
HBRUSH hbrBackground
Definition: winuser.h:3186
HINSTANCE hInstance
Definition: winuser.h:3183
UINT style
Definition: winuser.h:3179
WNDPROC lpfnWndProc
Definition: winuser.h:3180
int cbWndExtra
Definition: winuser.h:3182
HCURSOR hCursor
Definition: winuser.h:3185
Definition: inflate.c:139
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define max(a, b)
Definition: svc.c:63
#define GetWindowLongPtr
Definition: treelist.c:73
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
#define ZeroMemory
Definition: winbase.h:1737
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
HGDIOBJ WINAPI GetStockObject(_In_ int)
DWORD WINAPI GetGlyphIndicesW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpstr, _In_ int c, _Out_writes_(c) LPWORD pgi, _In_ DWORD fl)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LTGRAY_BRUSH
Definition: wingdi.h:900
#define LOGPIXELSY
Definition: wingdi.h:719
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define WHITE_BRUSH
Definition: wingdi.h:902
#define NULL_BRUSH
Definition: wingdi.h:901
#define BLACK_PEN
Definition: wingdi.h:903
#define GDI_ERROR
Definition: wingdi.h:1309
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define GGI_MARK_NONEXISTING_GLYPHS
Definition: wingdi.h:1085
#define PS_SOLID
Definition: wingdi.h:586
#define WM_PAINT
Definition: winuser.h:1623
HWND WINAPI GetFocus(void)
Definition: window.c:1865
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define MAKEWPARAM(l, h)
Definition: winuser.h:4012
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define SW_HIDE
Definition: winuser.h:771
#define SB_THUMBTRACK
Definition: winuser.h:573
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define SB_LINEUP
Definition: winuser.h:564
#define MAKELPARAM(l, h)
Definition: winuser.h:4011
#define COLOR_WINDOW
Definition: winuser.h:921
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define DT_CENTER
Definition: winuser.h:527
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_VSCROLL
Definition: winuser.h:1747
#define WM_CREATE
Definition: winuser.h:1611
#define SB_VERT
Definition: winuser.h:553
#define SB_BOTTOM
Definition: winuser.h:577
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1781
#define WM_COMMAND
Definition: winuser.h:1743
#define SW_INVALIDATE
Definition: winuser.h:2582
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:687
#define VK_CONTROL
Definition: winuser.h:2206
#define VK_UP
Definition: winuser.h:2228
#define WM_SETFOCUS
Definition: winuser.h:1616
#define WM_MOUSEMOVE
Definition: winuser.h:1778
#define CS_DBLCLKS
Definition: winuser.h:651
#define WM_LBUTTONDOWN
Definition: winuser.h:1779
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2157
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
int WINAPI SetScrollPos(_In_ HWND, _In_ int, _In_ int, _In_ BOOL)
#define VK_NEXT
Definition: winuser.h:2224
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI SetScrollRange(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define VK_END
Definition: winuser.h:2225
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define VK_HOME
Definition: winuser.h:2226
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define DLGC_WANTARROWS
Definition: winuser.h:2613
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
#define SB_PAGEDOWN
Definition: winuser.h:569
HDC WINAPI GetDC(_In_opt_ HWND)
#define SB_LINEDOWN
Definition: winuser.h:565
#define DT_VCENTER
Definition: winuser.h:543
#define PostMessage
Definition: winuser.h:5844
#define VK_LEFT
Definition: winuser.h:2227
#define VK_RIGHT
Definition: winuser.h:2229
#define SB_TOP
Definition: winuser.h:578
#define VK_DOWN
Definition: winuser.h:2230
#define GWLP_ID
Definition: winuser.h:863
#define MK_LBUTTON
Definition: winuser.h:2370
#define SW_SHOW
Definition: winuser.h:778
#define VK_PRIOR
Definition: winuser.h:2223
#define WM_DESTROY
Definition: winuser.h:1612
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
#define WM_KEYDOWN
Definition: winuser.h:1718
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define SetWindowLongPtrW
Definition: winuser.h:5358
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
BOOL WINAPI GetUpdateRect(_In_ HWND, _Out_opt_ LPRECT, _In_ BOOL)
BOOL WINAPI DestroyWindow(_In_ HWND)
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)
#define WM_KILLFOCUS
Definition: winuser.h:1617
#define SB_PAGEUP
Definition: winuser.h:568
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define WM_GETDLGCODE
Definition: winuser.h:1692
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
SHORT WINAPI GetKeyState(_In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
char CHAR
Definition: xmlstorage.h:175