[Ttssh2-commit] [7139] drag and dropダイアログのデザイン変更

scmno****@osdn***** scmno****@osdn*****
2018年 6月 18日 (月) 11:56:00 JST


Revision: 7139
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7139
Author:   zmatsuo
Date:     2018-06-18 11:56:00 +0900 (Mon, 18 Jun 2018)
Log Message:
-----------
drag and dropダイアログのデザイン変更

Modified Paths:
--------------
    branches/drag_and_drop/teraterm/common/tt_res.h
    branches/drag_and_drop/teraterm/teraterm/ttermpro.rc
    branches/drag_and_drop/teraterm/teraterm/vtwin.cpp

-------------- next part --------------
Modified: branches/drag_and_drop/teraterm/common/tt_res.h
===================================================================
--- branches/drag_and_drop/teraterm/common/tt_res.h	2018-06-14 11:07:19 UTC (rev 7138)
+++ branches/drag_and_drop/teraterm/common/tt_res.h	2018-06-18 02:56:00 UTC (rev 7139)
@@ -64,7 +64,6 @@
 #define IDC_SHELL                       1038
 #define IDC_TERM_EDIT                   1039
 #define IDC_ENV1                        1040
-#define IDC_EDIT7                       1041
 #define IDC_ENV2                        1041
 #define IDC_MOUSE                       1042
 #define IDC_DELIMITER                   1043
@@ -129,7 +128,6 @@
 #define IDC_REALTIME_CHECK              2508
 #define IDC_LIST1                       2509
 #define IDC_LIST                        2509
-#define IDC_EDIT1                       2510
 #define IDC_EDIT                        2510
 #define IDC_SCROLL_LINE                 2510
 #define IDC_PASTEDELAY_EDIT             2510
@@ -138,7 +136,6 @@
 #define IDC_ROTATE_SIZE                 2510
 #define IDC_INI_SETUPDIR_EDIT           2510
 #define IDC_KEYCNF_SETUPDIR_EDIT        2511
-#define IDC_CHECK1                      2512
 #define IDC_CONFIRM_CHANGE_PASTE        2512
 #define IDC_CURSOR_CTRL_SEQ             2512
 #define IDC_LOG_ROTATE                  2512
@@ -199,7 +196,6 @@
 #define IDC_CYGTERM_SETUPDIR_BUTTON_FILE2 2551
 #define IDC_SSH_SETUPDIR_BUTTON_FILE    2551
 #define IDC_BGIMG_BRIGHTNESS            2551
-#define IDC_EDIT2                       2552
 #define IDC_EDIT_BGIMG_BRIGHTNESS       2552
 #define IDC_INI_SETUPDIR_EDIT_VSTORE    2552
 #define IDC_INI_SETUPDIR_STATIC_VSTORE  2553
@@ -224,9 +220,13 @@
 #define IDC_SENDFILE_RADIO              2572
 #define IDC_PASTE_RADIO                 2573
 #define IDC_ESCAPE_CHECK                2574
-#define IDC_DEFAULT_CHECK               2575
-#define IDC_SCP_PATH_LABEL              2576
-#define IDC_SCP_PATH_NOTE               2577
+#define IDC_SCP_PATH_LABEL              2575
+#define IDC_SCP_PATH_NOTE               2576
+#define IDC_SPACE_RADIO                 2577
+#define IDC_NEWLINE_RADIO               2578
+#define IDC_DAD_NOTE                    2579
+#define IDC_SAME_PROCESS_CHECK          2580
+#define IDC_DONTSHOW_CHECK              2581
 #define ID_ACC_SENDBREAK                50001
 #define ID_ACC_COPY                     50002
 #define ID_ACC_NEWCONNECTION            50003
@@ -324,7 +324,7 @@
 #define _APS_NO_MFC                     1
 #define _APS_NEXT_RESOURCE_VALUE        126
 #define _APS_NEXT_COMMAND_VALUE         52031
-#define _APS_NEXT_CONTROL_VALUE         2578
+#define _APS_NEXT_CONTROL_VALUE         2582
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif

Modified: branches/drag_and_drop/teraterm/teraterm/ttermpro.rc
===================================================================
--- branches/drag_and_drop/teraterm/teraterm/ttermpro.rc	2018-06-14 11:07:19 UTC (rev 7138)
+++ branches/drag_and_drop/teraterm/teraterm/ttermpro.rc	2018-06-18 02:56:00 UTC (rev 7139)
@@ -26,7 +26,7 @@
 // Dialog
 //
 
