• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision8116 (tree)
Time2019-09-12 00:19:29
Authoryasuhide

Log Message

Additional settingsのVISUALタブでスライダーで不透明度を変更できるようにした

- 不透明度スライダー指定の改版履歴を記載した
- 不透明度ツールチップに小数第1位を表示した
- 不透明度ツールチップの文字数が変化したときにはみ出る問題の暫定対策
- 言語ファイルの変更日を 2019-09-11 に更新した

Change Summary

Incremental Difference

--- trunk/doc/en/html/about/history.html (revision 8115)
+++ trunk/doc/en/html/about/history.html (revision 8116)
@@ -44,6 +44,7 @@
4444 <li>Changed of indication from "Protocol" to "IP version" and from "UNSPEC" to "AUTO" on <a href="../menu/file-new.html">New connection dialog</a>.</li>
4545 <li>When the opacity value of the window is temporarily changed by operating the mouse wheel on the title bar of VT window, the tooltip of the opacity value is shown.</li>
4646 <li>The location of resizing toolchip is automatically moved to coordinates after resizing.</li>
47+ <li>Added slider for specify the opacity values on the Visual tab of the <a href="../menu/setup-additional.html">Additional settings dialog</a>.</li>
4748 <li>Eterm look-feel: Added the <a href="../menu/setup-additional.html#MixedThemeFile">Mixed ThemeFile to Background</a> configuration. Also, added the the <a href="../setup/teraterm-ini.html#BGIgnoreThemeFile">BGIgnoreThemeFile</a> entry in the teraterm.ini file. The default value is off.</li>
4849 </ul>
4950 </li>
--- trunk/doc/en/html/menu/setup-additional.html (revision 8115)
+++ trunk/doc/en/html/menu/setup-additional.html (revision 8116)
@@ -267,7 +267,7 @@
267267 <dt id="AlphaBlend">Window Opacity / Inactive</dt>
268268 <dd>
269269 You can set up the value of opacity when the window is active (on focus) and not active (non-focus).
270- The range of opacity is from 0% to 100%. The more reduces the this value, the more
270+ The range of opacity is from 0 to 255. The more reduces the this value, the more
271271 window transparency is blinding.
272272 </dd>
273273
--- trunk/doc/ja/html/about/history.html (revision 8115)
+++ trunk/doc/ja/html/about/history.html (revision 8116)
@@ -43,6 +43,7 @@
4343 <li>バージョン情報ダイアログにSFMTの表記を追加した。</li>
4444 <li><a href="../menu/file-new.html">New connectionダイアログ</a>の表記を「Protocol」から「IP version」に、「UNSPEC」を「AUTO」に変更した。</li>
4545 <li>VT ウィンドウのタイトルバー上でマウスホイールを操作してウィンドウの不透明度を一時的に変更するとき、不透明度をツールチップに表示するようにした。</li>
46+ <li><a href="../menu/setup-additional.html">Additional settingsダイアログ</a>のVisualタブで、不透明度をスライダーで指定できるようにした。</li>
4647 <li>リサイズ中の縦横サイズツールチップの表示位置をリサイズ後の座標に追従するようにした。</li>
4748 <li>Eterm look-feel: <a href="../menu/setup-additional.html#MixedThemeFile">壁紙と画像を混合する</a>を設定できるようにした。teraterm.ini に <a href="../setup/teraterm-ini.html#BGIgnoreThemeFile">BGIgnoreThemeFile</a> エントリを追加した。デフォルトはoff。</li>
4849 </ul>
--- trunk/doc/ja/html/menu/setup-additional.html (revision 8115)
+++ trunk/doc/ja/html/menu/setup-additional.html (revision 8116)
@@ -265,7 +265,7 @@
265265 <dt id="AlphaBlend">Window Opacity / Inactive</dt>
266266 <dd>
267267 VT ウィンドウがアクティブ(フォーカスがある)時、および非アクティブ(フォーカスがない)時の不透明度を設定できます。
268- 値は0%〜100%の範囲で指定することができ、値を小さくするほど透明度は強くなります。
268+ 値は0〜255の範囲で指定することができ、値を小さくするほど透明度は強くなります。
269269 </dd>
270270
271271 <dt>Eterm lookfeel</dt>
--- trunk/teraterm/common/tmfc.cpp (revision 8115)
+++ trunk/teraterm/common/tmfc.cpp (revision 8116)
@@ -669,6 +669,14 @@
669669 return TRUE;
670670 }
671671
672+void TTCPropertyPage::OnHScroll(UINT nSBCode, UINT nPos, HWND pScrollBar)
673+{
674+}
675+
676+void TTCPropertyPage::OnTimer(UINT_PTR nIDEvent)
677+{
678+}
679+
672680 HBRUSH TTCPropertyPage::OnCtlColor(HDC hDC, HWND hWnd)
673681 {
674682 return (HBRUSH)::DefWindowProc(m_hWnd, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)hWnd);
@@ -715,6 +723,12 @@
715723 break;
716724 case WM_CTLCOLORSTATIC:
717725 return (INT_PTR)self->OnCtlColor((HDC)wp, (HWND)lp);
726+ case WM_HSCROLL:
727+ self->OnHScroll(LOWORD(wp), HIWORD(wp), (HWND)lp);
728+ break;
729+ case WM_TIMER:
730+ self->OnTimer(LOWORD(wp));
731+ break;
718732 }
719733 return FALSE;
720734 }
--- trunk/teraterm/common/tmfc.h (revision 8115)
+++ trunk/teraterm/common/tmfc.h (revision 8116)
@@ -176,6 +176,8 @@
176176 virtual ~TTCPropertyPage();
177177 virtual void OnInitDialog();
178178 virtual void OnOK();
179+ virtual void OnHScroll(UINT nSBCode, UINT nPos, HWND pScrollBar);
180+ virtual void OnTimer(UINT_PTR nIDEvent);
179181 virtual BOOL OnCommand(WPARAM wp, LPARAM lp);
180182 virtual HBRUSH OnCtlColor(HDC hDC, HWND hWnd);
181183 virtual void OnHelp();
--- trunk/teraterm/common/tt_res.h (revision 8115)
+++ trunk/teraterm/common/tt_res.h (revision 8116)
@@ -106,6 +106,8 @@
106106 #define IDC_ENABLE_ANSI_COLOR 1073
107107 #define IDC_DISABLE_PASTE_MBUTTON 1074
108108 #define IDC_URL_UNDERLINE 1075
109+#define IDC_ALPHA_BLEND_ACTIVE_TRACKBAR 1076
110+#define IDC_ALPHA_BLEND_INACTIVE_TRACKBAR 1077
109111 #define IDD_PRNABORTDLG 2100
110112 #define IDD_FILETRANSDLG 2200
111113 #define IDC_TRANSFNAME 2201
--- trunk/teraterm/teraterm/addsetting.cpp (revision 8115)
+++ trunk/teraterm/teraterm/addsetting.cpp (revision 8116)
@@ -50,6 +50,8 @@
5050 #include "helpid.h"
5151 #include "addsetting.h"
5252
53+#include "TipWin.h"
54+
5355 #ifdef _DEBUG
5456 #define free(p) _free_dbg((p), _NORMAL_BLOCK)
5557 #define _strdup(s) _strdup_dbg((s), _NORMAL_BLOCK, __FILE__, __LINE__)
@@ -71,9 +73,8 @@
7173 };
7274 #define MOUSE_CURSOR_MAX (sizeof(MouseCursor)/sizeof(MouseCursor[0]) - 1)
7375
74-double round(double r) {
75- return ( r > 0.0 ) ? floor(r + 0.5) : ceil(r - 0.5);
76-}
76+static TipWin *ActiveOpacityTip;
77+static TipWin *InactiveOpacityTip;
7778
7879 void CVisualPropPageDlg::SetupRGBbox(int index)
7980 {
@@ -646,6 +647,13 @@
646647
647648 // CVisualPropPageDlg メッセージ ハンドラ
648649
650+static void DestroyOpacityTip(TipWin** OpacityTip) {
651+ if (*OpacityTip) {
652+ TipWinDestroy(*OpacityTip);
653+ (*OpacityTip) = NULL;
654+ }
655+}
656+
649657 void CVisualPropPageDlg::OnInitDialog()
650658 {
651659 char buf[MAXPATHLEN];
@@ -692,9 +700,15 @@
692700
693701 // (1)AlphaBlend
694702
695- SetDlgItemNum(IDC_ALPHA_BLEND_ACTIVE, (LONG)round((ts.AlphaBlendActive / 255.0) * 100.0));
703+ SetDlgItemNum(IDC_ALPHA_BLEND_ACTIVE, ts.AlphaBlendActive);
704+ DestroyOpacityTip(&ActiveOpacityTip);
705+ SendDlgItemMessage(IDC_ALPHA_BLEND_ACTIVE_TRACKBAR, TBM_SETRANGE, true, MAKELPARAM(0, 255));
706+ SendDlgItemMessage(IDC_ALPHA_BLEND_ACTIVE_TRACKBAR, TBM_SETPOS, true, ts.AlphaBlendActive);
696707
697- SetDlgItemNum(IDC_ALPHA_BLEND_INACTIVE, (LONG)round((ts.AlphaBlendInactive / 255.0) * 100));
708+ SetDlgItemNum(IDC_ALPHA_BLEND_INACTIVE, ts.AlphaBlendInactive);
709+ DestroyOpacityTip(&InactiveOpacityTip);
710+ SendDlgItemMessage(IDC_ALPHA_BLEND_INACTIVE_TRACKBAR, TBM_SETRANGE, true, MAKELPARAM(0, 255));
711+ SendDlgItemMessage(IDC_ALPHA_BLEND_INACTIVE_TRACKBAR, TBM_SETPOS, true, ts.AlphaBlendInactive);
698712
699713 // (2)[BG] BGEnable
700714 SetCheck(IDC_ETERM_LOOKFEEL, ts.EtermLookfeel.BGEnable);
@@ -805,6 +819,47 @@
805819 ::SetFocus(GetDlgItem(IDC_ALPHA_BLEND_ACTIVE));
806820 }
807821
822+void CVisualPropPageDlg::OnHScroll(UINT nSBCode, UINT nPos, HWND pScrollBar)
823+{
824+ int pos;
825+ if ( pScrollBar == GetDlgItem(IDC_ALPHA_BLEND_ACTIVE_TRACKBAR) ) {
826+ switch (nSBCode) {
827+ case SB_TOP:
828+ case SB_BOTTOM:
829+ case SB_LINEDOWN:
830+ case SB_LINEUP:
831+ case SB_PAGEDOWN:
832+ case SB_PAGEUP:
833+ case SB_THUMBPOSITION:
834+ case SB_THUMBTRACK:
835+ pos = SendDlgItemMessage(IDC_ALPHA_BLEND_ACTIVE_TRACKBAR, TBM_GETPOS, NULL, NULL);
836+ SetDlgItemNum(IDC_ALPHA_BLEND_ACTIVE, pos);
837+ break;
838+ case SB_ENDSCROLL:
839+ default:
840+ return;
841+ }
842+ }
843+ else if ( pScrollBar == GetDlgItem(IDC_ALPHA_BLEND_INACTIVE_TRACKBAR) ) {
844+ switch (nSBCode) {
845+ case SB_TOP:
846+ case SB_BOTTOM:
847+ case SB_LINEDOWN:
848+ case SB_LINEUP:
849+ case SB_PAGEDOWN:
850+ case SB_PAGEUP:
851+ case SB_THUMBPOSITION:
852+ case SB_THUMBTRACK:
853+ pos = SendDlgItemMessage(IDC_ALPHA_BLEND_INACTIVE_TRACKBAR, TBM_GETPOS, NULL, NULL);
854+ SetDlgItemNum(IDC_ALPHA_BLEND_INACTIVE, pos);
855+ break;
856+ case SB_ENDSCROLL:
857+ default:
858+ return;
859+ }
860+ }
861+}
862+
808863 BOOL CVisualPropPageDlg::OnCommand(WPARAM wParam, LPARAM lParam)
809864 {
810865 int sel;
@@ -936,13 +991,73 @@
936991
937992 ::InvalidateRect(GetDlgItem(IDC_SAMPLE_COLOR), NULL, TRUE);
938993 }
994+ return TRUE;
995+ case IDC_ALPHA_BLEND_ACTIVE | (EN_CHANGE << 16):
996+ {
997+ int pos;
998+ pos = GetDlgItemInt(IDC_ALPHA_BLEND_ACTIVE);
999+ SendDlgItemMessage(IDC_ALPHA_BLEND_ACTIVE_TRACKBAR, TBM_SETPOS, TRUE, pos);
9391000
940- return TRUE;
1001+ TCHAR tipbuf[32];
1002+ TCHAR uimsg[MAX_UIMSG];
1003+ RECT rc;
1004+ get_lang_msg("TOOLTIP_TITLEBAR_OPACITY", uimsg, sizeof(uimsg), "Opacity %.1f %%", ts.UILanguageFile);
1005+ _stprintf_s(tipbuf, _countof(tipbuf), _T(uimsg), (pos / 255.0) * 100);
1006+
1007+ DestroyOpacityTip(&InactiveOpacityTip);
1008+ SetTimer(GetSafeHwnd(), IdOpacityTipTimer, 1000, NULL);
1009+ ::GetWindowRect(GetDlgItem(IDC_ALPHA_BLEND_ACTIVE), &rc);
1010+ if (ActiveOpacityTip == NULL) {
1011+ ActiveOpacityTip = TipWinCreate(GetDlgItem(IDC_ALPHA_BLEND_ACTIVE), rc.right, rc.bottom, tipbuf);
1012+ }
1013+ else {
1014+ TipWinSetText(ActiveOpacityTip, tipbuf);
1015+ // ツールチップのリサイズが失敗したように見える問題の暫定対策
1016+ TipWinSetText(ActiveOpacityTip, tipbuf);
1017+ }
1018+ return TRUE;
1019+ }
1020+ case IDC_ALPHA_BLEND_INACTIVE | (EN_CHANGE << 16):
1021+ {
1022+ int pos;
1023+ pos = GetDlgItemInt(IDC_ALPHA_BLEND_INACTIVE);
1024+ SendDlgItemMessage(IDC_ALPHA_BLEND_INACTIVE_TRACKBAR, TBM_SETPOS, TRUE, pos);
1025+
1026+ TCHAR tipbuf[32], uimsg[MAX_UIMSG];
1027+ RECT rc;
1028+ get_lang_msg("TOOLTIP_TITLEBAR_OPACITY", uimsg, sizeof(uimsg), "Opacity %.1f %%", ts.UILanguageFile);
1029+ _stprintf_s(tipbuf, _countof(tipbuf), _T(uimsg), (pos / 255.0) * 100);
1030+
1031+ DestroyOpacityTip(&ActiveOpacityTip);
1032+ SetTimer(GetSafeHwnd(), IdOpacityTipTimer, 1000, NULL);
1033+ ::GetWindowRect(GetDlgItem(IDC_ALPHA_BLEND_INACTIVE), &rc);
1034+ if (InactiveOpacityTip == NULL) {
1035+ InactiveOpacityTip = TipWinCreate(GetDlgItem(IDC_ALPHA_BLEND_INACTIVE), rc.right, rc.bottom, tipbuf);
1036+ }
1037+ else {
1038+ TipWinSetText(InactiveOpacityTip, tipbuf);
1039+ // ツールチップのリサイズが失敗したように見える問題の暫定対策
1040+ TipWinSetText(InactiveOpacityTip, tipbuf);
1041+ }
1042+ return TRUE;
1043+ }
9411044 }
9421045
9431046 return TTCPropertyPage::OnCommand(wParam, lParam);
9441047 }
9451048
1049+
1050+void CVisualPropPageDlg::OnTimer(UINT_PTR nIDEvent)
1051+{
1052+ KillTimer(GetSafeHwnd(), nIDEvent);
1053+ switch (nIDEvent) {
1054+ case IdOpacityTipTimer:
1055+ DestroyOpacityTip(&ActiveOpacityTip);
1056+ DestroyOpacityTip(&InactiveOpacityTip);
1057+ break;
1058+ }
1059+}
1060+
9461061 HBRUSH CVisualPropPageDlg::OnCtlColor(HDC hDC, HWND hWnd)
9471062 {
9481063 if ( hWnd == GetDlgItem(IDC_SAMPLE_COLOR) ) {
@@ -976,7 +1091,7 @@
9761091 // (1)
9771092 GetDlgItemTextA(IDC_ALPHA_BLEND_ACTIVE, buf, sizeof(buf));
9781093 if (isdigit(buf[0])) {
979- int i = (int)round((double)(255 * atoi(buf) / 100));
1094+ int i = atoi(buf);
9801095 ts.AlphaBlendActive =
9811096 (i < 0) ? 0 :
9821097 (i > 255) ? 255 : i;
@@ -983,7 +1098,7 @@
9831098 }
9841099 GetDlgItemTextA(IDC_ALPHA_BLEND_INACTIVE, buf, sizeof(buf));
9851100 if (isdigit(buf[0])) {
986- int i = (int)round((double)(255 * atoi(buf) / 100));
1101+ int i = atoi(buf);
9871102 ts.AlphaBlendInactive =
9881103 (i < 0) ? 0 :
9891104 (i > 255) ? 255 : i;
--- trunk/teraterm/teraterm/addsetting.h (revision 8115)
+++ trunk/teraterm/teraterm/addsetting.h (revision 8116)
@@ -92,6 +92,8 @@
9292 HBRUSH OnCtlColor(HDC hDC, HWND hWnd);
9393 enum { IDD = IDD_TABSHEET_VISUAL };
9494 BOOL OnCommand(WPARAM wParam, LPARAM lParam);
95+ void OnHScroll(UINT nSBCode, UINT nPos, HWND pScrollBar);
96+ void OnTimer(UINT_PTR nIDEvent);
9597 void SetupRGBbox(int index);
9698 void OnHelp();
9799 };
Show on old repository browser