[Ttssh2-commit] [7560] ttssh 高DPI対応

アーカイブの一覧に戻る
scmno****@osdn***** scmno****@osdn*****
2019年 4月 9日 (火) 02:12:02 JST


Revision: 7560
          https://osdn.net/projects/ttssh2/scm/svn/commits/7560
Author:   zmatsuo
Date:     2019-04-09 02:12:02 +0900 (Tue, 09 Apr 2019)
Log Message:
-----------
ttssh 高DPI対応

Modified Paths:
--------------
    trunk/ttssh2/ttxssh/CMakeLists.txt
    trunk/ttssh2/ttxssh/auth.c
    trunk/ttssh2/ttxssh/fwdui.c
    trunk/ttssh2/ttxssh/hosts.c
    trunk/ttssh2/ttxssh/key.c
    trunk/ttssh2/ttxssh/ssh.c
    trunk/ttssh2/ttxssh/ttxssh.c
    trunk/ttssh2/ttxssh/util.c

-------------- next part --------------
Modified: trunk/ttssh2/ttxssh/CMakeLists.txt
===================================================================
--- trunk/ttssh2/ttxssh/CMakeLists.txt	2019-04-08 17:11:49 UTC (rev 7559)
+++ trunk/ttssh2/ttxssh/CMakeLists.txt	2019-04-08 17:12:02 UTC (rev 7560)
@@ -14,7 +14,11 @@
   ../../teraterm/common/ttcommon.h
   ../../teraterm/common/i18n.h
   ../../teraterm/common/ttlib.h
+  ../../teraterm/common/ttlib.c
   ../../teraterm/common/dlglib.h
+  ../../teraterm/common/dlglib.c
+  ../../teraterm/common/dlglib_cpp.cpp
+  ../../teraterm/common/dlglib_tmpl.cpp
   ../../teraterm/common/servicenames.h
   ../../teraterm/common/codeconv.cpp
   ../../teraterm/common/codeconv.h

Modified: trunk/ttssh2/ttxssh/auth.c
===================================================================
--- trunk/ttssh2/ttxssh/auth.c	2019-04-08 17:11:49 UTC (rev 7559)
+++ trunk/ttssh2/ttxssh/auth.c	2019-04-08 17:12:02 UTC (rev 7560)
@@ -32,6 +32,7 @@
 #include "ssh.h"
 #include "key.h"
 #include "ttlib.h"
+#include "dlglib.h"
 
 #include <io.h>
 #include <fcntl.h>
@@ -47,10 +48,17 @@
 
 #define MAX_AUTH_CONTROL IDC_SSHUSEPAGEANT
 
-static HFONT DlgAuthFont;
-static HFONT DlgTisFont;
-static HFONT DlgAuthSetupFont;
+#undef DialogBoxParam
+#define DialogBoxParam(p1,p2,p3,p4,p5) \
+	TTDialogBoxParam(p1,p2,p3,p4,p5)
+#undef EndDialog
+#define EndDialog(p1,p2) \
+	TTEndDialog(p1, p2)
 
+//static HFONT DlgAuthFont;
+//static HFONT DlgTisFont;
+//static HFONT DlgAuthSetupFont;
+
 void destroy_malloced_string(char **str)
 {
 	if (*str != NULL) {
@@ -702,9 +710,11 @@
 	}
 
 	EndDialog(dlg, 1);
+#if 0
 	if (DlgAuthFont != NULL) {
 		DeleteObject(DlgAuthFont);
 	}
+#endif
 
 	return TRUE;
 }
@@ -758,8 +768,8 @@
 	const int IDC_TIMER3 = 302; // challenge \x82\xC5 ask4passwd \x82\xC5CheckAuthListFirst \x82\xAA FALSE \x82̂Ƃ\xAB
 	const int autologin_timeout = 10; // \x83~\x83\x8A\x95b
 	PTInstVar pvar;
