LineDefinition Class Reference

Stores a vector Line definition A static list of these items is held in the LineComponent. More...

#include <linedef.h>

Inheritance diagram for LineDefinition:

CCObject SimpleCCObject BrushDefinition StrokeDefinition BlendedBrushDefinition List of all members.

Public Member Functions

 LineDefinition ()
 default constructor, please don't use it though, i am only keeping it around so I can integrate the StrokeDefinition stuff
 LineDefinition (Node *pLineTree)
 Constructor.
 ~LineDefinition ()
 Destructor.
void SetLineName (StringBase *pName)
 Sets the name text string for this Line.
void SetOverrideFill (BOOL Override)
void SetOverrideTrans (BOOL Override)
virtual BOOL IsDifferent (LineDefinition *pOther)=0
NodeGetLineTree (void)
String_32GetLineName (void)
BOOL OverrideFill (void) const
BOOL OverrideTrans (void) const
BOOL NeedsTransparency (void) const
 Determine if this Line needs transparency in order to render.
void SetIOStore (UINT32 NewValue)
UINT32 ReadIOStore (void) const

Static Public Member Functions

static void ConvertIndexedColours (Spread *pSpread)
 To convert all the colours in the subtree that we wish to use to make a brush definition.

Protected Attributes

Nodem_pTree
String_32 m_Name
BOOL m_bOverridesFill
BOOL m_bOverridesTrans
BOOL m_bNeedsTrans
UINT32 IOStore

Private Member Functions

 CC_DECLARE_DYNAMIC (LineDefinition)

Detailed Description

Stores a vector Line definition A static list of these items is held in the LineComponent.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/2/97
See also:
LineComponent

Definition at line 121 of file linedef.h.


Constructor & Destructor Documentation

LineDefinition::LineDefinition  ) 
 

default constructor, please don't use it though, i am only keeping it around so I can integrate the StrokeDefinition stuff

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/2/97

Definition at line 123 of file linedef.cpp.

00124 {
00125     // set to NULL or else CascadeDelete fails in the destructor
00126     m_pTree = NULL;
00127 }

LineDefinition::LineDefinition Node pLineTree  ) 
 

Constructor.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/2/97
Parameters:
pLineTree - A pointer to a Spread node which is the root of a clipart [INPUTS] subtree which should be used for this Line definition. It must obey these rules: It must be a Spread It must not be linked into any other parent tree structure It should contain at least one path node (or else the Line will appear "blank"). You should do Make Shapes on the subtree so that text, blends, quickshapes, etc are all in path form It should be attribute complete, or close thereto
See also:
LineComponent::AddNewLine

Definition at line 153 of file linedef.cpp.

00154 {
00155     ERROR3IF(pLineTree == NULL, "Illegal NULL param");
00156     ERROR3IF(!pLineTree->IsSpread(), "LineDefinitions must begin with a Spread (for now, at least)");
00157     ERROR3IF(pLineTree->FindParent() != NULL, "Line Definition looks like it's linked into a tree!");
00158 
00159     m_pTree   = pLineTree;
00160 
00161     // Check the subtree to see if it contains any transparency
00162     m_bNeedsTrans = m_pTree->ChildrenNeedTransparency();
00163 
00164     IOStore = 0;
00165 
00166     m_Name = TEXT("Custom line");
00167 
00168     m_bOverridesFill  = FALSE;
00169     m_bOverridesTrans = FALSE;
00170 }

LineDefinition::~LineDefinition  ) 
 

Destructor.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/2/97

Definition at line 185 of file linedef.cpp.

00186 {
00187     if (m_pTree != NULL)
00188     {
00189         m_pTree->CascadeDelete();
00190         delete m_pTree;
00191     }
00192 }


Member Function Documentation

LineDefinition::CC_DECLARE_DYNAMIC LineDefinition   )  [private]
 

void LineDefinition::ConvertIndexedColours Spread pRoot  )  [static]
 

To convert all the colours in the subtree that we wish to use to make a brush definition.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/3/97 Inputs : pRoot - the root of the subtree that is about to passed in to create a linedef Note that this node must actually be a SPREAD, as that is what we expect Ouputs: pSpread with all its indexed colours converted to local doccolours
Returns:
-

Definition at line 250 of file linedef.cpp.

