#include <pathedit.h>
Inheritance diagram for OpNewPath:
Public Member Functions | |
OpNewPath () | |
void | DoStartDragEdit (DocCoord, DocCoord, Spread *, ClickModifiers Mods, BOOL MakeCurve, BOOL MakeSmooth) |
This is called when a Drag operation has been started when the user wants to add a new path. FirstPoint comes from the floating endpoint, and LastPoint comes from the new click position. | |
virtual void | DragFinished (DocCoord Pos, ClickModifiers Mods, Spread *pSpread, BOOL Success, BOOL bSolidDrag) |
This routine handles the end of the drag operation when adding a new path to the tree. | |
Static Public Member Functions | |
static BOOL | Init () |
Adds the operation to the list of all known operations. | |
static OpState | GetState (String_256 *Description, OpDescriptor *) |
Find out the state of the operation at the specific time. | |
Protected Member Functions | |
BOOL | BuildEditPath (DocCoord FirstPoint, DocCoord LastPoint) |
Builds a new path consisting of one curve or line element. | |
Protected Attributes | |
INT32 | NewPointIndex |
INT32 | InsertPosition |
BezierTool * | pBezTool |
BOOL | AddCurveFlag |
BOOL | AddSmoothFlag |
Definition at line 456 of file pathedit.h.
|
Definition at line 463 of file pathedit.h. 00463 : OpNodePathEditBlob() { };
|
|
Builds a new path consisting of one curve or line element.
Definition at line 5708 of file pathedit.cpp. 05709 { 05710 // We only need 4 elements in the path to begin with 05711 if (!EditPath.Initialise(4, 4)) 05712 return FALSE; 05713 05714 // Create the path. 05715 EditPath.InsertMoveTo(FirstPoint); 05716 if (AddCurveFlag) 05717 EditPath.InsertCurveTo(LastPoint, LastPoint, LastPoint); 05718 else 05719 EditPath.InsertLineTo(LastPoint); 05720 05721 // Set the smoothing bits on all points 05722 PathFlags* Flags = EditPath.GetFlagArray(); 05723 INT32 NumCoords = EditPath.GetNumCoords(); 05724 for (INT32 i=0;i<NumCoords;i++) 05725 { 05726 Flags[i].IsSmooth = TRUE; 05727 Flags[i].IsRotate = AddSmoothFlag; 05728 } 05729 05730 // Now select the endpoint and the previous control point 05731 if (AddCurveFlag) 05732 { 05733 Flags[2].IsSelected = Flags[3].IsSelected = TRUE; 05734 Flags[0].NeedToRender = Flags[3].NeedToRender = TRUE; 05735 } 05736 else 05737 { 05738 Flags[1].IsSelected = TRUE; 05739 Flags[0].NeedToRender = Flags[1].NeedToRender = TRUE; 05740 } 05741 05742 EditPath.SmoothCurve(); 05743 05744 // It worked 05745 return TRUE; 05746 }
|
|
This is called when a Drag operation has been started when the user wants to add a new path. FirstPoint comes from the floating endpoint, and LastPoint comes from the new click position.
Definition at line 5644 of file pathedit.cpp. 05646 { 05647 ConstrainPoint = FirstPoint; 05648 ConstrainPrevPoint = FirstPoint; 05649 ConstrainNextPoint = FirstPoint; 05650 // Constrain the anchor and snap it to the grid 05651 ERROR3IF(ConstrainPoint == DocCoord(-1,-1),"DragConstrainPoint wasn't set"); 05652 if (Mods.Constrain) 05653 DocView::ConstrainToAngle(ConstrainPoint, &LastPoint); 05654 DocView::SnapCurrent(pSpread, &LastPoint); 05655 05656 // We had better take a note of the starting point of the drag 05657 StartMousePos = FirstPoint; 05658 LastMousePos = LastPoint; 05659 StartSpread = pSpread; 05660 AddCurveFlag = MakeCurve; 05661 AddSmoothFlag = MakeSmooth; 05662 05663 BOOL ok = CreateCursors(); 05664 05665 // We also need to make a version of the path that we can change 05666 if (ok) 05667 ok = BuildEditPath(FirstPoint, LastPoint); 05668 05669 // Set UpdatePoint so the position of the dragged point is shown in the infobar 05670 if (AddCurveFlag) 05671 UpdatePoint = 3; 05672 else 05673 UpdatePoint = 1; 05674 05675 // Start the drag 05676 if (ok) 05677 { 05678 // Render the bits of the path that are different 05679 DocRect EditPathBBox = EditPath.GetBoundingRect(); 05680 // RenderPathEditBlobs(EditPathBBox, pSpread); 05681 05682 // And tell the Dragging system that we need drags to happen 05683 ok = StartDrag(DRAGTYPE_AUTOSCROLL, &EditPathBBox, &LastMousePos); 05684 } 05685 05686 if (!ok) 05687 { 05688 InformError(); 05689 FailAndExecute(); 05690 End(); 05691 } 05692 }
|
|
This routine handles the end of the drag operation when adding a new path to the tree.
Reimplemented from OpNodePathEditBlob. Definition at line 5771 of file pathedit.cpp. 05772 { 05773 // Stop the drag 05774 RenderPathEditBlobs( EditPath.GetBoundingRect(), StartSpread ); 05775 EndDrag(); 05776 DestroyCursors(); 05777 BeginSlowJob(); 05778 05779 BOOL ok = TRUE; 05780 NodePath* NewPath = NULL; 05781 Document* pDoc = GetWorkingDoc(); 05782 ERROR3IF(pDoc == NULL, "Null Document while setting attributes for new NodePath"); 05783 05784 if (Success && (pDoc != NULL)) 05785 { 05786 ok = DoStartSelOp(FALSE); 05787 05788 // Create a path to hold the data 05789 NodePath* NewPath = new NodePath; 05790 ok = (NewPath != NULL); 05791 05792 // Initialise the path 05793 if (ok) 05794 ok = NewPath->SetUpPath(24, 12); 05795 05796 // Copy the data from the edit path to the new path 05797 if (ok) 05798 ok = NewPath->InkPath.CopyPathDataFrom(&EditPath); 05799 05800 // Apply attributes to the new node 05801 if (ok) 05802 ok = pDoc->GetAttributeMgr().ApplyCurrentAttribsToNode((NodeRenderableInk*)NewPath); 05803 05804 // Insert the new node into the tree 05805 if (ok) 05806 ok = DoInsertNewNode(NewPath, pSpread, TRUE); 05807 05808 // Here we have to clear the floating endpoint condition that prevails in the line tool. 05809 // To avoid grief in tool DLL builds lets just broadcast a message saying an new 05810 // path has been created. The line tool picks up this message and clears its floating endpoint 05811 if (ok) 05812 BROADCAST_TO_ALL(NewPathCreatedMsg(NewPath, this, &UndoActions)); 05813 } 05814 else 05815 { 05816 // Set up the flags that say it all went wrong 05817 FailAndExecute(); 05818 } 05819 05820 // Clean up after failure 05821 if (!ok) 05822 { 05823 if (NewPath != NULL) 05824 { 05825 NewPath->CascadeDelete(); 05826 delete NewPath; 05827 } 05828 FailAndExecute(); 05829 } 05830 05831 End(); 05832 }
|
|
Find out the state of the operation at the specific time.
Reimplemented from OpNodePathEditBlob. Definition at line 5612 of file pathedit.cpp. 05613 { 05614 OpState Blobby; 05615 05616 return Blobby; 05617 }
|
|
Adds the operation to the list of all known operations.
Reimplemented from OpNodePathEditBlob. Definition at line 5585 of file pathedit.cpp. 05586 { 05587 return (RegisterOpDescriptor( 0, 05588 _R(IDS_NODEPATH_NEWPATH), 05589 CC_RUNTIME_CLASS(OpNewPath), 05590 OPTOKEN_NODEPATH, 05591 OpNewPath::GetState, 05592 0, // help ID 05593 _R(IDBBL_NODEPATHOP), 05594 0 ) ); // bitmap ID 05595 }
|
|
Definition at line 487 of file pathedit.h. |
|
Definition at line 488 of file pathedit.h. |
|
Definition at line 485 of file pathedit.h. |
|
Definition at line 484 of file pathedit.h. |
|
Definition at line 486 of file pathedit.h. |