-	LOGFONT logfont;
-	HFONT font;
+//	LOGFONT logfont;
+//	HFONT font;
 
 	switch (msg) {
 	case WM_INITDIALOG:
@@ -768,7 +778,7 @@
 		SetWindowLong(dlg, DWL_USER, lParam);
 
 		init_auth_dlg(pvar, dlg);
-
+#if 0
 		font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
 		GetObject(font, sizeof(LOGFONT), &logfont);
 		if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgAuthFont, pvar)) {
@@ -797,7 +807,7 @@
 		else {
 			DlgAuthFont = NULL;
 		}
-
+#endif
 		// SSH2 autologin\x82\xAA\x97L\x8C\xF8\x82̏ꍇ\x82́A\x83^\x83C\x83}\x82\xF0\x8Ed\x8A|\x82\xAF\x82\xE9\x81B (2004.12.1 yutaka)
 		if (pvar->ssh2_autologin == 1) {
 			autologin_sent_none = FALSE;
@@ -943,11 +953,11 @@
 			pvar->auth_state.auth_dialog = NULL;
 			notify_closed_connection(pvar, "authentication cancelled");
 			EndDialog(dlg, 0);
-
+#if 0
 			if (DlgAuthFont != NULL) {
 				DeleteObject(DlgAuthFont);
 			}
-
+#endif
 			return TRUE;
 
 		case IDC_SSHUSERNAME:
@@ -1227,8 +1237,8 @@
                                   LPARAM lParam)
 {
 	PTInstVar pvar;
-	LOGFONT logfont;
-	HFONT font;
+//	LOGFONT logfont;
+//	HFONT font;
 
 	switch (msg) {
 	case WM_INITDIALOG:
@@ -1237,7 +1247,7 @@
 		SetWindowLong(dlg, DWL_USER, lParam);
 
 		init_TIS_dlg(pvar, dlg);
-
+#if 0
 		font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
 		GetObject(font, sizeof(LOGFONT), &logfont);
 		if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgTisFont, pvar)) {
@@ -1250,7 +1260,7 @@
 		else {
 			DlgTisFont = NULL;
 		}
-
+#endif
 		// /auth=challenge \x82\xF0\x92lj\xC1 (2007.10.5 maya)
 		if (pvar->ssh2_autologin == 1) {
 			SetDlgItemText(dlg, IDC_SSHPASSWORD, pvar->ssh2_password);
@@ -1264,10 +1274,11 @@
 
 		switch (LOWORD(wParam)) {
 		case IDOK:
+#if 0
 			if (DlgTisFont != NULL) {
 				DeleteObject(DlgTisFont);
 			}
-
+#endif
 			return end_TIS_dlg(pvar, dlg);
 
 		case IDCANCEL:			/* kill the connection */
@@ -1274,11 +1285,11 @@
 			pvar->auth_state.auth_dialog = NULL;
 			notify_closed_connection(pvar, "authentication cancelled");
 			EndDialog(dlg, 0);
-
+#if 0
 			if (DlgTisFont != NULL) {
 				DeleteObject(DlgTisFont);
 			}
-
+#endif
 			return TRUE;
 
 		default:
@@ -1449,8 +1460,8 @@
 										   WPARAM wParam, LPARAM lParam)
 {
 	PTInstVar pvar;
-	LOGFONT logfont;
-	HFONT font;
+//	LOGFONT logfont;
+//	HFONT font;
 
 	switch (msg) {
 	case WM_INITDIALOG:
@@ -1458,7 +1469,7 @@
 		SetWindowLong(dlg, DWL_USER, lParam);
 
 		init_default_auth_dlg(pvar, dlg);
-
+#if 0
 		font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
 		GetObject(font, sizeof(LOGFONT), &logfont);
 		if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgAuthSetupFont, pvar)) {
@@ -1483,7 +1494,7 @@
 		else {
 			DlgAuthSetupFont = NULL;
 		}
-
+#endif
 		return TRUE;			/* because we do not set the focus */
 
 	case WM_COMMAND:
@@ -1491,20 +1502,20 @@
 
 		switch (LOWORD(wParam)) {
 		case IDOK:
-
+#if 0
 			if (DlgAuthSetupFont != NULL) {
 				DeleteObject(DlgAuthSetupFont);
 			}
-
+#endif
 			return end_default_auth_dlg(pvar, dlg);
 
 		case IDCANCEL:
 			EndDialog(dlg, 0);
-
+#if 0
 			if (DlgAuthSetupFont != NULL) {
 				DeleteObject(DlgAuthSetupFont);
 			}
-
+#endif
 			return TRUE;
 
 		case IDC_CHOOSERSAFILE:

Modified: trunk/ttssh2/ttxssh/fwdui.c
===================================================================
--- trunk/ttssh2/ttxssh/fwdui.c	2019-04-08 17:11:49 UTC (rev 7559)
+++ trunk/ttssh2/ttxssh/fwdui.c	2019-04-08 17:12:02 UTC (rev 7560)
@@ -37,12 +37,20 @@
 #include "resource.h"
 #include "x11util.h"
 #include "util.h"
+#include "dlglib.h"
 
 #include "servicenames.h"
 
-static HFONT DlgFwdEditFont;
-static HFONT DlgFwdFont;
+#undef DialogBoxParam
+#define DialogBoxParam(p1,p2,p3,p4,p5) \
+	TTDialogBoxParam(p1,p2,p3,p4,p5)
+#undef EndDialog
+#define EndDialog(p1,p2) \
+	TTEndDialog(p1, p2)
 
+//static HFONT DlgFwdEditFont;
+//static HFONT DlgFwdFont;
+
 typedef struct {
 	FWDRequestSpec *spec;
 	PTInstVar pvar;
@@ -975,8 +983,8 @@
 {
 	FWDEditClosure *closure;
 	PTInstVar pvar;
-	LOGFONT logfont;
-	HFONT font;
+//	LOGFONT logfont;
+//	HFONT font;
 	BOOL result;
 
 	switch (msg) {
@@ -986,7 +994,7 @@
 
 		pvar = closure->pvar;
 		init_fwd_edit_dlg(pvar, closure->spec, dlg);
-
+#if 0
 		font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
 		GetObject(font, sizeof(LOGFONT), &logfont);
 		if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgFwdEditFont, pvar)) {
@@ -1017,6 +1025,7 @@
 		else {
 			DlgFwdEditFont = NULL;
 		}
+#endif
 		return FALSE;			/* because we set the focus */
 
 	case WM_COMMAND:
@@ -1028,9 +1037,11 @@
 			result = end_fwd_edit_dlg(closure->pvar, closure->spec, dlg);
 
 			if (result) {
+#if 0
 				if (DlgFwdEditFont != NULL) {
 					DeleteObject(DlgFwdEditFont);
 				}
+#endif
 			}
 
 			return result;
@@ -1037,11 +1048,11 @@
 
 		case IDCANCEL:
 			EndDialog(dlg, 0);
-
+#if 0
 			if (DlgFwdEditFont != NULL) {
 				DeleteObject(DlgFwdEditFont);
 			}
-
+#endif
 			return TRUE;
 
 		case IDC_SSHFWDLOCALTOREMOTE:
@@ -1140,8 +1151,8 @@
                                   LPARAM lParam)
 {
 	PTInstVar pvar;
-	LOGFONT logfont;
-	HFONT font;
+//	LOGFONT logfont;
+//	HFONT font;
 	BOOL ret;
 
 	switch (msg) {
@@ -1150,7 +1161,7 @@
 		SetWindowLong(dlg, DWL_USER, lParam);
 
 		init_fwd_dlg(pvar, dlg);
-
+#if 0
 		font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
 		GetObject(font, sizeof(LOGFONT), &logfont);
 		if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgFwdFont, pvar)) {
@@ -1167,7 +1178,7 @@
 		else {
 			DlgFwdFont = NULL;
 		}
-
+#endif
 		return TRUE;			/* because we do not set the focus */
 
 	case WM_COMMAND:
@@ -1177,21 +1188,21 @@
 		case IDOK:
 
 			ret = end_fwd_dlg(pvar, dlg);
-
+#if 0
 			if (ret == TRUE && DlgFwdFont != NULL) {
 				DeleteObject(DlgFwdFont);
 			}
-
+#endif
 			return ret;
 
 		case IDCANCEL:
 			free_all_listbox_specs(dlg);
 			EndDialog(dlg, 0);
-
+#if 0
 			if (DlgFwdFont != NULL) {
 				DeleteObject(DlgFwdFont);
 			}
-
+#endif
 			return TRUE;
 
 		case IDC_ADD:

Modified: trunk/ttssh2/ttxssh/hosts.c
===================================================================
--- trunk/ttssh2/ttxssh/hosts.c	2019-04-08 17:11:49 UTC (rev 7559)
+++ trunk/ttssh2/ttxssh/hosts.c	2019-04-08 17:12:02 UTC (rev 7560)
@@ -39,6 +39,7 @@
 #include "key.h"
 #include "hosts.h"
 #include "dns.h"
+#include "dlglib.h"
 
 #include <openssl/bn.h>
 #include <openssl/evp.h>
@@ -53,9 +54,16 @@
 #include <memory.h>
 
 
-static HFONT DlgHostsAddFont;
-static HFONT DlgHostsReplaceFont;
+#undef DialogBoxParam
+#define DialogBoxParam(p1,p2,p3,p4,p5) \
+	TTDialogBoxParam(p1,p2,p3,p4,p5)
+#undef EndDialog
+#define EndDialog(p1,p2) \
+	TTEndDialog(p1, p2)
 
+//static HFONT DlgHostsAddFont;
+//static HFONT DlgHostsReplaceFont;
+
 // BASE64\x8D\\x90\xAC\x95\xB6\x8E\x9A\x97\xF1\x81i\x82\xB1\x82\xB1\x82ł\xCD'='\x82͊܂܂\xEA\x82Ă\xA2\x82Ȃ\xA2\x81j
 static char base64[] ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
@@ -1702,8 +1710,8 @@
                                         LPARAM lParam)
 {
 	PTInstVar pvar;
-	LOGFONT logfont;
-	HFONT font;
+//	LOGFONT logfont;
+//	HFONT font;
 	char uimsg[MAX_UIMSG];
 
 	switch (msg) {
@@ -1776,7 +1784,7 @@
 		}
 
 		init_hosts_dlg(pvar, dlg);
-
+#if 0
 		font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
 		GetObject(font, sizeof(LOGFONT), &logfont);
 		if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgHostsAddFont, pvar)) {
@@ -1796,7 +1804,7 @@
 		else {
 			DlgHostsAddFont = NULL;
 		}
-
+#endif
 		// add host check box\x82Ƀ`\x83F\x83b\x83N\x82\xF0\x83f\x83t\x83H\x83\x8B\x83g\x82œ\xFC\x82\xEA\x82Ă\xA8\x82\xAD 
 		SendMessage(GetDlgItem(dlg, IDC_ADDTOKNOWNHOSTS), BM_SETCHECK, BST_CHECKED, 0);
 
@@ -1825,11 +1833,11 @@
 			pvar->hosts_state.hosts_dialog = NULL;
 
 			EndDialog(dlg, 1);
-
+#if 0
 			if (DlgHostsAddFont != NULL) {
 				DeleteObject(DlgHostsAddFont);
 			}
-
+#endif
 			return TRUE;
 
 		case IDCANCEL:			/* kill the connection */
@@ -1837,11 +1845,11 @@
 			pvar->hosts_state.hosts_dialog = NULL;
 			notify_closed_connection(pvar, "authentication cancelled");
 			EndDialog(dlg, 0);
-
+#if 0
 			if (DlgHostsAddFont != NULL) {
 				DeleteObject(DlgHostsAddFont);
 			}
-
+#endif
 			return TRUE;
 
 		case IDC_FP_HASH_ALG_MD5:
@@ -1868,8 +1876,8 @@
                                             LPARAM lParam)
 {
 	PTInstVar pvar;
-	LOGFONT logfont;
-	HFONT font;
+//	LOGFONT logfont;
+//	HFONT font;
 	char uimsg[MAX_UIMSG];
 
 	switch (msg) {
@@ -1942,7 +1950,7 @@
 		}
 
 		init_hosts_dlg(pvar, dlg);
-
+#if 0
 		font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
 		GetObject(font, sizeof(LOGFONT), &logfont);
 		if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgHostsReplaceFont, pvar)) {
@@ -1961,7 +1969,7 @@
 		else {
 			DlgHostsReplaceFont = NULL;
 		}
-
+#endif
 		// \x83f\x83t\x83H\x83\x8B\x83g\x82Ń`\x83F\x83b\x83N\x82͓\xFC\x82\xEA\x82Ȃ\xA2
 		return TRUE;			/* because we do not set the focus */
 
@@ -1989,11 +1997,11 @@
 			pvar->hosts_state.hosts_dialog = NULL;
 
 			EndDialog(dlg, 1);
-
+#if 0
 			if (DlgHostsReplaceFont != NULL) {
 				DeleteObject(DlgHostsReplaceFont);
 			}
-
+#endif
 			return TRUE;
 
 		case IDCANCEL:			/* kill the connection */
@@ -2001,11 +2009,11 @@
 			pvar->hosts_state.hosts_dialog = NULL;
 			notify_closed_connection(pvar, "authentication cancelled");
 			EndDialog(dlg, 0);
-
+#if 0
 			if (DlgHostsReplaceFont != NULL) {
 				DeleteObject(DlgHostsReplaceFont);
 			}
-
+#endif
 			return TRUE;
 
 		case IDC_FP_HASH_ALG_MD5:
@@ -2032,8 +2040,8 @@
                                          LPARAM lParam)
 {
 	PTInstVar pvar;
-	LOGFONT logfont;
-	HFONT font;
+//	LOGFONT logfont;
+//	HFONT font;
 	char uimsg[MAX_UIMSG];
 
 	switch (msg) {
@@ -2106,7 +2114,7 @@
 		}
 
 		init_hosts_dlg(pvar, dlg);
-
+#if 0
 		font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
 		GetObject(font, sizeof(LOGFONT), &logfont);
 		if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgHostsAddFont, pvar)) {
@@ -2126,7 +2134,7 @@
 		else {
 			DlgHostsAddFont = NULL;
 		}
-
+#endif
 		// add host check box \x82̃f\x83t\x83H\x83\x8B\x83g\x82\xCD off \x82ɂ\xB7\x82\xE9
 		// SendMessage(GetDlgItem(dlg, IDC_ADDTOKNOWNHOSTS), BM_SETCHECK, BST_CHECKED, 0);
 
@@ -2155,11 +2163,11 @@
 			pvar->hosts_state.hosts_dialog = NULL;
 
 			EndDialog(dlg, 1);
-
+#if 0
 			if (DlgHostsAddFont != NULL) {
 				DeleteObject(DlgHostsAddFont);
 			}
-
+#endif
 			return TRUE;
 
 		case IDCANCEL:			/* kill the connection */
@@ -2167,11 +2175,11 @@
 			pvar->hosts_state.hosts_dialog = NULL;
 			notify_closed_connection(pvar, "authentication cancelled");
 			EndDialog(dlg, 0);
-
+#if 0
 			if (DlgHostsAddFont != NULL) {
 				DeleteObject(DlgHostsAddFont);
 			}
-
+#endif
 			return TRUE;
 
 		case IDC_FP_HASH_ALG_MD5:

Modified: trunk/ttssh2/ttxssh/key.c
===================================================================
--- trunk/ttssh2/ttxssh/key.c	2019-04-08 17:11:49 UTC (rev 7559)
+++ trunk/ttssh2/ttxssh/key.c	2019-04-08 17:12:02 UTC (rev 7560)
@@ -27,6 +27,7 @@
  */
 #include "key.h"
 #include "resource.h"
+#include "dlglib.h"
 
 #include <openssl/rsa.h>
 #include <openssl/dsa.h>
@@ -33,6 +34,13 @@
 #include <openssl/ecdsa.h>
 #include <openssl/buffer.h>
 
+#undef DialogBoxParam
+#define DialogBoxParam(p1,p2,p3,p4,p5) \
+	TTDialogBoxParam(p1,p2,p3,p4,p5)
+#undef EndDialog
+#define EndDialog(p1,p2) \
+	TTEndDialog(p1, p2)
+
 #define INTBLOB_LEN 20
 #define SIGBLOB_LEN (2*INTBLOB_LEN)
 
@@ -2188,10 +2196,10 @@
 
 static BOOL CALLBACK hosts_updatekey_dlg_proc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
-	static HFONT DlgHostsAddFont;
+//	static HFONT DlgHostsAddFont;
 	PTInstVar pvar;
-	LOGFONT logfont;
-	HFONT font;
+//	LOGFONT logfont;
+//	HFONT font;
 	char buf[1024];
 	char *host;
 	struct hostkeys_update_ctx *ctx;
@@ -2239,7 +2247,7 @@
 		GetDlgItemText(dlg, IDCANCEL, uimsg, sizeof(uimsg));
 		UTIL_get_lang_msg("BTN_NO", pvar, uimsg);
 		SetDlgItemText(dlg, IDCANCEL, pvar->ts->UIMsg);
-
+#if 0
 		font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
 		GetObject(font, sizeof(LOGFONT), &logfont);
 		if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgHostsAddFont, pvar)) {
@@ -2257,7 +2265,7 @@
 		else {
 			DlgHostsAddFont = NULL;
 		}
-
+#endif
 		return TRUE;			/* because we do not set the focus */
 
 	case WM_COMMAND:
@@ -2267,20 +2275,20 @@
 		case IDOK:
 
 			EndDialog(dlg, 1);
-
+#if 0
 			if (DlgHostsAddFont != NULL) {
 				DeleteObject(DlgHostsAddFont);
 			}
-
+#endif
 			return TRUE;
 
 		case IDCANCEL:			/* kill the connection */
 			EndDialog(dlg, 0);
-
+#if 0
 			if (DlgHostsAddFont != NULL) {
 				DeleteObject(DlgHostsAddFont);
 			}
-
+#endif
 			return TRUE;
 
 		case IDC_FP_HASH_ALG_MD5:

Modified: trunk/ttssh2/ttxssh/ssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ssh.c	2019-04-08 17:11:49 UTC (rev 7559)
+++ trunk/ttssh2/ttxssh/ssh.c	2019-04-08 17:12:02 UTC (rev 7560)
@@ -54,6 +54,7 @@
 #include "fwd.h"
 #include "sftp.h"
 #include "kex.h"
+#include "dlglib.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -7350,9 +7351,9 @@
 	char new_passwd[PASSWD_MAXLEN];
 	char retype_passwd[PASSWD_MAXLEN];
 	static struct change_password *cp;
-	LOGFONT logfont;
-	HFONT font;
-	static HFONT DlgChgPassFont;
+//	LOGFONT logfont;
+//	HFONT font;
+//	static HFONT DlgChgPassFont;
 	char uimsg[MAX_UIMSG];
 	static PTInstVar pvar;
 
@@ -7362,6 +7363,7 @@
 		cp = (struct change_password *)lParam;
 		pvar = cp->pvar;
 
+#if 0
 		font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
 		GetObject(font, sizeof(LOGFONT), &logfont);
 
@@ -7371,6 +7373,7 @@
 		else {
 			DlgChgPassFont = NULL;
 		}
+#endif
 
 		GetWindowText(dlg, uimsg, sizeof(uimsg));
 		UTIL_get_lang_msg("DLG_PASSCHG_TITLE", pvar, uimsg);
@@ -7420,12 +7423,12 @@
 			strncpy_s(cp->new_passwd, sizeof(cp->new_passwd), new_passwd, _TRUNCATE);
 
 			EndDialog(dlg, 1); // dialog close
-
+#if 0
 			if (DlgChgPassFont != NULL) {
 				DeleteObject(DlgChgPassFont);
 				DlgChgPassFont = NULL;
 			}
-
+#endif
 			return TRUE;
 
 		case IDCANCEL:
@@ -7432,12 +7435,12 @@
 			// \x90ڑ\xB1\x82\xF0\x90؂\xE9
                         notify_closed_connection(pvar, "authentication cancelled");
 			EndDialog(dlg, 0); // dialog close
-
+#if 0
 			if (DlgChgPassFont != NULL) {
 				DeleteObject(DlgChgPassFont);
 				DlgChgPassFont = NULL;
 			}
-
+#endif
 			return TRUE;
 		}
 	}
@@ -8196,6 +8199,8 @@
 		return 0;
 }
 
