Пример #1
0
void FileList::ShowSelectedSize()
{

	if (Opt.ShowPanelStatus)
	{
		SetColor(COL_PANELBOX);
		DrawSeparator(Y2-2);
		for (int I=0,ColumnPos=X1+1; I<ViewSettings.ColumnCount-1; I++)
		{
			if (ViewSettings.ColumnWidth[I]<0 ||
			        (I==ViewSettings.ColumnCount-2 && ViewSettings.ColumnWidth[I+1]<0))
				continue;

			ColumnPos+=ViewSettings.ColumnWidth[I];
			GotoXY(ColumnPos,Y2-2);

			bool DoubleLine = Opt.DoubleGlobalColumnSeparator && (!((I+1)%ColumnsInGlobal));
			BoxText(BoxSymbols[DoubleLine?BS_B_H1V2:BS_B_H1V1]);
			ColumnPos++;
		}
	}

	if (SelFileCount)
	{
		string strFormStr;
		InsertCommas(SelFileSize,strFormStr);
		LangString strSelStr(__FormatEndSelectedPhrase(SelFileCount));
		strSelStr << strFormStr << SelFileCount;
		TruncStr(strSelStr,X2-X1-1);
		int Length=(int)strSelStr.GetLength();
		SetColor(COL_PANELSELECTEDINFO);
		GotoXY(X1+(X2-X1+1-Length)/2,Y2-2*Opt.ShowPanelStatus);
		Text(strSelStr);
	}
}
Пример #2
0
void wxDynamicToolBar::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
    // draw separators if any
    wxPaintDC dc(this);

    size_t i;
    for( i = 0; i != mTools.Count(); ++i )
    {
        if ( mTools[i]->mIsSeparator )
        {
            // check if separator doesn't have it's own window
            // if so, then draw it using built-in drawing method
            if ( !mTools[i]->mpToolWnd )
                DrawSeparator( *mTools[i], dc );
        }
    }
}
Пример #3
0
// back-end, delete pen selection
static void
DrawHistogramFull (int cy, int hist_width, int hist_count)
{
    int i;

//    SelectObject( hdcPB, GetStockObject(BLACK_PEN) );

    for( i=0; i<hist_count; i++ ) {
        int index = currFirst + i;
        int x = MarginX + MarginW + index * hist_width;

        /* Draw a separator every 10 moves */
        DrawSeparator( index, x );

        /* Draw histogram */
        if( currPvInfo[i].depth > 0 ) {
            DrawHistogram( x, cy, hist_width, GetPvScore(index), index & 1 );
        }
    }
}
Пример #4
0
/* Actually draw histogram as a diagram, cause there's too much data */
static void
DrawHistogramAsDiagram (int cy, int paint_width, int hist_count)
{
    double step;
    int i;

    /* Rescale the graph every few moves (as opposed to every move) */
    hist_count -= hist_count % 8;
    hist_count += 8;
    hist_count /= 2;

    step = (double) paint_width / (hist_count + 1);

    for( i=0; i<2; i++ ) {
        int index = currFirst;
        int side = (currCurrent + i + 1) & 1; /* Draw current side last */
        double x = MarginX + MarginW;

        if( (index & 1) != side ) {
            x += step / 2;
            index++;
        }

        DrawSegment( (int) x, cy, NULL, NULL, PEN_NONE );

        index += 2;

        while( index < currLast ) {
            x += step;

            DrawSeparator( index, (int) x );

            /* Extend line up to current point */
            if( currPvInfo[index].depth > 0 ) {
                DrawSegment((int) x, GetValueY( GetPvScore(index) ), NULL, NULL, (side==0 ? PEN_BOLDWHITE: PEN_BOLDBLACK) );
            }

            index += 2;
        }
    }
}
Пример #5
0
LONG PrintLine(LONG x, struct line_node *line, LONG line_nr, BOOL doublebuffer, struct InstData *data)
{
  STRPTR text = line->line.Contents;
  LONG length;
  struct RastPort *rp = &data->doublerp;

  ENTER();

  length  = LineCharsWidth(text+x, data);

  if(doublebuffer == FALSE)
    rp = &data->copyrp;

  if((line_nr > 0) && (data->update) && !(data->flags & FLG_Quiet) && data->rport != NULL && data->shown == TRUE)
  {
    LONG c_length = length;
    LONG startx = 0, stopx = 0;
    LONG starty = 0, xoffset = ((data->height-rp->TxBaseline+1)>>1)+1;
    LONG flow = 0;
    UWORD *styles = line->line.Styles;
    UWORD *colors = line->line.Colors;
    struct marking block;
    BOOL cursor = FALSE;

    if(line->line.Color && x == 0 && line->line.Length == 1)
      line->line.Color = FALSE;

    if(doublebuffer == FALSE)
    {
      starty = data->ypos+(data->height * (line_nr-1));
      xoffset = data->xpos;
    }

    flow = FlowSpace(line->line.Flow, text+x, data);
    Move(rp, xoffset+flow, starty+rp->TxBaseline);

    if(Enabled(data))
    {
      struct line_node *blkline;

      NiceBlock(&data->blockinfo, &block);

      blkline = block.startline->next;

      if(block.startline == block.stopline)
      {
        if(block.startline == line)
        {
          startx = block.startx;
          stopx = block.stopx;
        }
      }
      else
      {
        if(block.startline == line)
        {
          startx = block.startx;
          stopx = line->line.Length;
        }
        else
        {
          if(block.stopline == line)
          {
            stopx = block.stopx;
          }
          else
          {
            while((blkline != block.stopline) && (!stopx))
            {
              if(blkline == line)
              {
                stopx = line->line.Length;
              }
              blkline = blkline->next;
            }
          }
        }
      }
    }

    {
      UWORD blockstart = 0;
      UWORD blockwidth = 0;
      struct RastPort *old = muiRenderInfo(data->object)->mri_RastPort;

      if(startx < x+c_length && stopx > x)
      {
        if(startx > x)
          blockstart = TextLength(&data->tmprp, text+x, startx-x);
        else
          startx = x;

        blockwidth = ((stopx >= c_length+x) ? data->innerwidth-(blockstart+flow) : TextLength(&data->tmprp, text+startx, stopx-startx));
      }
      else if(!(data->flags & (FLG_ReadOnly | FLG_Ghosted)) &&
              line == data->actualline && data->CPos_X >= x &&
              data->CPos_X < x+c_length && !Enabled(data) &&
              (data->flags & FLG_Active || data->inactiveCursor == TRUE))
      {
        cursor = TRUE;
        blockstart = TextLength(&data->tmprp, text+x, data->CPos_X-x);

        // calculate the cursor width
        // if it is set to 6 then we should find out how the width of the current char is
        if(data->CursorWidth == 6)
          blockwidth = TextLength(&data->tmprp, (*(text+data->CPos_X) < ' ') ? (char *)" " : (char *)(text+data->CPos_X), 1);
        else
          blockwidth = data->CursorWidth;
      }

      SetDrMd(rp, JAM1);
      muiRenderInfo(data->object)->mri_RastPort = rp;

      // clear the background first
      DoMethod(data->object, MUIM_DrawBackground, xoffset, starty,
                                                  flow+blockstart, data->height,
                                                  (data->flags & FLG_InVGrp) ? 0 : data->xpos,
                                                  (data->flags & FLG_InVGrp) ? data->height*(data->visual_y+line_nr-2) : data->realypos+data->height * (data->visual_y+line_nr-2),
                                                  0);

      if(blockwidth)
      {
        ULONG color;

        // in case the gadget is in inactive state we use a different background
        // color for our selected area
        if((data->flags & FLG_Active) == 0 && (data->flags & FLG_Activated) == 0 &&
           (data->flags & FLG_ActiveOnClick) != 0)
        {
          color = data->inactivecolor;
        }
        else
          color = data->markedcolor;

        // if selectmode == 2 then a whole line should be drawn as being marked, so
        // we have to start at xoffset instead of xoffset+flow+blockstart.
        // Please note that the second part of the following "empiric" evaluation should
        // prevent that centered or right aligned lines are not correctly marked right
        // from the beginning of the line. However, it seems to be not cover 100% of all different
        // cases so that the evaluation if a line should be completely marked should be probably
        // moved elsewhere in future.
        if(data->selectmode == 2 ||
           (flow && data->selectmode != 1 && startx-x == 0 && cursor == FALSE &&
            ((data->blockinfo.startline != data->blockinfo.stopline) || x > 0)))
        {
          SetAPen(rp, color);
          RectFill(rp, xoffset, starty, xoffset+flow+blockwidth-1, starty+data->height-1);
        }
        else
        {
          SetAPen(rp, cursor ? data->cursorcolor : color);
          RectFill(rp, xoffset+flow+blockstart, starty, xoffset+flow+blockstart+blockwidth-1, starty+data->height-1);

          // if the gadget is in inactive state we just draw a skeleton cursor instead
          if(cursor == TRUE &&
             (data->flags & FLG_Active) == 0 && (data->flags & FLG_Activated) == 0)
          {
            DoMethod(data->object, MUIM_DrawBackground, xoffset+flow+blockstart+1, starty+1,
                                                        blockwidth-2, data->height-2,
                                                        (data->flags & FLG_InVGrp) ? 0 : data->xpos,
                                                        (data->flags & FLG_InVGrp) ? data->height*(data->visual_y+line_nr-2) : data->realypos+data->height * (data->visual_y+line_nr-2),
                                                        0);
          }
        }
      }


      {
        LONG  x_start = xoffset+blockstart+blockwidth,
            y_start = starty,
            x_width = data->innerwidth-(blockstart+blockwidth),
            y_width = data->height,
            x_ptrn = blockstart+blockwidth,
            y_ptrn = data->height*(data->visual_y+line_nr-2);

        if(blockwidth)
        {
          x_start += flow;
          x_width -= flow;
          x_ptrn += flow;
        }
        if(!(data->flags & FLG_InVGrp))
        {
          x_ptrn += data->xpos;
          y_ptrn += data->realypos;
        }

        DoMethod(data->object, MUIM_DrawBackground, x_start, y_start, x_width, y_width, x_ptrn, y_ptrn);
      }
      muiRenderInfo(data->object)->mri_RastPort = old;
    }

    if(doublebuffer == FALSE)
      AddClipping(data);

    SetAPen(rp, (line->line.Color ? data->highlightcolor : data->textcolor));

    while(c_length)
    {
      LONG p_length = c_length;

      SetSoftStyle(rp, convert(GetStyle(x, line)), AskSoftStyle(rp));
      if(styles)
      {
        while(*styles-1 <= x)
        {
          styles += 2;
        }
        if(*styles-x-1 < p_length)
        {
          p_length = *styles-x-1;
        }
      }

      if(colors)
      {
        while(*colors-1 <= x)
        {
          SetAPen(rp, ConvertPen(*(colors+1), line->line.Color, data));
          colors += 2;
        }
        if(*colors-x-1 < p_length)
        {
          p_length = *colors-x-1;
        }
      }

/*      if(stopx)
      {
        if((startx > x) && (startx-x < p_length))
        {
          p_length = startx-x;
          SetAPen(rp, 3);
        }
        else
        {
          if((stopx > x) && (stopx-x < p_length))
          {
            p_length = stopx-x;
            SetAPen(rp, 4);
          }
          else
            SetAPen(rp, (line->color ? data->highlightcolor : data->textcolor));
        }
      }
*/

      if(text[x+p_length-1] < ' ')
        Text(rp, text+x, p_length-1);
      else
        Text(rp, text+x, p_length);

      x += p_length;
      c_length -= p_length;
    }
    SetSoftStyle(rp, FS_NORMAL, AskSoftStyle(rp));

    if(line->line.Separator)
    {
        WORD  LeftX, LeftWidth,
            RightX, RightWidth,
            Y, Height;

      LeftX = xoffset;
      LeftWidth = flow-3;
      RightX = rp->cp_x+3;
      RightWidth = xoffset+data->innerwidth - RightX;
      Y = starty;
      Height = (line->line.Separator & LNSF_Thick) ? 2 : 1;

      if(line->line.Separator & LNSF_Middle)
        Y += (data->height/2)-Height;
      else
      {
        if(line->line.Separator & LNSF_Bottom)
          Y += data->height-(2*Height);
      }

      if(line->line.Separator & LNSF_StrikeThru || line->line.Length == 1)
      {
        LeftWidth = data->innerwidth;
      }
      else
      {
        DrawSeparator(rp, RightX, Y, RightWidth, Height, data);
      }
      DrawSeparator(rp, LeftX, Y, LeftWidth, Height, data);
    }


    if(data->flags & FLG_Ghosted)
    {
      UWORD *oldPattern = (UWORD *)rp->AreaPtrn;
      UBYTE oldSize = rp->AreaPtSz;
      UWORD newPattern[] = {0x1111, 0x4444};

      if(doublebuffer == TRUE)
      {
        ULONG ptrn1 = 0x11111111;
        ULONG ptrn2 = 0x44444444;

        ptrn1 = ptrn1>>((data->xpos-xoffset)%16);
        ptrn2 = ptrn2>>((data->xpos-xoffset)%16);

        if((data->height*(data->visual_y+line_nr-2))%2 == 0)
        {
          newPattern[0] = ptrn2;
          newPattern[1] = ptrn1;
        }
        else
        {
          newPattern[0] = ptrn1;
          newPattern[1] = ptrn2;
        }
      }
Пример #6
0
void QuickView::DisplayObject()
{
	if (m_Flags.Check(FSCROBJ_ISREDRAWING))
		return;

	m_Flags.Set(FSCROBJ_ISREDRAWING);

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

	if (this->Destroyed())
		return;

	if (QView)
		QView->SetPosition(m_X1+1,m_Y1+1,m_X2-1,m_Y2-3);

	Box(m_X1,m_Y1,m_X2,m_Y2,colors::PaletteColorToFarColor(COL_PANELBOX),DOUBLE_BOX);
	SetScreen(m_X1+1,m_Y1+1,m_X2-1,m_Y2-1,L' ',colors::PaletteColorToFarColor(COL_PANELTEXT));
	SetColor(m_Focus ? COL_PANELSELECTEDTITLE:COL_PANELTITLE);

	string strTitle = GetTitle();
	if (!strTitle.empty())
	{
		GotoXY(m_X1+(m_X2-m_X1+1-(int)strTitle.size())/2,m_Y1);
		Text(strTitle);
	}

	DrawSeparator(m_Y2-2);
	SetColor(COL_PANELTEXT);
	GotoXY(m_X1+1,m_Y2-1);
	Global->FS << fmt::LeftAlign()<<fmt::ExactWidth(m_X2-m_X1-1)<<PointToName(strCurFileName);

	if (!strCurFileType.empty())
	{
		string strTypeText=L" ";
		strTypeText+=strCurFileType;
		strTypeText+=L" ";
		TruncStr(strTypeText,m_X2-m_X1-1);
		SetColor(COL_PANELSELECTEDINFO);
		GotoXY(m_X1+(m_X2-m_X1+1-(int)strTypeText.size())/2,m_Y2-2);
		Text(strTypeText);
	}

	if (Directory)
	{
		FormatString FString;
		string DisplayName(strCurFileName);
		TruncPathStr(DisplayName,std::max(0, m_X2-m_X1-1-StrLength(MSG(MQuickViewFolder))-5));
		FString<<MSG(MQuickViewFolder)<<L" \""<<DisplayName<<L"\"";
		SetColor(COL_PANELTEXT);
		GotoXY(m_X1+2,m_Y1+2);
		PrintText(FString);

		DWORD currAttr=os::GetFileAttributes(strCurFileName); // обламывается, если нет доступа
		if (currAttr != INVALID_FILE_ATTRIBUTES && (currAttr&FILE_ATTRIBUTE_REPARSE_POINT))
		{
			string Tmp, Target;
			DWORD ReparseTag=0;
			const wchar_t* PtrName;
			if (GetReparsePointInfo(strCurFileName, Target, &ReparseTag))
			{
				NormalizeSymlinkName(Target);
				switch(ReparseTag)
				{
				// 0xA0000003L = Directory Junction or Volume Mount Point
				case IO_REPARSE_TAG_MOUNT_POINT:
					{
						LNGID ID_Msg = MQuickViewJunction;
						bool Root;
						if(ParsePath(Target, nullptr, &Root) == PATH_VOLUMEGUID && Root)
						{
							ID_Msg=MQuickViewVolMount;
						}
						PtrName = MSG(ID_Msg);
					}
					break;
				// 0xA000000CL = Directory or File Symbolic Link
				case IO_REPARSE_TAG_SYMLINK:
					PtrName = MSG(MQuickViewSymlink);
					break;
				// 0x8000000AL = Distributed File System
				case IO_REPARSE_TAG_DFS:
					PtrName = MSG(MQuickViewDFS);
					break;
				// 0x80000012L = Distributed File System Replication
				case IO_REPARSE_TAG_DFSR:
					PtrName = MSG(MQuickViewDFSR);
					break;
				// 0xC0000004L = Hierarchical Storage Management
				case IO_REPARSE_TAG_HSM:
					PtrName = MSG(MQuickViewHSM);
					break;
				// 0x80000006L = Hierarchical Storage Management2
				case IO_REPARSE_TAG_HSM2:
					PtrName = MSG(MQuickViewHSM2);
					break;
				// 0x80000007L = Single Instance Storage
				case IO_REPARSE_TAG_SIS:
					PtrName = MSG(MQuickViewSIS);
					break;
				// 0x80000008L = Windows Imaging Format
				case IO_REPARSE_TAG_WIM:
					PtrName = MSG(MQuickViewWIM);
					break;
				// 0x80000009L = Cluster Shared Volumes
				case IO_REPARSE_TAG_CSV:
					PtrName = MSG(MQuickViewCSV);
					break;
				case IO_REPARSE_TAG_DEDUP:
					PtrName = MSG(MQuickViewDEDUP);
					break;
				case IO_REPARSE_TAG_NFS:
					PtrName = MSG(MQuickViewNFS);
					break;
				case IO_REPARSE_TAG_FILE_PLACEHOLDER:
					PtrName = MSG(MQuickViewPlaceholder);
					break;
					// 0x????????L = anything else
				default:
					if (Global->Opt->ShowUnknownReparsePoint)
					{
						Tmp = FormatString() << L":" << fmt::Radix(16) << fmt::ExactWidth(8) << fmt::FillChar(L'0') << ReparseTag;
						PtrName = Tmp.data();
					}
					else
					{
						PtrName=MSG(MQuickViewUnknownReparsePoint);
					}
				}
			}
			else
			{
				PtrName = MSG(MQuickViewUnknownReparsePoint);
				Target = MSG(MQuickViewNoData);
			}

			TruncPathStr(Target,std::max(0, m_X2-m_X1-1-StrLength(PtrName)-5));
			FString.clear();
			FString<<PtrName<<L" \""<<Target<<L"\"";
			SetColor(COL_PANELTEXT);
			GotoXY(m_X1+2,m_Y1+3);
			PrintText(FString);
		}

		if (Directory==1 || Directory==4)
		{
			const auto iColor = uncomplete_dirscan? COL_PANELHIGHLIGHTTEXT : COL_PANELINFOTEXT;
			const wchar_t *prefix = uncomplete_dirscan ? L"~" : L"";
			GotoXY(m_X1+2,m_Y1+4);
			PrintText(MSG(MQuickViewContains));
			GotoXY(m_X1+2,m_Y1+6);
			PrintText(MSG(MQuickViewFolders));
			SetColor(iColor);
			FString.clear();
			FString<<prefix<<Data.DirCount;
			PrintText(FString);
			SetColor(COL_PANELTEXT);
			GotoXY(m_X1+2,m_Y1+7);
			PrintText(MSG(MQuickViewFiles));
			SetColor(iColor);
			FString.clear();
			FString<<prefix<<Data.FileCount;
			PrintText(FString);
			SetColor(COL_PANELTEXT);
			GotoXY(m_X1+2,m_Y1+8);
			PrintText(MSG(MQuickViewBytes));
			SetColor(iColor);
			string strSize;
			InsertCommas(Data.FileSize,strSize);
			PrintText(prefix+strSize);
			SetColor(COL_PANELTEXT);
			GotoXY(m_X1+2,m_Y1+9);
			PrintText(MSG(MQuickViewAllocated));
			SetColor(iColor);
			InsertCommas(Data.AllocationSize,strSize);
			FString.clear();
			FString << prefix << strSize << L" (" << ToPercent(Data.AllocationSize,Data.FileSize) << L"%)";
			PrintText(FString);

			if (Directory!=4)
			{
				SetColor(COL_PANELTEXT);
				GotoXY(m_X1+2,m_Y1+11);
				PrintText(MSG(MQuickViewCluster));
				SetColor(iColor);
				InsertCommas(Data.ClusterSize,strSize);
				PrintText(prefix+strSize);

				SetColor(COL_PANELTEXT);
				GotoXY(m_X1+2,m_Y1+12);
				PrintText(MSG(MQuickViewSlack));
				SetColor(iColor);
				InsertCommas(Data.FilesSlack, strSize);
				FString.clear();
				FString << prefix << strSize << L" (" << ToPercent(Data.FilesSlack, Data.AllocationSize) << L"%)";
				PrintText(FString);

				SetColor(COL_PANELTEXT);
				GotoXY(m_X1+2,m_Y1+13);
				PrintText(MSG(MQuickViewMFTOverhead));
				SetColor(iColor);
				InsertCommas(Data.MFTOverhead, strSize);
				FString.clear();
				FString<<prefix<<strSize<<L" ("<<ToPercent(Data.MFTOverhead, Data.AllocationSize)<<L"%)";
				PrintText(FString);

			}
		}
	}
	else if (QView)
		QView->Show();

	m_Flags.Clear(FSCROBJ_ISREDRAWING);
}
Пример #7
0
void CCustomToolBar::OnPaint() 
{
	//////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////
	// Copied from CToolBar::OnPaint()

	if (m_bDelayedButtonLayout)
	{
		m_bDelayedButtonLayout = FALSE;
		BOOL bHorz = (m_dwStyle & CBRS_ORIENT_HORZ) != 0;
		if ((m_dwStyle & CBRS_FLOATING) && (m_dwStyle & CBRS_SIZE_DYNAMIC))
			CalcDynamicLayout(0, LM_HORZ | LM_MRUWIDTH | LM_COMMIT);
		else if (bHorz)
 			CalcDynamicLayout(0, LM_HORZ | LM_HORZDOCK | LM_COMMIT);
		else
			CalcDynamicLayout(0, LM_VERTDOCK | LM_COMMIT);
	}

	//////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////

	// Get the rectangle we're going to be drawing.
	CRect crUpdate;
	if (GetUpdateRect(crUpdate))
	{
		// Get the actual device context we will be painting onto.
		CPaintDC dc(this);

		// Select out palette into the DC.
		CPalette* pOldPalette;
		SelectPalette(dc, pOldPalette, FALSE);

		// We construct an offscreen bitmap with the contents
		// to copy onto the final DC. This should avoid all flicker.

		// Create a DC for the offscreen bitmap.
		CDC dcOffScreen;
		if (dcOffScreen.CreateCompatibleDC(&dc))
		{
			// Create the offscreen bitmap in a format compatible
			// with the destination DC.
			CBitmap OffScreenBitmap;
			if (OffScreenBitmap.CreateCompatibleBitmap(&dc, crUpdate.Width(), crUpdate.Height()))
			{
				// Select our palette into the offscreen DC.
				CPalette* pOldOffScreenPalette;
				SelectPalette(dcOffScreen, pOldOffScreenPalette, TRUE);

				// Select the bitmap into the DC.
				CBitmap* pOldBitmap = dcOffScreen.SelectObject(&OffScreenBitmap);
				if (pOldBitmap != NULL)
				{
					// Offset the origin of the offscreen DC to match
					// the coordinate system of the final destination DC.
					dcOffScreen.OffsetWindowOrg(crUpdate.left, crUpdate.top);

					// Draw the background (DrawBackground() is virtual.)
					DrawBackground(dcOffScreen, crUpdate, CSize(0,0));

					int nButtons = GetToolBarCtrl().GetButtonCount();

					for (int nButton = 0; nButton < nButtons; nButton++)
					{
						// Get the bounding rectangle of the button.
						CRect crButton;
						GetItemRect(nButton, crButton);

						// Check if the button is in the update region. If not, then
						// there's nothing to draw.
						CRect crIntersect;
						if (crIntersect.IntersectRect(crButton, crUpdate))
						{
							// Get the button information.
							UINT uButtonID;
							UINT uButtonStyleState;
							int nButtonBitmap;
							GetButtonInfo(nButton, uButtonID, uButtonStyleState, nButtonBitmap);
							WORD wButtonStyle = LOWORD(uButtonStyleState);
							WORD wButtonState = HIWORD(uButtonStyleState);

							// If the button is hidden, then there's nothing to draw.
							if ((wButtonState & TBSTATE_HIDDEN) == 0)
							{
								if (wButtonStyle == TBSTYLE_SEP)
								{
									// Draw the separator (DrawSeparator() is virtual.)
									DrawSeparator(dcOffScreen, crButton, nButton, uButtonID, wButtonStyle, wButtonState);
								}
								else
								{
									// Draw the button (DrawButton() is virtual.)
									DrawButton(dcOffScreen, crButton, nButton, uButtonID, wButtonStyle, wButtonState);
								}
							}
						}
					}

					// Copy the offscreen bitmap to the destination DC.
					dc.BitBlt(
						crUpdate.left,
						crUpdate.top,
						crUpdate.Width(),
						crUpdate.Height(),
						&dcOffScreen,
						crUpdate.left,
						crUpdate.top,
						SRCCOPY);

					dcOffScreen.SelectObject(pOldBitmap);
					pOldBitmap = NULL;
				}

				// Clean up the offscreen bitmap and DC.
				OffScreenBitmap.DeleteObject();
				DeselectPalette(dcOffScreen, pOldOffScreenPalette, TRUE);
			}

			dcOffScreen.DeleteDC();
		}

		DeselectPalette(dc, pOldPalette, FALSE);
	}
}
Пример #8
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);
			}
		}