Revision: 9959 https://osdn.net/projects/ttssh2/scm/svn/commits/9959 Author: zmatsuo Date: 2022-05-24 23:21:17 +0900 (Tue, 24 May 2022) Log Message: ----------- tttypes にテーマ関連のパスのUnicode版を追加 - BGImageFilePathW - EtermLookfeel.BGThemeFileW - EtermLookfeel.BGSPIPathW ticket #44048 Ticket Links: ------------ https://osdn.net/projects/ttssh2/tracker/detail/44048 Modified Paths: -------------- trunk/teraterm/common/teraterm.h trunk/teraterm/common/tttypes.h trunk/teraterm/teraterm/vtdisp.c -------------- next part -------------- Modified: trunk/teraterm/common/teraterm.h =================================================================== --- trunk/teraterm/common/teraterm.h 2022-05-24 14:21:07 UTC (rev 9958) +++ trunk/teraterm/common/teraterm.h 2022-05-24 14:21:17 UTC (rev 9959) @@ -59,12 +59,15 @@ // Eterm look-feel #define BG_SECTION "BG" +#define BG_SECTIONW L"BG" #define BG_DESTFILE "BGDestFile" +#define BG_DESTFILEW L"BGDestFile" #define BG_THEME_DIR L"theme" #define BG_THEME_IMAGEFILE "theme\\ImageFile.INI" #define BG_THEME_IMAGEFILE_DEFAULT "theme\\*.INI" #define BG_THEME_IMAGE_BRIGHTNESS_DEFAULT 64 #define BG_THEME_IMAGE_BRIGHTNESS1 "BGSrc1Alpha" +#define BG_THEME_IMAGE_BRIGHTNESS1W L"BGSrc1Alpha" #define BG_THEME_IMAGE_BRIGHTNESS2 "BGSrc2Alpha" #define BG_THEME_IMAGEFILE_NAME "ImageFile.INI" #define BG_THEME_THEMEFILE_SCALE "Scale.INI" Modified: trunk/teraterm/common/tttypes.h =================================================================== --- trunk/teraterm/common/tttypes.h 2022-05-24 14:21:07 UTC (rev 9958) +++ trunk/teraterm/common/tttypes.h 2022-05-24 14:21:17 UTC (rev 9959) @@ -330,6 +330,8 @@ char BGThemeFile[MAX_PATH]; int BGIgnoreThemeFile; char reserve[20]; + wchar_t *BGThemeFileW; + wchar_t *BGSPIPathW; } eterm_lookfeel_t; typedef struct cygterm { @@ -648,6 +650,7 @@ wchar_t *ExeDirW; // ttermpro.exe \x82̂\xA0\x82\xE9\x83t\x83H\x83\x8B\x83_ wchar_t *LogDirW; // log\x82\xE2\x83_\x83\x93\x83v\x82\xF0\x92u\x82\xAD\x83t\x83H\x83\x8B\x83_ wchar_t *FileDirW; // \x83_\x83E\x83\x93\x83\x8D\x81[\x83h\x83p\x83X("%APPDATA%" \x93\x99\x82\xAA\x8A܂܂\xEA\x82\xE9,\x8Eg\x97p\x91O\x82Ɋ\xAB\x95ϐ\x94\x82\xF0\x93W\x8AJ\x82\xB7\x82邱\x82\xC6) + wchar_t *BGImageFilePathW; wchar_t *LogDefaultPathW; // \x83\x8D\x83O\x83t\x83H\x83\x8B\x83_([file]/[log]\x83\x81\x83j\x83\x85\x81[\x82̃\x8D\x83O) }; Modified: trunk/teraterm/teraterm/vtdisp.c =================================================================== --- trunk/teraterm/teraterm/vtdisp.c 2022-05-24 14:21:07 UTC (rev 9958) +++ trunk/teraterm/teraterm/vtdisp.c 2022-05-24 14:21:17 UTC (rev 9959) @@ -42,6 +42,7 @@ #include "setting.h" #include "codeconv.h" #include "libsusieplugin.h" +#include "asprintf.h" #include "inifile_com.h" #include "win32helper.h" @@ -1370,12 +1371,10 @@ */ void BGInitialize(BOOL initialize_once) { - char path[MAX_PATH], config_file[MAX_PATH], tempPath[MAX_PATH]; - char BGSPIPath[MAX_PATH]; + char path[MAX_PATH]; + char config_file[MAX_PATH]; - ZeroMemory(path, sizeof(path)); ZeroMemory(config_file, sizeof(config_file)); - ZeroMemory(tempPath, sizeof(tempPath)); // VTColor \x82\xF0\x93ǂݍ\x9E\x82\xDD BGVTColor[0] = ts.VTColor[0]; @@ -1390,18 +1389,8 @@ BGVTReverseColor[0] = ts.VTReverseColor[0]; BGVTReverseColor[1] = ts.VTReverseColor[1]; -#if 1 - // \x83n\x83C\x83p\x81[\x83\x8A\x83\x93\x83N\x95`\x89\xE6\x82̕\x9C\x8A\x88\x81B(2009.8.26 yutaka) - /* begin - ishizaki */ BGURLColor[0] = ts.URLColor[0]; BGURLColor[1] = ts.URLColor[1]; - /* end - ishizaki */ -#else - // TODO: \x83n\x83C\x83p\x81[\x83\x8A\x83\x93\x83N\x82̕`\x89悪\x83\x8A\x83A\x83\x8B\x83^\x83C\x83\x80\x82ɍs\x82\xED\x82\xEA\x82Ȃ\xA2\x82\xB1\x82Ƃ\xAA\x82\xA0\x82\xE9\x82̂ŁA - // \x90F\x91\xAE\x90\xAB\x95ύX\x82͂\xA2\x82\xC1\x82\xBD\x82\xF1\x8E\xE6\x82\xE8\x82\xE2\x82߂邱\x82Ƃɂ\xB7\x82\xE9\x81B\x8F\xAB\x97\x88\x81A\x91Ή\x9E\x82\xB7\x82\xE9\x81B(2005.4.3 yutaka) - BGURLColor[0] = ts.VTColor[0]; - BGURLColor[1] = ts.VTColor[1]; -#endif // ANSI color\x90ݒ\xE8\x82̂ق\xA4\x82\xF0\x97D\x90悳\x82\xB9\x82\xE9 (2005.2.3 yutaka) InitColorTable(); @@ -1419,22 +1408,29 @@ BGEnable = BGGetOnOff("BGEnable", FALSE, ts.SetupFNameW); } - GetPrivateProfileString(BG_SECTION, "BGSPIPath", "plugin", BGSPIPath, MAX_PATH, ts.SetupFName); - strncpy_s(ts.EtermLookfeel.BGSPIPath, sizeof(ts.EtermLookfeel.BGSPIPath), BGSPIPath, _TRUNCATE); + hGetPrivateProfileStringW(BG_SECTIONW, L"BGSPIPath", L"plugin", ts.SetupFNameW, &ts.EtermLookfeel.BGSPIPathW); + WideCharToACP_t(ts.EtermLookfeel.BGSPIPathW, ts.EtermLookfeel.BGSPIPath, sizeof(ts.EtermLookfeel.BGSPIPath)); if (ts.EtermLookfeel.BGThemeFile[0] == '\0') { - //\x83R\x83\x93\x83t\x83B\x83O\x83t\x83@\x83C\x83\x8B\x82̌\x88\x92\xE8 - GetPrivateProfileString(BG_SECTION, "BGThemeFile", "", path, MAX_PATH, ts.SetupFName); - strncpy_s(ts.EtermLookfeel.BGThemeFile, sizeof(ts.EtermLookfeel.BGThemeFile), path, _TRUNCATE); + wchar_t *theme_imagefile; + //\x83R\x83\x93\x83t\x83B\x83O\x83t\x83@\x83C\x83\x8B(\x83e\x81[\x83}\x83t\x83@\x83C\x83\x8B)\x82̌\x88\x92\xE8 + hGetPrivateProfileStringW(BG_SECTIONW, L"BGThemeFile", L"", ts.SetupFNameW, &ts.EtermLookfeel.BGThemeFileW); + WideCharToACP_t(ts.EtermLookfeel.BGThemeFileW, ts.EtermLookfeel.BGThemeFile, sizeof(ts.EtermLookfeel.BGThemeFile)); + + // \x83e\x81[\x83}\x83t\x83@\x83C\x83\x8BImageFile.INI\x82\xA9\x82\xE7 + aswprintf(&theme_imagefile, L"%s\\%hs", ts.HomeDirW, BG_THEME_IMAGEFILE); + // \x94w\x8Ci\x89摜\x82̓ǂݍ\x9E\x82\xDD - _snprintf_s(path, sizeof(path), _TRUNCATE, "%s\\%s", ts.HomeDir, BG_THEME_IMAGEFILE); - GetPrivateProfileString(BG_SECTION, BG_DESTFILE, "", ts.BGImageFilePath, sizeof(ts.BGImageFilePath), path); + hGetPrivateProfileStringW(BG_SECTIONW, BG_DESTFILEW, L"", theme_imagefile, &ts.BGImageFilePathW); + WideCharToACP_t(ts.BGImageFilePathW, ts.BGImageFilePath, _countof(ts.BGImageFilePath)); // \x94w\x8Ci\x89摜\x82̖\xBE\x82邳\x82̓ǂݍ\x9E\x82݁B // BGSrc1Alpha \x82\xC6 BGSrc2Alpha\x82͓\xAF\x92l\x82Ƃ\xB5\x82Ĉ\xB5\x82\xA4\x81B ts.BGImgBrightness = - GetPrivateProfileInt(BG_SECTION, BG_THEME_IMAGE_BRIGHTNESS1, BG_THEME_IMAGE_BRIGHTNESS_DEFAULT, path); + GetPrivateProfileIntW(BG_SECTIONW, BG_THEME_IMAGE_BRIGHTNESS1W, BG_THEME_IMAGE_BRIGHTNESS_DEFAULT, theme_imagefile); + + free(theme_imagefile); } // BGEnable\x82\xAA\x90^\x82ł\xE0\x81Ainitialize_once == FALSE\x82̏ꍇ\x82͏\x89\x8A\xFA\x89\xBB\x82\xF0\x82\xB5\x82Ȃ\xA2\x81B @@ -1458,10 +1454,14 @@ BGNoCopyBits = ts.EtermLookfeel.BGNoCopyBits; //\x83e\x83\x93\x83|\x83\x89\x83\x8A\x81[\x83t\x83@\x83C\x83\x8B\x96\xBC\x82\xAC - GetTempPath(MAX_PATH, tempPath); - GetTempFileName(tempPath, "ttAK", 0, BGDest.fileTmp); - GetTempFileName(tempPath, "ttAK", 0, BGSrc1.fileTmp); - GetTempFileName(tempPath, "ttAK", 0, BGSrc2.fileTmp); + { + char tempPath[MAX_PATH]; + ZeroMemory(tempPath, sizeof(tempPath)); + GetTempPathA(MAX_PATH, tempPath); + GetTempFileNameA(tempPath, "ttAK", 0, BGDest.fileTmp); + GetTempFileNameA(tempPath, "ttAK", 0, BGSrc1.fileTmp); + GetTempFileNameA(tempPath, "ttAK", 0, BGSrc2.fileTmp); + } //\x83f\x83t\x83H\x83\x8B\x83g\x92l BGDest.type = BG_PICTURE;