FFFTPのソースコードです。
Revisão | 2bffe82de6811b380d280099f638dd7b4cbb3404 (tree) |
---|---|
Hora | 2012-02-11 17:24:12 |
Autor | s_kawamoto <s_kawamoto@user...> |
Commiter | s_kawamoto |
Fix bugs of displaying icons in the local file list.
@@ -73,6 +73,7 @@ main_toolbar_bmp BITMAP "toolbar1.bmp" | ||
73 | 73 | remote_toolbar_bmp BITMAP "main_too.bmp" |
74 | 74 | dirattr_bmp BITMAP "list_bmp.bmp" |
75 | 75 | hlist_bmp BITMAP "bitmap1.bmp" |
76 | +dirattr16_bmp BITMAP "list_16.bmp" | |
76 | 77 | |
77 | 78 | ///////////////////////////////////////////////////////////////////////////// |
78 | 79 | // |
@@ -20,6 +20,7 @@ | ||
20 | 20 | #define rename_dlg 110 |
21 | 21 | #define hlist_bmp 110 |
22 | 22 | #define delete_dlg 111 |
23 | +#define dirattr16_bmp 111 | |
23 | 24 | #define hostlist_dlg 112 |
24 | 25 | #define hostset_dlg 113 |
25 | 26 | #define hset_main_dlg 113 |
@@ -73,6 +73,7 @@ main_toolbar_bmp BITMAP "toolbar1.bmp" | ||
73 | 73 | remote_toolbar_bmp BITMAP "main_too.bmp" |
74 | 74 | dirattr_bmp BITMAP "list_bmp.bmp" |
75 | 75 | hlist_bmp BITMAP "bitmap1.bmp" |
76 | +dirattr16_bmp BITMAP "list_16.bmp" | |
76 | 77 | |
77 | 78 | ///////////////////////////////////////////////////////////////////////////// |
78 | 79 | // |
@@ -20,6 +20,7 @@ | ||
20 | 20 | #define rename_dlg 110 |
21 | 21 | #define hlist_bmp 110 |
22 | 22 | #define delete_dlg 111 |
23 | +#define dirattr16_bmp 111 | |
23 | 24 | #define hostlist_dlg 112 |
24 | 25 | #define hostset_dlg 113 |
25 | 26 | #define hset_main_dlg 113 |
@@ -147,6 +147,8 @@ static WNDPROC LocalProcPtr; | ||
147 | 147 | static WNDPROC RemoteProcPtr; |
148 | 148 | |
149 | 149 | static HIMAGELIST ListImg = NULL; |
150 | +// ファイルアイコン表示対応 | |
151 | +static HIMAGELIST ListImgFileIcon = NULL; | |
150 | 152 | |
151 | 153 | static char FindStr[40+1] = { "*" }; /* 検索文字列 */ |
152 | 154 | static int IgnoreNew = NO; |
@@ -1340,22 +1342,22 @@ void RefreshIconImageList(FLISTANCHOR *Anchor) | ||
1340 | 1342 | int i; |
1341 | 1343 | char Cur[FMAX_PATH+1]; |
1342 | 1344 | SHFILEINFO FileInfo; |
1343 | - SendMessage(hWndListLocal, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)NULL); | |
1344 | - ShowWindow(hWndListLocal, SW_SHOW); | |
1345 | - SendMessage(hWndListRemote, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)NULL); | |
1346 | - ShowWindow(hWndListRemote, SW_SHOW); | |
1347 | - ImageList_Destroy(ListImg); | |
1348 | - ListImg = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR24, 0, 1); | |
1349 | - hBitmap = LoadBitmap(GetFtpInst(), MAKEINTRESOURCE(dirattr_bmp)); | |
1350 | - ImageList_AddMasked(ListImg, hBitmap, RGB(255,0,0)); | |
1351 | - DeleteObject(hBitmap); | |
1352 | - ImageId = 0; | |
1353 | - Pos = Anchor->Top; | |
1354 | - for(i = 0; i < Anchor->Files; i++) | |
1345 | + if(AskDispFileIcon() == YES) | |
1355 | 1346 | { |
1356 | - Pos->ImageId = -1; | |
1357 | - if(AskDispFileIcon() == YES) | |
1347 | + SendMessage(hWndListLocal, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)NULL); | |
1348 | + ShowWindow(hWndListLocal, SW_SHOW); | |
1349 | + SendMessage(hWndListRemote, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)NULL); | |
1350 | + ShowWindow(hWndListRemote, SW_SHOW); | |
1351 | + ImageList_Destroy(ListImgFileIcon); | |
1352 | + ListImgFileIcon = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 0, 1); | |
1353 | + hBitmap = LoadBitmap(GetFtpInst(), MAKEINTRESOURCE(dirattr16_bmp)); | |
1354 | + ImageList_AddMasked(ListImgFileIcon, hBitmap, RGB(255, 0, 0)); | |
1355 | + DeleteObject(hBitmap); | |
1356 | + ImageId = 0; | |
1357 | + Pos = Anchor->Top; | |
1358 | + for(i = 0; i < Anchor->Files; i++) | |
1358 | 1359 | { |
1360 | + Pos->ImageId = -1; | |
1359 | 1361 | if(Pos->Node == NODE_DRIVE) |
1360 | 1362 | strcpy(Cur, Pos->File); |
1361 | 1363 | else |
@@ -1366,20 +1368,27 @@ void RefreshIconImageList(FLISTANCHOR *Anchor) | ||
1366 | 1368 | } |
1367 | 1369 | if(SHGetFileInfoM(Cur, 0, &FileInfo, sizeof(SHFILEINFO), SHGFI_SMALLICON | SHGFI_ICON) != 0) |
1368 | 1370 | { |
1369 | - if(ImageList_AddIcon(ListImg, FileInfo.hIcon) >= 0) | |
1371 | + if(ImageList_AddIcon(ListImgFileIcon, FileInfo.hIcon) >= 0) | |
1370 | 1372 | { |
1371 | 1373 | Pos->ImageId = ImageId; |
1372 | 1374 | ImageId++; |
1373 | 1375 | } |
1374 | 1376 | DestroyIcon(FileInfo.hIcon); |
1375 | 1377 | } |
1378 | + Pos = Pos->Next; | |
1376 | 1379 | } |
1377 | - Pos = Pos->Next; | |
1380 | + SendMessage(hWndListLocal, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImgFileIcon); | |
1381 | + ShowWindow(hWndListLocal, SW_SHOW); | |
1382 | + SendMessage(hWndListRemote, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImgFileIcon); | |
1383 | + ShowWindow(hWndListRemote, SW_SHOW); | |
1384 | + } | |
1385 | + else | |
1386 | + { | |
1387 | + SendMessage(hWndListLocal, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImg); | |
1388 | + ShowWindow(hWndListLocal, SW_SHOW); | |
1389 | + SendMessage(hWndListRemote, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImg); | |
1390 | + ShowWindow(hWndListRemote, SW_SHOW); | |
1378 | 1391 | } |
1379 | - SendMessage(hWndListLocal, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImg); | |
1380 | - ShowWindow(hWndListLocal, SW_SHOW); | |
1381 | - SendMessage(hWndListRemote, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImg); | |
1382 | - ShowWindow(hWndListRemote, SW_SHOW); | |
1383 | 1392 | } |
1384 | 1393 | |
1385 | 1394 | void GetLocalDirForWnd(void) |
@@ -1695,8 +1704,8 @@ static void AddListView(HWND hWnd, int Pos, char *Name, int Type, LONGLONG Size, | ||
1695 | 1704 | else |
1696 | 1705 | LvItem.iImage = 4; |
1697 | 1706 | // ファイルアイコン表示対応 |
1698 | - if(hWnd == GetLocalHwnd() && ImageId >= 0) | |
1699 | - LvItem.iImage = 5 + ImageId; | |
1707 | + if(AskDispFileIcon() == YES && hWnd == GetLocalHwnd()) | |
1708 | + LvItem.iImage = ImageId + 5; | |
1700 | 1709 | LvItem.iItem = SendMessage(hWnd, LVM_INSERTITEM, 0, (LPARAM)&LvItem); |
1701 | 1710 | |
1702 | 1711 | /* 日付/時刻 */ |