NodeCompound Class Reference

Encapsulates everything to do with compound nodes. More...

#include <nodecomp.h>

Inheritance diagram for NodeCompound:

NodeRenderableInk NodeRenderableBounded NodeRenderable Node CCObject SimpleCCObject NodeEffect NodeGroup NodeBitmapEffect NodeBlend NodeBrush NodeClipViewController NodeContourController NodeMould NodeMoulder NodeMouldGroup List of all members.

Public Member Functions

 NodeCompound ()
 Note:.
 ~NodeCompound ()
 Destructor Note:.
 NodeCompound (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
 This constructor initialises the nodes flags and links it to ContextNode in the direction specified by Direction. All neccesary tree links are updated. Note: SetUpShape() must be called before the NodeRegularShape is in a state in which it can be used.
virtual ChangeCode OnChildChange (ObjChangeParam *pParam)
 Processes child change messages Note:.
virtual void SetSelected (BOOL Status)
 Calls all the regenerate functions on all children (bottom to top) Note: Recursive function to regenerate all nodes Note: Selects this node. Note that in most cases you'll want to call Select() or DeSelect(), which are virtual methods in NodeRenderable.
virtual void Select (BOOL ReDraw)
 Selects the node.
virtual void DeSelect (BOOL ReDraw, BOOL bDeselectChildren=FALSE)
 DeSelects the node.
virtual BOOL IsCompound () const
virtual BOOL IsCompoundClass () const
virtual INT32 EstimateNodeComplexity (OpParam *details)
 This function estimates a complexity value for the node. The complexity value is based upon the total length of all paths in the node. See Also: OpBlendNodes::DeterminBlendObjectsProcessorHit ().
virtual BOOL HasVisibleChildren () const
 Determine whether this compound node is really doing anything useful.
virtual BOOL AllowOp_AccountForCompound (ObjChangeParam *pParam, BOOL SetOpPermissionState=TRUE, BOOL DoPreTriggerEdit=TRUE)
 Overrides Node::AllowOp_AccountForCompound - see definition of that function for a general explanation.
void SetDPI (double dpi)
double GetDPI ()
void SetPrinting (BOOL bPrinting)
BOOL IsPrinting ()
virtual BOOL RegenerateForPrinting ()
virtual DocRect GetInsideBoundingRect ()
 Gets the bounding rectangle of all nodes under me, except for the 'needs parent' nodes.
virtual NodeRenderableInkGetNodeToBlend ()
 Gets the blend node inside of this compound node Notes: Only applies to blends.
virtual NodeCompoundGetParentController () const
virtual NodeRenderableInkCreateTreeFromNodeToBlend (NodeRenderableInk *pNode, CCAttrMap *pAttrMap)
void SetStartBlendGroupNode (BOOL bFlag=TRUE)
void SetEndBlendGroupNode (BOOL bFlag=TRUE)
BOOL IsStartBlendGroupNode ()
BOOL IsEndBlendGroupNode ()
void SetBlendCreatedByNode (NodeCompound *pNode)
NodeCompoundGetBlendCreatedByNode ()
virtual BOOL PromoteAttributeApplicationToMe (CCRuntimeClass *pAttrClass) const
virtual String_32GetName ()
 This routine is used to obtain the name of a group.
virtual void SetName (String_32 &GroupName)
 For setting the group's name.
virtual BOOL CanBecomeA (BecomeA *pBecomeA)
 This function is used by the convert to shapes operation. It determines if the node or any of its children can convert themselves into an InkClass object.
virtual BOOL DoBecomeA (BecomeA *pBecomeA)
 Transforms the object into another type of object. Note: changed 7/10/94 by MarkN to take the pBecomeA param, so that more data could be passed to these functions in the future without causing massive rebuilds due to the editing of node.h.
virtual NodeGroupBecomeAGroup (UndoableOperation *pUndoOp)
 This method is for the convenience of any compound node descended from NodeGroup. It 'changes' the node into a group by following these steps: Attributes are undoably localised on this node. A group node is created. All children of this node are undoably moved under the group node. The group is undoably inserted into the tree as the next sibling. Attributes are undoably factored out on the group node. This node is undoably hidden.
virtual DocRect GetChildBoundingRect (BOOL bIncludeAttrs=TRUE)
 Get the bounding rect of the children without updating BOundingRectangle or IsBOundingRectValid for this node...
virtual BOOL HasEffectAttrs () const
 Detect Effect Attributes.
virtual BOOL ContainsEffects () const
 Detect Effects.
virtual void TransformEffectAttrs (TransformBase &Trans)
 Transforms the Child nodes of this node. This allows fills etc to move with the objects.
virtual DocRect GetExtendTargetBounds (const ExtendParams &ExtParams)
 Return a DocRect which contains the bounds of this node as defined and required by the Extending mechanism.
virtual NodeRenderableInkGetInkNodeFromController () const
 If we had a Controller node inherited class from NodeGroup then this function really belongs there. But we don't, so this function only returns anything if your node also returns TRUE to IsAController(). If so it will return the node that is shadowed, bevelled or contoured.
NodeBlendGetBlenderNode ()
void SetBlenderNode (NodeBlend *blender)

Static Public Member Functions

static BOOL AllocBlendConsList (ListType listType)
 Allocates the relevant list.
static BOOL AllocatedBlendConsList (ListType listType)
 Determins whether blending has generated intermediate compound nodes.
static BOOL BlendConsListInsert (ListType listType, Node *insertNode)
 Inserts a blends intermediate node into our list. This is necessary so that they may be deleted at the correct time.
static BOOL KillBlendConsListItem (ListType listType, NodeBlend *NodeBlend)
 Clears out the list of nodes that were generated when blending compound nodes which are associated (i.e. created) with the supplied NodeBlend.
static BOOL KillBlendConsList (ListType listType, BOOL killAll, BOOL isPrinting)
 Clears out the list of nodes that were generated when blending compound nodes.
static BOOL KillAllBlendBecomeAConsLists (BOOL killAll=FALSE, BOOL isPrinting=FALSE)
 Clears out the list of nodes that were generated when blending compound nodes (that were instructed to DOBECOMEA).
static BOOL KillAllBlendBecomeAConsListItem (NodeBlend *associatedWith)
 Clears out the list of nodes (dobecomea) that were generated when blending compound nodes which are associated (i.e. created) with the supplied NodeBlend.
static void SetIsForPrinting (BOOL newVal)

Protected Member Functions

virtual void PreInformParentsOfRegenerate ()
 Informs all parents of a regeneration of the node Notes: Call after the RegenerateNode function in each compound node.
virtual void PostInformParentsOfRegenerate ()
 Informs all parents of a regeneration of the node Notes: Call after the RegenerateNode function in each compound node.
NodeCompoundFindAssociatedBlendNode (BlendNodeParam *pParam)
 Gets the associated compound node I am to blend to, in the end blend path structure in the blend node param NULL if non found Notes: Only applies to blends Use in conjunction with overrided Blend functions in derived classes.
NodeCompoundGetShadowDeleteThisNode ()
NodeCompoundGetShadowThisNode ()
void SetShadowThisNode (NodeCompound *thisNode)
void SetShadowDeleteThisNode (NodeCompound *thisNode)

Protected Attributes

double m_DPI
BOOL m_bPrinting
BOOL m_bBlendStartNode
BOOL m_bBlendEndNode
NodeCompoundm_pBlendCreatedByNode
String_32 CompoundName
NodeBlendblenderNode

Static Protected Attributes

static NodeCompoundshadowThisNode = NULL
static NodeCompoundshadowDeleteThis = NULL
static ListblndConsBecomeAShadows = NULL
static ListblndConsBecomeABevels = NULL
static ListblndConsBecomeAContours = NULL
static BOOL isForPrinting = FALSE

Private Member Functions

 CC_DECLARE_DYNCREATE (NodeCompound)

Static Private Member Functions

static ListInitListPtr (ListType listType)
 Returns a ptr to the relevant list of nodes (that when allocated when blending).

Detailed Description

Encapsulates everything to do with compound nodes.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/5/99

Definition at line 165 of file nodecomp.h.


Constructor & Destructor Documentation

NodeCompound::NodeCompound  ) 
 

Note:.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/5/99
See also:

Definition at line 236 of file nodecomp.cpp.

00236                            : NodeRenderableInk()
00237 {
00238     m_DPI = 96.0;
00239     m_bPrinting = FALSE;
00240     m_bBlendStartNode = FALSE;
00241     m_bBlendEndNode = FALSE;
00242     m_pBlendCreatedByNode = NULL;
00243 }

NodeCompound::~NodeCompound  ) 
 

Destructor Note:.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/5/99
See also:

Definition at line 256 of file nodecomp.cpp.

00257 {
00258 
00259 }

NodeCompound::NodeCompound Node ContextNode,
AttachNodeDirection  Direction,
BOOL  Locked = FALSE,
BOOL  Mangled = FALSE,
BOOL  Marked = FALSE,
BOOL  Selected = FALSE
 

