#include <shapeops.h>
Inheritance diagram for ChangeShapePathAction:
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 | |
NodeRegularShape * | pShape |
enum ChangeItem | ChangeItemID |
Path | NewEdge |
Definition at line 455 of file shapeops.h.
|
Definition at line 461 of file shapeops.h. 00461 {CHANGE_PATH1, CHANGE_PATH2};
|
|
Constructor for the action to change an edge path of a regular shape. Initialises the data members to sensible defaults.
Definition at line 1353 of file shapeops.cpp. 01354 { 01355 pShape = NULL; 01356 ChangeItemID = CHANGE_PATH1; 01357 }
|
|
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.
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 }
|
|
Changes a data item in a Regular shape, createing another ChangeShapePathAction to undo the change.
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 }
|
|
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 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 }
|
|
Definition at line 478 of file shapeops.h. |
|
Definition at line 479 of file shapeops.h. |
|
Definition at line 477 of file shapeops.h. |