[Ttssh2-commit] [5387] MACRO ERRO dialogに、TTLファイル名 ( basename) を付与した。

svnno****@sourc***** svnno****@sourc*****
2013年 9月 8日 (日) 17:16:14 JST


Revision: 5387
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5387
Author:   yutakapon
Date:     2013-09-08 17:16:13 +0900 (Sun, 08 Sep 2013)
Log Message:
-----------
MACRO ERRO dialogに、TTLファイル名(basename)を付与した。

Modified Paths:
--------------
    trunk/teraterm/ttpmacro/errdlg.cpp
    trunk/teraterm/ttpmacro/errdlg.h
    trunk/teraterm/ttpmacro/ttmbuff.c
    trunk/teraterm/ttpmacro/ttmbuff.h
    trunk/teraterm/ttpmacro/ttmdlg.cpp
    trunk/teraterm/ttpmacro/ttmdlg.h
    trunk/teraterm/ttpmacro/ttmparse.c
    trunk/teraterm/ttpmacro/ttpmacro.rc

-------------- next part --------------
Modified: trunk/teraterm/ttpmacro/errdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/errdlg.cpp	2013-09-06 15:02:09 UTC (rev 5386)
+++ trunk/teraterm/ttpmacro/errdlg.cpp	2013-09-08 08:16:13 UTC (rev 5387)
@@ -24,7 +24,7 @@
 #endif
 
 // CErrDlg dialog
-CErrDlg::CErrDlg(PCHAR Msg, PCHAR Line, int x, int y, int lineno, int start, int end)
+CErrDlg::CErrDlg(PCHAR Msg, PCHAR Line, int x, int y, int lineno, int start, int end, PCHAR FileName)
 	: CDialog(CErrDlg::IDD)
 {
 	//{{AFX_DATA_INIT(CErrDlg)
@@ -36,6 +36,7 @@
 	LineNo = lineno;
 	StartPos = start;
 	EndPos = end;
+	MacroFileName = FileName;
 }
 
 BEGIN_MESSAGE_MAP(CErrDlg, CDialog)
@@ -79,9 +80,9 @@
 	SetDlgItemText(IDC_ERRMSG,MsgStr);
 
 	// \x8Ds\x94ԍ\x86\x82\xF0\x90擪\x82ɂ‚\xAF\x82\xE9\x81B
-	// TODO: \x83t\x83@\x83C\x83\x8B\x96\xBC\x82\xE0\x82‚\xAF\x82\xBD\x82\xA2\x81B
+	// \x83t\x83@\x83C\x83\x8B\x96\xBC\x82\xE0\x82‚\xAF\x82\xE9\x81B
 	// \x83G\x83\x89\x81[\x89ӏ\x8A\x82Ɉ\xF3\x82\xF0\x82‚\xAF\x82\xE9\x81B
-	_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%d:", LineNo);
+	_snprintf_s(buf, sizeof(buf), _TRUNCATE, "%s:%d:", MacroFileName, LineNo);
 	SetDlgItemText(IDC_ERRLINE, buf);
 
 	len = strlen(LineStr);