This constructor initialises the nodes flags and links it to ContextNode in the direction specified by Direction. All neccesary tree links are updated. Note: SetUpShape() must be called before the NodeRegularShape is in a state in which it can be used.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/5/99
Parameters:
ContextNode,: Pointer to a node which this node is to be attached to. [INPUTS] MonoOn Direction: MonoOff Specifies the direction in which the node is to be attached to the ContextNode. The values this variable can take are as follows:
PREV : Attach node as a previous sibling of the context node NEXT : Attach node as a next sibling of the context node FIRSTCHILD: Attach node as the first child of the context node LASTCHILD : Attach node as a last child of the context node

BoundingRect: Bounding rectangle

The remaining inputs specify the status of the node:

Locked: Is node locked ? Mangled: Is node mangled ? Marked: Is node marked ? Selected: Is node selected ?

See also:
NodeRegularShape::SetUpShape
Returns:
Errors: An ENSURE will occur if ContextNode is NULL

Definition at line 208 of file nodecomp.cpp.

00214                 : NodeRenderableInk(ContextNode, Direction, Locked, Mangled, Marked, Selected )
00215 {                         
00216     m_DPI = 96.0;
00217     m_bPrinting = FALSE;
00218 
00219     // blending attributes
00220     m_bBlendStartNode = FALSE;
00221     m_bBlendEndNode = FALSE;
00222     m_pBlendCreatedByNode = NULL;
00223 }                        


Member Function Documentation

BOOL NodeCompound::AllocatedBlendConsList ListType  listType  )  [static]
 

Determins whether blending has generated intermediate compound nodes.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/6/2000
Parameters:
The type of list to check [INPUTS]
[OUTPUTS] 
Returns:
TRUE if list is not empty, FALSE otherwise

Errors: -

Definition at line 992 of file nodecomp.cpp.

00993 {   
00994     List* accessList = InitListPtr (listType);
00995 
00996     if (accessList == NULL)
00997     {
00998         return (FALSE);
00999     }
01000     else
01001     {
01002         if (accessList->GetCount () > 0)
01003         {
01004             return (TRUE);
01005         }
01006     }
01007     
01008     return (FALSE);
01009 }

BOOL NodeCompound::AllocBlendConsList ListType  listType  )  [static]
 

Allocates the relevant list.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/6/2000
Parameters:
The type of list to allocate [INPUTS]
[OUTPUTS] 
Returns:
-

Errors: If the blendConstructedCompoundChildren list has already been allocated.

Definition at line 947 of file nodecomp.cpp.

00948 {
00949 #ifdef _DEBUG   
00950     List* accessList = InitListPtr (listType);
00951     if (accessList != NULL)
00952     {
00953         ERROR3IF (accessList->GetCount () > 0, "Trying to re-allocate a list that still has items in it!");
00954     }
00955 #endif
00956     
00957     switch (listType)
00958     {
00959         case LT_BECOMEA_SHADOWSLIST:
00960             blndConsBecomeAShadows = new List;
00961         break;
00962         case LT_BECOMEA_BEVELSLIST:
00963             blndConsBecomeABevels = new List;
00964         break;
00965         case LT_BECOMEA_CONTOURSLIST:
00966             blndConsBecomeAContours = new List;
00967         break;
00968         default:
00969             ERROR3 ("NodeCompound::AllocBlendConsList - You wan't what??? !!!");
00970             return (TRUE);
00971     }
00972     
00973     return (TRUE);
00974 }

BOOL NodeCompound::AllowOp_AccountForCompound ObjChangeParam pParam,
BOOL  SetOpPermissionState = TRUE,
BOOL  DoPreTriggerEdit = TRUE
[virtual]
 

Overrides Node::AllowOp_AccountForCompound - see definition of that function for a general explanation.

Returns:
TRUE if ANY of the objects in the compound node have allowed the op.
Controller nodes need to inform all of their other children whenever one child is queried via AllowOp. This is because unlike a normal group, editing one child may well affect its siblings, who must be informed of the edit.

See Also: Node::AllowOp, Node::AllowOp_AccountForCompound

Notes: Karim 20/12/2000 Added the OpTextFormat bodge for feathers on bevelled text - sorry!

Reimplemented from Node.

Definition at line 1538 of file nodecomp.cpp.

01541 {
01542     BOOL AnyAllowed = FALSE;
01543 
01544     Node* pCallingChild = (pParam->GetDirection() == OBJCHANGE_CALLEDBYCHILD) ?
01545                                                     pParam->GetCallingChild() : NULL;
01546     pParam->SetCallingChild(NULL);
01547 
01548     ObjChangeFlags Flags = pParam->GetChangeFlags();
01549     UndoableOperation* pChangeOp = pParam->GetOpPointer();
01550 
01551     if( Flags.Attribute || 
01552         Flags.TransformNode || 
01553         Flags.RegenerateNode ||
01554         ( pChangeOp != NULL 
01555           && pChangeOp->IS_KIND_OF( OpTextUndoable )
01556          ) )
01557     {
01558 
01559         ObjChangeDirection OldDirection = pParam->GetDirection();
01560         pParam->SetDirection(OBJCHANGE_CALLEDBYPARENT);
01561         Node* pNode = FindFirstChild();
01562 
01563         BOOL InformGeomLinkedAttrs =    SetOpPermissionState &&
01564                                         pChangeOp != NULL &&
01565                                         pChangeOp->MayChangeNodeBounds();
01566 
01567         while (pNode != NULL)
01568         {
01569             if (pNode != pCallingChild)
01570             {
01571                 if (pNode->IsAnObject())
01572                     AnyAllowed |= pNode->AllowOp(pParam, SetOpPermissionState, DoPreTriggerEdit);
01573                 else
01574                 {
01575                     if (pNode->IsAnAttribute() && ((NodeAttribute*)pNode)->IsLinkedToNodeGeometry())
01576                         if (InformGeomLinkedAttrs)
01577                             ((NodeAttribute*)pNode)->LinkedNodeGeometryHasChanged(pChangeOp);
01578                 }
01579             }
01580 
01581             pNode = pNode->FindNext();
01582         }
01583 
01584         pParam->SetDirection(OldDirection);
01585     }
01586 
01587     // if setting flags and any child allowed it, set this permission allowed
01588     if (SetOpPermissionState && AnyAllowed)
01589         SetOpPermission(PERMISSION_ALLOWED);
01590 
01591     return AnyAllowed;
01592 }

NodeGroup * NodeCompound::BecomeAGroup UndoableOperation pUndoOp  )  [virtual]
 

This method is for the convenience of any compound node descended from NodeGroup. It 'changes' the node into a group by following these steps: Attributes are undoably localised on this node. A group node is created. All children of this node are undoably moved under the group node. The group is undoably inserted into the tree as the next sibling. Attributes are undoably factored out on the group node. This node is undoably hidden.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/07/2000
Parameters:
pUndoOp ptr to an Op to use for all the undoable bits. [INPUTS]
This node is converted into a group. [OUTPUTS]
Returns:
A pointer to the new group node if successful, NULL otherwise.
Notes: The group's selection state is maintained - if this node is selected now, then the new group will be selected - although this may not be enough for some nodes, eg NodeShadowController et al.

Although calling this method on a normal NodeGroup should have no visible effect, it *is* wasteful of time and memory. So DON'T call this method on a plain NodeGroup!

Returns:
Errors: We require a valid Op ptr, so will ERROR3 and return FALSE if we don't get one (maybe this should be an ERROR2).

Reimplemented in NodeClipViewController.

Definition at line 1758 of file nodecomp.cpp.