+/* dlglib \x82ɑS\x82\xAD\x93\xAF\x82\xB6\x82\xE0\x82̂\xAA\x82\xA0\x82\xE9\x82̂ł\xBB\x82\xBF\x82\xE7\x82𗘗p\x82\xB7\x82\xE9 */
+#if 0
 void InitDlgProgress(HWND HDlg, int id_Progress, int *CurProgStat) {
 	HWND HProg;
 	HProg = GetDlgItem(HDlg, id_Progress);
@@ -8208,6 +8213,7 @@
 
 	return;
 }
+#endif
 
 static unsigned __stdcall ssh_scp_thread(void *p)
 {

Modified: trunk/ttssh2/ttxssh/ttxssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.c	2019-04-08 17:11:49 UTC (rev 7559)
+++ trunk/ttssh2/ttxssh/ttxssh.c	2019-04-08 17:12:02 UTC (rev 7560)
@@ -76,6 +76,7 @@
 #include "buffer.h"
 #include "cipher.h"
 #include "key.h"
+#include "dlglib.h"
 
 #include "sftp.h"
 
@@ -84,6 +85,13 @@
 
 #include "libputty.h"
 
+#undef DialogBoxParam
+#define DialogBoxParam(p1,p2,p3,p4,p5) \
+	TTDialogBoxParam(p1,p2,p3,p4,p5)
+#undef EndDialog
+#define EndDialog(p1,p2) \
+	TTEndDialog(p1, p2)
+
 #define MATCH_STR(s, o) strncmp((s), (o), NUM_ELEM(o) - 1)
 #define MATCH_STR_I(s, o) _strnicmp((s), (o), NUM_ELEM(o) - 1)
 
@@ -96,11 +104,11 @@
 static HICON SecureNotifyIcon = NULL;
 static HICON OldNotifyIcon = NULL;
 
-static HFONT DlgHostFont;
-static HFONT DlgAboutFont;
+//static HFONT DlgHostFont;
+//static HFONT DlgAboutFont;
 static HFONT DlgAboutTextFont;
-static HFONT DlgSetupFont;
-static HFONT DlgKeygenFont;
+//static HFONT DlgSetupFont;
+//static HFONT DlgKeygenFont;
 
 static TInstVar *pvar;
 
@@ -1249,8 +1257,8 @@
 	static char *ComPortDesc[MAXCOMPORT];
 	int comports;
 	BOOL Ok;
-	LOGFONT logfont;
-	HFONT font;
+//	LOGFONT logfont;
+//	HFONT font;
 	char uimsg[MAX_UIMSG];
 	static HWND hwndHostname     = NULL; // HOSTNAME dropdown
 	static HWND hwndHostnameEdit = NULL; // Edit control on HOSTNAME dropdown
@@ -1454,6 +1462,7 @@
 			SetFocus(hwnd);
 		}
 
