PlugInUndoOp Class Reference

Undoable Operation so that a plug-ins can be invoked and used. More...

#include <plugopun.h>

Inheritance diagram for PlugInUndoOp:

SelOperation UndoableOperation Operation MessageHandler ListItem CCObject SimpleCCObject BfxPlugInUndoOp List of all members.

Public Member Functions

 PlugInUndoOp ()
 Constructor for PlugInUndoOp operation. It is undoable.
virtual void Do (OpDescriptor *)
 Invokes the plug-in specified by the OpDescriptor.
virtual void GetOpName (String_256 *OpName)
 To get the name of the operation to put on the undo/redo menu items. We overide the baseclass version which tries to use the runtime class of this class to work out the OpDescriptor it was invoked with. Of course, we use one operation with multiple OpDescriptors and so this is not good enough. Unfortunately the operation class does not seem to save away the OpDescriptor that invoked it and so we must do this and then use this to track down the text to use.

Static Public Member Functions

static BOOL Init ()
 Creates all the opDescriptors that call this operation.
static BOOL RegisterOpToken (TCHAR *OpToken, const String_64 &NewMenuText, CCRuntimeClass *pClass=CC_RUNTIME_CLASS(PlugInUndoOp), pfnGetState gs=GetState)
 Allows OpDescriptors to be defined to the operation system.
static BOOL RegisterOpToken (TCHAR *OpToken, UINT32 MenuTextID, CCRuntimeClass *pClass=CC_RUNTIME_CLASS(PlugInUndoOp), pfnGetState gs=GetState)
 Allows OpDescriptors to be defined to the operation system.
static OpState GetState (String_256 *, OpDescriptor *)
 To provide greying and ticking functionality for the operation.

Protected Attributes

OpDescriptorm_pOpDesc

Private Member Functions

 CC_DECLARE_DYNCREATE (PlugInUndoOp)

Detailed Description

Undoable Operation so that a plug-ins can be invoked and used.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/1/97

Definition at line 120 of file plugopun.h.


Constructor & Destructor Documentation

PlugInUndoOp::PlugInUndoOp  ) 
 

Constructor for PlugInUndoOp operation. It is undoable.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/1/97
Parameters:
[INPUTS] 
[OUTPUTS] 
Returns:

Errors: None

Definition at line 135 of file plugopun.cpp.

00135                            : SelOperation()
00136 {
00137     m_pOpDesc = NULL;
00138 }


Member Function Documentation

PlugInUndoOp::CC_DECLARE_DYNCREATE PlugInUndoOp   )  [private]
 

void PlugInUndoOp::Do OpDescriptor pOpDesc  )  [virtual]
 

Invokes the plug-in specified by the OpDescriptor.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/1/97
Parameters:
pOpDesc the OpDescriptor of the item to invoke [INPUTS]
None [OUTPUTS]
Returns:
None

Errors: if no OpDescriptor is supplied

Reimplemented from Operation.

Reimplemented in BfxPlugInUndoOp.

Definition at line 301 of file plugopun.cpp.

00302 {
00303     if (pOpDesc == NULL)
00304     {
00305         ERROR3IF(pOpDesc == NULL,"PlugInUndoOp::Do null OpDescriptor");
00306         return;
00307     }
00308     //ERROR3("PlugInUndoOp - do");
00309 
00310     // Store away a copy of the OpDescriptor for later use
00311     m_pOpDesc = pOpDesc;
00312 
00313     // Search the plug-ins list for the specified plug-in and invoke it
00314     PlugInManager* pManager = GetApplication()->GetPlugInManager();
00315     if (pManager == NULL)
00316         return;
00317 
00318     PlugInItem * pPlugIn = pManager->GetFirstPlugIn();
00319     String_32 OpToken;
00320     while (pPlugIn)
00321     {
00322         OpToken = pPlugIn->GetUniqueID();
00323         OpToken += pPlugIn->GetPlugInName();
00324         if (pOpDesc->Token == OpToken)
00325         {
00326             // Do Something
00327             break;
00328         }
00329 
00330         pPlugIn = pManager->GetNextPlugIn(pPlugIn);
00331     }
00332 
00333     // If we reached here then everything has happened ok and we can just end the
00334     // operation and exit 
00335     End();
00336 
00337     return;
00338 }

void PlugInUndoOp::GetOpName String_256 pOpName  )  [virtual]
 

To get the name of the operation to put on the undo/redo menu items. We overide the baseclass version which tries to use the runtime class of this class to work out the OpDescriptor it was invoked with. Of course, we use one operation with multiple OpDescriptors and so this is not good enough. Unfortunately the operation class does not seem to save away the OpDescriptor that invoked it and so we must do this and then use this to track down the text to use.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/3/97
Parameters:
The name of the operation [OUTPUTS]

Reimplemented from Operation.

Definition at line 277 of file plugopun.cpp.

