[Ttssh2-commit] [4278] 試験的に IME 制御用制御シーケンスを新設。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 1月 17日 (月) 19:50:28 JST


Revision: 4278
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4278
Author:   doda
Date:     2011-01-17 19:50:28 +0900 (Mon, 17 Jan 2011)

Log Message:
-----------
試験的に IME 制御用制御シーケンスを新設。

Modified Paths:
--------------
    trunk/teraterm/teraterm/ttime.c
    trunk/teraterm/teraterm/ttime.h
    trunk/teraterm/teraterm/vtterm.c


-------------- next part --------------
Modified: trunk/teraterm/teraterm/ttime.c
===================================================================
--- trunk/teraterm/teraterm/ttime.c	2011-01-17 10:46:25 UTC (rev 4277)
+++ trunk/teraterm/teraterm/ttime.c	2011-01-17 10:50:28 UTC (rev 4278)
@@ -33,12 +33,16 @@
 typedef BOOL (WINAPI *TImmReleaseContext)(HWND, HIMC);
 typedef BOOL (WINAPI *TImmSetCompositionFont)(HIMC, LPLOGFONTA);
 typedef BOOL (WINAPI *TImmSetCompositionWindow)(HIMC, LPCOMPOSITIONFORM);
+typedef BOOL (WINAPI *TImmGetOpenStatus)(HIMC);
+typedef BOOL (WINAPI *TImmSetOpenStatus)(HIMC, BOOL);
 
 static TImmGetCompositionString PImmGetCompositionString;
 static TImmGetContext PImmGetContext;
 static TImmReleaseContext PImmReleaseContext;
 static TImmSetCompositionFont PImmSetCompositionFont;
 static TImmSetCompositionWindow PImmSetCompositionWindow;
+static TImmGetOpenStatus PImmGetOpenStatus;
+static TImmSetOpenStatus PImmSetOpenStatus;
 
 
 static HANDLE HIMEDLL = NULL;
@@ -100,6 +104,14 @@
     HIMEDLL, "ImmSetCompositionWindow");
   if (PImmSetCompositionWindow==NULL) Err = TRUE;
 
+  PImmGetOpenStatus = (TImmGetOpenStatus)GetProcAddress(
+    HIMEDLL, "ImmGetOpenStatus");
+  if (PImmGetOpenStatus==NULL) Err = TRUE;
+
+  PImmSetOpenStatus = (TImmSetOpenStatus)GetProcAddress(
+    HIMEDLL, "ImmSetOpenStatus");
+  if (PImmSetOpenStatus==NULL) Err = TRUE;
+
   if ( Err )
   {
     FreeLibrary(HIMEDLL);
@@ -202,3 +214,24 @@
 	(*PImmReleaseContext)(HVTWin, hIMC);
 	return hstr;
 }
+
+BOOL GetIMEOpenStatus()
+{
+	HIMC hIMC;
+	BOOL stat;
+
+	hIMC = (*PImmGetContext)(HVTWin);
+	stat = (*PImmGetOpenStatus)(hIMC);
+	(*PImmReleaseContext)(HVTWin, hIMC);
+
+	return stat;
+
+}
+
+void SetIMEOpenStatus(BOOL stat) {
+	HIMC hIMC;
+
+	hIMC = (*PImmGetContext)(HVTWin);
+	(*PImmSetOpenStatus)(hIMC, stat);
+	(*PImmReleaseContext)(HVTWin, hIMC);
+}

Modified: trunk/teraterm/teraterm/ttime.h
===================================================================
--- trunk/teraterm/teraterm/ttime.h	2011-01-17 10:46:25 UTC (rev 4277)
+++ trunk/teraterm/teraterm/ttime.h	2011-01-17 10:50:28 UTC (rev 4278)
@@ -11,6 +11,8 @@
 BOOL CanUseIME();
 void SetConversionWindow(HWND HWin, int X, int Y);
 void SetConversionLogFont(PLOGFONT lf);
+BOOL GetIMEOpenStatus(void);
+void SetIMEOpenStatus(BOOL stat);
 
 HGLOBAL GetConvString(UINT wParam, LPARAM lParam);
 

Modified: trunk/teraterm/teraterm/vtterm.c
===================================================================
--- trunk/teraterm/teraterm/vtterm.c	2011-01-17 10:46:25 UTC (rev 4277)
+++ trunk/teraterm/teraterm/vtterm.c	2011-01-17 10:50:28 UTC (rev 4278)
@@ -23,6 +23,7 @@
 #include "filesys.h"
 #include "teraprn.h"
 #include "telnet.h"
+#include "ttime.h"
 
 #include "vtterm.h"
 
@@ -139,6 +140,9 @@
 int ButtonStat;
 int FilterTop, FilterBottom, FilterLeft, FilterRight;
 
+/* IME Status */
+BOOL IMEstat;
+
 static _locale_t CLocale = NULL;
 
 void ResetSBuffer(PStatusBuff sbuff)
@@ -249,6 +253,9 @@
 
   // Bracketed Paste Mode
   BracketedPaste = FALSE;
+
+  // Saved IME Status
+  IMEstat = FALSE;
 }
 
 void ResetCharSet()
@@ -2144,6 +2151,29 @@
     }
   }
 
+  void CSLT(BYTE b)
+  {
+    switch (b) {
+      case 'r':
+	if (CanUseIME()) {
+	  SetIMEOpenStatus(IMEstat);
+	}
+	break;
+
+      case 's':
+	if (CanUseIME()) {
+	  IMEstat = GetIMEOpenStatus();
+	}
+	break;
+
+      case 't':
+	if (CanUseIME()) {
+	  SetIMEOpenStatus(Param[1] == 1);
+	}
+	break;
+    }
+  }
+
   void CSEQ(BYTE b)
   {
     char Report[16];
@@ -2541,6 +2571,9 @@
 
     // status buffers
     ResetCurSBuffer();
+
+    // Saved IME status
+    IMEstat = FALSE;
   }
 
   void CSExc(BYTE b)
@@ -2879,6 +2912,8 @@
 	    case 'u': RestoreCursor(); break;           // RCP (Restore cursor (ANSI.SYS/SCO))
 	  } /* of case Prv=0 */
 	  break;
+	/* private parameter = '<' */
+	case '<': CSLT(b); break;
 	/* private parameter = '=' */
 	case '=': CSEQ(b); break;
 	/* private parameter = '>' */



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