OpChangeBarExtends Class Reference

#include <ngsetop.h>

Inheritance diagram for OpChangeBarExtends:

UndoableOperation Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Private Member Functions

 CC_DECLARE_DYNCREATE (OpChangeBarExtends)
virtual void DoWithParam (OpDescriptor *, OpParam *pParam)
 Runs the OPTOKEN_CHANGE_BAR_EXTENDS operation.

Detailed Description

Definition at line 441 of file ngsetop.h.


Member Function Documentation

OpChangeBarExtends::CC_DECLARE_DYNCREATE OpChangeBarExtends   )  [private]
 

void OpChangeBarExtends::DoWithParam OpDescriptor ,
OpParam pParam
[private, virtual]
 

Runs the OPTOKEN_CHANGE_BAR_EXTENDS operation.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/8/99
Parameters:
pParam->Param1 --- (INT32) ID of the bars to change [INPUTS] pParam->Param2 --- (BYTE) the new stretching mode to set
See also:
NodeBarProperty::MakeChange

Reimplemented from Operation.

Definition at line 1078 of file ngsetop.cpp.

01079 {
01080     // Extract the parameters.
01081     ERROR3IF(pParam == 0, "OpChangeBarExtends::DoWithParam: no parameter");
01082     INT32 idBars = (INT32) pParam->Param1;
01083     BYTE nMode = (BYTE) pParam->Param2;
01084     SGUsedNames* pNames = NameGallery::Instance()->GetUsedNames();
01085     ERROR3IF(pNames == 0, "OpChangeBarExtends::DoWithParam: no set names");
01086     NodeSetSentinel* pSentry = GetWorkingDoc()->GetSetSentinel();
01087 
01088     // Iterate over all SGUsedNames, looking for matching bar IDs.
01089     for (SGNameItem* pItem = (SGNameItem*) pNames->GetChild();
01090          pItem != 0;
01091          pItem = (SGNameItem*) pItem->GetNext())
01092             if (pItem->m_BarNumber == idBars)
01093             {
01094                 // We've found a bar whose ID matches.  Undoably change its extending
01095                 // mode to that passed in.
01096                 String_256 strName;
01097                 pItem->GetNameText(&strName);
01098                 NodeSetProperty* pOldSetNode = pSentry->FindPropertyNode(strName);
01099                 ERROR3IF(pOldSetNode == 0,
01100                             "OpChangeBarExtends::DoWithParam: can't find NodeSetProperty");
01101 
01102                 // Try to duplicate the old set properties.
01103                 NodeSetProperty* pNewSetNode;
01104                 ALLOC_WITH_FAIL(pNewSetNode,
01105                                 ((NodeSetProperty*) pOldSetNode->SimpleCopy()),
01106                                 this);
01107                 if (pNewSetNode == 0)
01108                 {
01109                     FailAndExecute();
01110                     End();
01111                     return;
01112                 }
01113 
01114                 // Write the stretching flag into the duplicate.
01115                 NamedStretchProp* pProp =
01116                         (NamedStretchProp*) pNewSetNode->GetProperty(NamedStretchProp::nIndex);
01117                 ERROR3IF(pProp == 0, "OpChangeBarExtends::DoWithParam: no property");
01118                 pProp->SetStretchType(nMode);
01119 
01120                 // Mark the duplicate property as no longer "virgin".
01121                 pProp->SetDirty();
01122 
01123                 // Insert the new properties in their place.
01124                 pNewSetNode->AttachNode(pSentry, LASTCHILD);
01125                 HideNodeAction* pHideAct;
01126                 if (AC_FAIL == HideNodeAction::Init(this, GetUndoActions(), pNewSetNode,
01127                                                     TRUE, (Action**) &pHideAct))
01128                 {
01129                     delete pNewSetNode;
01130                     FailAndExecute();
01131                     End();
01132                     return;
01133                 }
01134 
01135                 //  Finally, hide the old properties.
01136                 if (!DoHideNode(pOldSetNode, TRUE, 0, TRUE))
01137                 {
01138                     FailAndExecute();
01139                     End();
01140                     return;
01141                 }
01142             }
01143 
01144     // Success.
01145     End();
01146 }


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