PlugInManager Class Reference

Provide general handling facilities for plug-ins in Camelot. More...

#include <plugmngr.h>

Inheritance diagram for PlugInManager:

CCObject SimpleCCObject List of all members.

Public Member Functions

 PlugInManager ()
 Main constructor for the plug-in manager in Camelot.
 ~PlugInManager ()
 Main destructor for the plug-in manager in Camelot.
BOOL Init ()
 Main initialisation code for the plug-in manager in Camelot.
BOOL GetParseAtStartUp ()
void SetParseAtStartUp (BOOL NewState)
BOOL GetPlugInPath (PathName *NewSearchPath)
 Allows the requesting of a pathname to parse plug-ins for from the user. Its pops up a modified form of the stanadard file dialog box set up to browse explicitly for paths rather than files. Used by the plug-ins options tab.
BOOL AddPlugIn (PlugInItem *pPlugIn)
 Add a plug-in to the list in the plug-in manager and register the op desciptor to the system.
BOOL RemovePlugIn (PlugInItem *pPlugIn)
 Removes a plug-in from the list in the plug-in manager (if it's there).
PlugInItemGetFirstPlugIn ()
 Get the first plug-in item in the list stored in the plug-in manager.
PlugInItemGetNextPlugIn (PlugInItem *pPlugIn)
 Get the next plug-in item in the list stored in the plug-in manager.
BOOL AddPlugInPath (const PathName &NewSearchPath)
 Adds a new pathname to the list of pathnames stored in the plug-in manager.
BOOL DeletePlugInPath (const PathName &SearchPath)
 Deletes a pathname from the list of pathnames stored in the plug-in manager.
PlugInPathGetFirstPathName ()
 Get the first plug-in pathname in the list stored in the plug-in manager. This is just the list of user defined paths and does not include the hidden paths that are stored in the list as well.
PlugInPathGetNextPathName (PlugInPath *pPath)
 Get the next plug-in pathname in the list stored in the plug-in manager. This is just the list of user defined paths and does not include the hidden paths that are stored in the list as well.
PlugInItemGetPreviousPlugIn (PlugInItem *pPlugIn)
 Get the previous plug-in item in the list stored in the plug-in manager.
BOOL GetPlugInPathname (INT32 PathNameID, String_256 *pPathName)
 Converts a pathanme id which is stored with each plug-in into the real pathname that it corresponds to by searching the pathname list in the plug-in manager.
BOOL SearchForPlugIns ()
 Starts up the process of parsing all the paths specified to the plug-in manager for plug-ins and stroing information on them in a list. This is called during start up so needs to check the flag to see whether the user has requested this to be done at the start, before actually trying to parse.
BOOL CheckHaveDetailsOnPlugIns ()
 Checks to see if the pathnames have been searched for plug-ins. If not then do it now. This should be called by any UI code before they try and put up any UI of plug-ins, e.g. a menu of available plug-ins. If the user requested not to parse pathnames at start up then this is where it happens.
BOOL SearchedPathsYet ()
BOOL ReadPathNameList ()
 Reads the plug-in pathnames list in from the ini file. This has to be a new ini file as the main ini file code cannot cope with the concept of sections filled with an arbitrary number of items which need cleaning out when resaving to remove old items no longer required. The code is based on LibSettings::BuildList.
BOOL WritePathNameList ()
 Writes the list of plug-in pathnames to the ini file This has to be a new ini file as the main ini file code cannot cope with the concept of sections filled with an arbitrary number of items which need cleaning out when resaving to remove old items no longer required.
BOOL DestroyPlugInsList ()
 Destroy the list of plugs that the plug-in manager in Camelot currently has.
BOOL ParseAllPaths ()
 Starts up the process of parsing all the paths specified to the plug-in manager for plug-ins and storing information on them in a list. Assumes the list is either empty before we are called or the caller has cleared it using.
MenuItemFindPlugInMainMenuItem (MenuItem *pMainMenu=NULL)
 Finds the main plug-in menu item and returns a pointer to it.

Static Public Member Functions

static BOOL WipePlugInsSettings ()
 Wipes the plug-in pathnames list from the ini file or from the registry.

Protected Member Functions

BOOL ParsePathName (const PathName &SearchPath, const INT32 PathID, INT32 *FilesCount, const Progress &PathsProgress)
 Parse the given path for all files and pass the files of the registered types to the appropriate plug-in handler. The handler should then check to see whether it likes this type of file and if so then create a new plug-in record of the correct type and then place useful details into the record. Finally it should register the new plug-in record with the plug-in manager i.e. this class. The PathID should be stored in the plug-in record so that we do not have to store the full path with all plug-in records.
BOOL ParsePathNameForDirectories (const PathName &SearchPath, INT32 *FilesCount)
 Parse the given path for all directories. If found then add them as hidden items to our list of paths so that the user cannot see them. We do it this way so that we only ever store a PathID with a plug-in record rather than having to store the pathname or sub-directories to the pathname with the plug-in. Note: Must be re-entrant!

Private Member Functions

 CC_DECLARE_DYNAMIC (PlugInManager)
BOOL SortPlugInsAlphabetically ()
 Sorts the list of plugs-in alphabetically Borrowed code from SuperGallery::ApplySortNow as we need a much simpler version.
BOOL DeleteMainMenuItems ()
 Before the pathnames are parsed, we must clear out the main menu items of all the current plug-ins.
BOOL CreateMainMenuItems ()
 After the plug in list has been sorted alphabetically we must add each item in the list to the main plug-in menu.

Static Private Member Functions

static INT32 __cdecl SortComparator (const void *Item1, const void *Item2)
 'qsort' comparator function, used when quicksorting the loaded colour list

Private Attributes

PlugInPathList m_Paths
List m_HandlersList
List m_PlugInsList
BOOL m_Initialised
BOOL m_SearchedPaths

Static Private Attributes

static BOOL m_ParseAtStartUp = TRUE
 If TRUE, then the plug-in pathnames will be searched at start up for plug-ins. If FALSE, then the searching happens the first time any plug-in UI is invoked.

Detailed Description

Provide general handling facilities for plug-ins in Camelot.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/12/96

Definition at line 189 of file plugmngr.h.


Constructor & Destructor Documentation

PlugInManager::PlugInManager  ) 
 

Main constructor for the plug-in manager in Camelot.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/12/96