01759 {
01760     // we can't do a thing without an Op...
01761 //  if (pUndoOp == NULL)
01762 //  {
01763 //      ERROR3("NodeGroup::BecomeAGroup; NULL Op pointer!");
01764 //      return NULL;
01765 //  }
01766 
01767     // localise any attributes into our children, to ensure that none of our direct children
01768     // are attributes. we do this because we'll be moving all our children, and directly
01769     // moving attrs is forbidden (see DoMoveNode() for more info).
01770     BOOL    ok;
01771     
01772     if (pUndoOp)
01773         ok = pUndoOp->DoLocaliseCommonAttributes(this);
01774     else
01775         ok = LocaliseCommonAttributes(FALSE, FALSE, NULL);
01776 
01777     // create the new group node for our children.
01778     NodeGroup* pGroup = NULL;
01779     if (ok)
01780     {
01781         ALLOC_WITH_FAIL(pGroup, new NodeGroup, pUndoOp);
01782         ok = (pGroup != NULL);
01783     }
01784 
01785     // insert the new group into the tree as our right-sibling.
01786     if (ok)
01787     {
01788         if (pUndoOp)
01789             ok = pUndoOp->DoInsertNewNode(pGroup, this, NEXT, TRUE, FALSE, IsSelected(), FALSE);
01790         else
01791             pGroup->AttachNode(this, NEXT, FALSE, FALSE);
01792     }
01793 
01794     // move all our children into the new group.
01795     // some of our children may be non-optimisable attributes, which DoMoveNode() won't move.
01796     // In these cases, we non-undoably put copies of them under the new group node (which is
01797     // undoably inserted anyway, so the non-undoable stuff should be ok).
01798     if (ok)
01799     {
01800         Node* pNextKid  = NULL;
01801         Node* pThisKid  = FindFirstChild();
01802         while (ok && pThisKid != NULL)
01803         {
01804             pNextKid = pThisKid->FindNext();
01805 
01806             if (pThisKid->IsAnObject())
01807             {
01808                 if (pUndoOp)
01809                 {
01810                     CALL_WITH_FAIL(pUndoOp->DoMoveNode(pThisKid, pGroup, LASTCHILD), pUndoOp, ok)
01811                 }
01812                 else
01813                 {
01814                     pThisKid->MoveNode(pGroup, LASTCHILD);
01815                 }
01816                 if (ok && pThisKid->IsSelected())
01817                     pGroup->SetParentOfSelected(TRUE);
01818             }
01819             else if (   pThisKid->IsAnAttribute() &&
01820                         !((NodeAttribute*)pThisKid)->ShouldBeOptimized() )
01821                 CALL_WITH_FAIL(pThisKid->CopyNode(pGroup, LASTCHILD), pUndoOp, ok)
01822 
01823             pThisKid = pNextKid;
01824         }
01825     }
01826 
01827     // factor out attributes on the new group - this matches the localise call up top.
01828     if (ok)
01829     {
01830         if (pUndoOp)
01831             ok = pUndoOp->DoFactorOutCommonChildAttributes(pGroup);
01832         else
01833             ok = pGroup->FactorOutCommonChildAttributes();
01834     }
01835 
01836     // invalidate the group's bounding box.
01837     if (ok) pGroup->InvalidateBoundingRect();
01838 
01839     // finally, hide ourself.
01840     if (ok)
01841     {
01842         if (pUndoOp)
01843             ok = pUndoOp->DoHideNode(this, TRUE);
01844         else
01845         {
01846             CascadeDelete();
01847             delete this;        // Scary!
01848         }
01849     }
01850 
01851     return ok ? pGroup : NULL;
01852 }

BOOL NodeCompound::BlendConsListInsert ListType  listType,
Node insertNode
[static]
 

Inserts a blends intermediate node into our list. This is necessary so that they may be deleted at the correct time.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/6/2000
Parameters:
The type of list to insert into, and the node to be inserted [INPUTS]
[OUTPUTS] 
Returns:
TRUE

Errors: ERROR3IF insertItem == NULL, ERROR3IF list == NULL

Definition at line 1289 of file nodecomp.cpp.

01290 {   
01291     ERROR3IF(insertNode == NULL, "BlendConsListInsert ():  Trying to insert a NULL item into a list!");
01292     
01293     List* accessList = InitListPtr (listType);
01294 
01295     ERROR3IF(accessList == NULL, "BlendConsListInsert ():  Trying to insert item into a list which is NULL!");
01296     
01297     NodeListItemWithDocPtr* pInsert = new NodeListItemWithDocPtr ();
01298                     
01299     if (pInsert)    // and insert into the paths list ....
01300     {
01301         pInsert->pNode = insertNode;
01302         pInsert->pOwner = Document::GetCurrent ();
01303         pInsert->isForPrinting = isForPrinting;
01304         accessList->AddHead (pInsert);
01305 
01306         TRACEUSER ("ChrisS", _T("Blend constructed list just inserted a node\n") );
01307     }
01308     
01309     return (TRUE);
01310 }

BOOL NodeCompound::CanBecomeA BecomeA pBecomeA  )  [virtual]
 

This function is used by the convert to shapes operation. It determines if the node or any of its children can convert themselves into an InkClass object.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/94
Parameters:
InkClass,: The class of object [INPUTS] pNumObjects = ptr to place number of objects of type pClass that will be created (Note: can be NULL). pNumObects in undefined on entry
- [OUTPUTS]
Returns:
TRUE if the node, or any of its children can transmogrify themselves to become an InkClass object
The number you put into pNumObjects (if it's not NULL) should exactly equal the total number of pClass objects you create. It should NOT contain any additional objects you may produce such as group objects for containing the pClass object, or attributes.

Also, the entry value of *pNumObjects cannot be assumed to be 0.

Returns:
Errors: -

Reimplemented from Node.

Reimplemented in NodeContourController, NodeClipViewController, NodeBitmapEffect, NodeMoulder, and NodeMould.

Definition at line 1624 of file nodecomp.cpp.

01625 {
01626     BOOL bOK=FALSE;
01627 
01628     Node* Current = FindFirstChild(); 
01629     while (Current != NULL)
01630     {
01631         if (Current->CanBecomeA(pBecomeA))              // Increments count
01632         {
01633             bOK = TRUE;
01634             if (!pBecomeA->IsCounting())
01635                 return TRUE;                            // Don't want total, so return now
01636         }
01637 
01638         Current = Current->FindNext();
01639     }
01640 
01641     return bOK;
01642 }

NodeCompound::CC_DECLARE_DYNCREATE NodeCompound   )  [private]
 

BOOL NodeCompound::ContainsEffects  )  const [virtual]
 

Detect Effects.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/08/2005
Returns:
TRUE if the node contains effects nodes FALSE otherwise

Definition at line 1957 of file nodecomp.cpp.

01958 {
01959     Node* pn = FindFirstChild();
01960     while (pn)
01961     {
01962         if (pn->IsEffect())
01963             return TRUE;
01964 
01965         if (pn->IsCompoundClass() && ((NodeCompound*)pn)->ContainsEffects())
01966             return TRUE;
01967 
01968         pn = pn->FindNext();
01969     }
01970 
01971     return FALSE;
01972 }

virtual NodeRenderableInk* NodeCompound::CreateTreeFromNodeToBlend NodeRenderableInk pNode,
CCAttrMap pAttrMap
[inline, virtual]
 

Reimplemented in NodeContourController.

Definition at line 220 of file nodecomp.h.

00221                                       { return NULL; }

void NodeCompound::DeSelect BOOL  ReDraw,
BOOL  bDeselectChildren = FALSE
[virtual]
 

DeSelects the node.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/6/94
Parameters:
ReDraw - TRUE if you want the blobs to be redrawn for you [INPUTS]

Reimplemented from NodeRenderable.

Definition at line 662 of file nodecomp.cpp.

00663 {
00664     NodeRenderableInk::DeSelect(ReDraw && PromoteHitTestOnChildrenToMe(), bDeselectChildren);
00665 }

BOOL NodeCompound::DoBecomeA BecomeA pBecomeA  )  [virtual]
 

Transforms the object into another type of object. Note: changed 7/10/94 by MarkN to take the pBecomeA param, so that more data could be passed to these functions in the future without causing massive rebuilds due to the editing of node.h.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> (and Markn)
Date:
29/4/94
Parameters:
pBecomeA = ptr to a class that contains all the info needed to become a new [INPUTS] type of node.
- [OUTPUTS]
Returns:
TRUE if the object has been transformed, FALSE if we run out of memory
14/6/95 (Markn): This now localises attributes before calling it's children, then factors them out at the end. This is so that common attrs trickle down to ALL leaf nodes, no matter how deep they may be. This is important when a child node is a blend, because the action of DoBecomeA() in the blend's case creates new child attrs for the path it creates, hence making any common attrs illegal.
Returns:
Errors: -
See also:
Node::CanBecomeA

Reimplemented from Node.

Reimplemented in NodeContourController, NodeClipViewController, NodeBlend, NodeBitmapEffect, NodeMoulder, and NodeMould.

Definition at line 1671 of file nodecomp.cpp.

01672 {
01673     ERROR2IF(pBecomeA == NULL,FALSE,"NULL BecomeA ptr");
01674 
01675     UndoableOperation* pOp = pBecomeA->GetUndoOp();
01676     BOOL ok;
01677 
01678     if (pBecomeA->GetReason() == BECOMEA_REPLACE)
01679     {
01680 //      ERROR2IF(pBecomeA->GetUndoOp() == NULL,FALSE,"Trying to replace a NodeGroup, but pUndoOp == NULL");
01681 
01682         // Make all attrs children of the child nodes
01683         if (pOp)
01684             ok = pOp->DoLocaliseCommonAttributes(this);
01685         else
01686             ok = LocaliseCommonAttributes();
01687         if (!ok)
01688             return FALSE;
01689     }
01690 
01691     // Call DoBecomeA on all the group's children
01692     Node* Current = FindFirstChild(); 
01693     Node* Next;
01694 
01695     while (Current != NULL)
01696     {
01697         Next = Current->FindNext();
01698         if(!(Current->DoBecomeA(pBecomeA)))
01699         {   
01700             return FALSE;       // Out of memory
01701         } 
01702         Current = Next; 
01703     }
01704 
01705     if (pBecomeA->GetReason() == BECOMEA_REPLACE)
01706     {
01707 //      ERROR2IF(pBecomeA->GetUndoOp() == NULL,FALSE,"Trying to replace a NodeGroup, but pUndoOp == NULL");
01708 
01709         // Factor out the attrs (needed after a call to DoLocaliseCommonAttributes
01710         if (pOp)
01711             ok = pOp->DoFactorOutCommonChildAttributes(this);
01712         else
01713             ok = FactorOutCommonChildAttributes();
01714         if (!ok)
01715             return FALSE;
01716     }
01717 
01718     return TRUE; 
01719 }

