Skip to content

Commit

Permalink
1. С форума: показываем число папок в текущей панели.
Browse files Browse the repository at this point in the history
2. Warnings.
  • Loading branch information
alabuzhev committed Oct 23, 2015
1 parent fcd35c5 commit b9d59d1
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 69 deletions.
8 changes: 7 additions & 1 deletion 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
Симптоматическое лечение.
Expand Down
40 changes: 9 additions & 31 deletions far/farlang.templ.m4
Expand Up @@ -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 байт свободно "
Expand Down
72 changes: 41 additions & 31 deletions far/filelist.cpp
Expand Up @@ -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),
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -6978,6 +6998,7 @@ SearchListLess;
void FileList::MoveSelection(std::vector<FileListItem>& From, std::vector<FileListItem>& To)
{
SelFileCount=0;
SelDirCount = 0;
SelFileSize=0;
CacheSelIndex=-1;
CacheSelClearIndex=-1;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
}
Expand Down
6 changes: 4 additions & 2 deletions far/filelist.hpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
@@ -1 +1 @@
m4_define(BUILD,4441)m4_dnl
m4_define(BUILD,4442)m4_dnl
6 changes: 3 additions & 3 deletions far/viewer.cpp
Expand Up @@ -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;
}
Expand Down

0 comments on commit b9d59d1

Please sign in to comment.