Definition at line 302 of file plugmngr.cpp.

00303 {
00304     // Flag that we have not been initialised yet
00305     m_Initialised = FALSE;
00306     // Default to parsing paths at start up
00307     m_ParseAtStartUp = TRUE;
00308     // Flag that we have not searched the plug-ins path yet
00309     m_SearchedPaths = FALSE;
00310 }

PlugInManager::~PlugInManager  ) 
 

Main destructor for the plug-in manager in Camelot.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/12/96

Definition at line 322 of file plugmngr.cpp.

00323 {
00324     // Clean out our list of pathnames
00325     /* PlugInPath* pPath = (PlugInPath *)Paths.GetHead();
00326     while (pPath != NULL)
00327     {
00328         delete pBitmap->pBmp;
00329 
00330         // Try the next pathname in the list
00331         pPath = (PlugInPath *)Paths.GetNext(pPath);
00332     } */
00333 
00334     //Paths.DeleteAll();
00335 
00336     // Clean out the list of plug-in handlers that Camelot understands.
00337     m_HandlersList.DeleteAll();
00338 
00339     // Clean out the list of plug-in items
00340     DestroyPlugInsList();
00341 }


Member Function Documentation

BOOL PlugInManager::AddPlugIn PlugInItem pPlugIn  ) 
 

Add a plug-in to the list in the plug-in manager and register the op desciptor to the system.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/12/96
Returns:
True if worked, False otherwise

Definition at line 1107 of file plugmngr.cpp.

01108 {
01109     m_PlugInsList.AddTail(pPlugIn);
01110 
01111     return TRUE;
01112 }

BOOL PlugInManager::AddPlugInPath const PathName NewSearchPath  ) 
 

Adds a new pathname to the list of pathnames stored in the plug-in manager.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/96
Parameters:
NewSearchPath the pathname to add to the list [INPUTS]
Returns:
True if added ok, False otherwise.

Definition at line 1027 of file plugmngr.cpp.

01028 {
01029     // First check to see if its blank or not. If so then ignore it
01030     String_256 SearchDir = NewSearchPath.GetPath();
01031     if (SearchDir.IsEmpty())
01032     {
01033         ERROR3("AddPlugInPath asked to add blank path!");
01034         return FALSE;
01035     }
01036 
01037     m_Paths.AddPathName(NewSearchPath);
01038     return TRUE;
01039 }

PlugInManager::CC_DECLARE_DYNAMIC PlugInManager   )  [private]
 

BOOL PlugInManager::CheckHaveDetailsOnPlugIns  ) 
 

Checks to see if the pathnames have been searched for plug-ins. If not then do it now. This should be called by any UI code before they try and put up any UI of plug-ins, e.g. a menu of available plug-ins. If the user requested not to parse pathnames at start up then this is where it happens.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/12/96
Returns:
True if parsed ok, False otherwise.

Definition at line 727 of file plugmngr.cpp.

00728 {
00729     // If we have not already parsed the paths then go and do it now as we need it.
00730     if (!m_SearchedPaths)
00731         return ParseAllPaths();
00732     
00733     // Otherwise we do the job later
00734     return TRUE;
00735 }

BOOL PlugInManager::CreateMainMenuItems  )  [private]
 

After the plug in list has been sorted alphabetically we must add each item in the list to the main plug-in menu.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/1/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
True if the operation completed successfully False if it failed in some way.

Definition at line 1474 of file plugmngr.cpp.

01475 {
01476 /*
01477 //#if NEW_NATIVE_FILTER
01478     // Search the main menu items until we find the plug-ins one
01479     MenuItem * pRootMenu = FindPlugInMainMenuItem();
01480     if (pRootMenu == NULL)
01481         return FALSE;
01482 
01483 //  // Create the plug-ins manager menu item...
01484 //  MenuItem * pPlugDlgMngr = CreateMenuItem(OPTOKEN_PLUGSDLG, pRootMenu->GetMenuId(), TRUE);
01485 //  // If created ok then add this to the main plug-in's menu
01486 //  if (pPlugDlgMngr)
01487 //      pRootMenu->AddMenuItem(pPlugDlgMngr);
01488 
01489 
01490 //  // Create a menu item for the apply last item
01491     MenuItem * pApplyLastItem = CreateMenuItem(OPTOKEN_PHOTOSHOP_APPLYLAST, pRootMenu->GetMenuId(), FALSE);
01492     // If created ok then add this to the main plug-in's menu
01493     if (pApplyLastItem)
01494         pRootMenu->AddMenuItem(pApplyLastItem);
01495 //
01496 
01497 
01498     // Go through all the handlers asking them to add in sections to the main menu
01499     PlugInHandler* pHandler = (PlugInHandler *)m_HandlersList.GetHead();
01500     PlugInHandler* pNextHandler = NULL;
01501     BOOL AddedOk = TRUE;
01502     BOOL AddSeparator = TRUE;
01503     while (pHandler != NULL)
01504     {
01505         // Try the next handler in the list
01506         pNextHandler = (PlugInHandler *)m_HandlersList.GetNext(pHandler);
01507 
01508         // If there is a next handler then we must add a separator to the
01509         // end of the list.
01510         // This does assume that only one handler will not want to add items to the end.
01511         // but this is good enough for now
01512         if (pNextHandler && pNextHandler->GoingToAddMainMenuItems())
01513             AddSeparator = TRUE;
01514         else
01515             AddSeparator = FALSE;
01516 
01517         // Ask the handler to add its required section of the menu to the list
01518         AddedOk = pHandler->CreateMainMenuItems(this, pRootMenu, AddSeparator);
01519     
01520         // Try the next handler in the list
01521         pHandler = pNextHandler;
01522     }
01523     
01524 
01525     // Make sure that the plug-ins win menu is updated to mirror the kernel
01526     // menu structure that we have just created
01527     BOOL update = UpdatePlugInsWinMenu(pRootMenu);
01528 */
01529 
01530 //#endif
01531     return TRUE;
01532 }

BOOL PlugInManager::DeleteMainMenuItems  )  [private]
 

Before the pathnames are parsed, we must clear out the main menu items of all the current plug-ins.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/1/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
True if the operation completed successfully False if it failed in some way.

Definition at line 1431 of file plugmngr.cpp.

