#include <ops.h>
Inheritance diagram for TransformNodeAction:
Public Member Functions | |
TransformNodeAction () | |
TransformNodeAction constructor. | |
~TransformNodeAction () | |
void | Slaughter () |
destructor which gets called when an operation is deleted | |
virtual ActionCode | Execute () |
Executes the TransformNodeAction which transforms the range of nodes. It also creates another TransformNodeAction passing it the inverse of the transform. | |
void | CombineWith (TransformNodeAction *pMatrixTransformAction) |
This function can only be called on a TransformNodeAction with a Trans2DMatrix Transform. The transform's matrix is multiplied by the matrix in the pTransformAction therby combining the transforms. | |
TransformBase * | GetTransform () |
Used to find the transform within the TransformNodeAction. | |
const Range * | GetActionRange () const |
Static Public Member Functions | |
static ActionCode | Init (Operation *const pOp, ActionList *pActionList, Range NodeRangeIn, TransformBase *Trans, List *pNodeList, 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 | |
Range | NodeRange |
List * | m_pNodeList |
TransformBase * | pTrans |
Definition at line 1127 of file ops.h.
|
TransformNodeAction constructor.
Definition at line 4584 of file ops.cpp. 04585 { 04586 m_pNodeList = NULL; 04587 pTrans = NULL; 04588 }
|
|
Definition at line 4590 of file ops.cpp. 04591 { 04592 if (m_pNodeList) 04593 { 04594 m_pNodeList->DeleteAll(); 04595 delete m_pNodeList; 04596 m_pNodeList = NULL; 04597 } 04598 04599 if (pTrans) 04600 { 04601 delete pTrans; 04602 pTrans = NULL; 04603 } 04604 }
|
|
This function can only be called on a TransformNodeAction with a Trans2DMatrix Transform. The transform's matrix is multiplied by the matrix in the pTransformAction therby combining the transforms.
Definition at line 4849 of file ops.cpp. 04850 { 04851 // First lets make sure that we can combine the transforms 04852 ERROR3IF(!(pMatrixTransformAction->GetTransform()->IS_KIND_OF(Trans2DMatrix)), 04853 "Cannot combine Transform actions"); 04854 ERROR3IF(!(GetTransform()->IS_KIND_OF(Trans2DMatrix)), 04855 "Cannot combine transform actions"); 04856 04857 Trans2DMatrix* Trans1 = ((Trans2DMatrix*)GetTransform()); 04858 Trans2DMatrix* Trans2 = ((Trans2DMatrix*)(pMatrixTransformAction->GetTransform())); 04859 (*Trans1)*=(*Trans2); 04860 }
|
|
Executes the TransformNodeAction which transforms the range of nodes. It also creates another TransformNodeAction passing it the inverse of the transform.
Reimplemented from Action. Definition at line 4624 of file ops.cpp. 04625 { 04626 // DMc - changed 17/8/99 04627 // It didn't work in its old state with compound nodes as the node range seemed to 04628 // be corrupted in the transformations 04629 // Thus, made it more robust by having a node list of the range which is first passed in 04630 04631 // Further comment. Looks like things have been fiddled with too much to rely on the 04632 // range to be correct when redoing the op (check beveled shapes with text stories) 04633 // So I tidied up Daves node lists and corrected his transform matrix (sjk 9/8/00) 04634 TransformNodeAction* TransformNodeAct; 04635 ActionCode ActCode; 04636 04637 Trans2DMatrix * pTransform = new Trans2DMatrix((const Trans2DMatrix&) *pTrans); 04638 pTransform->Invert(); 04639 04640 // Create an action to transform the node back to its initial position 04641 if ( (ActCode = TransformNodeAction::Init(pOperation, 04642 pOppositeActLst, 04643 NodeRange, 04644 pTransform, 04645 m_pNodeList, 04646 (Action**)(&TransformNodeAct))) 04647 != AC_FAIL) 04648 { 04649 NodeListItem * pItem = (NodeListItem *)m_pNodeList->GetHead(); 04650 Node * pNode = NULL; 04651 04652 while (pItem) 04653 { 04654 pNode = pItem->pNode; 04655 04656 if (((NodeRenderable *)pNode)->IsNodeRenderableClass()) 04657 { 04658 ((NodeRenderable *)pNode)->Transform(*pTrans); 04659 // set the parent layer as having being edited 04660 pNode->SetParentLayerAsEdited(); 04661 } 04662 04663 pItem = (NodeListItem *)m_pNodeList->GetNext(pItem); 04664 } 04665 }; 04666 04667 return (ActCode); 04668 }
|
|
Definition at line 1147 of file ops.h. 01149 {return &NodeRange;}
|
|
Used to find the transform within the TransformNodeAction.
Definition at line 4824 of file ops.cpp. 04825 { 04826 return (pTrans); 04827 }
|
|
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.
NodeRange: The range of nodes to transform Trans: The Transform to apply to the nodes in the range
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 TransformNodeAction.
Definition at line 4714 of file ops.cpp. 04720 { 04721 ActionCode Ac = (Action::Init(pOp, 04722 pActionList, 04723 sizeof(TransformNodeAction), 04724 CC_RUNTIME_CLASS(TransformNodeAction), 04725 NewAction)); 04726 04727 if (Ac != AC_FAIL) 04728 { 04729 if (*NewAction != NULL) 04730 { 04731 // Store the range and transform in the action 04732 ((TransformNodeAction*)(*NewAction))->NodeRange = NodeRangeIn; 04733 ((TransformNodeAction*)(*NewAction))->pTrans = Trans; 04734 if (((TransformNodeAction*)(*NewAction))->m_pNodeList) 04735 { 04736 ((TransformNodeAction*)(*NewAction))->m_pNodeList->DeleteAll(); 04737 delete ((TransformNodeAction*)(*NewAction))->m_pNodeList; 04738 ((TransformNodeAction*)(*NewAction))->m_pNodeList = NULL; 04739 } 04740 04741 // run through the original node range, collecting all the selected nodes 04742 04743 ((TransformNodeAction*)(*NewAction))->m_pNodeList = new List; 04744 if (pNodeList == NULL) 04745 { 04746 Node *pNode = ((TransformNodeAction*)(*NewAction))->NodeRange.FindFirst(); 04747 while (pNode) 04748 { 04749 if (((NodeRenderable *)pNode)->IsNodeRenderableClass()) 04750 { 04751 TRACEUSER( "SimonK", _T("trans node : %s\n"), (LPCTSTR) pNode->GetRuntimeClass()->GetClassName() ); 04752 04753 NodeListItem * pItem = new NodeListItem(pNode); 04754 if (pItem) 04755 ((TransformNodeAction*)(*NewAction))->m_pNodeList->AddTail(pItem); 04756 } 04757 pNode = ((TransformNodeAction*)(*NewAction))->NodeRange.FindNext(pNode, FALSE); 04758 } 04759 } 04760 else 04761 { 04762 NodeListItem * pItem = (NodeListItem *)(pNodeList->GetHead()); 04763 Node * pNode = NULL; 04764 04765 while (pItem) 04766 { 04767 pNode = pItem->pNode; 04768 04769 if (((NodeRenderable *)pNode)->IsNodeRenderableClass()) 04770 { 04771 NodeListItem * pItem = new NodeListItem(pNode); 04772 if (pItem) 04773 ((TransformNodeAction*)(*NewAction))->m_pNodeList->AddTail(pItem); 04774 } 04775 04776 pItem = (NodeListItem *)pNodeList->GetNext(pItem); 04777 } 04778 } 04779 } 04780 04781 } 04782 return (Ac); 04783 }
|
|
destructor which gets called when an operation is deleted
Reimplemented from Action. Definition at line 4801 of file ops.cpp. 04802 { 04803 // Destroy the Trans object 04804 delete pTrans; 04805 pTrans = NULL; 04806 Action::Slaughter(); // Call base class to destroy this 04807 }
|
|
|
|
|
|
|