[Ttssh2-commit] [8460] 不透明度ツールチップを多言語化対応

scmno****@osdn***** scmno****@osdn*****
2020年 1月 10日 (金) 22:12:51 JST


Revision: 8460
          https://osdn.net/projects/ttssh2/scm/svn/commits/8460
Author:   zmatsuo
Date:     2020-01-10 22:12:51 +0900 (Fri, 10 Jan 2020)
Log Message:
-----------
不透明度ツールチップを多言語化対応

Modified Paths:
--------------
    trunk/teraterm/teraterm/addsetting.cpp

-------------- next part --------------
Modified: trunk/teraterm/teraterm/addsetting.cpp
===================================================================
--- trunk/teraterm/teraterm/addsetting.cpp	2020-01-10 13:12:35 UTC (rev 8459)
+++ trunk/teraterm/teraterm/addsetting.cpp	2020-01-10 13:12:51 UTC (rev 8460)
@@ -849,6 +849,22 @@
 	}
 }
 
+static void OpacityTooltip(CTipWin* tip, HWND hDlg, int trackbar, int pos, const char *UILanguageFile)
+{
+	wchar_t uimsg[MAX_UIMSG];
+	get_lang_msgW("TOOLTIP_TITLEBAR_OPACITY", uimsg, sizeof(uimsg), L"Opacity %.1f %%", ts.UILanguageFile);
+	wchar_t tipbuf[MAX_UIMSG];
+	swprintf_s(tipbuf, _countof(tipbuf), uimsg, (pos / 255.0) * 100);
+	RECT rc;
+	::GetWindowRect(::GetDlgItem(hDlg, trackbar), &rc);
+	tip->SetText(tipbuf);
+	tip->SetPos(rc.right, rc.bottom);
+	tip->SetHideTimer(1000);
+	if (! tip->IsVisible()) {
+		tip->SetVisible(TRUE);
+	}
+}
+
 BOOL CVisualPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
 {
 	int sel;
@@ -1028,20 +1044,7 @@
 					SetDlgItemNum(IDC_ALPHA_BLEND_ACTIVE, pos);
 				}
 				SendDlgItemMessage(IDC_ALPHA_BLEND_ACTIVE_TRACKBAR, TBM_SETPOS, TRUE, pos);
-
-				TCHAR tipbuf[32];
-				TCHAR uimsg[MAX_UIMSG];
-				RECT rc;
-				get_lang_msg("TOOLTIP_TITLEBAR_OPACITY", uimsg, sizeof(uimsg), "Opacity %.1f %%", ts.UILanguageFile);
-				_stprintf_s(tipbuf, _countof(tipbuf), uimsg, (pos / 255.0) * 100);
-
-				::GetWindowRect(GetDlgItem(IDC_ALPHA_BLEND_ACTIVE), &rc);
-				TipWin->SetText(tipbuf);
-				TipWin->SetPos(rc.right, rc.bottom);
-				TipWin->SetHideTimer(1000);
-				if (! TipWin->IsVisible()) {
-					TipWin->SetVisible(TRUE);
-				}
+				OpacityTooltip(TipWin, m_hWnd, IDC_ALPHA_BLEND_ACTIVE, pos, ts.UILanguageFile);
 				return TRUE;
 			}
 		case IDC_ALPHA_BLEND_INACTIVE | (EN_CHANGE << 16):
@@ -1057,19 +1060,7 @@
 					SetDlgItemNum(IDC_ALPHA_BLEND_INACTIVE, pos);
 				}
 				SendDlgItemMessage(IDC_ALPHA_BLEND_INACTIVE_TRACKBAR, TBM_SETPOS, TRUE, pos);
-
-				TCHAR tipbuf[32], uimsg[MAX_UIMSG];
-				RECT rc;
-				get_lang_msg("TOOLTIP_TITLEBAR_OPACITY", uimsg, sizeof(uimsg), "Opacity %.1f %%", ts.UILanguageFile);
-				_stprintf_s(tipbuf, _countof(tipbuf), uimsg, (pos / 255.0) * 100);
-
-				::GetWindowRect(GetDlgItem(IDC_ALPHA_BLEND_INACTIVE), &rc);
-				TipWin->SetText(tipbuf);
-				TipWin->SetPos(rc.right, rc.bottom);
-				TipWin->SetHideTimer(1000);
-				if (! TipWin->IsVisible()) {
-					TipWin->SetVisible(TRUE);
-				}
+				OpacityTooltip(TipWin, m_hWnd, IDC_ALPHA_BLEND_INACTIVE, pos, ts.UILanguageFile);
 				return TRUE;
 			}
 	}


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