01432 {
01433 //#if NEW_NATIVE_FILTER
01434     // Search the main menu items until we find the plug-ins one
01435     MenuItem * pRootMenu = FindPlugInMainMenuItem();
01436     if (pRootMenu == NULL)
01437         return FALSE;
01438 
01439     // Completely destroy this menu
01440     BOOL ok = DestroyCamMenu(pRootMenu);
01441     
01442     // We must add back an item so that the menu is not empty otherwise
01443     // all hell will break loose if its left in this state!!!!
01444     // Create a menu item for the apply last item
01445 //  MenuItem * pApplyLastItem = CreateMenuItem(OPTOKEN_PLUGINS_PARSING, pRootMenu->GetMenuId(), FALSE);
01446     // If created ok then add this to the main plug-in's menu
01447 //  if (pApplyLastItem)
01448 //      pRootMenu->AddMenuItem(pApplyLastItem);
01449 
01450     // Just in case anything goes wrong between here and adding the new plug-ins back in
01451     // we must make sure that the plug-ins win menu is updated to mirror the kernel
01452     // menu structure that we have just blatted
01453     BOOL update = UpdatePlugInsWinMenu(pRootMenu);
01454 
01455 //#endif
01456     return TRUE;
01457 }

BOOL PlugInManager::DeletePlugInPath const PathName SearchPath  ) 
 

Deletes a pathname from the list of pathnames stored in the plug-in manager.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/96
Parameters:
SearchPath the pathname to delete from the list [INPUTS]
Returns:
True if added ok, False otherwise.

Definition at line 1053 of file plugmngr.cpp.

01054 {
01055     return m_Paths.DeletePathName(SearchPath);
01056 }

BOOL PlugInManager::DestroyPlugInsList  ) 
 

Destroy the list of plugs that the plug-in manager in Camelot currently has.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/96
Returns:
True if worked ok, False otherwise.

Definition at line 355 of file plugmngr.cpp.

00356 {
00357     // We need to write the code to destruct an OpDescriptor and delink it from the
00358     // list before we can do this.
00359 
00360     // We must go through the list of plug-ins and deregister things like the
00361     // allocated op-descriptors that we allocated when the plug-in was created.
00362     PlugInItem* pPlugIn = (PlugInItem *)m_PlugInsList.GetHead();
00363     String_32 OpToken;
00364     String_32 FamilyOpToken;
00365     String_32 LastFamilyOpToken;
00366     while (pPlugIn != NULL)
00367     {
00368         OpToken = pPlugIn->GetUniqueID();
00369         FamilyOpToken = OpToken;
00370         OpToken += pPlugIn->GetPlugInName();
00371         FamilyOpToken += pPlugIn->GetFamilyName();
00372         // Search for the OpDescriptor
00373         OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OpToken);
00374         if (pOpDesc != NULL)
00375         {
00376             OpDescriptor::DelinkDescriptor(pOpDesc);
00377             delete pOpDesc;
00378         }
00379         // If the family optoken changes then this is the time to delete it
00380         if (FamilyOpToken != LastFamilyOpToken)
00381         {
00382             // Search for the OpDescriptor
00383             pOpDesc = OpDescriptor::FindOpDescriptor(FamilyOpToken);
00384             if (pOpDesc != NULL)
00385             {
00386                 OpDescriptor::DelinkDescriptor(pOpDesc);
00387                 delete pOpDesc;
00388             }
00389         }
00390         
00391         LastFamilyOpToken = FamilyOpToken;
00392 
00393         // Try the next plug-in in the list
00394         pPlugIn = (PlugInItem *)m_PlugInsList.GetNext(pPlugIn);
00395     }
00396 
00397     // Clean out the list of plug-in items
00398     m_PlugInsList.DeleteAll();
00399 
00400     // Lastly, flag that we have now not parsed all the paths
00401     m_SearchedPaths = FALSE;
00402 
00403     return TRUE;
00404 }

MenuItem * PlugInManager::FindPlugInMainMenuItem MenuItem pMainMenu = NULL  ) 
 

Finds the main plug-in menu item and returns a pointer to it.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> & Re-writen by sjk 2/8/00 so it doesn't have to be a top level menu!
Date:
20/1/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Pointer to the plug-in main menu item if the operation completed successfully NULL if it failed in some way.

Definition at line 1379 of file plugmngr.cpp.

01380 {
01381     if (pMainMenu == NULL)
01382         pMainMenu = GetMainMDIMenu();
01383 
01384     MenuItem * pMenu = pMainMenu->GetFirstMenuItem();
01385 
01386     String_256 PlugInMenu(OPTOKEN_PLUGINS_UNDO_MENU);
01387     String_32 Desc;
01388     while (pMenu)
01389     {
01390         MenuItem * pSub = pMenu->GetFirstMenuItem();
01391 
01392         if (pSub)
01393         {
01394             // check sub menu
01395             pSub = FindPlugInMainMenuItem(pMenu);
01396         }
01397 
01398         // Get the OpToken for the current menu item or returned menu item
01399         String_32 * pDesc = pSub ? pSub->GetOpToken() : pMenu->GetOpToken();
01400         if (pDesc)
01401             Desc = *pDesc;
01402         else
01403             Desc.Empty();
01404 
01405         // If the OpTokens match then it is the one that we desire
01406         if (Desc == PlugInMenu)
01407             return pSub ? pSub : pMenu;
01408 
01409         // Go to the next main menu item in the list
01410         pMenu = pMainMenu->GetNextMenuItem(pMenu);
01411     }
01412 
01413     return NULL;
01414 }

PlugInPath * PlugInManager::GetFirstPathName  ) 
 

Get the first plug-in pathname in the list stored in the plug-in manager. This is just the list of user defined paths and does not include the hidden paths that are stored in the list as well.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/96
Returns:
Pointer to a plug-in pathname in the list.

Definition at line 1071 of file plugmngr.cpp.

01072 {
01073     return (PlugInPath *)m_Paths.GetFirstPath();
01074 }

PlugInItem * PlugInManager::GetFirstPlugIn  ) 
 

Get the first plug-in item in the list stored in the plug-in manager.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/12/96
Returns:
Pointer to a plug-in item in the list.

Definition at line 1147 of file plugmngr.cpp.

01148 {
01149     return (PlugInItem *)m_PlugInsList.GetHead();
01150 }

