[Ttssh2-commit] [7663] teraterm.iniのからダイアログフォントの設定と高DPIの設定を読み込むようにした

scmno****@osdn***** scmno****@osdn*****
2019年 5月 12日 (日) 21:19:46 JST


Revision: 7663
          https://osdn.net/projects/ttssh2/scm/svn/commits/7663
Author:   zmatsuo
Date:     2019-05-12 21:19:46 +0900 (Sun, 12 May 2019)
Log Message:
-----------
teraterm.iniのからダイアログフォントの設定と高DPIの設定を読み込むようにした

Modified Paths:
--------------
    trunk/teraterm/ttpmacro/ttmacro.cpp

-------------- next part --------------
Modified: trunk/teraterm/ttpmacro/ttmacro.cpp
===================================================================
--- trunk/teraterm/ttpmacro/ttmacro.cpp	2019-05-10 16:04:40 UTC (rev 7662)
+++ trunk/teraterm/ttpmacro/ttmacro.cpp	2019-05-12 12:19:46 UTC (rev 7663)
@@ -54,6 +54,7 @@
 #endif
 
 char UILanguageFile[MAX_PATH];
+static char SetupFName[MAX_PATH];
 static HWND CtrlWnd;
 static HINSTANCE hInst;
 
@@ -70,16 +71,42 @@
 	return CtrlWnd;
 }
 
+static void GetDefaultSetupFName2(char *dest, int destlen)
+{
+	char HomeDir[MAX_PATH];
+	char Temp[MAX_PATH];
+
+	/* Get home directory */
+	if (GetModuleFileName(NULL,Temp,sizeof(Temp)) == 0) {
+		memset(dest, 0, destlen);
+		return;
+	}
+	ExtractDirName(Temp, HomeDir);
+
+	GetDefaultFName(HomeDir, "TERATERM.INI", dest, destlen);
+}
+
 static void init()
 {
+	GetDefaultSetupFName2(SetupFName, sizeof(SetupFName));
+	GetUILanguageFile(UILanguageFile, sizeof(UILanguageFile));
+
 	DLLInit();
 	WinCompatInit();
-	if (pSetThreadDpiAwarenessContext) {
-		pSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
+
+	// DPI Aware (\x8D\x82DPI\x91Ή\x9E)
+	{
+		int dip_aware = 0;
+		dip_aware = GetPrivateProfileInt("Tera Term", "DPIAware", dip_aware, SetupFName);
+		if (dip_aware != 0) {
+			if (pSetThreadDpiAwarenessContext != NULL) {
+				pSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
+			}
+		}
 	}
 
 	// UILanguageFile\x82\xCC "Tera Term" \x83Z\x83N\x83V\x83\x87\x83\x93 "DLG_SYSTEM_FONT" \x82̃t\x83H\x83\x93\x83g\x82ɐݒ肷\x82\xE9
-	SetDialogFont(NULL, UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
+	SetDialogFont(SetupFName, UILanguageFile, "Tera Term", "DLG_SYSTEM_FONT");
 }
 
 // TTMACRO main engine
@@ -114,7 +141,6 @@
 #endif
 
 //	InitCommonControls();
-	GetUILanguageFile(UILanguageFile, sizeof(UILanguageFile));
 	init();
 
 	Busy = TRUE;


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