[Ttssh2-commit] [7589] 従来の設定のダイアログフォントを設定を使ってダイアログを表示するようにした

scmno****@osdn***** scmno****@osdn*****
2019年 4月 14日 (日) 01:40:46 JST


Revision: 7589
          https://osdn.net/projects/ttssh2/scm/svn/commits/7589
Author:   zmatsuo
Date:     2019-04-14 01:40:46 +0900 (Sun, 14 Apr 2019)
Log Message:
-----------
従来の設定のダイアログフォントを設定を使ってダイアログを表示するようにした
lngの各セクションのDLG_SYSTEM_FONT,DLG_TAHOMA_FONT等を参照する
新たにダイアログフォントの設定を行うと、その後はその設定で表示される
新し設定はteraterm.iniの[Tera Term]セクションのDlgFont

Modified Paths:
--------------
    trunk/TTProxy/TTProxy.h
    trunk/TTXSamples/TTXRecurringCommand/TTXRecurringCommand.c
    trunk/teraterm/common/dlglib.h
    trunk/teraterm/common/dlglib_cpp.cpp
    trunk/teraterm/teraterm/tekwin.cpp
    trunk/teraterm/teraterm/teraterm.cpp
    trunk/teraterm/teraterm/vtwin.cpp
    trunk/teraterm/ttpmacro/ttmacro.cpp
    trunk/ttssh2/ttxssh/ttxssh.c

-------------- next part --------------
Modified: trunk/TTProxy/TTProxy.h
===================================================================
--- trunk/TTProxy/TTProxy.h	2019-04-12 16:19:30 UTC (rev 7588)
+++ trunk/TTProxy/TTProxy.h	2019-04-13 16:40:46 UTC (rev 7589)
@@ -251,7 +251,7 @@
 			copy_UILanguageFile();
 			SetDialogFont(getInstance().ts->SetupFName,
 						  getInstance().ts->UILanguageFile,
-						  "TTProxy");
+						  "TTProxy", "DLG_TAHOMA_FONT");
 			ProxyWSockHook::aboutDialog(hWin);
 			return 1;
 		case ID_PROXYSETUPMENU:
@@ -258,7 +258,7 @@
 			copy_UILanguageFile();
 			SetDialogFont(getInstance().ts->SetupFName,
 						  getInstance().ts->UILanguageFile,
-						  "TTProxy");
+						  "TTProxy", "DLG_TAHOMA_FONT");
 			ProxyWSockHook::setupDialog(hWin);
 			return 1;
 		case ID_ASYNCMESSAGEBOX:

Modified: trunk/TTXSamples/TTXRecurringCommand/TTXRecurringCommand.c
===================================================================
--- trunk/TTXSamples/TTXRecurringCommand/TTXRecurringCommand.c	2019-04-12 16:19:30 UTC (rev 7588)
+++ trunk/TTXSamples/TTXRecurringCommand/TTXRecurringCommand.c	2019-04-13 16:40:46 UTC (rev 7589)
@@ -580,9 +580,9 @@
 static int PASCAL TTXProcessCommand(HWND hWin, WORD cmd) {
 	switch (cmd) {
 	  case ID_MENU_SETUP:
-		  SetDialogFont(pvar->ts->SetupFName,
-						pvar->ts->UILanguageFile,
-						SECTION);
+		SetDialogFont(pvar->ts->SetupFName,
+					  pvar->ts->UILanguageFile,
+					  SECTION, "DLG_TAHOMA_FONT");
 		switch (TTDialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SETUP_RECURRINGCOMMAND),
 								 hWin, RecurringCommandSetting, (LPARAM)NULL)) {
 		  case IDOK:

Modified: trunk/teraterm/common/dlglib.h
===================================================================
--- trunk/teraterm/common/dlglib.h	2019-04-12 16:19:30 UTC (rev 7588)
+++ trunk/teraterm/common/dlglib.h	2019-04-13 16:40:46 UTC (rev 7589)
@@ -87,7 +87,8 @@
 	LPCTSTR lpTemplateName,
 	HWND hWndParent,
 	DLGPROC lpDialogFunc);
-void SetDialogFont(const char *SetupFName, const char *UILanguageFile, const char *Section);
+void SetDialogFont(const char *SetupFName,
+				   const char *UILanguageFile, const char *Section, const char *Key);
 HFONT SetDlgFonts(HWND hDlg, const int nIDDlgItems[], int nIDDlgItemCount,
 				  const char *UILanguageFile, PCHAR key);
 BOOL IsExistFontA(const char *face, BYTE charset, BOOL strict);

