#include <bfxop.h>
Inheritance diagram for BfxPlugInOp:
Public Member Functions | |
BfxPlugInOp () | |
Constructor for BfxPlugInOp operation. It is not undoable. | |
virtual void | Do (OpDescriptor *) |
Invokes the plug-in specified by the OpDescriptor. | |
Static Public Member Functions | |
static BOOL | Init () |
Creates all the opDescriptors that call this operation. | |
static OpState | GetState (String_256 *, OpDescriptor *) |
To provide greying and ticking functionality for the operation. Assumes only working on Bfx plug-ins. Not that this should make much difference at present. | |
static BOOL | CheckBitmapWithPlugIn (const String_256 &OpName, BOOL IncludeUniqueName=TRUE, BOOL IncludeUndoAbleSig=FALSE) |
To ask the plug-in which matches the OpName whether the bitmap is ok. Assumes only working on Bfx plug-ins. Not that this should make much difference at present. | |
static BOOL | SetBitmapAndDocument (KernelBitmap *pBitmap, Document *pDocument) |
Provides the parameters that the operation will apply to. | |
Private Member Functions | |
CC_DECLARE_DYNCREATE (BfxPlugInOp) | |
Static Private Attributes | |
static KernelBitmap * | m_pBitmap = NULL |
static Document * | m_pDocument = NULL |
Definition at line 118 of file bfxop.h.
|
Constructor for BfxPlugInOp operation. It is not undoable.
Definition at line 138 of file bfxop.cpp.
|
|
|
|
To ask the plug-in which matches the OpName whether the bitmap is ok. Assumes only working on Bfx plug-ins. Not that this should make much difference at present.
Definition at line 187 of file bfxop.cpp. 00189 { 00190 // If no bitmap then always return False 00191 if (m_pBitmap == NULL) 00192 return FALSE; 00193 00194 // Search the plug-ins list for the specified plug-in and check 00195 // that this colour depth is ok with it 00196 INT32 ColourDepth = m_pBitmap->GetBPP(); 00197 BOOL GreyScale = m_pBitmap->IsGreyscale(); 00198 PlugInManager* pManager = GetApplication()->GetPlugInManager(); 00199 if (pManager) 00200 { 00201 PlugInItem * pPlugIn = pManager->GetFirstPlugIn(); 00202 String_32 OpToken; 00203 // Add the unique undo signature 00204 String_32 UndoSig(TEXT(PLUGIN_UNDO_SIG)); 00205 while (pPlugIn) 00206 { 00207 // If we are to include the unique name in the test then do so 00208 if (IncludeUniqueName) 00209 OpToken = pPlugIn->GetUniqueID(); 00210 else 00211 OpToken.Empty(); 00212 if (IncludeUndoAbleSig) 00213 OpToken += UndoSig; 00214 OpToken += pPlugIn->GetPlugInName(); 00215 if (OpName == OpToken) 00216 { 00217 // Ask the plug-in item whether it likes this colour depth 00218 // Returns True if likes it, False otherwise, so we must negate this to 00219 // set the greyed state. 00220 return pPlugIn->IsBitmapModeOk(ColourDepth, GreyScale); 00221 } 00222 00223 pPlugIn = pManager->GetNextPlugIn(pPlugIn); 00224 } 00225 } 00226 00227 // Cannot find plug-in so return False 00228 return FALSE; 00229 }
|
|
Invokes the plug-in specified by the OpDescriptor.
Reimplemented from PlugInOp. Definition at line 295 of file bfxop.cpp. 00296 { 00297 if (pOpDesc == NULL || m_pBitmap == NULL || m_pDocument == NULL) 00298 { 00299 ERROR3("BfxPlugInOp::Do null OpDescriptor/bitmap/document"); 00300 FailAndExecute(); 00301 End(); 00302 return; 00303 } 00304 //ERROR3("PlugInOp - do"); 00305 00306 // Search the plug-ins list for the specified plug-in and invoke it 00307 PlugInManager* pManager = GetApplication()->GetPlugInManager(); 00308 if (pManager == NULL) 00309 return; 00310 00311 PlugInItem * pPlugIn = pManager->GetFirstPlugIn(); 00312 00313 String_32 OpToken; 00314 while (pPlugIn) 00315 { 00316 OpToken = pPlugIn->GetUniqueID(); 00317 OpToken += pPlugIn->GetPlugInName(); 00318 if (pOpDesc->Token == OpToken) 00319 { 00320 BOOL ok = pPlugIn->Apply(m_pBitmap, m_pDocument); 00321 if (!ok) 00322 { 00323 FailAndExecute(); 00324 } 00325 00326 // and finish as we have done our work 00327 End(); 00328 return; 00329 } 00330 00331 pPlugIn = pManager->GetNextPlugIn(pPlugIn); 00332 } 00333 00334 // We must have failed to find the plug-in operation so fail and finish 00335 ERROR3("BfxPlugInOp::Do Failed to find plug-in operation"); 00336 FailAndExecute(); 00337 End(); 00338 }
|
|
To provide greying and ticking functionality for the operation. Assumes only working on Bfx plug-ins. Not that this should make much difference at present.
Reimplemented from PlugInOp. Definition at line 249 of file bfxop.cpp. 00250 { 00251 // At present, this item is always available unless there is 00252 // no bitmap and document to apply it to. 00253 OpState OpSt; 00254 if (m_pBitmap == NULL || m_pDocument == NULL) 00255 OpSt.Greyed = TRUE; 00256 00257 if (m_pBitmap) 00258 { 00259 // If there is a bitmap then we are always available 00260 OpSt.Greyed = FALSE; 00261 00262 /* // If we have a valid bitmap then checks that it is of the correct type 00263 INT32 ColourDepth = m_pBitmap->GetBPP(); 00264 00265 // Only allow bitmaps of 24bpp or of 8bpp greyscale 00266 if (ColourDepth == 24 || (ColourDepth == 8 && m_pBitmap->IsGreyscale())) 00267 { 00268 // Check the bitmap depth with the plug-in itself 00269 // Returns True if likes it, False otherwise, so we must negate this to 00270 // set the greyed state. 00271 OpSt.Greyed = !CheckBitmapWithPlugIn(pOpDesc->Token); 00272 } 00273 else 00274 OpSt.Greyed = TRUE; 00275 */ 00276 } 00277 00278 return OpSt; 00279 }
|
|
Creates all the opDescriptors that call this operation.
Reimplemented from PlugInOp. Definition at line 153 of file bfxop.cpp. 00154 { 00155 BOOL ok = TRUE; 00156 // Set up some standard operations 00157 /* ok = ok && RegisterOpToken(OPTOKEN_Bfx_PLUGINS, _R(IDS_Bfx_PLUGINS), 00158 CC_RUNTIME_CLASS(BfxPlugInOp), BfxPlugInOp::GetState); 00159 ok = ok && RegisterOpToken(OPTOKEN_Bfx_APPLYLAST, _R(IDS_Bfx_APPLYLAST), 00160 CC_RUNTIME_CLASS(BfxPlugInOp), BfxPlugInOp::GetState); 00161 */ 00162 return ok; 00163 }
|
|
Provides the parameters that the operation will apply to.
Definition at line 352 of file bfxop.cpp. 00353 { 00354 m_pBitmap = pBitmap; 00355 m_pDocument = pDocument; 00356 return TRUE; 00357 }
|
|
|
|
|