[Ttssh2-commit] [7141] drag and dropダイアログの調整

Back to archive index

scmno****@osdn***** scmno****@osdn*****
2018年 6月 28日 (木) 23:24:08 JST


Revision: 7141
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7141
Author:   zmatsuo
Date:     2018-06-28 23:24:07 +0900 (Thu, 28 Jun 2018)
Log Message:
-----------
drag and dropダイアログの調整
- 文言修正
- ラジオボタンの動作改良

Modified Paths:
--------------
    branches/drag_and_drop/installer/release/lang/Japanese.lng
    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/installer/release/lang/Japanese.lng
===================================================================
--- branches/drag_and_drop/installer/release/lang/Japanese.lng	2018-06-28 09:54:14 UTC (rev 7140)
+++ branches/drag_and_drop/installer/release/lang/Japanese.lng	2018-06-28 14:24:07 UTC (rev 7141)
@@ -143,8 +143,6 @@
 ; vtwin.cpp
 MSG_ALL_TERMINATE_CONF=\x91STera Term\x82\xF0\x8B\xAD\x90\xA7\x8FI\x97\xB9\x82\xB5\x82܂\xB7\x82\xA9\x81H
 MSG_DISCONNECT_CONF=\x90ؒf\x82\xB5\x82܂\xB7\x82\xA9\x81H
-MSG_DANDD_CONF=\x83t\x83@\x83C\x83\x8B\x93]\x91\x97\x82\xF0\x8Ds\x82\xA2\x82܂\xB7\x82\xA9\x81H
-MSG_DANDD_CONF_TITLE=Tera Term: \x83t\x83@\x83C\x83\x8B \x83h\x83\x89\x83b\x83O&\x83h\x83\x8D\x83b\x83v
 MSG_EXEC_TT_ERROR=Tera Term \x82\xF0\x8E\xC0\x8Ds\x82ł\xAB\x82܂\xB9\x82\xF1 (%d)
 MSG_FIND_CYGTERM_DIR_ERROR=Cygwin \x83f\x83B\x83\x8C\x83N\x83g\x83\x8A\x82\xAA\x8C\xA9\x82‚\xA9\x82\xE8\x82܂\xB9\x82\xF1
 MSG_CYGTERM_ENV_ALLOC_ERROR=\x8A‹\xAB\x95ϐ\x94\x97p\x82̃\x81\x83\x82\x83\x8A\x82\xAA\x8Am\x95ۂł\xAB\x82܂\xB9\x82\xF1
@@ -168,6 +166,10 @@
 MSG_LOGFILE_TOOLONG_ERROR=\x83\x8D\x83O\x83t\x83@\x83C\x83\x8B\x96\xBC\x82\xAA\x92\xB7\x82\xB7\x82\xAC\x82܂\xB7
 MSG_SAVESETUP_PERMISSION_ERROR=TERATERM.INI \x82ɏ\x91\x82\xAB\x8D\x9E\x82݌\xA0\x8C\xC0\x82\xAA\x82\xA0\x82\xE8\x82܂\xB9\x82\xF1
 