Modified: trunk/teraterm/common/dlglib_cpp.cpp
===================================================================
--- trunk/teraterm/common/dlglib_cpp.cpp	2019-04-12 16:19:30 UTC (rev 7588)
+++ trunk/teraterm/common/dlglib_cpp.cpp	2019-04-13 16:40:46 UTC (rev 7589)
@@ -253,12 +253,13 @@
  *	\x8Eg\x97p\x82\xB7\x82\xE9\x83_\x83C\x83A\x83\x8D\x83O\x83t\x83H\x83\x93\x83g\x82\xF0\x8C\x88\x92肷\x82\xE9
  */
 void SetDialogFont(const char *SetupFName,
-				   const char *UILanguageFile, const char *Section)
+				   const char *UILanguageFile, const char *Section, const char *Key)
 {
+	LOGFONTA logfont;
+	BOOL result;
+
 	// teraterm.ini\x82̎w\x92\xE8
 	if (SetupFName != NULL) {
-		LOGFONTA logfont;
-		BOOL result;
 		result = GetI18nLogfont("Tera Term", "DlgFont", &logfont, 0, SetupFName);
 		if (result == TRUE) {
 			result = IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, TRUE);
@@ -270,60 +271,30 @@
 	}
 
 	// .lng\x82̎w\x92\xE8
-	if (UILanguageFile != NULL) {
+	if (UILanguageFile != NULL && Section != NULL && Key != NULL) {
+#if 0
 		static const char *dlg_font_keys[] = {
 			"DLG_FONT",
 			"DLG_TAHOMA_FONT",
 			"DLG_SYSTEM_FONT",
 		};
-		BOOL result = FALSE;
-		LOGFONTA logfont;
-		size_t i;
-		if (Section != NULL) {
-			for (i = 0; i < _countof(dlg_font_keys); i++) {
-				result = GetI18nLogfont(Section, dlg_font_keys[i], &logfont, 0, UILanguageFile);
-				if (result == FALSE) {
-					continue;
-				}
-				if (logfont.lfFaceName[0] == '\0') {
-					break;
-				}
-				if (IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, TRUE)) {
-					break;
-				}
+#endif
+		result = GetI18nLogfont(Section, Key, &logfont, 0, UILanguageFile);
+		if (result == TRUE) {
+			if (IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, TRUE)) {
+				TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet);
+				return;
 			}
 		}
-		if (result == FALSE) {
-			for (i = 0; i < _countof(dlg_font_keys); i++) {
-				result = GetI18nLogfont("Tera Term", dlg_font_keys[i], &logfont, 0, UILanguageFile);
-				if (result == FALSE) {
-					continue;
-				}
-				if (logfont.lfFaceName[0] == '\0') {
-					break;
-				}
-				if (IsExistFontA(logfont.lfFaceName, logfont.lfCharSet, TRUE)) {
-					break;
-				}
-			}
-		}
-		if (result == TRUE) {
-			TTSetDlgFontA(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet);
-			return;
-		}
 	}
 
 	// ini,lng\x82Ŏw\x92肳\x82ꂽ\x83t\x83H\x83\x93\x83g\x82\xAA\x8C\xA9\x82‚\xA9\x82\xE7\x82Ȃ\xA9\x82\xC1\x82\xBD\x82Ƃ\xAB\x81A
-	// \x95\xB6\x8E\x9A\x89\xBB\x82\xAF\x82Ő\xB3\x82\xB5\x82\xAD\x95\\x8E\xA6\x82\xB3\x82\xEA\x82Ȃ\xA2\x8E\x96\x91ԂƂȂ\xE9
 	// messagebox()\x82̃t\x83H\x83\x93\x83g\x82\xF0\x82Ƃ肠\x82\xA6\x82\xB8\x91I\x91\xF0\x82\xB5\x82Ă\xA8\x82\xAD
-	{
-		LOGFONT logfont;
-		GetMessageboxFont(&logfont);
-		if (logfont.lfHeight < 0) {
-			logfont.lfHeight = GetFontPointFromPixel(NULL, -logfont.lfHeight);
-		}
-		TTSetDlgFont(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet);
+	GetMessageboxFont(&logfont);
+	if (logfont.lfHeight < 0) {
+		logfont.lfHeight = GetFontPointFromPixel(NULL, -logfont.lfHeight);
 	}
+	TTSetDlgFont(logfont.lfFaceName, logfont.lfHeight, logfont.lfCharSet);
 }
 
 

Modified: trunk/teraterm/teraterm/tekwin.cpp
===================================================================
--- trunk/teraterm/teraterm/tekwin.cpp	2019-04-12 16:19:30 UTC (rev 7588)
+++ trunk/teraterm/teraterm/tekwin.cpp	2019-04-13 16:40:46 UTC (rev 7589)
@@ -789,6 +789,8 @@
 		return;
 	}
 	OldEmu = ts.TEKColorEmu;