-IDD_DAD_DIALOG DIALOGEX 0, 0, 187, 207
+IDD_DAD_DIALOG DIALOGEX 0, 0, 187, 267
 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Tera Term: File Drag and Drop"
 FONT 8, "Tahoma", 400, 0, 0x0
@@ -42,12 +42,17 @@
     LTEXT           "dest is home directory if empty",IDC_SCP_PATH_NOTE,50,64,120,8
     CONTROL         "Bina&ry",IDC_BINARY_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,92,151,10
     CONTROL         "Es&cape",IDC_ESCAPE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,125,151,10
+    CONTROL         "Separat&or is Space",IDC_SPACE_RADIO,"Button",BS_AUTORADIOBUTTON,19,139,160,10
+    CONTROL         "Separator is &NewLine",IDC_NEWLINE_RADIO,"Button",BS_AUTORADIOBUTTON,19,154,160,10
     CONTROL         "&Adapt same process to remaing %d files",IDC_ADAPT_SAME_CHECK,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,144,172,10
-    CONTROL         "&Default process from next drop\n(Drop with CTRL, this dialog is dispalyed)",IDC_DEFAULT_CHECK,
-                    "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,160,172,18
-    DEFPUSHBUTTON   "OK",IDOK,69,185,50,14
-    PUSHBUTTON      "Cancel",IDCANCEL,130,185,50,14
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,173,172,10
+    CONTROL         "Do sa&me process, next drop",IDC_SAME_PROCESS_CHECK,
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,188,172,10
+    CONTROL         "&Do not display this dialog, next drop",IDC_DONTSHOW_CHECK,
+                    "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,203,172,11
+    DEFPUSHBUTTON   "OK",IDOK,69,245,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,130,245,50,14
+    LTEXT           "Drop with CTRL, this dialog is dispalyed",IDC_DAD_NOTE,7,221,172,8
 END
 
 IDD_COMMENT_DIALOG DIALOGEX 0, 0, 239, 19

Modified: branches/drag_and_drop/teraterm/teraterm/vtwin.cpp
===================================================================
--- branches/drag_and_drop/teraterm/teraterm/vtwin.cpp	2018-06-14 11:07:19 UTC (rev 7138)
+++ branches/drag_and_drop/teraterm/teraterm/vtwin.cpp	2018-06-18 02:56:00 UTC (rev 7139)
@@ -2038,19 +2038,25 @@
 	DROP_TYPE_SEND_FILE,		// past contents of file
 	DROP_TYPE_SEND_FILE_BINARY,
 	DROP_TYPE_PASTE_FILENAME,
-	DROP_TYPE_PASTE_FILENAME_WITH_ESCAPE,
 };
 
+#define DROP_TYPE_PASTE_ESCAPE	0x01
+#define	DROP_TYPE_PASTE_NEWLINE	0x02
+
 struct DrapDropDlgParam {
 	const char *TargetFilename;
 	enum drop_type DropType;
+	unsigned char DropTypePaste;
 	bool ScpEnable;
 	char *ScpSendDirPtr;
 	int ScpSendDirSize;
 	bool SendfileEnable;
+	bool PasteNewlineEnable;
 	int RemaingFileCount;
 	bool AdaptSameProcess;
-	bool DefaultProcess;
+	bool DoSameProcess;
+	bool DoNotShowDialogEnable;
+	bool DoNotShowDialog;
 };
 
 struct DrapDropDlgData {
@@ -2081,8 +2087,10 @@
 					IDC_DAD_STATIC,
 					IDC_SCP_RADIO, IDC_SENDFILE_RADIO, IDC_PASTE_RADIO,
 					IDC_SCP_PATH_LABEL, IDC_SCP_PATH, IDC_SCP_PATH_NOTE,
-					IDC_BINARY_CHECK, IDC_ESCAPE_CHECK,
-					IDC_ADAPT_SAME_CHECK, IDC_DEFAULT_CHECK,
+					IDC_BINARY_CHECK,
+					IDC_ESCAPE_CHECK, IDC_NEWLINE_RADIO, IDC_SPACE_RADIO,
+					IDC_ADAPT_SAME_CHECK, IDC_DONTSHOW_CHECK,
+					IDC_DAD_NOTE,
 					IDOK, IDCANCEL,
 				};
 				SetDlgFonts(hDlgWnd, IDs, _countof(IDs), DlgDragDropFont);
