[Ttssh2-commit] [5232] 全Tera Termウィンドウを閉じる機能を追加した。

svnno****@sourc***** svnno****@sourc*****
2013年 5月 5日 (日) 21:29:53 JST


Revision: 5232
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5232
Author:   yutakapon
Date:     2013-05-05 21:29:52 +0900 (Sun, 05 May 2013)
Log Message:
-----------
全Tera Termウィンドウを閉じる機能を追加した。
ただし、このコミット時点では、どこからも呼び出していないので、実際には動かない。

Modified Paths:
--------------
    trunk/teraterm/common/ttcommon.h
    trunk/teraterm/common/tttypes.h
    trunk/teraterm/teraterm/vtwin.cpp
    trunk/teraterm/teraterm/vtwin.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-05 10:58:13 UTC (rev 5231)
+++ trunk/teraterm/common/ttcommon.h	2013-05-05 12:29:52 UTC (rev 5232)
@@ -39,6 +39,7 @@
 void FAR PASCAL ShowAllWinStacked(HWND);
 void FAR PASCAL ShowAllWinCascade(HWND);
 void FAR PASCAL SwitchWindowTopMost(HWND myhwnd);
+void FAR PASCAL BroadcastClosingMessage(HWND myhwnd);
 
 int FAR PASCAL CommReadRawByte(PComVar cv, LPBYTE b);
 int FAR PASCAL CommRead1Byte(PComVar cv, LPBYTE b);

Modified: trunk/teraterm/common/tttypes.h
===================================================================
--- trunk/teraterm/common/tttypes.h	2013-05-05 10:58:13 UTC (rev 5231)
+++ trunk/teraterm/common/tttypes.h	2013-05-05 12:29:52 UTC (rev 5232)
@@ -154,6 +154,8 @@
 
 #define MY_FORCE_FOREGROUND_MESSAGE	WM_USER+31
 
+#define WM_USER_NONCONFIRM_CLOSE  WM_USER+40
+
   /* port type ID */
 #define IdTCPIP  1
 #define IdSerial 2

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2013-05-05 10:58:13 UTC (rev 5231)
+++ trunk/teraterm/teraterm/vtwin.cpp	2013-05-05 12:29:52 UTC (rev 5232)
@@ -145,6 +145,7 @@
 	ON_MESSAGE(WM_USER_PROTOCANCEL,OnProtoEnd)
 	ON_MESSAGE(WM_USER_CHANGETITLE,OnChangeTitle)
 	ON_MESSAGE(WM_COPYDATA,OnReceiveIpcMessage)
+	ON_MESSAGE(WM_USER_NONCONFIRM_CLOSE, OnNonConfirmClose)
 	ON_COMMAND(ID_FILE_NEWCONNECTION, OnFileNewConnection)
 	ON_COMMAND(ID_FILE_DUPLICATESESSION, OnDuplicateSession)
 	ON_COMMAND(ID_FILE_CYGWINCONNECTION, OnCygwinConnection)
@@ -1764,6 +1765,21 @@
 	DestroyWindow();
 }
 
