OpShapeToggleSetNumSides Class Reference

This class is an operation that sets the number of sides of all selected QuickShapes. More...

#include <shapeops.h>

Inheritance diagram for OpShapeToggleSetNumSides:

SelOperation UndoableOperation Operation MessageHandler ListItem CCObject SimpleCCObject OpShapeToggleSetNumSides10 OpShapeToggleSetNumSides3 OpShapeToggleSetNumSides4 OpShapeToggleSetNumSides5 OpShapeToggleSetNumSides6 OpShapeToggleSetNumSides7 OpShapeToggleSetNumSides8 OpShapeToggleSetNumSides9 List of all members.

Public Member Functions

 OpShapeToggleSetNumSides ()
 Constructs an OpShapeToggleSetNumSides object.

Static Public Member Functions

static OpState GetState (String_256 *, OpDescriptor *)
 Find the state of the OpShapeToggleCurvature operation.
static BOOL Init ()
 Initialise the set number of sides operation by registering it.

Protected Member Functions

BOOL DoAction (INT32 NewNumSides)
 Sets the number of sides of a shape.

Detailed Description

This class is an operation that sets the number of sides of all selected QuickShapes.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/04/95
See also:
-

Definition at line 623 of file shapeops.h.


Constructor & Destructor Documentation

OpShapeToggleSetNumSides::OpShapeToggleSetNumSides  ) 
 

Constructs an OpShapeToggleSetNumSides object.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/04/95

Definition at line 3937 of file shapeops.cpp.

03937                                                   : SelOperation()
03938 {
03939 }


Member Function Documentation

BOOL OpShapeToggleSetNumSides::DoAction INT32  NumSides  )  [protected]
 

Sets the number of sides of a shape.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/4/95
Parameters:
NumSides - the number of sides to set the shape to [INPUTS]
- [OUTPUTS]
Returns:
TRUE/FALSE for successful toggle

Errors: -

See also:
-

Definition at line 4076 of file shapeops.cpp.

04077 {
04078     BOOL ok = DoStartSelOp(FALSE,FALSE);
04079 
04080     ObjChangeParam ObjChange(OBJCHANGE_STARTING,ObjChangeFlags(), NULL, this);
04081     SelRange* Selection = GetApplication()->FindSelection();
04082     Node* pNode = Selection->FindFirst();
04083 
04084     while (ok && (pNode != NULL)) 
04085     {
04086         if (IS_A(pNode,NodeRegularShape))
04087         {
04088             NodeRegularShape* pShape = (NodeRegularShape*)pNode;
04089         
04090             if (pShape->AllowOp(&ObjChange) && !pShape->IsCircular())
04091             {
04092                 // Record the bounds
04093                 if (ok)
04094                     ok = (RecalcBoundsAction::DoRecalc(this, &UndoActions, pShape) != AC_FAIL);
04095                 
04096                 // Change the shape
04097                 ok = (ChangeShapeDataAction::DoToggle(this, &UndoActions, pShape, 
04098                             ChangeShapeDataAction::CHANGE_NUMSIDES, pShape->GetNumSides()) != AC_FAIL);
04099                 if (ok)
04100                     pShape->SetNumSides(NumSides);
04101 
04102                 // Invalidate the shapes bounding rect as it's changed
04103                 if (ok)
04104                 {
04105                     pShape->InvalidateBoundingRect();
04106                     pShape->InvalidateCache();
04107                 }
04108 
04109                 // And redraw its final state
04110                 if (ok)
04111                     ok = (RecordBoundsAction::DoRecord(this, &UndoActions, pShape) != AC_FAIL);
04112 
04113                 // Say we have finished
04114                 if (ok)
04115                 {
04116                     ObjChange.Define(OBJCHANGE_FINISHED,ObjChangeFlags(),NULL,this);
04117                     ok = UpdateChangedNodes(&ObjChange);
04118                 }
04119             }
04120         }
04121 
04122         pNode = Selection->FindNext(pNode);
04123     }
04124 
04125     if (!ok)
04126     {
04127         InformError();
04128         FailAndExecute();
04129     }
04130 
04131     End();
04132 
04133     return ok;
04134 }

OpState OpShapeToggleSetNumSides::GetState String_256 UIDescription,
OpDescriptor
[static]
 

Find the state of the OpShapeToggleCurvature operation.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/04/95
Parameters:
UIDescription - the name of the opertaion to display [INPUTS] OpDescriptor - To help update the state
UIDescription - The name of the operation [OUTPUTS]
Returns:
The state of the operation

Errors: -

See also:
-

Definition at line 3959 of file shapeops.cpp.

