#include <pathedit.h>
Inheritance diagram for InsertPathElementAction:
Public Member Functions | |
InsertPathElementAction () | |
Constructor for the action to undo path modification. | |
~InsertPathElementAction () | |
virtual ActionCode | Execute () |
This is a pure virtual method which should be redefined for all derived classes of Action. | |
void | RecordPath (PathVerb *Verbs, PathFlags *Flags, DocCoord *Coords, NodePath *WhichPath) |
This function initialises the array pointers in this action. Note that the variables NumElements and InsertionPoint are initialised in the Init function. | |
Static Public Member Functions | |
static ActionCode | Init (Operation *pOp, ActionList *pActionList, INT32 NumChangedElements, INT32 ChangedIndex, 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 | |
INT32 | NumElements |
INT32 | InsertionPoint |
NodePath * | ChangedPath |
PathVerb * | ChangedVerbs |
PathFlags * | ChangedFlags |
DocCoord * | ChangedCoords |
Definition at line 704 of file pathedit.h.
|
Constructor for the action to undo path modification.
Definition at line 9004 of file pathedit.cpp. 09005 { 09006 ChangedVerbs = NULL; 09007 ChangedFlags = NULL; 09008 ChangedCoords = NULL; 09009 }
|
|
Definition at line 9149 of file pathedit.cpp. 09150 { 09151 if (ChangedVerbs) 09152 CCFree(ChangedVerbs); 09153 if (ChangedCoords) 09154 CCFree(ChangedCoords); 09155 if (ChangedFlags) 09156 CCFree(ChangedFlags); 09157 }
|
|
This is a pure virtual method which should be redefined for all derived classes of Action.
Reimplemented from Action. Definition at line 9093 of file pathedit.cpp. 09094 { 09095 // Here we're undoing the modify, so we have to write the list of changed array entries 09096 // back into the path. We also have to build undo information for the redo. Usefully, 09097 // We can use the existing arrays, swapping the data in the undo action for the data 09098 // in the path, then passing the arrays on to the redo record. We have to make sure 09099 // we don't try and de-allocate the arrays after we've done this, so we'll put a check in 09100 // the destructor for null pointers 09101 09102 RemovePathElementAction* ModAction; 09103 09104 ActionCode Act; 09105 Act = RemovePathElementAction::Init(pOperation, pOppositeActLst, NumElements, InsertionPoint, (Action**)(&ModAction)); 09106 if (Act == AC_FAIL) 09107 return AC_FAIL; 09108 09109 // Tell the operation where the path is 09110 if (ModAction!=NULL) 09111 ModAction->RecordPath(ChangedPath); 09112 09113 // Force a re-draw of the place where the path used to be 09114 Document* pDoc = GetWorkingDoc(); 09115 ERROR2IF( pDoc == NULL, AC_FAIL, "There was no current document when undoing modifypath" ); 09116 Spread* pSpread = ChangedPath->FindParentSpread(); 09117 DocRect Invalid = ChangedPath->GetUnionBlobBoundingRect(); 09118 pDoc->ForceRedraw( pSpread, Invalid, FALSE, ChangedPath ); 09119 09120 // See if we can open the path up 09121 if (!ChangedPath->InkPath.InsertSection(InsertionPoint, 09122 NumElements)) // WARNING! This routine will claim memory 09123 return AC_FAIL; // in a way the undo system can't track, so it 09124 // won't be able to warn the user that memory is 09125 // tight and would they prefer not to do this operation 09126 09127 // Get pointers to all the arrays of the path 09128 PathVerb* Verbs = ChangedPath->InkPath.GetVerbArray(); 09129 DocCoord* Coords = ChangedPath->InkPath.GetCoordArray(); 09130 PathFlags* Flags = ChangedPath->InkPath.GetFlagArray(); 09131 09132 // Now insert the data from the arrays in the action record 09133 09134 for (INT32 i=0;i<NumElements;i++) 09135 { 09136 Verbs[i+InsertionPoint] = ChangedVerbs[i]; 09137 Coords[i+InsertionPoint] = ChangedCoords[i]; 09138 Flags[i+InsertionPoint] = ChangedFlags[i]; 09139 } 09140 09141 ChangedPath->InvalidateBoundingRect(); 09142 09143 Invalid = ChangedPath->GetUnionBlobBoundingRect(); 09144 pDoc->ForceRedraw( pSpread, Invalid, FALSE, ChangedPath ); 09145 09146 return Act; 09147 }
|
|
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.
Definition at line 9043 of file pathedit.cpp. 09048 { 09049 UINT32 ActSize = sizeof(InsertPathElementAction) + 09050 NumChangedElements * (sizeof(PathVerb)+sizeof(PathFlags)+sizeof(DocCoord)); 09051 09052 ActionCode Ac = Action::Init( pOp, pActionList, ActSize, CC_RUNTIME_CLASS(InsertPathElementAction), NewAction); 09053 if ((Ac == AC_OK) && (*NewAction != NULL)) 09054 { 09055 ((InsertPathElementAction*)*NewAction)->NumElements = NumChangedElements; 09056 ((InsertPathElementAction*)*NewAction)->InsertionPoint = ChangedIndex; 09057 } 09058 09059 return Ac; 09060 }
|
|
This function initialises the array pointers in this action. Note that the variables NumElements and InsertionPoint are initialised in the Init function.
Definition at line 9084 of file pathedit.cpp. 09086 { 09087 ChangedPath = WhichPath; 09088 ChangedVerbs = Verbs; 09089 ChangedFlags = Flags; 09090 ChangedCoords = Coords; 09091 }
|
|
Definition at line 728 of file pathedit.h. |
|
Definition at line 727 of file pathedit.h. |
|
Definition at line 724 of file pathedit.h. |
|
Definition at line 726 of file pathedit.h. |
|
Definition at line 723 of file pathedit.h. |
|
Definition at line 722 of file pathedit.h. |