DocRect OpDragBox::CalcDragBox(const DocCoord& dcStartPos, const DocCoord& dcMousePos) const { return DocRect(Min(dcStartPos.x, dcMousePos.x), Min(dcStartPos.y, dcMousePos.y), Max(dcStartPos.x, dcMousePos.x), Max(dcStartPos.y, dcMousePos.y)); }
void DisplayDirector::MouseDown(int x, int y) { BPoint mousePoint(x, y); View* view = WindowView(); // hit the hotspot if (hotspot && hotspot->ContainsPoint(ViewToDoc(mousePoint))) hotspot->Clicked(this); // extend the selection else if ((view->CurModifiers() & B_SHIFT_KEY) != 0) ExtendSelection(); // promote or drag the selection else if (selection && selection->ContainsPoint(ViewToDoc(mousePoint))) { if (view->CurClicks() > 1) { StartRefreshCycle(); selection->Promote(this); FinishRefreshCycle(); ExtendSelection(); } else DragSelection(mousePoint); } // otherwise find a new selection else { if (DocRect().Contains(mousePoint)) FindSelection(); else SetSelection(NULL); } }
DocRect AttrWebAddress::GetClickableRectangle() { //Get our parent Node* pNode=FindParent(); //If it's not an object, return a NULL value if (pNode==NULL) return DocRect(0,0,0,0); if (!pNode->IsAnObject()) return DocRect(0,0,0,0); //Otherwise, return the bounding box of that object return (((NodeRenderableBounded*)pNode)->GetImagemapClickableRectangle()); }
WebAddressAttribute::WebAddressAttribute(const WebAddressAttribute& waaCopy) { //Set our member variables to NULL m_pcFrame=NULL; m_rectClickableInRendering=DocRect(0,0,0,0); //Simply use the assigment operator *this=waaCopy; }
DocRect OpCentredDragBox::CalcDragBox(const DocCoord& dcStartPos, const DocCoord& dcMousePos) const { // Find the half of the absolute width and height of the drag box. MILLIPOINT nWidth2 = dcStartPos.x - dcMousePos.x; if (nWidth2 < 0) nWidth2 = -nWidth2; MILLIPOINT nHeight2 = dcStartPos.y - dcMousePos.y; if (nHeight2 < 0) nHeight2 = -nHeight2; // Return a rectangle of this width and height centre on the click point. return DocRect(dcStartPos.x - nWidth2, dcStartPos.y - nHeight2, dcStartPos.x + nWidth2, dcStartPos.y + nHeight2); }
WebAddressAttribute::WebAddressAttribute(WebAddress url, BOOL fBounding, TCHAR* pcFrame) { //First set our member variable string pointer to NULL, //so that CopyString doesn't try to delete it m_pcFrame=NULL; //Then copy everything into our member variables m_url=url; CopyString(&m_pcFrame, pcFrame); m_fBounding=fBounding; //And set the clickable in rendering rectangle to a zero value //(See header file for a description of this variable) m_rectClickableInRendering=DocRect(0,0,0,0); }
Capture::Capture() { m_pOwner = NULL; m_pDirectBitmapSupplier = NULL; m_pClipRegionAttrValue = NULL; CaptureRect = DocRect(0,0,0,0); lpBitmapInfo = NULL; lpBits = NULL; CaptureMatrix = Matrix(); pColContext = NULL; info = CAPTUREINFO(ctDISABLED, cfNONE); dPixelsPerInch = 96; // m_ClipRegionMap.InitHashTable(17, FALSE); }
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 }
DocRect ArrowRec::GetArrowBoundingRect(Path* pParent, INT32 ParentLineWidth, BOOL StartArrow) { if (IsNullArrow()) return DocRect(0,0,0,0); // Hopefully we won't be asked for our bounds // if we are NULL. But just in case ... // We will now try and find the total bounds of the ArrowHeads, // on this path. The path may be made up of many subpaths, so // we'll need to union the bounds of each ArrowHead on the end // of each subpath. DocRect Bounds(0,0,0,0); INT32 PathIndex = 0; DocCoord ArrowCentre; DocCoord ArrowDirection; DocCoord* Coords = pParent->GetCoordArray(); PathVerb* Verbs = pParent->GetVerbArray(); INT32 NumCoords = pParent->GetNumCoords(); // Find the first position of an ArrowHead BOOL GotPos = GetFirstArrowPos(StartArrow, Coords, Verbs, NumCoords, &PathIndex, &ArrowCentre, &ArrowDirection); while (GotPos) { // Union all the Bounds of the Arrows on each subpath Bounds = Bounds.Union(FindBoundsAt(ArrowCentre, ArrowDirection, ParentLineWidth)); // Find the next Arrow position (if there are any more subpaths) GotPos = GetNextArrowPos(StartArrow, Coords, Verbs, NumCoords, &PathIndex, &ArrowCentre, &ArrowDirection); } // Return the Union of all the arrow bounds return Bounds; }
DocRect NodeSimpleShape::GetBlobBoundingRect() { #if !defined(EXCLUDE_FROM_RALPH) // Find the Shapes bounding rectangle DocRect Rect = GetBoundingRect(); // Find the blob manager BlobManager* pBlobMgr = GetApplication()->GetBlobManager(); // And if we can find the current view, add on the size of a selection blob if (pBlobMgr!= NULL) { // Wee need to add in each of the blobs. there is a blob on each corner // of the parallelogram DocRect BlobSize; pBlobMgr->GetBlobRect(Parallel[0], &BlobSize); Rect = Rect.Union(BlobSize); // Next corner of the parallelogram pBlobMgr->GetBlobRect(Parallel[1], &BlobSize); Rect = Rect.Union(BlobSize); // and the next pBlobMgr->GetBlobRect(Parallel[2], &BlobSize); Rect = Rect.Union(BlobSize); // and the last one pBlobMgr->GetBlobRect(Parallel[3], &BlobSize); Rect = Rect.Union(BlobSize); } // Make sure we include the Bounds of our children IncludeChildrensBoundingRects(&Rect); // return the rectangle with the blobs included return Rect; #else return DocRect(0,0,0,0); #endif }
DocRect NodeEllipse::GetBlobBoundingRect() { #if !defined(EXCLUDE_FROM_RALPH) // Find the paths bounding rectangle DocRect ShapeRect = GetBoundingRect(); DocRect Rect(Parallel[0], Parallel[0]); Rect.IncludePoint(Parallel[1]); Rect.IncludePoint(Parallel[2]); Rect.IncludePoint(Parallel[3]); // Find the blob manager BlobManager* pBlobMgr = GetApplication()->GetBlobManager(); // Get a rect to put the extra rectangle on DocRect BlobRect; // Get the rect round a blob in the corner of the ellipse and add it to the total DocCoord Corner = Rect.HighCorner(); pBlobMgr->GetBlobRect(Corner, &BlobRect); Rect = Rect.Union(BlobRect); // and the same with the other corner Corner = Rect.LowCorner(); pBlobMgr->GetBlobRect(Corner, &BlobRect); Rect = Rect.Union(BlobRect); // and union it with the rect of the shape or things like Linewidth get in the way Rect = Rect.Union(ShapeRect); // Make sure we include the Bounds of our children IncludeChildrensBoundingRects(&Rect); // return the rectangle with the blobs included return Rect; #else return DocRect(0,0,0,0); #endif }
DocRect NodeAttribute::GetAttrBoundingRect(NodeRenderableInk* pParent, CCAttrMap* pAttribMap) { return DocRect(0,0,0,0); }