[Ttssh2-commit] [5816] チケット #34943 設定フォルダを開く

svnno****@sourc***** svnno****@sourc*****
2015年 3月 7日 (土) 00:30:53 JST


Revision: 5816
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5816
Author:   yutakapon
Date:     2015-03-07 00:30:52 +0900 (Sat, 07 Mar 2015)
Log Message:
-----------
チケット #34943 設定フォルダを開く

モーダルダイアログに設定ファイル一覧を表示するようにした。
ssh_known_hostsには未対応。

Ticket Links:
------------
    http://sourceforge.jp/projects/ttssh2/tracker/detail/34943

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

-------------- next part --------------
Modified: trunk/teraterm/common/tt_res.h
===================================================================
--- trunk/teraterm/common/tt_res.h	2015-03-06 12:05:30 UTC (rev 5815)
+++ trunk/teraterm/common/tt_res.h	2015-03-06 15:30:52 UTC (rev 5816)
@@ -22,6 +22,7 @@
 #define IDD_CLIPBOARD_DIALOG            120
 #define IDD_TABSHEET_SEQUENCE           121
 #define IDD_DAD_DIALOG                  122
+#define IDD_SETUP_DIR_DIALOG            123
 #define IDR_TEKMENU                     1000
 #define IDC_EDIT_COMMENT                1000
 #define IDC_EDIT_FULLPATH               1001
@@ -133,16 +134,23 @@
 #define IDC_SCP_PATH                    2510
 #define IDC_BGIMG_EDIT                  2510
 #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
 #define IDC_BGIMG_CHECK                 2512
+#define IDC_CYGTERM_SETUPDIR_EDIT       2512
 #define IDC_MOUSEWHEEL_SCROLL_LINE      2513
 #define IDC_WINDOW_CTRL                 2513
+#define IDC_ETERM1_SETUPDIR_EDIT        2513
 #define IDC_TRANSPROGRESS               2514
 #define IDC_WINDOW_REPORT               2514
+#define IDC_ETERM2_SETUPDIR_EDIT        2514
 #define IDC_PROTOPROGRESS               2515
+#define IDC_ETERM3_SETUPDIR_EDIT        2515
+#define IDC_SSH_SETUPDIR_EDIT           2516
 #define IDC_ACCEPT_TITLE_CHANGING_LABEL 2517
 #define IDC_PASTEDELAY_LABEL            2518
 #define IDC_TITLE_REPORT_LABEL          2518
@@ -162,14 +170,22 @@
 #define IDC_TRANS_ETIME                 2528
 #define IDC_BUTTON1                     2528
 #define IDC_BGIMG_BUTTON                2528
+#define IDC_INI_SETUPDIR_BUTTON         2528
 #define IDC_CLIPBOARD_ACCESS_LABEL      2529
 #define IDC_ROTATE_SIZE_TYPE            2529
+#define IDC_KEYCNF_SETUPDIR_BUTTON      2529
 #define IDC_CLIPBOARD_ACCESS            2530
 #define IDC_ROTATE_STEP                 2530
+#define IDC_CYGTERM_SETUPDIR_BUTTON     2530
 #define IDC_ROTATE_STEP_TEXT            2531
+#define IDC_ETERM1_SETUPDIR_BUTTON      2531
 #define IDC_ROTATE_SIZE_TEXT            2532
+#define IDC_ETERM2_SETUPDIR_BUTTON      2532
 #define IDC_ROTATE_GROUP                2533
+#define IDC_ETERM3_SETUPDIR_BUTTON      2533
 #define IDC_LOG_OPTION_GROUP            2534
+#define IDC_SSH_BUTTON                  2534
+#define IDC_SSH_SETUPDIR_BUTTON         2534
 #define IDC_OPT_BINARY                  2535
 #define IDC_OPT_APPEND                  2536
 #define IDC_OPT_PLAINTEXT               2537
@@ -177,6 +193,13 @@
 #define IDC_OPT_HIDEDLG                 2539
 #define IDC_CHECK7                      2540
 #define IDC_OPT_INCBUF                  2540
+#define IDC_INI_SETUPDIR_STATIC         2541
+#define IDC_KEYCNF_SETUPDIR_STATIC      2542
+#define IDC_CYGTERM_SETUPDIR_STATIC     2543
+#define IDC_ETERM1_SETUPDIR_STATIC      2544
+#define IDC_ETERM2_SETUPDIR_STATIC      2545
+#define IDC_ETERM3_SETUPDIR_STATIC      2546
+#define IDC_SSH_SETUPDIR_STATIC         2547
 #define ID_ACC_SENDBREAK                50001
 #define ID_ACC_COPY                     50002
 #define ID_ACC_NEWCONNECTION            50003
