ActionApplyPlugInToBitmap Class Reference

When executed, this sets up an action to redo/undo an apply a plug-in to a bitmap. More...

#include <plugopun.h>

Inheritance diagram for ActionApplyPlugInToBitmap:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 ActionApplyPlugInToBitmap ()
 Find out if there is a valid bitmap in the selection and return useful information to the caller. ActionApplyPlugInToBitmap constructor.
 ~ActionApplyPlugInToBitmap ()
 ActionApplyPlugInToBitmap destructor.
virtual ActionCode Execute ()
 Executes the ActionApplyPlugInToBitmap to go and apply a new bitmap to the currently selected fill or node bitmap and generate another ActionApplyPlugInToBitmap to undo this change. Forces a redraw of the fill or node.

Static Public Member Functions

static ActionCode Init (Operation *const pOp, ActionList *pActionList, UINT32 ActionSize, Document *pDocument, KernelBitmap *pBitmap, KernelBitmapRef *pBitmapRef, NodeBitmap *pFoundNode, AttrFillGeometry *pFoundFillAttribute, Action **NewAction, BOOL bUpdateAspect=FALSE)
 To check that there is sufficient room for the action in the operation history, and if there is, then to add the action to the operations action list.

Private Attributes

Documentm_pDocument
KernelBitmapm_pBitmap
KernelBitmapRefm_pBitmapRef
NodeBitmapm_pFoundNode
AttrFillGeometrym_pFoundFillAttribute
BOOL m_bUpdateAspect

Detailed Description

When executed, this sets up an action to redo/undo an apply a plug-in to a bitmap.

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

Definition at line 167 of file plugopun.h.


Constructor & Destructor Documentation

ActionApplyPlugInToBitmap::ActionApplyPlugInToBitmap  ) 
 

Find out if there is a valid bitmap in the selection and return useful information to the caller. ActionApplyPlugInToBitmap constructor.

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

Definition at line 469 of file plugopun.cpp.

00470 {
00471     m_pDocument = NULL;
00472     m_pBitmap = NULL;
00473     m_pBitmapRef = NULL;
00474     m_pFoundNode = NULL;
00475     m_pFoundFillAttribute = NULL;
00476 }

ActionApplyPlugInToBitmap::~ActionApplyPlugInToBitmap  ) 
 

ActionApplyPlugInToBitmap destructor.

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

Definition at line 488 of file plugopun.cpp.

00489 {
00490 }


Member Function Documentation

ActionCode ActionApplyPlugInToBitmap::Execute  )  [virtual]
 

Executes the ActionApplyPlugInToBitmap to go and apply a new bitmap to the currently selected fill or node bitmap and generate another ActionApplyPlugInToBitmap to undo this change. Forces a redraw of the fill or node.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/1/97
Parameters:
- [INPUTS]
ActionCode indicating if the action was successfully executed or not [OUTPUTS]
Returns:
-

Reimplemented from Action.

Definition at line 508 of file plugopun.cpp.

00509 {
00510     ActionApplyPlugInToBitmap ApplyPlugInAct;
00511     ActionCode ActCode = AC_FAIL;
00512 
00513     // Get the details on the stored bitmap node or fill so that we can use this to undo what we
00514     // are about to try and do
00515     KernelBitmap *      pBitmap = NULL;
00516     KernelBitmapRef *   pBitmapRef = NULL;
00517     if (m_pDocument != NULL && m_pBitmap != NULL && m_pBitmapRef != NULL)
00518     {
00519         // Note the bitmap currently in use on that fill or node
00520         if (m_pFoundNode != NULL)
00521         {
00522             pBitmap = m_pFoundNode->GetBitmap();
00523             pBitmapRef = m_pFoundNode->GetBitmapRef();
00524         }
00525         else if (m_pFoundFillAttribute != NULL)
00526         {
00527             pBitmap = m_pFoundFillAttribute->GetBitmap();
00528             pBitmapRef = m_pFoundFillAttribute->GetBitmapRef();
00529         }
00530         else
00531         {
00532             ERROR3("Called ActionApplyPlugInToBitmap::Execute with no node or fill selected!");
00533             return AC_FAIL; 
00534         }
00535     }
00536     else
00537     {
00538         ERROR3("Called ActionApplyPlugInToBitmap::Execute with no selected bitmap in the range!");
00539         return AC_FAIL; 
00540     }
00541 
00542     if (pBitmap == NULL || pBitmapRef == NULL)
00543     {
00544         ERROR3("Called ActionApplyPlugInToBitmap::Execute with no selected bitmap in the range!");
00545         return AC_FAIL; 
00546     }
00547 
00548     // Create an action to restore the changes we are about to make
00549     ActCode = ActionApplyPlugInToBitmap::Init(  pOperation,
00550                                                 pOppositeActLst,
00551                                                 sizeof(ActionApplyPlugInToBitmap),
00552                                                 m_pDocument,
00553                                                 pBitmap,
00554                                                 pBitmapRef,
00555                                                 m_pFoundNode,
00556                                                 m_pFoundFillAttribute,
00557                                                 ( Action**)(&ApplyPlugInAct),
00558                                                 m_bUpdateAspect
00559                                                 );
00560     if (ActCode != AC_FAIL)
00561     {
00562         // Make sure we have quite a few valid items before even attempting to continue
00563         if (m_pDocument != NULL && m_pBitmap != NULL && m_pBitmapRef != NULL)
00564         {
00565             // Change that bitmap
00566             if (m_pFoundNode != NULL)
00567             {
00568                 if (m_bUpdateAspect)
00569                 {
00570                     // Ensure that the aspect ratio of the new bitmap is retained
00571                     // (Must be done before the new bitmap is attached)
00572                     m_pFoundNode->SetAspectRatio(m_pBitmap->GetWidth(), m_pBitmap->GetHeight(), TRUE);
00573                 }
00574 
00575                 // Its a node bitmap so change its bitmap reference to be the new one
00576                 m_pBitmapRef->Attach(m_pBitmap, m_pDocument);
00577 
00578                 BROADCAST_TO_ALL(BitmapListChangedMsg(m_pBitmap->GetParentBitmapList(), m_pBitmap));
00579 
00580                 // Say that the bitmap has changed
00581                 ((UndoableOperation*)pOperation)->DoInvalidateNodeRegion((NodeRenderableInk*)m_pFoundNode, TRUE);
00582             }
00583             else if (m_pFoundFillAttribute != NULL)
00584             {
00585                 // Its a bitmap fill so change its bitmap reference to be the new one
00586                 m_pBitmapRef->Attach(m_pBitmap, m_pDocument);
00587 
00588                 BROADCAST_TO_ALL(BitmapListChangedMsg(m_pBitmap->GetParentBitmapList(), m_pBitmap));
00589             }
00590             else
00591             {
00592                 ERROR3("Called ActionApplyPlugInToBitmap::Execute with no node or fill selected!");
00593                 return AC_FAIL; 
00594             }
00595         }
00596     }
00597 
00598     return (ActCode);
00599 }

