cmxtree.h

Go to the documentation of this file.
00001 // $Id: cmxtree.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 INC_CMXTREE
00100 #define INC_CMXTREE
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"
00108 //#include "cxfrech.h"
00109 //#include "cdrfiltr.h"
00110 #include "rifffile.h"
00111 
00112 // -----------------------------------------------------------------------------------------
00113 // CMXTreeDlg for displaying the Camelot v2 file format
00114  
00115 #define OPTOKEN_CMXTREEDLG _T("CMXTreeDlg")    
00116 
00117 class CMXTreeDlg;
00118 class DebugTreeInfo;
00119 class CCFile;
00120 //class RIFFFile;
00121 
00122 /* class CMXFileRecordHandler : public CC_CLASS_MEMDUMP
00123 {
00124     CC_DECLARE_MEMDUMP( CMXFileRecordHandler )
00125 public:
00126 
00127     CMXFileRecordHandler() {}
00128     ~CMXFileRecordHandler() {}
00129 }; */
00130 
00131 class CMXFileRecord : public CC_CLASS_MEMDUMP
00132 {
00133     CC_DECLARE_MEMDUMP( CMXFileRecord )
00134 public:
00135 
00136     CMXFileRecord() {}
00137     CMXFileRecord(RIFFObjectType ObjectType, FOURCC ChunkType, UINT32 ChunkSize, UINT32 ObjectLevel)
00138         {
00139             m_ObjectType = ObjectType;
00140             m_ChunkType = ChunkType;
00141             m_ChunkSize = ChunkSize;
00142             m_ObjectLevel = ObjectLevel;
00143         }
00144 
00145     ~CMXFileRecord() {}
00146 
00147     RIFFObjectType  GetObjectType()     { return m_ObjectType; }
00148     FOURCC          GetChunkType()      { return m_ChunkType; }
00149     UINT32          GetChunkSize()      { return m_ChunkSize; }
00150     UINT32          GetObjectLevel()    { return m_ObjectLevel; }
00151 
00152     virtual INT32  GetRecordNumber() { return m_RecordNumber; }
00153     virtual void  SetRecordNumber(UINT32 n) { m_RecordNumber = n; }
00154 
00155 protected:
00156     RIFFObjectType  m_ObjectType;
00157     FOURCC  m_ChunkType;
00158     UINT32  m_ChunkSize;
00159     UINT32  m_ObjectLevel;
00160 
00161     INT32   m_RecordNumber;
00162 };
00163 
00164 
00165 class CMXNode : public CC_CLASS_MEMDUMP
00166 {
00167     CC_DECLARE_MEMDUMP( CMXNode )
00168 public:
00169 
00170     CMXNode() {}
00171     CMXNode(CMXFileRecord* pThisRecord);
00172     ~CMXNode();
00173 
00174     void SetNext(CMXNode * pRecord)     { pNext     = pRecord; }
00175     void SetPrevious(CMXNode* pRecord)  { pPrevious = pRecord; }
00176     void SetParent(CMXNode* pRecord)    { pParent   = pRecord; }
00177     void SetChild(CMXNode* pRecord)     { pChild    = pRecord; }
00178 
00179     CMXNode* GetNext()          { return pNext;     }
00180     CMXNode* GetPrevious()      { return pPrevious; }
00181     CMXNode* GetParent()        { return pParent;   }
00182     CMXNode* GetChild()         { return pChild;    }
00183 
00184     CMXFileRecord* GetCMXFileRecord() { return pRecord; }
00185 
00186     RIFFObjectType  GetObjectType();
00187     FOURCC  GetChunkType();
00188     UINT32  GetChunkSize();
00189     UINT32  GetObjectLevel();
00190 
00191     //UINT32 GetTag();
00192     //UINT32 GetSize();
00193     void  ResetReadPos();
00194 
00195     BOOL HasChildren()           { return pChild != NULL; }
00196     BOOL ShowChildren()          { return DoShowChildren; }
00197     void SetShowChildren(BOOL b) { DoShowChildren = b; }
00198 
00199 private:
00200 
00201     CMXFileRecord* pRecord;
00202 
00203     CMXNode* pNext;
00204     CMXNode* pPrevious;
00205     CMXNode* pParent;
00206     CMXNode* pChild;
00207 
00208     BOOL DoShowChildren;
00209 };
00210 
00211 //---------------------------------------------------------------------
00212 //---------------------------------------------------------------------
00213 //---------------------------------------------------------------------
00214 
00215 class CMXTreeDlgRecordHandler : public CC_CLASS_MEMDUMP //CMXFileRecordHandler
00216 {
00217     // Give my name in memory dumps
00218     CC_DECLARE_MEMDUMP( CMXTreeDlgRecordHandler )
00219     //CC_DECLARE_DYNAMIC(CMXTreeDlgRecordHandler);
00220 
00221 public:
00222     CMXTreeDlgRecordHandler(CMXTreeDlg* pDlg, CCFile* pCMXile);
00223     ~CMXTreeDlgRecordHandler() {}
00224 
00225     virtual UINT32* GetTagList() { return NULL; }
00226     virtual BOOL    HandleRecord(CMXFileRecord* pCMXFileRecord);
00227     virtual void    IncProgressBarCount(UINT32 n) {}
00228 
00229     virtual void    GetTagText(FOURCC ChunkType, String_256& Str);
00230     virtual void    GetRecordDescriptionText(CMXFileRecord* pCMXFileRecord,StringBase* Str);
00231 
00232 private:
00233     CMXTreeDlg* pCMXDlg;
00234     CCFile* pCMXile;
00235 };
00236     
00237 //---------------------------------------------------------------------
00238 //---------------------------------------------------------------------
00239 //---------------------------------------------------------------------
00240 
00241 /********************************************************************************************
00242 
00243 >   class CMXNodeInfo : public CC_CLASS_MEMDUMP
00244 
00245     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> from Markn code
00246     Created:    7/11/97
00247     Purpose:    Hold information on a node displayed in the tree dialog.
00248     SeeAlso:    CMXTreeDlg
00249 
00250 ********************************************************************************************/
00251 
00252 class CMXNodeInfo : public CC_CLASS_MEMDUMP
00253 {
00254     CC_DECLARE_MEMDUMP( CMXNodeInfo  )
00255 public:
00256     CMXNode* pNode;
00257 };
00258 
00259 
00260 /********************************************************************************************
00261 
00262 >   class CMXNodeTypeStatistics : public ListItem
00263 
00264     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> from Markn code
00265     Created:    7/11/97
00266     Purpose:    Holds info relating to a node of a particular type (i.e. tag value)
00267     SeeAlso:    CMXTreeDlg
00268 
00269 ********************************************************************************************/
00270 
00271 class CMXNodeTypeStatistics : public ListItem
00272 {
00273     CC_DECLARE_MEMDUMP( CMXNodeTypeStatistics )
00274 public:
00275 
00276     CMXNodeTypeStatistics(FOURCC ThisChunk) { m_ChunkType = ThisChunk; NumOccurrences = 0; TotalSize = 0; }
00277 
00278     void    IncNumOccurances()      { NumOccurrences++; }
00279     void    AddToTotalSize(INT32 s) { TotalSize += s; }
00280 
00281     FOURCC  GetChunkType()          { return m_ChunkType; }
00282     //  UINT32  GetTag()                { return Tag; }
00283     INT32   GetNumOccurances()      { return NumOccurrences; }
00284     INT32   GetTotalSize()          { return TotalSize; }
00285 
00286 private:
00287     FOURCC  m_ChunkType;
00288 //  UINT32  Tag;
00289     INT32   NumOccurrences;
00290     INT32   TotalSize;
00291 };
00292 
00293 /********************************************************************************************
00294 
00295 >   class CMXNodeTypeStatisticsList : public List
00296 
00297     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> from Markn code
00298     Created:    7/11/97
00299     Purpose:    Class that maintains statistics on the nodes added to the tree
00300     SeeAlso:    CMXTreeDlg
00301 
00302 ********************************************************************************************/
00303 
00304 class CMXNodeTypeStatisticsList : public List
00305 {
00306     CC_DECLARE_MEMDUMP( CMXNodeTypeStatisticsList )
00307 public:
00308 
00309     void Update(CMXNode* pNode);
00310     void Dump(CMXTreeDlg* pDlg);
00311 
00312 private:
00313     CMXNodeTypeStatistics*  FindNodeType(UINT32 Tag);
00314     void                    Add(CMXNodeTypeStatistics* pNodeType);
00315     CMXNodeTypeStatistics*  GetHead();
00316     CMXNodeTypeStatistics*  GetNext(CMXNodeTypeStatistics* pItem);
00317 };
00318 
00319 //---------------------------------------------------------------------
00320 //---------------------------------------------------------------------
00321 //---------------------------------------------------------------------
00322 
00323 
00324 
00325 
00326 //---------------------------------------------------------------------
00327 //---------------------------------------------------------------------
00328 //---------------------------------------------------------------------
00329 
00330 class CMXTreeDlg : public DialogOp
00331 {
00332     CC_DECLARE_DYNCREATE( CMXTreeDlg )
00333 public:
00334 
00335     CMXTreeDlg();      
00336     ~CMXTreeDlg(); 
00337 
00338     MsgResult Message( Msg* Message); 
00339     void Do(OpDescriptor*);     // "Do" function        
00340     static BOOL Init();                        
00341     BOOL Create();
00342     static OpState GetState(String_256*, OpDescriptor*);
00343 
00344     void SetFileName(String_256& FileName);
00345 
00346     void SetEndOfFile(BOOL b) { EndOfFile = b; }
00347 
00348     enum { IDD = _R(IDD_NEWDEBUGTREE) };  
00349 
00350     void AddNode(CMXNode *pNode);
00351 
00352     static CMXTreeDlg* GetCurrentCMXTreeDlg() { return pCurrentCMXTreeDlg; }
00353     void ShowFile(char* pFileName);
00354 
00355     void GetTagText(FOURCC ChunkType,String_256& Str);
00356 
00357 protected:
00358     BOOL ParseFile(CCFile * pFile);
00359 
00360 private:
00361     void DeInit();
00362     void Delete(CMXNode* pNode);
00363 
00364     void DeleteTreeInfo();
00365 
00366     void CreateTree();
00367     void DisplayTree(BOOL ExpandAll);
00368     INT32 AddDisplayNode(CMXNode* pNode,INT32 Index,INT32 Depth,BOOL ExpandAll);
00369     void ShowNodeDebugInfo(INT32 ListIndex);
00370     void ShowNodeDebugInfoForNode(CMXNode *pNode);
00371     CMXNodeInfo* GetInfo(INT32 Index);
00372     CMXTreeDlgRecordHandler* CMXTreeDlg::FindHandler(FOURCC ChunkType);
00373     void GetTagText(CMXNode* pNode,String_256& Str);
00374 
00375     CMXNode* pRoot;
00376     CMXNode* pContextNode;
00377     BOOL AddNextAsChild;
00378     INT32 Level;
00379     INT32 MaxIndex;
00380 
00381     String_256 FileName;
00382     BOOL EndOfFile;
00383 
00384     DebugTreeInfo* TreeInfo;
00385     StringBase* EditStr;
00386 
00387     CMXNodeTypeStatisticsList ListOfNodeTypeStats;
00388 
00389     static CMXTreeDlg* pCurrentCMXTreeDlg;
00390 
00391 
00392     // New TreeView stuff
00393     HTREEITEM AddOneItem(HTREEITEM hParent, TCHAR *pText, HTREEITEM hInsAfter, INT32 iImage, CMXNode *pNode);
00394     HTREEITEM AddItemsToNewTreeControl(HTREEITEM hParentItem, CMXNode *pNodeToAdd);
00395     BOOL InitialiseNewTreeControl(void);
00396     INT32 AddBitmapResourceToImageList(HIMAGELIST hList, UINT32 ResID);
00397     INT32 GetImageForNode(CMXNode *pNode);
00398     BOOL GetInfoFromHTREEITEM(HTREEITEM hItem, CMXNode **pNode, INT32 *pChildren);
00399     void ExpandNewTree();
00400 
00401     // Pictures for tree view
00402     HIMAGELIST hNewTreeControlImageList;
00403     INT32 m_idxGeneralTag;
00404     INT32 m_idxDefineBitmap;
00405     INT32 m_idxDefineColour;
00406     INT32 m_idxCompression;
00407     INT32 m_idxDown;
00408     INT32 m_idxUp;
00409     INT32 m_idxGroup;
00410     INT32 m_idxPage;
00411     INT32 m_idxAttribute;
00412     INT32 m_idxShape;
00413 
00414     RIFFFile * m_pRIFF;
00415     CMXTreeDlgRecordHandler * m_pHandler;
00416 };    
00417 
00418 #endif // INC_CMXTREE
00419 

Generated on Sat Nov 10 03:44:47 2007 for Camelot by  doxygen 1.4.4