00278 {
00279     if (pOpName == NULL)
00280         return;
00281                                  
00282     // Use our stored copy of the OpDescriptor and ask it for the text
00283     if (m_pOpDesc)             
00284         m_pOpDesc->GetText(pOpName, OP_UNDO_TEXT);
00285 }  

OpState PlugInUndoOp::GetState String_256 ,
OpDescriptor OpDesc
[static]
 

To provide greying and ticking functionality for the operation.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/1/97
Parameters:
[INPUTS] 
String - if MenuItem is enabled Then return the name of the operation to [OUTPUTS] be undone Else return the reason why it is disabled
Returns:
OpState the state of the operation

Errors: None

Reimplemented in BfxPlugInUndoOp.

Definition at line 253 of file plugopun.cpp.

00254 {
00255     // At present, this item is always available.
00256     OpState OpSt;
00257     return OpSt;
00258 }

BOOL PlugInUndoOp::Init void   )  [static]
 

Creates all the opDescriptors that call this operation.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/1/97
Returns:
TRUE if the Op was started ok

Reimplemented from SimpleCCObject.

Reimplemented in BfxPlugInUndoOp.

Definition at line 151 of file plugopun.cpp.

00152 {
00153     BOOL ok = TRUE;
00154     // Set up some standard operations
00155 //  ok = ok && RegisterOpToken(OPTOKEN_PLUGINS, _R(IDS_PLUGINS));
00156 
00157 //  ok = ok && RegisterOpToken(OPTOKEN_PHOTOSHOP_PLUGINS, _R(IDS_PHOTOSHOP_PLUGINS));
00158 //  ok = ok && RegisterOpToken(OPTOKEN_PHOTOSHOP_APPLYLAST, _R(IDS_PHOTOSHOP_APPLYLAST));
00159 
00160 //  ok = ok && RegisterOpToken(OPTOKEN_PLUGINONE, _R(IDS_PLUGIN_ONE));
00161 //  ok = ok && RegisterOpToken(OPTOKEN_PLUGINTWO, _R(IDS_PLUGIN_TWO));
00162 //  ok = ok && RegisterOpToken(OPTOKEN_PLUGINTHREE, _R(IDS_PLUGIN_THREE));
00163     return ok;
00164 }

BOOL PlugInUndoOp::RegisterOpToken TCHAR OpToken,
UINT32  MenuTextID,
CCRuntimeClass pClass = CC_RUNTIME_CLASS(PlugInUndoOp),
pfnGetState  gs = GetState
[static]
 

Allows OpDescriptors to be defined to the operation system.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/1/97
Parameters:
OpToken the OpToken for the operation [INPUTS] MenuTextId the text for the menu item for this operation pClass the runtime class to use, defaults to PlugInUndoOp. gs the GetState function to use
Returns:
TRUE if the Op was registered ok

Definition at line 210 of file plugopun.cpp.

00212 {
00213     // register some option descriptors
00214     if (!UndoableOperation::RegisterOpDescriptor(
00215                         0,                          // Tool ID
00216                         MenuTextID,                 // String resource ID
00217                         pClass,                     // Runtime class
00218                         OpToken,                    // Token string
00219                         gs,                         // GetState function
00220                         NULL,                       // help ID
00221                         NULL,                       // bubble help
00222                         NULL,                       // resource ID
00223                         NULL,                       // control ID
00224                         SYSTEMBAR_ILLEGAL,          // Bar ID
00225                         TRUE,                       // Recieve system messages
00226                         FALSE,                      // Smart duplicate operation
00227                         FALSE,                      // Clean operation
00228 //                      NULL,                       // No vertical counterpart (not present in undoable versions)
00229                         NULL,                       // String for one copy only error
00230                         (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags
00231                         ))
00232         return FALSE;
00233 
00234     return TRUE;
00235 }

BOOL PlugInUndoOp::RegisterOpToken TCHAR OpToken,
const String_64 NewMenuText,
CCRuntimeClass pClass = CC_RUNTIME_CLASS(PlugInUndoOp),
pfnGetState  gs = GetState
[static]
 

Allows OpDescriptors to be defined to the operation system.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/1/97
Parameters:
OpToken the OpToken for the operation [INPUTS] NewMenuText the text for the menu item for this operation pClass the runtime class to use, defaults to PlugInUndoOp. gs the GetState function to use
Returns:
TRUE if the Op was registered ok

Definition at line 182 of file plugopun.cpp.

00184 {
00185     // Try to create the OpDescriptor
00186     PlugInOpDescriptor* pOpDesc = new PlugInOpDescriptor(OpToken, NewMenuText, pClass, gs);
00187     if (pOpDesc == NULL)
00188         return FALSE;
00189 
00190     return TRUE;
00191 }


Member Data Documentation

OpDescriptor* PlugInUndoOp::m_pOpDesc [protected]
 

Definition at line 152 of file plugopun.h.


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