00251 {
00252     if (pRoot == NULL)
00253     {
00254         ERROR3("Spread is NULL");
00255         return;
00256     }
00257     // start at the layer
00258     Node* pNode = pRoot->FindFirstChild();
00259     pNode = pNode->FindFirstChild();
00260 
00261     // traverse across the layer
00262     while (pNode != NULL)
00263     {
00264         // search depth first as we may have a group
00265         Node *pCurNode = pNode->FindFirstDepthFirst();
00266         Node *pNextNode;
00267 
00268         while (pCurNode !=NULL)
00269         {
00270             // We may be about to chop this node out of the tree, so get the next node now
00271             pNextNode = pCurNode->FindNextDepthFirst(pNode);
00272     
00273             // Use to scan the colour fields of the attribute.
00274             if (pCurNode->IsAnAttribute())
00275             {
00276                 UINT32 Context = 0;
00277                 NodeAttribute *pNodeAttr = (NodeAttribute *) pCurNode;
00278 
00279                 // Get the next colour field from the attribute
00280                 DocColour *pColour = pNodeAttr->EnumerateColourFields(Context++);
00281                 
00282                 while (pColour != NULL)
00283                 {
00284                     // For each colour field, make sure the colour is a local DocColour so that
00285                     // the sub-tree is entirely stand-alone
00286                     IndexedColour* pIndexCol = pColour->FindParentIndexedColour();
00287                     if (pIndexCol != NULL)
00288                     {
00289                         ColourGeneric ColDef;
00290                         ColourContext *cc = ColourManager::GetColourContext(pColour->GetColourModel());
00291                         ERROR3IF(cc == NULL, "Can't find colour context?!");
00292 
00293                         // Get the IndexedColour definition as a standalone colour definition
00294                         cc->ConvertColour(pIndexCol, &ColDef);
00295 
00296                         // Make the DocColour into a simple standalone "lookalike" of the parent colour
00297                         *pColour = DocColour(pColour->GetColourModel(), &ColDef);
00298 
00299                         // if the parent colour was named then set the reserved flag
00300                         if (pIndexCol->IsNamed())
00301                             pColour->SetReservedFlag(COL_NAMED);
00302                     }
00303                         pColour = pNodeAttr->EnumerateColourFields(Context++);
00304                 }
00305             }
00306             pCurNode = pNextNode;
00307         }
00308         
00309         pNode = pNode->FindNext(CC_RUNTIME_CLASS(NodeRenderableInk));
00310     }
00311 }

String_32* LineDefinition::GetLineName void   )  [inline]
 

Definition at line 150 of file linedef.h.

00150 { return(&m_Name); };

Node* LineDefinition::GetLineTree void   )  [inline]
 

Definition at line 147 of file linedef.h.

00147 { return(m_pTree); };

virtual BOOL LineDefinition::IsDifferent LineDefinition pOther  )  [pure virtual]
 

Implemented in BrushDefinition, and StrokeDefinition.

BOOL LineDefinition::NeedsTransparency void   )  const
 

Determine if this Line needs transparency in order to render.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/3/97
Returns:
TRUE if this Line needs transparency in order to render

Reimplemented in StrokeDefinition.

Definition at line 229 of file linedef.cpp.

00230 {
00231     return(m_bNeedsTrans);
00232 }

BOOL LineDefinition::OverrideFill void   )  const [inline]
 

Reimplemented in StrokeDefinition.

Definition at line 159 of file linedef.h.

00159 { return(m_bOverridesFill); };

BOOL LineDefinition::OverrideTrans void   )  const [inline]
 

Reimplemented in StrokeDefinition.

Definition at line 160 of file linedef.h.

00160 { return(m_bOverridesTrans); };

UINT32 LineDefinition::ReadIOStore void   )  const [inline]
 

Reimplemented in StrokeDefinition.

Definition at line 167 of file linedef.h.

00167 { return(IOStore); };

void LineDefinition::SetIOStore UINT32  NewValue  )  [inline]
 

Reimplemented in StrokeDefinition.

Definition at line 166 of file linedef.h.

00166 { IOStore = NewValue; };

void LineDefinition::SetLineName StringBase pName  ) 
 

Sets the name text string for this Line.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/3/97

Definition at line 207 of file linedef.cpp.

00208 {
00209     ERROR3IF(pName == NULL, "Illegal NULL param");
00210 
00211     pName->Left(&m_Name, 31);
00212 }

void LineDefinition::SetOverrideFill BOOL  Override  )  [inline]
 

Reimplemented in StrokeDefinition.

Definition at line 138 of file linedef.h.

00138 { m_bOverridesFill  = Override; };

void LineDefinition::SetOverrideTrans BOOL  Override  )  [inline]
 

Reimplemented in StrokeDefinition.

Definition at line 139 of file linedef.h.

00139 { m_bOverridesTrans = Override; };


Member Data Documentation

UINT32 LineDefinition::IOStore [protected]
 

Reimplemented in StrokeDefinition.

Definition at line 183 of file linedef.h.

BOOL LineDefinition::m_bNeedsTrans [protected]
 

Definition at line 181 of file linedef.h.

BOOL LineDefinition::m_bOverridesFill [protected]
 

Definition at line 178 of file linedef.h.

BOOL LineDefinition::m_bOverridesTrans [protected]
 

Definition at line 179 of file linedef.h.

String_32 LineDefinition::m_Name [protected]
 

Definition at line 172 of file linedef.h.

Node* LineDefinition::m_pTree [protected]
 

Definition at line 167 of file linedef.h.


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