GlobalFractalList Class Reference

A list of all the Fractals available in the application. More...

#include <fraclist.h>

Inheritance diagram for GlobalFractalList:

List CCObject SimpleCCObject List of all members.

Public Member Functions

 GlobalFractalList ()
 GlobalFractalList constructor.
 ~GlobalFractalList ()
 GlobalFractalList destructor.
BOOL AddFractal (FillGeometryAttribute *)
 Adds an item to the tail of the GlobalFractallist if it doesn't already exist.
BOOL RemoveFractal (FillGeometryAttribute *)
 Called when a fractal is destroyed.
void GetDocumentFractalData (Document *pDoc, EnumFractalData *pData)
 Updates the fields in the EnumFractalData with information about fractals in the specified document.
CachedFractalCheckFractalBitmap (FillGeometryAttribute *)
 Checks to see if this fractal fill is already in the list.

Static Public Member Functions

static BOOL Init ()
 Initialise the GlobalFractalList.
static BOOL DeInit ()
 DeInitialise the GlobalFractalList. Static function so it finds the global fractal list first.

Private Member Functions

INT32 GetFractalCacheCount ()
 Calculates the total number of cached fractals.
INT32 GetFractalCacheSize ()
 Calculates the total memory used by the cached fractals.
void Destroy ()
 Destroy the contents of the fractal list.

Detailed Description

A list of all the Fractals available in the application.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>/Mike
See also:
-

Definition at line 183 of file fraclist.h.


Constructor & Destructor Documentation

GlobalFractalList::GlobalFractalList  ) 
 

GlobalFractalList constructor.

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

Definition at line 377 of file fraclist.cpp.

00378 {
00379 }

GlobalFractalList::~GlobalFractalList  ) 
 

GlobalFractalList destructor.

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

Definition at line 394 of file fraclist.cpp.

00395 {
00396     if (!IsEmpty())
00397     {
00398         TRACEALL( _T("Trying to delete global fractal list when it's not empty !!\n") );
00399         Destroy();
00400     }
00401 }


Member Function Documentation

BOOL GlobalFractalList::AddFractal FillGeometryAttribute NewFractal  ) 
 

Adds an item to the tail of the GlobalFractallist if it doesn't already exist.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/12/94
Returns:
FALSE if this fractal already exits.

Definition at line 472 of file fraclist.cpp.

00473 {
00474     CachedFractal* ExistingFrac = CheckFractalBitmap(NewFractal);
00475 
00476     if (ExistingFrac != NULL)
00477     {
00478         ExistingFrac->IncUsageCount();
00479         return FALSE;
00480     }
00481 
00482     CachedFractal* Fractal = new CachedFractal();
00483 
00484     if (Fractal == NULL)
00485         return FALSE;
00486 
00487     TRACEUSER( "Mike", _T("Adding Cached Fractal @ %x\n"),Fractal);
00488 
00489     Fractal->SetCachedFractal(NewFractal);
00490     Fractal->IncUsageCount();
00491 
00492     AddTail((ListItem*)Fractal);
00493 
00494     if (this != GetApplication()->GetGlobalFractalList())
00495         Fractal->MakeFakeFractal();
00496 
00497     TRACEUSER( "Mike", _T("Cached Fractal Count = %d\n"),GetFractalCacheCount());
00498     TRACEUSER( "Mike", _T("Cached Fractal Size  = %d\n"),GetFractalCacheSize());
00499 
00500     return(TRUE);
00501 }

CachedFractal * GlobalFractalList::CheckFractalBitmap FillGeometryAttribute FractalFill  ) 
 

Checks to see if this fractal fill is already in the list.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/12/94
Returns:
The existing Fractal if one exists.

Definition at line 549 of file fraclist.cpp.

00550 {
00551     ListItem* Fractal = GetHead();
00552     while (Fractal!=NULL)
00553     {
00554         // Are the fractals the same ?
00555         if ( *((CachedFractal*)Fractal) == *FractalFill )
00556             return ((CachedFractal*)Fractal);
00557         
00558         Fractal = GetNext(Fractal);
00559     }   
00560     return NULL;
00561 }

BOOL GlobalFractalList::DeInit  )  [static]
 

DeInitialise the GlobalFractalList. Static function so it finds the global fractal list first.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/2/95
Returns:
FALSE if failed.

Definition at line 452 of file fraclist.cpp.

00453 {
00454     GlobalFractalList* FracList = GetApplication()->GetGlobalFractalList();
00455     if (FracList)
00456         FracList->Destroy();
00457     return TRUE;
00458 }

void GlobalFractalList::Destroy  )  [private]
 

Destroy the contents of the fractal list.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/2/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 416 of file fraclist.cpp.

