OpToggleContourInsetPath Class Reference

Toggles the inset path states of all selected contours. More...

#include <opcntr.h>

Inheritance diagram for OpToggleContourInsetPath:

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

Public Member Functions

 OpToggleContourInsetPath ()
 ~OpToggleContourInsetPath ()
virtual void DoWithParam (OpDescriptor *, OpParam *)
 Does the operation.
virtual void GetOpName (String_256 *OpName)
 Gets the op's name.
virtual BOOL MayChangeNodeBounds () const

Static Public Member Functions

static BOOL Declare ()
 Adds the operation to the list of all known operations.
static OpState GetState (String_256 *Description, OpDescriptor *)
 Gets the state of the operation.

Private Member Functions

 CC_DECLARE_DYNCREATE (OpToggleContourInsetPath)

Private Attributes

UINT32 m_OpName

Detailed Description

Toggles the inset path states of all selected contours.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000

Definition at line 861 of file opcntr.h.


Constructor & Destructor Documentation

OpToggleContourInsetPath::OpToggleContourInsetPath  )  [inline]
 

Definition at line 867 of file opcntr.h.

00867 {}

OpToggleContourInsetPath::~OpToggleContourInsetPath  )  [inline]
 

Definition at line 868 of file opcntr.h.

00868 {}


Member Function Documentation

OpToggleContourInsetPath::CC_DECLARE_DYNCREATE OpToggleContourInsetPath   )  [private]
 

BOOL OpToggleContourInsetPath::Declare  )  [static]
 

Adds the operation to the list of all known operations.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000
Returns:
TRUE if all went OK, False otherwise

Definition at line 4940 of file opcntr.cpp.

04941 {
04942     return (RegisterOpDescriptor(
04943                                 0, 
04944                                 _R(IDS_INSETPATHOP),
04945                                 CC_RUNTIME_CLASS(OpToggleContourInsetPath), 
04946                                 OPTOKEN_TOGGLEINSETPATH,
04947                                 OpToggleContourInsetPath::GetState));
04948 
04949 }

void OpToggleContourInsetPath::DoWithParam OpDescriptor pDesc,
OpParam pParam
[virtual]
 

Does the operation.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000
Returns:

Reimplemented from Operation.

Definition at line 4992 of file opcntr.cpp.

