#include <ops.h>
Inheritance diagram for RestoreSelectionsAction:
Public Member Functions | |
RestoreSelectionsAction () | |
RestoreSelectionsAction constructor. | |
~RestoreSelectionsAction () | |
void | Slaughter () |
All RestoreSelections actions have a pointer to a selection state. This selection state is passed on to the actions twin, and therefore should not be deleted in the actions destructor. The slaughter method is responsible for deleting the SelState. | |
virtual ActionCode | Execute () |
Executes the RestoreSelectionsAction which restores the selection state. It also creates another identical RestoreSelectionsAction and adds this to the opposite ActionList. | |
SelectionState * | GetSelState () |
Static Public Member Functions | |
static ActionCode | Init (Operation *const pOp, ActionList *pActionList, SelectionState *SelState, BOOL Toggle, BOOL ToggleStatus, BOOL SelStateShared, BOOL RenderStartBlobs, BOOL RenderEndBlobs, BOOL StartRestore, Action **NewAction) |
To check that there is sufficient room for the action in the operation history, and if there is, then to add the action to the operations action list. | |
Private Attributes | |
SelectionState * | SelState |
BOOL | toggle:1 |
BOOL | toggleStatus:1 |
BOOL | SelStateShared:1 |
BOOL | RenderStartBlobs:1 |
BOOL | RenderEndBlobs:1 |
BOOL | StartRestore:1 |
Definition at line 1037 of file ops.h.
|
RestoreSelectionsAction constructor.
Definition at line 4178 of file ops.cpp.
|
|
Definition at line 4182 of file ops.cpp. 04183 { 04184 // Note that the SelectionState object is not deleted in the destructor. This is because 04185 // it will be used by the spawned RestoreSelectionAction generated in the Execute method. 04186 }
|
|
Executes the RestoreSelectionsAction which restores the selection state. It also creates another identical RestoreSelectionsAction and adds this to the opposite ActionList.
Reimplemented from Action. Definition at line 4248 of file ops.cpp. 04249 { 04250 RestoreSelectionsAction* RestoreAct; 04251 ActionCode ActCode; 04252 // Attempt to initialise the action 04253 if ((ActCode = RestoreSelectionsAction::Init(pOperation, 04254 pOppositeActLst, 04255 SelState, 04256 toggle, 04257 !toggleStatus, // Toggle it 04258 SelStateShared, 04259 RenderStartBlobs, 04260 RenderEndBlobs, 04261 !StartRestore, // Will become the last restore ! 04262 ( Action**)(&RestoreAct))) != AC_FAIL) 04263 { 04264 // The action was successfully initialised. If this is a toggle 04265 // action then only restore the selection state when the toggleStatus is 04266 // true. 04267 if ((!toggle) || (toggleStatus)) // Determine if we have to do anything 04268 { 04269 // Only render the blobs if StartRestore is FALSE and either 04270 // a. RenderStartBlobs is TRUE and this action is an undo action 04271 // b. RenderEndBlobs is TRUE and this is a redo action 04272 04273 BOOL RenderBlobs = FALSE; 04274 04275 if (!StartRestore) 04276 { 04277 if (pOppositeActLst == pOperation->GetUndoActionList()) 04278 { 04279 // This action is a redo action 04280 RenderBlobs = RenderEndBlobs; 04281 } 04282 04283 else 04284 { 04285 // This action is an undo action 04286 RenderBlobs = RenderStartBlobs; 04287 } 04288 } 04289 04290 // Turn blob rendering on if this is the last restore 04291 //if (!StartRestore) 04292 //{ 04293 // Camelot.GetBlobManager()->BlobRenderingOn(FALSE); 04294 //} 04295 04296 // Always remove the selection blobs when StartRestore is TRUE 04297 SelState->Restore(RenderBlobs, StartRestore); // Restore selections 04298 04299 // Turn blob rendering off if this is the first restore 04300 //if (StartRestore) 04301 //{ 04302 // Camelot.GetBlobManager()->BlobRenderingOff(FALSE); 04303 //} 04304 04305 } 04306 } 04307 return (ActCode); 04308 }
|
|
Definition at line 1057 of file ops.h. 01059 { return SelState; };
|
|
To check that there is sufficient room for the action in the operation history, and if there is, then to add the action to the operations action list.
SelState: Pointer to a selection State - this gets destroyed in the actions slaughter method. Toggle: When TRUE this flag indicates that the selection state should only be restored when the ToggleStatus is TRUE. The ToggleStatus of the actions twin = !ToggleStatus. This mechanism allows two RestoreSelectionActions to be created for an operation, only one of which does anything. Usually an operation creates two RestoreSelectionsActions one at the head and one at the tail of the operations action list. When undoing it is desirable that the tail RestoreSelectionsAction restores the selection state and that the head RestoreSelectionsAction does nothing (except create a twin). when redoing the RestoreSelectionsAction which was originally at the head of the undo action list is now at the tail of the redo list and so it needs to restore the selections.Likewise the RestoreSelectionsAction which was at the tail of the undo action list will be at the head of the redo action list and so it is this actions turn to do nothing. ToggleStatus: The initial toggle status SelStateShared: This flag indicates that the SelState is shared by a pair of RestoreSelActions. If this flag is set then the Toggle flag must also be set. RenderStartBlobs: Should the selection blobs be rendered for the start selection state ? RenderEndBlobs: Should the selection blobs be rendered for the end selection state ? StartRestore: TRUE indicates that this is the first restore action executed when the operation is undone.
AC_OK : The action was successfully initialised and added to the operation. The function calls the Action::Init function passing the runtime class of a RestoreSelectionsAction.
Definition at line 4394 of file ops.cpp. 04404 { 04405 // If the SelState is shared then Toggle must be TRUE. This is so that we know when 04406 // to delete the SelState. 04407 ENSURE( (!SelStateShared || Toggle), "Invalid flags passed to RestoreSelectionsAction"); 04408 04409 // Try to allocate memory for the action 04410 ActionCode Ac = (Action::Init(pOp, 04411 pActionList, 04412 sizeof(RestoreSelectionsAction) + SelState->GetSize(), 04413 CC_RUNTIME_CLASS(RestoreSelectionsAction), 04414 NewAction)); 04415 if (*NewAction != NULL) 04416 { 04417 ((RestoreSelectionsAction*)(*NewAction))->SelState = SelState; 04418 ((RestoreSelectionsAction*)(*NewAction))->toggle = Toggle; 04419 ((RestoreSelectionsAction*)(*NewAction))->toggleStatus = ToggleStatus; 04420 ((RestoreSelectionsAction*)(*NewAction))->SelStateShared = SelStateShared; 04421 ((RestoreSelectionsAction*)(*NewAction))->RenderStartBlobs = RenderStartBlobs; 04422 ((RestoreSelectionsAction*)(*NewAction))->RenderEndBlobs = RenderEndBlobs; 04423 ((RestoreSelectionsAction*)(*NewAction))->StartRestore = StartRestore; 04424 04425 } 04426 return (Ac); 04427 }
|
|
All RestoreSelections actions have a pointer to a selection state. This selection state is passed on to the actions twin, and therefore should not be deleted in the actions destructor. The slaughter method is responsible for deleting the SelState.
Reimplemented from Action. Definition at line 4211 of file ops.cpp. 04212 { 04213 // Determine if the SelState should be deleted here or in another RestoreSelectionsAction 04214 if (SelStateShared) 04215 { 04216 ENSURE(toggle, "If the SelState is shared then the toggle flag should be set"); 04217 if (toggleStatus) 04218 { 04219 ENSURE (SelState != NULL, "Trying to delete a NULL SelectionState"); 04220 delete SelState; 04221 } 04222 } 04223 else // The SelState is not shared so we can safely delete the selection state 04224 { 04225 delete SelState; 04226 } 04227 Action::Slaughter(); 04228 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|