fontプロパティーページ追加
- Unicode/ANSI API切り替え
- VTfont切り替えはすぐに設定に反映する
- ANSI API利用時
- 未実装
@@ -28,6 +28,7 @@ | ||
28 | 28 | #define IDD_TABSHEET_DEBUG 126 |
29 | 29 | #define IDD_SENDFILEDLG 127 |
30 | 30 | #define IDD_TABSHEET_CODING 128 |
31 | +#define IDD_TABSHEET_FONT 129 | |
31 | 32 | #define IDR_TEKMENU 1000 |
32 | 33 | #define IDC_EDIT_COMMENT 1000 |
33 | 34 | #define IDC_EDIT_FULLPATH 1001 |
@@ -257,7 +258,6 @@ | ||
257 | 258 | #define IDC_SENDFILE_SEND_SIZE_LABEL 2603 |
258 | 259 | #define IDC_SENDFILE_DELAYTIME_LABEL 2604 |
259 | 260 | #define IDC_SENDFILE_DELAYTIME_EDIT 2605 |
260 | -#define IDC_DEBUG_USE_UNICODE_API 2606 | |
261 | 261 | #define ID_ACC_SENDBREAK 50001 |
262 | 262 | #define ID_ACC_COPY 50002 |
263 | 263 | #define ID_ACC_NEWCONNECTION 50003 |
@@ -358,7 +358,7 @@ | ||
358 | 358 | #define _APS_NO_MFC 1 |
359 | 359 | #define _APS_NEXT_RESOURCE_VALUE 129 |
360 | 360 | #define _APS_NEXT_COMMAND_VALUE 52031 |
361 | -#define _APS_NEXT_CONTROL_VALUE 2607 | |
361 | +#define _APS_NEXT_CONTROL_VALUE 2606 | |
362 | 362 | #define _APS_NEXT_SYMED_VALUE 101 |
363 | 363 | #endif |
364 | 364 | #endif |
@@ -25,6 +25,10 @@ | ||
25 | 25 | dnddlg.h |
26 | 26 | filesys.cpp |
27 | 27 | filesys.h |
28 | + font_pp.cpp | |
29 | + font_pp.h | |
30 | + font_pp.rc | |
31 | + font_pp_res.h | |
28 | 32 | ftdlg.cpp |
29 | 33 | ftdlg.h |
30 | 34 | keyboard.c |
@@ -57,6 +57,7 @@ | ||
57 | 57 | #include "codeconv.h" |
58 | 58 | #include "layer_for_unicode.h" |
59 | 59 | #include "coding_pp.h" |
60 | +#include "font_pp.h" | |
60 | 61 | |
61 | 62 | const mouse_cursor_t MouseCursor[] = { |
62 | 63 | {"ARROW", IDC_ARROW}, |
@@ -1776,7 +1777,8 @@ | ||
1776 | 1777 | |
1777 | 1778 | // TTCPropertyPage を使用しない PropertyPage |
1778 | 1779 | hPsp[m_PageCountCPP+0] = CodingPageCreate(hInstance, &ts); |
1779 | - m_PageCount = m_PageCountCPP+ 1; | |
1780 | + hPsp[m_PageCountCPP+1] = FontPageCreate(hInstance, &ts); | |
1781 | + m_PageCount = m_PageCountCPP + 2; | |
1780 | 1782 | |
1781 | 1783 | m_psh.nPages = m_PageCount; |
1782 | 1784 | m_psh.phpage = hPsp; |
@@ -147,7 +147,7 @@ | ||
147 | 147 | HINSTANCE m_hInst; |
148 | 148 | |
149 | 149 | int m_PageCount; |
150 | - HPROPSHEETPAGE hPsp[8]; | |
150 | + HPROPSHEETPAGE hPsp[9]; | |
151 | 151 | |
152 | 152 | int m_PageCountCPP; |
153 | 153 | TTCPropertyPage *m_Page[7]; |
@@ -178,6 +178,14 @@ | ||
178 | 178 | switch (lenA) { |
179 | 179 | case 0: |
180 | 180 | default: |
181 | +#if 1 | |
182 | + if (half_width) { | |
183 | + p->ansi_char = '?'; | |
184 | + } | |
185 | + else { | |
186 | + p->ansi_char = (('?' << 8) | '_'); | |
187 | + } | |
188 | +#else | |
181 | 189 | if (ts.UnknownUnicodeCharaAsWide) { |
182 | 190 | p->ansi_char = (('?' << 8) | '?'); |
183 | 191 | } |
@@ -184,6 +192,7 @@ | ||
184 | 192 | else { |
185 | 193 | p->ansi_char = '?'; |
186 | 194 | } |
195 | +#endif | |
187 | 196 | break; |
188 | 197 | case 1: |
189 | 198 | p->ansi_char = (unsigned char)strA[0]; |
@@ -5533,9 +5542,9 @@ | ||
5533 | 5542 | UseUnicodeApi = unicode; |
5534 | 5543 | } |
5535 | 5544 | |
5536 | -void BuffSetDispCodePage(int CodePage) | |
5545 | +void BuffSetDispCodePage(int code_page) | |
5537 | 5546 | { |
5538 | - CodePage = CodePage; | |
5547 | + CodePage = code_page; | |
5539 | 5548 | } |
5540 | 5549 | |
5541 | 5550 | int BuffGetDispCodePage(void) |
@@ -219,6 +219,8 @@ | ||
219 | 219 | break; |
220 | 220 | } |
221 | 221 | case PSN_HELP: |
222 | + MessageBox(hWnd, "Tera Term", "not implimented", | |
223 | + MB_OK | MB_ICONEXCLAMATION); | |
222 | 224 | break; |
223 | 225 | default: |
224 | 226 | break; |
@@ -302,7 +304,7 @@ | ||
302 | 304 | psp.pResource = Param->dlg_templ; |
303 | 305 | #endif |
304 | 306 | psp.pszTitle = L"coding"; // TODO lng ファイルに入れる |
305 | - psp.dwFlags |= (PSP_USETITLE | PSP_HASHELP); | |
307 | + psp.dwFlags |= (PSP_USETITLE /*| PSP_HASHELP */); | |
306 | 308 | |
307 | 309 | psp.pfnDlgProc = Proc; |
308 | 310 | psp.lParam = (LPARAM)Param; |
@@ -84,9 +84,6 @@ | ||
84 | 84 | } |
85 | 85 | } |
86 | 86 | SetDlgItemTextA(IDC_DEBUG_CONSOLE_BUTTON, caption); |
87 | - | |
88 | - // use unicode API | |
89 | - SetCheck(IDC_DEBUG_USE_UNICODE_API, UnicodeDebugParam.UseUnicodeApi); | |
90 | 87 | } |
91 | 88 | |
92 | 89 | BOOL CDebugPropPage::OnCommand(WPARAM wParam, LPARAM) |
@@ -131,6 +128,4 @@ | ||
131 | 128 | UnicodeDebugParam.CodePopupKey1 = key_list[i].key_code; |
132 | 129 | i = GetCurSel(IDC_DEBUG_POPUP_KEY2); |
133 | 130 | UnicodeDebugParam.CodePopupKey2 = key_list[i].key_code; |
134 | - | |
135 | - UnicodeDebugParam.UseUnicodeApi = GetCheck(IDC_DEBUG_USE_UNICODE_API); | |
136 | 131 | } |
@@ -0,0 +1,283 @@ | ||
1 | +/* | |
2 | + * (C) 2020 TeraTerm Project | |
3 | + * All rights reserved. | |
4 | + * | |
5 | + * Redistribution and use in source and binary forms, with or without | |
6 | + * modification, are permitted provided that the following conditions | |
7 | + * are met: | |
8 | + * | |
9 | + * 1. Redistributions of source code must retain the above copyright | |
10 | + * notice, this list of conditions and the following disclaimer. | |
11 | + * 2. Redistributions in binary form must reproduce the above copyright | |
12 | + * notice, this list of conditions and the following disclaimer in the | |
13 | + * documentation and/or other materials provided with the distribution. | |
14 | + * 3. The name of the author may not be used to endorse or promote products | |
15 | + * derived from this software without specific prior written permission. | |
16 | + * | |
17 | + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR | |
18 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
19 | + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
20 | + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
21 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
22 | + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
23 | + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
24 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
26 | + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 | + */ | |
28 | + | |
29 | +/* font property page */ | |
30 | + | |
31 | +#include <stdio.h> | |
32 | +#define _CRTDBG_MAP_ALLOC | |
33 | +#include <stdlib.h> | |
34 | +#include <crtdbg.h> | |
35 | +#include <assert.h> | |
36 | + | |
37 | +#include "tttypes.h" | |
38 | +#include "font_pp_res.h" | |
39 | +#include "dlglib.h" | |
40 | +#include "setting.h" | |
41 | +#include "layer_for_unicode.h" | |
42 | +#include "vtdisp.h" // for DispSetupFontDlg() | |
43 | +#include "buffer.h" | |
44 | +#include "compat_win.h" // for CF_INACTIVEFONTS | |
45 | + | |
46 | +#include "font_pp.h" | |
47 | + | |
48 | +// テンプレートの書き換えを行う | |
49 | +#define REWRITE_TEMPLATE | |
50 | + | |
51 | +struct FontPPData { | |
52 | + HINSTANCE hInst; | |
53 | + const char *UILanguageFile; | |
54 | + TTTSet *pts; | |
55 | + DLGTEMPLATE *dlg_templ; | |
56 | +// LOGFONTA VTFont; | |
57 | + LOGFONTA DlgFont; | |
58 | +}; | |
59 | + | |
60 | +static void GetDlgLogFont(HWND hWnd, const TTTSet *ts, LOGFONTA *logfont) | |
61 | +{ | |
62 | + memset(logfont, 0, sizeof(*logfont)); | |
63 | + logfont->lfHeight = -GetFontPixelFromPoint(hWnd, ts->DialogFontPoint); | |
64 | + strncpy_s(logfont->lfFaceName, sizeof(logfont->lfFaceName),ts->DialogFontName, _TRUNCATE); | |
65 | + logfont->lfCharSet = ts->DialogFontCharSet; | |
66 | +} | |
67 | + | |
68 | +static void SetDlgLogFont(HWND hWnd, const LOGFONTA *logfont, TTTSet *ts) | |
69 | +{ | |
70 | + strncpy_s(ts->DialogFontName, sizeof(ts->DialogFontName), logfont->lfFaceName, _TRUNCATE); | |
71 | + ts->DialogFontPoint = GetFontPointFromPixel(hWnd, -logfont->lfHeight); | |
72 | + ts->DialogFontCharSet = logfont->lfCharSet; | |
73 | +} | |
74 | + | |
75 | +static UINT_PTR CALLBACK TFontHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam) | |
76 | +{ | |
77 | + if (Message == WM_INITDIALOG) { | |
78 | + FontPPData *dlg_data = (FontPPData *)(((CHOOSEFONTA *)lParam)->lCustData); | |
79 | + wchar_t uimsg[MAX_UIMSG]; | |
80 | + get_lang_msgW("DLG_CHOOSEFONT_STC6", uimsg, _countof(uimsg), | |
81 | + L"\"Font style\" selection here won't affect actual font appearance.", dlg_data->UILanguageFile); | |
82 | + _SetDlgItemTextW(Dialog, stc6, uimsg); | |
83 | + | |
84 | + SetFocus(GetDlgItem(Dialog,cmb1)); | |
85 | + | |
86 | + CenterWindow(Dialog, GetParent(Dialog)); | |
87 | + } | |
88 | + return FALSE; | |
89 | +} | |
90 | + | |
91 | +static void SetupDlgFont(HWND hWnd, FontPPData *dlg_data) | |
92 | +{ | |
93 | + const TTTSet *ts = dlg_data->pts; | |
94 | + | |
95 | + // ダイアログ表示 | |
96 | + CHOOSEFONTA cf = {}; | |
97 | + cf.lStructSize = sizeof(cf); | |
98 | + cf.hwndOwner = hWnd; | |
99 | + cf.lpLogFont = &dlg_data->DlgFont; | |
100 | + cf.Flags = | |
101 | + CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT | | |
102 | + CF_SHOWHELP | CF_NOVERTFONTS | | |
103 | + CF_ENABLEHOOK; | |
104 | + if (IsWindows7OrLater() && ts->ListHiddenFonts) { | |
105 | + cf.Flags |= CF_INACTIVEFONTS; | |
106 | + } | |
107 | + cf.lpfnHook = &TFontHook; | |
108 | + cf.nFontType = REGULAR_FONTTYPE; | |
109 | + cf.hInstance = dlg_data->hInst; | |
110 | + cf.lCustData = (LPARAM)dlg_data; | |
111 | + BOOL result = ChooseFontA(&cf); | |
112 | +} | |
113 | + | |
114 | +static void EnableCodePage(HWND hWnd, BOOL enable) | |
115 | +{ | |
116 | + EnableWindow(GetDlgItem(hWnd, IDC_VTFONT_PAGECODE_LABEL), enable); | |
117 | + EnableWindow(GetDlgItem(hWnd, IDC_VTFONT_PAGECODE_EDIT), enable); | |
118 | +} | |
119 | + | |
120 | +static void SetFontString(HWND hWnd, int item, const LOGFONTA *logfont) | |
121 | +{ | |
122 | + // https://docs.microsoft.com/en-us/windows/win32/api/dimm/ns-dimm-logfonta | |
123 | + // http://www.coara.or.jp/~tkuri/D/015.htm#D2002-09-14 | |
124 | + char b[128]; | |
125 | + sprintf_s(b, "%s (%d,%d) %d", logfont->lfFaceName, logfont->lfWidth, logfont->lfHeight, logfont->lfCharSet); | |
126 | + SetDlgItemTextA(hWnd, item, b); | |
127 | +} | |
128 | + | |
129 | +static void SetVTFontString(HWND hWnd, int item, const TTTSet *ts) | |
130 | +{ | |
131 | + LOGFONTA logfont = {}; | |
132 | + logfont.lfWidth = ts->VTFontSize.x; | |
133 | + logfont.lfHeight = ts->VTFontSize.y; | |
134 | + strncpy_s(logfont.lfFaceName, sizeof(logfont.lfFaceName),ts->VTFont, _TRUNCATE); | |
135 | + logfont.lfCharSet = ts->VTFontCharSet; | |
136 | + SetFontString(hWnd, item, &logfont); | |
137 | +} | |
138 | + | |
139 | +static INT_PTR CALLBACK Proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) | |
140 | +{ | |
141 | + static const DlgTextInfo TextInfos[] = { | |
142 | + {0, "DLG_GEN_TITLE"}, | |
143 | + }; | |
144 | + FontPPData *dlg_data = (FontPPData *)GetWindowLongPtr(hWnd, DWLP_USER); | |
145 | + TTTSet *ts = dlg_data == NULL ? NULL : dlg_data->pts; | |
146 | + | |
147 | + switch (msg) { | |
148 | + case WM_INITDIALOG: { | |
149 | + dlg_data = (FontPPData *)(((PROPSHEETPAGEW_V1 *)lp)->lParam); | |
150 | + ts = dlg_data->pts; | |
151 | + SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)dlg_data); | |
152 | + SetDlgTexts(hWnd, TextInfos, _countof(TextInfos), dlg_data->pts->UILanguageFile); | |
153 | + | |
154 | + GetDlgLogFont(GetParent(hWnd), ts, &dlg_data->DlgFont); | |
155 | + | |
156 | + SetVTFontString(hWnd, IDC_VTFONT_EDIT, ts); | |
157 | + | |
158 | + CheckDlgButton(hWnd, | |
159 | + UnicodeDebugParam.UseUnicodeApi ? IDC_VTFONT_UNICODE : IDC_VTFONT_ANSI, | |
160 | + BST_CHECKED); | |
161 | + SetDlgItemInt(hWnd, IDC_VTFONT_PAGECODE_EDIT, UnicodeDebugParam.CodePageForANSIDraw, FALSE); | |
162 | + EnableCodePage(hWnd, UnicodeDebugParam.UseUnicodeApi ? FALSE : TRUE); | |
163 | + | |
164 | + CheckDlgButton(hWnd, IDC_LIST_HIDDEN_FONTS, ts->ListHiddenFonts); | |
165 | + EnableWindow(GetDlgItem(hWnd, IDC_LIST_HIDDEN_FONTS), IsWindows7OrLater() ? TRUE : FALSE); | |
166 | + | |
167 | + SetDlgItemInt(hWnd, IDC_SPACE_RIGHT, ts->FontDW, FALSE); | |
168 | + SetDlgItemInt(hWnd, IDC_SPACE_LEFT, ts->FontDH, FALSE); | |
169 | + SetDlgItemInt(hWnd, IDC_SPACE_TOP, ts->FontDX, FALSE); | |
170 | + SetDlgItemInt(hWnd, IDC_SPACE_BOTTOM, ts->FontDY, FALSE); | |
171 | + | |
172 | + const static I18nTextInfo visual_font_quality[] = { | |
173 | + { "DLG_TAB_VISUAL_FONT_QUALITY_DEFAULT", L"Default" }, | |
174 | + { "DLG_TAB_VISUAL_FONT_QUALITY_NONANTIALIASED", L"Non-Antialiased" }, | |
175 | + { "DLG_TAB_VISUAL_FONT_QUALITY_ANTIALIASED", L"Antialiased" }, | |
176 | + { "DLG_TAB_VISUAL_FONT_QUALITY_CLEARTYPE", L"ClearType" }, | |
177 | + }; | |
178 | + SetI18nList("Tera Term", hWnd, IDC_FONT_QUALITY, visual_font_quality, _countof(visual_font_quality), | |
179 | + ts->UILanguageFile, 0); | |
180 | + int cur = | |
181 | + ts->FontQuality == DEFAULT_QUALITY ? 0 : | |
182 | + ts->FontQuality == NONANTIALIASED_QUALITY ? 1 : | |
183 | + ts->FontQuality == ANTIALIASED_QUALITY ? 2 : | |
184 | + /*ts->FontQuality == CLEARTYPE_QUALITY ? */ 3; | |
185 | + SendDlgItemMessage(hWnd, IDC_FONT_QUALITY, CB_SETCURSEL, cur, 0); | |
186 | + | |
187 | + SetFontString(hWnd, IDC_DLGFONT_EDIT, &dlg_data->DlgFont); | |
188 | + } | |
189 | + case WM_NOTIFY: { | |
190 | + NMHDR *nmhdr = (NMHDR *)lp; | |
191 | + switch (nmhdr->code) { | |
192 | + case PSN_APPLY: { | |
193 | + UnicodeDebugParam.UseUnicodeApi = | |
194 | + IsDlgButtonChecked(hWnd, IDC_VTFONT_UNICODE) == BST_CHECKED; | |
195 | + UnicodeDebugParam.CodePageForANSIDraw = | |
196 | + GetDlgItemInt(hWnd, IDC_VTFONT_PAGECODE_EDIT, NULL, FALSE); | |
197 | + // ANSI表示用のコードページを設定する | |
198 | + BuffSetDispCodePage(UnicodeDebugParam.CodePageForANSIDraw); | |
199 | + ts->ListHiddenFonts = IsDlgButtonChecked(hWnd, IDC_LIST_HIDDEN_FONTS) == BST_CHECKED; | |
200 | + | |
201 | + SetDlgLogFont(GetParent(hWnd), &dlg_data->DlgFont, ts); | |
202 | + | |
203 | + break; | |
204 | + } | |
205 | + case PSN_HELP: | |
206 | + MessageBox(hWnd, "Tera Term", "not implimented", | |
207 | + MB_OK | MB_ICONEXCLAMATION); | |
208 | + break; | |
209 | + default: | |
210 | + break; | |
211 | + } | |
212 | + break; | |
213 | + } | |
214 | + case WM_COMMAND: { | |
215 | + switch (wp) { | |
216 | + case IDC_VTFONT_ANSI | (BN_CLICKED << 16): | |
217 | + case IDC_VTFONT_UNICODE | (BN_CLICKED << 16): { | |
218 | + BOOL enable = (wp & 0xffff) == IDC_VTFONT_ANSI ? TRUE : FALSE; | |
219 | + EnableCodePage(hWnd, enable); | |
220 | + break; | |
221 | + } | |
222 | + case IDC_VTFONT_CHOOSE | (BN_CLICKED << 16): { | |
223 | + DispSetupFontDlg(); | |
224 | + SetDlgItemInt(hWnd, IDC_VTFONT_PAGECODE_EDIT, UnicodeDebugParam.CodePageForANSIDraw, FALSE); | |
225 | + SetVTFontString(hWnd, IDC_VTFONT_EDIT, ts); | |
226 | + break; | |
227 | + } | |
228 | + case IDC_DLGFONT_CHOOSE | (BN_CLICKED << 16): | |
229 | + SetupDlgFont(hWnd, dlg_data); | |
230 | + SetFontString(hWnd, IDC_DLGFONT_EDIT, &dlg_data->DlgFont); | |
231 | + break; | |
232 | + | |
233 | + case IDC_DLGFONT_DEFAULT | (BN_CLICKED << 16): { | |
234 | + GetMessageboxFont(&dlg_data->DlgFont); | |
235 | + SetFontString(hWnd, IDC_DLGFONT_EDIT, &dlg_data->DlgFont); | |
236 | + } | |
237 | + | |
238 | + default: | |
239 | + break; | |
240 | + } | |
241 | + break; | |
242 | + } | |
243 | + case WM_DESTROY: { | |
244 | + free(dlg_data->dlg_templ); | |
245 | + free(dlg_data); | |
246 | + SetWindowLongPtr(hWnd, DWLP_USER, NULL); | |
247 | + break; | |
248 | + } | |
249 | + default: | |
250 | + return FALSE; | |
251 | + } | |
252 | + return FALSE; | |
253 | +} | |
254 | + | |
255 | +HPROPSHEETPAGE FontPageCreate(HINSTANCE inst, TTTSet *pts) | |
256 | +{ | |
257 | + // 注 common/tt_res.h と font_pp_res.h で値を一致させること | |
258 | + const int id = IDD_TABSHEET_FONT; | |
259 | + | |
260 | + FontPPData *Param = (FontPPData *)calloc(sizeof(FontPPData), 1); | |
261 | + Param->hInst = inst; | |
262 | + Param->UILanguageFile = pts->UILanguageFile; | |
263 | + Param->pts = pts; | |
264 | + | |
265 | + PROPSHEETPAGEW_V1 psp = {}; | |
266 | + psp.dwSize = sizeof(psp); | |
267 | + psp.dwFlags = PSP_DEFAULT; | |
268 | + psp.hInstance = inst; | |
269 | + psp.pszTemplate = MAKEINTRESOURCEW(id); | |
270 | +#if defined(REWRITE_TEMPLATE) | |
271 | + psp.dwFlags |= PSP_DLGINDIRECT; | |
272 | + Param->dlg_templ = TTGetDlgTemplate(inst, MAKEINTRESOURCEA(id)); | |
273 | + psp.pResource = Param->dlg_templ; | |
274 | +#endif | |
275 | + psp.pszTitle = L"font"; | |
276 | + psp.dwFlags |= (PSP_USETITLE /*| PSP_HASHELP */); | |
277 | + | |
278 | + psp.pfnDlgProc = Proc; | |
279 | + psp.lParam = (LPARAM)Param; | |
280 | + | |
281 | + HPROPSHEETPAGE hpsp = _CreatePropertySheetPageW(&psp); | |
282 | + return hpsp; | |
283 | +} |
@@ -0,0 +1,41 @@ | ||
1 | +/* | |
2 | + * (C) 2020 TeraTerm Project | |
3 | + * All rights reserved. | |
4 | + * | |
5 | + * Redistribution and use in source and binary forms, with or without | |
6 | + * modification, are permitted provided that the following conditions | |
7 | + * are met: | |
8 | + * | |
9 | + * 1. Redistributions of source code must retain the above copyright | |
10 | + * notice, this list of conditions and the following disclaimer. | |
11 | + * 2. Redistributions in binary form must reproduce the above copyright | |
12 | + * notice, this list of conditions and the following disclaimer in the | |
13 | + * documentation and/or other materials provided with the distribution. | |
14 | + * 3. The name of the author may not be used to endorse or promote products | |
15 | + * derived from this software without specific prior written permission. | |
16 | + * | |
17 | + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR | |
18 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
19 | + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
20 | + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
21 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
22 | + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
23 | + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
24 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
26 | + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 | + */ | |
28 | + | |
29 | +#include <windows.h> | |
30 | + | |
31 | +#ifdef __cplusplus | |
32 | +extern "C" { | |
33 | +#endif | |
34 | + | |
35 | +HPROPSHEETPAGE FontPageCreate(HINSTANCE inst, TTTSet *pts); | |
36 | + | |
37 | +#ifdef __cplusplus | |
38 | +} | |
39 | +#endif | |
40 | + | |
41 | + |
@@ -0,0 +1,37 @@ | ||
1 | +//{{NO_DEPENDENCIES}} | |
2 | +// Microsoft Visual C++ で生成されたインクルード ファイル。 | |
3 | +// font_pp.rc で使用 | |
4 | +// | |
5 | +#define IDD_TABSHEET_FONT 129 | |
6 | +#define IDC_SPACE_TOP 1001 | |
7 | +#define IDC_SPACE_BOTTOM 1002 | |
8 | +#define IDC_SPACE_LEFT 1003 | |
9 | +#define IDC_SPACE_RIGHT 1004 | |
10 | +#define IDC_VTFONT_PAGECODE_LABEL 1005 | |
11 | +#define IDC_VTFONT_EDIT 2607 | |
12 | +#define IDC_BUTTON1 2608 | |
13 | +#define IDC_VTFONT_CHOOSE 2608 | |
14 | +#define IDC_VTFONT_ANSI 2609 | |
15 | +#define IDC_VTFONT_UNICODE 2610 | |
16 | +#define IDC_VTFONT_PAGECODE_EDIT 2611 | |
17 | +#define IDC_LIST_HIDDEN_FONTS 2612 | |
18 | +#define IDC_FONT_QUALITY 2613 | |
19 | +#define IDC_CHECK2 2614 | |
20 | +#define IDC_LIST_PRO_FONTS 2614 | |
21 | +#define IDC_EDIT3 2615 | |
22 | +#define IDC_DLGFONT_EDIT 2615 | |
23 | +#define IDC_BUTTON2 2616 | |
24 | +#define IDC_DLGFONT_CHOOSE 2616 | |
25 | +#define IDC_BUTTON3 2617 | |
26 | +#define IDC_DLGFONT_DEFAULT 2617 | |
27 | + | |
28 | +// Next default values for new objects | |
29 | +// | |
30 | +#ifdef APSTUDIO_INVOKED | |
31 | +#ifndef APSTUDIO_READONLY_SYMBOLS | |
32 | +#define _APS_NEXT_RESOURCE_VALUE 102 | |
33 | +#define _APS_NEXT_COMMAND_VALUE 40001 | |
34 | +#define _APS_NEXT_CONTROL_VALUE 1006 | |
35 | +#define _APS_NEXT_SYMED_VALUE 101 | |
36 | +#endif | |
37 | +#endif |
@@ -29,27 +29,20 @@ | ||
29 | 29 | #pragma once |
30 | 30 | |
31 | 31 | #ifdef __cplusplus |
32 | +extern "C" { | |
33 | +#endif | |
32 | 34 | |
33 | -class CUnicodeDebugParam | |
35 | +typedef struct | |
34 | 36 | { |
35 | -public: | |
36 | 37 | BOOL CodePopupEnable; |
37 | 38 | WORD CodePopupKey1; |
38 | 39 | WORD CodePopupKey2; |
39 | 40 | BOOL UseUnicodeApi; |
40 | - CUnicodeDebugParam() | |
41 | - { | |
42 | -#if _DEBUG | |
43 | - CodePopupEnable = TRUE; | |
44 | -#else | |
45 | - CodePopupEnable = FALSE; | |
46 | -#endif | |
47 | - CodePopupKey1 = VK_CONTROL; | |
48 | - CodePopupKey2 = VK_CONTROL; | |
49 | - UseUnicodeApi = FALSE; | |
50 | - } | |
51 | -}; | |
41 | + int CodePageForANSIDraw; | |
42 | +} UnicodeDebugParam_t; | |
52 | 43 | |
53 | -extern CUnicodeDebugParam UnicodeDebugParam; | |
44 | +extern UnicodeDebugParam_t UnicodeDebugParam; | |
54 | 45 | |
46 | +#ifdef __cplusplus | |
47 | +} | |
55 | 48 | #endif |
@@ -44,6 +44,7 @@ | ||
44 | 44 | #include <olectl.h> |
45 | 45 | |
46 | 46 | #include "unicode_test.h" |
47 | +#include "setting.h" | |
47 | 48 | |
48 | 49 | #define CurWidth 2 |
49 | 50 |
@@ -3498,7 +3499,7 @@ | ||
3498 | 3499 | ts.VTFontSize.y = VTlf.lfHeight; |
3499 | 3500 | ts.VTFontCharSet = VTlf.lfCharSet; |
3500 | 3501 | |
3501 | - ts.CodePage = GetCodePageFromFontCharSet(VTlf.lfCharSet); | |
3502 | + UnicodeDebugParam.CodePageForANSIDraw = GetCodePageFromFontCharSet(VTlf.lfCharSet); | |
3502 | 3503 | |
3503 | 3504 | ChangeFont(); |
3504 | 3505 |
@@ -126,9 +126,7 @@ | ||
126 | 126 | #define WM_IME_COMPOSITION 0x010F |
127 | 127 | #endif |
128 | 128 | |
129 | -#if UNICODE_INTERNAL_BUFF | |
130 | -CUnicodeDebugParam UnicodeDebugParam; | |
131 | -#endif | |
129 | +UnicodeDebugParam_t UnicodeDebugParam; | |
132 | 130 | |
133 | 131 | ///////////////////////////////////////////////////////////////////////////// |
134 | 132 | // CVTWindow |
@@ -645,10 +643,23 @@ | ||
645 | 643 | TipWinCodeDebug = NULL; |
646 | 644 | #endif |
647 | 645 | |
646 | + // UnicodeDebugParam | |
647 | + { | |
648 | +#if _DEBUG | |
649 | + UnicodeDebugParam.CodePopupEnable = TRUE; | |
650 | +#else | |
651 | + UnicodeDebugParam.CodePopupEnable = FALSE; | |
652 | +#endif | |
653 | + UnicodeDebugParam.CodePopupKey1 = VK_CONTROL; | |
654 | + UnicodeDebugParam.CodePopupKey2 = VK_CONTROL; | |
655 | + UnicodeDebugParam.UseUnicodeApi = FALSE; | |
656 | + UnicodeDebugParam.CodePageForANSIDraw = 932; | |
657 | + } | |
658 | + | |
648 | 659 | /* Initialize scroll buffer */ |
649 | 660 | UnicodeDebugParam.UseUnicodeApi = IsWindowsNTKernel() ? TRUE : FALSE; |
650 | 661 | InitBuffer(UnicodeDebugParam.UseUnicodeApi); |
651 | - BuffSetDispCodePage(932); | |
662 | + BuffSetDispCodePage(UnicodeDebugParam.CodePageForANSIDraw); | |
652 | 663 | |
653 | 664 | InitDisp(); |
654 | 665 |
@@ -4635,7 +4646,8 @@ | ||
4635 | 4646 | { |
4636 | 4647 | HelpId = HlpSetupFont; |
4637 | 4648 | DispSetupFontDlg(); |
4638 | - BuffSetDispCodePage(ts.CodePage); // ANSI表示用のコードページを設定する | |
4649 | + // ANSI表示用のコードページを設定する | |
4650 | + BuffSetDispCodePage(UnicodeDebugParam.CodePageForANSIDraw); | |
4639 | 4651 | } |
4640 | 4652 | |
4641 | 4653 | static BOOL CALLBACK TFontHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam) |