OpChangeContourStepDistance Class Reference

This changes the step distance of the selected blends. More...

#include <opcntr.h>

Inheritance diagram for OpChangeContourStepDistance:

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

Public Member Functions

 OpChangeContourStepDistance ()
 ~OpChangeContourStepDistance ()
virtual void DoWithParam (OpDescriptor *, OpParam *pOpParam)
 This changes all the selected blend objects to have pOpParam->Param1 number of steps.
virtual void GetOpName (String_256 *OpName)
 The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies.
virtual BOOL MayChangeNodeBounds () const

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 operation at the specific time.

Private Member Functions

 CC_DECLARE_DYNCREATE (OpChangeContourStepDistance)

Detailed Description

This changes the step distance of the selected blends.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/11/94

Definition at line 747 of file opcntr.h.


Constructor & Destructor Documentation

OpChangeContourStepDistance::OpChangeContourStepDistance  )  [inline]
 

Definition at line 753 of file opcntr.h.

00753 {}

OpChangeContourStepDistance::~OpChangeContourStepDistance  )  [inline]
 

Definition at line 754 of file opcntr.h.

00754 {}


Member Function Documentation

OpChangeContourStepDistance::CC_DECLARE_DYNCREATE OpChangeContourStepDistance   )  [private]
 

BOOL OpChangeContourStepDistance::Declare  )  [static]
 

Adds the operation to the list of all known operations.

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

Definition at line 3839 of file opcntr.cpp.

03840 {
03841     return (RegisterOpDescriptor(
03842                                 0, 
03843                                 0,
03844                                 CC_RUNTIME_CLASS(OpChangeContourStepDistance), 
03845                                 OPTOKEN_CHANGECONTOURSTEPDISTANCE,
03846                                 OpChangeContourStepDistance::GetState,
03847                                 0,  /* help ID */
03848                                 0,  /* bubble ID */
03849                                 0   /* bitmap ID */
03850                                 ));
03851 }

void OpChangeContourStepDistance::DoWithParam OpDescriptor ,
OpParam pOpParam
[virtual]
 

This changes all the selected blend objects to have pOpParam->Param1 number of steps.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/11/94
Returns:
-

Reimplemented from Operation.

Definition at line 3726 of file opcntr.cpp.