@@ -272,9 +295,9 @@
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NO_MFC                     1
-#define _APS_NEXT_RESOURCE_VALUE        123
+#define _APS_NEXT_RESOURCE_VALUE        124
 #define _APS_NEXT_COMMAND_VALUE         52031
-#define _APS_NEXT_CONTROL_VALUE         2541
+#define _APS_NEXT_CONTROL_VALUE         2548
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif

Modified: trunk/teraterm/teraterm/ttermpro.rc
===================================================================
--- trunk/teraterm/teraterm/ttermpro.rc	2015-03-06 12:05:30 UTC (rev 5815)
+++ trunk/teraterm/teraterm/ttermpro.rc	2015-03-06 15:30:52 UTC (rev 5816)
@@ -13,6 +13,69 @@
 #undef APSTUDIO_READONLY_SYMBOLS
 
 /////////////////////////////////////////////////////////////////////////////
+// \x93\xFA\x96{\x8C\xEA (\x93\xFA\x96{) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
+LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
+#pragma code_page(932)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_SETUP_DIR_DIALOG DIALOGEX 0, 0, 385, 182
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Setup directory"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+    LTEXT           "TERATERM.INI",IDC_INI_SETUPDIR_STATIC,7,18,49,8
+    EDITTEXT        IDC_INI_SETUPDIR_EDIT,73,16,253,14,ES_AUTOHSCROLL | ES_READONLY
+    PUSHBUTTON      "...",IDC_INI_SETUPDIR_BUTTON,338,16,26,14
+    LTEXT           "KEYBOARD.CNF",IDC_KEYCNF_SETUPDIR_STATIC,7,38,52,8
+    EDITTEXT        IDC_KEYCNF_SETUPDIR_EDIT,73,37,253,14,ES_AUTOHSCROLL | ES_READONLY
+    PUSHBUTTON      "...",IDC_KEYCNF_SETUPDIR_BUTTON,338,37,26,14
+    LTEXT           "cygterm.cfg",IDC_CYGTERM_SETUPDIR_STATIC,7,59,40,8
+    EDITTEXT        IDC_CYGTERM_SETUPDIR_EDIT,73,58,253,14,ES_AUTOHSCROLL | ES_READONLY
+    PUSHBUTTON      "...",IDC_CYGTERM_SETUPDIR_BUTTON,338,58,26,14
+    LTEXT           "ImageFile.INI",IDC_ETERM1_SETUPDIR_STATIC,7,81,44,8
+    EDITTEXT        IDC_ETERM1_SETUPDIR_EDIT,73,80,253,14,ES_AUTOHSCROLL | ES_READONLY
+    PUSHBUTTON      "...",IDC_ETERM1_SETUPDIR_BUTTON,338,80,26,14
+    LTEXT           "Scale.INI",IDC_ETERM2_SETUPDIR_STATIC,7,103,30,8
+    EDITTEXT        IDC_ETERM2_SETUPDIR_EDIT,73,102,253,14,ES_AUTOHSCROLL | ES_READONLY
+    PUSHBUTTON      "...",IDC_ETERM2_SETUPDIR_BUTTON,338,102,26,14
+    LTEXT           "Tile.INI",IDC_ETERM3_SETUPDIR_STATIC,7,127,24,8
+    EDITTEXT        IDC_ETERM3_SETUPDIR_EDIT,73,126,253,14,ES_AUTOHSCROLL | ES_READONLY
+    PUSHBUTTON      "...",IDC_ETERM3_SETUPDIR_BUTTON,338,126,26,14
+    LTEXT           "ssh_known_hosts",IDC_SSH_SETUPDIR_STATIC,9,151,58,8
+    EDITTEXT        IDC_SSH_SETUPDIR_EDIT,73,150,253,14,ES_AUTOHSCROLL | ES_READONLY
+    PUSHBUTTON      "...",IDC_SSH_SETUPDIR_BUTTON,338,150,26,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+    IDD_SETUP_DIR_DIALOG, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 378
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 175
+    END
+END
+#endif    // APSTUDIO_INVOKED
+
+#endif    // \x93\xFA\x96{\x8C\xEA (\x93\xFA\x96{) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
 // \x89p\x8C\xEA (\x95č\x91) resources
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)

Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2015-03-06 12:05:30 UTC (rev 5815)
+++ trunk/teraterm/teraterm/vtwin.cpp	2015-03-06 15:30:52 UTC (rev 5816)
@@ -4700,6 +4700,112 @@
 	return (ret);
 }
 