03960 {
03961     OpState OpSt; 
03962 
03963     BOOL FoundEditable = FALSE;
03964     ObjChangeParam ObjChange(OBJCHANGE_STARTING,ObjChangeFlags(),NULL,NULL);
03965 
03966     SelRange* pSelection = GetApplication()->FindSelection();
03967     Node* pNode = pSelection->FindFirst();
03968 
03969     while (pNode != NULL)
03970     {
03971         if (IS_A(pNode, NodeRegularShape))
03972         {
03973             NodeRegularShape* pShape = (NodeRegularShape*)pNode;
03974         
03975             // Convert this shape if it's parents allow
03976             if (pNode->AllowOp(&ObjChange) && !pShape->IsCircular())
03977                 FoundEditable = TRUE;
03978         }
03979 
03980         // Get the next selected thing
03981         pNode = pSelection->FindNext(pNode);
03982     }  
03983 
03984     if (!FoundEditable)
03985         OpSt.Greyed = TRUE;
03986 
03987     return OpSt;    
03988 }                                    

BOOL OpShapeToggleSetNumSides::Init void   )  [static]
 

Initialise the set number of sides operation by registering it.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE/FALSE for successful init

Errors: -

See also:
-

Reimplemented from SimpleCCObject.

Definition at line 4007 of file shapeops.cpp.

04008 {
04009     BOOL ok = TRUE;
04010     
04011     ok = ok && RegisterOpDescriptor(0, 
04012                                     _R(IDS_QUICKSHAPES_NUMBERSIDES),
04013                                     CC_RUNTIME_CLASS(OpShapeToggleSetNumSides), 
04014                                     OPTOKEN_QUICKSHAPE_NUMBERSIDES,
04015                                     OpShapeToggleSetNumSides::GetState); 
04016     ok = ok && RegisterOpDescriptor(0, 
04017                                     _R(IDS_QUICKSHAPES_NUMBERSIDES3),
04018                                     CC_RUNTIME_CLASS(OpShapeToggleSetNumSides3), 
04019                                     OPTOKEN_QUICKSHAPE_NUMBERSIDES3,
04020                                     OpShapeToggleSetNumSides::GetState); 
04021     ok = ok && RegisterOpDescriptor(0, 
04022                                     _R(IDS_QUICKSHAPES_NUMBERSIDES4),
04023                                     CC_RUNTIME_CLASS(OpShapeToggleSetNumSides4), 
04024                                     OPTOKEN_QUICKSHAPE_NUMBERSIDES4,
04025                                     OpShapeToggleSetNumSides::GetState); 
04026     ok = ok && RegisterOpDescriptor(0, 
04027                                     _R(IDS_QUICKSHAPES_NUMBERSIDES5),
04028                                     CC_RUNTIME_CLASS(OpShapeToggleSetNumSides5), 
04029                                     OPTOKEN_QUICKSHAPE_NUMBERSIDES5,
04030                                     OpShapeToggleSetNumSides::GetState); 
04031     ok = ok && RegisterOpDescriptor(0, 
04032                                     _R(IDS_QUICKSHAPES_NUMBERSIDES6),
04033                                     CC_RUNTIME_CLASS(OpShapeToggleSetNumSides6), 
04034                                     OPTOKEN_QUICKSHAPE_NUMBERSIDES6,
04035                                     OpShapeToggleSetNumSides::GetState); 
04036     ok = ok && RegisterOpDescriptor(0, 
04037                                     _R(IDS_QUICKSHAPES_NUMBERSIDES7),
04038                                     CC_RUNTIME_CLASS(OpShapeToggleSetNumSides7), 
04039                                     OPTOKEN_QUICKSHAPE_NUMBERSIDES7,
04040                                     OpShapeToggleSetNumSides::GetState); 
04041     ok = ok && RegisterOpDescriptor(0, 
04042                                     _R(IDS_QUICKSHAPES_NUMBERSIDES8),
04043                                     CC_RUNTIME_CLASS(OpShapeToggleSetNumSides8), 
04044                                     OPTOKEN_QUICKSHAPE_NUMBERSIDES8,
04045                                     OpShapeToggleSetNumSides::GetState); 
04046     ok = ok && RegisterOpDescriptor(0, 
04047                                     _R(IDS_QUICKSHAPES_NUMBERSIDES9),
04048                                     CC_RUNTIME_CLASS(OpShapeToggleSetNumSides9), 
04049                                     OPTOKEN_QUICKSHAPE_NUMBERSIDES9,
04050                                     OpShapeToggleSetNumSides::GetState); 
04051     ok = ok && RegisterOpDescriptor(0, 
04052                                     _R(IDS_QUICKSHAPES_NUMBERSIDES10),
04053                                     CC_RUNTIME_CLASS(OpShapeToggleSetNumSides10), 
04054                                     OPTOKEN_QUICKSHAPE_NUMBERSIDES10,
04055                                     OpShapeToggleSetNumSides::GetState); 
04056 
04057     return ok;
04058 }


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