ApplyAction Class Reference

When executed this action will show a node. It will also generate a HideNodeAction action adding it to the opposite Action list. More...

#include <ops.h>

Inheritance diagram for ApplyAction:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 ApplyAction ()
 ApplyAction constructor.
virtual ~ApplyAction ()
virtual ActionCode Execute ()
 Executes the ApplyAction which un-hides the node. It also creates a UnApplyAction and adds it to the opposite ActionList.

Static Public Member Functions

static ActionCode Init (Operation *const pOp, ActionList *pActionList, Node *pActionApplyNode, NodeAttribute *pActionAttribute, BOOL IncludeSubtreeSize, Action **NewAction, BOOL TellSubtree=TRUE)
 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

Nodem_pApplyNode
NodeAttributem_pAttribute
BOOL IncludeSubtreeSize:1
BOOL TellSubtree:1

Friends

class OpApplyAttrInteractive

Detailed Description

When executed this action will show a node. It will also generate a HideNodeAction action adding it to the opposite Action list.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/07/2005
See also:
HideNodeAction

Definition at line 993 of file ops.h.


Constructor & Destructor Documentation

ApplyAction::ApplyAction  ) 
 

ApplyAction constructor.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/07/2005
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
- Notes: Phil, 26/07/2005 What a mess! Attribute application needs to be rewritten ShowNode/HideNode to control attribute undo is suspect because attribute optimisation can remove attributes outside of the undo system. UnapplyAction and ApplyAction are implemented to overcome this limitation but really, they are the way attribute application should always have been recorded in undo, given the above. OpRepeatApplyAttribToSelected is all wrong. It makes quick, non-undoable changes to a set of attributes after OpApplyAttribToSelected has applied them. This means that attributes may be optimised away AFTER the undo actions have been recorded. It should work the way most other solid dragging works - create a temporary set of attrs for fast manipulation druing dragging then remove them and do a one-shot undoable apply when the drag ends.

Definition at line 4001 of file ops.cpp.

04002 {
04003     m_pApplyNode = NULL;
04004     m_pAttribute = NULL;
04005 }

ApplyAction::~ApplyAction  )  [virtual]
 

Definition at line 4007 of file ops.cpp.

04008 {
04009     if (m_pAttribute)
04010     {
04011         delete m_pAttribute;
04012         m_pAttribute = NULL;
04013     }
04014 }   


Member Function Documentation

ActionCode ApplyAction::Execute  )  [virtual]
 

Executes the ApplyAction which un-hides the node. It also creates a UnApplyAction and adds it to the opposite ActionList.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/07/2005
Parameters:
- [INPUTS]
ActionCode indicating if the action was successfully executed or not [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from Action.

Definition at line 4033 of file ops.cpp.

04034 {  
04035     UnApplyAction* pUnApplyAction;  
04036     ActionCode ActCode;  
04037 
04038      // Attempt to initialise the hide node action  
04039     if ((ActCode = UnApplyAction::Init(pOperation,                    
04040                                         pOppositeActLst,
04041                                         m_pApplyNode,
04042                                         m_pAttribute,
04043                                         IncludeSubtreeSize,  
04044                                         ( Action**)(&pUnApplyAction),
04045                                         TellSubtree)) != AC_FAIL) 
04046     {
04047         ERROR3IF(m_pAttribute==NULL, "ApplyAction::Execute has no attribute!\n");
04048         if (m_pAttribute)
04049         {
04050             NodeAttribute* pAttr = (NodeAttribute*)m_pAttribute->SimpleCopy();
04051             BOOL bEffectRootOnly = (m_pApplyNode->IsAnObject() && ((NodeRenderableInk*)m_pApplyNode)->IsValidEffectAttr(pAttr));
04052             if (bEffectRootOnly)
04053                 pAttr->AttachNode(m_pApplyNode, LASTCHILD);
04054             else
04055                 pAttr->AttachNode(m_pApplyNode, FIRSTCHILD);
04056 
04057             if (pUnApplyAction)
04058                 pUnApplyAction->RecordTag(pAttr);
04059         }
04060 
04061         // If the node being shown is an attribute which will effect the bounds of it's parent
04062         // bounded object then we must invalidatate the parent's bounds
04063         if (m_pApplyNode && m_pApplyNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderableBounded)))
04064             ((NodeRenderableBounded*)m_pApplyNode)->InvalidateBoundingRect();
04065 
04066         // New 31/7/97 Neville
04067         // Mark the parent layer as edited as something has changed on it
04068         // Could use SetParentLayerAsEdited but only implemented for NodeRenderableInk at present
04069         Layer* pLayer = (Layer*)m_pApplyNode->FindParent(CC_RUNTIME_CLASS(Layer));
04070         if (pLayer)
04071             pLayer->SetEdited(TRUE);
04072 
04073         // Tell our parent that we have changed so any cached info he has must be removed
04074         // (Deals with cases where DoInvalidateRegion has been used and so no other
04075         //  cache release calls have been made)
04076         if (m_pApplyNode->IsBounded())
04077             ((NodeRenderableBounded*)m_pApplyNode)->ReleaseCached(TRUE, FALSE, TRUE, TRUE);
04078     }
04079 
04080     return (ActCode);                   
04081 }     

