ReactOS  0.4.13-dev-455-g28ed234
mainwnd.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS VGA Font Editor
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: Implements the main window of the application
5  * COPYRIGHT: Copyright 2008 Colin Finck (colin@reactos.org)
6  * Copyright 2018 Katayama Hirofui MZ (katayama.hirofumi.mz@gmail.com)
7  */
8 
9 #include "precomp.h"
10 
11 static const WCHAR szMainWndClass[] = L"VGAFontEditMainWndClass";
12 
13 static VOID
15 {
16  HDC hMemDC;
17  HDC hMainDC;
18  HPEN hPen, hPenOld;
19  RECT rect;
20  HBITMAP hBitmapOld;
21 
22  hMemDC = CreateCompatibleDC(NULL);
23  hMainDC = GetDC(Info->hMainWnd);
24 
25  // Create the "Box" bitmap
27  hBitmapOld = SelectObject(hMemDC, Info->hBoxBmp);
28 
29  rect.left = 0;
30  rect.top = 0;
33  FillRect( hMemDC, &rect, (HBRUSH)(COLOR_BTNFACE + 1) );
34 
35  hPenOld = SelectObject( hMemDC, GetStockObject(WHITE_PEN) );
36  Rectangle(hMemDC, 0, 0, CHARACTER_INFO_BOX_WIDTH - 1, 2);
37  Rectangle(hMemDC, 0, 2, 2, CHARACTER_INFO_BOX_HEIGHT - 1);
38  hPen = SelectObject(hMemDC, hPenOld);
39 
40  hPen = CreatePen( PS_SOLID, 1, RGB(128, 128, 128) );
41  hPenOld = SelectObject(hMemDC, hPen);
44 
45  SetPixel( hMemDC, CHARACTER_INFO_BOX_WIDTH - 1, 0, RGB(128, 128, 128) );
46  SetPixel( hMemDC, 0, CHARACTER_INFO_BOX_HEIGHT - 1, RGB(128, 128, 128) );
47  SelectObject(hMemDC, hBitmapOld);
48 
49  hPen = SelectObject(hMemDC, hPenOld);
50  DeleteObject(hPen);
51  DeleteDC(hMemDC);
52  ReleaseDC(Info->hMainWnd, hMainDC);
53 }
54 
55 static VOID
57 {
58  DeleteObject(Info->hBoxBmp);
59 }
60 
61 static VOID
62 AddToolbarButton(IN PMAIN_WND_INFO Info, IN INT iBitmap, IN INT idCommand, IN UINT uID)
63 {
64  PWSTR pszTooltip;
65  TBBUTTON tbb = {0,};
66 
67  if( AllocAndLoadString(&pszTooltip, uID) )
68  {
70  tbb.iBitmap = iBitmap;
71  tbb.idCommand = idCommand;
72  tbb.iString = (INT_PTR)pszTooltip;
73 
74  SendMessageW( Info->hToolbar, TB_ADDBUTTONSW, 1, (LPARAM)&tbb );
75  HeapFree(hProcessHeap, 0, pszTooltip);
76  }
77 }
78 
79 static VOID
81 {
82  TBBUTTONINFOW tbbi = {0,};
83 
84  tbbi.cbSize = sizeof(tbbi);
85  tbbi.dwMask = TBIF_STATE;
86  tbbi.fsState = (bEnabled ? TBSTATE_ENABLED : 0);
87 
88  SendMessageW(Info->hToolbar, TB_SETBUTTONINFOW, idCommand, (LPARAM)&tbbi);
89 }
90 
91 VOID
93 {
97 }
98 
99 static VOID
101 {
102  TBBUTTON tbb = {0,};
103 
104  tbb.fsStyle = BTNS_SEP;
105 
106  SendMessageW( Info->hToolbar, TB_ADDBUTTONSW, 1, (LPARAM)&tbb );
107 }
108 
109 static VOID
111 {
112  CLIENTCREATESTRUCT ccs;
113  INT iCustomBitmaps;
114  INT iStandardBitmaps;
115  TBADDBITMAP tbab;
116 
117  // Add the toolbar
118  Info->hToolbar = CreateWindowExW(0,
120  NULL,
122  0,
123  0,
124  0,
125  0,
126  Info->hMainWnd,
127  NULL,
128  hInstance,
129  NULL);
130 
131  // Identify the used Common Controls version
132  SendMessageW(Info->hToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
133 
134  // Enable Tooltips
135  SendMessageW(Info->hToolbar, TB_SETMAXTEXTROWS, 0, 0);
136 
137  // Add the toolbar bitmaps
138  tbab.hInst = HINST_COMMCTRL;
139  tbab.nID = IDB_STD_SMALL_COLOR;
140  iStandardBitmaps = (INT)SendMessageW(Info->hToolbar, TB_ADDBITMAP, 0, (LPARAM)&tbab);
141 
142  tbab.hInst = hInstance;
143  tbab.nID = IDB_MAIN_TOOLBAR;
144  iCustomBitmaps = (INT)SendMessageW(Info->hToolbar, TB_ADDBITMAP, 0, (LPARAM)&tbab);
145 
146  // Add the toolbar buttons
155 
158 
159  // Add the MDI client area
160  ccs.hWindowMenu = GetSubMenu(Info->hMenu, 2);
162 
163  Info->hMdiClient = CreateWindowExW(WS_EX_CLIENTEDGE,
164  L"MDICLIENT",
165  NULL,
167  0,
168  0,
169  0,
170  0,
171  Info->hMainWnd,
172  NULL,
173  hInstance,
174  &ccs);
175 
176  // Initialize the file handling
177  FileInitialize(Info->hMainWnd);
178 }
179 
180 static VOID
182 {
183  UINT uState;
184 
185  uState = MF_BYCOMMAND | !(Info->CurrentFontWnd);
186 
187  EnableMenuItem(Info->hMenu, ID_FILE_CLOSE, uState);
188  EnableMenuItem(Info->hMenu, ID_FILE_SAVE, uState);
189  EnableMenuItem(Info->hMenu, ID_FILE_SAVE_AS, uState);
190 
191  EnableMenuItem(Info->hMenu, ID_EDIT_COPY, uState);
192  EnableMenuItem(Info->hMenu, ID_EDIT_GLYPH, uState);
193 
194  uState = MF_BYCOMMAND | !(Info->CurrentFontWnd && IsClipboardFormatAvailable(uCharacterClipboardFormat));
195  EnableMenuItem(Info->hMenu, ID_EDIT_PASTE, uState);
196 }
197 
198 static VOID
200 {
201  MessageBoxW(Info->hMainWnd, L"Out of memory!", NULL, MB_ICONERROR);
202 }
203 
204 static PFONT_OPEN_INFO
206 {
207  PFONT_OPEN_INFO OpenInfo;
208 
210  if (!OpenInfo)
211  {
212  OutOfMemory(Info);
213  return NULL;
214  }
215 
216  OpenInfo->bCreateNew = bCreateNew;
217  OpenInfo->pszFileName = HeapAlloc(hProcessHeap, 0, MAX_PATH);
218  if (!OpenInfo->pszFileName)
219  {
220  OutOfMemory(Info);
221  HeapFree(hProcessHeap, 0, OpenInfo);
222  return NULL;
223  }
224 
225  if (StringCchCopyW(OpenInfo->pszFileName, MAX_PATH, File) != S_OK)
226  {
227  MessageBoxW(Info->hMainWnd, L"Pathname is too long!", NULL, MB_ICONERROR);
228  HeapFree(hProcessHeap, 0, OpenInfo->pszFileName);
229  HeapFree(hProcessHeap, 0, OpenInfo);
230  return NULL;
231  }
232 
233  return OpenInfo;
234 }
235 
236 static VOID
238 {
239  PFONT_OPEN_INFO OpenInfo = CreateOpenInfo(Info, TRUE, L"");
240  if (!OpenInfo)
241  return;
242 
243  CreateFontWindow(Info, OpenInfo);
244 }
245 
246 static VOID
248 {
249  PFONT_OPEN_INFO OpenInfo = CreateOpenInfo(Info, FALSE, L"");
250  if (!OpenInfo)
251  return;
252 
253  if (DoOpenFile(OpenInfo->pszFileName))
254  {
255  CreateFontWindow(Info, OpenInfo);
256  return;
257  }
258 
259  HeapFree(hProcessHeap, 0, OpenInfo->pszFileName);
260  HeapFree(hProcessHeap, 0, OpenInfo);
261 }
262 
263 static VOID
265 {
267  if (!OpenInfo)
268  return;
269 
270  CreateFontWindow(Info, OpenInfo);
271 }
272 
273 static VOID
275 {
277  INT i, Count = DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0);
278 
279  for (i = 0; i < Count; ++i)
280  {
281  DragQueryFileW(hDrop, i, Path, MAX_PATH);
283  }
284 
285  DragFinish(hDrop);
286 }
287 
288 VOID
290 {
291  DWORD dwBytesWritten;
292  HANDLE hFile;
293 
294  // Show the "Save" dialog
295  // - if "Save As" was clicked
296  // - if the file was not yet saved
297  // - if another format than the binary format was opened
298  if(bSaveAs || !Info->CurrentFontWnd->OpenInfo->bBinaryFileOpened)
299  {
300  if(!Info->CurrentFontWnd->OpenInfo->pszFileName)
301  {
302  Info->CurrentFontWnd->OpenInfo->pszFileName = (PWSTR) HeapAlloc(hProcessHeap, 0, MAX_PATH);
303  Info->CurrentFontWnd->OpenInfo->pszFileName[0] = 0;
304  }
305  else if(!Info->CurrentFontWnd->OpenInfo->bBinaryFileOpened)
306  {
307  // For a file in another format, the user has to enter a new file name as well
308  Info->CurrentFontWnd->OpenInfo->pszFileName[0] = 0;
309  }
310 
311  if( !DoSaveFile(Info->CurrentFontWnd->OpenInfo->pszFileName) )
312  return;
313  }
314 
315  // Save the binary font
316  hFile = CreateFileW(Info->CurrentFontWnd->OpenInfo->pszFileName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
317 
319  {
321  return;
322  }
323 
324  if( !WriteFile(hFile, Info->CurrentFontWnd->Font, sizeof(BITMAP_FONT), &dwBytesWritten, NULL) )
326 
328 }
329 
330 static VOID
332 {
333  HGLOBAL hMem;
334  PUCHAR pCharacterBits;
335 
336  if(!OpenClipboard(NULL))
337  return;
338 
339  EmptyClipboard();
340 
341  hMem = GlobalAlloc(GMEM_MOVEABLE, 8);
342  pCharacterBits = GlobalLock(hMem);
343  RtlCopyMemory(pCharacterBits, FontWndInfo->Font->Bits + FontWndInfo->uSelectedCharacter * 8, 8);
344  GlobalUnlock(hMem);
345 
347 
348  CloseClipboard();
349 }
350 
351 static VOID
353 {
354  HGLOBAL hMem;
355 
357  return;
358 
359  if(!OpenClipboard(NULL))
360  return;
361 
363  if(hMem)
364  {
365  PUCHAR pCharacterBits;
366 
367  pCharacterBits = GlobalLock(hMem);
368  if(pCharacterBits)
369  {
370  RECT CharacterRect;
371  UINT uFontRow;
372  UINT uFontColumn;
373 
374  RtlCopyMemory(FontWndInfo->Font->Bits + FontWndInfo->uSelectedCharacter * 8, pCharacterBits, 8);
375  GlobalUnlock(hMem);
376 
377  FontWndInfo->OpenInfo->bModified = TRUE;
378 
379  GetCharacterPosition(FontWndInfo->uSelectedCharacter, &uFontRow, &uFontColumn);
380  GetCharacterRect(uFontRow, uFontColumn, &CharacterRect);
381  InvalidateRect(FontWndInfo->hFontBoxesWnd, &CharacterRect, FALSE);
382  }
383  }
384 
385  CloseClipboard();
386 }
387 
388 VOID
390 {
394 }
395 
396 static BOOL
398 {
399  switch(nMenuItemID)
400  {
401  // File Menu
402  case ID_FILE_NEW:
403  DoFileNew(Info);
404  return TRUE;
405 
406  case ID_FILE_OPEN:
407  DoFileOpen(Info);
408  return TRUE;
409 
410  case ID_FILE_CLOSE:
411  SendMessageW(Info->CurrentFontWnd->hSelf, WM_CLOSE, 0, 0);
412  return TRUE;
413 
414  case ID_FILE_SAVE:
416  return TRUE;
417 
418  case ID_FILE_SAVE_AS:
419  DoFileSave(Info, TRUE);
420  return TRUE;
421 
422  case ID_FILE_EXIT:
423  PostMessage(Info->hMainWnd, WM_CLOSE, 0, 0);
424  return TRUE;
425 
426  // Edit Menu
427  case ID_EDIT_GLYPH:
428  EditCurrentGlyph(Info->CurrentFontWnd);
429  return TRUE;
430 
431  case ID_EDIT_COPY:
432  CopyCurrentGlyph(Info->CurrentFontWnd);
433  return TRUE;
434 
435  case ID_EDIT_PASTE:
436  PasteIntoCurrentGlyph(Info->CurrentFontWnd);
437  return TRUE;
438 
439  // Window Menu
440  case ID_WINDOW_TILE_HORZ:
442  return TRUE;
443 
444  case ID_WINDOW_TILE_VERT:
445  SendMessageW(Info->hMdiClient, WM_MDITILE, MDITILE_VERTICAL, 0);
446  return TRUE;
447 
448  case ID_WINDOW_CASCADE:
449  SendMessageW(Info->hMdiClient, WM_MDICASCADE, 0, 0);
450  return TRUE;
451 
452  case ID_WINDOW_ARRANGE:
453  SendMessageW(Info->hMdiClient, WM_MDIICONARRANGE, 0, 0);
454  return TRUE;
455 
456  case ID_WINDOW_NEXT:
457  SendMessageW(Info->hMdiClient, WM_MDINEXT, 0, 0);
458  return TRUE;
459 
460  // Help Menu
461  case ID_HELP_ABOUT:
463  return TRUE;
464  }
465 
466  return FALSE;
467 }
468 
469 static VOID
471 {
472  HDWP dwp;
473  INT iMdiTop;
474  RECT ToolbarRect;
475 
476  iMdiTop = 0;
477 
478  dwp = BeginDeferWindowPos(2);
479  if(!dwp)
480  return;
481 
482  if(Info->hToolbar)
483  {
484  GetWindowRect(Info->hToolbar, &ToolbarRect);
485  iMdiTop += ToolbarRect.bottom - ToolbarRect.top;
486 
487  dwp = DeferWindowPos(dwp, Info->hToolbar, NULL, 0, 0, cx, ToolbarRect.bottom - ToolbarRect.top, SWP_NOZORDER);
488  if(!dwp)
489  return;
490  }
491 
492  if(Info->hMdiClient)
493  {
494  dwp = DeferWindowPos(dwp, Info->hMdiClient, NULL, 0, iMdiTop, cx, cy - iMdiTop, SWP_NOZORDER);
495  if(!dwp)
496  return;
497  }
498 
499  EndDeferWindowPos(dwp);
500 }
501 
502 static LRESULT CALLBACK
504 {
505  static HWND hNextClipboardViewer;
506  INT i;
508 
510 
511  if(Info || uMsg == WM_CREATE)
512  {
513  switch(uMsg)
514  {
515  case WM_COMMAND:
516  if( MenuCommand( LOWORD(wParam), Info ) )
517  return 0;
518 
519  break;
520 
521  case WM_CHANGECBCHAIN:
522  if((HWND)wParam == hNextClipboardViewer)
523  hNextClipboardViewer = (HWND)lParam;
524  else
525  SendMessage(hNextClipboardViewer, uMsg, wParam, lParam);
526 
527  return 0;
528 
529  case WM_CLOSE:
530  if(Info->FirstFontWnd)
531  {
532  // Send WM_CLOSE to all subwindows, so they can prompt for saving unsaved files
533  PFONT_WND_INFO pNextWnd;
534  PFONT_WND_INFO pWnd;
535 
536  pWnd = Info->FirstFontWnd;
537 
538  do
539  {
540  // The pWnd structure might already be destroyed after the WM_CLOSE, so we have to preserve the address of the next window here
541  pNextWnd = pWnd->NextFontWnd;
542 
543  // Send WM_USER_APPCLOSE, so we can check for a custom return value
544  // In this case, we check if the user clicked the "Cancel" button in one of the prompts and if so, we don't close the app
545  if( !SendMessage(pWnd->hSelf, WM_USER_APPCLOSE, 0, 0) )
546  return 0;
547  }
548  while( (pWnd = pNextWnd) );
549  }
550  break;
551 
552  case WM_CREATE:
553  Info = (PMAIN_WND_INFO)( ( (LPCREATESTRUCT)lParam )->lpCreateParams );
554  Info->hMainWnd = hwnd;
555  Info->hMenu = GetMenu(hwnd);
557 
558  hNextClipboardViewer = SetClipboardViewer(hwnd);
559 
560  InitMainWnd(Info);
562 
563  ShowWindow(hwnd, Info->nCmdShow);
564 
565  for (i = 1; i < __argc; ++i)
566  {
568  }
570  return 0;
571 
572  case WM_DESTROY:
574 
577  PostQuitMessage(0);
578  return 0;
579 
580  case WM_DRAWCLIPBOARD:
582 
583  // Pass the message to the next clipboard window in the chain
584  SendMessage(hNextClipboardViewer, uMsg, wParam, lParam);
585  return 0;
586 
587  case WM_INITMENUPOPUP:
589  break;
590 
591  case WM_SIZE:
593  return 0;
594 
595  case WM_DROPFILES:
596  MainWndDropFiles(Info, (HDROP)wParam);
597  return 0;
598  }
599  }
600 
601  if(Info && Info->hMdiClient)
602  return DefFrameProcW(hwnd, Info->hMdiClient, uMsg, wParam, lParam);
603  else
604  return DefWindowProcW(hwnd, uMsg, wParam, lParam);
605 }
606 
607 BOOL
609 {
610  HWND hMainWnd;
611 
613 
614  if(*Info)
615  {
616  (*Info)->nCmdShow = nCmdShow;
617 
620  szAppName,
626  NULL,
628  hInstance,
629  *Info);
630 
631  if(hMainWnd)
632  return TRUE;
633  else
634  HeapFree(hProcessHeap, 0, *Info);
635  }
636 
637  return FALSE;
638 }
639 
640 BOOL
642 {
643  WNDCLASSW wc = {0,};
644 
646  wc.hInstance = hInstance;
647  wc.hCursor = LoadCursor( NULL, IDC_ARROW );
649  wc.hbrBackground = (HBRUSH)( COLOR_BTNFACE + 1 );
651 
652  return RegisterClassW(&wc) != 0;
653 }
654 
655 VOID
657 {
659 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
static VOID MainWndSize(PMAIN_WND_INFO Info, INT cx, INT cy)
Definition: mainwnd.c:470
static VOID InitMainWnd(IN PMAIN_WND_INFO Info)
Definition: mainwnd.c:110
#define IDS_TOOLTIP_PASTE
Definition: resource.h:76
#define WM_USER_APPCLOSE
Definition: precomp.h:115
#define WM_CHANGECBCHAIN
Definition: winuser.h:1835
#define TB_SETBUTTONINFOW
Definition: commctrl.h:1230
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IN
Definition: typedefs.h:38
VOID SetPasteButtonState(IN PMAIN_WND_INFO Info)
Definition: mainwnd.c:389
#define STD_PASTE
Definition: commctrl.h:1045
HDWP WINAPI BeginDeferWindowPos(_In_ int)
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1106
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define ID_EDIT_GLYPH
Definition: resource.h:44
#define CHARACTER_INFO_BOX_WIDTH
Definition: precomp.h:100
static VOID MainWndOpenFile(IN PMAIN_WND_INFO Info, LPCWSTR File)
Definition: mainwnd.c:264
#define CloseHandle
Definition: compat.h:398
HWND WINAPI SetClipboardViewer(_In_ HWND)
BOOL WINAPI IsClipboardFormatAvailable(_In_ UINT)
#define MF_BYCOMMAND
Definition: winuser.h:202
#define IDS_TOOLTIP_SAVE
Definition: resource.h:73
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define CHARACTER_BOX_WIDTH
Definition: precomp.h:103
__inline VOID GetCharacterPosition(IN UINT uCharacter, OUT PUINT uFontRow, OUT PUINT uFontColumn)
Definition: fontboxeswnd.c:34
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HDC WINAPI GetDC(_In_opt_ HWND)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define WM_INITMENUPOPUP
Definition: winuser.h:1722
uint16_t * PWSTR
Definition: typedefs.h:54
#define WHITE_PEN
Definition: wingdi.h:904
BOOL InitMainWndClass(VOID)
Definition: mainwnd.c:641
unsigned char * PUCHAR
Definition: retypes.h:3
VOID UnInitMainWndClass(VOID)
Definition: mainwnd.c:656
#define WM_MDICASCADE
Definition: winuser.h:1795
#define ID_EDIT_COPY
Definition: resource.h:49
#define INT
Definition: polytest.cpp:20
DWORD dwMask
Definition: commctrl.h:1215
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:27
#define TOOLBARCLASSNAMEW
Definition: commctrl.h:915
void WINAPI DragAcceptFiles(HWND hWnd, BOOL b)
Definition: shellole.c:527
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define IDB_STD_SMALL_COLOR
Definition: commctrl.h:1036
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define ID_FILE_OPEN
Definition: resource.h:42
static const WCHAR szMainWndClass[]
Definition: mainwnd.c:11
static BOOL MenuCommand(IN INT nMenuItemID, IN PMAIN_WND_INFO Info)
Definition: mainwnd.c:397
#define ID_FILE_SAVE_AS
Definition: resource.h:41
UINT_PTR WPARAM
Definition: windef.h:207
#define ID_WINDOW_TILE_VERT
Definition: resource.h:49
#define STD_FILENEW
Definition: commctrl.h:1049
HINSTANCE hInst
Definition: commctrl.h:1031
#define WS_CHILD
Definition: pedump.c:617
BOOL CreateFontWindow(IN PMAIN_WND_INFO MainWndInfo, IN PFONT_OPEN_INFO OpenInfo)
Definition: fontwnd.c:363
#define GetWindowLongPtrW
Definition: winuser.h:4698
#define SWP_NOZORDER
Definition: winuser.h:1232
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:62
BYTE fsStyle
Definition: commctrl.h:924
static INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:60
#define WS_CLIPCHILDREN
Definition: pedump.c:619
int32_t INT
Definition: typedefs.h:56
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
struct TraceInfo Info
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
VOID FileInitialize(IN HWND hwnd)
Definition: opensave.c:13
static VOID AddToolbarButton(IN PMAIN_WND_INFO Info, IN INT iBitmap, IN INT idCommand, IN UINT uID)
Definition: mainwnd.c:62
VOID EditCurrentGlyph(PFONT_WND_INFO FontWndInfo)
Definition: fontboxeswnd.c:189
#define TB_SETMAXTEXTROWS
Definition: commctrl.h:1134
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define PS_SOLID
Definition: wingdi.h:585
#define WM_MDIICONARRANGE
Definition: winuser.h:1796
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
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
unsigned int BOOL
Definition: ntddk_ex.h:94
static VOID DoOpenFile(PINFO pInfo)
Definition: connectdialog.c:34
#define IDS_TOOLTIP_EDIT_GLYPH
Definition: resource.h:74
#define ID_FILE_EXIT
Definition: resource.h:47
#define MDITILE_HORIZONTAL
Definition: winuser.h:2142
#define GENERIC_WRITE
Definition: nt_native.h:90
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
WNDPROC lpfnWndProc
Definition: winuser.h:3130
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_DROPFILES
Definition: winuser.h:1801
PWSTR pszFileName
Definition: precomp.h:61
static VOID SetToolbarButtonState(IN PMAIN_WND_INFO Info, INT idCommand, BOOL bEnabled)
Definition: mainwnd.c:80
#define CW_USEDEFAULT
Definition: winuser.h:225
#define GWLP_USERDATA
Definition: treelist.c:63
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
#define ID_HELP_ABOUT
Definition: resource.h:77
static VOID MainWndDropFiles(IN PMAIN_WND_INFO Info, HDROP hDrop)
Definition: mainwnd.c:274
smooth NULL
Definition: ftsmooth.c:416
#define WM_MDINEXT
Definition: winuser.h:1792
#define STD_COPY
Definition: commctrl.h:1044
LPCWSTR lpszClassName
Definition: winuser.h:3138
LONG_PTR LPARAM
Definition: windef.h:208
#define ID_FILE_SAVE
Definition: resource.h:43
INT_PTR iString
Definition: commctrl.h:931
#define IDS_OPENERROR
Definition: resource.h:61
INT_PTR CALLBACK AboutDlgProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
Definition: sndrec32.cpp:83
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4268
#define WM_DESTROY
Definition: winuser.h:1591
#define CHARACTER_INFO_BOX_HEIGHT
Definition: precomp.h:101
int iBitmap
Definition: commctrl.h:921
#define ID_FILE_NEW
Definition: resource.h:41
#define PostMessage
Definition: winuser.h:5698
#define IDM_MAINMENU
Definition: resources.h:3
#define ID_WINDOW_CASCADE
Definition: resource.h:78
FORCEINLINE VOID SetPixel(IN ULONG Left, IN ULONG Top, IN UCHAR Color)
Definition: vga.c:99
#define TBIF_STATE
Definition: commctrl.h:1193
BOOL bCreateNew
Definition: precomp.h:58
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define BTNS_SEP
Definition: commctrl.h:971
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static VOID CopyCurrentGlyph(IN PFONT_WND_INFO FontWndInfo)
Definition: mainwnd.c:331
#define WM_SIZE
Definition: winuser.h:1593
#define MDITILE_VERTICAL
Definition: winuser.h:2143
#define WM_CLOSE
Definition: winuser.h:1603
#define MAX_PATH
Definition: compat.h:26
#define RGB(r, g, b)
Definition: wingdi.h:2918
VOID LocalizedError(IN UINT uID,...)
Definition: misc.c:103
struct _MAIN_WND_INFO * PMAIN_WND_INFO
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
unsigned long DWORD
Definition: ntddk_ex.h:95
HICON hIcon
Definition: winuser.h:3134
HWND hSelf
Definition: precomp.h:70
#define IDB_MAIN_TOOLBAR
Definition: resource.h:24
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:961
#define OPEN_ALWAYS
Definition: disk.h:70
#define WS_HSCROLL
Definition: pedump.c:628
#define TB_ADDBITMAP
Definition: commctrl.h:1028
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define IDS_WRITEERROR
Definition: resource.h:63
VOID GetCharacterRect(IN UINT uFontRow, IN UINT uFontColumn, OUT LPRECT CharacterRect)
Definition: fontboxeswnd.c:25
#define ID_WINDOW_TILE_HORZ
Definition: resource.h:48
HWND hMainWnd
Definition: magnifier.c:32
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
static const WCHAR L[]
Definition: oid.c:1250
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
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 VOID OutOfMemory(IN PMAIN_WND_INFO Info)
Definition: mainwnd.c:199
#define IDI_MAIN
Definition: resource.h:4
int idCommand
Definition: commctrl.h:922
#define COLOR_BTNFACE
Definition: winuser.h:918
#define WM_DRAWCLIPBOARD
Definition: winuser.h:1830
#define MB_ICONERROR
Definition: winuser.h:781
#define TB_ADDBUTTONSW
Definition: commctrl.h:1238
VOID DoFileSave(IN PMAIN_WND_INFO Info, IN BOOL bSaveAs)
Definition: mainwnd.c:289
static BOOL DoSaveFile(HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
Definition: console.c:205
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1716
static VOID UnInitResources(IN PMAIN_WND_INFO Info)
Definition: mainwnd.c:56
_In_ HANDLE hFile
Definition: mswsock.h:90
#define TOOLBAR_EDIT_GLYPH
Definition: precomp.h:118
#define ID_WINDOW_ARRANGE
Definition: resource.h:52
#define LoadCursor
Definition: winuser.h:5678
TCHAR szAppName[128]
Definition: solitaire.cpp:16
#define IDS_TOOLTIP_COPY
Definition: resource.h:75
HCURSOR hCursor
Definition: winuser.h:3135
#define S_OK
Definition: intsafe.h:59
PRTL_UNICODE_STRING_BUFFER Path
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
BOOL WINAPI DeleteDC(_In_ HDC)
#define IDD_ABOUT
Definition: shresdef.h:298
#define ID_WINDOW_NEXT
Definition: resource.h:51
#define CHARACTER_BOX_HEIGHT
Definition: precomp.h:104
HINSTANCE hInstance
Definition: mainwnd.c:15
HBRUSH hbrBackground
Definition: winuser.h:3136
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static VOID AddToolbarSeparator(IN PMAIN_WND_INFO Info)
Definition: mainwnd.c:100
#define ID_FILE_CLOSE
Definition: resource.h:39
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define WS_VSCROLL
Definition: pedump.c:627
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
static VOID PasteIntoCurrentGlyph(IN PFONT_WND_INFO FontWndInfo)
Definition: mainwnd.c:352
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
HANDLE WINAPI GetClipboardData(_In_ UINT)
#define HINST_COMMCTRL
Definition: commctrl.h:1035
#define CreateFileW
Definition: compat.h:400
HINSTANCE hInstance
Definition: winuser.h:3133
#define IDC_ARROW
Definition: winuser.h:682
static VOID InitResources(IN PMAIN_WND_INFO Info)
Definition: mainwnd.c:14
static VOID DoFileNew(IN PMAIN_WND_INFO Info)
Definition: mainwnd.c:237
_CRTIMP int __argc
Definition: getargs.c:21
_Out_opt_ int * cx
Definition: commctrl.h:570
_CRTIMP wchar_t ** __wargv
Definition: getargs.c:20
#define SendMessage
Definition: winuser.h:5709
#define OUT
Definition: typedefs.h:39
void WINAPI DragFinish(HDROP h)
Definition: shellole.c:543
#define TBSTATE_ENABLED
Definition: commctrl.h:946
#define WM_CREATE
Definition: winuser.h:1590
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
#define STD_FILESAVE
Definition: commctrl.h:1051
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define HIWORD(l)
Definition: typedefs.h:246
#define ID_EDIT_PASTE
Definition: resource.h:50
#define IDS_TOOLTIP_OPEN
Definition: resource.h:72
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
LONG bottom
Definition: windef.h:294
PFONT_WND_INFO NextFontWnd
Definition: precomp.h:75
UINT uCharacterClipboardFormat
Definition: main.c:15
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
VOID SetToolbarFileButtonState(IN PMAIN_WND_INFO Info, BOOL bEnabled)
Definition: mainwnd.c:92
#define SetWindowLongPtrW
Definition: winuser.h:5215
static HBITMAP
Definition: button.c:44
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
Definition: File.h:15
#define ID_MDI_FIRSTCHILD
Definition: mainwnd.c:5
BYTE fsState
Definition: commctrl.h:923
LONG_PTR LRESULT
Definition: windef.h:209
static VOID DoFileOpen(IN PMAIN_WND_INFO Info)
Definition: mainwnd.c:247
#define STD_FILEOPEN
Definition: commctrl.h:1050
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define WS_VISIBLE
Definition: pedump.c:620
static PFONT_OPEN_INFO CreateOpenInfo(IN PMAIN_WND_INFO Info, BOOL bCreateNew, LPCWSTR File)
Definition: mainwnd.c:205
HMENU WINAPI GetMenu(_In_ HWND)
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:627
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define GMEM_MOVEABLE
Definition: winbase.h:291
LRESULT WINAPI DefFrameProcW(_In_ HWND, _In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND CreateMainWindow(LPCTSTR lpCaption, int nCmdShow)
Definition: mainwnd.c:920
#define WM_MDITILE
Definition: winuser.h:1794
HANDLE hProcessHeap
Definition: kbswitch.c:25
static VOID InitMenuPopup(IN PMAIN_WND_INFO Info)
Definition: mainwnd.c:181
UINT_PTR nID
Definition: commctrl.h:1032
#define IDS_TOOLTIP_NEW
Definition: resource.h:71
static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: mainwnd.c:503