ReactOS  0.4.14-dev-55-g2da92ac
fontboxeswnd.c File Reference
#include "precomp.h"
Include dependency graph for fontboxeswnd.c:

Go to the source code of this file.

Functions

static VOID DrawCharacterPixel (IN PAINTSTRUCT *ps, IN UINT uCharacter, IN UCHAR uRow, IN UCHAR uColumn, IN UCHAR uBit, IN COLORREF clBackground)
 
VOID GetCharacterRect (IN UINT uFontRow, IN UINT uFontColumn, OUT LPRECT CharacterRect)
 
__inline VOID GetCharacterPosition (IN UINT uCharacter, OUT PUINT uFontRow, OUT PUINT uFontColumn)
 
static INT FontBoxesHitTest (IN UINT xPos, IN UINT yPos, OUT LPRECT CharacterRect)
 
static VOID SetSelectedCharacter (IN PFONT_WND_INFO Info, IN UINT uNewCharacter, OPTIONAL IN LPRECT NewCharacterRect)
 
static VOID DrawProc (IN PFONT_WND_INFO Info, IN PAINTSTRUCT *ps)
 
VOID EditCurrentGlyph (PFONT_WND_INFO FontWndInfo)
 
VOID CreateFontBoxesWindow (IN PFONT_WND_INFO FontWndInfo)
 
static LRESULT CALLBACK FontBoxesWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL InitFontBoxesWndClass (VOID)
 
VOID UnInitFontBoxesWndClass (VOID)
 

Variables

static const WCHAR szFontBoxesWndClass [] = L"VGAFontEditFontBoxesWndClass"
 

Function Documentation

◆ CreateFontBoxesWindow()

VOID CreateFontBoxesWindow ( IN PFONT_WND_INFO  FontWndInfo)

Definition at line 231 of file fontboxeswnd.c.

232 {
233  FontWndInfo->hFontBoxesWnd = CreateWindowExW(0,
235  0,
237  0,
238  0,
239  0,
240  0,
241  FontWndInfo->hSelf,
242  NULL,
243  hInstance,
244  FontWndInfo);
245 }
#define WS_CHILD
Definition: pedump.c:617
HINSTANCE hInstance
Definition: charmap.c:20
smooth NULL
Definition: ftsmooth.c:416
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)
static const WCHAR szFontBoxesWndClass[]
Definition: fontboxeswnd.c:10
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by FontWndProc().

◆ DrawCharacterPixel()

static VOID DrawCharacterPixel ( IN PAINTSTRUCT ps,
IN UINT  uCharacter,
IN UCHAR  uRow,
IN UCHAR  uColumn,
IN UCHAR  uBit,
IN COLORREF  clBackground 
)
static

Definition at line 13 of file fontboxeswnd.c.

14 {
15  INT x;
16  INT y;
17 
18  x = (uCharacter % 16) * (CHARACTER_BOX_WIDTH + CHARACTER_BOX_PADDING) + 24 + uColumn;
19  y = (uCharacter / 16) * (CHARACTER_BOX_HEIGHT + CHARACTER_BOX_PADDING)+ 1 + CHARACTER_INFO_BOX_HEIGHT + 2 + uRow;
20 
21  SetPixel( ps->hdc, x, y, (uBit ? 0 : clBackground) );
22 }
#define CHARACTER_BOX_WIDTH
Definition: precomp.h:103
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int32_t INT
Definition: typedefs.h:56
#define CHARACTER_INFO_BOX_HEIGHT
Definition: precomp.h:101
FORCEINLINE VOID SetPixel(IN ULONG Left, IN ULONG Top, IN UCHAR Color)
Definition: vga.c:93
#define CHARACTER_BOX_HEIGHT
Definition: precomp.h:104
#define CHARACTER_BOX_PADDING
Definition: precomp.h:105
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by DrawProc().

◆ DrawProc()

static VOID DrawProc ( IN PFONT_WND_INFO  Info,
IN PAINTSTRUCT ps 
)
static

Definition at line 90 of file fontboxeswnd.c.

