ReactOS  0.4.15-dev-1074-gffc96d2
map.c File Reference
#include "precomp.h"
#include <stdlib.h>
#include <winnls.h>
Include dependency graph for map.c:

Go to the source code of this file.

Macros

#define MAX_ROWS   (0xFFFF / XCELLS) + 1 - YCELLS
 

Functions

static VOID SetGrid (PMAP infoPtr)
 
static VOID DrawActiveCell (PMAP infoPtr, HDC hdc)
 
static VOID DrawGrid (PMAP infoPtr, PAINTSTRUCT *ps)
 
static VOID FillGrid (PMAP infoPtr, PAINTSTRUCT *ps)
 
static BOOL CreateLargeCell (PMAP infoPtr)
 
static VOID MoveLargeCell (PMAP infoPtr)
 
static VOID GetPossibleCharacters (WCHAR *ch, INT chLen, INT codePageIdx)
 
static VOID SetFont (PMAP infoPtr, LPWSTR lpFontName)
 
static LRESULT NotifyParentOfSelection (PMAP infoPtr, UINT code, WCHAR ch)
 
static VOID OnClick (PMAP infoPtr, WORD ptx, WORD pty)
 
static BOOL MapOnCreate (PMAP infoPtr, HWND hwnd, HWND hParent)
 
static VOID OnVScroll (PMAP infoPtr, INT Value, INT Pos)
 
static VOID OnPaint (PMAP infoPtr, WPARAM wParam)
 
LRESULT CALLBACK MapWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL RegisterMapClasses (HINSTANCE hInstance)
 
VOID UnregisterMapClasses (HINSTANCE hInstance)
 

Variables

static const WCHAR szMapWndClass [] = L"FontMapWnd"
 
static const WCHAR szLrgCellWndClass [] = L"LrgCellWnd"
 

Macro Definition Documentation

◆ MAX_ROWS

#define MAX_ROWS   (0xFFFF / XCELLS) + 1 - YCELLS

Definition at line 18 of file map.c.

Function Documentation

◆ CreateLargeCell()

static BOOL CreateLargeCell ( PMAP  infoPtr)
static

Definition at line 147 of file map.c.

148 {
149  RECT rLarge;
150 
151  CopyRect(&rLarge,
152  &infoPtr->pActiveCell->CellExt);
153 
154  MapWindowPoints(infoPtr->hMapWnd,
155  infoPtr->hParent,
156  (VOID*)&rLarge,
157  2);
158 
159  InflateRect(&rLarge,
160  XLARGE - XCELLS,
161  YLARGE - YCELLS);
162 
163  infoPtr->hLrgWnd = CreateWindowExW(0,
165  NULL,
167  rLarge.left,
168  rLarge.top,
169  rLarge.right - rLarge.left,
170  rLarge.bottom - rLarge.top,
171  infoPtr->hParent,
172  NULL,
173  hInstance,
174  infoPtr);
175  if (!infoPtr->hLrgWnd)
176  return FALSE;
177 
178  return TRUE;
179 }
HWND hParent
Definition: precomp.h:48
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define TRUE
Definition: types.h:120
#define XLARGE
Definition: precomp.h:19
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
HINSTANCE hInstance
Definition: charmap.c:20
PCELL pActiveCell
Definition: precomp.h:53
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
RECT CellExt
Definition: precomp.h:38
#define WS_CHILDWINDOW
Definition: pedump.c:639
static const WCHAR szLrgCellWndClass[]
Definition: map.c:16
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)
HWND hLrgWnd
Definition: precomp.h:49
#define XCELLS
Definition: precomp.h:17
#define YLARGE
Definition: precomp.h:20
HWND hMapWnd
Definition: precomp.h:47
BOOL WINAPI CopyRect(_Out_ LPRECT, _In_ LPCRECT)
LONG bottom
Definition: windef.h:309
#define WS_VISIBLE
Definition: pedump.c:620
#define YCELLS
Definition: precomp.h:18

Referenced by OnClick().

◆ DrawActiveCell()

static VOID DrawActiveCell ( PMAP  infoPtr,
HDC  hdc 
)
static

Definition at line 47 of file map.c.

49 {
50  Rectangle(hdc,
51  infoPtr->pActiveCell->CellInt.left,
52  infoPtr->pActiveCell->CellInt.top,
53  infoPtr->pActiveCell->CellInt.right,
54  infoPtr->pActiveCell->CellInt.bottom);
55 
56 }
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
RECT CellInt
Definition: precomp.h:39
PCELL pActiveCell
Definition: precomp.h:53
HDC hdc
Definition: main.c:9
LONG bottom
Definition: windef.h:309

Referenced by DrawGrid().

◆ DrawGrid()

static VOID DrawGrid ( PMAP  infoPtr,
PAINTSTRUCT ps 
)
static

Definition at line 61 of file map.c.

