[Ttssh2-commit] [8247] Additional settings ダイアログでなるべくUnicode版APIを使用

scmno****@osdn***** scmno****@osdn*****
2019年 10月 3日 (木) 00:07:21 JST


Revision: 8247
          https://osdn.net/projects/ttssh2/scm/svn/commits/8247
Author:   zmatsuo
Date:     2019-10-03 00:07:20 +0900 (Thu, 03 Oct 2019)
Log Message:
-----------
Additional settings ダイアログでなるべくUnicode版APIを使用

- UI言語を切り替えても文字化けしないようになった
- タブは文字化けする状態

Modified Paths:
--------------
    branches/unicode_buf/teraterm/common/i18n.h
    branches/unicode_buf/teraterm/common/tmfc.cpp
    branches/unicode_buf/teraterm/common/tmfc.h
    branches/unicode_buf/teraterm/common/ttlib.c
    branches/unicode_buf/teraterm/common/ttlib.h
    branches/unicode_buf/teraterm/teraterm/addsetting.cpp

-------------- next part --------------
Modified: branches/unicode_buf/teraterm/common/i18n.h
===================================================================
--- branches/unicode_buf/teraterm/common/i18n.h	2019-10-02 15:07:09 UTC (rev 8246)
+++ branches/unicode_buf/teraterm/common/i18n.h	2019-10-02 15:07:20 UTC (rev 8247)
@@ -46,9 +46,7 @@
 	const char *key;
 } DlgTextInfo;
 
-#if defined(UNICODE)
 DllExport void WINAPI GetI18nStrW(const char *section, const char *key, wchar_t *buf, int buf_len, const wchar_t *def, const char *iniFile);
-#endif
 DllExport void WINAPI GetI18nStr(const char *section, const char *key, PCHAR buf, int buf_len, const char *def, const char *iniFile);
 DllExport int WINAPI GetI18nLogfont(const char *section, const char *key, PLOGFONTA logfont, int ppi, const char *iniFile);
 DllExport void WINAPI SetI18DlgStrs(const char *section, HWND hDlgWnd,

Modified: branches/unicode_buf/teraterm/common/tmfc.cpp
===================================================================
--- branches/unicode_buf/teraterm/common/tmfc.cpp	2019-10-02 15:07:09 UTC (rev 8246)
+++ branches/unicode_buf/teraterm/common/tmfc.cpp	2019-10-02 15:07:20 UTC (rev 8247)
@@ -68,12 +68,10 @@
 	return ::SendDlgItemMessage(m_hWnd, id, msg, wp, lp);
 }
 
-#if defined(UNICODE)
 LRESULT TTCWnd::SendDlgItemMessageW(int id, UINT msg, WPARAM wp, LPARAM lp)
 {
 	return ::SendDlgItemMessageW(m_hWnd, id, msg, wp, lp);
 }
-#endif
 
 LRESULT TTCWnd::SendDlgItemMessageA(int id, UINT msg, WPARAM wp, LPARAM lp)
 {

Modified: branches/unicode_buf/teraterm/common/tmfc.h
===================================================================
--- branches/unicode_buf/teraterm/common/tmfc.h	2019-10-02 15:07:09 UTC (rev 8246)
+++ branches/unicode_buf/teraterm/common/tmfc.h	2019-10-02 15:07:20 UTC (rev 8247)
@@ -72,19 +72,13 @@
 	// for controls
 	HWND GetDlgItem(int id);
 	LRESULT SendDlgItemMessageT(int id, UINT msg, WPARAM wp, LPARAM lp);
-#if defined(UNICODE)
 	LRESULT SendDlgItemMessageW(int id, UINT msg, WPARAM wp, LPARAM lp);
-#endif
 	LRESULT SendDlgItemMessageA(int id, UINT msg, WPARAM wp, LPARAM lp);
 	void GetDlgItemTextT(int id, TCHAR *buf, size_t size);
-#if defined(UNICODE)
 	void GetDlgItemTextW(int id, wchar_t *buf, size_t size);
-#endif
 	void GetDlgItemTextA(int id, char *buf, size_t size);
 	void SetDlgItemTextT(int id, const TCHAR *str);
-#if defined(UNICODE)
 	void SetDlgItemTextW(int id, const wchar_t *str);
-#endif
 	void SetDlgItemTextA(int id, const char *str);
 	void SetDlgItemNum(int id, LONG Num);
 	void SetCheck(int id, int nCheck);

Modified: branches/unicode_buf/teraterm/common/ttlib.c
===================================================================
--- branches/unicode_buf/teraterm/common/ttlib.c	2019-10-02 15:07:09 UTC (rev 8246)
+++ branches/unicode_buf/teraterm/common/ttlib.c	2019-10-02 15:07:20 UTC (rev 8247)
@@ -1043,6 +1043,11 @@
 	strncpy_s(buf, buflen, Temp, _TRUNCATE);
 }
 
