cxftree.h

Go to the documentation of this file.
00001 // $Id: cxftree.h 1693 2006-08-11 18:04:37Z 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_CXFTREE
00100 #define INC_CXFTREE
00101 
00102 //#include "dialogop.h"
00103 //#include "list.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 //#include "listitem.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00105 //#include "timdlg.h"
00106 
00107 //#include "cxfrec.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 //#include "cxfrech.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00109 
00110 // -----------------------------------------------------------------------------------------
00111 // CXFTreeDlg for displaying the Camelot v2 file format
00112  
00113 #define OPTOKEN_CXFTREEDLG _T("CXFTreeDlg")    
00114 
00115 class CXFTreeDlg;
00116 class DebugTreeInfo;
00117 class CXaraFileRecordHandler;
00118 class CXaraFile;
00119 
00120 class CXFNode : public CCObject
00121 {
00122     CC_DECLARE_DYNAMIC( CXFNode )
00123 public:
00124 
00125     CXFNode() {}
00126     CXFNode(CXaraFileRecord* pThisRecord);
00127     ~CXFNode();
00128 
00129     void SetNext(CXFNode * pRecord)     { pNext     = pRecord; }
00130     void SetPrevious(CXFNode* pRecord)  { pPrevious = pRecord; }
00131     void SetParent(CXFNode* pRecord)    { pParent   = pRecord; }
00132     void SetChild(CXFNode* pRecord)     { pChild    = pRecord; }
00133 
00134     CXFNode* GetNext()          { return pNext;     }
00135     CXFNode* GetPrevious()      { return pPrevious; }
00136     CXFNode* GetParent()        { return pParent;   }
00137     CXFNode* GetChild()         { return pChild;    }
00138 
00139     CXaraFileRecord* GetCXaraFileRecord() { return pRecord; }
00140 
00141     UINT32 GetTag();
00142     UINT32 GetSize();
00143     void  ResetReadPos();
00144 
00145     BOOL HasChildren()           { return pChild != NULL; }
00146     BOOL ShowChildren()          { return DoShowChildren; }
00147     void SetShowChildren(BOOL b) { DoShowChildren = b; }
00148 
00149 private:
00150 
00151     CXaraFileRecord* pRecord;
00152 
00153     CXFNode* pNext;
00154     CXFNode* pPrevious;
00155     CXFNode* pParent;
00156     CXFNode* pChild;
00157 
00158     BOOL DoShowChildren;
00159 };
00160 
00161 //---------------------------------------------------------------------
00162 //---------------------------------------------------------------------
00163 //---------------------------------------------------------------------
00164 
00165 class CXFTreeDlgRecordHandler : public CXaraFileRecordHandler
00166 {
00167     // Give my name in memory dumps
00168     CC_DECLARE_DYNAMIC(CXFTreeDlgRecordHandler);
00169 
00170 public:
00171     CXFTreeDlgRecordHandler(CXFTreeDlg* pDlg,CXaraFile* pCXFile);
00172     ~CXFTreeDlgRecordHandler() {}
00173 
00174     virtual UINT32* GetTagList() { return NULL; }
00175     virtual BOOL    HandleRecord(CXaraFileRecord* pCXaraFileRecord);
00176     virtual BOOL    HandleStreamedRecord(CXaraFile * pCXFile, UINT32 Tag,UINT32 Size,UINT32 RecordNumber);
00177     virtual void    IncProgressBarCount(UINT32 n) {}
00178     virtual BOOL    IsStreamed(UINT32 Tag);
00179 
00180 private:
00181     CXFTreeDlg* pCXFDlg;
00182     CXaraFile* pCXFile;
00183 };
00184 
00185 
00186 /********************************************************************************************
00187 
00188 >   class CXFNodeTypeStatistics : public ListItem
00189 
00190     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00191     Created:    2/10/96
00192     Purpose:    Holds info relating to a node of a particular type (i.e. tag value)
00193     SeeAlso:    CXFTreeDlg
00194 
00195 ********************************************************************************************/
00196 
00197 class CXFNodeTypeStatistics : public ListItem
00198 {
00199     CC_DECLARE_MEMDUMP( CXFNodeTypeStatistics )
00200 public:
00201 
00202     CXFNodeTypeStatistics(UINT32 ThisTag) { Tag = ThisTag; NumOccurrences = 0; TotalSize = 0; }
00203 
00204     void    IncNumOccurances()      { NumOccurrences++; }
00205     void    AddToTotalSize(INT32 s) { TotalSize += s; }
00206 
00207     UINT32  GetTag()                { return Tag; }
00208     INT32   GetNumOccurances()      { return NumOccurrences; }
00209     INT32   GetTotalSize()          { return TotalSize; }
00210 
00211 private:
00212     UINT32  Tag;
00213     INT32   NumOccurrences;
00214     INT32   TotalSize;
00215 };
00216 
00217 /********************************************************************************************
00218 
00219 >   class CXFNodeTypeStatisticsList : public List
00220 
00221     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00222     Created:    2/10/96
00223     Purpose:    Class that maintains statistics on the nodes added to the tree
00224     SeeAlso:    CXFTreeDlg
00225 
00226 ********************************************************************************************/
00227 
00228 class CXFNodeTypeStatisticsList : public List
00229 {
00230     CC_DECLARE_MEMDUMP( CXFNodeTypeStatisticsList )
00231 public:
00232 
00233     void Update(CXFNode* pNode);
00234     void Dump(CXFTreeDlg* pDlg);
00235 
00236 private:
00237     CXFNodeTypeStatistics*  FindNodeType(UINT32 Tag);
00238     void                    Add(CXFNodeTypeStatistics* pNodeType);
00239     CXFNodeTypeStatistics*  GetHead();
00240     CXFNodeTypeStatistics*  GetNext(CXFNodeTypeStatistics* pItem);
00241 };
00242 
00243 //---------------------------------------------------------------------
00244 //---------------------------------------------------------------------
00245 //---------------------------------------------------------------------
00246 
00247 
00248 
00249 
00250 //---------------------------------------------------------------------
00251 //---------------------------------------------------------------------
00252 //---------------------------------------------------------------------
00253 
00254 class CXFTreeDlg : public DialogOp
00255 {
00256     CC_DECLARE_DYNCREATE( CXFTreeDlg )
00257 public:
00258 
00259     CXFTreeDlg();
00260     ~CXFTreeDlg();
00261 
00262     MsgResult Message( Msg* Message);
00263     void Do(OpDescriptor*);
00264     BOOL Create();
00265 
00266     static CDlgResID IDD() {return _R(IDD_NEWDEBUGTREE);}
00267 
00268     static BOOL Init();
00269     static OpState GetState(String_256*, OpDescriptor*);
00270     static CXFTreeDlg* GetCurrentCXFTreeDlg() { return pCurrentCXFTreeDlg; }
00271 
00272     void SetFileName(String_256& FileName);
00273 
00274     void SetEndOfFile(BOOL b) { EndOfFile = b; }
00275 
00276     void AddNode(CXFNode *pNode);
00277 
00278     void ShowFile(TCHAR* pFileName);
00279 
00280     void GetTagText(UINT32 Tag,String_256& Str);
00281 
00282 private:
00283     void DeInit();
00284 
00285     void CreateTree();
00286     void Delete(CXFNode* pNode);
00287 
00288     INT32 AddDisplayNode(CXFNode* pNode,INT32 Index,INT32 Depth,BOOL ExpandAll);
00289     void ShowNodeDebugInfoForNode(CXFNode *pNode);
00290     CXaraFileRecordHandler* FindHandler(UINT32 Tag);
00291     void GetTagText(CXFNode* pNode,String_256& Str);
00292 
00293     CXFNode* pRoot;
00294     CXFNode* pContextNode;
00295     BOOL AddNextAsChild;
00296     INT32 Level;
00297     INT32 MaxIndex;
00298 
00299     String_256 FileName;
00300     BOOL EndOfFile;
00301 
00302     StringBase* EditStr;
00303 
00304     CXFNodeTypeStatisticsList ListOfNodeTypeStats;
00305 
00306     static CXFTreeDlg* pCurrentCXFTreeDlg;
00307     static BOOL     s_bExpandClicked;
00308 
00309     // New TreeView stuff
00310     CTreeItemID AddOneItem(CTreeItemID hParent, const StringBase& str, CTreeItemID hInsAfter, INT32 iImage, CXFNode *pNode);
00311     CTreeItemID AddItemToNewTreeControl(CTreeItemID hParentItem, CTreeItemID hInsAfterItem, CXFNode *pNode, BOOL bAddChildren);
00312     BOOL InitialiseNewTreeControl(void);
00313     INT32 GetImageForNode(CXFNode *pNode);
00314     BOOL GetInfoFromTreeItem(CTreeItemID hItem, CXFNode **pNode, INT32 *pChildren);
00315     void ExpandNewTree();
00316 
00317     // Pictures for tree view
00318     INT32 m_idxGeneralTag;
00319     INT32 m_idxDefineBitmap;
00320     INT32 m_idxDefineColour;
00321     INT32 m_idxCompression;
00322     INT32 m_idxDown;
00323     INT32 m_idxUp;
00324     INT32 m_idxGroup;
00325     INT32 m_idxPage;
00326     INT32 m_idxAttribute;
00327     INT32 m_idxShape;
00328     INT32 m_idxSentinelNode;
00329     INT32 m_idxSetProperty;
00330 };
00331 
00332 #endif // INC_CXFTREE
00333 

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