OpShapeToggleCurvature Class Reference

This class is an operation that toggles the curvature state of all selected QuickShapes. More...

#include <shapeops.h>

Inheritance diagram for OpShapeToggleCurvature:

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

Public Member Functions

 OpShapeToggleCurvature ()
 Constructs an OpShapeToggleCurvature object.

Static Public Member Functions

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

Protected Member Functions

BOOL DoAction (NodeRegularShape *pShape)
 Toggles the curvature state of a shape.

Detailed Description

This class is an operation that toggles the curvature state of all selected QuickShapes.

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

Definition at line 571 of file shapeops.h.


Constructor & Destructor Documentation

OpShapeToggleCurvature::OpShapeToggleCurvature  ) 
 

Constructs an OpShapeToggleCurvature object.

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

Definition at line 3785 of file shapeops.cpp.

03785                                               : OpShapeToggleBase()
03786 {
03787 }


Member Function Documentation

BOOL OpShapeToggleCurvature::DoAction NodeRegularShape pShape  )  [protected, virtual]
 

Toggles the curvature state of a shape.

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

Errors: -

See also:
-

Reimplemented from OpShapeToggleBase.

Definition at line 3899 of file shapeops.cpp.

03900 {
03901     BOOL Success = TRUE;
03902 
03903     // Do the primary curvature
03904     if (Success)
03905         Success = (ChangeShapeDataAction::DoToggle(this, &UndoActions, pShape,
03906                 ChangeShapeDataAction::CHANGE_PRIMARYCURVATURE, pShape->IsPrimaryCurvature() ? 1.0 : 0.0) != AC_FAIL);
03907     if (Success)
03908         pShape->SetPrimaryCurvature(!pShape->IsPrimaryCurvature());
03909 
03910     // Do the stellation curvature
03911     if (Success)
03912         Success = (ChangeShapeDataAction::DoToggle(this, &UndoActions, pShape,
03913                 ChangeShapeDataAction::CHANGE_STELLATIONCURVATURE, pShape->IsStellationCurvature() ? 1.0 : 0.0) != AC_FAIL);
03914     if (Success)
03915         pShape->SetStellationCurvature(!pShape->IsStellationCurvature());
03916 
03917     return Success;
03918 }

OpState OpShapeToggleCurvature::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 3807 of file shapeops.cpp.

03808 {
03809     OpState OpSt;  
03810     OpSt.Greyed = TRUE; 
03811     BOOL FoundCurved = FALSE;  
03812     BOOL FoundNotCurved = FALSE;
03813     BOOL AllEllipses = TRUE;
03814     ObjChangeFlags cFlags;
03815     ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,NULL);
03816 
03817     SelRange* pSelection = GetApplication()->FindSelection();
03818     Node* pNode = pSelection->FindFirst();
03819 
03820     while (pNode != NULL)
03821     {
03822         if (IS_A(pNode, NodeRegularShape))
03823         {
03824             NodeRegularShape* pShape = (NodeRegularShape*)pNode;
03825 
03826             AllEllipses = AllEllipses && pShape->IsCircular();
03827         
03828             // Convert this shape if it's parents allow
03829             if (pShape->AllowOp(&ObjChange))                
03830             {
03831                 if (pShape->IsPrimaryCurvature() && pShape->IsStellationCurvature())
03832                     FoundCurved = TRUE;
03833                 else
03834                     FoundNotCurved = TRUE;
03835             }
03836         }
03837 
03838         // Get the next selected thing
03839         pNode = pSelection->FindNext(pNode);
03840     }
03841 
03842     if (AllEllipses)
03843         UIDescription->Load(_R(IDS_REGSHAPE_ALLELLIPSES));
03844     else
03845     {
03846         if (FoundCurved || FoundNotCurved)
03847             OpSt.Greyed = FALSE;
03848         if (FoundCurved && !FoundNotCurved)
03849             UIDescription->Load(_R(IDS_OPSHAPETOGGLE_CURVE_REM));
03850         if (!FoundCurved && FoundNotCurved)
03851             UIDescription->Load(_R(IDS_OPSHAPETOGGLE_CURVE_ADD));
03852     }
03853 
03854     return(OpSt);   
03855 }                                    

BOOL OpShapeToggleCurvature::Init void   )  [static]
 

Initialise the toggle curvature 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 3874 of file shapeops.cpp.

03875 {
03876     return(RegisterOpDescriptor(0, 
03877                                 _R(IDS_OPSHAPETOGGLE_CURVE),
03878                                 CC_RUNTIME_CLASS(OpShapeToggleCurvature), 
03879                                 OPTOKEN_TOGGLECURVATURE,
03880                                 OpShapeToggleCurvature::GetState)); 
03881 }


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