00417 {
00418     ListItem* Fractal;
00419     while ((Fractal=RemoveHead())!=NULL)
00420         delete Fractal;
00421 }

void GlobalFractalList::GetDocumentFractalData Document pDoc,
EnumFractalData pData
 

Updates the fields in the EnumFractalData with information about fractals in the specified document.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/3/94
Parameters:
pDoc = a pointer to a document [INPUTS] pData = a pointer to a structure to fill
pData is updated with information about the fractals used in this document [OUTPUTS]
Returns:
-

Definition at line 618 of file fraclist.cpp.

00619 {
00620     BitmapInfo Info;
00621     GlobalFractalList FoundList;
00622 
00623     if (pDoc != NULL)
00624     {
00625         // Now Scan this document's tree for any references to a bitmap
00626         Node* pNode = Node::DocFindFirstDepthFirst(pDoc);
00627         while (pNode != NULL)
00628         {
00629             // First of all is this a NodeHidden ?
00630             // If so we want to look at the actual hidden node it's pointing at,
00631             // and scan the subtree, for Hidden bitmap references.
00632             if (!pNode->IsNodeHidden())
00633             {
00634                 if (pNode->IsAnAttribute())     // Is this an Attribute ?
00635                 {
00636                     // Is it a Fractal Fill ?
00637                     if (((NodeAttribute*)pNode)->IsAFractalFill())
00638                     {
00639                         AttrFractalFill* pFrac = (AttrFractalFill*)pNode;
00640                         FillGeometryAttribute* pVal = (FillGeometryAttribute*)pFrac->GetAttributeValue();
00641                         BOOL NewFractal = FoundList.AddFractal(pVal);
00642 
00643                         if (NewFractal)
00644                         {
00645                             pData->Count++;
00646 
00647                             if (pVal->GetBitmap() &&
00648                                 pVal->GetBitmap()->ActualBitmap)
00649                             {
00650                                 pVal->GetBitmap()->ActualBitmap->GetInfo(&Info);
00651                                 pData->Size += Info.MemoryUsed;
00652                             }
00653                         }
00654                     }
00655                 }
00656             }
00657 
00658             // Move onto the next node in the tree
00659             pNode = pNode->DocFindNextDepthFirst(); 
00660         }
00661     }
00662 
00663     FoundList.Destroy();
00664 }

INT32 GlobalFractalList::GetFractalCacheCount  )  [private]
 

Calculates the total number of cached fractals.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/3/94
Returns:
The total number of cached fractals.

Definition at line 574 of file fraclist.cpp.

00575 {
00576     return GetCount();
00577 }

INT32 GlobalFractalList::GetFractalCacheSize  )  [private]
 

Calculates the total memory used by the cached fractals.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/3/94
Returns:
The total memory used by the cached fractals.

Definition at line 590 of file fraclist.cpp.

00591 {
00592     INT32 FracSize = 0;
00593     ListItem* Fractal = GetHead();
00594     while (Fractal != NULL)
00595     {
00596         FracSize += ((CachedFractal*)Fractal)->GetSize();
00597         Fractal = GetNext(Fractal);
00598     }   
00599     return FracSize;
00600 }

BOOL GlobalFractalList::Init void   )  [static]
 

Initialise the GlobalFractalList.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/2/95
Returns:
FALSE if failed.

Reimplemented from SimpleCCObject.

Definition at line 435 of file fraclist.cpp.

00436 {
00437     return TRUE;
00438 }

BOOL GlobalFractalList::RemoveFractal FillGeometryAttribute Frac  ) 
 

Called when a fractal is destroyed.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/12/94
Returns:
TRUE if the fractal was really removed (or doesn't exist)

Definition at line 514 of file fraclist.cpp.

00515 {
00516     CachedFractal* ExistingFrac = CheckFractalBitmap(Frac);
00517 
00518     if (ExistingFrac == NULL)
00519         return TRUE;        // This will be the case when we delete the cached fractal
00520 
00521     ExistingFrac->DecUsageCount();
00522 
00523     if (ExistingFrac->GetUsageCount() <= 0)
00524     {
00525         TRACEUSER( "Mike", _T("Removing Cached Fractal @ %x\n"),ExistingFrac);
00526         RemoveItem((ListItem*)ExistingFrac);
00527         delete ExistingFrac;
00528 
00529         return TRUE;
00530     }
00531 
00532     TRACEUSER( "Mike", _T("Cached Fractal Count = %d\n"),GetFractalCacheCount());
00533     TRACEUSER( "Mike", _T("Cached Fractal Size  = %d\n"),GetFractalCacheSize());
00534 
00535     return FALSE;   // The fractal is still there
00536 }


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