OSDN Git Service

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