#include <ops.h>
Inheritance diagram for UnApplyAction:
Public Member Functions | |
UnApplyAction () | |
UnApplyAction constructor. | |
~UnApplyAction () | |
virtual ActionCode | Execute () |
Executes the UnApplyAction which hides the node. It also creates a ShowNodeAction and adds it to the opposite ActionList. | |
void | RecordTag (NodeAttribute *pAttr) |
Static Public Member Functions | |
static ActionCode | Init (Operation *const pOp, ActionList *pActionList, Node *pActionNode, 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 | |
Node * | m_pApplyNode |
NodeAttribute * | m_pAttribute |
TAG | m_nAttrTag |
BOOL | IncludeSubtreeSize:1 |
BOOL | TellSubtree:1 |
Friends | |
class | OpApplyAttrInteractive |
Definition at line 938 of file ops.h.
|
UnApplyAction constructor.
Definition at line 3779 of file ops.cpp. 03780 { 03781 m_pApplyNode = NULL; 03782 m_pAttribute = NULL; 03783 m_nAttrTag = 0; 03784 IncludeSubtreeSize = FALSE; 03785 TellSubtree = FALSE; 03786 }
|
|
Definition at line 3788 of file ops.cpp. 03789 { 03790 if (m_pAttribute) 03791 { 03792 delete m_pAttribute; 03793 m_pAttribute = NULL; 03794 } 03795 }
|
|
Executes the UnApplyAction which hides the node. It also creates a ShowNodeAction and adds it to the opposite ActionList.
Reimplemented from Action. Definition at line 3815 of file ops.cpp. 03816 { 03817 ApplyAction* pApplyAct; 03818 ActionCode ActCode; 03819 03820 // NodeHidden* HideNode = NULL; 03821 03822 // Attempt to initialise the apply action which will re-apply the node that 03823 // we are about to unapply. 03824 if ((ActCode = ApplyAction::Init(pOperation, 03825 pOppositeActLst, 03826 m_pApplyNode, 03827 m_pAttribute, 03828 IncludeSubtreeSize, 03829 ( Action**)(&pApplyAct), 03830 TellSubtree)) == AC_FAIL) 03831 return ActCode; 03832 03833 // Tell our parent that we have changed so any cached info he has must be removed 03834 // (Deals with cases where DoInvalidateRegion has been used and so no other 03835 // cache release calls have been made) 03836 if (m_pApplyNode->IsBounded()) 03837 ((NodeRenderableBounded*)m_pApplyNode)->ReleaseCached(TRUE, FALSE, TRUE, TRUE); 03838 03839 // Determine which node needs hiding 03840 CCRuntimeClass* pClass = m_pAttribute->GetRuntimeClass(); 03841 03842 // We need to search the children of node to find the attribute 03843 // Note that if this action has recorded a Tag, that attribute should not have been 03844 // mutated before trying to execute this action. If it has then the mutated attribute 03845 // will have a new tag and will not be found. c.f. interactive dragging... 03846 Node* NodeToHide = m_pApplyNode->FindFirstChild(); 03847 BOOL bLookingForEffect = m_pApplyNode->IsAnObject() && ((NodeRenderableInk*)m_pApplyNode)->IsValidEffectAttr(m_pAttribute); 03848 while (NodeToHide != NULL) 03849 { 03850 if (NodeToHide->GetRuntimeClass() == pClass && 03851 (m_nAttrTag == 0 || m_nAttrTag == NodeToHide->GetTag()) && 03852 (bLookingForEffect == (NodeToHide->IsAnAttribute() && ((NodeAttribute*)NodeToHide)->IsEffectAttribute())) 03853 ) 03854 // We have found the attribute to hide 03855 break; 03856 03857 NodeToHide = NodeToHide->FindNext(); 03858 } 03859 03860 if (NodeToHide != NULL) 03861 { 03862 // If the node being hidden is an attribute which will effect the bounds of it's parent 03863 // bounded object then we must invalidate the parents bounds 03864 if (m_pApplyNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderableBounded))) 03865 ((NodeRenderableBounded*)m_pApplyNode)->InvalidateBoundingRect(); 03866 03867 NodeToHide->CascadeDelete(); 03868 delete NodeToHide; 03869 NodeToHide = NULL; 03870 03871 // Mark the parent layer as edited as something has changed on it 03872 // Could use SetParentLayerAsEdited but only implemented for NodeRenderableInk at present 03873 Layer* pLayer = (Layer*) m_pApplyNode->FindParent(CC_RUNTIME_CLASS(Layer)); 03874 if (pLayer) 03875 pLayer->SetEdited(TRUE); 03876 03877 } 03878 03879 return ActCode; 03880 }
|
|
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.
NodeToHide: The node to hide IncludeSubtreeSize: The size of a UnApplyAction is always sizeof(UnApplyAction), however the IncludeSubtreeSize flag is required by the twin ShowNodeAction.
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 UnApplyAction.
Definition at line 3929 of file ops.cpp. 03937 { 03938 ActionCode Ac = (Action::Init(pOp, 03939 pActionList, 03940 sizeof(UnApplyAction) + sizeof(pActionAttribute), 03941 CC_RUNTIME_CLASS(UnApplyAction), 03942 NewAction)); 03943 03944 if (*NewAction != NULL) 03945 { 03946 UnApplyAction* pAction = (UnApplyAction*)(*NewAction); 03947 03948 // Store the runtime class of the attribute so that we can find it 03949 pAction->m_pApplyNode = pActionApplyNode; 03950 pAction->m_pAttribute = (NodeAttribute*)pActionAttribute->SimpleCopy(); 03951 pAction->IncludeSubtreeSize = IncludeSubtreeSize; 03952 pAction->TellSubtree = TellSubtree; 03953 pAction->RecordTag(pActionAttribute); 03954 } 03955 03956 return (Ac); 03957 }
|
|
Definition at line 3959 of file ops.cpp. 03960 { 03961 // If it's also a Wix attribute then store its tag so it can be uniquely identified 03962 // when the attribute must be hidden again. 03963 // if (pAttr->IS_KIND_OF(TemplateAttribute) || pAttr->IsEffectAttribute()) 03964 if (pAttr->IS_KIND_OF(TemplateAttribute)) 03965 m_nAttrTag = pAttr->GetTag(); 03966 else 03967 m_nAttrTag = 0; 03968 }
|
|
|
|
|
|
|
|
|
|
|
|
|