PlugInPath * PlugInManager::GetNextPathName PlugInPath pPath  ) 
 

Get the next plug-in pathname in the list stored in the plug-in manager. This is just the list of user defined paths and does not include the hidden paths that are stored in the list as well.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/96
Parameters:
pPlugIn pointer to the current plug-in in the list [INPUTS]
Returns:
Pointer to a plug-in pathname in the list.

Definition at line 1090 of file plugmngr.cpp.

01091 {
01092     return (PlugInPath *)m_Paths.GetNextPath(pPath);
01093 }

PlugInItem * PlugInManager::GetNextPlugIn PlugInItem pPlugIn  ) 
 

Get the next plug-in item in the list stored in the plug-in manager.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/12/96
Parameters:
pPlugIn pointer to the current plug-in in the list [INPUTS]
Returns:
Pointer to a plug-in item in the list.

Definition at line 1164 of file plugmngr.cpp.

01165 {
01166     return (PlugInItem *)m_PlugInsList.GetNext(pPlugIn);
01167 }

BOOL PlugInManager::GetParseAtStartUp  )  [inline]
 

Definition at line 201 of file plugmngr.h.

00201 { return m_ParseAtStartUp; }

BOOL PlugInManager::GetPlugInPath PathName NewSearchPath  ) 
 

Allows the requesting of a pathname to parse plug-ins for from the user. Its pops up a modified form of the stanadard file dialog box set up to browse explicitly for paths rather than files. Used by the plug-ins options tab.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/12/96
Parameters:
- [INPUTS]
NewSearchPath the pathname to parse for new plug-ins [OUTPUTS]
Returns:
True if parsed ok, False otherwise.

Definition at line 1007 of file plugmngr.cpp.

01008 {
01009     // Ask out special class to pop up a common file dialog box to the user and then
01010     // to return the path that the user has requested back to us.
01011     BOOL ok = PlugInsBrowser::GetLibPath(NewSearchPath);                            
01012     return ok;
01013 }

BOOL PlugInManager::GetPlugInPathname INT32  PathNameID,
String_256 pPathName
 

Converts a pathanme id which is stored with each plug-in into the real pathname that it corresponds to by searching the pathname list in the plug-in manager.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/12/96
Parameters:
PathNameID id of the pathname to search for [INPUTS] pPathName pointer to a string to fill in with the pathname pPlugIn pointer to the current plug-in in the list
Returns:
True if worked ok, False otherwise.

Definition at line 1202 of file plugmngr.cpp.

01203 {
01204     ERROR2IF(pPathName == NULL,FALSE,"PlugInManager::GetPlugInPathname null pPath");
01205 
01206     // Make the string empty
01207     pPathName->Empty();
01208 
01209     // Go through all our stored paths and check them for plug-ins stored in them.
01210     PlugInPath* pPath = (PlugInPath *)m_Paths.GetHead();
01211     while (pPath != NULL)
01212     {
01213         if (pPath->GetPathNameID() == PathNameID)
01214         {
01215             *pPathName = pPath->GetPathNameAsString();
01216             return TRUE;
01217         }
01218 
01219         // Try the next pathname in the list
01220         pPath = (PlugInPath *)m_Paths.GetNext(pPath);
01221     }
01222 
01223     // Nothing found so  return this to the user
01224     return FALSE;
01225 }

PlugInItem * PlugInManager::GetPreviousPlugIn PlugInItem pPlugIn  ) 
 

Get the previous plug-in item in the list stored in the plug-in manager.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/12/96
Parameters:
pPlugIn pointer to the current plug-in in the list [INPUTS]
Returns:
Pointer to a previous plug-in item in the list.

Definition at line 1181 of file plugmngr.cpp.

01182 {
01183     return (PlugInItem *)m_PlugInsList.GetPrev(pPlugIn);
01184 }

BOOL PlugInManager::Init void   ) 
 

Main initialisation code for the plug-in manager in Camelot.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/12/96
Returns:
True if initialised ok, False otherwise.

Reimplemented from SimpleCCObject.

Definition at line 437 of file plugmngr.cpp.

00438 {
00439 #ifndef WEBSTER
00440 #ifndef EXCLUDE_BFX
00441 //#ifdef NEW_NATIVE_FILTER
00442     ADD_HANDLER(BfxHandler);
00443 //#endif
00444 #endif
00445 #endif
00446     // Only include the freehand plug-ins if required
00447 #ifdef PHOTOSHOPPLUGINS 
00448     ADD_HANDLER(PhotoShopHandler);
00449 #endif
00450     // Only include the freehand plug-ins if required
00451 #ifdef FREEHANDPLUGINS
00452     ADD_HANDLER(XtraHandler);
00453 #endif
00454 
00455     if (!PlugInOp::Init())
00456         return FALSE;
00457 
00458     // Declare any preferences that we require.
00459     if ( Camelot.DeclareSection(TEXT("Plug-ins"), 3) )
00460     {
00461         // section declared ok so now define the preference option  
00462         Camelot.DeclarePref(TEXT("Plug-ins"), TEXT("ParseAtStartUp"), &m_ParseAtStartUp, 0, 1);
00463     }
00464 
00465     // load stored items from preference system
00466     BOOL ok = ReadPathNameList();
00467 
00468     ok = ok && PlugInOp::RegisterOpToken(OPTOKEN_PLUGINS_MENU, _R(IDS_PLUGINS));
00469     ok = ok && PlugInOp::RegisterOpToken(OPTOKEN_PLUGINS_MANAGER, _R(IDS_PLUGINS));
00470     ok = ok && PlugInOp::RegisterOpToken(OPTOKEN_PLUGINS_PARSING, _R(IDS_PLUGSIN_PARSING));
00471     ok = ok && PlugInOp::RegisterOpToken(OPTOKEN_PLUGINS_PLUGINSMNGR, _R(IDS_PLUGINS_PLUGINSMNGR));
00472 
00473     ok = ok && PlugInUndoOp::RegisterOpToken(OPTOKEN_PLUGINS_UNDO_MENU, _R(IDS_PLUGINS));
00474 
00475     // Lastly, note that initialised has been called
00476     m_Initialised = TRUE;
00477 
00478     return TRUE;
00479 }

BOOL PlugInManager::ParseAllPaths  ) 
 

