Layer Class Reference

Layers optionally exist on a page, they group together objects which are drawn at a particular level in a document. More...

#include <layer.h>

Inheritance diagram for Layer:

NodeRenderablePaper NodeRenderableBounded NodeRenderable Node CCObject SimpleCCObject List of all members.

Public Member Functions

 Layer ()
 This constructor creates a Layer linked to no other nodes, with all status flags false, and NULL bounding and pasteboard rectangles.
 ~Layer ()
 Default destructor.
 Layer (Node *ContextNode, AttachNodeDirection Direction, const String_256 &LayerID, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
 This method initialises the node and links it to ContextNode in the direction specified by Direction. All neccesary tree links are updated.
String Describe (BOOL Plural, BOOL Verbose)
 To return a description of the Node object in either the singular or the plural. This method is called by the DescribeRange method.
virtual SubtreeRenderState RenderSubtree (RenderRegion *pRender, Node **ppNextNode=NULL, BOOL bClip=TRUE)
 Virtual function - this version decides whether or not a layer should be rendered according to the ExcludeLockedLayers flags and the state of the layer itself.
virtual void RenderAfterSubtree (RenderRegion *pRender)
 Capture the group as a cached bitmap.
virtual BOOL NeedsToExport (RenderRegion *pRender, BOOL VisibleLayersOnly=FALSE, BOOL CheckSelected=FALSE)
 Indicate that we want to export layers. Now takes a parameter to say whether we want to take notice of the layers visible status when deciding about exporting it or not.
void PreExportRender (RenderRegion *pRegion)
 Outputs data to mark the beginning of a layer.
BOOL ExportRender (RenderRegion *pRegion)
 Called after all child nodes are asked to export.
BOOL IsLayer () const
 Indicate that we are a layer (overrides function in Node).
DocRect GetPasteboardRect (BOOL Pixelise=TRUE, View *pView=NULL) const
 For obtaining the layer's pasteboard rectangle which is actually the pasteboard rectangle of its parent spread node.
LayerFindNextLayer (BOOL ExcludeInvisible=FALSE, BOOL ExcludeLocked=FALSE)
 To find the next sibling layer.
LayerFindPrevLayer (BOOL ExcludeInvisible=FALSE, BOOL ExcludeLocked=FALSE)
 To find the prev sibling layer.
LayerFindNextFrameLayer ()
 To find the next sibling frame layer.
LayerFindPrevFrameLayer ()
 To find the prev sibling frame layer.
virtual BOOL HidingNode ()
 This virtual function is called whenever the node is hidden. It allows the node do things like 'optimise' itself to use less memory or send a message to let others know it is being hidden etc.
BOOL IsVisible (DocView *pDocView=NULL)
 For finding the layers visible status.
BOOL IsLocked ()
 For finding the layers locked status A layer is locked if the following is true - The layer's locked flag is TRUE AND The layer is NOT active (clause not used in Alpha release 15/8/94) AND The Multilayer flag in the parent document is FALSE.
BOOL IsActive ()
 For finding the layers active status.
BOOL IsPrintable ()
 For finding the layers printable status.
BOOL IsBackground ()
 For finding the layers background status.
BOOL IsOutline ()
 For finding the layers outline status.
BOOL IsGuide ()
 For finding the layers guide status.
BOOL IsPageBackground ()
 For finding the layer's page background status.
String_256GetLayerID ()
 For finding the layers identifier.
BOOL IsOverlay ()
 For finding the frame's/layer's Overlay status.
BOOL IsSolid ()
 For finding the frame's/layer's Solid status.
BOOL IsEdited ()
 For finding the frame's/layer's Edited status.
BOOL IsFrame ()
 For finding the frame's/layer's Frame status.
BOOL IsHiddenFrame ()
 For finding the frame's/layer's Hidden status This marks this frame as a hidden frame layer which will not be saved into the GIF animation but may take part in the rendering process of other frames.
BOOL IsPseudoFrame ()
 For finding out whether this might be regarded as a frame layer without especially having its frame flag set.
BOOL GetVisibleFlagState ()
 Returns the raw state of the layer's visible flag (specialist use only).
BOOL GetLockedFlagState ()
 Returns the raw state of the layer's Locked flag (specialist use only).
BOOL HasLayerGotRenderableChildren ()
 Scans the layer for children that render something on the screen. It ignores attributes, hidden nodes, etc - nodes that don't render anything themselves.
BOOL IncludeLayerInBoundingCalcs ()
 For finding out whether to include the layer in bounding box calcalutions. This may not be a simple IsVisible test as usually you want to exclude the two special layers:- guides and page background. This function should be used when:- Calculating drawing sizes for zooming Calculating drawing sizes for export.
LayerStatusGetLayerStatus ()
 Returns the layers status.
void SetVisible (BOOL Status)
 To set the Layer's visible flag status (TRUE/FALSE).
void SetLocked (BOOL Status)
 To set the Layer's locked flag status (TRUE/FALSE).
void SetActive (BOOL Status)
 To set the Layer's active flag status (TRUE/FALSE).
void SetPrintable (BOOL Status)
 To set the Layer's printable flag status (TRUE/FALSE).
void SetBackground (BOOL Status)
 To set the Layer's background flag status (TRUE/FALSE).
void SetOutline (BOOL Status)
 To set the Layer's outline flag status (TRUE/FALSE).
void SetGuide (BOOL Status)
 To set the Layer's Guide flag status (TRUE/FALSE).
void SetPageBackground (BOOL Status)
 To set the Layer's PageBackground flag status (TRUE/FALSE).
void SetLayerID (String_256 &LayerID)
 For setting the layer's identifier.
void SetLayerStatus (LayerStatus &Status)
 To set the layers status.
void SetSolid (BOOL Status)
 To set the Frame/Layer's Solid flag status (TRUE/FALSE).
void SetOverlay (BOOL Status)
 To set the Frame/Layer's Overlay flag status (TRUE/FALSE).
void SetEdited (BOOL Status)
 To set the Frame/Layer's Edited flag status (TRUE/FALSE).
void SetFrame (BOOL Status)
 To set the Frame/Layer's Frame flag status (TRUE/FALSE).
void SetHiddenFrame (BOOL Status)
 To set the Frame/Layer's Hidden flag status (TRUE/FALSE).
void EnsureUniqueLayerID (void)
 Ensures that the layers ID is unique amoung it's siblings. Call after the node is linked into the document tree.
void GetDebugDetails (StringBase *Str)
 For obtaining debug information about the Node.
virtual UINT32 GetNodeSize () const
 For finding the size of the node.
virtual DocRect GetBlobBoundingRect ()
 Returns the layer's bounding rect inflated by the size of a blob.
BOOL BelongsToDocument (Document *pDoc)
 Checks to see if this layer belongs to the document, i.e. the node is part of the tree that is attached to the given document.
DocumentFindDocument ()
 This should be able to return the document associated with this layer. If not, then this program is a worthless piece of junk and way beyond repair.
virtual BOOL AllowOp (ObjChangeParam *pParam, BOOL SetOpPermissionState=TRUE, BOOL DoPreTriggerEdit=TRUE)
 Layers will allow any op to happen to them, or to their children.
virtual void SetOpPermission (OpPermissionState NewState, BOOL AndParents=FALSE)
 Calls Node::SetOpPermission(NewState,FALSE), i.e. you can set the layer's op permission state, but the 'AndParent' param is ignored.
DocColourGetGuideColour ()
 Returns the DocColour that specifies the colour to render the guide objects in this layer with.
void SetGuideColour (IndexedColour *pIndexedColour)
 Assigns the given indexed colour as the colour to render guide objects in this layer in.
void MakeGuideColourDefault ()
 Makes the current colour the default for all guide layers.
DocColour GetDefaultGuideColour ()
 Makes the current colour the default for all guide layers.
void ColourChanged (IndexedColour *pChangedColour)
 Called when a colour has changed.
void ColourDeleted ()
 Called when a colour may have been deleted.
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Writes out the layer data suitable for the web format.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFilter)
 Writes out the layer data suitable for the native format.
virtual BOOL WritePostChildrenWeb (BaseCamelotFilter *pFilter)
 Gives the node a change to write data to the filter after its children have been automatically written out.
virtual BOOL WritePostChildrenNative (BaseCamelotFilter *pFilter)
virtual BOOL CanWriteChildrenWeb (BaseCamelotFilter *pFilter)
 Determines if the layer should write out its contents in the web format.
virtual BOOL CanWriteChildrenNative (BaseCamelotFilter *pFilter)
 Determines if the layer should write out its contents in the native format.
virtual BOOL WriteBeginChildRecordsWeb (BaseCamelotFilter *pFilter)
virtual BOOL WriteBeginChildRecordsNative (BaseCamelotFilter *pFilter)
 Begins the child record sequence for layers in the native format.
virtual BOOL WriteEndChildRecordsWeb (BaseCamelotFilter *pFilter)
virtual BOOL WriteEndChildRecordsNative (BaseCamelotFilter *pFilter)
 Ends the child record sequence for layers in the native format.
virtual BOOL ReadPostChildrenWeb (BaseCamelotFilter *pFilter)
 This function is called during the importing of the file.
virtual BOOL ReadPostChildrenNative (BaseCamelotFilter *pFilter)
virtual UINT32 CountNumWritableWebLayers (BaseCamelotFilter *pFilter)
 Counts how many layers are writable, as determined by Layer::CanWriteChildrenWeb().
virtual BOOL WriteAtomicNodesColourRefs (Node *pLayer, BaseCamelotFilter *pFilter)
 All compound nodes (e.g. bevels, contours, shadows, clipview) are now defined as being atomic. This is so that they can be backwards compatible with CX2. This means that colour definitions that occur within these nodes are omitted when CX2 reads the files. The cause access violations when another colour definition references the omitted. Thus, compund atomic nodes MUST write colour definitions BEFORE the node is written. The function scans the document for relevent nodes, and cause them to write out their colour definitions immediately after the layer node. This is only done of compound atomic nodes, since doing it for all would slow down other peoples distributed stuff.
virtual PathName MakeExportLayerName (const PathName &path)
 Make a pathname that's specific to this layer.
virtual BOOL WriteFrameLayerProperties (BaseCamelotFilter *pFilter)
 Exports the delay details for this frame layer to the filter.
DWORD GetFrameDelay ()
void SetFrameDelay (const DWORD &Delay)
Quality GetCaptureQuality ()
void SetCaptureQuality (const Quality &NewQuality)
KernelBitmapGetGeneratedBitmap ()
 To recover the bitmap that has been generated to represent this layer, if any.
BOOL SetGeneratedBitmap (KernelBitmap *pBitmap)
 To set the bitmap that has been generated to represent this layer.
virtual KernelBitmapEnumerateBitmaps (UINT32 Count)
 Find out what bitmaps, if any, are used by this node.
KernelBitmapGetReferencedBitmap ()
 To recover the bitmap that is present on the layer and is of the correct sort so that it can be used to represent this layer.
BOOL SetReferencedBitmap (KernelBitmap *pBitmap)
 To set the bitmap that has been found which is a single bitmap on this layer which is of the correct colour depth and scaling which can be used to directly represent this layer. Usually, the bitmap will be part of an animation that has been loaded in.
virtual ChangeCode OnChildChange (ObjChangeParam *pParam)
 We override the function to mark layers as edited. This should do the same as the baseclass i.e. return ok but should else set the edited flag to true. Composite objects can use this function to respond to one of their children undergoing a change. They should return CC_FAIL whenever they are unable to cope with the change.

Static Public Member Functions

static BOOL Init ()
 Does any layer initialisation necessary. Declares some layer INI settings Creates a layer message handler.
static void Deinit ()
 Deinits the layer system. This deletes the layer message handler.
static LayerCreateGuideLayer ()
 This does everything required in creating a layer fit to be called the guide layer.

Static Public Attributes

static BOOL ActiveLayerVisibleAndEditable = FALSE
 Dictates whether the active layer is automatically made visible and editable or whether it is left in its last state which might include it being invisible. Defaults to the old system (FALSE).
static INT32 EnableLayerCacheing = 1
 Control whether layers are cached or not.

Protected Member Functions

virtual 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.
void CopyNodeContents (Layer *NodeCopy)
 This method copies the node's contents to the node pointed to by NodeCopy.

Private Attributes

LayerStatus LayerSt
BOOL Active
BOOL Visible
BOOL Locked
BOOL Printable
BOOL Background
BOOL Outline
BOOL Guide
BOOL m_PageBackground
BOOL m_Overlay
BOOL m_Solid
BOOL m_Edited
BOOL m_Frame
BOOL m_HiddenFrame
DWORD m_FrameDelay
Quality m_CaptureQuality
KernelBitmapRef m_GeneratedBitmap
KernelBitmapm_pReferencedBitmap
DocColourpGuideColour
IndexedColourpIndexedGuideColour

Static Private Attributes

static INT32 GuideLayerRed = 255
static INT32 GuideLayerGreen = 0
static INT32 GuideLayerBlue = 0
static LayerMsgHandlerpLayerMsgHandler = NULL

Detailed Description

