AttrLineWidth Class Reference

Line Width Attribute class. More...

#include <lineattr.h>

Inheritance diagram for AttrLineWidth:

NodeAttribute NodeRenderable Node CCObject SimpleCCObject List of all members.

Public Member Functions

 AttrLineWidth ()
 Default constructor for Line Width Attribute class.
 AttrLineWidth (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
 Creates a LineWidth Attribute.
void Render (RenderRegion *pRender)
 'Renders' a Line Width attribute.
NodeSimpleCopy ()
 This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.
virtual INT32 operator== (const NodeAttribute &NodeAttrib)
 A virtual comparison operator. See NodeAttribute::operator== for a description of why it's required.
virtual UINT32 GetAttrNameID (void)
 Returns back a string resource ID describing the attribute.
void ShowDebugTreeDetails () const
void GetDebugDetails (StringBase *Str)
 For obtaining debug information about the Node.
virtual UINT32 GetNodeSize () const
 For finding the size of the node.
virtual void Transform (TransformBase &)
 Scale the Line Width.
virtual BOOL EffectsParentBounds ()
 Virtual function for determining if the node will effect it's parent bounds. eg. ArrowHeads.
virtual BOOL Blend (BlendAttrParam *pBlendParam)
 Blends a line width attribute with another. If successful, pBlendParam->GetBlendedAttr() will get a valid blended line attribute.
virtual AttributeValueGetAttributeValue ()
virtual CCRuntimeClassGetAttributeType ()
virtual AttrIndex GetAttributeIndex ()
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Writes the line width record to the filter.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFilter)
virtual NodeAttributeGetOtherAttrToApply (BOOL *IsMutate)
 Some attributes require a secondary attribute to be changed when they are changed. This routine obtains a pointer to the secondary attribute to apply.
virtual BOOL OtherAttrIsAppliedSelectively () const
virtual BOOL IsALineWidthAttr () const
virtual BOOL NeedsToRenderAtEachBrushStroke () const
 So that don't have to keep re-rendering attributes whilst drawing a brush, this identifies whether or not the attribute need to be rendered at each step, e.g. radial fills.

Public Attributes

LineWidthAttribute Value

Private Member Functions

void CopyNodeContents (AttrLineWidth *NodeCopy)
 This method copies the node's contents to the node pointed to by NodeCopy.

Detailed Description

Line Width Attribute class.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/6/93

Definition at line 136 of file lineattr.h.


Constructor & Destructor Documentation

AttrLineWidth::AttrLineWidth  ) 
 

Default constructor for Line Width Attribute class.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/6/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 194 of file lineattr.cpp.

00195 {
00196 }

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

Creates a LineWidth Attribute.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/6/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 169 of file lineattr.cpp.

00175              : NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected)  
00176 {                         
00177 } 


Member Function Documentation

BOOL AttrLineWidth::Blend BlendAttrParam pBlendParam  )  [virtual]
 

Blends a line width attribute with another. If successful, pBlendParam->GetBlendedAttr() will get a valid blended line attribute.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/10/94
Parameters:
pBlendParam = ptr to blend attribute param object holding all info needed [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise
See also:
-

Reimplemented from NodeAttribute.

Definition at line 439 of file lineattr.cpp.

00440 {
00441     // Check entry param isn't NULL
00442     ERROR3IF(pBlendParam == NULL,"NULL entry param");
00443     if (pBlendParam == NULL) return FALSE;
00444 
00445     // Get the Value member to blend to the Value member of the other NodeAttribute.
00446     // If it succeeds, ask the blended Value to make a NodeAttribute out of itself.
00447 
00448     if (Value.Blend(pBlendParam))
00449     {
00450         // Get the blended attr val. After this call, the ptr is our reponsibility
00451         // so we have to delete it if it's no longer needed
00452         AttributeValue* pBlendedAttrVal = pBlendParam->GetBlendedAttrVal();
00453 
00454         if (pBlendedAttrVal != NULL)
00455         {
00456             // We have a blended attr val, so ask it to make a NodeAttribute out of itself
00457             // and set the pBlendParam's blended NodeAttribute ptr to it
00458             NodeAttribute* pBlendedAttr = pBlendedAttrVal->MakeNode();
00459             pBlendParam->SetBlendedAttr(pBlendedAttr);
00460 
00461             if (pBlendedAttr != NULL)
00462             {
00463                 // We were able to make a blended NodeAttribute
00464                 // so delete the blended attr val, and return TRUE
00465                 delete pBlendedAttrVal;
00466                 return TRUE;
00467             }
00468             else
00469             {
00470                 // Couldn't make a blended NodeAttribute, so give the blended attr val back
00471                 // and return FALSE
00472                 pBlendParam->SetBlendedAttrVal(pBlendedAttrVal);
00473                 return FALSE;
00474             }
00475         }
00476     }
00477 
00478     return FALSE;
00479 }

void AttrLineWidth::CopyNodeContents AttrLineWidth NodeCopy  )  [private]
 