Starts up the process of parsing all the paths specified to the plug-in manager for plug-ins and storing information on them in a list. Assumes the list is either empty before we are called or the caller has cleared it using.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/12/96
Returns:
True if parsed ok, False otherwise.

Definition at line 751 of file plugmngr.cpp.

00752 {
00753     // First, flag that we have parsed all the paths
00754     m_SearchedPaths = TRUE;
00755 
00756     BOOL ParsedOk = TRUE;
00757 
00758 //#if NEW_NATIVE_FILTER
00759     // Now, go and make sure that we have no plug-ins main menu items
00760     DeleteMainMenuItems();
00761 //#endif
00762 
00763     // Start adding the plug-ins into the list
00764     // First any ones which are fixed or built in and not file related
00765     // Go through each of the handlers asking them to add fixed plug-ins.
00766     PlugInHandler* pHandler = (PlugInHandler *)m_HandlersList.GetHead();
00767     while (pHandler != NULL)
00768     {
00769         pHandler->AddFixedPlugIns();
00770 
00771         // Try the next handler in the list
00772         pHandler = (PlugInHandler *)m_HandlersList.GetNext(pHandler);
00773     }
00774 
00775     // Now look through all the directories that the user has specified
00776     
00777     // First remove all hidden items from the list
00778     // Put up an hourglass to show we are doing something
00779     Progress InitialPathsProgress(_R(IDS_PLUGSIN_PARSING));
00780     m_Paths.RemoveHiddenItems();
00781 
00782     // Now go through all the pathnames looking for sub-directories recursively
00783     // and add these to the list of items
00784     // The items we use MUST only ever see non-hidden paths, as otherwise
00785     // we will get very recursive!!!!!
00786     PlugInPath* pPath = (PlugInPath *)m_Paths.GetFirstPath();
00787     INT32 FilesCount = 0;
00788     while (pPath != NULL)
00789     {
00790         ParsedOk = ParsedOk && ParsePathNameForDirectories(pPath->GetPathName(), &FilesCount);
00791         pPath = (PlugInPath *)m_Paths.GetNextPath(pPath);
00792     }
00793 
00794     // Put up a progress bar to show we are doing something
00795     Progress PathsProgress(_R(IDS_PLUGSIN_PARSING), FilesCount);
00796 
00797     // Go through all our stored paths and check them for plug-ins stored in them.
00798     pPath = (PlugInPath *)m_Paths.GetHead();
00799     INT32 Count = 0;
00800     PathsProgress.Update(Count);
00801 
00802     while (pPath != NULL)
00803     {
00804         ParsedOk = ParsedOk && ParsePathName(pPath->GetPathName(), pPath->GetPathNameID(), &Count, PathsProgress);
00805 
00806         // Try the next pathname in the list
00807         pPath = (PlugInPath *)m_Paths.GetNext(pPath);
00808         PathsProgress.Update(Count);
00809     }
00810 
00811     // Sort those plug-ins that we have loaded
00812     SortPlugInsAlphabetically();
00813 
00814 //#if NEW_NATIVE_FILTER
00815     // Now, go and create the plug-ins main menu items required
00816     CreateMainMenuItems();
00817 //#endif
00818 
00819     return ParsedOk;
00820 }

BOOL PlugInManager::ParsePathName const PathName SearchPath,
const INT32  PathID,
INT32 *  pFilesCount,
const Progress PathsProgress
[protected]
 

Parse the given path for all files and pass the files of the registered types to the appropriate plug-in handler. The handler should then check to see whether it likes this type of file and if so then create a new plug-in record of the correct type and then place useful details into the record. Finally it should register the new plug-in record with the plug-in manager i.e. this class. The PathID should be stored in the plug-in record so that we do not have to store the full path with all plug-in records.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/12/96
Parameters:
ParsePath the pathname to parse for new plug-ins [INPUTS] pathID the ID assigned to this path PathsProgress the progress object to call for progress update
pFilesCount an updated count of the files discovered [OUTPUTS]
Returns:
True if parsed ok, False otherwise.

Definition at line 916 of file plugmngr.cpp.

00918 {
00919     PathName File = SearchPath;
00920     String_256 SearchDir = SearchPath.GetPath();
00921     // If the path is blank then ignore it otherwise we will search the entire hard drive
00922     // or currently selected directory!
00923     if (SearchDir.IsEmpty())
00924         return TRUE;
00925 
00926     // We must set up the operating system current directory so that extra DLLs beside the
00927     // plug-ins can be picked up.
00928     BOOL ok = FileUtil::SetCurrentDirectory( SearchPath );
00929 
00930     SearchDir += "*.*";
00931     TRACEUSER( "Neville", _T("ParsePathName Search path is %s, found:-\n"), (TCHAR *)SearchDir);
00932     FindFiles Finder;
00933     BOOL IsDirectory = FALSE;
00934     if (Finder.StartFindingFiles(&SearchDir))
00935     {
00936         String_256 LeafName;
00937         while (TRUE)
00938         {
00939             if (!Finder.FindNextFile(&LeafName, &IsDirectory))
00940                 break;
00941 
00942             if (pFilesCount)
00943                 (*pFilesCount)++;
00944 
00945             // Do something with file "LeafName"
00946             TRACEUSER( "Neville", _T("ParsePathName parse plug-in file %s\n"), (TCHAR *)LeafName);
00947 
00948             // We have found a file or a directory.
00949             // In this case we only want to look for files
00950             if (!IsDirectory)
00951             {
00952                 File.SetFileNameAndType(LeafName);
00953                 String_32 FileType = File.GetType();
00954                 FileType.toLower();
00955                 PlugInHandler* pHandler = (PlugInHandler *)m_HandlersList.GetHead();
00956                 BOOL Found = FALSE;
00957                 while (pHandler != NULL && !Found)
00958                 {
00959                     String_32 HandlerFileType = pHandler->GetFileTypes();
00960                     // If the handler returns a filetype which is null then ignore it
00961                     // as this generally indicates that it will do its own thing.
00962                     // Handlers can specify a list of file types by splitting them with commas
00963                     if (!HandlerFileType.IsEmpty() && (HandlerFileType.Sub(FileType) != -1)) //FileType == HandlerFileType)
00964                         Found = TRUE;
00965                     else
00966                     {
00967                         // Try the next handler in the list
00968                         pHandler = (PlugInHandler *)m_HandlersList.GetNext(pHandler);
00969                     }
00970                 }
00971                 // If we have found this filetype in our list of handlers then
00972                 // ask that handler to parse the file.
00973                 if (Found && pHandler)
00974                 {
00975                     pHandler->ParsePlugIn(File, PathID);
00976                 }
00977 
00978                 // Update our progress bar for the file just parsed
00979                 if (pFilesCount)
00980                     PathsProgress.Update(*pFilesCount);
00981             }
00982         }
00983 
00984         // Stop the process
00985         Finder.StopFindingFiles();
00986     }
00987 
00988     return TRUE;
00989 }

