[Ttssh2-commit] [5144] listbox マクロコマンドを追加した。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2013年 3月 13日 (水) 00:43:04 JST


Revision: 5144
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5144
Author:   yutakapon
Date:     2013-03-13 00:43:03 +0900 (Wed, 13 Mar 2013)
Log Message:
-----------
listbox マクロコマンドを追加した。

listbox '好きな食べ物を選んでください' 'あなたへの問い' 'バナナ' 'りんご' 'みかん'
sprintf2 var "%d" result
messagebox var "result"
; result
;   -1: Cancel
;    0: Banana
;    1: Apple
;    2: Orange

Modified Paths:
--------------
    trunk/teraterm/common/helpid.h
    trunk/teraterm/ttpmacro/ttl.c
    trunk/teraterm/ttpmacro/ttm_res.h
    trunk/teraterm/ttpmacro/ttmdlg.cpp
    trunk/teraterm/ttpmacro/ttmdlg.h
    trunk/teraterm/ttpmacro/ttmparse.c
    trunk/teraterm/ttpmacro/ttmparse.h
    trunk/teraterm/ttpmacro/ttpmacro.rc
    trunk/teraterm/ttpmacro/ttpmacro.vcproj

-------------- next part --------------
Modified: trunk/teraterm/common/helpid.h
===================================================================
--- trunk/teraterm/common/helpid.h	2013-03-10 16:05:28 UTC (rev 5143)
+++ trunk/teraterm/common/helpid.h	2013-03-12 15:43:03 UTC (rev 5144)
@@ -241,6 +241,7 @@
 #define HlpMacroCommandKmtget           92055
 #define HlpMacroCommandKmtrecv          92056
 #define HlpMacroCommandKmtsend          92057
+#define HlpMacroCommandListBox          92198
 #define HlpMacroCommandLoadkeymap       92058
 #define HlpMacroCommandLogclose         92059
 #define HlpMacroCommandLoginfo          92152

Modified: trunk/teraterm/ttpmacro/ttl.c
===================================================================
--- trunk/teraterm/ttpmacro/ttl.c	2013-03-10 16:05:28 UTC (rev 5143)
+++ trunk/teraterm/ttpmacro/ttl.c	2013-03-12 15:43:03 UTC (rev 5144)
@@ -2926,27 +2926,33 @@
 #define IdMsgBox 1
 #define IdYesNoBox 2
 #define IdStatusBox 3
+#define IdListBox 4
+#define LISTBOX_ITEM_NUM 10
 
 int MessageCommand(int BoxId, LPWORD Err)
 {
 	TStrVal Str1, Str2;
 	int sp = 0;
 	int ret;
+	char *s[LISTBOX_ITEM_NUM] = {0};
+	TStrVal str;
+	int i;
 
 	*Err = 0;
 	GetStrVal2(Str1, Err, TRUE);
 	GetStrVal2(Str2, Err, TRUE);
 	if (*Err!=0) return 0;
 
-	// get 3rd arg(optional) if given
-	if (CheckParameterGiven()) {
-		GetIntVal(&sp, Err);
+	if (BoxId != IdListBox) {
+		// get 3rd arg(optional) if given
+		if (CheckParameterGiven()) {
+			GetIntVal(&sp, Err);
+		}
+		if ((*Err==0) && (GetFirstChar()!=0))
+			*Err = ErrSyntax;
+		if (*Err!=0) return 0;
 	}
 
-	if ((*Err==0) && (GetFirstChar()!=0))
-		*Err = ErrSyntax;
-	if (*Err!=0) return 0;
-
 	if (sp) {
 		RestoreNewLine(Str1);
 	}
@@ -2967,11 +2973,52 @@
 		}
 		return (ret);
 	}