91 {
92  COLORREF clBackground;
93  HBRUSH hBrush = 0;
94  HBRUSH hOldBrush = 0;
95  HDC hBoxDC;
96  HFONT hFont;
97  HFONT hOldFont;
98  RECT CharacterRect;
99  UINT uFontColumn;
100  UINT uStartColumn;
101  UINT uEndColumn;
102  UINT uFontRow;
103  UINT uStartRow;
104  UINT uEndRow;
105  UINT uCharacter;
106  UCHAR uCharacterColumn;
107  UCHAR uCharacterRow;
108  UCHAR uBit;
109  WCHAR szInfoText[9];
110  HBITMAP hBitmapOld;
111 
112  // Preparations
113  hBoxDC = CreateCompatibleDC(NULL);
114  hBitmapOld = SelectObject(hBoxDC, Info->MainWndInfo->hBoxBmp);
115 
116  hFont = CreateFontW(13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"Tahoma");
117  hOldFont = SelectObject(ps->hdc, hFont);
118 
119  SetBkMode( ps->hdc, TRANSPARENT );
120 
121  // What ranges do we have to draw?
122  uStartRow = ps->rcPaint.top / (CHARACTER_BOX_HEIGHT + CHARACTER_BOX_PADDING);
123  uEndRow = ps->rcPaint.bottom / (CHARACTER_BOX_HEIGHT + CHARACTER_BOX_PADDING);
124  uStartColumn = ps->rcPaint.left / (CHARACTER_BOX_WIDTH + CHARACTER_BOX_PADDING);
125  uEndColumn = ps->rcPaint.right / (CHARACTER_BOX_WIDTH + CHARACTER_BOX_PADDING);
126 
127  for(uFontRow = uStartRow; uFontRow <= uEndRow; uFontRow++)
128  {
129  for(uFontColumn = uStartColumn; uFontColumn <= uEndColumn; uFontColumn++)
130  {
131  GetCharacterRect(uFontRow, uFontColumn, &CharacterRect);
132  uCharacter = uFontRow * 16 + uFontColumn;
133 
134  // Draw the Character Info Box (header)
135  BitBlt(ps->hdc,
136  CharacterRect.left,
137  CharacterRect.top,
140  hBoxDC,
141  0,
142  0,
143  SRCCOPY);
144 
145  // Draw the header text
146  wsprintfW(szInfoText, L"%02u = %02X", uCharacter, uCharacter);
147  DrawTextW( ps->hdc, szInfoText, -1, &CharacterRect, DT_CENTER );
148 
149  // Draw the Character Bitmap Box (rectangle with the actual character)
150  if(Info->uSelectedCharacter == uCharacter)
151  {
152  clBackground = RGB(255, 255, 0);
153  hBrush = CreateSolidBrush(clBackground);
154  hOldBrush = SelectObject(ps->hdc, hBrush);
155  }
156  else
157  {
158  clBackground = RGB(255, 255, 255);
160  }
161 
162  Rectangle(ps->hdc,
163  CharacterRect.left,
164  CharacterRect.top + CHARACTER_INFO_BOX_HEIGHT,
165  CharacterRect.right,
166  CharacterRect.bottom);
167 
168  // Draw the actual character into the box
169  for(uCharacterRow = 0; uCharacterRow < 8; uCharacterRow++)
170  {
171  for(uCharacterColumn = 0; uCharacterColumn < 8; uCharacterColumn++)
172  {
173  uBit = Info->Font->Bits[uCharacter * 8 + uCharacterRow] << uCharacterColumn & 0x80;
174  DrawCharacterPixel(ps, uCharacter, uCharacterRow, uCharacterColumn, uBit, clBackground);
175  }
176  }
177  }
178  }
179 
180  SelectObject(hBoxDC, hBitmapOld);
181  SelectObject(ps->hdc, hOldFont);
183  SelectObject(ps->hdc, hOldBrush);
184  DeleteObject(hBrush);
185  DeleteDC(hBoxDC);
186 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
HFONT WINAPI CreateFontW(_In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_opt_ LPCWSTR)
#define CHARACTER_BOX_WIDTH
Definition: precomp.h:103
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define WHITE_BRUSH
Definition: wingdi.h:901
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
HFONT hFont
Definition: main.c:53
struct TraceInfo Info
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
#define TRANSPARENT
Definition: wingdi.h:949
smooth NULL
Definition: ftsmooth.c:416
static VOID DrawCharacterPixel(IN PAINTSTRUCT *ps, IN UINT uCharacter, IN UCHAR uRow, IN UCHAR uColumn, IN UCHAR uBit, IN COLORREF clBackground)
Definition: fontboxeswnd.c:13
#define CHARACTER_INFO_BOX_HEIGHT
Definition: precomp.h:101
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD COLORREF
Definition: windef.h:285
#define RGB(r, g, b)
Definition: wingdi.h:2935
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID GetCharacterRect(IN UINT uFontRow, IN UINT uFontColumn, OUT LPRECT CharacterRect)
Definition: fontboxeswnd.c:25
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI DeleteDC(_In_ HDC)
#define CHARACTER_BOX_HEIGHT
Definition: precomp.h:104
#define CHARACTER_BOX_PADDING
Definition: precomp.h:105
unsigned int UINT
Definition: ndis.h:50
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
LONG bottom
Definition: windef.h:294
#define DT_CENTER
Definition: winuser.h:527
static HBITMAP
Definition: button.c:44
#define SRCCOPY
Definition: wingdi.h:332
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17

Referenced by FontBoxesWndProc().

◆ EditCurrentGlyph()

VOID EditCurrentGlyph ( PFONT_WND_INFO  FontWndInfo)

Definition at line 189 of file fontboxeswnd.c.

190 {
191  PEDIT_GLYPH_INFO EditGlyphInfo;
192 
193  // Has the window for this character already been opened?
194  EditGlyphInfo = FontWndInfo->FirstEditGlyphWnd;
195 
196  while(EditGlyphInfo)
197  {
198  if(EditGlyphInfo->uCharacter == FontWndInfo->uSelectedCharacter)
199  {
200  // Yes, it has. Bring it to the front.
201  SetFocus(EditGlyphInfo->hSelf);
202  return;
203  }
204 
205  EditGlyphInfo = EditGlyphInfo->NextEditGlyphWnd;
206  }
207 
208  // No. Then create a new one
209  EditGlyphInfo = (PEDIT_GLYPH_INFO) HeapAlloc( hProcessHeap, 0, sizeof(EDIT_GLYPH_INFO) );
210  EditGlyphInfo->FontWndInfo = FontWndInfo;
211  EditGlyphInfo->uCharacter = FontWndInfo->uSelectedCharacter;
212  RtlCopyMemory( EditGlyphInfo->CharacterBits, FontWndInfo->Font->Bits + FontWndInfo->uSelectedCharacter * 8, sizeof(EditGlyphInfo->CharacterBits) );
213 
214  // Add the new window to the linked list
215  EditGlyphInfo->PrevEditGlyphWnd = FontWndInfo->LastEditGlyphWnd;
216  EditGlyphInfo->NextEditGlyphWnd = NULL;
217 
218  if(FontWndInfo->LastEditGlyphWnd)
219  FontWndInfo->LastEditGlyphWnd->NextEditGlyphWnd = EditGlyphInfo;
220  else
221  FontWndInfo->FirstEditGlyphWnd = EditGlyphInfo;
222 
223  FontWndInfo->LastEditGlyphWnd = EditGlyphInfo;
224 
225  // Open the window as a modeless dialog, so people can edit several characters at the same time.
226  EditGlyphInfo->hSelf = CreateDialogParamW(hInstance, MAKEINTRESOURCEW(IDD_EDITGLYPH), FontWndInfo->hSelf, EditGlyphDlgProc, (LPARAM)EditGlyphInfo);
227  ShowWindow(EditGlyphInfo->hSelf, SW_SHOW);
228 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
UCHAR Bits[2048]
Definition: raw.h:13
struct _EDIT_GLYPH_INFO * PEDIT_GLYPH_INFO
Definition: precomp.h:37
INT_PTR CALLBACK EditGlyphDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: editglyphdlg.c:119
HWND WINAPI SetFocus(_In_opt_ HWND)
PEDIT_GLYPH_INFO LastEditGlyphWnd
Definition: precomp.h:78
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
PEDIT_GLYPH_INFO NextEditGlyphWnd
Definition: precomp.h:94
HINSTANCE hInstance
Definition: charmap.c:20
PEDIT_GLYPH_INFO PrevEditGlyphWnd
Definition: precomp.h:93
smooth NULL
Definition: ftsmooth.c:416
UINT uSelectedCharacter
Definition: precomp.h:72
LONG_PTR LPARAM
Definition: windef.h:208
UINT uCharacter
Definition: precomp.h:85
PEDIT_GLYPH_INFO FirstEditGlyphWnd
Definition: precomp.h:77
#define SW_SHOW
Definition: winuser.h:769
UCHAR CharacterBits[8]
Definition: precomp.h:86
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define IDD_EDITGLYPH
Definition: resource.h:29
HWND hSelf
Definition: precomp.h:70
PFONT_WND_INFO FontWndInfo
Definition: precomp.h:83
PBITMAP_FONT Font
Definition: precomp.h:68
HWND WINAPI CreateDialogParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HANDLE hProcessHeap
Definition: kbswitch.c:25

Referenced by FontBoxesWndProc(), and MenuCommand().

◆ FontBoxesHitTest()

static INT FontBoxesHitTest ( IN UINT  xPos,
IN UINT  yPos,
OUT LPRECT  CharacterRect 
)
static

Definition at line 41 of file fontboxeswnd.c.

42 {
43  UINT uFontColumn;
44  UINT uFontRow;
45 
46  uFontColumn = xPos / (CHARACTER_BOX_WIDTH + CHARACTER_BOX_PADDING);
47  uFontRow = yPos / (CHARACTER_BOX_HEIGHT + CHARACTER_BOX_PADDING);
48  GetCharacterRect(uFontRow, uFontColumn, CharacterRect);
49 
50  if(xPos > (UINT)CharacterRect->right || yPos > (UINT)CharacterRect->bottom)
51  // The user clicked on separator space, so return HITTEST_SEPARATOR
52  return HITTEST_SEPARATOR;
53  else
54  // Return the character number
55  return (uFontRow * 16 + uFontColumn);
56 }
#define CHARACTER_BOX_WIDTH
Definition: precomp.h:103
#define HITTEST_SEPARATOR
Definition: precomp.h:112
VOID GetCharacterRect(IN UINT uFontRow, IN UINT uFontColumn, OUT LPRECT CharacterRect)
Definition: fontboxeswnd.c:25
#define CHARACTER_BOX_HEIGHT
Definition: precomp.h:104
#define CHARACTER_BOX_PADDING
Definition: precomp.h:105
unsigned int UINT
Definition: ndis.h:50

Referenced by FontBoxesWndProc().

◆ FontBoxesWndProc()

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

Definition at line 248 of file fontboxeswnd.c.

249 {
251 
253 
254  if(Info || uMsg == WM_CREATE)
255  {
256  switch(uMsg)
257  {
258  case WM_CREATE:
259  Info = (PFONT_WND_INFO)( ( (LPCREATESTRUCT)lParam )->lpCreateParams );
261 
262  // Set a fixed window size
264 
265  return 0;
266 
267  case WM_DESTROY:
269  return 0;
270 
271  case WM_KEYDOWN:
272  switch(wParam)
273  {
274  case VK_DOWN:
275  if(Info->uSelectedCharacter < 239)
276  SetSelectedCharacter(Info, Info->uSelectedCharacter + 16, NULL);
277  return 0;
278 
279  case VK_LEFT:
280  if(Info->uSelectedCharacter)
281  SetSelectedCharacter(Info, Info->uSelectedCharacter - 1, NULL);
282  return 0;
283 
284  case VK_RETURN:
286  return 0;
287 
288  case VK_RIGHT:
289  if(Info->uSelectedCharacter < 255)
290  SetSelectedCharacter(Info, Info->uSelectedCharacter + 1, NULL);
291  return 0;
292 
293  case VK_UP:
294  if(Info->uSelectedCharacter > 15)
295  SetSelectedCharacter(Info, Info->uSelectedCharacter - 16, NULL);
296  return 0;
297  }
298 
299  break;
300 
301  case WM_LBUTTONDBLCLK:
302  {
304  return 0;
305  }
306 
307  case WM_LBUTTONDOWN:
308  {
309  RECT CharacterRect;
310  INT iRet;
311 
312  iRet = FontBoxesHitTest( GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), &CharacterRect );
313 
314  if(iRet >= 0)
315  SetSelectedCharacter( Info, (UINT)iRet, &CharacterRect );
316 
317  return 0;
318  }
319 
320  case WM_PAINT:
321  {
322  PAINTSTRUCT ps;
323 
324  BeginPaint(hwnd, &ps);
325  DrawProc(Info, &ps);
326  EndPaint(hwnd, &ps);
327 
328  return 0;
329  }
330  }
331  }
332 
333  return DefWindowProcW(hwnd, uMsg, wParam, lParam);
334 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
#define FONT_BOXES_WND_HEIGHT
Definition: precomp.h:107
static VOID DrawProc(IN PFONT_WND_INFO Info, IN PAINTSTRUCT *ps)
Definition: fontboxeswnd.c:90
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
#define VK_LEFT
Definition: winuser.h:2199
#define VK_DOWN
Definition: winuser.h:2202
#define GetWindowLongPtrW
Definition: winuser.h:4730
#define SWP_NOZORDER
Definition: winuser.h:1232
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
int32_t INT
Definition: typedefs.h:56
#define VK_RETURN
Definition: winuser.h:2176
WPARAM wParam
Definition: combotst.c:138
struct TraceInfo Info
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
VOID EditCurrentGlyph(PFONT_WND_INFO FontWndInfo)
Definition: fontboxeswnd.c:189
#define VK_UP
Definition: winuser.h:2200
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define GWLP_USERDATA
Definition: treelist.c:63
static VOID SetSelectedCharacter(IN PFONT_WND_INFO Info, IN UINT uNewCharacter, OPTIONAL IN LPRECT NewCharacterRect)
Definition: fontboxeswnd.c:59
smooth NULL
Definition: ftsmooth.c:416
#define WM_KEYDOWN
Definition: winuser.h:1697
#define WM_DESTROY
Definition: winuser.h:1591
static INT FontBoxesHitTest(IN UINT xPos, IN UINT yPos, OUT LPRECT CharacterRect)
Definition: fontboxeswnd.c:41
#define WM_PAINT
Definition: winuser.h:1602
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1760
#define VK_RIGHT
Definition: winuser.h:2201
struct _FONT_WND_INFO * PFONT_WND_INFO
Definition: precomp.h:36
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
#define WM_CREATE
Definition: winuser.h:1590
#define FONT_BOXES_WND_WIDTH
Definition: precomp.h:106
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SetWindowLongPtrW
Definition: winuser.h:5247
LPARAM lParam
Definition: combotst.c:139

Referenced by InitFontBoxesWndClass().

◆ GetCharacterPosition()

__inline VOID GetCharacterPosition ( IN UINT  uCharacter,
OUT PUINT  uFontRow,
OUT PUINT  uFontColumn 
)

Definition at line 34 of file fontboxeswnd.c.

35 {
36  *uFontRow = uCharacter / 16;
37  *uFontColumn = uCharacter % 16;
38 }

Referenced by EditGlyphCommand(), PasteIntoCurrentGlyph(), and SetSelectedCharacter().

◆ GetCharacterRect()

VOID GetCharacterRect ( IN UINT  uFontRow,
IN UINT  uFontColumn,
OUT LPRECT  CharacterRect 
)

Definition at line 25 of file fontboxeswnd.c.

26 {
27  CharacterRect->left = uFontColumn * (CHARACTER_BOX_WIDTH + CHARACTER_BOX_PADDING);
28  CharacterRect->top = uFontRow * (CHARACTER_BOX_HEIGHT + CHARACTER_BOX_PADDING);
29  CharacterRect->right = CharacterRect->left + CHARACTER_BOX_WIDTH;
30  CharacterRect->bottom = CharacterRect->top + CHARACTER_BOX_HEIGHT;
31 }
#define CHARACTER_BOX_WIDTH
Definition: precomp.h:103
#define CHARACTER_BOX_HEIGHT
Definition: precomp.h:104
#define CHARACTER_BOX_PADDING
Definition: precomp.h:105

Referenced by DrawProc(), EditGlyphCommand(), FontBoxesHitTest(), PasteIntoCurrentGlyph(), and SetSelectedCharacter().

◆ InitFontBoxesWndClass()

BOOL InitFontBoxesWndClass ( VOID  )

Definition at line 337 of file fontboxeswnd.c.

338 {
339  WNDCLASSW wc = {0,};
340 
342  wc.hInstance = hInstance;
343  wc.hCursor = LoadCursor( NULL, IDC_ARROW );
344  wc.hbrBackground = (HBRUSH)( COLOR_BTNFACE + 1 );
346  wc.style = CS_DBLCLKS;
347 
348  return RegisterClassW(&wc) != 0;
349 }
UINT style
Definition: winuser.h:3150
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
HINSTANCE hInstance
Definition: charmap.c:20
WNDPROC lpfnWndProc
Definition: winuser.h:3151
smooth NULL
Definition: ftsmooth.c:416
LPCWSTR lpszClassName
Definition: winuser.h:3159
#define COLOR_BTNFACE
Definition: winuser.h:918
#define CS_DBLCLKS
Definition: winuser.h:646
#define LoadCursor
Definition: winuser.h:5713
static LRESULT CALLBACK FontBoxesWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: fontboxeswnd.c:248
HCURSOR hCursor
Definition: winuser.h:3156
HBRUSH hbrBackground
Definition: winuser.h:3157
static const WCHAR szFontBoxesWndClass[]
Definition: fontboxeswnd.c:10
HINSTANCE hInstance
Definition: winuser.h:3154
#define IDC_ARROW
Definition: winuser.h:682

Referenced by wWinMain().

◆ SetSelectedCharacter()

static VOID SetSelectedCharacter ( IN PFONT_WND_INFO  Info,
IN UINT  uNewCharacter,
OPTIONAL IN LPRECT  NewCharacterRect 
)
static

Definition at line 59 of file fontboxeswnd.c.

60 {
61  LPRECT pCharacterRect;
62  RECT OldCharacterRect;
63  UINT uFontColumn;
64  UINT uFontRow;
65 
66  // Remove the selection of the old character
67  GetCharacterPosition(Info->uSelectedCharacter, &uFontRow, &uFontColumn);
68  GetCharacterRect(uFontRow, uFontColumn, &OldCharacterRect);
69  InvalidateRect(Info->hFontBoxesWnd, &OldCharacterRect, FALSE);
70 
71  // You may pass the RECT of the new character, otherwise we'll allocate memory for one and get it ourselves
72  if(NewCharacterRect)
73  pCharacterRect = NewCharacterRect;
74  else
75  {
76  GetCharacterPosition(uNewCharacter, &uFontRow, &uFontColumn);
77  pCharacterRect = (LPRECT) HeapAlloc( hProcessHeap, 0, sizeof(RECT) );
78  GetCharacterRect(uFontRow, uFontColumn, pCharacterRect);
79  }
80 
81  // Select the new character
82  Info->uSelectedCharacter = uNewCharacter;
83  InvalidateRect(Info->hFontBoxesWnd, pCharacterRect, FALSE);
84 
85  if(!NewCharacterRect)
86  HeapFree(hProcessHeap, 0, pCharacterRect);
87 }
__inline VOID GetCharacterPosition(IN UINT uCharacter, OUT PUINT uFontRow, OUT PUINT uFontColumn)
Definition: fontboxeswnd.c:34
struct TraceInfo Info
#define LPRECT
Definition: precomp.h:28
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
VOID GetCharacterRect(IN UINT uFontRow, IN UINT uFontColumn, OUT LPRECT CharacterRect)
Definition: fontboxeswnd.c:25
unsigned int UINT
Definition: ndis.h:50
#define HeapFree(x, y, z)
Definition: compat.h:394
HANDLE hProcessHeap
Definition: kbswitch.c:25

Referenced by FontBoxesWndProc().

◆ UnInitFontBoxesWndClass()

VOID UnInitFontBoxesWndClass ( VOID  )

Definition at line 352 of file fontboxeswnd.c.

353 {
355 }
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
HINSTANCE hInstance
Definition: charmap.c:20
static const WCHAR szFontBoxesWndClass[]
Definition: fontboxeswnd.c:10

Referenced by wWinMain().

Variable Documentation

◆ szFontBoxesWndClass

const WCHAR szFontBoxesWndClass[] = L"VGAFontEditFontBoxesWndClass"
static