Revision: 9355 https://osdn.net/projects/ttssh2/scm/svn/commits/9355 Author: zmatsuo Date: 2021-08-13 13:33:14 +0900 (Fri, 13 Aug 2021) Log Message: ----------- 不透明度文字列を動的に確保するするよう修正 - "Opacity xx%" - r9345 (ワークサイズを誤っていたので修正) Revision Links: -------------- https://osdn.net/projects/ttssh2/scm/svn/commits/9345 Modified Paths: -------------- trunk/teraterm/teraterm/addsetting.cpp trunk/teraterm/teraterm/vtwin.cpp -------------- next part -------------- Modified: trunk/teraterm/teraterm/addsetting.cpp =================================================================== --- trunk/teraterm/teraterm/addsetting.cpp 2021-08-12 03:06:23 UTC (rev 9354) +++ trunk/teraterm/teraterm/addsetting.cpp 2021-08-13 04:33:14 UTC (rev 9355) @@ -53,6 +53,7 @@ #include "codeconv.h" #include "coding_pp.h" #include "font_pp.h" +#include "asprintf.h" const mouse_cursor_t MouseCursor[] = { {"ARROW", IDC_ARROW}, @@ -849,10 +850,10 @@ 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, _countof(uimsg), L"Opacity %.1f %%", ts.UILanguageFile); - wchar_t tipbuf[MAX_UIMSG]; - swprintf_s(tipbuf, _countof(tipbuf), uimsg, (pos / 255.0) * 100); + wchar_t *uimsg; + GetI18nStrWA("Tera Term", "TOOLTIP_TITLEBAR_OPACITY", L"Opacity %.1f %%", ts.UILanguageFile, &uimsg); + wchar_t *tipbuf; + aswprintf(&tipbuf, uimsg, (pos / 255.0) * 100); RECT rc; ::GetWindowRect(::GetDlgItem(hDlg, trackbar), &rc); tip->SetText(tipbuf); @@ -861,6 +862,8 @@ if (! tip->IsVisible()) { tip->SetVisible(TRUE); } + free(tipbuf); + free(uimsg); } BOOL CVisualPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam) Modified: trunk/teraterm/teraterm/vtwin.cpp =================================================================== --- trunk/teraterm/teraterm/vtwin.cpp 2021-08-12 03:06:23 UTC (rev 9354) +++ trunk/teraterm/teraterm/vtwin.cpp 2021-08-13 04:33:14 UTC (rev 9355) @@ -2110,8 +2110,6 @@ if (InTitleBar) { int delta = zDelta < 0 ? -1 : 1; int newAlpha = Alpha; - wchar_t tipbuf[32]; - wchar_t uimsg[MAX_UIMSG]; POINT tippos; newAlpha += delta * ts.MouseWheelScrollLine; @@ -2121,8 +2119,11 @@ newAlpha = 0; SetWindowAlpha(newAlpha); - get_lang_msgW("TOOLTIP_TITLEBAR_OPACITY", uimsg, sizeof(uimsg), L"Opacity %.1f %%", ts.UILanguageFile); - _snwprintf_s(tipbuf, _countof(tipbuf), uimsg, (newAlpha / 255.0) * 100); + wchar_t *uimsg; + GetI18nStrWA("Tera Term", "TOOLTIP_TITLEBAR_OPACITY", L"Opacity %.1f %%", ts.UILanguageFile, &uimsg); + wchar_t *tipbuf; + aswprintf(&tipbuf, uimsg, (newAlpha / 255.0) * 100); + free(uimsg); tippos = TipWin->GetPos(); if (tippos.x != pt.x || @@ -2138,6 +2139,8 @@ TipWin->SetVisible(TRUE); } + free(tipbuf); + return TRUE; } }