+// \x91STera Term\x82̏I\x97\xB9\x82\xF0\x8Ew\x8E\xA6\x82\xB7\x82\xE9
+void CVTWindow::OnAllClose()
+{
+	BroadcastClosingMessage(HVTWin);
+}
+
+// \x8FI\x97\xB9\x96₢\x8D\x87\x82킹\x82Ȃ\xB5\x82\xC9Tera Term\x82\xF0\x8FI\x97\xB9\x82\xB7\x82\xE9\x81BOnAllClose()\x8E\xF3\x90M\x97p\x81B
+LONG CVTWindow::OnNonConfirmClose(UINT wParam, LONG lParam)
+{
+	// \x82\xB1\x82\xB1\x82\xC5 ts \x82̓\xE0\x97e\x82\xF0\x88Ӑ}\x93I\x82ɏ\x91\x82\xAB\x8A\xB7\x82\xA6\x82Ă\xE0\x81A\x8FI\x97\xB9\x8E\x9E\x82Ɏ\xA9\x93\xAE\x83Z\x81[\x83u\x82\xB3\x82\xEA\x82\xE9\x82킯\x82ł͂Ȃ\xA2\x82̂ŁA\x93\xC1\x82ɖ\xE2\x91\xE8\x82Ȃ\xB5\x81B
+	ts.PortFlag &= ~PF_CONFIRMDISCONN;
+	OnClose();
+	return 1;
+}
+
 void CVTWindow::OnDestroy()
 {
 	// remove this window from the window list

Modified: trunk/teraterm/teraterm/vtwin.h
===================================================================
--- trunk/teraterm/teraterm/vtwin.h	2013-05-05 10:58:13 UTC (rev 5231)
+++ trunk/teraterm/teraterm/vtwin.h	2013-05-05 12:29:52 UTC (rev 5232)
@@ -58,6 +58,7 @@
 	afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
 	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
 	afx_msg void OnClose();
+	afx_msg void OnAllClose();
 	afx_msg void OnDestroy();
 	afx_msg void OnDropFiles(HDROP hDropInfo);
 	afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
@@ -114,6 +115,7 @@
 	afx_msg LONG OnProtoEnd(UINT wParam, LONG lParam);
 	afx_msg LONG OnChangeTitle(UINT wParam, LONG lParam);
 	afx_msg LONG OnReceiveIpcMessage(UINT wParam, LONG lParam);
+	afx_msg LONG OnNonConfirmClose(UINT wParam, LONG lParam);
 	afx_msg void OnFileNewConnection();
 	afx_msg void OnDuplicateSession();
 	afx_msg void OnCygwinConnection();

Modified: trunk/teraterm/ttpcmn/ttcmn.c
===================================================================
--- trunk/teraterm/ttpcmn/ttcmn.c	2013-05-05 10:58:13 UTC (rev 5231)
+++ trunk/teraterm/ttpcmn/ttcmn.c	2013-05-05 12:29:52 UTC (rev 5232)
@@ -1204,6 +1204,30 @@
 }
 
 
+// \x91STera Term\x82ɏI\x97\xB9\x8Ew\x8E\xA6\x82\xF0\x8Fo\x82\xB7\x81B
+void FAR PASCAL BroadcastClosingMessage(HWND myhwnd) 
+{
+	int i, max;
+	HWND hwnd[MAXNWIN];
+
+	// Tera Term\x82\xF0\x8FI\x97\xB9\x82\xB3\x82\xB9\x82\xE9\x82ƁA\x8B\xA4\x97L\x83\x81\x83\x82\x83\x8A\x82\xAA\x95ω\xBB\x82\xB7\x82邽\x82߁A
+	// \x82\xA2\x82\xC1\x82\xBD\x82\xF1\x83o\x83b\x83t\x83@\x82ɃR\x83s\x81[\x82\xB5\x82Ă\xA8\x82\xAD\x81B
+	max = pm->NWin;
+	for (i = 0 ; i < pm->NWin ; i++) {
+		hwnd[i] = pm->WinList[i];
+	}
+
+	for (i = 0 ; i < max ; i++) {
+		// \x8E\xA9\x95\xAA\x8E\xA9\x90g\x82͍Ō\xE3\x82ɂ\xB7\x82\xE9\x81B
+		if (hwnd[i] == myhwnd) 
+			continue;
+
+		PostMessage(hwnd[i], WM_USER_NONCONFIRM_CLOSE, 0, 0);
+	}
+	PostMessage(myhwnd, WM_USER_NONCONFIRM_CLOSE, 0, 0);
+}
+
+
 int FAR PASCAL CommReadRawByte(PComVar cv, LPBYTE b)
 {
 	if ( ! cv->Ready ) {

Modified: trunk/teraterm/ttpcmn/ttpcmn.def
===================================================================
--- trunk/teraterm/ttpcmn/ttpcmn.def	2013-05-05 10:58:13 UTC (rev 5231)
+++ trunk/teraterm/ttpcmn/ttpcmn.def	2013-05-05 12:29:52 UTC (rev 5232)
@@ -51,3 +51,4 @@
   ShowAllWinStacked @57
   ShowAllWinCascade @58
   SwitchWindowTopMost @59
+  BroadcastClosingMessage @60



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