Layers optionally exist on a page, they group together objects which are drawn at a particular level in a document.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/4/93
See also:
NodeRenderablePaper

Chapter

Spread

Page

Definition at line 158 of file layer.h.


Constructor & Destructor Documentation

Layer::Layer  ) 
 

This constructor creates a Layer linked to no other nodes, with all status flags false, and NULL bounding and pasteboard rectangles.

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

Errors:

Definition at line 275 of file layer.cpp.

00275             : NodeRenderablePaper()
00276 { 
00277     // Set all layer flags to their defaults 
00278     Visible     = TRUE; 
00279     Locked      = FALSE; 
00280     Printable   = TRUE; 
00281     Background  = FALSE; 
00282     Outline     = FALSE;
00283     Guide       = FALSE;
00284     Active      = FALSE; 
00285 
00286     pGuideColour= NULL;
00287     pIndexedGuideColour = NULL;
00288 
00289     m_PageBackground = FALSE;
00290 
00291     // Frame related items
00292     m_Solid      = FALSE;
00293     m_Overlay    = FALSE;
00294     m_Edited     = FALSE;
00295     m_Frame      = FALSE;
00296     m_HiddenFrame   = FALSE;
00297     m_FrameDelay = 10;
00298 
00299     m_pReferencedBitmap = NULL; // DO NOT DELETE as it is a reference
00300 }                    

Layer::~Layer  ) 
 

Default destructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/10/95
Returns:
Errors:

Definition at line 313 of file layer.cpp.

00314 { 
00315     if (pGuideColour != NULL)
00316         delete pGuideColour;
00317 
00318     if (pIndexedGuideColour != NULL)
00319         delete pIndexedGuideColour;
00320 
00321     m_pReferencedBitmap = NULL; // DO NOT DELETE as it is a reference
00322 }                    

Layer::Layer Node ContextNode,
AttachNodeDirection  Direction,
const String_256 LayerID,
BOOL  NodeLocked = FALSE,
BOOL  Mangled = FALSE,
BOOL  Marked = FALSE,
BOOL  Selected = FALSE
 

This method initialises the node and links it to ContextNode in the direction specified by Direction. All neccesary tree links are updated.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
Parameters:
ContextNode,: Pointer to a node which this node is to be attached to. [INPUTS]
Direction:

Specifies the direction in which this 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

LayerID: String which uniquely identifies layer within the spread

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 ?

Parameters:
- [OUTPUTS]
Returns:
-

Errors: An assertion error will occur if ContextNode is NULL

Definition at line 373 of file layer.cpp.

00380                     : NodeRenderablePaper(ContextNode, Direction, NodeLocked, Mangled, 
00381                                     Marked, Selected)
00382 { 
00383     // Set all layer flags to their defaults 
00384     Visible     = TRUE; 
00385     Locked      = FALSE; 
00386     Printable   = TRUE; 
00387     Background  = FALSE; 
00388     Outline     = FALSE;
00389     Guide       = FALSE;
00390     Active      = FALSE; 
00391 
00392     m_PageBackground = FALSE;
00393 
00394     // Frame related flags
00395     m_Overlay       = FALSE;
00396     m_Solid         = FALSE;
00397     m_Edited        = FALSE;
00398     m_Frame         = FALSE;
00399     m_HiddenFrame   = FALSE;
00400     m_FrameDelay    = 10;
00401 
00402     m_pReferencedBitmap = NULL; // DO NOT DELETE as it is a reference
00403 
00404     pGuideColour    = NULL;
00405     pIndexedGuideColour = NULL;
00406 
00407     LayerSt.StringLayerID = LayerID; 
00408 }     


Member Function Documentation

BOOL Layer::AllowOp ObjChangeParam pParam,
BOOL  SetOpPermissionState = TRUE,
BOOL  DoPreTriggerEdit = TRUE
[virtual]
 

Layers will allow any op to happen to them, or to their children.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 20/01/2000
Date:
6/02/95
Parameters:
pParam = describes the way an op wants to change the node [INPUTS] SetOpPermissionState = if TRUE the Op permission state of this node will be set according to the outcome of the call DoPreTriggerEdit = layers and the nodes above them are not part of the stretching mechanism, and hence do not use this flag at all.
- [OUTPUTS]
Returns:
TRUE always!!
The main purpose for layers overriding this func is to ensure that layers become the top level node in the tree for the op permission mechanism, i.e. parents of layers (spreads, etc) shouldn't play a part.

This func will always return TRUE, and if 'SetOpPermissionState' is TRUE, the layer's op permission state will be set to PERMISSION_ALLOWED.

See also:
Node::AllowOp(),Node::GetOpPermission(),Node::SetOpPermission(),Layer::SetOpPermission()

Reimplemented from Node.

Definition at line 2554 of file layer.cpp.

02555 {
02556     if (SetOpPermissionState)
02557         SetOpPermission(PERMISSION_ALLOWED);
02558 
02559     return TRUE;
02560 }

BOOL Layer::BelongsToDocument Document pDoc  ) 
 

Checks to see if this layer belongs to the document, i.e. the node is part of the tree that is attached to the given document.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/8/94
Parameters:
pDoc = ptr to the document [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the layer belongs to the current document

Errors: -

See also:
-

Definition at line 1198 of file layer.cpp.

01199 {
01200     ENSURE(pDoc != NULL,"Get a NULL pDoc");
01201     if (pDoc == NULL) return FALSE;
01202 
01203     Node* pTreeStart = pDoc->GetFirstNode();
01204 
01205     ENSURE(pTreeStart != NULL,"This doc doesn't have a tree start node");
01206 
01207     Node* pNodeDoc     = pTreeStart->FindNext(CC_RUNTIME_CLASS(NodeDocument));
01208     Node* pThisNodeDoc = FindParent(CC_RUNTIME_CLASS(NodeDocument));
01209 
01210     ENSURE(pNodeDoc     != NULL,"This doc has no NodeDocument node");
01211     ENSURE(pThisNodeDoc != NULL,"This layer has no NodeDocument parent node");
01212 
01213     BOOL ok = ((pNodeDoc != NULL) && (pThisNodeDoc != NULL) && (pNodeDoc == pThisNodeDoc));
01214 
01215     if( !ok )
01216     {
01217         TRACEUSER( "MarkN", _T("-------\n"));
01218         TRACEUSER( "MarkN", _T("pDoc            = %ld 0x%p\n"),pDoc,pDoc);
01219         TRACEUSER( "MarkN", _T("pLayer          = %ld 0x%p\n"),this,this);
01220         TRACEUSER( "MarkN", _T("Layer's NodeDoc = %ld 0x%p\n"),pThisNodeDoc,pThisNodeDoc);
01221         TRACEUSER( "MarkN", _T("pDoc's  NodeDoc = %ld 0x%p\n"),pNodeDoc,pNodeDoc);
01222     }
01223 
01224     return (ok);
01225 }

BOOL Layer::CanWriteChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Determines if the layer should write out its contents in the native format.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/7/96
Parameters:
pFilter = ptr to the filter to write to [INPUTS]
- [OUTPUTS]
Returns:
TRUE if it's ok to write out the layer's children FALSE otherwise
Native files will not write out layers when: It's actually the cack compact format AND The user has selected "Remove invisible layers" AND The layer is invisible The layer is NOT a frame layer

See also:
WritePreChildrenNative()

Reimplemented from Node.

Definition at line 2884 of file layer.cpp.

02885 {
02886 #ifdef DO_EXPORT
02887 
02888     // if we are saving in the compact format, and
02889     // the user has selected to remove invisible layers & the layer is invisible,
02890     // then don't let the children go out
02891     if (pFilter->IsCompactNativeFilter())
02892     {
02893         // If user doesn't want visible layers, and it's not visible and it's not a animated GIF frame layer, don't bother
02894         if (pFilter->GetRemoveInvisibleLayers() && !IsVisible() && !IsFrame())
02895             return FALSE;
02896     }
02897 
02898     return Node::CanWriteChildrenNative(pFilter);
02899 #else
02900     return FALSE;
02901 #endif
02902 }

BOOL Layer::CanWriteChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

Determines if the layer should write out its contents in the web format.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/7/96
Parameters:
pFilter = ptr to the filter to write to [INPUTS]
- [OUTPUTS]
Returns:
TRUE if it's ok to write out the layer's children FALSE otherwise
Web files will not write out the following types of layer: Invisible layers Layers than contain no renderable objects Guide layers

See also:
WritePreChildrenNative()

Reimplemented from Node.

Definition at line 2837 of file layer.cpp.

02838 {
02839 #ifdef DO_EXPORT
02840     // If not visible and not a animated GIF frame layer, don't bother
02841     if (!IsVisible() && !IsFrame())
02842         return FALSE;
02843 
02844     // If a guide layer, don't bother
02845     if (IsGuide())
02846         return FALSE;
02847 
02848     // If no renderable objects on the layer and not a animated GIF frame layer, don't bother
02849     if (!IsFrame())
02850     {
02851         DocRect Rect = GetBoundingRect();
02852         if (Rect.IsEmpty())
02853             return FALSE;
02854     }
02855 
02856     return TRUE;
02857 #else
02858     return FALSE;
02859 #endif
02860 }

void Layer::ColourChanged IndexedColour pChangedColour  ) 
 

Called when a colour has changed.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/10/95
Parameters:
pChangedColour = ptr to the colour that's just changed [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
ColourDeleted()

Definition at line 3218 of file layer.cpp.

03219 {
03220 // WEBSTER - markn 15/1/97
03221 // Don't need this in Webster
03222 #ifndef WEBSTER
03223 #if !defined(EXCLUDE_FROM_RALPH)
03224     if (pChangedColour == NULL || pGuideColour == NULL)
03225         return;
03226 
03227     IndexedColour* pColour = pGuideColour->FindParentIndexedColour();
03228 
03229     if (pChangedColour == pColour)
03230     {
03231         Document* pDoc = Document::GetCurrent();
03232         if (pDoc != NULL)
03233             LayerSGallery::ForceRedrawLayer(pDoc,this);
03234     }
03235 #endif
03236 #endif // WEBSTER
03237 }

void Layer::ColourDeleted  ) 
 

Called when a colour may have been deleted.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/10/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
ColourChanged()

Definition at line 3253 of file layer.cpp.

03254 {
03255 #if !defined(EXCLUDE_FROM_RALPH)
03256     if (pGuideColour != NULL)
03257     {
03258         IndexedColour* pIndexedColour = pGuideColour->FindParentIndexedColour();
03259 
03260         if (pIndexedColour != NULL && pIndexedColour->IsDeleted())
03261         {
03262             ColourGeneric ColGen;
03263             pIndexedColour->GetSourceColour(&ColGen);
03264             ColourModel Model = pIndexedColour->GetColourModel();
03265 
03266             IndexedColour* pNewColour = new IndexedColour(Model,&ColGen);
03267 
03268             SetGuideColour(pNewColour);
03269 //          Document* pDoc = Document::GetCurrent();
03270 //          if (pDoc != NULL)
03271 //              LayerSGallery::ForceRedrawLayer(pDoc,this);
03272         }
03273     }
03274 #endif
03275 }

void Layer::CopyNodeContents Layer NodeCopy  )  [protected]
 

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

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/8/94
Parameters:
NodeCopy = ptr to the layer node that needs to become a copy of this layer [INPUTS]
The layer at *NodeCopy is a identical copy of this layer [OUTPUTS]
Returns:
-

Errors: An assertion failure will occur if NodeCopy is NULL Scope: protected

Definition at line 737 of file layer.cpp.

00738 {
00739     // Ensure the pointer's not null
00740     ENSURE(NodeCopy != NULL,"Trying to copy a node's contents into a NULL node");  
00741 
00742     // Get immediate base class to copy its bits
00743     NodeRenderablePaper::CopyNodeContents(NodeCopy); 
00744 
00745     // Copy layer-specific stuff now.
00746     NodeCopy->LayerSt = LayerSt;
00747 
00748     NodeCopy->Active = Active;
00749     NodeCopy->Visible = Visible;
00750     NodeCopy->Locked = Locked;
00751     NodeCopy->Printable = Printable;
00752     NodeCopy->Background = Background;
00753     NodeCopy->Outline = Outline;
00754     NodeCopy->Guide = Guide;
00755 
00756     NodeCopy->Active = Active;
00757     NodeCopy->Visible = Visible;
00758     NodeCopy->Locked = Locked;
00759     NodeCopy->Printable = Printable;
00760     NodeCopy->Background = Background;
00761     NodeCopy->Outline = Outline;
00762     NodeCopy->Guide = Guide;
00763 
00764     // Copy across the useful frame related information
00765     NodeCopy->m_FrameDelay      = m_FrameDelay;
00766     NodeCopy->m_Overlay         = m_Overlay;
00767     NodeCopy->m_Solid           = m_Solid;
00768     NodeCopy->m_Frame           = m_Frame;
00769     NodeCopy->m_HiddenFrame     = m_HiddenFrame;
00770     NodeCopy->m_Edited          = m_Edited;
00771     NodeCopy->m_PageBackground  = m_PageBackground;
00772 }       

UINT32 Layer::CountNumWritableWebLayers BaseCamelotFilter pFilter  )  [virtual]
 

