NodeClipView Class Reference

ClipView node. This node works in tandem with NodeClipViewController to provide clipview functionality. It sits underneath a NodeClipViewController, between the keyhole node and the clipped nodes, so that it is rendered after the keyhole node. Its Render() method saves GDraw's current clipping region and applies a new region, derived from the keyhole node's outline. See also:. More...

#include <nodeclip.h>

Inheritance diagram for NodeClipView:

NodeRenderableInk NodeRenderableBounded NodeRenderable Node CCObject SimpleCCObject List of all members.

Public Member Functions

 NodeClipView ()
 Default constructor.
 NodeClipView (Node *pContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
 This method initialises the node and links it to pContextNode in the direction specified by Direction. All necessary tree links are updated. Most of the work is carried out by base constructors.
 ~NodeClipView ()
 Destructor.
virtual BOOL IsANodeClipView () const
virtual DocRect GetBoundingRect (BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE)
 Find this node's bounding rectangle. If the rectangle is known to be valid then it is simply returned. If IsBoundingRectValid is FALSE then the rect is recalculated before it is returned and the validity flag reset. See also:.
virtual DocRect GetBlobBoundingRect ()
 Get this node's bounding rectangle when its blobs are drawn.
virtual SubtreeRenderState RenderSubtree (RenderRegion *pRender, Node **ppNextNode=NULL, BOOL bClip=TRUE)
 Whether or not we need to render. Most NodeRenderableBounded's do a check on intersection with the render-region's clip-rect here, however we may sometimes need to render when we *don't* intersect the clip-rect, but one of our right-siblings does. So we'll just return TRUE from this whatever.
virtual void Render (RenderRegion *pRender)
 Render method. See NodeClipViewController::Render() for complete details on what should happen when.
void RenderClipAttr (RenderRegion *pRender)
virtual void RenderEorDrag (RenderRegion *pRender)
 Render this node as eor-blobs into the given render region.
virtual BOOL RequiresAttrib (CCRuntimeClass *, BOOL)
 To determine if the node requires attribute AttribType to render itself.
virtual BOOL RequiresAttrib (NodeAttribute *, BOOL)
 To determine if the node requires the pAttr to render itself.
virtual BOOL CanAttrBeAppliedToMe (CCRuntimeClass *AttrType)
 This fn is not to be confused with RequiresAttrib, it determines if an attribute of type AttrType can be directly applied to this object. The object is assumed to Require the attribute.
virtual String Describe (BOOL Plural, BOOL Verbose)
 Get a string description, for use in menus and infobar etc.
virtual UINT32 GetNodeSize () const
 Obtain the size of a NodeClipView object.
void Transform (TransformBase &Trans)
 Perform a transformation on this node.
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Writes this node out to a camelot document.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFilter)
 Writes this node out to a camelot document.
virtual BOOL PostImport ()
 Performs any necessary post-processing once the object has been read in from a file.
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.

Protected Member Functions

void SetGDrawClippingRegion (RenderRegion *pRender)
 Work out the path of my keyhole node, save GDraw's rendering context and tell GDraw to clip to that path.
BOOL RestoreGDrawClippingRegion (BOOL fFirstInRenderLoop=FALSE)
 If GDraw's clipping region has been set but not yet restored, then attempt to restore it from the copy we made when it was set.
void SetClipPath (Path *pClipPath)
virtual NodeSimpleCopy ()
 Copy this node.
void CopyNodeContents (NodeClipView *pNodeCopy)
 Copy this node's contents into pNodeCopy.

Private Member Functions

 CC_DECLARE_DYNCREATE (NodeClipView)

Private Attributes

BOOL m_bRenderingForward
BYTE * m_pRegion
GCONTEXTm_pContext
CONST REGIONm_pSavedRegion
BOOL m_bGDrawClipRegionSet
RECT m_SavedClipRect
ClipRegionAttribute m_ClipRegionAttribute

Friends

class NodeClipViewController

Detailed Description

ClipView node. This node works in tandem with NodeClipViewController to provide clipview functionality. It sits underneath a NodeClipViewController, between the keyhole node and the clipped nodes, so that it is rendered after the keyhole node. Its Render() method saves GDraw's current clipping region and applies a new region, derived from the keyhole node's outline. See also:.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
10 February 2000