ActionCode ApplyAction::Init Operation *const   pOp,
ActionList pActionList,
Node pActionApplyNode,
NodeAttribute pActionAttribute,
BOOL  IncludeSubtreeSize,
Action **  NewAction,
BOOL  TellSubtree = TRUE
[static]
 

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.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/07/2005
Parameters:
pOp,: The operation to which the action should be added [INPUTS]
pActionList: The action list in the operation object

HiddenToShow: The hidden node to show when the action is executed

IncludeSubtreeSize: This flag should be set if the action size should include the size of the subtree which is hidden.

Parameters:
NewAction,: A pointer to the action if it could be allocated. [OUTPUTS]
Returns:
AC_FAIL: There was not enough room in the operation history for the action and the user did not wish to continue. Usually End() should be called in this situation.
AC_NORECORD: There was not enough room in the operation history for the action, but the user requested that he wished to continue without undo.

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 ShowNodeAction.

Returns:
Errors: -
See also:
Action::Init

Definition at line 4130 of file ops.cpp.

04137 { 
04138     // Determine the size of the action 
04139     ActionCode Ac = (Action::Init(pOp,
04140                      pActionList,
04141                      sizeof(ApplyAction) + sizeof(pActionAttribute),
04142                      CC_RUNTIME_CLASS(ApplyAction), 
04143                      NewAction));
04144     if (*NewAction != NULL) 
04145     {
04146         ApplyAction* pAction = (ApplyAction*)(*NewAction);
04147 
04148         pAction->m_pApplyNode       = pActionApplyNode;
04149         pAction->m_pAttribute       = (NodeAttribute*)pActionAttribute->SimpleCopy();
04150         pAction->IncludeSubtreeSize = IncludeSubtreeSize; 
04151         pAction->TellSubtree        = TellSubtree; 
04152     }
04153 
04154     return (Ac); 
04155 } 


Friends And Related Function Documentation

friend class OpApplyAttrInteractive [friend]
 

Definition at line 997 of file ops.h.


Member Data Documentation

BOOL ApplyAction::IncludeSubtreeSize [private]
 

Definition at line 1016 of file ops.h.

Node* ApplyAction::m_pApplyNode [private]
 

Definition at line 1011 of file ops.h.

NodeAttribute* ApplyAction::m_pAttribute [private]
 

Definition at line 1012 of file ops.h.

BOOL ApplyAction::TellSubtree [private]
 

Definition at line 1017 of file ops.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:49:59 2007 for Camelot by  doxygen 1.4.4