63 {
64  INT x, y;
65  RECT rc;
66  PCELL Cell;
67 
68  for (y = 0; y < YCELLS; y++)
69  for (x = 0; x < XCELLS; x++)
70  {
71  Cell = &infoPtr->Cells[y][x];
72 
73  if (!IntersectRect(&rc,
74  &ps->rcPaint,
75  &Cell->CellExt))
76  {
77  continue;
78  }
79 
80  Rectangle(ps->hdc,
81  Cell->CellExt.left,
82  Cell->CellExt.top,
83  Cell->CellExt.right,
84  Cell->CellExt.bottom);
85 
86  if (infoPtr->pActiveCell == Cell)
87  {
88  DrawActiveCell(infoPtr, ps->hdc);
89  }
90  }
91 }
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
LONG top
Definition: windef.h:307
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
Definition: precomp.h:36
PCELL pActiveCell
Definition: precomp.h:53
RECT CellExt
Definition: precomp.h:38
static VOID DrawActiveCell(PMAP infoPtr, HDC hdc)
Definition: map.c:47
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
#define XCELLS
Definition: precomp.h:17
CELL Cells[YCELLS][XCELLS]
Definition: precomp.h:52
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
LONG bottom
Definition: windef.h:309
#define YCELLS
Definition: precomp.h:18

Referenced by OnPaint().

◆ FillGrid()

static VOID FillGrid ( PMAP  infoPtr,
PAINTSTRUCT ps 
)
static

Definition at line 96 of file map.c.

98 {
99  HFONT hOldFont;
100  WCHAR ch;
101  INT x, y;
102  RECT rc;
103  PCELL Cell;
104  INT i, added;
105 
106  hOldFont = SelectObject(ps->hdc,
107  infoPtr->hFont);
108 
109  i = XCELLS * infoPtr->iYStart;
110 
111  added = 0;
112 
113  for (y = 0; y < YCELLS; y++)
114  for (x = 0; x < XCELLS; x++)
115  {
116  if (i >= infoPtr->NumValidGlyphs) break;
117 
118  ch = (WCHAR)infoPtr->ValidGlyphs[i];
119 
120  Cell = &infoPtr->Cells[y][x];
121 
122  if (IntersectRect(&rc,
123  &ps->rcPaint,
124  &Cell->CellExt))
125  {
126  Cell->ch = ch;
127 
128  DrawTextW(ps->hdc,
129  &ch,
130  1,
131  &Cell->CellInt,
133 
134  added++;
135  }
136 
137  i++;
138  ch = (WCHAR)i;
139  }
140  SelectObject(ps->hdc,
141  hOldFont);
142 }
HFONT hFont
Definition: precomp.h:54
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int32_t INT
Definition: typedefs.h:58
RECT CellInt
Definition: precomp.h:39
Definition: precomp.h:36
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
RECT CellExt
Definition: precomp.h:38
USHORT NumValidGlyphs
Definition: precomp.h:61
#define DT_VCENTER
Definition: winuser.h:543
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
USHORT ValidGlyphs[MAX_GLYPHS]
Definition: precomp.h:60
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
WCHAR ch
Definition: precomp.h:42
INT iYStart
Definition: precomp.h:56
#define DT_SINGLELINE
Definition: winuser.h:540
#define XCELLS
Definition: precomp.h:17
CELL Cells[YCELLS][XCELLS]
Definition: precomp.h:52
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define DT_CENTER
Definition: winuser.h:527
#define YCELLS
Definition: precomp.h:18
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17

Referenced by OnPaint().

◆ GetPossibleCharacters()

static VOID GetPossibleCharacters ( WCHAR ch,
INT  chLen,
INT  codePageIdx 
)
static

Definition at line 215 of file map.c.

216 {
217  INT i, j;
218 
219  memset(ch, 0, sizeof(ch[0]) * chLen);
220 
221  if (codePageIdx <= 0 || codePageIdx > SIZEOF(codePages))
222  {
223  /* this is unicode, so just load up the first MAX_GLYPHS characters
224  start at 0x21 to bypass whitespace characters */
225  INT len = min(MAX_GLYPHS, chLen);
226  for (i = 0x21, j = 0; i < len; i++)
227  ch[j++] = (WCHAR)i;
228  }
229  else
230  {
231  /* This is a codepage, so use NLS to translate the first 256 characters */
232  CHAR multiByteString[256] = { 0 };
233  for (i = 0x21; i < SIZEOF(multiByteString); i++)
234  multiByteString[i] = (CHAR)i;
235 
236  if (!MultiByteToWideChar(codePages[codePageIdx - 1], 0, multiByteString, sizeof(multiByteString), ch, chLen))
237  {
238  /* Failed for some reason, so clear the array */
239  memset(ch, 0, sizeof(ch[0]) * chLen);
240  }
241  }
242 }
char CHAR
Definition: xmlstorage.h:175
int32_t INT
Definition: typedefs.h:58
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
#define SIZEOF(_ar)
Definition: calc.h:97
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 MAX_GLYPHS
Definition: precomp.h:15
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLsizei len
Definition: glext.h:6722
#define min(a, b)
Definition: monoChain.cc:55
#define MultiByteToWideChar
Definition: compat.h:110
static const UINT codePages[]
Definition: precomp.h:29
#define memset(x, y, z)
Definition: compat.h:39

Referenced by SetFont().

◆ MapOnCreate()

static BOOL MapOnCreate ( PMAP  infoPtr,
HWND  hwnd,
HWND  hParent 
)
static

Definition at line 409 of file map.c.

412 {
413  RECT rc;
414  BOOL Ret = FALSE;
415 
416  infoPtr = HeapAlloc(GetProcessHeap(),
417  0,
418  sizeof(MAP));
419  if (infoPtr)
420  {
421  SetLastError(0);
423  0,
424  (DWORD_PTR)infoPtr);
425  if (GetLastError() == 0)
426  {
427  ZeroMemory(infoPtr,
428  sizeof(MAP));
429 
430  infoPtr->hMapWnd = hwnd;
431  infoPtr->hParent = hParent;
432 
433  GetClientRect(hwnd, &rc);
434  infoPtr->ClientSize.cx = rc.right;
435  infoPtr->ClientSize.cy = rc.bottom;
436  infoPtr->CellSize.cx = infoPtr->ClientSize.cx / XCELLS;
437  infoPtr->CellSize.cy = infoPtr->ClientSize.cy / YCELLS;
438 
439  infoPtr->pActiveCell = NULL;
440 
441  SetGrid(infoPtr);
442 
443  SetScrollPos(infoPtr->hParent, SB_VERT, 0, TRUE);
444 
445  Ret = TRUE;
446  }
447  }
448 
449  return Ret;
450 }
HWND hParent
Definition: precomp.h:48
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define SB_VERT
Definition: winuser.h:553
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define ZeroMemory
Definition: winbase.h:1648
LONG right
Definition: windef.h:308
Definition: precomp.h:45
PCELL pActiveCell
Definition: precomp.h:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:334
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define SetLastError(x)
Definition: compat.h:500
SIZE CellSize
Definition: precomp.h:51
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
uint32_t DWORD_PTR
Definition: typedefs.h:65
SIZE ClientSize
Definition: precomp.h:50
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define XCELLS
Definition: precomp.h:17
HWND hMapWnd
Definition: precomp.h:47
static VOID SetGrid(PMAP infoPtr)
Definition: map.c:23
LONG bottom
Definition: windef.h:309
#define SetWindowLongPtrW
Definition: winuser.h:5321
LONG cy
Definition: windef.h:335
#define YCELLS
Definition: precomp.h:18
int WINAPI SetScrollPos(_In_ HWND, _In_ int, _In_ int, _In_ BOOL)

