#include <penedit.h>
Inheritance diagram for OpPenCreatePath:
Public Member Functions | |
OpPenCreatePath () | |
OpPenCreatePath constructor. | |
void | DoPenCreatePath (ControlPts *, DocCoord, Spread *, Path *) |
Creates a path element when the user clicks or drags at a particular point. The edit path will contain the necessary element when the operation has finished. If the operation is not a success, the edit path will contain nothing. | |
virtual void | DragFinished (DocCoord Pos, ClickModifiers Mods, Spread *pSpread, BOOL Success, BOOL bSolidDrag) |
This is called when a drag operation finishes. | |
Static Public Member Functions | |
static BOOL | Init () |
OpPenCreatePath initialiser method. | |
static OpState | GetState (String_256 *, OpDescriptor *) |
For finding the OpPenCreatePath's state. | |
Private Attributes | |
DocCoord | Handle0 |
DocCoord | Handle1 |
Definition at line 415 of file penedit.h.
|
OpPenCreatePath constructor.
Definition at line 1486 of file penedit.cpp.
|
|
Creates a path element when the user clicks or drags at a particular point. The edit path will contain the necessary element when the operation has finished. If the operation is not a success, the edit path will contain nothing.
Definition at line 1576 of file penedit.cpp. 01580 { 01581 // ok, we always create a curve element in the path and descover whether 01582 // the points all lie in a straight line at the end of the drag. If so, we 01583 // will alter the path element back to a line at that stage. 01584 01585 BOOL ok; 01586 01587 pEditPath = pPath; 01588 01589 Handle0 = pHandles->HndClick; 01590 Handle1 = pHandles->HndDrag; 01591 01592 // make the new click point relative to our handle coordinates. 01593 if (pHandles->pHndSpread != pClickSpread) 01594 ClickPoint = MakeRelativeToSpread(pHandles->pHndSpread, pClickSpread, ClickPoint); 01595 01596 // make sure we get the grid snapping involved 01597 DocCoord SnapPos = ClickPoint; 01598 DocView::SnapCurrent(pClickSpread,&SnapPos); 01599 01600 // create the first element in the path 01601 ok = (pEditPath->InsertMoveTo(Handle0, NULL)); 01602 01603 if (ok) 01604 { 01605 DocCoord Cpt1 = Handle1; 01606 if (Handle0 == Handle1) 01607 { 01608 Cpt1.x = (2*Handle0.x + SnapPos.x)/3; 01609 Cpt1.y = (2*Handle0.y + SnapPos.y)/3; 01610 } 01611 DocCoord Cpt2; 01612 Cpt2.x = (Handle1.x + 2*SnapPos.x)/3; 01613 Cpt2.y = (Handle1.y + 2*SnapPos.y)/3; 01614 01615 ok = InsertBezier(Cpt1, Cpt2, SnapPos); 01616 } 01617 01618 if (ok) 01619 { 01620 // Set info about the click point and spread 01621 HandleFlags hFlags; 01622 SetDragHandles(hFlags, SnapPos, SnapPos, SnapPos, pClickSpread); 01623 01624 // Set the edit control to tell the drag code which 01625 // point to overwrite 01626 WobbleFlags wFlags; 01627 SetWobbleIndex(wFlags, 3); 01628 01629 // Render the first eor version on 01630 DocRect Rect = GetBoundingRect(); 01631 RenderDragBlobs(Rect, StartSpread, FALSE); 01632 01633 // Now start the drag op on this path 01634 ok = OpPenEditPath::DoPenDragPath(); 01635 } 01636 01637 if (!ok) 01638 { 01639 // failed to perform create so lets tidy up the path and exit 01640 pEditPath->ClearPath(); 01641 FailAndExecute(); 01642 End(); 01643 } 01644 }
|
|
This is called when a drag operation finishes.
Reimplemented from OpPenEditPath. Definition at line 1665 of file penedit.cpp. 01667 { 01668 // inform the base class to stop dragging 01669 OpPenEditPath::DragFinished( PointerPos, ClickMods, pSpread, Success, bSolidDrag); 01670 01671 // Rub out the old EORed version of the path 01672 DocRect Rect = GetBoundingRect(); 01673 RenderDragBlobs( Rect, StartSpread, bSolidDrag); 01674 01675 if (Success) 01676 { 01677 if (!HasMouseMoved(StartMousePos,CurrentMousePos)) 01678 { 01679 // nothing moved so check to see if we can convert to a line 01680 if (Handle0 == Handle1) 01681 ConvertToLine(1); // delete the curve element and create a line! 01682 else 01683 RemoveRotateEnd(1); // make sure the end has no smooth bits set 01684 } 01685 } 01686 else 01687 FailAndExecute(); 01688 01689 End(); 01690 }
|
|
For finding the OpPenCreatePath's state.
Reimplemented from OpPenEditPath. Definition at line 1541 of file penedit.cpp. 01542 { 01543 OpState OpSt; 01544 // Always enabled at the moment. 01545 return OpSt; 01546 }
|
|
OpPenCreatePath initialiser method.
Reimplemented from OpPenEditPath. Definition at line 1510 of file penedit.cpp. 01511 { 01512 return (RegisterOpDescriptor(0, // tool ID 01513 _R(IDS_PENCREATEPATHOP), // string resource ID 01514 CC_RUNTIME_CLASS(OpPenCreatePath), // runtime class for Op 01515 OPTOKEN_PENCREATEPATH, // Ptr to token string 01516 OpPenCreatePath::GetState, // GetState function 01517 0, // help ID = 0 01518 _R(IDBBL_PENCREATEPATHOP), // bubble help ID = 0 01519 0 // resource ID = 0 01520 )); 01521 01522 }
|
|
|
|
|