+	SetDialogFont(ts.SetupFName,
+				  ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
 	Ok = (*SetupWin)(HTEKWin, &ts);
 	FreeTTDLG();
 	if (Ok) {
@@ -830,6 +832,8 @@
 	if (! LoadTTDLG()) {
 		return;
 	}
+	SetDialogFont(ts.SetupFName,
+				  ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
 	(*WindowWindow)(HTEKWin,&Close);
 	FreeTTDLG();
 	if (Close) {

Modified: trunk/teraterm/teraterm/teraterm.cpp
===================================================================
--- trunk/teraterm/teraterm/teraterm.cpp	2019-04-12 16:19:30 UTC (rev 7588)
+++ trunk/teraterm/teraterm/teraterm.cpp	2019-04-13 16:40:46 UTC (rev 7589)
@@ -289,9 +289,8 @@
 	CVTWindow *m_pMainWnd = new CVTWindow();
 	pVTWin = m_pMainWnd;
 	main_window = m_pMainWnd->m_hWnd;
-	// [Tera Term]\x83Z\x83N\x83V\x83\x87\x83\x93\x82\xCCDlgFont=\x82\xAA\x82Ȃ\xA2\x8Fꍇ\x82\xCD
-	// [TTSSH]\x83Z\x83N\x83V\x83\x87\x83\x93\x82̃t\x83H\x83\x93\x83g\x90ݒ\xE8\x82\xF0\x8Eg\x97p\x82\xB7\x82\xE9
-	SetDialogFont(ts.SetupFName, ts.UILanguageFile, "TTSSH");
+	// [Tera Term]\x83Z\x83N\x83V\x83\x87\x83\x93\x82\xCCDLG_SYSTEM_FONT\x82\xF0\x82Ƃ肠\x82\xA6\x82\xB8\x83Z\x83b\x83g\x82\xB7\x82\xE9
+	SetDialogFont(ts.SetupFName, ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
 
 	MSG msg;
 	while (GetMessage(&msg, NULL, 0, 0)) {

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2019-04-12 16:19:30 UTC (rev 7588)
+++ trunk/teraterm/teraterm/vtwin.cpp	2019-04-13 16:40:46 UTC (rev 7589)
@@ -57,6 +57,7 @@
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #include "ttplug.h"  /* TTPLUG */
+#include "teraterml.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -2231,6 +2232,8 @@
 		if (!DoSameProcess) {
 			bool DoSameProcessNextDrop;
 			bool DoNotShowDialog = !DefaultShowDialog;
+			SetDialogFont(ts.SetupFName,
+						  ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
 			DropType =
 				ShowDropDialogBox(hInst, HVTWin,
 								  FileName, DropType,
@@ -3885,6 +3888,8 @@
 		return;
 	}
 
+	SetDialogFont(ts.SetupFName,
+				  ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
 	if ((*GetHostName)(HVTWin,&GetHNRec)) {
 		if ((GetHNRec.PortType==IdTCPIP) && LoadTTSET()) {
 			if (ts.HistoryList) {
@@ -4441,6 +4446,8 @@
 	if (! LoadTTDLG()) {
 		return;
 	}
+	SetDialogFont(ts.SetupFName,
+				  ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
 	(*ChangeDirectory)(HVTWin,ts.FileDir);
 	FreeTTDLG();
 }
@@ -4577,6 +4584,8 @@
 {
 	DWORD ret;
 
+	SetDialogFont(ts.SetupFName,
+				  ts.UILanguageFile, "Tera Term", "DLG_TAHOMA_FONT");
 	CAddSettingPropSheetDlg CAddSetting(hInst, _T("Tera Term: Additional settings"), HVTWin);
 	ret = CAddSetting.DoModal();
 	switch (ret) {
@@ -4628,6 +4637,8 @@
 	if (! LoadTTDLG()) {
 		return;
 	}
+	SetDialogFont(ts.SetupFName,
+				  ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
 	Ok = (*SetupTerminal)(HVTWin, &ts);
 	FreeTTDLG();
 	if (Ok) {
@@ -4648,6 +4659,8 @@
 		return;
 	}
 
+	SetDialogFont(ts.SetupFName,
+				  ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
 	strncpy_s(orgTitle, sizeof(orgTitle), ts.Title, _TRUNCATE);
 	Ok = (*SetupWin)(HVTWin, &ts);
 	FreeTTDLG();
@@ -4728,8 +4741,6 @@
 					font_point,
 					LogFont.lfCharSet);
 		WritePrivateProfileStringA("Tera Term", "DlgFont", Temp, ts.SetupFName);
-
-		SetDialogFont(ts.SetupFName, ts.UILanguageFile, "TTSSH");
 	}
 }
 
@@ -4746,6 +4757,8 @@
 	if (! LoadTTDLG()) {
 		return;
 	}
+	SetDialogFont(ts.SetupFName,
+				  ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
 	Ok = (*SetupKeyboard)(HVTWin, &ts);
 	FreeTTDLG();
 
@@ -4763,6 +4776,8 @@
 	if (! LoadTTDLG()) {
 		return;
 	}
+	SetDialogFont(ts.SetupFName,
+				  ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
 	Ok = (*SetupSerialPort)(HVTWin, &ts);
 	FreeTTDLG();
 
@@ -4788,6 +4803,8 @@
 	if (! LoadTTDLG()) {
 		return;
 	}
+	SetDialogFont(ts.SetupFName,
+				  ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
 	if ((*SetupTCPIP)(HVTWin, &ts)) {
 		TelUpdateKeepAliveInterval();
 	}
@@ -4800,6 +4817,8 @@
 	if (! LoadTTDLG()) {
 		return;
 	}
+	SetDialogFont(ts.SetupFName,
+				  ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
 	if ((*SetupGeneral)(HVTWin,&ts)) {
 		ResetCharSet();
 		ResetIME();
@@ -6184,6 +6203,8 @@
 	if (! LoadTTDLG()) {
 		return;
 	}
+	SetDialogFont(ts.SetupFName,
+				  ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
 	(*WindowWindow)(HVTWin,&Close);
 	FreeTTDLG();
 	if (Close) {
@@ -6231,6 +6252,8 @@
 	if (! LoadTTDLG()) {
 		return;
 	}
+	SetDialogFont(ts.SetupFName,
+				  ts.UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
 	(*AboutDialog)(HVTWin);
 	FreeTTDLG();
 }

Modified: trunk/teraterm/ttpmacro/ttmacro.cpp
===================================================================
--- trunk/teraterm/ttpmacro/ttmacro.cpp	2019-04-12 16:19:30 UTC (rev 7588)
+++ trunk/teraterm/ttpmacro/ttmacro.cpp	2019-04-13 16:40:46 UTC (rev 7589)
@@ -78,7 +78,7 @@
 		pSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
 	}
 	// messagebox\x82̃t\x83H\x83\x93\x83g\x82ɐݒ肷\x82\xE9
-	SetDialogFont(NULL, NULL, NULL);
+	SetDialogFont(NULL, NULL, NULL, NULL);
 }
 
 // TTMACRO main engine

Modified: trunk/ttssh2/ttxssh/ttxssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.c	2019-04-12 16:19:30 UTC (rev 7588)
+++ trunk/ttssh2/ttxssh/ttxssh.c	2019-04-13 16:40:46 UTC (rev 7589)
@@ -1669,12 +1669,13 @@
 
 static void UTIL_SetDialogFont()
 {
-	SetDialogFont(pvar->ts->SetupFName, pvar->ts->UILanguageFile, "TTSSH");
+	SetDialogFont(pvar->ts->SetupFName, pvar->ts->UILanguageFile, "TTSSH", "DLG_TAHOMA_FONT");
 }
 
 static BOOL PASCAL TTXGetHostName(HWND parent, PGetHNRec rec)
 {
-	UTIL_SetDialogFont();
+	SetDialogFont(pvar->ts->SetupFName,
+				  pvar->ts->UILanguageFile, "TTSSH", "DLG_SYSTEM_FONT");
 	return (BOOL) DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HOSTDLG),
 	                             parent, TTXHostDlg, (LPARAM)rec);
 }


Ttssh2-commit メーリングリストの案内