Referenced by MapWndProc().

◆ MapWndProc()

LRESULT CALLBACK MapWndProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 585 of file map.c.

589 {
590  PMAP infoPtr;
591  LRESULT Ret = 0;
592  WCHAR lfFaceName[LF_FACESIZE];
593 
594  infoPtr = (PMAP)GetWindowLongPtrW(hwnd,
595  0);
596 
597  switch (uMsg)
598  {
599  case WM_CREATE:
600  {
601  if (!MapOnCreate(infoPtr,
602  hwnd,
604  {
605  return (LRESULT)-1;
606  }
607 
608  break;
609  }
610 
611  case WM_LBUTTONDOWN:
612  {
613  OnClick(infoPtr,
614  LOWORD(lParam),
615  HIWORD(lParam));
616 
617  break;
618  }
619 
620  case WM_MOUSEMOVE:
621  {
622  if (wParam & MK_LBUTTON)
623  {
624  OnClick(infoPtr,
625  LOWORD(lParam),
626  HIWORD(lParam));
627  }
628  break;
629  }
630 
631  case WM_LBUTTONDBLCLK:
632  {
633  if (!infoPtr->pActiveCell)
634  break;
635 
636  NotifyParentOfSelection(infoPtr,
637  FM_SETCHAR,
638  infoPtr->pActiveCell->ch);
639 
640  if (infoPtr->pActiveCell->bLarge)
641  {
642  DestroyWindow(infoPtr->hLrgWnd);
643  infoPtr->hLrgWnd = NULL;
644  }
645 
646  infoPtr->pActiveCell->bLarge = FALSE;
647 
648  break;
649  }
650 
651  case WM_VSCROLL:
652  {
653  OnVScroll(infoPtr,
654  LOWORD(wParam),
655  HIWORD(wParam));
656 
657  break;
658  }
659 
660  case FM_SETCHARMAP:
661  infoPtr->CharMap = LOWORD(wParam);
662  wcsncpy(lfFaceName,
663  infoPtr->CurrentFont.lfFaceName,
664  SIZEOF(lfFaceName));
665  SetFont(infoPtr, lfFaceName);
666  break;
667 
668  case FM_SETFONT:
669  SetFont(infoPtr, (LPWSTR)lParam);
670  break;
671 
672  case FM_GETCHAR:
673  {
674  if (!infoPtr->pActiveCell) return 0;
675  return infoPtr->pActiveCell->ch;
676  }
677 
678  case FM_GETHFONT:
679  return (LRESULT)infoPtr->hFont;
680 
681  case WM_PAINT:
682  {
683  OnPaint(infoPtr,
684  wParam);
685  break;
686  }
687 
688  case WM_DESTROY:
689  {
690  DeleteObject(infoPtr->hFont);
692  0,
693  infoPtr);
695  0,
696  (DWORD_PTR)NULL);
697  break;
698  }
699 
700  default:
701  {
702  Ret = DefWindowProcW(hwnd,
703  uMsg,
704  wParam,
705  lParam);
706  break;
707  }
708  }
709 
710  return Ret;
711 }
LOGFONTW CurrentFont
Definition: precomp.h:55
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static VOID OnClick(PMAP infoPtr, WORD ptx, WORD pty)
Definition: map.c:350
#define LF_FACESIZE
Definition: dimm.idl:39
HFONT hFont
Definition: precomp.h:54
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
#define MK_LBUTTON
Definition: winuser.h:2342
struct _MAP * PMAP
static BOOL MapOnCreate(PMAP infoPtr, HWND hwnd, HWND hParent)
Definition: map.c:409
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
static VOID OnPaint(PMAP infoPtr, WPARAM wParam)
Definition: map.c:544
#define GetWindowLongPtrW
Definition: winuser.h:4804
BOOL WINAPI DestroyWindow(_In_ HWND)
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: precomp.h:45
static VOID SetFont(PMAP infoPtr, LPWSTR lpFontName)
Definition: map.c:247
#define SIZEOF(_ar)
Definition: calc.h:97
PCELL pActiveCell
Definition: precomp.h:53
#define FALSE
Definition: types.h:117
#define FM_SETFONT
Definition: precomp.h:22
#define FM_SETCHARMAP
Definition: precomp.h:26
BOOL bLarge
Definition: precomp.h:41
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
#define WM_DESTROY
Definition: winuser.h:1591
#define FM_GETHFONT
Definition: precomp.h:25
#define GetProcessHeap()
Definition: compat.h:484
__wchar_t WCHAR
Definition: xmlstorage.h:180
INT CharMap
Definition: precomp.h:58
#define WM_PAINT
Definition: winuser.h:1602
#define FM_GETCHAR
Definition: precomp.h:23
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1760
uint32_t DWORD_PTR
Definition: typedefs.h:65
HWND hLrgWnd
Definition: precomp.h:49
WCHAR ch
Definition: precomp.h:42
#define FM_SETCHAR
Definition: precomp.h:24
static LRESULT NotifyParentOfSelection(PMAP infoPtr, UINT code, WCHAR ch)
Definition: map.c:324
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
#define WM_MOUSEMOVE
Definition: winuser.h:1757
static VOID OnVScroll(PMAP infoPtr, INT Value, INT Pos)
Definition: map.c:455
#define WM_CREATE
Definition: winuser.h:1590
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
#define HIWORD(l)
Definition: typedefs.h:247
#define SetWindowLongPtrW
Definition: winuser.h:5321
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:483
#define WM_VSCROLL
Definition: winuser.h:1726

