Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /branches/ttcomtester/teraterm/teraterm/setupdirdlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9339 - (hide annotations) (download) (as text)
Sun Aug 1 05:36:53 2021 UTC (2 years, 8 months ago) by zmatsuo
Original Path: trunk/teraterm/teraterm/setupdirdlg.cpp
File MIME type: text/x-c++src
File size: 17659 byte(s)
setup directory dialog を別ソースに分離

- setupdirdlg.cpp,h を追加
1 zmatsuo 9339 /*
2     * Copyright (C) 1994-1998 T. Teranishi
3     * (C) 2004- TeraTerm Project
4     * All rights reserved.
5     *
6     * Redistribution and use in source and binary forms, with or without
7     * modification, are permitted provided that the following conditions
8     * are met:
9     *
10     * 1. Redistributions of source code must retain the above copyright
11     * notice, this list of conditions and the following disclaimer.
12     * 2. Redistributions in binary form must reproduce the above copyright
13     * notice, this list of conditions and the following disclaimer in the
14     * documentation and/or other materials provided with the distribution.
15     * 3. The name of the author may not be used to endorse or promote products
16     * derived from this software without specific prior written permission.
17     *
18     * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
19     * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20     * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21     * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22     * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23     * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27     * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28     */
29     /* IPv6 modification is Copyright(C) 2000 Jun-ya Kato <kato@win6.jp> */
30    
31     /* TERATERM.EXE, VT window */
32    
33     // SDK7.0�������AWIN32_IE���K�������`��������
34     #if _MSC_VER == 1400 // VS2005����������
35     #if !defined(_WIN32_IE)
36     #define _WIN32_IE 0x0501
37     #endif
38     #endif
39    
40     #include "teraterm.h"
41     #include "tttypes.h"
42     #include "tttypes_key.h"
43    
44     #include "ttcommon.h"
45     #include "ttwinman.h" //
46     //#include "ttsetup.h"
47     //#include "keyboard.h"
48     //#include "buffer.h"
49     //#include "vtterm.h"
50     //#include "vtdisp.h"
51     #include "ttdialog.h"
52     //#include "ttime.h"
53     #include "commlib.h"
54     //#include "clipboar.h"
55     //#include "filesys.h"
56     //#include "telnet.h"
57     //#include "tektypes.h"
58     //#include "ttdde.h"
59     #include "ttlib.h"
60     #include "dlglib.h"
61     #include "helpid.h"
62     //#include "teraprn.h"
63     //#include <winsock2.h>
64     //#include <ws2tcpip.h>
65     //#include "ttplug.h" /* TTPLUG */
66     #include "teraterml.h"
67     //#include "buffer.h"
68    
69     #include <stdio.h>
70     #define _CRTDBG_MAP_ALLOC
71     #include <stdlib.h>
72     #include <crtdbg.h>
73     #include <string.h>
74     #include <io.h>
75     #include <errno.h>
76    
77     #include <shlobj.h>
78     #include <windows.h>
79     #include <windowsx.h>
80     //#include <imm.h>
81     #include <dbt.h>
82     #include <assert.h>
83     #include <wchar.h>
84     #include <htmlhelp.h>
85    
86     #include "tt_res.h"
87     #include "vtwin.h"
88     //#include "addsetting.h"
89     //#include "winjump.h"
90     #include "sizetip.h"
91     //#include "dnddlg.h"
92     //#include "tekwin.h"
93     #include "compat_win.h"
94     //#include "unicode_test.h"
95     #if UNICODE_DEBUG
96     #include "tipwin.h"
97     #endif
98     #include "codeconv.h"
99     #include "sendmem.h"
100     //#include "sendfiledlg.h"
101     #include "setting.h"
102     //#include "broadcast.h"
103     #include "asprintf.h"
104     //#include "teraprn.h"
105    
106     #include "setupdirdlg.h"
107    
108     //
109     // �w�������A�v���P�[�V�������t�@�C�����J���B
110     //
111     // return TRUE: success
112     // FALSE: failure
113     //
114     static BOOL openFileWithApplication(char *pathname, char *filename, char *editor)
115     {
116     char command[1024];
117     char fullpath[1024];
118     STARTUPINFO si;
119     PROCESS_INFORMATION pi;
120     BOOL ret = FALSE;
121     wchar_t buf[80];
122     wchar_t uimsg[MAX_UIMSG];
123     wchar_t uimsg2[MAX_UIMSG];
124    
125     SetLastError(NO_ERROR);
126    
127     _snprintf_s(fullpath, sizeof(fullpath), "%s\\%s", pathname, filename);
128     if (_access(fullpath, 0) != 0) { // �t�@�C��������������
129     DWORD no = GetLastError();
130     get_lang_msgW("MSG_ERROR", uimsg, _countof(uimsg), L"ERROR", ts.UILanguageFile);
131     get_lang_msgW("DLG_SETUPDIR_NOFILE_ERROR", uimsg2, _countof(uimsg2),
132     L"File does not exist.(%d)", ts.UILanguageFile);
133     _snwprintf_s(buf, _countof(buf), _TRUNCATE, uimsg2, no);
134     ::MessageBoxW(NULL, buf, uimsg, MB_OK | MB_ICONWARNING);
135     goto error;
136     }
137    
138     _snprintf_s(command, sizeof(command), _TRUNCATE, "%s \"%s\"", editor, fullpath);
139    
140     memset(&si, 0, sizeof(si));
141     GetStartupInfo(&si);
142     memset(&pi, 0, sizeof(pi));
143    
144     if (CreateProcess(NULL, command, NULL, NULL, FALSE, 0,
145     NULL, NULL, &si, &pi) == 0) { // �N�����s
146     DWORD no = GetLastError();
147     get_lang_msgW("MSG_ERROR", uimsg, _countof(uimsg), L"ERROR", ts.UILanguageFile);
148     get_lang_msgW("DLG_SETUPDIR_OPENFILE_ERROR", uimsg2, _countof(uimsg2),
149     L"Cannot open file.(%d)", ts.UILanguageFile);
150     _snwprintf_s(buf, _countof(buf), _TRUNCATE, uimsg2, no);
151     ::MessageBoxW(NULL, buf, uimsg, MB_OK | MB_ICONWARNING);
152     goto error;
153     } else {
154     CloseHandle(pi.hThread);
155     CloseHandle(pi.hProcess);
156     }
157    
158     ret = TRUE;
159    
160     error:;
161     return (ret);
162     }
163    
164     //
165     // �G�N�X�v���[�����p�X���J���B
166     //
167     // return TRUE: success
168     // FALSE: failure
169     //
170     static BOOL openDirectoryWithExplorer(const wchar_t *path)
171     {
172     LPSHELLFOLDER pDesktopFolder;
173     LPMALLOC pMalloc;
174     LPITEMIDLIST pIDL;
175     SHELLEXECUTEINFO si;
176     BOOL ret = FALSE;
177    
178     if (SHGetDesktopFolder(&pDesktopFolder) == S_OK) {
179     if (SHGetMalloc(&pMalloc) == S_OK) {
180     if (pDesktopFolder->ParseDisplayName(NULL, NULL, (LPWSTR)path, NULL, &pIDL, NULL) == S_OK) {
181     ::ZeroMemory(&si, sizeof(si));
182     si.cbSize = sizeof(si);
183     si.fMask = SEE_MASK_IDLIST;
184     si.lpVerb = "open";
185     si.lpIDList = pIDL;
186     si.nShow = SW_SHOWNORMAL;
187     ::ShellExecuteEx(&si);
188     pMalloc->Free((void *)pIDL);
189    
190     ret = TRUE;
191     }
192    
193     pMalloc->Release();
194     }
195     pDesktopFolder->Release();
196     }
197    
198     return (ret);
199     }
200    
201     //
202     // �t�H���_���������t�@�C�����J���B
203     //
204     static void openFileDirectory(char *path, char *filename, BOOL open_directory_only, char *open_editor)
205     {
206     if (open_directory_only) {
207     wchar_t *pathW = ToWcharA(path);
208     openDirectoryWithExplorer(pathW);
209     free(pathW);
210     }
211     else {
212     openFileWithApplication(path, filename, open_editor);
213     }
214     }
215    
216     //
217     // Virtual Store�p�X�����������B
218     //
219     // path: IN
220     // filename: IN
221     // vstore_path: OUT
222     // vstore_pathlen: IN
223     //
224     // return TRUE: success
225     // FALSE: failure
226     //
227     static BOOL convertVirtualStore(char *path, char *filename, char *vstore_path, int vstore_pathlen)
228     {
229     BOOL ret = FALSE;
230     const char *s, **p;
231     const char *virstore_env[] = {
232     "ProgramFiles",
233     "ProgramData",
234     "SystemRoot",
235     NULL
236     };
237     char shPath[1024] = "";
238     char shFullPath[1024] = "";
239     LPITEMIDLIST pidl;
240     int CSIDL;
241    
242     OutputDebugPrintf("[%s][%s]\n", path, filename);
243    
244     if (cv.VirtualStoreEnabled == FALSE)
245     goto error;
246    
247     // Virtual Store�����������t�H���_���B
248     p = virstore_env;
249     while (*p) {
250     s = getenv(*p);
251     if (s != NULL && strstr(path, s) != NULL) {
252     break;
253     }
254     p++;
255     }
256     if (*p == NULL)
257     goto error;
258    
259     CSIDL = CSIDL_LOCAL_APPDATA;
260     if (SHGetSpecialFolderLocation(NULL, CSIDL, &pidl) != S_OK) {
261     goto error;
262     }
263     SHGetPathFromIDList(pidl, shPath);
264     CoTaskMemFree(pidl);
265    
266     // Virtual Store�p�X�������B
267     strncat_s(shPath, sizeof(shPath), "\\VirtualStore", _TRUNCATE);
268    
269     // �s�v���h���C�u���^�[�����������B
270     // �h���C�u���^�[���������������������_�������B
271     s = strstr(path, ":\\");
272     if (s != NULL) {
273     strncat_s(shPath, sizeof(shPath), s + 1, _TRUNCATE);
274     }
275    
276     // �������AVirtual Store���t�@�C�������������������������B
277     _snprintf_s(shFullPath, sizeof(shFullPath), "%s\\%s", shPath, filename);
278     if (_access(shFullPath, 0) != 0) {
279     goto error;
280     }
281    
282     strncpy_s(vstore_path, vstore_pathlen, shPath, _TRUNCATE);
283    
284     ret = TRUE;
285     return (ret);
286    
287     error:
288     return (ret);
289     }
290    
291     static INT_PTR CALLBACK OnSetupDirectoryDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
292     {
293     static const DlgTextInfo TextInfos[] = {
294     { 0, "DLG_SETUPDIR_TITLE" },
295     { IDC_INI_SETUPDIR_GROUP, "DLG_SETUPDIR_INIFILE" },
296     { IDC_KEYCNF_SETUPDIR_GROUP, "DLG_SETUPDIR_KEYBOARDFILE" },
297     { IDC_CYGTERM_SETUPDIR_GROUP, "DLG_SETUPDIR_CYGTERMFILE" },
298     { IDC_SSH_SETUPDIR_GROUP, "DLG_SETUPDIR_KNOWNHOSTSFILE" },
299     };
300     static char teratermexepath[MAX_PATH];
301     static char inipath[MAX_PATH], inifilename[MAX_PATH], inipath_vstore[1024];
302     static char keycnfpath[MAX_PATH], keycnffilename[MAX_PATH], keycnfpath_vstore[1024];
303     static char cygtermpath[MAX_PATH], cygtermfilename[MAX_PATH], cygtermpath_vstore[1024];
304     // static char eterm1path[MAX_PATH], eterm1filename[MAX_PATH], eterm1path_vstore[1024];
305     char temp[MAX_PATH];
306     char tmpbuf[1024];
307     typedef int (CALLBACK *PSSH_read_known_hosts_file)(char *, int);
308     PSSH_read_known_hosts_file func = NULL;
309     HMODULE h = NULL;
310     static char hostsfilepath[MAX_PATH], hostsfilename[MAX_PATH], hostsfilepath_vstore[1024];
311     char *path_p, *filename_p;
312     BOOL open_dir, ret;
313     int button_pressed;
314     HWND hWnd;
315    
316     switch (msg) {
317     case WM_INITDIALOG:
318     // I18N
319     SetDlgTexts(hDlgWnd, TextInfos, _countof(TextInfos), ts.UILanguageFile);
320    
321     if (GetModuleFileNameA(NULL, temp, sizeof(temp)) != 0) {
322     ExtractDirName(temp, teratermexepath);
323     }
324    
325     // �����t�@�C��(teraterm.ini)���p�X�����������B
326     /// (1)
327     ExtractFileName(ts.SetupFName, inifilename, sizeof(inifilename));
328     ExtractDirName(ts.SetupFName, inipath);
329     //SetDlgItemText(hDlgWnd, IDC_INI_SETUPDIR_STATIC, inifilename);
330     SetDlgItemText(hDlgWnd, IDC_INI_SETUPDIR_EDIT, ts.SetupFName);
331     /// (2) Virutal Store��������
332     memset(inipath_vstore, 0, sizeof(inipath_vstore));
333     ret = convertVirtualStore(inipath, inifilename, inipath_vstore, sizeof(inipath_vstore));
334     if (ret) {
335     hWnd = GetDlgItem(hDlgWnd, IDC_INI_SETUPDIR_STATIC_VSTORE);
336     EnableWindow(hWnd, TRUE);
337     hWnd = GetDlgItem(hDlgWnd, IDC_INI_SETUPDIR_EDIT_VSTORE);
338     EnableWindow(hWnd, TRUE);
339     _snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, "%s\\%s", inipath_vstore, inifilename);
340     SetDlgItemText(hDlgWnd, IDC_INI_SETUPDIR_EDIT_VSTORE, tmpbuf);
341     }
342     else {
343     hWnd = GetDlgItem(hDlgWnd, IDC_INI_SETUPDIR_STATIC_VSTORE);
344     EnableWindow(hWnd, FALSE);
345     hWnd = GetDlgItem(hDlgWnd, IDC_INI_SETUPDIR_EDIT_VSTORE);
346     EnableWindow(hWnd, FALSE);
347     SetDlgItemText(hDlgWnd, IDC_INI_SETUPDIR_EDIT_VSTORE, "");
348     }
349    
350     // �����t�@�C��(KEYBOARD.CNF)���p�X�����������B
351     /// (1)
352     ExtractFileName(ts.KeyCnfFN, keycnffilename, sizeof(keycnfpath));
353     ExtractDirName(ts.KeyCnfFN, keycnfpath);
354     //SetDlgItemText(hDlgWnd, IDC_KEYCNF_SETUPDIR_STATIC, keycnffilename);
355     SetDlgItemText(hDlgWnd, IDC_KEYCNF_SETUPDIR_EDIT, ts.KeyCnfFN);
356     /// (2) Virutal Store��������
357     memset(keycnfpath_vstore, 0, sizeof(keycnfpath_vstore));
358     ret = convertVirtualStore(keycnfpath, keycnffilename, keycnfpath_vstore, sizeof(keycnfpath_vstore));
359     if (ret) {
360     hWnd = GetDlgItem(hDlgWnd, IDC_KEYCNF_SETUPDIR_STATIC_VSTORE);
361     EnableWindow(hWnd, TRUE);
362     hWnd = GetDlgItem(hDlgWnd, IDC_KEYCNF_SETUPDIR_EDIT_VSTORE);
363     EnableWindow(hWnd, TRUE);
364     _snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, "%s\\%s", keycnfpath_vstore, keycnffilename);
365     SetDlgItemText(hDlgWnd, IDC_KEYCNF_SETUPDIR_EDIT_VSTORE, tmpbuf);
366     }
367     else {
368     hWnd = GetDlgItem(hDlgWnd, IDC_KEYCNF_SETUPDIR_STATIC_VSTORE);
369     EnableWindow(hWnd, FALSE);
370     hWnd = GetDlgItem(hDlgWnd, IDC_KEYCNF_SETUPDIR_EDIT_VSTORE);
371     EnableWindow(hWnd, FALSE);
372     SetDlgItemText(hDlgWnd, IDC_KEYCNF_SETUPDIR_EDIT_VSTORE, "");
373     }
374    
375    
376     // cygterm.cfg �� ttermpro.exe �z�������u�����B
377     /// (1)
378     strncpy_s(cygtermfilename, sizeof(cygtermfilename), "cygterm.cfg", _TRUNCATE);
379     strncpy_s(cygtermpath, sizeof(cygtermpath), teratermexepath, _TRUNCATE);
380     //SetDlgItemText(hDlgWnd, IDC_CYGTERM_SETUPDIR_STATIC, cygtermfilename);
381     _snprintf_s(temp, sizeof(temp), "%s\\%s", cygtermpath, cygtermfilename);
382     SetDlgItemText(hDlgWnd, IDC_CYGTERM_SETUPDIR_EDIT, temp);
383     /// (2) Virutal Store��������
384     memset(cygtermpath_vstore, 0, sizeof(cygtermpath_vstore));
385     ret = convertVirtualStore(cygtermpath, cygtermfilename, cygtermpath_vstore, sizeof(cygtermpath_vstore));
386     if (ret) {
387     hWnd = GetDlgItem(hDlgWnd, IDC_CYGTERM_SETUPDIR_STATIC_VSTORE);
388     EnableWindow(hWnd, TRUE);
389     hWnd = GetDlgItem(hDlgWnd, IDC_CYGTERM_SETUPDIR_EDIT_VSTORE);
390     EnableWindow(hWnd, TRUE);
391     _snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, "%s\\%s", cygtermpath_vstore, cygtermfilename);
392     SetDlgItemText(hDlgWnd, IDC_CYGTERM_SETUPDIR_EDIT_VSTORE, tmpbuf);
393     }
394     else {
395     hWnd = GetDlgItem(hDlgWnd, IDC_CYGTERM_SETUPDIR_STATIC_VSTORE);
396     EnableWindow(hWnd, FALSE);
397     hWnd = GetDlgItem(hDlgWnd, IDC_CYGTERM_SETUPDIR_EDIT_VSTORE);
398     EnableWindow(hWnd, FALSE);
399     SetDlgItemText(hDlgWnd, IDC_CYGTERM_SETUPDIR_EDIT_VSTORE, "");
400     }
401    
402     // ssh_known_hosts
403     if (func == NULL) {
404     if (((h = GetModuleHandle("ttxssh.dll")) != NULL)) {
405     func = (PSSH_read_known_hosts_file)GetProcAddress(h, "TTXReadKnownHostsFile");
406     if (func) {
407     int ret = func(temp, sizeof(temp));
408     if (ret) {
409     char *s = strstr(temp, ":\\");
410    
411     if (s) { // full path
412     ExtractFileName(temp, hostsfilename, sizeof(hostsfilename));
413     ExtractDirName(temp, hostsfilepath);
414     }
415     else { // relative path
416     strncpy_s(hostsfilepath, sizeof(hostsfilepath), teratermexepath, _TRUNCATE);
417     strncpy_s(hostsfilename, sizeof(hostsfilename), temp, _TRUNCATE);
418     _snprintf_s(temp, sizeof(temp), "%s\\%s", hostsfilepath, hostsfilename);
419     }
420    
421     SetDlgItemText(hDlgWnd, IDC_SSH_SETUPDIR_EDIT, temp);
422    
423     /// (2) Virutal Store��������
424     memset(hostsfilepath_vstore, 0, sizeof(hostsfilepath_vstore));
425     ret = convertVirtualStore(hostsfilepath, hostsfilename, hostsfilepath_vstore, sizeof(hostsfilepath_vstore));
426     if (ret) {
427     hWnd = GetDlgItem(hDlgWnd, IDC_SSH_SETUPDIR_STATIC_VSTORE);
428     EnableWindow(hWnd, TRUE);
429     hWnd = GetDlgItem(hDlgWnd, IDC_SSH_SETUPDIR_EDIT_VSTORE);
430     EnableWindow(hWnd, TRUE);
431     _snprintf_s(tmpbuf, sizeof(tmpbuf), _TRUNCATE, "%s\\%s", hostsfilepath_vstore, hostsfilename);
432     SetDlgItemText(hDlgWnd, IDC_SSH_SETUPDIR_EDIT_VSTORE, tmpbuf);
433     }
434     else {
435     hWnd = GetDlgItem(hDlgWnd, IDC_SSH_SETUPDIR_STATIC_VSTORE);
436     EnableWindow(hWnd, FALSE);
437     hWnd = GetDlgItem(hDlgWnd, IDC_SSH_SETUPDIR_EDIT_VSTORE);
438     EnableWindow(hWnd, FALSE);
439     SetDlgItemText(hDlgWnd, IDC_SSH_SETUPDIR_EDIT_VSTORE, "");
440     }
441    
442     }
443     }
444     }
445     else {
446     hWnd = GetDlgItem(hDlgWnd, IDC_SSH_SETUPDIR_EDIT);
447     EnableWindow(hWnd, FALSE);
448     SetDlgItemText(hDlgWnd, IDC_SSH_SETUPDIR_EDIT, "");
449     hWnd = GetDlgItem(hDlgWnd, IDC_SSH_SETUPDIR_BUTTON);
450     EnableWindow(hWnd, FALSE);
451     hWnd = GetDlgItem(hDlgWnd, IDC_SSH_SETUPDIR_BUTTON_FILE);
452     EnableWindow(hWnd, FALSE);
453     hWnd = GetDlgItem(hDlgWnd, IDC_SSH_SETUPDIR_STATIC_VSTORE);
454     EnableWindow(hWnd, FALSE);
455     hWnd = GetDlgItem(hDlgWnd, IDC_SSH_SETUPDIR_EDIT_VSTORE);
456     EnableWindow(hWnd, FALSE);
457     SetDlgItemText(hDlgWnd, IDC_SSH_SETUPDIR_EDIT_VSTORE, "");
458     }
459     }
460    
461     return TRUE;
462    
463     case WM_COMMAND:
464     button_pressed = 0;
465     switch (LOWORD(wp)) {
466     case IDC_INI_SETUPDIR_BUTTON | (BN_CLICKED << 16) :
467     open_dir = TRUE;
468     path_p = inipath;
469     if (inipath_vstore[0])
470     path_p = inipath_vstore;
471     filename_p = inifilename;
472     button_pressed = 1;
473     break;
474     case IDC_INI_SETUPDIR_BUTTON_FILE | (BN_CLICKED << 16) :
475     open_dir = FALSE;
476     path_p = inipath;
477     if (inipath_vstore[0])
478     path_p = inipath_vstore;
479     filename_p = inifilename;
480     button_pressed = 1;
481     break;
482    
483     case IDC_KEYCNF_SETUPDIR_BUTTON | (BN_CLICKED << 16) :
484     open_dir = TRUE;
485     path_p = keycnfpath;
486     if (keycnfpath_vstore[0])
487     path_p = keycnfpath_vstore;
488     filename_p = keycnffilename;
489     button_pressed = 1;
490     break;
491     case IDC_KEYCNF_SETUPDIR_BUTTON_FILE | (BN_CLICKED << 16) :
492     open_dir = FALSE;
493     path_p = keycnfpath;
494     if (keycnfpath_vstore[0])
495     path_p = keycnfpath_vstore;
496     filename_p = keycnffilename;
497     button_pressed = 1;
498     break;
499    
500     case IDC_CYGTERM_SETUPDIR_BUTTON | (BN_CLICKED << 16) :
501     open_dir = TRUE;
502     path_p = cygtermpath;
503     if (cygtermpath_vstore[0])
504     path_p = cygtermpath_vstore;
505     filename_p = cygtermfilename;
506     button_pressed = 1;
507     break;
508     case IDC_CYGTERM_SETUPDIR_BUTTON_FILE | (BN_CLICKED << 16) :
509     open_dir = FALSE;
510     path_p = cygtermpath;
511     if (cygtermpath_vstore[0])
512     path_p = cygtermpath_vstore;
513     filename_p = cygtermfilename;
514     button_pressed = 1;
515     break;
516    
517     case IDC_SSH_SETUPDIR_BUTTON | (BN_CLICKED << 16) :
518     open_dir = TRUE;
519     path_p = hostsfilepath;
520     if (hostsfilepath_vstore[0])
521     path_p = hostsfilepath_vstore;
522     filename_p = hostsfilename;
523     button_pressed = 1;
524     break;
525     case IDC_SSH_SETUPDIR_BUTTON_FILE | (BN_CLICKED << 16) :
526     open_dir = FALSE;
527     path_p = hostsfilepath;
528     if (hostsfilepath_vstore[0])
529     path_p = hostsfilepath_vstore;
530     filename_p = hostsfilename;
531     button_pressed = 1;
532     break;
533    
534     case IDCANCEL:
535     TTEndDialog(hDlgWnd, IDCANCEL);
536     return TRUE;
537     break;
538    
539     default:
540     return FALSE;
541     }
542    
543     if (button_pressed) {
544     char *app = NULL;
545    
546     if (open_dir)
547     app = NULL;
548     else
549     app = ts.ViewlogEditor;
550    
551     openFileDirectory(path_p, filename_p, open_dir, app);
552     return TRUE;
553     }
554     return FALSE;
555    
556     case WM_CLOSE:
557     TTEndDialog(hDlgWnd, 0);
558     return TRUE;
559    
560     default:
561     return FALSE;
562     }
563     return TRUE;
564     }
565    
566     void SetupDirectoryDialog(HINSTANCE hInst, HWND hWnd)
567     {
568     TTDialogBox(hInst, MAKEINTRESOURCE(IDD_SETUP_DIR_DIALOG),
569     hWnd, OnSetupDirectoryDlgProc);
570     }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26