INT32 NodeCompound::EstimateNodeComplexity OpParam details  )  [virtual]
 

This function estimates a complexity value for the node. The complexity value is based upon the total length of all paths in the node. See Also: OpBlendNodes::DeterminBlendObjectsProcessorHit ().

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/09/2000
Parameters:
details any data that should be used for the calculation [INPUTS]
- [OUTPUTS]
Returns:
an estimate of the nodes complexity

Reimplemented from Node.

Reimplemented in NodeBlend.

Definition at line 1371 of file nodecomp.cpp.

01372 {
01373     INT32 total = 0;
01374     
01375     // Call DoBecomeA on all the group's children
01376     Node* Current = FindFirstChild(); 
01377     Node* Next;
01378 
01379     while (Current != NULL)
01380     {
01381         Next = Current->FindNext();
01382         total += Current->EstimateNodeComplexity (details);
01383         Current = Next;
01384     }
01385 
01386     return (total);
01387 }

NodeCompound * NodeCompound::FindAssociatedBlendNode BlendNodeParam pParam  )  [protected]
 

Gets the associated compound node I am to blend to, in the end blend path structure in the blend node param NULL if non found Notes: Only applies to blends Use in conjunction with overrided Blend functions in derived classes.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/3/2000
Parameters:
The blend node param (see blender & blendatt.h) [INPUTS]
Returns:
The node compound that has been found
See also:

Definition at line 784 of file nodecomp.cpp.

00785 {
00786     // count how many parents I have
00787     Node * pParent = FindParent();
00788 
00789     UINT32 NumParents = 0;
00790     UINT32 NumSameNodesAbove = 0;
00791 
00792     while (pParent)
00793     {
00794         if (pParent->GetRuntimeClass() == this->GetRuntimeClass())
00795         {
00796             NumSameNodesAbove++;
00797         }
00798         
00799         NumParents ++;
00800         pParent = pParent->FindParent();
00801     }
00802 
00803     UINT32 NumSameNodesBelow = 0;
00804 
00805     Node * pChild = FindFirstChild(CC_RUNTIME_CLASS(NodeCompound));
00806 
00807     while (pChild)
00808     {
00809         if (pChild->GetRuntimeClass() == this->GetRuntimeClass())
00810         {
00811             NumSameNodesBelow ++;
00812         }
00813 
00814         pChild = pChild->FindFirstChild(CC_RUNTIME_CLASS(NodeCompound));
00815     }
00816 
00817     // thus deduce how many similar nodes to myself are in the tree (including myself)
00818     UINT32 NumSameNodesInStartTree = NumSameNodesAbove + NumSameNodesBelow + 1;
00819 
00820     // ok, lets search the end node for similar nodes
00821     Node * pEndNode = pParam->GetEndBlendPath()->GetBlendNode();
00822 
00823     // if the end node isn't a compound node, then I can't find anything
00824     if (!pEndNode->IsCompoundClass())
00825         return NULL;
00826 
00827     // find the node with the closest number of parents to mine
00828     Node * pEndNodeStep = pEndNode;
00829     
00830     // build a list of all similar nodes in the end tree
00831     List EndNodeList;
00832 
00833     NodeListItem * pItem = NULL;
00834 
00835     while (pEndNodeStep)
00836     {
00837         if (pEndNodeStep->GetRuntimeClass() == this->GetRuntimeClass())
00838         {
00839             pItem = new NodeListItem(pEndNodeStep);
00840             ERRORIF(pItem == NULL, _R(IDE_NOMORE_MEMORY), NULL);
00841 
00842             EndNodeList.AddTail(pItem);
00843         }
00844 
00845         pEndNodeStep = pEndNodeStep->FindFirstChild(CC_RUNTIME_CLASS(NodeCompound));
00846     }
00847 
00848     // ok, now we have a list of nodes we have found in the end node list,
00849     // and we know how many exist above me in the start node list
00850     // therefore, pick a node in the list to match to
00851     if (EndNodeList.IsEmpty())
00852     {
00853         // can't match to any !
00854         return NULL;
00855     }
00856 
00857     NodeCompound * pRetnNode = NULL;
00858 
00859     if (NumSameNodesInStartTree == EndNodeList.GetCount())
00860     {
00861         // 1 to 1 relationship therefore easy !
00862         UINT32 Count = 0;
00863 
00864         pItem = (NodeListItem *)EndNodeList.GetHead();
00865 
00866         while (pItem)
00867         {
00868             if (Count == NumSameNodesAbove)
00869             {
00870                 // get the node to return
00871                 pRetnNode = (NodeCompound *)pItem->pNode;
00872 
00873                 EndNodeList.DeleteAll();
00874 
00875                 return pRetnNode;
00876             }
00877         }
00878 
00879         ERROR3("Number of nodes in list isn't the same as the number of nodes in start tree");
00880         EndNodeList.DeleteAll();
00881         return NULL;
00882     }
00883 
00884     EndNodeList.DeleteAll();
00885 
00886     // many to one and one to many relations are not implemented yet    
00887     return NULL;
00888 }

NodeCompound* NodeCompound::GetBlendCreatedByNode  )  [inline]
 

Definition at line 230 of file nodecomp.h.

00230 { return m_pBlendCreatedByNode; }

NodeBlend* NodeCompound::GetBlenderNode  )  [inline]
 

Definition at line 375 of file nodecomp.h.

00375 { return (blenderNode); }

DocRect NodeCompound::GetChildBoundingRect BOOL  bIncludeAttrs = TRUE  )  [virtual]
 

Get the bounding rect of the children without updating BOundingRectangle or IsBOundingRectValid for this node...

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/09/2004
Returns:
The bounding box of the children of the live effect

Definition at line 1895 of file nodecomp.cpp.

01896 {
01897     // just set it to be an empty rectangle
01898     DocRect BoundRect(0,0,0,0);
01899     
01900     Node* pNode = FindFirstChild();
01901     while (pNode!=NULL)
01902     {
01903         // Add in the bounding rect of this node with all the others
01904         if (pNode->IsBounded())
01905             BoundRect = BoundRect.Union(((NodeRenderableBounded*)pNode)->GetBoundingRect(!bIncludeAttrs));
01906 
01907         // And find the next node
01908         pNode = pNode->FindNext();
01909     }
01910 
01911     return BoundRect;
01912 }

double NodeCompound::GetDPI  )  [inline]
 

Definition at line 202 of file nodecomp.h.

00202 { return m_DPI; }

DocRect NodeCompound::GetExtendTargetBounds const ExtendParams ExtParams  )  [virtual]
 

Return a DocRect which contains the bounds of this node as defined and required by the Extending mechanism.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/06/2000
Parameters:
ExtParams const ref to an ExtendParams class describing the extension. [INPUTS]
[OUTPUTS] 
Returns:
The DocRect to treat as the bounding rect of this node when extending.
We treat x- and y- directions separately, and we always return our true bounds, unless we're extending in a direction, in which case we return the bounds of our extend control points, which currently means the union of the ExtendTargetBounds of our children.

Notes: Note that we're assuming that we always have kids. No kids => pear-shapey.

See also: SliceHelper::BoundingNodeSize().

Reimplemented from NodeRenderableBounded.

Reimplemented in NodeMould.

Definition at line 1451 of file nodecomp.cpp.

01452 {
01453     DocRect drBounds(0, 0, 0, 0);
01454     Node* pKid = FindFirstChild();
01455     while (pKid != NULL)
01456     {
01457         if (pKid->IsAnObject())
01458             drBounds = drBounds.Union(((NodeRenderableInk*)pKid)->GetExtendTargetBounds(ExtParams));
01459     }
01460 
01461     return drBounds;
01462 }

NodeRenderableInk * NodeCompound::GetInkNodeFromController  )  const [virtual]
 

If we had a Controller node inherited class from NodeGroup then this function really belongs there. But we don't, so this function only returns anything if your node also returns TRUE to IsAController(). If so it will return the node that is shadowed, bevelled or contoured.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/10/2000
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The ink node that is used by bevels, shadows and contours
See also:

Reimplemented in NodeContourController, NodeBitmapEffect, and NodeLockedEffect.

Definition at line 1875 of file nodecomp.cpp.