Referenced by RegisterMapClasses().

◆ MoveLargeCell()

static VOID MoveLargeCell ( PMAP  infoPtr)
static

Definition at line 184 of file map.c.

185 {
186  RECT rLarge;
187 
188  CopyRect(&rLarge,
189  &infoPtr->pActiveCell->CellExt);
190 
191  MapWindowPoints(infoPtr->hMapWnd,
192  infoPtr->hParent,
193  (VOID*)&rLarge,
194  2);
195 
196  InflateRect(&rLarge,
197  XLARGE - XCELLS,
198  YLARGE - YCELLS);
199 
200  MoveWindow(infoPtr->hLrgWnd,
201  rLarge.left,
202  rLarge.top,
203  rLarge.right - rLarge.left,
204  rLarge.bottom - rLarge.top,
205  TRUE);
206 
207  InvalidateRect(infoPtr->hLrgWnd,
208  NULL,
209  TRUE);
210 }
HWND hParent
Definition: precomp.h:48
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define TRUE
Definition: types.h:120
#define XLARGE
Definition: precomp.h:19
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
PCELL pActiveCell
Definition: precomp.h:53
smooth NULL
Definition: ftsmooth.c:416
RECT CellExt
Definition: precomp.h:38
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
HWND hLrgWnd
Definition: precomp.h:49
#define XCELLS
Definition: precomp.h:17
#define YLARGE
Definition: precomp.h:20
HWND hMapWnd
Definition: precomp.h:47
BOOL WINAPI CopyRect(_Out_ LPRECT, _In_ LPCRECT)
LONG bottom
Definition: windef.h:309
#define YCELLS
Definition: precomp.h:18

Referenced by OnClick().

◆ NotifyParentOfSelection()