@@ -2105,8 +2113,7 @@
 			CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO,
 							 (Param->DropType == DROP_TYPE_SEND_FILE ||
 							  Param->DropType == DROP_TYPE_SEND_FILE_BINARY) ? IDC_SENDFILE_RADIO :
-							 (Param->DropType == DROP_TYPE_PASTE_FILENAME ||
-							  Param->DropType == DROP_TYPE_PASTE_FILENAME_WITH_ESCAPE) ? IDC_PASTE_RADIO :
+							 Param->DropType == DROP_TYPE_PASTE_FILENAME  ? IDC_PASTE_RADIO :
 							 IDC_SCP_RADIO);
 
 			// SCP
@@ -2130,9 +2137,16 @@
 			}
 
 			// Paste Filename
-			if (Param->DropType != DROP_TYPE_PASTE_FILENAME) {
+			if (Param->DropTypePaste & DROP_TYPE_PASTE_ESCAPE) {
 				SendMessage(GetDlgItem(hDlgWnd, IDC_ESCAPE_CHECK), BM_SETCHECK, BST_CHECKED, 0);
 			}
+			CheckRadioButton(hDlgWnd, IDC_SPACE_RADIO, IDC_NEWLINE_RADIO, 
+							 Param->DropTypePaste & DROP_TYPE_PASTE_NEWLINE?
+							 IDC_NEWLINE_RADIO : IDC_SPACE_RADIO);
+			if (Param->RemaingFileCount < 2) {
+				EnableWindow(GetDlgItem(hDlgWnd, IDC_SPACE_RADIO), FALSE);
+				EnableWindow(GetDlgItem(hDlgWnd, IDC_NEWLINE_RADIO), FALSE);
+			}
 
 			// Adapt same process
 			GetDlgItemText(hDlgWnd, IDC_ADAPT_SAME_CHECK, uimsg, sizeof(uimsg));
@@ -2143,6 +2157,15 @@
 				EnableWindow(GetDlgItem(hDlgWnd, IDC_ADAPT_SAME_CHECK), FALSE);
 			}
 
+			// Dont Show Dialog
+			if (Param->DoNotShowDialog) {
+				SendMessage(GetDlgItem(hDlgWnd, IDC_DONTSHOW_CHECK), BM_SETCHECK, BST_CHECKED, 0);
+			}
+			if (!Param->DoNotShowDialogEnable) {
+				EnableWindow(GetDlgItem(hDlgWnd, IDC_DONTSHOW_CHECK), FALSE);
+				EnableWindow(GetDlgItem(hDlgWnd, IDC_DAD_NOTE), FALSE);
+			}
+
 			// focus to "SCP dest textbox" or "Cancel"
 			if (Param->ScpEnable) {
 				// "SCP" \x97L\x8C\xF8\x8E\x9E\x82\xCD Cancel \x82Ƀt\x83H\x81[\x83J\x83X\x82𓖂āA\x8DŏI\x93I\x82\xC9 SCP PATH \x82Ƀt\x83H\x81[\x83J\x83X\x82\xAA
@@ -2185,16 +2208,24 @@
 						DROP_TYPE_SEND_FILE_BINARY : DROP_TYPE_SEND_FILE;
 				} else /* if (IsDlgButtonChecked(hDlgWnd, IDC_PASTE_RADIO) == BST_CHECKED) */ {
 					// Paste Filename
-					DlgData->Param->DropType =
+					DlgData->Param->DropType = DROP_TYPE_PASTE_FILENAME;
+					DlgData->Param->DropTypePaste = 0;
+					DlgData->Param->DropTypePaste |=
 						(IsDlgButtonChecked(hDlgWnd, IDC_ESCAPE_CHECK) == BST_CHECKED) ?
-						DROP_TYPE_PASTE_FILENAME_WITH_ESCAPE : DROP_TYPE_PASTE_FILENAME;
+						DROP_TYPE_PASTE_ESCAPE : 0;
+					DlgData->Param->DropTypePaste |=
+						(IsDlgButtonChecked(hDlgWnd, IDC_NEWLINE_RADIO) == BST_CHECKED) ?
+						DROP_TYPE_PASTE_NEWLINE : 0;
 				}
 				DlgData->Param->AdaptSameProcess = 
 					(IsDlgButtonChecked(hDlgWnd, IDC_ADAPT_SAME_CHECK) == BST_CHECKED) ?
 					true : false;