-	else if (BoxId==IdStatusBox)
+	else if (BoxId==IdStatusBox) {
 		OpenStatDlg(Str1,Str2);
+
+	} else if (BoxId==IdListBox) {
+		//  \x83\x8A\x83X\x83g\x83{\x83b\x83N\x83X\x82̑I\x91\xF0\x8E\x88\x82\xF0\x8E擾\x82\xB7\x82\xE9\x81B
+		for (i = 0 ; i < LISTBOX_ITEM_NUM ; i++) {
+			if (CheckParameterGiven()) {
+				GetStrVal2(str, Err, TRUE);
+				if (*Err ==0 ) 
+					s[i] = _strdup(str);
+			} else {
+				s[i] = NULL;
+			}
+		}
+		if (s[0] == NULL) {
+			*Err = ErrSyntax;
+			return 0;
+		}
+
+		// return 
+		//   0\x88ȏ\xE3: \x91I\x91\xF0\x8D\x80\x96\xDA
+		//   -1: \x83L\x83\x83\x83\x93\x83Z\x83\x8B
+		ret = OpenListDlg(Str1, Str2, s);
+
+		for (i = 0 ; i < LISTBOX_ITEM_NUM ; i++) {
+			free(s[i]);
+		}
+
+		return (ret);
+
+	}
 	return 0;
 }
 
+// \x83\x8A\x83X\x83g\x83{\x83b\x83N\x83X
+// (2013.3.13 yutaka)
+WORD TTLListBox()
+{
+	WORD Err;
+	int ret;
+
+	ret = MessageCommand(IdListBox, &Err);
+	SetResult(ret);
+	return Err;
+}
+
 WORD TTLMessageBox()
 {
 	WORD Err;
@@ -5185,6 +5232,8 @@
 			Err = TTLCommCmd(CmdKmtRecv,IdTTLWaitCmndResult); break;
 		case RsvKmtSend:
 			Err = TTLCommCmdFile(CmdKmtSend,IdTTLWaitCmndResult); break;
+		case RsvListBox:
+			Err = TTLListBox(); break;
 		case RsvLoadKeyMap:
 			Err = TTLCommCmdFile(CmdLoadKeyMap,0); break;
 		case RsvLogClose:

Modified: trunk/teraterm/ttpmacro/ttm_res.h
===================================================================
--- trunk/teraterm/ttpmacro/ttm_res.h	2013-03-10 16:05:28 UTC (rev 5143)
+++ trunk/teraterm/ttpmacro/ttm_res.h	2013-03-12 15:43:03 UTC (rev 5144)
@@ -16,15 +16,17 @@
 #define IDC_MSGTEXT                     401
 #define IDD_STATDLG                     500
 #define IDC_STATTEXT                    501
+#define IDD_LISTDLG                     600
 #define IDC_LINENO                      601
+#define IDC_LISTBOX                     602
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        600
+#define _APS_NEXT_RESOURCE_VALUE        601
 #define _APS_NEXT_COMMAND_VALUE         32771
-#define _APS_NEXT_CONTROL_VALUE         602
+#define _APS_NEXT_CONTROL_VALUE         603
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif

Modified: trunk/teraterm/ttpmacro/ttmdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/ttmdlg.cpp	2013-03-10 16:05:28 UTC (rev 5143)
+++ trunk/teraterm/ttpmacro/ttmdlg.cpp	2013-03-12 15:43:03 UTC (rev 5144)
@@ -15,6 +15,7 @@
 #include "inpdlg.h"
 #include "msgdlg.h"
 #include "statdlg.h"
+#include "ListDlg.h"
 #include "ttmlib.h"
 
 #define MaxStrLen 512
@@ -299,3 +300,17 @@
 	StatDlg = NULL;
 }
 }
+
+extern "C" {
+int OpenListDlg(PCHAR Text, PCHAR Caption, CHAR **Lists)
+{
+	int ret = -1;
+
+	CListDlg ListDlg(Text, Caption, Lists);
+	if (ListDlg.DoModal() == IDOK) {
+		ret = ListDlg.m_SelectItem;
+	}
+	return (ret);
+}
+}
+

Modified: trunk/teraterm/ttpmacro/ttmdlg.h
===================================================================
--- trunk/teraterm/ttpmacro/ttmdlg.h	2013-03-10 16:05:28 UTC (rev 5143)
+++ trunk/teraterm/ttpmacro/ttmdlg.h	2013-03-12 15:43:03 UTC (rev 5144)
@@ -22,6 +22,8 @@
 void OpenStatDlg(PCHAR Text, PCHAR Caption);
 void CloseStatDlg();
 
+int OpenListDlg(PCHAR Text, PCHAR Caption, CHAR **Lists);
+
 extern char HomeDir[MAXPATHLEN];
 extern char FileName[MAX_PATH];
 extern char TopicName[11];