static LRESULT NotifyParentOfSelection ( PMAP  infoPtr,
UINT  code,
WCHAR  ch 
)
static

Definition at line 324 of file map.c.

327 {
328  LRESULT Ret = 0;
329 
330  if (infoPtr->hParent != NULL)
331  {
332  DWORD dwIdc = GetWindowLongPtr(infoPtr->hMapWnd, GWLP_ID);
333  /*
334  * Push directly into the event queue instead of waiting
335  * the parent to be unlocked.
336  * High word of LPARAM is still available for future needs...
337  */
338  Ret = PostMessage(infoPtr->hParent,
339  WM_COMMAND,
340  MAKELPARAM((WORD)dwIdc, (WORD)code),
341  (LPARAM)LOWORD(ch));
342  }
343 
344  return Ret;
345 }
HWND hParent
Definition: precomp.h:48
#define MAKELPARAM(l, h)
Definition: winuser.h:3983
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define PostMessage
Definition: winuser.h:5807
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WM_COMMAND
Definition: winuser.h:1722
Definition: inflate.c:139
HWND hMapWnd
Definition: precomp.h:47
#define GetWindowLongPtr
Definition: treelist.c:73
LONG_PTR LRESULT
Definition: windef.h:209
#define LOWORD(l)
Definition: pedump.c:82
#define GWLP_ID
Definition: winuser.h:854

Referenced by MapWndProc().

◆ OnClick()

static VOID OnClick ( PMAP  infoPtr,
WORD  ptx,
WORD  pty 
)
static

Definition at line 350 of file map.c.

353 {
354  INT x, y, i;
355 
356  /*
357  * Find the cell the mouse pointer is over.
358  * Since each cell is the same size, this can be done quickly using CellSize.
359  * Clamp to XCELLS - 1 and YCELLS - 1 because the map can sometimes be slightly
360  * larger than infoPtr.CellSize * XCELLS , due to the map size being a non integer
361  * multiple of infoPtr.CellSize .
362  */
363  x = min(XCELLS - 1, ptx / max(1, infoPtr->CellSize.cx));
364  y = min(YCELLS - 1, pty / max(1, infoPtr->CellSize.cy));
365 
366  /* Make sure the mouse is within a valid glyph */
367  i = XCELLS * infoPtr->iYStart + y * XCELLS + x;
368  if (i >= infoPtr->NumValidGlyphs)
369  {
370  if (infoPtr->pActiveCell)
371  infoPtr->pActiveCell->bActive = FALSE;
372  infoPtr->pActiveCell = NULL;
373  return;
374  }
375 
376  /* if the cell is not already active */
377  if (!infoPtr->Cells[y][x].bActive)
378  {
379  /* set previous active cell to inactive */
380  if (infoPtr->pActiveCell)
381  {
382  /* invalidate normal cells, required when
383  * moving a small active cell via keyboard */
384  if (!infoPtr->pActiveCell->bLarge)
385  {
386  InvalidateRect(infoPtr->hMapWnd,
387  &infoPtr->pActiveCell->CellInt,
388  TRUE);
389  }
390 
391  infoPtr->pActiveCell->bActive = FALSE;
392  infoPtr->pActiveCell->bLarge = FALSE;
393  }
394 
395  /* set new cell to active */
396  infoPtr->pActiveCell = &infoPtr->Cells[y][x];
397  infoPtr->pActiveCell->bActive = TRUE;
398  infoPtr->pActiveCell->bLarge = TRUE;
399  if (infoPtr->hLrgWnd)
400  MoveLargeCell(infoPtr);
401  else
402  CreateLargeCell(infoPtr);
403  }
404 }
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int32_t INT
Definition: typedefs.h:58
RECT CellInt
Definition: precomp.h:39
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
PCELL pActiveCell
Definition: precomp.h:53
#define FALSE
Definition: types.h:117
static BOOL CreateLargeCell(PMAP infoPtr)
Definition: map.c:147
BOOL bLarge
Definition: precomp.h:41
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:334
USHORT NumValidGlyphs
Definition: precomp.h:61
BOOL bActive
Definition: precomp.h:40
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
SIZE CellSize
Definition: precomp.h:51
HWND hLrgWnd
Definition: precomp.h:49
static VOID MoveLargeCell(PMAP infoPtr)
Definition: map.c:184
INT iYStart
Definition: precomp.h:56
#define XCELLS
Definition: precomp.h:17
CELL Cells[YCELLS][XCELLS]
Definition: precomp.h:52
#define min(a, b)
Definition: monoChain.cc:55
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
HWND hMapWnd
Definition: precomp.h:47
LONG cy
Definition: windef.h:335
#define YCELLS
Definition: precomp.h:18

Referenced by MapWndProc().

◆ OnPaint()

static VOID OnPaint ( PMAP  infoPtr,
WPARAM  wParam 
)
static

Definition at line 544 of file map.c.

