AddPressurePointsAction Class Reference

An action which adds points to the Pressure list of a BrushAttValue. More...

#include <opdrbrsh.h>

Inheritance diagram for AddPressurePointsAction:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 AddPressurePointsAction ()
 Constructor for the action.
 ~AddPressurePointsAction ()
 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, CSampleData *pNewPoints, UINT32 StartIndex, size_t NumPoints, AddPressurePointsAction **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

AttrBrushTypem_pAttrBrush
CSampleDatam_pPressureSampler
MILLIPOINT m_StartIndex
size_t m_NumPoints

Detailed Description

An action which adds points to the Pressure list of a BrushAttValue.

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

Definition at line 779 of file opdrbrsh.h.


Constructor & Destructor Documentation

AddPressurePointsAction::AddPressurePointsAction  ) 
 

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 5957 of file opdrbrsh.cpp.

05958 {
05959     m_pPressureSampler = NULL;
05960 }

AddPressurePointsAction::~AddPressurePointsAction  ) 
 

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 5979 of file opdrbrsh.cpp.

05980 {
05981     if (m_pPressureSampler != NULL)
05982         delete m_pPressureSampler;
05983 }


Member Function Documentation

ActionCode AddPressurePointsAction::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 6109 of file opdrbrsh.cpp.

06110 {
06111     TRACEUSER( "Diccon", _T("\nUNDOING ADD PRESSURE POINTS\n"));
06112     ActionCode Act;
06113     AddPressurePointsAction* pAction;
06114     size_t NumPoints;
06115 //  if (m_pPressureSampler != NULL)
06116 //      NumPoints = m_pPressureSampler->GetNumItems();
06117 //  else
06118         NumPoints = m_NumPoints;
06119     Act = AddPressurePointsAction::Init(pOperation,pOppositeActLst,m_pAttrBrush, m_pPressureSampler, m_StartIndex, NumPoints, &pAction);
06120 
06121     // the list gets deleted in the Init but not NULLED
06122     m_pPressureSampler = NULL;
06123 
06124     return Act;
06125 }

ActionCode AddPressurePointsAction::Init Operation pOp,
ActionList pActionList,
AttrBrushType pAttrBrush,
CSampleData pNewPoints,
UINT32  StartIndex,
size_t  NumPoints,
AddPressurePointsAction **  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 pNewPoints - the points to add to the list StartDistance - the distance to start adding the points
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
This function actually changes the blend node in a way specified in pChangeParam
Returns:
Errors: -
See also:
Action::Init()

Definition at line 6018 of file opdrbrsh.cpp.

06022 {
06023     ERROR2IF(pAttrBrush == NULL,AC_FAIL,"pAttrBrush is NULL");
06024 
06025     // just check that we do actually have a pressure brush attribute, if not then just quit
06026     if (!pAttrBrush->ContainsPressureCache())
06027         return AC_OK;
06028     // Get the attribute value, just to make sure
06029     BrushAttrValue* pVal = (BrushAttrValue*)pAttrBrush->GetAttributeValue();
06030     if (pVal == NULL)
06031         return AC_FAIL;
06032 
06033     // make the new action
06034     UINT32 ActSize = sizeof(AddPressurePointsAction);
06035     AddPressurePointsAction* pNewAction;
06036     ActionCode Ac = Action::Init(pOp,pActionList,ActSize,CC_RUNTIME_CLASS(AddPressurePointsAction),(Action**)&pNewAction);
06037     *ppNewAction = pNewAction;
06038 
06039     if (Ac != AC_FAIL)
06040     {
06041         // if the CSampleData is NULL then we are removing points
06042         if (pNewPoints == NULL)
06043         {
06044             //allocate a new list to store the deleted points in
06045             pNewPoints = new CSampleData;
06046             if (pNewPoints == NULL)
06047             {
06048                 delete pNewAction;
06049                 return AC_FAIL;
06050             }
06051             // initialise the array
06052             if (!pNewPoints->InitialiseData(NumPoints))
06053             {
06054                 delete pNewAction;
06055                 delete pNewPoints;
06056                 return AC_FAIL;
06057             }
06058 
06059             pVal->DeletePressurePoints(StartIndex, NumPoints, pNewPoints->GetSampleArray());
06060             // we must calculate num items ourselves
06061             pNewPoints->SetNumItemsFromArraySize();
06062         }
06063         // otherwise we are adding
06064         else
06065         {   
06066             pNewPoints->ClipArray(NumPoints);
06067             pVal->AddPressurePoints(pNewPoints, StartIndex);
06068             NumPoints = (UINT32)pNewPoints->GetNumItems();
06069             
06070             delete pNewPoints;
06071             pNewPoints = NULL;
06072         }
06073         pNewAction->m_pAttrBrush = pAttrBrush;
06074         pNewAction->m_pPressureSampler = pNewPoints;
06075         pNewAction->m_StartIndex = StartIndex;
06076         pNewAction->m_NumPoints = NumPoints;
06077         
06078         pAttrBrush->ClearCachedRect();
06079 
06080         // tell the attr we are changing the list, so don't reposition
06081         pVal->SetPressureUpdateType(UPDATE_LISTANDPOSITION);
06082         
06083     //  TRACEUSER( "Diccon", _T("Start = %d, End = %d\n"), StartDistance, pNewAction->m_EndDistance);
06084 
06085         
06086     }
06087     return Ac;
06088     
06089 }


Member Data Documentation

size_t AddPressurePointsAction::m_NumPoints
 

Definition at line 798 of file opdrbrsh.h.

AttrBrushType* AddPressurePointsAction::m_pAttrBrush
 

Definition at line 795 of file opdrbrsh.h.

CSampleData* AddPressurePointsAction::m_pPressureSampler
 

Definition at line 796 of file opdrbrsh.h.

MILLIPOINT AddPressurePointsAction::m_StartIndex
 

Definition at line 797 of file opdrbrsh.h.


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