Counts how many layers are writable, as determined by Layer::CanWriteChildrenWeb().

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/8/96
Parameters:
pFilter = ptr to the filter to write to [INPUTS]
- [OUTPUTS]
Returns:
The number of layers that will be written in the web file
The count looks at all layers, including this one, in the spread to which this layer belongs

See also:
CanWriteChildrenWeb()

Definition at line 2696 of file layer.cpp.

02697 {
02698 #ifdef DO_EXPORT
02699 /*****************************************************
02700 See note in BOOL Layer::WritePreChildrenWeb(BaseCamelotFilter* pFilter) for 
02701 a reason why this code is commented out
02702 (markn 12/8/96)
02703 
02704     UINT32 WritableLayerCount = 0;
02705     Spread* pSpread = (Spread*)FindParent(CC_RUNTIME_CLASS(Spread));
02706     if (pSpread != NULL)
02707     {
02708         Layer* pLayer = pSpread->FindFirstLayer();
02709         while (pLayer != NULL)
02710         {
02711             if (pLayer->CanWriteChildrenWeb(pFilter))
02712                 WritableLayerCount++;
02713             pLayer = pLayer->FindNextLayer();
02714         }
02715     }
02716 
02717     return WritableLayerCount;
02718 ******************************************************/
02719 
02720     return 0;
02721 #else
02722     return 0;
02723 #endif
02724 }

Layer * Layer::CreateGuideLayer  )  [static]
 

This does everything required in creating a layer fit to be called the guide layer.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Ptr to a guide layer that's ready to be inserted into the tree
WEBSTER - markn - 15/1/97 Moved from OpGuideLine for WEBSTER purposes, but it should be in this class anyway
See also:
-

Definition at line 3294 of file layer.cpp.

03295 {
03296     Layer* pNewLayer = new Layer;
03297     if (pNewLayer != NULL)
03298     {
03299         String_256 LayerName(_R(IDS_GUIDESLAYERNAME));
03300 
03301         pNewLayer->SetVisible(TRUE); 
03302         pNewLayer->SetLocked(FALSE); 
03303         pNewLayer->SetPrintable(FALSE); 
03304 //      pNewLayer->SetBackground(TRUE);
03305         pNewLayer->SetBackground(FALSE);    // make sure Guides are in the "normal" foreground section
03306         pNewLayer->SetOutline(FALSE);
03307         pNewLayer->SetGuide(TRUE);
03308         pNewLayer->SetLayerID(LayerName); 
03309 
03310         Quality Qual;
03311         Qual.SetQuality(-1);
03312         QualityAttribute QualAttr(Qual);
03313         NodeAttribute* pNodeAttr = QualAttr.MakeNode();
03314         pNodeAttr->AttachNode(pNewLayer,FIRSTCHILD);
03315     }
03316 
03317     return pNewLayer;
03318 }

void Layer::Deinit void   )  [static]
 

Deinits the layer system. This deletes the layer message handler.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/10/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors:

Definition at line 248 of file layer.cpp.

00249 {
00250     if (pLayerMsgHandler != NULL)
00251     {
00252         delete pLayerMsgHandler;
00253         pLayerMsgHandler = NULL;
00254     }
00255 } 

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

To return a description of the Node object in either the singular or the plural. This method is called by the DescribeRange method.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/6/93
Parameters:
Plural,: Flag indicating if the string description should be plural or [INPUTS] singular.
- [OUTPUTS] Retuns: Description of the object
The description will always begin with a lower case letter.

Returns:
Errors: A resource exception will be thrown if a problem occurs when loading the string resource.
See also:
-

Reimplemented from Node.

Definition at line 644 of file layer.cpp.

00645 {     
00646     if (Plural)
00647         return(String(_R(IDS_LAYER_DESCRP)));  
00648     else
00649         return(String(_R(IDS_LAYER_DESCRS))); 
00650 }; 

void Layer::EnsureUniqueLayerID void   ) 
 

Ensures that the layers ID is unique amoung it's siblings. Call after the node is linked into the document tree.

Author:
Ben_Summers (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/04/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
Layer::SetLayerID

Definition at line 2603 of file layer.cpp.

02604 {
02605     // first, find the first sibling of this node
02606     Layer *pFirstSibling = this;
02607     Layer *pPrevious = NULL;
02608 
02609     while ((pPrevious = pFirstSibling->FindPrevLayer()) != NULL)
02610         pFirstSibling = pPrevious;
02611 
02612     // then run though checking to see if the name is unqiue.
02613     String_256 ID   = GetLayerID();
02614     INT32 Count     = 1;            // the count of the extra number to give the layer
02615     Layer *pExamine = NULL;
02616     BOOL Unique     = FALSE;
02617     BOOL Changed    = FALSE;        // whether the ID got changed
02618 
02619     do
02620     {
02621         // run through the siblings to find out if their ID match this one
02622         pExamine = pFirstSibling;
02623         Unique = TRUE;
02624         
02625         while (pExamine != NULL)
02626         {
02627             // don't fiddle with this layer
02628             if (pExamine != this)
02629             {
02630                 // OK, does it match?
02631                 Layer *pLayer = pExamine;
02632                 if (pLayer->GetLayerID() == ID)
02633                 {
02634                     // nope
02635                     Unique = FALSE;
02636                     break;
02637                 }
02638             }
02639 
02640             // next thing to look at...
02641             pExamine = pExamine->FindNextLayer();
02642         }
02643 
02644         // right then, is it unique?
02645         if (Unique == FALSE)
02646         {
02647             // munge up a new layer name
02648             Count++;
02649 
02650 // there is a problem here..
02651 // a) ralph has no string resources
02652 // b) MakeMsg has been bodged so that it never fails
02653 // the result is that ralph sits in this loop forever
02654 // ralph doesn't give a fig about layer names so just get out of here 
02655 #ifdef RALPH
02656             return;
02657 #endif
02658             UINT32 format_id = _R(IDT_LAYERNAMEUNIQUEFORM); // "#1%s (#2%d)" 
02659             // If its a frame then use a different form of unique formatter without the brackets
02660             if (IsFrame())
02661                 format_id = _R(IDS_FRAMENAMEUNIQUEFORM);            // "#1%s #2%d"
02662             
02663             if (ID.MakeMsg(format_id, (TCHAR *)GetLayerID(), Count) == 0)
02664                 return;     // error getting a string -- give up! (doesn't really matter as the only problem will be the user seeing two layers with the same name)
02665 
02666             Changed = TRUE;
02667 
02668             // and then try again...
02669         }
02670     
02671     } while (Unique == FALSE);
02672     
02673     // and if it needs to be changed, change it
02674     if (Changed)
02675         SetLayerID(ID);
02676 }

KernelBitmap * Layer::EnumerateBitmaps UINT32  Count  )  [virtual]
 

Find out what bitmaps, if any, are used by this node.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> based on Will code
Date:
7/5/97
Parameters:
Count - the bitmap to get (see Purpose). [INPUTS]
Returns:
The KernelBitmap in use by the node, or NULL if no more are used.
The base class returns NULL always, so you over-ride this in any node classes that use bitmaps.

This function supports nodes that use more than one bitmap - you call this function repeatedly and keep incrementing the Count parameter that you pass in each time by 1. You should stop calling it when it returns NULL, as this indicates that no more bitmaps are used by this node. Count should start off as 0 for the first call. Note that this function can (and often will) return NULL for the first call, as many nodes don't use bitmaps, obviously.

See also:
KernelBitmap

Reimplemented from Node.

Definition at line 2133 of file layer.cpp.

02134 {
02135     if (Count == 0) 
02136         return GetGeneratedBitmap();
02137 
02138     return NULL;
02139 }

BOOL Layer::ExportRender RenderRegion pRegion  )  [virtual]
 

Called after all child nodes are asked to export.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/10/95
Parameters:
pRegion = the render region to export to [INPUTS]
- [OUTPUTS]
Returns:
-

Reimplemented from Node.

Definition at line 2487 of file layer.cpp.

02488 {
02489 #ifdef DO_EXPORT
02490     // Can only export guide layers in Native format
02491     if (Guide && pRegion->IS_KIND_OF(NativeRenderRegion))
02492     {
02493         EPSExportDC *pDC = (EPSExportDC *) pRegion->GetRenderDC();
02494 
02495         pDC->OutputToken(_T("ceo"));
02496         pDC->OutputNewLine();
02497     }
02498 PORTNOTE("cmx", "Disabled CMXRenderRegion")
02499 #ifndef EXCLUDE_FROM_XARALX
02500     else if(pRegion->IsKindOf(CC_RUNTIME_CLASS(CMXRenderRegion)))
02501     {
02502         // mark start of a group...
02503         CMXExportDC *pDC = (CMXExportDC *) pRegion->GetRenderDC();
02504         pDC->EndLayer();
02505 
02506         return TRUE;
02507     }
02508 #endif
02509     // Graeme (11-4-00) - Added call to AIEPSRenderRegion to export layers in that format.
02510     else if ( pRegion->IsKindOf ( CC_RUNTIME_CLASS ( AIEPSRenderRegion ) ) )
02511     {
02512         // Cast the render region to get a reference to an AIEPSRenderRegion.
02513         AIEPSRenderRegion   *pAIEPS = static_cast<AIEPSRenderRegion*> ( pRegion );
02514 
02515         // Call the export method.
02516         pAIEPS->ExportLayer ( this );
02517 
02518         // Return TRUE to avoid calling the standard exporter code.
02519         return TRUE;
02520     }
02521 #endif
02522 
02523     return FALSE;
02524 }

Document * Layer::FindDocument  ) 
 

This should be able to return the document associated with this layer. If not, then this program is a worthless piece of junk and way beyond repair.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Finds the Document object that contains the tree that contains this layer, or NULL (God forbit)

Errors: -

See also:
-

Definition at line 1146 of file layer.cpp.

01147 {
01148     Node* pThisNodeDoc = FindParent(CC_RUNTIME_CLASS(NodeDocument));
01149 
01150     if (pThisNodeDoc != NULL)
01151     {
01152         List* pList = &GetApplication()->Documents;
01153 
01154         if (pList != NULL)
01155         {
01156             Document* pDoc = (Document*) pList->GetHead();
01157 
01158             while (pDoc != NULL)
01159             {
01160                 Node* pNodeDoc = pDoc->GetFirstNode();
01161                 if (pNodeDoc != NULL)
01162                     pNodeDoc = pNodeDoc->FindNext(CC_RUNTIME_CLASS(NodeDocument));
01163 
01164                 if (pNodeDoc == pThisNodeDoc)
01165                     return (pDoc);
01166 
01167                 pDoc = (Document*) pList->GetNext(pDoc);
01168             }
01169         }
01170     }
01171 
01172     return NULL;
01173 }

Layer * Layer::FindNextFrameLayer  ) 
 

To find the next sibling frame layer.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/04/97
Returns:
The next sibling frame layer of this node, or NULL if there are no more layers

Errors: -

See also:
FindPrevFrameLayer; FindPrevLayer;

Definition at line 914 of file layer.cpp.

00915 {
00916     Layer* pCurrentLayer = FindNextLayer(); 
00917     while (pCurrentLayer != NULL)
00918     {
00919         // Frame layers cannot be guide layers or background layers
00920         if (pCurrentLayer->IsFrame() && !pCurrentLayer->IsPageBackground() && !pCurrentLayer->IsGuide())
00921         { 
00922             return pCurrentLayer;     
00923         }
00924 
00925         pCurrentLayer = pCurrentLayer->FindNextLayer(); 
00926     }
00927     
00928     // No next frame layer found
00929     return NULL;
00930 }                                                               

Layer * Layer::FindNextLayer BOOL  ExcludeInvisible = FALSE,
BOOL  ExcludeLocked = FALSE
 

To find the next sibling layer.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/01/94
Parameters:
ExcludeInvisible Do not consider any invisible layer. [INPUTS] ExcludeLocked Do not consider any locked layer.
- [OUTPUTS]
Returns:
The next sibling layer of this node, or NULL if there are no more layers
Notes: Karim 08/08/2000 Extended this method so we can also exclude locked layers from the search.

Returns:
Errors: -
See also:
-

Definition at line 819 of file layer.cpp.

00820 {
00821     Node* CurrentNode = FindNext();
00822     while (CurrentNode != NULL)
00823     {
00824         if (CurrentNode->IsLayer())
00825         {
00826             Layer* l = (Layer*) CurrentNode;
00827             if (ExcludeInvisible && !l->IsVisible())
00828             {
00829                 // we're ignoring invisible layers and this layer is invisible.
00830             }
00831             else if (ExcludeLocked && l->IsLocked())
00832             {
00833                 // we're ignoring locked layers and this layer is locked.
00834             }
00835             else
00836             {
00837                 // this one's ok - return it.
00838                 return l;
00839             }
00840         }
00841 
00842         CurrentNode = CurrentNode->FindNext();
00843     }
00844 
00845     // no layer found.
00846     return NULL;
00847 }

Layer * Layer::FindPrevFrameLayer  ) 
 

To find the prev sibling frame layer.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/04/97
Returns:
The previous sibling frame layer of this node, or NULL if there are no more layers