+#if 0
 		font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
 		GetObject(font, sizeof(LOGFONT), &logfont);
 		if (UTIL_get_lang_font("DLG_SYSTEM_FONT", dlg, &logfont, &DlgHostFont, pvar)) {
@@ -1481,7 +1490,8 @@
 		else {
 			DlgHostFont = NULL;
 		}
-
+#endif
+		
 		// SetFocus()\x82Ńt\x83H\x81[\x83J\x83X\x82\xF0\x82\xA0\x82킹\x82\xBD\x8Fꍇ\x81AFALSE\x82\xF0\x95Ԃ\xB7\x95K\x97v\x82\xAA\x82\xA0\x82\xE9\x81B
 		// TRUE\x82\xF0\x95Ԃ\xB7\x82ƁATABSTOP\x91Ώۂ̈\xEA\x94Ԃ͂\xB6\x82߂̃R\x83\x93\x83g\x83\x8D\x81[\x83\x8B\x82\xAA\x91I\x82΂\xEA\x82\xE9\x81B
 		// (2004.11.23 yutaka)
@@ -1559,21 +1569,21 @@
 			}
 			SetWindowLong(hwndHostnameEdit, GWL_WNDPROC, (LONG)OrigHostnameEditProc);
 			EndDialog(dlg, 1);
