ChangeEffectResAction Class Reference

An action to record/restore the current state of the LiveEffect EditList. More...

#include <opliveeffects.h>

Inheritance diagram for ChangeEffectResAction:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 ChangeEffectResAction ()
 

 ~ChangeEffectResAction ()
virtual ActionCode Execute ()
 Inserts the floating endpoint into the Line Tool, creating an undo action to remove the endpoint.

Static Public Member Functions

static ActionCode Init (Operation *pOp, ActionList *pActionList, Action **NewAction)
 This is the function which creates an instance of this action. If there is no room in the undo buffer (which is determined by the base class Init function called within) the function will either return AC_NO_RECORD which means the operation can continue, but no undo information needs to be stored, or AC_OK which means the operation should continue AND record undo information. If the function returns AC_FAIL, there was not enough memory to record the undo information, and the user has decided not to continue with the operation.
static BOOL CreateChangeEffectResAction (Operation *pOp, NodeBitmapEffect *pEffectNode, double dResolution)
 This static function makes it a little easier to use this action. It creates an instance of this action and appends it to the action list.

Public Attributes

NodeBitmapEffectm_pEffectNode
double m_dResolution

Detailed Description

An action to record/restore the current state of the LiveEffect EditList.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/2005
See also:

Definition at line 636 of file opliveeffects.h.


Constructor & Destructor Documentation

ChangeEffectResAction::ChangeEffectResAction  ) 
 

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/2005
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 4282 of file opliveeffects.cpp.

04283 {
04284     m_dResolution = 0;
04285     m_pEffectNode = NULL;
04286 }

ChangeEffectResAction::~ChangeEffectResAction  ) 
 

Definition at line 4423 of file opliveeffects.cpp.

04424 {
04425     m_pEffectNode = NULL;
04426 }


Member Function Documentation

BOOL ChangeEffectResAction::CreateChangeEffectResAction Operation pOp,
NodeBitmapEffect pEffectNode,
double  dRes
[static]
 

This static function makes it a little easier to use this action. It creates an instance of this action and appends it to the action list.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/2005
Parameters:
pOp is the currently running operation [INPUTS] pActionList is a pointer ot the action list to which the action should be appended
- [OUTPUTS]
Returns:
Action code which indicates success or failure to create the action

Errors: -

Definition at line 4346 of file opliveeffects.cpp.

04350 {
04351     ERROR3IF(pOp==NULL, "CreateChangeEffectResAction given NULL op pointer");
04352     ERROR3IF(pEffectNode==NULL, "CreateChangeEffectResAction given NULL node pointer");
04353 
04354     if (dRes == pEffectNode->GetPixelsPerInchValue())   // Prevent unwanted extra work
04355         return FALSE;
04356 
04357     ChangeEffectResAction* RecAction = NULL;
04358     ActionCode Act = ChangeEffectResAction::Init(pOp, pOp->GetUndoActionList(), (Action**)&RecAction);
04359     if ( (Act == AC_OK) && (RecAction != NULL) )
04360     {
04361         RecAction->m_dResolution = pEffectNode->GetPixelsPerInchValue();
04362         RecAction->m_pEffectNode = pEffectNode;
04363     }
04364     else if (Act==AC_FAIL)
04365     {
04366         pOp->FailAndExecute();
04367         pOp->End();
04368     }
04369 
04370     return (Act != AC_FAIL);
04371 }

ActionCode ChangeEffectResAction::Execute  )  [virtual]
 

Inserts the floating endpoint into the Line Tool, creating an undo action to remove the endpoint.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/2005
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
ActionCode, either AC_OK, AC_NORECORD or AC_FAIL

Errors: -

See also:
RemoveFloaterAction::Execute

Reimplemented from Action.

Definition at line 4390 of file opliveeffects.cpp.

04391 {
04392     ChangeEffectResAction* ReAction = NULL;
04393     ActionCode Act = AC_FAIL;
04394     
04395     // Create a redo action for this action, which is another ChangeEffectResAction
04396     Act = ChangeEffectResAction::Init(pOperation, 
04397                                     pOppositeActLst, 
04398                                     (Action**)(&ReAction));
04399     if (Act == AC_FAIL)
04400         return AC_FAIL;
04401 
04402     // ---------------------------------------------------
04403     // Record the current values in the Action
04404     ReAction->m_pEffectNode = m_pEffectNode;
04405     ReAction->m_dResolution = m_pEffectNode->GetPixelsPerInchValue();;
04406 
04407     // ---------------------------------------------------
04408     // Now do the actual action
04409     if (m_pEffectNode->IsLockedEffect())
04410     {
04411         ((NodeLockedEffect*)m_pEffectNode)->SetPixelsPerInch(m_dResolution);
04412     }
04413     else
04414         if (m_pEffectNode->IsBitmapEffect())
04415         {
04416             ((NodeBitmapEffect*)m_pEffectNode)->SetPixelsPerInch(m_dResolution);
04417             m_pEffectNode->ReleaseCached();
04418         }
04419 
04420     return Act;
04421 }

ActionCode ChangeEffectResAction::Init Operation pOp,
ActionList pActionList,
Action **  NewAction
[static]
 

This is the function which creates an instance of this action. If there is no room in the undo buffer (which is determined by the base class Init function called within) the function will either return AC_NO_RECORD which means the operation can continue, but no undo information needs to be stored, or AC_OK which means the operation should continue AND record undo information. If the function returns AC_FAIL, there was not enough memory to record the undo information, and the user has decided not to continue with the operation.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/06/2005
Parameters:
pOp is the pointer to the operation to which this action belongs [INPUTS] pTool is pActionList is the action list to which this action should be added
NewAction is a pointer to a pointer to an action, allowing the function to [OUTPUTS] return a pointer to the created action
Returns:
ActionCode, one of AC_OK, AC_NO_RECORD or AC_FAIL

Errors: -

See also:
Action::Init()

Definition at line 4314 of file opliveeffects.cpp.

04317 {
04318     UINT32 ActSize = sizeof(ChangeEffectResAction);
04319 
04320     ActionCode Ac = Action::Init( pOp, pActionList, ActSize, CC_RUNTIME_CLASS(ChangeEffectResAction), NewAction);
04321 
04322     return Ac;
04323 }


Member Data Documentation

double ChangeEffectResAction::m_dResolution
 

Definition at line 654 of file opliveeffects.h.

NodeBitmapEffect* ChangeEffectResAction::m_pEffectNode
 

Definition at line 653 of file opliveeffects.h.


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