OpRemoveContour Class Reference

Removes contours on the selection. More...

#include <opcntr.h>

Inheritance diagram for OpRemoveContour:

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

Public Member Functions

 OpRemoveContour ()
 Constructor.
 ~OpRemoveContour ()
 Destructor.
virtual void Do (OpDescriptor *pOpDesc)
 The do function. Applys a Bevel to the selection in the current document.
virtual void DoWithParam (OpDescriptor *pOp, OpParam *pParam)
 Applys a Bevel to the selected node after a mouse click.
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 *)
 Find out the state of the new regular shape at the specific time.

Detailed Description

Removes contours on the selection.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/8/99

Definition at line 198 of file opcntr.h.


Constructor & Destructor Documentation

OpRemoveContour::OpRemoveContour  ) 
 

Constructor.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/8/99

Definition at line 714 of file opcntr.cpp.

00715 {
00716     //TRACEUSER( "MarkH", _T("Just Made a OpRemoveContour Class!\n"));
00717 }

OpRemoveContour::~OpRemoveContour  ) 
 

Destructor.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/8/99

Definition at line 728 of file opcntr.cpp.

00729 {
00730     //TRACEUSER( "MarkH", _T("Just Killed OpRemoveContour Class!!!\n"));
00731 }


Member Function Documentation

BOOL OpRemoveContour::Declare  )  [static]
 

Adds the operation to the list of all known operations.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
Returns:
TRUE if all went OK, False otherwise

Definition at line 1015 of file opcntr.cpp.

01016 {
01017     return (RegisterOpDescriptor(
01018                                 0, 
01019                                 _R(IDS_REMOVECONTOUROP),
01020                                 CC_RUNTIME_CLASS(OpRemoveContour), 
01021                                 OPTOKEN_REMOVECONTOUR,
01022                                 OpRemoveContour::GetState,
01023                                 0,
01024                                 _R(IDBBL_REMOVECONTOUR),
01025                                 0));
01026 
01027 }

void OpRemoveContour::Do OpDescriptor pOpDesc  )  [virtual]
 

The do function. Applys a Bevel to the selection in the current document.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/8/99
Parameters:
pOpDesc - OpDescriptor - unused [INPUTS]
- [OUTPUTS]
Returns:
-

Reimplemented from Operation.

Definition at line 745 of file opcntr.cpp.

