[Ttssh2-commit] [9146] ファイル送信を整理

Zurück zum Archiv-Index
scmno****@osdn***** scmno****@osdn*****
2021年 2月 6日 (土) 14:44:31 JST


Revision: 9146
          https://osdn.net/projects/ttssh2/scm/svn/commits/9146
Author:   zmatsuo
Date:     2021-02-06 14:44:30 +0900 (Sat, 06 Feb 2021)
Log Message:
-----------
ファイル送信を整理

- ファイル送信のUIを Tera Term 4 と 5 で追加した方法の2つから選択できるよう修正
  - 変更前はコードを変更する必要があった
- filesys.cpp からファイル選択ダイアログに関するコードを削除
  - sendfiledlg にまとめた

Modified Paths:
--------------
    trunk/teraterm/common/tt_res.h
    trunk/teraterm/teraterm/filesys.cpp
    trunk/teraterm/teraterm/sendfiledlg.cpp
    trunk/teraterm/teraterm/sendfiledlg.h
    trunk/teraterm/teraterm/sendmem.cpp
    trunk/teraterm/teraterm/sendmem.h
    trunk/teraterm/teraterm/ttdde.c
    trunk/teraterm/teraterm/ttermpro.rc
    trunk/teraterm/teraterm/vtterm.c
    trunk/teraterm/teraterm/vtwin.cpp

-------------- next part --------------
Modified: trunk/teraterm/common/tt_res.h
===================================================================
--- trunk/teraterm/common/tt_res.h	2021-02-06 05:44:11 UTC (rev 9145)
+++ trunk/teraterm/common/tt_res.h	2021-02-06 05:44:30 UTC (rev 9146)
@@ -258,6 +258,7 @@
 #define IDC_SENDFILE_SEND_SIZE_LABEL    2603
 #define IDC_SENDFILE_DELAYTIME_LABEL    2604
 #define IDC_SENDFILE_DELAYTIME_EDIT     2605
+#define IDC_SENDFILE_CHECK_4            2606
 #define ID_ACC_SENDBREAK                50001
 #define ID_ACC_COPY                     50002
 #define ID_ACC_NEWCONNECTION            50003
@@ -358,7 +359,7 @@
 #define _APS_NO_MFC                     1
 #define _APS_NEXT_RESOURCE_VALUE        129
 #define _APS_NEXT_COMMAND_VALUE         52031
-#define _APS_NEXT_CONTROL_VALUE         2606
+#define _APS_NEXT_CONTROL_VALUE         2607
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif

Modified: trunk/teraterm/teraterm/filesys.cpp
===================================================================
--- trunk/teraterm/teraterm/filesys.cpp	2021-02-06 05:44:11 UTC (rev 9145)
+++ trunk/teraterm/teraterm/filesys.cpp	2021-02-06 05:44:30 UTC (rev 9146)
@@ -29,11 +29,7 @@
 
 /* TERATERM.EXE, file transfer routines */
 #include <stdio.h>
-#include <io.h>
-#include <process.h>
 #include <windows.h>
-#include <htmlhelp.h>
-#include <assert.h>
 
 #include "teraterm.h"
 #include "tttypes.h"
@@ -42,21 +38,13 @@
 #include "commlib.h"
 #include "ttcommon.h"
 #include "ttdde.h"
-#include "ttlib.h"
-#include "dlglib.h"
 #include "vtterm.h"
-#include "helpid.h"
 #include "layer_for_unicode.h"
-#include "codeconv.h"
 #include "asprintf.h"
 
-#include "filesys_log_res.h"
-
 #include "filesys.h"
 
 typedef struct {
-	wchar_t *DlgCaption;
-
 	wchar_t *FullName;
 
 	HANDLE FileHandle;
@@ -67,9 +55,11 @@
 } TFileVar;
 typedef TFileVar *PFileVar;
 
-#define FS_BRACKET_NONE  0
-#define FS_BRACKET_START 1
-#define FS_BRACKET_END   2
+typedef enum {
+	FS_BRACKET_NONE,
+	FS_BRACKET_START,
+	FS_BRACKET_END,
+} FileBracketMode_t;
 
 static PFileVar SendVar = NULL;
 