ActionCode ActionApplyPlugInToBitmap::Init Operation *const   pOp,
ActionList pActionList,
UINT32  ActionSize,
Document pDocument,
KernelBitmap pBitmap,
KernelBitmapRef pBitmapRef,
NodeBitmap pFoundNode,
AttrFillGeometry pFoundFillAttribute,
Action **  NewAction,
BOOL  bUpdateAspect = FALSE
[static]
 

To check that there is sufficient room for the action in the operation history, and if there is, then to add the action to the operations action list.

Parameters:
pOp,: The operation to which the action should be added [INPUTS] pActionList: The action list in the operation object ActionSize: The size of the action in bytes. This should be the total size of the action (including any objects pointed to by the action). pDocument: The target document which contains the bitmap pBmp: The target bitmap to have the plug-in applied to pBitmapRef: The target bitmap reference to be changed pFoundNode: The possible target nodebitmap or NULL pFoundFillAttribute: The possible target attribute or null.
NewAction,: A pointer to the action if it could be allocated. [OUTPUTS]
Returns:
AC_FAIL: There was not enough room in the operation history for the action and the user did not wish to continue. Usually End() should be called in this situation.
AC_NORECORD: There was not enough room in the operation history for the action, but the user requested that he wished to continue without undo.

AC_OK : The action was successfully initialised and added to the operation.

The function calls the Action::Init function passing the runtime class of an ActionApplyPlugInToBitmap.

Returns:
Errors: -
See also:
Action::Init; PlugInUndoOp;

Definition at line 653 of file plugopun.cpp.

00663 {
00664     ActionCode Ac = (Action::Init(pOp,
00665                                     pActionList,
00666                                     ActionSize,
00667                                     CC_RUNTIME_CLASS(ActionApplyPlugInToBitmap), 
00668                                     NewAction));
00669     if (*NewAction != NULL)
00670     {
00671         ActionApplyPlugInToBitmap *ACC = (ActionApplyPlugInToBitmap*) (*NewAction);
00672         ACC->m_pDocument  = pDocument;
00673         ACC->m_pBitmap  = pBitmap;
00674         ACC->m_pBitmapRef = pBitmapRef;
00675         ACC->m_pFoundNode = pFoundNode;
00676         ACC->m_pFoundFillAttribute = pFoundFillAttribute;
00677         ACC->m_bUpdateAspect = bUpdateAspect;
00678     }
00679 
00680     return (Ac);
00681 }


Member Data Documentation

BOOL ActionApplyPlugInToBitmap::m_bUpdateAspect [private]
 

Definition at line 194 of file plugopun.h.

KernelBitmap* ActionApplyPlugInToBitmap::m_pBitmap [private]
 

Definition at line 190 of file plugopun.h.

KernelBitmapRef* ActionApplyPlugInToBitmap::m_pBitmapRef [private]
 

Definition at line 191 of file plugopun.h.

Document* ActionApplyPlugInToBitmap::m_pDocument [private]
 

Definition at line 189 of file plugopun.h.

AttrFillGeometry* ActionApplyPlugInToBitmap::m_pFoundFillAttribute [private]
 

Definition at line 193 of file plugopun.h.

NodeBitmap* ActionApplyPlugInToBitmap::m_pFoundNode [private]
 

Definition at line 192 of file plugopun.h.


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