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(); } }
/******************************************************************************************** > BOOL MakeBitmapFilter::FindCentreInsertionPosition(Spread** Spread, DocCoord* Position) Author: Will_Cowling (Xara Group Ltd) <*****@*****.**> (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; }
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; }