#include <shapeops.h>
Inheritance diagram for ChangeShapePointAction:
Public Types | |
enum | ChangeItem { CHANGE_MAJOR, CHANGE_CENTRE, CHANGE_MINOR } |
Public Member Functions | |
ChangeShapePointAction () | |
Constructor for the action to change a point in a regular shape. Initialises the data members to sensible defaults. | |
virtual ActionCode | Execute () |
Changes a data item in a Regular shape, createing another ChangeShapePointAction to undo the change. | |
Static Public Member Functions | |
static ActionCode | Init (Operation *pOp, ActionList *pActionList, NodeRegularShape *pShape, enum ChangeItem NewItem, DocCoord NewData, 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 | DoToggle (Operation *pOp, ActionList *pActionList, NodeRegularShape *pShape, enum ChangeItem NewItem, DocCoord NewData) |
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 * | pToggleShape |
enum ChangeItem | ChangeItemID |
DocCoord | NewValue |
Definition at line 413 of file shapeops.h.
|
Definition at line 419 of file shapeops.h. 00419 {CHANGE_MAJOR, CHANGE_CENTRE, CHANGE_MINOR};
|
|
Constructor for the action to change a point in a regular shape. Initialises the data members to sensible defaults.
Definition at line 1162 of file shapeops.cpp. 01163 { 01164 pToggleShape = NULL; 01165 ChangeItemID = CHANGE_MAJOR; 01166 NewValue = DocCoord(0,0); 01167 }
|
|
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 1246 of file shapeops.cpp. 01251 { 01252 // Get the runtime class info on this object and create a pointer to another object of the same type 01253 ChangeShapePointAction* NewAction; 01254 01255 // Now call the init function to set everything up 01256 ActionCode Act = ChangeShapePointAction::Init(pOp, pActionList, pShape, NewItem, NewData, (Action**)&NewAction); 01257 return Act; 01258 }
|
|
Changes a data item in a Regular shape, createing another ChangeShapePointAction to undo the change.
Reimplemented from Action. Definition at line 1278 of file shapeops.cpp. 01279 { 01280 ERROR3IF(pToggleShape == NULL, "Pointer to shape was NULL. Did you call Init/DoToggle OR handle their failure?"); 01281 01282 // Get the runtime class info on this object and create a pointer to another object of the same type 01283 ChangeShapePointAction *ReAction; 01284 ActionCode Act = AC_FAIL; 01285 DocCoord ReData(0,0); 01286 01287 switch (ChangeItemID) 01288 { 01289 case CHANGE_MINOR: 01290 ReData = pToggleShape->GetUTMinorAxes(); 01291 break; 01292 case CHANGE_MAJOR: 01293 ReData = pToggleShape->GetUTMajorAxes(); 01294 break; 01295 case CHANGE_CENTRE: 01296 ReData = pToggleShape->GetUTCentrePoint(); 01297 break; 01298 default: 01299 ERROR2(Act, "What was that Change ID?!"); 01300 break; 01301 } 01302 01303 // Create a redo action for this action 01304 if (pToggleShape != NULL) 01305 { 01306 Act = ChangeShapePointAction::Init(pOperation, pOppositeActLst, pToggleShape, ChangeItemID, 01307 ReData, (Action**)(&ReAction)); 01308 01309 if (Act == AC_FAIL) 01310 return AC_FAIL; 01311 01312 // Now do the actual action 01313 switch (ChangeItemID) 01314 { 01315 case CHANGE_MINOR: 01316 pToggleShape->SetMinorAxes(NewValue); 01317 break; 01318 case CHANGE_MAJOR: 01319 pToggleShape->SetMajorAxes(NewValue); 01320 break; 01321 case CHANGE_CENTRE: 01322 pToggleShape->SetCentrePoint(NewValue); 01323 break; 01324 } 01325 pToggleShape->InvalidateBoundingRect(); 01326 pToggleShape->InvalidateCache(); 01327 } 01328 01329 return Act; 01330 }
|
|
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 1201 of file shapeops.cpp. 01207 { 01208 UINT32 ActSize = sizeof(ChangeShapePointAction); 01209 01210 ActionCode Ac = Action::Init( pOp, pActionList, ActSize, CC_RUNTIME_CLASS(ChangeShapePointAction), NewAction); 01211 if ((Ac == AC_OK) && (*NewAction != NULL)) 01212 { 01213 ((ChangeShapePointAction*)*NewAction)->pToggleShape = pShape; 01214 ((ChangeShapePointAction*)*NewAction)->ChangeItemID = NewItem; 01215 ((ChangeShapePointAction*)*NewAction)->NewValue = NewData; 01216 } 01217 return Ac; 01218 }
|
|
Definition at line 438 of file shapeops.h. |
|
Definition at line 439 of file shapeops.h. |
|
Definition at line 437 of file shapeops.h. |