Errors: -

See also:
FindNextFrameLayer; FindNextLayer;

Definition at line 946 of file layer.cpp.

00947 {
00948     Layer* pCurrentLayer = FindPrevLayer(); 
00949     while (pCurrentLayer != NULL)
00950     {
00951         // Frame layers cannot be guide layers or background layers
00952         if (pCurrentLayer->IsFrame() && !pCurrentLayer->IsPageBackground() && !pCurrentLayer->IsGuide())
00953         { 
00954             return pCurrentLayer;     
00955         }
00956 
00957         pCurrentLayer = pCurrentLayer->FindPrevLayer(); 
00958     }
00959 
00960     // No next frame layer found
00961     return NULL;
00962 }                                                               

Layer * Layer::FindPrevLayer BOOL  ExcludeInvisible = FALSE,
BOOL  ExcludeLocked = FALSE
 

To find the prev sibling layer.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/94
Parameters:
ExcludeInvisible Do not consider any invisible layer. [INPUTS] ExcludeLocked Do not consider any locked layer.
- [OUTPUTS]
Returns:
The prev sibling layer of this node, or NULL if there are no more layers
Notes: Karim 08/08/2000 Extended this method so we can also exclude locked layers from the search.

Returns:
Errors: -
See also:
-

Definition at line 871 of file layer.cpp.

00872 {
00873     Node* CurrentNode = FindPrevious();
00874     while (CurrentNode != NULL)
00875     {
00876         if (CurrentNode->IsLayer())
00877         {
00878             Layer* l = (Layer*) CurrentNode;
00879             if (ExcludeInvisible && !l->IsVisible())
00880             {
00881                 // we're ignoring invisible layers and this layer is invisible.
00882             }
00883             else if (ExcludeLocked && l->IsLocked())
00884             {
00885                 // we're ignoring locked layers and this layer is locked.
00886             }
00887             else
00888             {
00889                 // this one's ok - return it.
00890                 return l;
00891             }
00892         }
00893 
00894         CurrentNode = CurrentNode->FindPrevious(); 
00895     }
00896 
00897     // no layer found.
00898     return (NULL);
00899 }

DocRect Layer::GetBlobBoundingRect  )  [virtual]
 

Returns the layer's bounding rect inflated by the size of a blob.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The layer's blob bounds
See also:
NodeRenderable::GetBlobBoundingRect()

Reimplemented from NodeRenderable.

Definition at line 2361 of file layer.cpp.

02362 {
02363 #if !defined(EXCLUDE_FROM_RALPH)
02364     BlobManager* BlobMgr = GetApplication()->GetBlobManager();
02365     ENSURE(BlobMgr != NULL,"No blob manager - HELP!");
02366 
02367     DocRect rect     = GetBoundingRect();
02368     INT32   BlobSize = BlobMgr->GetBlobSize();
02369 
02370     rect.Inflate(BlobSize);
02371 
02372     return (rect);
02373 #else
02374     return DocRect(0,0,0,0);
02375 #endif
02376 }

Quality Layer::GetCaptureQuality  )  [inline]
 

Definition at line 325 of file layer.h.

00325 { return m_CaptureQuality; }

void Layer::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:
- [INPUTS]
Str,: String giving debug info about the node [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from NodeRenderablePaper.

Definition at line 2269 of file layer.cpp.

02270 {          
02271 #ifdef _DEBUG
02272     NodeRenderablePaper::GetDebugDetails(Str); 
02273     (*Str)+= TEXT("\r\nLayer Status("); 
02274     (*Str)+=TEXT("\r\n   VISIBLE = "); 
02275     if (Visible)
02276         (*Str)+=TEXT("TRUE"); 
02277     else
02278         (*Str)+=TEXT("FALSE"); 
02279     
02280     (*Str)+=TEXT("\r\n   LOCKED = "); 
02281     if (Locked)
02282         (*Str)+=TEXT("TRUE"); 
02283     else
02284         (*Str)+=TEXT("FALSE"); 
02285 
02286     (*Str)+=TEXT("\r\n   ACTIVE = "); 
02287     if (Active)
02288         (*Str)+=TEXT("TRUE"); 
02289     else
02290         (*Str)+=TEXT("FALSE"); 
02291             
02292     (*Str)+=TEXT("\r\n   PRINTABLE = "); 
02293     if (Printable)
02294         (*Str)+=TEXT("TRUE"); 
02295     else
02296         (*Str)+=TEXT("FALSE"); 
02297 
02298     (*Str)+=TEXT("\r\n   BACKGROUND = "); 
02299     if (Background)
02300         (*Str)+=TEXT("TRUE"); 
02301     else
02302         (*Str)+=TEXT("FALSE"); 
02303 
02304     (*Str)+=TEXT("\r\n");
02305     
02306     String_256 Temp; 
02307 
02308     Temp._MakeMsg(TEXT("Outline = #1%ld\r\n"),Outline);   
02309     (*Str)+=Temp; 
02310     Temp._MakeMsg(TEXT("Guide   = #1%ld\r\n"),Guide);   
02311     (*Str)+=Temp; 
02312     Temp._MakeMsg(TEXT("PageBackground   = #1%ld\r\n"),m_PageBackground);   
02313     (*Str)+=Temp; 
02314     Temp._MakeMsg(TEXT("Frame   = #1%ld\r\n"),m_Frame);   
02315     (*Str)+=Temp; 
02316     Temp._MakeMsg(TEXT("Edited  = #1%ld\r\n"),m_Edited);   
02317     (*Str)+=Temp; 
02318     Temp._MakeMsg(TEXT("Hidden frame = #1%ld\r\n"),m_HiddenFrame);   
02319     (*Str)+=Temp; 
02320 
02321     (*Str)+=TEXT("Layer ID = "); 
02322     (*Str)+=LayerSt.StringLayerID; 
02323     (*Str)+=TEXT("\r\n");
02324 #endif
02325 }   

DocColour Layer::GetDefaultGuideColour  ) 
 

Makes the current colour the default for all guide layers.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/10/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The DocColour that represents the default colour settings
See also:
GetGuideColour(),SetGuideColour()

Definition at line 3189 of file layer.cpp.

03190 {
03191 #if !defined(EXCLUDE_FROM_RALPH)
03192     ColourValue r = ColourValue(double(GuideLayerRed)   / double(COL_MAX));
03193     ColourValue g = ColourValue(double(GuideLayerGreen) / double(COL_MAX));
03194     ColourValue b = ColourValue(double(GuideLayerBlue)  / double(COL_MAX));
03195 
03196     DocColour Col(r,g,b);
03197 
03198     return Col;
03199 #else
03200     return DocColour(0,0,0);
03201 #endif
03202 }

DWORD Layer::GetFrameDelay  ) 
 

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/05/97
Returns:
The delay value for each animation frame layer.

Definition at line 1641 of file layer.cpp.

01642 {
01643     return m_FrameDelay;
01644 }

KernelBitmap * Layer::GetGeneratedBitmap  ) 
 

To recover the bitmap that has been generated to represent this layer, if any.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/5/97
Returns:
NULL or the kernel bitmap that we generated to represent this layer

Definition at line 2038 of file layer.cpp.

02039 {
02040     // Just ask the embedded bitmap ref to return its current status
02041     return m_GeneratedBitmap.GetBitmap();
02042 }

DocColour * Layer::GetGuideColour  ) 
 

Returns the DocColour that specifies the colour to render the guide objects in this layer with.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/10/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
ptr to the DocColour attached to this layer
See also:
SetGuideColour()

Definition at line 3104 of file layer.cpp.

03105 {
03106     if (pGuideColour == NULL)
03107         SetGuideColour(NULL);
03108 
03109     return (pGuideColour);
03110 }

String_256 & Layer::GetLayerID  ) 
 

For finding the layers identifier.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/1/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The layers ID

Errors: -

See also:
-

Definition at line 1704 of file layer.cpp.

01705 {
01706     return (LayerSt.StringLayerID); 
01707 } 

LayerStatus & Layer::GetLayerStatus  ) 
 

Returns the layers status.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/1/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1724 of file layer.cpp.

01725 {
01726     return (LayerSt); 
01727 } 

BOOL Layer::GetLockedFlagState  ) 
 

Returns the raw state of the layer's Locked flag (specialist use only).

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the layer's Locked is TRUE, FALSE otherwise

Errors: -

See also:
Layer::IsLocked()

Definition at line 1400 of file layer.cpp.

01401 {   
01402     return (Locked);
01403 }

UINT32 Layer::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 2342 of file layer.cpp.

02343 {     
02344     return (sizeof(Layer)); 
02345 }  

DocRect Layer::GetPasteboardRect BOOL  Pixelise = TRUE,
View pView = NULL
const [virtual]
 

For obtaining the layer's pasteboard rectangle which is actually the pasteboard rectangle of its parent spread node.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/5/93
Parameters:
Pixelise - whether or not to pixelise the pasteboard rectangle before [INPUTS] returning it. pView - the view to pixelise to (not used if Pixelise is FALSE).
The objects pasteboard rectangle [OUTPUTS]
Returns:
-

Errors:

Reimplemented from NodeRenderablePaper.

Definition at line 672 of file layer.cpp.

00673 {
00674     // Ensure that the parent of the Layer object is a spread
00675     ERROR2IF(!Parent->IsKindOf(CC_RUNTIME_CLASS(Spread)),
00676             DocRect(0,0,0,0),
00677             "The parent of a layer node was not a spread node");
00678 
00679     return ( ((Spread*)Parent)->GetPasteboardRect(Pixelise, pView) );
00680 }       

KernelBitmap * Layer::GetReferencedBitmap  ) 
 

To recover the bitmap that is present on the layer and is of the correct sort so that it can be used to represent this layer.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/5/97
Returns:
NULL or the kernel bitmap that we reference to represent this layer

Definition at line 2161 of file layer.cpp.

02162 {
02163     // We have a direct pointer rather than a ref as otherwise we will see the bitmap twice
02164     // in the bitmap gallery for this document.
02165     return m_pReferencedBitmap;
02166 }

BOOL Layer::GetVisibleFlagState  ) 
 

Returns the raw state of the layer's visible flag (specialist use only).

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the layer's Visible is TRUE, FALSE otherwise

Errors: -

See also:
Layer::IsVisible()

Definition at line 1307 of file layer.cpp.

01308 {   
01309     if (Guide)
01310     {
01311         DocView* pDocView = DocView::GetCurrent();
01312         if (pDocView != NULL)
01313              return (pDocView->GetShowGuidesState());
01314     }
01315 
01316     return (Visible);
01317 }

BOOL Layer::HasLayerGotRenderableChildren  ) 
 

Scans the layer for children that render something on the screen. It ignores attributes, hidden nodes, etc - nodes that don't render anything themselves.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> from MarkN version in LayerSGallery::HasLayerGotChildren()
Date:
21/7/97
Returns:
TRUE - The layer has children the user may be interested in - i.e. children that actually render something. FALSE - The layer has no rendering children

Definition at line 2209 of file layer.cpp.

02210 {
02211     Node* pNode = FindFirstChild();
02212     BOOL ChildFound = FALSE;
02213 
02214     while (pNode != NULL && !ChildFound)
02215     {
02216         ChildFound = pNode->IsBounded();
02217         pNode = pNode->FindNext();
02218     }
02219 
02220     return (ChildFound);
02221 }

BOOL Layer::HidingNode  )  [virtual]
 

This virtual function is called whenever the node is hidden. It allows the node do things like 'optimise' itself to use less memory or send a message to let others know it is being hidden etc.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/6/97
Returns:
TRUE if all was ok. FALSE if an error occured.
ALWAYS CALL THE BASE CLASS' FUNCTION FROM YOUR OVERRIDDEN FUNCTION.

Reimplemented from Node.

Definition at line 979 of file layer.cpp.

