本文整理汇总了C++中DocRect类的典型用法代码示例。如果您正苦于以下问题:C++ DocRect类的具体用法?C++ DocRect怎么用?C++ DocRect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DocRect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindEnclosingChapter
Chapter* DocCoord::FindEnclosingChapter(Document *pDocument,
DocCoord* ChapterPos,
XLONG* ChapterDepth,
View *pView)
{
Chapter* CurrentChapter = Node::FindFirstChapter(pDocument);
// Search all chapters
*ChapterDepth = 0;
DocRect CurrentChaptersPasteboardRect;
while (CurrentChapter != NULL)
{
CurrentChaptersPasteboardRect = CurrentChapter->GetPasteboardRect(TRUE, pView);
if (CurrentChaptersPasteboardRect.ContainsRectCoord(*this))
{
// Chapter position is the top left hand corner of the chapters pasteboard
ChapterPos->x = CurrentChaptersPasteboardRect.LowCorner().x;
ChapterPos->y = CurrentChaptersPasteboardRect.HighCorner().y;
return (CurrentChapter);
}
(*ChapterDepth) += CurrentChaptersPasteboardRect.Height();
CurrentChapter = CurrentChapter->FindNextChapter();
}
// The DocCoord was not found in any chapter
ERROR3("DocCoord::FindEnclosingChapter: Coord wasn't in any chapter. See the function help for debugging tips");
return(NULL);
}
示例2: MakeRelativeToSpread
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();
}
}
示例3: GetBoundingRect
void NodeBrush::RenderObjectBlobs(RenderRegion* pRegion)
{
#if !defined(EXCLUDE_FROM_RALPH)
// Find out about the groups bounding rect
DocRect BoundingRect = GetBoundingRect();
// Inflate the bounds by the width of a blob
DocRect TempRect;
GetApplication()->GetBlobManager()->GetBlobRect(BoundingRect.lo,&TempRect);
INT32 Delta = ((TempRect.hi.x - TempRect.lo.x)*3)/4;
BoundingRect.Inflate(Delta);
// Find out where to draw the blobs
DocCoord Low = BoundingRect.LowCorner();
DocCoord High = BoundingRect.HighCorner();
// Set the colours of the blobs
pRegion->SetFillColour(COLOUR_UNSELECTEDBLOB);
pRegion->SetLineColour(COLOUR_NONE);
// Draw all the blobs
pRegion->DrawBlob(Low, BT_UNSELECTED);
pRegion->DrawBlob(High, BT_UNSELECTED);
pRegion->DrawBlob(DocCoord(Low.x, High.y), BT_UNSELECTED);
pRegion->DrawBlob(DocCoord(High.x, Low.y), BT_UNSELECTED);
// for some reason the NBP is never called, there is probably a
// proper fix for this but I don't have time right now, so render
// the nodeblend path here
m_pNodeBrushPath->RenderObjectBlobs(pRegion);
#endif
}
示例4: FindParent
XLONG Chapter::GetChapterDepth()
{
XLONG Depth = 0;
// Loop through document tree calculating the logical coordinate offset for the
// current chapter
// Chapter *pChapter = Node::FindFirstChapter(FindOwnerDoc());
Node* pNode = FindParent();
ERROR2IF(!(pNode->IsNodeDocument()), 0, "Parent of Chapter is not NodeDocument");
Chapter *pChapter = (Chapter*)pNode->FindFirstChild(CC_RUNTIME_CLASS(Chapter));
ENSURE(pChapter != NULL, "Couldn't find first chapter in Chapter::GetChapterDepth");
while ((pChapter != NULL) && (pChapter != this))
{
ENSURE(pChapter->IsKindOf(CC_RUNTIME_CLASS(Chapter)),
"Chapter's sibling is not a Chapter");
const DocRect ChapRect = pChapter->GetPasteboardRect();
// Accumulate logical offset
Depth += ChapRect.Height();
pChapter = (Chapter *) pChapter->FindNext();
}
return Depth;
}
示例5: GetApplication
BOOL NodeSimpleShape::IsNearControlHandle(DocCoord Coord, INT32* CoordNum)
{
#if !defined(EXCLUDE_FROM_RALPH)
// Find the blob manager
BlobManager* pBlobMgr = GetApplication()->GetBlobManager();
if (pBlobMgr==NULL)
return FALSE;
// Find out about the size of a blob
DocRect BlobRect;
pBlobMgr->GetBlobRect(Coord, &BlobRect);
// Check to see if it is near any of the blobs
for (INT32 i=0; i<4; i++)
{
// Check for collision with the control points
if (BlobRect.ContainsCoord(Parallel[i]))
{
// Tell them which control point it waas over
*CoordNum = i;
// we have used that click up, so tell the world
return TRUE;
}
}
#endif
// was not over any of the control points
return FALSE;
}
示例6: DoScrollRedraw
void LibraryFile::DoScrollRedraw(void)
{
// Scroll / redraw the newly added groups...
if(FirstLibraryAdded != NULL && LastLibraryAdded != NULL)
{
SGLibGroup *FirstGroup = FirstLibraryAdded->ParentGroup;
SGLibGroup *SecondGroup = LastLibraryAdded->ParentGroup;
if(FirstGroup != NULL && SecondGroup != NULL)
{
// Redraw whatever we need to and reformat the gallery ready for poking...
ParentGallery->ReformatAndRedrawIfNecessary();
// Calculate where the new folders are...
DocRect ScrollToRect;
FirstGroup->GetFormatRect(&ScrollToRect);
if(SecondGroup != FirstGroup)
{
DocRect TempRect;
FirstGroup->GetFormatRect(&TempRect);
ScrollToRect = ScrollToRect.Union(TempRect);
}
// Actually do the scroll...
ParentGallery->ScrollToShow(&ScrollToRect, TRUE);
}
}
}
示例7: Will_Cowling
/********************************************************************************************
> 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;
}
示例8: ERROR2IF
BOOL NativePrefsDlg::InitDialog ()
{
ERROR2IF ( mpParams == NULL, FALSE,
"NativePrefsDlg::InitDialog called after duff initialisation?!" );
//First, do we have a selection?
Application *pApp = GetApplication();
ERROR2IF(pApp == NULL, FALSE,"NativePrefsDlg::InitDialog - no application!");
SelRange *pRange = pApp->FindSelection();
ERROR2IF(pRange == NULL, FALSE,"NativePrefsDlg::InitDialog - no selection range!");
DocRect ClipRect = pRange->GetBoundingRect();
BOOL fThereIsASelection=!ClipRect.IsEmpty();
//Now, is there a selection?
if (fThereIsASelection)
{
// Yes. So ungrey both the buttons for selecting the nodes to export.
EnableGadget(_R(IDC_NATIVEOPTS_SELECT), TRUE);
EnableGadget(_R(IDC_NATIVEOPTS_DRAWING), TRUE);
//Now, which of those buttons should be selected?
switch ( mpParams->GetExportSel () )
{
case SELECTION:
// Choose the export pair of buttons.
SetLongGadgetValue(_R(IDC_NATIVEOPTS_SELECT), FALSE);
SetLongGadgetValue(_R(IDC_NATIVEOPTS_DRAWING), TRUE);
break;
default:
case DRAWING:
// Choose the export pair of buttons.
SetLongGadgetValue(_R(IDC_NATIVEOPTS_SELECT), TRUE);
SetLongGadgetValue(_R(IDC_NATIVEOPTS_DRAWING), FALSE);
break;
}
}
else
{
//No. So grey the SELECTION button and ungrey
//the DRAWING button
EnableGadget(_R(IDC_NATIVEOPTS_SELECT), FALSE);
EnableGadget(_R(IDC_NATIVEOPTS_DRAWING), TRUE);
// And we must select the DRAWING button for the export area controls.
SetLongGadgetValue(_R(IDC_NATIVEOPTS_SELECT), TRUE);
SetLongGadgetValue(_R(IDC_NATIVEOPTS_DRAWING), FALSE);
}
return TRUE;
}
示例9: GetRotateMatrix
Trans2DMatrix* BlendHelpers::GetRotateMatrix(NodeRenderableBounded* pNode,double Angle)
{
Trans2DMatrix* pMatrix = NULL;
if (pNode != NULL && fmod(Angle,360.0) != 0.0)
{
DocRect BoundsStart = pNode->GetBoundingRect();
DocCoord Centre = BoundsStart.Centre();
pMatrix = new Trans2DMatrix(Centre,Angle);
}
return pMatrix;
}
示例10: ERROR2IF
NodeRegularShape * OpBackground::DoCreateRectangle(Spread * pSpread)
{
ERROR2IF(pSpread == NULL,FALSE,"OpBackground::DoCreateRectangle Bad params error!");
if (pSpread == NULL)
return NULL;
// This assumes that we have already checked to see if there is a page covering rectangle
// already present on this layer.
// Create a new rectangle node on the layer
NodeRegularShape *pShape = new NodeRegularShape;
if (pShape != NULL)
{
BOOL ok = pShape->SetUpShape();
if (!ok)
{
// Do something sensible in here
delete pShape;
return NULL;
}
// We want to make the rectangle the same size as the current union of
// all the pages on the current spread
DocRect Rect;
pSpread->GetPagesRect(&Rect);
/* // We must expand the rectangle by a single pixel as the page redraw
// draws a single pixel line around the outside.
const MILLIPOINT pixel = (MILLIPOINT)(72000.0/96.0);
Rect.Inflate(pixel); */
const INT32 CornerRadius = 0; // No curvature
if (pShape->MakeRectangle(Rect.Width(), Rect.Height(), CornerRadius))
{
// Translate centre from 0,0 to required position relative to page
INT32 XTrans = Rect.lo.x + (Rect.Width()/2);
INT32 YTrans = Rect.lo.y + (Rect.Height()/2);
Trans2DMatrix Trans(XTrans, YTrans);
pShape->Transform(Trans);
// finish off the shape
pShape->InvalidateBoundingRect();
}
}
return pShape;
}
示例11: if
void OpDragBox::UpdateSolidDragBox(const DocRect& drNewDragBox)
{
// Set up four update rectangles. We will xor none, some, or all of these rectangles to
// produce the new drag box.
DocRect drUpdate[4];
INT32 nHowMany;
// Find the intersection of the last and new rectangles. We will exclude this from
// any xoring as it is already xored.
DocRect drCommonDragBox = drNewDragBox.Intersection(m_drLastDragBox);
// Calculate the rectangles that need to be xored to change the last into the new
// drag box. This depends on how they overlap.
if (drCommonDragBox.IsEmpty())
{
// There's no intersection between the last drag box and the new drag box, even
// though they share a common corner. So xor the full extent of both drag rects.
drUpdate[0] = m_drLastDragBox;
drUpdate[1] = drNewDragBox;
nHowMany = 2;
}
else if (drNewDragBox.ContainsRect(m_drLastDragBox))
{
// The new drag rect completely contains the last one, so clip out the last.
nHowMany = ((DocRect&) drNewDragBox).SplitRect(m_drLastDragBox, drUpdate);
}
else if (m_drLastDragBox.ContainsRect(drNewDragBox))
{
// The last drag rect completely contains the new one, so clip out the new.
nHowMany = m_drLastDragBox.SplitRect(drNewDragBox, drUpdate);
}
else
{
// The drag rectangles overlap but neither completely contains the other, so set
// the xor rectangles to be each drag rectangle less the common drag rectangle.
nHowMany = m_drLastDragBox.SplitRect(drCommonDragBox, &drUpdate[0]);
nHowMany += ((DocRect&) drNewDragBox).SplitRect(drCommonDragBox, &drUpdate[nHowMany]);
}
// Sanity check.
ERROR3IF(nHowMany < 0 || nHowMany > 4,
"Wrong number of split rects in OpDragBox::UpdateSolidDragBox\n");
// Draw the xor rects.
for (INT32 i = 0; i < nHowMany; i++)
{
DrawXorRect(drUpdate[i], m_pStartSpread, drUpdate[i]);
}
}
示例12: 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;
}
示例13: GetApplication
void LiveEffectsTool::OnMouseMove(DocCoord Coord, Spread* pSpread, ClickModifiers mods)
{
// Stub out this function if the tool isn't wanted
#ifndef NO_ADVANCED_TOOLS
// We are interested in any selected paths that the cursor is over
// we will also be needing the current docview
SelRange* Selected = GetApplication()->FindSelection();
Node* pNode = Selected->FindFirst();
// Check to see if the selection is on the same spread as the mouse
if (pNode!=NULL)
{
// Get the spread and return if it is different from the one with the cursor
Spread* pNodeSpread = pNode->FindParentSpread();
if (pNodeSpread!=pSpread)
return;
}
// Find the Blob manager, so we can find out how big a rect to use
BlobManager* pBlobMgr = GetApplication()->GetBlobManager();
if (pBlobMgr==NULL)
return;
// Find the Rect round the mouse pos that counts as a hit
DocRect BlobRect;
pBlobMgr->GetBlobRect(Coord, &BlobRect);
// Work out the square of the distance that we will count as 'close' to the line
INT32 Range = BlobRect.Width() / 2;
Range *= Range;
// // loop through the selection
// while (pNode!=NULL)
// {
// // Now find the next selected node
// pNode = Selected->FindNext(pNode);
// }
// We did not find anything good, so set the cursor to the normal one
ChangeCursor(pNormalCursor);
// And set the status bar text
StatusMsg.Load(_R(IDS_LIVEEFFECTSTART), Tool::GetModuleID(GetID()));
GetApplication()->UpdateStatusBarText(&StatusMsg);
#endif // NO_ADVANCED_TOOLS
}
示例14: Colin_Barfoot
/********************************************************************************************
> BOOL TipsDlg::DrawBitmap(ResourceID BitmapID, DocRect& RedrawRect)
Author: Colin_Barfoot (Xara Group Ltd) <[email protected]>
Created: 08/08/96
Inputs: BitmapID : the resource id of the bitmap to draw
RedrawRect : the rectangle in which to draw it
Returns: TRUE if drawn OK
FALSE otherwise
Purpose: Renders the given bitmap in the given rectangle
********************************************************************************************/
BOOL TipsDlg::DrawBitmap(ResourceID BitmapID, DocRect& RedrawRect)
{
OILBitmap *pOILBitmap = OILBitmap::Create();
if (pOILBitmap == NULL)
{
return FALSE;
}
if (!pOILBitmap->LoadBitmap(BitmapID))
{
return FALSE;
}
// Centre the bitmap within the RedrawRect
UINT32 bitmapWidth = pOILBitmap->GetRecommendedWidth();
UINT32 bitmapHeight = pOILBitmap->GetRecommendedHeight();
UINT32 xOffset = RedrawRect.lo.x + (RedrawRect.Width() - bitmapWidth) / 2;
UINT32 yOffset = RedrawRect.lo.y + (RedrawRect.Height() - bitmapHeight) / 2;
DocCoord lowCorner(xOffset, yOffset);
DocRect bitmapRect(lowCorner, bitmapWidth, bitmapHeight);
KernelBitmap bitmap(pOILBitmap, TRUE);
// Now we need to create a temporary NodeBitmap, which we will
// use to render the bitmap preview.
NodeBitmap* dummyNode = new NodeBitmap();
if (dummyNode == NULL)
{
return FALSE;
}
// Set the NodeBitmap path to be our RedrawRect and attach the Bitmap to it.
dummyNode->SetUpPath();
dummyNode->CreateShape(bitmapRect);
dummyNode->GetBitmapRef()->SetBitmap(&bitmap);
// Now render the bitmap preview
dummyNode->Render(m_pRenderer);
delete dummyNode;
// All OK
return TRUE;
}
示例15: GetApplication
DocRect NodeBrush::GetBlobBoundingRect()
{
#if !defined(EXCLUDE_FROM_RALPH)
// Find the base class blob bounding rectangle
DocRect Rect = NodeGroup::GetBlobBoundingRect();
// inflate it by the width of a blob (plus a bit)
DocRect TempRect;
GetApplication()->GetBlobManager()->GetBlobRect(Rect.lo,&TempRect);
INT32 Delta = ((TempRect.hi.x - TempRect.lo.x)*1)/1;
Rect.Inflate(Delta);
return Rect;
#else
return DocRect(0,0,0,0);
#endif
}