OpChangeContourToInner Class Reference

Changes all contours to inner - used by the button on the infobar. More...

#include <opcntr.h>

Inheritance diagram for OpChangeContourToInner:

SelOperation UndoableOperation Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 OpChangeContourToInner ()
 Constructor.
 ~OpChangeContourToInner ()
 Destructor.
virtual void Do (OpDescriptor *pOpDesc)
 The do function. Applys a Bevel to the selection in the current document.
virtual void DoWithParam (OpDescriptor *pOp, OpParam *pParam)
 Changes all contours in the selection to inner contours.

Static Public Member Functions

static BOOL Declare ()
 Adds the operation to the list of all known operations.
static OpState GetState (String_256 *Description, OpDescriptor *)
 Find out the state of the new regular shape at the specific time.

Detailed Description

Changes all contours to inner - used by the button on the infobar.

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

Definition at line 409 of file opcntr.h.


Constructor & Destructor Documentation

OpChangeContourToInner::OpChangeContourToInner  ) 
 

Constructor.

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

Definition at line 1972 of file opcntr.cpp.

01973 {
01974     //TRACEUSER( "MarkH", _T("Just Made a OpChangeContourWidth Class!\n"));
01975 }

OpChangeContourToInner::~OpChangeContourToInner  ) 
 

Destructor.

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

Definition at line 1986 of file opcntr.cpp.

01987 {
01988     //TRACEUSER( "MarkH", _T("Just Killed OpChangeContourToInner Class!!!\n"));
01989 }


Member Function Documentation

BOOL OpChangeContourToInner::Declare  )  [static]
 

Adds the operation to the list of all known operations.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
Returns:
TRUE if all went OK, False otherwise

Definition at line 2155 of file opcntr.cpp.

02156 {
02157     return (RegisterOpDescriptor(
02158                                 0, 
02159                                 _R(IDS_OP_CONTOURINNER),
02160                                 CC_RUNTIME_CLASS(OpChangeContourToInner), 
02161                                 OPTOKEN_CHANGECONTOUR_INNER,
02162                                 OpChangeContourToInner::GetState,
02163                                 0,
02164                                 _R(IDBBL_CONTOURINNER)
02165                                 ));
02166 
02167 }

void OpChangeContourToInner::Do OpDescriptor pOpDesc  )  [virtual]
 

The do function. Applys a Bevel to the selection in the current document.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/8/99
Parameters:
pOpDesc - OpDescriptor - unused [INPUTS]
- [OUTPUTS]
Returns:
-

Reimplemented from Operation.

Definition at line 2003 of file opcntr.cpp.