BOOL PlugInManager::ParsePathNameForDirectories const PathName SearchPath,
INT32 *  pFilesCount
[protected]
 

Parse the given path for all directories. If found then add them as hidden items to our list of paths so that the user cannot see them. We do it this way so that we only ever store a PathID with a plug-in record rather than having to store the pathname or sub-directories to the pathname with the plug-in. Note: Must be re-entrant!

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/12/96
Parameters:
ParsePath the pathname to parse for new plug-ins [INPUTS]
pFilesCount an updated count of the files discovered [OUTPUTS]
Returns:
True if parsed ok, False otherwise.

Definition at line 840 of file plugmngr.cpp.

00841 {
00842     PathName File = SearchPath;
00843     String_256 SearchDir = SearchPath.GetPath();
00844     // If the path is blank then ignore it otherwise we will search the entire hard drive
00845     // or currently selected directory!
00846     if (SearchDir.IsEmpty())
00847         return TRUE;
00848 
00849     SearchDir += "*.*";
00850     TRACEUSER( "Neville", _T("ParsePathNameForDirectories Search path is %s\n"), (TCHAR *)SearchDir);
00851     FindFiles Finder;
00852     BOOL IsDirectory = FALSE;
00853     if (Finder.StartFindingFiles(&SearchDir))
00854     {
00855         String_256 LeafName;
00856         while (TRUE)
00857         {
00858             if (!Finder.FindNextFile(&LeafName, &IsDirectory))
00859                 break;
00860 
00861             if (pFilesCount)
00862                 (*pFilesCount)++;
00863 
00864             // We have found a file or a directory.
00865             // In this case we only want to look for directories
00866             if (IsDirectory)
00867             {
00868                 // Do something with the directory "LeafName"
00869                 TRACEUSER( "Neville", _T("ParsePathNameForDirectories add directory %s\n"), (TCHAR *)LeafName);
00870                 String_256 NewSearchDir = SearchPath.GetPath();
00871                 NewSearchDir += LeafName;
00872                 // Add a trailing slash if it hasn't got one, which it shouldn't have
00873                 SGLibOil::AppendSlashIfNotPresent(&NewSearchDir);
00874                 PathName NewSearchPath(NewSearchDir);
00875                 // Add the new pathname to the list, but as a hidden one so that
00876                 // people not in the know do not see them.
00877                 PlugInPath * pPath = m_Paths.AddPathName(NewSearchPath, TRUE);
00878                 if (pPath)
00879                 {
00880                     // recover the id associated with the path
00881                     ParsePathNameForDirectories(NewSearchPath, pFilesCount);
00882                 }
00883             }
00884         }
00885 
00886         // Stop the process
00887         Finder.StopFindingFiles();
00888     }
00889 
00890     return TRUE;
00891 }

BOOL PlugInManager::ReadPathNameList  ) 
 

Reads the plug-in pathnames list in from the ini file. This has to be a new ini file as the main ini file code cannot cope with the concept of sections filled with an arbitrary number of items which need cleaning out when resaving to remove old items no longer required. The code is based on LibSettings::BuildList.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/12/96
See also:
CFileList::ReadList(); LibSettings::BuildList;

Definition at line 531 of file plugmngr.cpp.

00532 {
00533 #ifdef SAVE_PREFS_TO_REGISTRY
00534     // Check if the registry entry is present or not. Look for the our special plugin related
00535     // items which should be stored in a 'PlugIns\\Plug-in Pathname List' key.
00536     // This is the section and sub-section name that we are going to use
00537     String_256 KeySectionName(PRODUCT_REGISTRYKEY_PLUGINS TEXT("\\Plug-in Pathname List"));
00538     BOOL EntryPresent = CheckForRegistryEntry(KeySectionName);
00539 
00540     if (EntryPresent)
00541     {
00542         LoadRegistryEntries Loader;
00543         Loader.StartLoading(&KeySectionName);
00544 
00545         BOOL AddedItems = FALSE;
00546         String_256 FileName;
00547         while (Loader.LoadNextEntry(&FileName))
00548         {
00549             // only interested in items which contain some data!
00550             // If blank then we may parse the entire disc or currently selected directory!
00551             if (!FileName.IsEmpty())
00552             {
00553                 // Add a trailing slash if it hasn't got one
00554                 SGLibOil::AppendSlashIfNotPresent(&FileName);
00555                 PathName Path(FileName);
00556                 m_Paths.AddPathName(Path);
00557                 // Flag that we have added something
00558                 AddedItems = TRUE;
00559             }
00560         }
00561         Loader.StopLoading();
00562     }
00563     else
00564 #endif
00565     {
00566         // Read in the data from the older ini file that may be kicking around
00567         // This is the section name that we are going to use
00568         String_256 SectionName(TEXT("Plug-in Pathname List"));
00569         // This is the ini file that we are going to be using
00570         String_256 PlugInsIni(PRODUCT_PLUGINS_INIFILE);
00571 
00572         BOOL AddedItems = FALSE;
00573         String_256 FileName;
00574         CCDiskFile GetEntryFile(1024, FALSE, TRUE);
00575 
00576         if (LibSettings::GetEntryStart(&GetEntryFile, &PlugInsIni))
00577         {
00578             if (LibSettings::SeekToSection(&GetEntryFile, &SectionName))
00579             {
00580                 while (LibSettings::GetNextLine(&GetEntryFile, &FileName))
00581                 {
00582                     // Add a trailing slash if it hasn't got one
00583                     SGLibOil::AppendSlashIfNotPresent(&FileName);
00584                     PathName Path(FileName);
00585                     m_Paths.AddPathName(Path);
00586                     // Flag that we have added something
00587                     AddedItems = TRUE;
00588                 }
00589             }
00590 
00591             LibSettings::GetEntryFinish(&GetEntryFile);
00592         }
00593     }
00594 
00595     // Everything is ok
00596     return TRUE;
00597 }

