X-Git-Url: http://git.sourceforge.jp/view?p=ffftp%2Fffftp.git;a=blobdiff_plain;f=filelist.c;h=b3e1da2a81599356697697a04d34f6a621c4a15b;hp=be492524b0027712a4fc769a931615d3afc36245;hb=663728dfaea4b4e0da170722b4046764e01555dc;hpb=19f7cced5712c402119825eb556f3dac6aee54f9 diff --git a/filelist.c b/filelist.c index be49252..b3e1da2 100644 --- a/filelist.c +++ b/filelist.c @@ -147,6 +147,8 @@ static WNDPROC LocalProcPtr; static WNDPROC RemoteProcPtr; static HIMAGELIST ListImg = NULL; +// ファイルアイコン表示対応 +static HIMAGELIST ListImgFileIcon = NULL; static char FindStr[40+1] = { "*" }; /* 検索文字列 */ static int IgnoreNew = NO; @@ -786,6 +788,9 @@ static LRESULT FileListCommonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPA return(CallWindowProc(ProcPtr, hWnd, message, wParam, lParam)); case WM_DROPFILES : + // 同時接続対応 + if(AskUserOpeDisabled() == YES) + break; // ドラッグ中は処理しない。ドラッグ後にWM_LBUTTONDOWNが飛んでくるため、そこで処理する。 if (Dragging == YES) return (FALSE); @@ -793,7 +798,7 @@ static LRESULT FileListCommonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPA if(hWnd == hWndListRemote) { if(AskConnecting() == YES) - UpLoadDragProc(wParam); + UploadDragProc(wParam); } else if(hWnd == hWndListLocal) { @@ -818,6 +823,9 @@ static LRESULT FileListCommonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPA hCsrDrg = LoadCursor(NULL, IDC_ARROW); SetCursor(hCsrDrg); + // 同時接続対応 + if(AskUserOpeDisabled() == YES) + break; Point.x = (long)(short)LOWORD(lParam); Point.y = (long)(short)HIWORD(lParam); ClientToScreen(hWnd, &Point); @@ -1334,22 +1342,22 @@ void RefreshIconImageList(FLISTANCHOR *Anchor) int i; char Cur[FMAX_PATH+1]; SHFILEINFO FileInfo; - SendMessage(hWndListLocal, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)NULL); - ShowWindow(hWndListLocal, SW_SHOW); - SendMessage(hWndListRemote, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)NULL); - ShowWindow(hWndListRemote, SW_SHOW); - ImageList_Destroy(ListImg); - ListImg = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR24, 0, 1); - hBitmap = LoadBitmap(GetFtpInst(), MAKEINTRESOURCE(dirattr_bmp)); - ImageList_AddMasked(ListImg, hBitmap, RGB(255,0,0)); - DeleteObject(hBitmap); - ImageId = 0; - Pos = Anchor->Top; - for(i = 0; i < Anchor->Files; i++) + if(AskDispFileIcon() == YES) { - Pos->ImageId = -1; - if(AskDispFileIcon() == YES) + SendMessage(hWndListLocal, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)NULL); + ShowWindow(hWndListLocal, SW_SHOW); + SendMessage(hWndListRemote, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)NULL); + ShowWindow(hWndListRemote, SW_SHOW); + ImageList_Destroy(ListImgFileIcon); + ListImgFileIcon = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 0, 1); + hBitmap = LoadBitmap(GetFtpInst(), MAKEINTRESOURCE(dirattr16_bmp)); + ImageList_AddMasked(ListImgFileIcon, hBitmap, RGB(255, 0, 0)); + DeleteObject(hBitmap); + ImageId = 0; + Pos = Anchor->Top; + for(i = 0; i < Anchor->Files; i++) { + Pos->ImageId = -1; if(Pos->Node == NODE_DRIVE) strcpy(Cur, Pos->File); else @@ -1360,20 +1368,27 @@ void RefreshIconImageList(FLISTANCHOR *Anchor) } if(SHGetFileInfoM(Cur, 0, &FileInfo, sizeof(SHFILEINFO), SHGFI_SMALLICON | SHGFI_ICON) != 0) { - if(ImageList_AddIcon(ListImg, FileInfo.hIcon) >= 0) + if(ImageList_AddIcon(ListImgFileIcon, FileInfo.hIcon) >= 0) { Pos->ImageId = ImageId; ImageId++; } DestroyIcon(FileInfo.hIcon); } + Pos = Pos->Next; } - Pos = Pos->Next; + SendMessage(hWndListLocal, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImgFileIcon); + ShowWindow(hWndListLocal, SW_SHOW); + SendMessage(hWndListRemote, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImgFileIcon); + ShowWindow(hWndListRemote, SW_SHOW); + } + else + { + SendMessage(hWndListLocal, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImg); + ShowWindow(hWndListLocal, SW_SHOW); + SendMessage(hWndListRemote, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImg); + ShowWindow(hWndListRemote, SW_SHOW); } - SendMessage(hWndListLocal, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImg); - ShowWindow(hWndListLocal, SW_SHOW); - SendMessage(hWndListRemote, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ListImg); - ShowWindow(hWndListRemote, SW_SHOW); } void GetLocalDirForWnd(void) @@ -1428,7 +1443,7 @@ void GetLocalDirForWnd(void) if(DispDrives) { GetLogicalDriveStrings(FMAX_PATH, Scan); - NoDrives = LoadHideDriveListRegistory(); + NoDrives = LoadHideDriveListRegistry(); Pos = Scan; while(*Pos != NUL) @@ -1689,8 +1704,8 @@ static void AddListView(HWND hWnd, int Pos, char *Name, int Type, LONGLONG Size, else LvItem.iImage = 4; // ファイルアイコン表示対応 - if(hWnd == GetLocalHwnd() && ImageId >= 0) - LvItem.iImage = 5 + ImageId; + if(AskDispFileIcon() == YES && hWnd == GetLocalHwnd()) + LvItem.iImage = ImageId + 5; LvItem.iItem = SendMessage(hWnd, LVM_INSERTITEM, 0, (LPARAM)&LvItem); /* 日付/時刻 */ @@ -4109,6 +4124,8 @@ static int ResolvFileInfo(char *Str, int ListType, char *Fname, LONGLONG *Size, /* まずクリアしておく */ Ret = NODE_NONE; + // バグ対策 + memset(Fname, NUL, FMAX_PATH+1); *Size = -1; *Attr = 0; *Link = NO; @@ -4844,6 +4861,82 @@ static int ResolvFileInfo(char *Str, int ListType, char *Fname, LONGLONG *Size, break; #endif + // MLSD対応 + // 以下の形式に対応 + // fact1=value1;fact2=value2;fact3=value3; filename\r\n + // 不完全な実装のホストが存在するため以下の形式も許容 + // fact1=value1;fact2=value2;fact3=value3 filename\r\n + // fact1=value1;fact2=value2;fact3=value3;filename\r\n + case LIST_MLSD: + { + int i = 0; + char StrBuf[(FMAX_PATH * 2) + 1]; + char Fact[FMAX_PATH + 1]; + char Name[FMAX_PATH + 1]; + char Value[FMAX_PATH + 1]; + char* pFileName; + strncpy(StrBuf, Str, FMAX_PATH * 2); + StrBuf[FMAX_PATH * 2] = '\0'; + if((pFileName = strstr(StrBuf, "; ")) != NULL) + { + *pFileName = '\0'; + pFileName += 2; + } + else if((pFileName = strchr(StrBuf, ' ')) != NULL) + { + *pFileName = '\0'; + pFileName++; + } + else if((pFileName = strrchr(StrBuf, ';')) != NULL) + { + *pFileName = '\0'; + pFileName++; + } + if(pFileName != NULL) + strcpy(Fname, pFileName); + while(FindField2(StrBuf, Fact, ';', i, NO) == FFFTP_SUCCESS) + { + if(FindField2(Fact, Name, '=', 0, NO) == FFFTP_SUCCESS && FindField2(Fact, Value, '=', 1, NO) == FFFTP_SUCCESS) + { + if(_stricmp(Name, "type") == 0) + { + if(_stricmp(Value, "dir") == 0) + Ret = NODE_DIR; + else if(_stricmp(Value, "file") == 0) + Ret = NODE_FILE; + } + else if(_stricmp(Name, "size") == 0) + { + *Size = _atoi64(Value); + *InfoExist |= FINFO_SIZE; + } + else if(_stricmp(Name, "modify") == 0) + { + sTime.wYear = atoi_n(Value, 4); + sTime.wMonth = atoi_n(Value + 4, 2); + sTime.wDay = atoi_n(Value + 6, 2); + sTime.wHour = atoi_n(Value + 8, 2); + sTime.wMinute = atoi_n(Value + 10, 2); + sTime.wSecond = atoi_n(Value + 12, 2); + sTime.wMilliseconds = 0; + SystemTimeToFileTime(&sTime, Time); + // 時刻はGMT +// SpecificLocalFileTime2FileTime(Time, AskHostTimeZone()); + *InfoExist |= FINFO_DATE | FINFO_TIME; + } + else if(_stricmp(Name, "UNIX.mode") == 0) + { + *Attr = strtol(Value, NULL, 16); + *InfoExist |= FINFO_ATTR; + } + else if(_stricmp(Name, "UNIX.owner") == 0) + strcpy(Owner, Value); + } + i++; + } + } + break; + case LIST_UNIX_10 : case LIST_UNIX_11 : case LIST_UNIX_12 : @@ -5109,57 +5202,6 @@ static int ResolvFileInfo(char *Str, int ListType, char *Fname, LONGLONG *Size, Ret = NODE_NONE; } break; - - // MLSD対応 - case LIST_MLSD: - { - int i = 0; - char Tmp[FMAX_PATH + 1]; - char Name[FMAX_PATH + 1]; - char Value[FMAX_PATH + 1]; - while(FindField2(Str, Tmp, ';', i, NO) == FFFTP_SUCCESS) - { - if(i >= 1 && strncmp(Tmp, " ", 1) == 0) - strcpy(Fname, strstr(Str, "; ") + 2); - else if(FindField2(Tmp, Name, '=', 0, NO) == FFFTP_SUCCESS && FindField2(Tmp, Value, '=', 1, NO) == FFFTP_SUCCESS) - { - if(_stricmp(Name, "type") == 0) - { - if(_stricmp(Value, "dir") == 0) - Ret = NODE_DIR; - else if(_stricmp(Value, "file") == 0) - Ret = NODE_FILE; - } - else if(_stricmp(Name, "size") == 0) - { - *Size = _atoi64(Value); - *InfoExist |= FINFO_SIZE; - } - else if(_stricmp(Name, "modify") == 0) - { - sTime.wYear = atoi_n(Value, 4); - sTime.wMonth = atoi_n(Value + 4, 2); - sTime.wDay = atoi_n(Value + 6, 2); - sTime.wHour = atoi_n(Value + 8, 2); - sTime.wMinute = atoi_n(Value + 10, 2); - sTime.wSecond = atoi_n(Value + 12, 2); - sTime.wMilliseconds = 0; - SystemTimeToFileTime(&sTime, Time); -// SpecificLocalFileTime2FileTime(Time, AskHostTimeZone()); - *InfoExist |= FINFO_DATE | FINFO_TIME; - } - else if(_stricmp(Name, "UNIX.mode") == 0) - { - *Attr = strtol(Value, NULL, 16); - *InfoExist |= FINFO_ATTR; - } - else if(_stricmp(Name, "UNIX.owner") == 0) - strcpy(Owner, Value); - } - i++; - } - } - break; } // UTF-8対応