#include <bfxmngr.h>
Inheritance diagram for BfxHandler:
Public Member Functions | |
BfxHandler () | |
Main constructor for the Bfx plug-in handler in Camelot. | |
~BfxHandler () | |
Main destructor for the Bfx plug-in handler in Camelot. | |
virtual BOOL | Init () |
Main initialisation code for the Bfx plug-in handler in Camelot. | |
virtual BOOL | AddFixedPlugIns () |
Add any fixed plug-ins to the list in the plug-in manager and register the op descriptor to the system. By fixed, I mean those which are not file related and hence will be loaded when the specified paths are parsed for plug-ins. This is the main way that BFX type plug-ins are added to the system. | |
virtual BOOL | AddPlugIn (PlugInItem *pPlugIn, CCRuntimeClass *pClass=CC_RUNTIME_CLASS(PlugInOp), pfnGetState gs=PlugInOp::GetState) |
Add a plug-in to the list in the plug-in manager and register the op descriptor to the system. We override the baseclass version as we need to register an undoable operation and a normal version for each plug-in. The undoable version is used in the document. The normal version is used in the bitmap gallery. | |
virtual BOOL | ParsePlugIn (const PathName &Path, const INT32 PathID) |
Parses the specified plug-in and sees whether it is a Bfx plug-in. If so, then adds it to the list of available plug-ins, noting any useful details which will be required later. The PathID should be added to the plug-in record so that it can be translated back to the pathname at the appropriate time. | |
virtual BOOL | CreateMainMenuItems (PlugInManager *pManager, MenuItem *pRootMenu, BOOL AddSeparator=FALSE) |
After the plug in list has been sorted alphabetically we must add each item in the list to the main plug-in menu. This is a handler's chance to insert menu options into this menu. | |
virtual BOOL | GoingToAddMainMenuItems () |
virtual String_32 | GetUniqueID () const |
A string which defines the unique identifier for the plug-ins that this handler is interested in. In this case being Bfx it is 'Bfx:'. | |
virtual TypeOfPlugIn | GetTypeOfPlugIn () const |
A unique type for the plug-ins that this handler is interested in. In this case being Bfx it is PLUGIN_BFX. | |
virtual String_32 | GetFileTypes () const |
A string which defines the filetype or a list of filetypes that this type of plug-in is interested in. In this case being Bfx they are built in and have no filetype. Always supplied in lowercase. | |
Private Member Functions | |
CC_DECLARE_DYNAMIC (BfxHandler) |
Definition at line 127 of file bfxmngr.h.
|
Main constructor for the Bfx plug-in handler in Camelot.
Definition at line 144 of file bfxmngr.cpp.
|
|
Main destructor for the Bfx plug-in handler in Camelot.
Definition at line 158 of file bfxmngr.cpp.
|
|
Add any fixed plug-ins to the list in the plug-in manager and register the op descriptor to the system. By fixed, I mean those which are not file related and hence will be loaded when the specified paths are parsed for plug-ins. This is the main way that BFX type plug-ins are added to the system.
Reimplemented from PlugInHandler. Definition at line 258 of file bfxmngr.cpp. 00259 { 00260 // Add our fixed plug-ins to the system 00261 // BfxBrightnessContrast * pBrightnessContrast = new BfxBrightnessContrast; 00262 // if (pBrightnessContrast) 00263 // AddPlugIn(pBrightnessContrast, CC_RUNTIME_CLASS(BfxPlugInOp), BfxPlugInOp::GetState); 00264 00265 BfxSpecialEffects * pSpecialEffects = new BfxSpecialEffects; 00266 if (pSpecialEffects) 00267 AddPlugIn(pSpecialEffects, CC_RUNTIME_CLASS(BfxPlugInOp), BfxPlugInOp::GetState); 00268 00269 // BfxResize * pBfxResize = new BfxResize; 00270 // if (pBfxResize) 00271 // AddPlugIn(pBfxResize, CC_RUNTIME_CLASS(BfxPlugInOp), BfxPlugInOp::GetState); 00272 00273 // BfxFlipAndRotate * pBfxFlipAndRotate = new BfxFlipAndRotate; 00274 // if (pBfxFlipAndRotate) 00275 // AddPlugIn(pBfxFlipAndRotate, CC_RUNTIME_CLASS(BfxPlugInOp), BfxPlugInOp::GetState); 00276 00277 // BfxColourDepth * pBfxColourDepth = new BfxColourDepth; 00278 // if (pBfxColourDepth) 00279 // AddPlugIn(pBfxColourDepth, CC_RUNTIME_CLASS(BfxPlugInOp), BfxPlugInOp::GetState); 00280 00281 return TRUE; 00282 }
|
|
Add a plug-in to the list in the plug-in manager and register the op descriptor to the system. We override the baseclass version as we need to register an undoable operation and a normal version for each plug-in. The undoable version is used in the document. The normal version is used in the bitmap gallery.
Reimplemented from PlugInHandler. Definition at line 329 of file bfxmngr.cpp. 00330 { 00331 PlugInManager* pManager = GetApplication()->GetPlugInManager(); 00332 if (pManager == NULL) 00333 return FALSE; 00334 00335 if (!pManager->AddPlugIn(pPlugIn)) 00336 ERROR2(FALSE,"Failed to register a plug-in with plug-in manager"); 00337 00338 // Make up a unique name for the plug in 00339 String_32 OpToken = GetUniqueID(); 00340 OpToken += pPlugIn->GetPlugInName(); 00341 // Register this name as an OpDescriptor to the system so that we can use it 00342 // on menus etc. 00343 if (!PlugInOp::RegisterOpToken(OpToken, pPlugIn->GetPlugInName(), pClass, gs)) 00344 ERROR2(FALSE,"Failed to register OpToken for a plug-in"); 00345 00346 //#if NEW_NATIVE_FILTER 00347 // Now do the same to register the undoable operation to the system 00348 // Make up a unique name for the plug in 00349 OpToken = GetUniqueID(); 00350 // Add the unique undo signature 00351 String_32 UndoSig(TEXT(PLUGIN_UNDO_SIG)); 00352 OpToken += UndoSig; 00353 OpToken += pPlugIn->GetPlugInName(); 00354 // Register this name as an OpDescriptor to the system so that we can use it 00355 // on menus etc. 00356 if (!PlugInUndoOp::RegisterOpToken(OpToken, pPlugIn->GetPlugInName(), CC_RUNTIME_CLASS(BfxPlugInUndoOp), BfxPlugInUndoOp::GetState)) 00357 ERROR2(FALSE,"Failed to register undo OpToken for a plug-in"); 00358 //#endif 00359 00360 // Now see if the family name is registered, if not then register it 00361 OpToken = GetUniqueID(); 00362 OpToken += pPlugIn->GetFamilyName(); 00363 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OpToken); 00364 if (pOpDesc == NULL) 00365 { 00366 // Register this name as an OpDescriptor to the system so that we can use it 00367 // on menus etc. 00368 // Use the default OpDescriptor as this will have enough functionality for tick 00369 // greying i.e. none! 00370 if (!PlugInOp::RegisterOpToken(OpToken, pPlugIn->GetFamilyName())) //, pClass, gs)) 00371 ERROR2(FALSE,"Failed to register OpToken for a plug-in family name"); 00372 } 00373 00374 // Now see if the undo version of the family name is registered, if not then register it 00375 OpToken = GetUniqueID(); 00376 OpToken += UndoSig; 00377 OpToken += pPlugIn->GetFamilyName(); 00378 pOpDesc = OpDescriptor::FindOpDescriptor(OpToken); 00379 if (pOpDesc == NULL) 00380 { 00381 // Register this name as an OpDescriptor to the system so that we can use it 00382 // on menus etc. 00383 // Use the default OpDescriptor as this will have enough functionality for tick 00384 // greying i.e. none! 00385 if (!PlugInUndoOp::RegisterOpToken(OpToken, pPlugIn->GetFamilyName(), CC_RUNTIME_CLASS(BfxPlugInUndoOp), BfxPlugInUndoOp::GetState)) 00386 ERROR2(FALSE,"Failed to register OpToken for a plug-in family name"); 00387 } 00388 00389 return TRUE; 00390 }
|
|
|
|
After the plug in list has been sorted alphabetically we must add each item in the list to the main plug-in menu. This is a handler's chance to insert menu options into this menu.
Reimplemented from PlugInHandler. Definition at line 411 of file bfxmngr.cpp. 00413 { 00414 ERROR2IF(pManager == NULL || pRootMenu == NULL,FALSE,"CreateMainMenuItems bad parameters!"); 00415 00416 //#if NEW_NATIVE_FILTER 00417 // Create a menu item for the apply last item 00418 //MenuItem * pApplyLastItem = CreateMenuItem(OPTOKEN_PLUGINS_PARSING, pRootMenu->GetMenuId(), FALSE); 00419 // If created ok then add this to the main plug-in's menu 00420 //if (pApplyLastItem) 00421 // pRootMenu->AddMenuItem(pApplyLastItem); 00422 00423 // Create the plug-ins manager menu item... 00424 MenuItem * pPlugDlgMngr = CreateMenuItem(OPTOKEN_PLUGSDLG, pRootMenu->GetMenuId(), TRUE); 00425 // If created ok then add this to the main plug-in's menu 00426 if (pPlugDlgMngr) 00427 pRootMenu->AddMenuItem(pPlugDlgMngr); 00428 00429 // Did we find the plug-in main menu item? 00430 // If we did then we need to add the plug-ins to the item 00431 String_32 OpToken; 00432 String_32 FamilyOpToken; 00433 String_32 LastFamilyOpToken; 00434 // MenuItem* pFamilyRoot = NULL; 00435 MenuItem* pFamilyRoot = pRootMenu; 00436 String_32 UndoSig(TEXT(PLUGIN_UNDO_SIG)); 00437 // Go through the list of plug-ins registered to the system and make up a 00438 // menu structure from the OpTokens that they have registered. 00439 // Assumes the plug-ins are sorted correctly on family names and then 00440 // plug-in names. 00441 PlugInItem * pPlugIn = pManager->GetFirstPlugIn(); 00442 BOOL ok = TRUE; 00443 while (pPlugIn != NULL) 00444 { 00445 // Only allow Bfx plug-ins on this menu. We are very plug-inist! 00446 if (pPlugIn->GetTypeOfPlugIn() == PLUGIN_BFX) 00447 { 00448 OpToken = pPlugIn->GetUniqueID(); 00449 FamilyOpToken = OpToken; 00450 // Add the unique undo signature 00451 OpToken += UndoSig; 00452 FamilyOpToken += UndoSig; 00453 // Now add the menu names themselves 00454 OpToken += pPlugIn->GetPlugInName(); 00455 FamilyOpToken += pPlugIn->GetFamilyName(); 00456 // check if we already have 00457 // if (FamilyOpToken != LastFamilyOpToken) 00458 // { 00459 // MenuItem * pNewFamilyItem = CreateMenuItem(FamilyOpToken, pRootMenu->GetMenuId(), FALSE); 00460 // if (pNewFamilyItem) 00461 // { 00462 // // Created ok so add this to the main plug-in's menu 00463 // ok = ok && pRootMenu->AddMenuItem(pNewFamilyItem); 00464 // // This becomes the new family root 00465 // pFamilyRoot = pNewFamilyItem; 00466 // } 00467 // } 00468 // 00469 if (pFamilyRoot) 00470 { 00471 // Create a menu item for the plug-in itself 00472 MenuItem * pNewItem = CreateMenuItem(OpToken, pFamilyRoot->GetMenuId(), FALSE); 00473 // If created ok then add this to the main plug-in's menu 00474 if (pNewItem) 00475 ok = ok && pFamilyRoot->AddMenuItem(pNewItem); 00476 } 00477 00478 LastFamilyOpToken = FamilyOpToken; 00479 } 00480 00481 pPlugIn = pManager->GetNextPlugIn(pPlugIn); 00482 } 00483 00484 00485 // Tell the last item that it should have a separator 00486 // if (pFamilyRoot != NULL && AddSeparator) 00487 // pFamilyRoot->SetIsFollowedBySeparator(TRUE); 00488 00489 //#endif 00490 return TRUE; 00491 }
|
|
A string which defines the filetype or a list of filetypes that this type of plug-in is interested in. In this case being Bfx they are built in and have no filetype. Always supplied in lowercase.
Implements PlugInHandler. Definition at line 237 of file bfxmngr.cpp. 00238 { 00239 return TEXT(""); 00240 }
|
|
A unique type for the plug-ins that this handler is interested in. In this case being Bfx it is PLUGIN_BFX.
Implements PlugInHandler. Definition at line 218 of file bfxmngr.cpp. 00219 { 00220 return PLUGIN_BFX; 00221 }
|
|
A string which defines the unique identifier for the plug-ins that this handler is interested in. In this case being Bfx it is 'Bfx:'.
Implements PlugInHandler. Definition at line 201 of file bfxmngr.cpp. 00202 { 00203 return TEXT("BFX:"); 00204 }
|
|
Reimplemented from PlugInHandler. Definition at line 156 of file bfxmngr.h. 00156 { return TRUE; }
|
|
Main initialisation code for the Bfx plug-in handler in Camelot.
Implements PlugInHandler. Definition at line 173 of file bfxmngr.cpp. 00174 { 00175 // Initialise the operations we are going to need 00176 if (!BfxPlugInOp::Init()) 00177 return FALSE; 00178 //#if NEW_NATIVE_FILTER 00179 if (!BfxPlugInUndoOp::Init()) 00180 return FALSE; 00181 //#endif 00182 if (!BfxPlugInDlg::Init()) 00183 return FALSE; 00184 00185 return TRUE; 00186 }
|
|
Parses the specified plug-in and sees whether it is a Bfx plug-in. If so, then adds it to the list of available plug-ins, noting any useful details which will be required later. The PathID should be added to the plug-in record so that it can be translated back to the pathname at the appropriate time.
Implements PlugInHandler. Definition at line 301 of file bfxmngr.cpp. 00302 { 00303 // TRACEUSER( "Neville", _T("ParsePlugIn = %s\n"), (TCHAR*)Path.GetPath()); 00304 // They are built in and so do not need parsing 00305 00306 return TRUE; 00307 }
|