00746 {
00747     // CGS:  (13/7/2000)  I have ammended this function to take into account multiple NodeBlends
00748     // since the contour may be part of more than one blend!
00749     
00750     // get all the contour nodes
00751     DoStartSelOp(TRUE, TRUE);
00752     ObjChangeFlags cFlags;
00753     ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,this);
00754 
00755     String_64 s(_T("Removing contour - please wait"));
00756     BeginSlowJob(-1, TRUE, &s);
00757 
00758     List NodeList;
00759     BevelTools::BuildListOfSelectedNodes(&NodeList, CC_RUNTIME_CLASS(NodeContourController), TRUE);
00760 
00761     //List BlendList;
00762     //BevelTools::BuildListOfSelectedNodes(&BlendList, CC_RUNTIME_CLASS(NodeBlender), TRUE);
00763 
00764     // run through these nodes, eliminating them
00765     NodeListItem * pItem = (NodeListItem *)NodeList.GetHead();
00766 
00767     Node * pChildNode = NULL;
00768     Node * pNextNode = NULL;
00769     NodeHidden * pHidden = NULL;
00770 
00771     Node * pParent = NULL;
00772 
00773     BOOL ok = TRUE;
00774 
00775     NodeContourController * pControl = NULL;
00776 
00777     NodeBlender * pBlender = NULL;
00778     BOOL bBlendBefore = FALSE;
00779     BOOL bBlendAfter = FALSE;
00780 
00781     // for blends
00782     NodeRenderableInk *pRenderableNode = NULL;
00783 
00784     while (pItem)
00785     {
00786         pControl = (NodeContourController *)pItem->pNode;
00787 
00788         // try to find a blender node, as if there's one present we
00789         // need to reinitialise it
00790         pBlender = (NodeBlender *)pControl->FindNext(CC_RUNTIME_CLASS(NodeBlender));
00791 
00792         bBlendBefore = FALSE;
00793         bBlendAfter = FALSE;
00794         if (pBlender)
00795         {
00796             bBlendBefore = TRUE;
00797         }
00798         else
00799         {
00800             pBlender = (NodeBlender *)pControl->FindPrevious(CC_RUNTIME_CLASS(NodeBlender));
00801 
00802             if (pBlender)
00803             {
00804                 bBlendAfter = TRUE;
00805             }
00806         }
00807         
00808         // get the parent for child change messaging
00809         pParent = pControl->FindParent();
00810 
00811         // invalidate the region
00812         if (ok)
00813             ok = DoInvalidateNodeRegion(pControl, TRUE);
00814         
00815         // factor out the common child attributes
00816         if (ok)
00817             ok = DoLocaliseCommonAttributes(pControl, TRUE);
00818 
00819         if (ok)
00820             SliceHelper::RemoveNamesFromController(this,pControl);
00821 
00822         pChildNode = pControl->FindFirstChild();
00823 
00824         // move all nodes to being siblings of the controller node, except for the
00825         // contour node itself
00826         while (pChildNode)
00827         {
00828             pNextNode = pChildNode->FindNext();
00829 
00830             if (pChildNode->IsAnObject() && !pChildNode->IS_KIND_OF(NodeContour))
00831             {
00832                 if (ok)
00833                 {
00834                     ok = DoMoveNode(pChildNode, pControl, PREV);
00835                 }
00836 
00837                 if (ok)
00838                     ok = DoSelectNode((NodeRenderableInk *)pChildNode);
00839 
00840                 if (ok)
00841                     ok = DoFactorOutAfterAttrChange((NodeRenderableInk *)pChildNode, 
00842                                                     (AttrTypeSet *)NULL);
00843             }
00844 
00845             pChildNode = pNextNode;
00846         }
00847 
00848         pParent = pControl->FindParent();
00849 
00850         // agh why do i have to mess with a list just to add this action into the undo list?
00851         List ContList;
00852         NodeListItem * pActionItem = NULL;
00853         RegenerateContourAction* pRegenAction = NULL;
00854         ALLOC_WITH_FAIL(pActionItem, new NodeListItem, this);
00855 
00856         pActionItem->pNode = pControl;
00857         ContList.AddTail(pActionItem);
00858 
00859         RegenerateContourAction::Init(this, GetUndoActionList(),&ContList,&pRegenAction, TRUE);
00860 
00861         ContList.DeleteAll();
00862 
00863         // now, hide the controller node
00864         if (ok)
00865             ok = DoHideNode(pControl, TRUE, &pHidden, FALSE);
00866 
00867         // reinit the blends (if necessary)
00868         if (ok)
00869         {
00870             if (bBlendBefore)
00871             {
00872                 if (InitBlendAction::InitOnBlender(this, GetUndoActionList(), pBlender, TRUE, TRUE) != AC_OK)
00873                 {
00874                     ERROR2RAW("Couldn't Initialise blend action");
00875                 }
00876 
00877                 // reinit the node
00878                 pRenderableNode = (NodeRenderableInk *)pBlender->FindPrevious(CC_RUNTIME_CLASS(NodeRenderableInk)); 
00879                     
00880                 if (pRenderableNode)
00881                 {
00882                     pBlender->Reinit(pRenderableNode,   pBlender->GetNodeEnd(), FALSE);
00883                 }
00884             }
00885             else if (bBlendAfter)
00886             {
00887                 if (InitBlendAction::InitOnBlender(this, GetUndoActionList(), pBlender, TRUE, TRUE) != AC_OK)
00888                 {
00889                     ERROR2RAW("Couldn't Initialise blend action");
00890                 }
00891 
00892                 // reinit the node
00893                 pRenderableNode = (NodeRenderableInk *)pBlender->FindNext(CC_RUNTIME_CLASS(NodeRenderableInk)); 
00894                     
00895                 if (pRenderableNode)
00896                 {
00897                     pBlender->Reinit(pBlender->GetNodeStart(), pRenderableNode, FALSE);
00898                 }
00899             }
00900 
00901             if (pBlender)
00902             {
00903                 NodeBlend* ptrBlend = (NodeBlend*) pBlender->FindParent ();
00904 
00905                 ERROR3IF (!IS_A (ptrBlend, NodeBlend), "NodeBlend is not a NodeBlend!");
00906 
00907                 BOOL done = FALSE;
00908                 NodeBlender* ptrNode = ptrBlend->FindFirstBlender ();
00909 
00910                 while (!done)
00911                 {
00912                     if (ptrNode != pBlender)
00913                     {
00914                         if (ptrNode->GetNodeStart () == pControl)
00915                         {
00916                             if (InitBlendAction::InitOnBlender(this, GetUndoActionList(), ptrNode, TRUE, TRUE) != AC_OK)
00917                             {
00918                                 ERROR2RAW("Couldn't Initialise blend action");
00919                             }
00920                             
00921                             if (pRenderableNode)
00922                             {
00923                                 ptrNode->Reinit(pRenderableNode, NULL, FALSE);
00924                             }
00925                         }
00926                         if (ptrNode->GetNodeEnd () == pControl)
00927                         {
00928                             if (InitBlendAction::InitOnBlender(this, GetUndoActionList(), ptrNode, TRUE, TRUE) != AC_OK)
00929                             {
00930                                 ERROR2RAW("Couldn't Initialise blend action");
00931                             }
00932 
00933                             if (pRenderableNode)
00934                             {
00935                                 ptrNode->Reinit(NULL, pRenderableNode, FALSE);
00936                             }
00937                         }
00938                     }
00939 
00940                     ptrNode = ptrBlend->FindNextBlender (ptrNode);
00941 
00942                     if (!ptrNode)
00943                     {
00944                         done = TRUE;
00945                     }
00946                 }
00947             }
00948         }
00949             
00950         // Karim 19/07/2000
00951         // the parent's bounds will have changed, so tell them so.
00952         if (pParent->IsBounded())       // paranoia code - this is always true.
00953             ((NodeRenderableBounded*)pParent)->InvalidateBoundingRect();
00954 
00955         // update all the changed nodes on the parent of the contour
00956 //      ObjChangeFlags flgs(FALSE, FALSE, FALSE, TRUE);
00957 //      flgs.RegenerateNode = TRUE;
00958 //      ObjChangeParam OP(OBJCHANGE_FINISHED, flgs, NULL, this, OBJCHANGE_CALLEDBYOP);
00959 
00960         while (pParent)
00961         {
00962             pParent->AllowOp(&ObjChange);
00963 //          pParent->OnChildChange(&OP);
00964 
00965             pParent = pParent->FindParent();
00966         }
00967 
00968         // go onto the next item
00969         pItem = (NodeListItem *)NodeList.GetNext(pItem);
00970         
00971     }
00972 
00973     NodeList.DeleteAll();
00974 
00975     if (!ok)
00976     {
00977         FailAndExecute();
00978     }
00979 
00980     ObjChange.Define(OBJCHANGE_FINISHED,cFlags,NULL,this);
00981     UpdateChangedNodes(&ObjChange, Document::GetSelectedSpread());
00982 
00983     GetApplication()->UpdateSelection();
00984 
00985     End();
00986 }

