#include <penedit.h>
Inheritance diagram for OpAddNewPath:
Public Member Functions | |
OpAddNewPath () | |
OpAddNewPath constructor. | |
void | GetOpName (String_256 *OpName) |
The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies. | |
void | DoAddNewPath (Path *pAddPath, Spread *pSpread) |
This operation is called to add a path to the tree. If successfull it will create a new node, copy the contents of pAddPath into it and apply the current attributes to it. | |
Static Public Member Functions | |
static BOOL | Init () |
OpAddNewPath initialiser method. | |
static OpState | GetState (String_256 *, OpDescriptor *) |
For finding the OpAddNewPath's state. |
Definition at line 549 of file penedit.h.
|
OpAddNewPath constructor.
Definition at line 2636 of file penedit.cpp.
|
|
This operation is called to add a path to the tree. If successfull it will create a new node, copy the contents of pAddPath into it and apply the current attributes to it.
Definition at line 2738 of file penedit.cpp. 02739 { 02740 BeginSlowJob(); 02741 02742 if (!DoStartSelOp(FALSE,TRUE)) 02743 { 02744 FailAndExecute(); End(); return; 02745 } 02746 02747 // We had better copy the path back over the original and re-calc the bounding box 02748 DocView* pDocView = DocView::GetSelected(); 02749 ERROR2IF( pDocView == NULL, (void)0, "There was no selected DocView when editing a path" ); 02750 02751 // Create a path to hold the data 02752 NodePath* NewPath = new NodePath; 02753 if (!NewPath) 02754 { 02755 FailAndExecute(); End(); return; 02756 } 02757 02758 if (!NewPath->SetUpPath(24, 12)) 02759 { 02760 InformError( _R(IDS_OUT_OF_MEMORY), _R(IDS_OK) ); 02761 delete NewPath; 02762 FailAndExecute(); End(); return; 02763 } 02764 02765 // Copy the data from the edit path to the new path 02766 if (!NewPath->InkPath.CopyPathDataFrom(pAddPath)) 02767 { 02768 NewPath->CascadeDelete(); 02769 delete NewPath; 02770 FailAndExecute(); End(); return; 02771 } 02772 02773 // Apply attributes to the new node 02774 Document* pDoc = GetWorkingDoc(); 02775 if (pDoc!=NULL) 02776 { 02777 // Apply the current attributes to the path 02778 if (!(pDoc->GetAttributeMgr().ApplyCurrentAttribsToNode((NodeRenderableInk*)NewPath))) 02779 { 02780 NewPath->CascadeDelete(); 02781 delete NewPath; 02782 FailAndExecute(); End(); return; 02783 } 02784 } 02785 else 02786 { 02787 NewPath->CascadeDelete(); 02788 delete NewPath; 02789 FailAndExecute(); End(); return; 02790 } 02791 02792 if (!DoInsertNewNode(NewPath, pSpread, TRUE)) 02793 { 02794 NewPath->CascadeDelete(); 02795 delete NewPath; 02796 FailAndExecute(); End(); return; 02797 } 02798 02799 // Reselect the last endpoint in the new path 02800 NewPath->InkPath.GetFlagArray()[NewPath->InkPath.GetNumCoords()-1].IsSelected = TRUE; 02801 02802 // terminate the op 02803 End(); 02804 02805 }
|
|
The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies.
Reimplemented from Operation. Definition at line 2714 of file penedit.cpp. 02715 { 02716 *OpName = String_256(_R(IDS_UNDO_ADDNEWPATHOP)); 02717 }
|
|
For finding the OpAddNewPath's state.
Definition at line 2690 of file penedit.cpp. 02691 { 02692 OpState OpSt; 02693 return OpSt; 02694 }
|
|
OpAddNewPath initialiser method.
Reimplemented from SimpleCCObject. Definition at line 2660 of file penedit.cpp. 02661 { 02662 return (RegisterOpDescriptor(0, // tool ID 02663 _R(IDS_ADDNEWPATHOP), // string resource ID 02664 CC_RUNTIME_CLASS(OpAddNewPath), // runtime class for Op 02665 OPTOKEN_ADDNEWPATH, // Ptr to token string 02666 OpAddNewPath::GetState, // GetState function 02667 0, // help ID = 0 02668 _R(IDBBL_ADDNEWPATHOP), // bubble help ID = 0 02669 0 // resource ID = 0 02670 )); 02671 02672 }
|