[Ttssh2-commit] [8471] GUIを多言語化

scmno****@osdn***** scmno****@osdn*****
2020年 1月 14日 (火) 01:26:07 JST


Revision: 8471
          https://osdn.net/projects/ttssh2/scm/svn/commits/8471
Author:   zmatsuo
Date:     2020-01-14 01:26:06 +0900 (Tue, 14 Jan 2020)
Log Message:
-----------
GUIを多言語化

Modified Paths:
--------------
    trunk/TTXSamples/TTXRecurringCommand/TTXRecurringCommand.c

-------------- next part --------------
Modified: trunk/TTXSamples/TTXRecurringCommand/TTXRecurringCommand.c
===================================================================
--- trunk/TTXSamples/TTXRecurringCommand/TTXRecurringCommand.c	2020-01-10 15:50:02 UTC (rev 8470)
+++ trunk/TTXSamples/TTXRecurringCommand/TTXRecurringCommand.c	2020-01-13 16:26:06 UTC (rev 8471)
@@ -430,24 +430,25 @@
 //	\x83R\x83\x93\x83g\x83\x8D\x81[\x83\x8B\x83\x81\x83j\x83\x85\x81[\x82\xC9RecurringCommand\x82\xF0\x92lj\xC1\x81B
 //
 static void PASCAL TTXModifyMenu(HMENU menu) {
+	static const DlgTextInfo MenuTextInfo[] = {
+		{ ID_MENU_SETUP, "MENU_SETUP_RECURRING" },
+		{ ID_MENU_CONTROL, "MENU_CONTROL_RECURRING" },
+	};
 	UINT flag = MF_BYCOMMAND | MF_STRING | MF_ENABLED;
 
 	pvar->SetupMenu = GetSetupMenu(menu);
 	pvar->ControlMenu = GetControlMenu(menu);
 
-	GetI18nStr(SECTION, "MENU_SETUP_RECURRING", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg),
-		"Rec&urring command", pvar->ts->UILanguageFile);
-	InsertMenu(pvar->SetupMenu, ID_SETUP_ADDITIONALSETTINGS, flag, ID_MENU_SETUP, pvar->ts->UIMsg);
+	InsertMenu(pvar->SetupMenu, ID_SETUP_ADDITIONALSETTINGS, flag, ID_MENU_SETUP, "Rec&urring command");
 
 	if (pvar->enable) {
 		flag |= MF_CHECKED;
 	}
 
+	InsertMenu(pvar->ControlMenu, ID_CONTROL_MACRO, flag, ID_MENU_CONTROL, "Rec&urring command");
+	InsertMenu(pvar->ControlMenu, ID_CONTROL_MACRO, MF_BYCOMMAND | MF_SEPARATOR, 0, NULL);
 