-
+#if 0
 			if (DlgHostFont != NULL) {
 				DeleteObject(DlgHostFont);
 			}
-
+#endif
 			return TRUE;
 
 		case IDCANCEL:
 			SetWindowLong(hwndHostnameEdit, GWL_WNDPROC, (LONG)OrigHostnameEditProc);
 			EndDialog(dlg, 0);
-
+#if 0
 			if (DlgHostFont != NULL) {
 				DeleteObject(DlgHostFont);
 			}
-
+#endif
 			return TRUE;
 
 		case IDC_HOSTTCPIP:
@@ -1657,10 +1667,16 @@
 	return FALSE;
 }
 
+static void UTIL_SetDialogFont()
+{
+	SetDialogFont(pvar->ts->SetupFName, pvar->ts->UILanguageFile, "TTSSH");
+}
+
 static BOOL PASCAL TTXGetHostName(HWND parent, PGetHNRec rec)
 {
+	UTIL_SetDialogFont();
 	return (BOOL) DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HOSTDLG),
-	                             parent, TTXHostDlg, (LONG) rec);
+	                             parent, TTXHostDlg, (LPARAM)rec);
 }
 
 static void PASCAL TTXGetUIHooks(TTXUIHooks *hooks)
@@ -2459,11 +2475,12 @@
 static BOOL CALLBACK TTXAboutDlg(HWND dlg, UINT msg, WPARAM wParam,
                                  LPARAM lParam)
 {
-	LOGFONT logfont;
-	HFONT font;
+//	LOGFONTA logfont;
+//	HFONT font;
 
 	switch (msg) {
 	case WM_INITDIALOG:
+#if 0
 		font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
 		GetObject(font, sizeof(LOGFONT), &logfont);
 		if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgAboutFont, pvar)) {
@@ -2484,26 +2501,24 @@
 		else {
 			DlgAboutFont = NULL;
 		}
+#endif
 
 		// Edit control\x82͓\x99\x95\x9D\x83t\x83H\x83\x93\x83g\x82ŕ\\x8E\xA6\x82\xB5\x82\xBD\x82\xA2\x82̂ŁA\x95ʐݒ\xE8\x8F\xEE\x95񂩂\xE7\x83t\x83H\x83\x93\x83g\x82\xF0\x83Z\x83b\x83g\x82\xB7\x82\xE9\x81B
 		// (2014.5.5. yutaka)
-		if (UTIL_get_lang_font("DLG_ABOUT_FONT", dlg, &logfont, &DlgAboutTextFont, pvar)) {
-			SendDlgItemMessage(dlg, IDC_ABOUTTEXT, WM_SETFONT, (WPARAM)DlgAboutTextFont, MAKELPARAM(TRUE,0));
-		} else {
+		if (!UTIL_get_lang_font("DLG_ABOUT_FONT", dlg, NULL, &DlgAboutTextFont, pvar)) {
 			// \x93ǂݍ\x9E\x82߂Ȃ\xA9\x82\xC1\x82\xBD\x8Fꍇ\x82͓\x99\x95\x9D\x83t\x83H\x83\x93\x83g\x82\xF0\x8Ew\x92肷\x82\xE9\x81B
 			// \x83G\x83f\x83B\x83b\x83g\x83R\x83\x93\x83g\x83\x8D\x81[\x83\x8B\x82̓_\x83C\x83A\x83\x8D\x83O\x82Ɠ\xAF\x82\xB6\x83t\x83H\x83\x93\x83g\x82\xF0\x8E\x9D\x82\xC1\x82Ă\xA8\x82\xE8
 			// \x93\x99\x95\x9D\x83t\x83H\x83\x93\x83g\x82ł͂Ȃ\xA2\x82\xBD\x82߁B
+			LOGFONTA logfont = {0};
 			strncpy_s(logfont.lfFaceName, sizeof(logfont.lfFaceName), "Courier New", _TRUNCATE);
 			logfont.lfCharSet = 0;
 			logfont.lfHeight = MulDiv(8, GetDeviceCaps(GetDC(dlg),LOGPIXELSY) * -1, 72);
 			logfont.lfWidth = 0;
-			if ((DlgAboutTextFont = CreateFontIndirect(&logfont)) != NULL) {
-				SendDlgItemMessage(dlg, IDC_ABOUTTEXT, WM_SETFONT, (WPARAM)DlgAboutTextFont, MAKELPARAM(TRUE,0));
-			}
-			else {
-				DlgAboutTextFont = NULL;
-			}
+			DlgAboutTextFont = CreateFontIndirect(&logfont);	// \x83G\x83\x89\x81[\x8E\x9E NULL
 		}
+		if (DlgAboutTextFont != NULL) {
+			SendDlgItemMessage(dlg, IDC_ABOUTTEXT, WM_SETFONT, (WPARAM)DlgAboutTextFont, MAKELPARAM(TRUE,0));
+		}
 
 		// \x83A\x83C\x83R\x83\x93\x82𓮓I\x82ɃZ\x83b\x83g
 		{
@@ -2534,9 +2549,11 @@
 		switch (LOWORD(wParam)) {
 		case IDOK:
 			EndDialog(dlg, 1);
+#if 0
 			if (DlgAboutFont != NULL) {
 				DeleteObject(DlgAboutFont);
 			}
+#endif
 			if (DlgAboutTextFont != NULL) {
 				DeleteObject(DlgAboutTextFont);
 			}
@@ -2544,9 +2561,11 @@
 		case IDCANCEL:			/* there isn't a cancel button, but other Windows
 								   UI things can send this message */
 			EndDialog(dlg, 0);
+#if 0
 			if (DlgAboutFont != NULL) {
 				DeleteObject(DlgAboutFont);
 			}
+#endif
 			if (DlgAboutTextFont != NULL) {
 				DeleteObject(DlgAboutTextFont);
 			}
@@ -3299,14 +3318,14 @@
 static BOOL CALLBACK TTXSetupDlg(HWND dlg, UINT msg, WPARAM wParam,
                                  LPARAM lParam)
 {
-	LOGFONT logfont;
-	HFONT font;
+//	LOGFONT logfont;
+//	HFONT font;
 
 	switch (msg) {
 	case WM_INITDIALOG:
 		SetWindowLong(dlg, DWL_USER, lParam);
 		init_setup_dlg((PTInstVar) lParam, dlg);
-
+#if 0
 		font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
 		GetObject(font, sizeof(LOGFONT), &logfont);
 		if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgSetupFont, pvar)) {
@@ -3363,7 +3382,7 @@
 		else {
 			DlgSetupFont = NULL;
 		}
-
+#endif
 		return TRUE;
 	case WM_COMMAND:
 		switch (LOWORD(wParam)) {
@@ -3370,16 +3389,20 @@
 		case IDOK:
 			complete_setup_dlg((PTInstVar) GetWindowLong(dlg, DWL_USER), dlg);
 			EndDialog(dlg, 1);
+#if 0
 			if (DlgSetupFont != NULL) {
 				DeleteObject(DlgSetupFont);
 			}
+#endif
 			return TRUE;
 		case IDCANCEL:			/* there isn't a cancel button, but other Windows
 								   UI things can send this message */
 			EndDialog(dlg, 0);
+#if 0
 			if (DlgSetupFont != NULL) {
 				DeleteObject(DlgSetupFont);
 			}
+#endif
 			return TRUE;
 		// Cipher order
 		case IDC_SSHMOVECIPHERUP:
@@ -4298,8 +4321,8 @@
 	static ssh_keytype key_type;
 	static int saved_key_bits;
 	char uimsg[MAX_UIMSG];
-	LOGFONT logfont;
-	HFONT font;
+//	LOGFONT logfont;
+//	HFONT font;
 
 	switch (msg) {
 	case WM_INITDIALOG:
@@ -4340,7 +4363,7 @@
 		GetDlgItemText(dlg, IDC_BCRYPT_KDF_ROUNDS_LABEL, uimsg, sizeof(uimsg));
 		UTIL_get_lang_msg("DLG_KEYGEN_BCRYPT_ROUNDS", pvar, uimsg);
 		SetDlgItemText(dlg, IDC_BCRYPT_KDF_ROUNDS_LABEL, pvar->ts->UIMsg);
-
+#if 0
 		font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
 		GetObject(font, sizeof(LOGFONT), &logfont);
 		if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgKeygenFont, pvar)) {
@@ -4372,6 +4395,7 @@
 		else {
 			DlgHostFont = NULL;
 		}
+#endif
 
 		init_password_control(dlg, IDC_KEY_EDIT);
 		init_password_control(dlg, IDC_CONFIRM_EDIT);
@@ -4529,9 +4553,11 @@
 			// don't forget to free SSH resource!
 			free_ssh_key();
 			EndDialog(dlg, 0); // dialog close
+#if 0
 			if (DlgKeygenFont != NULL) {
 				DeleteObject(DlgKeygenFont);
 			}
+#endif
 			return TRUE;
 
 		// if radio button pressed...

Modified: trunk/ttssh2/ttxssh/util.c
===================================================================
--- trunk/ttssh2/ttxssh/util.c	2019-04-08 17:11:49 UTC (rev 7559)
+++ trunk/ttssh2/ttxssh/util.c	2019-04-08 17:12:02 UTC (rev 7560)
@@ -322,6 +322,10 @@
 
 int UTIL_get_lang_font(PCHAR key, HWND dlg, PLOGFONT logfont, HFONT *font, PTInstVar pvar)
 {
+	LOGFONT logfont_tmp;
+	if (logfont == NULL) {
+		logfont = &logfont_tmp;
+	}
 	if (GetI18nLogfont("TTSSH", key, logfont,
 					   GetDeviceCaps(GetDC(dlg),LOGPIXELSY),
 					   pvar->ts->UILanguageFile) == FALSE) {


Ttssh2-commit メーリングリストの案内
アーカイブの一覧に戻る