void OpRemoveContour::DoWithParam OpDescriptor pOp,
OpParam pParam
[virtual]
 

Applys a Bevel to the selected node after a mouse click.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/8/99
Parameters:
[INPUTS] 
- [OUTPUTS]
Returns:
-

Reimplemented from Operation.

Definition at line 1000 of file opcntr.cpp.

01001 {
01002     End();
01003 }

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

Find out the state of the new regular shape at the specific time.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/11/94
Parameters:
- [OUTPUTS]
Returns:
Ungreyed, Unticked

Definition at line 1042 of file opcntr.cpp.

01043 {
01044     OpState State(FALSE,TRUE); // It's not ticked, but it is greyed by default
01045     
01046     // Get an ObjChangeParam ready so we can tell the selected blend's parents what we hope to do 
01047     // to the blend (i.e. replace it with other nodes).
01048     ObjChangeFlags cFlags;
01049     cFlags.MultiReplaceNode = TRUE;
01050     ObjChangeParam ObjChange(OBJCHANGE_STARTING,cFlags,NULL,NULL);
01051 
01052 //  BOOL Denied = FALSE;
01053     List NodeList;
01054     BevelTools::BuildListOfSelectedNodes(&NodeList, CC_RUNTIME_CLASS(NodeContourController), TRUE);
01055 
01056     if (NodeList.IsEmpty())
01057     {
01058         State.Greyed = TRUE;
01059     }
01060     else
01061     {
01062         State.Greyed = FALSE;
01063     }
01064 
01065     NodeList.DeleteAll();
01066 
01067     UINT32 IDS = 0;
01068     
01069 
01070     if (IDS == 0)
01071         IDS = _R(IDS_REMOVECONTOUR);
01072 
01073     *Description = String_256(IDS);
01074 
01075     return State;
01076 }

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

Reimplemented from SelOperation.

Definition at line 217 of file opcntr.h.

00217 { return TRUE; }


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