BOOL PlugInManager::RemovePlugIn PlugInItem pPlugIn  ) 
 

Removes a plug-in from the list in the plug-in manager (if it's there).

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/1/97
Parameters:
pPlugIn - Pointer to plugin item [INPUTS]
Returns:
True if worked, False otherwise

Definition at line 1126 of file plugmngr.cpp.

01127 {
01128     if(m_PlugInsList.RemoveItem(pPlugIn) == NULL)
01129         return FALSE;
01130 
01131     return TRUE;
01132 }

BOOL PlugInManager::SearchedPathsYet  )  [inline]
 

Definition at line 235 of file plugmngr.h.

00235 { return m_SearchedPaths; }

BOOL PlugInManager::SearchForPlugIns  ) 
 

Starts up the process of parsing all the paths specified to the plug-in manager for plug-ins and stroing information on them in a list. This is called during start up so needs to check the flag to see whether the user has requested this to be done at the start, before actually trying to parse.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/12/96
Returns:
True if parsed ok, False otherwise.

Definition at line 701 of file plugmngr.cpp.

00702 {
00703     // If the user has requested plug-in parsing at start up then now is the time to do it
00704     // Otherwise, delay until the first call
00705     if (m_ParseAtStartUp)
00706         return ParseAllPaths();
00707 
00708     // Otherwise we do the job later
00709     return TRUE;
00710 }

void PlugInManager::SetParseAtStartUp BOOL  NewState  )  [inline]
 

Definition at line 202 of file plugmngr.h.

00202 { m_ParseAtStartUp = NewState; }

INT32 __cdecl PlugInManager::SortComparator const void *  Item1,
const void *  Item2
[static, private]
 

'qsort' comparator function, used when quicksorting the loaded colour list

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/5/96
Parameters:
Item1,Item2 - the items to be compared [INPUTS]
Returns:
negative (I am lesser), 0 (we are equal), or positive (I am greater) result of comparing the items with the EntryNumber stored in each item in the loaded colour list.
See also:
PlugInManager::SortPlugInsAlphabetically(); ImportedColours::SortColoursByEntryNumber(); SuperGallery::SortComparator; SuperGallery::ApplySortNow;

Definition at line 1332 of file plugmngr.cpp.

01333 {
01334 //  if (Item1 == NULL || Item2 == NULL)
01335 //      return 0;
01336 
01337     PlugInItem *pItem1 = *((PlugInItem **)Item1);
01338     PlugInItem *pItem2 = *((PlugInItem **)Item2);
01339 
01340     if (pItem1 == NULL || pItem2 == NULL)
01341     {
01342         ERROR3("PlugIn::SortComparator bad pointers!"); 
01343         return 0;
01344     }
01345 
01346     INT32 Result = 0;
01347 
01348     // Sort on family name as the highest priority
01349     if (pItem1->GetFamilyName() < pItem2->GetFamilyName())
01350         return(-1);
01351 
01352     if ((pItem1->GetFamilyName() == pItem2->GetFamilyName()) &&
01353         (pItem1->GetPlugInName() < pItem2->GetPlugInName())
01354         )
01355         return(-1);
01356 
01357     if ((pItem1->GetFamilyName() == pItem2->GetFamilyName()) &&
01358         (pItem1->GetPlugInName() == pItem2->GetPlugInName())
01359         )
01360         return 0;
01361     
01362     // Must be greater than
01363     return 1;
01364 }

BOOL PlugInManager::SortPlugInsAlphabetically  )  [private]
 

Sorts the list of plugs-in alphabetically Borrowed code from SuperGallery::ApplySortNow as we need a much simpler version.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/12/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
True if the operation completed successfully False if it failed in some way.

Errors: -

See also:
ImportedColours::SortColoursByEntryNumber(); SuperGallery::ApplySortNow

Definition at line 1244 of file plugmngr.cpp.

01245 {
01246     INT32 NumItems = 0;
01247 
01248     // Count the number of items we have to sort
01249     PlugInItem * pPlugIn = GetFirstPlugIn();
01250     while (pPlugIn != NULL)
01251     {
01252         NumItems ++;
01253         pPlugIn = GetNextPlugIn(pPlugIn);
01254     }
01255 
01256     // Start progress indicators, with a percentage based upon the number of items.
01257     // We will update twice for each group (after qsort and shuffle-items stages)
01258     Progress SortProgress(_R(IDS_PLUGSIN_SORTING), NumItems * 2, FALSE);
01259     INT32 NumItemsToSort = 0;
01260 
01261     if (NumItems > 1)
01262     {
01263         // Get memory for an array of pointers to these items
01264         PlugInItem **SortArray = (PlugInItem **)CCMalloc(NumItems * sizeof(PlugInItem *));
01265         if (SortArray == NULL)
01266             return FALSE;
01267 
01268         // Fill in the array with pointers to display items to sort
01269         INT32 i = 0;
01270         PlugInItem * pPlugIn = GetFirstPlugIn();
01271         while (pPlugIn != NULL)
01272         {
01273             SortArray[i++] = pPlugIn;
01274             pPlugIn = GetNextPlugIn(pPlugIn);
01275         }
01276 
01277         // Sort the array of pointers
01278         qsort(SortArray, NumItems, sizeof(PlugInItem *), PlugInManager::SortComparator);
01279 
01280         NumItemsToSort += NumItems;
01281         // Update percentage complete for the number of items processed
01282         SortProgress.Update(NumItemsToSort);
01283 
01284         // Now, take the sorted array, and rearrange the items to be in that order      
01285         // Special case the first item
01286         PlugInItem *pPrevPlugIn = GetPreviousPlugIn(SortArray[0]);
01287         if (pPrevPlugIn != NULL)
01288         {
01289             m_PlugInsList.RemoveItem(SortArray[0]);
01290             m_PlugInsList.InsertBefore(SortArray[1], SortArray[0]);
01291         }
01292 
01293         // Then whip through the rest of the items
01294         for (i = 1; i < NumItems; i++)
01295         {
01296             pPrevPlugIn = GetPreviousPlugIn(SortArray[i]);
01297             if (pPrevPlugIn != SortArray[i-1])
01298             {
01299                 m_PlugInsList.RemoveItem(SortArray[i]);
01300                 m_PlugInsList.InsertAfter(SortArray[i-1], SortArray[i]);
01301             }
01302         }
01303 
01304         // Free our temporary workspace
01305         CCFree(SortArray);
01306     }
01307     
01308     // End the progress bar that we started
01309     //EndSlowJob();
01310 
01311     // We seem to have sorted the items ok
01312     return TRUE;
01313 }

