ChangeShapePathAction Class Reference

An action to change a path in a regular shape. More...

#include <shapeops.h>

Inheritance diagram for ChangeShapePathAction:

Action ListItem CCObject SimpleCCObject List of all members.

Public Types

enum  ChangeItem { CHANGE_PATH1, CHANGE_PATH2 }

Public Member Functions

 ChangeShapePathAction ()
 Constructor for the action to change an edge path of a regular shape. Initialises the data members to sensible defaults.
virtual ActionCode Execute ()
 Changes a data item in a Regular shape, createing another ChangeShapePathAction to undo the change.

Static Public Member Functions

static ActionCode Init (Operation *pOp, ActionList *pActionList, NodeRegularShape *pShape, enum ChangeItem NewItem, Path *NewPath, Action **NewAction)
 This is the function which creates an instance of this action. If there is no room in the undo buffer (which is determined by the base class Init function called within) the function will either return AC_NO_RECORD which means the operation can continue, but no undo information needs to be stored, or AC_OK which means the operation should continue AND record undo information. If the function returns AC_FAIL, there was not enough memory to record the undo information, and the user has decided not to continue with the operation.
static ActionCode DoReshape (Operation *pOp, ActionList *pActionList, NodeRegularShape *pShape, enum ChangeItem NewItem, Path *NewPath)
 This static function makes it a little easier to use this action. It creates an instance of this action and appends it to the action list.

Private Attributes

NodeRegularShapepShape
enum ChangeItem ChangeItemID
Path NewEdge

Detailed Description

An action to change a path in a regular shape.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/94
See also:
ChangeShapeDataAction

Definition at line 455 of file shapeops.h.


Member Enumeration Documentation

enum ChangeShapePathAction::ChangeItem
 

Enumerator:
CHANGE_PATH1 
CHANGE_PATH2 

Definition at line 461 of file shapeops.h.


Constructor & Destructor Documentation

ChangeShapePathAction::ChangeShapePathAction  ) 
 

Constructor for the action to change an edge path of a regular shape. Initialises the data members to sensible defaults.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1353 of file shapeops.cpp.

01354 {
01355     pShape = NULL;
01356     ChangeItemID = CHANGE_PATH1;
01357 }


Member Function Documentation

ActionCode ChangeShapePathAction::DoReshape Operation pOp,
ActionList pActionList,
NodeRegularShape pShape,
enum ChangeItem  NewItem,
Path NewData
[static]
 

This static function makes it a little easier to use this action. It creates an instance of this action and appends it to the action list.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/94
Parameters:
pOp is the currently running operation. [INPUTS] pActionList is a pointer ot the action list to which the action should be appended. pShape is a pointer to the NodeRegularShape to change. NewItem identifes the data item that shoudl be changed NewData poits to the path that this action should store
- [OUTPUTS]
Returns:
Action code which indicates success or failure to create the action

Errors: -

See also:
-

Definition at line 1438 of file shapeops.cpp.

01443 {
01444     // Get the runtime class info on this object and create a pointer to another object of the same type 
01445     ChangeShapePathAction* NewAction; 
01446 
01447     // Now call the init function to set everything up
01448     ActionCode Act = ChangeShapePathAction::Init(pOp, pActionList, pShape, NewItem, NewData, (Action**)&NewAction);
01449     return Act;
01450 }

ActionCode ChangeShapePathAction::Execute  )  [virtual]
 

Changes a data item in a Regular shape, createing another ChangeShapePathAction to undo the change.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
ActionCode, either AC_OK, AC_NORECORD or AC_FAIL

Errors: ERROR2 if the internal shape pointer was NULL.

See also:
-

Reimplemented from Action.

Definition at line 1469 of file shapeops.cpp.

01470 {
01471     ERROR2IF(pShape == NULL, AC_FAIL, "Pointer to shape was NULL.  Did you call Init/DoToggle OR handle their failure?");
01472 
01473     // Get the runtime class info on this object and create a pointer to another object of the same type 
01474     ChangeShapePathAction *ReAction; 
01475     ActionCode Act = AC_FAIL;
01476     Path* ReData;
01477 
01478     switch (ChangeItemID)
01479     {
01480         case CHANGE_PATH1:
01481             ReData = &(pShape->EdgePath1);
01482             break;
01483         case CHANGE_PATH2:
01484             ReData = &(pShape->EdgePath2);
01485             break;
01486         default:
01487             ERROR2(Act, "What was that Change ID?!");
01488             break;
01489     }
01490     
01491     // Create a redo action for this action
01492     Act = ChangeShapePathAction::Init(pOperation, pOppositeActLst, pShape, ChangeItemID, 
01493                                                                         ReData, (Action**)(&ReAction));
01494 
01495     if (Act == AC_FAIL)
01496         return AC_FAIL;
01497 
01498     // Now do the actual action
01499     switch (ChangeItemID)
01500     {
01501         case CHANGE_PATH1:
01502             pShape->EdgePath1.CopyPathDataFrom(&NewEdge);
01503             break;
01504         case CHANGE_PATH2:
01505             pShape->EdgePath2.CopyPathDataFrom(&NewEdge);
01506             break;
01507     }
01508     pShape->InvalidateBoundingRect();
01509     pShape->InvalidateCache();
01510 
01511     return Act;
01512 }

ActionCode ChangeShapePathAction::Init Operation pOp,
ActionList pActionList,
NodeRegularShape pChangeShape,
enum ChangeItem  NewItem,
Path NewPath,
Action **  NewAction
[static]
 

This is the function which creates an instance of this action. If there is no room in the undo buffer (which is determined by the base class Init function called within) the function will either return AC_NO_RECORD which means the operation can continue, but no undo information needs to be stored, or AC_OK which means the operation should continue AND record undo information. If the function returns AC_FAIL, there was not enough memory to record the undo information, and the user has decided not to continue with the operation.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/94
Parameters:
pOp is the pointer to the operation to which this action belongs [INPUTS] pShape is a pointer to the NodeRegularShape to change NewItem identifes the data item that shoudl be changed NewPath points to the path to store as undo infomation pActionList is the action list to which this action should be added
NewAction is a pointer to a pointer to an action, allowing the function to [OUTPUTS] return a pointer to the created action
Returns:
ActionCode, one of AC_OK, AC_NO_RECORD or AC_FAIL

Errors: -

See also:
Action::Init()

Definition at line 1391 of file shapeops.cpp.

01397 {
01398     UINT32 ActSize = sizeof(ChangeShapePathAction);         
01399 
01400     ActionCode Ac = Action::Init( pOp, pActionList, ActSize, CC_RUNTIME_CLASS(ChangeShapePathAction), NewAction);
01401     if ((Ac == AC_OK) && (*NewAction != NULL))
01402     {
01403         ((ChangeShapePathAction*)*NewAction)->pShape = pChangeShape;
01404         ((ChangeShapePathAction*)*NewAction)->ChangeItemID = NewItem;
01405         if (!((ChangeShapePathAction*)*NewAction)->NewEdge.Initialise(NewPath->GetNumCoords()))
01406             return AC_FAIL;
01407         ((ChangeShapePathAction*)*NewAction)->NewEdge.CopyPathDataFrom(NewPath);
01408     }
01409     return Ac;
01410 }


Member Data Documentation

enum ChangeItem ChangeShapePathAction::ChangeItemID [private]
 

Definition at line 478 of file shapeops.h.

Path ChangeShapePathAction::NewEdge [private]
 

Definition at line 479 of file shapeops.h.

NodeRegularShape* ChangeShapePathAction::pShape [private]
 

Definition at line 477 of file shapeops.h.


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