From b9d59d15d7d17895d86b575ca25b8f5d0fde07e6 Mon Sep 17 00:00:00 2001 From: Alex Alabuzhev Date: Fri, 23 Oct 2015 21:06:54 +0000 Subject: [PATCH] =?UTF-8?q?1.=20=D0=A1=20=D1=84=D0=BE=D1=80=D1=83=D0=BC?= =?UTF-8?q?=D0=B0:=20=D0=BF=D0=BE=D0=BA=D0=B0=D0=B7=D1=8B=D0=B2=D0=B0?= =?UTF-8?q?=D0=B5=D0=BC=20=D1=87=D0=B8=D1=81=D0=BB=D0=BE=20=D0=BF=D0=B0?= =?UTF-8?q?=D0=BF=D0=BE=D0=BA=20=D0=B2=20=D1=82=D0=B5=D0=BA=D1=83=D1=89?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=BF=D0=B0=D0=BD=D0=B5=D0=BB=D0=B8.=202.=20War?= =?UTF-8?q?nings.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- far/changelog | 8 ++++- far/farlang.templ.m4 | 40 ++++++------------------ far/filelist.cpp | 72 +++++++++++++++++++++++++------------------- far/filelist.hpp | 6 ++-- far/vbuild.m4 | 2 +- far/viewer.cpp | 6 ++-- 6 files changed, 65 insertions(+), 69 deletions(-) diff --git a/far/changelog b/far/changelog index 80d70f7083..70dfd3e11a 100644 --- a/far/changelog +++ b/far/changelog @@ -1,4 +1,10 @@ -w17 20.10.2015 16:21:53 +0300 - build 4441 +drkns 24.10.2015 00:04:08 +0200 - build 4442 + +1. С форума: показываем число папок в текущей панели. + +2. Warnings. + +w17 20.10.2015 16:21:53 +0300 - build 4441 1. M#3100: Crash on search in invalid ZIP archive Симптоматическое лечение. diff --git a/far/farlang.templ.m4 b/far/farlang.templ.m4 index 7840a425c1..469bb4b9fc 100644 --- a/far/farlang.templ.m4 +++ b/far/farlang.templ.m4 @@ -8909,37 +8909,15 @@ MListEb "E" MListFileSize -" %1 байт в 1 файле " -" %1 bytes in 1 file " -" %1 bytů v 1 souboru " -" %1 Bytes in 1 Datei " -" %1 bájt 1 fájlban " -" %1 bajtów w 1 pliku " -" %1 bytes en 1 archivo " -" %1 bajtov v 1 súbore " -" %1 Bytes In 1 File " - -MListFilesSize1 -" %1 байт в %2 файле " -" %1 bytes in %2 files " -" %1 bytů ve %2 souborech " -" %1 Bytes in %2 Dateien " -" %1 bájt %2 fájlban " -" %1 bajtów w %2 plikach " -" %1 bytes en %2 archivos " -" %1 bajtov v %2 súboroch " -" %1 Bytes In %2 Files " - -MListFilesSize2 -" %1 байт в %2 файлах " -" %1 bytes in %2 files " -" %1 bytů v %2 souborech " -" %1 Bytes in %2 Dateien " -" %1 bájt %2 fájlban " -" %1 bajtów w %2 plikach " -" %1 bytes en %2 archivos " -" %1 bajtov v %2 súboroch " -" %1 Bytes In %2 Files " +" Байт: %1, файлов: %2, папок: %3 " +" Bytes: %1, files: %2, folders: %3 " +upd:" Bytes: %1, files: %2, folders: %3 " +upd:" Bytes: %1, files: %2, folders: %3 " +upd:" Bytes: %1, files: %2, folders: %3 " +upd:" Bytes: %1, files: %2, folders: %3 " +upd:" Bytes: %1, files: %2, folders: %3 " +upd:" Bytes: %1, files: %2, folders: %3 " +upd:" Bytes: %1, files: %2, folders: %3 " MListFreeSize " %1 байт свободно " diff --git a/far/filelist.cpp b/far/filelist.cpp index 2dc732dec0..9861f981c6 100644 --- a/far/filelist.cpp +++ b/far/filelist.cpp @@ -213,8 +213,10 @@ FileList::FileList(window_ptr Owner): LastCurFile(-1), ReturnCurrentFile(FALSE), SelFileCount(0), + SelDirCount(), GetSelPosition(0), LastSelPosition(-1), TotalFileCount(0), + TotalDirCount(), SelFileSize(0), TotalFileSize(0), FreeDiskSize(-1), @@ -2452,11 +2454,13 @@ void FileList::Select(FileListItem& SelItem, int Selection) if ((SelItem.Selected = Selection) != 0) { SelFileCount++; + SelDirCount += SelItem.FileAttr & FILE_ATTRIBUTE_DIRECTORY? 1 : 0; SelFileSize += SelItem.FileSize; } else { SelFileCount--; + SelDirCount -= SelItem.FileAttr & FILE_ATTRIBUTE_DIRECTORY? 1 : 0; SelFileSize -= SelItem.FileSize; } } @@ -6569,8 +6573,10 @@ void FileList::ReadFileNames(int KeepSelection, int UpdateEvenIfPanelInvisible, AnotherPanel->QViewDelTempName(); size_t PrevSelFileCount=SelFileCount; SelFileCount=0; + SelDirCount = 0; SelFileSize=0; TotalFileCount=0; + TotalDirCount = 0; TotalFileSize=0; CacheSelIndex=-1; CacheSelClearIndex=-1; @@ -6739,8 +6745,14 @@ void FileList::ReadFileNames(int KeepSelection, int UpdateEvenIfPanelInvisible, if (!ContentPlugins.empty()) Global->CtrlObject->Plugins->GetContentData(ContentPlugins, NewItem.strName, ContentNames, ContentValues, NewItem.ContentData); - if (!(fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) - TotalFileCount++; + if (fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + ++TotalDirCount; + } + else + { + ++TotalFileCount; + } if (TimeCheck) { @@ -6839,9 +6851,17 @@ void FileList::ReadFileNames(int KeepSelection, int UpdateEvenIfPanelInvisible, i.ShowFolderSize = 0; i.SortGroup=Global->CtrlObject->HiFiles->GetGroup(&i); - if (!TestParentFolderName(PluginPtr->FileName) && !(i.FileAttr & FILE_ATTRIBUTE_DIRECTORY)) - TotalFileCount++; - + if (!TestParentFolderName(PluginPtr->FileName)) + { + if (i.FileAttr & FILE_ATTRIBUTE_DIRECTORY) + { + ++TotalDirCount; + } + else + { + ++TotalFileCount; + } + } ++PluginPtr; ++Position; } @@ -6978,6 +6998,7 @@ SearchListLess; void FileList::MoveSelection(std::vector& From, std::vector& To) { SelFileCount=0; + SelDirCount = 0; SelFileSize=0; CacheSelIndex=-1; CacheSelClearIndex=-1; @@ -7053,8 +7074,10 @@ void FileList::UpdatePlugin(int KeepSelection, int UpdateEvenIfPanelInvisible) size_t PrevSelFileCount=SelFileCount; SelFileCount=0; + SelDirCount = 0; SelFileSize=0; TotalFileCount=0; + TotalDirCount = 0; TotalFileSize=0; CacheSelIndex=-1; CacheSelClearIndex=-1; @@ -7132,9 +7155,16 @@ void FileList::UpdatePlugin(int KeepSelection, int UpdateEvenIfPanelInvisible) DotsPresent=TRUE; CurListData.FileAttr|=FILE_ATTRIBUTE_DIRECTORY; } - else if (!(CurListData.FileAttr & FILE_ATTRIBUTE_DIRECTORY)) + else { - TotalFileCount++; + if (CurListData.FileAttr & FILE_ATTRIBUTE_DIRECTORY) + { + ++TotalDirCount; + } + else + { + ++TotalFileCount; + } } TotalFileSize += CurListData.FileSize; @@ -7344,26 +7374,6 @@ void FileList::AddParentPoint(FileListItem *CurPtr, size_t CurFilePos, const FIL static wchar_t OutCharacter[8]={}; -static LNGID __FormatEndSelectedPhrase(size_t Count) -{ - LNGID M_Fmt=MListFileSize; - - if (Count != 1) - { - FormatString StrItems; - StrItems << Count; - size_t LenItems= StrItems.size(); - - if (StrItems[LenItems-1] == '1' && Count != 11) - M_Fmt=MListFilesSize1; - else - M_Fmt=MListFilesSize2; - } - - return M_Fmt; -} - - void FileList::DisplayObject() { m_Height=m_Y2-m_Y1-4+!Global->Opt->ShowColumnTitles+(Global->Opt->ShowPanelStatus ? 0:2); @@ -7799,7 +7809,7 @@ void FileList::ShowSelectedSize() { string strFormStr; InsertCommas(SelFileSize,strFormStr); - auto strSelStr = string_format(__FormatEndSelectedPhrase(SelFileCount), strFormStr, SelFileCount); + auto strSelStr = string_format(MListFileSize, strFormStr, SelFileCount - SelDirCount, SelDirCount); TruncStr(strSelStr,m_X2-m_X1-1); int Length=(int)strSelStr.size(); SetColor(COL_PANELSELECTEDINFO); @@ -7834,13 +7844,13 @@ void FileList::ShowTotalSize(const OpenPanelInfo &Info) { if (!Global->Opt->ShowPanelFree || strFreeSize.empty()) { - strTotalStr = string_format(__FormatEndSelectedPhrase(TotalFileCount), strFormSize, TotalFileCount); + strTotalStr = string_format(MListFileSize, strFormSize, TotalFileCount, TotalDirCount); } else { wchar_t DHLine[4]={BoxSymbols[BS_H2],BoxSymbols[BS_H2],BoxSymbols[BS_H2],0}; FormatString str; - str << L" " << strFormSize << L" (" << TotalFileCount << L") " << DHLine << L" " << strFreeSize << L" "; + str << L" " << strFormSize << L" (" << TotalFileCount << L"/" << TotalDirCount << L") " << DHLine << L" " << strFreeSize << L" "; if ((int)str.size() > m_X2-m_X1-1) { @@ -7854,7 +7864,7 @@ void FileList::ShowTotalSize(const OpenPanelInfo &Info) } InsertCommas(TotalFileSize>>20,strFormSize); str.clear(); - str << L" " << strFormSize << L" " << MSG(MListMb) << L" (" << TotalFileCount << L") " << DHLine << L" " << strFreeSize << L" " << MSG(MListMb) << L" "; + str << L" " << strFormSize << L" " << MSG(MListMb) << L" (" << TotalFileCount << L"/" << TotalDirCount << L") " << DHLine << L" " << strFreeSize << L" " << MSG(MListMb) << L" "; } strTotalStr = str; } diff --git a/far/filelist.hpp b/far/filelist.hpp index f4e6c93732..679cf092bc 100644 --- a/far/filelist.hpp +++ b/far/filelist.hpp @@ -432,9 +432,11 @@ class FileList:public Panel FileSystemWatcher FSWatcher; long UpperFolderTopFile,LastCurFile; long ReturnCurrentFile; - size_t SelFileCount; + size_t SelFileCount; // both files and directories + size_t SelDirCount; // directories only long GetSelPosition,LastSelPosition; - size_t TotalFileCount; + size_t TotalFileCount; // files only + size_t TotalDirCount; // directories only unsigned __int64 SelFileSize; unsigned __int64 TotalFileSize; unsigned __int64 FreeDiskSize; diff --git a/far/vbuild.m4 b/far/vbuild.m4 index 89714d8167..ce11a43533 100644 --- a/far/vbuild.m4 +++ b/far/vbuild.m4 @@ -1 +1 @@ -m4_define(BUILD,4441)m4_dnl +m4_define(BUILD,4442)m4_dnl diff --git a/far/viewer.cpp b/far/viewer.cpp index 287d887f4a..7ec70ca62d 100644 --- a/far/viewer.cpp +++ b/far/viewer.cpp @@ -2433,14 +2433,14 @@ void Viewer::Up( int nlines, bool adjust ) while ( i >= 0 ) { int l = llengths[i--]; - bool eol = false; + bool IsEol = false; if (l < 0) { - eol = true; + IsEol = true; l = -l; } fpos1 -= l; - CacheLine(fpos1, l, eol); + CacheLine(fpos1, l, IsEol); if (--nlines == 0) FilePos = fpos1; }