Esempio n. 1
0
static void DrawSumatraVersion(HDC hdc, RectI rect)
{
    ScopedFont fontSumatraTxt(GetSimpleFont(hdc, SUMATRA_TXT_FONT, SUMATRA_TXT_FONT_SIZE));
    ScopedFont fontVersionTxt(GetSimpleFont(hdc, VERSION_TXT_FONT, VERSION_TXT_FONT_SIZE));
    HGDIOBJ oldFont = SelectObject(hdc, fontSumatraTxt);

    SetBkMode(hdc, TRANSPARENT);

    SIZE txtSize;
    const WCHAR *txt = APP_NAME_STR;
    GetTextExtentPoint32(hdc, txt, (int)str::Len(txt), &txtSize);
    RectI mainRect(rect.x + (rect.dx - txtSize.cx) / 2,
                   rect.y + (rect.dy - txtSize.cy) / 2, txtSize.cx, txtSize.cy);
    DrawSumatraPDF(hdc, mainRect.TL());

    SetTextColor(hdc, WIN_COL_BLACK);
    SelectObject(hdc, fontVersionTxt);
    PointI pt(mainRect.x + mainRect.dx + ABOUT_INNER_PADDING, mainRect.y);
    txt = VERSION_TXT;
    TextOut(hdc, pt.x, pt.y, txt, (int)str::Len(txt));
    txt = VERSION_SUB_TXT;
    TextOut(hdc, pt.x, pt.y + 16, txt, (int)str::Len(txt));

    SelectObject(hdc, oldFont);
}
Esempio n. 2
0
void MainBottomWidget::initAnimation()
{
    QRect mainRect(0, 240, 900, 360);
    QRect origRect(0, 440, 900, 160);
    m_examineAnimation = new QPropertyAnimation(this, "geometry");
    m_examineAnimation->setDuration(200);
    m_examineAnimation->setStartValue(origRect);
    m_examineAnimation->setEndValue(mainRect);


    m_returnAnimation = new QPropertyAnimation(this, "geometry");
    m_returnAnimation->setDuration(200);
    m_returnAnimation->setStartValue(mainRect);
    m_returnAnimation->setEndValue(origRect);

}
Esempio n. 3
0
wxRect wxCustomStatusBar::DoGetMainFieldRect()
{
    // Calculate the fields length
    wxRect rect = GetClientRect();
    size_t totalLength = rect.GetWidth();
    size_t fieldsLength = DoGetFieldsWidth();

    size_t offsetX = 0;
    if(totalLength <= fieldsLength) {
        offsetX = 0;
    } else {
        offsetX = totalLength - fieldsLength;
    }
    wxRect mainRect(0, rect.y, offsetX, rect.height);
    return mainRect;
}
Esempio n. 4
0
/**
@SYMTestCaseID		GRAPHICS-WSERV-0462

@SYMDEF  			PDEF114190

@SYMTestCaseDesc    Test sprite list cleanup when a window is deleted in low memory conditions

@SYMTestPriority    High

@SYMTestStatus      Implemented

@SYMTestActions     Have a loop which increases the number of allocations in the server thread before failure;
					Within the loop:
					1) Create a parent window and a child window of the parent;
					2) Create a sprite on the child window; 
					3) Delete the parent window only, but not the child window; 
					4) Create a testWindow and do redraw on this window; 
					5) Do redraw on the testWindow. This testWindow's redraw will force checking the sprite list. 
					This would panic the client thread due to this defect because the sprite on the orphaned 
					window (which is the previous child window) is still in the sprite list;
					6) Delete all the windows involved.

@SYMTestExpectedResults The sprite should be disabled when a window is deleted;
						The client thread should not be panic'd.
						The test should pass.
*/
void CTTSprite::SpriteOnWindowOrphanedTestsL()
	{
	TInt handles = 344;
	TInt loop = 0;
	TInt allocFailRate = 0;
	TInt err = KErrNone;

	CFbsBitmap* bitmap = new(ELeave) CFbsBitmap;
	CleanupStack::PushL(bitmap);
	User::LeaveIfError(bitmap->Create(TSize(500, 500), EColor16MU));
	TSpriteMember spritemember;
	spritemember.iBitmap = bitmap;
	spritemember.iMaskBitmap = NULL;	
	
	RWindowGroup group(TheClient->iWs);
	RWindow parent1(TheClient->iWs);
	RWindow child1(TheClient->iWs);
	RWindow testWindow(TheClient->iWs);
	RWsSprite sprite(TheClient->iWs);
	
	while (loop < 5)
		{
		TRect mainRect(TPoint(0,0), TSize(500,500));
		err = group.Construct(++handles, EFalse);	
		if (err == KErrNone)
			{
			TheClient->iWs.HeapSetFail(RHeap::EDeterministic, allocFailRate);

			//Create parent 1
			err = parent1.Construct(group,++handles);
			if (err == KErrNone)
				{
				parent1.SetExtent(mainRect.iTl, mainRect.Size());
				parent1.EnableRedrawStore(ETrue);
				parent1.Activate();
				}			
			}
		
		//Create child 1
		if (err == KErrNone)
			{
			TRect childRect(TPoint (10, 10), TSize (200, 150));
			err = child1.Construct(parent1,++handles);
			if (err == KErrNone)
				{
				child1.SetExtent(childRect.iTl, childRect.Size());
				child1.SetBackgroundColor(TRgb(128,100,255,20));
				child1.Activate();
				}
			}
		
		//Add sprite to child 1
		if (err == KErrNone) 
			{
			err = sprite.Construct(child1,TPoint(10,10), 0);
			if (err == KErrNone)
				{
				err = sprite.AppendMember(spritemember);
				if (err == KErrNone)
					err = sprite.Activate();	
				}
			}

		//Only delete parent 1, but not child 1	
		parent1.Close();		

		if (err == KErrNone) 
			{
			TRect testRect(TPoint(10, 30), TSize(200, 150));
			//Create testWindow
			err = testWindow.Construct(group,++handles);
			if (err == KErrNone)
				{
				testWindow.SetExtent(testRect.iTl, testRect.Size());
				testWindow.SetBackgroundColor(TRgb(128,100,255,20));
				testWindow.EnableRedrawStore(ETrue);
				testWindow.Activate();
				testWindow.BeginRedraw();
				testWindow.EndRedraw();	
				TheClient->Flush();			
				}
			}
		TheClient->iWs.HeapSetFail(RAllocator::ENone, 0);

		sprite.Close();
		child1.Close();
		testWindow.Close();
		group.Close();		
		++allocFailRate;
		loop = (err == KErrNone) ? loop + 1 : 0;
		}
	CleanupStack::PopAndDestroy(bitmap);
	}