00980 {
00981     // Call the base class first
00982     if (!Node::HidingNode())
00983         return FALSE;
00984 
00985     // Check if we are the active layer, if we are then try and make
00986     // another layer active
00987     if (IsActive())
00988     {
00989         // Hiding an active layer
00990         TRACEUSER( "Neville", _T("++++++ Hiding the active layer\n"));
00991 
00992 // Included in Camelot2 for frame/layer integration - RanbirR - 06/11/97
00993 //#ifdef WEBSTER
00994         if (!IsFrame())
00995         {
00996             // Choose the next/prev layer to be the new active one
00997             Layer* pNewActiveLayer = FindPrevLayer();
00998             if (pNewActiveLayer == NULL)
00999                 pNewActiveLayer = FindNextLayer();
01000             if (pNewActiveLayer != NULL)
01001                 LayerSGallery::MakeActiveLayer(pNewActiveLayer);
01002         }
01003         else
01004         {
01005 PORTNOTE("other", "Disabled frame gallery")
01006 #ifndef EXCLUDE_FROM_XARALX
01007             // Choose the next/prev frame layer to be the new active one
01008             Layer* pNewActiveLayer = FindPrevFrameLayer();
01009             if (pNewActiveLayer == NULL)
01010                 pNewActiveLayer = FindNextFrameLayer();
01011             if (pNewActiveLayer != NULL)
01012                 FrameSGallery::MakeActiveLayer(pNewActiveLayer);
01013 #endif
01014         }
01015     }
01016 
01017     // If we are hiding the page background layer then we must mark all frame layers
01018     // as edited as they must be regenerated.
01019     // Use frame layers as only these will have been captured
01020     if (IsPageBackground())
01021     {
01022         Node * pParentNode = FindParent();
01023         Spread * pSpread = NULL;
01024         if (pParentNode->IsKindOf(CC_RUNTIME_CLASS(Spread)))
01025             pSpread = (Spread*)pParentNode;
01026         if (pSpread)
01027         {
01028             Layer* pLayer = pSpread->FindFirstFrameLayer();
01029             while (pLayer != NULL)
01030             {
01031                 // This is just as a double check
01032                 if (pLayer->IsPseudoFrame())
01033                 {
01034                     // Set the edited flag on the layer
01035                     pLayer->SetEdited(TRUE);
01036 #ifdef _DEBUG
01037                     // Tell the frame gallery to update its display of the frame
01038                     BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::REDRAW_LAYER));
01039 #endif
01040                 }
01041 
01042                 // Move to the next frame layer in the animation
01043                 pLayer = pLayer->FindNextFrameLayer();
01044             }
01045         }
01046     }
01047     return TRUE;
01048 }

BOOL Layer::IncludeLayerInBoundingCalcs  ) 
 

For finding out whether to include the layer in bounding box calcalutions. This may not be a simple IsVisible test as usually you want to exclude the two special layers:- guides and page background. This function should be used when:- Calculating drawing sizes for zooming Calculating drawing sizes for export.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/4/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the layer is one that can contains the page background

Errors: -

See also:
Spread::GetPageVisibleBounds(); BaseBitmapFilter::GetSizeOfDrawing();

Definition at line 1680 of file layer.cpp.

01681 {
01682     // Only add the bounding box of the layer in if it is visible and if it is not
01683     // either a guide layer or the page background layer.
01684     return (!IsPageBackground() && !IsGuide() && IsVisible());
01685 } 

BOOL Layer::Init void   )  [static]
 

Does any layer initialisation necessary. Declares some layer INI settings Creates a layer message handler.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/10/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors:

Reimplemented from NodeRenderableBounded.

Definition at line 210 of file layer.cpp.

00211 {
00212     BOOL ok = TRUE;
00213 
00214 #if !defined(EXCLUDE_FROM_RALPH)
00215     // Declare the section that the preferences for layers will live in
00216     if (ok) ok= Camelot.DeclareSection(TEXT("Layers"), 3);
00217 
00218     // declare the guideline colour vars
00219     if (ok) ok= Camelot.DeclarePref(TEXT("Layers"), TEXT("GuideLayerRed"),  &Layer::GuideLayerRed,   0, COL_MAX);
00220     if (ok) ok= Camelot.DeclarePref(TEXT("Layers"), TEXT("GuideLayerGreen"),&Layer::GuideLayerGreen, 0, COL_MAX);
00221     if (ok) ok= Camelot.DeclarePref(TEXT("Layers"), TEXT("GuideLayerBlue"), &Layer::GuideLayerBlue,  0, COL_MAX);
00222 #endif
00223 
00224     if (ok)
00225     {
00226         pLayerMsgHandler = new LayerMsgHandler;
00227         ok = (pLayerMsgHandler != NULL);
00228     }
00229 
00230     return ok;
00231 }

BOOL Layer::IsActive  ) 
 

For finding the layers active status.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/1/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the layer is active, otherwise FALSE.

Errors: -

See also:
-

Definition at line 1421 of file layer.cpp.

01422 {
01423     return (Active); 
01424 } 

BOOL Layer::IsBackground  ) 
 

For finding the layers background status.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/1/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the layer is a background layer, otherwise FALSE.

Errors: -

See also:
-

Definition at line 1463 of file layer.cpp.

01464 {
01465     return (Background); 
01466 } 

BOOL Layer::IsEdited  ) 
 

For finding the frame's/layer's Edited status.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/4/97
Returns:
TRUE if the frame/layer is one that has its Edited flag set

Definition at line 1574 of file layer.cpp.

01575 {
01576     return m_Edited;
01577 }

BOOL Layer::IsFrame  ) 
 

For finding the frame's/layer's Frame status.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/4/97
Returns:
TRUE if the frame/layer is one that has its Frame flag set

Definition at line 1590 of file layer.cpp.

01591 {
01592     return m_Frame;
01593 }

BOOL Layer::IsGuide  ) 
 

For finding the layers guide status.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/9/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the layer is one that can contain guidelines

Errors: -

See also:
-

Definition at line 1505 of file layer.cpp.

01506 {
01507     return (Guide); 
01508 } 

BOOL Layer::IsHiddenFrame  ) 
 

For finding the frame's/layer's Hidden status This marks this frame as a hidden frame layer which will not be saved into the GIF animation but may take part in the rendering process of other frames.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/4/97
Returns:
TRUE if the frame/layer is one that has its Hidden flag set

Definition at line 1608 of file layer.cpp.

01609 {
01610     return m_HiddenFrame;
01611 }

BOOL Layer::IsLayer  )  const [virtual]
 

Indicate that we are a layer (overrides function in Node).

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/11/94
Returns:
TRUE => This node is a layer
See also:
Node::IsLayer

Reimplemented from Node.

Definition at line 609 of file layer.cpp.

00610 {
00611     return TRUE;
00612 }

BOOL Layer::IsLocked void   ) 
 

For finding the layers locked status A layer is locked if the following is true - The layer's locked flag is TRUE AND The layer is NOT active (clause not used in Alpha release 15/8/94) AND The Multilayer flag in the parent document is FALSE.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> (modified by Markn) (modified to not use CurrentDoc by Jason)
Date:
6/1/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the layer is locked, otherwise FALSE.

Errors: -

See also:
-

Reimplemented from Node.

Definition at line 1338 of file layer.cpp.

01339 {
01340 /*  // WEBSTER - markn 29/1/97
01341     // All layers are editable in Webster
01342     #ifndef WEBSTER */
01343         // Disabled as we now have frame layers and some layers MUST be locked
01344 
01345         // Fast track it if the layer is not locked (the majority of cases)
01346         if (!Locked)
01347             return (FALSE);
01348 
01349         // If we are the page background layer then ALWAYS return locked
01350         if (IsPageBackground())
01351             return TRUE;
01352 
01353         // If the "Active layer is editable and visible" flag is TRUE,
01354         // then return FALSE (layer is editable) if this layer is Active
01355         if (Active && ActiveLayerVisibleAndEditable)
01356             return (FALSE);
01357 
01358         // This layer is locked. However, if the document to which this layer belongs
01359         // has the Multilayer flag set (i.e. all layers editable), the return FALSE
01360         // I.e. return the inverse of the doc's Multilayer state
01361         Document *pDoc = FindDocument();
01362         if (pDoc == NULL)
01363             return (FALSE);
01364 
01365         return (!pDoc->IsMultilayer());
01366 /*  #else
01367         // Fast track it if the layer is not locked (the majority of cases)
01368         // Required in Webster so that when the BackgroundOp is inserting objects and
01369         // it has turned the locked status off, then we do not get the warning. In other
01370         // cases where the user is trying to change the background layer and the locked
01371         // flag is set to its default true state, we should fall through to the PageBackground
01372         // test and fail.
01373         if (!Locked)
01374             return (FALSE);
01375 
01376         // If we are the page background layer then ALWAYS return locked
01377         if (IsPageBackground())
01378             return TRUE;
01379         
01380         // always return FALSE i.e. editable
01381         return FALSE;
01382     #endif // WEBSTER */
01383 }

BOOL Layer::IsOutline  ) 
 

For finding the layers outline status.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the layer is to render its objects in outline mode

Errors: -

See also:
-

Definition at line 1484 of file layer.cpp.

01485 {
01486     return (Outline); 
01487 } 

BOOL Layer::IsOverlay  ) 
 

For finding the frame's/layer's Overlay status.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/4/97
Returns:
TRUE if the frame/layer is one that has its Overlay flag set

Definition at line 1542 of file layer.cpp.

01543 {
01544     return m_Overlay;
01545 }

BOOL Layer::IsPageBackground  ) 
 

For finding the layer's page background status.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/4/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the layer is one that can contains the page background

Errors: -

See also:
-

Definition at line 1525 of file layer.cpp.

01526 {
01527     return (m_PageBackground); 
01528 } 

BOOL Layer::IsPrintable  ) 
 

For finding the layers printable status.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/1/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the layer is printable, otherwise FALSE.

Errors: -

See also:
-

Definition at line 1442 of file layer.cpp.

01443 {
01444     return (Printable && !IsGuide()); 
01445 } 

BOOL Layer::IsPseudoFrame  ) 
 

For finding out whether this might be regarded as a frame layer without especially having its frame flag set.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/4/97
Returns:
TRUE if the frame/layer is one that might be a frame layer

Definition at line 1625 of file layer.cpp.

01626 {
01627     // Only true if the layer is not a background layer or a guide layer or a page background
01628     // layer
01629     return (!IsBackground() && !IsGuide() && !IsPageBackground());
01630 }

BOOL Layer::IsSolid  ) 
 

For finding the frame's/layer's Solid status.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/4/97
Returns:
TRUE if the frame/layer is one that has its Solid flag set

Definition at line 1558 of file layer.cpp.

01559 {
01560     return m_Solid;
01561 }

BOOL Layer::IsVisible DocView pDocView = NULL  ) 
 

For finding the layers visible status.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> (modified by Markn)
Date:
6/1/94
Parameters:
pDocView = ptr to a docview (only used if the layer is a guide layer) [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the layer is visible, otherwise FALSE.

Errors: -

See also:
-

Definition at line 1255 of file layer.cpp.

01256 {
01257     if (Guide)
01258     {
01259         // WEBSTER - markn 29/1/97
01260         // Guide layers are always invisible
01261         #ifndef WEBSTER
01262             if (pDocView == NULL)
01263                 pDocView = DocView::GetCurrent();
01264             if (pDocView != NULL)
01265                  return (pDocView->GetShowGuidesState());
01266             else
01267                 return FALSE;
01268         #else
01269             return FALSE;
01270         #endif // WEBSTER
01271     }
01272 
01273     // If it is visible, fast track the return
01274     if (Visible)
01275         return (TRUE);
01276 
01277     // If the "Active layer is editable and visible" flag is TRUE,
01278     // then return TRUE (layer is visible) if this layer is Active
01279     if (Active && ActiveLayerVisibleAndEditable)
01280         return (TRUE);
01281 
01282     // This layer is NOT visible. However, if the document to which this layer belongs
01283     // has the AllVisible flag set, then return TRUE
01284     // I.e. return the doc's AllVisible state
01285     Document *pDoc = FindDocument();
01286     if (pDoc == NULL)
01287         return(TRUE);
01288 
01289     return(pDoc->IsAllVisible());
01290 }

PathName Layer::MakeExportLayerName const PathName path  )  [virtual]
 

Make a pathname that's specific to this layer.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/03/2004 Input: PathName - original pathname
Parameters:
- [OUTPUTS]
Returns:
PathName - modified pathname

Definition at line 3389 of file layer.cpp.

03390 {
03391     PathName pathLayer = path;
03392 
03393     String_256 filename = path.GetFileName(FALSE);
03394     filename += String( _T(" ") );
03395 //  if (LayerSt.StringLayerID.SubWithoutCase("Layer")==-1)
03396 //      filename += String("Layer ");
03397     filename += LayerSt.StringLayerID;
03398     pathLayer.SetFileName(filename);
03399 
03400     return pathLayer;
03401 };

void Layer::MakeGuideColourDefault  ) 
 

Makes the current colour the default for all guide layers.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/10/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
GetGuideColour(),SetGuideColour()

Definition at line 3161 of file layer.cpp.

03162 {
03163 #if !defined(EXCLUDE_FROM_RALPH)
03164     if (pGuideColour != NULL)
03165     {
03166         INT32 Red,Green,Blue;
03167         pGuideColour->GetRGBValue(&Red,&Green,&Blue);
03168         GuideLayerRed   = INT32(Red);
03169         GuideLayerGreen = INT32(Green);
03170         GuideLayerBlue  = INT32(Blue);
03171     }
03172 #endif
03173 }

BOOL Layer::NeedsToExport RenderRegion pRender,
BOOL  VisibleLayersOnly = FALSE,
BOOL  CheckSelected = FALSE
[virtual]
 

Indicate that we want to export layers. Now takes a parameter to say whether we want to take notice of the layers visible status when deciding about exporting it or not.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/03/94
Parameters:
pRender - A pointer to the current export region (NULL if none) [INPUTS] VisibleLayersOnly - TRUE => remove nodes which are on invisible layers
  • FALSE => export everything CheckSelected - TRUE => we check if object selected and only export selected bjects
  • FALSE => we don't bother checking for selection or not
    Returns:
    TRUE => export this node.
    See also:
    Layer::NeedsToRender

Reimplemented from NodeRenderablePaper.