This method copies the node's contents to the node pointed to by NodeCopy.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/93
Parameters:
[INPUTS] 
A copy of this node [OUTPUTS]
Returns:
-

Errors: An assertion failure will occur if NodeCopy is NULL

Scope: protected

Definition at line 338 of file lineattr.cpp.

00339 {
00340     NodeAttribute::CopyNodeContents( NodeCopy );
00341     
00342     //Copy contents specific to derived class here
00343     NodeCopy->Value.LineWidth = Value.LineWidth;
00344 } 

virtual BOOL AttrLineWidth::EffectsParentBounds  )  [inline, virtual]
 

Virtual function for determining if the node will effect it's parent bounds. eg. ArrowHeads.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the node will effect the bounds of it's parent.
See also:
NodeAttribute::GetAttrBoundingRect

Reimplemented from NodeAttribute.

Definition at line 162 of file lineattr.h.

00162 { return TRUE; }

virtual AttrIndex AttrLineWidth::GetAttributeIndex  )  [inline, virtual]
 

Reimplemented from NodeAttribute.

Definition at line 168 of file lineattr.h.

00168 { return ATTR_LINEWIDTH; }

virtual CCRuntimeClass* AttrLineWidth::GetAttributeType  )  [inline, virtual]
 

Reimplemented from NodeAttribute.

Definition at line 167 of file lineattr.h.

00167 { return CC_RUNTIME_CLASS(AttrLineWidth); }

virtual AttributeValue* AttrLineWidth::GetAttributeValue  )  [inline, virtual]
 

Reimplemented from NodeAttribute.

Definition at line 166 of file lineattr.h.

00166 { return &Value; }

UINT32 AttrLineWidth::GetAttrNameID void   )  [virtual]
 

Returns back a string resource ID describing the attribute.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/2/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Attribute description ID

Errors: -

See also:
-

Reimplemented from NodeAttribute.

Definition at line 314 of file lineattr.cpp.

00315 {
00316     return (_R(IDS_LINE_WIDTH)); 
00317 }               

void AttrLineWidth::GetDebugDetails StringBase Str  )  [virtual]
 

For obtaining debug information about the Node.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/9/93
Parameters:
Str,: String giving debug info about the node [OUTPUTS]

Reimplemented from NodeRenderable.

Definition at line 391 of file lineattr.cpp.

00392 {
00393 #ifdef _DEBUG
00394     NodeAttribute::GetDebugDetails( Str );
00395 
00396     String_256 TempStr;
00397     TempStr._MakeMsg( TEXT("\r\nLine width=#1%ld\r\n"), Value.LineWidth );
00398     (*Str) += TempStr;
00399 #endif
00400 }

UINT32 AttrLineWidth::GetNodeSize  )  const [virtual]
 

For finding the size of the node.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The size of the node in bytes
See also:
Node::GetSubtreeSize

Reimplemented from Node.

Definition at line 418 of file lineattr.cpp.

00419 {     
00420     return (sizeof(AttrLineWidth)); 
00421 }  

NodeAttribute * AttrLineWidth::GetOtherAttrToApply BOOL *  IsMutate  )  [virtual]
 

Some attributes require a secondary attribute to be changed when they are changed. This routine obtains a pointer to the secondary attribute to apply.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/06/2000
Parameters:
IsMutate **don't know(!)** [INPUTS]
Returns:
The secondary attribute to apply, or NULL if none to apply.
In the case of AttrLineWidth, the other attribute is AttrStrokeColour.

See also: OpApplyAttribToSelected::ApplyToSelection().

Reimplemented from NodeAttribute.

Definition at line 588 of file lineattr.cpp.

00589 {
00590     ERROR3IF(IsMutate == NULL, "NULL flag pointer passed to GetOtherAttrToApply");
00591 
00592     // LineWidth attributes sometimes require a stroke colour attribute as well.
00593     AttrStrokeColour* pStrokeColour = NULL;
00594     pStrokeColour = new AttrStrokeColour;
00595     if (pStrokeColour == NULL)
00596         return NULL;
00597 
00598     *IsMutate = FALSE;
00599 
00600     return pStrokeColour;
00601 }

BOOL AttrLineWidth::IsALineWidthAttr  )  const [virtual]
 

Reimplemented from NodeAttribute.

Definition at line 520 of file lineattr.cpp.

00521 {
00522     return TRUE;
00523 }

BOOL AttrLineWidth::NeedsToRenderAtEachBrushStroke  )  const [virtual]
 

So that don't have to keep re-rendering attributes whilst drawing a brush, this identifies whether or not the attribute need to be rendered at each step, e.g. radial fills.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/11/99
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if this attribute should be rendered at every step of a brush stroke