546 {
547  PAINTSTRUCT ps;
548  HDC hdc;
549 
550 
551  if (wParam != 0)
552  {
553  if (!GetUpdateRect(infoPtr->hMapWnd,
554  &ps.rcPaint,
555  TRUE))
556  {
557  return;
558  }
559  ps.hdc = (HDC)wParam;
560  }
561  else
562  {
563  hdc = BeginPaint(infoPtr->hMapWnd,
564  &ps);
565  if (hdc == NULL)
566  {
567  return;
568  }
569  }
570 
571  DrawGrid(infoPtr, &ps);
572 
573  FillGrid(infoPtr, &ps);
574 
575  if (wParam == 0)
576  {
577  EndPaint(infoPtr->hMapWnd,
578  &ps);
579  }
580 }
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
WPARAM wParam
Definition: combotst.c:138
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
smooth NULL
Definition: ftsmooth.c:416
HDC hdc
Definition: main.c:9
BOOL WINAPI GetUpdateRect(_In_ HWND, _Out_opt_ LPRECT, _In_ BOOL)
static VOID DrawGrid(PMAP infoPtr, PAINTSTRUCT *ps)
Definition: map.c:61
static VOID FillGrid(PMAP infoPtr, PAINTSTRUCT *ps)
Definition: map.c:96
HWND hMapWnd
Definition: precomp.h:47

Referenced by MapWndProc().

◆ OnVScroll()

static VOID OnVScroll ( PMAP  infoPtr,
INT  Value,
INT  Pos 
)
static

Definition at line 455 of file map.c.

458 {
459  INT iYDiff, iOldYStart = infoPtr->iYStart;
460 
461  switch (Value)
462  {
463  case SB_LINEUP:
464  infoPtr->iYStart -= 1;
465  break;
466 
467  case SB_LINEDOWN:
468  infoPtr->iYStart += 1;
469  break;
470 
471  case SB_PAGEUP:
472  infoPtr->iYStart -= YCELLS;
473  break;
474 
475  case SB_PAGEDOWN:
476  infoPtr->iYStart += YCELLS;
477  break;
478 
479  case SB_THUMBTRACK:
480  infoPtr->iYStart = Pos;
481  break;
482 
483  default:
484  break;
485  }
486 
487  infoPtr->iYStart = max(0, infoPtr->iYStart);
488  infoPtr->iYStart = min(infoPtr->iYStart, infoPtr->NumRows);
489 
490  iYDiff = iOldYStart - infoPtr->iYStart;
491  if (iYDiff)
492  {
493  if (infoPtr->hLrgWnd != NULL)
494  {
495  ShowWindow(infoPtr->hLrgWnd, SW_HIDE);
496  }
497 
498  SetScrollPos(infoPtr->hMapWnd,
499  SB_VERT,
500  infoPtr->iYStart,
501  TRUE);
502 
503  if (abs(iYDiff) < YCELLS)
504  {
505  RECT rect;
506 
507  /* Invalidate the rect around the active cell since a new cell will become active */
508  if (infoPtr->pActiveCell && infoPtr->pActiveCell->bActive)
509  {
510  InvalidateRect(infoPtr->hMapWnd,
511  &infoPtr->pActiveCell->CellExt,
512  TRUE);
513  }
514 
515  GetClientRect(infoPtr->hMapWnd, &rect);
516  rect.top += 2;
517  rect.bottom -= 2;
518  ScrollWindowEx(infoPtr->hMapWnd,
519  0,
520  iYDiff * infoPtr->CellSize.cy,
521  &rect,
522  &rect,
523  NULL,
524  NULL,
525  SW_INVALIDATE);
526  }
527  else
528  {
529  InvalidateRect(infoPtr->hMapWnd,
530  NULL,
531  TRUE);
532  }
533 
534  if (infoPtr->hLrgWnd != NULL)
535  {
536  ShowWindow(infoPtr->hLrgWnd, SW_SHOW);
537  }
538  }
539 }
#define abs(i)
Definition: fconv.c:206
#define SB_PAGEDOWN
Definition: winuser.h:569
#define SB_PAGEUP
Definition: winuser.h:568
#define max(a, b)
Definition: svc.c:63
#define SB_VERT
Definition: winuser.h:553
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
ush Pos
Definition: deflate.h:92
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT
Definition: typedefs.h:58
& rect
Definition: startmenu.cpp:1413
INT NumRows
Definition: precomp.h:57
IN UCHAR Value
Definition: halp.h:394
PCELL pActiveCell
Definition: precomp.h:53
smooth NULL
Definition: ftsmooth.c:416
RECT CellExt
Definition: precomp.h:38
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)
#define SW_SHOW
Definition: winuser.h:769
BOOL bActive
Definition: precomp.h:40
#define SB_THUMBTRACK
Definition: winuser.h:573
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
SIZE CellSize
Definition: precomp.h:51
HWND hLrgWnd
Definition: precomp.h:49
#define SW_INVALIDATE
Definition: winuser.h:2554
INT iYStart
Definition: precomp.h:56
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define min(a, b)
Definition: monoChain.cc:55
#define SB_LINEDOWN
Definition: winuser.h:565
#define SB_LINEUP
Definition: winuser.h:564
HWND hMapWnd
Definition: precomp.h:47
LONG cy
Definition: windef.h:335
#define YCELLS
Definition: precomp.h:18
int WINAPI SetScrollPos(_In_ HWND, _In_ int, _In_ int, _In_ BOOL)

