SelectedAttrs Class Reference

More...

#include <fillattr.h>

Inheritance diagram for SelectedAttrs:

CCObject SimpleCCObject List of all members.

Public Member Functions

 SelectedAttrs ()
 ~SelectedAttrs ()
NodeAttributeFindFirst (CCRuntimeClass *AttrType=(CCRuntimeClass *) CC_RUNTIME_CLASS(AttrFillGeometry))
 Scans the selection for attributes. Replaces AttrFillGeometry::FindFirstSelectedAttr without relying on global variables!
NodeAttributeFindNext (CCRuntimeClass *AttrType=(CCRuntimeClass *) CC_RUNTIME_CLASS(AttrFillGeometry))
 Scans the selection for fill attributes.

Private Attributes

Rangem_pAttrSelectionLevel
SelRangem_pAttrSelection
Nodem_pSelNode
NodeAttributem_pLastSelectedAttr

Detailed Description

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/2005
See also:
-

Definition at line 520 of file fillattr.h.


Constructor & Destructor Documentation

SelectedAttrs::SelectedAttrs  )  [inline]
 

Definition at line 523 of file fillattr.h.

00524     {
00525         m_pAttrSelectionLevel = NULL;
00526         m_pAttrSelection = NULL;
00527         m_pSelNode = NULL;
00528         m_pLastSelectedAttr = NULL;
00529     }

SelectedAttrs::~SelectedAttrs  )  [inline]
 

Definition at line 531 of file fillattr.h.

00532     {
00533         if (m_pAttrSelectionLevel)
00534         {
00535             delete m_pAttrSelectionLevel;
00536             m_pAttrSelectionLevel = NULL;
00537         }
00538     }


Member Function Documentation

NodeAttribute * SelectedAttrs::FindFirst CCRuntimeClass AttrType = (CCRuntimeClass*)CC_RUNTIME_CLASS(AttrFillGeometry)  ) 
 

Scans the selection for attributes. Replaces AttrFillGeometry::FindFirstSelectedAttr without relying on global variables!

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/2005
Returns:
The first AttrFillGeometry it finds in the selection. or NULL if they're aren't any.
See also:
AttrFillGeometry::FindNextSelectedAttr

Definition at line 1442 of file fillattr.cpp.

01443 {
01444     // Get the current selection
01445     // and initialise all statics to initial conditions
01446     m_pAttrSelection = Camelot.FindSelection();
01447     m_pLastSelectedAttr = NULL;
01448     m_pSelNode = NULL;
01449 
01450     // If previous use of FindFirst/NextSelectedAttr was stopped before FindNext had reached the
01451     // end, AttrSelectionLevel may still be left lying around...
01452     if (m_pAttrSelectionLevel)
01453     {
01454         delete m_pAttrSelectionLevel;
01455         m_pAttrSelectionLevel = NULL;
01456     }
01457 
01458     m_pAttrSelectionLevel = EffectsStack::GetNewLevelRange(NULL, FALSE);    // Don't escape old controllers, apply attr to base nodes
01459 
01460     if (m_pAttrSelectionLevel)
01461     {
01462         // Find the first Object
01463         m_pSelNode = m_pAttrSelectionLevel->FindFirst();
01464         if (m_pSelNode)
01465         {
01466             // Now find any attributes that are applied to this node.
01467             Node* pAttrNode = m_pSelNode;
01468             if (m_pSelNode->IsAnObject())
01469                 pAttrNode = ((NodeRenderableInk*)m_pSelNode)->GetObjectToApplyTo(AttrType);
01470             ENSURE(pAttrNode->IsAnObject(), "Found unexpected non-ink node in FindFirstSelectedAttr");
01471             m_pLastSelectedAttr = ((NodeRenderableInk*)pAttrNode)->FindAppliedAttribute(AttrType);
01472             if (m_pLastSelectedAttr)
01473                 return (NodeAttribute*)m_pLastSelectedAttr;
01474         }
01475 
01476         // If nothing found on first object or level range is empty
01477         // fall into FindNext so that we don't have to
01478         // duplicate its loop and its tidy up features...
01479         return FindNext(AttrType);
01480     }
01481 
01482     ENSURE(m_pAttrSelectionLevel==NULL, "Possible Range Leak");
01483     m_pAttrSelection = NULL;
01484     m_pSelNode = NULL;
01485     m_pLastSelectedAttr = NULL;
01486     return NULL;
01487 }

NodeAttribute * SelectedAttrs::FindNext CCRuntimeClass AttrType = (CCRuntimeClass*)CC_RUNTIME_CLASS(AttrFillGeometry)  ) 
 

Scans the selection for fill attributes.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/4/2005
Returns:
The next AttrFillGeometry it finds in the selection.
See also:
AttrFillGeometry::FindFirstSelectedAttr

Definition at line 1502 of file fillattr.cpp.

01503 {
01504     // Better make sure nobodys being Silly
01505     ERROR2IF((m_pAttrSelection==NULL), NULL, "AttrSelection NULL in FindNextSelectedAttr");
01506     ERROR2IF((m_pAttrSelectionLevel==NULL), NULL, "AttrSelectionLevel NULL in FindNextSelectedAttr");
01507 
01508     // Loop through the selection range until found another match or end of range
01509     while (m_pSelNode)
01510     {
01511         m_pSelNode = m_pAttrSelectionLevel->FindNext(m_pSelNode);
01512 
01513         if (m_pSelNode)
01514         {
01515             // Now find any attributes that are applied to this node.
01516             Node* pAttrNode = m_pSelNode;
01517             if (m_pSelNode->IsAnObject())
01518                 pAttrNode = ((NodeRenderableInk*)m_pSelNode)->GetObjectToApplyTo(AttrType);
01519             ENSURE(pAttrNode->IsAnObject(), "Found unexpected non-ink node in FindFirstSelectedAttr");
01520             m_pLastSelectedAttr = ((NodeRenderableInk*)pAttrNode)->FindAppliedAttribute(AttrType);
01521             if (m_pLastSelectedAttr)
01522             {
01523                 return (NodeAttribute*)m_pLastSelectedAttr;
01524             }
01525         }
01526     }
01527 
01528     // End of iteration so clear out our statics
01529     if (m_pAttrSelectionLevel)
01530     {
01531         delete m_pAttrSelectionLevel;
01532         m_pAttrSelectionLevel = NULL;
01533     }
01534     m_pAttrSelection = NULL;
01535     m_pSelNode = NULL;
01536     m_pLastSelectedAttr = NULL;
01537 
01538     return NULL;
01539 }


Member Data Documentation

SelRange* SelectedAttrs::m_pAttrSelection [private]
 

Definition at line 545 of file fillattr.h.

Range* SelectedAttrs::m_pAttrSelectionLevel [private]
 

Definition at line 544 of file fillattr.h.

NodeAttribute* SelectedAttrs::m_pLastSelectedAttr [private]
 

Definition at line 547 of file fillattr.h.

Node* SelectedAttrs::m_pSelNode [private]
 

Definition at line 546 of file fillattr.h.


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