#include <shapeops.h>
Inheritance diagram for ChangeShapeDataAction:
Public Types | |
enum | ChangeItem { CHANGE_NUMSIDES, CHANGE_CIRCULAR, CHANGE_STELLATED, CHANGE_PRIMARYCURVATURE, CHANGE_STELLATIONCURVATURE, CHANGE_STELLRADIUSTOPRIMARY, CHANGE_PRIMARYCURVETOPRIMARY, CHANGE_STELLCURVETOSTELL, CHANGE_STELLATIONOFFSET } |
Public Member Functions | |
ChangeShapeDataAction () | |
Constructor for the action to toggle a data item of a regular state. Initialises the data members to sensible defaults. | |
virtual ActionCode | Execute () |
Changes a data item in a Regular shape, createing another ChangeShapeDataAction to undo the change. | |
Static Public Member Functions | |
static ActionCode | Init (Operation *pOp, ActionList *pActionList, NodeRegularShape *pShape, enum ChangeItem NewItem, double 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, double 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 |
double | NewValue |
Definition at line 369 of file shapeops.h.
|
Definition at line 376 of file shapeops.h. 00376 {CHANGE_NUMSIDES, CHANGE_CIRCULAR, CHANGE_STELLATED, CHANGE_PRIMARYCURVATURE, 00377 CHANGE_STELLATIONCURVATURE, CHANGE_STELLRADIUSTOPRIMARY, 00378 CHANGE_PRIMARYCURVETOPRIMARY, CHANGE_STELLCURVETOSTELL, CHANGE_STELLATIONOFFSET};
|
|
Constructor for the action to toggle a data item of a regular state. Initialises the data members to sensible defaults.
Definition at line 932 of file shapeops.cpp. 00933 { 00934 pToggleShape = NULL; 00935 ChangeItemID = CHANGE_NUMSIDES; 00936 NewValue = 0.0; 00937 }
|
|
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 1016 of file shapeops.cpp. 01021 { 01022 // Get the runtime class info on this object and create a pointer to another object of the same type 01023 ChangeShapeDataAction* NewAction; 01024 01025 // Now call the init function to set everything up 01026 ActionCode Act = ChangeShapeDataAction::Init(pOp, pActionList, pShape, NewItem, NewData, (Action**)&NewAction); 01027 return Act; 01028 }
|
|
Changes a data item in a Regular shape, createing another ChangeShapeDataAction to undo the change.
Reimplemented from Action. Definition at line 1048 of file shapeops.cpp. 01049 { 01050 ERROR3IF(pToggleShape == NULL, "Pointer to shape was NULL. Did you call Init/DoToggle OR handle their failure?"); 01051 01052 // Get the runtime class info on this object and create a pointer to another object of the same type 01053 ChangeShapeDataAction *ReAction; 01054 ActionCode Act = AC_FAIL; 01055 double ReData = 0.0; 01056 01057 switch (ChangeItemID) 01058 { 01059 case CHANGE_NUMSIDES: 01060 ReData = pToggleShape->GetNumSides(); 01061 break; 01062 case CHANGE_CIRCULAR: 01063 ReData = pToggleShape->IsCircular() ? 1.0 : 0.0; 01064 break; 01065 case CHANGE_STELLATED: 01066 ReData = pToggleShape->IsStellated() ? 1.0 : 0.0; 01067 break; 01068 case CHANGE_STELLRADIUSTOPRIMARY: 01069 ReData = pToggleShape->GetStellRadiusToPrimary(); 01070 break; 01071 case CHANGE_PRIMARYCURVATURE: 01072 ReData = pToggleShape->IsPrimaryCurvature() ? 1.0 : 0.0; 01073 break; 01074 case CHANGE_STELLATIONCURVATURE: 01075 ReData = pToggleShape->IsStellationCurvature() ? 1.0 : 0.0; 01076 break; 01077 case CHANGE_PRIMARYCURVETOPRIMARY: 01078 ReData = pToggleShape->GetPrimaryCurveToPrimary(); 01079 break; 01080 case CHANGE_STELLCURVETOSTELL: 01081 ReData = pToggleShape->GetStellCurveToStell(); 01082 break; 01083 case CHANGE_STELLATIONOFFSET: 01084 ReData = pToggleShape->GetStellationRatio(); 01085 break; 01086 default: 01087 ERROR2(Act, "What was that Change ID?!"); 01088 break; 01089 } 01090 01091 // Create a redo action for this action 01092 if (pToggleShape != NULL) 01093 { 01094 Act = ChangeShapeDataAction::Init(pOperation, pOppositeActLst, pToggleShape, ChangeItemID, 01095 ReData, (Action**)(&ReAction)); 01096 01097 if (Act == AC_FAIL) 01098 return AC_FAIL; 01099 01100 // Now do the actual action 01101 switch (ChangeItemID) 01102 { 01103 case CHANGE_NUMSIDES: 01104 pToggleShape->SetNumSides((UINT32)NewValue); 01105 break; 01106 case CHANGE_CIRCULAR: 01107 pToggleShape->SetCircular(NewValue == 1.0 ? TRUE : FALSE); 01108 break; 01109 case CHANGE_STELLATED: 01110 pToggleShape->SetStellated(NewValue == 1.0 ? TRUE : FALSE); 01111 break; 01112 case CHANGE_STELLRADIUSTOPRIMARY: 01113 pToggleShape->SetStellRadiusToPrimary(NewValue); 01114 break; 01115 case CHANGE_PRIMARYCURVATURE: 01116 pToggleShape->SetPrimaryCurvature(NewValue == 1.0 ? TRUE : FALSE); 01117 break; 01118 case CHANGE_STELLATIONCURVATURE: 01119 pToggleShape->SetStellationCurvature(NewValue == 1.0 ? TRUE : FALSE); 01120 break; 01121 case CHANGE_PRIMARYCURVETOPRIMARY: 01122 pToggleShape->SetPrimaryCurveToPrimary(NewValue); 01123 break; 01124 case CHANGE_STELLCURVETOSTELL: 01125 pToggleShape->SetStellCurveToStell(NewValue); 01126 break; 01127 case CHANGE_STELLATIONOFFSET: 01128 pToggleShape->SetStellationRatio(NewValue); 01129 break; 01130 default: 01131 ERROR3("What was that Change ID?!"); 01132 break; 01133 } 01134 pToggleShape->InvalidateBoundingRect(); 01135 pToggleShape->InvalidateCache(); 01136 } 01137 01138 return Act; 01139 }
|
|
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 971 of file shapeops.cpp. 00977 { 00978 UINT32 ActSize = sizeof(ChangeShapeDataAction); 00979 00980 ActionCode Ac = Action::Init( pOp, pActionList, ActSize, CC_RUNTIME_CLASS(ChangeShapeDataAction), NewAction); 00981 if ((Ac == AC_OK) && (*NewAction != NULL)) 00982 { 00983 ((ChangeShapeDataAction*)*NewAction)->pToggleShape = pShape; 00984 ((ChangeShapeDataAction*)*NewAction)->ChangeItemID = NewItem; 00985 ((ChangeShapeDataAction*)*NewAction)->NewValue = NewData; 00986 } 00987 return Ac; 00988 }
|
|
Definition at line 396 of file shapeops.h. |
|
Definition at line 397 of file shapeops.h. |
|
Definition at line 395 of file shapeops.h. |