@@ -85,7 +75,7 @@
 static struct FileSendHandler FileSendHandler;
 static int FileDlgRefresh;
 
-static int FileBracketMode = FS_BRACKET_NONE;
+static FileBracketMode_t FileBracketMode = FS_BRACKET_NONE;
 static int FileBracketPtr = 0;
 static char BracketStartStr[] = "\033[200~";
 static char BracketEndStr[] = "\033[201~";
@@ -99,28 +89,34 @@
 	PFileTransDlg FTDlg;
 
 	FTDlg = new CFileTransDlg();
+	if (FTDlg == NULL) {
+		return FALSE;
+	}
 
-	fv->FilePause = FALSE;
+	wchar_t *DlgCaption;
+	wchar_t *uimsg = TTGetLangStrW("Tera Term", "FILEDLG_TRANS_TITLE_SENDFILE", L"Send file", ts.UILanguageFile);
+	aswprintf(&DlgCaption, L"Tera Term: %s", uimsg);
+	free(uimsg);
 
-	if (FTDlg!=NULL)
-	{
-		CFileTransDlg::Info info;
-		info.UILanguageFile = ts.UILanguageFile;
-		info.OpId = CFileTransDlg::OpSendFile;
-		info.DlgCaption = fv->DlgCaption;
-		info.FileName = NULL;
-		info.FullName = fv->FullName;
-		info.HideDialog = FALSE;
-		info.HMainWin = HVTWin;
-		FTDlg->Create(hInst, &info);
-		FTDlg->RefreshNum(0, fv->FileSize, fv->ByteCount);
-	}
+	CFileTransDlg::Info info;
+	info.UILanguageFile = ts.UILanguageFile;
+	info.OpId = CFileTransDlg::OpSendFile;
+	info.DlgCaption = DlgCaption;
+	info.FileName = NULL;
+	info.FullName = fv->FullName;
+	info.HideDialog = FALSE;
+	info.HMainWin = HVTWin;
 
-	SendDlg = FTDlg; /* File send */
+	FTDlg->Create(hInst, &info);
+	FTDlg->RefreshNum(0, fv->FileSize, fv->ByteCount);
 
+	free(DlgCaption);
+
+	fv->FilePause = FALSE;
 	fv->StartTime = GetTickCount();
+	SendDlg = FTDlg; /* File send */
 
-	return (FTDlg!=NULL);
+	return TRUE;
 }
 
 #if 0
@@ -165,151 +161,13 @@
 		free(fv->FullName);
 		fv->FullName = NULL;
 	}
-	free(fv->DlgCaption);
-	fv->DlgCaption = NULL;
 	free(fv);
 	*pfv = NULL;
 }
 