+
+static LRESULT CALLBACK OnSetupDirectoryDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+	static char teratermexepath[MAX_PATH];
+	static char inipath[MAX_PATH], inifilename[MAX_PATH];
+	static char keycnfpath[MAX_PATH], keycnffilename[MAX_PATH];
+	static char cygtermpath[MAX_PATH], cygtermfilename[MAX_PATH];
+	static char eterm1path[MAX_PATH], eterm1filename[MAX_PATH];
+	static char eterm2path[MAX_PATH], eterm2filename[MAX_PATH];
+	static char eterm3path[MAX_PATH], eterm3filename[MAX_PATH];
+	char temp[MAX_PATH];
+
+	switch (msg) {
+	case WM_INITDIALOG:
+		if (GetModuleFileName(NULL, temp, sizeof(temp)) != 0) {
+			ExtractDirName(temp, teratermexepath);
+		}
+
+		// \x90ݒ\xE8\x83t\x83@\x83C\x83\x8B(teraterm.ini)\x82̃p\x83X\x82\xF0\x8E擾\x82\xB7\x82\xE9\x81B
+		ExtractFileName(ts.SetupFName, inifilename, sizeof(inifilename));
+		ExtractDirName(ts.SetupFName, inipath);
+		SetDlgItemText(hDlgWnd, IDC_INI_SETUPDIR_STATIC, inifilename);
+		SetDlgItemText(hDlgWnd, IDC_INI_SETUPDIR_EDIT, inipath);
+
+		// \x90ݒ\xE8\x83t\x83@\x83C\x83\x8B(KEYBOARD.CNF)\x82̃p\x83X\x82\xF0\x8E擾\x82\xB7\x82\xE9\x81B
+		ExtractFileName(ts.KeyCnfFN, keycnffilename, sizeof(keycnfpath));
+		ExtractDirName(ts.KeyCnfFN, keycnfpath);
+		SetDlgItemText(hDlgWnd, IDC_KEYCNF_SETUPDIR_STATIC, keycnffilename);
+		SetDlgItemText(hDlgWnd, IDC_KEYCNF_SETUPDIR_EDIT, keycnfpath);
+
+		// cygterm.cfg \x82\xCD ttermpro.exe \x94z\x89\xBA\x82Ɉʒu\x82\xB7\x82\xE9\x81B
+		strncpy_s(cygtermfilename, sizeof(cygtermfilename), "cygterm.cfg", _TRUNCATE);
+		strncpy_s(cygtermpath, sizeof(cygtermpath), teratermexepath, _TRUNCATE);
+		SetDlgItemText(hDlgWnd, IDC_CYGTERM_SETUPDIR_STATIC, cygtermfilename);
+		SetDlgItemText(hDlgWnd, IDC_CYGTERM_SETUPDIR_EDIT, cygtermpath);
+
+		// TODO: Eterm look-feel \x8A֘A\x82\xCD BGThemeFile \x83G\x83\x93\x83g\x83\x8A\x82\xA9\x82\xE7\x8E擾\x82\xB7\x82\xE9\x81B
+		strncpy_s(eterm1filename, sizeof(eterm1filename), "ImageFile.INI", _TRUNCATE);
+		_snprintf_s(eterm1path, sizeof(eterm1path), "%s\\theme", teratermexepath);
+		SetDlgItemText(hDlgWnd, IDC_ETERM1_SETUPDIR_STATIC, eterm1filename);
+		SetDlgItemText(hDlgWnd, IDC_ETERM1_SETUPDIR_EDIT, eterm1path);
+
+		strncpy_s(eterm2filename, sizeof(eterm2filename), "Scale.INI", _TRUNCATE);
+		_snprintf_s(eterm2path, sizeof(eterm2path), "%s\\theme", teratermexepath);
+		SetDlgItemText(hDlgWnd, IDC_ETERM2_SETUPDIR_STATIC, eterm2filename);
+		SetDlgItemText(hDlgWnd, IDC_ETERM2_SETUPDIR_EDIT, eterm2path);
+
+		strncpy_s(eterm3filename, sizeof(eterm3filename), "Tile.INI", _TRUNCATE);
+		_snprintf_s(eterm3path, sizeof(eterm3path), "%s\\theme", teratermexepath);
+		SetDlgItemText(hDlgWnd, IDC_ETERM3_SETUPDIR_STATIC, eterm3filename);
+		SetDlgItemText(hDlgWnd, IDC_ETERM3_SETUPDIR_EDIT, eterm3path);
+
+		// TODO: ssh_known_hosts
+
+
+		return TRUE;
+
+	case WM_COMMAND:
+		switch (LOWORD(wp)) {
+		case IDC_INI_SETUPDIR_BUTTON | (BN_CLICKED << 16) :
+			openVirtualStore(inipath, inifilename);
+			return TRUE;
+
+		case IDC_KEYCNF_SETUPDIR_BUTTON | (BN_CLICKED << 16) :
+			openVirtualStore(keycnfpath, keycnfpath);
+			return TRUE;
+
+		case IDC_CYGTERM_SETUPDIR_BUTTON | (BN_CLICKED << 16) :
+			openVirtualStore(cygtermpath, cygtermfilename);
+			return TRUE;
+
+		case IDC_ETERM1_SETUPDIR_BUTTON | (BN_CLICKED << 16) :
+			openVirtualStore(eterm1path, eterm1filename);
+			return TRUE;
+
+		case IDC_ETERM2_SETUPDIR_BUTTON | (BN_CLICKED << 16) :
+			openVirtualStore(eterm2path, eterm2filename);
+			return TRUE;
+
+		case IDC_ETERM3_SETUPDIR_BUTTON | (BN_CLICKED << 16) :
+			openVirtualStore(eterm3path, eterm3filename);
+			return TRUE;
+
+		case IDC_SSH_SETUPDIR_BUTTON | (BN_CLICKED << 16) :
+			// TODO:
+			return TRUE;
+
+		case IDCANCEL:
+			EndDialog(hDlgWnd, IDCANCEL);
+			break;
+
+		default:
+			return FALSE;
+		}
+
+	case WM_CLOSE:
+		EndDialog(hDlgWnd, 0);
+		return TRUE;
+
+	default:
+		return FALSE;
+	}
+	return TRUE;
+}
+
+
 //
 // \x8C\xBB\x8Dݓǂݍ\x9E\x82܂\xEA\x82Ă\xA2\x82\xE9 teraterm.ini \x83t\x83@\x83C\x83\x8B\x82\xAA\x8Ai\x94[\x82\xB3\x82\xEA\x82Ă\xA2\x82\xE9
 // \x83t\x83H\x83\x8B\x83_\x82\xF0\x83G\x83N\x83X\x83v\x83\x8D\x81[\x83\x89\x82ŊJ\x82\xAD\x81B
