ReactOS  0.4.12-dev-14-gd0c8636
precomp.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <wingdi.h>
#include "resource.h"
Include dependency graph for precomp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _CELL
 
struct  _MAP
 
struct  MAPNOTIFY
 
struct  SETTINGS
 

Macros

#define SIZEOF(_v)   (sizeof(_v) / sizeof(*_v))
 
#define MAX_GLYPHS   65536
 
#define XCELLS   20
 
#define YCELLS   10
 
#define XLARGE   45
 
#define YLARGE   25
 
#define FM_SETFONT   (WM_USER + 1)
 
#define FM_GETCHAR   (WM_USER + 2)
 
#define FM_SETCHAR   (WM_USER + 3)
 
#define FM_GETHFONT   (WM_USER + 4)
 

Typedefs

typedef struct _CELL CELL
 
typedef struct _CELLPCELL
 
typedef struct _MAP MAP
 
typedef struct _MAPPMAP
 
typedef struct MAPNOTIFYLPMAPNOTIFY
 

Functions

LRESULT CALLBACK LrgCellWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID ShowAboutDlg (HWND hWndParent)
 
BOOL RegisterMapClasses (HINSTANCE hInstance)
 
VOID UnregisterMapClasses (HINSTANCE hInstance)
 
int WINAPI GetUName (IN WORD wCharCode, OUT LPWSTR lpBuf)
 
VOID UpdateStatusBar (WCHAR wch)
 
VOID ChangeMapFont (HWND hDlg)
 
void LoadSettings (void)
 
void SaveSettings (void)
 

Variables

HINSTANCE hInstance
 
SETTINGS Settings
 
HWND hCharmapDlg
 

Macro Definition Documentation

◆ FM_GETCHAR

#define FM_GETCHAR   (WM_USER + 2)

Definition at line 23 of file precomp.h.

Referenced by AddCharToSelection(), and MapWndProc().

◆ FM_GETHFONT

#define FM_GETHFONT   (WM_USER + 4)

Definition at line 25 of file precomp.h.

Referenced by AddCharToSelection(), and MapWndProc().

◆ FM_SETCHAR

#define FM_SETCHAR   (WM_USER + 3)

Definition at line 24 of file precomp.h.

Referenced by CharMapDlgProc(), and MapWndProc().

◆ FM_SETFONT

#define FM_SETFONT   (WM_USER + 1)

Definition at line 22 of file precomp.h.

Referenced by ChangeMapFont(), and MapWndProc().

◆ MAX_GLYPHS

#define MAX_GLYPHS   65536

Definition at line 15 of file precomp.h.

Referenced by CGridView::SetFont(), and SetFont().

◆ SIZEOF

#define SIZEOF (   _v)    (sizeof(_v) / sizeof(*_v))

Definition at line 13 of file precomp.h.

◆ XCELLS

#define XCELLS   20

◆ XLARGE

#define XLARGE   45

Definition at line 19 of file precomp.h.

Referenced by CreateLargeCell(), and MoveLargeCell().

◆ YCELLS

#define YCELLS   10

◆ YLARGE

#define YLARGE   25

Definition at line 20 of file precomp.h.

Referenced by CreateLargeCell(), and MoveLargeCell().

Typedef Documentation

◆ CELL

typedef struct _CELL CELL

◆ LPMAPNOTIFY

◆ MAP

typedef struct _MAP MAP

◆ PCELL

typedef struct _CELL * PCELL

◆ PMAP

typedef struct _MAP * PMAP

Function Documentation

◆ ChangeMapFont()

VOID ChangeMapFont ( HWND  hDlg)

Definition at line 113 of file charmap.c.

Referenced by CharMapDlgProc(), and LoadSettings().

114 {
115  HWND hCombo;
116  HWND hMap;
117  LPWSTR lpFontName;
118  INT Len;
119 
120  hCombo = GetDlgItem(hDlg, IDC_FONTCOMBO);
121 
122  Len = GetWindowTextLengthW(hCombo);
123 
124  if (Len != 0)
125  {
126  lpFontName = HeapAlloc(GetProcessHeap(),
127  0,
128  (Len + 1) * sizeof(WCHAR));
129 
130  if (lpFontName)
131  {
132  SendMessageW(hCombo,
133  WM_GETTEXT,
134  Len + 1,
135  (LPARAM)lpFontName);
136 
137  hMap = GetDlgItem(hDlg, IDC_FONTMAP);
138 
139  SendMessageW(hMap,
140  FM_SETFONT,
141  0,
142  (LPARAM)lpFontName);
143  }
144 
146  0,
147  lpFontName);
148  }
149 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_GETTEXT
Definition: winuser.h:1600
int32_t INT
Definition: typedefs.h:56
LONG_PTR LPARAM
Definition: windef.h:208
#define FM_SETFONT
Definition: precomp.h:22
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define Len
Definition: deflate.h:82
#define IDC_FONTCOMBO
Definition: resource.h:12
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
#define IDC_FONTMAP
Definition: resource.h:14

