nodecntr.h

Go to the documentation of this file.
00001 // $Id: nodecntr.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 NODECNTR_H
00100 #define NODECNTR_H
00101 
00102 //#include "becomea.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00103 //#include "biasgain.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 
00105 class ExtendParams;
00106 class NodeContourController;
00107 class AttrBrushType;
00108 class SumAllPathsElem;
00109 class NodeCompound;
00110 
00111 /***********************************************************************************************
00112 
00113 >   class NodeContour : public NodeRenderableInk
00114 
00115     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00116     Created:    12/8/99
00117     Purpose:    Contour node
00118 
00119 ***********************************************************************************************/
00120 
00121 class NodeContour : public NodeRenderableInk
00122 {
00123     // Give my name out in memory dumps
00124     CC_DECLARE_DYNCREATE(NodeContour);
00125 
00126 public:
00127     NodeContour();
00128 
00129     NodeContour(Node* ContextNode,  
00130                 AttachNodeDirection Direction,  
00131                 BOOL Locked = FALSE, 
00132                 BOOL Mangled = FALSE,  
00133                 BOOL Marked = FALSE, 
00134                 BOOL Selected = FALSE    
00135                 ) ;
00136 
00137     ~NodeContour();
00138 
00139     // Copy functions
00140     virtual Node* SimpleCopy(); 
00141     void CopyNodeContents(NodeContour* pNewNode);
00142     virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00143 
00144     // get the bounding rect of me
00145     virtual DocRect GetBoundingRect(BOOL DontUseAttrs = FALSE, BOOL HitTest = FALSE);
00146     virtual DocRect GetBlobBoundingRect();
00147 
00148     virtual void RenderTinyBlobs(RenderRegion * pRegion);
00149 
00150     virtual void Render(RenderRegion* pRender);
00151 
00152     virtual BOOL DoBecomeA(BecomeA* pBecomeA);
00153     virtual BOOL CanBecomeA(BecomeA* pBecomeA); 
00154 
00155     virtual BOOL NeedsParent(Node* pClassNode) const;
00156     virtual NodeCompound* GetParentController() const;
00157 
00158     virtual String Describe(BOOL Plural, BOOL Verbose); 
00159 
00160     virtual BOOL IsAContour() const { return TRUE;}
00161     BOOL GenerateContour(List * pList = NULL, CCAttrMap * pAttrMap = NULL);
00162     
00163     void DeleteCache();
00164 
00165     void Transform(TransformBase &Trans);
00166 
00167     void RenderEorDrag(RenderRegion * pRender);
00168 
00169     // Version 2 file format functions
00170     virtual BOOL WritePreChildrenWeb(BaseCamelotFilter* pFilter);
00171     virtual BOOL WritePreChildrenNative(BaseCamelotFilter* pFilter);
00172 
00173     virtual BOOL AllowOp(ObjChangeParam *pParam, BOOL SetOpPermissionState = TRUE,
00174                                                  BOOL DoPreTriggerEdit = TRUE);
00175 
00176     // Karim MacDonald 25/11/1999
00177     // virtual Extend functions; see declaration/implementation in Node.
00178 public:
00179     virtual BOOL IsTypeExtendible() const { return TRUE; }
00180     virtual DocRect ValidateExtend(const ExtendParams& ExtParams);
00181     virtual void Extend(const ExtendParams& ExtParams);
00182 
00183     // smooths the path
00184     static BOOL SmoothPath(Path * pPath);
00185 
00186     virtual BOOL OnNodePopUp(Spread* pSpread, DocCoord PointerPos, ContextMenu* pMenu);
00187 
00188     static BOOL GenerateContourPathForNode( Path* pDestPath,
00189                                             Node* pSourceNode,
00190                                             const List* pSourceList,
00191                                             const MILLIPOINT nWidth,
00192                                             const BOOL fOuterContour    = TRUE,
00193                                             const JointType jt          = RoundJoin,
00194                                             const MILLIPOINT nFlatness  = -1,
00195                                             const BOOL fUseLineWidths   = TRUE,
00196                                             const BOOL fIncludeShadows  = FALSE );
00197 
00198     virtual INT32 EstimateNodeComplexity (OpParam* details);
00199 
00200 protected:
00201     // blend attributes function
00202     BOOL BlendAttributes(RenderRegion * pRender, CCAttrMap * pAttrMapStart, 
00203                          CCAttrMap * pEndAttrMap, CCAttrMap * pBlendedAttrMap, 
00204                          double BlendRatio);
00205 
00206     // copies all the attributes in the attribute map onto the node
00207     BOOL CopyAttributes(NodeRenderableInk * pNode, CCAttrMap * pAttrMap);
00208 
00209     // smooths all paths
00210     BOOL SmoothPaths();
00211 
00212     // finds the node I'm to use to blend colours from
00213     NodeRenderableInk * FindNodeToContour(NodeRenderableInk * pInk);
00214 
00215 protected:
00216     // the source path generated by the path processor
00217     Path m_SourcePath;
00218 
00219     // the path list generated by the contour
00220     Path * m_pPathList;
00221     INT32 m_NumPaths;
00222 
00223     BOOL m_FirstRender;
00224 
00225 } ;
00226 
00227 /***********************************************************************************************
00228 
00229 >   class ContourBecomeA: public BecomeA
00230 
00231     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com> Mc
00232     Created:    18/10/94
00233     Purpose:    This is used to turn all nodes which are to be contoured into a single path
00234 
00235 ***********************************************************************************************/
00236 
00237 class ContourBecomeA : public BecomeA
00238 {
00239 public:
00240     ContourBecomeA( BecomeAReason Reason,
00241                     CCRuntimeClass* pClass, 
00242                     UndoableOperation* pOp, 
00243                     BOOL Sel,
00244                     Path * pPathList,
00245                     Path * pSummedPath, 
00246                     INT32 Width,
00247                     INT32 NumSteps,
00248                     BOOL bOuter,
00249                     CProfileBiasGain &Profile,
00250                     JointType jt = RoundJoin,
00251                     double Flatness = 200.0,
00252                     BOOL bIncludeLineWidths = TRUE) : BecomeA(Reason, pClass, pOp, Sel)
00253     {
00254         m_pPathList = pPathList;
00255         m_bNodeIsPath = FALSE;
00256         m_Width = Width;
00257         m_NumSteps = NumSteps;
00258         m_pSummedPath = pSummedPath;
00259         m_bOuter = bOuter;
00260         m_Profile = Profile;
00261         m_Join    = jt;
00262         m_Flatness = Flatness;
00263         m_bIncludeLineWidths = bIncludeLineWidths;
00264 
00265         // we're only interested in the silhouettes of shapes.
00266         fSilhouette = TRUE;
00267 
00268         m_bContourBrush = FALSE;
00269     }
00270 
00271     // this sets the variable which tells the passback function that the next node
00272     // passed in is a path node
00273     void SetNodeIsPath(BOOL b) { m_bNodeIsPath = b; }
00274     
00275     // This function should be called when Reason == BECOMEA_PASSBACK 
00276     virtual BOOL PassBack(NodeRenderableInk* pNewNode,NodeRenderableInk* pCreatedByNode,CCAttrMap* pAttrMap);
00277 
00278     // MRH New Gavin Version!
00279     BOOL GenerateContourPaths(Path* pPathToContour, Path* pPathList, JointType jt, bool Outer = true,
00280                               bool UseContourMode = true, LineCapType ct = LineCapRound);
00281     
00282     void SetContourBrush(BOOL Set);
00283 protected:
00284     // DY we want to contour nodes with brushes applied to them, so heres a yucky special case function
00285     BOOL PassbackBrush(NodeRenderableInk* pCreatedByNode, NodeRenderableInk** ppNewNode);
00286 
00287 private:
00288     Path * m_pPathList;
00289     
00290     // the summed path of all nodes' paths which have been passed through the passback mecahnism
00291     Path * m_pSummedPath;
00292     INT32 m_NumSteps;
00293     INT32 m_Width;
00294     BOOL m_bNodeIsPath;
00295     BOOL m_bOuter;
00296     BOOL m_bIncludeLineWidths;
00297 
00298     CProfileBiasGain m_Profile;
00299 
00300     JointType m_Join;
00301 
00302     double m_Flatness;
00303 
00304     BOOL m_bContourBrush;
00305 
00306 };
00307 
00308 #endif // NODECNTR_H
00309 
00310 
00311 
00312     
00313 
00314 

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