03727 {
03728     ERROR3IF(pOpParam == NULL,"NULL OpParam ptr");
03729     if (pOpParam == NULL) return;
03730 
03731     List NodeList;
03732     BevelTools::BuildListOfSelectedNodes(&NodeList, CC_RUNTIME_CLASS(NodeRenderableInk));
03733 
03734     NodeListItem *pItem = NULL;
03735 
03736     BOOL ok = !NodeList.IsEmpty();
03737 
03738     if (ok) ok = DoStartSelOp(FALSE,FALSE);
03739 
03740     if (ok)
03741     {
03742         // The new number of steps is in pOpParam->Param1 of the 
03743         INT32 NewStepDistance = INT32(pOpParam->Param1);
03744         pItem = (NodeListItem *)NodeList.GetHead();
03745 
03746         Node* pSelNode = NULL;
03747 
03748         if (pItem)
03749         {
03750             pSelNode = pItem->pNode;
03751         }
03752 
03753         while (pSelNode != NULL && ok)
03754         {
03755             Node* pNode = pSelNode;
03756 
03757             pItem = (NodeListItem *)NodeList.GetNext(pItem);
03758 
03759             if (pItem)
03760             {
03761                 pSelNode = pItem->pNode;
03762             }
03763             else
03764             {
03765                 pSelNode = NULL;
03766             }
03767 
03768             if (pNode->IS_KIND_OF(NodeContourController))
03769             {
03770                 // We now have a selected blend node so:
03771                 //  Invalidate the node's region
03772                 //  Store the current number of blend steps in an undo actiom
03773                 //  Change the number of steps to NewNumSteps
03774             
03775                 NodeRenderableInk * pInk = (NodeRenderableInk *)pNode;
03776 
03777                 UINT32 NumSteps = 0;
03778                 double DistanceEntered = 0.0;
03779                 NumSteps = ((NodeContourController *)pNode)->GetNumberOfSteps();
03780                 DistanceEntered = 0.0;
03781                 
03782                 ChangeContourStepsAction* pAction;
03783 
03784                 // Ask the node if it's ok to do the op
03785                 ObjChangeFlags cFlags;
03786                 ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,this);
03787                 ok = pInk->AllowOp(&ObjChange);
03788 
03789                 if (ok) ok = DoInvalidateNodeRegion(pInk,TRUE,FALSE);
03790                 if (ok) ok = (InvalidateBoundsAction::Init(this,&UndoActions,pInk,TRUE) != AC_FAIL);
03791                 if (ok) ok = ChangeContourStepsAction::Init(this,&UndoActions,pInk,NumSteps, DistanceEntered, &pAction) != AC_FAIL;
03792                 
03793                 if (ok)
03794                 {
03795                     if (abs(((NodeContourController *)pNode)->GetWidth()) < NewStepDistance * 2)
03796                     {
03797                         ((NodeContourController *)pNode)->SetNumberOfSteps(0);
03798                     }
03799                     else
03800                     {
03801                         ((NodeContourController *)pNode)->SetNumberOfSteps(
03802                             (abs(((NodeContourController *)pNode)->GetWidth()) / NewStepDistance) - 1);
03803                     }
03804                     pNode->RegenerateNode(NULL, FALSE);
03805                 }
03806                 
03807                 if (ok) ok = DoInvalidateNodeRegion(pInk,TRUE,FALSE);
03808                 if (ok) ok = (InvalidateBoundsAction::Init(this,&UndoActions,pInk,TRUE) != AC_FAIL);
03809             }
03810         }
03811     }
03812 
03813     NodeList.DeleteAll();
03814 
03815     if (ok) 
03816     {
03817         // Inform the effected parents of the change
03818         ObjChangeFlags cFlags;
03819         ObjChangeParam ObjChange(OBJCHANGE_FINISHED,cFlags,NULL,this);
03820         UpdateChangedNodes(&ObjChange);
03821     }
03822     else
03823         FailAndExecute();
03824 
03825     End();
03826 }

void OpChangeContourStepDistance::GetOpName String_256 OpName  )  [virtual]
 

The GetOpName fn is overridden so that we return back a description appropriate to the type of attribute that the operation applies.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/11/94
Parameters:
- [INPUTS]
The undo string for the operation [OUTPUTS]
Returns:

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 3908 of file opcntr.cpp.

03909 { 
03910     *OpName = String_256(_R(IDS_CONTOURSTEPS_UNDO));
03911 }  

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

Find out the state of the operation at the specific time.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/11/94
Parameters:
Description - GetState fills this string with an approriate description [OUTPUTS] of the current state of the operation
Returns:
The state of the operation, so that menu items (ticks and greying) can be done properly

Definition at line 3868 of file opcntr.cpp.

03869 {
03870     OpState State(FALSE,TRUE); // It's not ticked, but it is greyed by default
03871     
03872     // DMc - to test for bevels & contours
03873     // are there any contour nodes in the selection
03874     List NodeList;
03875     BevelTools::BuildListOfSelectedNodes(&NodeList, CC_RUNTIME_CLASS(NodeContourController));
03876 
03877     if (!NodeList.IsEmpty())
03878     {
03879         State.Greyed = FALSE;
03880     }
03881 
03882     NodeList.DeleteAll();
03883 
03884     if (State.Greyed)
03885         *Description = String_256(_R(IDS_CONTOURSTEPS));
03886     else
03887         *Description = String_256(_R(IDS_CONTOURSTEPS));
03888 
03889     return State;
03890 }

virtual BOOL OpChangeContourStepDistance::MayChangeNodeBounds  )  const [inline, virtual]
 

Reimplemented from SelOperation.

Definition at line 765 of file opcntr.h.

00765 { return FALSE; }


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