FFFTPのソースコードです。
Revisión | f7f66a0e6272bd7b89ffa24a02045b76b604f0a0 (tree) |
---|---|
Tiempo | 2012-09-06 15:50:31 |
Autor | s_kawamoto <s_kawamoto@user...> |
Commiter | s_kawamoto |
Change the behavior of automatic update of the local view.
@@ -1366,6 +1366,9 @@ int GetItemCount(int Win); | ||
1366 | 1366 | int GetSelectedCount(int Win); |
1367 | 1367 | int GetFirstSelected(int Win, int All); |
1368 | 1368 | int GetNextSelected(int Win, int Pos, int All); |
1369 | +// ローカル側自動更新 | |
1370 | +int GetHotSelected(int Win, char *Fname); | |
1371 | +int SetHotSelected(int Win, char *Fname); | |
1369 | 1372 | int FindNameNode(int Win, char *Name); |
1370 | 1373 | void GetNodeName(int Win, int Pos, char *Buf, int Max); |
1371 | 1374 | int GetNodeTime(int Win, int Pos, FILETIME *Buf); |
@@ -2337,6 +2337,58 @@ int GetNextSelected(int Win, int Pos, int All) | ||
2337 | 2337 | } |
2338 | 2338 | |
2339 | 2339 | |
2340 | +// ローカル側自動更新 | |
2341 | +int GetHotSelected(int Win, char *Fname) | |
2342 | +{ | |
2343 | + HWND hWnd; | |
2344 | + int Pos; | |
2345 | + | |
2346 | + hWnd = GetLocalHwnd(); | |
2347 | + if(Win == WIN_REMOTE) | |
2348 | + hWnd = GetRemoteHwnd(); | |
2349 | + | |
2350 | + Pos = SendMessage(hWnd, LVM_GETNEXTITEM, (WPARAM)-1, (LPARAM)MAKELPARAM(LVNI_FOCUSED, 0)); | |
2351 | + if(Pos != -1) | |
2352 | + GetNodeName(Win, Pos, Fname, FMAX_PATH); | |
2353 | + | |
2354 | + return Pos; | |
2355 | +} | |
2356 | + | |
2357 | +int SetHotSelected(int Win, char *Fname) | |
2358 | +{ | |
2359 | + HWND hWnd; | |
2360 | + int i; | |
2361 | + int Num; | |
2362 | + char Name[FMAX_PATH+1]; | |
2363 | + LV_ITEM LvItem; | |
2364 | + int Pos; | |
2365 | + | |
2366 | + hWnd = GetLocalHwnd(); | |
2367 | + if(Win == WIN_REMOTE) | |
2368 | + hWnd = GetRemoteHwnd(); | |
2369 | + | |
2370 | + Num = GetItemCount(Win); | |
2371 | + memset(&LvItem, 0, sizeof(LV_ITEM)); | |
2372 | + Pos = -1; | |
2373 | + for(i = 0; i < Num; i++) | |
2374 | + { | |
2375 | + LvItem.state = 0; | |
2376 | + GetNodeName(Win, i, Name, FMAX_PATH); | |
2377 | + if(_mbscmp(Fname, Name) == 0) | |
2378 | + { | |
2379 | + Pos = i; | |
2380 | + LvItem.state = LVIS_FOCUSED; | |
2381 | + } | |
2382 | + LvItem.mask = LVIF_STATE; | |
2383 | + LvItem.iItem = i; | |
2384 | + LvItem.stateMask = LVIS_FOCUSED; | |
2385 | + LvItem.iSubItem = 0; | |
2386 | + SendMessage(hWnd, LVM_SETITEMSTATE, i, (LPARAM)&LvItem); | |
2387 | + } | |
2388 | + | |
2389 | + return Pos; | |
2390 | +} | |
2391 | + | |
2340 | 2392 | /*----- 指定された名前のアイテムを探す ---------------------------------------- |
2341 | 2393 | * |
2342 | 2394 | * Parameter |
@@ -925,11 +925,18 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA | ||
925 | 925 | if(AskUserOpeDisabled() == NO) |
926 | 926 | { |
927 | 927 | FILELIST* Base; |
928 | + char Name[FMAX_PATH+1]; | |
929 | + int Pos; | |
928 | 930 | FindNextChangeNotification(ChangeNotification); |
929 | 931 | Base = NULL; |
930 | 932 | MakeSelectedFileList(WIN_LOCAL, NO, NO, &Base, &CancelFlg); |
933 | + GetHotSelected(WIN_LOCAL, Name); | |
934 | + Pos = SendMessage(GetLocalHwnd(), LVM_GETTOPINDEX, 0, 0); | |
931 | 935 | GetLocalDirForWnd(); |
932 | 936 | SelectFileInList(GetLocalHwnd(), SELECT_LIST, Base); |
937 | + SetHotSelected(WIN_LOCAL, Name); | |
938 | + SendMessage(GetLocalHwnd(), LVM_ENSUREVISIBLE, (WPARAM)(SendMessage(GetLocalHwnd(), LVM_GETITEMCOUNT, 0, 0) - 1), (LPARAM)TRUE); | |
939 | + SendMessage(GetLocalHwnd(), LVM_ENSUREVISIBLE, (WPARAM)Pos, (LPARAM)TRUE); | |
933 | 940 | } |
934 | 941 | } |
935 | 942 | break; |
@@ -1333,6 +1333,8 @@ int SelectFile(HWND hWnd, char *Fname, char *Title, char *Filters, char *Ext, in | ||
1333 | 1333 | GetCurrentDirectory(FMAX_PATH, Cur); |
1334 | 1334 | |
1335 | 1335 | strcpy(Tmp, Fname); |
1336 | + // 変数が未初期化のバグ修正 | |
1337 | + memset(&OpenFile, 0, sizeof(OPENFILENAME)); | |
1336 | 1338 | OpenFile.lStructSize = sizeof(OPENFILENAME); |
1337 | 1339 | OpenFile.hwndOwner = hWnd; |
1338 | 1340 | OpenFile.hInstance = 0; |