+MSG_DANDD_CONF_TITLE=Tera Term: \x83t\x83@\x83C\x83\x8B \x83h\x83\x89\x83b\x83O&\x83h\x83\x8D\x83b\x83v
+MSG_DANDD_CONF=\x83t\x83@\x83C\x83\x8B\x93]\x91\x97\x82\xF0\x8Ds\x82\xA2\x82܂\xB7\x82\xA9\x81H
+MSG_DANDD_CONF_CONFLICTS=\x93\xAF\x82\xB6\x8F\x88\x97\x9D\x82\xF0\x8E\x9F\x82\xCC %d \x8C‚̋\xA3\x8D\x87\x82ɓK\x97p
+
 DLG_TABSHEET_TITLE=Tera Term: \x82\xBB\x82̑\xBC\x82̐ݒ\xE8
 DLG_TABSHEET_TITLE_GENERAL=\x91S\x94\xCA
 DLG_TABSHEET_TITLE_SEQUENCE=\x90\xA7\x8C\xE4\x83V\x81[\x83P\x83\x93\x83X

Modified: branches/drag_and_drop/teraterm/common/tt_res.h
===================================================================
--- branches/drag_and_drop/teraterm/common/tt_res.h	2018-06-28 09:54:14 UTC (rev 7140)
+++ branches/drag_and_drop/teraterm/common/tt_res.h	2018-06-28 14:24:07 UTC (rev 7141)
@@ -214,7 +214,7 @@
 #define IDC_CLIPBOARD_NOTIFY            2566
 #define IDC_LIST_HIDDEN_FONTS           2567
 #define IDC_BINARY_CHECK                2568
-#define IDC_ADAPT_SAME_CHECK            2569
+#define IDC_SAME_PROCESS_CHECK          2569
 #define IDC_FILENAME_EDIT               2570
 #define IDC_SCP_RADIO                   2571
 #define IDC_SENDFILE_RADIO              2572
@@ -225,7 +225,7 @@
 #define IDC_SPACE_RADIO                 2577
 #define IDC_NEWLINE_RADIO               2578
 #define IDC_DAD_NOTE                    2579
-#define IDC_SAME_PROCESS_CHECK          2580
+#define IDC_SAME_PROCESS_NEXTDROP_CHECK 2580
 #define IDC_DONTSHOW_CHECK              2581
 #define ID_ACC_SENDBREAK                50001
 #define ID_ACC_COPY                     50002

Modified: branches/drag_and_drop/teraterm/teraterm/ttermpro.rc
===================================================================
--- branches/drag_and_drop/teraterm/teraterm/ttermpro.rc	2018-06-28 09:54:14 UTC (rev 7140)
+++ branches/drag_and_drop/teraterm/teraterm/ttermpro.rc	2018-06-28 14:24:07 UTC (rev 7141)
@@ -37,22 +37,22 @@
     CONTROL         "S&end File (Paste content of file)",IDC_SENDFILE_RADIO,
                     "Button",BS_AUTORADIOBUTTON | BS_NOTIFY,7,77,172,10
     CONTROL         "&Paste Filename",IDC_PASTE_RADIO,"Button",BS_AUTORADIOBUTTON | BS_NOTIFY,7,109,172,10
-    LTEXT           "SCP des&t:",IDC_SCP_PATH_LABEL,19,50,36,8
-    EDITTEXT        IDC_SCP_PATH,57,47,122,14,ES_AUTOHSCROLL
+    LTEXT           "des&t:",IDC_SCP_PATH_LABEL,19,50,22,8
+    EDITTEXT        IDC_SCP_PATH,46,47,133,14,ES_AUTOHSCROLL
     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,
+    CONTROL         "&Do this for the next %d conflicts",IDC_SAME_PROCESS_CHECK,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,173,172,10
-    CONTROL         "Do sa&me process, next drop",IDC_SAME_PROCESS_CHECK,
+    CONTROL         "Do sa&me process, next drop",IDC_SAME_PROCESS_NEXTDROP_CHECK,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,188,172,10
-    CONTROL         "&Do not display this dialog, next drop",IDC_DONTSHOW_CHECK,
+    CONTROL         "Do not d&isplay 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
+    LTEXT           "Drop with CTRL, this dialog is displayed",IDC_DAD_NOTE,7,221,172,8
 END
 
 IDD_COMMENT_DIALOG DIALOGEX 0, 0, 239, 19
@@ -348,8 +348,8 @@
     BEGIN
         LEFTMARGIN, 7
         RIGHTMARGIN, 179
-        TOPMARGIN, 1
-        BOTTOMMARGIN, 67
+        TOPMARGIN, 6
+        BOTTOMMARGIN, 259
     END
 
     IDD_COMMENT_DIALOG, DIALOG

Modified: branches/drag_and_drop/teraterm/teraterm/vtwin.cpp
===================================================================
--- branches/drag_and_drop/teraterm/teraterm/vtwin.cpp	2018-06-28 09:54:14 UTC (rev 7140)
+++ branches/drag_and_drop/teraterm/teraterm/vtwin.cpp	2018-06-28 14:24:07 UTC (rev 7141)
@@ -2032,6 +2032,28 @@
 	}
 }
 
