#include <shapeops.h>
Inheritance diagram for OpShapeToggleSetNumSides:
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. |
Definition at line 623 of file shapeops.h.
|
Constructs an OpShapeToggleSetNumSides object.
Definition at line 3937 of file shapeops.cpp. 03937 : SelOperation() 03938 { 03939 }
|
|
Sets the number of sides of a shape.
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 }
|
|
Find the state of the OpShapeToggleCurvature operation.
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 }
|
|