RegenerateContourAction Class Reference

Forces a regeneration of the bevel in all nodes in the list Used by NodeBevelcontroller::OnChildChange to force redraws in undos/redos. More...

#include <opcntr.h>

Inheritance diagram for RegenerateContourAction:

Action ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 RegenerateContourAction ()
 Constructor for the action.
 ~RegenerateContourAction ()
virtual ActionCode Execute ()
 Executes the action. Causes a regen of all bevels nodes in the action's list.

Static Public Member Functions

static ActionCode Init (Operation *pOp, ActionList *pActionList, List *pNodes, RegenerateContourAction **NewAction, BOOL bCache=FALSE)
 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.

Protected Attributes

Listm_pNodes
BOOL m_bCache
DocRect m_OldRect

Detailed Description

Forces a regeneration of the bevel in all nodes in the list Used by NodeBevelcontroller::OnChildChange to force redraws in undos/redos.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/3/99

Definition at line 228 of file opcntr.h.


Constructor & Destructor Documentation

RegenerateContourAction::RegenerateContourAction  ) 
 

Constructor for the action.

Author:
Olivier_Gascoin (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/01/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 1095 of file opcntr.cpp.

01096 {
01097     m_pNodes = NULL;
01098     m_bCache = FALSE;
01099 }

RegenerateContourAction::~RegenerateContourAction  ) 
 

Definition at line 1247 of file opcntr.cpp.

01248 {
01249     if (m_pNodes)
01250     {
01251         m_pNodes->DeleteAll();
01252         delete m_pNodes;
01253     }
01254 }


Member Function Documentation

ActionCode RegenerateContourAction::Execute  )  [virtual]
 

Executes the action. Causes a regen of all bevels nodes in the action's list.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/3/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 1229 of file opcntr.cpp.

01230 {
01231     ActionCode Act;
01232     RegenerateContourAction* pAction;
01233     
01234     Act = RegenerateContourAction::Init(pOperation, 
01235                                         pOppositeActLst,
01236                                         m_pNodes,
01237                                         &pAction,
01238                                         m_bCache);
01239 
01240     if (Act != AC_FAIL)
01241     {
01242     }
01243 
01244     return Act;
01245 }

ActionCode RegenerateContourAction::Init Operation pOp,
ActionList pActionList,
List pNodes,
RegenerateContourAction **  ppNewAction,
BOOL  bCache = FALSE
[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:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/3/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 pNodes = ptr to node list containing the NodeBevel nodes to be regenerated
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 1132 of file opcntr.cpp.

01137 {
01138     UINT32 ActSize = sizeof(RegenerateContourAction);
01139     
01140     ActionCode Ac = Action::Init(pOp,pActionList,ActSize,CC_RUNTIME_CLASS(RegenerateContourAction),(Action**)ppNewAction);
01141 
01142     // make a copy of the node list
01143     List * pCopyList = NULL;
01144     ALLOC_WITH_FAIL(pCopyList, new List, pOp);
01145     NodeListItem * pItem = (NodeListItem *)pNodes->GetHead();
01146     NodeListItem * pCopyItem = NULL;
01147 
01148     while (pItem)
01149     {
01150         ALLOC_WITH_FAIL(pCopyItem, new NodeListItem, pOp);
01151         pCopyItem->pNode = pItem->pNode;
01152         
01153         pCopyList->AddTail(pCopyItem);
01154 
01155         pItem = (NodeListItem *)pNodes->GetNext(pItem);
01156     }
01157 
01158     (*ppNewAction)->m_pNodes = pCopyList;
01159     (*ppNewAction)->m_bCache = bCache;
01160 
01161     pItem = (NodeListItem *)pNodes->GetHead();
01162 
01163     DocView * pView = DocView::GetCurrent();
01164 
01165     Document * pDoc = Document::GetCurrent();
01166 
01167     DocRect dr;
01168 
01169     if (Ac != AC_FAIL)
01170     {
01171         while (pItem)
01172         {
01173             if (pItem->pNode && !pItem->pNode->IsNodeHidden() && pItem->pNode->FindParent()!=NULL)
01174             {
01175                 dr = dr.Union(((NodeRenderableBounded *)pItem->pNode)->GetBoundingRect());
01176                 
01177                 if (pView && bCache)
01178                 {
01179                     GetApplication()->AddNodeToRegenList(pItem->pNode);
01180                 }
01181                 else
01182                 {
01183                     ((NodeContourController *)(pItem->pNode))->RegenerateNode(NULL, FALSE);
01184                 }
01185 
01186                 dr = dr.Union(((NodeRenderableBounded *)pItem->pNode)->GetBoundingRect());
01187             }
01188             ((NodeRenderableInk*)pItem->pNode)->ReleaseCached();
01189     
01190             pItem = (NodeListItem *)pNodes->GetNext(pItem);
01191         }
01192 
01193         if (pDoc)
01194         {
01195             if (Document::GetSelectedSpread())
01196             {
01197                 pDoc->ForceRedraw(Document::GetSelectedSpread(), 
01198                     dr);
01199             }
01200         }
01201     }
01202 
01203     (*ppNewAction)->m_OldRect = dr;
01204 
01205     // move my action to the head of the list
01206     // I have a problem, for certain ops we need to do the following, BUT for others
01207     // we don't (otherwise access violations occur).  um?
01208     pActionList->RemoveItem(*ppNewAction);
01209     pActionList->AddHead(*ppNewAction);
01210 
01211     return Ac;
01212 }


Member Data Documentation

BOOL RegenerateContourAction::m_bCache [protected]
 

Definition at line 244 of file opcntr.h.

DocRect RegenerateContourAction::m_OldRect [protected]
 

Definition at line 245 of file opcntr.h.

List* RegenerateContourAction::m_pNodes [protected]
 

Definition at line 243 of file opcntr.h.


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