01876 {
01877     return NULL;
01878 }

DocRect NodeCompound::GetInsideBoundingRect  )  [virtual]
 

Gets the bounding rectangle of all nodes under me, except for the 'needs parent' nodes.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/6/99
Parameters:
[INPUTS] 
See also:

Definition at line 681 of file nodecomp.cpp.

00682 {
00683     Node * pNode = FindFirstChild();
00684 
00685     DocRect dr;
00686 
00687     while (pNode)
00688     {
00689         if (pNode->IsAnObject())
00690         {
00691             if (!pNode->NeedsParent(NULL))
00692             {
00693                 dr = dr.Union(((NodeRenderableInk *)pNode)->GetBoundingRect(FALSE, FALSE));
00694             }
00695         }
00696 
00697         pNode = pNode->FindNext();
00698     }
00699 
00700     return dr;
00701 }

String_32 & NodeCompound::GetName void   )  [virtual]
 

This routine is used to obtain the name of a group.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/6/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The name of the group

Errors: -

See also:
-

Definition at line 1482 of file nodecomp.cpp.

01483 {
01484     return CompoundName; 
01485 } 

NodeRenderableInk * NodeCompound::GetNodeToBlend  )  [virtual]
 

Gets the blend node inside of this compound node Notes: Only applies to blends.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/9/99
Parameters:
None [INPUTS]
See also:

Definition at line 902 of file nodecomp.cpp.

00903 {
00904     Node * pChild = FindFirstChild();
00905 
00906     while (pChild)
00907     {
00908         if (pChild->IsAnObject())
00909         {
00910             if (!pChild->NeedsParent(NULL))
00911             {
00912                 // we've found it
00913                 if (pChild->IsCompoundClass())
00914                 {
00915                     return ((NodeCompound*)pChild)->GetNodeToBlend();
00916                 }
00917                 
00918                 return (NodeRenderableInk*)pChild;
00919             }
00920         }
00921 
00922         pChild = pChild->FindNext();
00923     }
00924 
00925     // failure !
00926     return NULL;
00927 }

virtual NodeCompound* NodeCompound::GetParentController  )  const [inline, virtual]
 

Reimplemented from Node.

Reimplemented in NodeBlend.

Definition at line 217 of file nodecomp.h.

00217 {return NULL;}

NodeCompound* NodeCompound::GetShadowDeleteThisNode  )  [inline, protected]
 

Definition at line 327 of file nodecomp.h.

00327 { return (shadowDeleteThis); }

NodeCompound* NodeCompound::GetShadowThisNode  )  [inline, protected]
 

Definition at line 328 of file nodecomp.h.

00328 { return (shadowThisNode); }

BOOL NodeCompound::HasEffectAttrs  )  const [virtual]
 

Detect Effect Attributes.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/01/2005
Returns:
TRUE if the node has effect attributes FALSE otherwise

Definition at line 1929 of file nodecomp.cpp.

01930 {
01931     Node* pn = FindLastChild();
01932     while (pn && !pn->IsBounded())
01933     {
01934         if (pn->IsAnAttribute() && ((NodeAttribute*)pn)->IsEffectAttribute())
01935             return TRUE;
01936 
01937         pn = pn->FindPrevious();
01938     }
01939     return FALSE;
01940 }

BOOL NodeCompound::HasVisibleChildren  )  const [virtual]
 

Determine whether this compound node is really doing anything useful.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/04/2005
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if this compound is empty and can thus be deleted or hidden without the user seeing any difference

Definition at line 1406 of file nodecomp.cpp.

01407 {
01408     if (!this->IsRenderable())
01409         return FALSE;
01410 
01411     Node* pChild = FindFirstChild(); 
01412     while (pChild)
01413     {
01414         if (pChild->IsAnObject() && pChild->IsRenderable())
01415         {
01416             if (!pChild->NeedsParent((Node*)this))
01417                 return TRUE;
01418         }
01419 
01420         pChild = pChild->FindNext();
01421     }
01422 
01423     return FALSE;
01424 }

List * NodeCompound::InitListPtr ListType  listType  )  [static, private]
 

Returns a ptr to the relevant list of nodes (that when allocated when blending).

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/6/2000
Parameters:
The type of list to retrieve [INPUTS]
[OUTPUTS] 
Returns:
Ptr to the relevant list

Errors: -

Definition at line 1331 of file nodecomp.cpp.

01332 {
01333     List* list = NULL;
01334     
01335     switch (listType)
01336     {
01337         case LT_BECOMEA_SHADOWSLIST:
01338             list = blndConsBecomeAShadows;
01339         break;
01340         case LT_BECOMEA_BEVELSLIST:
01341             list = blndConsBecomeABevels;
01342         break;
01343         case LT_BECOMEA_CONTOURSLIST:
01344             list = blndConsBecomeAContours;
01345         break;
01346         default:
01347             list = NULL;
01348     }
01349     
01350     return (list);
01351 }

virtual BOOL NodeCompound::IsCompound  )  const [inline, virtual]
 

Reimplemented from Node.

Definition at line 190 of file nodecomp.h.

00190 { return TRUE; }        // See also BaseTextClass

virtual BOOL NodeCompound::IsCompoundClass  )  const [inline, virtual]
 

Reimplemented from Node.

Definition at line 191 of file nodecomp.h.

00191 { return TRUE; }

BOOL NodeCompound::IsEndBlendGroupNode  )  [inline]
 

Definition at line 227 of file nodecomp.h.

00227 { return m_bBlendEndNode; }

BOOL NodeCompound::IsPrinting  )  [inline]
 

Definition at line 206 of file nodecomp.h.

00206 { return m_bPrinting; }

BOOL NodeCompound::IsStartBlendGroupNode  )  [inline]
 

Definition at line 226 of file nodecomp.h.

00226 { return m_bBlendStartNode; }

BOOL NodeCompound::KillAllBlendBecomeAConsListItem NodeBlend associatedWith  )  [static]
 

Clears out the list of nodes (dobecomea) that were generated when blending compound nodes which are associated (i.e. created) with the supplied NodeBlend.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/6/2000
Parameters:
The blend that the item is associated with [INPUTS]
[OUTPUTS] 
Returns:
TRUE if success, FALSE otherwise
NOTE: The associated blend node is set by calling NodeCompound::SetBlenderNode ()

Definition at line 1245 of file nodecomp.cpp.

01246 {
01247     if (NodeCompound::AllocatedBlendConsList (LT_BECOMEA_BEVELSLIST))
01248     {
01249         TRACEUSER( "ChrisS", _T("Invoking delete all on CALLBACK BEVELS\n") );
01250         NodeCompound::KillBlendConsListItem (LT_BECOMEA_BEVELSLIST, associatedWith);
01251     }
01252 
01253     if (NodeCompound::AllocatedBlendConsList (LT_BECOMEA_CONTOURSLIST))
01254     {
01255         TRACEUSER ("ChrisS", _T("Invoking delete all on CALLBACK CONTOURS\n") );
01256         NodeCompound::KillBlendConsListItem (LT_BECOMEA_CONTOURSLIST, associatedWith);
01257     }
01258 
01259     // shadows MUST be deleted last (cause they could be shadowing a bevel, and if we
01260     // calls cascade delete on the shadow then this also deletes the bevel (leaving the
01261     // bevels list bevel vaped - but the list reference to it still valid).
01262     
01263     if (NodeCompound::AllocatedBlendConsList (LT_BECOMEA_SHADOWSLIST))
01264     {
01265         TRACEUSER ("ChrisS", _T("Invoking delete all on CALLBACK SHADOWS\n") );
01266         NodeCompound::KillBlendConsListItem (LT_BECOMEA_SHADOWSLIST, associatedWith);
01267     }
01268 
01269     return (TRUE);
01270 }

BOOL NodeCompound::KillAllBlendBecomeAConsLists BOOL  killAll = FALSE,
BOOL  isPrinting = FALSE
[static]
 

Clears out the list of nodes that were generated when blending compound nodes (that were instructed to DOBECOMEA).

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/6/2000
Parameters:
killAll - do we kill all items in the list, or just the ones that are a part [INPUTS] of the current document?
[OUTPUTS] 
Returns:
TRUE if success, FALSE otherwise

Errors:

Definition at line 1208 of file nodecomp.cpp.

01209 {
01210     if (NodeCompound::AllocatedBlendConsList (LT_BECOMEA_BEVELSLIST))
01211     {
01212         NodeCompound::KillBlendConsList (LT_BECOMEA_BEVELSLIST, killAll, isPrinting);
01213     }
01214 
01215     if (NodeCompound::AllocatedBlendConsList (LT_BECOMEA_CONTOURSLIST))
01216     {
01217         NodeCompound::KillBlendConsList (LT_BECOMEA_CONTOURSLIST, killAll, isPrinting);
01218     }
01219 
01220     if (NodeCompound::AllocatedBlendConsList (LT_BECOMEA_SHADOWSLIST))
01221     {
01222         NodeCompound::KillBlendConsList (LT_BECOMEA_SHADOWSLIST, killAll, isPrinting);
01223     }
01224 
01225     return (TRUE);
01226 }

