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_CXFTREE
00100 #define INC_CXFTREE
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
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
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
00189
00190
00191
00192
00193
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
00220
00221
00222
00223
00224
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
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
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