Referenced by MapWndProc().

◆ RegisterMapClasses()

BOOL RegisterMapClasses ( HINSTANCE  hInstance)

Definition at line 715 of file map.c.

716 {
717  WNDCLASSW wc = {0};
718 
719  wc.style = CS_DBLCLKS;
720  wc.lpfnWndProc = MapWndProc;
721  wc.cbWndExtra = sizeof(PMAP);
722  wc.hInstance = hInstance;
723  wc.hCursor = LoadCursorW(NULL,
724  (LPWSTR)IDC_ARROW);
725  wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
727 
728  if (RegisterClassW(&wc))
729  {
731  wc.cbWndExtra = 0;
733 
734  return RegisterClassW(&wc) != 0;
735  }
736 
737  return FALSE;
738 }
UINT style
Definition: winuser.h:3151
LRESULT CALLBACK MapWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: map.c:585
struct _MAP * PMAP
#define COLOR_WINDOW
Definition: winuser.h:908
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
HINSTANCE hInstance
Definition: charmap.c:20
#define FALSE
Definition: types.h:117
WNDPROC lpfnWndProc
Definition: winuser.h:3152
smooth NULL
Definition: ftsmooth.c:416
LPCWSTR lpszClassName
Definition: winuser.h:3160
static const WCHAR szLrgCellWndClass[]
Definition: map.c:16
int cbWndExtra
Definition: winuser.h:3154
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define CS_DBLCLKS
Definition: winuser.h:646
HCURSOR hCursor
Definition: winuser.h:3157
HBRUSH hbrBackground
Definition: winuser.h:3158
static const WCHAR szMapWndClass[]
Definition: map.c:15
LRESULT CALLBACK LrgCellWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: lrgcell.c:68
HINSTANCE hInstance
Definition: winuser.h:3155
#define IDC_ARROW
Definition: winuser.h:682
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by wWinMain().

◆ SetFont()

static VOID SetFont ( PMAP  infoPtr,
LPWSTR  lpFontName 
)
static

Definition at line 247 of file map.c.

249 {
250  HDC hdc;
251  WCHAR ch[MAX_GLYPHS];
253  DWORD i, j;
254 
255  /* Destroy Zoom window, since it was created with older font */
256  DestroyWindow(infoPtr->hLrgWnd);
257  infoPtr->hLrgWnd = NULL;
258 
259  if (infoPtr->hFont)
260  DeleteObject(infoPtr->hFont);
261 
262  ZeroMemory(&infoPtr->CurrentFont,
263  sizeof(LOGFONTW));
264 
265  hdc = GetDC(infoPtr->hMapWnd);
267 
270  lpFontName,
271  SIZEOF(infoPtr->CurrentFont.lfFaceName));
272 
273  infoPtr->hFont = CreateFontIndirectW(&infoPtr->CurrentFont);
274 
275  InvalidateRect(infoPtr->hMapWnd,
276  NULL,
277  TRUE);
278 
279  if (infoPtr->pActiveCell)
280  infoPtr->pActiveCell->bActive = FALSE;
281  infoPtr->pActiveCell = &infoPtr->Cells[0][0];
282  infoPtr->pActiveCell->bActive = TRUE;
283 
284  // Get all the valid glyphs in this font
285 
286  SelectObject(hdc, infoPtr->hFont);
287 
288  // Get the code page associated with the selected 'character set'
290 
291  if (GetGlyphIndicesW(hdc,
292  ch,
293  MAX_GLYPHS,
294  out,
296  {
297  j = 0;
298  for (i = 0; i < MAX_GLYPHS; i++)
299  {
300  if (out[i] != 0xffff && out[i] != 0x0000 && ch[i] != 0x0000)
301  {
302  infoPtr->ValidGlyphs[j] = ch[i];
303  j++;
304  }
305  }
306  infoPtr->NumValidGlyphs = j;
307  }
308 
309  ReleaseDC(infoPtr->hMapWnd, hdc);
310 
311  infoPtr->NumRows = infoPtr->NumValidGlyphs / XCELLS;
312  if (infoPtr->NumValidGlyphs % XCELLS)
313  infoPtr->NumRows += 1;
314  infoPtr->NumRows = (infoPtr->NumRows > YCELLS) ? infoPtr->NumRows - YCELLS : 0;
315 
316  SetScrollRange(infoPtr->hMapWnd, SB_VERT, 0, infoPtr->NumRows, FALSE);
317  SetScrollPos(infoPtr->hMapWnd, SB_VERT, 0, TRUE);
318  infoPtr->iYStart = 0;
319 }
LOGFONTW CurrentFont
Definition: precomp.h:55
HFONT hFont
Definition: precomp.h:54
static VOID GetPossibleCharacters(WCHAR *ch, INT chLen, INT codePageIdx)
Definition: map.c:215
HDC WINAPI GetDC(_In_opt_ HWND)
#define SB_VERT
Definition: winuser.h:553
#define TRUE
Definition: types.h:120
LONG lfHeight
Definition: dimm.idl:59
BYTE lfCharSet
Definition: dimm.idl:67
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
#define ZeroMemory
Definition: winbase.h:1648
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define DEFAULT_CHARSET
Definition: wingdi.h:383
BOOL WINAPI DestroyWindow(_In_ HWND)
INT NumRows
Definition: precomp.h:57
#define lstrcpynW
Definition: compat.h:486
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
#define SIZEOF(_ar)
Definition: calc.h:97
PCELL pActiveCell
Definition: precomp.h:53
#define FALSE
Definition: types.h:117
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
USHORT NumValidGlyphs
Definition: precomp.h:61
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 MAX_GLYPHS
Definition: precomp.h:15
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL bActive
Definition: precomp.h:40
INT CharMap
Definition: precomp.h:58
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
unsigned short WORD
Definition: ntddk_ex.h:93
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GGI_MARK_NONEXISTING_GLYPHS
Definition: wingdi.h:1084
HDC hdc
Definition: main.c:9
USHORT ValidGlyphs[MAX_GLYPHS]
Definition: precomp.h:60
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
HWND hLrgWnd
Definition: precomp.h:49
INT iYStart
Definition: precomp.h:56
#define XCELLS
Definition: precomp.h:17
CELL Cells[YCELLS][XCELLS]
Definition: precomp.h:52
BOOL WINAPI SetScrollRange(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ BOOL)
HWND hMapWnd
Definition: precomp.h:47
DWORD WINAPI GetGlyphIndicesW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpstr, _In_ int c, _Out_writes_(c) LPWORD pgi, _In_ DWORD fl)
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
#define LOGPIXELSY
Definition: wingdi.h:718
#define GDI_ERROR
Definition: wingdi.h:1308
#define YCELLS
Definition: precomp.h:18
int WINAPI SetScrollPos(_In_ HWND, _In_ int, _In_ int, _In_ BOOL)