+typedef struct {
+	int nIDDlgItem;
+	char *key;
+} DlgTextInfo;
+
+static void SetDlgTexts(HWND hDlgWnd, const DlgTextInfo *infos, int infoCount, char *UILanguageFile)
+{
+	for (int i = 0 ; i < infoCount; i++) {
+		char *key = infos[i].key;
+		char uimsg[MAX_UIMSG];
+		get_lang_msg(key, uimsg, sizeof(uimsg), "", UILanguageFile);
+		if (uimsg[0] != '\0') {
+			const int nIDDlgItem = infos[i].nIDDlgItem;
+			if (nIDDlgItem == 0) {
+				SetWindowText(hDlgWnd, uimsg);
+			} else {
+				SetDlgItemText(hDlgWnd, nIDDlgItem, uimsg);
+			}
+		}
+	}
+}
+
 enum drop_type {
 	DROP_TYPE_CANCEL,
 	DROP_TYPE_SCP,
@@ -2053,8 +2075,8 @@
 	bool SendfileEnable;
 	bool PasteNewlineEnable;
 	int RemaingFileCount;
-	bool AdaptSameProcess;
 	bool DoSameProcess;
+	bool DoSameProcessNextDrop;
 	bool DoNotShowDialogEnable;
 	bool DoNotShowDialog;
 };