02004 {
02005     TRACEUSER( "DavidM", _T("OpChangeContourToInner - Do !\n"));
02006     BeginSlowJob(-1, TRUE);
02007     DoStartSelOp(TRUE, TRUE);
02008 
02009     // get all the contour nodes in the selection
02010     List ContourList;
02011 
02012     BevelTools::BuildListOfSelectedNodes(&ContourList, CC_RUNTIME_CLASS(NodeContourController),
02013         TRUE);
02014 
02015     NodeListItem * pItem = (NodeListItem *)ContourList.GetHead();
02016 
02017     ChangeContourToInnerAction * pAction = NULL;
02018 
02019     NodeContourController * pControl = NULL;
02020 
02021     BOOL ok = TRUE;
02022 
02023     Document * pDoc = Document::GetCurrent();
02024 
02025     // set up the object changed param
02026     ObjChangeFlags flgs(FALSE, FALSE, FALSE, TRUE);
02027     flgs.RegenerateNode = TRUE;
02028     ObjChangeParam MyObjChangeParam(OBJCHANGE_FINISHED, flgs, NULL, this, OBJCHANGE_CALLEDBYOP);
02029 
02030     Node * pParent = NULL;
02031 
02032     // run through the list, changing all widths to be positive
02033     while (pItem && ok)
02034     {
02035         if (pItem->pNode)
02036         {
02037             pControl = (NodeContourController *)pItem->pNode;
02038 
02039             if (pControl->GetWidth() < 0)
02040             {
02041                 // redraw the node
02042                 if (pDoc)
02043                     pDoc->ForceRedraw(pControl->FindParentSpread(), pControl->GetBoundingRect(), FALSE, pControl);
02044 
02045                 // and invalidate all parents' rectangles
02046                 pParent = pControl->FindParent();
02047                 pControl->ReleaseCached();      // Associated with DoInvalidateRegion, does parents itself
02048 
02049                 while (pParent)
02050                 {
02051                     if (pParent->IsAnObject())
02052                     {
02053                         DoInvalidateRegion(pParent->FindParentSpread(), ((NodeRenderableInk *)pParent)->GetBoundingRect());
02054                     }
02055 
02056                     pParent = pParent->FindParent();
02057                 }               
02058 
02059                 // check for maximum width
02060                 MILLIPOINT MaxWidth = 
02061                     ContourNodePathProcessor::GetMaxInnerContourWidth(pControl);
02062 
02063                 if (ChangeContourToInnerAction::Init(this, this->GetUndoActionList(),
02064                     pControl, &pAction) != AC_OK)
02065                 {
02066                     ok = FALSE;
02067                 }
02068 
02069                 // set the width to positive
02070                 pControl->SetWidth(-pControl->GetWidth());
02071 
02072                 if (pControl->GetWidth() > MaxWidth)
02073                     pControl->SetWidth(MaxWidth);
02074 
02075                 // move the node
02076                 if (ok)
02077                 {
02078                     Node * pContourNode = pControl->FindFirstChild(CC_RUNTIME_CLASS(NodeContour));
02079 
02080                     if (pContourNode)
02081                     {
02082                         Node * pInsertNode = pControl->FindLastChild(CC_RUNTIME_CLASS(NodeRenderableInk));
02083 
02084                         if (pInsertNode != pContourNode)
02085                             ok = DoMoveNode(pContourNode, pInsertNode, NEXT);
02086                     }
02087                 }
02088 
02089                 // regenerate the node
02090                 pControl->RegenerateNode(NULL, FALSE);
02091 
02092                 // Ilan 7/5/00
02093                 // Inform geom linked attrs of the change. Nb outside the normal AllowOp mechanism
02094                 NodeAttribute* pNA = pControl->FindFirstGeometryLinkedAttr();
02095                 while(pNA)
02096                 {
02097                     pNA->LinkedNodeGeometryHasChanged(this);
02098                     pNA = pNA->FindNextGeometryLinkedAttr();
02099                 }
02100 
02101                 // redraw the node
02102                 if (pDoc)
02103                     pDoc->ForceRedraw(pControl->FindParentSpread(), pControl->GetBoundingRect(), FALSE, pControl);
02104             }
02105         }
02106 
02107         pItem = (NodeListItem *)ContourList.GetNext(pItem);
02108     }
02109 
02110     ContourList.DeleteAll();
02111 
02112     if (!ok)
02113     {
02114         FailAndExecute();
02115         End();
02116         return;
02117     }
02118     
02119     End();
02120 }

void OpChangeContourToInner::DoWithParam OpDescriptor pOp,
OpParam pParam
[virtual]
 

Changes all contours in the selection to inner contours.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/8/99
Parameters:
[INPUTS] 
- [OUTPUTS]
Returns:
-

Reimplemented from Operation.

Definition at line 2134 of file opcntr.cpp.

02135 {
02136     // first, begin the operation
02137     BeginSlowJob(-1, TRUE);
02138     DoStartSelOp(TRUE, TRUE);
02139 
02140 
02141     
02142     End();
02143 }

OpState OpChangeContourToInner::GetState String_256 Description,
OpDescriptor
[static]
 

Find out the state of the new regular shape at the specific time.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
Parameters:
- [OUTPUTS]
Returns:
Ungreyed, Unticked

Definition at line 2182 of file opcntr.cpp.

02183 {
02184     OpState Blobby;
02185 
02186     TRACEUSER( "DavidM", _T("OpChangeContourToInner - get state !\n"));
02187 
02188     if (Description)
02189     {
02190         Description->Load(_R(IDS_CONTOURINNEROPNAME));
02191     }
02192 
02193     return Blobby;
02194 }


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