[Ttssh2-commit] [8100] リサイズ中の縦横サイズツールチップの表示位置をリサイズ後の座標に追従するようにした。

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 9月 9日 (月) 19:34:40 JST


Revision: 8100
          https://osdn.net/projects/ttssh2/scm/svn/commits/8100
Author:   yutakapon
Date:     2019-09-09 19:34:40 +0900 (Mon, 09 Sep 2019)
Log Message:
-----------
リサイズ中の縦横サイズツールチップの表示位置をリサイズ後の座標に追従するようにした。

Modified Paths:
--------------
    trunk/doc/en/html/about/history.html
    trunk/doc/ja/html/about/history.html
    trunk/teraterm/common/tipwin.cpp
    trunk/teraterm/common/tipwin.h
    trunk/teraterm/teraterm/sizetip.c
    trunk/teraterm/teraterm/sizetip.h
    trunk/teraterm/teraterm/vtwin.cpp

-------------- next part --------------
Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2019-09-09 09:23:58 UTC (rev 8099)
+++ trunk/doc/en/html/about/history.html	2019-09-09 10:34:40 UTC (rev 8100)
@@ -44,6 +44,7 @@
       <li>Added SFMT information on version dialog.</li>
       <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>
       <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>
+      <li>The location of resizing toolchip is automatically moved to coordinates after resizing.</li>
     </ul>
   </li>
   <li>Bug fixes

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2019-09-09 09:23:58 UTC (rev 8099)
+++ trunk/doc/ja/html/about/history.html	2019-09-09 10:34:40 UTC (rev 8100)
@@ -44,6 +44,7 @@
       <li>\x83o\x81[\x83W\x83\x87\x83\x93\x8F\xEE\x95\xF1\x83_\x83C\x83A\x83\x8D\x83O\x82\xC9SFMT\x82̕\\x8BL\x82\xF0\x92lj\xC1\x82\xB5\x82\xBD\x81B</li>
       <li><a href="../menu/file-new.html">New connection\x83_\x83C\x83A\x83\x8D\x83O</a>\x82̕\\x8BL\x82\xF0\x81uProtocol\x81v\x82\xA9\x82\xE7\x81uIP version\x81v\x82ɁA\x81uUNSPEC\x81v\x82\xF0\x81uAUTO\x81v\x82ɕύX\x82\xB5\x82\xBD\x81B</li>
       <li>VT \x83E\x83B\x83\x93\x83h\x83E\x82̃^\x83C\x83g\x83\x8B\x83o\x81[\x8F\xE3\x82Ń}\x83E\x83X\x83z\x83C\x81[\x83\x8B\x82𑀍삵\x82ăE\x83B\x83\x93\x83h\x83E\x82̕s\x93\xA7\x96\xBE\x93x\x82\xF0\x88ꎞ\x93I\x82ɕύX\x82\xB7\x82\xE9\x82ƁA\x95s\x93\xA7\x96\xBE\x93x\x82\xF0\x83c\x81[\x83\x8B\x83`\x83b\x83v\x82ɕ\\x8E\xA6\x82\xB7\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
+      <li>\x83\x8A\x83T\x83C\x83Y\x92\x86\x82̏c\x89\xA1\x83T\x83C\x83Y\x83c\x81[\x83\x8B\x83`\x83b\x83v\x82̕\\x8E\xA6\x88ʒu\x82\xF0\x83\x8A\x83T\x83C\x83Y\x8C\xE3\x82̍\xC0\x95W\x82ɒǏ]\x82\xB7\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
     </ul>
   </li>
   <li>\x83o\x83O\x8FC\x90\xB3

Modified: trunk/teraterm/common/tipwin.cpp
===================================================================
--- trunk/teraterm/common/tipwin.cpp	2019-09-09 09:23:58 UTC (rev 8099)
+++ trunk/teraterm/common/tipwin.cpp	2019-09-09 10:34:40 UTC (rev 8100)
@@ -305,8 +305,12 @@
 	DeleteObject(tip_font);
 }
 
-void TipWinSetPos(int x, int y)
+void TipWinSetPos(TipWin *tWin, int x, int y)
 {
+	if (tWin != NULL) {
+		HWND tip_wnd = tWin->tip_wnd;
+		SetWindowPos(tip_wnd, 0, x, y, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
+	}
 }
 
 void TipWinSetText(TipWin *tWin, TCHAR *text)

Modified: trunk/teraterm/common/tipwin.h
===================================================================
--- trunk/teraterm/common/tipwin.h	2019-09-09 09:23:58 UTC (rev 8099)
+++ trunk/teraterm/common/tipwin.h	2019-09-09 10:34:40 UTC (rev 8100)
@@ -14,6 +14,7 @@
 void TipWinSetText(TipWin *tWin, TCHAR *text);
 void TipWinDestroy(TipWin *tWin);
 void TipWinGetTextWidthHeight(HWND src, const TCHAR *str, int *width, int *height);
+void TipWinSetPos(TipWin *tWin, int x, int y);
 
 #ifdef __cplusplus
 }

Modified: trunk/teraterm/teraterm/sizetip.c
===================================================================
--- trunk/teraterm/teraterm/sizetip.c	2019-09-09 09:23:58 UTC (rev 8099)
+++ trunk/teraterm/teraterm/sizetip.c	2019-09-09 10:34:40 UTC (rev 8100)
@@ -96,17 +96,33 @@
 	}
 }
 