-/* \x83_\x83C\x83A\x83\x8D\x83O\x82𒆉\x9B\x82Ɉړ\xAE\x82\xB7\x82\xE9 */
-static void CenterCommonDialog(HWND hDlg)
-{
-	/* hDlg\x82̐e\x82\xAA\x83_\x83C\x83A\x83\x8D\x83O\x82̃E\x83B\x83\x93\x83h\x83E\x83n\x83\x93\x83h\x83\x8B */
-	HWND hWndDlgRoot = GetParent(hDlg);
-	CenterWindow(hWndDlgRoot, GetParent(hWndDlgRoot));
-}
-
-static HFONT DlgFoptFont;
-static UINT_PTR CALLBACK TransFnHook(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
-{
-	static const DlgTextInfo text_info[] = {
-		{ IDC_FOPT, "DLG_FOPT" },
-		{ IDC_FOPTBIN, "DLG_FOPT_BINARY" },
-	};
-	LPOPENFILENAME ofn;
-	LPWORD pw;
-	LPOFNOTIFY notify;
-	LOGFONT logfont;
-	HFONT font;
-	const char *UILanguageFile = ts.UILanguageFile;
-
-	switch (Message) {
-	case WM_INITDIALOG:
-		ofn = (LPOPENFILENAME)lParam;
-		pw = (LPWORD)ofn->lCustData;
-		SetWindowLongPtr(Dialog, DWLP_USER, (LONG_PTR)pw);
-
-		font = (HFONT)SendMessage(Dialog, WM_GETFONT, 0, 0);
-		GetObject(font, sizeof(LOGFONT), &logfont);
-		if (get_lang_font("DLG_TAHOMA_FONT", Dialog, &logfont, &DlgFoptFont, UILanguageFile)) {
-			SendDlgItemMessage(Dialog, IDC_FOPT, WM_SETFONT, (WPARAM)DlgFoptFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_FOPTBIN, WM_SETFONT, (WPARAM)DlgFoptFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_FOPTAPPEND, WM_SETFONT, (WPARAM)DlgFoptFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_PLAINTEXT, WM_SETFONT, (WPARAM)DlgFoptFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(Dialog, IDC_TIMESTAMP, WM_SETFONT, (WPARAM)DlgFoptFont, MAKELPARAM(TRUE,0));
-		}
-		else {
-			DlgFoptFont = NULL;
-		}
-
-		SetI18nDlgStrs("Tera Term", Dialog, text_info, _countof(text_info), UILanguageFile);
-
-		SetRB(Dialog,*pw & 1,IDC_FOPTBIN,IDC_FOPTBIN);
-
-		CenterCommonDialog(Dialog);
-
-		return TRUE;
-	case WM_COMMAND: // for old style dialog
-		switch (LOWORD(wParam)) {
-		case IDOK:
-			pw = (LPWORD)GetWindowLongPtr(Dialog,DWLP_USER);
-			if (pw!=NULL)
-				GetRB(Dialog,pw,IDC_FOPTBIN,IDC_FOPTBIN);
-			if (DlgFoptFont != NULL) {
-				DeleteObject(DlgFoptFont);
-			}
-			break;
-		case IDCANCEL:
-			if (DlgFoptFont != NULL) {
-				DeleteObject(DlgFoptFont);
-			}
-			break;
-		}
-		break;
-	case WM_NOTIFY: // for Explorer-style dialog
-		notify = (LPOFNOTIFY)lParam;
-		switch (notify->hdr.code) {
-		case CDN_FILEOK:
-			pw = (LPWORD)GetWindowLongPtr(Dialog,DWLP_USER);
-			if (pw!=NULL)
-				GetRB(Dialog,pw,IDC_FOPTBIN,IDC_FOPTBIN);
-			if (DlgFoptFont != NULL) {
-				DeleteObject(DlgFoptFont);
-			}
-			break;
-		}
-		break;
-	}
-	return FALSE;
-}
-
-static wchar_t *_GetTransFname(HWND hWnd, const wchar_t *caption, LPLONG Option)
-{
-	WORD optw;
-	wchar_t TempDir[MAX_PATH];
-	wchar_t FileName[MAX_PATH];
-	const char *UILanguageFile = ts.UILanguageFile;
-
-	/* save current dir */
-	_GetCurrentDirectoryW(_countof(TempDir), TempDir);
-
-	wchar_t FileDirExpanded[MAX_PATH];
-	wchar_t *FileDir = ToWcharA(ts.FileDir);
-	_ExpandEnvironmentStringsW(FileDir, FileDirExpanded, _countof(FileDirExpanded));
-	wchar_t *CurDir = FileDirExpanded;
-	free(FileDir);
-
-	wchar_t *FNFilter = GetCommonDialogFilterW(ts.FileSendFilter, UILanguageFile);
-	FileName[0] = 0;
-	OPENFILENAMEW ofn = {};
-	ofn.lStructSize = get_OPENFILENAME_SIZEW();
-	ofn.hwndOwner   = hWnd;
-	ofn.lpstrFilter = FNFilter;
-	ofn.nFilterIndex = 1;
-	ofn.lpstrFile = FileName;
-	ofn.nMaxFile = _countof(FileName);
-	ofn.lpstrInitialDir = CurDir;
-
-	ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
-	ofn.Flags |= OFN_ENABLETEMPLATE | OFN_ENABLEHOOK | OFN_EXPLORER | OFN_ENABLESIZING;
-	ofn.lpTemplateName = MAKEINTRESOURCEW(IDD_FOPT);
-
-	ofn.lpfnHook = TransFnHook;
-	optw = (WORD)*Option;
-	ofn.lCustData = (LPARAM)&optw;
-
-	ofn.Flags |= OFN_SHOWHELP;
-
-	ofn.lpstrTitle = caption;
-
-	ofn.hInstance = hInst;
-
-	BOOL Ok = _GetOpenFileNameW(&ofn);
-	free(FNFilter);
-
-	if (Ok) {
-		*Option = (long)optw;
-	}
-	/* restore dir */
-	_SetCurrentDirectoryW(TempDir);
-
-	wchar_t *ret = NULL;
-	if (Ok) {
-		ret = _wcsdup(FileName);
-	}
-	return ret;
-}
-
+/**
+ *	\x83t\x83@\x83C\x83\x8B\x91\x97\x90M
+ */
 BOOL FileSendStart(const wchar_t *filename, int binary)
 {
 	if (SendVar != NULL) {
@@ -318,6 +176,9 @@
 	if (! cv.Ready || FSend) {
 		return FALSE;
 	}
+	if (filename == NULL) {
+		return FALSE;
+	}
 	if (ProtoGetProtoFlag())
 	{
 		FreeFileVar(&SendVar);
@@ -330,28 +191,9 @@
 	FSend = TRUE;
 	PFileVar fv = SendVar;
 
-	wchar_t uimsg[MAX_UIMSG];
-	get_lang_msgW("FILEDLG_TRANS_TITLE_SENDFILE", uimsg, _countof(uimsg), L"Send file", ts.UILanguageFile);
-	aswprintf(&(fv->DlgCaption), L"Tera Term: %s", uimsg);
+	SendVar->FullName = _wcsdup(filename);
+	ts.TransBin = binary;
 
-	if (filename != NULL) {
-		SendVar->FullName = _wcsdup(filename);
-		ts.TransBin = binary;
-	}
-	else {
-		// \x83t\x83@\x83C\x83\x8B\x82\xAA\x8Ew\x92肳\x82\xEA\x82Ă\xA2\x82Ȃ\xA2\x8Fꍇ
-		LONG Option = 0;
-		if (ts.TransBin)
-			Option |= LOGDLG_BINARY;
-		wchar_t *filename = _GetTransFname(HVTWin, fv->DlgCaption, &Option);
-		if (filename == NULL) {
-			FileSendEnd();
-			return FALSE;
-		}
-		SendVar->FullName = filename;
-		ts.TransBin = CheckFlag(Option, LOGDLG_BINARY);
-	}
-
 	SendVar->FileHandle = _CreateFileW(SendVar->FullName, GENERIC_READ, FILE_SHARE_READ, NULL,
 									   OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
 	if (SendVar->FileHandle == INVALID_HANDLE_VALUE) {
@@ -435,7 +277,7 @@
 
 // \x88ȉ\xBA\x82̎\x9E\x82͂\xB1\x82\xBF\x82\xE7\x82̊֐\x94\x82\xF0\x8Eg\x82\xA4
 // - BinaryMode == true
-// - FileBracketMode == false
+// - FileBracketMode == FS_BRACKET_NONE
 // - cv.TelFlag == false
 // - ts.LocalEcho == 0
 static void FileSendBinayBoost(void)
@@ -499,11 +341,10 @@
 {
 	WORD c, fc;
 	LONG BCOld;
-	DWORD read_bytes;
 	PFileVar fv = SendVar;
 
 	if (cv.PortType == IdSerial && ts.FileSendHighSpeedMode &&
-	    BinaryMode && !FileBracketMode && !cv.TelFlag &&
+	    BinaryMode && FileBracketMode == FS_BRACKET_NONE && !cv.TelFlag &&
 	    (ts.LocalEcho == 0) && (ts.Baud >= 115200)) {
 		return FileSendBinayBoost();
 	}
@@ -542,6 +383,7 @@
 			}
 		}
 		else if (! FileReadEOF) {
+			DWORD read_bytes;
 			ReadFile(SendVar->FileHandle, &FileByte, 1, &read_bytes, NULL);
 			fc = LOWORD(read_bytes);
 			SendVar->ByteCount = SendVar->ByteCount + fc;

Modified: trunk/teraterm/teraterm/sendfiledlg.cpp
===================================================================
--- trunk/teraterm/teraterm/sendfiledlg.cpp	2021-02-06 05:44:11 UTC (rev 9145)
+++ trunk/teraterm/teraterm/sendfiledlg.cpp	2021-02-06 05:44:30 UTC (rev 9146)
@@ -45,7 +45,11 @@
 
 #include "sendfiledlg.h"
 
-#define TitSendFile L"Send file"
+typedef struct {
+	sendfiledlgdata *create_param;
+	// work
+	UINT MsgDlgHelp;
+} SendFileDlgWork_t;
 
 static INT_PTR CALLBACK SendFileDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
 {
@@ -66,14 +70,16 @@
 		{"DLG_SENDFILE_DELAYTYPE_PER_SENDSIZE", L"per sendsize"},
 	};
 	static const int send_size_list[] = {16, 256, 4 * 1024};
-	sendfiledlgdata *data = (sendfiledlgdata *)GetWindowLongPtr(hDlgWnd, DWLP_USER);
-	int i;
+	SendFileDlgWork_t *work = (SendFileDlgWork_t *)GetWindowLongPtr(hDlgWnd, DWLP_USER);
+	sendfiledlgdata *data = work != NULL ? work->create_param : NULL;
 
 	switch (msg) {
-		case WM_INITDIALOG:
+		case WM_INITDIALOG: {
+			work = (SendFileDlgWork_t *)calloc(sizeof(*work), 1);
+			SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)work);
 			data = (sendfiledlgdata *)lp;
-			data->MsgDlgHelp = RegisterWindowMessage(HELPMSGSTRING);
-			SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)data);
+			work->create_param = data;
+			work->MsgDlgHelp = RegisterWindowMessage(HELPMSGSTRING);
 			::DragAcceptFiles(hDlgWnd, TRUE);
 			SetDlgTexts(hDlgWnd, TextInfos, _countof(TextInfos), data->UILanguageFile);
 			CenterWindow(hDlgWnd, GetParent(hDlgWnd));
@@ -81,7 +87,7 @@
 			SetI18nList("TeraTerm", hDlgWnd, IDC_SENDFILE_DELAYTYPE_DROPDOWN, delaytype_list, _countof(delaytype_list),
 						data->UILanguageFile, 0);
 
-			for (i = 0; i < _countof(send_size_list); i++) {
+			for (size_t i = 0; i < _countof(send_size_list); i++) {
 				char buf[32];
 				sprintf(buf, "%d", send_size_list[i]);
 				SendDlgItemMessageA(hDlgWnd, IDC_SENDFILE_SEND_SIZE_DROPDOWN, CB_ADDSTRING, 0, (LPARAM)buf);
@@ -94,7 +100,7 @@
 			EnableWindow(GetDlgItem(hDlgWnd, IDC_SENDFILE_DELAYTIME_EDIT), FALSE);
 
 			return TRUE;
-
+		}
 		case WM_COMMAND:
 			switch (wp) {
 				case IDOK | (BN_CLICKED << 16): {
@@ -124,6 +130,7 @@
 					data->delay_type = (int)SendDlgItemMessage(hDlgWnd, IDC_SENDFILE_DELAYTYPE_DROPDOWN, CB_GETCURSEL, 0, 0);
 					data->delay_tick = GetDlgItemInt(hDlgWnd, IDC_SENDFILE_DELAYTIME_EDIT, NULL, FALSE);
 					data->send_size = GetDlgItemInt(hDlgWnd, IDC_SENDFILE_SEND_SIZE_DROPDOWN, NULL, FALSE);
+					data->method_4 = IsDlgButtonChecked(hDlgWnd, IDC_SENDFILE_CHECK_4);
 
 					TTEndDialog(hDlgWnd, IDOK);
 					return TRUE;
@@ -142,7 +149,7 @@
 					wchar_t TempDir[MAX_PATH];
 					_GetCurrentDirectoryW(_countof(TempDir), TempDir);
 
-					wchar_t *uimsg = TTGetLangStrW("Tera Term", "FILEDLG_TRANS_TITLE_SENDFILE", TitSendFile, data->UILanguageFile);
+					wchar_t *uimsg = TTGetLangStrW("Tera Term", "FILEDLG_TRANS_TITLE_SENDFILE", L"Send file", data->UILanguageFile);
 					wchar_t *title;
 					aswprintf(&title, L"Tera Term: %s", uimsg);
 					free(uimsg);
@@ -184,7 +191,6 @@
 				default:
 					return FALSE;
 			}
-			return FALSE;
 
 		case WM_DROPFILES: {
 			// \x95\xA1\x90\x94\x83h\x83\x8D\x83b\x83v\x82\xB3\x82\xEA\x82Ă\xE0\x8Dŏ\x89\x82\xCC1\x82‚\xBE\x82\xAF\x82\xF0\x88\xB5\x82\xA4
@@ -206,7 +212,7 @@
 			return TRUE;
 		}
 		default:
-			if (data != NULL && msg == data->MsgDlgHelp) {
+			if (work != NULL && msg == work->MsgDlgHelp) {
 				// \x83R\x83\x82\x83\x93\x83_\x83C\x83A\x83\x8D\x83O\x82Ńw\x83\x8B\x83v\x83{\x83^\x83\x93\x82\xAA\x89\x9F\x82\xB3\x82ꂽ
 				PostMessage(GetParent(hDlgWnd), WM_USER_DLGHELP2, HlpMenuFileSendfile, 0);
 				return TRUE;
@@ -218,6 +224,7 @@
 INT_PTR sendfiledlg(HINSTANCE hInstance, HWND hWndParent, sendfiledlgdata *data)
 {
 	INT_PTR ret;
+	data->method_4 = FALSE;
 	ret = TTDialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_SENDFILEDLG), hWndParent, SendFileDlgProc, (LPARAM)data);
 	return ret;
 }

Modified: trunk/teraterm/teraterm/sendfiledlg.h
===================================================================
--- trunk/teraterm/teraterm/sendfiledlg.h	2021-02-06 05:44:11 UTC (rev 9145)
+++ trunk/teraterm/teraterm/sendfiledlg.h	2021-02-06 05:44:30 UTC (rev 9146)
@@ -43,8 +43,7 @@
 	int delay_type;
 	DWORD delay_tick;
 	size_t send_size;
-	// work
-	WORD MsgDlgHelp;
+	BOOL method_4;			// Tera Term 4 \x82̃\x8B\x81[\x83`\x83\x93\x82\xF0\x8Eg\x97p\x82\xB7\x82\xE9
 } sendfiledlgdata;
 
 INT_PTR sendfiledlg(HINSTANCE hInstance, HWND hWndParent, sendfiledlgdata *data);
@@ -52,4 +51,3 @@
 #ifdef __cplusplus
 }
 #endif
-

Modified: trunk/teraterm/teraterm/sendmem.cpp
===================================================================
--- trunk/teraterm/teraterm/sendmem.cpp	2021-02-06 05:44:11 UTC (rev 9145)
+++ trunk/teraterm/teraterm/sendmem.cpp	2021-02-06 05:44:30 UTC (rev 9146)
@@ -41,7 +41,7 @@
 #include "ttwinman.h"		// for ts
 #include "codeconv.h"
 
-#define	SENDMEM_USE_OLD_API	1
+#define	SENDMEM_USE_OLD_API	0
 
 #if SENDMEM_USE_OLD_API
 #include "filesys.h"		// for FileSendStart()

Modified: trunk/teraterm/teraterm/sendmem.h
===================================================================
--- trunk/teraterm/teraterm/sendmem.h	2021-02-06 05:44:11 UTC (rev 9145)
+++ trunk/teraterm/teraterm/sendmem.h	2021-02-06 05:44:30 UTC (rev 9146)
@@ -56,12 +56,10 @@
 // idle\x82\xA9\x82\xE7\x82̑\x97\x90M\x97pAPI
 void SendMemContinuously(void);
 
+// convenient function
+BOOL SendMemPasteString(wchar_t *str);
+BOOL SendMemSendFile(const wchar_t *filename, BOOL binary, SendMemDelayType delay_type, DWORD delay_tick, size_t send_max);
+
 #ifdef __cplusplus
 }
 #endif
-
-#ifdef __cplusplus
-// convenient function
-BOOL SendMemSendFile(const wchar_t *filename, BOOL binary, SendMemDelayType delay_type = SENDMEM_DELAYTYPE_NO_DELAY, DWORD delay_tick = 0, size_t send_max = 0);
-BOOL SendMemPasteString(wchar_t *str);
-#endif

Modified: trunk/teraterm/teraterm/ttdde.c
===================================================================
--- trunk/teraterm/teraterm/ttdde.c	2021-02-06 05:44:11 UTC (rev 9145)
+++ trunk/teraterm/teraterm/ttdde.c	2021-02-06 05:44:30 UTC (rev 9146)
@@ -34,7 +34,6 @@
 #include <string.h>
 #include <ddeml.h>
 #include "ttwinman.h"
-#include "filesys.h"
 #include "ttsetup.h"
 #include "telnet.h"
 #include "ttlib.h"
@@ -46,6 +45,9 @@
 #include "codeconv.h"
 #include "broadcast.h"
 
+#include "filesys.h"
+#include "sendmem.h"
+
 #define ServiceName "TERATERM"
 #define ItemName "DATA"
 #define ItemName2 "PARAM"
@@ -625,7 +627,13 @@
 		break;
 	case CmdSendFile: {
 		wchar_t *ParamFileNameW = ToWcharU8(ParamFileName);
+#if 0
+		// Tera Term 4 \x82Ɠ\xAF\x82\xB6\x95\xFB\x96@\x82ő\x97\x90M
 		BOOL r = FileSendStart(ParamFileNameW, ParamBinaryFlag);
+#else
+		// 5 \x82Œlj\xC1\x82\xB5\x82\xBD\x95\xFB\x96@\x82ő\x97\x90M
+		BOOL r = SendMemSendFile(ParamFileNameW, ParamBinaryFlag, 0, 0, 0);
+#endif
 		free(ParamFileNameW);
 		if (r) {
 			DdeCmnd = TRUE;

Modified: trunk/teraterm/teraterm/ttermpro.rc
===================================================================
--- trunk/teraterm/teraterm/ttermpro.rc	2021-02-06 05:44:11 UTC (rev 9145)
+++ trunk/teraterm/teraterm/ttermpro.rc	2021-02-06 05:44:30 UTC (rev 9146)
@@ -344,7 +344,7 @@
     EDITTEXT        IDC_SSH_SETUPDIR_EDIT_VSTORE,68,179,251,14,ES_AUTOHSCROLL | ES_READONLY
 END
 
-IDD_SENDFILEDLG DIALOGEX 0, 0, 271, 182
+IDD_SENDFILEDLG DIALOGEX 0, 0, 271, 188
 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Send file"
 FONT 8, "MS Shell Dlg", 400, 0, 0x1
@@ -352,16 +352,18 @@
     LTEXT           "&Filename (drop file in this dialog)",IDC_SENDFILE_FILENAME_TITLE,9,7,172,8
     EDITTEXT        IDC_SENDFILE_FILENAME_EDIT,18,21,224,14,ES_AUTOHSCROLL
     PUSHBUTTON      "...",IDC_SENDFILE_FILENAME_BUTTON,245,21,14,14
-    CONTROL         "&Binary",IDC_SENDFILE_CHECK_BINARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,44,72,10
-    LTEXT           "delay type",IDC_SENDFILE_DELAYTYPE_LABEL,9,61,74,11
-    COMBOBOX        IDC_SENDFILE_DELAYTYPE_DROPDOWN,18,75,64,53,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
-    LTEXT           "send size(bytes)",IDC_SENDFILE_SEND_SIZE_LABEL,9,92,75,8
-    COMBOBOX        IDC_SENDFILE_SEND_SIZE_DROPDOWN,18,106,65,47,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
-    LTEXT           "delay time(ms)",IDC_SENDFILE_DELAYTIME_LABEL,9,124,75,8
-    EDITTEXT        IDC_SENDFILE_DELAYTIME_EDIT,18,139,40,14,ES_AUTOHSCROLL
-    PUSHBUTTON      "Help",IDHELP,104,160,50,14
-    DEFPUSHBUTTON   "OK",IDOK,160,160,50,14
-    PUSHBUTTON      "Cancel",IDCANCEL,215,160,50,14
+    CONTROL         "Send in same way as Tera Term 4",IDC_SENDFILE_CHECK_4,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,42,124,10
+    CONTROL         "&Binary",IDC_SENDFILE_CHECK_BINARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,59,72,10
+    LTEXT           "delay type",IDC_SENDFILE_DELAYTYPE_LABEL,9,76,74,11
+    COMBOBOX        IDC_SENDFILE_DELAYTYPE_DROPDOWN,18,90,64,53,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "send size(bytes)",IDC_SENDFILE_SEND_SIZE_LABEL,9,107,75,8
+    COMBOBOX        IDC_SENDFILE_SEND_SIZE_DROPDOWN,18,121,65,47,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "delay time(ms)",IDC_SENDFILE_DELAYTIME_LABEL,9,139,75,8
+    EDITTEXT        IDC_SENDFILE_DELAYTIME_EDIT,18,154,40,14,ES_AUTOHSCROLL
+    PUSHBUTTON      "Help",IDHELP,104,166,50,14
+    DEFPUSHBUTTON   "OK",IDOK,160,166,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,215,166,50,14
 END
 
 
@@ -466,7 +468,7 @@
     BEGIN
         VERTGUIDE, 9
         VERTGUIDE, 18
-        BOTTOMMARGIN, 174
+        BOTTOMMARGIN, 180
     END
 END
 #endif    // APSTUDIO_INVOKED

Modified: trunk/teraterm/teraterm/vtterm.c
===================================================================
--- trunk/teraterm/teraterm/vtterm.c	2021-02-06 05:44:11 UTC (rev 9145)
+++ trunk/teraterm/teraterm/vtterm.c	2021-02-06 05:44:30 UTC (rev 9146)
@@ -5206,7 +5206,7 @@
 	unsigned char b;
 	WORD word;
 
-	if (_stricmp(ts.Locale, DEFAULT_LOCALE) == 0) {
+	if (ts.CodePage == 932) {
 		for (i = 0 ; i < len ; i++) {
 			b = str[i];
 			if (IS_SJIS(b) || IS_EUC(b)) {

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2021-02-06 05:44:11 UTC (rev 9145)
+++ trunk/teraterm/teraterm/vtwin.cpp	2021-02-06 05:44:30 UTC (rev 9146)
@@ -1827,10 +1827,10 @@
 			// cancel
 			break;
 		case DROP_TYPE_SEND_FILE:
-			SendMemSendFile(FileName, FALSE);
+			SendMemSendFile(FileName, FALSE, SENDMEM_DELAYTYPE_NO_DELAY, 0, 0);
 			break;
 		case DROP_TYPE_SEND_FILE_BINARY:
-			SendMemSendFile(FileName, TRUE);
+			SendMemSendFile(FileName, TRUE, SENDMEM_DELAYTYPE_NO_DELAY, 0, 0);
 			break;
 		case DROP_TYPE_PASTE_FILENAME:
 		{
@@ -4089,11 +4089,6 @@
 
 void CVTWindow::OnFileSend()
 {
-#if 1
-	// file send same as teraterm 4
-	HelpId = HlpFileSend;
-	FileSendStart(NULL, 0);
-#else
 	// new file send
 	SetDialogFont(ts.DialogFontName, ts.DialogFontPoint, ts.DialogFontCharSet,
 				  ts.UILanguageFile, "Tera Term", "DLG_TAHOMA_FONT");
@@ -4106,9 +4101,15 @@
 	}
 
 	wchar_t *filename = data.filename;
-	SendMemSendFile(filename, data.binary, (SendMemDelayType)data.delay_type, data.delay_tick, data.send_size);
+	if (!data.method_4) {
+		SendMemSendFile(filename, data.binary, (SendMemDelayType)data.delay_type, data.delay_tick, data.send_size);
+	}
+	else {
+		// file send same as teraterm 4
+		HelpId = HlpFileSend;
+		FileSendStart(filename, 0);
+	}
 	free(filename);
-#endif
 }
 
 void CVTWindow::OnFileKermitRcv()


Ttssh2-commit メーリングリストの案内
Zurück zum Archiv-Index