#include <opdrbrsh.h>
Inheritance diagram for AddPressurePointsAction:
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 | |
AttrBrushType * | m_pAttrBrush |
CSampleData * | m_pPressureSampler |
MILLIPOINT | m_StartIndex |
size_t | m_NumPoints |
Definition at line 779 of file opdrbrsh.h.
|
Constructor for the action.
Definition at line 5957 of file opdrbrsh.cpp. 05958 { 05959 m_pPressureSampler = NULL; 05960 }
|
|
destructor for the action
Definition at line 5979 of file opdrbrsh.cpp. 05980 { 05981 if (m_pPressureSampler != NULL) 05982 delete m_pPressureSampler; 05983 }
|
|
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.
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 }
|
|
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.
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 }
|
|
Definition at line 798 of file opdrbrsh.h. |
|
Definition at line 795 of file opdrbrsh.h. |
|
Definition at line 796 of file opdrbrsh.h. |
|
Definition at line 797 of file opdrbrsh.h. |