BOOL NodeCompound::KillBlendConsList ListType  listType,
BOOL  killAll,
BOOL  isPrinting
[static]
 

Clears out the list of nodes that were generated when blending compound nodes.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/6/2000
Parameters:
The type of list that we are killing [INPUTS] killAll - do we kill all items in the list, or just the ones that are a part of the current document?
[OUTPUTS] 
Returns:
TRUE if success, FALSE otherwise

Errors: ERROR3IF the list == NULL

Definition at line 1029 of file nodecomp.cpp.

01030 {
01031     List* accessList = InitListPtr (listType);
01032 
01033     ERROR3IF(accessList == NULL, "KillBlendConsList ():  Trying to delete an empty list! - fruitless function call!");
01034 
01035     NodeListItemWithDocPtr* pCurrent = (NodeListItemWithDocPtr*) accessList->GetHead ();
01036 
01037     if (!killAll)
01038     {
01039         if (!isPrinting)
01040         {
01041             // user has closed a document - clear out any data that was required for rendering
01042 
01043             Document* pCurrentDoc = Document::GetCurrent ();
01044 
01045             ERROR3IF (pCurrentDoc == NULL, "No current document!");
01046             
01047             while (pCurrent)
01048             {
01049                 if (pCurrent->pOwner == pCurrentDoc)
01050                 {
01051                     NodeListItemWithDocPtr* pNext = (NodeListItemWithDocPtr*) accessList->GetNext (pCurrent);
01052                     
01053                     NodeListItemWithDocPtr* markedForDelete = (NodeListItemWithDocPtr*) accessList->RemoveItem (pCurrent);
01054 
01055                     markedForDelete->pNode->CascadeDelete ();
01056                     delete (markedForDelete->pNode);
01057 
01058                     pCurrent = pNext;
01059                 }
01060                 else
01061                 {
01062                     // the node is NOT linked to the current document - so we can't delete it ....
01063                     
01064                     pCurrent = (NodeListItemWithDocPtr*) accessList->GetNext (pCurrent);
01065                 }
01066             }
01067         }
01068         else
01069         {
01070             // were printing ....
01071             
01072             while (pCurrent)
01073             {
01074                 if (pCurrent->isForPrinting)
01075                 {
01076                     NodeListItemWithDocPtr* pNext = (NodeListItemWithDocPtr*) accessList->GetNext (pCurrent);
01077                     
01078                     NodeListItemWithDocPtr* markedForDelete = (NodeListItemWithDocPtr*) accessList->RemoveItem (pCurrent);
01079 
01080                     markedForDelete->pNode->CascadeDelete ();
01081                     delete (markedForDelete->pNode);
01082 
01083                     pCurrent = pNext;
01084                 }
01085                 else
01086                 {
01087                     // the node was not generated for printing - so we can't delete it ....
01088                     
01089                     pCurrent = (NodeListItemWithDocPtr*) accessList->GetNext (pCurrent);
01090                 }
01091             }
01092         }
01093     }
01094     else
01095     {
01096         // camelot is dying - clear out all data ....
01097         
01098         while (pCurrent)
01099         {
01100             pCurrent->pNode->CascadeDelete ();
01101             delete (pCurrent->pNode);
01102             
01103             pCurrent = (NodeListItemWithDocPtr*) accessList->GetNext (pCurrent);
01104         }
01105 
01106         accessList->DeleteAll ();
01107         delete (accessList);
01108 
01109         accessList = NULL;
01110 
01111         switch (listType)
01112         {
01113             case LT_BECOMEA_SHADOWSLIST:
01114                 blndConsBecomeAShadows = NULL;
01115             break;
01116             case LT_BECOMEA_BEVELSLIST:
01117                 blndConsBecomeABevels = NULL;
01118             break;
01119             case LT_BECOMEA_CONTOURSLIST:
01120                 blndConsBecomeAContours = NULL;
01121             break;
01122             default:
01123                 ERROR3 ("NodeCompound::AllocBlendConsList - You wan't what??? !!!");
01124                 return (FALSE);
01125         }
01126     }
01127     
01128     return (TRUE);
01129 }

BOOL NodeCompound::KillBlendConsListItem ListType  listType,
NodeBlend nodeBlend
[static]
 

Clears out the list of nodes that were generated when blending compound nodes which are associated (i.e. created) with the supplied NodeBlend.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/6/2000
Parameters:
The type of list that we are killing, the blend that the item is associated with [INPUTS]
[OUTPUTS] 
Returns:
TRUE if success, FALSE otherwise
NOTE: The associated blend node is set by calling NodeCompound::SetBlenderNode ()

Returns:
Errors: ERROR3IF the list == NULL

Definition at line 1150 of file nodecomp.cpp.

01151 {
01152     List* accessList = InitListPtr (listType);
01153 
01154     ERROR3IF(accessList == NULL, "KillBlendConsList ():  Trying to delete an empty list! - fruitless function call!");
01155 
01156     NodeListItemWithDocPtr* pCurrent = (NodeListItemWithDocPtr*) accessList->GetHead ();
01157 
01158     while (pCurrent)
01159     {
01160         if (pCurrent->pNode->IsCompoundClass())
01161         {
01162             NodeCompound* ptrGroup = (NodeCompound*) pCurrent->pNode;
01163             NodeBlend* ptrBlender = (NodeBlend*) ptrGroup->GetBlenderNode();
01164 
01165             if (ptrBlender == nodeBlend)
01166             {
01167                 NodeListItemWithDocPtr* pNext = (NodeListItemWithDocPtr*) accessList->GetNext (pCurrent);
01168                 
01169                 NodeListItemWithDocPtr* markedForDelete = (NodeListItemWithDocPtr*) accessList->RemoveItem (pCurrent);
01170 
01171                 markedForDelete->pNode->CascadeDelete ();
01172                 delete (markedForDelete->pNode);
01173 
01174                 pCurrent = pNext;
01175             }
01176             else
01177             {
01178                 pCurrent = (NodeListItemWithDocPtr*) accessList->GetNext (pCurrent);
01179             }
01180         }
01181         else
01182         {
01183             pCurrent = (NodeListItemWithDocPtr*) accessList->GetNext (pCurrent);
01184         }
01185     }
01186     
01187     return (TRUE);
01188 }

ChangeCode NodeCompound::OnChildChange ObjChangeParam pParam  )  [virtual]
 

Processes child change messages Note:.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/5/99
See also:

Reimplemented from Node.

Reimplemented in NodeGroup, NodeContourController, NodeClipViewController, NodeMouldGroup, NodeBlend, NodeBrush, NodeMoulder, and NodeMould.

Definition at line 272 of file nodecomp.cpp.