-	GetI18nStr(SECTION, "MENU_CONTROL_RECURRING", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg),
-		"Rec&urring command", pvar->ts->UILanguageFile);
-	InsertMenu(pvar->ControlMenu, ID_CONTROL_MACRO, flag, ID_MENU_CONTROL, pvar->ts->UIMsg);
-	InsertMenu(pvar->ControlMenu, ID_CONTROL_MACRO, MF_BYCOMMAND | MF_SEPARATOR, 0, NULL);
+	SetI18MenuStrs(SECTION, menu, MenuTextInfo, _countof(MenuTextInfo), pvar->ts->UILanguageFile);
 }
 
 static void PASCAL TTXModifyPopupMenu(HMENU menu) {
@@ -465,54 +466,18 @@
 // RecurringCommand\x90ݒ\xE8\x83_\x83C\x83A\x83\x8D\x83O\x82̃R\x81[\x83\x8B\x83o\x83b\x83N\x8A֐\x94\x81B
 //
 static LRESULT CALLBACK RecurringCommandSetting(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam) {
-	char uimsg[MAX_UIMSG];
-#if 0
-	static HFONT DlgFont;
-	LOGFONT logfont;
-	HFONT font;
-#endif
+	const static DlgTextInfo text_info[] = {
+		{ 0, "DLG_TITLE" },
+		{ IDC_ENABLE, "DLG_ENABLE" },
+		{ IDC_INTERVAL_LABEL, "DLG_INTERVAL" },
+		{ IDC_COMMAND_LABEL, "DLG_COMMAND" },
+		{ IDC_ADD_NL, "DLG_ADD_NEWLINE" },
+	};
 
 	switch (msg) {
 	  case WM_INITDIALOG:
-#if 0
-	  	font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
-		GetObject(font, sizeof(LOGFONT), &logfont);
+		SetI18DlgStrs(SECTION, dlg, text_info, _countof(text_info), pvar->ts->UILanguageFile);
 
-		if ((GetI18nLogfont(SECTION, "DLG_TAHOMA_FONT", &logfont, GetDeviceCaps(GetDC(dlg), LOGPIXELSY),
-		                   pvar->ts->UILanguageFile) != FALSE) &&
-		   ((DlgFont = CreateFontIndirect(&logfont)) != NULL)) {
-			SendDlgItemMessage(dlg, IDC_ENABLE, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(dlg, IDC_INTERVAL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(dlg, IDC_INTERVAL_LABEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(dlg, IDC_COMMAND, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(dlg, IDC_COMMAND_LABEL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(dlg, IDC_ADD_NL, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE,0));
-		}
-		else {
-			DlgFont = NULL;
-		}
-#endif
-
-		GetWindowText(dlg, uimsg, sizeof(uimsg));
-		GetI18nStr(SECTION, "DLG_TITLE", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), uimsg, pvar->ts->UILanguageFile);
-		SetWindowText(dlg, pvar->ts->UIMsg);
-
-		GetDlgItemText(dlg, IDC_ENABLE, uimsg, sizeof(uimsg));
-		GetI18nStr(SECTION, "DLG_ENABLE", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), uimsg, pvar->ts->UILanguageFile);
-		SetDlgItemText(dlg, IDC_ENABLE, pvar->ts->UIMsg);
-
-		GetDlgItemText(dlg, IDC_INTERVAL_LABEL, uimsg, sizeof(uimsg));
-		GetI18nStr(SECTION, "DLG_INTERVAL", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), uimsg, pvar->ts->UILanguageFile);
-		SetDlgItemText(dlg, IDC_INTERVAL_LABEL, pvar->ts->UIMsg);
-
-		GetDlgItemText(dlg, IDC_COMMAND_LABEL, uimsg, sizeof(uimsg));
-		GetI18nStr(SECTION, "DLG_COMMAND", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), uimsg, pvar->ts->UILanguageFile);
-		SetDlgItemText(dlg, IDC_COMMAND_LABEL, pvar->ts->UIMsg);
-
-		GetDlgItemText(dlg, IDC_ADD_NL, uimsg, sizeof(uimsg));
-		GetI18nStr(SECTION, "DLG_ADD_NEWLINE", pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg), uimsg, pvar->ts->UILanguageFile);
-		SetDlgItemText(dlg, IDC_ADD_NL, pvar->ts->UIMsg);
-
 		SendMessage(GetDlgItem(dlg, IDC_ENABLE), BM_SETCHECK,
 		            pvar->enable?BST_CHECKED:BST_UNCHECKED, 0);
 		SetDlgItemInt(dlg, IDC_INTERVAL, pvar->interval, FALSE);
@@ -555,20 +520,10 @@
 			}
 
 			EndDialog(dlg, IDOK);
-#if 0
-			if (DlgFont != NULL) {
-				DeleteObject(DlgFont);
-			}
-#endif
 			return TRUE;
 
 		  case IDCANCEL:
 			EndDialog(dlg, IDCANCEL);
-#if 0
-			if (DlgFont != NULL) {
-				DeleteObject(DlgFont);
-			}
-#endif
 			return TRUE;
 		}
 		break;


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