Errors: See Also; Brush code (ndbrshmk.cpp)

Notes: You wouldn't think that you would need to render line width at each stroke but we want to make linewidth scale along with the brush.

Reimplemented from NodeAttribute.

Definition at line 502 of file lineattr.cpp.

00503 {
00504     return TRUE;
00505 }

INT32 AttrLineWidth::operator== const NodeAttribute Attrib  )  [virtual]
 

A virtual comparison operator. See NodeAttribute::operator== for a description of why it's required.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/2/94
Parameters:
Atrib,: The attribute to compare, which must be an AttrLineWidth [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: An ENSURE failure will occur if Attrib does not have a AttrLineWidth runtime class.

See also:
NodeAttribute::operator==

Reimplemented from NodeAttribute.

Definition at line 289 of file lineattr.cpp.

00290 {
00291     ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrLineWidth)), 
00292         "Trying to compare two objects with different types"); 
00293     AttrLineWidth* Attr = (AttrLineWidth*) &Attrib;
00294     return (Attr->Value.LineWidth == Value.LineWidth); 
00295 } 

virtual BOOL AttrLineWidth::OtherAttrIsAppliedSelectively  )  const [inline, virtual]
 

Reimplemented from NodeAttribute.

Definition at line 177 of file lineattr.h.

00177 { return TRUE; }

void AttrLineWidth::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 NodeRenderable.

Definition at line 360 of file lineattr.cpp.

00361 {
00362     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00363     ENSURE(IS_A(pNodeCopy, AttrLineWidth), "PolyCopyNodeContents given wrong dest node type");
00364 
00365     if (IS_A(pNodeCopy, AttrLineWidth))
00366         CopyNodeContents((AttrLineWidth*)pNodeCopy);
00367 }

void AttrLineWidth::Render RenderRegion pRender  )  [virtual]
 

'Renders' a Line Width attribute.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/6/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from NodeAttribute.

Definition at line 213 of file lineattr.cpp.

00214 {
00215     pRender->SetLineWidth(&Value, FALSE);
00216 }

void AttrLineWidth::ShowDebugTreeDetails  )  const
 

Node * AttrLineWidth::SimpleCopy void   )  [virtual]
 

This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/6/93
Parameters:
- [INPUTS]
[OUTPUTS] 
Returns:
A copy of the node, or NULL if memory runs out

Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory error and the function returns NULL.

Scope: protected

Reimplemented from NodeAttribute.

Definition at line 262 of file lineattr.cpp.

00263 {
00264     AttrLineWidth* NodeCopy = new AttrLineWidth();
00265     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
00266     CopyNodeContents(NodeCopy);
00267     return NodeCopy;
00268 } 

void AttrLineWidth::Transform TransformBase Trans  )  [virtual]
 

Scale the Line Width.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/8/94
Parameters:
Trans - the transform object to apply to this attribute. [INPUTS]
See also:
NodeRenderable::Transform

Reimplemented from NodeRenderable.

Definition at line 230 of file lineattr.cpp.

00231 {
00232     if ( Trans.TransLines )
00233     {
00234         // Find out the equivalent scale factor
00235         FIXED16 ScaleFactor = Trans.GetScalar();
00236 
00237         // And scale the line width
00238         Value.LineWidth = labs( INT32(ScaleFactor.MakeDouble() * Value.LineWidth) );
00239         //TRACEUSER( "Diccon", _T("Transforming line width %d\n"), Value.LineWidth);
00240     }
00241 }

BOOL AttrLineWidth::WritePreChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Reimplemented from Node.

Definition at line 560 of file lineattr.cpp.

00561 {
00562 #ifdef DO_EXPORT
00563     return WritePreChildrenWeb(pFilter);
00564 #else
00565     return FALSE;
00566 #endif
00567 }

BOOL AttrLineWidth::WritePreChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

Writes the line width record to the filter.

> virtual BOOL AttrLineWidth::WritePreChildrenWeb(BaseCamelotFilter* pFilter)

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/5/96
Parameters:
pFilter = ptr to the filter [INPUTS]
Returns:
TRUE if record is written, FALSE if not
See also:
-

Reimplemented from Node.

Definition at line 539 of file lineattr.cpp.

00540 {
00541 #ifdef DO_EXPORT
00542     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
00543 
00544     CamelotFileRecord Rec(pFilter,TAG_LINEWIDTH,TAG_LINEWIDTH_SIZE);
00545 
00546     BOOL ok = Rec.Init();
00547 
00548     if (ok) ok = Rec.WriteINT32(Value.LineWidth);
00549     if (ok) ok = pFilter->Write(&Rec);
00550 
00551     return ok;
00552 #else
00553     return FALSE;
00554 #endif
00555 }


Member Data Documentation

LineWidthAttribute AttrLineWidth::Value
 

Definition at line 185 of file lineattr.h.


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