Exemple #1
0
void FileViewer::ShowStatus()
{
	string strName;
	string strStatus;

	if (!IsTitleBarVisible())
		return;

	GetTitle(strName);
	int NameLength=ScrX-43; //???41

	if (Opt.ViewerEditorClock && IsFullScreen())
		NameLength-=6;

	if (NameLength<20)
		NameLength=20;

	TruncPathStr(strName, NameLength);
	const wchar_t *lpwszStatusFormat = L"%-*s %5u %13I64u %7.7s %-4I64d %s%3d%%";
	strStatus.Format(
	    lpwszStatusFormat,
	    NameLength,
	    strName.CPtr(),
	    View.VM.CodePage,
	    View.FileSize,
	    MSG(MViewerStatusCol),
	    View.LeftPos,
	    Opt.ViewerEditorClock ? L"":L" ",
	    (View.LastPage ? 100:ToPercent64(View.FilePos,View.FileSize))
	);
	SetColor(COL_VIEWERSTATUS);
	GotoXY(X1,Y1);
	FS<<fmt::LeftAlign()<<fmt::Width(View.Width+(View.ViOpt.ShowScrollbar?1:0))<<fmt::Precision(View.Width+(View.ViOpt.ShowScrollbar?1:0))<<strStatus;

	if (Opt.ViewerEditorClock && IsFullScreen())
		ShowTime(FALSE);
}
Exemple #2
0
void QuickView::DisplayObject()
{
	if (Flags.Check(FSCROBJ_ISREDRAWING))
		return;

	Flags.Set(FSCROBJ_ISREDRAWING);
	FARString strTitle;

	if (!QView && !ProcessingPluginCommand)
		CtrlObject->Cp()->GetAnotherPanel(this)->UpdateViewPanel();

	if (QView)
		QView->SetPosition(X1+1,Y1+1,X2-1,Y2-3);

	Box(X1,Y1,X2,Y2,COL_PANELBOX,DOUBLE_BOX);
	SetScreen(X1+1,Y1+1,X2-1,Y2-1,L' ',COL_PANELTEXT);
	SetColor(Focus ? COL_PANELSELECTEDTITLE:COL_PANELTITLE);
	GetTitle(strTitle);

	if (!strTitle.IsEmpty())
	{
		GotoXY(X1+(X2-X1+1-(int)strTitle.GetLength())/2,Y1);
		Text(strTitle);
	}

	DrawSeparator(Y2-2);
	SetColor(COL_PANELTEXT);
	GotoXY(X1+1,Y2-1);
	FS<<fmt::LeftAlign()<<fmt::Width(X2-X1-1)<<fmt::Precision(X2-X1-1)<<PointToName(strCurFileName);

	if (!strCurFileType.IsEmpty())
	{
		FARString strTypeText=L" ";
		strTypeText+=strCurFileType;
		strTypeText+=L" ";
		TruncStr(strTypeText,X2-X1-1);
		SetColor(COL_PANELSELECTEDINFO);
		GotoXY(X1+(X2-X1+1-(int)strTypeText.GetLength())/2,Y2-2);
		Text(strTypeText);
	}

	if (Directory)
	{
		FormatString FString;
		FString<<MSG(MQuickViewFolder)<<L" \""<<strCurFileName<<L"\"";
		SetColor(COL_PANELTEXT);
		GotoXY(X1+2,Y1+2);
		PrintText(FString);

		/*if ((apiGetFileAttributes(strCurFileName)&FILE_ATTRIBUTE_REPARSE_POINT) == FILE_ATTRIBUTE_REPARSE_POINT)
		{
			FARString strJuncName;
			DWORD ReparseTag=0;

			if (GetReparsePointInfo(strCurFileName, strJuncName,&ReparseTag))
			{
				int ID_Msg=MQuickViewJunction;

				if (ReparseTag==IO_REPARSE_TAG_MOUNT_POINT)
				{
					if (IsLocalVolumeRootPath(strJuncName))
					{
						ID_Msg=MQuickViewVolMount;
					}
				}
				else if (ReparseTag==IO_REPARSE_TAG_SYMLINK)
				{
					ID_Msg=MQuickViewSymlink;
				}

				//"\??\D:\Junc\Src\"
				NormalizeSymlinkName(strJuncName);
				TruncPathStr(strJuncName,X2-X1-1-StrLength(MSG(ID_Msg)));
				FString.Clear();
				FString<<MSG(ID_Msg)<<L" \""<<strJuncName<<L"\"";
				SetColor(COL_PANELTEXT);
				GotoXY(X1+2,Y1+3);
				PrintText(FString);
			}
		}*/

		if (Directory==1 || Directory==4)
		{
			GotoXY(X1+2,Y1+4);
			PrintText(MSG(MQuickViewContains));
			GotoXY(X1+2,Y1+6);
			PrintText(MSG(MQuickViewFolders));
			SetColor(COL_PANELINFOTEXT);
			FString.Clear();
			FString<<DirCount;
			PrintText(FString);
			SetColor(COL_PANELTEXT);
			GotoXY(X1+2,Y1+7);
			PrintText(MSG(MQuickViewFiles));
			SetColor(COL_PANELINFOTEXT);
			FString.Clear();
			FString<<FileCount;
			PrintText(FString);
			SetColor(COL_PANELTEXT);
			GotoXY(X1+2,Y1+8);
			PrintText(MSG(MQuickViewBytes));
			SetColor(COL_PANELINFOTEXT);
			FARString strSize;
			InsertCommas(FileSize,strSize);
			PrintText(strSize);
			SetColor(COL_PANELTEXT);
			GotoXY(X1+2,Y1+9);
			PrintText(MSG(MQuickViewCompressed));
			SetColor(COL_PANELINFOTEXT);
			InsertCommas(CompressedFileSize,strSize);
			PrintText(strSize);
			SetColor(COL_PANELTEXT);
			GotoXY(X1+2,Y1+10);
			PrintText(MSG(MQuickViewRatio));
			SetColor(COL_PANELINFOTEXT);
			FString.Clear();
			FString<<ToPercent64(CompressedFileSize,FileSize)<<L"%";
			PrintText(FString);

			if (Directory!=4 && RealFileSize>=CompressedFileSize)
			{
				SetColor(COL_PANELTEXT);
				GotoXY(X1+2,Y1+12);
				PrintText(MSG(MQuickViewCluster));
				SetColor(COL_PANELINFOTEXT);
				FARString strSize;
				InsertCommas(ClusterSize,strSize);
				PrintText(strSize);
				SetColor(COL_PANELTEXT);
				GotoXY(X1+2,Y1+13);
				PrintText(MSG(MQuickViewRealSize));
				SetColor(COL_PANELINFOTEXT);
				InsertCommas(RealFileSize,strSize);
				PrintText(strSize);
				SetColor(COL_PANELTEXT);
				GotoXY(X1+2,Y1+14);
				PrintText(MSG(MQuickViewSlack));
				SetColor(COL_PANELINFOTEXT);
				InsertCommas(RealFileSize-CompressedFileSize,strSize);
				uint64_t Size1=RealFileSize-CompressedFileSize;
				uint64_t Size2=RealFileSize;

				while ((Size2 >> 32) )
				{
					Size1=Size1>>1;
					Size2=Size2>>1;
				}

				FString.Clear();
				FString<<strSize<<L" ("<<ToPercent((DWORD)Size1, (DWORD)Size2)<<L"%)";
				PrintText(FString);
			}
		}