• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision7386 (tree)
Time2019-01-10 23:20:14
Authorzmatsuo

Log Message

ダイアログフォント調整

Change Summary

Incremental Difference

--- branches/cmake/TTProxy/ProxyWSockHook.h (revision 7385)
+++ branches/cmake/TTProxy/ProxyWSockHook.h (revision 7386)
@@ -34,7 +34,7 @@
3434
3535 void UTIL_set_dialog_font()
3636 {
37- SetDialogFont("TTProxy", UILanguageFile);
37+ SetDialogFont(NULL, UILanguageFile, "TTProxy");
3838 }
3939
4040 #if 0
--- branches/cmake/TTXSamples/TTXRecurringCommand/TTXRecurringCommand.c (revision 7385)
+++ branches/cmake/TTXSamples/TTXRecurringCommand/TTXRecurringCommand.c (revision 7386)
@@ -605,7 +605,7 @@
605605 static int PASCAL TTXProcessCommand(HWND hWin, WORD cmd) {
606606 switch (cmd) {
607607 case ID_MENU_SETUP:
608- SetDialogFont("TTXRecurringCommand", pvar->ts->UILanguageFile);
608+ SetDialogFont(pvar->ts->SetupFName, pvar->ts->UILanguageFile, "TTXRecurringCommand");
609609 switch (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SETUP_RECURRINGCOMMAND),
610610 hWin, RecurringCommandSetting, (LPARAM)NULL)) {
611611 case IDOK:
--- branches/cmake/teraterm/common/dlglib.c (revision 7385)
+++ branches/cmake/teraterm/common/dlglib.c (revision 7386)
@@ -1,4 +1,4 @@
1-/* -*- coding: utf-8-with-signature -*- // TODO 文字コード
1+/*
22 * Copyright (C) 1994-1998 T. Teranishi
33 * (C) 2008-2018 TeraTerm Project
44 * All rights reserved.
@@ -125,8 +125,8 @@
125125
126126 void SetDlgPercent(HWND HDlg, int id_Item, int id_Progress, LONG a, LONG b, int *p)
127127 {
128- // 20MB以上のファイルをアップロードしようとすると、buffer overflowで
129- // 落ちる問題への対処。(2005.3.18 yutaka)
128+ // 20MB?ȏ?̃t?@?C?????A?b?v???[?h???悤?Ƃ???ƁAbuffer overflow??
129+ // ????????ւ̑Ώ??B(2005.3.18 yutaka)
130130 // cf. http://sourceforge.jp/tracker/index.php?func=detail&aid=5713&group_id=1412&atid=5333
131131 double Num;
132132 TCHAR NumStr[10];
@@ -228,11 +228,11 @@
228228 BOOL ComboBox;
229229 } EditSubclassData;
230230
231-// C-n/C-p のためにサブクラス化 (2007.9.4 maya)
232-// C-p/C-n/C-b/C-f/C-a/C-e をサポート (2007.9.5 maya)
233-// C-d/C-k をサポート (2007.10.3 yutaka)
234-// ドロップダウンの中のエディットコントロールを
235-// サブクラス化するためのウインドウプロシージャ
231+// C-n/C-p ?̂??߂ɃT?u?N???X?? (2007.9.4 maya)
232+// C-p/C-n/C-b/C-f/C-a/C-e ???T?|?[?g (2007.9.5 maya)
233+// C-d/C-k ???T?|?[?g (2007.10.3 yutaka)
234+// ?h???b?v?_?E???̒??̃G?f?B?b?g?R???g???[????
235+// ?T?u?N???X?????邽?߂̃E?C???h?E?v???V?[?W??
236236 static LRESULT CALLBACK HostnameEditProc(HWND dlg, UINT msg,
237237 WPARAM wParam, LPARAM lParam)
238238 {
@@ -244,7 +244,7 @@
244244 char *str, *orgstr;
245245
246246 switch (msg) {
247- // キーが押されたのを検知する
247+ // ?L?[???????ꂽ?̂????m????
248248 case WM_KEYDOWN:
249249 if (GetKeyState(VK_CONTROL) < 0) {
250250 switch (wParam) {
@@ -296,17 +296,17 @@
296296 if (str != NULL) {
297297 len = GetWindowTextA(dlg, str, (int)max);
298298 if (select >= 0 && select < len) {
299- if (wParam == 0x44) { // カーソル配下の文字のみを削除する
299+ if (wParam == 0x44) { // ?J?[?\???z???̕????݂̂??폜????
300300 memmove(&str[select], &str[select + 1], len - select - 1);
301301 str[len - 1] = '\0';
302302
303- } else if (wParam == 0x4b) { // カーソルから行末まで削除する
303+ } else if (wParam == 0x4b) { // ?J?[?\??????s???܂ō폜????
304304 str[select] = '\0';
305305
306306 }
307307 }
308308
309- if (wParam == 0x55) { // カーソルより左側をすべて消す
309+ if (wParam == 0x55) { // ?J?[?\????荶???????ׂď???
310310 if (select >= len) {
311311 str[0] = '\0';
312312 } else {
@@ -325,7 +325,7 @@
325325 }
326326 break;
327327
328- // 上のキーを押した結果送られる文字で音が鳴るので捨てる
328+ // ??̃L?[???????????ʑ????镶???ʼn????‚?̂Ŏ̂Ă?
329329 case WM_CHAR:
330330 switch (wParam) {
331331 case 0x01:
@@ -361,7 +361,7 @@
361361 return Result;
362362 }
363363
364-// C-n/C-p のためにサブクラス化
364+// C-n/C-p ?̂??߂ɃT?u?N???X??
365365 void SetEditboxSubclass(HWND hDlg, int nID, BOOL ComboBox)
366366 {
367367 EditSubclassData *data;
@@ -379,18 +379,24 @@
379379
380380 typedef struct {
381381 BOOL found;
382- const TCHAR *face;
382+ const wchar_t *face;
383383 BYTE charset;
384-} IsExistFontInfo;
384+} IsExistFontInfoW;
385385
386-int CALLBACK IsExistFontSub(
387- ENUMLOGFONT* lpelf, NEWTEXTMETRIC* lpntm,
386+typedef struct {
387+ BOOL found;
388+ const char *face;
389+ BYTE charset;
390+} IsExistFontInfoA;
391+
392+int CALLBACK IsExistFontSubW(
393+ ENUMLOGFONTW* lpelf, NEWTEXTMETRICW* lpntm,
388394 int nFontType, LPARAM lParam)
389395 {
390- IsExistFontInfo *info = (IsExistFontInfo *)lParam;
396+ IsExistFontInfoW *info = (IsExistFontInfoW *)lParam;
391397 (void)lpntm;
392398 if (nFontType != DEVICE_FONTTYPE &&
393- _tcsicmp(lpelf->elfLogFont.lfFaceName, info->face) == 0 &&
399+ _wcsicmp(lpelf->elfLogFont.lfFaceName, info->face) == 0 &&
394400 lpelf->elfLogFont.lfCharSet == info->charset)
395401 {
396402 info->found = TRUE;
@@ -399,127 +405,81 @@
399405 return 1;
400406 }
401407
408+int CALLBACK IsExistFontSubA(
409+ ENUMLOGFONTA* lpelf, NEWTEXTMETRICA* lpntm,
410+ int nFontType, LPARAM lParam)
411+{
412+ IsExistFontInfoA *info = (IsExistFontInfoA *)lParam;
413+ (void)lpntm;
414+ if (nFontType != DEVICE_FONTTYPE &&
415+ _stricmp(lpelf->elfLogFont.lfFaceName, info->face) == 0 &&
416+ lpelf->elfLogFont.lfCharSet == info->charset)
417+ {
418+ info->found = TRUE;
419+ return 0;
420+ }
421+ return 1;
422+}
423+
402424 /**
403- * フォントがインストールされているか調べる
425+ * ?t?H???g???C???X?g?[??????Ă??邩???ׂ?
404426 */
405-BOOL IsExistFont(const TCHAR *face, BYTE charset, BOOL strict)
427+BOOL IsExistFont(const wchar_t *face, BYTE charset, BOOL strict)
406428 {
407429 HDC hDC = GetDC(NULL);
408- LOGFONT lf;
409- IsExistFontInfo info;
410- (void)face;
411- (void)charset;
430+ LOGFONTW lf;
431+ IsExistFontInfoW info;
412432 memset(&lf, 0, sizeof(lf));
413433 lf.lfCharSet = strict ? DEFAULT_CHARSET : charset;
414- // ↑DEFAULT_CHARSETとするとフォントリンクも有効になるようだ
434+ // ??DEFAULT_CHARSET?Ƃ???ƃt?H???g?????N???L???ɂȂ?悤??
415435 lf.lfPitchAndFamily = 0;
416436 info.found = FALSE;
417437 info.face = face;
418438 info.charset = charset;
419- EnumFontFamiliesEx(hDC, &lf, (FONTENUMPROC)IsExistFontSub, (LPARAM)&info, 0);
439+ EnumFontFamiliesExW(hDC, &lf, (FONTENUMPROCW)IsExistFontSubW, (LPARAM)&info, 0);
420440 ReleaseDC(NULL, hDC);
421441 return info.found;
422442 }
423443
424-/**
425- * 使用するCharSetを取得する
426- */
427-#if 0
428-DWORD GetCharSet()
444+BOOL IsExistFontA(const char *face, BYTE charset, BOOL strict)
429445 {
430- DWORD codepage;
431- CHARSETINFO charset_info;
432- BOOL result;
433-
434-#if 0
435- TCHAR codepage_str[16];
436- int ri = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE,
437- (LPSTR)&codepage_str, _countof(codepage_str));
438- if (ri == 0) {
439- return 0;
440- }
441- codepage = _ttoi(codepage_str);
442-#else
443- codepage = GetACP();
444-#endif
445-
446- result = TranslateCharsetInfo((DWORD *)codepage, &charset_info, TCI_SRCCODEPAGE);
447- assert(result == TRUE);
448- if (result == FALSE) {
449- return SHIFTJIS_CHARSET;
450- }
451-
452- return charset_info.ciCharset;
446+ HDC hDC = GetDC(NULL);
447+ LOGFONTA lf;
448+ IsExistFontInfoA info;
449+ memset(&lf, 0, sizeof(lf));
450+ lf.lfCharSet = strict ? DEFAULT_CHARSET : charset;
451+ // ??DEFAULT_CHARSET?Ƃ???ƃt?H???g?????N???L???ɂȂ?悤??
452+ lf.lfPitchAndFamily = 0;
453+ info.found = FALSE;
454+ info.face = face;
455+ info.charset = charset;
456+ EnumFontFamiliesExA(hDC, &lf, (FONTENUMPROCA)IsExistFontSubA, (LPARAM)&info, 0);
457+ ReleaseDC(NULL, hDC);
458+ return info.found;
453459 }
454-#endif
455460
456461 /**
457- * 使用するダイアログフォントの候補
462+ * ?g?p????_?C?A???O?t?H???g?????肷??
458463 */
459-#if 0
460-typedef struct {
461- const TCHAR *face;
462- LONG height;
463-} DialogFontLists;
464-
465-const DialogFontLists *GetDialogFontCandidate(BYTE char_set)
464+void SetDialogFont(const char *SetupFName,
465+ const char *UILanguageFile, const char *Section)
466466 {
467- switch (char_set) {
468- case SHIFTJIS_CHARSET: {
469- static const DialogFontLists list[] = {
470- { _T("Yu Gothic UI"), -9 },
471- { _T("Meiryo UI"), -9 }, // Vista以降
472- { _T("MS UI Gothic"), -9 }, // 98以降
473- { _T("MS ゴシック"), -9 }, // Windows 3.1以降
474- 0
475- };
476- return list;
467+ // teraterm.ini?̎w??
468+ if (SetupFName != NULL) {
469+ LOGFONTA logfont;
470+ BOOL result;
471+ result = GetI18nLogfont("Tera Term", "DlgFont", &logfont, 0, SetupFName);
472+ if (result == TRUE) {
473+ result = IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, FALSE);
474+ if (result == TRUE) {
475+ TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet);
476+ return;
477+ }
478+ }
477479 }
478- case HANGUL_CHARSET: {
479- // Korean
480- static const DialogFontLists list[] = {
481- { _T("돋움"), -9 },
482- { _T("굴림"), -10 },
483- 0
484- };
485- return list;
486- }
487- case GB2312_CHARSET: {
488- // Simplified Chinese
489- static const DialogFontLists list[] = {
490- { _T("微软雅黑") , -8 },
491- { _T("微软雅黑") , -10 },
492- 0
493- };
494- return list;
495- }
496- case CHINESEBIG5_CHARSET: {
497- // Traditional Chinese
498- static const DialogFontLists list[] = {
499- { _T("細明體") , -8 },
500- { _T("新細明體") , -10 },
501- 0
502- };
503- return list;
504- }
505- default: {
506- static const DialogFontLists list[] = {
507- { _T("Tahoma"), -8 },
508- 0
509- };
510- return list;
511- }
512- }
513-}
514-#endif
515480
516-/**
517- * 使用するダイアログフォントを決定する
518- */
519-void SetDialogFont(const char *section, const char *UILanguageFile)
520-{
521- // 明示的に指定されている場合はそれに従う
522- {
481+ // .lng?̎w??
482+ if (UILanguageFile != NULL) {
523483 static const char *dlg_font_keys[] = {
524484 "DLG_FONT",
525485 "DLG_TAHOMA_FONT",
@@ -527,44 +487,45 @@
527487 };
528488 BOOL result = FALSE;
529489 LOGFONTA logfont;
530- int i;
531- if (section != NULL) {
490+ size_t i;
491+ if (Section != NULL) {
532492 for (i = 0; i < _countof(dlg_font_keys); i++) {
533- result = GetI18nLogfont(section, dlg_font_keys[i], &logfont, 72, UILanguageFile);
534- if (result == TRUE) {
493+ result = GetI18nLogfont(Section, dlg_font_keys[i], &logfont, 0, UILanguageFile);
494+ if (result == FALSE) {
495+ continue;
496+ }
497+ if (logfont.lfFaceName[0] == '\0') {
535498 break;
536499 }
500+ if (IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, FALSE)) {
501+ break;
502+ }
537503 }
538504 }
539505 if (result == FALSE) {
540506 for (i = 0; i < _countof(dlg_font_keys); i++) {
541- result = GetI18nLogfont("Tera Term", dlg_font_keys[i], &logfont, 72, UILanguageFile);
542- if (result == TRUE) {
507+ result = GetI18nLogfont("Tera Term", dlg_font_keys[i], &logfont, 0, UILanguageFile);
508+ if (result == FALSE) {
509+ continue;
510+ }
511+ if (logfont.lfFaceName[0] == '\0') {
543512 break;
544513 }
514+ if (IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, FALSE)) {
515+ break;
516+ }
545517 }
546518 }
547519 if (result == TRUE) {
548-#if defined(UNICODE)
549- wchar_t face[LF_FACESIZE];
550- MultiByteToWideChar(CP_ACP, 0, logfont.lfFaceName, -1, face, LF_FACESIZE);
551- if (IsExistFont(face, logfont.lfCharSet, FALSE)) {
552- TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet);
553- return;
554- }
555-#else
556- if (IsExistFont(logfont.lfFaceName, logfont.lfCharSet, FALSE)) {
557- TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet);
558- return;
559- }
560-#endif
561- // フォントが見つからなかったとき、
562- // 文字化けで正しく表示されない事態となる
563- // messagebox()のフォントをとりあえず選択しておく
520+ TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet);
521+ return;
564522 }
523+ // ?t?H???g?????‚???Ȃ??????Ƃ??A
524+ // ?????????Ő??????\??????Ȃ????ԂƂȂ?
525+ // messagebox()?̃t?H???g???Ƃ肠?????I?????Ă???
565526 }
566527
567- // messageboxのフォントを選択
528+ // messagebox?̃t?H???g??I??
568529 {
569530 NONCLIENTMETRICS nci;
570531 int st_size = CCSIZEOF_STRUCT(NONCLIENTMETRICS, lfMessageFont);
@@ -577,6 +538,6 @@
577538 assert(r == TRUE);
578539 logfont = &nci.lfStatusFont;
579540
580- TTSetDlgFont(logfont->lfFaceName, /*logfont->lfHeight*/ -9, logfont->lfCharSet);
541+ TTSetDlgFont(logfont->lfFaceName, logfont->lfHeight, logfont->lfCharSet);
581542 }
582543 }
--- branches/cmake/teraterm/common/dlglib.h (revision 7385)
+++ branches/cmake/teraterm/common/dlglib.h (revision 7386)
@@ -88,7 +88,7 @@
8888 LPCTSTR lpTemplateName,
8989 HWND hWndParent,
9090 DLGPROC lpDialogFunc);
91-void SetDialogFont(const char *section, const char *UILanguageFile);
91+void SetDialogFont(const char *SetupFName, const char *UILanguageFile, const char *Section);
9292
9393 #if defined(_UNICODE)
9494 #define TTSetDlgFont(p1,p2,p3) TTSetDlgFontW(p1,p2,p3)
--- branches/cmake/teraterm/common/dlglib_tmpl.cpp (revision 7385)
+++ branches/cmake/teraterm/common/dlglib_tmpl.cpp (revision 7386)
@@ -163,7 +163,7 @@
163163 }
164164 src += extraCount;
165165 }
166-
166+
167167 size = (size + 1) & ~1;
168168 return size;
169169 }
@@ -205,7 +205,7 @@
205205 // 取得
206206 if (logfont != NULL) {
207207 memset(logfont, 0, sizeof(*logfont));
208- logfont->lfHeight = -(*src++);
208+ logfont->lfHeight = *src++;
209209 t = CopySz(src, (WORD *)(&logfont->lfFaceName[0]));
210210 } else {
211211 src++;
@@ -215,7 +215,7 @@
215215 } else {
216216 // セット
217217 if (logfont != NULL) {
218- *dest++ = (WORD)(-logfont->lfHeight);
218+ *dest++ = (WORD)logfont->lfHeight;
219219 src += 1;
220220 t = CopySz((WORD *)(&logfont->lfFaceName[0]), dest);
221221 dest += t;
@@ -276,7 +276,7 @@
276276 }
277277 src += extraCount;
278278 }
279-
279+
280280 size = (size + 1) & ~1;
281281 return size;
282282 }
@@ -322,7 +322,7 @@
322322 // 取得
323323 if (logfont != NULL) {
324324 memset(logfont, 0, sizeof(*logfont));
325- logfont->lfHeight = -(*src++);
325+ logfont->lfHeight = *src++;
326326 logfont->lfWeight = *src++;
327327 logfont->lfItalic = *((BYTE *)src);
328328 logfont->lfCharSet = *(((BYTE *)src)+1);
@@ -338,7 +338,7 @@
338338 } else {
339339 // セット
340340 if (logfont != NULL) {
341- *dest++ = (WORD)(-logfont->lfHeight);
341+ *dest++ = (WORD)logfont->lfHeight;
342342 *dest++ = (WORD)logfont->lfWeight;
343343 *((BYTE *)dest) = logfont->lfItalic;
344344 *(((BYTE *)dest)+1) = logfont->lfCharSet;
--- branches/cmake/teraterm/common/i18n.c (revision 7385)
+++ branches/cmake/teraterm/common/i18n.c (revision 7386)
@@ -82,32 +82,14 @@
8282 #endif
8383 }
8484
85-static void GetMessageBoxFontName(char *FontName)
86-{
87- NONCLIENTMETRICSA nci;
88-#if(WINVER >= 0x0600)
89- int st_size = offsetof(NONCLIENTMETRICSA, iPaddedBorderWidth);
90-#else
91- int st_size = sizeof(NONCLIENTMETRICSA);
92-#endif
93- BOOL r;
94- const LOGFONTA *logfont;
95-
96- memset(&nci, 0, sizeof(nci));
97- nci.cbSize = st_size;
98- r = SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, st_size, &nci, 0);
99- assert(r == TRUE);
100- logfont = &nci.lfStatusFont;
101-
102- strcpy(FontName, logfont->lfFaceName);
103-}
104-
10585 DllExport int GetI18nLogfont(const char *section, const char *key, PLOGFONTA logfont, int ppi, const char *iniFile)
10686 {
107- static char tmp[MAX_UIMSG];
108- static char font[LF_FACESIZE];
109- int hight, charset;
87+ char tmp[MAX_UIMSG];
88+ char font[LF_FACESIZE];
89+ int height, charset;
11090 assert(iniFile[0] != '\0');
91+ memset(logfont, 0, sizeof(*logfont));
92+
11193 GetPrivateProfileStringA(section, key, "", tmp, MAX_UIMSG, iniFile);
11294 if (tmp[0] == '\0') {
11395 return FALSE;
@@ -114,17 +96,18 @@
11496 }
11597
11698 GetNthString(tmp, 1, LF_FACESIZE-1, font);
117- GetNthNum(tmp, 2, &hight);
99+ GetNthNum(tmp, 2, &height);
118100 GetNthNum(tmp, 3, &charset);
119101
120- memset(logfont, 0, sizeof(*logfont));
121- if (font[0] == '\0') {
122- GetMessageBoxFontName(logfont->lfFaceName);
123- } else {
102+ if (font[0] != '\0') {
124103 strncpy_s(logfont->lfFaceName, sizeof(logfont->lfFaceName), font, _TRUNCATE);
125104 }
126105 logfont->lfCharSet = (BYTE)charset;
127- logfont->lfHeight = MulDiv(hight, -ppi, 72);
106+ if (ppi != 0) {
107+ logfont->lfHeight = MulDiv(height, -ppi, 72);
108+ } else {
109+ logfont->lfHeight = height;
110+ }
128111 logfont->lfWidth = 0;
129112
130113 return TRUE;
--- branches/cmake/teraterm/common/tt_res.h (revision 7385)
+++ branches/cmake/teraterm/common/tt_res.h (revision 7386)
@@ -289,6 +289,7 @@
289289 #define ID_SETUP_TERMINAL 50310
290290 #define ID_SETUP_WINDOW 50320
291291 #define ID_SETUP_FONT 50330
292+#define ID_SETUP_DLG_FONT 50331
292293 #define ID_SETUP_KEYBOARD 50340
293294 #define ID_SETUP_SERIALPORT 50350
294295 #define ID_SETUP_TCPIP 50360
--- branches/cmake/teraterm/teraterm/teraterm.cpp (revision 7385)
+++ branches/cmake/teraterm/teraterm/teraterm.cpp (revision 7386)
@@ -246,7 +246,7 @@
246246 CVTWindow *m_pMainWnd = new CVTWindow();
247247 pVTWin = m_pMainWnd;
248248 main_window = m_pMainWnd->m_hWnd;
249- SetDialogFont(NULL, ts.UILanguageFile);
249+ SetDialogFont(ts.SetupFName, ts.UILanguageFile, NULL);
250250
251251 MSG msg;
252252 while (GetMessage(&msg, NULL, 0, 0)) {
--- branches/cmake/teraterm/teraterm/vtwin.cpp (revision 7385)
+++ branches/cmake/teraterm/teraterm/vtwin.cpp (revision 7386)
@@ -105,10 +105,12 @@
105105 #define CreateProcessT CreateProcessW
106106 #define GetStartupInfoT GetStartupInfoW
107107 #define STARTUPINFOT STARTUPINFOW
108+#define SetDlgItemTextT SetDlgItemTextW
108109 #else
109110 #define CreateProcessT CreateProcessA
110111 #define GetStartupInfoT GetStartupInfoA
111112 #define STARTUPINFOT STARTUPINFOA
113+#define SetDlgItemTextT SetDlgItemTextA
112114 #endif
113115
114116 #ifdef _DEBUG
@@ -1236,10 +1238,12 @@
12361238 { ID_EDIT_SELECTSCREEN, "MENU_EDIT_SELECTSCREEN" },
12371239 { ID_EDIT_SELECTALL, "MENU_EDIT_SELECTALL" },
12381240 };
1239- static const DlgTextInfo SetupMenuTextInfo1[] = {
1241+ static const DlgTextInfo SetupMenuTextInfo[] = {
12401242 { ID_SETUP_TERMINAL, "MENU_SETUP_TERMINAL" },
12411243 { ID_SETUP_WINDOW, "MENU_SETUP_WINDOW" },
1244+ { 2, "MENU_SETUP_FONT" },
12421245 { ID_SETUP_FONT, "MENU_SETUP_FONT" },
1246+ { ID_SETUP_DLG_FONT, "MENU_SETUP_DLG_FONT" },
12431247 { ID_SETUP_KEYBOARD, "MENU_SETUP_KEYBOARD" },
12441248 { ID_SETUP_SERIALPORT, "MENU_SETUP_SERIALPORT" },
12451249 { ID_SETUP_TCPIP, "MENU_SETUP_TCPIP" },
@@ -1250,7 +1254,7 @@
12501254 { ID_OPEN_SETUP, "MENU_SETUP_OPENSETUP" },
12511255 { ID_SETUP_LOADKEYMAP, "MENU_SETUP_LOADKEYMAP" },
12521256 };
1253- static const DlgTextInfo ControlMenuTextInfo1[] = {
1257+ static const DlgTextInfo ControlMenuTextInfo[] = {
12541258 { ID_CONTROL_RESETTERMINAL, "MENU_CONTROL_RESET" },
12551259 { ID_CONTROL_RESETREMOTETITLE, "MENU_CONTROL_RESETTITLE" },
12561260 { ID_CONTROL_AREYOUTHERE, "MENU_CONTROL_AREYOUTHERE" },
@@ -1298,8 +1302,8 @@
12981302
12991303 SetDlgMenuTexts(FileMenu, FileMenuTextInfo, _countof(FileMenuTextInfo), ts.UILanguageFile);
13001304 SetDlgMenuTexts(hMenu, EditMenuTextInfo, _countof(EditMenuTextInfo), ts.UILanguageFile);
1301- SetDlgMenuTexts(hMenu, SetupMenuTextInfo1, _countof(SetupMenuTextInfo1), ts.UILanguageFile);
1302- SetDlgMenuTexts(hMenu, ControlMenuTextInfo1, _countof(ControlMenuTextInfo1), ts.UILanguageFile);
1305+ SetDlgMenuTexts(SetupMenu, SetupMenuTextInfo, _countof(SetupMenuTextInfo), ts.UILanguageFile);
1306+ SetDlgMenuTexts(hMenu, ControlMenuTextInfo, _countof(ControlMenuTextInfo), ts.UILanguageFile);
13031307 SetDlgMenuTexts(hMenu, HelpMenuTextInfo, _countof(HelpMenuTextInfo), ts.UILanguageFile);
13041308
13051309 TTXModifyMenu(hMenu); /* TTPLUG */
@@ -4491,6 +4495,51 @@
44914495 DispSetupFontDlg();
44924496 }
44934497
4498+static BOOL CALLBACK TFontHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
4499+{
4500+ if (Message == WM_INITDIALOG) {
4501+ TCHAR uimsg[MAX_UIMSG];
4502+ get_lang_msgT("DLG_CHOOSEFONT_STC6", uimsg, _countof(uimsg),
4503+ _T("\"Font style\" selection here won't affect actual font appearance."), ts.UILanguageFile);
4504+ SetDlgItemTextT(Dialog, stc6, uimsg);
4505+ }
4506+ return FALSE;
4507+}
4508+
4509+void CVTWindow::OnSetupDlgFont()
4510+{
4511+ LOGFONTA LogFont;
4512+ CHOOSEFONTA cf;
4513+ BOOL result;
4514+ result = GetI18nLogfont("Tera Term", "DlgFont", &LogFont, 0, ts.SetupFName);
4515+ if (result == FALSE) {
4516+ memset(&LogFont, 0, sizeof(LogFont));
4517+ }
4518+
4519+ memset(&cf, 0, sizeof(cf));
4520+ cf.lStructSize = sizeof(cf);
4521+ cf.hwndOwner = HVTWin;
4522+ cf.lpLogFont = &LogFont;
4523+ cf.Flags =
4524+ CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT |
4525+ CF_SHOWHELP | CF_NOVERTFONTS |
4526+ CF_ENABLEHOOK;
4527+ if (ts.ListHiddenFonts) {
4528+ cf.Flags |= CF_INACTIVEFONTS;
4529+ }
4530+ cf.lpfnHook = (LPCFHOOKPROC)(&TFontHook);
4531+ cf.nFontType = REGULAR_FONTTYPE;
4532+ cf.hInstance = hInst;
4533+ HelpId = HlpSetupFont;
4534+ result = ChooseFontA(&cf);
4535+ if (result) {
4536+ char Temp[80];
4537+ _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%s,%d,%d",
4538+ LogFont.lfFaceName, LogFont.lfHeight, LogFont.lfCharSet);
4539+ WritePrivateProfileStringA("Tera Term", "DlgFont", Temp, ts.SetupFName);
4540+ }
4541+}
4542+
44944543 void CVTWindow::OnSetupKeyboard()
44954544 {
44964545 BOOL Ok;
@@ -6265,6 +6314,7 @@
62656314 case ID_SETUP_TERMINAL: OnSetupTerminal(); break;
62666315 case ID_SETUP_WINDOW: OnSetupWindow(); break;
62676316 case ID_SETUP_FONT: OnSetupFont(); break;
6317+ case ID_SETUP_DLG_FONT: OnSetupDlgFont(); break;
62686318 case ID_SETUP_KEYBOARD: OnSetupKeyboard(); break;
62696319 case ID_SETUP_SERIALPORT: OnSetupSerialPort(); break;
62706320 case ID_SETUP_TCPIP: OnSetupTCPIP(); break;
--- branches/cmake/teraterm/teraterm/vtwin.h (revision 7385)
+++ branches/cmake/teraterm/teraterm/vtwin.h (revision 7386)
@@ -197,6 +197,7 @@
197197 afx_msg void OnSetupTerminal();
198198 afx_msg void OnSetupWindow();
199199 afx_msg void OnSetupFont();
200+ afx_msg void OnSetupDlgFont();
200201 afx_msg void OnSetupKeyboard();
201202 afx_msg void OnSetupSerialPort();
202203 afx_msg void OnSetupTCPIP();
--- branches/cmake/teraterm/ttpdlg/ttdlg.c (revision 7385)
+++ branches/cmake/teraterm/ttpdlg/ttdlg.c (revision 7386)
@@ -80,6 +80,7 @@
8080
8181 //static HANDLE hInst;
8282 extern HANDLE hInst;
83+extern TTTSet ts;
8384
8485 static char UILanguageFile[MAX_PATH];
8586
@@ -2777,7 +2778,7 @@
27772778 i = IDD_TERMDLG;
27782779 }
27792780
2780- SetDialogFont(NULL, UILanguageFile);
2781+ SetDialogFont(ts->SetupFName, UILanguageFile, NULL);
27812782 return
27822783 (BOOL)DialogBoxParam(hInst,
27832784 MAKEINTRESOURCE(i),
@@ -2786,7 +2787,7 @@
27862787
27872788 DllExport BOOL WINAPI _SetupWin(HWND WndParent, PTTSet ts)
27882789 {
2789- SetDialogFont(NULL, UILanguageFile);
2790+ SetDialogFont(ts->SetupFName, UILanguageFile, NULL);
27902791 return
27912792 (BOOL)DialogBoxParam(hInst,
27922793 MAKEINTRESOURCE(IDD_WINDLG),
@@ -2795,7 +2796,7 @@
27952796
27962797 DllExport BOOL WINAPI _SetupKeyboard(HWND WndParent, PTTSet ts)
27972798 {
2798- SetDialogFont(NULL, UILanguageFile);
2799+ SetDialogFont(ts->SetupFName, UILanguageFile, NULL);
27992800 return
28002801 (BOOL)DialogBoxParam(hInst,
28012802 MAKEINTRESOURCE(IDD_KEYBDLG),
@@ -2804,7 +2805,7 @@
28042805
28052806 DllExport BOOL WINAPI _SetupSerialPort(HWND WndParent, PTTSet ts)
28062807 {
2807- SetDialogFont(NULL, UILanguageFile);
2808+ SetDialogFont(ts->SetupFName, UILanguageFile, NULL);
28082809 return
28092810 (BOOL)DialogBoxParam(hInst,
28102811 MAKEINTRESOURCE(IDD_SERIALDLG),
@@ -2813,7 +2814,7 @@
28132814
28142815 DllExport BOOL WINAPI _SetupTCPIP(HWND WndParent, PTTSet ts)
28152816 {
2816- SetDialogFont(NULL, UILanguageFile);
2817+ SetDialogFont(ts->SetupFName, UILanguageFile, NULL);
28172818 return
28182819 (BOOL)DialogBoxParam(hInst,
28192820 MAKEINTRESOURCE(IDD_TCPIPDLG),
@@ -2822,7 +2823,7 @@
28222823
28232824 DllExport BOOL WINAPI _GetHostName(HWND WndParent, PGetHNRec GetHNRec)
28242825 {
2825- SetDialogFont(NULL, UILanguageFile);
2826+ SetDialogFont(ts.SetupFName, UILanguageFile, NULL);
28262827 return
28272828 (BOOL)DialogBoxParam(hInst,
28282829 MAKEINTRESOURCE(IDD_HOSTDLG),
@@ -2831,7 +2832,7 @@
28312832
28322833 DllExport BOOL WINAPI _ChangeDirectory(HWND WndParent, PCHAR CurDir)
28332834 {
2834- SetDialogFont(NULL, UILanguageFile);
2835+ SetDialogFont(ts.SetupFName, UILanguageFile, NULL);
28352836 return
28362837 (BOOL)DialogBoxParam(hInst,
28372838 MAKEINTRESOURCE(IDD_DIRDLG),
@@ -2840,7 +2841,7 @@
28402841
28412842 DllExport BOOL WINAPI _AboutDialog(HWND WndParent)
28422843 {
2843- SetDialogFont(NULL, UILanguageFile);
2844+ SetDialogFont(ts.SetupFName, UILanguageFile, NULL);
28442845 return
28452846 (BOOL)DialogBox(hInst,
28462847 MAKEINTRESOURCE(IDD_ABOUTDLG),
@@ -2897,8 +2898,8 @@
28972898 CHOOSEFONTA cf;
28982899 BOOL Ok;
28992900
2900- memset(&cf, 0, sizeof(CHOOSEFONT));
2901- cf.lStructSize = sizeof(CHOOSEFONT);
2901+ memset(&cf, 0, sizeof(cf));
2902+ cf.lStructSize = sizeof(cf);
29022903 cf.hwndOwner = WndParent;
29032904 cf.lpLogFont = LogFont;
29042905 cf.Flags = CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT |
@@ -2917,7 +2918,7 @@
29172918
29182919 DllExport BOOL WINAPI _SetupGeneral(HWND WndParent, PTTSet ts)
29192920 {
2920- SetDialogFont(NULL, UILanguageFile);
2921+ SetDialogFont(ts->SetupFName, UILanguageFile, NULL);
29212922 return
29222923 (BOOL)DialogBoxParam(hInst,
29232924 MAKEINTRESOURCE(IDD_GENDLG),
@@ -2926,7 +2927,7 @@
29262927
29272928 DllExport BOOL WINAPI _WindowWindow(HWND WndParent, PBOOL Close)
29282929 {
2929- SetDialogFont(NULL, UILanguageFile);
2930+ SetDialogFont(ts.SetupFName, UILanguageFile, NULL);
29302931 *Close = FALSE;
29312932 return
29322933 (BOOL)DialogBoxParam(hInst,
--- branches/cmake/teraterm/ttpmacro/ttmacro.cpp (revision 7385)
+++ branches/cmake/teraterm/ttpmacro/ttmacro.cpp (revision 7386)
@@ -137,7 +137,7 @@
137137 init();
138138 InitCommonControls();
139139 GetUILanguageFile(UILanguageFile, sizeof(UILanguageFile));
140- SetDialogFont(NULL, UILanguageFile);
140+ SetDialogFont(NULL, UILanguageFile, NULL);
141141
142142 Busy = TRUE;
143143 pCCtrlWindow = new CCtrlWindow();
--- branches/cmake/ttssh2/ttxssh/CMakeLists.txt (revision 7385)
+++ branches/cmake/ttssh2/ttxssh/CMakeLists.txt (revision 7386)
@@ -1,170 +1,170 @@
1-project(ttxssh)
2-
3-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/")
4-
5-include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_zlib.cmake)
6-include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_openssl.cmake)
7-
8-if(USE_UNICODE_API)
9- add_definitions(-DUNICODE -D_UNICODE)
10-endif()
11-
12-set(COMMON_SRC
13- ../../teraterm/teraterm/WSAAsyncGetAddrInfo.c
14- ../../teraterm/common/ttcommon.h
15- ../../teraterm/common/i18n.h
16- ../../teraterm/common/ttlib.h
17- ../../teraterm/common/dlglib.h
18- ../../teraterm/common/dlglib.c
19- ../../teraterm/common/dlglib_cpp.cpp
20- ../../teraterm/common/dlglib_tmpl.cpp
21- ../../teraterm/common/servicenames.h
22- ../../teraterm/common/codeconv.cpp
23- ../../teraterm/common/codeconv.h
24- )
25-
26-source_group(
27- "common"
28- FILES
29- ${COMMON_SRC}
30- )
31-
32-set(SRC
33- ${CMAKE_CURRENT_BINARY_DIR}/puttyversion.h
34- ../matcher/matcher.c
35- arc4random.c
36- arc4random.h
37- auth.c
38- auth.h
39- buffer.c
40- buffer.h
41- chacha.c
42- chacha.h
43- cipher.h
44- cipher-ctr.c
45- config.h
46- crypt.c
47- crypt.h
48- dns.c
49- dns.h
50- ed25519.c
51- ed25519_bcrypt_pbkdf.c
52- ed25519_blf.h
53- ed25519_blocks.c
54- ed25519_blowfish.c
55- ed25519_crypto_api.h
56- ed25519_fe25519.c
57- ed25519_fe25519.h
58- ed25519_ge25519.c
59- ed25519_ge25519.h
60- ed25519_hash.c
61- ed25519_sc25519.c
62- ed25519_sc25519.h
63- ed25519_verify.c
64- fwd.c
65- fwd.h
66- fwd-socks.c
67- fwd-socks.h
68- fwdui.c
69- fwdui.h
70- hosts.c
71- hosts.h
72- kex.c
73- kex.h
74- key.c
75- key.h
76- keyfiles.c
77- keyfiles.h
78- pkt.c
79- pkt.h
80- resource.h
81- sftp.c
82- sftp.h
83- ssh.c
84- ssh.h
85- ttxssh.c
86- ttxssh.def
87- ttxssh.h
88- ttxssh.rc
89- ttxssh-version.h
90- ttxssh-version.rc
91- util.c
92- util.h
93- x11util.c
94- x11util.h
95- ${COMMON_SRC}
96- )
97-
98-
99-include_directories(
100- ../../teraterm/teraterm
101- ../../teraterm/common
102- ../matcher
103- ../putty
104- ${OPENSSL_INCLUDE_DIRS}
105- ${ZLIB_INCLUDE_DIRS}
106- )
107-
108-link_directories(
109- ${ZLIB_LIBRARY_DIRS}
110- )
111-
112-if (MSVC)
113- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:dnsapi.dll")
114-endif()
115-
116-if(MINGW)
117- link_directories(
118- ${CMAKE_SOURCE_DIR}/teraterm/htmlhelp
119- )
120-endif()
121-
122-add_library(
123- ttxssh SHARED
124- ${SRC}
125- )
126-
127-target_compile_definitions(
128- ttxssh
129- PRIVATE -DTTPCMN_IMPORT
130- )
131-
132-set_target_properties(
133- ttxssh
134- PROPERTIES
135- PREFIX ""
136- )
137-
138-target_link_libraries(
139- ttxssh
140- libputty
141- ttpcmn
142- debug zlibstaticd
143- optimized zlibstatic
144- ${OPENSSL_LIB}
145- #
146- ws2_32
147- dnsapi
148- gdi32
149- comdlg32
150- delayimp
151- )
152-
153-### create puttyversion.h
154-
155-file(READ "${CMAKE_SOURCE_DIR}/libs/putty/windows/putty.iss" iis)
156-
157-string(REGEX MATCH "VersionInfoTextVersion=([^\n]+)\n" _ ${iis})
158-set(version_str ${CMAKE_MATCH_1})
159-if("${version_str}" STREQUAL "")
160- string(REGEX MATCH "AppVerName=([^\n]+)\n" _ ${iis})
161- set(version_str ${CMAKE_MATCH_1})
162-endif()
163-if("${version_str}" STREQUAL "")
164- set(version_str "unknown")
165-endif()
166-message("putty version=\"${version_str}\"")
167-FILE(
168- WRITE ${CMAKE_CURRENT_BINARY_DIR}/puttyversion.h
169- "#define PUTTYVERSION \"${version_str}\"\n"
170- )
1+project(ttxssh)
2+
3+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/")
4+
5+include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_zlib.cmake)
6+include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/lib_openssl.cmake)
7+
8+if(USE_UNICODE_API)
9+ add_definitions(-DUNICODE -D_UNICODE)
10+endif()
11+
12+set(COMMON_SRC
13+ ../../teraterm/teraterm/WSAAsyncGetAddrInfo.c
14+ ../../teraterm/common/ttcommon.h
15+ ../../teraterm/common/i18n.h
16+ ../../teraterm/common/ttlib.h
17+ ../../teraterm/common/dlglib.h
18+ ../../teraterm/common/dlglib.c
19+ ../../teraterm/common/dlglib_cpp.cpp
20+ ../../teraterm/common/dlglib_tmpl.cpp
21+ ../../teraterm/common/servicenames.h
22+ ../../teraterm/common/codeconv.cpp
23+ ../../teraterm/common/codeconv.h
24+ )
25+
26+source_group(
27+ "common"
28+ FILES
29+ ${COMMON_SRC}
30+ )
31+
32+set(SRC
33+ ${CMAKE_CURRENT_BINARY_DIR}/puttyversion.h
34+ ../matcher/matcher.c
35+ arc4random.c
36+ arc4random.h
37+ auth.c
38+ auth.h
39+ buffer.c
40+ buffer.h
41+ chacha.c
42+ chacha.h
43+ cipher.h
44+ cipher-ctr.c
45+ config.h
46+ crypt.c
47+ crypt.h
48+ dns.c
49+ dns.h
50+ ed25519.c
51+ ed25519_bcrypt_pbkdf.c
52+ ed25519_blf.h
53+ ed25519_blocks.c
54+ ed25519_blowfish.c
55+ ed25519_crypto_api.h
56+ ed25519_fe25519.c
57+ ed25519_fe25519.h
58+ ed25519_ge25519.c
59+ ed25519_ge25519.h
60+ ed25519_hash.c
61+ ed25519_sc25519.c
62+ ed25519_sc25519.h
63+ ed25519_verify.c
64+ fwd.c
65+ fwd.h
66+ fwd-socks.c
67+ fwd-socks.h
68+ fwdui.c
69+ fwdui.h
70+ hosts.c
71+ hosts.h
72+ kex.c
73+ kex.h
74+ key.c
75+ key.h
76+ keyfiles.c
77+ keyfiles.h
78+ pkt.c
79+ pkt.h
80+ resource.h
81+ sftp.c
82+ sftp.h
83+ ssh.c
84+ ssh.h
85+ ttxssh.c
86+ ttxssh.def
87+ ttxssh.h
88+ ttxssh.rc
89+ ttxssh-version.h
90+ ttxssh-version.rc
91+ util.c
92+ util.h
93+ x11util.c
94+ x11util.h
95+ ${COMMON_SRC}
96+ )
97+
98+
99+include_directories(
100+ ../../teraterm/teraterm
101+ ../../teraterm/common
102+ ../matcher
103+ ../putty
104+ ${OPENSSL_INCLUDE_DIRS}
105+ ${ZLIB_INCLUDE_DIRS}
106+ )
107+
108+link_directories(
109+ ${ZLIB_LIBRARY_DIRS}
110+ )
111+
112+if (MSVC)
113+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:dnsapi.dll")
114+endif()
115+
116+if(MINGW)
117+ link_directories(
118+ ${CMAKE_SOURCE_DIR}/teraterm/htmlhelp
119+ )
120+endif()
121+
122+add_library(
123+ ttxssh SHARED
124+ ${SRC}
125+ )
126+
127+target_compile_definitions(
128+ ttxssh
129+ PRIVATE -DTTPCMN_IMPORT
130+ )
131+
132+set_target_properties(
133+ ttxssh
134+ PROPERTIES
135+ PREFIX ""
136+ )
137+
138+target_link_libraries(
139+ ttxssh
140+ libputty
141+ ttpcmn
142+ debug zlibstaticd
143+ optimized zlibstatic
144+ ${OPENSSL_LIB}
145+ #
146+ ws2_32
147+ dnsapi
148+ gdi32
149+ comdlg32
150+ delayimp
151+ )
152+
153+### create puttyversion.h
154+
155+file(READ "${CMAKE_SOURCE_DIR}/libs/putty/windows/putty.iss" iis)
156+
157+string(REGEX MATCH "VersionInfoTextVersion=([^\n]+)\n" _ ${iis})
158+set(version_str ${CMAKE_MATCH_1})
159+if("${version_str}" STREQUAL "")
160+ string(REGEX MATCH "AppVerName=([^\n]+)\n" _ ${iis})
161+ set(version_str ${CMAKE_MATCH_1})
162+endif()
163+if("${version_str}" STREQUAL "")
164+ set(version_str "unknown")
165+endif()
166+message("putty version=\"${version_str}\"")
167+FILE(
168+ WRITE ${CMAKE_CURRENT_BINARY_DIR}/puttyversion.h
169+ "#define PUTTYVERSION \"${version_str}\"\n"
170+ )
--- branches/cmake/ttssh2/ttxssh/hosts.c (revision 7385)
+++ branches/cmake/ttssh2/ttxssh/hosts.c (revision 7386)
@@ -997,7 +997,7 @@
997997 }
998998 {
999999 const TCHAR *hostname = ToTcharU8(pvar->hosts_state.prefetched_hostname);
1000- _tcsncpy_s(buf2 + i, sizeof(buf2) - i,
1000+ _tcsncpy_s(buf2 + i, _countof(buf2) - i,
10011001 hostname, _TRUNCATE);
10021002 free((void *)hostname);
10031003 }
@@ -1004,7 +1004,7 @@
10041004 j = i + _tcslen(buf2 + i);
10051005 for (; buf[i] == '#'; i++) {
10061006 }
1007- _tcsncpy_s(buf2 + j, sizeof(buf2) - j, buf + i, _TRUNCATE);
1007+ _tcsncpy_s(buf2 + j, _countof(buf2) - j, buf + i, _TRUNCATE);
10081008
10091009 SetDlgItemText(dlg, IDC_HOSTWARNING, buf2);
10101010
--- branches/cmake/ttssh2/ttxssh/ttxssh.c (revision 7385)
+++ branches/cmake/ttssh2/ttxssh/ttxssh.c (revision 7386)
@@ -1715,7 +1715,7 @@
17151715
17161716 static void UTIL_SetDialogFont()
17171717 {
1718- SetDialogFont("TTSSH", pvar->ts->UILanguageFile);
1718+ SetDialogFont(pvar->ts->SetupFName, pvar->ts->UILanguageFile, "TTSSH");
17191719 }
17201720
17211721 static BOOL PASCAL TTXGetHostName(HWND parent, PGetHNRec rec)
Show on old repository browser