AddTimeStampPointsAction Class Reference

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

#include <opdrbrsh.h>

Inheritance diagram for AddTimeStampPointsAction:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 AddTimeStampPointsAction ()
 Constructor for the action.
 ~AddTimeStampPointsAction ()
 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, TimeStampList *pNewPoints, MILLIPOINT StartDistance, MILLIPOINT EndDistance, size_t NumPoints, AddTimeStampPointsAction **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
TimeStampListm_pTimeStampList
MILLIPOINT m_StartDistance
MILLIPOINT m_EndDistance
size_t m_NumPoints

Detailed Description

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

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

Definition at line 624 of file opdrbrsh.h.


Constructor & Destructor Documentation

AddTimeStampPointsAction::AddTimeStampPointsAction  ) 
 

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

05306 {
05307     m_pTimeStampList = NULL;
05308 }

AddTimeStampPointsAction::~AddTimeStampPointsAction  ) 
 

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

05328 {
05329     if (m_pTimeStampList != NULL)
05330         delete m_pTimeStampList;
05331 }


Member Function Documentation

ActionCode AddTimeStampPointsAction::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 5452 of file opdrbrsh.cpp.

05453 {
05454     ActionCode Act;
05455     AddTimeStampPointsAction* pAction;
05456     size_t NumPoints;
05457     if (m_pTimeStampList != NULL)
05458         NumPoints = m_pTimeStampList->size();
05459     else
05460         NumPoints = m_NumPoints;
05461     Act = AddTimeStampPointsAction::Init( pOperation, pOppositeActLst, m_pAttrBrush, m_pTimeStampList, 
05462         m_StartDistance, m_EndDistance, NumPoints, &pAction );
05463 
05464     // the list gets deleted in the Init but not NULLED
05465     m_pTimeStampList = NULL;
05466 
05467     return Act;
05468 }

ActionCode AddTimeStampPointsAction::Init Operation pOp,
ActionList pActionList,
AttrBrushType pAttrBrush,
TimeStampList pNewPoints,
MILLIPOINT  StartDistance,
MILLIPOINT  EndDistance,
size_t  NumPoints,
AddTimeStampPointsAction **  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 5366 of file opdrbrsh.cpp.

05370 {
05371     ERROR2IF(pAttrBrush == NULL,AC_FAIL,"pAttrBrush is NULL");
05372     ERROR2IF(StartDistance < 0, AC_FAIL, "Invalid start distance");
05373 
05374     // just check that we do actually have a time stamping brush attribute, if not then just quit
05375     if (!pAttrBrush->IsTimeStamping())
05376         return AC_OK;
05377     // Get the attribute value, just to make sure
05378     BrushAttrValue* pVal = (BrushAttrValue*)pAttrBrush->GetAttributeValue();
05379     if (pVal == NULL)
05380         return AC_FAIL;
05381 
05382     // make the new action
05383     UINT32 ActSize = sizeof(AddTimeStampPointsAction);
05384     AddTimeStampPointsAction* pNewAction;
05385     ActionCode Ac = Action::Init(pOp,pActionList,ActSize,CC_RUNTIME_CLASS(AddTimeStampPointsAction),(Action**)&pNewAction);
05386     *ppNewAction = pNewAction;
05387 
05388     if (Ac != AC_FAIL)
05389     {
05390         // if the list is NULL then we are removing points
05391         if (pNewPoints == NULL)
05392         {
05393             //allocate a new list to store the deleted points in
05394             pNewPoints = new TimeStampList;
05395             if (pNewPoints == NULL)
05396             {
05397                 delete pNewAction;
05398                 return AC_FAIL;
05399             }
05400 
05401             pVal->DeleteTimeStampPoints(StartDistance, EndDistance, pNewPoints);
05402         }
05403         // otherwise we are adding
05404         else
05405         {   
05406             pVal->AddTimeStampPoints(pNewPoints, StartDistance);
05407             NumPoints = (UINT32)pNewPoints->size();
05408         /*  // we want to find out the distance between the start and end points, 
05409             // as the list may well have been sorted by the time we come to undo
05410             TimeStampBrushPoint StartPoint  = pNewPoints->GetHead();
05411             TimeStampBrushPoint EndPoint = pNewPoints->GetTail();
05412             MILLIPOINT ListDistance = EndPoint.m_Distance - StartPoint.m_Distance;
05413             pNewAction->m_EndDistance = StartDistance + ListDistance ;*/
05414             
05415             delete pNewPoints;
05416             pNewPoints = NULL;
05417         }
05418         pNewAction->m_pAttrBrush = pAttrBrush;
05419         pNewAction->m_pTimeStampList = pNewPoints;
05420         pNewAction->m_StartDistance = StartDistance;
05421         pNewAction->m_EndDistance = EndDistance;
05422         pNewAction->m_NumPoints = NumPoints;
05423         
05424         // tell the attr we are changing the list, so don't reposition
05425         pVal->SetTimeStampUpdateType(UPDATE_LISTANDPOSITION);
05426         
05427         TRACEUSER( "Diccon", _T("Start = %d, End = %d\n"), StartDistance, pNewAction->m_EndDistance);
05428 
05429         
05430     }
05431     return Ac;
05432 }


Member Data Documentation

MILLIPOINT AddTimeStampPointsAction::m_EndDistance
 

Definition at line 644 of file opdrbrsh.h.

size_t AddTimeStampPointsAction::m_NumPoints
 

Definition at line 645 of file opdrbrsh.h.

AttrBrushType* AddTimeStampPointsAction::m_pAttrBrush
 

Definition at line 641 of file opdrbrsh.h.

TimeStampList* AddTimeStampPointsAction::m_pTimeStampList
 

Definition at line 642 of file opdrbrsh.h.

MILLIPOINT AddTimeStampPointsAction::m_StartDistance
 

Definition at line 643 of file opdrbrsh.h.


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