Definition at line 123 of file nodeclip.h.


Constructor & Destructor Documentation

NodeClipView::NodeClipView  ) 
 

Default constructor.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
10 February 2000
Returns:
Errors: See also:

Definition at line 131 of file nodeclip.cpp.

00131                            : NodeRenderableInk()
00132 {
00133     // member variable initialisation.
00134     m_pRegion   = NULL;
00135     m_pContext  = NULL;
00136     m_bRenderingForward = FALSE;
00137     m_pSavedRegion  = NULL;
00138     m_bGDrawClipRegionSet = FALSE;
00139 
00140     m_ClipRegionAttribute.SetResponsibleForGrouping (FALSE);
00141 }

NodeClipView::NodeClipView Node pContextNode,
AttachNodeDirection  Direction,
BOOL  Locked = FALSE,
BOOL  Mangled = FALSE,
BOOL  Marked = FALSE,
BOOL  Selected = FALSE
 

This method initialises the node and links it to pContextNode in the direction specified by Direction. All necessary tree links are updated. Most of the work is carried out by base constructors.

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.

Locked is node locked? Mangled is node mangled? Marked is node marked? Selected is node selected?

Returns:
Errors: An ENSURE error will occur if pContextNode is NULL. See also:

Definition at line 177 of file nodeclip.cpp.

00183             : NodeRenderableInk(pContextNode, Direction, Locked, Mangled, Marked, Selected) 
00184 {
00185     // member variable initialisation.
00186     m_pRegion   = NULL;
00187     m_pContext  = NULL;
00188     m_bRenderingForward = FALSE;
00189     m_pSavedRegion  = NULL;
00190     m_bGDrawClipRegionSet = FALSE;
00191 
00192     m_ClipRegionAttribute.SetResponsibleForGrouping (FALSE);
00193 }

NodeClipView::~NodeClipView  ) 
 

Destructor.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
10 February 2000
Returns:
Errors: See also:

Definition at line 208 of file nodeclip.cpp.

00209 {
00210     // delete and clear member variables.
00211     if (m_pRegion   != NULL)
00212         delete [] m_pRegion; m_pRegion = NULL;
00213     if (m_pContext  != NULL)
00214         delete [] ((BYTE *)m_pContext); m_pContext = NULL;
00215 }


Member Function Documentation

virtual BOOL NodeClipView::CanAttrBeAppliedToMe CCRuntimeClass AttrType  )  [inline, virtual]
 

This fn is not to be confused with RequiresAttrib, it determines if an attribute of type AttrType can be directly applied to this object. The object is assumed to Require the attribute.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/6/95
Parameters:
AttrType,: The type of the attribute. It is a type, rather than an [INPUTS] instance because this function needs to be called from the Localise/Factor out routines which operate on attribute types.
Returns:
TRUE if an attribute of AttrType can be applied to this object, FALSE otherwise.
The base class fn returns TRUE.

Certain attributes cannot be directly applied to specific nodes (even though they require the attribute to render). eg. LineSpacing attributes cannot be applied to text character objects.

This function is called by the GetObjectToApplyTo virtual function.

Returns:
Errors: -
See also:
NodeRenderableInk::GetObjectToApplyTo

Reimplemented from NodeRenderableInk.

Definition at line 159 of file nodeclip.h.

00159 { return FALSE; }

NodeClipView::CC_DECLARE_DYNCREATE NodeClipView   )  [private]
 

void NodeClipView::CopyNodeContents NodeClipView pNodeCopy  )  [protected]
 

Copy this node's contents into pNodeCopy.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
10 February 2000
Parameters:
pNodeCopy the node to copy our contents into. [INPUTS]
Returns:
Errors: See also: Node::CopyNodeContents()

Definition at line 593 of file nodeclip.cpp.

00594 {
00595     // call base-class implementation; this will also perform necessary validation for us.
00596     NodeRenderableInk::CopyNodeContents(pNodeCopy);
00597 
00598     // TODO:
00599     //  Any other relevant copying.
00600 }

String NodeClipView::Describe BOOL  Plural,
BOOL  Verbose
[virtual]
 

