Пример #1
0
BOOL CRectItem::UpdateExtent()
{
	// get size in pixels
	CSize size;
	if (!GetCachedExtent(&size))
		return FALSE;       // blank
	Invalidate();   // invalidate the old size/position
	CSize sizeBase = GetBaseSize();
	if (size == sizeBase) // no change
		return FALSE;
	// if new object (i.e. m_extent is empty) setup position
	if (sizeBase == CSize(0,0))
	{
		// convert to document coords
		CSize sizeNew(MulDiv(size.cx, 10, 254), - MulDiv(size.cy, 10, 254));
		SetSize(sizeNew);
	}
	else
	{
		if (!IsInPlaceActive() && size != sizeBase)
		{
			// data changed and not inplace, so scale up rect as well
			CSize sizeCur = GetSize();
			sizeCur.cx = MulDiv(sizeCur.cx, size.cx, sizeBase.cx);
			sizeCur.cy = - MulDiv(-sizeCur.cy, size.cy, sizeBase.cy);
			SetSize(sizeCur);
		}
	}
	SetBaseSize(size);
	Invalidate();   // as well as the new size/position
	return TRUE;
}
Пример #2
0
void CRectItem::ResetSize()
{
	ASSERT_VALID(this);
	Invalidate();
	SetBaseSize(CSize(0, 0));
	UpdateExtent();
}
Пример #3
0
CAICHHashTree::CAICHHashTree(uint64 nDataSize, bool bLeftBranch, uint64 nBaseSize){
	m_nDataSize = nDataSize;
	SetBaseSize(nBaseSize);
	m_bIsLeftBranch = bLeftBranch;
	m_pLeftTree = NULL;
	m_pRightTree = NULL;
	m_bHashValid = false;
}