Referenced by MapWndProc().

◆ SetGrid()

static VOID SetGrid ( PMAP  infoPtr)
static

Definition at line 23 of file map.c.

24 {
25  INT x, y;
26 
27  for (y = 0; y < YCELLS; y++)
28  for (x = 0; x < XCELLS; x++)
29  {
30  infoPtr->Cells[y][x].CellExt.left = x * infoPtr->CellSize.cx + 1;
31  infoPtr->Cells[y][x].CellExt.top = y * infoPtr->CellSize.cy + 1;
32  infoPtr->Cells[y][x].CellExt.right = (x + 1) * infoPtr->CellSize.cx + 2;
33  infoPtr->Cells[y][x].CellExt.bottom = (y + 1) * infoPtr->CellSize.cy + 2;
34 
35  CopyRect(&infoPtr->Cells[y][x].CellInt,
36  &infoPtr->Cells[y][x].CellExt);
37 
38  InflateRect(&infoPtr->Cells[y][x].CellInt,
39  -1,
40  -1);
41  }
42 }
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
LONG top
Definition: windef.h:307
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
RECT CellInt
Definition: precomp.h:39
RECT CellExt
Definition: precomp.h:38
LONG cx
Definition: windef.h:334
SIZE CellSize
Definition: precomp.h:51
#define XCELLS
Definition: precomp.h:17
CELL Cells[YCELLS][XCELLS]
Definition: precomp.h:52
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
BOOL WINAPI CopyRect(_Out_ LPRECT, _In_ LPCRECT)
LONG bottom
Definition: windef.h:309
LONG cy
Definition: windef.h:335
#define YCELLS
Definition: precomp.h:18

Referenced by MapOnCreate().

◆ UnregisterMapClasses()

VOID UnregisterMapClasses ( HINSTANCE  hInstance)

Definition at line 741 of file map.c.

742 {
744  hInstance);
745 
747  hInstance);
748 }
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
HINSTANCE hInstance
Definition: charmap.c:20
static const WCHAR szLrgCellWndClass[]
Definition: map.c:16
static const WCHAR szMapWndClass[]
Definition: map.c:15

Referenced by wWinMain().

Variable Documentation

◆ szLrgCellWndClass

const WCHAR szLrgCellWndClass[] = L"LrgCellWnd"
static

Definition at line 16 of file map.c.

Referenced by CreateLargeCell(), RegisterMapClasses(), and UnregisterMapClasses().

◆ szMapWndClass

const WCHAR szMapWndClass[] = L"FontMapWnd"
static

Definition at line 15 of file map.c.

Referenced by RegisterMapClasses(), and UnregisterMapClasses().