RemovePressurePointsAction Class Reference

An action which removes points from the pressure data list of a BrushAttValue. More...

#include <opdrbrsh.h>

Inheritance diagram for RemovePressurePointsAction:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 RemovePressurePointsAction ()
 Constructor for the action.
 ~RemovePressurePointsAction ()
 destructor for the action
virtual ActionCode Execute ()
 Executes the action. This will reset the num blend steps in pThisNodeBrush to OldNumSteps, after creating another action to record the current num steps of pThisNodeBrush.

Static Public Member Functions

static ActionCode Init (Operation *pOp, ActionList *pActionList, AttrBrushType *pAttrBrush, UINT32 StartIndex, UINT32 NumPoints, CSampleData *pSampler, RemovePressurePointsAction **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.

Public Attributes

CSampleDatam_pPressureSampler
AttrBrushTypem_pAttrBrush
MILLIPOINT m_StartIndex
MILLIPOINT m_NumPoints

Detailed Description

An action which removes points from the pressure data list of a BrushAttValue.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/3/2000
See also:
-

Definition at line 743 of file opdrbrsh.h.


Constructor & Destructor Documentation

RemovePressurePointsAction::RemovePressurePointsAction  ) 
 

Constructor for the action.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/11/99
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 5777 of file opdrbrsh.cpp.

05778 {
05779     m_pPressureSampler = NULL;
05780 }

RemovePressurePointsAction::~RemovePressurePointsAction  ) 
 

destructor for the action

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/11/99
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 5799 of file opdrbrsh.cpp.

05800 {
05801     if (m_pPressureSampler != NULL)
05802         delete m_pPressureSampler;
05803 }


Member Function Documentation

ActionCode RemovePressurePointsAction::Execute  )  [virtual]
 

Executes the action. This will reset the num blend steps in pThisNodeBrush to OldNumSteps, after creating another action to record the current num steps of pThisNodeBrush.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/11/99
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
ActionCode, one of AC_OK, AC_NO_RECORD or AC_FAIL

Errors: -

See also:
Action::Init()

Reimplemented from Action.

Definition at line 5924 of file opdrbrsh.cpp.

05925 {
05926     TRACEUSER( "Diccon", _T("\nUNDOING REMOVE PRESSURE POINTS\n"));
05927     ActionCode Act;
05928     RemovePressurePointsAction* pAction;
05929     Act = RemovePressurePointsAction::Init(pOperation,pOppositeActLst,m_pAttrBrush,m_StartIndex, m_NumPoints,  m_pPressureSampler, &pAction);
05930     // this gets deleted in the Init, but not nulled
05931     m_pPressureSampler = NULL;
05932     return Act;
05933 }

ActionCode RemovePressurePointsAction::Init Operation pOp,
ActionList pActionList,
AttrBrushType pAttrBrush,
UINT32  StartIndex,
UINT32  NumPoints,
CSampleData pPressureData,
RemovePressurePointsAction **  ppNewAction
[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:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/11/99
Parameters:
pOp = ptr to the operation to which this action belongs [INPUTS] pActionList = ptr to action list to which this action should be added pAttrBrush - the brush attribute to perform the action on StartIndex - the index in the pressure list to begin removing at NumPoints - the number of points to remove
ppNewAction = ptr to a ptr to an action, allowing the function to return [OUTPUTS] 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 5838 of file opdrbrsh.cpp.

05842 {
05843     ERROR2IF(pAttrBrush == NULL,AC_FAIL,"pAttrBrush is NULL");
05844     
05845     // just check that we do actually have a time stamping brush attribute, if not then just quit
05846     if (!pAttrBrush->ContainsPressureCache())
05847         return AC_OK;
05848     // Get the attribute value, just to make sure
05849     BrushAttrValue* pVal = (BrushAttrValue*)pAttrBrush->GetAttributeValue();
05850     if (pVal == NULL)
05851         return AC_FAIL;
05852     
05853     // make the new action
05854     UINT32 ActSize = sizeof(RemovePressurePointsAction);
05855     RemovePressurePointsAction* pNewAction;
05856     ActionCode Ac = Action::Init(pOp,pActionList,ActSize,CC_RUNTIME_CLASS(RemovePressurePointsAction),(Action**)&pNewAction);
05857     *ppNewAction = pNewAction;
05858 
05859     if (Ac != AC_FAIL)
05860     {
05861         
05862         // if the list is NULL then we are removing points
05863         if (pPressureData == NULL)
05864         {
05865             //allocate a new list to store the deleted points in
05866             pPressureData = new CSampleData;
05867             if (pPressureData == NULL)
05868             {
05869                 delete pNewAction;
05870                 return AC_FAIL;
05871             }
05872             // initialise the array 
05873             if (!pPressureData->InitialiseData(NumPoints))
05874             {
05875                 delete pNewAction;
05876                 delete pPressureData;
05877                 return AC_FAIL;
05878             }
05879 
05880                 pVal->DeletePressurePoints(StartIndex, NumPoints, pPressureData->GetSampleArray());
05881                 pPressureData->SetNumItemsFromArraySize();
05882         //  m_pAttrBrush = pAttrBrush;
05883         //  m_StartDistance = StartDistance;
05884         //  m_EndDistance = EndDistance;
05885         }
05886         // otherwise we are undoing
05887         else
05888         {
05889             pVal->AddPressurePoints(pPressureData, StartIndex);
05890             delete pPressureData;
05891             pPressureData = NULL;
05892         }
05893         pNewAction->m_pPressureSampler = pPressureData;
05894         pNewAction->m_pAttrBrush = pAttrBrush;
05895         pNewAction->m_StartIndex = StartIndex;
05896         pNewAction->m_NumPoints  = NumPoints;
05897 
05898         pAttrBrush->ClearCachedRect();
05899 
05900         // tell the attr we are changing the list, so don't reposition
05901         pVal->SetPressureUpdateType(UPDATE_LISTANDPOSITION);
05902     }
05903     return Ac;
05904 }


Member Data Documentation

MILLIPOINT RemovePressurePointsAction::m_NumPoints
 

Definition at line 763 of file opdrbrsh.h.

AttrBrushType* RemovePressurePointsAction::m_pAttrBrush
 

Definition at line 761 of file opdrbrsh.h.

CSampleData* RemovePressurePointsAction::m_pPressureSampler
 

Definition at line 760 of file opdrbrsh.h.

MILLIPOINT RemovePressurePointsAction::m_StartIndex
 

Definition at line 762 of file opdrbrsh.h.


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