@@ -4708,31 +4814,11 @@
 //
 void CVTWindow::OnOpenSetupDirectory()
 {
-	char path[MAX_PATH], inipath[MAX_PATH];
-	char filename[MAX_PATH];
+	int ret;
 
-	// \x90ݒ\xE8\x83t\x83@\x83C\x83\x8B(teraterm.ini)\x82̃p\x83X\x82\xF0\x8E擾\x82\xB7\x82\xE9\x81B
-	ExtractFileName(ts.SetupFName, filename, sizeof(filename));
-	ExtractDirName(ts.SetupFName, inipath);
-	//strcpy(inipath, "C:\\Program Files (x86)\\teraterm");
-	openVirtualStore(inipath, filename);
+	ret = DialogBox(hInst, MAKEINTRESOURCE(IDD_SETUP_DIR_DIALOG),
+		HVTWin, (DLGPROC)OnSetupDirectoryDlgProc);
 
-#if 0
-	// cygterm.cfg
-	if (GetModuleFileName(NULL, Temp, sizeof(Temp)) != 0) {
-		ExtractDirName(Temp, path);
-		// teraterm.ini\x82ƈقȂ\xE9\x83p\x83X\x82̏ꍇ\x81A\x90V\x82\xB5\x82\xAD\x8AJ\x82\xAD\x81B
-		if (strcmp(inipath, path) != 0) {
-			openVirtualStore(path, sizeof(path));
-		}
-	}
-
-	// KEYBOARD.CNF
-	//ExtractDirName(ts.KeyCnfFN, path);
-	//openDirectoryWithExplorer(path, sizeof(path));
-
-	// ssh_known_hosts
-#endif
 }
 
 



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