OpShapeToggleBase Class Reference

This is a base class for operations that toggle certain states of a QuickShape. More...

#include <shapeops.h>

Inheritance diagram for OpShapeToggleBase:

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

Public Member Functions

 OpShapeToggleBase ()
 Constructs an OpShapeToggleBase object.
void Do (OpDescriptor *)
 Runs through all selected Quickshapes, toggling their one of their member states.

Protected Member Functions

virtual BOOL DoAction (NodeRegularShape *pShape)

Detailed Description

This is a base class for operations that toggle certain states of a QuickShape.

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

Definition at line 519 of file shapeops.h.


Constructor & Destructor Documentation

OpShapeToggleBase::OpShapeToggleBase  ) 
 

Constructs an OpShapeToggleBase object.

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

Definition at line 3390 of file shapeops.cpp.

03390                                     : SelOperation()
03391 {
03392 }


Member Function Documentation

void OpShapeToggleBase::Do OpDescriptor  )  [virtual]
 

Runs through all selected Quickshapes, toggling their one of their member states.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/04/95
Parameters:
An Operation Descriptor (unused) [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 3411 of file shapeops.cpp.

03412 {
03413     // Start the operation
03414     BOOL Success = DoStartSelOp(FALSE, FALSE, FALSE, FALSE);
03415 
03416     // Check with our parent nodes
03417     ObjChangeParam ObjChange(OBJCHANGE_STARTING,ObjChangeFlags(),NULL,this);
03418 
03419     // Run through the selected nodes
03420     if (Success)
03421     {
03422         SelRange* pSelection = GetApplication()->FindSelection();
03423         Node* pNode = pSelection->FindFirst();
03424 
03425         while ((pNode != NULL) && Success)
03426         {
03427             if (IS_A(pNode, NodeRegularShape))
03428             {
03429                 NodeRegularShape* pShape = (NodeRegularShape*)pNode;
03430             
03431                 // Convert this shape if it's parents allow
03432                 if (pShape->AllowOp(&ObjChange))                
03433                 {
03434                     // Create an action to will cause the shape to recalc its bounds
03435                     if (Success)
03436                         Success = (RecalcBoundsAction::DoRecalc(this, &UndoActions, pShape) != AC_FAIL);
03437                     
03438                     // Toggle its ellipseness
03439                     if (Success)
03440                         Success = DoAction(pShape);
03441 
03442                     // Invalidate the shapes bounding rect as it's changed
03443                     if (Success)
03444                     {
03445                         pShape->InvalidateBoundingRect();
03446                         pShape->InvalidateCache();
03447                     }
03448 
03449                     // And redraw its final state
03450                     if (Success)
03451                         Success = (RecordBoundsAction::DoRecord(this, &UndoActions, pShape) != AC_FAIL);
03452 
03453                     // Tell our parents we have finished
03454                     if (Success)
03455                     {
03456                         ObjChange.Define(OBJCHANGE_FINISHED,ObjChangeFlags(),NULL,this);
03457                         Success = UpdateChangedNodes(&ObjChange);
03458                     }
03459                 }
03460             }
03461 
03462             // Get the next selected thing
03463             pNode = pSelection->FindNext(pNode);
03464         }
03465     }
03466 
03467     // Clean up after any failure
03468     if (!Success)
03469     {
03470         InformError();
03471         FailAndExecute();
03472     }
03473 
03474     End();
03475 }

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

Reimplemented in OpShapeToggleElipPoly, OpShapeToggleCurvature, and OpShapeToggleStellation.

Definition at line 3479 of file shapeops.cpp.

03480 {
03481     ERROR3("Should not call OpShapeToggleBase::DoAction"); 
03482     return FALSE;
03483 }


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