00001 // $Id: ndmldink.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 "ndmldink.h" 00104 #include "nodemldr.h" 00105 #include "moldshap.h" 00106 #include "nodebmp.h" 00107 //#include "mike.h" 00108 //#include "mario.h" 00109 #include "nodemold.h" 00110 //#include "bitmap.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00111 00112 DECLARE_SOURCE("$Revision: 1282 $"); 00113 00114 CC_IMPLEMENT_DYNAMIC( NodeMouldBitmap, NodeRenderableInk ) 00115 00116 #define new CAM_DEBUG_NEW 00117 00118 00119 00120 /********************************************************************************************* 00121 00122 > NodeMouldBitmap::NodeMouldBitmap() 00123 00124 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 00125 Created: 19/12/94 00126 Inputs: 00127 Outputs: 00128 Returns: 00129 Purpose: This constructor creates a NodeMouldBitmap linked to no other, with all status 00130 flags false and an uninitialised bounding rectangle. 00131 Errors: 00132 00133 **********************************************************************************************/ 00134 00135 NodeMouldBitmap::NodeMouldBitmap(): NodeRenderableInk() 00136 { 00137 } 00138 00139 00140 /*********************************************************************************************** 00141 00142 > void NodeMouldBitmap::NodeMouldBitmap 00143 ( 00144 Node* ContextNode, 00145 AttachNodeDirection Direction, 00146 BOOL Locked = FALSE, 00147 BOOL Mangled = FALSE, 00148 BOOL Marked = FALSE, 00149 BOOL Selected = FALSE, 00150 ) 00151 00152 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 00153 Created: 5/12/94 00154 Inputs: ContextNode: Pointer to a node which this node is to be attached to. 00155 00156 Direction: 00157 00158 Specifies the direction in which this node is to be attached to the 00159 ContextNode. The values this variable can take are as follows: 00160 00161 PREV : Attach node as a previous sibling of the context node 00162 NEXT : Attach node as a next sibling of the context node 00163 FIRSTCHILD: Attach node as the first child of the context node 00164 LASTCHILD : Attach node as a last child of the context node 00165 00166 The remaining inputs specify the status of the node: 00167 00168 Locked: Is node locked ? 00169 Mangled: Is node mangled ? 00170 Marked: Is node marked ? 00171 Selected: Is node selected ? 00172 00173 Outputs: - 00174 Returns: - 00175 Purpose: This method initialises the node and links it to ContextNode in the 00176 direction specified by Direction. All necessary tree links are 00177 updated. 00178 00179 Errors: An assertion error will occur if ContextNode is NULL 00180 00181 00182 ***********************************************************************************************/ 00183 00184 NodeMouldBitmap::NodeMouldBitmap(Node* ContextNode, 00185 AttachNodeDirection Direction, 00186 BOOL Locked, 00187 BOOL Mangled, 00188 BOOL Marked, 00189 BOOL Selected 00190 ):NodeRenderableInk(ContextNode, Direction, Locked, Mangled, Marked, Selected) 00191 { 00192 } 00193 00194 00195 /********************************************************************************************* 00196 00197 > NodeMouldBitmap::~NodeMouldBitmap() 00198 00199 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 00200 Created: 5/12/94 00201 Purpose: default destructor for the NodeMouldBitmap class 00202 00203 **********************************************************************************************/ 00204 00205 NodeMouldBitmap::~NodeMouldBitmap() 00206 { 00207 } 00208 00209 00210 00211 /*********************************************************************************************** 00212 00213 > void NodeMouldBitmap::Render(RenderRegion* pRender) 00214 00215 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 00216 Created: 19/12/94 00217 Inputs: Pointer to a render region 00218 Purpose: Will construct a moulded path from the renderable reference nodes bounding 00219 rectangle and render the reference node into it. 00220 This currently only makes sense for bitmap nodes. These are usually rendered 00221 as bitmap fills inside a rectangle. If we can generate the destination path 00222 by moulding the NodeBitmap bounding rectangle, we should be able to render 00223 the bitmap into the result. 00224 00225 ***********************************************************************************************/ 00226 00227 void NodeMouldBitmap::Render(RenderRegion* pRegion) 00228 { 00229 // find the mould root object 00230 /* 00231 NodeMould* pNodeMould = (NodeMould*)this->FindParent(CC_RUNTIME_CLASS(NodeMould)); 00232 MouldGeometry* pMouldGeom = pNodeMould->GetGeometry(); 00233 if (pMouldGeom) 00234 pMouldGeom->MouldBitmapRender(&TheBitmap, Parallel, pRegion); 00235 */ 00236 } 00237 00238 00239 /******************************************************************************************** 00240 00241 > virtual String NodeMouldBitmap::Describe(BOOL Plural, BOOL Verbose = TRUE) 00242 00243 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 00244 Created: 19/12/94 00245 Inputs: Plural: Flag indicating if the string description should be plural or 00246 singular. 00247 Outputs: - 00248 Retuns: Description of the mould node 00249 Purpose: To return a description of the NodeMouldBitmap object in either the singular 00250 or the plural. This method is called by the DescribeRange method. 00251 The description will always begin with a lower case letter. 00252 Errors: - 00253 SeeAlso: - 00254 00255 ********************************************************************************************/ 00256 00257 String NodeMouldBitmap::Describe(BOOL Plural, BOOL Verbose) 00258 { 00259 if (Plural) 00260 return(String(_R(IDS_MOULDINK_DESCRP))); 00261 else 00262 return(String(_R(IDS_MOULDINK_DESCRS))); 00263 }; 00264 00265 00266 00267 00268 /*********************************************************************************************** 00269 00270 > Node* NodeMouldBitmap::SimpleCopy() 00271 00272 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 00273 Created: 19/12/94 00274 Inputs: - 00275 Outputs: - 00276 Returns: A copy of the node, or NULL if memory has run out 00277 00278 Purpose: This method returns a shallow copy of the node with all Node pointers NULL. 00279 The function is virtual, and must be defined for all derived classes. 00280 00281 Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory 00282 error and the function returns NULL. 00283 00284 **********************************************************************************************/ 00285 00286 Node* NodeMouldBitmap::SimpleCopy() 00287 { 00288 NodeMouldBitmap* pCopyOfNode = new NodeMouldBitmap(); 00289 ERROR1IF(pCopyOfNode == NULL,NULL,_R(IDE_NOMORE_MEMORY)); 00290 CopyNodeContents(pCopyOfNode); 00291 return (pCopyOfNode); 00292 } 00293 00294 00295 /*********************************************************************************************** 00296 00297 > void NodeMouldBitmap::CopyNodeContents(NodeMouldBitmap* pCopyOfNode) 00298 00299 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 00300 Created: 19/12/94 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 00305 to get it to copy its stuff, and then copying its own stuff 00306 00307 ***********************************************************************************************/ 00308 00309 void NodeMouldBitmap::CopyNodeContents(NodeMouldBitmap* pCopyOfNode) 00310 { 00311 ERROR3IF(pCopyOfNode == NULL,"NodeMouldBitmap::CopyNodeContents was asked to copy into a NULL pointer"); 00312 00313 // Copy from the base class 00314 NodeRenderableInk::CopyNodeContents(pCopyOfNode); 00315 00316 } 00317 00318 00319 /*********************************************************************************************** 00320 > void NodeMouldBitmap::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 00321 00322 Author: Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> 00323 Created: 18/12/2003 00324 Outputs: - 00325 Purpose: Polymorphically copies the contents of this node to another 00326 Errors: An assertion failure will occur if NodeCopy is NULL 00327 Scope: protected 00328 00329 ***********************************************************************************************/ 00330 00331 void NodeMouldBitmap::PolyCopyNodeContents(NodeRenderable* pNodeCopy) 00332 { 00333 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 00334 ENSURE(IS_A(pNodeCopy, NodeMouldBitmap), "PolyCopyNodeContents given wrong dest node type"); 00335 00336 if (IS_A(pNodeCopy, NodeMouldBitmap)) 00337 CopyNodeContents((NodeMouldBitmap*)pNodeCopy); 00338 } 00339 00340 00341 00342 /******************************************************************************************** 00343 00344 > virtual UINT32 NodeMouldBitmap::GetNodeSize() const 00345 00346 Author: Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com> 00347 Created: 19/12/94 00348 Inputs: - 00349 Outputs: - 00350 Returns: The size of the node in bytes 00351 Purpose: For finding the size of the node 00352 00353 ********************************************************************************************/ 00354 00355 UINT32 NodeMouldBitmap::GetNodeSize() const 00356 { 00357 return (sizeof(NodeMouldBitmap)); 00358 }