OpReversePath Class Reference

#include <pathops.h>

Inheritance diagram for OpReversePath:

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

Public Member Functions

 OpReversePath ()
 Construct an object of this type.
 ~OpReversePath ()
 Destruct an object of this type.
void Do (OpDescriptor *)
 Does the work of reversing the paths.

Static Public Member Functions

static BOOL Init ()
 OpMakeSegmentsLines initialiser method.
static OpState GetState (String_256 *Description, OpDescriptor *)
 Determines the state of the op.

Detailed Description

Definition at line 388 of file pathops.h.


Constructor & Destructor Documentation

OpReversePath::OpReversePath  ) 
 

Construct an object of this type.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/5/2000
Parameters:
- [INPUTS]

Definition at line 1152 of file pathops.cpp.

01153 {
01154 }

OpReversePath::~OpReversePath  ) 
 

Destruct an object of this type.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/5/2000
Parameters:
- [INPUTS]

Definition at line 1169 of file pathops.cpp.

01170 {
01171 }


Member Function Documentation

void OpReversePath::Do OpDescriptor  )  [virtual]
 

Does the work of reversing the paths.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/5/2000
Parameters:
OpDescriptor (unused) [INPUTS]

Reimplemented from Operation.

Definition at line 1273 of file pathops.cpp.

01274 {
01275     // Obtain the current selections and the first node in the selection
01276     SelRange* Selected = GetApplication()->FindSelection();
01277     BOOL ok = (Selected != NULL);
01278 
01279     // Start the op
01280     BeginSlowJob();
01281     if (ok)
01282         ok = DoStartSelOp(TRUE,TRUE);
01283 
01284     // Check with the selrange it is ok to run this op
01285     ObjChangeFlags cFlags;
01286     ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,this);
01287     if (ok)
01288     {
01289         if (!Selected->AllowOp(&ObjChange))
01290         {
01291             EndSlowJob();
01292             FailAndExecute();
01293             End();
01294             return;
01295         }
01296     }
01297 
01298     Node* pNode = Selected->FindFirst();
01299     NodePath* ThisPath = NULL;
01300 
01301     //Document* pDocument = GetWorkingDoc();
01302 
01303     while (ok && (pNode != NULL))
01304     {   // we're only interested in NodePaths which have selected points
01305         BOOL DoThisNode = pNode->IsNodePath();
01306         //if (DoThisNode)
01307         //  DoThisNode = (((NodePath*)pNode)->InkPath.IsSubSelection());
01308         if (DoThisNode)
01309             DoThisNode = (((NodePath*)pNode)->IsPathAllowable());
01310 
01311         if  ( DoThisNode )
01312         {
01313             // for convenience, cast the pointer to a pointer to a NodePath
01314             ThisPath = (NodePath*)pNode;
01315 
01316             // First get pointers to the arrays
01317             PathVerb* Verbs = NULL;
01318             PathFlags* Flags = NULL;
01319             DocCoord* Coords = NULL;
01320             ThisPath->InkPath.GetPathArrays(&Verbs, &Coords, &Flags);
01321             INT32 NumCoords = ThisPath->InkPath.GetNumCoords();
01322 //          BOOL PrevSelected = FALSE;
01323 //          INT32 PrevPos = 0;
01324 
01325             ObjChangeFlags cFlags;
01326             cFlags.TransformNode = TRUE;
01327             ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,ThisPath,this);
01328             if (!ThisPath->AllowOp(&ObjChange, TRUE))
01329             {
01330                 return;
01331             }
01332 
01333             // Set the NeedToRender flags
01334             for (INT32 loop = 0; loop < NumCoords; loop++)
01335             {
01336                 if (Flags[loop].IsEndPoint && Flags[loop].IsSelected)
01337                     Flags[loop].NeedToRender = TRUE;
01338                 else
01339                     Flags[loop].NeedToRender = FALSE;
01340             }
01341 
01342             // Force a re-draw of the place where the path used to be
01343             if (ok)
01344                 ok = (RecalcBoundsAction::DoRecalc(this, &UndoActions, ThisPath, TRUE) != AC_FAIL);
01345 
01346             DoReversePath (ThisPath);
01347 
01348             // Force a redraw of the place where the path is now.
01349             if (ok)
01350                 ok = (RecordBoundsAction::DoRecord(this, &UndoActions, ThisPath, TRUE) != AC_FAIL);
01351         }
01352         pNode = Selected->FindNext(pNode);
01353     }
01354 
01355     if (ok)
01356     {
01357         ObjChange.Define(OBJCHANGE_FINISHED,cFlags,NULL,this);
01358         if (!UpdateChangedNodes(&ObjChange))
01359         {
01360             FailAndExecute();
01361             End();
01362             return;
01363         }
01364     }
01365 
01366     EndSlowJob();
01367 
01368     if (!ok)
01369     {   
01370         FailAndExecute();
01371         InformError();
01372     }
01373 
01374     End();
01375 }

OpState OpReversePath::GetState String_256 Description,
OpDescriptor
[static]
 

Determines the state of the op.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/2/2000
Returns:
Ungreyed, Unticked

Definition at line 1214 of file pathops.cpp.

01215 {
01216     OpState OpSt;
01217 
01218     SelRange*   Selected = GetApplication ()->FindSelection ();
01219 
01220     if ((Document::GetSelected () == NULL) || (Selected == NULL) )
01221     {   // There is no selected document or selrange is invalid 
01222         OpSt.Greyed = TRUE;
01223         return (OpSt);
01224     }
01225 
01226     if (Selected->Count () == 0)    // if there ain't no selection - return cause we ain't
01227                                     // going to be reversing anything
01228     {
01229         OpSt.Greyed = TRUE;
01230         return (OpSt);
01231     }
01232 
01233     Node* pNode = Selected->FindFirst ();
01234 
01235     // scan the selection and if even a single DoThisNode fails, then return that the op
01236     // is greyed immediately ....
01237 
01238     while (pNode != NULL)
01239     {   // we're only interested in NodePaths which have selected points
01240         BOOL DoThisNode = pNode->IsNodePath ();
01241         //if (DoThisNode)
01242         //  DoThisNode = (((NodePath*)pNode)->InkPath.IsSubSelection());
01243         if (DoThisNode)
01244             DoThisNode = (((NodePath*)pNode)->IsPathAllowable ());
01245 
01246         if (DoThisNode)
01247         {
01248             pNode = Selected->FindNext (pNode);
01249         }
01250         else
01251         {
01252             pNode = NULL;
01253             OpSt.Greyed = TRUE;
01254         }
01255     }
01256 
01257     return (OpSt);
01258 }

BOOL OpReversePath::Init void   )  [static]
 

OpMakeSegmentsLines initialiser method.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/5/2000
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.

Reimplemented from SimpleCCObject.

Definition at line 1189 of file pathops.cpp.

01190 {
01191     return (RegisterOpDescriptor(   0, 
01192                                     _R(IDS_MAKEREVERSE),
01193                                     CC_RUNTIME_CLASS(OpReversePath), 
01194                                     OPTOKEN_REVERSEPATH,
01195                                     OpReversePath::GetState,
01196                                     0,  /* help ID */
01197                                     _R(IDBBL_MAKEREVERSE),
01198                                     0   /* bitmap ID */));
01199 }               


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