BrushComponentClass Class Reference

The class that gets a Brush doc component going on start up We need to register our class as a document component and this is where we do it all. More...

#include <brshcomp.h>

Inheritance diagram for BrushComponentClass:

DocComponentClass ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

BOOL AddComponent (BaseDocument *pDoc)
 Add a Brush component to the specified document.

Static Public Member Functions

static BOOL Init ()
 Register the Brush document component with the main application.
static void DeInit ()
 De-initialises the vector Brush provider system.
static BOOL LoadDefaultBrushes ()
 Loads default brushes from a file.

Detailed Description

The class that gets a Brush doc component going on start up We need to register our class as a document component and this is where we do it all.

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

Definition at line 471 of file brshcomp.h.


Member Function Documentation

BOOL BrushComponentClass::AddComponent BaseDocument pDocument  )  [virtual]
 

Add a Brush component to the specified document.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/12/99
Parameters:
pDocument - the document to add the component to. [INPUTS]
Returns:
TRUE if the Brush component was added ok; FALSE if not.

Errors: Out of memory

See also:
PrintComponentClass

Implements DocComponentClass.

Definition at line 3690 of file brshcomp.cpp.

03691 {
03692     ERROR2IF(pDocument==NULL, FALSE, "NULL document passed to BrushCompClass:Add");
03693 
03694     // Check to see if this document already has a colour list; if so, leave it alone.
03695     if (pDocument->GetDocComponent(CC_RUNTIME_CLASS(BrushComponent)) != NULL)
03696         return(TRUE);
03697 
03698     // Ok - create the print mark component.
03699     BrushComponent *pComponent = new BrushComponent;
03700     if (pComponent == NULL)
03701         return(FALSE);
03702 
03703     // All ok - add the component to the document.
03704     pDocument->AddDocComponent(pComponent);
03705 
03706     return(TRUE);
03707 }

void BrushComponentClass::DeInit  )  [static]
 

De-initialises the vector Brush provider system.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/12/99
Returns:
TRUE if all went well; FALSE if not.

Definition at line 3668 of file brshcomp.cpp.

03669 {
03670     BrushComponent::DeleteList();
03671 }

BOOL BrushComponentClass::Init void   )  [static]
 

Register the Brush document component with the main application.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/12/99
Returns:
TRUE if all went well; FALSE if not.

Errors: Out of memory.

See also:
DocComponent

Reimplemented from SimpleCCObject.

Definition at line 3584 of file brshcomp.cpp.

03585 {
03586     // Instantiate a component class to register with the application.
03587     BrushComponentClass *pClass = new BrushComponentClass;
03588     if (pClass == NULL)
03589         return(FALSE);
03590 
03591     // Register it
03592     GetApplication()->RegisterDocComponent(pClass);
03593 
03594     return(TRUE);
03595 }

BOOL BrushComponentClass::LoadDefaultBrushes  )  [static]
 

Loads default brushes from a file.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/12/99
Returns:
TRUE if all went well; FALSE if not.

Errors: Fail to load file

Definition at line 3611 of file brshcomp.cpp.

03612 {
03613     PORTNOTETRACE("other","BrushComponentClass::LoadDefaultBrushes - do nothing");
03614 #ifndef EXCLUDE_FROM_XARALX
03615     // lets try loading the default brushes here
03616     LoadBrushDirect LoadBrush;
03617     
03618     // set up the search path, file util allows us just to pass the path/*.xar
03619     String_256 SearchPath;
03620     CResDll::GetExecutablePath((TCHAR*)SearchPath);
03621     String_256 Path = TEXT("\\Templates\\Brushes\\");
03622     SearchPath += Path;
03623     String_256 FileSpecifier = SearchPath;
03624     FileSpecifier += TEXT("*.xar");
03625 
03626     BOOL ok = FileUtil::StartFindingFiles(&FileSpecifier);
03627     BrushComponent::BeginLoadingDefaultFiles();
03628     String_256 Filename;
03629     FilePath oFilePath;
03630     String_16 Extension;
03631     while (ok)
03632     {
03633         // fileutil will give us the next filename
03634         ok = FileUtil::FindNextFile(&Filename);
03635         String_256 FullPath = SearchPath;
03636         FullPath += Filename;
03637         if (ok)
03638         {
03639             oFilePath.SetFilePath(FullPath);
03640             Extension = oFilePath.GetType();
03641             Extension.toLower();
03642             if (oFilePath.IsValid() && Extension==String_16("xar"))
03643             {
03644                 BrushComponent::LoadNextDefaultFile();
03645                 ok = LoadBrush.Execute((TCHAR*)FullPath);
03646             }
03647         }
03648     }
03649     BrushComponent::EndLoadingDefaults();
03650     FileUtil::StopFindingFiles();
03651 #endif
03652     return TRUE;
03653 }


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