OpMakeShapes Class Reference

This class represents the MakeShapes operation. More...

#include <mkshapes.h>

Inheritance diagram for OpMakeShapes:

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

Public Member Functions

 OpMakeShapes ()
 OpMakeShapes constructor.
void Do (OpDescriptor *)
 Performs the MakeShapes operation.

Static Public Member Functions

static BOOL Init ()
 OpMakeShapes initialiser method.
static OpState GetState (String_256 *, OpDescriptor *)
 For finding the OpMakeShapes's state.

Detailed Description

This class represents the MakeShapes operation.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/7/93

Definition at line 120 of file mkshapes.h.


Constructor & Destructor Documentation

OpMakeShapes::OpMakeShapes  ) 
 

OpMakeShapes constructor.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/04/94

Definition at line 134 of file mkshapes.cpp.

00134                           : SelOperation()                              
00135 {                              
00136 }


Member Function Documentation

void OpMakeShapes::Do OpDescriptor  )  [virtual]
 

Performs the MakeShapes operation.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/04/94
Parameters:
OpDescriptor (unused) [INPUTS]
- [OUTPUTS]
Returns:
-

Reimplemented from Operation.

Definition at line 219 of file mkshapes.cpp.

00220 {   
00221     // Obtain the current selections 
00222     Range Selection(*GetApplication()->FindSelection());
00223     RangeControl rg = Selection.GetRangeControlFlags();
00224     rg.PromoteToParent = TRUE;
00225     Selection.Range::SetRangeControl(rg);
00226 
00227     // change the selection flags
00228 
00229     Node* CurrentNode = Selection.FindFirst(); 
00230     BOOL Success = TRUE;        
00231     
00232     ERROR3IF(CurrentNode == NULL, "Make shapes called with no nodes selected"); 
00233     
00234     if (CurrentNode != NULL) // No nodes selected so End
00235     {   
00236         // We need to invalidate the region
00237         if (Success)
00238             Success = DoInvalidateNodesRegions(Selection, TRUE, FALSE, FALSE, FALSE);   // Don't recache
00239                     
00240         // Try to record the selection state, don't render the blobs though 
00241         if (Success)
00242             Success = DoStartSelOp(FALSE,FALSE);                                   
00243 
00244         // The DoMakeShapes function does all the work
00245         while (Success && CurrentNode!=NULL)
00246         {
00247             Node* Next = Selection.FindNext(CurrentNode);
00248 
00249 // BODGE - since the group is selected and won't be replaced by anything else, no need to reselect it
00250 // this fixes a bug where make shapes on grouped text stories/molds/blends don't leave the parent group
00251 // selected but selects the objects inside!
00252             BOOL reselect = !IS_A(CurrentNode,NodeGroup) && !IS_A(CurrentNode,NodeBlend);
00253 //          BOOL ok = TRUE;
00254         
00255 
00256             ObjChangeFlags cFlags(TRUE);
00257             ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,NULL);
00258             if (CurrentNode->AllowOp(&ObjChange))
00259             {
00260                 BecomeA BecomeAPath(BECOMEA_REPLACE,CC_RUNTIME_CLASS(NodePath), this, reselect);
00261                 BecomeAPath.SetResultsStayInPlace(TRUE);
00262                 Success = CurrentNode->DoBecomeA(&BecomeAPath);
00263             }
00264     
00265             CurrentNode = Next;
00266         }
00267 
00268         // We need to invalidate the region again for the new positions
00269         GetApplication()->FindSelection()->Update();
00270         if (Success)
00271             Success = DoInvalidateNodesRegions(*GetApplication()->FindSelection(), TRUE);
00272     }                   
00273 
00274     if (!Success)
00275     {
00276         InformError();
00277         FailAndExecute();
00278     }
00279 
00280     End(); 
00281 }           

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

For finding the OpMakeShapes's state.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/04/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The state of the OpMakeShapes

Definition at line 186 of file mkshapes.cpp.

00187 {
00188     OpState OpSt;
00189 
00190     SelRange Sel(*(GetApplication()->FindSelection())); 
00191     RangeControl rg = Sel.GetRangeControlFlags();
00192     rg.PromoteToParent = TRUE;
00193     Sel.Range::SetRangeControl(rg);
00194 
00195 
00196     // Set up the ObjChangeParam so we can ask the selected nodes if they mind being deleted
00197     ObjChangeFlags cFlags(TRUE);
00198     ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,NULL);
00199 
00200     // Will one or more selected nodes allow this op?
00201     if (!Sel.AllowOp(&ObjChange,FALSE))
00202         OpSt.Greyed = TRUE;
00203 
00204     return(OpSt);   
00205 }

BOOL OpMakeShapes::Init void   )  [static]
 

OpMakeShapes initialiser method.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/04/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the operation could be successfully initialised FALSE if no more memory could be allocated

Errors: ERROR will be called if there was insufficient memory to allocate the operation.

See also:
-

Reimplemented from SimpleCCObject.

Definition at line 155 of file mkshapes.cpp.

00156 {
00157     return (RegisterOpDescriptor(0,                         // tool id
00158                                 _R(IDS_MAKESHAPESOP),           // Ops name
00159                                 CC_RUNTIME_CLASS(OpMakeShapes), // Ops class
00160                                 OPTOKEN_MAKE_SHAPES,        // Op token
00161                                 OpMakeShapes::GetState,     // Get state function
00162                                 0,                          // help ID
00163                                 _R(IDBBL_MAKESHAPES),           // Bubble help
00164                                 0,                          // Bitmap ID
00165                                 0,                          // Control ID
00166                                 SYSTEMBAR_ILLEGAL,          // Bar to appear on
00167                                 TRUE,                       // Recieve messages
00168                                 FALSE,                      // Smart
00169                                 FALSE,                      // Clean
00170                                 0,                          // One open string ID
00171     GREY_WHEN_NO_CURRENT_DOC | GREY_WHEN_NO_SELECTION | DONT_GREY_WHEN_SELECT_INSIDE));
00172 }


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