Modified: trunk/teraterm/ttpmacro/errdlg.h
===================================================================
--- trunk/teraterm/ttpmacro/errdlg.h	2013-09-06 15:02:09 UTC (rev 5386)
+++ trunk/teraterm/ttpmacro/errdlg.h	2013-09-08 08:16:13 UTC (rev 5387)
@@ -8,7 +8,7 @@
 class CErrDlg : public CDialog
 {
 public:
-	CErrDlg(PCHAR Msg, PCHAR Line, int x, int y, int lineno, int start, int end);
+	CErrDlg(PCHAR Msg, PCHAR Line, int x, int y, int lineno, int start, int end, PCHAR FileName);
 
 	//{{AFX_DATA(CErrDlg)
 	enum { IDD = IDD_ERRDLG };
@@ -23,6 +23,7 @@
 	HFONT DlgFont;
 	int LineNo;
 	int StartPos, EndPos;
+	PCHAR MacroFileName;
 
 	//{{AFX_MSG(CErrDlg)
 	virtual BOOL OnInitDialog();

Modified: trunk/teraterm/ttpmacro/ttmbuff.c
===================================================================
--- trunk/teraterm/ttpmacro/ttmbuff.c	2013-09-06 15:02:09 UTC (rev 5386)
+++ trunk/teraterm/ttpmacro/ttmbuff.c	2013-09-08 08:16:13 UTC (rev 5387)
@@ -19,8 +19,11 @@
 
 #define MAXNESTLEVEL 10
 
+#define MAXFILENAME 32   // .ttl\x83t\x83@\x83C\x83\x8B\x96\xBC\x82̍ő\xE5\x83T\x83C\x83Y
+
 static int INest;
 static HANDLE BuffHandle[MAXNESTLEVEL];
+static CHAR BuffHandleFileName[MAXNESTLEVEL][MAXFILENAME];  // \x8Ae\x8AK\x91w\x82\xCC.ttl\x83t\x83@\x83C\x83\x8B\x96\xBC
 static PCHAR Buff[MAXNESTLEVEL];
 static BINT BuffLen[MAXNESTLEVEL];
 static BINT BuffPtr[MAXNESTLEVEL];
@@ -88,6 +91,7 @@
 {
 	int F;
 	int dummy_read = 0;
+	char basename[MAX_PATH];
 
 	if ((FileName[0]==0) || (IBuff>MAXNESTLEVEL-1)) {
 		return FALSE;
@@ -95,6 +99,14 @@
 	if (BuffHandle[IBuff]!=0) {
 		return FALSE;
 	}
+
+	// include\x82ɐ\xAC\x8C\x{1C2D42}\xBD\x83t\x83@\x83C\x83\x8B\x82\xA9\x82\xE7\x81A\x83t\x83@\x83C\x83\x8B\x96\xBC\x82\xF0\x8BL\x98^\x82\xB7\x82\xE9\x81B
+	// \x83}\x83N\x83\x8D\x82̃G\x83\x89\x81[\x83_\x83C\x83A\x83\x8D\x83O\x82ŁA\x83t\x83@\x83C\x83\x8B\x96\xBC\x82\xF0\x95\\x8E\xA6\x82\xB5\x82\xBD\x82\xA2\x82\xBD\x82߁B
+	// (2013.9.8 yutaka)
+	if (GetFileTitle(FileName, basename, sizeof(basename)) != 0) 
+		strncpy_s(basename, sizeof(basename), FileName, _TRUNCATE);
+	strncpy_s(&BuffHandleFileName[IBuff][0], MAXFILENAME, basename, _TRUNCATE);
+
 	BuffPtr[IBuff] = 0;
 
 	// get file length
@@ -134,10 +146,18 @@
 		}
 	}
 	_lclose(F);
+
 	return FALSE;
 }
 
 
+// \x8C\xBB\x8Dݎ\xC0\x8Ds\x92\x86\x82̃}\x83N\x83\x8D\x83t\x83@\x83C\x83\x8B\x82̃t\x83@\x83C\x83\x8B\x96\xBC\x82\xF0\x95Ԃ\xB7
+char *GetMacroFileName(void)
+{
+	return &BuffHandleFileName[INest][0];
+}
+
+
 // \x8C\xBB\x8Dݎ\xC0\x8Ds\x92\x86\x82̃}\x83N\x83\x8D\x83t\x83@\x83C\x83\x8B\x82̍s\x94ԍ\x86\x82\xF0\x95Ԃ\xB7 (2005.7.18 yutaka)
 static int getCurrentLineNumber(CHAR *buf, BINT curpos)
 {

Modified: trunk/teraterm/ttpmacro/ttmbuff.h
===================================================================
--- trunk/teraterm/ttpmacro/ttmbuff.h	2013-09-06 15:02:09 UTC (rev 5386)
+++ trunk/teraterm/ttpmacro/ttmbuff.h	2013-09-08 08:16:13 UTC (rev 5387)
@@ -33,6 +33,7 @@
 char *GetLineBuffer(void);
 int IsUpdateMacroCommand(void);
 WORD BreakLoop(WORD WId);
+char *GetMacroFileName(void);
 
 extern int EndWhileFlag;
 extern int BreakFlag;

Modified: trunk/teraterm/ttpmacro/ttmdlg.cpp
===================================================================
--- trunk/teraterm/ttpmacro/ttmdlg.cpp	2013-09-06 15:02:09 UTC (rev 5386)
+++ trunk/teraterm/ttpmacro/ttmdlg.cpp	2013-09-08 08:16:13 UTC (rev 5387)
@@ -261,9 +261,9 @@
 }
 
 extern "C" {
-int OpenErrDlg(PCHAR Msg, PCHAR Line, int lineno, int start, int end)
+int OpenErrDlg(PCHAR Msg, PCHAR Line, int lineno, int start, int end, PCHAR FileName)
 {
-	CErrDlg ErrDlg(Msg,Line,DlgPosX,DlgPosY, lineno, start, end);
+	CErrDlg ErrDlg(Msg,Line,DlgPosX,DlgPosY, lineno, start, end, FileName);
 	return ErrDlg.DoModal();
 }
 }

