nodepostpro.cpp

Go to the documentation of this file.
00001 // $Id: nodepostpro.cpp 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 /*
00100 */
00101 
00102 #include "camtypes.h"
00103 //#include "app.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 //#include "node.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00105 #include "nodepostpro.h"
00106 #include "attrmap.h"
00107 
00108 // Resource headers
00109 //#include "resource.h"
00110 //#include "mario.h"
00111 #include "lineattr.h"
00112 //#include "fillattr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00113 
00114 DECLARE_SOURCE( "$Revision: 1282 $" );
00115 
00116 CC_IMPLEMENT_DYNCREATE(NodeEffect, NodeCompound)
00117 
00118 // Declare smart memory handling in Debug builds
00119 #define new CAM_DEBUG_NEW
00120 
00121 /***********************************************************************************************
00122 
00123 >   NodeEffect::NodeEffect(Node*    ContextNode,
00124                         AttachNodeDirection Direction,
00125                         const DocRect&      BoundingRect,
00126                         BOOL                Locked = FALSE,
00127                         BOOL                Mangled = FALSE,
00128                         BOOL                Marked = FALSE,
00129                         BOOL                Selected = FALSE,
00130                         BOOL                Renderable = FALSE
00131                         )
00132 
00133     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00134     Created:    07/09/2004
00135     Inputs:     ContextNode: Pointer to a node which this node is to be attached to.
00136                 MonoOn Direction: MonoOff
00137                 Specifies the direction in which the node is to be attached to the
00138                 ContextNode. The values this variable can take are as follows:
00139                                   
00140                 PREV      : Attach node as a previous sibling of the context node
00141                 NEXT      : Attach node as a next sibling of the context node
00142                 FIRSTCHILD: Attach node as the first child of the context node
00143                 LASTCHILD : Attach node as a last child of the context node
00144 
00145                 BoundingRect: Bounding rectangle
00146 
00147                 The remaining inputs specify the status of the node:
00148             
00149                 Locked:     Is node locked ?
00150                 Mangled:    Is node mangled ?
00151                 Marked:     Is node marked ?
00152                 Selected:   Is node selected ?
00153 
00154     Purpose:    This constructor initialises the nodes flags and links it to ContextNode in the
00155                 direction specified by Direction. All neccesary tree links are updated.
00156     Note:       SetUpShape() must be called before the NodeRegularShape is in a state in which
00157                 it can be used.
00158     SeeAlso:    NodeRegularShape::SetUpShape
00159     Errors:     An ENSURE will occur if ContextNode is NULL
00160 
00161 ***********************************************************************************************/
00162 NodeEffect::NodeEffect(Node* ContextNode,  
00163                     AttachNodeDirection Direction,  
00164                     BOOL Locked, 
00165                     BOOL Mangled,  
00166                     BOOL Marked, 
00167                     BOOL Selected    
00168               ) : NodeCompound(ContextNode, Direction, Locked, Mangled, Marked, Selected )
00169 {                         
00170     m_strPostProID = String(_T(""));
00171 }                        
00172  
00173 /*********************************************************************************************
00174 
00175 >   NodeEffect::NodeEffect() 
00176 
00177     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00178     Created:    07/09/2004
00179     Purpose:    
00180     Note:       
00181     SeeAlso:    
00182 
00183 **********************************************************************************************/
00184 NodeEffect::NodeEffect() : NodeCompound()
00185 {
00186     m_strPostProID = String(_T(""));
00187 }
00188 
00189 /*********************************************************************************************
00190 
00191 >   NodeEffect::~NodeEffect() 
00192 
00193     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00194     Created:    07/09/2004
00195     Purpose:    Destructor
00196     Note:       
00197     SeeAlso:    
00198 
00199 **********************************************************************************************/
00200 NodeEffect::~NodeEffect()
00201 {
00202 }
00203 
00204 
00205 
00206 
00207 /********************************************************************************************
00208 
00209 >   SubtreeRenderState NodeEffect::RenderSubtree(RenderRegion* pRender, Node** ppNextNode, BOOL bClip)
00210 
00211     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00212     Created:    07/09/2004
00213     Inputs:     pRender - The region render into (or use as context for decisions about subtree)
00214                 ppNextNode - Address of node pointer for next node to render or run to after this
00215                 bClip - flag indicating whether to clip or not
00216     Purpose:    Do clever stuff on the way into a subtree, possibly modifying rendering
00217                 behaviour.
00218 
00219 ********************************************************************************************/
00220 
00221 SubtreeRenderState NodeEffect::RenderSubtree(RenderRegion* pRender, Node** ppNextNode, BOOL bClip)
00222 {
00223     if (pRender == NULL)                            // If no render region supplied, assume we need to be rendered
00224         return SUBTREE_ROOTANDCHILDREN;
00225 
00226     // Go find out about my bounding rectangle
00227     DocRect BoundingRect = GetBoundingRect();
00228     DocRect ClipRect = pRender->GetClipRect();
00229 
00230     if (bClip && !ClipRect.IsIntersectedWith(BoundingRect)) // If not within the clipping rect then
00231         return SUBTREE_NORENDER;                    // Don't render us or our children
00232 
00233     // Ask Helper function to set up cacheing for me...
00234 // AMB wonders whethere this was commented out during porting - 20051212
00235 //  if (RenderCached(pRender))                      // If we can find a cached bitmap for this node and render it
00236 //  {
00237 //      return SUBTREE_NORENDER;                    // Then tell the renderer to move on without doing any more...
00238 //  }
00239 
00240     return SUBTREE_ROOTANDCHILDREN;                 // Else we must render ourselves and our children
00241 }
00242 
00243 
00244 
00245 /********************************************************************************************
00246 
00247 >   void NodeEffect::RenderAfterSubtree(RenderRegion* pRender)
00248 
00249     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00250     Created:    07/09/2004
00251     Inputs:     pRender - The region to render into
00252     Purpose:    Capture the group as a cached bitmap
00253 
00254 ********************************************************************************************/
00255 
00256 void NodeEffect::RenderAfterSubtree(RenderRegion* pRegion)
00257 {
00258     // Deal with group transparency capture
00259     // Call Helper function to run all my cacheing functionality for me...
00260 //  CaptureCached(pRegion);
00261 }
00262 
00263 
00264 
00265 
00266 /***********************************************************************************************
00267 > Node* NodeEffect::SimpleCopy()  
00268 
00269     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00270     Created:    09/09/2004
00271     Inputs:     -  
00272     Outputs:    
00273     Returns:    A copy of the node, or NULL if memory has run out 
00274          
00275     Purpose:    This method returns a shallow copy of the node with all Node pointers NULL. 
00276                 The function is virtual, and must be defined for all derived classes.  
00277                 
00278     Errors:     If memory runs out when trying to copy, then ERROR is called with an out of memory
00279                 error and the function returns NULL.                                                                      
00280                                                                                  
00281 **********************************************************************************************/
00282 
00283 Node* NodeEffect::SimpleCopy()
00284 {
00285     NodeEffect* NodeCopy; 
00286     NodeCopy = new NodeEffect();
00287     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
00288     CopyNodeContents(NodeCopy);         
00289     return (NodeCopy);
00290 }   
00291 
00292 
00293 
00294    
00295 /***********************************************************************************************
00296 
00297 >   void NodeEffect::CopyNodeContents(Node* pCopyOfNode)
00298 
00299     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00300     Created:    09/09/2004
00301     Inputs:     pCopyOfNode - The node to copy data to
00302     Outputs:    -
00303     Returns:    -
00304     Purpose:    Copies the data from this node to pCopyOfNode by first calling the base class to get it to
00305                 copy its stuff, and then copying its own stuff
00306     Scope:      protected
00307     SeeAlso:    NodeGroup::CopyNodeContents
00308 
00309 ***********************************************************************************************/
00310 
00311 void NodeEffect::CopyNodeContents(NodeEffect* pCopyOfNode)
00312 {
00313     NodeCompound::CopyNodeContents(pCopyOfNode);
00314 
00315     // Copy member vars here
00316     pCopyOfNode->m_strPostProID = m_strPostProID;
00317 }
00318 
00319 
00320 
00321 
00322 /***********************************************************************************************
00323 >   void NodeEffect::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
00324 
00325     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00326     Created:    09/09/2004
00327     Outputs:    -
00328     Purpose:    Polymorphically copies the contents of this node to another
00329     Errors:     An assertion failure will occur if NodeCopy is NULL
00330     Scope:      protected
00331                                      
00332 ***********************************************************************************************/
00333 
00334 void NodeEffect::PolyCopyNodeContents(NodeRenderable* pNodeCopy)
00335 {
00336     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00337     ENSURE(IS_A(pNodeCopy, NodeEffect), "PolyCopyNodeContents given wrong dest node type");
00338 
00339     if (IS_A(pNodeCopy, NodeEffect))
00340         CopyNodeContents((NodeEffect*)pNodeCopy);
00341 }
00342 
00343 
00344 
00345 
00346 /********************************************************************************************
00347 
00348 >   void NodeEffect::IsValidEffectAttr(CCRuntimeClass* pAttrClass) const
00349 
00350     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00351     Created:    18/01/2005
00352     Inputs:     Attribute class
00353     Returns:    TRUE if the attr class is a valid effect attr
00354     Purpose:    Determine whether this type of attribute can be an effect attribute
00355                 On this node at this time.
00356 
00357 ********************************************************************************************/
00358 
00359 /*BOOL NodeEffect::IsValidEffectAttr(CCRuntimeClass* pAttrClass) const
00360 {
00361     return (AttrFillGeometry::s_bGroupTransparency &&
00362             (pAttr->IsATranspFill() ||
00363              pAttr->IsKindOf(CC_RUNTIME_CLASS(AttrTranspChange)) ||
00364              pAttr->IsKindOf(CC_RUNTIME_CLASS(AttrStrokeTranspChange)
00365              )
00366             );
00367 }*/
00368 
00369     
00370     
00371     
00372 /********************************************************************************************
00373 
00374 >   void NodeEffect::IsValidEffectAttr(NodeAttribute* pAttr) const
00375 
00376     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00377     Created:    18/01/2005
00378     Inputs:     Attribute
00379     Returns:    TRUE if the attr is a valid effect attr
00380     Purpose:    Determine whether this attribute instance can be an effect attribute
00381                 On this node at this time.
00382 
00383 ********************************************************************************************/
00384 
00385 BOOL NodeEffect::IsValidEffectAttr(NodeAttribute* pAttr) const
00386 {
00387     CCRuntimeClass* pAttrType = pAttr->GetAttributeType();
00388 
00389     return (pAttr->IsATranspFill() ||
00390             pAttrType == CC_RUNTIME_CLASS(AttrTranspFillGeometry) || //->IsKindOf(CC_RUNTIME_CLASS(AttrTranspChange)) ||
00391             pAttrType == CC_RUNTIME_CLASS(AttrStrokeTransp) || //pAttr->IsKindOf(CC_RUNTIME_CLASS(AttrStrokeTranspChange)) ||
00392             pAttrType == CC_RUNTIME_CLASS(AttrTranspFillMapping)
00393             );
00394 }
00395 
00396 
00397 
00398 

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