Esempio n. 5
0
void wxCustomStatusBar::OnPaint(wxPaintEvent& event)
{
    wxBufferedPaintDC dc(this);
    wxRect rect = GetClientRect();

    // Remember which art name used for painting
    SetLastArtNameUsedForPaint(m_art->GetName());

    // Fill the background
    dc.SetBrush(m_art->GetBgColour());
    dc.SetPen(m_art->GetBgColour());

    dc.DrawRectangle(rect);

    // Draw top separator line
    wxPoint topLeft = rect.GetTopLeft();
    wxPoint topRight = rect.GetTopRight();
    dc.SetPen(m_art->GetSeparatorColour());
    dc.DrawLine(topLeft, topRight);

    // Draw the bottom separator using the pen colour
    // this will give a "sink" look to the status bar
    topLeft.y += 1;
    topRight.y += 1;
    dc.SetPen(m_art->GetPenColour());
    dc.DrawLine(topLeft, topRight);

    // Calculate the fields length
    size_t totalLength = rect.GetWidth();
    size_t fieldsLength = DoGetFieldsWidth();

    // sanity
    size_t offsetX = 0;
    if(totalLength <= fieldsLength) {
        offsetX = 0;
    } else {
        offsetX = totalLength - fieldsLength;
    }

    //===----------------------
    // Draw the main field
    //===----------------------
    // update the rect
    
    wxRect mainRect(0, rect.y, offsetX, rect.height);
    dc.SetClippingRegion(mainRect);
    m_mainText->SetRect(mainRect);
    m_mainText->Cast<wxCustomStatusBarFieldText>()->Render(dc, mainRect, m_art);
    m_mainText->Cast<wxCustomStatusBarFieldText>()->SetTooltip(m_text);
    dc.DestroyClippingRegion();

    //===----------------------
    // Draw the fields
    //===----------------------
    
    for(size_t i = 0; i < m_fields.size(); ++i) {
        // Prepare the rect
        wxRect fieldRect(offsetX, rect.y, m_fields.at(i)->GetWidth(), rect.height);
        dc.SetClippingRegion(fieldRect);
        m_fields.at(i)->Render(dc, fieldRect, m_art);
        dc.DestroyClippingRegion();
        offsetX += m_fields.at(i)->GetWidth();
    }
}