-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsole.h
More file actions
262 lines (209 loc) · 5.71 KB
/
Copy pathconsole.h
File metadata and controls
262 lines (209 loc) · 5.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
/*++
Copyright (c) Microsoft Corporation.
Licensed under the MIT license.
Module Name:
console.h
Abstract:
This module contains the definitions for the console applet
Author:
Jerry Shea (jerrysh) Feb-3-1992
Revision History:
Mike Griese, migrie, Oct 2016:
Moved to cpp and the OpenConsole project
--*/
#pragma once
#include "font.h"
#include "OptionsPage.h"
#include "LayoutPage.h"
#include "ColorsPage.h"
#include "TerminalPage.h"
#include "ColorControl.h"
//
// Icon ID.
//
#define IDI_CONSOLE 1
//
// String table constants
//
#define IDS_NAME 1
#define IDS_INFO 2
#define IDS_TITLE 3
#define IDS_RASTERFONT 4
#define IDS_FONTSIZE 5
#define IDS_SELECTEDFONT 6
#define IDS_SAVE 7
#define IDS_LINKERRCAP 8
#define IDS_LINKERROR 9
#define IDS_FONTSTRING 10
#define IDS_TOOLTIP_LINE_SELECTION 11
#define IDS_TOOLTIP_FILTER_ON_PASTE 12
#define IDS_TOOLTIP_LINE_WRAP 13
#define IDS_TOOLTIP_CTRL_KEYS 14
#define IDS_TOOLTIP_EDIT_KEYS 15
// unused 16
#define IDS_TOOLTIP_OPACITY 17
#define IDS_TOOLTIP_INTERCEPT_COPY_PASTE 18
NTSTATUS
MakeAltRasterFont(
__in UINT CodePage,
__out COORD *AltFontSize,
__out BYTE *AltFontFamily,
__out ULONG *AltFontIndex,
__out_ecount(LF_FACESIZE) LPTSTR AltFaceName);
NTSTATUS InitializeDbcsMisc();
BYTE
CodePageToCharSet(
UINT CodePage
);
BOOL
ShouldAllowAllMonoTTFonts();
LPTTFONTLIST
SearchTTFont(
__in_opt LPCTSTR ptszFace,
BOOL fCodePage,
UINT CodePage
);
BOOL
IsAvailableTTFont(
LPCTSTR ptszFace
);
BOOL
IsAvailableTTFontCP(
LPCWSTR pwszFace,
UINT CodePage
);
BOOL
IsDisableBoldTTFont(
LPCTSTR ptszFace
);
LPTSTR
GetAltFaceName(
LPCTSTR ptszFace
);
NTSTATUS DestroyDbcsMisc();
int
LanguageListCreate(
HWND hDlg,
UINT CodePage
);
int
LanguageDisplay(
HWND hDlg,
UINT CodePage
) ;
//
// registry.c
//
NTSTATUS
MyRegOpenKey(
__in_opt HANDLE hKey,
__in LPCWSTR lpSubKey,
__out PHANDLE phResult
);
NTSTATUS
MyRegEnumValue(
__in HANDLE hKey,
__in DWORD dwIndex,
__in DWORD dwValueLength,
__out_bcount(dwValueLength) LPWSTR lpValueName,
__in_range(4, 1024) DWORD dwDataLength,
__out_bcount(dwDataLength) LPBYTE lpData
);
//
// Function prototypes
//
INT_PTR ConsolePropertySheet(
__in HWND hWnd,
__in PCONSOLE_STATE_INFO pStateInfo);
VOID RegisterClasses(
HINSTANCE hModule);
VOID UnregisterClasses(
HINSTANCE hModule);
INT_PTR APIENTRY FontDlgProc(
HWND hDlg,
UINT wMsg,
WPARAM wParam,
LPARAM lParam);
VOID InitRegistryValues(
__out PCONSOLE_STATE_INFO pStateInfo);
DWORD GetRegistryValues(
__out_opt PCONSOLE_STATE_INFO StateInfo);
VOID SetGlobalRegistryValues();
VOID SetRegistryValues(
PCONSOLE_STATE_INFO StateInfo,
DWORD dwPage);
PCONSOLE_STATE_INFO InitStateValues(
HWND hwnd);
LRESULT FontPreviewWndProc(
HWND hWnd,
UINT wMsg,
WPARAM wParam,
LPARAM lParam);
LRESULT PreviewWndProc(
HWND hWnd,
UINT wMsg,
WPARAM wParam,
LPARAM lParam);
VOID EndDlgPage(
const HWND hDlg,
const BOOL fSaveNow);
BOOL UpdateStateInfo(
HWND hDlg,
UINT Item,
int Value);
BOOL InitializeConsoleState();
void UninitializeConsoleState();
void UpdateApplyButton(const HWND hDlg);
HRESULT FindFontAndUpdateState();
BOOL PopulatePropSheetPageArray(_Out_writes_(cPsps) PROPSHEETPAGE *pPsp, const size_t cPsps, const BOOL fRegisterCallbacks);
void CreateAndAssociateToolTipToControl(const UINT dlgItem, const HWND hDlg, const UINT idsToolTip);
BOOL CheckNum(HWND hDlg, UINT Item);
void UpdateItem(HWND hDlg, UINT item, UINT nNum);
void Undo(HWND hControlWindow);
//
// Macros
//
#define AttrToRGB(Attr) (gpStateInfo->ColorTable[(Attr) & 0x0F])
#define ScreenTextColor(pStateInfo) \
(AttrToRGB(LOBYTE(pStateInfo->ScreenAttributes) & 0x0F))
#define ScreenBkColor(pStateInfo) \
(AttrToRGB(LOBYTE(pStateInfo->ScreenAttributes >> 4)))
#define PopupTextColor(pStateInfo) \
(AttrToRGB(LOBYTE(pStateInfo->PopupAttributes) & 0x0F))
#define PopupBkColor(pStateInfo) \
(AttrToRGB(LOBYTE(pStateInfo->PopupAttributes >> 4)))
#if DBG
#define _DBGFONTS 0x00000001
#define _DBGFONTS2 0x00000002
#define _DBGCHARS 0x00000004
#define _DBGOUTPUT 0x00000008
#define _DBGALL 0xFFFFFFFF
extern ULONG gDebugFlag;
#define DBGFONTS(_params_)
#define DBGFONTS2(_params_)
#define DBGCHARS(_params_)
#define DBGOUTPUT(_params_)
#else
#define DBGFONTS(_params_)
#define DBGFONTS2(_params_)
#define DBGCHARS(_params_)
#define DBGOUTPUT(_params_)
#endif
// Macro definitions that handle codepages
//
#define CP_US (UINT)437
#define CP_JPN (UINT)932
#define CP_WANSUNG (UINT)949
#define CP_TC (UINT)950
#define CP_SC (UINT)936
#define IsBilingualCP(cp) ((cp)==CP_JPN || (cp)==CP_WANSUNG)
#define IsEastAsianCP(cp) ((cp)==CP_JPN || (cp)==CP_WANSUNG || (cp)==CP_TC || (cp)==CP_SC)
const unsigned int TRANSPARENCY_RANGE_MIN = 0x4D;
const unsigned int OPTIONS_PAGE_INDEX = 0;
const unsigned int FONT_PAGE_INDEX = 1;
const unsigned int LAYOUT_PAGE_INDEX = 2;
const unsigned int COLORS_PAGE_INDEX = 3;
const unsigned int TERMINAL_PAGE_INDEX = 4;
// number of property sheet pages
static const int V1_NUMBER_OF_PAGES = 4;
static const int NUMBER_OF_PAGES = 5;