RecordBoundsAction Class Reference

An action which simply marks the fact that, when undone, it has to create a RecalcBoundsAction, and invalidate the existing bounds. It is the opposite action to RecalcBounds and should be used after creating a Recalc object and modifying the bounding box. Even when executed, all the action does is invalidate the screen and create a Recalc action. More...

#include <pathedit.h>

Inheritance diagram for RecordBoundsAction:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 RecordBoundsAction ()
 Constructor for the action to recalculate bounds of a node.
 ~RecordBoundsAction ()
virtual ActionCode Execute ()
 Will replace the bounding box of an object, recording the existing bounds.

Static Public Member Functions

static ActionCode Init (Operation *pOp, ActionList *pActionList, NodeRenderableBounded *WhichNode, 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 DoRecord (Operation *pOp, ActionList *pActionList, NodeRenderableBounded *WhichNode, BOOL OptimiseRedraw=FALSE)
 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. Then it invalidates the current view according to the blob rectangle of the object.

Protected Attributes

NodeRenderableBoundedChangedNode

Detailed Description

An action which simply marks the fact that, when undone, it has to create a RecalcBoundsAction, and invalidate the existing bounds. It is the opposite action to RecalcBounds and should be used after creating a Recalc object and modifying the bounding box. Even when executed, all the action does is invalidate the screen and create a Recalc action.

Author:
Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/7/94
See also:
RecalcBoundsAction

Definition at line 902 of file pathedit.h.


Constructor & Destructor Documentation

RecordBoundsAction::RecordBoundsAction  ) 
 

Constructor for the action to recalculate bounds of a node.

Author:
Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/7/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 9872 of file pathedit.cpp.

09873 {
09874 }

RecordBoundsAction::~RecordBoundsAction  ) 
 

Definition at line 10021 of file pathedit.cpp.

10022 {
10023 }


Member Function Documentation

ActionCode RecordBoundsAction::DoRecord Operation pOp,
ActionList pActionList,
NodeRenderableBounded WhichNode,
BOOL  OptimiseRedraw = FALSE
[static]
 

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. Then it invalidates the current view according to the blob rectangle of the object.

Author:
Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/7/94
Parameters:
pOp is the currently running operation [INPUTS] pActionList is a pointer ot the action list to which the action should be appended WhichNode is the node we're dealing with here OptimiseRedraw : If this is TRUE and WhichNode is a NodePath then the NeedToRender flags are used to determine the areas of the screen to redraw
- [OUTPUTS]
Returns:
Action code which indicates success or failure to create the action

Errors: ERROR2 if the operation dosen't have a document ERROR3 if you attempt to optimise for a non path object

See also:
RecalcBoundsAction::DoRecalc

Definition at line 9944 of file pathedit.cpp.

09948 {
09949     ERROR3IF(OptimiseRedraw && !WhichNode->IsNodePath(),"Can't optimise redraw for a non-path object");
09950 
09951     RecordBoundsAction* RecAction;
09952     ActionCode Act = RecordBoundsAction::Init(pOp, pActionList, WhichNode, (Action**)&RecAction);
09953     if (Act != AC_FAIL)
09954     {
09955         // Force a re-draw of the place where the path used to be
09956         Document* pDoc = pOp->GetWorkingDoc();
09957         ERROR2IF( pDoc == NULL, AC_FAIL, "There was no current document in RecordBoundsAction::DoRecord" );
09958 
09959         Spread* pSpread = WhichNode->FindParentSpread();
09960 
09961         // Do an optimised redraw if possible
09962         if (WhichNode->IsNodePath() && OptimiseRedraw)
09963             OptimiseRedraw = RecalcBoundsAction::CauseOptimisedRedraw((NodePath*)WhichNode, pDoc, pSpread);
09964         else
09965             OptimiseRedraw = FALSE;
09966 
09967         if (!OptimiseRedraw)
09968             pDoc->ForceRedraw( pSpread, WhichNode->GetUnionBlobBoundingRect(), FALSE, WhichNode);
09969     }
09970     return Act;
09971 }

ActionCode RecordBoundsAction::Execute  )  [virtual]
 

Will replace the bounding box of an object, recording the existing bounds.

Author:
Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/7/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
ActionCode, either AC_OK, AC_NORECORD or AC_FAIL

Errors: -

See also:
-

Reimplemented from Action.

Definition at line 9989 of file pathedit.cpp.

09990 {
09991     // This is undoing a bounds recalculation
09992     
09993     RecalcBoundsAction* ReAction;
09994     
09995     // Create a redo action for this action, which is also a RecalcBoundsAction
09996 
09997     ActionCode Act;
09998     Act = RecalcBoundsAction::Init(pOperation, 
09999                                     pOppositeActLst, 
10000                                     ChangedNode,
10001                                     (Action**)(&ReAction));
10002     if (Act == AC_FAIL)
10003         return AC_FAIL;
10004 
10005     // Force a re-draw of the place where the path used to be
10006     Document* pDoc = GetWorkingDoc();
10007     ERROR2IF( pDoc == NULL, AC_FAIL, "There was no current document when undoing RecalcBounds" );
10008     Spread* pSpread = ChangedNode->FindParentSpread();
10009     
10010     if (pSpread != NULL)
10011     {
10012         DocRect Invalid = ChangedNode->GetUnionBlobBoundingRect();
10013         pDoc->ForceRedraw( pSpread, Invalid, FALSE, ChangedNode );
10014     }
10015 
10016     return Act;
10017 }

ActionCode RecordBoundsAction::Init Operation pOp,
ActionList pActionList,
NodeRenderableBounded WhichNode,
Action **  NewAction
[static]
 

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.

Author:
Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/7/94
Parameters:
pOp is the pointer to the operation to which this action belongs [INPUTS] pActionList is the action list to which this action should be added WhichNode is the object whose bounds we want to recalculate
NewAction is a pointer to a pointer to an action, allowing the function to return [OUTPUTS] a pointer to the created action
Returns:
ActionCode, one of AC_OK, AC_NO_RECORD or AC_FAIL

Errors: -

See also:
Action::Init()

Definition at line 9904 of file pathedit.cpp.

09908 {
09909     UINT32 ActSize = sizeof(RecordBoundsAction);
09910 
09911     ActionCode Ac = Action::Init( pOp, pActionList, ActSize, CC_RUNTIME_CLASS(RecordBoundsAction), NewAction);
09912     if ((Ac == AC_OK) && (*NewAction != NULL))
09913         ((RecordBoundsAction*)*NewAction)->ChangedNode = WhichNode;
09914 
09915     return Ac;
09916 }


Member Data Documentation

NodeRenderableBounded* RecordBoundsAction::ChangedNode [protected]
 

Definition at line 920 of file pathedit.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:20 2007 for Camelot by  doxygen 1.4.4