Get a string description, for use in menus and infobar etc.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
11 April 2000
Parameters:
Plural whether to pluralise the description. [INPUTS] Verbose short or long version.
Returns:
A string description of this node.

Errors: See also:

Reimplemented from Node.

Definition at line 433 of file nodeclip.cpp.

00434 {
00435     if (Plural)
00436         return(String(_R(IDS_CLIPVIEW_DESCRP)));
00437     else
00438         return(String(_R(IDS_CLIPVIEW_DESCRS)));
00439 }

DocRect NodeClipView::GetBlobBoundingRect  )  [virtual]
 

Get this node's bounding rectangle when its blobs are drawn.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
10 February 2000
Returns:
The bounding rectangle of this node with its blobs drawn.

Errors: See also: GetBoundingRect().

Reimplemented from NodeRenderable.

Definition at line 260 of file nodeclip.cpp.

00261 {
00262     // TODO:
00263     //  need to investigate exactly when this method is used, as I don't think I should 
00264     //  implement it for an invisible node, but I'm not sure...
00265 
00266     return DocRect(0, 0, 0, 0);
00267 }

DocRect NodeClipView::GetBoundingRect BOOL  DontUseAttrs = FALSE,
BOOL  HitTest = FALSE
[virtual]
 

Find this node's bounding rectangle. If the rectangle is known to be valid then it is simply returned. If IsBoundingRectValid is FALSE then the rect is recalculated before it is returned and the validity flag reset. See also:.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
10 February 2000
Parameters:
DontUseAttrs TRUE of you want to ignore all the node's attributes. [INPUTS] HitTest TRUE if being called during a hit-test.
Returns:
The bounding rectangle of this node.

Reimplemented from NodeRenderableBounded.

Definition at line 235 of file nodeclip.cpp.

00236 {
00237     // we want our Render() fuction to be called whenever that of our parent NCVC is called,
00238     // therefore we need the same size bounding rect.
00239     Node* pNCVC = FindParent();
00240     if (pNCVC != NULL && pNCVC->IsANodeClipViewController())
00241         return ((NodeRenderableInk*)pNCVC)->GetBoundingRect(DontUseAttrs, HitTest);
00242     else
00243         return DocRect(0, 0, 0, 0);
00244 }

UINT32 NodeClipView::GetNodeSize  )  const [virtual]
 

Obtain the size of a NodeClipView object.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
10 February 2000
Returns:
The size of the node in bytes.
See also: Node::GetSubtreeSize

Reimplemented from Node.

Definition at line 455 of file nodeclip.cpp.

00456 {
00457     return sizeof(NodeClipView);
00458 }

virtual BOOL NodeClipView::IsANodeClipView  )  const [inline, virtual]
 

Reimplemented from Node.

Definition at line 144 of file nodeclip.h.

00144 { return TRUE; }

void NodeClipView::PolyCopyNodeContents NodeRenderable pNodeCopy  )  [virtual]
 

Polymorphically copies the contents of this node to another.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/12/2003
Parameters:
- [OUTPUTS]
Returns:
Errors: An assertion failure will occur if NodeCopy is NULL Scope: protected

Reimplemented from NodeRenderableBounded.

Definition at line 616 of file nodeclip.cpp.

00617 {
00618     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00619     ENSURE(IS_A(pNodeCopy, NodeClipView), "PolyCopyNodeContents given wrong dest node type");
00620 
00621     if (IS_A(pNodeCopy, NodeClipView))
00622         CopyNodeContents((NodeClipView*)pNodeCopy);
00623 }

BOOL NodeClipView::PostImport void   )  [virtual]
 

Performs any necessary post-processing once the object has been read in from a file.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
10 February 2000
Returns:
TRUE if success, FALSE if unsuccessful.

Errors: See also:

Reimplemented from Node.

Definition at line 549 of file nodeclip.cpp.

00550 {
00551     // re-initialise our pointer to our keyhole node.
00552     return TRUE;
00553 }

void NodeClipView::Render RenderRegion pRender  )  [virtual]
 

Render method. See NodeClipViewController::Render() for complete details on what should happen when.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
10 February 2000
Parameters:
pRender points to a render region to render into. [INPUTS]
If we think we're in a forward rendering loop, then set GDraw's clipping region by rendering our ClipRegionAttribute.