BOOL PlugInManager::WipePlugInsSettings  )  [static]
 

Wipes the plug-in pathnames list from the ini file or from the registry.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/2/97
See also:
LibSettings::NukeSettings;

Definition at line 494 of file plugmngr.cpp.

00495 {
00496 #ifdef SAVE_PREFS_TO_REGISTRY
00497     // Check if the registry entry is present or not. Look for the our special plugin related
00498     // items which should be stored in a 'PlugIns\\Plug-in Pathname List' key.
00499     // This is the section and sub-section name that we are going to use
00500     String_256 KeySectionName(PRODUCT_REGISTRYKEY_PLUGINS TEXT("\\Plug-in Pathname List"));
00501     DeleteRegKey(hAppStateRegKey, KeySectionName);
00502 
00503     // We must wipe the ini file as well as otherwise when the code checks to 
00504     // see if the registry settings and then falls back on the ini file if they
00505     // are not there, then we wont be using the default settings.
00506 #endif
00507 
00508     // Vape the plug-ins ini file
00509     String_256 PlugInsIni(PRODUCT_PLUGINS_INIFILE);
00510     LibSettings::NukeSettings(&PlugInsIni);
00511 
00512     return TRUE;
00513 }

BOOL PlugInManager::WritePathNameList  ) 
 

Writes the list of plug-in pathnames to the ini file This has to be a new ini file as the main ini file code cannot cope with the concept of sections filled with an arbitrary number of items which need cleaning out when resaving to remove old items no longer required.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/12/96
See also:
CFileList::WriteList()

Definition at line 613 of file plugmngr.cpp.

00614 {
00615 #ifdef SAVE_PREFS_TO_REGISTRY
00616     BOOL ok = TRUE;
00617 
00618     // This is the section and sub-section name that we are going to use
00619     String_256 SectionName(PRODUCT_REGISTRYKEY_PLUGINS TEXT("\\Plug-in Pathname List"));
00620     SaveRegistryEntries Saver;
00621     ok = Saver.StartSaving(&SectionName);
00622     ERROR3IF(!ok,"PlugInManager::WritePathNameList() couldn't start saving the settings");
00623     // Go through all our stored paths writing them out in the preferences.
00624     // DO NOT USE GetHead/GetNext as we would see all the paths, which is more than we should
00625     // be seeing. Use the offical GetFirstPath/GetNextPath routines which give us what we 
00626     // should be seeing, i.e. the user entered paths.
00627     PlugInPath* pPath = (PlugInPath *)m_Paths.GetFirstPath();
00628     PathName FileName;
00629     String_256 Line;
00630 
00631     while (pPath != NULL && ok)
00632     {
00633         // Get the pathname for this entry
00634         FileName = pPath->GetPathName();
00635         // Get the string that represents this
00636         Line = FileName.GetPath();
00637         // only write out the line if non-blank
00638         // If blank then we may parse the entire disc or currently selected directory!
00639         if (!Line.IsEmpty())
00640             ok = ok && Saver.SaveNextEntry(&Line);
00641         // if !ok then possibly write access denied on in file... or disk full...
00642         // So flag that we should stop outputting any more data
00643 
00644         // Try the next pathname in the list
00645         pPath = (PlugInPath *)m_Paths.GetNextPath(pPath);
00646     }
00647 
00648     Saver.StopSaving();
00649 #else
00650     // This is the section name that we are going to use
00651     String_256 SectionName(TEXT("Plug-in Pathname List"));
00652     // This is the ini file that we are going to be using
00653     String_256 PlugInsIni(PRODUCT_PLUGINS_INIFILE);
00654     
00655     LibSettings::StartOutput(&SectionName, &PlugInsIni);
00656     LibSettings::AddSection(&SectionName, &PlugInsIni);
00657 
00658     // Go through all our stored paths writing them out in the preferences.
00659     // DO NOT USE GetHead/GetNext as we would see all the paths, which is more than we should
00660     // be seeing. Use the offical GetFirstPath/GetNextPath routines which give us what we 
00661     // should be seeing, i.e. the user entered paths.
00662     PlugInPath* pPath = (PlugInPath *)m_Paths.GetFirstPath();
00663     PathName FileName;
00664     String_256 Line;
00665 
00666     BOOL ok = TRUE;
00667     while (pPath != NULL && ok)
00668     {
00669         // Get the pathname for this entry
00670         FileName = pPath->GetPathName();
00671         // Get the string that represents this
00672         Line = FileName.GetPath();
00673         if (!LibSettings::AddLine(&Line, &PlugInsIni))
00674         {
00675             // Possibly write access denied on in file... or disk full...
00676             // So flag that we should stop outputting any more data
00677             ok = FALSE;
00678         }
00679         // Try the next pathname in the list
00680         pPath = (PlugInPath *)m_Paths.GetNextPath(pPath);
00681     }
00682 #endif
00683     return TRUE;
00684 }


Member Data Documentation

List PlugInManager::m_HandlersList [private]
 

Definition at line 274 of file plugmngr.h.

BOOL PlugInManager::m_Initialised [private]
 

Definition at line 280 of file plugmngr.h.

BOOL PlugInManager::m_ParseAtStartUp = TRUE [static, private]
 

If TRUE, then the plug-in pathnames will be searched at start up for plug-ins. If FALSE, then the searching happens the first time any plug-in UI is invoked.

Preference: ParseAtStartUp Section: Plug-ins Range: TRUE or FALSE

See also:
-

Definition at line 284 of file plugmngr.h.

PlugInPathList PlugInManager::m_Paths [private]
 

Definition at line 271 of file plugmngr.h.

List PlugInManager::m_PlugInsList [private]
 

Definition at line 277 of file plugmngr.h.

BOOL PlugInManager::m_SearchedPaths [private]
 

Definition at line 282 of file plugmngr.h.


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