00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 #ifndef INC_CMXTREE
00100 #define INC_CMXTREE
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 #include "rifffile.h"
00111
00112
00113
00114
00115 #define OPTOKEN_CMXTREEDLG _T("CMXTreeDlg")
00116
00117 class CMXTreeDlg;
00118 class DebugTreeInfo;
00119 class CCFile;
00120
00121
00122
00123
00124
00125
00126
00127
00128
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
00192
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
00216 {
00217
00218 CC_DECLARE_MEMDUMP( CMXTreeDlgRecordHandler )
00219
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
00244
00245
00246
00247
00248
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
00263
00264
00265
00266
00267
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
00283 INT32 GetNumOccurances() { return NumOccurrences; }
00284 INT32 GetTotalSize() { return TotalSize; }
00285
00286 private:
00287 FOURCC m_ChunkType;
00288
00289 INT32 NumOccurrences;
00290 INT32 TotalSize;
00291 };
00292
00293
00294
00295
00296
00297
00298
00299
00300
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*);
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
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
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