If we think we're in a backward rendering loop, then do nothing.

Returns:
Errors: See also: NodeClipViewController::Render()

Reimplemented from Node.

Definition at line 318 of file nodeclip.cpp.

00319 {
00320 // DEBUG
00321 //  TRACEUSER( "Karim", _T("NCV::Render; Tag %d\n"), Tag);
00322 
00323     // In the hit-test render-loop we do *not*
00324     // want to directly cause any clipping. at all other times, we render away.
00325     if (!pRender->IsHitDetect())
00326         SetGDrawClippingRegion(pRender);
00327 }

void NodeClipView::RenderClipAttr RenderRegion pRender  ) 
 

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
13 April 2000
Parameters:
[INPUTS] 
[OUTPUTS] 
Returns:

Errors: See also:

Definition at line 345 of file nodeclip.cpp.

00346 {
00347     m_ClipRegionAttribute.Render(pRender);
00348 }

void NodeClipView::RenderEorDrag RenderRegion pRender  )  [virtual]
 

Render this node as eor-blobs into the given render region.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
10 February 2000
Parameters:
pRender pointer to the render region to render into. [INPUTS]
Returns:
Errors: See also: See Render() for info.

Reimplemented from NodeRenderableInk.

Definition at line 413 of file nodeclip.cpp.

00414 {
00415 }

SubtreeRenderState NodeClipView::RenderSubtree RenderRegion pRender,
Node **  ppNextNode = NULL,
BOOL  bClip = TRUE
[virtual]
 

Whether or not we need to render. Most NodeRenderableBounded's do a check on intersection with the render-region's clip-rect here, however we may sometimes need to render when we *don't* intersect the clip-rect, but one of our right-siblings does. So we'll just return TRUE from this whatever.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
05 May 2000
Parameters:
pRender the render-region we're rendering into. [INPUTS]
Returns:
TRUE always.
Notes: In future it may pay to test the bounds of all our right-siblings, however what if there are nested ClipView's? I get the feeling that not rendering in that case would probably screw things up for on of our multi-clipped grand-children.

Reimplemented from NodeRenderableBounded.

Definition at line 292 of file nodeclip.cpp.

00293 {
00294     return SUBTREE_ROOTANDCHILDREN;
00295 }

virtual BOOL NodeClipView::RequiresAttrib NodeAttribute ,
BOOL 
[inline, virtual]
 

To determine if the node requires the pAttr to render itself.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/7/94
Parameters:
pAttr,: An attribute [INPUTS] Search: This flag only applies to compound objects. It specifies if we should search the compound to find out if any child requires the attribute. By default time is considered more important than truth, and TRUE is returned on compound objects.
Returns:
The answer to this question

Reimplemented from NodeRenderableInk.

Definition at line 158 of file nodeclip.h.

00158 { return FALSE; }

virtual BOOL NodeClipView::RequiresAttrib CCRuntimeClass ,
BOOL 
[inline, virtual]
 

To determine if the node requires attribute AttribType to render itself.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/7/94
Parameters:
AttribType,: The type of the attribute [INPUTS]
Search: This flag only applies to compound objects. It specifies if we should search the compound to find out if any child requires the attribute. By default time is considered more important than truth and TRUE is returned on compound objects.

Returns:
The answer to this question

Reimplemented from NodeRenderableInk.

Definition at line 157 of file nodeclip.h.

00157 { return FALSE; }

BOOL NodeClipView::RestoreGDrawClippingRegion BOOL  fFirstInRenderLoop = FALSE  )  [protected]
 

If GDraw's clipping region has been set but not yet restored, then attempt to restore it from the copy we made when it was set.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/02/2000
Parameters:
fFirstInRenderLoop whether or not we are being called at the start of a [INPUTS] ClipView render-process.
Returns:
TRUE if we restored the region and did it successfully, FALSE otherwise.

Errors: See also: SetGDrawClippingRegion()

Definition at line 393 of file nodeclip.cpp.

00394 {
00395     return TRUE;
00396 }

void NodeClipView::SetClipPath Path pClipPath  )  [inline, protected]
 