◆ GetUName()

int WINAPI GetUName ( IN WORD  wCharCode,
OUT LPWSTR  lpBuf 
)

Definition at line 17 of file getuname.c.

Referenced by BestFit_FromNLS(), and UpdateStatusBar().

19 {
20  WCHAR szDescription[256];
21  int res = LoadStringW(hInstance, wCharCode, szDescription, 256);
22  if (res != 0)
23  {
24  wcscpy(lpBuf, szDescription);
25  return 0;
26  }
27  else
28  {
29  wcscpy(lpBuf, L"Undefined");
30  return 0;
31  }
32 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1087
HINSTANCE hInstance
Definition: getuname.c:13
GLuint res
Definition: glext.h:9613
static const WCHAR szDescription[]
Definition: provider.c:52

◆ LoadSettings()

void LoadSettings ( void  )

Definition at line 53 of file settings.c.

Referenced by InitDevice(), InitInstance(), MAIN_LoadSettings(), OnCreate(), ScreenSaverConfigureDialog(), ScreenSaverProc(), and wWinMain().

54 {
55  HKEY hKey = NULL;
56  int iItemIndex = -1;
57 
59  {
60  TCHAR szBuffer[MAX_PATH];
61  DWORD dwAdvancedChecked;
62  unsigned long type = REG_DWORD, size = 1024;
63 
64  /* Restore last selected font */
65  if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, _T("Font"), szBuffer, (sizeof(szBuffer)/sizeof(szBuffer[0]))) == ERROR_SUCCESS)
66  {
67  //Get combobox handle
69 
70  //Search for match and return index if match found
71  iItemIndex = ComboBox_FindStringExact(hWnd, -1, szBuffer);
72  if(iItemIndex != CB_ERR)
73  {
74  ComboBox_SetCurSel(hWnd, iItemIndex);
76  }
77  }
78 
79  /* Restore last selected character set */
80  if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, _T("CodePage"), szBuffer, (sizeof(szBuffer)/sizeof(szBuffer[0]))) == ERROR_SUCCESS)
81  {
82  //Get combobox handle
84 
85  iItemIndex = ComboBox_FindStringExact(hWnd, -1, szBuffer);
86  if(iItemIndex != CB_ERR)
87  {
88  ComboBox_SetCurSel(hWnd, iItemIndex);
89  }
90  }
91 
92  RegQueryValueEx(hKey, _T("Advanced"), NULL, &type, (LPBYTE)&dwAdvancedChecked, &size);
93 
94  if(dwAdvancedChecked != FALSE)
96 
97  RegCloseKey(hKey);
98  }
99  else
100  {
101  /* Default font seems to be Arial */
103 
104  iItemIndex = ComboBox_FindStringExact(hWnd, -1, _T("Arial"));
105  if(iItemIndex != CB_ERR)
106  {
107  ComboBox_SetCurSel(hWnd, iItemIndex);
109  }
110  }
111 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDC_CHECK_ADVANCED
Definition: resource.h:26
#define KEY_READ
Definition: nt_native.h:1023
#define HKEY_CURRENT_USER
Definition: winreg.h:11
HWND hWnd
Definition: settings.c:17
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define SendDlgItemMessage
Definition: winuser.h:5708
#define IDC_COMBO_CHARSET
Definition: resource.h:21
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define ComboBox_FindStringExact(hwndCtl, indexStart, lpszFind)
Definition: windowsx.h:22
unsigned char * LPBYTE
Definition: typedefs.h:52
const TCHAR g_szGeneralRegKey[]
Definition: settings.c:16
smooth NULL
Definition: ftsmooth.c:416
#define CB_ERR
Definition: winuser.h:2389
#define MF_CHECKED
Definition: winuser.h:132
char TCHAR
Definition: xmlstorage.h:189
#define BM_CLICK
Definition: winuser.h:1878
#define _T(x)
Definition: vfdio.h:22
GLsizeiptr size
Definition: glext.h:5919
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ComboBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:41
#define IDC_FONTCOMBO
Definition: resource.h:12
VOID ChangeMapFont(HWND hDlg)
Definition: charmap.c:113
LONG QueryStringValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPTSTR pszBuffer, DWORD dwBufferLen)
Definition: settings.c:19
#define RegOpenKeyEx
Definition: winreg.h:520
HWND hCharmapDlg
Definition: charmap.c:22
#define REG_DWORD
Definition: sdbapi.c:539

◆ LrgCellWndProc()

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

Definition at line 68 of file lrgcell.c.

Referenced by RegisterMapClasses().