@@ -2071,7 +2093,6 @@
 	switch (msg) {
 		case WM_INITDIALOG:
 		{
-			char uimsg[MAX_UIMSG];
 			LOGFONT logfont;
 			HFONT font;
 			HFONT DlgDragDropFont = NULL;
@@ -2082,7 +2103,7 @@
 			font = (HFONT)SendMessage(hDlgWnd, WM_GETFONT, 0, 0);
 			GetObject(font, sizeof(LOGFONT), &logfont);
 			if (get_lang_font("DLG_TAHOMA_FONT", hDlgWnd, &logfont, &DlgDragDropFont, ts.UILanguageFile)) {
-				const static int IDs[] = {
+				static const int IDs[] = {
 					IDC_FILENAME_EDIT,
 					IDC_DAD_STATIC,
 					IDC_SCP_RADIO, IDC_SENDFILE_RADIO, IDC_PASTE_RADIO,
@@ -2089,7 +2110,7 @@
 					IDC_SCP_PATH_LABEL, IDC_SCP_PATH, IDC_SCP_PATH_NOTE,
 					IDC_BINARY_CHECK,
 					IDC_ESCAPE_CHECK, IDC_NEWLINE_RADIO, IDC_SPACE_RADIO,
-					IDC_ADAPT_SAME_CHECK, IDC_DONTSHOW_CHECK,
+					IDC_SAME_PROCESS_CHECK, IDC_SAME_PROCESS_NEXTDROP_CHECK, IDC_DONTSHOW_CHECK,
 					IDC_DAD_NOTE,
 					IDOK, IDCANCEL,
 				};
@@ -2099,15 +2120,15 @@
 			}
 			DlgData->DlgDragDropFont = DlgDragDropFont;
 
-			GetWindowText(hDlgWnd, uimsg, sizeof(uimsg));
-			get_lang_msg("MSG_DANDD_CONF_TITLE", ts.UIMsg, sizeof(ts.UIMsg), uimsg, ts.UILanguageFile);
-			SetWindowText(hDlgWnd, ts.UIMsg);
+			static const DlgTextInfo textInfos[] = {
+				{ 0, "MSG_DANDD_CONF_TITLE" },
+				{ IDC_DAD_STATIC, "MSG_DANDD_CONF" },
+				{ IDC_SAME_PROCESS_CHECK, "MSG_DANDD_CONF_CONFLICTS" },
+			};
+			SetDlgTexts(hDlgWnd, textInfos, _countof(textInfos), ts.UILanguageFile);
 
+			// target file
 			SetDlgItemText(hDlgWnd, IDC_FILENAME_EDIT, Param->TargetFilename);
-
-			get_lang_msg("MSG_DANDD_CONF", ts.UIMsg, sizeof(ts.UIMsg),
-			             "Are you sure that you want to send the file content?", ts.UILanguageFile);
-			SetDlgItemText(hDlgWnd, IDC_DAD_STATIC, ts.UIMsg);
 			
 			// checkbox
 			CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO,
@@ -2148,13 +2169,14 @@
 				EnableWindow(GetDlgItem(hDlgWnd, IDC_NEWLINE_RADIO), FALSE);
 			}
 
-			// Adapt same process
-			GetDlgItemText(hDlgWnd, IDC_ADAPT_SAME_CHECK, uimsg, sizeof(uimsg));
-			char b[MAX_UIMSG];
-			_snprintf_s(b, sizeof(b), _TRUNCATE, uimsg, Param->RemaingFileCount);
-			SetDlgItemText(hDlgWnd, IDC_ADAPT_SAME_CHECK, b);
+			// Do this for the next %d conflicts
+			char orgmsg[MAX_UIMSG];
+			GetDlgItemText(hDlgWnd, IDC_SAME_PROCESS_CHECK, orgmsg, sizeof(orgmsg));
+			char uimsg[MAX_UIMSG];
+			_snprintf_s(uimsg, sizeof(uimsg), _TRUNCATE, orgmsg, Param->RemaingFileCount - 1);
+			SetDlgItemText(hDlgWnd, IDC_SAME_PROCESS_CHECK, uimsg);
 			if (Param->RemaingFileCount < 2) {
-				EnableWindow(GetDlgItem(hDlgWnd, IDC_ADAPT_SAME_CHECK), FALSE);
+				EnableWindow(GetDlgItem(hDlgWnd, IDC_SAME_PROCESS_CHECK), FALSE);
 			}
 
 			// Dont Show Dialog
@@ -2194,6 +2216,17 @@
 			{	// radio buttons double click
 				wID = IDOK;
 			}
+			if (wCMD == EN_SETFOCUS && wID == IDC_SCP_PATH) {
+				CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_SCP_RADIO);
+			}
+			if (wID == IDC_BINARY_CHECK) {
+				CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_SENDFILE_RADIO);
+			}
+			if (wID == IDC_ESCAPE_CHECK ||
+				wID == IDC_SPACE_RADIO || wID == IDC_NEWLINE_RADIO)
+			{
+				CheckRadioButton(hDlgWnd, IDC_SCP_RADIO, IDC_PASTE_RADIO, IDC_PASTE_RADIO);
+			}
 			if (wID == IDOK) {
 				if (IsDlgButtonChecked(hDlgWnd, IDC_SCP_RADIO) == BST_CHECKED) {
 					// SCP
@@ -2217,12 +2250,12 @@
 						(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->DoSameProcess =
+				DlgData->Param->DoSameProcess = 
 					(IsDlgButtonChecked(hDlgWnd, IDC_SAME_PROCESS_CHECK) == BST_CHECKED) ?
 					true : false;
+				DlgData->Param->DoSameProcessNextDrop =
+					(IsDlgButtonChecked(hDlgWnd, IDC_SAME_PROCESS_NEXTDROP_CHECK) == BST_CHECKED) ?
+					true : false;
 				DlgData->Param->DoNotShowDialog = 
 					(IsDlgButtonChecked(hDlgWnd, IDC_DONTSHOW_CHECK) == BST_CHECKED) ?
 					true : false;
@@ -2256,8 +2289,8 @@
 	bool EnableSendFile,
 	bool EnableDoNotShowDialog,
 	unsigned char *DropTypePaste,
-	bool *AdaptSameProcess,
 	bool *DoSameProcess,
+	bool *DoSameProcessNextDrop,
 	bool *DoNotShowDialog)
 {
 	struct DrapDropDlgParam Param;
@@ -2280,8 +2313,8 @@
 		return DROP_TYPE_CANCEL;
 	}
 	*DropTypePaste = Param.DropTypePaste;
-	*AdaptSameProcess = Param.AdaptSameProcess;
 	*DoSameProcess = Param.DoSameProcess;
+	*DoSameProcessNextDrop = Param.DoSameProcessNextDrop;
 	*DoNotShowDialog = Param.DoNotShowDialog;
 	return Param.DropType;
 }
@@ -2404,7 +2437,7 @@
 		}
 	}
 
-	bool AdapatSameProcess = false;
+	bool DoSameProcess = false;
 	const bool isSSH = (cv.isSSH == 2);
 	enum drop_type DropType;
 	unsigned char DropTypePaste = DROP_TYPE_PASTE_ESCAPE;
