[Ttssh2-commit] [5227] 「常に手前に表示」を Window メニューに追加した。

svnno****@sourc***** svnno****@sourc*****
2013年 5月 3日 (金) 18:51:04 JST


Revision: 5227
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5227
Author:   yutakapon
Date:     2013-05-03 18:51:03 +0900 (Fri, 03 May 2013)
Log Message:
-----------
「常に手前に表示」を Window メニューに追加した。

Modified Paths:
--------------
    trunk/doc/en/html/reference/keycode.txt
    trunk/doc/ja/html/reference/keycode.txt
    trunk/teraterm/common/ttcommon.h
    trunk/teraterm/common/tttypes.h
    trunk/teraterm/teraterm/tekwin.cpp
    trunk/teraterm/teraterm/vtwin.cpp
    trunk/teraterm/teraterm/vtwin.h
    trunk/teraterm/ttpcmn/ttcmn.c
    trunk/teraterm/ttpcmn/ttpcmn.def

-------------- next part --------------
Modified: trunk/doc/en/html/reference/keycode.txt
===================================================================
--- trunk/doc/en/html/reference/keycode.txt	2013-05-02 07:10:32 UTC (rev 5226)
+++ trunk/doc/en/html/reference/keycode.txt	2013-05-03 09:51:03 UTC (rev 5227)
@@ -435,6 +435,7 @@
 [Window] Cascade                    50813
 [Window] Stacked                    50814
 [Window] Side by Side               50815
+[Window] TopMost                    50816
 [Help] Index                        50910
 [Help] About Tera Term              50990
 

Modified: trunk/doc/ja/html/reference/keycode.txt
===================================================================
--- trunk/doc/ja/html/reference/keycode.txt	2013-05-02 07:10:32 UTC (rev 5226)
+++ trunk/doc/ja/html/reference/keycode.txt	2013-05-03 09:51:03 UTC (rev 5227)
@@ -445,6 +445,7 @@
 [Window] Cascade                    50813
 [Window] Stacked                    50814
 [Window] Side by Side               50815
+[Window] TopMost                    50816
 [Help] Index                        50910
 [Help] About Tera Term              50990
 

Modified: trunk/teraterm/common/ttcommon.h
===================================================================
--- trunk/teraterm/common/ttcommon.h	2013-05-02 07:10:32 UTC (rev 5226)
+++ trunk/teraterm/common/ttcommon.h	2013-05-03 09:51:03 UTC (rev 5227)
@@ -29,7 +29,7 @@
 
 int FAR PASCAL RegWin(HWND HWinVT, HWND HWinTEK);
 void FAR PASCAL UnregWin(HWND HWin);
-void FAR PASCAL SetWinMenu(HMENU menu, PCHAR buf, int buflen, PCHAR langFile, int VTFlag);
+void FAR PASCAL SetWinMenu(HMENU menu, PCHAR buf, int buflen, PCHAR langFile, int VTFlag, HWND myhwnd);
 void FAR PASCAL SetWinList(HWND HWin, HWND HDlg, int IList);
 void FAR PASCAL SelectWin(int WinId);
 void FAR PASCAL SelectNextWin(HWND HWin, int Next, BOOL SkipIconic);
@@ -38,6 +38,7 @@
 void FAR PASCAL ShowAllWinSidebySide(HWND);
 void FAR PASCAL ShowAllWinStacked(HWND);
 void FAR PASCAL ShowAllWinCascade(HWND);
