本文整理汇总了C++中DocRect::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ DocRect::IsValid方法的具体用法?C++ DocRect::IsValid怎么用?C++ DocRect::IsValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocRect
的用法示例。
在下文中一共展示了DocRect::IsValid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DragPointerMove
void OpDragBox::DragPointerMove(DocCoord dcMousePos, ClickModifiers cmods, Spread* pSpread, BOOL bSolidDrag)
{
// If the mouse has moved to another spread than translate its position into the
// new spread's coordinate system.
if (pSpread != m_pStartSpread && pSpread != NULL)
{
dcMousePos = MakeRelativeToSpread(m_pStartSpread, pSpread, dcMousePos);
}
// Calculate the new drag rectangle.
DocRect drNewDragBox = CalcDragBox(m_dcStartPos, dcMousePos);
ERROR3IF(!drNewDragBox.IsValid(), "Invalid drag box in OpDragBox::DragPointerMove");
// Call the appropriate update function, according to whether we are drawing solid
// drag boxes or unfilled drag boxes.
if (m_fDoSolidDragBoxes)
{
UpdateSolidDragBox(drNewDragBox);
}
else
{
UpdateUnfilledDragBox(drNewDragBox);
}
// Update our record of the last drag box and call the derived class.
if (!OnPointerMoved(m_pStartSpread, m_drLastDragBox = drNewDragBox, cmods))
{
// Cancel the drag and operation.
EndDrag();
End();
}
}
示例2: FindCentreInsertionPosition
/********************************************************************************************
> BOOL MakeBitmapFilter::FindCentreInsertionPosition(Spread** Spread, DocCoord* Position)
Author: Will_Cowling (Xara Group Ltd) <[email protected]> (from Simon)
Created: 12/6/96
Inputs: -
Outputs: Spread: The spread to place the clipboard objects on
Position:The centre of the view (Spread coords)
Purpose: Finds the centre insertion position for clipboard objects
********************************************************************************************/
BOOL MakeBitmapFilter::FindCentreInsertionPosition(Spread** Spread, DocCoord* Position)
{
// ---------------------------------------------------------------------------------
// Find out which spread is in the centre of the view
// this is the spread that the pasted objects will be placed on
// Obtain the current DocView
DocView* CurDocView = DocView::GetCurrent();
ENSURE(CurDocView != NULL, "The current DocView is NULL");
if (CurDocView == NULL)
return FALSE; // No DocView
// Get the view rect
WorkRect WrkViewRect = CurDocView->GetViewRect();
if (WrkViewRect.IsEmpty() || (!WrkViewRect.IsValid()) )
return FALSE; // Defensive
// Determine the centre of the view
WorkCoord WrkCentreOfView;
WrkCentreOfView.x = WrkViewRect.lox + (WrkViewRect.Width()/2);
WrkCentreOfView.y = WrkViewRect.loy + (WrkViewRect.Height()/2);
// FindEnclosing spread requires an OilCoord
OilCoord OilCentreOfView = WrkCentreOfView.ToOil(CurDocView->GetScrollOffsets());
// Find out which spread to insert the pasteboard objects onto
(*Spread) = CurDocView->FindEnclosingSpread(OilCentreOfView);
if ((*Spread) == NULL)
return FALSE; // There is no spread
// Phew
// ---------------------------------------------------------------------------------
// Now lets find the spread coordinate of the centre of the view
DocRect DocViewRect = CurDocView->GetDocViewRect(*Spread);
if ( DocViewRect.IsEmpty() || (!DocViewRect.IsValid()) )
{
ERROR3("DocViewRect is invalid");
return FALSE; // Defensive
}
// Find the centre of the DocViewRect
DocCoord DocCentreOfView;
DocCentreOfView.x = DocViewRect.lox + (DocViewRect.Width()/2);
DocCentreOfView.y = DocViewRect.loy + (DocViewRect.Height()/2);
// --------------------------------------------------------------------------------
// Now convert from DocCoords to spread coords
DocRect PhysSpreadRect = (*Spread)->GetPasteboardRect();
(*Position).x = DocCentreOfView.x - PhysSpreadRect.lo.x;
(*Position).y = DocCentreOfView.y - PhysSpreadRect.lo.y;
return TRUE;
}
示例3: WriteClipRegion
BOOL PrintPSRenderRegion::WriteClipRegion(KernelDC *pDC, const DocRect& Rect)
{
if (!Rect.IsValid() || Rect.IsEmpty())
return TRUE;
DocCoord c0,c1;
c0=Rect.lo;
c1=Rect.hi;
BOOL ok = pDC->OutputCoord(c0);
ok = ok && pDC->OutputCoord(c1);
ok = ok && pDC->OutputToken(TEXT("Cp"));
ok = ok && pDC->OutputNewLine();
return ok;
}