00273 {
00274     if (IsNodeHidden())
00275         return CC_OK;
00276     
00277     ERROR2IF(pParam == NULL,CC_FAIL,"pParam == NULL");
00278 
00279     BOOL bRegen = TRUE;
00280     BOOL bCache = FALSE;
00281 
00282 //  Node * pChild = NULL;
00283 
00284 //  Node * pThis = this;
00285 
00286 //  Node * pNextChild = NULL;
00287 
00288     UndoableOperation* pOp = NULL;
00289     if (pParam->GetOpPointer())
00290     {
00291         if (pParam->GetOpPointer()->IsKindOf(CC_RUNTIME_CLASS(UndoableOperation)))
00292         {
00293             pOp = pParam->GetOpPointer();
00294         }
00295     }
00296 
00297 //  CCRuntimeClass * pClass = NULL;
00298 
00299 //  ActionList * pActionList = NULL;
00300 
00301 //  Action *pAction = NULL;
00302 
00303 //  BOOL bDelete = FALSE;
00304 //  INT32 NumChildrenThatNeedMe = 0;
00305 
00306     // the last code failled to give a spread for nodes recently divorced
00307     Spread * pSpread = Document::GetSelectedSpread(); //(Spread *)FindParent(CC_RUNTIME_CLASS(Spread));
00308     ERROR2IF(pSpread==NULL, CC_FAIL, "Can't find selected spread");
00309 
00310     List TextNodeList;
00311     NodeListItem * pItem = NULL;
00312 
00313     DocRect Bounds = BoundingRectangle;
00314 
00315     BlobManager* BlobMgr = GetApplication()->GetBlobManager();
00316     INT32 BlobSize = 0;
00317 
00318     if (!pOp && pParam->GetChangeType() == OBJCHANGE_FINISHED &&
00319         pParam->GetDirection() == OBJCHANGE_CALLEDBYCHILD &&
00320         pParam->GetChangeFlags().RegenerateNode)
00321     {
00322         RegenerateNode(NULL, FALSE, FALSE);
00323         return CC_OK;
00324     }
00325         
00326     if (BlobMgr)
00327     {
00328         BlobSize = BlobMgr->GetBlobSize();
00329     }
00330 
00331     if (pParam->GetChangeType() == OBJCHANGE_STARTING)
00332     {
00333         
00334     }
00335     else if (pParam->GetChangeType() == OBJCHANGE_FINISHED)
00336     {
00337         if (pParam->GetChangeFlags().DeleteNode)
00338         {
00339             TRACEUSER( "DavidM", _T("Delete node\n"));
00340         }
00341         
00342         if (pOp != NULL)
00343         { 
00344             // Ok! Tell all my children to regenerate (in some cases !)
00345 
00346             // check for ops which we do nothing with
00347             if (pOp->IsKindOf(CC_RUNTIME_CLASS(TransOperation)) &&
00348                 !pOp->IS_KIND_OF(OpMovePathPoint))
00349             {
00350                 // ok, we have a transform operation
00351                 TRACEUSER( "DavidM", _T("Transform operation!"));
00352 
00353                 if (((TransOperation *)pOp)->GetCurrentMatrix().IsTranslation())
00354                 {
00355                     // find out if the selected object is a child of myself
00356                     Range Sel(*(GetApplication()->FindSelection()));
00357 
00358                     Node * pNode = Sel.FindFirst(FALSE);
00359 
00360                     bRegen = TRUE;
00361 
00362                     while (pNode && bRegen)
00363                     {
00364                         if (pNode->FindParent())
00365                         {
00366                             if (pNode->FindParent()->ShouldITransformWithChildren())
00367                             {
00368                                 bRegen = FALSE;
00369                             }
00370                         }
00371 
00372                         pNode = Sel.FindNext(pNode, FALSE);
00373                     }
00374                 }
00375                 else
00376                 {
00377                     // re-format all text nodes under me
00378                     ReleaseCached();
00379                     pOp->DoInvalidateRegion(pSpread, BoundingRectangle);
00380 
00381                     BevelTools::GetAllNodesUnderNode(this, &TextNodeList, 
00382                         CC_RUNTIME_CLASS(TextStory));
00383 
00384                     pItem = (NodeListItem *)TextNodeList.GetHead();
00385 
00386                     while (pItem)
00387                     {
00388                         if (pItem->pNode)
00389                         {
00390                             PrePostTextAction::DoFormatStory(pOp, (TextStory *) pItem->pNode, TRUE);
00391                         }
00392 
00393                         pItem = (NodeListItem *)TextNodeList.GetNext(pItem);
00394                     }
00395 
00396                     TextNodeList.DeleteAll();
00397                                 
00398                     bRegen = TRUE;
00399                     bCache = FALSE;
00400                 }
00401             }
00402             else if (pOp->IsKindOf(CC_RUNTIME_CLASS(OpApplyAttrib)))
00403             {
00404                 // has there been a change which causes a geometry change ?
00405                 // if so, we need to regen
00406                 CCRuntimeClass * pClass = ((OpApplyAttrib *)pOp)->GetValueChangeType();
00407 
00408                 if (pClass)
00409                 {
00410                     if (pClass->IsKindOf(CC_RUNTIME_CLASS(AttrTxtBase)) ||
00411                         pClass->IsKindOf(CC_RUNTIME_CLASS(AttrBevelIndent)) ||
00412                         pClass->IsKindOf(CC_RUNTIME_CLASS(AttrTranspFillGeometry)) ||
00413                         pClass->IsKindOf(CC_RUNTIME_CLASS(AttrLineWidth)) ||
00414                         pClass->IsKindOf(CC_RUNTIME_CLASS(AttrStrokeColour)) ||
00415                         pClass->IsKindOf(CC_RUNTIME_CLASS(AttrStartCap)) ||
00416                         pClass->IsKindOf(CC_RUNTIME_CLASS(AttrStartArrow)) ||
00417                         pClass->IsKindOf(CC_RUNTIME_CLASS(AttrDashPattern)) ||
00418                         pClass->IsKindOf(CC_RUNTIME_CLASS(AttrEndArrow)) ||
00419                         pClass->IsKindOf(CC_RUNTIME_CLASS(AttrJoinType)) ||
00420                         pClass->IsKindOf(CC_RUNTIME_CLASS(AttrStrokeColourChange)) ||
00421                         pClass->IsKindOf(CC_RUNTIME_CLASS(AttrStrokeTranspChange)) ||
00422                         pClass->IsKindOf(CC_RUNTIME_CLASS(AttrStrokeTranspTypeChange))
00423                         )
00424                     {
00425                         bRegen = TRUE;
00426                     }
00427                     else
00428                     {
00429                         bRegen = FALSE;
00430                     
00431                     }
00432                 }
00433             }
00434             // this operation is called for changes in fills (e.g. dragging a linear fill blob,
00435             // and then dropping it
00436             // we need to stop regeneration for normal fills, but regen for transparency fills
00437             else if (pOp->IsKindOf(CC_RUNTIME_CLASS(OpReplaceAttributes)))
00438             {
00439                 // find out the op name
00440                 String_256 OpName;
00441 
00442                 // don't do colour fills, but do transparent fills
00443                 NodeAttribute * pAttr = ((OpReplaceAttributes *)pOp)->GetAttribute();
00444 
00445                 if (pAttr)
00446                 {
00447                     if (pAttr->IsAFillAttr())
00448                     {
00449                         bRegen = FALSE;
00450                     }
00451 
00452                     if (pAttr->IsATranspFill())
00453                     {
00454                         bRegen = TRUE;
00455                     }
00456                         
00457                 }
00458             }
00459             else if (pOp->IsKindOf(CC_RUNTIME_CLASS(OpDelete)))
00460             {
00461                 bRegen = FALSE;
00462             }
00463             else if (pOp->IsKindOf(CC_RUNTIME_CLASS(OpCopy)))
00464             {
00465                 bRegen = FALSE;
00466             }
00467             else if (pOp->IsKindOf(CC_RUNTIME_CLASS(OpCut)))
00468             {
00469                 bRegen = FALSE;
00470             }
00471             else if (pOp->IsKindOf(CC_RUNTIME_CLASS(OpPaste)))
00472             {
00473                 bRegen = FALSE;
00474             }
00475             else if (pOp->IsKindOf(CC_RUNTIME_CLASS(OpTextFormat)))
00476             {
00477                 // indicates a change in the text (e.g. the user has typed in)
00478                 // find out if my children have all disappeared
00479                 // invalidate and hide me
00480                 Bounds.lo.x = BoundingRectangle.lo.x - BlobSize;
00481                 Bounds.lo.y = BoundingRectangle.lo.y - BlobSize;
00482                 Bounds.hi.x = BoundingRectangle.hi.x + BlobSize;
00483                 Bounds.hi.y = BoundingRectangle.hi.y + BlobSize;
00484                 
00485                 ReleaseCached();
00486                 pOp->DoInvalidateRegion(pSpread, Bounds);
00487 
00488                 // regen if we've still got a valid interior
00489                 if (GetInsideBoundingRect().IsEmpty())
00490                 {
00491                     bRegen = FALSE;
00492                 }
00493                 else
00494                 {
00495                     bRegen = TRUE;
00496                 }
00497 
00498                 bCache = TRUE;
00499             }
00500             else if (pOp->IsKindOf(CC_RUNTIME_CLASS(OpDeleteTextStory)))
00501             {
00502                 // indicates that a text story has been deleted - so if my inside
00503                 // bounding rect is empty then hide me
00504                 if (GetInsideBoundingRect().IsEmpty())
00505                 {
00506                     // hide me !
00507                     pOp->DoHideNode(this, TRUE, NULL, TRUE);
00508                     bRegen = FALSE;
00509                 }
00510             }
00511             else
00512             {
00513                 // regen for all other ops
00514                 bRegen = TRUE;
00515             }
00516 
00517             if (bRegen)
00518             {
00519 //              Document * pDoc = Document::GetCurrent();
00520 
00521                 pOp->DoInvalidateRegion(pSpread, Bounds);   // Invalidate original bounds
00522 
00523                 BOOL bDidRegen = RegenerateNode(pOp, bCache, FALSE);    // ForceRedraw is called internally by RegenerateNode...
00524 
00525                 if (bDidRegen)
00526                 {
00527                     ReleaseCached();
00528                     pOp->DoInvalidateRegion(pSpread, GetBoundingRect());
00529                 }
00530             }
00531         }
00532         else
00533         {
00534             // were being called by with a pOp of NULL (i.e.  the change is occuring
00535             // in a none undoable way)
00536 
00537             // NOTE:  we need to regenerate here as well, because we will be called with
00538             // a pOp of NULL when being called through OpRepeatApplyAttribToSelected ....
00539 
00540 //          Document * pDoc = Document::GetCurrent();
00541 
00542             RegenerateNode(NULL, bCache, FALSE);    // ForceRedraw is called internally by RegenerateNode...
00543             
00544             // we should also probably check whether it really is OpRepeatApplyAttribToSelected
00545             // that is causing this block of code to execute (BUT, there is no way of doing this!)
00546         }       
00547     }
00548 
00549     // exit (bearing in mind this has probably been called by my inherited classes)
00550     return NodeRenderableInk::OnChildChange(pParam);
00551 }

