00001 // $Id: group.h 751 2006-03-31 15:43: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 // Group and OpEditGroup definitions 00099 00100 #ifndef INC_GROUP 00101 #define INC_GROUP 00102 00103 #include "ink.h" 00104 #include "nodecomp.h" 00105 00106 00107 class RenderRegion; 00108 class String_32; 00109 class NodeRect; 00110 class BecomeA; 00111 00112 /******************************************************************************************** 00113 00114 > class NodeGroup: public NodeCompound 00115 00116 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00117 Created: 28/9/93 00118 Purpose: Group Node 00119 00120 ********************************************************************************************/ 00121 00122 class NodeGroup: public NodeCompound 00123 { 00124 public: 00125 00126 CC_DECLARE_DYNAMIC( NodeGroup ) 00127 00128 NodeGroup(); 00129 00130 NodeGroup(Node* ContextNode, 00131 AttachNodeDirection Direction, 00132 BOOL Locked=FALSE, 00133 BOOL Mangled=FALSE, 00134 BOOL Marked=FALSE, 00135 BOOL Selected=FALSE 00136 ); 00137 00138 // virtual ID fn for a group node. 00139 virtual BOOL IsAGroup() const { return TRUE; } 00140 00141 // virtual Functions to deal with bounding boxes 00142 virtual DocRect GetBoundingRect(BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE); 00143 virtual DocRect GetBlobBoundingRect(); 00144 virtual DocRect GetEorDragBoundingRect(); 00145 virtual void Transform(TransformBase&); 00146 00147 // Virtual rendering functions 00148 // virtual void Render(RenderRegion* pRRegion); 00149 virtual void PreExportRender( RenderRegion* pRender ); 00150 virtual BOOL ExportRender( RenderRegion* pRender ); 00151 virtual SubtreeRenderState RenderSubtree(RenderRegion* pRender, Node** ppNextNode = NULL, BOOL bClip = TRUE); 00152 virtual void RenderAfterSubtree(RenderRegion* pRender); 00153 00154 // Selection Functions 00155 virtual void RenderObjectBlobs(RenderRegion* pRender); 00156 virtual void RenderTinyBlobs(RenderRegion* pRender); 00157 00158 // Other virtual functions 00159 virtual String Describe(BOOL Plural, BOOL Verbose); 00160 virtual Node* SimpleCopy(); 00161 void CopyNodeContents(NodeGroup* NodeCopy); 00162 virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy); 00163 virtual UINT32 GetNodeSize() const; // Returns size of node in bytes 00164 00165 // Fuctions that allows ops and other nodes to inform this node of events on it's children 00166 virtual ChangeCode OnChildChange(ObjChangeParam* pParam); 00167 00168 // Functions to deal with messages 00169 virtual BOOL OnClick( DocCoord, ClickType, ClickModifiers, Spread* ); 00170 00171 // Version 2 file format functions 00172 virtual BOOL WritePreChildrenWeb(BaseCamelotFilter* pFilter); 00173 virtual BOOL WritePreChildrenNative(BaseCamelotFilter* pFilter); 00174 virtual BOOL WriteBoundsRecord(BaseCamelotFilter* pFilter); 00175 virtual BOOL WillWriteBounds(BaseCamelotFilter* pFilter); 00176 00177 // Progressive rendering & the new file format 00178 virtual BOOL AreYouSafeToRender(); 00179 00180 // Effect Attribute functions 00181 virtual BOOL RenderTight(RenderRegion* pRender); 00182 virtual BOOL CaptureTight(RenderRegion* pRender); 00183 virtual double GetTightGroupPixelsPerInch(RenderRegion* pRender=NULL) const; 00184 virtual double GetTightGroupPixelWidth(RenderRegion* pRender=NULL) const {return 72000.0/GetTightGroupPixelsPerInch(pRender);} 00185 virtual void TransformTight(TransformBase& Trans, double dTestPixelWidth); 00186 00187 // virtual BOOL IsValidEffectAttr(CCRuntimeClass* pAttrClass) const; 00188 virtual BOOL IsValidEffectAttr(NodeAttribute* pAttr) const; 00189 virtual BOOL GroupCanTransformCached(TransformBase& Trans) const {return TRUE;} 00190 00191 protected: 00192 // BOOL CopyEffectAttrsFrom(NodeGroup* pSrcNode); 00193 }; 00194 00195 /******************************************************************************************** 00196 00197 > class NodeListItemWithDocPtr : public NodeListItem 00198 00199 Author: Chris_Snook (Xara Group Ltd) <camelotdev@xara.com> 00200 Created: 10/7/2000 00201 Purpose: This is used to allows blends of compounds to manage memory correctly. 00202 The class stores a pointer to the owning document - so that when the 00203 document dies, we only kill nodes associated with that document. 00204 SeeAlso: Range::MakeListOfNodes 00205 00206 ********************************************************************************************/ 00207 00208 class NodeListItemWithDocPtr : public NodeListItem 00209 { 00210 public: 00211 CC_DECLARE_DYNAMIC( NodeListItemWithDocPtr ) 00212 NodeListItemWithDocPtr(); // will contain a NULL pointer 00213 NodeListItemWithDocPtr(Node* WhichNode); // initialise pNode to be WhichNode 00214 ~NodeListItemWithDocPtr() {} // Nothing to destruct 00215 00216 Node* pNode; // pointer to a node 00217 Document* pOwner; // ptr to the owning doc 00218 BOOL isForPrinting; // was the node generated for use in printing? 00219 }; 00220 00221 00222 00223 /******************************************************************************************** 00224 00225 > class OpEditGroup : public SelOperation 00226 00227 Author: Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> 00228 Created: 28/09/94 00229 Purpose: This operation handles the resizing of a group. It is usually 00230 started when the Group detects a drag on one of its selected blobs. 00231 00232 ********************************************************************************************/ 00233 #if 0 00234 class OpEditGroup : public SelOperation 00235 { 00236 CC_DECLARE_DYNCREATE(OpEditGroup); 00237 00238 public: 00239 // Construction/Destruction 00240 OpEditGroup(); 00241 00242 // The all important Do functions 00243 //void DoDrag(DocCoord Anchor, Spread*, NodeRect *pRect, INT32 FixedCorner); 00244 void DoWithParam(OpDescriptor* OpDesc, OpParam* pOpParam); 00245 00246 // Virtual functions needed for the dragging operations to work 00247 virtual void DragPointerMove(DocCoord PointerPos, ClickModifiers ClickMods, Spread*, BOOL bSolidDrag); 00248 virtual void DragFinished(DocCoord PointerPos, ClickModifiers ClickMods, Spread*, BOOL Success, BOOL bSolidDrag); 00249 00250 // Some Render functions to will draw the EORed group 00251 virtual void RenderDragBlobs(DocRect, Spread*, BOOL bSolidDrag); 00252 00253 // These functions required for the OpDescriptor class 00254 static BOOL Init(); 00255 static OpState GetState(String_256* Description, OpDescriptor*); 00256 00257 private: 00258 // Function to deal with all the undo stuff 00259 BOOL CompleteOperation(); 00260 00261 // Function to calculate the position of the rectangle after one of the corners moves 00262 void RebuildParallelogram(DocCoord PointerPos); 00263 DocRect GetDragBlobRect(); 00264 00265 // Vars 00266 protected: 00267 // Information we need to draw the EORed rectangle 00268 DocCoord Parallel[4]; // The coords of the parallelogram 00269 INT32 FixedCorner; // The corner of the rectangle that is not moving 00270 00271 // Infomation about what we are editing 00272 NodeRect* OldRect; 00273 00274 BOOL UseRect; 00275 NodeRect* RectPath; 00276 Spread* StartSpread; 00277 00278 // Mouse Positions 00279 DocCoord StartPoint; 00280 DocCoord LastMousePosition; 00281 }; 00282 #endif 00283 00284 #endif