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
00103 #include "camtypes.h"
00104
00105 DECLARE_SOURCE("$Revision: 1765 $");
00106
00107 #include "camelot.h"
00108
00109 #include "finfodlg.h"
00110
00111
00112
00113
00114
00115
00116
00117 #include "localenv.h"
00118
00119
00120 #include "page.h"
00121
00122 #include "nodebmp.h"
00123 #include "bitmpinf.h"
00124
00125
00126 #include "nodetxts.h"
00127 #include "fontlist.h"
00128 #include "progress.h"
00129
00130 #include "fontman.h"
00131 #include "bubbleid.h"
00132
00133
00134
00135
00136
00137 #include "ophist.h"
00138
00139
00140 #include "fontman.h"
00141 #include "fontdrop.h"
00142 #include "fontbase.h"
00143
00144 #include "nodeliveeffect.h"
00145
00146 CC_IMPLEMENT_DYNCREATE(FileInfo, DialogOp)
00147 CC_IMPLEMENT_DYNCREATE(RefItem, ListItem)
00148
00149 #define new CAM_DEBUG_NEW
00150
00151
00152 const CDlgMode FileInfo::Mode = MODELESS;
00153 const UINT32 FileInfo::IDD = _R(IDD_FINFODLG);
00154 FileInfo * FileInfo::CurrentDialog = NULL;
00155
00156 DocumentFontDropDown *FileInfo::NameDropDown = NULL;
00157
00158
00159 #define DURATION_FASTJOB 500
00160 #define DURATION_SLOWJOB 10*1000
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178 FileInfo::FileInfo(): DialogOp(FileInfo::IDD, FileInfo::Mode)
00179 {
00180 }
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198 FileInfo::~FileInfo()
00199 {
00200 BitmapList.DeleteAll();
00201
00202 CurrentDialog = NULL;
00203
00204
00205
00206
00207 if (NameDropDown != NULL)
00208 {
00209 delete NameDropDown;
00210 NameDropDown = NULL;
00211 }
00212 }
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230 MsgResult FileInfo::Message(Msg* Message)
00231 {
00232 if (IS_OUR_DIALOG_MSG(Message))
00233 {
00234 DialogMsg* Msg = (DialogMsg*)Message;
00235
00236 if (Msg->DlgMsg == DIM_CREATE)
00237 {
00238 OnDimCreate();
00239 }
00240
00241 if ((Msg->DlgMsg == DIM_COMMIT) || (Msg->DlgMsg == DIM_SOFT_COMMIT))
00242 {
00243 Document* WorkDoc = Document::GetSelected();
00244 if (WorkDoc != NULL)
00245 {
00246 String_256 NewComment = GetStringGadgetValue(_R(IDC_FILEINFO_COMMENT), NULL, -1);
00247 String_256 OldComment = WorkDoc->GetComment();
00248 if (NewComment != OldComment)
00249 {
00250 WorkDoc->SetComment(&NewComment);
00251 WorkDoc->SetModified(TRUE);
00252 }
00253 }
00254 }
00255
00256 if ((Msg->DlgMsg == DIM_COMMIT) || (Msg->DlgMsg == DIM_CANCEL))
00257 {
00258 Close();
00259 End();
00260 return (DLG_EAT_IF_HUNGRY(Msg));
00261 }
00262
00263 if (Msg->DlgMsg == DIM_TIMER)
00264 {
00265 SetDocInfo(FALSE, timerSlowJob.Elapsed(DURATION_SLOWJOB, TRUE));
00266 }
00267 }
00268
00269 if (MESSAGE_IS_A(Message, DocChangingMsg))
00270 {
00271 DocChangingMsg* DocMsg = (DocChangingMsg*) Message;
00272 if (DocMsg->State == DocChangingMsg::SELCHANGED)
00273 {
00274 if (DocMsg->pOldDoc != NULL)
00275 {
00276 String_256 NewComment = GetStringGadgetValue(_R(IDC_FILEINFO_COMMENT), NULL, -1);
00277 String_256 OldComment = DocMsg->pOldDoc->GetComment();
00278 if (NewComment != OldComment)
00279 {
00280 DocMsg->pOldDoc->SetComment(&NewComment);
00281 DocMsg->pOldDoc->SetModified(TRUE);
00282 }
00283 }
00284 SetDocInfo(TRUE,TRUE);
00285 }
00286 }
00287
00288
00289 return DialogOp::Message(Message);
00290 }
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308 BOOL FileInfo::OnDimCreate()
00309 {
00310
00311 this->SetTimer(42, DURATION_FASTJOB);
00312 timerSlowJob.Sample();
00313
00314
00315
00316 if (!m_lstctrlExternalResInfo.Init(WindowID, _R(IDC_FINFO_REFSLIST)))
00317 return FALSE;
00318
00319 m_lstctrlExternalResInfo.AddColumn(_T("Status"), 14);
00320 m_lstctrlExternalResInfo.AddColumn(_T("Item"), 180);
00321 m_lstctrlExternalResInfo.AddColumn(_T("Details"), 760);
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333 SetDocInfo(TRUE, TRUE);
00334
00335 return TRUE;
00336 }
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354 OpState FileInfo::GetState(String_256*, OpDescriptor*)
00355 {
00356 return OpState(FALSE, (Document::GetSelected() == NULL));
00357 }
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375 BOOL FileInfo::Init()
00376 {
00377 return RegisterOpDescriptor(
00378 0,
00379 _R(IDS_FILE_INFO),
00380 CC_RUNTIME_CLASS(FileInfo),
00381 OPTOKEN_FINFODLG,
00382 FileInfo::GetState,
00383 0,
00384 _R(IDBBL_FILEINFO),
00385 _R(IDD_BARCONTROLSTORE),
00386 _R(IDC_FILEINFO),
00387 SYSTEMBAR_FILE,
00388 TRUE,
00389 FALSE,
00390 TRUE,
00391 0,
00392 _R(IDS_FILEINFO_ONE),
00393 (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC)
00394 );
00395 }
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413 void FileInfo::Do(OpDescriptor*)
00414 {
00415 Create();
00416 Open();
00417 CurrentDialog = this;
00418 }
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433 void FileInfo::Refresh()
00434 {
00435 if (CurrentDialog)
00436 CurrentDialog->SetDocInfo(TRUE,TRUE);
00437
00438 }
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459 BOOL FileInfo::UpdateFontList(Document* WorkDoc)
00460 {
00461
00462
00463
00464 List ItemList;
00465
00466
00467
00468 FontListItem* FontItem = NULL;
00469 if (WorkDoc)
00470 {
00471 FontList DocFonts;
00472 DocFonts.Build(WorkDoc);
00473 FontItem = DocFonts.GetFirstItem();
00474
00475
00476 while (FontItem != NULL)
00477 {
00478
00479 UINT32 idBitmap = 0;
00480 String_64 strName = FontItem->GetFontName();
00481 String_256 strDetails;
00482
00483 WORD Handle = FONTMANAGER->GetFontHandle(&strName);
00484
00485
00486 INT32 Style = FontItem->GetFontStyle();
00487 if (Style & 1)
00488 strName += _T(" -Bold");
00489 if (Style & 2)
00490 strName += _T(" -Italic");
00491
00492 if (Handle > 0)
00493 {
00494 if (FONTMANAGER->IsFontReplaced(Handle))
00495 strDetails = String(_R(IDS_FINFO_FONTNOTINSTALLED));
00496 }
00497 FontClass Type = FontItem->GetFontClass();
00498 switch(Type)
00499 {
00500 case FC_TRUETYPE:
00501 idBitmap = _R(IDB_TTF_SYMBOL);
00502 break;
00503
00504 case FC_ATM:
00505 idBitmap = _R(IDB_ATM_SYMBOL);
00506 break;
00507
00508 default:
00509 idBitmap = 0;
00510 break;
00511 }
00512
00513 AddToSortedList(ItemList, idBitmap, strName, strDetails);
00514
00515 FontItem = DocFonts.GetNextItem(FontItem);
00516
00517 ContinueSlowJob();
00518 }
00519 }
00520
00521
00522 RefItem* pRefItem = (RefItem*)ItemList.GetHead();
00523 while (pRefItem)
00524 {
00525
00526
00527 CFileInfoList::CListRow oNewRow = m_lstctrlExternalResInfo.AddRow();
00528 oNewRow.SetBitmap(pRefItem->idBitmap);
00529 oNewRow.SetText(1, pRefItem->strItemName);
00530 oNewRow.SetText(2, pRefItem->strDetails);
00531
00532
00533 pRefItem = (RefItem*)ItemList.GetNext(pRefItem);
00534 }
00535
00536 ItemList.DeleteAll();
00537
00538 return TRUE;
00539 }
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557 BOOL FileInfo::UpdateEffectsList(Document* pWorkDoc)
00558 {
00559
00560
00561
00562
00563
00564
00565
00566 if (pWorkDoc == NULL)
00567 {
00568 return TRUE;
00569 }
00570
00571 List ItemList;
00572
00573 PORTNOTE("other", "Disabled bitmap effects")
00574 #ifndef EXCLUDE_FROM_XARALX
00575 ListRange* pEffectList = pWorkDoc->GetEffectsList(500000);
00576 if (pEffectList)
00577 {
00578
00579 INT32 index = 0;
00580 Node* pNode = pEffectList->FindFirst();
00581 while (pNode)
00582 {
00583 ENSURE(pNode->IsBitmapEffect(), "How can this node not be a BitmapEffect?");
00584
00585 if (pNode->IsBitmapEffect())
00586 {
00587 NodeBitmapEffect* pEffect = (NodeBitmapEffect*)pNode;
00588
00589 String_64 strEffectName = pEffect->GetDisplayName();
00590 String_256 strDetails;
00591 UINT32 idBitmap = 0;
00592
00593 if (pEffect->IsLockedEffect())
00594 {
00595
00596
00597 String_64 strFoundDisplayName;
00598 BOOL bFound = XPEHost::GetEffectDetails(pEffect->GetPostProcessorID(), &strFoundDisplayName);
00599 if (bFound)
00600 {
00601 strDetails = String(_R(IDS_FINFO_EFFECTOK));
00602 idBitmap = _R(IDB_FINFO_OKEFFECT);
00603 }
00604 else
00605 {
00606 strDetails = String(_R(IDS_FINFO_LOCKEDEFFECT));
00607 idBitmap = _R(IDB_FINFO_LOCKEDEFFECT);
00608 }
00609 }
00610 else
00611 {
00612
00613
00614 String_64 strFoundDisplayName;
00615 BOOL bFound = XPEHost::GetEffectDetails(pEffect->GetPostProcessorID(), &strFoundDisplayName);
00616 if (bFound)
00617 {
00618 strDetails = String(_R(IDS_FINFO_EFFECTOK));
00619 idBitmap = _R(IDB_FINFO_OKEFFECT);
00620 }
00621 else
00622 {
00623 strDetails = String(_R(IDS_FINFO_NOTFOUND));
00624 strDetails += String(" [");
00625 strDetails += pEffect->GetPostProcessorID();
00626 strDetails += String("]");
00627 idBitmap = _R(IDB_FINFO_MISSINGEFFECT);
00628 }
00629 }
00630 AddToSortedList(ItemList, idBitmap, strEffectName, strDetails);
00631
00632 ContinueSlowJob();
00633 }
00634
00635 pNode = pEffectList->FindNext(pNode);
00636 }
00637
00638 delete pEffectList;
00639 pEffectList = NULL;
00640 }
00641 #endif
00642
00643 RefItem* pRefItem = (RefItem*)ItemList.GetHead();
00644 while (pRefItem)
00645 {
00646
00647
00648 CFileInfoList::CListRow oNewRow = m_lstctrlExternalResInfo.AddRow();
00649 oNewRow.SetBitmap(pRefItem->idBitmap);
00650 oNewRow.SetText(1, pRefItem->strItemName);
00651 oNewRow.SetText(2, pRefItem->strDetails);
00652
00653 pRefItem = (RefItem*)ItemList.GetNext(pRefItem);
00654 }
00655
00656 ItemList.DeleteAll();
00657
00658 return TRUE;
00659 }
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680 BOOL FileInfo::SetDocInfo(BOOL UpdateComment, BOOL UpdateFonts)
00681 {
00682 Document* WorkDoc = Document::GetSelected();
00683
00684 if (UpdateFonts)
00685 {
00686 BeginSlowJob();
00687 GadgetRedraw(_R(IDC_FINFO_REFSLIST), FALSE);
00688
00689
00690
00691
00692 m_lstctrlExternalResInfo.Clear();
00693
00694
00695 CFileInfoList::CListRow oNewRow = m_lstctrlExternalResInfo.AddRow();
00696 oNewRow.SetText(1, String(_R(IDS_FINFO_FONTREFS_NAMEHEADER)));
00697 oNewRow.SetText(2, String(_R(IDS_FINFO_FONTREFS_DETAILSHEADER)));
00698
00699 UpdateFontList(WorkDoc);
00700
00701
00702
00703 oNewRow = m_lstctrlExternalResInfo.AddRow();
00704 oNewRow.SetText(1, String(_R(IDS_FINFO_EFFECTREFS_NAMEHEADER)));
00705 oNewRow.SetText(2, String(_R(IDS_FINFO_EFFECTREFS_DETAILSHEADER)));
00706
00707 UpdateEffectsList(WorkDoc);
00708
00709
00710
00711
00712 GadgetRedraw(_R(IDC_FINFO_REFSLIST), TRUE);
00713 InvalidateGadget(_R(IDC_FINFO_REFSLIST));
00714 EndSlowJob();
00715 }
00716
00717
00718 if (WorkDoc == NULL)
00719 {
00720 String_8 DashString(_R(IDS_K_FINFODLG_DASH));
00721 String_8 NullString = _T("");
00722 UpdateStringGadgetValue(_R(IDC_FILEINFO_UNDOSIZE), &DashString);
00723 UpdateStringGadgetValue(_R(IDC_FILEINFO_UNDOSTEPS), &DashString);
00724
00725
00726 UpdateStringGadgetValue(_R(IDC_FILEINFO_NUMOBJECTS), &DashString);
00727 UpdateStringGadgetValue(_R(IDC_FILEINFO_NUMSELOBJECTS), &DashString);
00728 UpdateStringGadgetValue(_R(IDC_FILEINFO_LOCATION), &DashString);
00729 UpdateStringGadgetValue(_R(IDC_FILEINFO_FILENAME), &DashString);
00730 UpdateStringGadgetValue(_R(IDC_FILEINFO_FILESIZE), &DashString);
00731 UpdateStringGadgetValue(_R(IDC_FILEINFO_NUMBITMAPS), &DashString);
00732 UpdateStringGadgetValue(_R(IDC_FILEINFO_BITMAPSIZE), &DashString);
00733 UpdateStringGadgetValue(_R(IDC_FILEINFO_FRACTALS), &DashString);
00734 UpdateStringGadgetValue(_R(IDC_FILEINFO_FRACTALSIZE), &DashString);
00735 UpdateStringGadgetValue(_R(IDC_FILEINFO_CREATIONDATE), &DashString);
00736 UpdateStringGadgetValue(_R(IDC_FILEINFO_LASTSAVEDATE), &DashString);
00737 UpdateStringGadgetValue(_R(IDC_FILEINFO_COMMENT), &NullString);
00738 return TRUE;
00739 }
00740
00741
00742 String_256 String;
00743 String_256 String2;
00744
00745
00746
00747 BitmapList.DeleteAll();
00748
00749
00750
00751
00752
00753
00754 Convert::BytesToString(&String, WorkDoc->GetOpHistory().GetSize());
00755 if (WorkDoc->GetOpHistory().IsReduced())
00756 {
00757 String2.MakeMsg(_R(IDS_FILEINFO_REDUCED));
00758 String += String2;
00759 }
00760 UpdateStringGadgetValue(_R(IDC_FILEINFO_UNDOSIZE), &String);
00761
00762
00763 UINT32 UndoSteps = WorkDoc->GetOpHistory().GetNumUndoSteps();
00764 UINT32 RedoSteps = WorkDoc->GetOpHistory().GetNumRedoSteps();
00765 String = "";
00766 if (UndoSteps != 0)
00767 {
00768 String.MakeMsg(_R(IDS_FILEINFO_UNDOSTEPS), UndoSteps);
00769 if (UndoSteps == 1)
00770 String2.MakeMsg(_R(IDS_FILEINFO_STEP));
00771 else
00772 String2.MakeMsg(_R(IDS_FILEINFO_STEPS));
00773 String += String2;
00774 }
00775 if (RedoSteps != 0)
00776 {
00777 String_256 String3;
00778 String2.MakeMsg(_R(IDS_FILEINFO_REDOSTEPS), RedoSteps);
00779 if (String.CompareTo(_T("")) != 0)
00780 String += String_64(_R(IDS_K_FINFODLG_SEPERATOR));
00781 if (RedoSteps == 1)
00782 String3.MakeMsg(_R(IDS_FILEINFO_STEP));
00783 else
00784 String3.MakeMsg(_R(IDS_FILEINFO_STEPS));
00785 String += String2;
00786 String += String3;
00787 }
00788 if (String.CompareTo(_T("")) == 0)
00789 {
00790 String.MakeMsg(_R(IDS_FILEINFO_NOSTEPS));
00791 UpdateStringGadgetValue(_R(IDC_FILEINFO_UNDOSTEPS), &String);
00792 }
00793 else
00794 {
00795 UpdateStringGadgetValue(_R(IDC_FILEINFO_UNDOSTEPS), &String);
00796 }
00797
00798
00799
00800
00801
00802
00803 if (UpdateComment)
00804 {
00805 String = WorkDoc->GetComment();
00806 UpdateStringGadgetValue(_R(IDC_FILEINFO_COMMENT), &String);
00807 }
00808
00809
00810 BitmapInfo BitInfo;
00811 Node* CurrentNode = StartTreeScan(WorkDoc);
00812 UINT32 Spreads = 0;
00813 UINT32 Pages = 0;
00814 UINT32 Bitmaps = 0;
00815 UINT32 BitmapSize = 0;
00816 UINT32 Objects = 0;
00817 UINT32 SelObjects = 0;
00818 UINT32 Groups = 0;
00819 UINT32 Size = 0;
00820 BOOL DontGetNext = TRUE;
00821
00822 while (CurrentNode != NULL)
00823 {
00824 Size += CurrentNode->GetNodeSize();
00825 DontGetNext = TRUE;
00826
00827 if (CurrentNode->IsAnObject())
00828 {
00829
00830 Objects ++;
00831
00832
00833
00834
00835
00836
00837
00838
00839 if (CurrentNode->IS_KIND_OF(NodeGroup) || IS_A(CurrentNode,TextStory))
00840 {
00841
00842
00843
00844
00845 Size += CurrentNode->GetSubtreeSize();
00846 CurrentNode = SkipSubtreeScan(CurrentNode);
00847 DontGetNext = FALSE;
00848
00849
00850 if (IS_A(CurrentNode,NodeGroup))
00851 Groups++;
00852 }
00853 else
00854 {
00858
00859
00860 if (IS_A(CurrentNode,NodeBitmap))
00861 {
00862
00863
00864
00865 Bitmaps ++;
00866 NodeListItem* CurrentBitmapNode = (NodeListItem*)BitmapList.GetHead();
00867 BOOL Found = FALSE;
00868
00869 while (CurrentBitmapNode != NULL)
00870 {
00871 if ((((NodeBitmap*)CurrentBitmapNode->pNode)->GetBitmap()->ActualBitmap) ==
00872 (((NodeBitmap*)CurrentNode)->GetBitmap()->ActualBitmap))
00873 {
00874 Found = TRUE;
00875 }
00876 CurrentBitmapNode = (NodeListItem*)BitmapList.GetNext(CurrentBitmapNode);
00877 }
00878 if (!Found)
00879 {
00880 ((NodeBitmap*)CurrentNode)->GetBitmap()->ActualBitmap->GetInfo(&BitInfo);
00881 BitmapSize += BitInfo.MemoryUsed;
00882 CurrentBitmapNode = new NodeListItem(CurrentNode);
00883 BitmapList.AddHead(CurrentBitmapNode);
00884 }
00885 }
00886 }
00887 }
00888 else
00889 {
00890 if (IS_A(CurrentNode,Spread))
00891 {
00892 Spreads ++;
00893 }
00894 else
00895 {
00896 if (IS_A(CurrentNode,Page))
00897 {
00898 Pages ++;
00899 }
00900 }
00901 }
00902 if ((CurrentNode != NULL) && DontGetNext)
00903 {
00904 CurrentNode = GetNextTreeNode(CurrentNode);
00905 }
00906 }
00907
00908
00909
00910 Application* pApplication = GetApplication();
00911 if (pApplication)
00912 {
00913
00914 SelRange* pSelection = pApplication->FindSelection();
00915
00916 if (pSelection)
00917 {
00918 SelObjects = pSelection->Count();
00919 }
00920 }
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937 String._MakeMsg(_T("#1%lu"), Objects);
00938 UpdateStringGadgetValue(_R(IDC_FILEINFO_NUMOBJECTS), &String);
00939 String._MakeMsg(_T("#1%lu"), SelObjects);
00940 UpdateStringGadgetValue(_R(IDC_FILEINFO_NUMSELOBJECTS), &String);
00941
00942
00943
00944
00945
00946
00947
00948 Application * Camelot = GetApplication();
00949 EnumFractalData FracData;
00950 if (Camelot)
00951 {
00952 GlobalFractalList * FracList = Camelot->GetGlobalFractalList();
00953 if (FracList)
00954 FracList->GetDocumentFractalData(WorkDoc,&FracData);
00955 }
00956 String._MakeMsg(_T("#1%lu"), FracData.Count);
00957 UpdateStringGadgetValue(_R(IDC_FILEINFO_FRACTALS), &String);
00958 Convert::BytesToString(&String, FracData.Size);
00959 UpdateStringGadgetValue(_R(IDC_FILEINFO_FRACTALSIZE), &String);
00960
00961
00962
00963
00964
00965 INT32 BitmapsCount = 0;
00966 INT32 BitmapsSize = 0;
00967 if (Camelot)
00968 {
00969 GlobalBitmapList * BmpList = Camelot->GetGlobalBitmapList();
00970 if (BmpList)
00971 {
00972 BitmapsCount = BmpList->GetDocumentBitmapCount(WorkDoc);
00973 BitmapsSize = BmpList->GetDocumentBitmapSize(WorkDoc);
00974 }
00975 }
00976
00977 String._MakeMsg(_T("#1%lu"), BitmapsCount);
00978 UpdateStringGadgetValue(_R(IDC_FILEINFO_NUMBITMAPS), &String);
00979
00980 Convert::BytesToString(&String, BitmapsSize);
00981 UpdateStringGadgetValue(_R(IDC_FILEINFO_BITMAPSIZE), &String);
00982
00983
00984
00985
00986
00987
00988 Size += BitmapsSize;
00989 Size += FracData.Size;
00990 Convert::BytesToString(&String, Size);
00991 UpdateStringGadgetValue(_R(IDC_FILEINFO_FILESIZE), &String);
00992
00993
00994
00995
00996
00997
00998
00999 String.Empty();
01000
01001 String = WorkDoc->GetLocation(41);
01002 if ( String.IsEmpty() )
01003 {
01004
01005 String.MakeMsg(_R(IDS_FILEINFO_UNSAVED));
01006 }
01007 UpdateStringGadgetValue(_R(IDC_FILEINFO_LOCATION), &String);
01008
01009
01010 String.Empty();
01011 String = WorkDoc->GetTitle();
01012 UpdateStringGadgetValue(_R(IDC_FILEINFO_FILENAME), &String);
01013
01014
01015
01016
01017
01018
01019 time_t TimeData;
01020 TimeData = WorkDoc->GetCreationTime();
01021
01022 String = asctime(localtime(&TimeData));
01023
01024
01025
01026
01027
01028 UpdateStringGadgetValue(_R(IDC_FILEINFO_CREATIONDATE), &String);
01029
01030 TimeData = WorkDoc->GetLastSaveTime();
01031 if (TimeData != 0)
01032 {
01033
01034
01035
01036
01037 String = asctime(localtime(&TimeData));
01038
01039 UpdateStringGadgetValue(_R(IDC_FILEINFO_LASTSAVEDATE), &String);
01040 }
01041 else
01042 {
01043 String.MakeMsg(_R(IDS_FILEINFO_UNSAVED));
01044 UpdateStringGadgetValue(_R(IDC_FILEINFO_LASTSAVEDATE), &String);
01045 }
01046
01047 #ifdef STANDALONE
01048 EnableGadget(_R(IDC_FILEINFO_COMMENT),FALSE);
01049 #endif
01050
01051 return TRUE;
01052 }
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067 Node* StartTreeScan(Document* pDoc)
01068 {
01069 if (pDoc == NULL)
01070 {
01071 ENSURE(FALSE,"NULL document pointer passed to StartTreeScan");
01072 return NULL;
01073 }
01074 return pDoc->GetFirstNode();
01075 }
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091 Node* GetNextTreeNode(Node* Current)
01092 {
01093 if (Current == NULL)
01094 {
01095 ENSURE(FALSE,"NULL node pointer passed to GetNextTreeNode");
01096 return NULL;
01097 }
01098
01099 if (Current->FindFirstChild() != NULL)
01100 {
01101 return Current->FindFirstChild();
01102 }
01103
01104 if (Current->FindNext() != NULL)
01105 {
01106 return Current->FindNext();
01107 }
01108
01109 Node* Temp = Current->FindParent();;
01110 while (Temp != NULL)
01111 {
01112 if (Temp->FindNext() != NULL)
01113 {
01114 return Temp->FindNext();
01115 }
01116 Temp = Temp->FindParent();
01117 }
01118
01119 return NULL;
01120 }
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135 Node* SkipSubtreeScan(Node* Current)
01136 {
01137 if (Current == NULL)
01138 {
01139 ENSURE(FALSE,"NULL node pointer passed to SkipSubTreeScan");
01140 return NULL;
01141 }
01142 if (Current->FindNext() != NULL)
01143 {
01144 return Current->FindNext();
01145 }
01146
01147
01148 Node* Temp = Current->FindParent();
01149 while (Temp != NULL)
01150 {
01151 if (Temp->FindNext() != NULL)
01152 {
01153 return Temp->FindNext();
01154 }
01155 Temp = Temp->FindParent();
01156 }
01157 return NULL;
01158 }
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183 BOOL FileInfo::AddToSortedList(List& ItemList, UINT32 idBitmap, String_64& strItemName, String_256& strDetails)
01184 {
01185 RefItem* pNewItem = new RefItem(idBitmap, strItemName, strDetails);
01186 if (pNewItem == NULL)
01187 {
01188 ERROR3("AddRefsItem couldn't create Item");
01189 return FALSE;
01190 }
01191
01192
01193 RefItem *pTheItem = (RefItem*)ItemList.GetHead();
01194
01195 if (pTheItem == NULL)
01196 {
01197 ItemList.AddTail(pNewItem);
01198 return TRUE;
01199 }
01200
01201 if (pTheItem->strItemName > strItemName)
01202 {
01203 ItemList.InsertBefore(pTheItem, pNewItem);
01204 return TRUE;
01205 }
01206
01207 while (pTheItem != NULL)
01208 {
01209 RefItem* pTheNextItem = (RefItem*)ItemList.GetNext(pTheItem);
01210
01211 if (pTheNextItem == NULL)
01212 {
01213 ItemList.InsertAfter(pTheItem, pNewItem);
01214 return TRUE;
01215 }
01216
01217 if (pTheNextItem->strItemName > strItemName)
01218 {
01219 ItemList.InsertBefore(pTheNextItem, pNewItem);
01220 return TRUE;
01221 }
01222
01223
01224 pTheItem = pTheNextItem;
01225 }
01226
01227
01228 ERROR3("Why are we here?");
01229 return FALSE;
01230 }
01231
01232
01233
01234
01235