@@ -2418,17 +2451,17 @@
 					} else {
 						DropType = DROP_TYPE_SEND_FILE;
 					}
-					AdapatSameProcess = false;
+					DoSameProcess = false;
 				} else {
 					DropType = DROP_TYPE_SEND_FILE;
-					AdapatSameProcess = DefaultShowDialog ? false : true;
+					DoSameProcess = DefaultShowDialog ? false : true;
 				}
 			} else if (FileCount == 0 && DirectoryCount == 1) {
 				DropType = DROP_TYPE_PASTE_FILENAME;
-				AdapatSameProcess = DefaultShowDialog ? false : true;
+				DoSameProcess = DefaultShowDialog ? false : true;
 			} else if (FileCount > 0 && DirectoryCount > 0) {
 				DropType = DROP_TYPE_PASTE_FILENAME;
-				AdapatSameProcess = false;
+				DoSameProcess = false;
 			} else if (FileCount > 0 && DirectoryCount == 0) {
 				// filename only
 				if (isSSH) {
@@ -2436,11 +2469,11 @@
 				} else {
 					DropType = DROP_TYPE_SEND_FILE;
 				}
-				AdapatSameProcess = false;
+				DoSameProcess = false;
 			} else {
 				// directory only
 				DropType = DROP_TYPE_PASTE_FILENAME;
-				AdapatSameProcess = ts.ConfirmFileDragAndDrop ? false : true;
+				DoSameProcess = ts.ConfirmFileDragAndDrop ? false : true;
 			}
 		} else {
 			// show dialog
@@ -2453,7 +2486,7 @@
 					DropType = DROP_TYPE_SEND_FILE;
 				}
 			}
-			AdapatSameProcess = false;
+			DoSameProcess = false;
 		}
 	} else {
 		if (DirectoryCount > 0 &&
@@ -2463,11 +2496,11 @@
 		{	// \x83f\x83t\x83H\x83\x8B\x83g\x82̂܂܂ł͏\x88\x97\x9D\x82ł\xAB\x82Ȃ\xA2\x91g\x82ݍ\x87\x82킹
 			DropType = DROP_TYPE_PASTE_FILENAME;
 			DropTypePaste = DefaultDropTypePaste;
-			AdapatSameProcess = false;
+			DoSameProcess = false;
 		} else {
 			DropType = DefaultDropType;
 			DropTypePaste = DefaultDropTypePaste;
-			AdapatSameProcess = (ShowDialog || DefaultShowDialog) ? false : true;
+			DoSameProcess = (ShowDialog || DefaultShowDialog) ? false : true;
 		}
 	}
 
@@ -2474,8 +2507,8 @@
 	for (int i = 0; i < DropListCount; i++) {
 		const char *FileName = DropLists[i];
 
-		if (!AdapatSameProcess) {
-			bool DoSameProcess;
+		if (!DoSameProcess) {
+			bool DoSameProcessNextDrop;
 			bool DoNotShowDialog = !DefaultShowDialog;
 			DropType =
 				ShowDropDialogBox(hInst, HVTWin,
@@ -2485,13 +2518,13 @@
 								  DirectoryCount == 0 ? true : false,
 								  ts.ConfirmFileDragAndDrop ? false : true,
 								  &DropTypePaste,
-								  &AdapatSameProcess,
 								  &DoSameProcess,
+								  &DoSameProcessNextDrop,
 								  &DoNotShowDialog);
 			if (DropType == DROP_TYPE_CANCEL) {
 				goto finish;
 			}
-			if (DoSameProcess) {
+			if (DoSameProcessNextDrop) {
 				DefaultDropType = DropType;
 				DefaultDropTypePaste = DropTypePaste;
 			}
@@ -2543,7 +2576,7 @@
 		{
 			// send by scp
 			char **FileNames = &DropLists[i];
-			int FileCount = AdapatSameProcess ? DropListCount - i : 1;
+			int FileCount = DoSameProcess ? DropListCount - i : 1;
 			if (!SendScp(FileNames, FileCount, ts.ScpSendDir)) {
 				goto finish;
 			}



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