-				DlgData->Param->DefaultProcess = 
-					(IsDlgButtonChecked(hDlgWnd, IDC_DEFAULT_CHECK) == BST_CHECKED) ?
+				DlgData->Param->DoSameProcess =
+					(IsDlgButtonChecked(hDlgWnd, IDC_SAME_PROCESS_CHECK) == BST_CHECKED) ?
 					true : false;
+				DlgData->Param->DoNotShowDialog = 
+					(IsDlgButtonChecked(hDlgWnd, IDC_DONTSHOW_CHECK) == BST_CHECKED) ?
+					true : false;
 			}
 			if (wID == IDCANCEL) {
 				DlgData->Param->DropType = DROP_TYPE_CANCEL;
@@ -2223,17 +2254,24 @@
 	int RemaingFileCount,
 	bool EnableSCP,
 	bool EnableSendFile,
+	bool EnableDoNotShowDialog,
+	unsigned char *DropTypePaste,
 	bool *AdaptSameProcess,
-	bool *DefaultProcess)
+	bool *DoSameProcess,
+	bool *DoNotShowDialog)
 {
 	struct DrapDropDlgParam Param;
 	Param.TargetFilename = TargetFilename;
 	Param.DropType = DefaultDropType;
+	Param.DropTypePaste = *DropTypePaste;
 	Param.ScpEnable = EnableSCP;
 	Param.ScpSendDirPtr = ts.ScpSendDir;
 	Param.ScpSendDirSize = sizeof(ts.ScpSendDir);
 	Param.SendfileEnable = EnableSendFile;
+	Param.PasteNewlineEnable = true;
 	Param.RemaingFileCount = RemaingFileCount;
+	Param.DoNotShowDialog = *DoNotShowDialog;
+	Param.DoNotShowDialogEnable = EnableDoNotShowDialog;
 	int ret = DialogBoxParam(
 		hInstance, MAKEINTRESOURCE(IDD_DAD_DIALOG),
 		hWndParent, (DLGPROC)OnDragDropDlgProc,
@@ -2241,8 +2279,10 @@
 	if (ret != IDOK) {
 		return DROP_TYPE_CANCEL;
 	}
+	*DropTypePaste = Param.DropTypePaste;
 	*AdaptSameProcess = Param.AdaptSameProcess;
-	*DefaultProcess = Param.DefaultProcess;
+	*DoSameProcess = Param.DoSameProcess;
+	*DoNotShowDialog = Param.DoNotShowDialog;
 	return Param.DropType;
 }
 
@@ -2343,7 +2383,10 @@
 
 LONG CVTWindow::OnDropNotify(UINT ShowDialog, LONG lParam)
 {
+	// ini\x82ɕۑ\xB6\x82\xB3\x82\xEA\x82Ȃ\xA2\x81A\x8D\xA1\x8E\xC0\x8Ds\x82\xB5\x82Ă\xA2\x82\xE9Tera Term\x82ł̂ݗL\x8C\xF8\x82Ȑݒ\xE8
 	static enum drop_type DefaultDropType = DROP_TYPE_CANCEL;
+	static unsigned char DefaultDropTypePaste = DROP_TYPE_PASTE_ESCAPE;
+	static bool DefaultShowDialog = ts.ConfirmFileDragAndDrop ? true : false;
 
 	(void)lParam;
 	int FileCount = 0;
@@ -2364,6 +2407,7 @@
 	bool AdapatSameProcess = false;
 	const bool isSSH = (cv.isSSH == 2);
 	enum drop_type DropType;
+	unsigned char DropTypePaste = DROP_TYPE_PASTE_ESCAPE;
 	if (DefaultDropType == DROP_TYPE_CANCEL) {
 		// default is not set
 		if (!ShowDialog) {
@@ -2377,13 +2421,13 @@
 					AdapatSameProcess = false;
 				} else {
 					DropType = DROP_TYPE_SEND_FILE;
-					AdapatSameProcess = true;
+					AdapatSameProcess = DefaultShowDialog ? false : true;
 				}
 			} else if (FileCount == 0 && DirectoryCount == 1) {
-				DropType = DROP_TYPE_PASTE_FILENAME_WITH_ESCAPE;
-				AdapatSameProcess = true;
+				DropType = DROP_TYPE_PASTE_FILENAME;
+				AdapatSameProcess = DefaultShowDialog ? false : true;
 			} else if (FileCount > 0 && DirectoryCount > 0) {
-				DropType = DROP_TYPE_PASTE_FILENAME_WITH_ESCAPE;
+				DropType = DROP_TYPE_PASTE_FILENAME;
 				AdapatSameProcess = false;
 			} else if (FileCount > 0 && DirectoryCount == 0) {
 				// filename only
@@ -2395,13 +2439,13 @@
 				AdapatSameProcess = false;
 			} else {
 				// directory only
-				DropType = DROP_TYPE_PASTE_FILENAME_WITH_ESCAPE;
+				DropType = DROP_TYPE_PASTE_FILENAME;
 				AdapatSameProcess = ts.ConfirmFileDragAndDrop ? false : true;
 			}
 		} else {
 			// show dialog
 			if (DirectoryCount > 0) {
-				DropType = DROP_TYPE_PASTE_FILENAME_WITH_ESCAPE;
+				DropType = DROP_TYPE_PASTE_FILENAME;
 			} else {
 				if (isSSH) {
 					DropType = DROP_TYPE_SCP;
@@ -2417,11 +2461,13 @@
 			 DefaultDropType == DROP_TYPE_SEND_FILE_BINARY ||
 			 DefaultDropType == DROP_TYPE_SCP))
 		{	// \x83f\x83t\x83H\x83\x8B\x83g\x82̂܂܂ł͏\x88\x97\x9D\x82ł\xAB\x82Ȃ\xA2\x91g\x82ݍ\x87\x82킹
-			DropType = DROP_TYPE_PASTE_FILENAME_WITH_ESCAPE;
+			DropType = DROP_TYPE_PASTE_FILENAME;
+			DropTypePaste = DefaultDropTypePaste;
 			AdapatSameProcess = false;
 		} else {
 			DropType = DefaultDropType;
-			AdapatSameProcess = ShowDialog ? false : true;
+			DropTypePaste = DefaultDropTypePaste;
+			AdapatSameProcess = (ShowDialog || DefaultShowDialog) ? false : true;
 		}
 	}
 
@@ -2429,7 +2475,8 @@
 		const char *FileName = DropLists[i];
 
 		if (!AdapatSameProcess) {
-			bool DefaultProcess;
+			bool DoSameProcess;
+			bool DoNotShowDialog = !DefaultShowDialog;
 			DropType =
 				ShowDropDialogBox(hInst, HVTWin,
 								  FileName, DropType,
@@ -2436,13 +2483,21 @@
 								  DropListCount - i,
 								  (DirectoryCount == 0 && isSSH) ? true : false,
 								  DirectoryCount == 0 ? true : false,
-								  &AdapatSameProcess, &DefaultProcess);
+								  ts.ConfirmFileDragAndDrop ? false : true,
+								  &DropTypePaste,
+								  &AdapatSameProcess,
+								  &DoSameProcess,
+								  &DoNotShowDialog);
 			if (DropType == DROP_TYPE_CANCEL) {
 				goto finish;
 			}
-			if (DefaultProcess) {
+			if (DoSameProcess) {
 				DefaultDropType = DropType;
+				DefaultDropTypePaste = DropTypePaste;
 			}
+			if (!ts.ConfirmFileDragAndDrop) {
+				DefaultShowDialog = !DoNotShowDialog;
+			}
 		}
 			 
 		switch (DropType) {
@@ -2475,12 +2530,12 @@
 			}
 			break;
 		case DROP_TYPE_PASTE_FILENAME:
-		case DROP_TYPE_PASTE_FILENAME_WITH_ESCAPE:
 		{
-			const bool escape = DropType == DROP_TYPE_PASTE_FILENAME ? false : true;
+			const bool escape = (DropTypePaste & DROP_TYPE_PASTE_ESCAPE) ? true : false;
 			PasteString(&cv, FileName, escape);
-			if (DropListCount > 1) {
-				PasteString(&cv, "\n", false);
+			if (DropListCount > 1 && i < DropListCount - 1) {
+				const char *separator = (DropTypePaste & DROP_TYPE_PASTE_NEWLINE) ? "\n" : " ";
+				PasteString(&cv, separator, false);
 			}
 			break;
 		}



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