+void FAR PASCAL SwitchWindowTopMost(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-02 07:10:32 UTC (rev 5226)
+++ trunk/teraterm/common/tttypes.h	2013-05-03 09:51:03 UTC (rev 5227)
@@ -988,6 +988,7 @@
 #define ID_WINDOW_CASCADEALL   50813
 #define ID_WINDOW_STACKED      50814
 #define ID_WINDOW_SIDEBYSIDE   50815
+#define ID_WINDOW_TOPMOST      50816
 #define ID_TEKWINDOW_WINDOW    51810
 
 #define ID_TRANSFER      9 // the position on [File] menu

Modified: trunk/teraterm/teraterm/tekwin.cpp
===================================================================
--- trunk/teraterm/teraterm/tekwin.cpp	2013-05-02 07:10:32 UTC (rev 5226)
+++ trunk/teraterm/teraterm/tekwin.cpp	2013-05-03 09:51:03 UTC (rev 5227)
@@ -217,7 +217,7 @@
 		}
 	}
 	else if ( SubMenu == WinMenu ) {
-		SetWinMenu(WinMenu, ts.UIMsg, sizeof(ts.UIMsg), ts.UILanguageFile, 0);
+		SetWinMenu(WinMenu, ts.UIMsg, sizeof(ts.UIMsg), ts.UILanguageFile, 0, NULL);
 	}
 }
 

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2013-05-02 07:10:32 UTC (rev 5226)
+++ trunk/teraterm/teraterm/vtwin.cpp	2013-05-03 09:51:03 UTC (rev 5227)
@@ -209,6 +209,7 @@
 	ON_COMMAND(ID_WINDOW_CASCADEALL, OnWindowCascade)
 	ON_COMMAND(ID_WINDOW_STACKED, OnWindowStacked)
 	ON_COMMAND(ID_WINDOW_SIDEBYSIDE, OnWindowSidebySide)
+	ON_COMMAND(ID_WINDOW_TOPMOST, OnWindowTopMost)
 	ON_COMMAND(ID_WINDOW_RESTOREALL, OnWindowRestoreAll)
 	ON_COMMAND(ID_HELP_INDEX2, OnHelpIndex)
 	ON_COMMAND(ID_HELP_ABOUT, OnHelpAbout)
@@ -1413,7 +1414,7 @@
 	}
 	else if (SubMenu == WinMenu)
 	{
-		SetWinMenu(WinMenu, ts.UIMsg, sizeof(ts.UIMsg), ts.UILanguageFile, 1);
+		SetWinMenu(WinMenu, ts.UIMsg, sizeof(ts.UIMsg), ts.UILanguageFile, 1, HVTWin);
 	}
 
 	TTXModifyPopupMenu(SubMenu); /* TTPLUG */
@@ -5335,6 +5336,11 @@
 	ShowAllWinSidebySide(HVTWin);
 }
 
