• R/O
  • SSH
  • HTTPS

ttssh2: コミット


コミットメタ情報

リビジョン7148 (tree)
日時2018-07-13 20:05:13
作者zmatsuo

ログメッセージ

merge drag and drop branch r7147

- drag and drop branchをマージ
- ttssh2/installer/release/lang/Russian.lngが未編集
- teraterm/teraterm/dnddlg.cpp,hをプロジェクトファイルに追加できていない

変更サマリ

差分

--- trunk/teraterm/ttpdlg/ttdlg.c (revision 7147)
+++ trunk/teraterm/ttpdlg/ttdlg.c (revision 7148)
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (C) 1994-1998 T. Teranishi
3- * (C) 2004-2017 TeraTerm Project
3+ * (C) 2004-2018 TeraTerm Project
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
@@ -72,9 +72,9 @@
7272
7373 char UILanguageFile[MAX_PATH];
7474
75-static PCHAR far NLListRcv[] = {"CR","CR+LF", "LF", "AUTO", NULL};
76-static PCHAR far NLList[] = {"CR","CR+LF", "LF", NULL};
77-static PCHAR far TermList[] =
75+static PCHAR NLListRcv[] = {"CR","CR+LF", "LF", "AUTO", NULL};
76+static PCHAR NLList[] = {"CR","CR+LF", "LF", NULL};
77+static PCHAR TermList[] =
7878 {"VT100", "VT101", "VT102", "VT282", "VT320", "VT382",
7979 "VT420", "VT520", "VT525", NULL};
8080 static WORD Term_TermJ[] =
@@ -81,29 +81,34 @@
8181 {IdVT100, IdVT101, IdVT102, IdVT282, IdVT320, IdVT382,
8282 IdVT420, IdVT520, IdVT525};
8383 static WORD TermJ_Term[] = {1, 1, 2, 3, 3, 4, 4, 5, 6, 7, 8, 9};
84-static PCHAR far TermListJ[] =
84+static PCHAR TermListJ[] =
8585 {"VT100", "VT100J", "VT101", "VT102", "VT102J", "VT220J", "VT282",
8686 "VT320", "VT382", "VT420", "VT520", "VT525", NULL};
87-static PCHAR far KanjiList[] = {"SJIS","EUC","JIS", "UTF-8", "UTF-8m", NULL};
88-static PCHAR far KanjiListSend[] = {"SJIS","EUC","JIS", "UTF-8", NULL};
89-static PCHAR far KanjiInList[] = {"^[$@","^[$B",NULL};
90-static PCHAR far KanjiOutList[] = {"^[(B","^[(J",NULL};
91-static PCHAR far KanjiOutList2[] = {"^[(B","^[(J","^[(H",NULL};
92-static PCHAR far RussList[] = {"Windows","KOI8-R","CP 866","ISO 8859-5",NULL};
93-static PCHAR far RussList2[] = {"Windows","KOI8-R",NULL};
94-static PCHAR far LocaleList[] = {"japanese","chinese", "chinese-simplified", "chinese-traditional", NULL};
95-static PCHAR far MetaList[] = {"off", "on", "left", "right", NULL};
96-static PCHAR far MetaList2[] = {"off", "on", NULL};
87+static PCHAR KanjiList[] = {"SJIS","EUC","JIS", "UTF-8", "UTF-8m", NULL};
88+static PCHAR KanjiListSend[] = {"SJIS","EUC","JIS", "UTF-8", NULL};
89+static PCHAR KanjiInList[] = {"^[$@","^[$B",NULL};
90+static PCHAR KanjiOutList[] = {"^[(B","^[(J",NULL};
91+static PCHAR KanjiOutList2[] = {"^[(B","^[(J","^[(H",NULL};
92+static PCHAR RussList[] = {"Windows","KOI8-R","CP 866","ISO 8859-5",NULL};
93+static PCHAR RussList2[] = {"Windows","KOI8-R",NULL};
94+static PCHAR LocaleList[] = {"japanese","chinese", "chinese-simplified", "chinese-traditional", NULL};
95+static PCHAR MetaList[] = {"off", "on", "left", "right", NULL};
96+static PCHAR MetaList2[] = {"off", "on", NULL};
9797
9898 // HKS
99-static PCHAR far KoreanList[] = {"KS5601", "UTF-8", "UTF-8m", NULL};
100-static PCHAR far KoreanListSend[] = {"KS5601", "UTF-8", NULL};
99+static PCHAR KoreanList[] = {"KS5601", "UTF-8", "UTF-8m", NULL};
100+static PCHAR KoreanListSend[] = {"KS5601", "UTF-8", NULL};
101101
102102 // UTF-8
103-static PCHAR far Utf8List[] = {"UTF-8", "UTF-8m", NULL};
104-static PCHAR far Utf8ListSend[] = {"UTF-8", NULL};
103+static PCHAR Utf8List[] = {"UTF-8", "UTF-8m", NULL};
104+static PCHAR Utf8ListSend[] = {"UTF-8", NULL};
105105
106+static PCHAR BaudList[] =
107+ {"110","300","600","1200","2400","4800","9600",
108+ "14400","19200","38400","57600","115200",
109+ "230400", "460800", "921600", NULL};
106110
111+
107112 BOOL CALLBACK TermDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
108113 {
109114 PTTSet ts;
@@ -1359,10 +1364,10 @@
13591364 return FALSE;
13601365 }
13611366
1362-static PCHAR far DataList[] = {"7 bit","8 bit",NULL};
1363-static PCHAR far ParityList[] = {"none", "odd", "even", "mark", "space", NULL};
1364-static PCHAR far StopList[] = {"1 bit", "1.5 bit", "2 bit", NULL};
1365-static PCHAR far FlowList[] = {"Xon/Xoff","hardware","none",NULL};
1367+static PCHAR DataList[] = {"7 bit","8 bit",NULL};
1368+static PCHAR ParityList[] = {"none", "odd", "even", "mark", "space", NULL};
1369+static PCHAR StopList[] = {"1 bit", "1.5 bit", "2 bit", NULL};
1370+static PCHAR FlowList[] = {"Xon/Xoff","hardware","none",NULL};
13661371
13671372 BOOL CALLBACK SerialDlg(HWND Dialog, UINT Message, WPARAM wParam, LPARAM lParam)
13681373 {
@@ -3036,7 +3041,7 @@
30363041 return FALSE;
30373042 }
30383043
3039-static PCHAR far LangList[] = {"English","Japanese","Russian","Korean","UTF-8",NULL};
3044+static PCHAR LangList[] = {"English","Japanese","Russian","Korean","UTF-8",NULL};
30403045 static char **LangUIList = NULL;
30413046 #define LANG_PATH "lang"
30423047 #define LANG_EXT ".lng"
@@ -3573,7 +3578,7 @@
35733578 switch (ul_reason_for_call) {
35743579 case DLL_THREAD_ATTACH:
35753580 /* do thread initialization */
3576- break;
3581+ break;
35773582 case DLL_THREAD_DETACH:
35783583 /* do thread cleanup */
35793584 break;
--- trunk/teraterm/svnrev/svnrev.cpp (revision 7147)
+++ trunk/teraterm/svnrev/svnrev.cpp (revision 7148)
@@ -1,5 +1,5 @@
11 /*
2- * Copyright (C) 2009-2017 TeraTerm Project
2+ * Copyright (C) 2009-2018 TeraTerm Project
33 * All rights reserved.
44 *
55 * Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,10 @@
4343
4444 // _popen はスペースが含まれる場合にダブルクォートで囲んでも
4545 // うまく動かないため 8.3 形式に変換
46- GetShortPathName(svnversion, arg1, sizeof(arg1));
46+ DWORD r = GetShortPathName(svnversion, arg1, sizeof(arg1));
47+ if (r == 0) {
48+ return -1; // svn did not exist
49+ }
4750 GetShortPathName(path, arg2, sizeof(arg2));
4851
4952 _snprintf_s(command, sizeof(command), _TRUNCATE, "%s -n %s", arg1, arg2);
--- trunk/teraterm/teraterm/vtdisp.c (revision 7147)
+++ trunk/teraterm/teraterm/vtdisp.c (revision 7148)
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (C) 1994-1998 T. Teranishi
3- * (C) 2005-2017 TeraTerm Project
3+ * (C) 2005-2018 TeraTerm Project
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
@@ -44,7 +44,7 @@
4444
4545 #define CurWidth 2
4646
47-int DefaultColorTable[256][3] = {
47+static const BYTE DefaultColorTable[256][3] = {
4848 { 0, 0, 0}, {255, 0, 0}, { 0,255, 0}, {255,255, 0}, { 0, 0,255}, {255, 0,255}, { 0,255,255}, {255,255,255}, // 0 - 7
4949 {128,128,128}, {128, 0, 0}, { 0,128, 0}, {128,128, 0}, { 0, 0,128}, {128, 0,128}, { 0,128,128}, {192,192,192}, // 8 - 15
5050 { 0, 0, 0}, { 0, 0, 95}, { 0, 0,135}, { 0, 0,175}, { 0, 0,215}, { 0, 0,255}, { 0, 95, 0}, { 0, 95, 95}, // 16 - 23
--- trunk/teraterm/teraterm/vtwin.cpp (revision 7147)
+++ trunk/teraterm/teraterm/vtwin.cpp (revision 7148)
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (C) 1994-1998 T. Teranishi
3- * (C) 2004-2017 TeraTerm Project
3+ * (C) 2004-2018 TeraTerm Project
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
@@ -77,6 +77,7 @@
7777 #include "addsetting.h"
7878 #include "winjump.h"
7979 #include "sizetip.h"
80+#include "dnddlg.h"
8081
8182 #include "initguid.h"
8283 //#include "Usbiodef.h"
@@ -254,6 +255,7 @@
254255 ON_COMMAND(ID_WINDOW_UNDO, OnWindowUndo)
255256 ON_COMMAND(ID_HELP_INDEX2, OnHelpIndex)
256257 ON_COMMAND(ID_HELP_ABOUT, OnHelpAbout)
258+ ON_MESSAGE(WM_USER_DROPNOTIFY, OnDropNotify)
257259 //}}AFX_MSG_MAP
258260 END_MESSAGE_MAP()
259261
@@ -918,6 +920,9 @@
918920 // Tera Termの起動時、Virtual Storeが働くかどうかを覚えておく。
919921 // (2015.11.14 yutaka)
920922 cv.VirtualStoreEnabled = GetVirtualStoreEnvironment();
923+
924+ DropLists = NULL;
925+ DropListCount = 0;
921926 }
922927
923928 /////////////////////////////////////////////////////////////////////////////
@@ -1986,6 +1991,7 @@
19861991
19871992 /* Disable drag-drop */
19881993 ::DragAcceptFiles(HVTWin,FALSE);
1994+ DropListFree();
19891995
19901996 EndDDE();
19911997
@@ -2019,210 +2025,302 @@
20192025 DeleteNotifyIcon(&cv);
20202026 }
20212027
2022-static LRESULT CALLBACK OnDragDropDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
2028+static void EscapeFilename(const char *src, char *dest)
20232029 {
2024- static HFONT DlgDragDropFont = NULL;
2025- char uimsg[MAX_UIMSG];
2026- LOGFONT logfont;
2027- HFONT font;
2030+#define ESCAPE_CHARS " ;&()$!`'[]{}#^~"
2031+ setlocale(LC_ALL, ts.Locale);
2032+ const char *s = src;
2033+ char *d = dest;
2034+ while (*s) {
2035+ if (isleadbyte(*s)) { // multi-byte
2036+ *d++ = *s++;
2037+ *d++ = *s++;
2038+ continue;
2039+ }
2040+ char c = *s++;
2041+ if (c == '\\') {
2042+ // パスの区切りを \ -> / へ
2043+ *d = '/';
2044+ } else if (strchr(ESCAPE_CHARS, c) != NULL) {
2045+ // エスケープが必要な文字
2046+ *d++ = '\\';
2047+ *d = c;
2048+ } else {
2049+ *d = c;
2050+ }
2051+ d++;
2052+ }
2053+ *d = '\0'; // null-terminate
2054+}
20282055
2029- switch (msg) {
2030- case WM_INITDIALOG:
2031- font = (HFONT)SendMessage(hDlgWnd, WM_GETFONT, 0, 0);
2032- GetObject(font, sizeof(LOGFONT), &logfont);
2033- if (get_lang_font("DLG_TAHOMA_FONT", hDlgWnd, &logfont, &DlgDragDropFont, ts.UILanguageFile)) {
2034- SendDlgItemMessage(hDlgWnd, IDC_SCP_PATH, WM_SETFONT, (WPARAM)DlgDragDropFont, MAKELPARAM(TRUE,0));
2035- SendDlgItemMessage(hDlgWnd, IDOK, WM_SETFONT, (WPARAM)DlgDragDropFont, MAKELPARAM(TRUE,0));
2036- SendDlgItemMessage(hDlgWnd, IDCANCEL, WM_SETFONT, (WPARAM)DlgDragDropFont, MAKELPARAM(TRUE,0));
2037- SendDlgItemMessage(hDlgWnd, IDC_DAD_STATIC, WM_SETFONT, (WPARAM)DlgDragDropFont, MAKELPARAM(TRUE,0));
2038- SendDlgItemMessage(hDlgWnd, IDC_DAD_SENDFILE, WM_SETFONT, (WPARAM)DlgDragDropFont, MAKELPARAM(TRUE,0));
2039- } else {
2040- DlgDragDropFont = NULL;
2041- }
2056+static void PasteString(PComVar cv, const char *str, bool escape)
2057+{
2058+ PCHAR ptr = (PCHAR)str;
2059+ char *tmpbuf = NULL;
2060+ if (escape) {
2061+ size_t len = strlen(str) * 2;
2062+ tmpbuf = (char *)malloc(len);
2063+ EscapeFilename(str, tmpbuf);
2064+ ptr = tmpbuf;
2065+ }
20422066
2043- GetWindowText(hDlgWnd, uimsg, sizeof(uimsg));
2044- get_lang_msg("MSG_DANDD_CONF_TITLE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
2045- SetWindowText(hDlgWnd, ts.UIMsg);
2067+ // consoleへ送信
2068+ while (*ptr) {
2069+ CommTextOut(cv, ptr, 1);
2070+ if (ts.LocalEcho > 0) {
2071+ CommTextEcho(cv, ptr, 1);
2072+ }
2073+ ptr++;
2074+ }
20462075
2047- get_lang_msg("MSG_DANDD_CONF", ts.UIMsg, sizeof(ts.UIMsg),
2048- "Are you sure that you want to send the file content?", ts.UILanguageFile);
2049- SetDlgItemText(hDlgWnd, IDC_DAD_STATIC, ts.UIMsg);
2076+ if (tmpbuf != NULL) free(tmpbuf);
2077+}
20502078
2051- get_lang_msg("FILEDLG_TRANS_TITLE_SENDFILE", ts.UIMsg, sizeof(ts.UIMsg),
2052- "Send file", ts.UILanguageFile);
2053- SetDlgItemText(hDlgWnd, IDOK, ts.UIMsg);
2079+/* 入力はファイルのみ(フォルダは含まれない) */
2080+static bool SendScp(char *Filenames[], int FileCount, const char *SendDir)
2081+{
2082+ typedef int (CALLBACK *PSSH_start_scp)(char *, char *);
2083+ static PSSH_start_scp func = NULL;
2084+ static HMODULE h = NULL;
2085+ char msg[128];
20542086
2055- SendMessage(GetDlgItem(hDlgWnd, IDC_SCP_PATH), WM_SETTEXT, 0, (LPARAM)ts.ScpSendDir);
2087+ if (h == NULL) {
2088+ if ( ((h = GetModuleHandle("ttxssh.dll")) == NULL) ) {
2089+ _snprintf_s(msg, sizeof(msg), _TRUNCATE, "GetModuleHandle(\"ttxssh.dll\")) %d", GetLastError());
2090+ scp_send_error:
2091+ ::MessageBox(NULL, msg, "Tera Term: scpsend command error", MB_OK | MB_ICONERROR);
2092+ return false;
2093+ }
2094+ }
2095+ if (func == NULL) {
2096+ func = (PSSH_start_scp)GetProcAddress(h, "TTXScpSendfile");
2097+ if (func == NULL) {
2098+ _snprintf_s(msg, sizeof(msg), _TRUNCATE, "GetProcAddress(\"TTXScpSendfile\")) %d", GetLastError());
2099+ goto scp_send_error;
2100+ }
2101+ }
20562102
2057- // SSH2 接続ではない場合には "SCP" を無効化する。
2058- if (cv.isSSH != 2) {
2059- EnableWindow(GetDlgItem(hDlgWnd, IDC_DAD_SENDFILE), FALSE);
2060- EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH), FALSE);
2061- EnableWindow(GetDlgItem(hDlgWnd, IDC_STATIC), FALSE);
2103+ for (int i = 0; i < FileCount; i++) {
2104+ const char *FileName = Filenames[i];
2105+ func((char *)FileName, ts.ScpSendDir);
2106+ }
2107+ return true;
2108+}
20622109
2063- // フォーカスの初期状態を Cancel にする為、この時点では Send File (IDOK)に
2064- // フォーカスを当てる。後で WM_NEXTDLGCTL でフォーカスが次のボタンになる。
2065- SetFocus(GetDlgItem(hDlgWnd, IDOK));
2066- }
2067- else {
2068- // SSH2 接続時は Cancel にフォーカスを当て、最終的に SCP PATH にフォーカスが
2069- // 当たるようにする。
2070- SetFocus(GetDlgItem(hDlgWnd, IDCANCEL));
2071- }
2110+void CVTWindow::DropListFree()
2111+{
2112+ if (DropListCount > 0) {
2113+ for (int i = 0; i < DropListCount; i++) {
2114+ free(DropLists[i]);
2115+ DropLists[i] = NULL;
2116+ }
2117+ free(DropLists);
2118+ DropLists = NULL;
2119+ DropListCount = 0;
2120+ }
2121+}
20722122
2073- // フォーカスを次のボタンに移す
2074- // SetFocus() で直接フォーカスを当てるとタブキーの動作等に問題が出るため、
2075- // このメッセージを併用する
2076- PostMessage(hDlgWnd, WM_NEXTDLGCTL, 0, 0L);
2123+LONG CVTWindow::OnDropNotify(UINT ShowDialog, LONG lParam)
2124+{
2125+ // iniに保存されない、今実行しているTera Termでのみ有効な設定
2126+ static enum drop_type DefaultDropType = DROP_TYPE_CANCEL;
2127+ static unsigned char DefaultDropTypePaste = DROP_TYPE_PASTE_ESCAPE;
2128+ static bool DefaultShowDialog = ts.ConfirmFileDragAndDrop ? true : false;
20772129
2078- // TRUEにするとボタンにフォーカスが当たらない。
2079- return FALSE;
2130+ (void)lParam;
2131+ int FileCount = 0;
2132+ int DirectoryCount = 0;
2133+ for (int i = 0; i < DropListCount; i++) {
2134+ const char *FileName = DropLists[i];
2135+ const DWORD attr = GetFileAttributes(FileName);
2136+ if (attr == -1 ) {
2137+ goto finish;
2138+ }
2139+ if (attr & FILE_ATTRIBUTE_DIRECTORY) {
2140+ DirectoryCount++;
2141+ } else {
2142+ FileCount++;
2143+ }
2144+ }
20802145
2081- case WM_COMMAND:
2082- switch (LOWORD(wp)) {
2083- case IDC_DAD_SENDFILE:
2084- SendMessage(GetDlgItem(hDlgWnd, IDC_SCP_PATH), WM_GETTEXT, sizeof(ts.ScpSendDir), (LPARAM)ts.ScpSendDir);
2085- if (DlgDragDropFont != NULL) {
2086- DeleteObject(DlgDragDropFont);
2146+ bool DoSameProcess = false;
2147+ const bool isSSH = (cv.isSSH == 2);
2148+ enum drop_type DropType;
2149+ unsigned char DropTypePaste = DROP_TYPE_PASTE_ESCAPE;
2150+ if (DefaultDropType == DROP_TYPE_CANCEL) {
2151+ // default is not set
2152+ if (!ShowDialog) {
2153+ if (FileCount == 1 && DirectoryCount == 0) {
2154+ if (ts.ConfirmFileDragAndDrop) {
2155+ if (isSSH) {
2156+ DropType = DROP_TYPE_SCP;
2157+ } else {
2158+ DropType = DROP_TYPE_SEND_FILE;
20872159 }
2088- EndDialog(hDlgWnd, IDC_DAD_SENDFILE);
2089- break;
2160+ DoSameProcess = false;
2161+ } else {
2162+ DropType = DROP_TYPE_SEND_FILE;
2163+ DoSameProcess = DefaultShowDialog ? false : true;
2164+ }
2165+ } else if (FileCount == 0 && DirectoryCount == 1) {
2166+ DropType = DROP_TYPE_PASTE_FILENAME;
2167+ DoSameProcess = DefaultShowDialog ? false : true;
2168+ } else if (FileCount > 0 && DirectoryCount > 0) {
2169+ DropType = DROP_TYPE_PASTE_FILENAME;
2170+ DoSameProcess = false;
2171+ } else if (FileCount > 0 && DirectoryCount == 0) {
2172+ // filename only
2173+ if (isSSH) {
2174+ DropType = DROP_TYPE_SCP;
2175+ } else {
2176+ DropType = DROP_TYPE_SEND_FILE;
2177+ }
2178+ DoSameProcess = false;
2179+ } else {
2180+ // directory only
2181+ DropType = DROP_TYPE_PASTE_FILENAME;
2182+ DoSameProcess = ts.ConfirmFileDragAndDrop ? false : true;
2183+ }
2184+ } else {
2185+ // show dialog
2186+ if (DirectoryCount > 0) {
2187+ DropType = DROP_TYPE_PASTE_FILENAME;
2188+ } else {
2189+ if (isSSH) {
2190+ DropType = DROP_TYPE_SCP;
2191+ } else {
2192+ DropType = DROP_TYPE_SEND_FILE;
2193+ }
2194+ }
2195+ DoSameProcess = false;
2196+ }
2197+ } else {
2198+ if (DirectoryCount > 0 &&
2199+ (DefaultDropType == DROP_TYPE_SEND_FILE ||
2200+ DefaultDropType == DROP_TYPE_SEND_FILE_BINARY ||
2201+ DefaultDropType == DROP_TYPE_SCP))
2202+ { // デフォルトのままでは処理できない組み合わせ
2203+ DropType = DROP_TYPE_PASTE_FILENAME;
2204+ DropTypePaste = DefaultDropTypePaste;
2205+ DoSameProcess = false;
2206+ } else {
2207+ DropType = DefaultDropType;
2208+ DropTypePaste = DefaultDropTypePaste;
2209+ DoSameProcess = (ShowDialog || DefaultShowDialog) ? false : true;
2210+ }
2211+ }
20902212
2091- case IDOK:
2092- if (DlgDragDropFont != NULL) {
2093- DeleteObject(DlgDragDropFont);
2094- }
2095- EndDialog(hDlgWnd, IDOK);
2096- break;
2213+ for (int i = 0; i < DropListCount; i++) {
2214+ const char *FileName = DropLists[i];
20972215
2098- case IDCANCEL:
2099- if (DlgDragDropFont != NULL) {
2100- DeleteObject(DlgDragDropFont);
2216+ if (!DoSameProcess) {
2217+ bool DoSameProcessNextDrop;
2218+ bool DoNotShowDialog = !DefaultShowDialog;
2219+ DropType =
2220+ ShowDropDialogBox(hInst, HVTWin,
2221+ FileName, DropType,
2222+ DropListCount - i,
2223+ (DirectoryCount == 0 && isSSH) ? true : false,
2224+ DirectoryCount == 0 ? true : false,
2225+ ts.ConfirmFileDragAndDrop ? false : true,
2226+ &DropTypePaste,
2227+ &DoSameProcess,
2228+ &DoSameProcessNextDrop,
2229+ &DoNotShowDialog);
2230+ if (DropType == DROP_TYPE_CANCEL) {
2231+ goto finish;
2232+ }
2233+ if (DoSameProcessNextDrop) {
2234+ DefaultDropType = DropType;
2235+ DefaultDropTypePaste = DropTypePaste;
2236+ }
2237+ if (!ts.ConfirmFileDragAndDrop) {
2238+ DefaultShowDialog = !DoNotShowDialog;
2239+ }
2240+ }
2241+
2242+ switch (DropType) {
2243+ case DROP_TYPE_CANCEL:
2244+ default:
2245+ // cancel
2246+ break;
2247+ case DROP_TYPE_SEND_FILE:
2248+ case DROP_TYPE_SEND_FILE_BINARY:
2249+ if (SendVar==NULL && NewFileVar(&SendVar)) {
2250+ HelpId = HlpFileSend;
2251+ strncpy_s(SendVar->FullName, sizeof(SendVar->FullName), FileName, _TRUNCATE);
2252+ SendVar->DirLen = 0;
2253+ ts.TransBin = DropType == DROP_TYPE_SEND_FILE ? 0 : 1;
2254+ FileSendStart();
2255+#if 0
2256+ goto finish; // send fileは連続してできない
2257+#else
2258+ {
2259+ LONG lCount = 0;
2260+ CWinApp *app = AfxGetApp();
2261+ while(1) {
2262+ if (SendVar == NULL) {
2263+ break;
2264+ }
2265+ app->OnIdle(lCount++);
21012266 }
2102- EndDialog(hDlgWnd, IDCANCEL);
2103- break;
2104-
2105- default:
2106- return FALSE;
2267+ }
2268+#endif
21072269 }
2270+ break;
2271+ case DROP_TYPE_PASTE_FILENAME:
2272+ {
2273+ const bool escape = (DropTypePaste & DROP_TYPE_PASTE_ESCAPE) ? true : false;
2274+ if (!BracketedPasteMode()) {
2275+ TermSendStartBracket();
2276+ }
2277+ PasteString(&cv, FileName, escape);
2278+ if (DropListCount > 1 && i < DropListCount - 1) {
2279+ const char *separator = (DropTypePaste & DROP_TYPE_PASTE_NEWLINE) ? "\n" : " ";
2280+ PasteString(&cv, separator, false);
2281+ }
2282+ break;
2283+ }
2284+ case DROP_TYPE_SCP:
2285+ {
2286+ // send by scp
2287+ char **FileNames = &DropLists[i];
2288+ int FileCount = DoSameProcess ? DropListCount - i : 1;
2289+ if (!SendScp(FileNames, FileCount, ts.ScpSendDir)) {
2290+ goto finish;
2291+ }
2292+ i += FileCount - 1;
2293+ break;
2294+ }
2295+ }
2296+ }
21082297
2109- default:
2110- return FALSE;
2298+finish:
2299+ if (BracketedPasteMode()) {
2300+ TermSendEndBracket();
21112301 }
2112- return TRUE;
2302+ DropListFree();
2303+ return 0;
21132304 }
21142305
21152306 void CVTWindow::OnDropFiles(HDROP hDropInfo)
21162307 {
21172308 ::SetForegroundWindow(HVTWin);
2118- if (cv.Ready && (SendVar==NULL) && NewFileVar(&SendVar))
2309+ if (cv.Ready && SendVar==NULL)
21192310 {
2120- if (DragQueryFile(hDropInfo,0,SendVar->FullName,
2121- sizeof(SendVar->FullName))>0)
2122- {
2123- DWORD attr;
2124- char *ptr, *q;
2125- char tmpbuf[_MAX_PATH * 2];
2311+ const UINT ShowDialog =
2312+ ((GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0) ? 1 : 0;
2313+ DropListCount = DragQueryFile(hDropInfo, -1, NULL, 0);
2314+ DropLists = (char **)malloc(sizeof(char *) * DropListCount);
21262315
2127- // ディレクトリの場合はフルパス名を貼り付ける (2004.11.3 yutaka)
2128- attr = GetFileAttributes(SendVar->FullName);
2129- if (attr != -1 && (attr & FILE_ATTRIBUTE_DIRECTORY)) {
2130- ptr = SendVar->FullName;
2131- // パスの区切りを \ -> / へ
2132- setlocale(LC_ALL, ts.Locale);
2133- while (*ptr) {
2134- if (isleadbyte(*ptr)) { // multi-byte
2135- ptr += 2;
2136- continue;
2137- }
2138- if (*ptr == '\\')
2139- *ptr = '/';
2140- ptr++;
2141- }
2316+ for (int i = 0; i < DropListCount; i++) {
2317+ const UINT cch = DragQueryFile(hDropInfo, i, NULL, 0) + 1;
2318+ char *FileName = (char *)malloc(cch);
2319+ DropLists[i] = FileName;
2320+ DragQueryFile(hDropInfo,i,FileName,cch);
2321+ }
21422322
2143- // パスに空白があればエスケープする
2144- q = tmpbuf;
2145- ptr = SendVar->FullName;
2146- while (*ptr) {
2147- if (*ptr == ' ')
2148- *q++ = '\\';
2149- *q++ = *ptr;
2150- ptr++;
2151- }
2152- *q = '\0'; // null-terminate
2153-
2154- ptr = tmpbuf;
2155-
2156- // consoleへ送信
2157- while (*ptr) {
2158- CommTextOut(&cv, ptr, 1);
2159- if (ts.LocalEcho > 0) {
2160- CommTextEcho(&cv, ptr, 1);
2161- }
2162- ptr++;
2163- }
2164- FreeFileVar(&SendVar); // 解放を忘れずに
2165-
2166- } else {
2167- // Confirm send a file when drag and drop (2007.12.28 maya)
2168- if (ts.ConfirmFileDragAndDrop) {
2169- // いきなりファイルの内容を送り込む前に、ユーザに問い合わせを行う。(2006.1.21 yutaka)
2170- // MessageBoxでSCPも選択できるようにする。(2008.1.25 yutaka)
2171- // SCPパスを指定できるようにダイアログに変更した。(2012.4.11 yutaka)
2172- int ret;
2173-
2174- ret = DialogBox(hInst, MAKEINTRESOURCE(IDD_DAD_DIALOG),
2175- HVTWin, (DLGPROC)OnDragDropDlgProc);
2176-
2177- if (ret == IDOK) { // sendfile
2178- HelpId = HlpFileSend;
2179- SendVar->DirLen = 0;
2180- ts.TransBin = 0;
2181- FileSendStart();
2182-
2183- } else if (ret == IDC_DAD_SENDFILE) { // SCP
2184- typedef int (CALLBACK *PSSH_start_scp)(char *, char *);
2185- static PSSH_start_scp func = NULL;
2186- static HMODULE h = NULL;
2187- char msg[128];
2188-
2189- if (func == NULL) {
2190- if ( ((h = GetModuleHandle("ttxssh.dll")) == NULL) ) {
2191- _snprintf_s(msg, sizeof(msg), _TRUNCATE, "GetModuleHandle(\"ttxssh.dll\")) %d", GetLastError());
2192- goto scp_send_error;
2193- }
2194- func = (PSSH_start_scp)GetProcAddress(h, "TTXScpSendfile");
2195- if (func == NULL) {
2196- _snprintf_s(msg, sizeof(msg), _TRUNCATE, "GetProcAddress(\"TTXScpSendfile\")) %d", GetLastError());
2197- goto scp_send_error;
2198- }
2199- }
2200-
2201- if (func != NULL) {
2202- func(SendVar->FullName, ts.ScpSendDir);
2203- goto send_success;
2204- }
2205-
2206-scp_send_error:
2207- ::MessageBox(NULL, msg, "Tera Term: scpsend command error", MB_OK | MB_ICONERROR);
2208-send_success:
2209- FreeFileVar(&SendVar); // 解放を忘れずに
2210-
2211- } else {
2212- FreeFileVar(&SendVar);
2213-
2214- }
2215- }
2216- else {
2217- SendVar->DirLen = 0;
2218- ts.TransBin = 0;
2219- FileSendStart();
2220-
2221- }
2222- }
2223- }
2224- else
2225- FreeFileVar(&SendVar);
2323+ ::PostMessage(HVTWin, WM_USER_DROPNOTIFY, ShowDialog, 0);
22262324 }
22272325 DragFinish(hDropInfo);
22282326 }
--- trunk/teraterm/teraterm/dnddlg.h (revision 0)
+++ trunk/teraterm/teraterm/dnddlg.h (revision 7148)
@@ -0,0 +1,53 @@
1+/*
2+ * (C) 2005-2018 TeraTerm Project
3+ * All rights reserved.
4+ *
5+ * Redistribution and use in source and binary forms, with or without
6+ * modification, are permitted provided that the following conditions
7+ * are met:
8+ *
9+ * 1. Redistributions of source code must retain the above copyright
10+ * notice, this list of conditions and the following disclaimer.
11+ * 2. Redistributions in binary form must reproduce the above copyright
12+ * notice, this list of conditions and the following disclaimer in the
13+ * documentation and/or other materials provided with the distribution.
14+ * 3. The name of the author may not be used to endorse or promote products
15+ * derived from this software without specific prior written permission.
16+ *
17+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
18+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+ */
28+
29+#include <windows.h>
30+
31+enum drop_type {
32+ DROP_TYPE_CANCEL,
33+ DROP_TYPE_SCP,
34+ DROP_TYPE_SEND_FILE, // past contents of file
35+ DROP_TYPE_SEND_FILE_BINARY,
36+ DROP_TYPE_PASTE_FILENAME,
37+};
38+
39+#define DROP_TYPE_PASTE_ESCAPE 0x01
40+#define DROP_TYPE_PASTE_NEWLINE 0x02
41+
42+enum drop_type ShowDropDialogBox(
43+ HINSTANCE hInstance, HWND hWndParent,
44+ const char *TargetFilename,
45+ enum drop_type DefaultDropType,
46+ int RemaingFileCount,
47+ bool EnableSCP,
48+ bool EnableSendFile,
49+ bool EnableDoNotShowDialog,
50+ unsigned char *DropTypePaste,
51+ bool *DoSameProcess,
52+ bool *DoSameProcessNextDrop,
53+ bool *DoNotShowDialog);
--- trunk/teraterm/teraterm/vtwin.h (revision 7147)
+++ trunk/teraterm/teraterm/vtwin.h (revision 7148)
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (C) 1994-1998 T. Teranishi
3- * (C) 2004-2017 TeraTerm Project
3+ * (C) 2004-2018 TeraTerm Project
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
@@ -50,6 +50,13 @@
5050 HMENU MainMenu, FileMenu, TransMenu, EditMenu,
5151 SetupMenu, ControlMenu, WinMenu, HelpMenu;
5252
53+ // drag and drop handle
54+ char **DropLists;
55+ int DropListCount;
56+ void DropListFree();
57+ bool DropWithLeftbutton;
58+ bool DropWithRightbutton;
59+
5360 protected:
5461
5562 public:
@@ -214,6 +221,7 @@
214221 afx_msg void OnHelpIndex();
215222 afx_msg void OnHelpUsing();
216223 afx_msg void OnHelpAbout();
224+ afx_msg LONG OnDropNotify(UINT ShowMenu, LONG lParam);
217225 //}}AFX_MSG
218226 DECLARE_MESSAGE_MAP();
219227 void Disconnect(BOOL confirm);
--- trunk/teraterm/teraterm/dnddlg.cpp (revision 0)
+++ trunk/teraterm/teraterm/dnddlg.cpp (revision 7148)
@@ -0,0 +1,329 @@
1+/*
2+ * (C) 2005-2018 TeraTerm Project
3+ * All rights reserved.
4+ *
5+ * Redistribution and use in source and binary forms, with or without
6+ * modification, are permitted provided that the following conditions
7+ * are met:
8+ *
9+ * 1. Redistributions of source code must retain the above copyright
10+ * notice, this list of conditions and the following disclaimer.
11+ * 2. Redistributions in binary form must reproduce the above copyright
12+ * notice, this list of conditions and the following disclaimer in the
13+ * documentation and/or other materials provided with the distribution.
14+ * 3. The name of the author may not be used to endorse or promote products
15+ * derived from this software without specific prior written permission.
16+ *
17+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
18+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+ */
28+
29+#include "dnddlg.h"
30+
31+#include <windowsx.h>
32+#include <stdio.h> // for _snprintf_s
33+
34+#include "tt_res.h"
35+
36+#include "i18n.h"
37+#include "ttlib.h"
38+#include "dlglib.h"
39+#include "tttypes.h" // for ttwinman.h
40+#include "ttwinman.h" // for ts
41+
42+struct DlgTextInfo {
43+ int nIDDlgItem;
44+ char *key;
45+};
46+
47+struct DrapDropDlgParam {
48+ const char *TargetFilename;
49+ enum drop_type DropType;
50+ unsigned char DropTypePaste;
51+ bool ScpEnable;
52+ char *ScpSendDirPtr;
53+ int ScpSendDirSize;
54+ bool SendfileEnable;
55+ bool PasteNewlineEnable;
56+ int RemaingFileCount;
57+ bool DoSameProcess;
58+ bool DoSameProcessNextDrop;
59+ bool DoNotShowDialogEnable;
60+ bool DoNotShowDialog;
61+ const char *UILanguageFile;
62+};
63+
64+struct DrapDropDlgData {
65+ HFONT hPrevFont;
66+ DrapDropDlgParam *Param;
67+};
68+
69+static HFONT SetDlgFonts(HWND hDlg, const int nIDDlgItems[], int nIDDlgItemCount, const char *UILanguageFile, PCHAR key)
70+{
71+ if (key == NULL) key = "DLG_TAHOMA_FONT";
72+ HFONT hPrevFont = (HFONT)SendMessage(hDlg, WM_GETFONT, 0, 0);
73+ LOGFONT logfont;
74+ GetObject(hPrevFont, sizeof(LOGFONT), &logfont);
75+ HFONT hNewFont;
76+ if (get_lang_font("DLG_TAHOMA_FONT", hDlg, &logfont, &hNewFont, UILanguageFile)) {
77+ for (int i = 0 ; i < nIDDlgItemCount ; i++) {
78+ const int nIDDlgItem = nIDDlgItems[i];
79+ SendDlgItemMessage(hDlg, nIDDlgItem, WM_SETFONT, (WPARAM)hNewFont, MAKELPARAM(TRUE,0));
80+ }
81+ }
82+ return hNewFont;
83+}
84+
85+static void SetDlgTexts(HWND hDlgWnd, const DlgTextInfo *infos, int infoCount, const char *UILanguageFile)
86+{
87+ for (int i = 0 ; i < infoCount; i++) {
88+ char *key = infos[i].key;
89+ char uimsg[MAX_UIMSG];
90+ get_lang_msg(key, uimsg, sizeof(uimsg), "", UILanguageFile);
91+ if (uimsg[0] != '\0') {
92+ const int nIDDlgItem = infos[i].nIDDlgItem;
93+ if (nIDDlgItem == 0) {
94+ SetWindowText(hDlgWnd, uimsg);
95+ } else {
96+ SetDlgItemText(hDlgWnd, nIDDlgItem, uimsg);
97+ }
98+ }
99+ }
100+}
101+
102+static LRESULT CALLBACK OnDragDropDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
103+{
104+ static const int FontIDs[] = {
105+ IDC_FILENAME_EDIT,
106+ IDC_DAD_STATIC,
107+ IDC_SCP_RADIO, IDC_SENDFILE_RADIO, IDC_PASTE_RADIO,
108+ IDC_SCP_PATH_LABEL, IDC_SCP_PATH, IDC_SCP_PATH_NOTE,
109+ IDC_BINARY_CHECK,
110+ IDC_ESCAPE_CHECK, IDC_NEWLINE_RADIO, IDC_SPACE_RADIO,
111+ IDC_SAME_PROCESS_CHECK, IDC_SAME_PROCESS_NEXTDROP_CHECK, IDC_DONTSHOW_CHECK,
112+ IDC_DAD_NOTE,
113+ IDOK, IDCANCEL,
114+ };
115+ static const DlgTextInfo TextInfos[] = {
116+ { 0, "DLG_DANDD_TITLE" },
117+ { IDC_DAD_STATIC, "DLG_DANDD_TEXT" },
118+ { IDC_SCP_PATH_NOTE, "DLG_DADDD_DEST_NOTE" },
119+ { IDC_SAME_PROCESS_CHECK, "DLG_DANDD_CONFLICTS" },
120+ { IDC_SAME_PROCESS_NEXTDROP_CHECK, "DLG_DANDD_SAME_NEEXTDROP" },
121+ { IDC_DONTSHOW_CHECK, "DLG_DANDD_DONTSHOW_NEEXTDROP" },
122+ { IDC_DAD_NOTE, "DLG_DANDD_NOTE" },
123+ { IDOK, "BTN_OK" },
124+ { IDCANCEL, "BTN_CANCEL" },
125+ };
126+ DrapDropDlgData *DlgData = (DrapDropDlgData *)GetWindowLongPtr(hDlgWnd, GWLP_USERDATA);
127+
128+ switch (msg) {
129+ case WM_INITDIALOG:
130+ {
131+ DlgData = (DrapDropDlgData *)malloc(sizeof(DrapDropDlgData));
132+ SetWindowLongPtr(hDlgWnd, GWLP_USERDATA, (LONG_PTR)DlgData);
133+ DrapDropDlgParam *Param = (DrapDropDlgParam *)lp;
134+ DlgData->Param = Param;
135+ DlgData->hPrevFont = SetDlgFonts(hDlgWnd, FontIDs, _countof(FontIDs), Param->UILanguageFile, NULL);
136+ SetDlgTexts(hDlgWnd, TextInfos, _countof(TextInfos), Param->UILanguageFile);
137+
138+ // target file
139+ SetDlgItemText(hDlgWnd, IDC_FILENAME_EDIT, Param->TargetFilename);
140+
141+ // checkbox
142+ CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO,
143+ (Param->DropType == DROP_TYPE_SEND_FILE ||
144+ Param->DropType == DROP_TYPE_SEND_FILE_BINARY) ? IDC_SENDFILE_RADIO :
145+ Param->DropType == DROP_TYPE_PASTE_FILENAME ? IDC_PASTE_RADIO :
146+ IDC_SCP_RADIO);
147+
148+ // SCP
149+ SendMessage(GetDlgItem(hDlgWnd, IDC_SCP_PATH), WM_SETTEXT, 0, (LPARAM)Param->ScpSendDirPtr);
150+ if (!Param->ScpEnable) {
151+ // 無効化
152+ EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_RADIO), FALSE);
153+ EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH_LABEL), FALSE);
154+ EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH), FALSE);
155+ EnableWindow(GetDlgItem(hDlgWnd, IDC_SCP_PATH_NOTE), FALSE);
156+ }
157+
158+ // Send File
159+ if (Param->DropType == DROP_TYPE_SEND_FILE_BINARY) {
160+ SendMessage(GetDlgItem(hDlgWnd, IDC_BINARY_CHECK), BM_SETCHECK, BST_CHECKED, 0);
161+ }
162+ if (!Param->SendfileEnable) {
163+ // 無効化
164+ EnableWindow(GetDlgItem(hDlgWnd, IDC_SENDFILE_RADIO), FALSE);
165+ EnableWindow(GetDlgItem(hDlgWnd, IDC_BINARY_CHECK), FALSE);
166+ }
167+
168+ // Paste Filename
169+ if (Param->DropTypePaste & DROP_TYPE_PASTE_ESCAPE) {
170+ SendMessage(GetDlgItem(hDlgWnd, IDC_ESCAPE_CHECK), BM_SETCHECK, BST_CHECKED, 0);
171+ }
172+ CheckRadioButton(hDlgWnd, IDC_SPACE_RADIO, IDC_NEWLINE_RADIO,
173+ Param->DropTypePaste & DROP_TYPE_PASTE_NEWLINE?
174+ IDC_NEWLINE_RADIO : IDC_SPACE_RADIO);
175+ if (Param->RemaingFileCount < 2) {
176+ EnableWindow(GetDlgItem(hDlgWnd, IDC_SPACE_RADIO), FALSE);
177+ EnableWindow(GetDlgItem(hDlgWnd, IDC_NEWLINE_RADIO), FALSE);
178+ }
179+
180+ // Do this for the next %d conflicts
181+ char orgmsg[MAX_UIMSG];
182+ GetDlgItemText(hDlgWnd, IDC_SAME_PROCESS_CHECK, orgmsg, sizeof(orgmsg));
183+ char uimsg[MAX_UIMSG];
184+ _snprintf_s(uimsg, sizeof(uimsg), _TRUNCATE, orgmsg, Param->RemaingFileCount - 1);
185+ SetDlgItemText(hDlgWnd, IDC_SAME_PROCESS_CHECK, uimsg);
186+ if (Param->RemaingFileCount < 2) {
187+ EnableWindow(GetDlgItem(hDlgWnd, IDC_SAME_PROCESS_CHECK), FALSE);
188+ }
189+
190+ // Dont Show Dialog
191+ if (Param->DoNotShowDialog) {
192+ SendMessage(GetDlgItem(hDlgWnd, IDC_DONTSHOW_CHECK), BM_SETCHECK, BST_CHECKED, 0);
193+ }
194+ if (!Param->DoNotShowDialogEnable) {
195+ EnableWindow(GetDlgItem(hDlgWnd, IDC_DONTSHOW_CHECK), FALSE);
196+ EnableWindow(GetDlgItem(hDlgWnd, IDC_DAD_NOTE), FALSE);
197+ }
198+
199+ // focus to "SCP dest textbox" or "Cancel"
200+ if (Param->ScpEnable) {
201+ // "SCP" 有効時は Cancel にフォーカスを当て、最終的に SCP PATH にフォーカスが
202+ // 当たるようにする。
203+ SetFocus(GetDlgItem(hDlgWnd, IDC_SCP_RADIO));
204+ } else {
205+ // フォーカスの初期状態を Cancel にする為、この時点では IDOK に
206+ // フォーカスを当てる。後で WM_NEXTDLGCTL でフォーカスが次のボタンになる。
207+ SetFocus(GetDlgItem(hDlgWnd, IDOK));
208+ }
209+ // フォーカスを次のボタンに移す
210+ // SetFocus() で直接フォーカスを当てるとタブキーの動作等に問題が出るため、
211+ // このメッセージを併用する
212+ PostMessage(hDlgWnd, WM_NEXTDLGCTL, 0, 0L);
213+
214+ // TRUEにするとボタンにフォーカスが当たらない。
215+ return FALSE;
216+ }
217+
218+ case WM_COMMAND:
219+ {
220+ WORD wID = GET_WM_COMMAND_ID(wp, lp);
221+ const WORD wCMD = GET_WM_COMMAND_CMD(wp, lp);
222+ if (wCMD == BN_DBLCLK &&
223+ (wID == IDC_SCP_RADIO || wID == IDC_SENDFILE_RADIO || wID == IDC_PASTE_RADIO))
224+ { // radio buttons double click
225+ wID = IDOK;
226+ }
227+ if (wCMD == EN_SETFOCUS && wID == IDC_SCP_PATH) {
228+ CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_SCP_RADIO);
229+ }
230+ if (wID == IDC_BINARY_CHECK) {
231+ CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_SENDFILE_RADIO);
232+ }
233+ if (wID == IDC_ESCAPE_CHECK ||
234+ wID == IDC_SPACE_RADIO || wID == IDC_NEWLINE_RADIO)
235+ {
236+ CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_PASTE_RADIO);
237+ }
238+ if (wID == IDOK) {
239+ if (IsDlgButtonChecked(hDlgWnd, IDC_SCP_RADIO) == BST_CHECKED) {
240+ // SCP
241+ DlgData->Param->DropType = DROP_TYPE_SCP;
242+ SendMessage(GetDlgItem(hDlgWnd, IDC_SCP_PATH), WM_GETTEXT,
243+ (WPARAM)DlgData->Param->ScpSendDirSize,
244+ (LPARAM)DlgData->Param->ScpSendDirPtr);
245+ } else if (IsDlgButtonChecked(hDlgWnd, IDC_SENDFILE_RADIO) == BST_CHECKED) {
246+ // Send File
247+ DlgData->Param->DropType =
248+ (IsDlgButtonChecked(hDlgWnd, IDC_BINARY_CHECK) == BST_CHECKED) ?
249+ DROP_TYPE_SEND_FILE_BINARY : DROP_TYPE_SEND_FILE;
250+ } else /* if (IsDlgButtonChecked(hDlgWnd, IDC_PASTE_RADIO) == BST_CHECKED) */ {
251+ // Paste Filename
252+ DlgData->Param->DropType = DROP_TYPE_PASTE_FILENAME;
253+ DlgData->Param->DropTypePaste = 0;
254+ DlgData->Param->DropTypePaste |=
255+ (IsDlgButtonChecked(hDlgWnd, IDC_ESCAPE_CHECK) == BST_CHECKED) ?
256+ DROP_TYPE_PASTE_ESCAPE : 0;
257+ DlgData->Param->DropTypePaste |=
258+ (IsDlgButtonChecked(hDlgWnd, IDC_NEWLINE_RADIO) == BST_CHECKED) ?
259+ DROP_TYPE_PASTE_NEWLINE : 0;
260+ }
261+ DlgData->Param->DoSameProcess =
262+ (IsDlgButtonChecked(hDlgWnd, IDC_SAME_PROCESS_CHECK) == BST_CHECKED) ?
263+ true : false;
264+ DlgData->Param->DoSameProcessNextDrop =
265+ (IsDlgButtonChecked(hDlgWnd, IDC_SAME_PROCESS_NEXTDROP_CHECK) == BST_CHECKED) ?
266+ true : false;
267+ DlgData->Param->DoNotShowDialog =
268+ (IsDlgButtonChecked(hDlgWnd, IDC_DONTSHOW_CHECK) == BST_CHECKED) ?
269+ true : false;
270+ }
271+ if (wID == IDCANCEL) {
272+ DlgData->Param->DropType = DROP_TYPE_CANCEL;
273+ }
274+ if (wID == IDOK || wID == IDCANCEL) {
275+ if (DlgData->hPrevFont != NULL) {
276+ DeleteObject(DlgData->hPrevFont);
277+ }
278+ EndDialog(hDlgWnd, wID);
279+ free(DlgData);
280+ break;
281+ }
282+ return FALSE;
283+ }
284+
285+ default:
286+ return FALSE;
287+ }
288+ return TRUE;
289+}
290+
291+enum drop_type ShowDropDialogBox(
292+ HINSTANCE hInstance, HWND hWndParent,
293+ const char *TargetFilename,
294+ enum drop_type DefaultDropType,
295+ int RemaingFileCount,
296+ bool EnableSCP,
297+ bool EnableSendFile,
298+ bool EnableDoNotShowDialog,
299+ unsigned char *DropTypePaste,
300+ bool *DoSameProcess,
301+ bool *DoSameProcessNextDrop,
302+ bool *DoNotShowDialog)
303+{
304+ DrapDropDlgParam Param;
305+ Param.TargetFilename = TargetFilename;
306+ Param.DropType = DefaultDropType;
307+ Param.DropTypePaste = *DropTypePaste;
308+ Param.ScpEnable = EnableSCP;
309+ Param.ScpSendDirPtr = ts.ScpSendDir;
310+ Param.ScpSendDirSize = sizeof(ts.ScpSendDir);
311+ Param.SendfileEnable = EnableSendFile;
312+ Param.PasteNewlineEnable = true;
313+ Param.RemaingFileCount = RemaingFileCount;
314+ Param.DoNotShowDialog = *DoNotShowDialog;
315+ Param.DoNotShowDialogEnable = EnableDoNotShowDialog;
316+ Param.UILanguageFile = ts.UILanguageFile;
317+ int ret = DialogBoxParam(
318+ hInstance, MAKEINTRESOURCE(IDD_DAD_DIALOG),
319+ hWndParent, (DLGPROC)OnDragDropDlgProc,
320+ (LPARAM)&Param);
321+ if (ret != IDOK) {
322+ return DROP_TYPE_CANCEL;
323+ }
324+ *DropTypePaste = Param.DropTypePaste;
325+ *DoSameProcess = Param.DoSameProcess;
326+ *DoSameProcessNextDrop = Param.DoSameProcessNextDrop;
327+ *DoNotShowDialog = Param.DoNotShowDialog;
328+ return Param.DropType;
329+}
--- trunk/teraterm/common/tt_res.h (revision 7147)
+++ trunk/teraterm/common/tt_res.h (revision 7148)
@@ -64,7 +64,6 @@
6464 #define IDC_SHELL 1038
6565 #define IDC_TERM_EDIT 1039
6666 #define IDC_ENV1 1040
67-#define IDC_EDIT7 1041
6867 #define IDC_ENV2 1041
6968 #define IDC_MOUSE 1042
7069 #define IDC_DELIMITER 1043
@@ -129,7 +128,6 @@
129128 #define IDC_REALTIME_CHECK 2508
130129 #define IDC_LIST1 2509
131130 #define IDC_LIST 2509
132-#define IDC_EDIT1 2510
133131 #define IDC_EDIT 2510
134132 #define IDC_SCROLL_LINE 2510
135133 #define IDC_PASTEDELAY_EDIT 2510
@@ -138,7 +136,6 @@
138136 #define IDC_ROTATE_SIZE 2510
139137 #define IDC_INI_SETUPDIR_EDIT 2510
140138 #define IDC_KEYCNF_SETUPDIR_EDIT 2511
141-#define IDC_CHECK1 2512
142139 #define IDC_CONFIRM_CHANGE_PASTE 2512
143140 #define IDC_CURSOR_CTRL_SEQ 2512
144141 #define IDC_LOG_ROTATE 2512
@@ -164,7 +161,6 @@
164161 #define IDC_PROT_ELAPSED 2525
165162 #define IDC_DAD_STATIC 2525
166163 #define IDC_PROTOELAPSEDTIME 2526
167-#define IDC_DAD_SENDFILE 2526
168164 #define IDC_TRANS_ELAPSED 2527
169165 #define IDC_BGIMG_LABEL 2527
170166 #define IDC_TRANS_ETIME 2528
@@ -200,7 +196,6 @@
200196 #define IDC_CYGTERM_SETUPDIR_BUTTON_FILE2 2551
201197 #define IDC_SSH_SETUPDIR_BUTTON_FILE 2551
202198 #define IDC_BGIMG_BRIGHTNESS 2551
203-#define IDC_EDIT2 2552
204199 #define IDC_EDIT_BGIMG_BRIGHTNESS 2552
205200 #define IDC_INI_SETUPDIR_EDIT_VSTORE 2552
206201 #define IDC_INI_SETUPDIR_STATIC_VSTORE 2553
@@ -225,7 +220,20 @@
225220 #define IDC_TITLEFMT_SWAPHOSTTITLE 2572
226221 #define IDC_TITLEFMT_DISPTCPPORT 2573
227222 #define IDC_TITLEFMT_DISPSERIALSPEED 2574
228-
223+#define IDC_FILENAME_EDIT 2575
224+#define IDC_SCP_RADIO 2576
225+#define IDC_SENDFILE_RADIO 2577
226+#define IDC_PASTE_RADIO 2578
227+#define IDC_SCP_PATH_LABEL 2579
228+#define IDC_SCP_PATH_NOTE 2580
229+#define IDC_BINARY_CHECK 2581
230+#define IDC_ESCAPE_CHECK 2582
231+#define IDC_SPACE_RADIO 2583
232+#define IDC_NEWLINE_RADIO 2584
233+#define IDC_SAME_PROCESS_CHECK 2585
234+#define IDC_SAME_PROCESS_NEXTDROP_CHECK 2586
235+#define IDC_DONTSHOW_CHECK 2587
236+#define IDC_DAD_NOTE 2588
229237 #define ID_ACC_SENDBREAK 50001
230238 #define ID_ACC_COPY 50002
231239 #define ID_ACC_NEWCONNECTION 50003
@@ -323,7 +331,7 @@
323331 #define _APS_NO_MFC 1
324332 #define _APS_NEXT_RESOURCE_VALUE 126
325333 #define _APS_NEXT_COMMAND_VALUE 52031
326-#define _APS_NEXT_CONTROL_VALUE 2575
334+#define _APS_NEXT_CONTROL_VALUE 2589
327335 #define _APS_NEXT_SYMED_VALUE 101
328336 #endif
329337 #endif
--- trunk/teraterm/common/ttlib.c (revision 7147)
+++ trunk/teraterm/common/ttlib.c (revision 7148)
@@ -970,12 +970,12 @@
970970 strncpy_s(buf, buflen, Temp, _TRUNCATE);
971971 }
972972
973-void get_lang_msg(PCHAR key, PCHAR buf, int buf_len, PCHAR def, PCHAR iniFile)
973+void get_lang_msg(PCHAR key, PCHAR buf, int buf_len, PCHAR def, const char *iniFile)
974974 {
975975 GetI18nStr("Tera Term", key, buf, buf_len, def, iniFile);
976976 }
977977
978-int get_lang_font(PCHAR key, HWND dlg, PLOGFONT logfont, HFONT *font, PCHAR iniFile)
978+int get_lang_font(PCHAR key, HWND dlg, PLOGFONT logfont, HFONT *font, const char *iniFile)
979979 {
980980 if (GetI18nLogfont("Tera Term", key, logfont,
981981 GetDeviceCaps(GetDC(dlg),LOGPIXELSY),
--- trunk/teraterm/common/i18n.c (revision 7147)
+++ trunk/teraterm/common/i18n.c (revision 7148)
@@ -1,5 +1,5 @@
11 /*
2- * Copyright (C) 2006-2017 TeraTerm Project
2+ * Copyright (C) 2006-2018 TeraTerm Project
33 * All rights reserved.
44 *
55 * Redistribution and use in source and binary forms, with or without
@@ -28,13 +28,13 @@
2828
2929 #include "i18n.h"
3030
31-void PASCAL GetI18nStr(PCHAR section, PCHAR key, PCHAR buf, int buf_len, PCHAR def, PCHAR iniFile)
31+void GetI18nStr(PCHAR section, PCHAR key, PCHAR buf, int buf_len, PCHAR def, const char *iniFile)
3232 {
3333 GetPrivateProfileString(section, key, def, buf, buf_len, iniFile);
3434 RestoreNewLine(buf);
3535 }
3636
37-int PASCAL GetI18nLogfont(PCHAR section, PCHAR key, PLOGFONT logfont, int ppi, PCHAR iniFile)
37+int GetI18nLogfont(PCHAR section, PCHAR key, PLOGFONT logfont, int ppi, const char *iniFile)
3838 {
3939 static char tmp[MAX_UIMSG];
4040 static char font[LF_FACESIZE];
--- trunk/teraterm/common/ttlib.h (revision 7147)
+++ trunk/teraterm/common/ttlib.h (revision 7148)
@@ -67,8 +67,8 @@
6767 void GetDefaultSetupFName(char *home, char *dest, int destlen);
6868 void GetUILanguageFile(char *buf, int buflen);
6969 void GetOnOffEntryInifile(char *entry, char *buf, int buflen);
70-void get_lang_msg(PCHAR key, PCHAR buf, int buf_len, PCHAR def, PCHAR iniFile);
71-int get_lang_font(PCHAR key, HWND dlg, PLOGFONT logfont, HFONT *font, PCHAR iniFile);
70+void get_lang_msg(PCHAR key, PCHAR buf, int buf_len, PCHAR def, const char *iniFile);
71+int get_lang_font(PCHAR key, HWND dlg, PLOGFONT logfont, HFONT *font, const char *iniFile);
7272 BOOL doSelectFolder(HWND hWnd, char *path, int pathlen, char *def, char *msg);
7373 void OutputDebugPrintf(char *fmt, ...);
7474 BOOL is_NT4();
--- trunk/teraterm/common/i18n.h (revision 7147)
+++ trunk/teraterm/common/i18n.h (revision 7148)
@@ -1,5 +1,5 @@
11 /*
2- * Copyright (C) 2006-2017 TeraTerm Project
2+ * Copyright (C) 2006-2018 TeraTerm Project
33 * All rights reserved.
44 *
55 * Redistribution and use in source and binary forms, with or without
@@ -38,8 +38,8 @@
3838 extern "C" {
3939 #endif
4040
41-void PASCAL GetI18nStr(PCHAR section, PCHAR key, PCHAR buf, int buf_len, PCHAR def, PCHAR iniFile);
42-int PASCAL GetI18nLogfont(PCHAR section, PCHAR key, PLOGFONT logfont, int ppi, PCHAR iniFile);
41+void GetI18nStr(PCHAR section, PCHAR key, PCHAR buf, int buf_len, PCHAR def, const char *iniFile);
42+int GetI18nLogfont(PCHAR section, PCHAR key, PLOGFONT logfont, int ppi, const char *iniFile);
4343
4444 #ifdef __cplusplus
4545 }
--- trunk/teraterm/common/tttypes.h (revision 7147)
+++ trunk/teraterm/common/tttypes.h (revision 7148)
@@ -1,6 +1,6 @@
11 /*
22 * Copyright (C) 1994-1998 T. Teranishi
3- * (C) 2004-2017 TeraTerm Project
3+ * (C) 2004-2018 TeraTerm Project
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
@@ -173,6 +173,7 @@
173173 #define WM_USER_GETSERIALNO WM_USER+13
174174 #define WM_USER_CHANGETITLE WM_USER+14
175175 #define WM_USER_NOTIFYICON WM_USER+15
176+#define WM_USER_DROPNOTIFY WM_USER+16
176177
177178 #define WM_USER_DDEREADY WM_USER+21
178179 #define WM_USER_DDECMNDEND WM_USER+22
@@ -683,7 +684,6 @@
683684 };
684685
685686 typedef struct tttset TTTSet, *PTTSet;
686-//typedef TTTSet far *PTTSet;
687687
688688 /* New Line modes */
689689 #define IdCR 1
@@ -781,11 +781,6 @@
781781 /* Baud rate ID */
782782 #define BaudNone 0
783783
784-static PCHAR far BaudList[] =
785- {"110","300","600","1200","2400","4800","9600",
786- "14400","19200","38400","57600","115200",
787- "230400", "460800", "921600", NULL};
788-
789784 /* Parity ID */
790785 #define IdParityNone 1
791786 #define IdParityOdd 2
@@ -816,7 +811,7 @@
816811 WORD ComPort; // serial port #
817812 WORD MaxComPort; // max serial port #
818813 } TGetHNRec;
819-typedef TGetHNRec far *PGetHNRec;
814+typedef TGetHNRec *PGetHNRec;
820815
821816 /* Tera Term internal key codes */
822817 #define IdUp 1
@@ -934,7 +929,7 @@
934929 /* user key type */
935930 BYTE UserKeyType[NumOfUserKey];
936931 } TKeyMap;
937-typedef TKeyMap far *PKeyMap;
932+typedef TKeyMap *PKeyMap;
938933
939934 /* Control Characters */
940935
@@ -1092,7 +1087,7 @@
10921087
10931088 DWORD ConnectedTime;
10941089 } TComVar;
1095-typedef TComVar far *PComVar;
1090+typedef TComVar *PComVar;
10961091
10971092 #define ID_FILE 0
10981093 #define ID_EDIT 1
@@ -1137,7 +1132,7 @@
11371132 BOOL WinUndoFlag;
11381133 int WinUndoStyle;
11391134 } TMap;
1140-typedef TMap far *PMap;
1135+typedef TMap *PMap;
11411136
11421137 // TMap を格納するファイルマッピングオブジェクト(共有メモリ)の名前
11431138 // TMap(とそのメンバ)の更新時は旧バージョンとの同時起動の為に変える必要があるが
旧リポジトリブラウザで表示