OSDN Git Service

Add support for retrying file transfer.
[ffftp/ffftp.git] / toolmenu.c
1 /*=============================================================================\r
2 *\r
3 *                                                               ツールバーとメニュー\r
4 *\r
5 ===============================================================================\r
6 / Copyright (C) 1997-2007 Sota. All rights reserved.\r
7 /\r
8 / Redistribution and use in source and binary forms, with or without \r
9 / modification, are permitted provided that the following conditions \r
10 / are met:\r
11 /\r
12 /  1. Redistributions of source code must retain the above copyright \r
13 /     notice, this list of conditions and the following disclaimer.\r
14 /  2. Redistributions in binary form must reproduce the above copyright \r
15 /     notice, this list of conditions and the following disclaimer in the \r
16 /     documentation and/or other materials provided with the distribution.\r
17 /\r
18 / THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR \r
19 / IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES \r
20 / OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \r
21 / IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, \r
22 / INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, \r
23 / BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF \r
24 / USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON \r
25 / ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
26 / (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF \r
27 / THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
28 /============================================================================*/\r
29 \r
30 #define  STRICT\r
31 // IPv6対応\r
32 #include <winsock2.h>\r
33 #include <windows.h>\r
34 #include <stdio.h>\r
35 #include <stdlib.h>\r
36 #include <string.h>\r
37 #include <mbstring.h>\r
38 #include <malloc.h>\r
39 #include <windowsx.h>\r
40 #include <commctrl.h>\r
41 #include <stdarg.h>\r
42 // IPv6対応\r
43 //#include <winsock.h>\r
44 \r
45 #include "common.h"\r
46 #include "resource.h"\r
47 \r
48 \r
49 /*===== プロトタイプ =====*/\r
50 \r
51 static void AddOpenMenu(HMENU hMenu, UINT Flg);\r
52 static LRESULT CALLBACK HistEditBoxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\r
53 \r
54 /* 2007/09/21 sunasunamix  ここから *********************/\r
55 static LRESULT CALLBACK CountermeasureTbarMainProc(HWND hWnd,UINT uMessage,WPARAM wParam,LPARAM lParam);\r
56 static LRESULT CALLBACK CountermeasureTbarLocalProc(HWND hWnd,UINT uMessage,WPARAM wParam,LPARAM lParam);\r
57 static LRESULT CALLBACK CountermeasureTbarRemoteProc(HWND hWnd,UINT uMessage,WPARAM wParam,LPARAM lParam);\r
58 /********************************************* ここまで */\r
59 \r
60 \r
61 /*===== 外部参照 =====*/\r
62 \r
63 extern int SepaWidth;\r
64 extern int RemoteWidth;\r
65 \r
66 extern int CancelFlg;\r
67 \r
68 /* 設定値 */\r
69 extern int DotFile;\r
70 extern char AsciiExt[ASCII_EXT_LEN+1];\r
71 extern int TransMode;\r
72 extern int ListType;\r
73 extern int LocalWidth;\r
74 extern char ViewerName[VIEWERS][FMAX_PATH+1];\r
75 extern int TransMode;\r
76 extern int SortSave;\r
77 \r
78 /*===== ローカルなワーク =====*/\r
79 \r
80 static HWND hWndTbarMain = NULL;\r
81 static HWND hWndTbarLocal = NULL;\r
82 static HWND hWndTbarRemote = NULL;\r
83 static HWND hWndDirLocal = NULL;\r
84 static HWND hWndDirRemote = NULL;\r
85 static HWND hWndDirLocalEdit = NULL;\r
86 static HWND hWndDirRemoteEdit = NULL;\r
87 \r
88 static WNDPROC HistEditBoxProcPtr;\r
89 \r
90 static HFONT DlgFont = NULL;\r
91 \r
92 static int TmpTransMode;\r
93 static int TmpHostKanjiCode;\r
94 static int TmpHostKanaCnv;\r
95 \r
96 // TODO: ローカルの漢字コードをShift_JIS以外にも対応\r
97 static int TmpLocalKanjiCode;\r
98 \r
99 static int TmpLocalFileSort;\r
100 static int TmpLocalDirSort;\r
101 static int TmpRemoteFileSort;\r
102 static int TmpRemoteDirSort;\r
103 \r
104 static int SyncMove = NO;\r
105 \r
106 static int HideUI = NO;\r
107 \r
108 \r
109 /* 2007/09/21 sunasunamix  ここから *********************/\r
110 static WNDPROC pOldTbarMainProc   = NULL;\r
111 static WNDPROC pOldTbarLocalProc  = NULL;\r
112 static WNDPROC pOldTbarRemoteProc = NULL;\r
113 /********************************************* ここまで */\r
114 \r
115 \r
116 /* 以前、コンボボックスにカレントフォルダを憶えさせていた流れで */\r
117 /* このファイルでカレントフォルダを憶えさせる */\r
118 static char LocalCurDir[FMAX_PATH+1];\r
119 static char RemoteCurDir[FMAX_PATH+1];\r
120 \r
121 \r
122 /* メインのツールバー */\r
123 static TBBUTTON TbarDataMain[] = {\r
124         { 0,  0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
125         { 0,  MENU_CONNECT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },\r
126         { 16, MENU_QUICK, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },\r
127         { 1,  MENU_DISCONNECT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },\r
128         { 0,  0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
129         { 2,  MENU_DOWNLOAD, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },\r
130         { 3,  MENU_UPLOAD, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },\r
131         { 0,  0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
132         { 24, MENU_MIRROR_UPLOAD, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },\r
133         { 0,  0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
134         { 4,  MENU_DELETE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },\r
135         { 5,  MENU_RENAME, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },\r
136         { 6,  MENU_MKDIR, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },\r
137         { 0,  0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
138         { 7,  MENU_TEXT, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
139         { 8,  MENU_BINARY, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
140         { 17, MENU_AUTO, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
141         { 0,  0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
142         { 27, MENU_L_KNJ_SJIS, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
143         { 20, MENU_L_KNJ_EUC, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
144         { 21, MENU_L_KNJ_JIS, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
145         { 28, MENU_L_KNJ_UTF8N, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
146         { 29, MENU_L_KNJ_UTF8BOM, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
147         { 0,  0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
148         { 27, MENU_KNJ_SJIS, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
149         { 20, MENU_KNJ_EUC, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
150         { 21, MENU_KNJ_JIS, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
151         { 28, MENU_KNJ_UTF8N, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
152         { 29, MENU_KNJ_UTF8BOM, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
153         { 22, MENU_KNJ_NONE, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
154         { 0,  0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
155         { 23, MENU_KANACNV, TBSTATE_ENABLED, TBSTYLE_CHECK, 0, 0 },\r
156         { 0,  0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
157         { 15, MENU_REFRESH, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },\r
158         { 0,  0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
159         { 18, MENU_LIST, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
160         { 19, MENU_REPORT, TBSTATE_ENABLED, TBSTYLE_CHECKGROUP, 0, 0 },\r
161         { 0,  0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
162         { 25, MENU_SYNC, TBSTATE_ENABLED, TBSTYLE_CHECK, 0, 0 },\r
163         { 0,  0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
164         { 26, MENU_ABORT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 }\r
165 };\r
166 \r
167 /* ローカル側のツールバー */\r
168 static TBBUTTON TbarDataLocal[] = {\r
169         { 0, 0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
170         { 0, MENU_LOCAL_UPDIR, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },\r
171         { 1, MENU_LOCAL_CHDIR, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },\r
172         { 0, 0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 }\r
173 };\r
174 \r
175 /* ホスト側のツールバー */\r
176 static TBBUTTON TbarDataRemote[] = {\r
177         { 0, 0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 },\r
178         { 0, MENU_REMOTE_UPDIR, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },\r
179         { 1, MENU_REMOTE_CHDIR, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0 },\r
180         { 0, 0, TBSTATE_ENABLED, BTNS_SEP, 0, 0 }\r
181 };\r
182 \r
183 /* 全ボタン/メニュー項目 */\r
184 static const int HideMenus[] = {\r
185         MENU_CONNECT,           MENU_QUICK,                     MENU_DISCONNECT,\r
186         MENU_SET_CONNECT,       MENU_IMPORT_WS,         MENU_EXIT,\r
187         MENU_DOWNLOAD,          MENU_UPLOAD,            MENU_DOWNLOAD_AS,       MENU_MIRROR_UPLOAD,\r
188         MENU_UPLOAD_AS,         MENU_DOWNLOAD_NAME,     MENU_MIRROR_UPLOAD,\r
189         MENU_FILESIZE,          MENU_DELETE,            MENU_RENAME,\r
190         MENU_CHMOD,                     MENU_MKDIR,                     MENU_SOMECMD,\r
191         MENU_SYNC,\r
192         MENU_BMARK_ADD,         MENU_BMARK_ADD_LOCAL, MENU_BMARK_ADD_BOTH,\r
193         MENU_BMARK_EDIT,\r
194         MENU_FILTER,            MENU_FIND,                      MENU_FINDNEXT,          MENU_SELECT,\r
195         MENU_SELECT_ALL,        MENU_LIST,                      MENU_REPORT,\r
196         MENU_SORT,                      MENU_DOTFILE,\r
197         MENU_DIRINFO,           MENU_TASKINFO,          MENU_REFRESH,\r
198         MENU_OPTION,\r
199         MENU_OTPCALC,\r
200         MENU_HELP,                      MENU_HELP_TROUBLE,      MENU_ABOUT,\r
201         MENU_REGINIT,\r
202         MENU_TEXT,                      MENU_BINARY,            MENU_AUTO,\r
203         MENU_KNJ_SJIS,          MENU_KNJ_EUC,           MENU_KNJ_JIS,           MENU_KNJ_UTF8N,         MENU_KNJ_UTF8BOM,       MENU_KNJ_NONE,\r
204         MENU_L_KNJ_SJIS,        MENU_L_KNJ_EUC,         MENU_L_KNJ_JIS,         MENU_L_KNJ_UTF8N,       MENU_L_KNJ_UTF8BOM,\r
205         MENU_KANACNV,\r
206         MENU_LOCAL_UPDIR,       MENU_LOCAL_CHDIR,\r
207         MENU_REMOTE_UPDIR,      MENU_REMOTE_CHDIR,\r
208         MENU_HIST_1,            MENU_HIST_2,            MENU_HIST_3,            MENU_HIST_4,\r
209         MENU_HIST_5,            MENU_HIST_6,            MENU_HIST_7,            MENU_HIST_8,\r
210         MENU_HIST_9,            MENU_HIST_10,           MENU_HIST_11,           MENU_HIST_12,\r
211         MENU_HIST_13,           MENU_HIST_14,           MENU_HIST_15,           MENU_HIST_16,\r
212         MENU_HIST_17,           MENU_HIST_18,           MENU_HIST_19,           MENU_HIST_20\r
213 };\r
214 \r
215 \r
216 \r
217 /*----- ツールバーを作成する --------------------------------------------------\r
218 *\r
219 *       Parameter\r
220 *               HWND hWnd : 親ウインドウのウインドウハンドル\r
221 *               HINSTANCE hInst : インスタンスハンドル\r
222 *\r
223 *       Return Value\r
224 *               int ステータス\r
225 *                       FFFTP_SUCCESS/FFFTP_FAIL\r
226 *----------------------------------------------------------------------------*/\r
227 \r
228 int MakeToolBarWindow(HWND hWnd, HINSTANCE hInst)\r
229 {\r
230         int Sts;\r
231         RECT Rect1;\r
232         char Tmp[FMAX_PATH+1];\r
233         char *Pos;\r
234         int Tmp2;\r
235         DWORD NoDrives;\r
236 \r
237         /*===== メインのツールバー =====*/\r
238 \r
239         hWndTbarMain = CreateToolbarEx(\r
240                                 hWnd,\r
241                                 WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS | CCS_TOP | TBSTYLE_FLAT,\r
242                                 1,\r
243                                 27,\r
244                                 hInst,\r
245                                 main_toolbar_bmp,\r
246                                 TbarDataMain,\r
247                                 sizeof(TbarDataMain)/sizeof(TBBUTTON),\r
248                                 16,16,\r
249                                 16,16,\r
250                                 sizeof(TBBUTTON));\r
251 \r
252         if(hWndTbarMain != NULL)\r
253         {\r
254                 /* 2007/09/21 sunasunamix  ここから *********************/\r
255                 pOldTbarMainProc = (WNDPROC)SetWindowLong(hWndTbarMain, GWL_WNDPROC, (DWORD)CountermeasureTbarMainProc);\r
256                 /********************************************* ここまで */\r
257 \r
258                 GetClientRect(hWnd, &Rect1);\r
259                 MoveWindow(hWndTbarMain, 0, 0, Rect1.right, TOOLWIN_HEIGHT, FALSE);\r
260         }\r
261 \r
262         /*===== ローカルのツールバー =====*/\r
263 \r
264         hWndTbarLocal = CreateToolbarEx(\r
265                                 hWnd,\r
266                                 WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS | CCS_NORESIZE | TBSTYLE_FLAT,\r
267                                 2,\r
268                                 2,\r
269                                 hInst,\r
270                                 remote_toolbar_bmp,\r
271                                 TbarDataLocal,\r
272                                 sizeof(TbarDataLocal)/sizeof(TBBUTTON),\r
273                                 16,16,\r
274                                 16,16,\r
275                                 sizeof(TBBUTTON));\r
276 \r
277         if(hWndTbarLocal != NULL)\r
278         {\r
279                 /* 2007/09/21 sunasunamix  ここから *********************/\r
280                 pOldTbarLocalProc = (WNDPROC)SetWindowLong(hWndTbarLocal, GWL_WNDPROC, (DWORD)CountermeasureTbarLocalProc);\r
281                 /********************************************* ここまで */\r
282 \r
283                 MoveWindow(hWndTbarLocal, 0, TOOLWIN_HEIGHT, LocalWidth, TOOLWIN_HEIGHT, FALSE);\r
284 \r
285                 /*===== ローカルのディレクトリ名ウインドウ =====*/\r
286 \r
287                 SendMessage(hWndTbarLocal, TB_GETITEMRECT, 3, (LPARAM)&Rect1);\r
288 #ifndef ENGLISH\r
289                 DlgFont = CreateFont(Rect1.bottom-Rect1.top-8, 0, 0, 0, 0, FALSE,FALSE,FALSE,SHIFTJIS_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,MSGJPN254);\r
290 #else\r
291                 DlgFont = CreateFont(Rect1.bottom-Rect1.top-8, 0, 0, 0, 0, FALSE,FALSE,FALSE,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,MSGJPN254);\r
292 #endif\r
293 \r
294                 hWndDirLocal = CreateWindowEx(WS_EX_CLIENTEDGE,\r
295                                         "COMBOBOX", "",\r
296                                         WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | CBS_DROPDOWN | CBS_SORT | CBS_AUTOHSCROLL,\r
297                                         Rect1.right, Rect1.top, LocalWidth - Rect1.right, 200,\r
298                                         hWndTbarLocal, (HMENU)COMBO_LOCAL, hInst, NULL);\r
299 \r
300                 if(hWndDirLocal != NULL)\r
301                 {\r
302                         /* エディットコントロールを探す */\r
303                         hWndDirLocalEdit = GetWindow(hWndDirLocal, GW_CHILD);\r
304                         if(hWndDirLocalEdit != NULL)\r
305                                 HistEditBoxProcPtr = (WNDPROC)SetWindowLong(hWndDirLocalEdit, GWL_WNDPROC, (LONG)HistEditBoxWndProc);\r
306 \r
307                         SendMessage(hWndDirLocal, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE, 0));\r
308                         SendMessage(hWndDirLocal, CB_LIMITTEXT, FMAX_PATH, 0);\r
309 \r
310                         /* ドライブ名をセットしておく */\r
311                         GetLogicalDriveStrings(FMAX_PATH, Tmp);\r
312                         NoDrives = LoadHideDriveListRegistory();\r
313                         Pos = Tmp;\r
314                         while(*Pos != NUL)\r
315                         {\r
316                                 Tmp2 = toupper(*Pos) - 'A';\r
317                                 if((NoDrives & (0x00000001 << Tmp2)) == 0)\r
318                                         SetLocalDirHist(Pos);\r
319                                 Pos = strchr(Pos, NUL) + 1;\r
320                         }\r
321                         SendMessage(hWndDirLocal, CB_SETCURSEL, 0, 0);\r
322                 }\r
323         }\r
324 \r
325         /*===== ホストのツールバー =====*/\r
326 \r
327         hWndTbarRemote = CreateToolbarEx(\r
328                                 hWnd,\r
329                                 WS_CHILD | WS_VISIBLE | TBSTYLE_TOOLTIPS | CCS_NORESIZE | TBSTYLE_FLAT,\r
330                                 3,\r
331                                 2,\r
332                                 hInst,\r
333                                 remote_toolbar_bmp,\r
334                                 TbarDataRemote,\r
335                                 sizeof(TbarDataRemote)/sizeof(TBBUTTON),\r
336                                 16,16,\r
337                                 16,16,\r
338                                 sizeof(TBBUTTON));\r
339 \r
340         if(hWndTbarRemote != NULL)\r
341         {\r
342                 /* 2007/09/21 sunasunamix  ここから *********************/\r
343                 pOldTbarRemoteProc = (WNDPROC)SetWindowLong(hWndTbarRemote, GWL_WNDPROC, (DWORD)CountermeasureTbarRemoteProc);\r
344                 /********************************************* ここまで */\r
345 \r
346                 MoveWindow(hWndTbarRemote, LocalWidth + SepaWidth, TOOLWIN_HEIGHT, RemoteWidth, TOOLWIN_HEIGHT, FALSE);\r
347 \r
348                 /*===== ホストのディレクトリ名ウインドウ =====*/\r
349 \r
350                 SendMessage(hWndTbarRemote, TB_GETITEMRECT, 3, (LPARAM)&Rect1);\r
351                 hWndDirRemote = CreateWindowEx(WS_EX_CLIENTEDGE,\r
352                                         "COMBOBOX", "",\r
353                                         WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL,\r
354                                         Rect1.right, Rect1.top, RemoteWidth - Rect1.right, 200,\r
355                                         hWndTbarRemote, (HMENU)COMBO_REMOTE, hInst, NULL);\r
356 \r
357                 if(hWndDirRemote != NULL)\r
358                 {\r
359                         /* エディットコントロールを探す */\r
360                         hWndDirRemoteEdit = GetWindow(hWndDirRemote, GW_CHILD);\r
361                         if(hWndDirRemoteEdit != NULL)\r
362                                 HistEditBoxProcPtr = (WNDPROC)SetWindowLong(hWndDirRemoteEdit, GWL_WNDPROC, (LONG)HistEditBoxWndProc);\r
363 \r
364                         SendMessage(hWndDirRemote, WM_SETFONT, (WPARAM)DlgFont, MAKELPARAM(TRUE, 0));\r
365                         SendMessage(hWndDirRemote, CB_LIMITTEXT, FMAX_PATH, 0);\r
366                         SendMessage(hWndDirRemote, CB_SETCURSEL, 0, 0);\r
367                 }\r
368         }\r
369 \r
370         Sts = FFFTP_SUCCESS;\r
371         if((hWndTbarMain == NULL) ||\r
372            (hWndTbarLocal == NULL) ||\r
373            (hWndTbarRemote == NULL) ||\r
374            (hWndDirLocal == NULL) ||\r
375            (hWndDirRemote == NULL))\r
376         {\r
377                 Sts = FFFTP_FAIL;\r
378         }\r
379         return(Sts);\r
380 }\r
381 \r
382 \r
383 \r
384 \r
385 \r
386 static LRESULT CALLBACK HistEditBoxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\r
387 {\r
388         char Tmp[FMAX_PATH+1];\r
389 \r
390         switch (message)\r
391         {\r
392                 case WM_CHAR :\r
393                         if(wParam == 0x0D)              /* リターンキーが押された */\r
394                         {\r
395                                 if(hWnd == hWndDirLocalEdit)\r
396                                 {\r
397                                         SendMessage(hWndDirLocalEdit, WM_GETTEXT, FMAX_PATH+1, (LPARAM)Tmp);\r
398                                         DoLocalCWD(Tmp);\r
399                                         GetLocalDirForWnd();\r
400                                 }\r
401                                 else\r
402                                 {\r
403                                         // 同時接続対応\r
404                                         CancelFlg = NO;\r
405                                         SendMessage(hWndDirRemoteEdit, WM_GETTEXT, FMAX_PATH+1, (LPARAM)Tmp);\r
406                                         if(CheckClosedAndReconnect() == FFFTP_SUCCESS)\r
407                                         {\r
408                                                 if(DoCWD(Tmp, YES, NO, YES) < FTP_RETRY)\r
409                                                         GetRemoteDirForWnd(CACHE_NORMAL, &CancelFlg);\r
410                                         }\r
411                                 }\r
412                         }\r
413                         else if(wParam == 0x09)         /* TABキーが押された */\r
414                         {\r
415                                 if(hWnd == hWndDirLocalEdit)\r
416                                 {\r
417                                         SetFocus(GetLocalHwnd());\r
418                                 }\r
419                                 else\r
420                                 {\r
421                                         SetFocus(GetRemoteHwnd());\r
422                                 }\r
423                         }\r
424                         else\r
425                                 return(CallWindowProc(HistEditBoxProcPtr, hWnd, message, wParam, lParam));\r
426                         break;\r
427 \r
428                 default :\r
429                         return(CallWindowProc(HistEditBoxProcPtr, hWnd, message, wParam, lParam));\r
430         }\r
431     return(0L);\r
432 }\r
433 \r
434 \r
435 \r
436 \r
437 /*----- ツールバーを削除 ------------------------------------------------------\r
438 *\r
439 *       Parameter\r
440 *               なし\r
441 *\r
442 *       Return Value\r
443 *               なし\r
444 *----------------------------------------------------------------------------*/\r
445 \r
446 void DeleteToolBarWindow(void)\r
447 {\r
448 //      if(DlgFont != NULL)\r
449 //              DeleteObject(DlgFont);\r
450 \r
451         if(hWndTbarMain != NULL)\r
452                 DestroyWindow(hWndTbarMain);\r
453         if(hWndTbarLocal != NULL)\r
454                 DestroyWindow(hWndTbarLocal);\r
455         if(hWndTbarRemote != NULL)\r
456                 DestroyWindow(hWndTbarRemote);\r
457         if(hWndDirLocal != NULL)\r
458                 DestroyWindow(hWndDirLocal);\r
459         if(hWndDirRemote != NULL)\r
460                 DestroyWindow(hWndDirRemote);\r
461         return;\r
462 }\r
463 \r
464 \r
465 /*----- メインのツールバーのウインドウハンドルを返す --------------------------\r
466 *\r
467 *       Parameter\r
468 *               なし\r
469 *\r
470 *       Return Value\r
471 *               HWND ウインドウハンドル\r
472 *----------------------------------------------------------------------------*/\r
473 \r
474 HWND GetMainTbarWnd(void)\r
475 {\r
476         return(hWndTbarMain);\r
477 }\r
478 \r
479 \r
480 /*----- ローカル側のヒストリウインドウのウインドウハンドルを返す --------------\r
481 *\r
482 *       Parameter\r
483 *               なし\r
484 *\r
485 *       Return Value\r
486 *               HWND ウインドウハンドル\r
487 *----------------------------------------------------------------------------*/\r
488 \r
489 HWND GetLocalHistHwnd(void)\r
490 {\r
491         return(hWndDirLocal);\r
492 }\r
493 \r
494 \r
495 /*----- ホスト側のヒストリウインドウのウインドウハンドルを返す ----------------\r
496 *\r
497 *       Parameter\r
498 *               なし\r
499 *\r
500 *       Return Value\r
501 *               HWND ウインドウハンドル\r
502 *----------------------------------------------------------------------------*/\r
503 \r
504 HWND GetRemoteHistHwnd(void)\r
505 {\r
506         return(hWndDirRemote);\r
507 }\r
508 \r
509 \r
510 /*----- ローカル側のヒストリエディットのウインドウハンドルを返す --------------\r
511 *\r
512 *       Parameter\r
513 *               なし\r
514 *\r
515 *       Return Value\r
516 *               HWND ウインドウハンドル\r
517 *----------------------------------------------------------------------------*/\r
518 \r
519 HWND GetLocalHistEditHwnd(void)\r
520 {\r
521         return(hWndDirLocalEdit);\r
522 }\r
523 \r
524 \r
525 /*----- ホスト側のヒストリエディットのウインドウハンドルを返す ----------------\r
526 *\r
527 *       Parameter\r
528 *               なし\r
529 *\r
530 *       Return Value\r
531 *               HWND ウインドウハンドル\r
532 *----------------------------------------------------------------------------*/\r
533 \r
534 HWND GetRemoteHistEditHwnd(void)\r
535 {\r
536         return(hWndDirRemoteEdit);\r
537 }\r
538 \r
539 \r
540 /*----- ローカル側のツールバーのウインドウハンドルを返す ----------------------\r
541 *\r
542 *       Parameter\r
543 *               なし\r
544 *\r
545 *       Return Value\r
546 *               HWND ウインドウハンドル\r
547 *----------------------------------------------------------------------------*/\r
548 \r
549 HWND GetLocalTbarWnd(void)\r
550 {\r
551         return(hWndTbarLocal);\r
552 }\r
553 \r
554 \r
555 /*----- ホスト側のツールバーのウインドウハンドルを返す ------------------------\r
556 *\r
557 *       Parameter\r
558 *               なし\r
559 *\r
560 *       Return Value\r
561 *               HWND ウインドウハンドル\r
562 *----------------------------------------------------------------------------*/\r
563 \r
564 HWND GetRemoteTbarWnd(void)\r
565 {\r
566         return(hWndTbarRemote);\r
567 }\r
568 \r
569 \r
570 /*----- HideUI の状態を返す ---------------------------------------------------\r
571 *\r
572 *       Parameter\r
573 *               なし\r
574 *\r
575 *       Return Value\r
576 *               int HideUI の状態\r
577 *----------------------------------------------------------------------------*/\r
578 \r
579 int GetHideUI(void)\r
580 {\r
581         return(HideUI);\r
582 }\r
583 \r
584 \r
585 /*----- ツールボタン/メニューのハイド処理 ------------------------------------\r
586 *\r
587 *       Parameter\r
588 *               なし\r
589 *\r
590 *       Return Value\r
591 *               なし\r
592 *----------------------------------------------------------------------------*/\r
593 \r
594 void MakeButtonsFocus(void)\r
595 {\r
596         HWND hWndFocus;\r
597         HWND hWndMain;\r
598         int Count;\r
599         int Win;\r
600 \r
601         if(HideUI == NO)\r
602         {\r
603                 hWndMain = GetMainHwnd();\r
604                 hWndFocus = GetFocus();\r
605                 Win = WIN_LOCAL;\r
606                 if(hWndFocus == GetRemoteHwnd())\r
607                         Win = WIN_REMOTE;\r
608 \r
609                 Count = GetSelectedCount(Win);\r
610 \r
611                 if(AskConnecting() == YES)\r
612                 {\r
613                         EnableMenuItem(GetMenu(hWndMain), MENU_BMARK_ADD, MF_ENABLED);\r
614                         EnableMenuItem(GetMenu(hWndMain), MENU_BMARK_ADD_LOCAL, MF_ENABLED);\r
615                         EnableMenuItem(GetMenu(hWndMain), MENU_BMARK_ADD_BOTH, MF_ENABLED);\r
616                         EnableMenuItem(GetMenu(hWndMain), MENU_BMARK_EDIT, MF_ENABLED);\r
617                         EnableMenuItem(GetMenu(hWndMain), MENU_DIRINFO, MF_ENABLED);\r
618                         EnableMenuItem(GetMenu(hWndMain), MENU_MIRROR_UPLOAD, MF_ENABLED);\r
619                         EnableMenuItem(GetMenu(hWndMain), MENU_MIRROR_DOWNLOAD, MF_ENABLED);\r
620                         EnableMenuItem(GetMenu(hWndMain), MENU_DOWNLOAD_NAME, MF_ENABLED);\r
621                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_MIRROR_UPLOAD, MAKELONG(TRUE, 0));\r
622                 }\r
623                 else\r
624                 {\r
625                         EnableMenuItem(GetMenu(hWndMain), MENU_BMARK_ADD, MF_GRAYED);\r
626                         EnableMenuItem(GetMenu(hWndMain), MENU_BMARK_ADD_LOCAL, MF_GRAYED);\r
627                         EnableMenuItem(GetMenu(hWndMain), MENU_BMARK_ADD_BOTH, MF_GRAYED);\r
628                         EnableMenuItem(GetMenu(hWndMain), MENU_BMARK_EDIT, MF_GRAYED);\r
629                         EnableMenuItem(GetMenu(hWndMain), MENU_DIRINFO, MF_GRAYED);\r
630                         EnableMenuItem(GetMenu(hWndMain), MENU_MIRROR_UPLOAD, MF_GRAYED);\r
631                         EnableMenuItem(GetMenu(hWndMain), MENU_MIRROR_DOWNLOAD, MF_GRAYED);\r
632                         EnableMenuItem(GetMenu(hWndMain), MENU_DOWNLOAD_NAME, MF_GRAYED);\r
633                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_MIRROR_UPLOAD, MAKELONG(FALSE, 0));\r
634                 }\r
635 \r
636                 if(hWndFocus == GetLocalHwnd())\r
637                 {\r
638                         if((AskConnecting() == YES) && (Count > 0))\r
639                         {\r
640                                 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_UPLOAD, MAKELONG(TRUE, 0));\r
641                                 EnableMenuItem(GetMenu(hWndMain), MENU_UPLOAD, MF_ENABLED);\r
642                                 EnableMenuItem(GetMenu(hWndMain), MENU_UPLOAD_AS, MF_ENABLED);\r
643                         }\r
644                         else\r
645                         {\r
646                                 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_UPLOAD, MAKELONG(FALSE, 0));\r
647                                 EnableMenuItem(GetMenu(hWndMain), MENU_UPLOAD, MF_GRAYED);\r
648                                 EnableMenuItem(GetMenu(hWndMain), MENU_UPLOAD_AS, MF_GRAYED);\r
649                         }\r
650                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_DOWNLOAD, MAKELONG(FALSE, 0));\r
651                         EnableMenuItem(GetMenu(hWndMain), MENU_SOMECMD, MF_GRAYED);\r
652                         EnableMenuItem(GetMenu(hWndMain), MENU_DOWNLOAD, MF_GRAYED);\r
653                         EnableMenuItem(GetMenu(hWndMain), MENU_DOWNLOAD_AS, MF_GRAYED);\r
654                         EnableMenuItem(GetMenu(hWndMain), MENU_DOWNLOAD_AS_FILE, MF_GRAYED);\r
655                 }\r
656 \r
657                 if(hWndFocus == GetRemoteHwnd())\r
658                 {\r
659                         if(AskConnecting() == YES)\r
660                         {\r
661                                 EnableMenuItem(GetMenu(hWndMain), MENU_SOMECMD, MF_ENABLED);\r
662                         }\r
663                         else\r
664                         {\r
665                                 EnableMenuItem(GetMenu(hWndMain), MENU_SOMECMD, MF_GRAYED);\r
666                         }\r
667 \r
668                         if((AskConnecting() == YES) && (Count > 0))\r
669                         {\r
670                                 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_DOWNLOAD, MAKELONG(TRUE, 0));\r
671                                 EnableMenuItem(GetMenu(hWndMain), MENU_DOWNLOAD, MF_ENABLED);\r
672                                 EnableMenuItem(GetMenu(hWndMain), MENU_DOWNLOAD_AS, MF_ENABLED);\r
673                                 EnableMenuItem(GetMenu(hWndMain), MENU_DOWNLOAD_AS_FILE, MF_ENABLED);\r
674                         }\r
675                         else\r
676                         {\r
677                                 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_DOWNLOAD, MAKELONG(FALSE, 0));\r
678                                 EnableMenuItem(GetMenu(hWndMain), MENU_DOWNLOAD, MF_GRAYED);\r
679                                 EnableMenuItem(GetMenu(hWndMain), MENU_DOWNLOAD_AS, MF_GRAYED);\r
680                                 EnableMenuItem(GetMenu(hWndMain), MENU_DOWNLOAD_AS_FILE, MF_GRAYED);\r
681                         }\r
682                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_UPLOAD, MAKELONG(FALSE, 0));\r
683                         EnableMenuItem(GetMenu(hWndMain), MENU_UPLOAD, MF_GRAYED);\r
684                         EnableMenuItem(GetMenu(hWndMain), MENU_UPLOAD_AS, MF_GRAYED);\r
685                 }\r
686 \r
687                 if((hWndFocus == GetLocalHwnd()) || (hWndFocus == GetRemoteHwnd()))\r
688                 {\r
689                         if(Count > 0)\r
690                         {\r
691                                 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_DELETE, MAKELONG(TRUE, 0));\r
692                                 EnableMenuItem(GetMenu(hWndMain), MENU_DELETE, MF_ENABLED);\r
693                                 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_RENAME, MAKELONG(TRUE, 0));\r
694                                 EnableMenuItem(GetMenu(hWndMain), MENU_RENAME, MF_ENABLED);\r
695 \r
696                                 EnableMenuItem(GetMenu(hWndMain), MENU_CHMOD, MF_ENABLED);\r
697 \r
698                         }\r
699                         else\r
700                         {\r
701                                 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_DELETE, MAKELONG(FALSE, 0));\r
702                                 EnableMenuItem(GetMenu(hWndMain), MENU_DELETE, MF_GRAYED);\r
703                                 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_RENAME, MAKELONG(FALSE, 0));\r
704                                 EnableMenuItem(GetMenu(hWndMain), MENU_RENAME, MF_GRAYED);\r
705 \r
706                                 EnableMenuItem(GetMenu(hWndMain), MENU_CHMOD, MF_GRAYED);\r
707                         }\r
708 \r
709                         if((hWndFocus == GetLocalHwnd()) || (AskConnecting() == YES))\r
710                         {\r
711                                 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_MKDIR, MAKELONG(TRUE, 0));\r
712                                 EnableMenuItem(GetMenu(hWndMain), MENU_MKDIR, MF_ENABLED);\r
713                                 EnableMenuItem(GetMenu(hWndMain), MENU_FILESIZE, MF_ENABLED);\r
714                         }\r
715                         else\r
716                         {\r
717                                 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_MKDIR, MAKELONG(FALSE, 0));\r
718                                 EnableMenuItem(GetMenu(hWndMain), MENU_MKDIR, MF_GRAYED);\r
719                                 EnableMenuItem(GetMenu(hWndMain), MENU_FILESIZE, MF_GRAYED);\r
720                         }\r
721                 }\r
722                 else\r
723                 {\r
724                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_UPLOAD, MAKELONG(FALSE, 0));\r
725                         EnableMenuItem(GetMenu(hWndMain), MENU_UPLOAD, MF_GRAYED);\r
726                         EnableMenuItem(GetMenu(hWndMain), MENU_UPLOAD_AS, MF_GRAYED);\r
727                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_DOWNLOAD, MAKELONG(FALSE, 0));\r
728                         EnableMenuItem(GetMenu(hWndMain), MENU_DOWNLOAD, MF_GRAYED);\r
729                         EnableMenuItem(GetMenu(hWndMain), MENU_DOWNLOAD_AS, MF_GRAYED);\r
730                         EnableMenuItem(GetMenu(hWndMain), MENU_DOWNLOAD_AS_FILE, MF_GRAYED);\r
731                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_DELETE, MAKELONG(FALSE, 0));\r
732                         EnableMenuItem(GetMenu(hWndMain), MENU_DELETE, MF_GRAYED);\r
733                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_RENAME, MAKELONG(FALSE, 0));\r
734                         EnableMenuItem(GetMenu(hWndMain), MENU_RENAME, MF_GRAYED);\r
735                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_MKDIR, MAKELONG(FALSE, 0));\r
736                         EnableMenuItem(GetMenu(hWndMain), MENU_MKDIR, MF_GRAYED);\r
737                         EnableMenuItem(GetMenu(hWndMain), MENU_CHMOD, MF_GRAYED);\r
738                         EnableMenuItem(GetMenu(hWndMain), MENU_FILESIZE, MF_GRAYED);\r
739                         EnableMenuItem(GetMenu(hWndMain), MENU_SOMECMD, MF_GRAYED);\r
740                 }\r
741         }\r
742         return;\r
743 }\r
744 \r
745 \r
746 /*----- ユーザの操作を禁止する ------------------------------------------------\r
747 *\r
748 *       Parameter\r
749 *               なし\r
750 *\r
751 *       Return Value\r
752 *               なし\r
753 *----------------------------------------------------------------------------*/\r
754 \r
755 void DisableUserOpe(void)\r
756 {\r
757         int i;\r
758 \r
759         HideUI = YES;\r
760 \r
761         for(i = 0; i < sizeof(HideMenus) / sizeof(int); i++)\r
762         {\r
763                 EnableMenuItem(GetMenu(GetMainHwnd()), HideMenus[i], MF_GRAYED);\r
764                 SendMessage(hWndTbarMain, TB_ENABLEBUTTON, HideMenus[i], MAKELONG(FALSE, 0));\r
765                 SendMessage(hWndTbarLocal, TB_ENABLEBUTTON, HideMenus[i], MAKELONG(FALSE, 0));\r
766                 SendMessage(hWndTbarRemote, TB_ENABLEBUTTON, HideMenus[i], MAKELONG(FALSE, 0));\r
767         }\r
768 \r
769         EnableWindow(hWndDirLocal, FALSE);\r
770         EnableWindow(hWndDirRemote, FALSE);\r
771 \r
772         return;\r
773 }\r
774 \r
775 \r
776 /*----- ユーザの操作を許可する ------------------------------------------------\r
777 *\r
778 *       Parameter\r
779 *               なし\r
780 *\r
781 *       Return Value\r
782 *               なし\r
783 *----------------------------------------------------------------------------*/\r
784 \r
785 void EnableUserOpe(void)\r
786 {\r
787         int i;\r
788 \r
789         if(HideUI == YES)\r
790         {\r
791                 for(i = 0; i < sizeof(HideMenus) / sizeof(int); i++)\r
792                 {\r
793                         EnableMenuItem(GetMenu(GetMainHwnd()), HideMenus[i], MF_ENABLED);\r
794                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, HideMenus[i], MAKELONG(TRUE, 0));\r
795                         SendMessage(hWndTbarLocal, TB_ENABLEBUTTON, HideMenus[i], MAKELONG(TRUE, 0));\r
796                         SendMessage(hWndTbarRemote, TB_ENABLEBUTTON, HideMenus[i], MAKELONG(TRUE, 0));\r
797                 }\r
798                 EnableWindow(hWndDirLocal, TRUE);\r
799                 EnableWindow(hWndDirRemote, TRUE);\r
800 \r
801                 // 選択不可な漢字コードのボタンが表示されるバグを修正\r
802                 HideHostKanjiButton();\r
803                 HideLocalKanjiButton();\r
804 \r
805                 HideUI = NO;\r
806 \r
807                 MakeButtonsFocus();\r
808         }\r
809         return;\r
810 }\r
811 \r
812 \r
813 /*----- ユーザの操作が禁止されているかどうかを返す ----------------------------\r
814 *\r
815 *       Parameter\r
816 *               なし\r
817 *\r
818 *       Return Value\r
819 *               int ステータス\r
820 *                       YES=禁止されている/NO\r
821 *----------------------------------------------------------------------------*/\r
822 \r
823 int AskUserOpeDisabled(void)\r
824 {\r
825         return(HideUI);\r
826 }\r
827 \r
828 \r
829 /*===================================================\r
830 *                       転送モード\r
831 *===================================================*/\r
832 \r
833 /*----- 転送モードを設定する --------------------------------------------------\r
834 *\r
835 *       Parameter\r
836 *               int Mode : 転送モード (TYPE_xx)\r
837 *\r
838 *       Return Value\r
839 *               なし\r
840 *----------------------------------------------------------------------------*/\r
841 \r
842 void SetTransferTypeImm(int Mode)\r
843 {\r
844         TmpTransMode = Mode;\r
845         HideHostKanjiButton();\r
846         HideLocalKanjiButton();\r
847         return;\r
848 }\r
849 \r
850 \r
851 /*----- メニューにより転送モードを設定する ------------------------------------\r
852 *\r
853 *       Parameter\r
854 *               int Type : 転送モード (MENU_xxxx)\r
855 *\r
856 *       Return Value\r
857 *               なし\r
858 *----------------------------------------------------------------------------*/\r
859 \r
860 void SetTransferType(int Type)\r
861 {\r
862         switch(Type)\r
863         {\r
864                 case MENU_TEXT :\r
865                         TmpTransMode = TYPE_A;\r
866                         break;\r
867 \r
868                 case MENU_BINARY :\r
869                         TmpTransMode = TYPE_I;\r
870                         break;\r
871 \r
872                 default :\r
873                         TmpTransMode = TYPE_X;\r
874                         break;\r
875         }\r
876         HideHostKanjiButton();\r
877         HideLocalKanjiButton();\r
878         return;\r
879 }\r
880 \r
881 \r
882 /*----- 転送モードにしたがってボタンを表示する --------------------------------\r
883 *\r
884 *       Parameter\r
885 *               なし\r
886 *\r
887 *       Return Value\r
888 *               なし\r
889 *----------------------------------------------------------------------------*/\r
890 \r
891 void DispTransferType(void)\r
892 {\r
893         switch(TmpTransMode)\r
894         {\r
895                 case TYPE_A :\r
896                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_TEXT, MAKELONG(TRUE, 0));\r
897                         break;\r
898 \r
899                 case TYPE_I :\r
900                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_BINARY, MAKELONG(TRUE, 0));\r
901                         break;\r
902 \r
903                 default :\r
904                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_AUTO, MAKELONG(TRUE, 0));\r
905                         break;\r
906         }\r
907         return;\r
908 }\r
909 \r
910 \r
911 /*----- 設定上の転送モードを返す ----------------------------------------------\r
912 *\r
913 *       Parameter\r
914 *               なし\r
915 *\r
916 *       Return Value\r
917 *               int 転送モード (TYPE_xx)\r
918 *----------------------------------------------------------------------------*/\r
919 \r
920 int AskTransferType(void)\r
921 {\r
922         return(TmpTransMode);\r
923 }\r
924 \r
925 \r
926 /*----- 実際の転送モードを返す ------------------------------------------------\r
927 *\r
928 *       Parameter\r
929 *               char Fname : ファイル名\r
930 *               int Type : 設定上の転送モード (TYPE_xx)\r
931 *\r
932 *       Return Value\r
933 *               int 転送モード (TYPE_xx)\r
934 *----------------------------------------------------------------------------*/\r
935 \r
936 int AskTransferTypeAssoc(char *Fname, int Type)\r
937 {\r
938         int Ret;\r
939         char *Pos;\r
940         char *Name;\r
941 \r
942         Ret = Type;\r
943         if(Ret == TYPE_X)\r
944         {\r
945                 Ret = TYPE_I;\r
946                 if(StrMultiLen(AsciiExt) > 0)\r
947                 {\r
948                         Name = GetFileName(Fname);\r
949                         Pos = AsciiExt;\r
950                         while(*Pos != NUL)\r
951                         {\r
952                                 if(CheckFname(Name, Pos) == FFFTP_SUCCESS)\r
953                                 {\r
954                                         Ret = TYPE_A;\r
955                                         break;\r
956                                 }\r
957                                 Pos += strlen(Pos) + 1;\r
958                         }\r
959                 }\r
960         }\r
961         return(Ret);\r
962 }\r
963 \r
964 \r
965 /*----- 転送モードを保存する --------------------------------------------------\r
966 *\r
967 *       Parameter\r
968 *               なし\r
969 *\r
970 *       Return Value\r
971 *               なし\r
972 *\r
973 *       Note\r
974 *               現在の転送モードがレジストリに保存される\r
975 *----------------------------------------------------------------------------*/\r
976 \r
977 void SaveTransferType(void)\r
978 {\r
979         TransMode = TmpTransMode;\r
980         return;\r
981 }\r
982 \r
983 \r
984 /*===================================================\r
985 *                       漢字モード\r
986 *===================================================*/\r
987 \r
988 /*----- ホストの漢字モードをセットする ----------------------------------------\r
989 *\r
990 *       Parameter\r
991 *               int Mode : 漢字モード (KANJI_xxxx)\r
992 *\r
993 *       Return Value\r
994 *               なし\r
995 *----------------------------------------------------------------------------*/\r
996 \r
997 void SetHostKanjiCodeImm(int Mode)\r
998 {\r
999         TmpHostKanjiCode = Mode;\r
1000         DispHostKanjiCode();\r
1001         HideHostKanjiButton();\r
1002         return;\r
1003 }\r
1004 \r
1005 \r
1006 /*----- メニューによりホストの漢字モードを設定する -----------------------------\r
1007 *\r
1008 *       Parameter\r
1009 *               int Type : 漢字モード (MENU_xxxx)\r
1010 *\r
1011 *       Return Value\r
1012 *               なし\r
1013 *----------------------------------------------------------------------------*/\r
1014 \r
1015 void SetHostKanjiCode(int Type)\r
1016 {\r
1017         switch(Type)\r
1018         {\r
1019                 // UTF-8対応\r
1020                 case MENU_KNJ_SJIS :\r
1021                         TmpHostKanjiCode = KANJI_SJIS;\r
1022                         break;\r
1023 \r
1024                 case MENU_KNJ_EUC :\r
1025                         TmpHostKanjiCode = KANJI_EUC;\r
1026                         break;\r
1027 \r
1028                 case MENU_KNJ_JIS :\r
1029                         TmpHostKanjiCode = KANJI_JIS;\r
1030                         break;\r
1031 \r
1032                 case MENU_KNJ_UTF8N :\r
1033                         TmpHostKanjiCode = KANJI_UTF8N;\r
1034                         break;\r
1035 \r
1036                 case MENU_KNJ_UTF8BOM :\r
1037                         TmpHostKanjiCode = KANJI_UTF8BOM;\r
1038                         break;\r
1039 \r
1040                 default :\r
1041                         TmpHostKanjiCode = KANJI_NOCNV;\r
1042                         break;\r
1043         }\r
1044         DispHostKanjiCode();\r
1045         HideHostKanjiButton();\r
1046         return;\r
1047 }\r
1048 \r
1049 \r
1050 /*----- ホストの漢字モードにしたがってボタンを表示する ------------------------\r
1051 *\r
1052 *       Parameter\r
1053 *               なし\r
1054 *\r
1055 *       Return Value\r
1056 *               なし\r
1057 *----------------------------------------------------------------------------*/\r
1058 \r
1059 void DispHostKanjiCode(void)\r
1060 {\r
1061         switch(TmpHostKanjiCode)\r
1062         {\r
1063                 // UTF-8対応\r
1064                 case KANJI_SJIS :\r
1065                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_KNJ_SJIS, MAKELONG(TRUE, 0));\r
1066                         break;\r
1067 \r
1068                 case KANJI_EUC :\r
1069                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_KNJ_EUC, MAKELONG(TRUE, 0));\r
1070                         break;\r
1071 \r
1072                 case KANJI_JIS :\r
1073                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_KNJ_JIS, MAKELONG(TRUE, 0));\r
1074                         break;\r
1075 \r
1076                 case KANJI_UTF8N :\r
1077                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_KNJ_UTF8N, MAKELONG(TRUE, 0));\r
1078                         break;\r
1079 \r
1080                 case KANJI_UTF8BOM :\r
1081                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_KNJ_UTF8BOM, MAKELONG(TRUE, 0));\r
1082                         break;\r
1083 \r
1084                 default :\r
1085                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_KNJ_NONE, MAKELONG(TRUE, 0));\r
1086                         break;\r
1087         }\r
1088         return;\r
1089 }\r
1090 \r
1091 \r
1092 /*----- ホストの漢字モードを返す ----------------------------------------------\r
1093 *\r
1094 *       Parameter\r
1095 *               なし\r
1096 *\r
1097 *       Return Value\r
1098 *               int 漢字モード (KANJI_xxxx)\r
1099 *----------------------------------------------------------------------------*/\r
1100 \r
1101 int AskHostKanjiCode(void)\r
1102 {\r
1103         return(TmpHostKanjiCode);\r
1104 }\r
1105 \r
1106 \r
1107 /*----- 漢字モードボタンのハイド処理を行う ------------------------------------\r
1108 *\r
1109 *       Parameter\r
1110 *               なし\r
1111 *\r
1112 *       Return Value\r
1113 *               なし\r
1114 *----------------------------------------------------------------------------*/\r
1115 \r
1116 void HideHostKanjiButton(void)\r
1117 {\r
1118         switch(TmpTransMode)\r
1119         {\r
1120                 // UTF-8対応\r
1121                 case TYPE_I : \r
1122                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_SJIS, MAKELONG(FALSE, 0));\r
1123                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_EUC, MAKELONG(FALSE, 0));\r
1124                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_JIS, MAKELONG(FALSE, 0));\r
1125                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_UTF8N, MAKELONG(FALSE, 0));\r
1126                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_UTF8BOM, MAKELONG(FALSE, 0));\r
1127                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_NONE, MAKELONG(FALSE, 0));\r
1128                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(FALSE, 0));\r
1129                         break;\r
1130 \r
1131                 default :\r
1132                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_SJIS, MAKELONG(TRUE, 0));\r
1133                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_EUC, MAKELONG(TRUE, 0));\r
1134                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_JIS, MAKELONG(TRUE, 0));\r
1135                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_UTF8N, MAKELONG(TRUE, 0));\r
1136                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_UTF8BOM, MAKELONG(TRUE, 0));\r
1137                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KNJ_NONE, MAKELONG(TRUE, 0));\r
1138 //                      if(TmpHostKanjiCode != KANJI_NOCNV)\r
1139 //                              SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(TRUE, 0));\r
1140 //                      else\r
1141 //                              SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(FALSE, 0));\r
1142 //                      break;\r
1143                         // 現在カナ変換はShift_JIS、JIS、EUC間でのみ機能する\r
1144                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(FALSE, 0));\r
1145                         switch(TmpHostKanjiCode)\r
1146                         {\r
1147                         case KANJI_SJIS:\r
1148                         case KANJI_JIS:\r
1149                         case KANJI_EUC:\r
1150                                 switch(TmpLocalKanjiCode)\r
1151                                 {\r
1152                                 case KANJI_SJIS:\r
1153                                 case KANJI_JIS:\r
1154                                 case KANJI_EUC:\r
1155                                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(TRUE, 0));\r
1156                                         break;\r
1157                                 }\r
1158                                 break;\r
1159                         }\r
1160         }\r
1161         return;\r
1162 }\r
1163 \r
1164 \r
1165 // ローカルの漢字コード\r
1166 // テキストモード転送時に使用\r
1167 // ホスト側が無変換の時はローカルも無変換\r
1168 \r
1169 void SetLocalKanjiCodeImm(int Mode)\r
1170 {\r
1171         TmpLocalKanjiCode = Mode;\r
1172         DispLocalKanjiCode();\r
1173         HideLocalKanjiButton();\r
1174         return;\r
1175 }\r
1176 \r
1177 void SetLocalKanjiCode(int Type)\r
1178 {\r
1179         switch(Type)\r
1180         {\r
1181                 // UTF-8対応\r
1182                 case MENU_L_KNJ_SJIS :\r
1183                         TmpLocalKanjiCode = KANJI_SJIS;\r
1184                         break;\r
1185 \r
1186                 case MENU_L_KNJ_EUC :\r
1187                         TmpLocalKanjiCode = KANJI_EUC;\r
1188                         break;\r
1189 \r
1190                 case MENU_L_KNJ_JIS :\r
1191                         TmpLocalKanjiCode = KANJI_JIS;\r
1192                         break;\r
1193 \r
1194                 case MENU_L_KNJ_UTF8N :\r
1195                         TmpLocalKanjiCode = KANJI_UTF8N;\r
1196                         break;\r
1197 \r
1198                 case MENU_L_KNJ_UTF8BOM :\r
1199                         TmpLocalKanjiCode = KANJI_UTF8BOM;\r
1200                         break;\r
1201         }\r
1202         DispLocalKanjiCode();\r
1203         HideLocalKanjiButton();\r
1204         return;\r
1205 }\r
1206 \r
1207 void DispLocalKanjiCode(void)\r
1208 {\r
1209         switch(TmpLocalKanjiCode)\r
1210         {\r
1211                 // UTF-8対応\r
1212                 case KANJI_SJIS :\r
1213                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_L_KNJ_SJIS, MAKELONG(TRUE, 0));\r
1214                         break;\r
1215 \r
1216                 case KANJI_EUC :\r
1217                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_L_KNJ_EUC, MAKELONG(TRUE, 0));\r
1218                         break;\r
1219 \r
1220                 case KANJI_JIS :\r
1221                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_L_KNJ_JIS, MAKELONG(TRUE, 0));\r
1222                         break;\r
1223 \r
1224                 case KANJI_UTF8N :\r
1225                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_L_KNJ_UTF8N, MAKELONG(TRUE, 0));\r
1226                         break;\r
1227 \r
1228                 case KANJI_UTF8BOM :\r
1229                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_L_KNJ_UTF8BOM, MAKELONG(TRUE, 0));\r
1230                         break;\r
1231         }\r
1232         return;\r
1233 }\r
1234 \r
1235 int AskLocalKanjiCode(void)\r
1236 {\r
1237         return(TmpLocalKanjiCode);\r
1238 }\r
1239 \r
1240 void HideLocalKanjiButton(void)\r
1241 {\r
1242         switch(TmpTransMode)\r
1243         {\r
1244                 // UTF-8対応\r
1245                 case TYPE_I : \r
1246                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_SJIS, MAKELONG(FALSE, 0));\r
1247                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_EUC, MAKELONG(FALSE, 0));\r
1248                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_JIS, MAKELONG(FALSE, 0));\r
1249                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_UTF8N, MAKELONG(FALSE, 0));\r
1250                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_UTF8BOM, MAKELONG(FALSE, 0));\r
1251                         break;\r
1252 \r
1253                 default :\r
1254                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_SJIS, MAKELONG(TRUE, 0));\r
1255                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_EUC, MAKELONG(TRUE, 0));\r
1256                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_JIS, MAKELONG(TRUE, 0));\r
1257                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_UTF8N, MAKELONG(TRUE, 0));\r
1258                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_L_KNJ_UTF8BOM, MAKELONG(TRUE, 0));\r
1259                         // 現在カナ変換はShift_JIS、JIS、EUC間でのみ機能する\r
1260                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(FALSE, 0));\r
1261                         switch(TmpHostKanjiCode)\r
1262                         {\r
1263                         case KANJI_SJIS:\r
1264                         case KANJI_JIS:\r
1265                         case KANJI_EUC:\r
1266                                 switch(TmpLocalKanjiCode)\r
1267                                 {\r
1268                                 case KANJI_SJIS:\r
1269                                 case KANJI_JIS:\r
1270                                 case KANJI_EUC:\r
1271                                         SendMessage(hWndTbarMain, TB_ENABLEBUTTON, MENU_KANACNV, MAKELONG(TRUE, 0));\r
1272                                         break;\r
1273                                 }\r
1274                                 break;\r
1275                         }\r
1276                         break;\r
1277         }\r
1278         return;\r
1279 }\r
1280 \r
1281 \r
1282 /*===================================================\r
1283 *                       半角変換モード\r
1284 *===================================================*/\r
1285 \r
1286 /*----- ホストの半角変換モードを設定する --------------------------------------\r
1287 *\r
1288 *       Parameter\r
1289 *               int Mode : 半角変換モード(YES/NO)\r
1290 *\r
1291 *       Return Value\r
1292 *               なし\r
1293 *----------------------------------------------------------------------------*/\r
1294 \r
1295 void SetHostKanaCnvImm(int Mode)\r
1296 {\r
1297         TmpHostKanaCnv = Mode;\r
1298         DispHostKanaCnv();\r
1299         return;\r
1300 }\r
1301 \r
1302 \r
1303 /*----- ホストの半角変換モードを反転する --------------------------------------\r
1304 *\r
1305 *       Parameter\r
1306 *               なし\r
1307 *\r
1308 *       Return Value\r
1309 *               なし\r
1310 *----------------------------------------------------------------------------*/\r
1311 \r
1312 void SetHostKanaCnv(void)\r
1313 {\r
1314         TmpHostKanaCnv ^= 1;\r
1315         DispHostKanaCnv();\r
1316         return;\r
1317 }\r
1318 \r
1319 \r
1320 /*----- ホストの半角変換モードにしたがってボタンを表示する --------------------\r
1321 *\r
1322 *       Parameter\r
1323 *               なし\r
1324 *\r
1325 *       Return Value\r
1326 *               なし\r
1327 *----------------------------------------------------------------------------*/\r
1328 \r
1329 void DispHostKanaCnv(void)\r
1330 {\r
1331         if(TmpHostKanaCnv != 0)\r
1332                 SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_KANACNV, MAKELONG(TRUE, 0));\r
1333         else\r
1334                 SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_KANACNV, MAKELONG(FALSE, 0));\r
1335         return;\r
1336 }\r
1337 \r
1338 \r
1339 /*----- ホストの半角変換モードを返す ------------------------------------------\r
1340 *\r
1341 *       Parameter\r
1342 *               なし\r
1343 *\r
1344 *       Return Value\r
1345 *               int 半角変換モード\r
1346 *----------------------------------------------------------------------------*/\r
1347 \r
1348 int AskHostKanaCnv(void)\r
1349 {\r
1350         return(TmpHostKanaCnv);\r
1351 }\r
1352 \r
1353 \r
1354 /*===================================================\r
1355 *                       ソート方法\r
1356 *===================================================*/\r
1357 \r
1358 /*----- ソート方法をセットする ------------------------------------------------\r
1359 *\r
1360 *       Parameter\r
1361 *               int LFsort : ローカル側のファイルのソート方法 (SORT_xxx)\r
1362 *               int LDsort : ローカル側のディレクトリのソート方法 (SORT_xxx)\r
1363 *               int RFsort : ホスト側のファイルのソート方法 (SORT_xxx)\r
1364 *               int RDsort : ホスト側のディレクトリのソート方法 (SORT_xxx)\r
1365 *\r
1366 *       Return Value\r
1367 *               なし\r
1368 *----------------------------------------------------------------------------*/\r
1369 \r
1370 void SetSortTypeImm(int LFsort, int LDsort, int RFsort, int RDsort)\r
1371 {\r
1372         TmpLocalFileSort = LFsort;\r
1373         TmpLocalDirSort = LDsort;\r
1374         TmpRemoteFileSort = RFsort;\r
1375         TmpRemoteDirSort = RDsort;\r
1376         return;\r
1377 }\r
1378 \r
1379 \r
1380 /*----- リストビューのタブクリックによるソート方法のセット --------------------\r
1381 *\r
1382 *       Parameter\r
1383 *               int Win : ウインドウ番号\r
1384 *               int Tab : カラム番号\r
1385 *\r
1386 *       Return Value\r
1387 *               int ソート方法 (SORT_xxx)\r
1388 *----------------------------------------------------------------------------*/\r
1389 \r
1390 void SetSortTypeByColumn(int Win, int Tab)\r
1391 {\r
1392         if(Win == WIN_LOCAL)\r
1393         {\r
1394                 if((TmpLocalFileSort & SORT_MASK_ORD) == Tab)\r
1395                         TmpLocalFileSort ^= SORT_GET_ORD;\r
1396                 else\r
1397                         TmpLocalFileSort = Tab;\r
1398 \r
1399                 if((Tab == SORT_NAME) || (Tab == SORT_DATE))\r
1400                         TmpLocalDirSort = TmpLocalFileSort;\r
1401                 else\r
1402                         TmpLocalDirSort = SORT_NAME;\r
1403         }\r
1404         else\r
1405         {\r
1406                 if(Tab != 4)\r
1407                 {\r
1408                         if((TmpRemoteFileSort & SORT_MASK_ORD) == Tab)\r
1409                                 TmpRemoteFileSort ^= SORT_GET_ORD;\r
1410                         else\r
1411                                 TmpRemoteFileSort = Tab;\r
1412 \r
1413                         if((Tab == SORT_NAME) || (Tab == SORT_DATE))\r
1414                                 TmpRemoteDirSort = TmpRemoteFileSort;\r
1415                         else\r
1416                                 TmpRemoteDirSort = SORT_NAME;\r
1417                 }\r
1418         }\r
1419         return;\r
1420 }\r
1421 \r
1422 \r
1423 /*----- ソート方法を返す ------------------------------------------------------\r
1424 *\r
1425 *       Parameter\r
1426 *               int Name : どの部分か (ITEM_xxx)\r
1427 *\r
1428 *       Return Value\r
1429 *               int ソート方法 (SORT_xxx)\r
1430 *----------------------------------------------------------------------------*/\r
1431 \r
1432 int AskSortType(int Name)\r
1433 {\r
1434         int Ret;\r
1435 \r
1436         switch(Name)\r
1437         {\r
1438                 case ITEM_LFILE :\r
1439                         Ret = TmpLocalFileSort;\r
1440                         break;\r
1441 \r
1442                 case ITEM_LDIR :\r
1443                         Ret = TmpLocalDirSort;\r
1444                         break;\r
1445 \r
1446                 case ITEM_RFILE :\r
1447                         Ret = TmpRemoteFileSort;\r
1448                         break;\r
1449 \r
1450                 case ITEM_RDIR :\r
1451                         Ret = TmpRemoteDirSort;\r
1452                         break;\r
1453         }\r
1454         return(Ret);\r
1455 }\r
1456 \r
1457 \r
1458 /*----- ホストごとにソートを保存するかどうかをセットする-----------------------\r
1459 *\r
1460 *       Parameter\r
1461 *               int Sw : スイッチ (YES/NO)\r
1462 *\r
1463 *       Return Value\r
1464 *               なし\r
1465 *----------------------------------------------------------------------------*/\r
1466 \r
1467 void SetSaveSortToHost(int Sw)\r
1468 {\r
1469         SortSave = Sw;\r
1470         return;\r
1471 }\r
1472 \r
1473 \r
1474 /*----- ホストごとにソートを保存するかどうかを返す ----------------------------\r
1475 *\r
1476 *       Parameter\r
1477 *               なし\r
1478 *\r
1479 *       Return Value\r
1480 *               int スイッチ (YES/NO)\r
1481 *----------------------------------------------------------------------------*/\r
1482 \r
1483 int AskSaveSortToHost(void)\r
1484 {\r
1485         return(SortSave);\r
1486 }\r
1487 \r
1488 \r
1489 \r
1490 /*===================================================\r
1491 *                       リストモード\r
1492 *===================================================*/\r
1493 \r
1494 /*----- リストモードにしたがってボタンを表示する ------------------------------\r
1495 *\r
1496 *       Parameter\r
1497 *               なし\r
1498 *\r
1499 *       Return Value\r
1500 *               なし\r
1501 *----------------------------------------------------------------------------*/\r
1502 \r
1503 void DispListType(void)\r
1504 {\r
1505         HWND hWndMain;\r
1506 \r
1507         hWndMain = GetMainHwnd();\r
1508         switch(ListType)\r
1509         {\r
1510                 case LVS_LIST :\r
1511                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_LIST, MAKELONG(TRUE, 0));\r
1512                         CheckMenuItem(GetMenu(hWndMain), MENU_LIST, MF_CHECKED);\r
1513                         CheckMenuItem(GetMenu(hWndMain), MENU_REPORT, MF_UNCHECKED);\r
1514                         break;\r
1515 \r
1516                 default :\r
1517                         SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_REPORT, MAKELONG(TRUE, 0));\r
1518                         CheckMenuItem(GetMenu(hWndMain), MENU_REPORT, MF_CHECKED);\r
1519                         CheckMenuItem(GetMenu(hWndMain), MENU_LIST, MF_UNCHECKED);\r
1520                         break;\r
1521         }\r
1522         return;\r
1523 }\r
1524 \r
1525 \r
1526 /*===================================================\r
1527 *                       フォルダ同時移動モード\r
1528 *===================================================*/\r
1529 \r
1530 /*----- 転送モードを設定する --------------------------------------------------\r
1531 *\r
1532 *       Parameter\r
1533 *               int Mode : 転送モード (TYPE_xx)\r
1534 *\r
1535 *       Return Value\r
1536 *               なし\r
1537 *----------------------------------------------------------------------------*/\r
1538 \r
1539 void SetSyncMoveMode(int Mode)\r
1540 {\r
1541         SyncMove = Mode;\r
1542         DispSyncMoveMode();\r
1543         return;\r
1544 }\r
1545 \r
1546 \r
1547 /*----- フォルダ同時移動モードを切り替える ------------------------------------\r
1548 *\r
1549 *       Parameter\r
1550 *               なし\r
1551 *\r
1552 *       Return Value\r
1553 *               なし\r
1554 *----------------------------------------------------------------------------*/\r
1555 \r
1556 void ToggleSyncMoveMode(void)\r
1557 {\r
1558         SyncMove ^= 1;\r
1559         DispSyncMoveMode();\r
1560         return;\r
1561 }\r
1562 \r
1563 \r
1564 /*----- フォルダ同時移動を行うかどうかをによってメニュー/ボタンを表示 --------\r
1565 *\r
1566 *       Parameter\r
1567 *               なし\r
1568 *\r
1569 *       Return Value\r
1570 *               なし\r
1571 *----------------------------------------------------------------------------*/\r
1572 \r
1573 void DispSyncMoveMode(void)\r
1574 {\r
1575         if(SyncMove != 0)\r
1576         {\r
1577                 SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_SYNC, MAKELONG(TRUE, 0));\r
1578                 CheckMenuItem(GetMenu(GetMainHwnd()), MENU_SYNC, MF_CHECKED);\r
1579         }\r
1580         else\r
1581         {\r
1582                 SendMessage(hWndTbarMain, TB_CHECKBUTTON, MENU_SYNC, MAKELONG(FALSE, 0));\r
1583                 CheckMenuItem(GetMenu(GetMainHwnd()), MENU_SYNC, MF_UNCHECKED);\r
1584         }\r
1585         return;\r
1586 }\r
1587 \r
1588 \r
1589 /*----- フォルダ同時移動モードを返す ------------------------------------------\r
1590 *\r
1591 *       Parameter\r
1592 *               なし\r
1593 *\r
1594 *       Return Value\r
1595 *               int 半角変換モード\r
1596 *----------------------------------------------------------------------------*/\r
1597 \r
1598 int AskSyncMoveMode(void)\r
1599 {\r
1600         return(SyncMove);\r
1601 }\r
1602 \r
1603 \r
1604 /*===================================================\r
1605 *                       ディレクトリヒストリ\r
1606 *===================================================*/\r
1607 \r
1608 /*----- ホスト側のヒストリ一覧ウインドウに登録 --------------------------------\r
1609 *\r
1610 *       Parameter\r
1611 *               char *Path : パス\r
1612 *\r
1613 *       Return Value\r
1614 *               なし\r
1615 *----------------------------------------------------------------------------*/\r
1616 \r
1617 void SetRemoteDirHist(char *Path)\r
1618 {\r
1619         int i;\r
1620 \r
1621         if((i = SendMessage(hWndDirRemote, CB_FINDSTRINGEXACT, 0, (LPARAM)Path)) != CB_ERR)\r
1622                 SendMessage(hWndDirRemote, CB_DELETESTRING, i, 0);\r
1623 \r
1624         SendMessage(hWndDirRemote, CB_ADDSTRING, 0, (LPARAM)Path);\r
1625         i = SendMessage(hWndDirRemote, CB_GETCOUNT, 0, 0);\r
1626         SendMessage(hWndDirRemote, CB_SETCURSEL, i-1, 0);\r
1627 \r
1628         strcpy(RemoteCurDir, Path);\r
1629         return;\r
1630 }\r
1631 \r
1632 \r
1633 /*----- ローカル側のヒストリ一覧ウインドウに登録 -------------------------------\r
1634 *\r
1635 *       Parameter\r
1636 *               char *Path : パス\r
1637 *\r
1638 *       Return Value\r
1639 *               なし\r
1640 *----------------------------------------------------------------------------*/\r
1641 \r
1642 void SetLocalDirHist(char *Path)\r
1643 {\r
1644         int i;\r
1645 \r
1646         if((i = SendMessage(hWndDirLocal, CB_FINDSTRINGEXACT, 0, (LPARAM)Path)) == CB_ERR)\r
1647                 SendMessage(hWndDirLocal, CB_ADDSTRING, 0, (LPARAM)Path);\r
1648         i = SendMessage(hWndDirLocal, CB_FINDSTRINGEXACT, 0, (LPARAM)Path);\r
1649         SendMessage(hWndDirLocal, CB_SETCURSEL, i, 0);\r
1650 \r
1651         strcpy(LocalCurDir, Path);\r
1652         return;\r
1653 }\r
1654 \r
1655 \r
1656 /*----- ローカルのカレントディレクトリを返す ----------------------------------\r
1657 *\r
1658 *       Parameter\r
1659 *               char *Buf : カレントディレクトリ名を返すバッファ\r
1660 *               int Max : バッファのサイズ\r
1661 *\r
1662 *       Return Value\r
1663 *               なし\r
1664 *----------------------------------------------------------------------------*/\r
1665 \r
1666 void AskLocalCurDir(char *Buf, int Max)\r
1667 {\r
1668         memset(Buf, 0, Max);\r
1669         strncpy(Buf, LocalCurDir, Max-1);\r
1670         return;\r
1671 }\r
1672 \r
1673 \r
1674 /*----- ホストのカレントディレクトリを返す ------------------------------------\r
1675 *\r
1676 *       Parameter\r
1677 *               char *Buf : カレントディレクトリ名を返すバッファ\r
1678 *               int Max : バッファのサイズ\r
1679 *\r
1680 *       Return Value\r
1681 *               なし\r
1682 *----------------------------------------------------------------------------*/\r
1683 \r
1684 void AskRemoteCurDir(char *Buf, int Max)\r
1685 {\r
1686         memset(Buf, 0, Max);\r
1687         strncpy(Buf, RemoteCurDir, Max-1);\r
1688         return;\r
1689 }\r
1690 \r
1691 \r
1692 /*----- カレントディレクトリを設定する ----------------------------------------\r
1693 *\r
1694 *       Parameter\r
1695 *               なし\r
1696 *\r
1697 *       Return Value\r
1698 *               なし\r
1699 *----------------------------------------------------------------------------*/\r
1700 \r
1701 void SetCurrentDirAsDirHist(void)\r
1702 {\r
1703         SetCurrentDirectory(LocalCurDir);\r
1704         return;\r
1705 }\r
1706 \r
1707 \r
1708 /*===================================================\r
1709 *                       メニュー\r
1710 *===================================================*/\r
1711 \r
1712 /*----- ドットファイルを表示するかどうかをメニューに表示する ------------------\r
1713 *\r
1714 *       Parameter\r
1715 *               なし\r
1716 *\r
1717 *       Return Value\r
1718 *               なし\r
1719 *----------------------------------------------------------------------------*/\r
1720 \r
1721 void DispDotFileMode(void)\r
1722 {\r
1723         CheckMenuItem(GetMenu(GetMainHwnd()), MENU_DOTFILE, MF_UNCHECKED);\r
1724         if(DotFile == YES)\r
1725                 CheckMenuItem(GetMenu(GetMainHwnd()), MENU_DOTFILE, MF_CHECKED);\r
1726         return;\r
1727 }\r
1728 \r
1729 \r
1730 /*----- ローカル側の右ボタンメニューを表示 ------------------------------------------------\r
1731 *\r
1732 *       Parameter\r
1733 *               int Pos : メニューの位置\r
1734 *                                       0=マウスカーソルの位置\r
1735 *                                       1=ウインドウの左上\r
1736 *\r
1737 *       Return Value\r
1738 *               なし\r
1739 *----------------------------------------------------------------------------*/\r
1740 \r
1741 void LocalRbuttonMenu(int Pos)\r
1742 {\r
1743         HMENU hMenu;\r
1744         POINT point;\r
1745         RECT Rect;\r
1746         UINT Flg1;\r
1747         UINT Flg2;\r
1748         UINT Flg3;\r
1749         int Count;\r
1750 \r
1751         if(HideUI == NO)\r
1752         {\r
1753                 Flg1 = 0;\r
1754                 if(AskConnecting() == NO)\r
1755                         Flg1 = MF_GRAYED;\r
1756 \r
1757                 Count = GetSelectedCount(WIN_LOCAL);\r
1758                 Flg2 = 0;\r
1759                 if(Count == 0)\r
1760                         Flg2 = MF_GRAYED;\r
1761 \r
1762                 Flg3 = 0;\r
1763                 if(Count != 1)\r
1764                         Flg3 = MF_GRAYED;\r
1765 \r
1766                 hMenu = CreatePopupMenu();\r
1767                 AddOpenMenu(hMenu, Flg3);\r
1768                 AppendMenu(hMenu, MF_STRING | Flg1 | Flg2, MENU_UPLOAD, MSGJPN255);\r
1769                 AppendMenu(hMenu, MF_STRING | Flg1 | Flg2, MENU_UPLOAD_AS, MSGJPN256);\r
1770                 AppendMenu(hMenu, MF_STRING | Flg1, MENU_UPLOAD_ALL, MSGJPN257);\r
1771                 AppendMenu(hMenu, MF_STRING | Flg2, MENU_DELETE, MSGJPN258);\r
1772                 AppendMenu(hMenu, MF_STRING | Flg2, MENU_RENAME, MSGJPN259);\r
1773                 AppendMenu(hMenu, MF_STRING , MENU_MKDIR, MSGJPN260);\r
1774                 AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);\r
1775                 AppendMenu(hMenu, MF_STRING , MENU_FILESIZE, MSGJPN261);\r
1776                 AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);\r
1777                 AppendMenu(hMenu, MF_STRING, REFRESH_LOCAL, MSGJPN262);\r
1778 \r
1779                 if(Pos == 0)\r
1780                         GetCursorPos(&point);\r
1781                 else\r
1782                 {\r
1783                         GetWindowRect(GetLocalHwnd(), &Rect);\r
1784                         point.x = Rect.left + 20;\r
1785                         point.y = Rect.top + 20;\r
1786                 }\r
1787                 TrackPopupMenu(hMenu, TPM_LEFTBUTTON | TPM_RIGHTBUTTON, point.x, point.y, 0, GetMainHwnd(), NULL);\r
1788 \r
1789                 DestroyMenu(hMenu);\r
1790         }\r
1791         return;\r
1792 }\r
1793 \r
1794 \r
1795 /*----- ホスト側の右ボタンメニューを表示 --------------------------------------\r
1796 *\r
1797 *       Parameter\r
1798 *               int Pos : メニューの位置\r
1799 *                                       0=マウスカーソルの位置\r
1800 *                                       1=ウインドウの左上\r
1801 *\r
1802 *       Return Value\r
1803 *               なし\r
1804 *----------------------------------------------------------------------------*/\r
1805 \r
1806 void RemoteRbuttonMenu(int Pos)\r
1807 {\r
1808         HMENU hMenu;\r
1809         POINT point;\r
1810         RECT Rect;\r
1811         UINT Flg1;\r
1812         UINT Flg2;\r
1813         UINT Flg3;\r
1814         int Count;\r
1815 \r
1816         if(HideUI == NO)\r
1817         {\r
1818                 Flg1 = 0;\r
1819                 if(AskConnecting() == NO)\r
1820                         Flg1 = MF_GRAYED;\r
1821 \r
1822                 Count = GetSelectedCount(WIN_REMOTE);\r
1823                 Flg2 = 0;\r
1824                 if(Count == 0)\r
1825                         Flg2 = MF_GRAYED;\r
1826 \r
1827                 Flg3 = 0;\r
1828                 if(Count != 1)\r
1829                         Flg3 = MF_GRAYED;\r
1830 \r
1831                 hMenu = CreatePopupMenu();\r
1832                 AddOpenMenu(hMenu, Flg1 | Flg3);\r
1833                 AppendMenu(hMenu, MF_STRING | Flg1 | Flg2, MENU_DOWNLOAD, MSGJPN263);\r
1834                 AppendMenu(hMenu, MF_STRING | Flg1 | Flg2, MENU_DOWNLOAD_AS, MSGJPN264);\r
1835                 AppendMenu(hMenu, MF_STRING | Flg1 | Flg2, MENU_DOWNLOAD_AS_FILE, MSGJPN265);\r
1836                 AppendMenu(hMenu, MF_STRING | Flg1, MENU_DOWNLOAD_ALL, MSGJPN266);\r
1837                 AppendMenu(hMenu, MF_STRING | Flg1 | Flg2, MENU_DELETE, MSGJPN267);\r
1838                 AppendMenu(hMenu, MF_STRING | Flg1 | Flg2, MENU_RENAME, MSGJPN268);\r
1839                 AppendMenu(hMenu, MF_STRING | Flg1 | Flg2, MENU_CHMOD, MSGJPN269);\r
1840                 AppendMenu(hMenu, MF_STRING | Flg1, MENU_MKDIR, MSGJPN270);\r
1841                 AppendMenu(hMenu, MF_STRING | Flg1 | Flg2, MENU_URL_COPY, MSGJPN271);\r
1842                 AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);\r
1843                 AppendMenu(hMenu, MF_STRING | Flg1, MENU_FILESIZE, MSGJPN272);\r
1844                 AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);\r
1845                 AppendMenu(hMenu, MF_STRING | Flg1, REFRESH_REMOTE, MSGJPN273);\r
1846 \r
1847                 if(Pos == 0)\r
1848                         GetCursorPos(&point);\r
1849                 else\r
1850                 {\r
1851                         GetWindowRect(GetRemoteHwnd(), &Rect);\r
1852                         point.x = Rect.left + 20;\r
1853                         point.y = Rect.top + 20;\r
1854                 }\r
1855                 if(TrackPopupMenu(hMenu, TPM_LEFTBUTTON | TPM_RIGHTBUTTON, point.x, point.y, 0, GetMainHwnd(), NULL) == 0)\r
1856                         Count = GetLastError();\r
1857 \r
1858                 DestroyMenu(hMenu);\r
1859         }\r
1860         return;\r
1861 }\r
1862 \r
1863 \r
1864 /*----- 右ボタンメニューに「開く」を追加  -------------------------------------\r
1865 *\r
1866 *       Parameter\r
1867 *               HMENU hMenu : メニューハンドル\r
1868 *               UINT Flg : フラグ\r
1869 *\r
1870 *       Return Value\r
1871 *               なし\r
1872 *----------------------------------------------------------------------------*/\r
1873 \r
1874 static void AddOpenMenu(HMENU hMenu, UINT Flg)\r
1875 {\r
1876         static const UINT MenuID[VIEWERS] = { MENU_OPEN1, MENU_OPEN2, MENU_OPEN3 };\r
1877         char Tmp[FMAX_PATH+1];\r
1878         int i;\r
1879 \r
1880         AppendMenu(hMenu, MF_STRING | Flg, MENU_DCLICK, MSGJPN274);\r
1881         for(i = 0; i < VIEWERS; i++)\r
1882         {\r
1883                 if(strlen(ViewerName[i]) != 0)\r
1884                 {\r
1885                         sprintf(Tmp, MSGJPN275, GetToolName(ViewerName[i]), i+1);\r
1886                         AppendMenu(hMenu, MF_STRING | Flg, MenuID[i], Tmp);\r
1887                 }\r
1888         }\r
1889         AppendMenu(hMenu, MF_SEPARATOR, 0, NULL);\r
1890         return;\r
1891 }\r
1892 \r
1893 /* 2007/09/21 sunasunamix  ここから *********************/\r
1894 \r
1895 /*----- CreateToolbarEx のマウスクリック関連を無視する(TbarMain用) -----------\r
1896 *       (サブクラス化を行うためのウインドウプロシージャ)\r
1897 *----------------------------------------------------------------------------*/\r
1898 static LRESULT CALLBACK CountermeasureTbarMainProc(HWND hWnd,UINT uMessage,WPARAM wParam,LPARAM lParam)\r
1899 {\r
1900         switch (uMessage) {\r
1901         case WM_DESTROY :\r
1902                 SetWindowLong(hWnd,GWL_WNDPROC,(DWORD)pOldTbarMainProc);\r
1903                 break;\r
1904         case WM_RBUTTONDBLCLK :\r
1905         case WM_RBUTTONDOWN :\r
1906         case WM_RBUTTONUP :\r
1907                 return TRUE;\r
1908         }\r
1909         return CallWindowProc(pOldTbarMainProc, hWnd, uMessage, wParam, lParam);\r
1910 }\r
1911 \r
1912 /*----- CreateToolbarEx のマウスクリック関連を無視する(TbarLocal用) ----------\r
1913 *       (サブクラス化を行うためのウインドウプロシージャ)\r
1914 *----------------------------------------------------------------------------*/\r
1915 static LRESULT CALLBACK CountermeasureTbarLocalProc(HWND hWnd,UINT uMessage,WPARAM wParam,LPARAM lParam)\r
1916 {\r
1917         switch (uMessage) {\r
1918         case WM_DESTROY :\r
1919                 SetWindowLong(hWnd,GWL_WNDPROC,(DWORD)pOldTbarLocalProc);\r
1920                 break;\r
1921         case WM_RBUTTONDBLCLK :\r
1922         case WM_RBUTTONDOWN :\r
1923         case WM_RBUTTONUP :\r
1924                 return TRUE;\r
1925         }\r
1926         return CallWindowProc(pOldTbarLocalProc, hWnd, uMessage, wParam, lParam);\r
1927 }\r
1928 \r
1929 /*----- CreateToolbarEx のマウスクリック関連を無視する(TbarRemote用) ---------\r
1930 *       (サブクラス化を行うためのウインドウプロシージャ)\r
1931 *----------------------------------------------------------------------------*/\r
1932 static LRESULT CALLBACK CountermeasureTbarRemoteProc(HWND hWnd,UINT uMessage,WPARAM wParam,LPARAM lParam)\r
1933 {\r
1934         switch (uMessage) {\r
1935         case WM_DESTROY :\r
1936                 SetWindowLong(hWnd,GWL_WNDPROC,(DWORD)pOldTbarRemoteProc);\r
1937                 break;\r
1938         case WM_RBUTTONDBLCLK :\r
1939         case WM_RBUTTONDOWN :\r
1940         case WM_RBUTTONUP :\r
1941                 return TRUE;\r
1942         }\r
1943         return CallWindowProc(pOldTbarRemoteProc, hWnd, uMessage, wParam, lParam);\r
1944 }\r
1945 /********************************************* ここまで */\r