OpAddNewPath Class Reference

This op actually adds a new path to the current document. The path has been created and edited with OpPenCreatePath() which will handle EOR drawing It can now be instantiated as a physical object by this op. More...

#include <penedit.h>

Inheritance diagram for OpAddNewPath:

OpAddPath SelOperation UndoableOperation Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

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.

Detailed Description

This op actually adds a new path to the current document. The path has been created and edited with OpPenCreatePath() which will handle EOR drawing It can now be instantiated as a physical object by this op.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/9/94

Definition at line 549 of file penedit.h.


Constructor & Destructor Documentation

OpAddNewPath::OpAddNewPath  ) 
 

OpAddNewPath constructor.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/9/94
See also:
-

Definition at line 2636 of file penedit.cpp.

02637 {
02638 }


Member Function Documentation

void OpAddNewPath::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.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/9/94
Parameters:
pAddPath = Pointer to a path to add to the document [INPUTS] pSpread = Pointer to the spread to add the path to.
- [OUTPUTS]

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 }

void OpAddNewPath::GetOpName String_256 OpName  )  [virtual]
 

The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/9/94
Parameters:
- [INPUTS]
The undo string for the operation [OUTPUTS]
Returns:

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 2714 of file penedit.cpp.

02715 {
02716     *OpName = String_256(_R(IDS_UNDO_ADDNEWPATHOP));
02717 }

OpState OpAddNewPath::GetState String_256 UIDescription,
OpDescriptor
[static]
 

For finding the OpAddNewPath's state.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/9/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The state of the OpAddNewPath

Errors: -

See also:
-

Definition at line 2690 of file penedit.cpp.

02691 {
02692     OpState OpSt;
02693     return OpSt;   
02694 }

BOOL OpAddNewPath::Init void   )  [static]
 

OpAddNewPath initialiser method.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/9/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the operation could be successfully initialised FALSE if no more memory could be allocated

Errors: ERROR will be called if there was insufficient memory to allocate the operation.

See also:
-

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 }               


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:57:23 2007 for Camelot by  doxygen 1.4.4