1 /*=============================================================================
\r
5 ===============================================================================
\r
6 / Copyright (C) 1997-2007 Sota. All rights reserved.
\r
8 / Redistribution and use in source and binary forms, with or without
\r
9 / modification, are permitted provided that the following conditions
\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
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
31 #include <windows.h>
\r
35 #include <mbstring.h>
\r
37 #include <windowsx.h>
\r
38 #include <commctrl.h>
\r
40 #include <winsock.h>
\r
43 #include "resource.h"
\r
46 /*===== ローカルなワーク =====*/
\r
48 static HWND hWndSbar = NULL;
\r
49 static int SbarColWidth[5] = { 70, 230, 410, 570, -1 };
\r
53 /*----- ステータスウインドウを作成する ----------------------------------------
\r
56 * HWND hWnd : 親ウインドウのウインドウハンドル
\r
57 * HINSTANCE hInst : インスタンスハンドル
\r
61 * FFFTP_SUCCESS/FFFTP_FAIL
\r
62 *----------------------------------------------------------------------------*/
\r
64 int MakeStatusBarWindow(HWND hWnd, HINSTANCE hInst)
\r
69 hWndSbar = CreateWindowEx(0,
\r
70 STATUSCLASSNAME, NULL,
\r
71 WS_CHILD | SBS_SIZEGRIP | WS_CLIPSIBLINGS | SBT_NOBORDERS,
\r
73 hWnd, (HMENU)1500, hInst, NULL);
\r
75 if(hWndSbar != NULL)
\r
77 SendMessage(hWndSbar, SB_SETPARTS, sizeof(SbarColWidth)/sizeof(int), (LPARAM)SbarColWidth);
\r
78 ShowWindow(hWndSbar, SW_SHOW);
\r
79 Sts = FFFTP_SUCCESS;
\r
85 /*----- ステータスウインドウを削除 --------------------------------------------
\r
92 *----------------------------------------------------------------------------*/
\r
94 void DeleteStatusBarWindow(void)
\r
96 if(hWndSbar != NULL)
\r
97 DestroyWindow(hWndSbar);
\r
102 /*----- ステータスウインドウのウインドウハンドルを返す ------------------------
\r
109 *----------------------------------------------------------------------------*/
\r
111 HWND GetSbarWnd(void)
\r
117 /*----- カレントウインドウを表示 ----------------------------------------------
\r
120 * int Win : ウインドウ番号 (WIN_xxx : -1=なし)
\r
124 *----------------------------------------------------------------------------*/
\r
126 void DispCurrentWindow(int Win)
\r
128 if(Win == WIN_LOCAL)
\r
129 SendMessage(GetSbarWnd(), SB_SETTEXT, 0 | 0, (LPARAM)MSGJPN245);
\r
130 else if(Win == WIN_REMOTE)
\r
131 SendMessage(GetSbarWnd(), SB_SETTEXT, 0 | 0, (LPARAM)MSGJPN246);
\r
133 SendMessage(GetSbarWnd(), SB_SETTEXT, 0 | 0, (LPARAM)"");
\r
138 /*----- 選択されているファイル数とサイズを表示 --------------------------------
\r
145 *----------------------------------------------------------------------------*/
\r
147 void DispSelectedSpace(void)
\r
154 if(GetFocus() == GetRemoteHwnd())
\r
157 MakeSizeString(GetSelectedTotalSize(Win), Buf1);
\r
158 sprintf(Buf2, MSGJPN247, GetSelectedCount(Win), Buf1);
\r
159 SendMessage(GetSbarWnd(), SB_SETTEXT, 1 | 0, (LPARAM)Buf2);
\r
164 /*----- ローカル側の空き容量を表示 --------------------------------------------
\r
171 *----------------------------------------------------------------------------*/
\r
173 void DispLocalFreeSpace(char *Path)
\r
177 sprintf(Buf, MSGJPN248, AskLocalFreeSpace(Path));
\r
178 SendMessage(GetSbarWnd(), SB_SETTEXT, 2 | 0, (LPARAM)Buf);
\r
183 /*----- 転送するファイルの数を表示 --------------------------------------------
\r
190 *----------------------------------------------------------------------------*/
\r
192 void DispTransferFiles(void)
\r
196 sprintf(Buf, MSGJPN249, AskTransferFileNum());
\r
197 SendMessage(GetSbarWnd(), SB_SETTEXT, 3 | 0, (LPARAM)Buf);
\r
202 /*----- 受信中のバイト数を表示 ------------------------------------------------
\r
205 * LONGLONG Size : バイト数 (-1=表示を消す)
\r
209 *----------------------------------------------------------------------------*/
\r
211 void DispDownloadSize(LONGLONG Size)
\r
219 MakeSizeString((double)Size, Tmp);
\r
220 sprintf(Buf, MSGJPN250, Tmp);
\r
222 SendMessage(GetSbarWnd(), SB_SETTEXT, 4 | 0, (LPARAM)Buf);
\r