nbevcont.h

Go to the documentation of this file.
00001 // $Id: nbevcont.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 
00099 #ifndef INC_NODEBEVELCONTROLLER
00100 #define INC_NODEBEVELCONTROLLER
00101 
00102 #ifdef BUILDSHADOWS
00103 
00104 //#include "control.h"
00105 //#include "group.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 //#include "cxfrec.h"       // CXaraFileRecord - in camtypes.h [AUTOMATICALLY REMOVED]
00107 #include "clipattr.h"
00108 
00109 class ContextMenu;
00110 class ExtendParams;
00111 class BlendNodeParam;
00112 class AttrClipView;
00113 class NodeBevel;
00114 
00115 /********************************************************************************************
00116 
00117 >   class NodeBevelController : public NodeGroup
00118 
00119     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00120     Created:    6/10/98
00121     Purpose:    
00122 
00123 ********************************************************************************************/
00124 
00125 class NodeBevelController : public NodeGroup
00126 {
00127     CC_DECLARE_DYNAMIC( NodeBevelController )    
00128 public:
00129     NodeBevelController(); 
00130     NodeBevelController(Node* ContextNode,  
00131                 AttachNodeDirection Direction,  
00132                 BOOL Locked = FALSE, 
00133                 BOOL Mangled = FALSE,  
00134                 BOOL Marked = FALSE, 
00135                 BOOL Selected = FALSE    
00136                 ) ;
00137 
00138     ~NodeBevelController();
00139 
00140     NodeBevel * GetBevelNode();
00141 
00142     // creates the bevel immediately
00143     void CreateBevel();
00144 
00145     // copy this node
00146     virtual Node* SimpleCopy(); 
00147     void CopyNodeContents(NodeBevelController* pNewNode);
00148     virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00149 
00150     // PreRender functionality for inner bevel object clipping
00151     virtual void PreExportRender( RenderRegion* pRender ); 
00152     virtual SubtreeRenderState RenderSubtree(RenderRegion* pRender, Node** ppNextNode = NULL, BOOL bClip = TRUE);
00153 
00154     // Virtual rendering functions       
00155     virtual BOOL ExportRender( RenderRegion* pRender ); 
00156 
00157     virtual void RenderTinyBlobs(RenderRegion* pRender);
00158 
00159     virtual void Render(RenderRegion* pRender);
00160     virtual BOOL HidingNode();
00161     virtual BOOL ShowingNode();
00162 
00163     // test to see if there is a bevel controller in the current selection
00164     static BOOL SelectionHasBevelNode();
00165 
00166     // test to see if there is a bevel inking node in the current selection
00167     static BOOL SelectionHasBevelInkNode();
00168 
00169     // get the n'th bevel node in the selection
00170     static NodeBevelController * GetSelectionBevelNode(INT32 num = 0);
00171     static NodeBevel * GetSelectionBevelInkNode(INT32 num = 0);
00172 
00173     virtual void Transform( TransformBase& Trans );
00174     
00175     DocRect GetBoundingRect(BOOL DontUseAttrs, BOOL HitTest);
00176     DocRect GetBlobBoundingRect();
00177 
00178     // Karim 14/04/2000 - helper method for marquee selection.
00179     virtual void SelectInRect(const DocRect& Rect, SelStateAction st);
00180 
00181     // file format stuff
00182     BOOL WritePreChildrenNative(BaseCamelotFilter* pFilter);
00183     
00184     // same as native in this case
00185     BOOL WritePreChildrenWeb(BaseCamelotFilter* pFilter);
00186 
00187     BOOL WritePostChildrenNative(BaseCamelotFilter* pFilter);
00188     BOOL WritePostChildrenWeb(BaseCamelotFilter* pFilter);
00189 
00190     BOOL LoadBevelFromRecord(CXaraFileRecord* pCXaraFileRecord);
00191 
00192     // change in child ?
00193     virtual ChangeCode  OnChildChange(ObjChangeParam* pParam);
00194 
00195     virtual BOOL AllowOp(ObjChangeParam *pParam, BOOL SetOpPermissionState = TRUE,
00196                                                  BOOL DoPreTriggerEdit = TRUE);
00197 
00198         // we don't want to have brush attrs applied to us.
00199     virtual BOOL RequiresAttrib(CCRuntimeClass* pAttribClass, BOOL Search = FALSE);
00200     virtual BOOL RequiresAttrib(NodeAttribute* pAttr, BOOL Search = FALSE);
00201     virtual BOOL CanAttrBeAppliedToMe(CCRuntimeClass* pAttribClass);
00202     
00203     // have we finished importing yet ?
00204     BOOL PostImport();
00205 
00206     // tells the bevel node to delete it's data
00207     void DeleteCache();
00208 
00209     // this renders the light vector (used by the tool !)
00210     void RenderMyBlobs(RenderRegion * pRender);
00211 
00212     DocRect GetBlobRect() { return m_BlobDocRect; }
00213 
00214     virtual String Describe(BOOL Plural, BOOL Verbose); 
00215 
00216     virtual BOOL OnNodePopUp(Spread*, DocCoord, ContextMenu*);
00217 
00218     BOOL DoBecomeA(BecomeA* pBecomeA);
00219     BOOL CanBecomeA(BecomeA* pBecomeA);
00220 
00221     // hit testing on children isn't promoted
00222     BOOL PromoteHitTestOnChildrenToMe() const { return FALSE; }
00223 
00224     BOOL ShouldITransformWithChildren() const { return TRUE; }
00225 
00226     BOOL PostDuplicate(UndoableOperation* pOp);
00227 
00228     void RenderEorDrag(RenderRegion * pRegion);
00229     virtual BOOL ChildrenAreEorDragRenderedByMe() { return TRUE; }
00230 
00231     virtual BOOL NeedsTransparency() const {return TRUE;}
00232 
00233     // functions to render just the bevel bitmap
00234     void ReRenderBevelBitmap(double LightAngle);
00235 
00236     virtual NodeRenderableInk * CreateTreeFromNodeToBlend(NodeRenderableInk * pNode, 
00237         CCAttrMap * pAttrMap);
00238 
00239     // fns to tell this class to start & end blending
00240     virtual BOOL EndBlendStep(BlendNodeParam * pParam);
00241 
00242     virtual BOOL PromoteAttributeApplicationToMe(CCRuntimeClass *pAttrClass) const;
00243 
00244     BOOL AmDragging() { return m_bDrag; }
00245 
00246     BOOL RegenerateNode(UndoableOperation * pOp, BOOL bCacheRender = FALSE,
00247         BOOL bInformParents = TRUE);
00248 
00249     // just regenerates my bitmap
00250     BOOL RegenerateBevelBitmap(UndoableOperation * pOp, BOOL bInformParents = TRUE);
00251 
00252     INT32 ComplexHide(UndoableOperation* pOp, Node* pNextInRange);
00253 
00254     // Diccon added virtual identifier 9/99
00255     virtual BOOL IsController() { return TRUE;}
00256     virtual BOOL IsABevelController() const { return TRUE;}
00257     virtual BOOL GroupCanTransformCached(TransformBase& Trans) const {return Trans.IsTranslation();} //{return FALSE;}
00258 
00259     // retrieves the node that we end up bevelling
00260     virtual NodeRenderableInk* GetInkNodeFromController() const;
00261 
00262     // Karim MacDonald 25/11/1999
00263     // virtual Extend functions; see declaration/implementation in Node.
00264     virtual BOOL IsTypeExtendible() const { return TRUE; }
00265     virtual DocRect ValidateExtend(const ExtendParams& ExtParams);
00266     virtual void Extend(const ExtendParams& ExtParams);
00267 
00268     void GetDebugDetails(StringBase* Str);
00269 
00270 public:
00271     // the data members for the bevel
00272     // public for easy access
00273     INT32 m_BevelType;
00274     INT32 m_Indent;
00275     LineCapType m_LType;
00276 
00277     double m_LightAngle;
00278     BOOL m_bOuter;
00279     INT32 m_Contrast;
00280     double m_Tilt;
00281     
00282     // boolean which tells GetBoundingRect to include the blobs
00283     BOOL m_bIncludeBlobsInBoundingRect;
00284 
00285     // points determining the fill control points
00286     DocCoord m_BMPCentre;
00287     DocCoord m_BMPPoint1;
00288     DocCoord m_BMPPoint2;
00289 
00290     // the rect of the (original) selection
00291     DocRect m_SelectedRect;
00292 
00293 protected:
00294     void ApplyRelevantAttributes (CCAttrMap* ptrBevelMap, CCAttrMap* oldPathMap,
00295                                   CCAttrMap* newPathMap, CCAttrMap* pMap,
00296                                   CCAttrMap* pSingleMap);
00297 
00298     // PreRender Function of inner bevels
00299     BOOL PreApplyClipViewNode(RenderRegion* pRender);
00300 
00301 protected:
00302     DocRect m_BlobDocRect;
00303     DocCoord m_BlobCentre;
00304     
00305     // indicates that a drag is in progress
00306     BOOL m_bDrag;
00307 
00308     BOOL m_HaveDoneApplyTest;
00309 
00310     // indicates that the last bounding rect passed back was for the tool
00311     // used to see if we need to re-generate the bounding rect 
00312     BOOL m_bBoundingRectIsForTool;
00313 
00314     FIXED16 m_LastZoom;
00315 
00316     BOOL m_PerformedExtend;
00317 
00318     BOOL m_LastColoursTransparency;
00319 
00320     // New ClipView Attribute for rendering Inner bevels
00321     AttrClipView* m_pClipViewAttribute;
00322 
00323     Path m_PathToClipVeiw;
00324     NodeBevel* m_pBevel;
00325 
00326     double m_LastClipZoom;
00327 
00328 } ;
00329 
00330 /***********************************************************************************************
00331 
00332 >   class BevelNodeTreeFactory : public CompoundNodeTreeFactory
00333 
00334     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00335     Created:    10/8/99
00336     Purpose:    Creates a new bevel node with the given parameters
00337 
00338 ***********************************************************************************************/
00339 class BevelNodeTreeFactory : public CompoundNodeTreeFactory
00340 {
00341     CC_DECLARE_DYNCREATE(BevelNodeTreeFactory);
00342 
00343 public:
00344     // constructor which sets up the class factory to create nodes the same as given
00345     BevelNodeTreeFactory(NodeBevelController * pController);
00346     ~BevelNodeTreeFactory();
00347 
00348     // given a list of NodeListItems, shadows them
00349     virtual NodeCompound * CreateNode(List *pList, UndoableOperation * pOp = NULL);
00350 
00351     void SetBevelType(INT32 Type)               { m_BevelType = Type; }
00352     void SetBevelLightAngle(INT32 Angle)    { m_BevelLightAngle = Angle; }
00353     void SetBevelIndent(INT32 Indent)           { m_BevelIndent = Indent; }
00354     void SetBevelContrast(INT32 Contrast)       { m_BevelContrast = Contrast; }
00355 
00356 private:
00357     List m_ControllerAttributeList;
00358     List m_BevelNodeAttributeList;
00359 
00360     INT32 m_BevelType;
00361     INT32 m_BevelLightAngle;
00362     INT32 m_BevelIndent;
00363     INT32 m_BevelContrast;
00364 } ;
00365 
00366 
00367 #endif
00368 #endif

Generated on Sat Nov 10 03:45:47 2007 for Camelot by  doxygen 1.4.4