#include <brshcomp.h>
Inheritance diagram for BrushComponentClass:
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. |
Definition at line 471 of file brshcomp.h.
|
Add a Brush component to the specified document.
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 }
|
|
De-initialises the vector Brush provider system.
Definition at line 3668 of file brshcomp.cpp. 03669 { 03670 BrushComponent::DeleteList(); 03671 }
|
|
Register the Brush document component with the main application.
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 }
|
|
Loads default brushes from a 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 }
|