[Ttssh2-commit] [5222] Tera Termのウィンドウ群を「並べて表示」する関数を追加した。

svnno****@sourc***** svnno****@sourc*****
2013年 5月 2日 (木) 00:55:26 JST


Revision: 5222
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5222
Author:   yutakapon
Date:     2013-05-02 00:55:25 +0900 (Thu, 02 May 2013)
Log Message:
-----------
Tera Termのウィンドウ群を「並べて表示」する関数を追加した。
関数自体はまだどこからも呼んでいないので、実際にはまだ動かない。

Modified Paths:
--------------
    trunk/teraterm/common/ttcommon.h
    trunk/teraterm/ttpcmn/ttcmn.c
    trunk/teraterm/ttpcmn/ttpcmn.def

-------------- next part --------------
Modified: trunk/teraterm/common/ttcommon.h
===================================================================
--- trunk/teraterm/common/ttcommon.h	2013-05-01 11:22:58 UTC (rev 5221)
+++ trunk/teraterm/common/ttcommon.h	2013-05-01 15:55:25 UTC (rev 5222)
@@ -35,6 +35,9 @@
 void FAR PASCAL SelectNextWin(HWND HWin, int Next, BOOL SkipIconic);
 HWND FAR PASCAL GetNthWin(int n);
 void FAR PASCAL ShowAllWin(int stat);
+void FAR PASCAL ShowAllWinSidebySide(HWND);
+void FAR PASCAL ShowAllWinStacked(HWND);
+void FAR PASCAL ShowAllWinCascade(HWND);
 
 int FAR PASCAL CommReadRawByte(PComVar cv, LPBYTE b);
 int FAR PASCAL CommRead1Byte(PComVar cv, LPBYTE b);

Modified: trunk/teraterm/ttpcmn/ttcmn.c
===================================================================
--- trunk/teraterm/ttpcmn/ttcmn.c	2013-05-01 11:22:58 UTC (rev 5221)
+++ trunk/teraterm/ttpcmn/ttcmn.c	2013-05-01 15:55:25 UTC (rev 5222)
@@ -1028,6 +1028,109 @@
 	}
 }
 
+// \x83}\x83\x8B\x83`\x83\x82\x83j\x83^\x81[\x82\xF0\x8Dl\x97\xB6\x82\xB5\x82āA\x83^\x83X\x83N\x83o\x81[\x82\xF0\x8F\x9C\x82\xA2\x82\xBD\x83f\x83B\x83X\x83v\x83\x8C\x83C\x83T\x83C\x83Y\x82\xF0\x8E擾\x82\xB7\x82\xE9\x81B
+static void get_desktop_size_by_multi_monitor(HWND hwnd, RECT *rect)
+{
+	HMONITOR hMon;
+	MONITORINFO mi;
+
+	// FIXME: Windows95\x82ł͖\xA2\x92\xE8\x8B`\x82̖͗l\x81B
+	hMon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
+
+	ZeroMemory( &mi, sizeof( mi ));
+	mi.cbSize = sizeof( mi );
+	GetMonitorInfo(hMon, &mi);
+	*rect = mi.rcWork;  // \x83^\x83X\x83N\x83o\x81[\x82\xF0\x8F\x9C\x82\xA2\x82\xBD\x83f\x83B\x83X\x83v\x83\x8C\x83C\x83T\x83C\x83Y
+}
+
+// \x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x8D\xB6\x89E\x82ɕ\xC0\x82ׂĕ\\x8E\xA6\x82\xB7\x82\xE9(Show Windows Side by Side)
+void FAR PASCAL ShowAllWinSidebySide(HWND myhwnd)
+{
+	int i, n, width;
+	HWND hwnd[MAXNWIN];
+	RECT rc;
+
+	get_desktop_size_by_multi_monitor(myhwnd, &rc);
+
+	n = 0;
+	for (i = 0 ; i < pm->NWin ; i++) {
+		if (IsIconic(pm->WinList[i]) || !IsWindowVisible(pm->WinList[i]))
+			continue;
+
+		if (pm->WinList[i] == myhwnd) {
+			hwnd[n] = hwnd[0];
+			hwnd[0] = myhwnd;
+		} else {
+			hwnd[n] = pm->WinList[i];
+		}
+		n++;
+	}
+	if (n <= 1)    // \x97L\x8C\xF8\x82ȃE\x83B\x83\x93\x83h\x83E\x82\xAA2\x82ˆȏ\xE3\x82̏ꍇ\x82Ɍ\xC0\x82\xE9
+		goto error;
+
+	width = (rc.right - rc.left) / n;
+	for (i = 0 ; i < n ; i++) {
+		ShowWindow(hwnd[i], SW_RESTORE);
+		SetWindowPos(hwnd[i], 0, 
+			width*i + rc.left,
+			rc.top,
+			width,
+			rc.bottom - rc.top,
+			SWP_NOOWNERZORDER | SWP_NOZORDER);
+	}
+	SetFocus(hwnd[0]);
+
+error:
+	return;
+}
+
+// \x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x8F㉺\x82ɕ\xC0\x82ׂĕ\\x8E\xA6\x82\xB7\x82\xE9(Show Windows Stacked)
+void FAR PASCAL ShowAllWinStacked(HWND myhwnd) 
+{
+	int i, n, height;
+	HWND hwnd[MAXNWIN];
+	RECT rc;
+
+	get_desktop_size_by_multi_monitor(myhwnd, &rc);
+
+	n = 0;
+	for (i = 0 ; i < pm->NWin ; i++) {
+		if (IsIconic(pm->WinList[i]) || !IsWindowVisible(pm->WinList[i]))
+			continue;
+
+		if (pm->WinList[i] == myhwnd) {
+			hwnd[n] = hwnd[0];
+			hwnd[0] = myhwnd;
+		} else {
+			hwnd[n] = pm->WinList[i];
+		}
+		n++;
+	}
+	if (n <= 1)    // \x97L\x8C\xF8\x82ȃE\x83B\x83\x93\x83h\x83E\x82\xAA2\x82ˆȏ\xE3\x82̏ꍇ\x82Ɍ\xC0\x82\xE9
+		goto error;
+
+	height = (rc.bottom - rc.top) / n;
+	for (i = 0 ; i < n ; i++) {
+		ShowWindow(hwnd[i], SW_RESTORE);
+		SetWindowPos(hwnd[i], 0, 
+			rc.left,
+			rc.top + height*i,
+			rc.right - rc.left,
+			height,
+			SWP_NOOWNERZORDER | SWP_NOZORDER);
+	}
+	SetFocus(hwnd[0]);
+
+error:
+	return;
+}
+
+// \x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x8Fd\x82˂ĕ\\x8E\xA6\x82\xB7\x82\xE9(Cascade)
+void FAR PASCAL ShowAllWinCascade(HWND myhwnd) 
+{
+	// TODO:
+}
+
 int FAR PASCAL CommReadRawByte(PComVar cv, LPBYTE b)
 {
 	if ( ! cv->Ready ) {

Modified: trunk/teraterm/ttpcmn/ttpcmn.def
===================================================================
--- trunk/teraterm/ttpcmn/ttpcmn.def	2013-05-01 11:22:58 UTC (rev 5221)
+++ trunk/teraterm/ttpcmn/ttpcmn.def	2013-05-01 15:55:25 UTC (rev 5222)
@@ -47,3 +47,6 @@
 
   mctimelocal @53
   RestartTeraTerm @55
+  ShowAllWinSidebySide @56
+  ShowAllWinStacked @57
+  ShowAllWinCascade @58



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