72 {
73  PMAP infoPtr;
74  LRESULT Ret = 0;
75  static INT cxClient, cyClient;
76  static RECT rc;
77  static HFONT hFont = NULL;
78 
79  infoPtr = (PMAP)GetWindowLongPtrW(hwnd,
81 
82  if (infoPtr == NULL && uMsg != WM_CREATE)
83  {
84  goto HandleDefaultMessage;
85  }
86 
87  switch (uMsg)
88  {
89  case WM_CREATE:
90  {
91  infoPtr = (PMAP)(((LPCREATESTRUCTW)lParam)->lpCreateParams);
92 
93  SetWindowLongPtrW(hwnd,
95  (LONG_PTR)infoPtr);
96 
97  hFont = SetLrgFont(infoPtr);
98 
99  break;
100  }
101 
102  case WM_SIZE:
103  {
104  cxClient = LOWORD(lParam);
105  cyClient = HIWORD(lParam);
106 
107  rc.left = 0;
108  rc.top = 0;
109  rc.right = cxClient;
110  rc.bottom = cyClient;
111 
112  break;
113  }
114 
115  case WM_PAINT:
116  {
117  PAINTSTRUCT ps;
118  HDC hdc;
119  HFONT hOldFont;
120 
121  hdc = BeginPaint(hwnd,
122  &ps);
123 
124  Rectangle(hdc,
125  0,
126  0,
127  cxClient,
128  cyClient);
129 
130  hOldFont = SelectObject(hdc, hFont);
131 
132  DrawTextW(hdc,
133  &infoPtr->pActiveCell->ch,
134  1,
135  &rc,
137 
138  SelectObject(hdc, hOldFont);
139 
140  EndPaint(hwnd,
141  &ps);
142 
143  UpdateStatusBar(infoPtr->pActiveCell->ch);
144  break;
145  }
146 
147  case WM_DESTROY:
148  {
149  DeleteObject(hFont);
150 
151  break;
152  }
153 
154  default:
155  {
156 HandleDefaultMessage:
157  Ret = DefWindowProcW(hwnd,
158  uMsg,
159  wParam,
160  lParam);
161  break;
162  }
163  }
164 
165  return Ret;
166 }
#define HDC
Definition: msvc.h:22
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
struct _MAP * PMAP
LONG top
Definition: windef.h:297
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define GetWindowLongPtrW
Definition: winuser.h:4698
LONG left
Definition: windef.h:296
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
LONG right
Definition: windef.h:298
int32_t INT
Definition: typedefs.h:56
WPARAM wParam
Definition: combotst.c:138
HFONT hFont
Definition: main.c:53
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: precomp.h:38
PCELL pActiveCell
Definition: precomp.h:46
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define GWLP_USERDATA
Definition: treelist.c:63
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:416
#define DT_VCENTER
Definition: winuser.h:543
#define WM_DESTROY
Definition: winuser.h:1591
#define WM_SIZE
Definition: winuser.h:1593
#define WM_PAINT
Definition: winuser.h:1602
WCHAR ch
Definition: precomp.h:35
#define DT_SINGLELINE
Definition: winuser.h:540
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
VOID UpdateStatusBar(WCHAR wch)
Definition: charmap.c:262
#define WM_CREATE
Definition: winuser.h:1590
#define HIWORD(l)
Definition: typedefs.h:246
static HFONT SetLrgFont(PMAP infoPtr)
Definition: lrgcell.c:14
LONG bottom
Definition: windef.h:299
#define DT_CENTER
Definition: winuser.h:527
#define SetWindowLongPtrW
Definition: winuser.h:5215
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17

◆ RegisterMapClasses()

BOOL RegisterMapClasses ( HINSTANCE  hInstance)

Definition at line 646 of file map.c.

Referenced by wWinMain().

647 {
648  WNDCLASSW wc = {0};
649 
650  wc.style = CS_DBLCLKS;
651  wc.lpfnWndProc = MapWndProc;
652  wc.cbWndExtra = sizeof(PMAP);
653  wc.hInstance = hInstance;
654  wc.hCursor = LoadCursorW(NULL,
655  (LPWSTR)IDC_ARROW);
656  wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
658 
659  if (RegisterClassW(&wc))
660  {
662  wc.cbWndExtra = 0;
664 
665  return RegisterClassW(&wc) != 0;
666  }
667 
668  return FALSE;
669 }
UINT style
Definition: winuser.h:3129
LRESULT CALLBACK MapWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: map.c:546
struct _MAP * PMAP
#define COLOR_WINDOW
Definition: winuser.h:908
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
HINSTANCE hInstance
Definition: charmap.c:20
WNDPROC lpfnWndProc
Definition: winuser.h:3130
smooth NULL
Definition: ftsmooth.c:416
LPCWSTR lpszClassName
Definition: winuser.h:3138
static const WCHAR szLrgCellWndClass[]
Definition: map.c:15
int cbWndExtra
Definition: winuser.h:3132
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define CS_DBLCLKS
Definition: winuser.h:646
HCURSOR hCursor
Definition: winuser.h:3135
HBRUSH hbrBackground
Definition: winuser.h:3136
static const WCHAR szMapWndClass[]
Definition: map.c:14
LRESULT CALLBACK LrgCellWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: lrgcell.c:68
HINSTANCE hInstance
Definition: winuser.h:3133
#define IDC_ARROW
Definition: winuser.h:682
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ SaveSettings()

void SaveSettings ( void  )

Definition at line 113 of file settings.c.

Referenced by ConfigDlgProc(), FrameWndProc(), PanelWndProc(), CMainWindow::ProcessWindowMessage(), ScreenSaverConfigureDialog(), anonymous_namespace{settingsdlg.cpp}::SettingsDlgProc(), and WndProc().

114 {
115  HKEY hKey = NULL;
116 
118  {
119  TCHAR szBuffer[MAX_PATH];
120 
122  ComboBox_GetText(hWnd, szBuffer, MAX_PATH);
123 
124  if(*szBuffer != '\0')
125  RegSetValueEx(hKey, _T("Font"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) MAX_PATH);
126 
128  ComboBox_GetText(hWnd, szBuffer, MAX_PATH);
129 
130  if(*szBuffer != '\0')
131  RegSetValueEx(hKey, _T("CodePage"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) MAX_PATH);
132 
133  RegSetValueEx(hKey, _T("Advanced"), 0, REG_DWORD, (LPBYTE)&Settings.IsAdvancedView, (DWORD) sizeof(DWORD));
134 
135  RegCloseKey(hKey);
136  }
137 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define HKEY_CURRENT_USER
Definition: winreg.h:11
HWND hWnd
Definition: settings.c:17
#define ComboBox_GetText(hwndCtl, lpch, cchMax)
Definition: windowsx.h:33
SSSTARS Settings
Definition: settings.c:33
#define IDC_COMBO_CHARSET
Definition: resource.h:21
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
const TCHAR g_szGeneralRegKey[]
Definition: settings.c:16
smooth NULL
Definition: ftsmooth.c:416
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_FONTCOMBO
Definition: resource.h:12
HWND hCharmapDlg
Definition: charmap.c:22
#define REG_DWORD
Definition: sdbapi.c:539
#define RegSetValueEx
Definition: winreg.h:533
#define RegCreateKeyEx
Definition: winreg.h:501
#define REG_SZ
Definition: layer.c:22

◆ ShowAboutDlg()

VOID ShowAboutDlg ( HWND  hWndParent)

Definition at line 77 of file about.c.

Referenced by PanelWndProc().

78 {
81  hWndParent,
83 }
HINSTANCE hInstance
Definition: charmap.c:20
#define IDD_ABOUTBOX
Definition: resource.h:8
static INT_PTR CALLBACK AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: about.c:15
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4268
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ UnregisterMapClasses()

VOID UnregisterMapClasses ( HINSTANCE  hInstance)

Definition at line 672 of file map.c.

Referenced by wWinMain().

673 {
675  hInstance);
676 
678  hInstance);
679 }
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
static const WCHAR szLrgCellWndClass[]
Definition: map.c:15
static const WCHAR szMapWndClass[]
Definition: map.c:14

◆ UpdateStatusBar()

VOID UpdateStatusBar ( WCHAR  wch)

Definition at line 262 of file charmap.c.

Referenced by DeckClickProc(), LrgCellWndProc(), NewGame(), RowStackClickProc(), RowStackDropProc(), SuitStackAddProc(), and SuitStackDropProc().

263 {
265  WCHAR szDesc[MAX_PATH];
266 
267  GetUName(wch, szDesc);
268  wsprintfW(buff, L"U+%04X: %s", wch, szDesc);
270 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
HWND hStatusWnd
Definition: charmap.c:23
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG_PTR LPARAM
Definition: windef.h:208
#define MAX_PATH
Definition: compat.h:26
static const WCHAR L[]
Definition: oid.c:1087
#define SB_SETTEXT
Definition: commctrl.h:1919
int WINAPI GetUName(IN WORD wCharCode, OUT LPWSTR lpBuf)
Definition: getuname.c:17
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static unsigned char buff[32768]
Definition: fatten.c:17

Variable Documentation

◆ hCharmapDlg

HWND hCharmapDlg

Definition at line 22 of file charmap.c.

Referenced by LoadSettings(), and SaveSettings().

◆ hInstance

HINSTANCE hInstance

Definition at line 20 of file charmap.c.

Referenced by SetWindowExStyle().

◆ Settings

SETTINGS Settings

Definition at line 26 of file charmap.c.