+void get_lang_msgW(const char *key, wchar_t *buf, int buf_len, const wchar_t *def, const char *iniFile)
+{
+	GetI18nStrW("Tera Term", key, buf, buf_len, def, iniFile);
+}
+
 void get_lang_msg(const char *key, PCHAR buf, int buf_len, const char *def, const char *iniFile)
 {
 	GetI18nStr("Tera Term", key, buf, buf_len, def, iniFile);

Modified: branches/unicode_buf/teraterm/common/ttlib.h
===================================================================
--- branches/unicode_buf/teraterm/common/ttlib.h	2019-10-02 15:07:09 UTC (rev 8246)
+++ branches/unicode_buf/teraterm/common/ttlib.h	2019-10-02 15:07:20 UTC (rev 8247)
@@ -80,9 +80,7 @@
 						   char *UILanguageFileFull, size_t UILanguageFileFullLen);
 void GetOnOffEntryInifile(char *entry, char *buf, int buflen);
 void get_lang_msg(const char *key, PCHAR buf, int buf_len, const char *def, const char *iniFile);
-#if defined(UNICODE)
 void get_lang_msgW(const char *key, wchar_t *buf, int buf_len, const wchar_t *def, const char *iniFile);
-#endif
 int get_lang_font(PCHAR key, HWND dlg, PLOGFONT logfont, HFONT *font, const char *iniFile);
 DllExport BOOL doSelectFolder(HWND hWnd, char *path, int pathlen, const char *def, const char *msg);
 DllExport void OutputDebugPrintf(const char *fmt, ...);

Modified: branches/unicode_buf/teraterm/teraterm/addsetting.cpp
===================================================================
--- branches/unicode_buf/teraterm/teraterm/addsetting.cpp	2019-10-02 15:07:09 UTC (rev 8246)
+++ branches/unicode_buf/teraterm/teraterm/addsetting.cpp	2019-10-02 15:07:20 UTC (rev 8247)
@@ -257,31 +257,31 @@
 	};
 	SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
 