Modified: trunk/teraterm/ttpmacro/ttmdlg.h
===================================================================
--- trunk/teraterm/ttpmacro/ttmdlg.h	2013-09-06 15:02:09 UTC (rev 5386)
+++ trunk/teraterm/ttpmacro/ttmdlg.h	2013-09-08 08:16:13 UTC (rev 5387)
@@ -17,7 +17,7 @@
 void SetDlgPos(int x, int y);
 void OpenInpDlg(PCHAR Buff, PCHAR Text, PCHAR Caption,
                 PCHAR Default, BOOL Paswd);
-int OpenErrDlg(PCHAR Msg, PCHAR Line, int lineno, int start, int end);
+int OpenErrDlg(PCHAR Msg, PCHAR Line, int lineno, int start, int end, PCHAR FileName);
 int OpenMsgDlg(PCHAR Text, PCHAR Caption, BOOL YesNo);
 void OpenStatDlg(PCHAR Text, PCHAR Caption);
 void CloseStatDlg();

Modified: trunk/teraterm/ttpmacro/ttmparse.c
===================================================================
--- trunk/teraterm/ttpmacro/ttmparse.c	2013-09-06 15:02:09 UTC (rev 5386)
+++ trunk/teraterm/ttpmacro/ttmparse.c	2013-09-08 08:16:13 UTC (rev 5387)
@@ -97,6 +97,7 @@
 	char Msg[41];
 	int i;
 	int no, start, end;
+	char *filename;
 
 	strncpy_s(Msg, sizeof(Msg), "Unknown error message number.", _TRUNCATE);
 
@@ -129,7 +130,9 @@
 	if (start == end)
 		end = LineLen;
 
-	i = OpenErrDlg(Msg, LineBuff, no, start, end);
+	filename = GetMacroFileName();
+
+	i = OpenErrDlg(Msg, LineBuff, no, start, end, filename);
 	if (i==IDOK) TTLStatus = IdTTLEnd;
 }
 

Modified: trunk/teraterm/ttpmacro/ttpmacro.rc
===================================================================
--- trunk/teraterm/ttpmacro/ttpmacro.rc	2013-09-06 15:02:09 UTC (rev 5386)
+++ trunk/teraterm/ttpmacro/ttpmacro.rc	2013-09-08 08:16:13 UTC (rev 5387)
@@ -61,17 +61,17 @@
     LTEXT           "LineNo:",IDC_LINENO,4,32,108,8
 END
 
-IDD_ERRDLG DIALOGEX 20, 20, 234, 49
+IDD_ERRDLG DIALOGEX 20, 20, 263, 49
 STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "MACRO: Error"
 FONT 14, "System", 0, 0, 0x0
 BEGIN
-    CONTROL         "ERRMSG",IDC_ERRMSG,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_GROUP,20,4,141,8
-    RTEXT           "NO:",IDC_ERRLINE,20,16,17,8,SS_NOPREFIX
+    CONTROL         "ERRMSG",IDC_ERRMSG,"Static",SS_LEFTNOWORDWRAP | SS_NOPREFIX | WS_GROUP,20,4,215,8
+    RTEXT           "NO:",IDC_ERRLINE,0,16,77,8,SS_NOPREFIX
     DEFPUSHBUTTON   "&Stop macro",IDOK,27,28,54,14
     PUSHBUTTON      "&Continue",IDCANCEL,92,28,54,14
     PUSHBUTTON      "&Help",IDC_MACROERRHELP,157,28,54,14
-    EDITTEXT        IDC_EDIT_ERRLINE,44,13,175,14,ES_AUTOHSCROLL | ES_READONLY
+    EDITTEXT        IDC_EDIT_ERRLINE,85,13,175,14,ES_AUTOHSCROLL | ES_READONLY
 END
 
 IDD_INPDLG DIALOGEX 20, 20, 143, 59
@@ -119,6 +119,11 @@
 #ifdef APSTUDIO_INVOKED
 GUIDELINES DESIGNINFO 
 BEGIN
+    IDD_ERRDLG, DIALOG
+    BEGIN
+        RIGHTMARGIN, 260
+    END
+
     IDD_LISTDLG, DIALOG
     BEGIN
         LEFTMARGIN, 7
@@ -181,3 +186,13 @@
 /////////////////////////////////////////////////////////////////////////////
 
 
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+



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