Modified: trunk/teraterm/ttpmacro/ttmparse.c
===================================================================
--- trunk/teraterm/ttpmacro/ttmparse.c	2013-03-10 16:05:28 UTC (rev 5143)
+++ trunk/teraterm/ttpmacro/ttmparse.c	2013-03-12 15:43:03 UTC (rev 5144)
@@ -249,7 +249,8 @@
 		else if (_stricmp(Str,"kmtsend")==0) *WordId = RsvKmtSend;
 		break;
 	case 'l':
-		if (_stricmp(Str,"loadkeymap")==0) *WordId = RsvLoadKeyMap;
+		if (_stricmp(Str,"listbox")==0) *WordId = RsvListBox;
+		else if (_stricmp(Str,"loadkeymap")==0) *WordId = RsvLoadKeyMap;
 		else if (_stricmp(Str,"logclose")==0) *WordId = RsvLogClose;
 		else if (_stricmp(Str,"loginfo")==0) *WordId = RsvLogInfo;
 		else if (_stricmp(Str,"logopen")==0) *WordId = RsvLogOpen;

Modified: trunk/teraterm/ttpmacro/ttmparse.h
===================================================================
--- trunk/teraterm/ttpmacro/ttmparse.h	2013-03-10 16:05:28 UTC (rev 5143)
+++ trunk/teraterm/ttpmacro/ttmparse.h	2013-03-12 15:43:03 UTC (rev 5144)
@@ -224,6 +224,7 @@
 #define RsvGetSpecialFolder  195
 #define RsvSetPassword  196
 #define RsvIsPassword   197
+#define RsvListBox      198
 
 #define RsvOperator     1000
 #define RsvBNot         1001

Modified: trunk/teraterm/ttpmacro/ttpmacro.rc
===================================================================
--- trunk/teraterm/ttpmacro/ttpmacro.rc	2013-03-10 16:05:28 UTC (rev 5143)
+++ trunk/teraterm/ttpmacro/ttpmacro.rc	2013-03-12 15:43:03 UTC (rev 5144)
@@ -13,6 +13,54 @@
 #undef APSTUDIO_READONLY_SYMBOLS
 
 /////////////////////////////////////////////////////////////////////////////
+// \x93\xFA\x96{\x8C\xEA resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
+#ifdef _WIN32
+LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
+#pragma code_page(932)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_LISTDLG DIALOGEX 0, 0, 186, 86
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Dialog"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+    DEFPUSHBUTTON   "OK",IDOK,129,7,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,129,24,50,14
+    LISTBOX         IDC_LISTBOX,7,7,104,49,LBS_SORT | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "\x83X\x83^\x83e\x83B\x83b\x83N",IDC_STATIC,7,63,172,15
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO 
+BEGIN
+    IDD_LISTDLG, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 179
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 79
+    END
+END
+#endif    // APSTUDIO_INVOKED
+
+#endif    // \x93\xFA\x96{\x8C\xEA resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
 // \x89p\x8C\xEA (\x95č\x91) resources
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
@@ -149,3 +197,13 @@
 /////////////////////////////////////////////////////////////////////////////
 
 
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+

Modified: trunk/teraterm/ttpmacro/ttpmacro.vcproj
===================================================================
--- trunk/teraterm/ttpmacro/ttpmacro.vcproj	2013-03-10 16:05:28 UTC (rev 5143)
+++ trunk/teraterm/ttpmacro/ttpmacro.vcproj	2013-03-12 15:43:03 UTC (rev 5144)
@@ -228,6 +228,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\ListDlg.cpp"
+				>
+			</File>
+			<File
 				RelativePath="msgdlg.cpp"
 				>
 			</File>
@@ -261,6 +265,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\ListDlg.h"
+				>
+			</File>
+			<File
 				RelativePath="msgdlg.h"
 				>
 			</File>
@@ -269,6 +277,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
 				RelativePath="ttl.h"
 				>
 			</File>
@@ -395,5 +407,9 @@
 		</Filter>
 	</Files>
 	<Globals>
+		<Global
+			Name="RESOURCE_FILE"
+			Value="ttpmacro.rc"
+		/>
 	</Globals>
 </VisualStudioProject>



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