ModifyElementAction Class Reference

An action which undoes the modification of a single element of path data. This action can be used for undoing changing coordinates or flags or verbs. This action is not really suitable if you have a lot of path data to change - ModifyPathAction is more efficient because it encodes multiple elements. This action was written because for single elements, ModifyPathAction is too complicated to call. More...

#include <pathedit.h>

Inheritance diagram for ModifyElementAction:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 ModifyElementAction ()
 Constructor for the action to undo path element modification.
 ~ModifyElementAction ()
virtual ActionCode Execute ()
 This is a pure virtual method which should be redefined for all derived classes of Action.
NodePathGetActionPath () const
INT32 GetActionIndex () const

Static Public Member Functions

static ActionCode Init (Operation *pOp, ActionList *pActionList, PathVerb Verb, PathFlags Flags, DocCoord Coord, INT32 Index, NodePath *WhichPath, 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.

Protected Attributes

NodePathChangedPath
PathVerb ChangedVerb
PathFlags ChangedFlags
DocCoord ChangedCoord
INT32 ChangedIndex

Detailed Description

An action which undoes the modification of a single element of path data. This action can be used for undoing changing coordinates or flags or verbs. This action is not really suitable if you have a lot of path data to change - ModifyPathAction is more efficient because it encodes multiple elements. This action was written because for single elements, ModifyPathAction is too complicated to call.

Author:
Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/6/94
See also:
-

Definition at line 747 of file pathedit.h.


Constructor & Destructor Documentation

ModifyElementAction::ModifyElementAction  ) 
 

Constructor for the action to undo path element modification.

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

Errors: -

See also:
-

Definition at line 9178 of file pathedit.cpp.

09179 {
09180     ChangedPath = NULL;
09181 }

ModifyElementAction::~ModifyElementAction  ) 
 

Definition at line 9290 of file pathedit.cpp.

09291 {
09292 }


Member Function Documentation

ActionCode ModifyElementAction::Execute  )  [virtual]
 

This is a pure virtual method which should be redefined for all derived classes of Action.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/8/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: If this method is ever called then an ENSURE failure will occur.

See also:
-

Reimplemented from Action.

Definition at line 9245 of file pathedit.cpp.

09246 {
09247     // Here we're undoing the modify, so we have to change the element in the path,
09248     // recording redo information at the same time.
09249     
09250     ModifyElementAction* ModAction;
09251     
09252     // Get pointers to all the arrays of the path
09253 
09254     PathVerb* Verbs = ChangedPath->InkPath.GetVerbArray();
09255     DocCoord* Coords = ChangedPath->InkPath.GetCoordArray();
09256     PathFlags* Flags = ChangedPath->InkPath.GetFlagArray();
09257 
09258     // Create a redo action for this action, which is also a ModifyElementAction
09259 
09260     ActionCode Act;
09261     Act = ModifyElementAction::Init(pOperation, 
09262                                     pOppositeActLst, 
09263                                     Verbs[ChangedIndex],
09264                                     Flags[ChangedIndex],
09265                                     Coords[ChangedIndex],
09266                                     ChangedIndex,
09267                                     ChangedPath,
09268                                     (Action**)(&ModAction));
09269     if (Act == AC_FAIL)
09270         return AC_FAIL;
09271 
09272     // Force a re-draw of the place where the path used to be
09273     Document* pDoc = GetWorkingDoc();
09274     ERROR2IF( pDoc == NULL, AC_FAIL, "There was no current document when undoing modifypath" );
09275     Spread* pSpread = ChangedPath->FindParentSpread();
09276     DocRect Invalid = ChangedPath->GetUnionBlobBoundingRect();
09277     pDoc->ForceRedraw( pSpread, Invalid, FALSE, ChangedPath );
09278 
09279     Verbs[ChangedIndex] = ChangedVerb;
09280     Flags[ChangedIndex] = ChangedFlags;
09281     Coords[ChangedIndex] = ChangedCoord;
09282 
09283     ChangedPath->InvalidateBoundingRect();
09284     Invalid = ChangedPath->GetUnionBlobBoundingRect();
09285     pDoc->ForceRedraw( pSpread, Invalid, FALSE, ChangedPath );
09286 
09287     return Act;
09288 }

INT32 ModifyElementAction::GetActionIndex  )  const [inline]
 

Definition at line 767 of file pathedit.h.

00767 {return ChangedIndex;}

NodePath* ModifyElementAction::GetActionPath  )  const [inline]
 

Definition at line 766 of file pathedit.h.

00766 {return ChangedPath;}

ActionCode ModifyElementAction::Init Operation pOp,
ActionList pActionList,
PathVerb  Verb,
PathFlags  Flags,
DocCoord  Coord,
INT32  Index,
NodePath WhichPath,
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:
Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/6/94
Parameters:
pOp is the pointer to the operation to which this action belongs [INPUTS] pActionList is the action list to which this action should be added Verb is the verb of the path that we're changing Flags are the flags of the changed element DocCoord is the coords of the element Index is the index into the path of the element
NewAction is a pointer to a pointer to an action, allowing the function to return [OUTPUTS] 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 9220 of file pathedit.cpp.

09228 {
09229     UINT32 ActSize = sizeof(ModifyElementAction);
09230 
09231     ActionCode Ac = Action::Init( pOp, pActionList, ActSize, CC_RUNTIME_CLASS(ModifyElementAction), NewAction);
09232 
09233     if ((Ac == AC_OK) && (*NewAction != NULL))
09234     {
09235         ((ModifyElementAction*)*NewAction)->ChangedVerb = Verb;
09236         ((ModifyElementAction*)*NewAction)->ChangedFlags = Flags;
09237         ((ModifyElementAction*)*NewAction)->ChangedCoord = Coord;
09238         ((ModifyElementAction*)*NewAction)->ChangedIndex = Index;
09239         ((ModifyElementAction*)*NewAction)->ChangedPath = WhichPath;
09240     }
09241 
09242     return Ac;
09243 }


Member Data Documentation

DocCoord ModifyElementAction::ChangedCoord [protected]
 

Definition at line 774 of file pathedit.h.

PathFlags ModifyElementAction::ChangedFlags [protected]
 

Definition at line 773 of file pathedit.h.

INT32 ModifyElementAction::ChangedIndex [protected]
 

Definition at line 775 of file pathedit.h.

NodePath* ModifyElementAction::ChangedPath [protected]
 

Definition at line 771 of file pathedit.h.

PathVerb ModifyElementAction::ChangedVerb [protected]
 

Definition at line 772 of file pathedit.h.


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