Definition at line 190 of file nodeclip.h.

00190 { m_ClipRegionAttribute.SetClipPath(pClipPath); }

void NodeClipView::SetGDrawClippingRegion RenderRegion pRender  )  [protected]
 

Work out the path of my keyhole node, save GDraw's rendering context and tell GDraw to clip to that path.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/02/2000
Parameters:
pRender points to the region which we shall be clipping inside. [INPUTS]
GDraw's current clipping region may have been changed by this method. [OUTPUTS]
Returns:

Errors: ERROR3 if pKeyhole cannot be converted to paths. In release builds, we just quit, with no clipping. See also: RestoreGDrawClippingRegion()

Definition at line 369 of file nodeclip.cpp.

00370 {
00371     m_ClipRegionAttribute.Render(pRender);
00372 }

Node * NodeClipView::SimpleCopy void   )  [protected, virtual]
 

Copy this node.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
10 February 2000
Returns:
A copy of this node, or NULL if unsuccessful.

Errors: ERROR1 returning NULL if we couldn't allocate memory for the new node. See also: Node::SimpleCopy()

Reimplemented from NodeRenderableInk.

Definition at line 570 of file nodeclip.cpp.

00571 {
00572     NodeClipView* pNodeCopy = new NodeClipView;
00573     ERROR1IF(pNodeCopy == NULL, NULL, _R(IDE_NOMORE_MEMORY));
00574     CopyNodeContents(pNodeCopy);
00575 
00576     return pNodeCopy;
00577 }

void NodeClipView::Transform TransformBase Trans  )  [virtual]
 

Perform a transformation on this node.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
10 February 2000
Parameters:
Trans non-const reference to a description of the transformation. [INPUTS]
This node will be transformed appropriately. [OUTPUTS]
Returns:
Errors: See also:

Reimplemented from NodeRenderableBounded.

Definition at line 475 of file nodeclip.cpp.

00476 {
00477     // leave it up to the base class...
00478     NodeRenderableInk::Transform(Trans);
00479 }

BOOL NodeClipView::WritePreChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Writes this node out to a camelot document.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
10 February 2000
Parameters:
pFilter pointer to a camelot file filter. [INPUTS]
Returns:
TRUE if successful, FALSE otherwise.

Errors: See also:

Reimplemented from Node.

Definition at line 528 of file nodeclip.cpp.

00529 {
00530     return WritePreChildrenWeb(pFilter);
00531 }

BOOL NodeClipView::WritePreChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

Writes this node out to a camelot document.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
10 February 2000
Parameters:
pFilter pointer to a camelot file filter. [INPUTS]
Returns:
TRUE if successful, FALSE otherwise.

Errors: ERROR2 if pFilter is NULL. See also:

Reimplemented from Node.

Definition at line 498 of file nodeclip.cpp.

00499 {
00500     // validate input.
00501     ERROR2IF(pFilter == NULL, FALSE, "NULL parameter");
00502     
00503     CXaraFileRecord Rec(TAG_CLIPVIEW, TAG_CLIPVIEW_SIZE);
00504 
00505     BOOL    ok = Rec.Init();
00506     if (ok) ok = (pFilter->Write(&Rec) != 0);
00507 
00508     return ok;
00509 }


Friends And Related Function Documentation

friend class NodeClipViewController [friend]
 

Definition at line 129 of file nodeclip.h.


Member Data Documentation

BOOL NodeClipView::m_bGDrawClipRegionSet [private]
 

Definition at line 208 of file nodeclip.h.

BOOL NodeClipView::m_bRenderingForward [private]
 

Definition at line 204 of file nodeclip.h.

ClipRegionAttribute NodeClipView::m_ClipRegionAttribute [private]
 

Definition at line 212 of file nodeclip.h.

GCONTEXT* NodeClipView::m_pContext [private]
 

Definition at line 206 of file nodeclip.h.

BYTE* NodeClipView::m_pRegion [private]
 

Definition at line 205 of file nodeclip.h.

CONST REGION* NodeClipView::m_pSavedRegion [private]
 

Definition at line 207 of file nodeclip.h.

RECT NodeClipView::m_SavedClipRect [private]
 

Definition at line 209 of file nodeclip.h.


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