-	TCHAR uimsg[MAX_UIMSG];
-	get_lang_msgT("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_OFF", uimsg, _countof(uimsg), _T("off"), ts.UILanguageFile);
-	SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)uimsg);
-	get_lang_msgT("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_OVERWRITE", uimsg, _countof(uimsg), _T("overwrite"), ts.UILanguageFile);
-	SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)uimsg);
-	get_lang_msgT("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_AHEAD", uimsg, _countof(uimsg), _T("ahead"), ts.UILanguageFile);
-	SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)uimsg);
-	get_lang_msgT("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_LAST", uimsg, _countof(uimsg), _T("last"), ts.UILanguageFile);
-	SendDlgItemMessage(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	wchar_t uimsg[MAX_UIMSG];
+	get_lang_msgW("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_OFF", uimsg, _countof(uimsg), L"off", ts.UILanguageFile);
+	SendDlgItemMessageW(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgW("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_OVERWRITE", uimsg, _countof(uimsg), L"overwrite", ts.UILanguageFile);
+	SendDlgItemMessageW(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgW("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_AHEAD", uimsg, _countof(uimsg), L"ahead", ts.UILanguageFile);
+	SendDlgItemMessageW(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgW("DLG_TAB_SEQUENCE_ACCEPT_TITLE_CHANGING_LAST", uimsg, _countof(uimsg), L"last", ts.UILanguageFile);
+	SendDlgItemMessageW(IDC_ACCEPT_TITLE_CHANGING, CB_ADDSTRING, 0, (LPARAM)uimsg);
 
-	get_lang_msgT("DLG_TAB_SEQUENCE_TITLE_REPORT_IGNORE", uimsg, _countof(uimsg), _T("ignore"), ts.UILanguageFile);
-	SendDlgItemMessage(IDC_TITLE_REPORT, CB_ADDSTRING, 0, (LPARAM)uimsg);
-	get_lang_msgT("DLG_TAB_SEQUENCE_TITLE_REPORT_ACCEPT", uimsg, _countof(uimsg), _T("accept"), ts.UILanguageFile);
-	SendDlgItemMessage(IDC_TITLE_REPORT, CB_ADDSTRING, 0, (LPARAM)uimsg);
-	get_lang_msgT("DLG_TAB_SEQUENCE_TITLE_REPORT_EMPTY", uimsg, _countof(uimsg), _T("empty"), ts.UILanguageFile);
-	SendDlgItemMessage(IDC_TITLE_REPORT, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgW("DLG_TAB_SEQUENCE_TITLE_REPORT_IGNORE", uimsg, _countof(uimsg), L"ignore", ts.UILanguageFile);
+	SendDlgItemMessageW(IDC_TITLE_REPORT, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgW("DLG_TAB_SEQUENCE_TITLE_REPORT_ACCEPT", uimsg, _countof(uimsg), L"accept", ts.UILanguageFile);
+	SendDlgItemMessageW(IDC_TITLE_REPORT, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgW("DLG_TAB_SEQUENCE_TITLE_REPORT_EMPTY", uimsg, _countof(uimsg), L"empty", ts.UILanguageFile);
+	SendDlgItemMessageW(IDC_TITLE_REPORT, CB_ADDSTRING, 0, (LPARAM)uimsg);
 
-	get_lang_msgT("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_OFF", uimsg, _countof(uimsg), _T("off"), ts.UILanguageFile);
-	SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)uimsg);
-	get_lang_msgT("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_WRITE", uimsg, _countof(uimsg), _T("write only"), ts.UILanguageFile);
-	SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)uimsg);
-	get_lang_msgT("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_READ", uimsg, _countof(uimsg), _T("read only"), ts.UILanguageFile);
-	SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)uimsg);
-	get_lang_msgT("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_ON", uimsg, _countof(uimsg), _T("read/write"), ts.UILanguageFile);
-	SendDlgItemMessage(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgW("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_OFF", uimsg, _countof(uimsg), L"off", ts.UILanguageFile);
+	SendDlgItemMessageW(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgW("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_WRITE", uimsg, _countof(uimsg), L"write only", ts.UILanguageFile);
+	SendDlgItemMessageW(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgW("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_READ", uimsg, _countof(uimsg), L"read only", ts.UILanguageFile);
+	SendDlgItemMessageW(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgW("DLG_TAB_SEQUENCE_CLIPBOARD_ACCESS_ON", uimsg, _countof(uimsg), L"read/write", ts.UILanguageFile);
+	SendDlgItemMessageW(IDC_CLIPBOARD_ACCESS, CB_ADDSTRING, 0, (LPARAM)uimsg);
 
 	// (1)IDC_ACCEPT_MOUSE_EVENT_TRACKING
 	SetCheck(IDC_ACCEPT_MOUSE_EVENT_TRACKING, ts.MouseEventTracking);
@@ -684,19 +684,19 @@
 	};
 	SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
 
-	TCHAR uimsg[MAX_UIMSG];
-	get_lang_msgT("DLG_TAB_VISUAL_FONT_QUALITY_DEFAULT",
-				  uimsg, _countof(uimsg), _T("Default"), ts.UILanguageFile);
-	SendDlgItemMessage(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)uimsg);
-	get_lang_msgT("DLG_TAB_VISUAL_FONT_QUALITY_NONANTIALIASED",
-				  uimsg, _countof(uimsg), _T("Non-Antialiased"), ts.UILanguageFile);
-	SendDlgItemMessage(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)uimsg);
-	get_lang_msgT("DLG_TAB_VISUAL_FONT_QUALITY_ANTIALIASED",
-				  uimsg, _countof(uimsg), _T("Antialiased"), ts.UILanguageFile);
-	SendDlgItemMessage(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)uimsg);
-	get_lang_msgT("DLG_TAB_VISUAL_FONT_QUALITY_CLEARTYPE",
-				  uimsg, _countof(uimsg), _T("ClearType"), ts.UILanguageFile);
-	SendDlgItemMessage(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	wchar_t uimsg[MAX_UIMSG];
+	get_lang_msgW("DLG_TAB_VISUAL_FONT_QUALITY_DEFAULT",
+				  uimsg, _countof(uimsg), L"Default", ts.UILanguageFile);
+	SendDlgItemMessageW(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgW("DLG_TAB_VISUAL_FONT_QUALITY_NONANTIALIASED",
+				  uimsg, _countof(uimsg), L"Non-Antialiased", ts.UILanguageFile);
+	SendDlgItemMessageW(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgW("DLG_TAB_VISUAL_FONT_QUALITY_ANTIALIASED",
+				  uimsg, _countof(uimsg), L"Antialiased", ts.UILanguageFile);
+	SendDlgItemMessageW(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)uimsg);
+	get_lang_msgW("DLG_TAB_VISUAL_FONT_QUALITY_CLEARTYPE",
+				  uimsg, _countof(uimsg), L"ClearType", ts.UILanguageFile);
+	SendDlgItemMessageW(IDC_FONT_QUALITY, CB_ADDSTRING, 0, (LPARAM)uimsg);
 
 	// (1)AlphaBlend
 


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