Definition at line 549 of file layer.cpp.

00550 {
00551 #ifdef DO_EXPORT
00552     // If this is export as a ART file, we want to save all the layers
00553     if (pRender->IS_KIND_OF(NativeRenderRegion))
00554         return TRUE;
00555 
00556     // If there's a filter running
00557     // and it's trying to export just one layer
00558     // then return FALSE if this layer is NOT the layer in question
00559     // else fall through to the normal logic...
00560     Filter* pFilter = pRender->GetFilter();
00561     if (pFilter)
00562     {
00563         Layer* pFilterLayer = pFilter->GetSoleLayer();
00564         if (pFilterLayer!=NULL && pFilterLayer!=this)
00565             return FALSE;
00566     }
00567 
00568     // if this is an export as a CMX file, we don't want invisible layers
00569     // as CMX doesn't support non-visible stuff so we can't save it and
00570     // get the file looking the same
00571 PORTNOTE("cmx", "Removed use of CMXRenderRegion")
00572 #ifndef EXCLUDE_FROM_XARALX
00573     if(!IsVisible() && pRender->IS_KIND_OF(CMXRenderRegion))
00574         return FALSE;
00575 #endif
00576 
00577     // Guide layers only export to Native render regions
00578     if (Guide)
00579         return FALSE;
00580 
00581     // Changed so that instead of always returning True there is a parameter which
00582     // defaults to the old state whereby it always returns True but can be set so
00583     // that we return the visible state of the layer and hence this dictates whether
00584     // only visible layers will be exported.
00585     if (VisibleLayersOnly)
00586         return (IsVisible());
00587     else
00588         return(TRUE);
00589 #else
00590     return FALSE;
00591 #endif
00592 }

ChangeCode Layer::OnChildChange ObjChangeParam pParam  )  [virtual]
 

We override the function to mark layers as edited. This should do the same as the baseclass i.e. return ok but should else set the edited flag to true. Composite objects can use this function to respond to one of their children undergoing a change. They should return CC_FAIL whenever they are unable to cope with the change.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/05/97
Parameters:
pParam = pointer to a object change parameter class [INPUTS]
Returns:
CC_OK if we have successfully processed the change. CC_FAIL if we cannot handle this particular change and must prevent the child from continuing
See also:
WarnParentOfChange();

Reimplemented from Node.

Definition at line 2010 of file layer.cpp.

02011 {
02012     // Note that this layer has been edited
02013     SetEdited(TRUE);
02014 
02015 #ifdef _DEBUG
02016     // Tell the frame gallery to update its display of the frame
02017     BROADCAST_TO_ALL(LayerMsg(this, LayerMsg::REDRAW_LAYER));
02018 #endif
02019 
02020     return CC_OK;
02021 }

void Layer::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 NodeRenderablePaper.

Definition at line 787 of file layer.cpp.

00788 {
00789     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00790     ENSURE(IS_A(pNodeCopy, Layer), "PolyCopyNodeContents given wrong dest node type");
00791 
00792     if (IS_A(pNodeCopy, Layer))
00793         CopyNodeContents((Layer*)pNodeCopy);
00794 }

void Layer::PreExportRender RenderRegion pRegion  )  [virtual]
 

Outputs data to mark the beginning of a layer.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Reimplemented from Node.

Definition at line 2392 of file layer.cpp.

02393 {
02394 #ifdef DO_EXPORT
02395     if(pRegion->IsKindOf(CC_RUNTIME_CLASS(ArtWorksEPSRenderRegion)))
02396     {
02397         // export layers in ArtWorks-type EPS render regions
02398 
02399         // Can only export guide layers in Native format
02400         if (Guide && !pRegion->IS_KIND_OF(NativeRenderRegion))
02401             return;
02402 
02403         // Get ptr to the export DC
02404         EPSExportDC *pDC = (EPSExportDC *) pRegion->GetRenderDC();
02405 
02406         // Guide layers are extended objects so mark them as such
02407         if (Guide)
02408         {
02409             pDC->OutputValue(INT32(EOTAG_GUIDELAYER));  // Output start extended object tag and token
02410             pDC->OutputToken(_T("cso"));
02411             pDC->OutputNewLine();
02412         }
02413 
02414         // Output the layer name
02415         pDC->OutputString(LayerSt.StringLayerID);
02416 
02417         // Layer type - foreground or background
02418         if (IsBackground())
02419             pDC->OutputToken(_T("0"));
02420         else
02421             pDC->OutputToken(_T("1"));
02422 
02423         // Visible flag
02424         if (Visible)
02425             pDC->OutputToken(_T("1"));
02426         else
02427             pDC->OutputToken(_T("0"));
02428 
02429         // Printable flag
02430         if (IsPrintable())
02431             pDC->OutputToken(_T("1"));
02432         else
02433             pDC->OutputToken(_T("0"));
02434 
02435         // Locked flag
02436         if (Locked)
02437             pDC->OutputToken(_T("1"));
02438         else
02439             pDC->OutputToken(_T("0"));
02440 
02441         // Layer token itself
02442 
02443         if (!Guide)
02444             pDC->OutputToken(_T("alyr"));
02445         else
02446         {
02447             // Output guide layer stuff
02448 
02449             if (pGuideColour == NULL)
02450                 SetGuideColour(NULL);
02451 
02452             ERROR3IF(pGuideColour == NULL,"Can't export guide layer without a colour");
02453 
02454             if (pGuideColour != NULL)
02455                 pDC->OutputNamedColour(pGuideColour);
02456 
02457             pDC->OutputToken(_T("glyr"));
02458         }
02459 
02460         pDC->OutputNewLine();
02461     }
02462 PORTNOTE("cmx", "Disabled CMXRenderRegion")
02463 #ifndef EXCLUDE_FROM_XARALX
02464     else if(pRegion->IsKindOf(CC_RUNTIME_CLASS(CMXRenderRegion)))
02465     {
02466         // mark start of a group...
02467         CMXExportDC *pDC = (CMXExportDC *) pRegion->GetRenderDC();
02468         pDC->StartLayer(GetLayerID());
02469     }
02470 #endif
02471 #endif
02472 }

BOOL Layer::ReadPostChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Reimplemented from Node.

Definition at line 3080 of file layer.cpp.

03081 {
03082     if (pFilter != NULL)
03083         pFilter->InvalidateRegion(this);
03084 
03085     return Node::ReadPostChildrenNative(pFilter);
03086 }

BOOL Layer::ReadPostChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

This function is called during the importing of the file.

> virtual BOOL Node::ReadPostChildrenWeb(BaseCamelotFilter* pFilter)

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/7/96
Parameters:
pFilter = ptr to filter to write to [INPUTS]
Returns:
TRUE if ok, FALSE otherwise
A node gets called via this function after all its children have been imported. This allows complex nodes (such as moulds) to do some post-import work, which can only be done after all its children have been read in and created.

See also:
CanWriteChildrenWeb(), WritePreChildrenWeb()

Reimplemented from Node.

Definition at line 3072 of file layer.cpp.

03073 {
03074     if (pFilter != NULL)
03075         pFilter->InvalidateRegion(this);
03076 
03077     return Node::ReadPostChildrenWeb(pFilter);
03078 }

void Layer::RenderAfterSubtree RenderRegion pRegion  )  [virtual]
 

Capture the group as a cached bitmap.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/08/2004
Parameters:
pRender - The region to render into [INPUTS]

Reimplemented from Node.

Definition at line 520 of file layer.cpp.

00521 {
00522     // Call Helper function to run all my cacheing functionality for me...
00523     if (IsVisible())
00524         CaptureCached(pRegion);
00525 }

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

Virtual function - this version decides whether or not a layer should be rendered according to the ExcludeLockedLayers flags and the state of the layer itself.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/02/94
Parameters:
pRender - A pointer to the current render region (NULL if none) [INPUTS]
Returns:
TRUE => This node should be rendered, FALSE => This node does not need to be rendered.
See also:
Node::NeedsToRender

Reimplemented from NodeRenderablePaper.

Definition at line 426 of file layer.cpp.

00427 {
00428     if (pRender==NULL)
00429         return SUBTREE_ROOTANDCHILDREN;
00430 
00431     // ignore hit detection render regions when the layer is locked.
00432     if (pRender->IsHitDetect() && IsLocked())
00433         return SUBTREE_NORENDER;
00434 
00435 
00436     // If we are printing then we do special things
00437     else if (pRender->IsPrinting())
00438     {
00439         // Ignore non-printable layers (i.e. don't ever print background layers)
00440         if (!IsPrintable())
00441             return SUBTREE_NORENDER;
00442 
00443         // Added this since we want to print what we see - might need looking at ?
00444         return IsVisible() ? SUBTREE_ROOTANDCHILDREN : SUBTREE_NORENDER;
00445 
00446         // Otherwise, get the print control
00447         
00448         CCPrintInfo *pInfo = CCPrintInfo::GetCurrent();
00449 //      ERROR2IF(pInfo == NULL, FALSE, "No print info for printing render region!");
00450         PrintControl *pPrCtrl = NULL;
00451         if (pInfo != NULL)
00452             pPrCtrl = pInfo->GetPrintControl();
00453 //      ERROR2IF(pPrCtrl == NULL, FALSE, "No print control for printing render region!");
00454 
00455         // Ok, work out what whether we should print this layer...
00456         if (pPrCtrl == NULL || pPrCtrl->GetPrintLayers() == PRINTLAYERS_VISIBLEFOREGROUND)
00457         {
00458             // Print only visible foreground layers.
00459             return IsVisible() ? SUBTREE_ROOTANDCHILDREN : SUBTREE_NORENDER;
00460         }
00461         else
00462         {
00463             // Print all foreground layers, regardless of visibility.
00464             return SUBTREE_ROOTANDCHILDREN;
00465         }
00466 
00467     }
00468     else if (IS_A(pRender,CamelotEPSRenderRegion))
00469         return (IsVisible() && IsPrintable()) ? SUBTREE_ROOTANDCHILDREN : SUBTREE_NORENDER;
00470     else
00471     {
00472         // Normal rendering
00473         //
00474         // Ask Helper function to set up cacheing for me...
00475         //
00476         // If we can find a cached bitmap for this node and render it
00477         // Then tell the renderer to move on without doing any more...
00478         // Else we might have set up a capture, in which case render as normal
00479         // and let RenderAfterSubtree catch the capture at the other end
00480         switch (Layer::EnableLayerCacheing)
00481         {
00482         // Value 1 means enable all layer cacheing
00483         case 1:
00484             if (IsVisible() && !IsGuide() && RenderCached(pRender))
00485             {
00486                 return SUBTREE_NORENDER;
00487             }
00488         break;
00489 
00490         // Value 2 means enable layer cacheing for all but the active layer
00491         case 2:
00492             if (IsVisible() && !IsGuide() && !IsActive() && RenderCached(pRender))
00493             {
00494                 return SUBTREE_NORENDER;
00495             }
00496         break;
00497 
00498         }
00499 
00500         // Simple visibility check...
00501         return IsVisible() ? SUBTREE_ROOTANDCHILDREN : SUBTREE_NORENDER;
00502     }
00503 
00504     return SUBTREE_NORENDER;
00505 }

void Layer::SetActive BOOL  Status  ) 
 

To set the Layer's active flag status (TRUE/FALSE).

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/1/94
Parameters:
Status,: Status of the Layer's active flag [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1796 of file layer.cpp.

01797 {
01798     Active = Status; 
01799 }

void Layer::SetBackground BOOL  Status  ) 
 

To set the Layer's background flag status (TRUE/FALSE).

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/1/94
Parameters:
Status,: Status of the Layer's background flag [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1838 of file layer.cpp.

01839 {
01840     Background = Status; 
01841 }

void Layer::SetCaptureQuality const Quality NewQuality  )  [inline]
 

Definition at line 326 of file layer.h.

00326 { m_CaptureQuality = NewQuality; }

void Layer::SetEdited BOOL  Status  ) 
 

To set the Frame/Layer's Edited flag status (TRUE/FALSE).

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/4/97
Parameters:
Status,: Status of the Frame/Layer's Edited flag [INPUTS]

Definition at line 1949 of file layer.cpp.

01950 {
01951     m_Edited = Status; 
01952 }

void Layer::SetFrame BOOL  Status  ) 
 

To set the Frame/Layer's Frame flag status (TRUE/FALSE).

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/4/97
Parameters:
Status,: Status of the Frame/Layer's Frame flag [INPUTS]

Definition at line 1965 of file layer.cpp.

01966 {
01967     m_Frame = Status; 
01968 }

void Layer::SetFrameDelay const DWORD Delay  ) 
 

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/05/97
Returns:
- purpose: To set the delay value for each animation frame layer.

Definition at line 1655 of file layer.cpp.

01656 {
01657     m_FrameDelay = Delay;
01658 }

BOOL Layer::SetGeneratedBitmap KernelBitmap pBitmap  ) 
 

To set the bitmap that has been generated to represent this layer.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/5/97
Parameters:
The kernel bitmap that we wish to represent this layer [INPUTS]

Definition at line 2055 of file layer.cpp.