-void UpdateSizeTip(HWND src, int cx, int cy)
+/* リサイズ用ツールチップを表示する
+ *
+ * 引数:
+ *   src        ウィンドウハンドル
+ *   cx, cy     ツールチップに表示する縦横サイズ
+ *   fwSide     リサイズ時にどこのウィンドウを掴んだか
+ *   newX, newY リサイズ後の左上の座標
+ *
+ * 注意: Windows9x では動作しない
+ */
+void UpdateSizeTip(HWND src, int cx, int cy, UINT fwSide, int newX, int newY)
 {
 	TCHAR str[32];
+	int tooltip_movable = 0;
 
 	if (!tip_enabled)
 		return;
 
 	/* Generate the tip text */
-
 	_stprintf_s(str, _countof(str), _T("%dx%d"), cx, cy);
 
+	// ウィンドウの右、右下、下を掴んだ場合は、ツールチップを左上隅に配置する。
+	// それら以外はリサイズ後の左上隅に配置する。
+	if (!(fwSide == WMSZ_RIGHT || fwSide == WMSZ_BOTTOMRIGHT || fwSide == WMSZ_BOTTOM)) {
+		tooltip_movable = 1;
+	}
+
 	if (SizeTip == NULL) {
 		RECT wr;
 		POINT point;
@@ -117,6 +133,7 @@
 
 		// ウィンドウの位置を取得
 		GetWindowRect(src, &wr);
+
 		// sizetipを出す位置は、ウィンドウ左上(X, Y)に対して、
 		// (X, Y - 文字列の高さ - FRAME_WIDTH * 2) とする。
 		point.x = wr.left;
@@ -126,10 +143,21 @@
 		cy = point.y;
 
 		SizeTip = TipWinCreate(src, cx, cy, str);
+
+		//OutputDebugPrintf("Created: (%d,%d)\n", cx, cy);
+
 	} else {
 		/* Tip already exists, just set the text */
 		TipWinSetText(SizeTip, str);
 		//SetWindowText(tip_wnd, str);
+
+		//OutputDebugPrintf("Updated: (%d,%d)\n", cx, cy);
+
+		// ウィンドウの左上が移動する場合
+		if (tooltip_movable) {
+			TipWinSetPos(SizeTip, newX + FRAME_WIDTH*2, newY + FRAME_WIDTH*2);
+			//OutputDebugPrintf("Moved: (%d,%d)\n", newX, newY);
+		}
 	}
 }
 

Modified: trunk/teraterm/teraterm/sizetip.h
===================================================================
--- trunk/teraterm/teraterm/sizetip.h	2019-09-09 09:23:58 UTC (rev 8099)
+++ trunk/teraterm/teraterm/sizetip.h	2019-09-09 10:34:40 UTC (rev 8100)
@@ -30,7 +30,7 @@
 extern "C" {
 #endif
 
-void UpdateSizeTip(HWND src, int cx, int cy);
+void UpdateSizeTip(HWND src, int cx, int cy, UINT fwSide, int newX, int newY);
 void EnableSizeTip(int bEnable);
 
 #ifdef __cplusplus

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2019-09-09 09:23:58 UTC (rev 8099)
+++ trunk/teraterm/teraterm/vtwin.cpp	2019-09-09 10:34:40 UTC (rev 8100)
@@ -2728,7 +2728,7 @@
 	if (h <= 0)
 		h = 1;
 
-	UpdateSizeTip(HVTWin, w, h);
+	UpdateSizeTip(HVTWin, w, h, fwSide, pRect->left, pRect->top);
 
 	fixed_width = w * FontWidth + margin_width;
 	fixed_height = h * FontHeight + margin_height;


Ttssh2-commit メーリングリストの案内
Back to archive index