#include <moldedit.h>
Inheritance diagram for OpDragOrigin:
Public Member Functions | |
OpDragOrigin () | |
Constructs an Operation that allows the user to drag vanishing points of a perspective mould. | |
void | DoDragVanishPoint (Spread *, const DocCoord &, ClickModifiers, NodeMould *, BOOL) |
Starts a drag of one of the perspective moulds vanishing points. Note, a lot of effort has been put into the redraw of perspectives when dragging vanishing points. We must make sure the vanishing point rectangles are redrawn separately to the actual mould contents. If not it is v likely that you will get a huge rectangle as a result of the union. Redrawing this area is very bad. Also note, we do not drag a copy of the envelope or perspective control polygon but the control polygon itself. This means we must make sure when we scroll we prevent the mould object from attempting to eor its blobs on, this has the tendancy to leave large amounts of unsightly eor all over the place. | |
virtual void | DragPointerMove (DocCoord Pos, ClickModifiers Mods, Spread *pSpread, BOOL bSolidDrag) |
Called while the vanishing point is being dragged around. Erases it from its old position and redraws it at its new position. | |
virtual void | DragFinished (DocCoord Pos, ClickModifiers Mods, Spread *pSpread, BOOL Success, BOOL bSolidDrag) |
Update the perspective mould object with the final resting place of this mould vanishing point. | |
virtual void | RenderDragBlobs (DocRect, Spread *, BOOL bSolidDrag) |
Draws the drag path and new vanishing point positions. | |
virtual void | GetOpName (String_256 *OpName) |
The GetOpName fn is overridden so that we return back a description appropriate to this type of operation. | |
Static Public Member Functions | |
static BOOL | Init () |
Registers the rotation centre drag Operation. | |
static OpState | GetState (String_256 *Description, OpDescriptor *) |
Controls whether the rotation-centre mouse drag operation is available or not. Currently, is always available (the internal logic of the selector tool & info-bar handle this really). | |
Private Member Functions | |
CC_DECLARE_DYNCREATE (OpDragOrigin) | |
DocRect | CalcBlobClipRect () |
Constructs a rectangle that surrounds the objects we are eoring. | |
Private Attributes | |
Spread * | StartSpread |
NodeMould * | pEditMould |
NodeMouldPath * | pEditMouldPath |
Path * | pEditPath |
MouldPerspective * | pEditGeometry |
DocRect | EditRect |
DocCoord | Blob |
Definition at line 363 of file moldedit.h.
|
Constructs an Operation that allows the user to drag vanishing points of a perspective mould.
Definition at line 1574 of file moldedit.cpp. 01575 { 01576 StartSpread = NULL; 01577 pEditMould = NULL; 01578 pEditMouldPath = NULL; 01579 pEditPath = NULL; 01580 pEditGeometry = NULL; 01581 }
|
|
Constructs a rectangle that surrounds the objects we are eoring.
Definition at line 1922 of file moldedit.cpp. 01923 { 01924 // get the current vanish point clip rects 01925 DocRect Rect0 = pEditGeometry->GetBlobBoundingRect(); 01926 DocRect Rect1 = pEditMouldPath->GetBlobBoundingRect(); 01927 01928 return Rect0.Union(Rect1); 01929 }
|
|
|
|
Starts a drag of one of the perspective moulds vanishing points. Note, a lot of effort has been put into the redraw of perspectives when dragging vanishing points. We must make sure the vanishing point rectangles are redrawn separately to the actual mould contents. If not it is v likely that you will get a huge rectangle as a result of the union. Redrawing this area is very bad. Also note, we do not drag a copy of the envelope or perspective control polygon but the control polygon itself. This means we must make sure when we scroll we prevent the mould object from attempting to eor its blobs on, this has the tendancy to leave large amounts of unsightly eor all over the place.
Definition at line 1684 of file moldedit.cpp. 01689 { 01690 ERROR3IF(pMould==NULL,"DoDragVanishPoint() given a null mould object"); 01691 DocCoord v0,v1; 01692 01693 // Remember the starting positions etc and initiate a drag. 01694 StartSpread = pSpread; 01695 pEditMould = pMould; 01696 01697 // try to find the geometry 01698 MouldGeometry* pGeometry = pMould->GetGeometry(); 01699 if (!pGeometry->IsKindOf(CC_RUNTIME_CLASS(MouldPerspective))) 01700 { 01701 ERROR3("DoDragVanishPoint() called on an illegal geometry"); 01702 goto Failed; 01703 } 01704 01705 pEditGeometry = (MouldPerspective*)pGeometry; 01706 01707 // read the current vanishing point positions for this mould. 01708 pEditGeometry->GetVanishingPoints(v0,v1); 01709 WhichBlob ? (Blob=v1) : (Blob=v0); 01710 01711 // get hold of the moulds nodepath object 01712 pEditMouldPath = pMould->GetPathShape(); 01713 if (!pEditMouldPath) 01714 goto Failed; 01715 01716 // cache the actual path shape 01717 pEditPath = &(pEditMouldPath->InkPath); 01718 01719 // record an action to redraw the node in its current state during undo/redo 01720 // we use our own special action to do this RecordBoundsAction uses the nasty 01721 // GetUnionBlobBounds() which unions the vanishing points in there too. 01722 // PS.. Pass FALSE into this function to avoid redraw at this stage 01723 if (RedrawBoundsAction::DoRecord(this,pEditMould,FALSE)==AC_FAIL) 01724 goto Failed; 01725 01726 // Save the current rectangular bounds to redraw after the dragop has finished 01727 OpDragOrigin::EditRect = pMould->GetChildrensBounds(); 01728 01729 // record the current path data, ie its flags,verbs & coords 01730 if ((pEditMould->StartSaveContext(this, REC_REBUILD | REC_BLOBS | REC_GEOMCONTEXT | REC_PATHARRAYS)) == CC_FAIL) 01731 goto Failed; 01732 01733 /* if (SavePathArraysAction::DoRecord(this, &UndoActions, pEditPath) == AC_FAIL) 01734 goto Failed; 01735 01736 // record the current mould shape on the undo and any blob rectangles 01737 if (pEditMould->SaveContext(this)==CC_FAIL) 01738 goto Failed; 01739 */ 01740 // turn the display blobs off to prevent the mould from drawing them on 01741 // during a scroll. 01742 pEditMould->DisableBlobs(); 01743 01744 // start off the drag and get ready 01745 StartDrag(DRAGTYPE_AUTOSCROLL); 01746 return; 01747 01748 Failed: 01749 FailAndExecute(); 01750 End(); 01751 }
|
|
Update the perspective mould object with the final resting place of this mould vanishing point.
Reimplemented from Operation. Definition at line 1815 of file moldedit.cpp. 01820 { 01821 EndDrag(); 01822 Document* pDoc = Document::GetCurrent(); 01823 NodeAttribute* pNA = NULL; 01824 01825 // Make sure the nodes blob rendering is enabled again 01826 pEditMould->EnableBlobs(); 01827 01828 // Act on the termination status of the drag operation. 01829 if (!success) 01830 { 01831 // Get rid of what ever new stuff we have, the unwind handler will 01832 // cause our original stuff to be replaced. 01833 RenderDragBlobs(CalcBlobClipRect(), StartSpread, bSolidDrag); 01834 goto Failed; 01835 } 01836 01837 // Turn that hourglass on 01838 BeginSlowJob(); 01839 01840 // Make sure we invalidate the edit object 01841 pEditMouldPath->InvalidateBoundingRect(); 01842 01843 // Force a redraw on the original position. 01844 // Note, we cannot do this before we start dragging as EORing goes mad! 01845 if (pDoc) 01846 pDoc->ForceRedraw( StartSpread, OpDragOrigin::EditRect, FALSE, pEditMould); 01847 01848 if (pEditMould->RemouldAll(this)==CC_FAIL) 01849 goto Failed; 01850 01851 // Ilan 7/5/00 01852 // Inform geom linked attrs of the change. Nb outside the normal AllowOp mechanism 01853 pNA = pEditMould->FindFirstGeometryLinkedAttr(); 01854 while(pNA) 01855 { 01856 pNA->LinkedNodeGeometryHasChanged(this); 01857 pNA = pNA->FindNextGeometryLinkedAttr(); 01858 } 01859 01860 if ((pEditMould->EndSaveContext(this, REC_REBUILD | REC_BLOBS | REC_GEOMCONTEXT | REC_PATHARRAYS)) == CC_FAIL) 01861 goto Failed; 01862 01863 // record an action to redraw the state of the mould (but not vanishpoints) 01864 if (RedrawBoundsAction::DoRecord(this,pEditMould,TRUE)==AC_FAIL) 01865 goto Failed; 01866 01867 // record the vanish points separately (important to avoid unionblobbounds()!) 01868 if (pEditGeometry->RecordBlobs(this,StartSpread)==CC_FAIL) 01869 goto Failed; 01870 01871 End(); 01872 return; 01873 01874 Failed: 01875 FailAndExecute(); 01876 End(); 01877 return; 01878 }
|
|
Called while the vanishing point is being dragged around. Erases it from its old position and redraws it at its new position.
Reimplemented from Operation. Definition at line 1770 of file moldedit.cpp. 01771 { 01772 // If the mouse has moved outside the spread the drag was started on then we must 01773 // account for this. 01774 if (pSpread != StartSpread) 01775 dcPos = MakeRelativeToSpread(StartSpread, pSpread, dcPos); 01776 01777 // Erase the old blobs. 01778 RenderDragBlobs(CalcBlobClipRect(), StartSpread, bSolidDrag); 01779 01780 if (pEditGeometry->MoveVanishingPoint(Blob,dcPos)) 01781 { 01782 Blob=dcPos; 01783 // Update the new shape in the path. 01784 DocCoord* pCoords = pEditPath->GetCoordArray(); 01785 pEditGeometry->CopyShape(pCoords); 01786 } 01787 01788 // Draw on the new blobs 01789 RenderDragBlobs(CalcBlobClipRect(), StartSpread, bSolidDrag); 01790 }
|
|
The GetOpName fn is overridden so that we return back a description appropriate to this type of operation.
Reimplemented from Operation. Definition at line 1649 of file moldedit.cpp. 01650 { 01651 *OpName = String_256(_R(IDS_UNDO_DRAGVPOINT)); 01652 }
|
|
Controls whether the rotation-centre mouse drag operation is available or not. Currently, is always available (the internal logic of the selector tool & info-bar handle this really).
Definition at line 1628 of file moldedit.cpp. 01629 { 01630 OpState os; 01631 return os; 01632 }
|
|
Registers the rotation centre drag Operation.
Reimplemented from SimpleCCObject. Definition at line 1598 of file moldedit.cpp. 01599 { 01600 return RegisterOpDescriptor(0, /* _R(IDS_DRAGOriginOP), */ 01601 _R(IDS_DRAGORIGINOP), 01602 CC_RUNTIME_CLASS(OpDragOrigin), 01603 OPTOKEN_DRAGVANISHPOINT, 01604 OpDragOrigin::GetState, 01605 0, 01606 _R(IDBBL_DRAGORIGINOP)); 01607 }
|
|
Draws the drag path and new vanishing point positions.
Reimplemented from Operation. Definition at line 1895 of file moldedit.cpp. 01896 { 01897 RenderRegion* pRegion = DocView::RenderOnTop(&Clip, pSpread, ClippedEOR); 01898 while (pRegion != NULL) 01899 { 01900 // Get the edit path to render itself 01901 pEditMouldPath->RenderObjectBlobs(pRegion); 01902 pEditGeometry->RenderControlBlobs(pRegion); 01903 01904 pRegion = DocView::GetNextOnTop(&Clip); 01905 } 01906 }
|
|
Definition at line 389 of file moldedit.h. |
|
Definition at line 388 of file moldedit.h. |
|
Definition at line 387 of file moldedit.h. |
|
Definition at line 384 of file moldedit.h. |
|
Definition at line 385 of file moldedit.h. |
|
Definition at line 386 of file moldedit.h. |
|
Definition at line 383 of file moldedit.h. |