#include <pathedit.h>
Inheritance diagram for RemovePathElementAction:
Public Member Functions | |
RemovePathElementAction () | |
Constructor for the action to undo path element insertion. | |
~RemovePathElementAction () | |
virtual ActionCode | Execute () |
This is a pure virtual method which should be redefined for all derived classes of Action. | |
void | RecordPath (NodePath *WhichPath) |
This function records a pointer to the path. That's all. | |
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 the action to remove elements from a path. 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 | FirstChangedIndex |
NodePath * | ChangedPath |
Definition at line 669 of file pathedit.h.
|
Constructor for the action to undo path element insertion.
Definition at line 8822 of file pathedit.cpp.
|
|
Definition at line 8973 of file pathedit.cpp. 08974 { 08975 // if (ChangedVerbs) 08976 // CCFree(ChangedVerbs); 08977 // if (ChangedCoords) 08978 // CCFree(ChangedCoords); 08979 // if (ChangedFlags) 08980 // CCFree(ChangedFlags); 08981 // if (ChangedIndices) 08982 // CCFree(ChangedIndices); 08983 }
|
|
This is a pure virtual method which should be redefined for all derived classes of Action.
Reimplemented from Action. Definition at line 8901 of file pathedit.cpp. 08902 { 08903 // Here we're undoing the insert, so we have to remove the elements that were inserted. 08904 // At the same time, we have to create a redo operation which will end up being an 08905 // InsertPathElementAction. 08906 08907 InsertPathElementAction* ModAction; 08908 08909 ActionCode Act; 08910 Act = InsertPathElementAction::Init(pOperation, pOppositeActLst, NumElements, FirstChangedIndex, 08911 (Action**)(&ModAction)); 08912 if (Act == AC_FAIL) 08913 return AC_FAIL; 08914 08915 // Force a re-draw of the place where the path used to be 08916 Document* pDoc = GetWorkingDoc(); 08917 ERROR2IF( pDoc == NULL, AC_FAIL, "There was no current document when undoing modifypath" ); 08918 Spread* pSpread = ChangedPath->FindParentSpread(); 08919 DocRect Invalid = ChangedPath->GetUnionBlobBoundingRect(); 08920 pDoc->ForceRedraw( pSpread, Invalid, FALSE, ChangedPath ); 08921 08922 if ((Act!=AC_NORECORD) && (ModAction!=NULL)) 08923 { 08924 // I have to claim some memory to store the elements I'm deleting... 08925 08926 PathVerb* ChangedVerbs; 08927 DocCoord* ChangedCoords; 08928 PathFlags* ChangedFlags; 08929 08930 ALLOC_WITH_FAIL(ChangedVerbs,(PathVerb*) CCMalloc(NumElements * sizeof(PathVerb)),pOperation); 08931 ALLOC_WITH_FAIL(ChangedCoords,(DocCoord*) CCMalloc(NumElements * sizeof(DocCoord)),pOperation); 08932 ALLOC_WITH_FAIL(ChangedFlags,(PathFlags*) CCMalloc(NumElements * sizeof(PathFlags)),pOperation); 08933 08934 if (!ChangedVerbs || !ChangedCoords || !ChangedFlags) 08935 { 08936 if (ChangedVerbs) CCFree(ChangedVerbs); 08937 if (ChangedCoords) CCFree(ChangedCoords); 08938 if (ChangedFlags) CCFree(ChangedFlags); 08939 return AC_FAIL; 08940 } 08941 08942 // Get pointers to all the arrays of the path 08943 PathVerb* Verbs = ChangedPath->InkPath.GetVerbArray(); 08944 DocCoord* Coords = ChangedPath->InkPath.GetCoordArray(); 08945 PathFlags* Flags = ChangedPath->InkPath.GetFlagArray(); 08946 08947 // Now copy the data from the path into the arrays 08948 for (INT32 i=0;i<NumElements;i++) 08949 { 08950 ChangedVerbs[i] = Verbs[FirstChangedIndex+i]; 08951 ChangedCoords[i] = Coords[FirstChangedIndex+i]; 08952 ChangedFlags[i] = Flags[FirstChangedIndex+i]; 08953 } 08954 08955 // Now pass these arrays to the Insert action 08956 ModAction->RecordPath(ChangedVerbs, ChangedFlags,ChangedCoords, ChangedPath); 08957 } 08958 08959 // Now we've recorded the data we're about to delete, let's delete it 08960 ChangedPath->InkPath.DeleteSection(FirstChangedIndex, NumElements); 08961 08962 ChangedPath->InvalidateBoundingRect(); 08963 08964 // Now cause a redraw of the new path 08965 Invalid = ChangedPath->GetUnionBlobBoundingRect(); 08966 pDoc->ForceRedraw( pSpread, Invalid, FALSE, ChangedPath ); 08967 08968 return Act; 08969 }
|
|
This is the function which creates an instance of the action to remove elements from a path. 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 8859 of file pathedit.cpp. 08864 { 08865 UINT32 ActSize = sizeof(RemovePathElementAction) + 08866 NumChangedElements * (sizeof(PathVerb)+sizeof(PathFlags)+sizeof(DocCoord)); 08867 08868 ActionCode Ac = Action::Init( pOp, pActionList, ActSize, CC_RUNTIME_CLASS(RemovePathElementAction), NewAction); 08869 08870 if ((Ac == AC_OK) && (*NewAction != NULL)) 08871 { 08872 ((RemovePathElementAction*)*NewAction)->NumElements = NumChangedElements; 08873 ((RemovePathElementAction*)*NewAction)->FirstChangedIndex = ChangedIndex; 08874 } 08875 08876 return Ac; 08877 }
|
|
This function records a pointer to the path. That's all.
Definition at line 8896 of file pathedit.cpp. 08897 { 08898 ChangedPath = WhichPath; 08899 }
|
|
Definition at line 688 of file pathedit.h. |
|
Definition at line 687 of file pathedit.h. |
|
Definition at line 686 of file pathedit.h. |