+void CVTWindow::OnWindowTopMost()
+{
+	SwitchWindowTopMost(HVTWin);
+}
+
 void CVTWindow::OnWindowRestoreAll()
 {
 	ShowAllWin(SW_RESTORE);

Modified: trunk/teraterm/teraterm/vtwin.h
===================================================================
--- trunk/teraterm/teraterm/vtwin.h	2013-05-02 07:10:32 UTC (rev 5226)
+++ trunk/teraterm/teraterm/vtwin.h	2013-05-03 09:51:03 UTC (rev 5227)
@@ -178,6 +178,7 @@
 	afx_msg void OnWindowCascade();
 	afx_msg void OnWindowStacked();
 	afx_msg void OnWindowSidebySide();
+	afx_msg void OnWindowTopMost();
 	afx_msg void OnWindowRestoreAll();
 	afx_msg void OnHelpIndex();
 	afx_msg void OnHelpUsing();

Modified: trunk/teraterm/ttpcmn/ttcmn.c
===================================================================
--- trunk/teraterm/ttpcmn/ttcmn.c	2013-05-02 07:10:32 UTC (rev 5226)
+++ trunk/teraterm/ttpcmn/ttcmn.c	2013-05-03 09:51:03 UTC (rev 5227)
@@ -18,6 +18,7 @@
 
 #include "compat_w95.h"
 #include "tt_res.h"
+#include "ttcommon.h"
 
 /* first instance flag */
 static BOOL FirstInstance = TRUE;
@@ -31,6 +32,9 @@
 #define TEKCLASSNAME "TEKWin32"
 
 
+static BOOL GetWindowTopMost(HWND myhwnd);
+
+
 void PASCAL CopyShmemToTTSet(PTTSet ts)
 {
 	// \x8C\xBB\x8D݂̐ݒ\xE8\x82\xF0\x8B\xA4\x97L\x83\x81\x83\x82\x83\x8A\x82\xA9\x82\xE7\x83R\x83s\x81[\x82\xB7\x82\xE9
@@ -886,7 +890,7 @@
 		return '+';
 }
 
-void FAR PASCAL SetWinMenu(HMENU menu, PCHAR buf, int buflen, PCHAR langFile, int VTFlag)
+void FAR PASCAL SetWinMenu(HMENU menu, PCHAR buf, int buflen, PCHAR langFile, int VTFlag, HWND myhwnd)
 {
 	int i;
 	char Temp[MAXPATHLEN];
@@ -941,6 +945,12 @@
 
 		get_lang_msg("MENU_WINDOW_RESTOREALL", buf, buflen, "&Restore All", langFile);
 		AppendMenu(menu, MF_ENABLED | MF_STRING, ID_WINDOW_RESTOREALL, buf);
+
+		get_lang_msg("MENU_WINDOW_TOPMOST", buf, buflen, "&TopMost", langFile);
+		if (GetWindowTopMost(myhwnd) == TRUE)
+			AppendMenu(menu, MF_ENABLED | MF_STRING | MFS_CHECKED, ID_WINDOW_TOPMOST, buf);
+		else
+			AppendMenu(menu, MF_ENABLED | MF_STRING | MFS_UNCHECKED, ID_WINDOW_TOPMOST, buf);
 	}
 	else {
 		AppendMenu(menu,MF_ENABLED | MF_STRING,ID_TEKWINDOW_WINDOW, buf);
@@ -1175,6 +1185,32 @@
 		CascadeWindows(NULL, MDITILE_SKIPDISABLED, NULL, n, hwnd);
 }
 
+// \x83E\x83B\x83\x93\x83h\x83E\x82\xAA\x81u\x8F\xED\x82Ɏ\xE8\x91O\x82ɕ\\x8E\xA6\x81v\x82ł\xA0\x82邩\x81H
+static BOOL GetWindowTopMost(HWND myhwnd)
+{
+	DWORD val;
+
+	val = (DWORD)GetWindowLongPtr(myhwnd, GWL_EXSTYLE);
+	if (val & WS_EX_TOPMOST)
+		return TRUE;
+	else
+		return FALSE;
+}
+
+// \x83E\x83B\x83\x93\x83h\x83E\x82\xF0\x81u\x8F\xED\x82Ɏ\xE8\x91O\x82ɕ\\x8E\xA6\x81v\x82ɂ\xB7\x82邩\x82\xF0\x83g\x83O\x83\x8B\x82Ő؂\xE8\x91ւ\xA6\x82\xE9\x81B
+void FAR PASCAL SwitchWindowTopMost(HWND myhwnd) 
+{
+	HWND style;
+
+	if (GetWindowTopMost(myhwnd) == TRUE)
+		style = HWND_NOTOPMOST;
+	else
+		style = HWND_TOPMOST;
+
+	SetWindowPos(myhwnd, style, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE );
+}
+
+
 int FAR PASCAL CommReadRawByte(PComVar cv, LPBYTE b)
 {
 	if ( ! cv->Ready ) {

Modified: trunk/teraterm/ttpcmn/ttpcmn.def
===================================================================
--- trunk/teraterm/ttpcmn/ttpcmn.def	2013-05-02 07:10:32 UTC (rev 5226)
+++ trunk/teraterm/ttpcmn/ttpcmn.def	2013-05-03 09:51:03 UTC (rev 5227)
@@ -50,3 +50,4 @@
   ShowAllWinSidebySide @56
   ShowAllWinStacked @57
   ShowAllWinCascade @58
+  SwitchWindowTopMost @59



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