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
00100
00101
00102 #include "camtypes.h"
00103
00104 #include "dbugtree.h"
00105
00106
00107
00108 #include "oildbug.h"
00109 #include "nodedoc.h"
00110
00111
00112 #include "nodetext.h"
00113 #include "userattr.h"
00114 #include "ngsentry.h"
00115
00116 #include "clipint.h"
00117 #include "keypress.h"
00118 #include "vkextra.h"
00119
00120 #include "insertnd.h"
00121 #include "bubbleid.h"
00122
00123 #if DEBUG_TREE
00124
00125 CC_IMPLEMENT_DYNCREATE(DebugTreeDlg, DialogOp)
00126
00127 BOOL DebugTreeDlg::s_bShowHiddenNodes = TRUE;
00128 BOOL DebugTreeDlg::s_bSelectionOnly = FALSE;
00129 BOOL DebugTreeDlg::s_bExpandClicked = FALSE;
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142 DebugTreeDlg::DebugTreeDlg()
00143 : DialogOp(DebugTreeDlg::IDD(), MODELESS)
00144 {
00145 m_pstrDetails = new StringBase;
00146 if (!m_pstrDetails || !m_pstrDetails->Alloc(4096)) return;
00147 s_bExpandClicked = FALSE;
00148 }
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161 DebugTreeDlg::~DebugTreeDlg()
00162 {
00163
00164 delete m_pstrDetails;
00165 }
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181 MsgResult DebugTreeDlg::Message( Msg* Message)
00182 {
00183
00184 if (IS_OUR_DIALOG_MSG(Message))
00185 {
00186 DialogMsg* Msg = (DialogMsg*) Message;
00187
00188 if ((Msg->DlgMsg == DIM_COMMIT || Msg->DlgMsg == DIM_CANCEL))
00189 {
00190 DeInit();
00191 Close();
00192 End();
00193 }
00194 else if ((Msg->GadgetID == _R(IDC_DEBUGTREE_EXPAND))
00195 && (Msg->DlgMsg == DIM_LFT_BN_CLICKED))
00196 {
00197
00198
00199 s_bExpandClicked = TRUE;
00200 ExpandNewTree();
00201 }
00202 else if ((Msg->GadgetID == _R(IDC_DEBUGTREE_DUMP))
00203 && (Msg->DlgMsg == DIM_LFT_BN_CLICKED))
00204 {
00205
00206 DumpTreeTree();
00207 }
00208 else if ((Msg->GadgetID == _R(IDC_DEBUGTREE_REFRESH))
00209 && (Msg->DlgMsg == DIM_LFT_BN_CLICKED))
00210 {
00211
00212 Refresh();
00213 }
00214 else if ((Msg->GadgetID == _R(IDC_DEBUGTREE_HIDDEN))
00215 && (Msg->DlgMsg == DIM_LFT_BN_CLICKED))
00216 {
00217
00218 BOOL Valid;
00219 INT32 Value = GetLongGadgetValue(_R(IDC_DEBUGTREE_HIDDEN), 0, 1, 0, &Valid);
00220
00221 if (Valid)
00222 s_bShowHiddenNodes = (Value == 1);
00223
00224
00225 RefreshNewTree();
00226 }
00227 else if ((Msg->GadgetID == _R(IDC_DEBUGTREE_SELNONLY))
00228 && (Msg->DlgMsg == DIM_LFT_BN_CLICKED))
00229 {
00230
00231 BOOL Valid;
00232 INT32 Value = GetLongGadgetValue(_R(IDC_DEBUGTREE_SELNONLY), 0, 1, 0, &Valid);
00233
00234 if (Valid)
00235 s_bSelectionOnly = (Value == 1);
00236
00237
00238 RefreshNewTree();
00239 }
00240 else if ((Msg->GadgetID == _R(IDC_DEBUGTREE_TREE)) && (Msg->DlgMsg == DIM_SELECTION_CHANGED))
00241 {
00242
00243 CTreeItemID hItem = GetTreeGadgetFirstSelectedItem(_R(IDC_DEBUGTREE_TREE));
00244 if (hItem.IsOk())
00245 {
00246 CCObject* pNode = GetTreeGadgetItemData(_R(IDC_DEBUGTREE_TREE), hItem);
00247 if (pNode)
00248 ShowNodeDebugInfoForNode((Node*)pNode);
00249 }
00250 }
00251
00252 return (DLG_EAT_IF_HUNGRY(Msg));
00253 }
00254 return OK;
00255 }
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271 void DebugTreeDlg::Do(OpDescriptor*)
00272 {
00273 Create();
00274 Open();
00275 }
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291 BOOL DebugTreeDlg::Init()
00292 {
00293
00294 Camelot.DeclareSection(_T("DebugFlags"), 2);
00295 Camelot.DeclarePref(_T("DebugFlags"), _T("ShowHiddenNodes"), &s_bShowHiddenNodes);
00296 Camelot.DeclarePref(_T("DebugFlags"), _T("SelectionOnly"), &s_bSelectionOnly);
00297
00298
00299 return (RegisterOpDescriptor(
00300 0,
00301 _R(IDS_DEBUGTREEDLG),
00302 CC_RUNTIME_CLASS(DebugTreeDlg),
00303 OPTOKEN_DEBUGTREEDLG,
00304 DebugTreeDlg::GetState,
00305 0,
00306 _R(IDBBL_DEBUGTREEDLG),
00307 0 ));
00308 }
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323 BOOL DebugTreeDlg::Create()
00324 {
00325 if (DialogOp::Create())
00326 {
00327 Initialise();
00328 }
00329 return TRUE;
00330 }
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344 OpState DebugTreeDlg::GetState(String_256*, OpDescriptor*)
00345 {
00346 OpState OpSt;
00347 return(OpSt);
00348 }
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363 INT32 DebugTreeDlg::GetTreeDepth(Node *pNode)
00364 {
00365 INT32 Depth = 0;
00366
00367 do
00368 {
00369 pNode = pNode->FindParent();
00370 Depth++;
00371 } while (pNode != NULL);
00372
00373 return Depth - 1;
00374 }
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388 void DebugTreeDlg::ShowNodeDebugInfoForNode(Node *pNode)
00389 {
00390
00391 String_256 NodeDesc = String_256( (TCHAR *)( pNode->GetRuntimeClass()->GetClassName() ) );
00392
00393
00394 m_pstrDetails->Empty();
00395 *m_pstrDetails += NodeDesc;
00396 TCHAR NodeAddress[64];
00397 camSnprintf( NodeAddress, 64, _T(" Data at 0x%p (%lu bytes)\n\n"), pNode, pNode->GetNodeSize() );
00398 *m_pstrDetails += NodeAddress;
00399 pNode->GetDebugDetails(m_pstrDetails);
00400
00401
00402 SetStringGadgetValue(_R(IDC_DEBUGTREE_DETAILS), *m_pstrDetails);
00403 }
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415 void DebugTreeDlg::Refresh()
00416 {
00417
00418 DeleteAllValues(_R(IDC_DEBUGTREE_TREE));
00419
00420
00421 GetTree();
00422
00423
00424 CTreeItemID hItem = GetTreeGadgetRootItem(_R(IDC_DEBUGTREE_TREE));
00425 SelectTreeGadgetItem(_R(IDC_DEBUGTREE_TREE), hItem);
00426 CCObject* pNode = GetTreeGadgetItemData(_R(IDC_DEBUGTREE_TREE), hItem);
00427 if (pNode && pNode->IsKindOf(CC_RUNTIME_CLASS(Node) ))
00428 ShowNodeDebugInfoForNode((Node*)pNode);
00429
00430
00431 if (s_bExpandClicked)
00432 ExpandNewTree();
00433 }
00434
00435
00436
00437 const INT32 SelectionDepth = 4;
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451 void DebugTreeDlg::TweeDump(BaseDocument* DocToDump)
00452 {
00453 TCHAR StrBuff[256];
00454 String_256 Details;
00455
00456 if (DocToDump == NULL)
00457 DocToDump = Document::GetSelected();
00458 if (DocToDump==NULL)
00459 {
00460 DebugTreeInfo::OutputDebug( _T("TweeDump: No Selected Document!\n") );
00461 return;
00462 }
00463 else
00464 {
00465 camSnprintf( StrBuff, 256, _T("Tweedump: Document %p\n"), DocToDump);
00466 DebugTreeInfo::OutputDebug((TCHAR*) StrBuff);
00467 }
00468
00469 Node* pNode = DocToDump->GetFirstNode();
00470 INT32 depth = 0;
00471 INT32 i;
00472 while (pNode)
00473 {
00474
00475 Details.Empty();
00476 for(i=0; i<depth; i++)
00477 {
00478 camSnprintf( StrBuff, 256, _T(" ") );
00479 Details += StrBuff;
00480 }
00481 camSnprintf( StrBuff, 256, _T("%p "), pNode);
00482 Details += StrBuff;
00483 camSnprintf( StrBuff, 256, _T("%c%c%c "),
00484 (pNode->IsRenderable() ? 'R':'-'),
00485 (pNode->IsSelected() ? 'S':'-'),
00486 (pNode->IsParentOfSelected() ? 'P':'-')
00487 );
00488 Details += StrBuff;
00489 Details += String_256((TCHAR*)(pNode->GetRuntimeClass()->GetClassName()));
00490 camSnprintf( StrBuff, 256, _T("\n"), pNode);
00491 Details += StrBuff;
00492 DebugTreeInfo::OutputDebug((TCHAR*)Details);
00493
00494
00495 if (pNode->FindFirstChild())
00496 {
00497 depth+=1;
00498 pNode = pNode->FindFirstChild();
00499 }
00500 else
00501 {
00502
00503 while ( pNode && pNode->FindNext()==NULL)
00504 {
00505 pNode = pNode->FindParent();
00506 depth-=1;
00507 }
00508 if (pNode)
00509 pNode = pNode->FindNext();
00510 }
00511 }
00512
00513 DebugTreeInfo::OutputDebug( _T("\n") );
00514 }
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527 void DebugTreeDlg::DumpSubTree(Node* pSubTree, INT32 FromParent, INT32 MaxDepth)
00528 {
00529 if (FromParent<0)
00530 {
00531 DebugTreeInfo::OutputDebug( _T("DebugTreeDlg::DumpSubTree() - FromParent<0!\n") );
00532 return;
00533 }
00534 if (MaxDepth<0)
00535 {
00536 DebugTreeInfo::OutputDebug( _T("DebugTreeDlg::DumpSubTree() - MaxDepth<0!\n") );
00537 return;
00538 }
00539
00540 Node* pStartNode = pSubTree;
00541 while (FromParent--!=0 && pStartNode!=NULL)
00542 pStartNode = pStartNode->FindParent();
00543
00544 if (pStartNode==NULL)
00545 {
00546 DebugTreeInfo::OutputDebug( _T("DebugTreeDlg::DumpSubTree() - pSubTree==NULL!\n") );
00547 return;
00548 }
00549
00550 TCHAR StrBuff[256];
00551 camSnprintf( StrBuff, 256, _T("DebugTreeDlg::DumpSubTree() - pStartNode = %p\n"), pStartNode );
00552 DebugTreeInfo::OutputDebug((TCHAR*)StrBuff);
00553
00554 INT32 depth = 0;
00555 String_256 Details;
00556 Node* pNode = pStartNode;
00557 while (pNode && depth>=0)
00558 {
00559
00560 camSnprintf( StrBuff, 256, _T(" ") );
00561 Details.Empty();
00562 for(INT32 i=0; i<depth; i++)
00563 Details += StrBuff;
00564 camSnprintf( StrBuff, 256, _T("%p "), pNode);
00565 Details += StrBuff;
00566 camSnprintf( StrBuff, 256, _T("%c%c%c "),
00567 (pNode->IsRenderable() ? 'R':'-'),
00568 (pNode->IsSelected() ? 'S':'-'),
00569 (pNode->IsParentOfSelected() ? 'P':'-') );
00570 Details += StrBuff;
00571 Details += String_256((TCHAR*)(pNode->GetRuntimeClass()->GetClassName()));
00572 if (IS_A(pNode,TextChar))
00573 {
00574 Details += String_8( _T(" '") );
00575 TCHAR ptch[2] = { (TCHAR)(((TextChar*)pNode)->GetUnicodeValue()), '\0' };
00576 Details += String_8((TCHAR*)ptch);
00577 Details += String_8( _T("'") );
00578 }
00579 Details += String_8( _T("\n") );
00580 DebugTreeInfo::OutputDebug((TCHAR*)Details);
00581
00582
00583 if (pNode->FindFirstChild() && depth<MaxDepth)
00584 {
00585 depth += 1;
00586 pNode = pNode->FindFirstChild();
00587 }
00588 else
00589 {
00590
00591 while ( pNode && pNode->FindNext()==NULL)
00592 {
00593 pNode = pNode->FindParent();
00594 depth-=1;
00595 }
00596 if (pNode==pStartNode)
00597 pNode = NULL;
00598 if (pNode)
00599 pNode = pNode->FindNext();
00600 }
00601 }
00602
00603 DebugTreeInfo::OutputDebug( _T("\n") );
00604 }
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622 BOOL DebugTreeDlg::ShouldBeHidden(Node *pNode)
00623 {
00624 if (!s_bShowHiddenNodes && pNode->IsKindOf(CC_RUNTIME_CLASS(NodeHidden)))
00625
00626 return TRUE;
00627
00628 if (s_bSelectionOnly &&
00629 (GetTreeDepth(pNode) == SelectionDepth) &&
00630 !pNode->IsSelected())
00631 {
00632
00633 return TRUE;
00634 }
00635
00636
00637 return FALSE;
00638 }
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655 BOOL DebugTreeDlg::IsChildOfHiddenNode(Node *pNode)
00656 {
00657 if (pNode->FindParent() != NULL)
00658
00659 return FALSE;
00660
00661
00662 return (!pNode->IsKindOf(CC_RUNTIME_CLASS(NodeDocument)));
00663 }
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683 BOOL DebugTreeDlg::HasChildren(Node *pNode)
00684 {
00685 if (pNode->FindFirstChild() != NULL)
00686 {
00687
00688
00689 return (IsChildOfHiddenNode(pNode) == FALSE);
00690 }
00691
00692 if (pNode->IsKindOf(CC_RUNTIME_CLASS(NodeHidden)))
00693
00694 return TRUE;
00695
00696
00697 return FALSE;
00698 }
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711 void DebugTreeDlg::GetTree()
00712 {
00713
00714 Node *pNodeDoc = Document::GetSelected()->GetFirstNode()->FindNext();
00715
00716 if (KeyPress::IsKeyPressed(CAMKEY(C)))
00717 pNodeDoc = InternalClipboard::Instance()->GetFirstNode()->FindNext();
00718
00719 ENSURE(pNodeDoc->IsKindOf(CC_RUNTIME_CLASS(NodeDocument)),
00720 "Bad document node in tree");
00721
00722 AddItemToNewTreeControl( CTreeItemID(), CTreeItemID(), pNodeDoc );
00723 }
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737 void DebugTreeDlg::Initialise()
00738 {
00739
00740 InitialiseNewTreeControl();
00741
00742 GetTree();
00743
00744
00745 CTreeItemID hItem = GetTreeGadgetRootItem(_R(IDC_DEBUGTREE_TREE));
00746 SelectTreeGadgetItem(_R(IDC_DEBUGTREE_TREE), hItem);
00747 CCObject* pNode = GetTreeGadgetItemData(_R(IDC_DEBUGTREE_TREE), hItem);
00748 if (pNode && pNode->IsKindOf(CC_RUNTIME_CLASS(Node) ))
00749 ShowNodeDebugInfoForNode((Node*)pNode);
00750
00751
00752 if (s_bShowHiddenNodes)
00753 SetLongGadgetValue(_R(IDC_DEBUGTREE_HIDDEN), 1);
00754 else
00755 SetLongGadgetValue(_R(IDC_DEBUGTREE_HIDDEN), 0);
00756
00757 if (s_bSelectionOnly)
00758 SetLongGadgetValue(_R(IDC_DEBUGTREE_SELNONLY), 1);
00759 else
00760 SetLongGadgetValue(_R(IDC_DEBUGTREE_SELNONLY), 0);
00761 }
00762
00763
00764 BOOL DebugTreeDlg::IsAHiddenNode(Node *pNode)
00765 {
00766 return (pNode->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeHidden));
00767 }
00768
00769
00770 void DebugTreeDlg::DeInit()
00771 {
00772 DeleteAllValues(_R(IDC_DEBUGTREE_TREE));
00773 }
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793 CTreeItemID DebugTreeDlg::AddOneItem(CTreeItemID hParent,
00794 const StringBase& str,
00795 CTreeItemID hInsAfter,
00796 INT32 iImage,
00797 Node* pNode)
00798 {
00799 return SetTreeGadgetItem(_R(IDC_DEBUGTREE_TREE), hParent, str, hInsAfter, iImage, pNode);
00800 }
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814 INT32 DebugTreeDlg::GetImageForNode(Node *pNode)
00815 {
00816 INT32 iImage = m_idxNode;
00817
00818 if (pNode->IS_KIND_OF(AttrUser))
00819 iImage = m_idxUserAttr;
00820 else if (pNode->IsKindOf(CC_RUNTIME_CLASS(NodeHidden)))
00821 iImage = m_idxHiddenNode;
00822 else if (pNode->IsKindOf(CC_RUNTIME_CLASS(NodeAttribute)))
00823 iImage = m_idxAttribute;
00824 else if (pNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderableInk)))
00825 iImage = m_idxRenderableInk;
00826 else if (pNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderablePaper)))
00827 iImage = m_idxRenderablePaper;
00828 else if (pNode->IsKindOf(CC_RUNTIME_CLASS(InsertionNode)))
00829 iImage = m_idxInsertionNode;
00830 else if (pNode->IS_KIND_OF(NodeSetSentinel))
00831 iImage = m_idxSentinelNode;
00832 else if (pNode->IS_KIND_OF(NodeSetProperty))
00833 iImage = m_idxSetProperty;
00834
00835 return iImage;
00836 }
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848 CTreeItemID DebugTreeDlg::AddItemToNewTreeControl(CTreeItemID hParentItem, CTreeItemID hInsAfterItem, Node *pNode, BOOL bAddChildren)
00849 {
00850 String_256 strNodeText( (TCHAR*)( pNode->GetRuntimeClass()->GetClassName() ) );
00851 INT32 iImage = GetImageForNode(pNode);
00852
00853 CTreeItemID hThisItem = AddOneItem(hParentItem, strNodeText, hInsAfterItem, iImage, pNode);
00854
00855 if (bAddChildren && HasChildren(pNode))
00856 {
00857
00858 Node *pChild;
00859 CTreeItemID hInsContext;
00860
00861
00862 if (pNode->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeHidden))
00863 {
00864 pChild = ((NodeHidden*) pNode)->HiddenNd;
00865
00866
00867 hInsContext = AddItemToNewTreeControl(hThisItem, hInsContext, pChild, FALSE);
00868 }
00869 else
00870 {
00871 pChild = pNode->FindFirstChild();
00872
00873 while (pChild != NULL)
00874 {
00875
00876 if (!ShouldBeHidden(pChild))
00877 {
00878
00879 hInsContext = AddItemToNewTreeControl(hThisItem, hInsContext, pChild);
00880 }
00881
00882 pChild = pChild->FindNext();
00883 }
00884 }
00885 }
00886
00887 return hThisItem;
00888 }
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901 BOOL DebugTreeDlg::InitialiseNewTreeControl(void)
00902 {
00903
00904 CGadgetImageList NewImageList(16, 16);
00905 m_idxNode = NewImageList.Add(_R(IDB_DEBUGTREE_NODE));
00906 m_idxAttribute = NewImageList.Add(_R(IDB_DEBUGTREE_ATTRIBUTE));
00907 m_idxRenderableInk = NewImageList.Add(_R(IDB_DEBUGTREE_RENDERABLE));
00908 m_idxRenderablePaper = NewImageList.Add(_R(IDB_DEBUGTREE_PAPER));
00909 m_idxInsertionNode = NewImageList.Add(_R(IDB_DEBUGTREE_INSERT));
00910 m_idxHiddenNode = NewImageList.Add(_R(IDB_DEBUGTREE_HIDDEN));
00911 m_idxSentinelNode = NewImageList.Add(_R(IDB_DEBUGTREE_SENTINEL));
00912 m_idxUserAttr = NewImageList.Add(_R(IDB_DEBUGTREE_USER));
00913 m_idxSetProperty = NewImageList.Add(_R(IDB_DEBUGTREE_PROPERTY));
00914
00915 SetGadgetBitmaps(_R(IDC_DEBUGTREE_TREE), NewImageList);
00916
00917 PORTNOTE("other", "Removed use of GetGadgetImageCount")
00918
00919
00920
00921 return TRUE;
00922 }
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936 void DebugTreeDlg::DumpTreeTree()
00937 {
00938 PORTNOTETRACE("other", "Removed body of DumpTreeTree because it does nothing!");
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987 }
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999 BOOL DebugTreeDlg::GetInfoFromTreeItem(CTreeItemID hItem, Node** ppNode, size_t* pChildren)
01000 {
01001 CCObject* pNode = GetTreeGadgetItemData(_R(IDC_DEBUGTREE_TREE), hItem);
01002 ERROR3IF(!pNode->IsKindOf(CC_RUNTIME_CLASS(Node)), "DebugTreeDlg found a non-node tree item");
01003 if (!pNode->IsKindOf(CC_RUNTIME_CLASS(Node)))
01004 return FALSE;
01005
01006 *ppNode = (Node*)pNode;
01007 *pChildren = GetTreeGadgetChildrenCount(_R(IDC_DEBUGTREE_TREE), hItem, FALSE);
01008
01009 return TRUE;
01010 }
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023 void DebugTreeDlg::ExpandNewTree()
01024 {
01025 CTreeItemID hItem = GetTreeGadgetRootItem(_R(IDC_DEBUGTREE_TREE));
01026 CTreeItemID hSelectedItem = GetTreeGadgetFirstSelectedItem(_R(IDC_DEBUGTREE_TREE));
01027
01028
01029 while (hItem.IsOk())
01030 {
01031 TreeGadgetExpandItem(_R(IDC_DEBUGTREE_TREE), hItem);
01032 CTreeItemID hChild = GetTreeGadgetFirstChildItem(_R(IDC_DEBUGTREE_TREE), hItem);
01033 if (hChild.IsOk())
01034 hItem = hChild;
01035
01036
01037 hItem = GetTreeGadgetNextVisItem(_R(IDC_DEBUGTREE_TREE), hItem);
01038 }
01039
01040 SelectTreeGadgetItem(_R(IDC_DEBUGTREE_TREE), hSelectedItem, TRUE );
01041 }
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055 void DebugTreeDlg::RefreshNewTree()
01056 {
01057
01058 DeleteAllValues(_R(IDC_DEBUGTREE_TREE));
01059
01060
01061 Node* pNodeDoc = Document::GetSelected()->GetFirstNode()->FindNext();
01062
01063 if (KeyPress::IsKeyPressed(CAMKEY(C)))
01064 pNodeDoc = InternalClipboard::Instance()->GetFirstNode()->FindNext();
01065
01066 ENSURE(pNodeDoc->IsKindOf(CC_RUNTIME_CLASS(NodeDocument)),
01067 "Bad document node in tree");
01068
01069 AddItemToNewTreeControl( CTreeItemID(), CTreeItemID(), pNodeDoc );
01070
01071
01072 if (s_bExpandClicked)
01073 ExpandNewTree();
01074 }
01075
01076 #endif //DEBUG_TREE
01077
01078