02056 {
02057     //ERROR2IF(pBitmap == NULL,FALSE,"SetGeneratedBitmap Bad params");
02058 
02059     Document *pParentDoc = (Document *) FindOwnerDoc();
02060     ERROR2IF(pParentDoc == NULL,FALSE,"SetGeneratedBitmap bad parent doc!");
02061 
02062     // delete the old one from the system, if it is there and it is not used
02063     // elsewhere in the document
02064     KernelBitmap * pOldBitmap = m_GeneratedBitmap.GetBitmap();
02065     if (pOldBitmap)
02066     {
02067         // Disclude ourselves from the count
02068         m_GeneratedBitmap.Detach();
02069         
02070         // Should we use HasBeenDeleted???
02071         // If the bitmap is not used in this document then delete it
02072         if (!pOldBitmap->IsUsedInDocument(pParentDoc))
02073             delete pOldBitmap;
02074         //m_GeneratedBitmap.DeleteBmp();
02075     }
02076 
02077     // Only do this if we are passed in a non-null bitmap
02078     if (pBitmap != NULL)
02079     {
02080         // Make our bitmap ref use the new specified one
02081         // We could use the nice and simple:-
02082         //m_GeneratedBitmap.Attach(pBitmap, pParentDoc);
02083         // but this makes a new kernel bitmap, which is bad!
02084         // So do this instead:-
02085         // Try and add it to the list of bitmaps already present in this document
02086         BitmapList * pBmpList = pParentDoc->GetBitmapList();
02087         if (pBmpList == NULL)
02088         {
02089             ERROR3("SetGeneratedBitmap No document bitmap ref found!");
02090             return FALSE; 
02091         }
02092 
02093         // and then attach the bitmap
02094         pBitmap->Attach(pBmpList);
02095         // and tell everybody about the change
02096         BROADCAST_TO_ALL(BitmapListChangedMsg(pBmpList, pBitmap)); 
02097 
02098         m_GeneratedBitmap.SetBitmap(pBitmap);
02099 
02100         // If we have a generated bitmap then we cannot have a referenced bitmap
02101         // so reset the referenced bitmap
02102         SetReferencedBitmap(NULL);
02103     }
02104 
02105     return TRUE;
02106 }

void Layer::SetGuide BOOL  Status  ) 
 

To set the Layer's Guide flag status (TRUE/FALSE).

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/9/95
Parameters:
Status,: Status of the Layer's Guide flag [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1881 of file layer.cpp.

01882 {
01883     Guide = Status; 
01884 }

void Layer::SetGuideColour IndexedColour pIndexedColour  ) 
 

Assigns the given indexed colour as the colour to render guide objects in this layer in.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/10/95
Parameters:
pIndexedColour = ptr to IndexedColour (NULL means set to default) [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
GetGuideColour()

Definition at line 3126 of file layer.cpp.

03127 {
03128     if (pGuideColour == NULL)
03129         pGuideColour = new DocColour();
03130 
03131     if (pGuideColour != NULL)
03132     {
03133         if (pIndexedColour == NULL)
03134         {
03135             ColourValue r = ColourValue(double(GuideLayerRed)   / double(COL_MAX));
03136             ColourValue g = ColourValue(double(GuideLayerGreen) / double(COL_MAX));
03137             ColourValue b = ColourValue(double(GuideLayerBlue)  / double(COL_MAX));
03138             pIndexedColour = new IndexedColour(r,g,b);
03139             pIndexedGuideColour = pIndexedColour;
03140         }
03141 
03142         if (pIndexedColour != NULL)
03143             pGuideColour->MakeRefToIndexedColour(pIndexedColour);
03144     }
03145 }

void Layer::SetHiddenFrame BOOL  Status  ) 
 

To set the Frame/Layer's Hidden flag status (TRUE/FALSE).

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/7/97
Parameters:
Status,: Status of the Frame/Layer's Hidden flag [INPUTS]

Definition at line 1981 of file layer.cpp.

01982 {
01983     m_HiddenFrame = Status; 
01984 }

void Layer::SetLayerID String_256 LayerID  ) 
 

For setting the layer's identifier.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/1/94
Parameters:
LayerID,: The new layer identifier [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 2238 of file layer.cpp.

02239 {
02240     LayerSt.StringLayerID = LayerID; 
02241 } 

void Layer::SetLayerStatus LayerStatus Status  ) 
 

To set the layers status.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/1/94
Parameters:
Status,: The new status for the layer [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
Layer::SetVisible

Layer::SetLocked

Layer::SetActive

Layer::SetPrintable

Layer::SetBackground

LAyer::SetGlobalQualityFlg

Definition at line 2264 of file layer.cpp.

02265 {
02266     LayerSt = Status;   
02267 }

void Layer::SetLocked BOOL  Status  ) 
 

To set the Layer's locked flag status (TRUE/FALSE).

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/1/94
Parameters:
Status,: Status of the Layer's locked flag [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from Node.

Definition at line 1775 of file layer.cpp.

01776 {
01777     Locked = Status; 
01778 }

void Layer::SetOpPermission OpPermissionState  NewState,
BOOL  AndParents = FALSE
[virtual]
 

Calls Node::SetOpPermission(NewState,FALSE), i.e. you can set the layer's op permission state, but the 'AndParent' param is ignored.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/02/95
Parameters:
NewState = the state to set the permission to [INPUTS] AndParents = Ignored (see later)
- [OUTPUTS]
Returns:
-
The purpose of this func is to make layers the top level node that has it's op permission state changed.

See also:
Node::SetOpPermission();

Reimplemented from Node.

Definition at line 2582 of file layer.cpp.

02583 {
02584     Node::SetOpPermission(NewState,FALSE);
02585 }

void Layer::SetOutline BOOL  Status  ) 
 

To set the Layer's outline flag status (TRUE/FALSE).

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/8/94
Parameters:
Status,: Status of the Layer's outline flag [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1860 of file layer.cpp.

01861 {
01862     Outline = Status; 
01863 }

void Layer::SetOverlay BOOL  Status  ) 
 

To set the Frame/Layer's Overlay flag status (TRUE/FALSE).

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/4/97
Parameters:
Status,: Status of the Frame/Layer's Overlay flag [INPUTS]

Definition at line 1933 of file layer.cpp.

01934 {
01935     m_Overlay = Status; 
01936 }

void Layer::SetPageBackground BOOL  Status  ) 
 

To set the Layer's PageBackground flag status (TRUE/FALSE).

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/4/97
Parameters:
Status,: Status of the Layer's PageBackground flag [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1901 of file layer.cpp.

01902 {
01903     m_PageBackground = Status; 
01904 }

void Layer::SetPrintable BOOL  Status  ) 
 

To set the Layer's printable flag status (TRUE/FALSE).

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/1/94
Parameters:
Status,: Status of the Layer's printable flag [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1817 of file layer.cpp.

01818 {
01819     Printable = Status; 
01820 }

BOOL Layer::SetReferencedBitmap KernelBitmap pBitmap  ) 
 

To set the bitmap that has been found which is a single bitmap on this layer which is of the correct colour depth and scaling which can be used to directly represent this layer. Usually, the bitmap will be part of an animation that has been loaded in.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/7/97
Parameters:
The kernel bitmap that we wish to represent this layer [INPUTS]

Definition at line 2182 of file layer.cpp.

02183 {
02184     // We have a direct pointer rather than a ref as otherwise we will see the bitmap twice
02185     // in the bitmap gallery for this document.
02186     m_pReferencedBitmap = pBitmap;
02187 
02188     return TRUE;
02189 }

void Layer::SetSolid BOOL  Status  ) 
 

To set the Frame/Layer's Solid flag status (TRUE/FALSE).

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/4/97
Parameters:
Status,: Status of the Frame/Layer's Solid flag [INPUTS]

Definition at line 1917 of file layer.cpp.

01918 {
01919     m_Solid = Status; 
01920 }

void Layer::SetVisible BOOL  Status  ) 
 

To set the Layer's visible flag status (TRUE/FALSE).

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/1/94
Parameters:
Status,: Status of the Layer's visible flag [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1747 of file layer.cpp.

01748 {
01749     if (Guide)
01750     {
01751         DocView* pDocView = DocView::GetCurrent();
01752         if (pDocView != NULL)
01753              pDocView->SetShowGuidesState(Status);
01754     }
01755     else
01756         Visible = Status;
01757 }

Node * Layer::SimpleCopy void   )  [protected, 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:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/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 NodeRenderablePaper.

Definition at line 702 of file layer.cpp.

00703 {
00704     Layer* NodeCopy; 
00705     NodeCopy = new Layer();  
00706     //ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
00707     if (NodeCopy != NULL)
00708         CopyNodeContents(NodeCopy);   
00709     return (NodeCopy);
00710 }           

BOOL Layer::WriteAtomicNodesColourRefs Node pLayer,
BaseCamelotFilter pFilter
[virtual]
 

All compound nodes (e.g. bevels, contours, shadows, clipview) are now defined as being atomic. This is so that they can be backwards compatible with CX2. This means that colour definitions that occur within these nodes are omitted when CX2 reads the files. The cause access violations when another colour definition references the omitted. Thus, compund atomic nodes MUST write colour definitions BEFORE the node is written. The function scans the document for relevent nodes, and cause them to write out their colour definitions immediately after the layer node. This is only done of compound atomic nodes, since doing it for all would slow down other peoples distributed stuff.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/9/2000
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if written, FALSE otherwise

Errors: -

See also:
BaseCamelotFilter::WriteRemainingAtomicTagDefinitions () Layer::WriteAtomicNodesColourRefs () AttrFillGeometry::WriteColourDefinitions ()

Definition at line 3560 of file layer.cpp.

03561 {
03562     BOOL ok = TRUE;
03563 
03564     CCRuntimeClass * pClass = CC_RUNTIME_CLASS(AttrFlatColourFill);
03565     BOOL done = FALSE;
03566     INT32 i = 0;
03567 
03568     while (!done)
03569     {
03570         AttrFillGeometry* pNode = (AttrFillGeometry*) SliceHelper::FindNextOfClass(pLayer, pLayer, pClass);
03571 
03572         while (pNode)
03573         {
03574             if (ShouldWriteColourDefinitions (pNode))
03575             {
03576                 ok = pNode->WriteColourDefinitions (pFilter);
03577             }
03578             pNode = (AttrFillGeometry*) SliceHelper::FindNextOfClass(pNode, pLayer, pClass);
03579         }
03580         if (!ok) done = TRUE;
03581         switch (i)
03582         {
03583             case 0:
03584                 pClass = CC_RUNTIME_CLASS(AttrLinearColourFill);
03585             break;
03586             case 1:
03587                 pClass = CC_RUNTIME_CLASS(AttrRadialColourFill);
03588             break;
03589             case 2:
03590                 pClass = CC_RUNTIME_CLASS(AttrConicalColourFill);
03591             break;
03592             case 3:
03593                 pClass = CC_RUNTIME_CLASS(AttrSquareColourFill);
03594             break;
03595             case 4:
03596                 pClass = CC_RUNTIME_CLASS(AttrThreeColColourFill);
03597             break;
03598             case 5:
03599                 pClass = CC_RUNTIME_CLASS(AttrFourColColourFill);
03600             break;
03601             case 6:
03602                 pClass = CC_RUNTIME_CLASS(AttrBitmapColourFill);
03603             break;
03604             case 7:
03605                 pClass = CC_RUNTIME_CLASS(AttrFractalColourFill);
03606             break;
03607             case 8:
03608                 pClass = CC_RUNTIME_CLASS(AttrNoiseColourFill);
03609             break;
03610             case 9:
03611                 pClass = CC_RUNTIME_CLASS(AttrStrokeColour);
03612             break;
03613             default:
03614                 done = TRUE;
03615         }
03616 
03617         i++;
03618     }
03619 
03620     return (ok);
03621 }

BOOL Layer::WriteBeginChildRecordsNative BaseCamelotFilter pFilter  )  [virtual]
 