04993 {
04994     DoStartSelOp(TRUE, TRUE);
04995 
04996     if (!GetApplication()->FindSelection())
04997     {
04998         End();
04999         return;
05000     }
05001 
05002     BOOL bFlag = FALSE;
05003 
05004     if (pParam->Param1)
05005         bFlag = TRUE;
05006 
05007 //  BOOL ok = TRUE;
05008 
05009     if (bFlag)
05010         m_OpName = _R(IDS_INSETPATH_OP_UNDO_NAME);
05011     else
05012         m_OpName = _R(IDS_INSETPATH_OP_REDO_NAME);
05013 
05014     List ContourList;
05015     BevelTools::BuildListOfSelectedNodes(&ContourList, CC_RUNTIME_CLASS(NodeContourController));
05016 
05017     NodeListItem * pItem = (NodeListItem *)ContourList.GetHead();
05018 
05019 //  ToggleInsetPathAction * pAction = NULL;
05020 
05021     NodeContour * pContour = NULL;
05022     NodeContourController * pController = NULL;
05023     NodeHidden * pHidden = NULL;
05024     Node * pChild = NULL;
05025 //  Node * pNext = NULL;
05026 //  Node * pNodeGroup = NULL;
05027     CCAttrMap AttrMap;
05028 //  NodeContour * pContourCopy = NULL;
05029     BOOL IsAnOuter = TRUE;
05030 
05031     while (pItem)
05032     {
05033         pController = (NodeContourController *)pItem->pNode;
05034         pContour = (NodeContour *)pController->FindFirstChild(CC_RUNTIME_CLASS(NodeContour));
05035         
05036         if (!pController || !pContour)
05037             goto FailExit;
05038 
05039         IsAnOuter = pController->IsContourAnOuterContour();
05040 
05041         if (bFlag)
05042         {
05043             // only swap attributes when you're going from a contour to an inset path node
05044             // now, try to find the first appropriate node to take an attribute map from to
05045             // copy over to the contour node
05046             pChild = pController->FindFirstDepthFirst();
05047             
05048             while (pChild)
05049             {
05050                 if (pChild->IsAnObject() && !pChild->IS_KIND_OF(NodeContour) && !pChild->IsCompound())
05051                 {
05052                     if (((NodeRenderableInk *)pChild)->FindAppliedAttributes(&AttrMap))
05053                     {
05054 /*                      // create a copy of the contour node, and apply this attribute map to it
05055                         pContourCopy = (NodeContour *)pContour->PublicCopy();
05056                         AttrMap.ApplyAttributesToNode(pContourCopy);
05057                         
05058                         // insert this node into the tree after the contour node
05059                         if (!DoInsertNewNode(pContourCopy, pContour, NEXT, TRUE, FALSE, FALSE, TRUE))
05060                         {
05061                             goto FailExit;
05062                         }
05063 
05064                         if (!DoHideNode(pContour, TRUE, &pHidden, TRUE))
05065                             goto FailExit;
05066 */
05067                         // Create and initialize a new NodePath to hold the inset path!
05068                         NodePath* pNewPath;
05069                         ALLOC_WITH_FAIL(pNewPath, new NodePath, this);
05070                         pNewPath->InkPath.Initialise();
05071 
05072                         DoInvalidateNodeRegion(pController,FALSE);
05073 
05074                         // Create the DoBecomeA Function and call it on the controller
05075                         BecomeA BecomeAReplace(BECOMEA_REPLACE, CC_RUNTIME_CLASS(NodePath), this, FALSE);
05076                         pContour->DoBecomeA(&BecomeAReplace);
05077 
05078                         // Now get the relavent path from the group of path nodes
05079                         NodePath* pPathToCopy = NULL;
05080 
05081                         if(IsAnOuter)
05082                             pPathToCopy = (NodePath*)pController->FindFirstChild(CC_RUNTIME_CLASS(NodePath));
05083                         else
05084                             pPathToCopy = (NodePath*)pController->FindLastChild(CC_RUNTIME_CLASS(NodePath));
05085 
05086                         pNewPath->InkPath.CloneFrom(pPathToCopy->InkPath);
05087 
05088                         // now Initialize the flag array with the new Path and insert it after the group node!
05089                         pNewPath->InkPath.InitialiseFlags(0, pNewPath->InkPath.GetNumCoords());
05090                         DoInsertNewNode(pNewPath, pController, NEXT, TRUE, FALSE, TRUE, TRUE);
05091 
05092                         pNewPath->InkPath.IsFilled = TRUE;
05093 
05094                         // Make sure we have the correct attributes applied to our new path and make it selected!
05095                         AttrMap.ApplyAttributesToNode(pNewPath);
05096                         pNewPath->NormaliseAttributes();
05097                         
05098                         pNewPath->SetSelected(TRUE);
05099                         
05100                         DoHideNode(pController, TRUE, &pHidden, TRUE);
05101 
05102                         // ok we're out
05103                         break;
05104                         
05105                     }
05106                 }
05107                 
05108                 pChild = pChild->FindNextDepthFirst(pController);
05109             }
05110         }
05111 /*
05112         if (ToggleInsetPathAction::Init(this, GetUndoActionList(), pController, bFlag,
05113             &pAction) != AC_OK)
05114         {
05115             goto FailExit;
05116         }
05117 
05118         // make sure that the controller node is deselected and the contour node is
05119         pController->SetSelected(FALSE);
05120 
05121         if (pContourCopy)
05122             pContourCopy->SetSelected(TRUE);
05123 
05124         // do a do become a on the controller
05125         BecomeA BecomeAReplace(BECOMEA_REPLACE, CC_RUNTIME_CLASS(NodePath), this, FALSE);
05126         pController->DoBecomeA(&BecomeAReplace);
05127 */      pItem = (NodeListItem *)ContourList.GetNext(pItem);
05128     }
05129 
05130     ContourList.DeleteAll();
05131 
05132     if (GetApplication()->FindSelection())
05133     {
05134         GetApplication()->FindSelection()->Update(TRUE);
05135     }
05136     
05137     End();
05138     return;
05139 
05140 FailExit:
05141     FailAndExecute();
05142     End();
05143 }

void OpToggleContourInsetPath::GetOpName String_256 OpName  )  [virtual]
 

Gets the op's name.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000
Returns:

Reimplemented from Operation.

Definition at line 5155 of file opcntr.cpp.

05156 {
05157     if (OpName)
05158     {
05159         OpName->Load(m_OpName);
05160     }
05161 }

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

Gets the state of the operation.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/2/2000
Returns:
TRUE if all went OK, False otherwise

Definition at line 4961 of file opcntr.cpp.

04962 {
04963     OpState Blobby;
04964 
04965     // are there any contours in the selection ?
04966     List ContourList;
04967 
04968     BevelTools::BuildListOfSelectedNodes(&ContourList, CC_RUNTIME_CLASS(NodeContour));
04969 
04970     if (ContourList.IsEmpty())
04971     {
04972         Blobby.Greyed = TRUE;
04973     }
04974     else
04975     {
04976         ContourList.DeleteAll();
04977     }
04978     
04979     return Blobby;
04980 }

virtual BOOL OpToggleContourInsetPath::MayChangeNodeBounds  )  const [inline, virtual]
 

Reimplemented from SelOperation.

Definition at line 879 of file opcntr.h.

00879 { return FALSE; }


Member Data Documentation

UINT32 OpToggleContourInsetPath::m_OpName [private]
 

Definition at line 881 of file opcntr.h.


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