nodemold.h

Go to the documentation of this file.
00001 // $Id: nodemold.h 1282 2006-06-09 09:46:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // The NodeMould renderable class
00099 
00100 #ifndef INC_NODEMOULD
00101 #define INC_NODEMOULD
00102 
00103 
00104 //#include "ink.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00105 //#include "rndrgn.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 //#include "selop.h"
00107 //#include "moldshap.h"
00108 //#include "group.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00109 //#include "becomea.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00110 //#include "doccoord.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00111 #include "objchge.h"
00112 
00113 #define OPTOKEN_NODEMOULD _T("MouldObject")
00114 #define MOULD_EPS_VERSION 100             // v 1.00
00115 
00116 //class BecomeA;
00117 class NodeMoulder;
00118 class NodeMouldGroup;
00119 class NodeMouldPath;
00120 class MouldGeometry;
00121 class BaseCamelotFilter;
00122 
00123 /***********************************************************************************************
00124 
00125 >   enum MouldSpace
00126 
00127     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00128     Created:    5/12/94
00129     Purpose:    defines the types of mould vector spaces that exist
00130 
00131 ***********************************************************************************************/
00132 
00133 typedef enum MouldSpace {
00134     MOULDSPACE_UNDEFINED,
00135     MOULDSPACE_ENVELOPE,
00136     MOULDSPACE_PERSPECTIVE,
00137     MOULDSPACE_ENVELOPE2X2
00138 };
00139 
00140 #define REC_REBUILD     1
00141 #define REC_PATHARRAYS  2
00142 #define REC_BLOBS       4
00143 #define REC_GEOMETRY    8
00144 #define REC_GEOMCONTEXT 16
00145 
00146 #define REC_TYPE        INT32
00147 
00148 /***********************************************************************************************
00149 
00150 >   class NodeMould : public NodeGroup
00151 
00152     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00153     Created:    1/12/94
00154     Purpose:    This class defines the structure of a mould node object. This object is the
00155                 parent of a MouldGroup node and a Moulder node. Objects being moulded are 
00156                 placed inside MouldGroup and all resulting moulded objects are placed inside
00157                 the Moulder node.
00158 
00159 ***********************************************************************************************/
00160 
00161 class NodeMould: public NodeGroup
00162 {
00163     friend class RecordChangeCodesAction;
00164 
00165     CC_DECLARE_DYNAMIC( NodeMould );    
00166 
00167 public: 
00168     NodeMould(); 
00169     NodeMould(Node* ContextNode,  
00170               AttachNodeDirection Direction,    
00171               BOOL Locked=FALSE, 
00172               BOOL Mangled=FALSE,  
00173               BOOL Marked=FALSE, 
00174               BOOL Selected=FALSE    
00175              ); 
00176     ~NodeMould();
00177 
00178             void    InitialiseVars();
00179 
00180     // Virtual rendering functions       
00181     virtual void    PreExportRender( RenderRegion* pRender ); 
00182     virtual BOOL    ExportRender( RenderRegion* pRender ); 
00183     virtual BOOL    PostImport();
00184 
00185     virtual void    RenderObjectBlobs(RenderRegion* pRender);
00186     virtual void    RenderTinyBlobs(RenderRegion* pRender);
00187     virtual DocRect GetBlobBoundingRect();
00188     virtual void    Transform( TransformBase& Trans );
00189 
00190     // Other virtual functions
00191     virtual String  Describe(BOOL Plural, BOOL Verbose); 
00192     virtual Node*   SimpleCopy();  
00193     virtual UINT32  GetNodeSize() const;            // Returns size of node in bytes
00194     virtual BOOL    IsANodeMould() const;
00195 
00196     // Functions to deal with messages
00197     virtual BOOL    OnClick( DocCoord, ClickType, ClickModifiers, Spread* );
00198             BOOL    OnMouseMove( DocCoord, Spread*, ClickModifiers, INT32*, INT32* );
00199 
00200     // Functions to handle changes to moulds
00201     virtual ChangeCode OnChildChange(ObjChangeParam* pParam);
00202 
00203     // Specify whats editable inside ourselves
00204     virtual Node*   HasEditableChild(CCRuntimeClass *ChildClass, Node* pPrevEditable);
00205     virtual BOOL    OnNodePopUp(Spread* pSpread, DocCoord PointerPos, ContextMenu* pMenu);
00206 
00207     // Replace DoBecomeA() so that the mould node can turn itself into a group
00208     virtual BOOL    CanBecomeA(BecomeA* pBecomeA);
00209     virtual BOOL    DoBecomeA(BecomeA* pBecomeA);
00210 
00211     virtual BOOL    AllowSelectInside() const { return FALSE; }
00212 
00213     #ifdef _DEBUG
00214             void    ShowDebugTreeDetails() const;                   // Debugging function
00215     #endif
00216             void    GetDebugDetails( StringBase* Str );
00217 
00218     // CAM/AW EPS output functions
00219             void    PreExportCAMEPS(RenderRegion* pRegion);
00220             BOOL    PostExportCAMEPS(RenderRegion* pRegion);
00221             void    PreExportAWEPS(RenderRegion* pRegion);
00222             BOOL    PostExportAWEPS(RenderRegion* pRegion);
00223 
00224             void    ToggleDetachFlag();
00225             BOOL    IsDetached() const { return DetachedGeometry; }
00226 
00227     // Version 2 file format functions
00228     virtual BOOL WritePreChildrenWeb(BaseCamelotFilter* pFilter);
00229     virtual BOOL WritePreChildrenNative(BaseCamelotFilter* pFilter);
00230 
00231     // temporary function!
00232     static  void    RemovePerspectiveFills(Node* pParentNode, UndoableOperation* pUndoOp);
00233 
00234     // Karim MacDonald 26/05/2000
00235     // Extend functions. Maybe these functions should really originate in NodeRenderable?
00236     // Note that if a sub-class returns TRUE from IsTypeExtendible, it must
00237     // also provide complete implementations of ValidateExtend and Extend,
00238     // which should usually check/extend its children.
00239 public:
00240     virtual BOOL IsTypeExtendible() const { return TRUE; }
00241     virtual DocRect ValidateExtend(const ExtendParams& ExtParams);
00242     virtual void Extend(const ExtendParams& ExtParams);
00243 
00244     // Karim 20/06/2000 - find the extend bounding rect of this node, for use with Extension.
00245     virtual DocRect GetExtendTargetBounds(const ExtendParams& ExtParams);
00246 
00247     virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00248 
00249     // the following functions are node mould specific
00250 
00251 public:
00252     MouldSpace      DescribeGeometry();
00253     MouldGeometry*  GetGeometry() const { return pMouldGeometry; }
00254     NodeMouldPath*  GetPathShape();
00255     Path*           GetPath();
00256     DocRect         GetRenderBounds();
00257     DocRect         GetChildrensBounds();
00258 
00259     void            DisableBlobs() { RenderBlobs=FALSE; }
00260     void            EnableBlobs()  { RenderBlobs=TRUE; }
00261 
00262     BOOL            CreateGeometry(MouldSpace mSpace);
00263     NodeMoulder*    CreateNewMoulder(UndoableOperation*);
00264     NodeMouldPath*  CreateNewMouldShape(Path* pPath, DocRect* const pDestin, UndoableOperation* pOp);
00265     NodeMouldGroup* CreateNewMouldGroup(UndoableOperation* pOp);
00266     BOOL            CreateAllMoulderObjects(UndoableOperation* pOp);
00267 
00268     NodeMoulder*    AddNewMoulder(Node*, AttachNodeDirection, UndoableOperation*);
00269     NodeMouldPath*  AddNewMouldShape(Path* pPath, DocRect* const pDestin, UndoableOperation* pOp);
00270     NodeMouldGroup* AddNewMouldGroup(UndoableOperation* pOp);
00271 
00272     BOOL            FillMouldGroup(NodeMouldGroup*, List*,  UndoableOperation*);
00273 
00274     NodeMoulder*    FindFirstMoulder(BOOL errorcheck=TRUE);
00275     NodeMoulder*    FindNextMoulder(NodeMoulder* pNodeMoulder);
00276     NodeMouldGroup* FindMouldGroup(BOOL errorcheck=TRUE);
00277     ChangeCode      RemouldAll(UndoableOperation* pUndoOp);
00278     ChangeCode      StartSaveContext(UndoableOperation* pUndoOp, REC_TYPE);
00279     ChangeCode      EndSaveContext(UndoableOperation* pUndoOp, REC_TYPE);
00280     BOOL            CreateAttrSetFromChildren(AttrTypeSet& AttSet);
00281 
00282     // used only for undo (and probably temporary)
00283     BOOL            SetGeometry(MouldGeometry*);
00284     INT32           CountMoulders();
00285 
00286 //  virtual BOOL IsValidEffectAttr(CCRuntimeClass* pAttrClass) const {return FALSE;}
00287     virtual BOOL IsValidEffectAttr(NodeAttribute* pAttr) const {return FALSE;}
00288     virtual BOOL GroupCanTransformCached(TransformBase& Trans) const {return TRUE;}
00289 
00290 private:
00291     void            RedrawMould();
00292     void            CopyNodeContents(NodeMould* pCopyOfNode);
00293     ChangeCode      HandleMouldShapeChange(ObjChangePathEdit* pParam);
00294     void            IncludeChildrensBoundingRects(DocRect& BoundingRect);
00295     BOOL            OverMouldEndPoint(DocCoord coord, Spread* pSpread);
00296     ChangeCode      RecordChangeCodes(UndoableOperation* pOp);
00297     ChangeCode      ConvertCode(ActionCode Act);
00298     
00299     String_32       MouldName; // The name of the mould 
00300 
00301     MouldGeometry*  pMouldGeometry;
00302     BOOL            DetachedGeometry;
00303 
00304 private:
00305     // Temorary private vars until v2.0
00306     INT32           OnCC_CRC;
00307     INT32           OnCC_Width;
00308     INT32           OnCC_Height;
00309     BOOL            RenderBlobs;
00310 };
00311 
00312 
00313 
00314 /********************************************************************************************
00315 
00316     class RecordChangeCodesAction : public Action
00317 
00318     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00319     Created:    16/01/95
00320     Purpose:    This class records undo/redo information for the Perspective shape object.
00321     
00322 ********************************************************************************************/
00323 
00324 class RecordChangeCodesAction : public Action
00325 {
00326     CC_DECLARE_DYNCREATE(RecordChangeCodesAction)
00327 
00328     public:
00329          RecordChangeCodesAction();
00330         ~RecordChangeCodesAction();
00331         virtual ActionCode Execute();
00332         static ActionCode Init( Operation* pOp,
00333                                 ActionList* pActionList,
00334                                 NodeMould* pMould,
00335                                 Action** NewAction);
00336     private:
00337         NodeMould* pCRCMould;
00338         INT32  CRCcode;
00339         INT32 CRCWidth;
00340         INT32 CRCHeight;
00341 };
00342 
00343 
00344 #endif

Generated on Sat Nov 10 03:46:04 2007 for Camelot by  doxygen 1.4.4