Begins the child record sequence for layers in the native format.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/8/96
Parameters:
pFilter = ptr to the filter to write to [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the node has written out a record to the filter FALSE otherwise
The native format writes out all layers and includes the layer details record as the layer's first child record

See also:
WritePreChildrenNative()

Reimplemented from Node.

Definition at line 2923 of file layer.cpp.

02924 {
02925 #ifdef DO_EXPORT
02926     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
02927 
02928     // First thing to do is write out the Down record
02929     BOOL ok = (pFilter->WriteZeroSizedRecord(TAG_DOWN));
02930 
02931     // The colour ref used in the guide layer info record
02932     INT32 ColRef = 0;
02933 
02934     // Firstly, if it's a guide layer write out the colour definition
02935     if (ok && IsGuide())
02936     {
02937         DocColour* pColour = GetGuideColour();
02938 
02939         if (pColour != NULL)
02940             ColRef = pFilter->WriteRecord(pColour);
02941 
02942         if (ColRef == 0)
02943         {
02944             pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
02945             ok = FALSE;
02946         }
02947     }
02948 
02949     if (ok)
02950     {
02951         // Assume it's a normal layer (i.e. not a guide layer)
02952         UINT32 Tag  = TAG_LAYERDETAILS;
02953         INT32  Size = TAG_LAYERDETAILS_SIZE;
02954 
02955         // If it's a guide layer, change the tag & size values
02956         if (IsGuide())
02957         {
02958             Tag  = TAG_GUIDELAYERDETAILS;
02959             Size = TAG_GUIDELAYERDETAILS_SIZE;
02960         }
02961 
02962         // Build the flags byte
02963         BYTE Flags = 0;
02964         if (GetVisibleFlagState())  Flags |= TAG_LAYER_FLAG_VISIBLE;
02965         if (GetLockedFlagState())   Flags |= TAG_LAYER_FLAG_LOCKED;
02966         if (IsPrintable())          Flags |= TAG_LAYER_FLAG_PRINTABLE;
02967         if (IsActive())             Flags |= TAG_LAYER_FLAG_ACTIVE;
02968         // new 4/4/97
02969         if (IsPageBackground())     Flags |= TAG_LAYER_FLAG_PAGEBACKGROUND;
02970         if (IsBackground())         Flags |= TAG_LAYER_FLAG_BACKGROUND;
02971 
02972         // Create a record and write to it
02973         CamelotFileRecord Rec(pFilter,Tag,Size);
02974         if (ok) ok = Rec.Init();
02975         if (ok) ok = Rec.WriteBYTE(Flags);
02976         if (ok) ok = Rec.WriteUnicode(GetLayerID());
02977 
02978         // Make sure the guide layer details include the colour ref
02979         if (ok && Tag == TAG_GUIDELAYERDETAILS)
02980             ok = Rec.WriteReference(ColRef);
02981 
02982         // Write the details record to the file.
02983         ok = (pFilter->Write(&Rec) != 0);
02984 
02985         // Only write out the frame properties if it is a frame layer
02986         if (ok && IsFrame()) ok = WriteFrameLayerProperties(pFilter);
02987 
02988         ok = WriteAtomicNodesColourRefs (this, pFilter);
02989     }
02990 
02991     return ok;
02992 #else
02993     return FALSE;
02994 #endif
02995 }

BOOL Layer::WriteBeginChildRecordsWeb BaseCamelotFilter pFilter  )  [virtual]
 

See note in BOOL Layer::WritePreChildrenWeb(BaseCamelotFilter* pFilter) for a reason why this code is commented out (markn 12/8/96)

  • UINT32 WritableLayerCount = CountNumWritableWebLayers(pFilter);
  • if (WritableLayerCount < 2)
  • return TRUE;

Reimplemented from Node.

Definition at line 3040 of file layer.cpp.

03041 {
03042 /*****************************************************
03043 See note in BOOL Layer::WritePreChildrenWeb(BaseCamelotFilter* pFilter) for 
03044 a reason why this code is commented out
03045 (markn 12/8/96)
03046 
03047 -   UINT32 WritableLayerCount = CountNumWritableWebLayers(pFilter);
03048 -
03049 -   if (WritableLayerCount < 2)
03050 -       return TRUE;
03051 ******************************************************/
03052 
03053     return Node::WriteBeginChildRecordsWeb(pFilter);
03054 }

BOOL Layer::WriteEndChildRecordsNative BaseCamelotFilter pFilter  )  [virtual]
 

Ends the child record sequence for layers in the native format.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/8/96
Parameters:
pFilter = ptr to the filter to write to [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the node has written out a record to the filter FALSE otherwise
The native format writes out all layers. This func just writes out the Up record

See also:
WritePreChildrenNative()

Reimplemented from Node.

Definition at line 3015 of file layer.cpp.

03016 {
03017 #ifdef DO_EXPORT
03018     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
03019     return pFilter->WriteZeroSizedRecord(TAG_UP);
03020 #else
03021     return FALSE;
03022 #endif
03023 }

BOOL Layer::WriteEndChildRecordsWeb BaseCamelotFilter pFilter  )  [virtual]
 

See note in BOOL Layer::WritePreChildrenWeb(BaseCamelotFilter* pFilter) for a reason why this code is commented out (markn 12/8/96)

  • UINT32 WritableLayerCount = CountNumWritableWebLayers(pFilter);
  • if (WritableLayerCount < 2)
  • return TRUE;

Reimplemented from Node.

Definition at line 3056 of file layer.cpp.

03057 {
03058 /*****************************************************
03059 See note in BOOL Layer::WritePreChildrenWeb(BaseCamelotFilter* pFilter) for 
03060 a reason why this code is commented out
03061 (markn 12/8/96)
03062 
03063 -   UINT32 WritableLayerCount = CountNumWritableWebLayers(pFilter);
03064 -
03065 -   if (WritableLayerCount < 2)
03066 -       return TRUE;
03067 ******************************************************/
03068 
03069     return Node::WriteEndChildRecordsWeb(pFilter);
03070 }

BOOL Layer::WriteFrameLayerProperties BaseCamelotFilter pFilter  )  [virtual]
 

Exports the delay details for this frame layer to the filter.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/5/97 Input: pFilter = ptr to the filter to export to.
Parameters:
- [OUTPUTS]
Returns:
TRUE if ok, FALSE otherwise.

Definition at line 3333 of file layer.cpp.

03334 {
03335 #ifdef DO_EXPORT
03336     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
03337 
03338     BOOL RecordWritten = FALSE;
03339     BOOL ok = TRUE;
03340 
03341     // Add a description of the TAG_LAYER_FRAMEPROPS record, for older importers that don't understand this record
03342     pFilter->AddTagDescription(TAG_LAYER_FRAMEPROPS, _R(IDS_TAG_LAYER_FRAMEPROPS));
03343 
03344     // Start a record to save our data in
03345     CXaraFileRecord Rec(TAG_LAYER_FRAMEPROPS, TAG_LAYER_FRAMEPROPS_SIZE);
03346     // Get the Frame delay inforamtion.
03347     DWORD Delay = GetFrameDelay();
03348     BYTE Flags = 0;
03349 
03350     if (IsSolid())          Flags |= TAG_LAYER_FLAG_SOLID;
03351     if (IsOverlay())        Flags |= TAG_LAYER_FLAG_OVERLAY;
03352     if (IsHiddenFrame())    Flags |= TAG_LAYER_FLAG_HIDDEN;
03353         
03354     ok = Rec.Init();
03355 
03356     if (ok)
03357         ok = Rec.WriteUINT32(Delay);    
03358 
03359     if (ok)
03360         ok = Rec.WriteBYTE(Flags);  
03361 
03362     // Write out the record.
03363     if (ok) ok = (pFilter->Write(&Rec) != 0);
03364     if (ok)
03365         RecordWritten = TRUE;
03366     else
03367         pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
03368 
03369     return RecordWritten;
03370 #else
03371     return FALSE;   
03372 #endif 
03373 
03374 };

BOOL Layer::WritePostChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Reimplemented from Node.

Definition at line 3035 of file layer.cpp.

03036 {
03037     return Node::WritePostChildrenNative(pFilter);
03038 }

BOOL Layer::WritePostChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

Gives the node a change to write data to the filter after its children have been automatically written out.

> virtual BOOL Node::WritePostChildrenWeb(BaseCamelotFilter* pFilter)

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/5/96
Parameters:
pFilter = ptr to filter to write to [INPUTS]
Returns:
TRUE if ok, FALSE otherwise
This function will get called even if CanWriteChildrenWeb() has returned FALSE

See also:
CanWriteChildrenWeb(), WritePreChildrenWeb()

Reimplemented from Node.

Definition at line 3030 of file layer.cpp.

03031 {
03032     return Node::WritePostChildrenWeb(pFilter);
03033 }

BOOL Layer::WritePreChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Writes out the layer data suitable for the native format.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/7/96
Parameters:
pFilter = ptr to the filter to write to [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the node has written out a record to the filter FALSE otherwise
See also:
WritePreChildrenNative()

Reimplemented from Node.

Definition at line 2798 of file layer.cpp.

02799 {
02800 #ifdef DO_EXPORT
02801     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
02802 
02803     // If the layer doesn't want the children to be written out, then don't write out the layer record
02804     if (!CanWriteChildrenNative(pFilter))
02805         return FALSE;
02806 
02807     // Always write out the layer record in the native format
02808     CamelotFileRecord Rec(pFilter,TAG_LAYER,TAG_LAYER_SIZE);
02809     return (pFilter->Write(&Rec) != 0);
02810 
02811 #else
02812     return FALSE;
02813 #endif
02814 }

BOOL Layer::WritePreChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

Writes out the layer data suitable for the web format.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/7/96
Parameters:
pFilter = ptr to the filter to write to [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the node has written out a record to the filter FALSE otherwise
Web files only need to write out the basic layer record - no other info is needed.

NOTE: See Layer::CanWriteChildrenWeb() header for the rules that determine whether a layer is actually written or not

See also:
CanWriteChildrenWeb()

Reimplemented from Node.

Definition at line 2747 of file layer.cpp.

02748 {
02749 #ifdef DO_EXPORT
02750     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
02751 
02752     // If the layer doesn't want the children to be written out, then don't write out the layer record
02753     if (!CanWriteChildrenWeb(pFilter))
02754         return FALSE;
02755 
02756 /***************************************
02757 Originally, .web files would not write out a layer node if there was only one layer
02758 i.e. the layer could be implied, hence saving space.
02759 
02760 However, writing the layer node out has benefits when importing .web files.  It means we can easily
02761 make sure undo import works, plus we can cope with redraw problems easier.
02762 
02763 So single-layer docs saved out in the new format will contain a layer node.
02764 (markn 12/8/96)
02765 
02766 -   UINT32 WritableLayerCount = CountNumWritableWebLayers(pFilter);
02767 -   ERROR3IF(WritableLayerCount == 0,"WritableLayerCount should be at least 1");
02768 -
02769 -   // If there aren't 2 or more writable layers, then don't bother 
02770 -   if (WritableLayerCount < 2)
02771 -       return FALSE;
02772 *****************************************/
02773 
02774     CamelotFileRecord Rec(pFilter,TAG_LAYER,TAG_LAYER_SIZE);
02775     return (pFilter->Write(&Rec) != 0);
02776 
02777 #else
02778     return FALSE;
02779 #endif
02780 }


Member Data Documentation

BOOL Layer::Active [private]
 

Definition at line 344 of file layer.h.

BOOL Layer::ActiveLayerVisibleAndEditable = FALSE [static]
 

Dictates whether the active layer is automatically made visible and editable or whether it is left in its last state which might include it being invisible. Defaults to the old system (FALSE).

Preference: ActiveLayerVisibleAndEditable Section: Layers Range: 0 - 1

It is controlled by the "Current layer always visible & editable" switch in the General options tab.

See also:
NodeRenderableBounded::Init();

Definition at line 278 of file layer.h.

BOOL Layer::Background [private]
 

Definition at line 350 of file layer.h.

INT32 Layer::EnableLayerCacheing = 1 [static]
 

Control whether layers are cached or not.

Preference: EnableLayerCacheing Section: Layers Range: 0 - 2

See also:
NodeRenderableBounded::Init();

Definition at line 279 of file layer.h.

BOOL Layer::Guide [private]
 

Definition at line 352 of file layer.h.

INT32 Layer::GuideLayerBlue = 0 [static, private]
 

Definition at line 383 of file layer.h.

INT32 Layer::GuideLayerGreen = 0 [static, private]
 

Definition at line 382 of file layer.h.

INT32 Layer::GuideLayerRed = 255 [static, private]
 

Definition at line 381 of file layer.h.

LayerStatus Layer::LayerSt [private]
 

Definition at line 342 of file layer.h.

BOOL Layer::Locked [private]
 

Definition at line 347 of file layer.h.

Quality Layer::m_CaptureQuality [private]
 

Definition at line 370 of file layer.h.

BOOL Layer::m_Edited [private]
 

Definition at line 362 of file layer.h.

BOOL Layer::m_Frame [private]
 

Definition at line 364 of file layer.h.

DWORD Layer::m_FrameDelay [private]
 

Definition at line 368 of file layer.h.

KernelBitmapRef Layer::m_GeneratedBitmap [private]
 

Definition at line 372 of file layer.h.

BOOL Layer::m_HiddenFrame [private]
 

Definition at line 365 of file layer.h.

BOOL Layer::m_Overlay [private]
 

Definition at line 358 of file layer.h.

BOOL Layer::m_PageBackground [private]
 

Definition at line 354 of file layer.h.

KernelBitmap* Layer::m_pReferencedBitmap [private]
 

Definition at line 374 of file layer.h.

BOOL Layer::m_Solid [private]
 

Definition at line 360 of file layer.h.

BOOL Layer::Outline [private]
 

Definition at line 351 of file layer.h.

DocColour* Layer::pGuideColour [private]
 

Definition at line 377 of file layer.h.

IndexedColour* Layer::pIndexedGuideColour [private]
 

Definition at line 378 of file layer.h.

LayerMsgHandler * Layer::pLayerMsgHandler = NULL [static, private]
 

Definition at line 386 of file layer.h.

BOOL Layer::Printable [private]
 

Definition at line 349 of file layer.h.

BOOL Layer::Visible [private]
 

Definition at line 346 of file layer.h.


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