OpAddPath Class Reference

The base class for various addpath operations. This is not really an operation in its own right as it does not provide an init and getstate function. Its use is to provide common functions required by distinct addpath operations. More...

#include <penedit.h>

Inheritance diagram for OpAddPath:

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

Public Member Functions

 OpAddPath ()
 OpAddPath constructor.

Protected Member Functions

ExecuteType AugmentPathWithPath (Path *, NodePath *, INT32)
 This operation is called to update an existing path. If successful it will create a new node, copy the contents of pElement into it and apply the current attributes to it.
ActionCode DeselectPoint (NodePath *pDestNode, INT32 position)
ActionCode DeselectHandle (NodePath *pDestNode, INT32 position)

Detailed Description

The base class for various addpath operations. This is not really an operation in its own right as it does not provide an init and getstate function. Its use is to provide common functions required by distinct addpath operations.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/10/94

Definition at line 520 of file penedit.h.


Constructor & Destructor Documentation

OpAddPath::OpAddPath  ) 
 

OpAddPath constructor.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/94
See also:
-

Definition at line 2435 of file penedit.cpp.

02436 {
02437     // dummy constructor for the moment.
02438 }


Member Function Documentation

ExecuteType OpAddPath::AugmentPathWithPath Path pSourcePath,
NodePath pDestinNode,
INT32  after
[protected]
 

This operation is called to update an existing path. If successful it will create a new node, copy the contents of pElement into it and apply the current attributes to it.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
Parameters:
SourcePath [INPUTS] DestinNode pNode = Pointer to nodepath in document to add element to pElement = Pointer to path element to add after = offset of verb (line, move, curve) after which to add element
- [OUTPUTS]

Definition at line 2462 of file penedit.cpp.

02463 {
02464 #ifndef STANDALONE
02465 
02466     // Get a pointer to the path object (makes reading easier)
02467     Path* pDestPath = &(pDestinNode->InkPath);
02468 
02469     PathFlags* Flags = pDestPath->GetFlagArray();
02470     PathVerb* Verbs = pDestPath->GetVerbArray();
02471     DocCoord* Coords = pDestPath->GetCoordArray();
02472 
02473     PathVerb AfterVerb = Verbs[after] & ~PT_CLOSEFIGURE;
02474 
02475     // Set the insert position (v important for path->makespace func)
02476     pDestPath->SetPathPosition(after+1);
02477 
02478     // calc how many coords in the insert path
02479     INT32 NumInSource = pSourcePath->GetNumCoords();
02480 
02481     // If we're undoing, create an action for this insert
02482     Action* UnAction;               // pointer to action that might be created
02483     ActionCode Act;                 // Action code that might be used
02484 
02485     // Remove selection from around this handle
02486     Act = DeselectHandle(pDestinNode, after);
02487     if (Act == AC_FAIL)
02488         return ExeInclusive;
02489 
02490     // if inserting after a moveto, we change the moveto.
02491     if (AfterVerb == PT_MOVETO)
02492     {
02493         // alter the coordinate of the move to
02494         Act = ModifyElementAction::Init(this, 
02495                                         &UndoActions,
02496                                         Verbs[after],
02497                                         Flags[after],
02498                                         Coords[after],
02499                                         after,
02500                                         pDestinNode,
02501                                         (Action**)&UnAction);
02502 
02503         if (Act == AC_FAIL)
02504             return ExeInclusive;
02505 
02506         DocCoord* SCoords = pSourcePath->GetCoordArray();
02507         Coords[after] = SCoords[0];
02508         Flags[after].IsSelected = TRUE;
02509 
02510     }
02511 
02512     // record a record for the undo. we're inserting elements so we'll want to delete them during undo      
02513     Act = RemovePathElementAction::Init(this, &UndoActions, NumInSource-1, after+1, (Action**)(&UnAction));
02514     if (Act == AC_FAIL)
02515         return ExeInclusive;
02516 
02517     // record the path pointer where the remove will take place. (Why isn't this part of the above?)
02518     if (Act == AC_OK)
02519         ((RemovePathElementAction*)UnAction)->RecordPath(pDestinNode);
02520 
02521     // copy the necessary data into the destination path. return fail if unable to do so
02522     if (!pDestPath->MergeSectionFrom(after+1, *pSourcePath, 1, NumInSource-1))
02523         return ExeExclusive;
02524 
02525 #endif
02526     return ExeNone;
02527                                                                      
02528 }

ActionCode OpAddPath::DeselectHandle NodePath pDestinNode,
INT32  after
[protected]
 

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
Parameters:
pDestinNode = pointer to a node whose path contains a point we will deselect [INPUTS] after = offset of verb (line, move, curve) which will be deselected
- [OUTPUTS]

Definition at line 2580 of file penedit.cpp.

02581 {
02582 #ifndef STANDALONE
02583 
02584     ActionCode Act;                 // Action code that might be used
02585 
02586     // Remove the selected end bit
02587     Act = DeselectPoint(pDestinNode, after);
02588     if (Act == AC_FAIL)
02589         return Act;
02590 
02591     INT32 lasti = pDestinNode->InkPath.GetNumCoords() -1;
02592 
02593     // Now check and remove any other selection bits around the handle
02594     PathVerb* Verbs = pDestinNode->InkPath.GetVerbArray();
02595     PathVerb AfterVerb = Verbs[after] & ~PT_CLOSEFIGURE;
02596 
02597     switch (AfterVerb)
02598     {
02599         case PT_MOVETO:
02600             if (after < lasti)
02601             {
02602                 PathVerb NextVerb = Verbs[after+1] & ~PT_CLOSEFIGURE;
02603                 if (NextVerb == PT_BEZIERTO)
02604                     Act = DeselectPoint(pDestinNode,after+1);
02605             }
02606         break;
02607 
02608         case PT_BEZIERTO:
02609             if (after>0)
02610                 Act = DeselectPoint(pDestinNode,after-1);
02611             break;
02612     }
02613 
02614     return Act;
02615 
02616 #else
02617     return AC_OK;
02618 #endif
02619 }

ActionCode OpAddPath::DeselectPoint NodePath pDestNode,
INT32  position
[protected]
 

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
Parameters:
pDestinNode = pointer to a node whose path contains a point we will deselect [INPUTS] position = offset of verb (line, move, curve) which will be deselected
- [OUTPUTS]

Definition at line 2545 of file penedit.cpp.

02546 {
02547 #ifndef STANDALONE
02548 
02549     Action* UnAction;               // pointer to action that might be created
02550     ActionCode Act;                 // Action code that might be used
02551 
02552     PathFlags* Flags = pDestNode->InkPath.GetFlagArray();
02553 
02554     Act = ModifyFlagsAction::Init(this, &UndoActions, Flags[position], position, pDestNode, (Action**)(&UnAction));
02555     if (Act != AC_FAIL)
02556         Flags[position].IsSelected = FALSE;
02557 
02558     return Act;
02559 
02560 #else
02561     return AC_OK;
02562 #endif
02563 }


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