void NodeCompound::PostInformParentsOfRegenerate  )  [protected, virtual]
 

Informs all parents of a regeneration of the node Notes: Call after the RegenerateNode function in each compound node.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/9/99
Parameters:
None [INPUTS]
See also:

Definition at line 746 of file nodecomp.cpp.

00747 {
00748     ObjChangeFlags flgs;
00749     flgs.RegenerateNode = TRUE;
00750 
00751     ObjChangeParam OP(OBJCHANGE_FINISHED, flgs, this, NULL, OBJCHANGE_CALLEDBYCHILD);
00752 
00753     Node * pParent = FindParent();
00754 
00755     while (pParent)
00756     {
00757         if (pParent->IsAnObject())
00758         {
00759             pParent->OnChildChange(&OP);
00760         }
00761 
00762         pParent = pParent->FindParent();
00763     }
00764     
00765     return;
00766 }

void NodeCompound::PreInformParentsOfRegenerate  )  [protected, virtual]
 

Informs all parents of a regeneration of the node Notes: Call after the RegenerateNode function in each compound node.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/9/99
Parameters:
None [INPUTS]
See also:

Definition at line 715 of file nodecomp.cpp.

00716 {
00717     ObjChangeFlags flgs;
00718     flgs.RegenerateNode = TRUE;
00719 
00720     ObjChangeParam OP(OBJCHANGE_STARTING, flgs, this, NULL, OBJCHANGE_CALLEDBYCHILD);
00721 
00722     Node * pParent = FindParent();
00723 
00724     while (pParent)
00725     {
00726         pParent->OnChildChange(&OP);
00727 
00728         pParent = pParent->FindParent();
00729     }
00730     
00731     return;
00732 }

virtual BOOL NodeCompound::PromoteAttributeApplicationToMe CCRuntimeClass pAttrClass  )  const [inline, virtual]
 

Reimplemented in NodeContourController.

Definition at line 237 of file nodecomp.h.

00237 { return FALSE; }

virtual BOOL NodeCompound::RegenerateForPrinting  )  [inline, virtual]
 

Reimplemented in NodeContourController.

Definition at line 209 of file nodecomp.h.

00209 { return TRUE; }

void NodeCompound::Select BOOL  ReDraw  )  [virtual]
 

Selects the node.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/6/94
Parameters:
Redraw - TRUE if you want the blobs to be redrawn for you [INPUTS]

Reimplemented from NodeRenderable.

Definition at line 657 of file nodecomp.cpp.

00658 {
00659     NodeRenderableInk::Select(ReDraw && PromoteHitTestOnChildrenToMe());
00660 }

void NodeCompound::SetBlendCreatedByNode NodeCompound pNode  )  [inline]
 

Definition at line 229 of file nodecomp.h.

00229 { m_pBlendCreatedByNode = pNode; }

void NodeCompound::SetBlenderNode NodeBlend blender  )  [inline]
 

Definition at line 376 of file nodecomp.h.

00376 { blenderNode = blender; }

void NodeCompound::SetDPI double  dpi  )  [inline]
 

Definition at line 201 of file nodecomp.h.

00201 { m_DPI = dpi; }

void NodeCompound::SetEndBlendGroupNode BOOL  bFlag = TRUE  )  [inline]
 

Definition at line 224 of file nodecomp.h.

00224 { m_bBlendEndNode   = bFlag; }

static void NodeCompound::SetIsForPrinting BOOL  newVal  )  [inline, static]
 

Definition at line 373 of file nodecomp.h.

00373 { isForPrinting = newVal; }

void NodeCompound::SetName String_32 Name  )  [virtual]
 

For setting the group's name.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/6/94
Parameters:
Name,: The new group name [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1502 of file nodecomp.cpp.

01503 {
01504     CompoundName = Name; 
01505 }

void NodeCompound::SetPrinting BOOL  bPrinting  )  [inline]
 

Definition at line 205 of file nodecomp.h.

00205 { m_bPrinting = bPrinting; }

void NodeCompound::SetSelected BOOL  Status  )  [virtual]
 

Calls all the regenerate functions on all children (bottom to top) Note: Recursive function to regenerate all nodes Note: Selects this node. Note that in most cases you'll want to call Select() or DeSelect(), which are virtual methods in NodeRenderable.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/07/2000
Parameters:
Status whether we should become selected or deselected. [INPUTS]
If (Status) then all children are selected. [OUTPUTS]
This override of Node::SetSelected() contains special case code for the usual suspects - shadows, bevels and contours - which sometimes behave like groups, but try to fool the user into thinking they aren't. Any attempt to select NodeBevelController or its sisters of murphy will result in their children* being selected instead.

It's generally better to use Ranges with PromoteToParent to do rendering and similar with these nodes - eg to iterate over the selection, don't step through the tree, querying each node - use a SelRange instead. It should be quicker, and you can choose to have controller nodes automatically included.

Reimplemented from Node.

Definition at line 631 of file nodecomp.cpp.

00632 {
00633     // normal nodes get a normal set-selected.
00634     if (PromoteHitTestOnChildrenToMe() || !Status)
00635         Node::SetSelected(Status);
00636 
00637     // contour, bevel & shadow controller nodes instead
00638     // select all of their ink-children (arbitrary).
00639     // NOTE - doesn't happen if Status is FALSE.
00640     else
00641     {
00642         Node* pKid = FindFirstChild();
00643         while (pKid != NULL)
00644         {
00645             if (pKid->IsAnObject())
00646                 ((NodeRenderableInk*)pKid)->SetSelected(Status);
00647 
00648             pKid = pKid->FindNext();
00649         }
00650     }
00651 }

void NodeCompound::SetShadowDeleteThisNode NodeCompound thisNode  )  [inline, protected]
 

Definition at line 331 of file nodecomp.h.

00331 { shadowDeleteThis = thisNode; }

void NodeCompound::SetShadowThisNode NodeCompound thisNode  )  [inline, protected]
 

Definition at line 330 of file nodecomp.h.

00330 { shadowThisNode = thisNode; } 

void NodeCompound::SetStartBlendGroupNode BOOL  bFlag = TRUE  )  [inline]
 

Definition at line 223 of file nodecomp.h.

00223 { m_bBlendStartNode = bFlag; }

void NodeCompound::TransformEffectAttrs TransformBase Trans  )  [virtual]
 

Transforms the Child nodes of this node. This allows fills etc to move with the objects.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/06/2005
Parameters:
Trans - The transform that should be applied to all the children [INPUTS]

Definition at line 1989 of file nodecomp.cpp.

01990 {
01991     // Find all Effect Attributes (in subtree after last bounded node
01992     // and transform them.
01993     Node* pn = FindLastChild();
01994     while (pn && !pn->IsBounded())
01995     {
01996         if (pn->IsAnAttribute() && ((NodeAttribute*)pn)->IsEffectAttribute())
01997             ((NodeAttribute*)pn)->Transform( Trans );
01998 
01999         pn = pn->FindPrevious();
02000     }
02001 }


Member Data Documentation

NodeBlend* NodeCompound::blenderNode [protected]
 

Definition at line 348 of file nodecomp.h.

List * NodeCompound::blndConsBecomeABevels = NULL [static, protected]
 

Definition at line 345 of file nodecomp.h.

List * NodeCompound::blndConsBecomeAContours = NULL [static, protected]
 

Definition at line 346 of file nodecomp.h.

List * NodeCompound::blndConsBecomeAShadows = NULL [static, protected]
 

Definition at line 344 of file nodecomp.h.

String_32 NodeCompound::CompoundName [protected]
 

Definition at line 298 of file nodecomp.h.

BOOL NodeCompound::isForPrinting = FALSE [static, protected]
 

Definition at line 354 of file nodecomp.h.

BOOL NodeCompound::m_bBlendEndNode [protected]
 

Definition at line 289 of file nodecomp.h.

BOOL NodeCompound::m_bBlendStartNode [protected]
 

Definition at line 288 of file nodecomp.h.

BOOL NodeCompound::m_bPrinting [protected]
 

Definition at line 279 of file nodecomp.h.

double NodeCompound::m_DPI [protected]
 

Definition at line 277 of file nodecomp.h.

NodeCompound* NodeCompound::m_pBlendCreatedByNode [protected]
 

Definition at line 295 of file nodecomp.h.

NodeCompound * NodeCompound::shadowDeleteThis = NULL [static, protected]
 

Definition at line 323 of file nodecomp.h.

NodeCompound * NodeCompound::shadowThisNode = NULL [static, protected]
 

Definition at line 312 of file nodecomp.h.


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