Beispiel #1
0
void DisplayElement::InvalidateChild (DisplayElement *pChild, WebRect *pDirty)
{
	WebRect dirty;
	dirty.Set(pDirty);
	dirty.Shift(mRect.left, mRect.top);

	if (GetOverflow() == DISPLAY_OVERFLOW_HIDDEN)
	{
		WebRect clipRect;
		GetClipRect(&clipRect);

		// If completely outside clipping rect, stop here
		if (!dirty.Overlaps(&clipRect))
		{
			return;
		}

		// clip pDirty to our rect
		dirty.And(&clipRect);
	}

	if ((mFlags & DISPLAY_FLAG_FIXED_POS) || !mpParent)
	{
		DisplayManager *pManager = GetManager();
		if (pManager)
		{
			if (mFlags & DISPLAY_FLAG_FIXED_POS)
			{
				dirty.Shift(pManager->mViewRect.left, pManager->mViewRect.top);
			}

			pManager->InvalidateViewportRegion(&dirty);
		}
	}
	else
	{
		mpParent->InvalidateChild(this, &dirty);
	}
 }
Beispiel #2
0
void DisplayElement::Draw (DISPLAY_INT iScreenX, DISPLAY_INT iScreenY, WebRect *pViewport, WebGraphics *pGC)
{
	DisplayElement *pChild = mpFirstChild;
	WebRect clip, saveClip, screenClip;
	WEBC_BOOL clipRestore = WEBC_FALSE;

	pGC->GetClip(&saveClip);
	clip.Set(&saveClip);
	if (GetOverflow() != DISPLAY_OVERFLOW_VISIBLE)
	//if (GetOverflow() == DISPLAY_OVERFLOW_HIDDEN)
	{
		GetClipRect(&screenClip);
		screenClip.Shift(iScreenX - mRect.left, iScreenY - mRect.top);
		if (!clip.Overlaps(&screenClip))
		{
			// we're not visible, so neither are our children
			return;
		}
		clip.And(&screenClip);
		pGC->SetClip(&clip);
		clipRestore = WEBC_TRUE;
	}

	WebRect screenRect(mRect);
	screenRect.MoveTo(iScreenX, iScreenY);
	mScreenRect = screenRect; // April2013 - save the screenrect of last known draw and subtract boundaries of the display manager screenrect
	DisplayManager*pManager= this->GetManager();
	if (pManager && pManager->mBrowser)
		pManager=pManager->mBrowser->GetDisplayManager();
	if (pManager)
	{
	WebRect r;
//	printf("Not working all the way \n");
		r=pManager->mScreenRect;
		mScreenRect.top -= r.top;
		mScreenRect.bottom -= r.top;
		mScreenRect.left -= r.left;
		mScreenRect.right -= r.left;
	}  // April2013 - end save the screenrect of last known draw and subtract boundaries of the display manager screenrect
	// Start drawing
//	pGC->StartBuffer();

	// Draw negative-z children
	while (pChild && (pChild->GetZIndex() < 0))
	{
		if (pChild->mFlags & DISPLAY_FLAG_FIXED_POS)
		{
			pChild->Draw(pViewport->left + pChild->mRect.left, pViewport->top + pChild->mRect.top, pViewport, pGC);
		}
		else
		{
			pChild->Draw(iScreenX + pChild->mRect.left, iScreenY + pChild->mRect.top, pViewport, pGC);
		}
		pChild = pChild->mpNext;
	}

	// if I am visible
	if (screenRect.Overlaps(&clip))
	{
		// Draw myself
		DrawThisOnly(iScreenX, iScreenY, pGC);
	}
#if (INCLUDE_EXPERIMENTAL_DIV_SCROLLBARS)
	int xContentOffset=0;
	int yContentOffset=0;

	if (clipRestore && vScrollWidth() || hScrollWidth())
	{
		WebRect contentClip;
		contentClip.Set(&clip);
		contentClip.SetHeight(contentClip.Height()-hScrollWidth());
		contentClip.SetWidth(contentClip.Width()-vScrollWidth());
		pGC->SetClip(&contentClip);

		if (GetHScroll())
		{
			WebHScroll *pScroll = (WebHScroll *)GetHScroll();
			xContentOffset=pScroll->GetPosition();
		}
		if (GetVScroll())
		{
			WebVScroll *pScroll = (WebVScroll *)GetVScroll();
			yContentOffset=pScroll->GetPosition();
			if (yContentOffset)
			{ // If we have a y offset step i nto the content holder element
			  // so we don't exclude the whole thing becuase it is out of our
			  // range.
		//		if (GetInlineContentHolder())
		//			pChild = GetInlineContentHolder()->mpFirstChild;
				;
			}
		}
	}
#endif

	// Draw positive-z children
	while (pChild)
	{
#if (INCLUDE_EXPERIMENTAL_DIV_SCROLLBARS)
		if (pChild->IncludeInFlow() && pChild->mRect.bottom >= yContentOffset && pChild->mRect.right >= xContentOffset)
		{
			if (pChild->mFlags & DISPLAY_FLAG_FIXED_POS)
			{
				pChild->Draw(pViewport->left+pChild->mRect.left-xContentOffset, pViewport->top+pChild->mRect.top-yContentOffset, pViewport, pGC);
			}
			else
			{
				pChild->Draw(iScreenX + pChild->mRect.left-xContentOffset, iScreenY+pChild->mRect.top-yContentOffset, pViewport, pGC);
			}
		}
#else
		if (pChild->mFlags & DISPLAY_FLAG_FIXED_POS)
		{
			pChild->Draw(pViewport->left + pChild->mRect.left, pViewport->top + pChild->mRect.top, pViewport, pGC);
		}
		else
		{
			pChild->Draw(iScreenX + pChild->mRect.left, iScreenY + pChild->mRect.top, pViewport, pGC);
		}
#endif
		pChild = pChild->mpNext;
	}


	if (clipRestore)
	{
		pGC->SetClip(&saveClip);
	}
#if (INCLUDE_EXPERIMENTAL_DIV_SCROLLBARS)
	if (clipRestore && vScrollWidth() || hScrollWidth())
	{
		DisplayElement *pScroll;
		if (GetHScroll())
		{
			pScroll = (WebHScroll *)GetHScroll();
			pScroll->Draw(iScreenX + pScroll->mRect.left, iScreenY + pScroll->mRect.top, pViewport, pGC);
		}
		if (GetVScroll())
		{
			pScroll = (WebVScroll *)GetVScroll();
			pScroll->Draw(iScreenX + pScroll->mRect.left, iScreenY + pScroll->mRect.top, pViewport, pGC);
		}
		pGC->SetClip(&saveClip);
	}
#endif
//	pGC->EndBuffer();
}
Beispiel #3
0
// x,y are in same coordinate space as this->mRect; viewX, viewY is the upper left corner of the viewport in
//  the coordinate space of this->mRect
DisplayElement *DisplayElement::TrapEventPoint (DISPLAY_INT x, DISPLAY_INT y, DISPLAY_INT viewX, DISPLAY_INT viewY)
{
	// if we clip our children to our rect, and the point is outside our rect,
	//  then fail right away
	if (GetOverflow() == DISPLAY_OVERFLOW_HIDDEN)
	{
		WebRect clipRect;
		GetClipRect(&clipRect);
		if (!clipRect.Contains(x,y))
		{
			return (0);
		}
	}

	DisplayElement *pChild = mpLastChild, *pFound;

	// now search positive-z children in reverse order
	while (pChild && (pChild->GetZIndex() >= 0))
	{
		if (pChild->mFlags & DISPLAY_FLAG_FIXED_POS)
		{
			pFound = pChild->TrapEventPoint(x - (mRect.left + viewX), y - (mRect.top + viewY), -mRect.left, -mRect.top);
		}
		else
		{
			pFound = pChild->TrapEventPoint(x - mRect.left, y - mRect.top, viewX - mRect.left, viewY - mRect.top);
		}

		if (pFound)
		{
			return (pFound);
		}
		pChild = pChild->mpPrev;
	}

	// if we contain the point, trap it
	if (TrapEventInThis(x,y))
	{
		return (this);
	}

	// now search negative-z children in reverse order
	while (pChild)
	{
		if (pChild->mFlags & DISPLAY_FLAG_FIXED_POS)
		{
			pFound = pChild->TrapEventPoint(x - (mRect.left + viewX), y - (mRect.top + viewY), -mRect.left, -mRect.top);
		}
		else
		{
			pFound = pChild->TrapEventPoint(x - mRect.left, y - mRect.top, viewX - mRect.left, viewY - mRect.top);
		}

		if (pFound)
		{
			return (pFound);
		}
		pChild = pChild->mpPrev;
	}

	return (0);
}
Beispiel #4
0
static void SendData(char *file)
{
    DataFile = fopen(file, "r");
    bool error = mfalse;

    done = mfalse;
    everError = mfalse;
    
    if (DataFile == NULL)
    {
	LogMsg(0,LogLevel,LogFile,"Could not Open %s for reading",file);
	done = mtrue;
	error = mtrue;
    }
    
    int recordCounts[dataClass_last_tag];
    for (int i=0;i<dataClass_last_tag;i++)
	recordCounts[i] = 0;

    long rt;
    long count;
    while (done == mfalse) {
	count = ScanPastMagicNumber(&rt);
	if (count > 0) {
	    LogMsg(0,LogLevel,LogFile,
		   "Out of sync with data file: %d words skipped to next sync point",
		   count);
	    everError = mtrue;
	    LogErrorPoint(recordCounts);
	} else if (count < 0) {
	    LogMsg(0,LogLevel,LogFile,"End of data file");
	    LogErrorPoint(recordCounts);
	}
	switch(rt) {
	case -1:
	    done = mtrue;
	    break;
	case SESSION_TAG:
	    GetSession(&error);
	    recordCounts[SESSION]++;
	    break;    
	case COMM_TAG:
	    GetComm(&error);
	    recordCounts[COMM]++;
	    break;
	case CLNTCALL_TAG:
	    GetClientCall(&error);
	    recordCounts[CLNTCALL]++;
	    break;
	case CLNTMCALL_TAG:
	    GetClientMCall(&error);
	    recordCounts[CLNTMCALL]++;
	    break;
	case CLNTRVM_TAG:
	    GetClientRVM(&error);
	    recordCounts[CLNTRVM]++;
	    break;
	case VCB_TAG:
	    GetVCB(&error);
	    recordCounts[VCB]++;
	    break;
	case ADVICE_TAG:
	    GetAdvice(&error);
	    recordCounts[ADVICE]++;
	    break;
	case MINICACHE_TAG:
	    GetMiniCache(&error);
	    recordCounts[MINICACHE]++;
	    break;
	case OVERFLOW_TAG:
	    GetOverflow(&error);
	    recordCounts[OVERFLOW]++;
	    break;
	case SRVCALL_TAG:
	    GetSrvCall(&error);
	    recordCounts[SRVCALL]++;
	    break;
	case SRVRES_TAG:
	    GetResEvent(&error);
	    recordCounts[SRVRES]++;
	    break;
	case SRVRVMRES_TAG:
	    GetRvmResEvent(&error);
	    recordCounts[SRVRVMRES]++;
	    break;
	case SRVOVRFLW_TAG:
	    GetSrvOverflow(&error);
	    recordCounts[SRVOVRFLW]++;
	    break;
	case IOTINFO_TAG:
	    GetIotInfo(&error);
	    recordCounts[IOTINFO]++;
	    break;
	case IOTSTAT_TAG:
	    GetIotStats(&error);
	    recordCounts[IOTSTAT]++;
	    break;
	case SUBTREE_TAG:
	    GetSubtree(&error);
	    recordCounts[SUBTREE]++;
	    break;
	case REPAIR_TAG:
	    GetRepair(&error);
	    recordCounts[REPAIR]++;
	    break;
	case RWSSTAT_TAG:
	    GetRwsStats(&error);
	    recordCounts[RWSSTAT]++;
	    break;
	default:
	    LogMsg(1,LogLevel,LogFile,"main: bogus rt (%d)", rt);
	    error = mtrue;
	}
	if (error == mtrue) {
	    everError = mtrue;
	    LogErrorPoint(recordCounts);
	    error = mfalse;
	}
    }
    fclose(DataFile);
    if (everError == mfalse) 
    {
	if (removeOnDone == mtrue)
	{
	    if (unlink(file))
		LogMsg(0,LogLevel,LogFile,"Could not unlink %s, but spooled it with no errors",
		       file);
	}
    } else
	LogMsg(0,LogLevel,LogFile,"Error spooling file %s",file);
}