TRootBrowserLite.cxx

Go to the documentation of this file.
00001 // @(#)root/gui:$Id: TRootBrowserLite.cxx 36977 2010-11-26 15:31:09Z bellenot $
00002 // Author: Fons Rademakers   27/02/98
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 //////////////////////////////////////////////////////////////////////////
00013 //                                                                      //
00014 // TRootBrowserLite                                                     //
00015 //                                                                      //
00016 // This class creates a ROOT object browser (looking like Windows       //
00017 // Explorer). The widgets used are the new native ROOT GUI widgets.     //
00018 //                                                                      //
00019 //////////////////////////////////////////////////////////////////////////
00020 
00021 #include "RConfigure.h"
00022 
00023 #include "TRootBrowserLite.h"
00024 #include "TRootApplication.h"
00025 #include "TGCanvas.h"
00026 #include "TGMenu.h"
00027 #include "TGFileDialog.h"
00028 #include "TGStatusBar.h"
00029 #include "TGFSComboBox.h"
00030 #include "TGLabel.h"
00031 #include "TGButton.h"
00032 #include "TGListView.h"
00033 #include "TGListTree.h"
00034 #include "TGToolBar.h"
00035 #include "TGSplitter.h"
00036 #include "TG3DLine.h"
00037 #include "TGFSContainer.h"
00038 #include "TGMimeTypes.h"
00039 #include "TRootHelpDialog.h"
00040 #include "TGTextEntry.h"
00041 #include "TGTextEdit.h"
00042 #include "TGTextEditDialogs.h"
00043 
00044 #include "TROOT.h"
00045 #include "TEnv.h"
00046 #include "TBrowser.h"
00047 #include "TApplication.h"
00048 #include "TFile.h"
00049 #include "TKey.h"
00050 #include "TKeyMapFile.h"
00051 #include "TClass.h"
00052 #include "TContextMenu.h"
00053 #include "TSystem.h"
00054 #include "TSystemDirectory.h"
00055 #include "TSystemFile.h"
00056 #include "TRemoteObject.h"
00057 #include "TInterpreter.h"
00058 #include "TGuiBuilder.h"
00059 #include "TImage.h"
00060 #include "TVirtualPad.h"
00061 #include "KeySymbols.h"
00062 #include "THashTable.h"
00063 #include "TMethod.h"
00064 #include "TColor.h"
00065 #include "TObjString.h"
00066 #include "TGDNDManager.h"
00067 #include "TBufferFile.h"
00068 #include "TFolder.h"
00069 #include "Getline.h"
00070 
00071 #include "HelpText.h"
00072 
00073 #ifdef WIN32
00074 #include "TWin32SplashThread.h"
00075 #endif
00076 
00077 // Browser menu command ids
00078 enum ERootBrowserCommands {
00079    kFileNewBrowserLite,
00080    kFileNewBrowser,
00081    kFileNewCanvas,
00082    kFileNewBuilder,
00083    kFileOpen,
00084    kFileSave,
00085    kFileSaveAs,
00086    kFilePrint,
00087    kFileCloseBrowser,
00088    kFileQuit,
00089 
00090    kViewToolBar,
00091    kViewStatusBar,
00092    kViewLargeIcons,
00093    kViewSmallIcons,
00094    kViewList,
00095    kViewDetails,
00096    kViewLineUp,
00097    kViewHidden,
00098    kViewRefresh,
00099    kViewFind,
00100    kViewExec,
00101    kViewInterrupt,
00102    kViewSave,
00103 
00104    kViewArrangeByName,     // Arrange submenu
00105    kViewArrangeByType,
00106    kViewArrangeBySize,
00107    kViewArrangeByDate,
00108    kViewArrangeAuto,
00109    kViewGroupLV,
00110 
00111    kHistoryBack,
00112    kHistoryForw,
00113 
00114    kOptionShowCycles,
00115    kOptionAutoThumbnail,
00116 
00117    kOneLevelUp,            // One level up toolbar button
00118    kFSComboBox,            // File system combobox in toolbar
00119 
00120    kHelpAbout,
00121    kHelpOnBrowser,
00122    kHelpOnCanvas,
00123    kHelpOnMenus,
00124    kHelpOnGraphicsEd,
00125    kHelpOnObjects,
00126    kHelpOnPS,
00127    kHelpOnRemote
00128 };
00129 
00130 
00131 //----- Struct for default icons
00132 
00133 struct DefaultIcon_t {
00134    const char      *fPicnamePrefix;
00135    const TGPicture *fIcon[2];
00136 };
00137 
00138 #if 0
00139 static DefaultIcon_t gDefaultIcon[] = {
00140    { "folder",  { 0, 0 } },
00141    { "app",     { 0, 0 } },
00142    { "doc",     { 0, 0 } },
00143    { "slink",   { 0, 0 } },
00144    { "histo",   { 0, 0 } },
00145    { "object",  { 0, 0 } }
00146 };
00147 #endif
00148 
00149 
00150 //----- Toolbar stuff...
00151 
00152 static ToolBarData_t gToolBarData[] = {
00153    { "tb_uplevel.xpm",   "Up One Level",   kFALSE, kOneLevelUp, 0 },
00154    { "",                 "",               kFALSE, -1, 0 },
00155    { "tb_bigicons.xpm",  "Large Icons",    kTRUE,  kViewLargeIcons, 0 },
00156    { "tb_smicons.xpm",   "Small Icons",    kTRUE,  kViewSmallIcons, 0 },
00157    { "tb_list.xpm",      "List",           kTRUE,  kViewList, 0 },
00158    { "tb_details.xpm",   "Details",        kTRUE,  kViewDetails, 0 },
00159    { "",                 "",               kFALSE, -1, 0 },
00160    { "tb_back.xpm",      "Back",           kFALSE, kHistoryBack, 0 },
00161    { "tb_forw.xpm",      "Forward",        kFALSE, kHistoryForw, 0 },
00162    { "tb_refresh.xpm",   "Refresh (F5)",   kFALSE, kViewRefresh, 0 },
00163    { "",                 "",               kFALSE, -1, 0 },
00164    { "tb_find.xpm",      "Find (Ctrl-F)",  kFALSE, kViewFind, 0 },
00165    { "",                 "",               kFALSE, -1, 0 },
00166    { "macro_t.xpm",      "Execute Macro",  kFALSE, kViewExec, 0 },
00167    { "interrupt.xpm",    "Interrupt Macro",kFALSE, kViewInterrupt, 0 },
00168    { "filesaveas.xpm",   "Save Macro",     kFALSE, kViewSave, 0 },
00169    { 0,                  0,                kFALSE, 0, 0 }
00170 };
00171 
00172 
00173 //----- TGFileDialog file types
00174 
00175 static const char *gOpenTypes[] = { "ROOT files",   "*.root",
00176                                     "All files",    "*",
00177                                     0,              0 };
00178 
00179 ////////////////////////////////////////////////////////////////////////////////////
00180 class TRootBrowserHistoryCursor : public TObject {
00181 public:
00182    TGListTreeItem *fItem;
00183 
00184    TRootBrowserHistoryCursor(TGListTreeItem *item) : fItem(item) {}
00185    void Print(Option_t *) const {  if (fItem) printf("%s\n", fItem->GetText()); }
00186 };
00187 
00188 
00189 ////////////////////////////////////////////////////////////////////////////////////
00190 class TRootBrowserHistory : public TList {
00191 public:
00192    void RecursiveRemove(TObject *obj) {
00193       TRootBrowserHistoryCursor *cur;
00194       TIter next(this);
00195 
00196       while ((cur = (TRootBrowserHistoryCursor*)next())) {
00197          if (cur->fItem->GetUserData() == obj) {
00198             Remove(cur);
00199             delete cur;
00200          }
00201       }
00202    }
00203 
00204    void DeleteItem(TGListTreeItem *item) {
00205       TRootBrowserHistoryCursor *cur;
00206       TIter next(this);
00207 
00208       while ((cur = (TRootBrowserHistoryCursor*)next())) {
00209          if (cur->fItem == item) {
00210             Remove(cur);
00211             delete cur;
00212          }
00213       }
00214    }
00215 };
00216 
00217 
00218 ////////////////////////////////////////////////////////////////////////////////////
00219 class TRootBrowserCursorSwitcher {
00220 private:
00221    TGWindow *fW1;
00222    TGWindow *fW2;
00223 public:
00224    TRootBrowserCursorSwitcher(TGWindow *w1, TGWindow *w2) : fW1(w1), fW2(w2) {
00225       if (w1) gVirtualX->SetCursor(w1->GetId(), gVirtualX->CreateCursor(kWatch));
00226       if (w2) gVirtualX->SetCursor(w2->GetId(), gVirtualX->CreateCursor(kWatch));
00227    }
00228    ~TRootBrowserCursorSwitcher() {
00229       if (fW1) gVirtualX->SetCursor(fW1->GetId(), gVirtualX->CreateCursor(kPointer));
00230       if (fW2) gVirtualX->SetCursor(fW2->GetId(), gVirtualX->CreateCursor(kPointer));
00231    }
00232 };
00233 
00234 ////////////////////////////////////////////////////////////////////////////////////
00235 class TIconBoxThumb : public TObject {
00236 public:
00237    TString fName;
00238    const TGPicture *fSmall;
00239    const TGPicture *fLarge;
00240 
00241    TIconBoxThumb(const char *name, const TGPicture *spic, const TGPicture *pic) {
00242       fName = name;
00243       fSmall = spic;
00244       fLarge = pic;
00245    }
00246    ULong_t Hash() const { return fName.Hash(); }
00247    const char *GetName() const { return fName.Data(); }
00248 };
00249 
00250 
00251 
00252 //----- Special ROOT object item (this are items in the icon box, see
00253 //----- TRootIconBox)
00254 ////////////////////////////////////////////////////////////////////////////////////
00255 class TRootObjItem : public TGFileItem {
00256 public:
00257    TRootObjItem(const TGWindow *p, const TGPicture *bpic,
00258                 const TGPicture *spic, TGString *name,
00259                 TObject *obj, TClass *cl, EListViewMode viewMode = kLVSmallIcons);
00260 
00261    virtual TDNDData *GetDNDData(Atom_t) {
00262       TObject *object = 0;
00263       if (fObj->IsA() == TKey::Class())
00264          object = ((TKey *)fObj)->ReadObj();
00265       else
00266          object = fObj;
00267       if (object) {
00268          if (!fBuf) fBuf = new TBufferFile(TBuffer::kWrite);
00269          fBuf->WriteObject(object);
00270          fDNDData.fData = fBuf->Buffer();
00271          fDNDData.fDataLength = fBuf->Length();
00272       }
00273       fDNDData.fDataType = gVirtualX->InternAtom("application/root", kFALSE);
00274       return &fDNDData;
00275    }
00276 
00277    virtual Bool_t HandleDNDFinished() {
00278       if (GetParent())
00279          return ((TGFrame *)GetParent())->HandleDNDFinished();
00280       return kFALSE;
00281    }
00282 
00283 protected:
00284    TObject     *fObj;
00285    TDNDData     fDNDData;
00286 };
00287 
00288 //______________________________________________________________________________
00289 TRootObjItem::TRootObjItem(const TGWindow *p, const TGPicture *bpic,
00290                            const TGPicture *spic, TGString *name,
00291                            TObject *obj, TClass *, EListViewMode viewMode) :
00292    TGFileItem(p, bpic, 0, spic, 0, name, 0, 0, 0, 0, 0, viewMode)
00293 {
00294    // Create an icon box item.
00295 
00296    fObj = obj;
00297    fDNDData.fData = 0;
00298    fDNDData.fDataLength = 0;
00299 
00300    if (fSubnames) {
00301       for (Int_t i = 0; fSubnames[i] != 0; ++i) delete fSubnames[i];
00302    }
00303    delete [] fSubnames;
00304    fSubnames = new TGString* [2];
00305 
00306    fSubnames[0] = new TGString(obj->GetTitle());
00307 
00308    fSubnames[1] = 0;
00309 
00310    if (obj->IsA()->HasDefaultConstructor()) {
00311       SetDNDSource(kTRUE);
00312    }
00313    if ((obj->IsA() == TFolder::Class()) ||
00314        (obj->IsA() == TClass::Class())) {
00315       SetDNDSource(kFALSE);
00316    }
00317 
00318    int i;
00319    for (i = 0; fSubnames[i] != 0; ++i)
00320       ;
00321    fCtw = new int[i];
00322    for (i = 0; fSubnames[i] != 0; ++i)
00323       fCtw[i] = gVirtualX->TextWidth(fFontStruct, fSubnames[i]->GetString(),
00324                                      fSubnames[i]->GetLength());
00325 }
00326 
00327 class TRootIconBox;
00328 ////////////////////////////////////////////////////////////////////////////////////
00329 class TRootIconList : public TList {
00330 
00331 private:
00332    TRootIconBox    *fIconBox; // iconbox to which list belongs
00333    const TGPicture *fPic;     // list view icon
00334 
00335 public:
00336    TRootIconList(TRootIconBox* box = 0);
00337    virtual ~TRootIconList();
00338    void              UpdateName();
00339    const char       *GetTitle() const { return "ListView Container"; }
00340    Bool_t            IsFolder() const { return kFALSE; }
00341    void              Browse(TBrowser *b);
00342    const TGPicture  *GetPicture() const { return fPic; }
00343 };
00344 
00345 //______________________________________________________________________________
00346 TRootIconList::TRootIconList(TRootIconBox* box)
00347 {
00348    // constructor
00349 
00350    fPic = gClient->GetPicture("listview.xpm");
00351    fIconBox = box;
00352    fName = "empty";
00353 }
00354 
00355 //______________________________________________________________________________
00356 TRootIconList::~TRootIconList()
00357 {
00358    // destructor
00359 
00360    gClient->FreePicture(fPic);
00361 }
00362 
00363 //______________________________________________________________________________
00364 void TRootIconList::UpdateName()
00365 {
00366    // composite name
00367 
00368    if (!First()) return;
00369 
00370    if (fSize==1) {
00371       fName = First()->GetName();
00372       return;
00373    }
00374 
00375    fName = First()->GetName();
00376    fName += "-";
00377    fName += Last()->GetName();
00378 }
00379 
00380 //----- Special ROOT object container (this is the icon box on the
00381 //----- right side of the browser)
00382 ////////////////////////////////////////////////////////////////////////////////////
00383 class TRootIconBox : public TGFileContainer {
00384 friend class TRootIconList;
00385 friend class TRootBrowserLite;
00386 
00387 private:
00388    Bool_t           fCheckHeaders;   // if true check headers
00389    TRootIconList   *fCurrentList;    //
00390    TRootObjItem    *fCurrentItem;    //
00391    Bool_t           fGrouped;        //
00392    TString          fCachedPicName;  //
00393    TList           *fGarbage;        // garbage for  TRootIconList's
00394    Int_t            fGroupSize;      // the total number of items when icon box switched to "global view" mode
00395    TGString        *fCurrentName;    //
00396    const TGPicture *fLargeCachedPic; //
00397    const TGPicture *fSmallCachedPic; //
00398    Bool_t           fWasGrouped;
00399    TObject         *fActiveObject;   //
00400    Bool_t           fIsEmpty;
00401    THashTable      *fThumbnails;     // hash table with thumbnailed pictures
00402    Bool_t           fAutoThumbnail;  //
00403    TRootBrowserLite    *fBrowser;
00404 
00405    void  *FindItem(const TString& name,
00406                    Bool_t direction = kTRUE,
00407                    Bool_t caseSensitive = kTRUE,
00408                    Bool_t beginWith = kFALSE);
00409    void RemoveGarbage();
00410 
00411 public:
00412    TRootIconBox(TRootBrowserLite *browser, TGListView *lv,
00413                 UInt_t options = kSunkenFrame,
00414                 ULong_t back = GetDefaultFrameBackground());
00415 
00416    virtual ~TRootIconBox();
00417 
00418    void   AddObjItem(const char *name, TObject *obj, TClass *cl);
00419    void   GetObjPictures(const TGPicture **pic, const TGPicture **spic,
00420                          TObject *obj, const char *name);
00421    void   SetObjHeaders();
00422    void   Refresh();
00423    void   RemoveAll();
00424    void   SetGroupSize(Int_t siz) { fGroupSize = siz; }
00425    Int_t  GetGroupSize() const { return fGroupSize; }
00426    TGFrameElement *FindFrame(Int_t x, Int_t y, Bool_t exclude=kTRUE) { return TGContainer::FindFrame(x,y,exclude); }
00427    Bool_t WasGrouped() const { return fWasGrouped; }
00428 };
00429 
00430 //______________________________________________________________________________
00431 TRootIconBox::TRootIconBox(TRootBrowserLite *browser, TGListView *lv, UInt_t options,
00432                            ULong_t back) : TGFileContainer(lv, options, back)
00433 {
00434    // Create iconbox containing ROOT objects in browser.
00435 
00436    fListView = lv;
00437    fBrowser = browser;
00438 
00439    fCheckHeaders = kTRUE;
00440    fTotal = 0;
00441    fGarbage = new TList();
00442    fCurrentList = 0;
00443    fCurrentItem = 0;
00444    fGrouped = kFALSE;
00445    fGroupSize = 1000;
00446    fCurrentName = 0;
00447    fWasGrouped = kFALSE;
00448    fActiveObject = 0;
00449    fIsEmpty = kTRUE;
00450 
00451    // Don't use timer HERE (timer is set in TBrowser).
00452    StopRefreshTimer();
00453    fRefresh = 0;
00454    fThumbnails = new THashTable(50);
00455    fAutoThumbnail = kTRUE;
00456 }
00457 
00458 //______________________________________________________________________________
00459 TRootIconBox::~TRootIconBox()
00460 {
00461    // destructor
00462 
00463    RemoveAll();
00464    RemoveGarbage();
00465    delete fGarbage;
00466    delete fThumbnails;
00467 }
00468 
00469 //______________________________________________________________________________
00470 void TRootIconBox::GetObjPictures(const TGPicture **pic, const TGPicture **spic,
00471                                   TObject *obj, const char *name)
00472 {
00473    // Retrieve icons associated with class "name". Association is made
00474    // via the user's ~/.root.mimes file or via $ROOTSYS/etc/root.mimes.
00475 
00476    static TImage *im = 0;
00477    if (!im) {
00478       im = TImage::Create();
00479    }
00480 
00481    TString xpm_magic(name, 3);
00482    Bool_t xpm = xpm_magic == "/* ";
00483    const char *iconname = xpm ? obj->GetName() : name;
00484 
00485    if (obj->IsA()->InheritsFrom("TGeoVolume")) {
00486       iconname = obj->GetIconName() ? obj->GetIconName() : obj->IsA()->GetName();
00487    }
00488 
00489    if (fCachedPicName == iconname) {
00490       *pic = fLargeCachedPic;
00491       *spic = fSmallCachedPic;
00492       return;
00493    }
00494 
00495    *pic = fClient->GetMimeTypeList()->GetIcon(iconname, kFALSE);
00496 
00497    if (!(*pic) && xpm) {
00498       if (im && im->SetImageBuffer((char**)&name, TImage::kXpm)) {
00499          *pic = fClient->GetPicturePool()->GetPicture(iconname, im->GetPixmap(),
00500                                                       im->GetMask());
00501          im->Scale(im->GetWidth()/2, im->GetHeight()/2);
00502          *spic = fClient->GetPicturePool()->GetPicture(iconname, im->GetPixmap(),
00503                                                       im->GetMask());
00504       }
00505 
00506       fClient->GetMimeTypeList()->AddType("[thumbnail]", iconname, iconname, iconname, "->Browse()");
00507       return;
00508    }
00509 
00510    if (*pic == 0) {
00511       if (obj->IsFolder()) {
00512          *pic = fFolder_s;
00513       } else {
00514          *pic = fDoc_s;
00515       }
00516    }
00517    fLargeCachedPic = *pic;
00518 
00519    *spic = fClient->GetMimeTypeList()->GetIcon(iconname, kTRUE);
00520 
00521    if (*spic == 0) {
00522       if (obj->IsFolder())
00523          *spic = fFolder_t;
00524       else
00525          *spic = fDoc_t;
00526    }
00527    fSmallCachedPic = *spic;
00528    fCachedPicName = iconname;
00529 }
00530 
00531 //______________________________________________________________________________
00532 void TRootIconBox::RemoveGarbage()
00533 {
00534    // delete all TRootIconLists from garbage
00535 
00536    TIter next(fGarbage);
00537    TList *li;
00538 
00539    while ((li=(TList *)next())) {
00540       li->Clear("nodelete");
00541    }
00542    fGarbage->Delete();
00543 }
00544 
00545 //______________________________________________________________________________
00546 void TRootIconBox::AddObjItem(const char *name, TObject *obj, TClass *cl)
00547 {
00548    // Add object to iconbox. Class is used to get the associated icons
00549    // via the mime file (see GetObjPictures()).
00550 
00551    if (!cl) return;
00552 
00553    Bool_t isSystemFile = kFALSE;
00554    TGFileItem *fi;
00555    fWasGrouped = kFALSE;
00556    const TGPicture *pic = 0;
00557    const TGPicture *spic = 0;
00558 
00559    if (obj->InheritsFrom("TRemoteObject")) {
00560       // check if the real remote object is a system file or directory
00561       TRemoteObject *robj = (TRemoteObject *)obj;
00562       if ((TString(robj->GetClassName()) == "TSystemFile") ||
00563           (TString(robj->GetClassName()) == "TSystemDirectory"))
00564          isSystemFile = kTRUE;
00565    }
00566 
00567    if (isSystemFile || obj->IsA() == TSystemFile::Class() ||
00568        obj->IsA() == TSystemDirectory::Class()) {
00569       if (fCheckHeaders) {
00570          if (strcmp(fListView->GetHeader(1), "Attributes")) {
00571             fListView->SetDefaultHeaders();
00572             TGTextButton** buttons = fListView->GetHeaderButtons();
00573             if (buttons) {
00574                buttons[0]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
00575                                    TString::Format("SetSortMode(=%d)", kViewArrangeByName));
00576                buttons[1]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
00577                                    TString::Format("SetSortMode(=%d)", kViewArrangeByType));
00578                buttons[2]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
00579                                    TString::Format("SetSortMode(=%d)", kViewArrangeBySize));
00580                buttons[5]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
00581                                    TString::Format("SetSortMode(=%d)", kViewArrangeByDate));
00582             }
00583          }
00584          fCheckHeaders = kFALSE;
00585       }
00586 
00587       TIconBoxThumb *thumb = 0;
00588       char *thumbname = gSystem->ConcatFileName(gSystem->WorkingDirectory(), name);
00589       thumb = (TIconBoxThumb *)fThumbnails->FindObject(gSystem->IsAbsoluteFileName(name) ? name :
00590                                                        thumbname);
00591       delete []thumbname;
00592 
00593       if (thumb) {
00594          spic = thumb->fSmall;
00595          pic =  thumb->fLarge;
00596       }
00597 
00598       if (obj->InheritsFrom("TRemoteObject"))
00599          // special case for remote object
00600          fi = AddRemoteFile(obj, spic, pic);
00601       else
00602          fi = AddFile(name, spic, pic);
00603       if (fi) {
00604          fi->SetUserData(obj);
00605          if (obj->IsA() == TSystemFile::Class()) {
00606             TString str;
00607             TDNDData data;
00608             str = TString::Format("file://%s/%s\r\n",
00609                                   gSystem->UnixPathName(obj->GetTitle()),
00610                                   obj->GetName());
00611             data.fData = (void *)strdup(str.Data());
00612             data.fDataLength = str.Length()+1;
00613             data.fDataType = gVirtualX->InternAtom("text/uri-list", kFALSE);
00614             fi->SetDNDData(&data);
00615             fi->SetDNDSource(kTRUE);
00616          }
00617       }
00618 
00619       fIsEmpty = kFALSE;
00620       return;
00621    }
00622 
00623    if (!fCurrentList) {
00624       fCurrentList = new TRootIconList(this);
00625       fGarbage->Add(fCurrentList);
00626    }
00627 
00628    fCurrentList->Add(obj);
00629    fCurrentList->UpdateName();
00630    fIsEmpty = kFALSE;
00631 
00632    TGFrameElement *el;
00633    TIter next(fList);
00634    while ((el = (TGFrameElement *) next())) {
00635       TGLVEntry *f = (TGLVEntry *) el->fFrame;
00636       if (f->GetUserData() == obj) {
00637          return;
00638       }
00639    }
00640 
00641    if (fGrouped && fCurrentItem && (fCurrentList->GetSize()>1)) {
00642       fCurrentName->SetString(fCurrentList->GetName());
00643    }
00644 
00645    EListViewMode view = fListView->GetViewMode();
00646 
00647    if ((fCurrentList->GetSize() < fGroupSize) && !fGrouped) {
00648       GetObjPictures(&pic, &spic, obj, obj->GetIconName() ?
00649                      obj->GetIconName() : cl->GetName());
00650 
00651       if (fCheckHeaders) {
00652          if (strcmp(fListView->GetHeader(1), "Title")) {
00653             SetObjHeaders();
00654          }
00655          fCheckHeaders = kFALSE;
00656       }
00657 
00658       fi = new TRootObjItem(this, pic, spic, new TGString(name), obj, cl, view);
00659 
00660       fi->SetUserData(obj);
00661       AddItem(fi);
00662       fTotal++;
00663       return;
00664    }
00665 
00666    if (fGrouped && (fCurrentList->GetSize()==1)) {
00667       fCurrentName = new TGString(fCurrentList->GetName());
00668       fCurrentItem = new TRootObjItem(this, fCurrentList->GetPicture(), fCurrentList->GetPicture(),
00669                                       fCurrentName,fCurrentList, TList::Class(), view);
00670       fCurrentItem->SetUserData(fCurrentList);
00671       AddItem(fCurrentItem);
00672       fTotal = fList->GetSize();
00673       return;
00674    }
00675 
00676    if ((fCurrentList->GetSize()==fGroupSize) && !fGrouped) {
00677       fGrouped = kTRUE;
00678 
00679       // clear fList
00680       TGFrameElement *el2;
00681       TIter nextl(fList);
00682 
00683       while ((el2 = (TGFrameElement *) nextl())) {
00684          el2->fFrame->DestroyWindow();
00685          delete el2->fFrame;
00686          fList->Remove(el2);
00687          delete el2;
00688       }
00689 
00690       fCurrentName = new TGString(fCurrentList->GetName());
00691       fi = new TRootObjItem(this, fCurrentList->GetPicture(), fCurrentList->GetPicture(),
00692                             fCurrentName, fCurrentList, TList::Class(), view);
00693       fi->SetUserData(fCurrentList);
00694       AddItem(fi);
00695 
00696       fCurrentList = new TRootIconList(this);
00697       fGarbage->Add(fCurrentList);
00698       fTotal = 1;
00699       return;
00700    }
00701 
00702    if ((fCurrentList->GetSize()==fGroupSize) && fGrouped) {
00703       fCurrentList = new TRootIconList(this);
00704       fGarbage->Add(fCurrentList);
00705       return;
00706    }
00707 }
00708 
00709 //______________________________________________________________________________
00710 void TRootIconList::Browse(TBrowser *)
00711 {
00712    // browse icon list
00713 
00714    if (!fIconBox) return;
00715 
00716    TObject *obj;
00717    TGFileItem *fi;
00718    const TGPicture *pic = 0;
00719    const TGPicture *spic = 0;
00720    TClass *cl;
00721    TString name;
00722    TKey *key = 0;
00723 
00724    fIconBox->RemoveAll();
00725    TObjLink *lnk = FirstLink();
00726 
00727    while (lnk) {
00728       obj = lnk->GetObject();
00729       lnk = lnk->Next();
00730 
00731       if (obj->IsA() == TKey::Class()) {
00732          cl = TClass::GetClass(((TKey *)obj)->GetClassName());
00733          key = (TKey *)obj;
00734       } else if (obj->IsA() == TKeyMapFile::Class()) {
00735          cl = TClass::GetClass(((TKeyMapFile *)obj)->GetTitle());
00736       } else if (obj->InheritsFrom("TRemoteObject")) {
00737          // special case for remote object: get real object class
00738          TRemoteObject *robj = (TRemoteObject *)obj;
00739          cl = TClass::GetClass(robj->GetClassName());
00740       } else {
00741          cl = obj->IsA();
00742       }
00743 
00744       name = obj->GetName();
00745 
00746       if (key && obj->IsA() == TKey::Class()) {
00747          name += ";";
00748          name +=  key->GetCycle();
00749       }
00750 
00751       fIconBox->GetObjPictures(&pic, &spic, obj, obj->GetIconName() ?
00752                                obj->GetIconName() : cl->GetName());
00753 
00754       fi = new TRootObjItem((const TGWindow*)fIconBox, pic, spic, new TGString(name.Data()),
00755                              obj, cl, (EListViewMode)fIconBox->GetViewMode());
00756       fi->SetUserData(obj);
00757       fIconBox->AddItem(fi);
00758       fIconBox->fTotal++;
00759 
00760       if (obj==fIconBox->fActiveObject) {
00761          fIconBox->ActivateItem((TGFrameElement*)fIconBox->fList->Last());
00762       }
00763    }
00764 
00765    fIconBox->fGarbage->Remove(this);
00766    fIconBox->RemoveGarbage();
00767    fIconBox->fGarbage->Add(this); // delete this later
00768 
00769    fIconBox->Refresh();
00770    fIconBox->AdjustPosition();
00771 
00772    fIconBox->fWasGrouped = kTRUE;
00773 }
00774 
00775 //______________________________________________________________________________
00776 void *TRootIconBox::FindItem(const TString& name, Bool_t direction,
00777                              Bool_t caseSensitive,Bool_t beginWith)
00778 {
00779    // Find a frame which assosiated object has a name containing a "name" string.
00780 
00781    if (!fGrouped) {
00782       return TGContainer::FindItem(name, direction, caseSensitive, beginWith);
00783    }
00784 
00785    if (name.IsNull()) return 0;
00786    int idx = kNPOS;
00787 
00788    TGFrameElement* el = 0;
00789    TString str;
00790    TString::ECaseCompare cmp = caseSensitive ? TString::kExact : TString::kIgnoreCase;
00791 
00792    fLastDir = direction;
00793    fLastCase = caseSensitive;
00794    fLastName = name;
00795 
00796    if (fLastActiveEl) {
00797       el = fLastActiveEl;
00798 
00799       if (direction) {
00800          el = (TGFrameElement *)fList->After(el);
00801       } else {
00802          el = (TGFrameElement *)fList->Before(el);
00803       }
00804    } else {
00805       if (direction) el = (TGFrameElement *)fList->First();
00806       else el  = (TGFrameElement *)fList->Last();
00807    }
00808 
00809    TGLVEntry* lv = 0;
00810    TObject* obj = 0;
00811    TList* li = 0;
00812 
00813    while (el) {
00814       lv = (TGLVEntry*)el->fFrame;
00815       li = (TList*)lv->GetUserData();
00816 
00817       TIter next(li);
00818 
00819       while ((obj=next())) {
00820          str = obj->GetName();
00821          idx = str.Index(name,0,cmp);
00822 
00823          if (idx!=kNPOS) {
00824             if (beginWith) {
00825                if (idx==0) {
00826                   fActiveObject = obj;
00827                   return el;
00828                }
00829             } else {
00830                fActiveObject = obj;
00831                return el;
00832             }
00833          }
00834       }
00835       if (direction) {
00836          el = (TGFrameElement *)fList->After(el);
00837       } else {
00838          el = (TGFrameElement *)fList->Before(el);
00839       }
00840    }
00841    fActiveObject = 0;
00842    return 0;
00843 }
00844 
00845 //______________________________________________________________________________
00846 void TRootIconBox::SetObjHeaders()
00847 {
00848    // Set list box headers used to display detailed object iformation.
00849    // Currently this is only "Name" and "Title".
00850 
00851    fListView->SetHeaders(2);
00852    fListView->SetHeader("Name",  kTextLeft, kTextLeft, 0);
00853    fListView->SetHeader("Title", kTextLeft, kTextLeft, 1);
00854 }
00855 
00856 //______________________________________________________________________________
00857 void TRootIconBox::Refresh()
00858 {
00859    // Sort icons, and send message to browser with number of objects
00860    // in box.
00861 
00862    // This automatically calls layout
00863    Sort(fSortType);
00864 
00865    // Make TRootBrowserLite display total objects in status bar
00866    SendMessage(fMsgWindow, MK_MSG(kC_CONTAINER, kCT_SELCHANGED), fTotal, fSelected);
00867 
00868    MapSubwindows();
00869    fListView->AdjustHeaders();
00870 }
00871 
00872 //______________________________________________________________________________
00873 void TRootIconBox::RemoveAll()
00874 {
00875    // Remove all items from icon box
00876 
00877    if (fIsEmpty) return;
00878 
00879    fCheckHeaders = kTRUE;
00880    TGFileContainer::RemoveAll();
00881    fGrouped = kFALSE;
00882    fCurrentItem = 0;
00883    fCurrentList = 0;
00884    fIsEmpty = kTRUE;
00885 }
00886 
00887 
00888 //_____________________________________________________________________________
00889 //
00890 // TRootBrowserLite
00891 //
00892 // ROOT object browser (looking like Windows Explorer).
00893 //_____________________________________________________________________________
00894 
00895 ClassImp(TRootBrowserLite)
00896 
00897 //______________________________________________________________________________
00898 TRootBrowserLite::TRootBrowserLite(TBrowser *b, const char *name, UInt_t width, UInt_t height)
00899    : TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
00900 {
00901    // Create browser with a specified width and height.
00902 
00903    CreateBrowser(name);
00904 
00905    Resize(width, height);
00906    if (b) Show();
00907 }
00908 
00909 //______________________________________________________________________________
00910 TRootBrowserLite::TRootBrowserLite(TBrowser *b, const char *name, Int_t x, Int_t y,
00911                            UInt_t width, UInt_t height)
00912    : TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
00913 {
00914    // Create browser with a specified width and height and at position x, y.
00915 
00916    CreateBrowser(name);
00917 
00918    MoveResize(x, y, width, height);
00919    SetWMPosition(x, y);
00920    if (b) Show();
00921 }
00922 
00923 //______________________________________________________________________________
00924 TRootBrowserLite::~TRootBrowserLite()
00925 {
00926    // Browser destructor.
00927 
00928    if (fIconPic) gClient->FreePicture(fIconPic);
00929 
00930    delete fToolBarSep;
00931 
00932    fToolBar->Cleanup();
00933    delete fToolBar;
00934    delete fStatusBar;
00935    delete fV1;
00936    delete fV2;
00937    delete fLbl1;
00938    delete fLbl2;
00939    delete fHf;
00940    delete fTreeHdr;
00941    delete fListHdr;
00942    delete fIconBox;
00943    delete fListView;
00944    delete fLt;
00945    delete fTreeView;
00946 
00947    delete fMenuBar;
00948    delete fFileMenu;
00949    delete fViewMenu;
00950    delete fOptionMenu;
00951    delete fHelpMenu;
00952    delete fSortMenu;
00953 
00954    delete fMenuBarLayout;
00955    delete fMenuBarItemLayout;
00956    delete fMenuBarHelpLayout;
00957    delete fBarLayout;
00958 
00959    delete fTextEdit;
00960 
00961    if (fWidgets) fWidgets->Delete();
00962    delete fWidgets;
00963 
00964    fHistory->Delete();
00965    delete fHistory;
00966 }
00967 
00968 //______________________________________________________________________________
00969 void TRootBrowserLite::CreateBrowser(const char *name)
00970 {
00971    // Create the actual browser.
00972 
00973    fWidgets = new TList;
00974    fHistory = new TRootBrowserHistory;
00975    fHistoryCursor = 0;
00976    fBrowseTextFile = kFALSE;
00977 
00978    // Create menus
00979    fFileMenu = new TGPopupMenu(fClient->GetDefaultRoot());
00980    fFileMenu->AddEntry("&New Browser",        kFileNewBrowser);
00981    fFileMenu->AddEntry("New Browser &Lite",   kFileNewBrowserLite);
00982    fFileMenu->AddEntry("New Canvas",          kFileNewCanvas);
00983    fFileMenu->AddEntry("&Gui Builder",        kFileNewBuilder);
00984    fFileMenu->AddEntry("&Open...",            kFileOpen);
00985    fFileMenu->AddSeparator();
00986    fFileMenu->AddEntry("&Save",               kFileSave);
00987    fFileMenu->AddEntry("Save &As...",         kFileSaveAs);
00988    fFileMenu->AddSeparator();
00989    fFileMenu->AddEntry("&Print...",           kFilePrint);
00990    fFileMenu->AddSeparator();
00991    fFileMenu->AddEntry("&Close Browser",      kFileCloseBrowser);
00992    fFileMenu->AddSeparator();
00993    fFileMenu->AddEntry("&Quit ROOT",          kFileQuit);
00994 
00995    //fFileMenu->DefaultEntry(kFileNewCanvas);
00996    fFileMenu->DisableEntry(kFileSave);
00997    fFileMenu->DisableEntry(kFileSaveAs);
00998    fFileMenu->DisableEntry(kFilePrint);
00999 
01000    fSortMenu = new TGPopupMenu(fClient->GetDefaultRoot());
01001    fSortMenu->AddEntry("By &Name",            kViewArrangeByName);
01002    fSortMenu->AddEntry("By &Type",            kViewArrangeByType);
01003    fSortMenu->AddEntry("By &Size",            kViewArrangeBySize);
01004    fSortMenu->AddEntry("By &Date",            kViewArrangeByDate);
01005    fSortMenu->AddSeparator();
01006    fSortMenu->AddEntry("&Auto Arrange",       kViewArrangeAuto);
01007 
01008    fSortMenu->CheckEntry(kViewArrangeAuto);
01009 
01010    fViewMenu = new TGPopupMenu(fClient->GetDefaultRoot());
01011    fViewMenu->AddEntry("&Toolbar",            kViewToolBar);
01012    fViewMenu->AddEntry("Status &Bar",         kViewStatusBar);
01013    fViewMenu->AddSeparator();
01014    fViewMenu->AddEntry("Lar&ge Icons",        kViewLargeIcons);
01015    fViewMenu->AddEntry("S&mall Icons",        kViewSmallIcons);
01016    fViewMenu->AddEntry("&List",               kViewList);
01017    fViewMenu->AddEntry("&Details",            kViewDetails);
01018    fViewMenu->AddSeparator();
01019    fViewMenu->AddEntry("Show &Hidden",        kViewHidden);
01020    fViewMenu->AddPopup("Arrange &Icons",      fSortMenu);
01021    fViewMenu->AddEntry("Lin&e up Icons",      kViewLineUp);
01022    fViewMenu->AddEntry("&Group Icons",        kViewGroupLV);
01023 
01024    fViewMenu->AddSeparator();
01025    fViewMenu->AddEntry("&Refresh (F5)",       kViewRefresh);
01026 
01027    fViewMenu->CheckEntry(kViewToolBar);
01028    fViewMenu->CheckEntry(kViewStatusBar);
01029 
01030    if (fBrowser) {
01031       if (gEnv->GetValue("Browser.ShowHidden", 0)) {
01032          fViewMenu->CheckEntry(kViewHidden);
01033          fBrowser->SetBit(TBrowser::kNoHidden, kFALSE);
01034       } else {
01035          fViewMenu->UnCheckEntry(kViewHidden);
01036          fBrowser->SetBit(TBrowser::kNoHidden, kTRUE);
01037       }
01038    }
01039 
01040    fOptionMenu = new TGPopupMenu(fClient->GetDefaultRoot());
01041    fOptionMenu->AddEntry("&Show Cycles",        kOptionShowCycles);
01042    fOptionMenu->AddEntry("&AutoThumbnail",      kOptionAutoThumbnail);
01043 
01044    fHelpMenu = new TGPopupMenu(fClient->GetDefaultRoot());
01045    fHelpMenu->AddEntry("&About ROOT...",        kHelpAbout);
01046    fHelpMenu->AddSeparator();
01047    fHelpMenu->AddEntry("Help On Browser...",    kHelpOnBrowser);
01048    fHelpMenu->AddEntry("Help On Canvas...",     kHelpOnCanvas);
01049    fHelpMenu->AddEntry("Help On Menus...",      kHelpOnMenus);
01050    fHelpMenu->AddEntry("Help On Graphics Editor...", kHelpOnGraphicsEd);
01051    fHelpMenu->AddEntry("Help On Objects...",    kHelpOnObjects);
01052    fHelpMenu->AddEntry("Help On PostScript...", kHelpOnPS);
01053    fHelpMenu->AddEntry("Help On Remote Session...", kHelpOnRemote);
01054 
01055    // This main frame will process the menu commands
01056    fFileMenu->Associate(this);
01057    fViewMenu->Associate(this);
01058    fSortMenu->Associate(this);
01059    fOptionMenu->Associate(this);
01060    fHelpMenu->Associate(this);
01061 
01062    // Create menubar layout hints
01063    fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 1, 1);
01064    fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
01065    fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight);
01066 
01067    // Create menubar
01068    fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
01069    fMenuBar->AddPopup("&File",    fFileMenu,    fMenuBarItemLayout);
01070    fMenuBar->AddPopup("&View",    fViewMenu,    fMenuBarItemLayout);
01071    fMenuBar->AddPopup("&Options", fOptionMenu,  fMenuBarItemLayout);
01072    fMenuBar->AddPopup("&Help",    fHelpMenu,    fMenuBarHelpLayout);
01073 
01074    AddFrame(fMenuBar, fMenuBarLayout);
01075 
01076    // Create toolbar and separator
01077 
01078    fToolBarSep = new TGHorizontal3DLine(this);
01079    fToolBar = new TGToolBar(this, 60, 20, kHorizontalFrame);
01080    fFSComboBox = new TGFSComboBox(fToolBar, kFSComboBox);
01081 
01082    fComboLayout = new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 0, 0, 2, 2);
01083    fToolBar->AddFrame(fFSComboBox, fComboLayout);
01084    fFSComboBox->Resize(190, fFSComboBox->GetDefaultHeight());
01085    fFSComboBox->Associate(this);
01086 
01087    int spacing = 8;
01088 
01089    for (int i = 0; gToolBarData[i].fPixmap; i++) {
01090       if (strlen(gToolBarData[i].fPixmap) == 0) {
01091          spacing = 8;
01092          continue;
01093       }
01094       fToolBar->AddButton(this, &gToolBarData[i], spacing);
01095       spacing = 0;
01096    }
01097 
01098    fDrawOption = new TGComboBox(fToolBar, "");
01099    TGTextEntry *dropt_entry = fDrawOption->GetTextEntry();
01100    dropt_entry->SetToolTipText("Object Draw Option", 300);
01101    fDrawOption->Resize(80, 10);
01102    TGListBox *lb = fDrawOption->GetListBox();
01103    lb->Resize(lb->GetWidth(), 120);
01104    Int_t dropt = 1;
01105    fDrawOption->AddEntry("", dropt++);
01106    fDrawOption->AddEntry("same", dropt++);
01107    fDrawOption->AddEntry("box", dropt++);
01108    fDrawOption->AddEntry("lego", dropt++);
01109    fDrawOption->AddEntry("colz", dropt++);
01110    fDrawOption->AddEntry("alp", dropt++);
01111    fDrawOption->AddEntry("text", dropt++);
01112 
01113    fToolBar->AddFrame(fDrawOption, new TGLayoutHints(kLHintsCenterY | kLHintsRight | kLHintsExpandY,2,2,2,0));
01114    fToolBar->AddFrame(new TGLabel(fToolBar,"Option"),
01115                       new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2,2,2,0));
01116 
01117    fBarLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX);
01118    AddFrame(fToolBarSep, fBarLayout);
01119    AddFrame(fToolBar, fBarLayout);
01120 
01121    // Create panes
01122 
01123    fHf = new TGHorizontalFrame(this, 10, 10);
01124 
01125    fV1 = new TGVerticalFrame(fHf, 10, 10, kFixedWidth);
01126    fV2 = new TGVerticalFrame(fHf, 10, 10);
01127    fTreeHdr = new TGCompositeFrame(fV1, 10, 10, kSunkenFrame);
01128    fListHdr = new TGCompositeFrame(fV2, 10, 10, kSunkenFrame);
01129 
01130    fLbl1 = new TGLabel(fTreeHdr, "All Folders");
01131    fLbl2 = new TGLabel(fListHdr, "Contents of \".\"");
01132 
01133    TGLayoutHints *lo;
01134 
01135    lo = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 0, 0);
01136    fWidgets->Add(lo);
01137    fTreeHdr->AddFrame(fLbl1, lo);
01138    fListHdr->AddFrame(fLbl2, lo);
01139 
01140    lo = new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 1, 2);
01141    fWidgets->Add(lo);
01142    fV1->AddFrame(fTreeHdr, lo);
01143    fV2->AddFrame(fListHdr, lo);
01144 
01145    fV1->Resize(fTreeHdr->GetDefaultWidth()+100, fV1->GetDefaultHeight());
01146 
01147    lo = new TGLayoutHints(kLHintsLeft | kLHintsExpandY);
01148    fWidgets->Add(lo);
01149    fHf->AddFrame(fV1, lo);
01150 
01151    TGVSplitter *splitter = new TGVSplitter(fHf);
01152    splitter->SetFrame(fV1, kTRUE);
01153    lo = new TGLayoutHints(kLHintsLeft | kLHintsExpandY);
01154    fWidgets->Add(splitter);
01155    fWidgets->Add(lo);
01156    fHf->AddFrame(splitter, lo);
01157 
01158    lo = new TGLayoutHints(kLHintsRight | kLHintsExpandX | kLHintsExpandY);
01159    fWidgets->Add(lo);
01160    fHf->AddFrame(fV2, lo);
01161 
01162    // Create tree
01163    fTreeView = new TGCanvas(fV1, 10, 10, kSunkenFrame | kDoubleBorder); // canvas
01164    fLt = new TGListTree(fTreeView, kHorizontalFrame,fgWhitePixel); // container
01165    fLt->Associate(this);
01166    fLt->SetAutoTips();
01167 
01168    fExpandLayout = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY);
01169    fWidgets->Add(fExpandLayout);
01170    fV1->AddFrame(fTreeView, fExpandLayout);
01171 
01172    // Create list view (icon box)
01173    fListView = new TGListView(fV2, 520, 250); // canvas
01174    // container
01175    fIconBox = new TRootIconBox(this, fListView, kHorizontalFrame, fgWhitePixel);
01176    fIconBox->Associate(this);
01177    fListView->SetIncrements(1, 19); // set vertical scroll one line height at a time
01178    fViewMode = fListView->GetViewMode();
01179 
01180    TString str = gEnv->GetValue("Browser.AutoThumbnail", "yes");
01181    str.ToLower();
01182    fIconBox->fAutoThumbnail = (str == "yes") || atoi(str.Data());
01183    fIconBox->fAutoThumbnail ? fOptionMenu->CheckEntry(kOptionAutoThumbnail) :
01184                               fOptionMenu->UnCheckEntry(kOptionAutoThumbnail);
01185 
01186    str = gEnv->GetValue("Browser.GroupView", "10000");
01187    Int_t igv = atoi(str.Data());
01188 
01189    if (igv>10) {
01190       fViewMenu->CheckEntry(kViewGroupLV);
01191       fIconBox->SetGroupSize(igv);
01192    }
01193 
01194    // reuse lo from "create tree"
01195    fV2->AddFrame(fListView, fExpandLayout);
01196 
01197    AddFrame(fHf, lo);
01198 
01199    // Statusbar
01200 
01201    int parts[] = { 26, 74 };
01202    fStatusBar = new TGStatusBar(this, 60, 10);
01203    fStatusBar->SetParts(parts, 2);
01204    lo = new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 0, 0, 3, 0);
01205    AddFrame(fStatusBar, lo);
01206 
01207    fTextEdit = 0;
01208 
01209    // Misc
01210    TString bname(name);
01211    bname.Prepend("Old ");
01212    SetWindowName(bname.Data());
01213    SetIconName(bname.Data());
01214    fIconPic = SetIconPixmap("rootdb_s.xpm");
01215    SetClassHints("Browser", "Browser");
01216 
01217    SetWMSizeHints(600, 350, 10000, 10000, 2, 2);
01218 
01219    fListLevel = 0;
01220    fTreeLock  = kFALSE;
01221 
01222    gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Escape), 0, kTRUE);
01223    gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_F5), 0, kTRUE);
01224    gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Right), kKeyMod1Mask, kTRUE);
01225    gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Left), kKeyMod1Mask, kTRUE);
01226    ClearHistory();
01227    SetEditDisabled(kEditDisable);
01228 
01229    gVirtualX->SetDNDAware(fId, fDNDTypeList);
01230    MapSubwindows();
01231    SetDefaults();
01232    Resize();
01233    ShowMacroButtons(kFALSE);
01234 
01235    printf("\n You are using the old ROOT browser! A new version is available. To use it:\n");
01236    printf(" Select the \"New Browser\" entry from the \"File\" menu in the browser, or change\n");
01237    printf(" \"Browser.Name:\" from \"TRootBrowserLite\" to \"TRootBrowser\" in system.rootrc\n\n");
01238 
01239    Connect(fLt, "Checked(TObject*, Bool_t)", "TRootBrowserLite",
01240            this, "Checked(TObject *,Bool_t)");
01241 }
01242 
01243 //______________________________________________________________________________
01244 Bool_t TRootBrowserLite::HandleKey(Event_t *event)
01245 {
01246    // handle keys
01247 
01248    if (event->fType == kGKeyPress) {
01249       UInt_t keysym;
01250       char input[10];
01251       gVirtualX->LookupString(event, input, sizeof(input), keysym);
01252 
01253       if (!event->fState && (EKeySym)keysym == kKey_F5) {
01254          Refresh(kTRUE);
01255          return kTRUE;
01256       }
01257       if (!event->fState && (EKeySym)keysym == kKey_Escape) {
01258          if (gDNDManager->IsDragging()) gDNDManager->EndDrag();
01259       }
01260 
01261       if (event->fState & kKeyMod1Mask) {
01262          switch ((EKeySym)keysym & ~0x20) {
01263             case kKey_Right:
01264                HistoryForward();
01265                return kTRUE;
01266             case kKey_Left:
01267                HistoryBackward();
01268                return kTRUE;
01269             default:
01270                break;
01271          }
01272       }
01273    }
01274    return TGMainFrame::HandleKey(event);
01275 }
01276 
01277 //______________________________________________________________________________
01278 void TRootBrowserLite::Add(TObject *obj, const char *name, Int_t check)
01279 {
01280    // Add items to the browser. This function has to be called
01281    // by the Browse() member function of objects when they are
01282    // called by a browser. If check < 0 (default) no check box is drawn,
01283    // if 0 then unchecked checkbox is added, if 1 checked checkbox is added.
01284 
01285    if (!obj)
01286       return;
01287    if (obj->InheritsFrom("TObjectSpy"))
01288       return;
01289    if (!name) name = obj->GetName();
01290 
01291    AddToBox(obj, name);
01292    if (check > -1) {
01293       TGFrameElement *el;
01294       TIter next(fIconBox->fList);
01295       if (!obj->IsFolder()) {
01296          while ((el = (TGFrameElement *) next())) {
01297             TGLVEntry *f = (TGLVEntry *) el->fFrame;
01298             if (f->GetUserData() == obj) {
01299                f->SetCheckedEntry(check);
01300             }
01301          }
01302       }
01303    }
01304 
01305    // Don't show current dir and up dir links in the tree
01306    if (name[0] == '.' && ((name[1] == '\0') || (name[1] == '.' && name[2] == '\0')))
01307       return;
01308 
01309    if (obj->IsFolder())
01310       AddToTree(obj, name, check);
01311 }
01312 
01313 //______________________________________________________________________________
01314 void TRootBrowserLite::AddCheckBox(TObject *obj, Bool_t check)
01315 {
01316    // Add a checkbox in the TGListTreeItem corresponding to obj
01317    // and a checkmark on TGLVEntry if check = kTRUE.
01318 
01319    if (obj) {
01320       TGListTreeItem *item = fLt->FindItemByObj(fLt->GetFirstItem(), obj);
01321       while (item) {
01322          fLt->SetCheckBox(item, kTRUE);
01323          fLt->CheckItem(item, check);
01324          item = fLt->FindItemByObj(item->GetNextSibling(), obj);
01325       }
01326       TGFrameElement *el;
01327       TIter next(fIconBox->fList);
01328       while ((el = (TGFrameElement *) next())) {
01329          TGLVEntry *f = (TGLVEntry *) el->fFrame;
01330          if (f->GetUserData() == obj) {
01331             f->SetCheckedEntry(check);
01332          }
01333       }
01334    }
01335 }
01336 
01337 //______________________________________________________________________________
01338 void TRootBrowserLite::CheckObjectItem(TObject *obj, Bool_t check)
01339 {
01340    // Check / uncheck the TGListTreeItem corresponding to this
01341    // object and add a checkmark on TGLVEntry if check = kTRUE.
01342 
01343    if (obj) {
01344       TGListTreeItem *item = fLt->FindItemByObj(fLt->GetFirstItem(), obj);
01345       while (item) {
01346          fLt->CheckItem(item, check);
01347          item = fLt->FindItemByObj(item->GetNextSibling(), obj);
01348          TGFrameElement *el;
01349          TIter next(fIconBox->fList);
01350          if (!obj->IsFolder()) {
01351             while ((el = (TGFrameElement *) next())) {
01352                TGLVEntry *f = (TGLVEntry *) el->fFrame;
01353                if (f->GetUserData() == obj) {
01354                   f->SetCheckedEntry(check);
01355                }
01356             }
01357          }
01358       }
01359    }
01360 }
01361 
01362 //______________________________________________________________________________
01363 void TRootBrowserLite::RemoveCheckBox(TObject *obj)
01364 {
01365    // Remove checkbox from TGListTree and checkmark from TGListView.
01366 
01367    if (obj) {
01368       TGListTreeItem *item = fLt->FindItemByObj(fLt->GetFirstItem(), obj);
01369       while (item) {
01370          fLt->SetCheckBox(item, kFALSE);
01371          item = fLt->FindItemByObj(item->GetNextSibling(), obj);
01372          TGFrameElement *el;
01373          TIter next(fIconBox->fList);
01374          if (!obj->IsFolder()) {
01375             while ((el = (TGFrameElement *) next())) {
01376                TGLVEntry *f = (TGLVEntry *) el->fFrame;
01377                if (f->GetUserData() == obj) {
01378                   f->SetCheckedEntry(kFALSE);
01379                }
01380             }
01381          }
01382       }
01383    }
01384 }
01385 
01386 //______________________________________________________________________________
01387 void TRootBrowserLite::AddToBox(TObject *obj, const char *name)
01388 {
01389    // Add items to the iconbox of the browser.
01390 
01391    if (obj) {
01392       if (!name) name = obj->GetName() ? obj->GetName() : "NoName";
01393       //const char *titlePtr = obj->GetTitle() ? obj->GetTitle() : " ";
01394 
01395       TClass *objClass = 0;
01396 
01397       if (obj->IsA() == TKey::Class())
01398          objClass = TClass::GetClass(((TKey *)obj)->GetClassName());
01399       else if (obj->IsA() == TKeyMapFile::Class())
01400          objClass = TClass::GetClass(((TKeyMapFile *)obj)->GetTitle());
01401       else if (obj->InheritsFrom("TRemoteObject")) {
01402          // special case for remote object: get real object class
01403          TRemoteObject *robj = (TRemoteObject *)obj;
01404          if (!strcmp(robj->GetClassName(), "TKey"))
01405             objClass = TClass::GetClass(robj->GetKeyClassName());
01406          else
01407             objClass = TClass::GetClass(robj->GetClassName());
01408       }
01409       else
01410          objClass = obj->IsA();
01411 
01412       fIconBox->AddObjItem(name, obj, objClass);
01413    }
01414 }
01415 
01416 //______________________________________________________________________________
01417 void TRootBrowserLite::AddToTree(TObject *obj, const char *name, Int_t check)
01418 {
01419    // Add items to the current TGListTree of the browser.
01420 
01421    if (!obj)
01422       return;
01423    if (obj->InheritsFrom("TApplication"))
01424       fListLevel = 0;
01425    if (!fTreeLock) {
01426       if (!name) name = obj->GetName();
01427       if (name[0] == '.' && name[1] == '.')
01428          Info("AddToTree", "up one level %s", name);
01429       if(check > -1) {
01430          TGListTreeItem *item = fLt->AddItem(fListLevel, name, obj, 0, 0, kTRUE);
01431          if (item) fLt->CheckItem(item, (Bool_t)check);
01432          TString tip(obj->ClassName());
01433          if (obj->GetTitle()) {
01434             tip += " ";
01435             tip += obj->GetTitle();
01436          }
01437          fLt->SetToolTipItem(item, tip.Data());
01438       } else {
01439          // special case for remote object
01440          Bool_t isRemote = kFALSE;
01441          if (obj->InheritsFrom("TRemoteObject"))
01442             isRemote = kTRUE;
01443          else if (fListLevel) {
01444             // check also if one of its parents is a remote object
01445             TGListTreeItem *top = fListLevel;
01446             while (top->GetParent()) {
01447                TObject *tobj = (TObject *) top->GetUserData();
01448                if (tobj && (tobj->InheritsFrom("TRemoteObject") ||
01449                   tobj->InheritsFrom("TApplicationRemote"))) {
01450                   isRemote = kTRUE;
01451                   break;
01452                }
01453                top = top->GetParent();
01454             }
01455          }
01456          // add the object only if not already in the list
01457          if ((!fLt->FindChildByName(fListLevel, name)) &&
01458              (!fLt->FindChildByData(fListLevel, obj))) {
01459             TGListTreeItem *it = fLt->AddItem(fListLevel, name, obj);
01460             Long64_t bsize, fsize, objsize = 0;
01461             TString objinfo = obj->GetObjectInfo(1, 1);
01462             TString infos = obj->GetName();
01463             infos += "\n";
01464             infos += obj->GetTitle();
01465             if (!objinfo.IsNull() && !objinfo.BeginsWith("x=")) {
01466                objsize = objinfo.Atoll();
01467                if (objsize > 0) {
01468                   infos += "\n";
01469                   bsize = fsize = objsize;
01470                   if (fsize > 1024) {
01471                      fsize /= 1024;
01472                      if (fsize > 1024) {
01473                         // 3.7MB is more informative than just 3MB
01474                         infos += TString::Format("Size: %lld.%lldM", fsize/1024,
01475                                                  (fsize%1024)/103);
01476                      } else {
01477                         infos += TString::Format("Size: %lld.%lldK", bsize/1024,
01478                                                  (bsize%1024)/103);
01479                      }
01480                   } else {
01481                      infos += TString::Format("Size: %lld bytes", bsize);
01482                   }
01483                }
01484             }
01485             if (it)
01486                it->SetTipText(infos.Data());
01487          }
01488       }
01489    }
01490 }
01491 
01492 //______________________________________________________________________________
01493 void TRootBrowserLite::BrowseObj(TObject *obj)
01494 {
01495    // Browse object. This, in turn, will trigger the calling of
01496    // TRootBrowserLite::Add() which will fill the IconBox and the tree.
01497    // Emits signal "BrowseObj(TObject*)".
01498 
01499    TGPosition pos = fIconBox->GetPagePosition();
01500    Emit("BrowseObj(TObject*)", (Long_t)obj);
01501 
01502    if (obj != gROOT) {
01503       if (!fLt->FindItemByObj(fLt->GetFirstItem(), obj)) {
01504          fListLevel = 0;
01505          Add(obj);
01506          fListLevel = fLt->FindItemByObj(fLt->GetFirstItem(), obj);
01507          fLt->HighlightItem(fListLevel);
01508          if (obj->IsFolder())
01509             fLt->OpenItem(fListLevel);
01510          fLt->ClearViewPort();
01511          fLt->AdjustPosition(fListLevel);
01512       }
01513    }
01514 
01515    if (obj->IsFolder()) fIconBox->RemoveAll();
01516    obj->Browse(fBrowser);
01517    if ((fListLevel && obj->IsFolder()) || (!fListLevel && (obj == gROOT))) {
01518       fIconBox->Refresh();
01519    }
01520 
01521    if (fBrowser) {
01522       fBrowser->SetRefreshFlag(kFALSE);
01523    }
01524    UpdateDrawOption();
01525 
01526    fIconBox->SetHsbPosition(pos.fX);
01527    fIconBox->SetVsbPosition(pos.fY);
01528 }
01529 
01530 //______________________________________________________________________________
01531 void TRootBrowserLite::UpdateDrawOption()
01532 {
01533    // add new draw option to the "history"
01534 
01535    TString opt = GetDrawOption();
01536    TGListBox *lb = fDrawOption->GetListBox();
01537    TGLBContainer *lbc = (TGLBContainer *)lb->GetContainer();
01538 
01539    TIter next(lbc->GetList());
01540    TGFrameElement *el;
01541 
01542    while ((el = (TGFrameElement *)next())) {
01543       TGTextLBEntry *lbe = (TGTextLBEntry *)el->fFrame;
01544       if (lbe->GetText()->GetString() == opt) {
01545          return;
01546       }
01547    }
01548 
01549    Int_t nn = fDrawOption->GetNumberOfEntries() + 1;
01550    fDrawOption->AddEntry(opt.Data(), nn);
01551    fDrawOption->Select(nn);
01552 }
01553 
01554 //______________________________________________________________________________
01555 TGFileContainer *TRootBrowserLite::GetIconBox() const
01556 {
01557    // returns pointer to fIconBox object
01558 
01559    return (TGFileContainer*)fIconBox;
01560 }
01561 
01562 //______________________________________________________________________________
01563 void TRootBrowserLite::ReallyDelete()
01564 {
01565    // Really delete the browser and the this GUI.
01566 
01567    gInterpreter->DeleteGlobal(fBrowser);
01568    delete fBrowser;    // will in turn delete this object
01569 }
01570 
01571 //______________________________________________________________________________
01572 void TRootBrowserLite::CloseWindow()
01573 {
01574    // In case window is closed via WM we get here.
01575 
01576    DeleteWindow();
01577 }
01578 
01579 //______________________________________________________________________________
01580 void TRootBrowserLite::DisplayTotal(Int_t total, Int_t selected)
01581 {
01582    // Display in statusbar total number of objects and number of
01583    // selected objects in IconBox.
01584 
01585    char tmp[64];
01586    const char *fmt;
01587 
01588    if (selected)
01589       fmt = "%d Object%s, %d selected.";
01590    else
01591       fmt = "%d Object%s.";
01592 
01593    snprintf(tmp, 64, fmt, total, (total == 1) ? "" : "s", selected);
01594    fStatusBar->SetText(tmp, 0);
01595 }
01596 
01597 //______________________________________________________________________________
01598 void TRootBrowserLite::DisplayDirectory()
01599 {
01600    // Display current directory in second label, fLbl2.
01601 
01602    char *p, path[1024];
01603 
01604    fLt->GetPathnameFromItem(fListLevel, path, 12);
01605    p = path;
01606    while (*p && *(p+1) == '/') ++p;
01607    if (strlen(p) == 0)
01608       fLbl2->SetText(new TGString("Contents of \".\""));
01609    else
01610       fLbl2->SetText(new TGString(Form("Contents of \"%s\"", p)));
01611    fListHdr->Layout();
01612 
01613    // Get full pathname for FS combobox (previously truncated to 12 levels deep)
01614    fLt->GetPathnameFromItem(fListLevel, path);
01615    p = path;
01616    while (*p && *(p+1) == '/') ++p;
01617    fFSComboBox->Update(p);
01618 
01619    if (fListLevel) {
01620       // disable/enable up level navigation
01621       TGButton *btn = fToolBar->GetButton(kOneLevelUp);
01622       const char *dirname = gSystem->DirName(p);
01623       Bool_t disableUp;
01624 
01625       TObject *obj = (TObject*)fListLevel->GetUserData();
01626       disableUp = (strlen(dirname) == 1) && (*dirname == '/');
01627 
01628       // normal file directory
01629       if (disableUp && (obj->IsA() == TSystemDirectory::Class())) {
01630          disableUp = strlen(p) == 1;
01631       }
01632       btn->SetState(disableUp ? kButtonDisabled : kButtonUp);
01633       AddToHistory(fListLevel);
01634    }
01635 }
01636 
01637 //____________________________________________________________________________
01638 void TRootBrowserLite::ExecuteDefaultAction(TObject *obj)
01639 {
01640    // Execute default action for selected object (action is specified
01641    // in the $HOME/.root.mimes or $ROOTSYS/etc/root.mimes file.
01642    // Emits signal "ExecuteDefaultAction(TObject*)".
01643 
01644    TRootBrowserCursorSwitcher cursorSwitcher(fIconBox, fLt);
01645    char action[512];
01646    fBrowser->SetDrawOption(GetDrawOption());
01647    TVirtualPad *wasp = gPad ? (TVirtualPad*)gPad->GetCanvas() : 0;
01648    TFile *wasf = gFile;
01649 
01650    // Special case for file system objects...
01651    if (obj->IsA() == TSystemFile::Class() ||
01652        obj->InheritsFrom("TRemoteObject")) {
01653       TString act;
01654       TString ext = obj->GetName();
01655 
01656       if (fClient->GetMimeTypeList()->GetAction(obj->GetName(), action)) {
01657          act = action;
01658          act.ReplaceAll("%s", obj->GetName());
01659          gInterpreter->SaveGlobalsContext();
01660 
01661          if (act[0] == '!') {
01662             act.Remove(0, 1);
01663             gSystem->Exec(act.Data());
01664          } else {
01665             // special case for remote object: remote process
01666             if (obj->InheritsFrom("TRemoteObject"))
01667                gApplication->SetBit(TApplication::kProcessRemotely);
01668             gApplication->ProcessLine(act.Data());
01669          }
01670          Emit("ExecuteDefaultAction(TObject*)", (Long_t)obj);
01671       }
01672 
01673       // special case for remote object: browse real object
01674       if (obj->InheritsFrom("TRemoteObject") && ext.EndsWith(".root")) {
01675          TRootBrowserCursorSwitcher cursorSwitcher2(fIconBox, fLt);
01676          gApplication->SetBit(TApplication::kProcessRemotely);
01677          gApplication->ProcessLine("((TApplicationServer *)gApplication)->BrowseFile(0);");
01678          Refresh();
01679       }
01680       ////////// new TFile was opened. Add it to the browser /////
01681       if (gFile && (wasf != gFile) && ext.EndsWith(".root")) {
01682          TGListTreeItem *itm = fLt->FindChildByData(0, gROOT->GetListOfFiles());
01683 
01684          if (itm) {
01685             fLt->ClearHighlighted();
01686             fListLevel = itm;
01687             ListTreeHighlight(fListLevel);
01688             fLt->OpenItem(fListLevel);
01689             itm = fLt->AddItem(fListLevel, gFile->GetName());
01690             itm->SetUserData(gFile);
01691             fClient->NeedRedraw(fLt, kTRUE);
01692             return;
01693          }
01694       }
01695 
01696       // only valid for local text files
01697       if (!obj->InheritsFrom("TRemoteObject"))
01698          BrowseTextFile(obj->GetName());
01699 
01700       /////////////// cache and change file's icon ///////////////////////
01701       TVirtualPad *nowp = gPad ? (TVirtualPad*)gPad->GetCanvas() : 0;
01702 
01703       if (fIconBox->fAutoThumbnail && nowp && (nowp != wasp)) {
01704          TSystemFile *sf = (TSystemFile*)obj;
01705          const TGPicture *pic, *spic;
01706 
01707          TIconBoxThumb *thumb = 0;
01708          TString path = gSystem->IsAbsoluteFileName(sf->GetName()) ? sf->GetName() :
01709                         gSystem->ConcatFileName(gSystem->WorkingDirectory(), sf->GetName());
01710 
01711          thumb = (TIconBoxThumb*)fIconBox->fThumbnails->FindObject(path);
01712 
01713          if (thumb) {
01714             spic = thumb->fSmall;
01715             pic = thumb->fLarge;
01716          } else {
01717             TImage *img = TImage::Create();
01718             nowp->Modified();
01719             nowp->Update();
01720             img->FromPad(nowp);
01721 
01722             if (!img->IsValid()) {
01723                return;
01724             }
01725 
01726             static const UInt_t sz = 72;
01727             UInt_t w = sz;
01728             UInt_t h = sz;
01729 
01730             if (img->GetWidth() > img->GetHeight()) {
01731                h = (img->GetHeight()*sz)/img->GetWidth();
01732             } else {
01733                w = (img->GetWidth()*sz)/img->GetHeight();
01734             }
01735 
01736             w = w < 54 ? 54 : w;
01737             h = h < 54 ? 54 : h;
01738 
01739             img->Scale(w, h);
01740             img->Merge(img, "tint");   // contrasting
01741             img->DrawBox(0, 0, w, h, "#ffff00", 1); // yellow frame
01742 
01743             pic = fClient->GetPicturePool()->GetPicture(path.Data(), img->GetPixmap(), 0);
01744             img->Scale(w/3, h/3);
01745             spic = fClient->GetPicturePool()->GetPicture(path.Data(), img->GetPixmap(), 0);
01746 
01747             thumb = new TIconBoxThumb(path.Data(), spic, pic);
01748             fIconBox->fThumbnails->Add(thumb);
01749             delete img;
01750          }
01751       }
01752       return;
01753    }
01754 
01755    // For other objects the default action is still hard coded in
01756    // their Browse() member function.
01757 }
01758 
01759 //______________________________________________________________________________
01760 Bool_t TRootBrowserLite::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
01761 {
01762    // Handle menu and other command generated by the user.
01763 
01764    TRootHelpDialog *hd;
01765    TRootBrowserCursorSwitcher *cursorSwitcher = 0;
01766    TDirectory *tdir = 0;
01767    TString cmd;
01768 
01769    if (GET_SUBMSG(msg) != kCT_SELCHANGED) {
01770       cursorSwitcher = new TRootBrowserCursorSwitcher(fIconBox, fLt);
01771    }
01772 
01773    TObject *obj;
01774    TGListTreeItem *item = 0;
01775 
01776    gVirtualX->Update();
01777 
01778    switch (GET_MSG(msg)) {
01779 
01780       case kC_COMMAND:
01781 
01782          switch (GET_SUBMSG(msg)) {
01783 
01784             case kCM_BUTTON:
01785                // fallthrough
01786             case kCM_MENU:
01787 
01788                switch (parm1) {
01789                   // Handle File menu items...
01790                   case kFileNewBrowserLite:
01791                      new TBrowser("Browser", "ROOT Object Browser");
01792                      break;
01793                   case kFileNewBrowser:
01794                      gEnv->SetValue("Browser.Name", "TRootBrowser");
01795                      new TBrowser();
01796                      gEnv->SetValue("Browser.Name", "TRootBrowserLite");
01797                      break;
01798                   case kFileNewCanvas:
01799                      gROOT->MakeDefCanvas();
01800                      break;
01801                   case kFileNewBuilder:
01802                      TGuiBuilder::Instance();
01803                      break;
01804                   case kFileOpen:
01805                      {
01806                         static TString dir(".");
01807                         TGFileInfo fi;
01808                         fi.fFileTypes = gOpenTypes;
01809                         fi.fIniDir    = StrDup(dir);
01810                         new TGFileDialog(fClient->GetDefaultRoot(), this,
01811                                          kFDOpen,&fi);
01812                         dir = fi.fIniDir;
01813                         if (fi.fMultipleSelection && fi.fFileNamesList) {
01814                            TObjString *el;
01815                            TIter next(fi.fFileNamesList);
01816                            while ((el = (TObjString *) next())) {
01817                               new TFile(el->GetString(), "update");
01818                            }
01819                         }
01820                         else if (fi.fFilename) {
01821                            new TFile(fi.fFilename, "update");
01822                         }
01823                      }
01824                      break;
01825                   case kFileSave:
01826                   case kFileSaveAs:
01827                      break;
01828                   case kFilePrint:
01829                      break;
01830                   case kFileCloseBrowser:
01831                      SendCloseMessage();
01832                      break;
01833                   case kFileQuit:
01834                      gApplication->Terminate(0);
01835                      break;
01836 
01837                   // Handle View menu items...
01838                   case kViewToolBar:
01839                      if (fViewMenu->IsEntryChecked(kViewToolBar))
01840                         ShowToolBar(kFALSE);
01841                      else
01842                         ShowToolBar();
01843                      break;
01844                   case kViewStatusBar:
01845                      if (fViewMenu->IsEntryChecked(kViewStatusBar))
01846                         ShowStatusBar(kFALSE);
01847                      else
01848                         ShowStatusBar();
01849                      break;
01850                   case kViewLargeIcons:
01851                   case kViewSmallIcons:
01852                   case kViewList:
01853                   case kViewDetails:
01854                      SetViewMode((Int_t)parm1);
01855                      break;
01856                   case kViewHidden:
01857                      if (fBrowser->TestBit(TBrowser::kNoHidden)) {
01858                         fViewMenu->CheckEntry(kViewHidden);
01859                         fBrowser->SetBit(TBrowser::kNoHidden, kFALSE);
01860                      } else {
01861                         fViewMenu->UnCheckEntry(kViewHidden);
01862                         fBrowser->SetBit(TBrowser::kNoHidden, kTRUE);
01863                      }
01864                      Refresh(kTRUE);
01865                      break;
01866                   case kViewArrangeByName:
01867                   case kViewArrangeByType:
01868                   case kViewArrangeBySize:
01869                   case kViewArrangeByDate:
01870                      SetSortMode((Int_t)parm1);
01871                      break;
01872                   case kViewLineUp:
01873                      break;
01874                   case kViewRefresh:
01875                      Refresh(kTRUE);
01876                      break;
01877                   case kViewGroupLV:
01878                      if (!fViewMenu->IsEntryChecked(kViewGroupLV)) {
01879                         fViewMenu->CheckEntry(kViewGroupLV);
01880                         TString gv = gEnv->GetValue("Browser.GroupView", "10000");
01881                         Int_t igv = atoi(gv.Data());
01882 
01883                         if (igv > 10) {
01884                            fIconBox->SetGroupSize(igv);
01885                         }
01886                      } else {
01887                         fViewMenu->UnCheckEntry(kViewGroupLV);
01888                         fIconBox->SetGroupSize(10000000); // very large value
01889                      }
01890                      break;
01891 
01892                   // Handle Option menu items...
01893                   case kOptionShowCycles:
01894                      printf("Currently the browser always shows all cycles\n");
01895                      break;
01896 
01897                   case kOptionAutoThumbnail:
01898                      if (fOptionMenu->IsEntryChecked(kOptionAutoThumbnail)) {
01899                         fOptionMenu->UnCheckEntry(kOptionAutoThumbnail);
01900                         fIconBox->fThumbnails->Delete();
01901                         fIconBox->fAutoThumbnail = kFALSE;
01902                         Refresh(kTRUE);
01903                      } else {
01904                         fOptionMenu->CheckEntry(kOptionAutoThumbnail);
01905                         fIconBox->fAutoThumbnail = kTRUE;
01906                      }
01907                      break;
01908 
01909                   // Handle toolbar button...
01910                   case kOneLevelUp:
01911                   {
01912                      if (fBrowseTextFile) {
01913                         HideTextEdit();
01914                         break;
01915                      }
01916                      if (!fListLevel || !fListLevel->IsActive()) break;
01917 
01918                      if (fListLevel && fIconBox->WasGrouped()) {
01919                         if (fListLevel) {
01920                            item = fListLevel->GetParent();
01921                            if (item) fListLevel = item;
01922                            obj = (TObject *) fListLevel->GetUserData();
01923                            HighlightListLevel();
01924                            if (obj) BrowseObj(obj);
01925                         }
01926 
01927                         fClient->NeedRedraw(fLt, kTRUE);
01928                         break;
01929                      }
01930                      if (fListLevel) item = fListLevel->GetParent();
01931 
01932 
01933                      if (item) {
01934                         fListLevel = item;
01935                         obj = (TObject *)fListLevel->GetUserData();
01936                         HighlightListLevel();
01937                         DisplayDirectory();
01938                         if (obj) BrowseObj(obj);
01939                         fClient->NeedRedraw(fLt, kTRUE);
01940                      } else {
01941                         obj = (TObject *)fListLevel->GetUserData();
01942                         if (obj) ToSystemDirectory(gSystem->DirName(obj->GetTitle()));
01943                      }
01944                      break;
01945                   }
01946 
01947                   // toolbar buttons
01948                   case kHistoryBack:
01949                      HistoryBackward();
01950                      break;
01951                   case kHistoryForw:
01952                      HistoryForward();
01953                      break;
01954 
01955                   case kViewFind:
01956                      Search();
01957                      break;
01958 
01959                   // Handle Help menu items...
01960                   case kHelpAbout:
01961                      {
01962 #ifdef R__UNIX
01963                         TString rootx;
01964 # ifdef ROOTBINDIR
01965                         rootx = ROOTBINDIR;
01966 # else
01967                         rootx = gSystem->Getenv("ROOTSYS");
01968                         if (!rootx.IsNull()) rootx += "/bin";
01969 # endif
01970                         rootx += "/root -a &";
01971                         gSystem->Exec(rootx);
01972 #else
01973 #ifdef WIN32
01974                         new TWin32SplashThread(kTRUE);
01975 #else
01976                         char str[32];
01977                         sprintf(str, "About ROOT %s...", gROOT->GetVersion());
01978                         hd = new TRootHelpDialog(this, str, 600, 400);
01979                         hd->SetText(gHelpAbout);
01980                         hd->Popup();
01981 #endif
01982 #endif
01983                      }
01984                      break;
01985                   case kHelpOnCanvas:
01986                      hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
01987                      hd->SetText(gHelpCanvas);
01988                      hd->Popup();
01989                      break;
01990                   case kHelpOnMenus:
01991                      hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
01992                      hd->SetText(gHelpPullDownMenus);
01993                      hd->Popup();
01994                      break;
01995                   case kHelpOnGraphicsEd:
01996                      hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
01997                      hd->SetText(gHelpGraphicsEditor);
01998                      hd->Popup();
01999                      break;
02000                   case kHelpOnBrowser:
02001                      hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
02002                      hd->SetText(gHelpBrowserLite);
02003                      hd->Popup();
02004                      break;
02005                   case kHelpOnObjects:
02006                      hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
02007                      hd->SetText(gHelpObjects);
02008                      hd->Popup();
02009                      break;
02010                   case kHelpOnPS:
02011                      hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
02012                      hd->SetText(gHelpPostscript);
02013                      hd->Popup();
02014                      break;
02015                   case kHelpOnRemote:
02016                      hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
02017                      hd->SetText(gHelpRemote);
02018                      hd->Popup();
02019                      break;
02020                }
02021                break;
02022             case kCM_COMBOBOX:
02023                if (parm1 == kFSComboBox) {
02024                   TGTreeLBEntry *e = (TGTreeLBEntry *) fFSComboBox->GetSelectedEntry();
02025                   if (e) {
02026                      const char *dirname = e->GetPath()->GetString();
02027                      item = fLt->FindItemByPathname(dirname);
02028                      if (item) {
02029                         fListLevel = item;
02030                         HighlightListLevel();
02031                         DisplayDirectory();
02032                         fClient->NeedRedraw(fLt, kTRUE);
02033                      } else {
02034                         ToSystemDirectory(dirname);
02035                      }
02036                   }
02037                }
02038                break;
02039             default:
02040                break;
02041          }
02042 
02043          break;
02044 
02045       case kC_LISTTREE:
02046          switch (GET_SUBMSG(msg)) {
02047 
02048             case kCT_ITEMCLICK:
02049                if (parm1 == kButton1 || parm1 == kButton3) {
02050                   HideTextEdit();
02051                   TGListTreeItem *item2;
02052                   TObject *obj2 = 0;
02053                   if ((item2 = fLt->GetSelected()) != 0 ) {
02054                      ListTreeHighlight(item2);
02055                      fStatusBar->SetText("", 1);   // clear
02056                   }
02057                   if (item2 && parm1 == kButton3) {
02058                      Int_t x = (Int_t)(parm2 & 0xffff);
02059                      Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
02060                      obj2 = (TObject *) item2->GetUserData();
02061                      if (obj2) {
02062                         if (obj2->InheritsFrom("TTree")) {
02063                            // if a tree not attached to any directory (e.g. in a TFolder)
02064                            // then attach it to the current directory (gDirectory)
02065                            cmd = TString::Format("((TTree *)0x%lx)->GetDirectory();",
02066                                                  (ULong_t)obj2);
02067                            tdir = (TDirectory *)gROOT->ProcessLine(cmd.Data());
02068                            if (!tdir) {
02069                               cmd = TString::Format("((TTree *)0x%lx)->SetDirectory(gDirectory);",
02070                                                     (ULong_t)obj2);
02071                               gROOT->ProcessLine(cmd.Data());
02072                            }
02073                         }
02074                         fBrowser->GetContextMenu()->Popup(x, y, obj2, fBrowser);
02075                      }
02076                   }
02077                   fClient->NeedRedraw(fLt);
02078                   fListView->LayoutHeader(0);
02079                   fListView->Layout();
02080                }
02081                break;
02082 
02083             case kCT_ITEMDBLCLICK:
02084                if (parm1 == kButton1) {
02085                   if (fBrowseTextFile) {
02086                      HideTextEdit();
02087                   }
02088                   if (fListLevel && fIconBox->WasGrouped()) {
02089                      TObject *obj2;
02090                      TGListTreeItem *item2;
02091 
02092                      if (fListLevel) {
02093                         item2 = fListLevel->GetParent();
02094                         if (item2) fListLevel = item2;
02095 
02096                         obj2 = (TObject *) fListLevel->GetUserData();
02097                         HighlightListLevel();
02098                         if (obj2) {
02099                            BrowseObj(obj2);
02100                         }
02101                      }
02102                      break;
02103                   }
02104                }
02105 
02106             default:
02107                break;
02108          }
02109          break;
02110 
02111       case kC_CONTAINER:
02112          switch (GET_SUBMSG(msg)) {
02113 
02114             case kCT_ITEMCLICK:
02115                if (fIconBox->NumSelected() == 1) {
02116                   // display title of selected object
02117                   TGFileItem *item2;
02118                   void *p = 0;
02119                   if ((item2 = (TGFileItem *)fIconBox->GetNextSelected(&p)) != 0) {
02120                      TObject *obj2 = (TObject *)item2->GetUserData();
02121 
02122                      TGListTreeItem *itm = 0;
02123                      if (!fListLevel) itm = fLt->GetFirstItem();
02124                      else itm = fListLevel->GetFirstChild();
02125                      //Bool_t found = kFALSE;
02126 
02127                      while (itm) {
02128                         if (itm->GetUserData() == obj2) break;
02129                         itm = itm->GetNextSibling();
02130                      }
02131 
02132                      if (itm) {
02133                         if ((fListLevel && fListLevel->IsOpen()) || !fListLevel) {
02134                            fLt->ClearHighlighted();
02135                            fLt->HighlightItem(itm);
02136                            fClient->NeedRedraw(fLt, kTRUE);
02137                         }
02138                      }
02139 
02140                      if (obj2) fStatusBar->SetText(obj2->GetName(), 1);
02141                   }
02142                }
02143                if (parm1 == kButton3) {
02144                   // show context menu for selected object
02145                   if (fIconBox->NumSelected() == 1) {
02146                      void *p = 0;
02147                      TGFileItem *item2;
02148                      if ((item2 = (TGFileItem *) fIconBox->GetNextSelected(&p)) != 0) {
02149                         Int_t x = (Int_t)(parm2 & 0xffff);
02150                         Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
02151                         TObject *obj2 = (TObject *)item2->GetUserData();
02152                         if (obj2) {
02153                            if (obj2->IsA() == TKey::Class()) {
02154                               TKey *key = (TKey*)obj2;
02155                               TClass *cl = TClass::GetClass(key->GetClassName());
02156                               TString name = key->GetName();
02157                               name += ";";
02158                               name += key->GetCycle();
02159                               //void *add = gROOT->FindObject((char *) name.Data());//key->GetName());
02160                               void *add = gDirectory->FindObjectAny((char *) name.Data());
02161                               if (cl->IsTObject()) {
02162                                  obj2 = (TObject*)add; // cl->DynamicCast(TObject::Class(),startadd);
02163                                  item2->SetUserData(obj2);
02164                               } else {
02165                                  Error("ProcessMessage","do not support non TObject (like %s) yet",
02166                                        cl->GetName());
02167                                  break;
02168                               }
02169                            }
02170                            if (obj2->InheritsFrom("TTree")) {
02171                               // if a tree not attached to any directory (e.g. in a TFolder)
02172                               // then attach it to the current directory (gDirectory)
02173                               cmd = TString::Format("((TTree *)0x%lx)->GetDirectory();",
02174                                                     (ULong_t)obj2);
02175                               tdir = (TDirectory *)gROOT->ProcessLine(cmd.Data());
02176                               if (!tdir) {
02177                                  cmd = TString::Format("((TTree *)0x%lx)->SetDirectory(gDirectory);",
02178                                                        (ULong_t)obj2);
02179                                  gROOT->ProcessLine(cmd.Data());
02180                               }
02181                            }
02182                            fBrowser->GetContextMenu()->Popup(x, y, obj2, fBrowser);
02183                         }
02184                      }
02185                   }
02186                }
02187                break;
02188             case kCT_ITEMDBLCLICK:
02189                if (parm1 == kButton1) {
02190                   if (fIconBox->NumSelected() == 1) {
02191                      void *p = 0;
02192                      TGFileItem *item2;
02193                      if ((item2 = (TGFileItem *) fIconBox->GetNextSelected(&p)) != 0) {
02194                         TObject *obj2 = (TObject *)item2->GetUserData();
02195                         if (obj2) {
02196                            DoubleClicked(obj2);
02197                            IconBoxAction(obj2);
02198                         }
02199                         delete cursorSwitcher;
02200                         return kTRUE; //
02201                      }
02202                   }
02203                }
02204                break;
02205             case kCT_SELCHANGED:
02206                DisplayTotal((Int_t)parm1, (Int_t)parm2);
02207                break;
02208             default:
02209                break;
02210          }
02211 
02212          break;
02213 
02214       default:
02215          break;
02216    }
02217 
02218    delete cursorSwitcher;
02219 
02220    fClient->NeedRedraw(fIconBox);
02221    return kTRUE;
02222 }
02223 
02224 //______________________________________________________________________________
02225 void TRootBrowserLite::Chdir(TGListTreeItem *item)
02226 {
02227    // Make object associated with item the current directory.
02228 
02229    if (item) {
02230       TGListTreeItem *i = item;
02231       TString dir;
02232       while (i) {
02233          TObject *obj = (TObject*) i->GetUserData();
02234          if (obj) {
02235             if (obj->IsA() == TDirectoryFile::Class()) {
02236                dir = "/" + dir;
02237                dir = obj->GetName() + dir;
02238             }
02239             if (obj->IsA() == TFile::Class()) {
02240                dir = ":/" + dir;
02241                dir = obj->GetName() + dir;
02242             }
02243             if (obj->IsA() == TKey::Class()) {
02244                if (strcmp(((TKey*)obj)->GetClassName(), "TDirectoryFile") == 0) {
02245                   dir = "/" + dir;
02246                   dir = obj->GetName() + dir;
02247                }
02248             }
02249          }
02250          i = i->GetParent();
02251       }
02252 
02253       if (gDirectory && dir.Length()) gDirectory->cd(dir.Data());
02254    }
02255 }
02256 
02257 //______________________________________________________________________________
02258 void TRootBrowserLite::HighlightListLevel()
02259 {
02260    // helper method  to track history
02261 
02262    if (!fListLevel) return;
02263 
02264    fLt->ClearHighlighted();
02265    fLt->HighlightItem(fListLevel);
02266 }
02267 
02268 //______________________________________________________________________________
02269 void TRootBrowserLite::AddToHistory(TGListTreeItem *item)
02270 {
02271    // helper method to track history
02272 
02273    TGButton *btn = fToolBar->GetButton(kHistoryBack);
02274 
02275    if (!item || (fHistoryCursor &&
02276        (item == ((TRootBrowserHistoryCursor*)fHistoryCursor)->fItem))) return;
02277 
02278    TRootBrowserHistoryCursor *cur = (TRootBrowserHistoryCursor*)fHistoryCursor;
02279 
02280    while ((cur = (TRootBrowserHistoryCursor*)fHistory->After(fHistoryCursor))) {
02281       fHistory->Remove(cur);
02282       delete cur;
02283    }
02284 
02285    cur = new TRootBrowserHistoryCursor(item);
02286    fHistory->Add(cur);
02287    fHistoryCursor = cur;
02288    btn->SetState(kButtonUp);
02289 }
02290 
02291 //______________________________________________________________________________
02292 void TRootBrowserLite::ClearHistory()
02293 {
02294    // clear navigation history
02295 
02296    fHistory->Delete();
02297    TGButton *btn = fToolBar->GetButton(kHistoryBack);
02298    TGButton *btn2 = fToolBar->GetButton(kHistoryForw);
02299    btn->SetState(kButtonDisabled);
02300    btn2->SetState(kButtonDisabled);
02301 }
02302 
02303 //______________________________________________________________________________
02304 Bool_t TRootBrowserLite::HistoryBackward()
02305 {
02306    // go to the past
02307 
02308    if (fBrowseTextFile) {
02309       HideTextEdit();
02310       return kFALSE;
02311    }
02312    TRootBrowserHistoryCursor *cur = (TRootBrowserHistoryCursor*)fHistory->Before(fHistoryCursor);
02313    TGButton *btn = fToolBar->GetButton(kHistoryBack);
02314    TGButton *btn2 = fToolBar->GetButton(kHistoryForw);
02315 
02316    if (!cur) {
02317       btn->SetState(kButtonDisabled);
02318       return kFALSE;
02319    }
02320 
02321    fLt->ClearHighlighted();
02322    fHistoryCursor = cur;
02323    fListLevel = cur->fItem;
02324    ListTreeHighlight(fListLevel);
02325    fLt->AdjustPosition();
02326    fClient->NeedRedraw(fLt, kTRUE);
02327 
02328    btn2->SetState(kButtonUp);
02329    cur = (TRootBrowserHistoryCursor*)fHistory->Before(fHistoryCursor);
02330    if (!cur) {
02331       btn->SetState(kButtonDisabled);
02332       return kFALSE;
02333    }
02334 
02335    return kTRUE;
02336 }
02337 
02338 //______________________________________________________________________________
02339 Bool_t TRootBrowserLite::HistoryForward()
02340 {
02341    //  go to the future
02342 
02343    if (fBrowseTextFile) {
02344       HideTextEdit();
02345       return kFALSE;
02346    }
02347 
02348    TRootBrowserHistoryCursor *cur = (TRootBrowserHistoryCursor*)fHistory->After(fHistoryCursor);
02349    TGButton *btn = fToolBar->GetButton(kHistoryForw);
02350    TGButton *btn2 = fToolBar->GetButton(kHistoryBack);
02351 
02352    if (!cur) {
02353       btn->SetState(kButtonDisabled);
02354       return kFALSE;
02355    }
02356 
02357    fLt->ClearHighlighted();
02358    fHistoryCursor = cur;
02359    fListLevel = cur->fItem;
02360    ListTreeHighlight(fListLevel);
02361    fLt->AdjustPosition();
02362    fClient->NeedRedraw(fLt, kTRUE);
02363 
02364    btn2->SetState(kButtonUp);
02365 
02366    cur = (TRootBrowserHistoryCursor*)fHistory->After(fHistoryCursor);
02367    if (!cur) {
02368       btn->SetState(kButtonDisabled);
02369       return kFALSE;
02370    }
02371 
02372    return kTRUE;
02373 }
02374 
02375 //______________________________________________________________________________
02376 void TRootBrowserLite::DeleteListTreeItem(TGListTreeItem *item)
02377 {
02378    // delete list tree item, remove it from history
02379 
02380    ((TRootBrowserHistory*)fHistory)->DeleteItem(item);
02381    fLt->DeleteItem(item);
02382 }
02383 
02384 //______________________________________________________________________________
02385 void TRootBrowserLite::ListTreeHighlight(TGListTreeItem *item)
02386 {
02387    // Open tree item and list in iconbox its contents.
02388 
02389    if (item) {
02390       TObject *obj = (TObject *) item->GetUserData();
02391 
02392       if (obj) {
02393          if (obj->IsA() == TKey::Class()) {
02394 
02395             TKey *key = (TKey *)obj;
02396             TString name = obj->GetName();
02397             name += ";";
02398             name += key->GetCycle();
02399             Chdir(item->GetParent());
02400             //TObject *k_obj = gROOT->FindObject(name);
02401             TObject *k_obj = gDirectory->FindObjectAny(name);
02402 
02403             if (k_obj) {
02404                item->SetUserData(k_obj);
02405                obj = k_obj;
02406             }
02407          } else if (obj->InheritsFrom(TDirectoryFile::Class())) {
02408             Chdir(item->GetParent());
02409          }
02410          else if (obj->InheritsFrom("TApplicationRemote")) {
02411             if (!gApplication->GetAppRemote()) {
02412                gROOT->ProcessLine(Form(".R %s", item->GetText()));
02413                if (gApplication->GetAppRemote()) {
02414                   Getlinem(kInit, TString::Format("\n%s:root [0]",
02415                            gApplication->GetAppRemote()->ApplicationName()));
02416                }
02417             }
02418          }
02419          else if (obj->InheritsFrom("TRemoteObject")) {
02420             // special case for remote object
02421             TRemoteObject *robj = (TRemoteObject *)obj;
02422             // the real object is a TKey
02423             if (!strcmp(robj->GetClassName(), "TKey")) {
02424                TGListTreeItem *parent = item;
02425                TRemoteObject *probj = (TRemoteObject *)parent->GetUserData();
02426                // find the TFile remote object containing the TKey
02427                while ( probj && strcmp(probj->GetClassName(), "TFile")) {
02428                   parent = parent->GetParent();
02429                   probj = (TRemoteObject *)parent->GetUserData();
02430                }
02431                if (probj) {
02432                   // remotely browse file (remotely call TFile::cd())
02433                   gApplication->SetBit(TApplication::kProcessRemotely);
02434                   gApplication->ProcessLine(
02435                      TString::Format("((TApplicationServer *)gApplication)->BrowseFile(\"%s\");",
02436                                      probj->GetName()));
02437                }
02438             }
02439          }
02440          if (item->GetParent() && item->GetParent()->GetUserData() &&
02441             ((TObject *)item->GetParent()->GetUserData())->InheritsFrom("TApplicationRemote")) {
02442             // switch to remote session
02443             if (!gApplication->GetAppRemote()) {
02444                gROOT->ProcessLine(Form(".R %s", item->GetParent()->GetText()));
02445                if (gApplication->GetAppRemote()) {
02446                   Getlinem(kInit, TString::Format("\n%s:root [0]",
02447                            gApplication->GetAppRemote()->ApplicationName()));
02448                }
02449             }
02450             else if (!strcmp(item->GetText(), "ROOT Files")) {
02451                // update list of files opened in the remote session
02452                gApplication->SetBit(TApplication::kProcessRemotely);
02453                gApplication->ProcessLine("((TApplicationServer *)gApplication)->BrowseFile(0);");
02454             }
02455          }
02456          else {
02457             // check if the listtree item is from a local session or
02458             // from a remote session, then switch to the session it belongs to
02459             TGListTreeItem *top = item;
02460             while (top->GetParent()) {
02461                top = top->GetParent();
02462             }
02463             TObject *topobj = (TObject *) top->GetUserData();
02464             if (topobj->InheritsFrom("TApplicationRemote")) {
02465                // it belongs to a remote session
02466                if (!gApplication->GetAppRemote()) {
02467                   // switch to remote session if not already in
02468                   gROOT->ProcessLine(Form(".R %s", top->GetText()));
02469                   if (gApplication->GetAppRemote()) {
02470                      Getlinem(kInit, TString::Format("\n%s:root [0]",
02471                               gApplication->GetAppRemote()->ApplicationName()));
02472                   }
02473                }
02474             }
02475             else if (gApplication->GetAppRemote()) {
02476                // switch back to local session if not already in
02477                gApplication->ProcessLine(".R");
02478                Getlinem(kInit, "\nroot [0]");
02479             }
02480          }
02481 
02482          if (!fListLevel || !fListLevel->IsActive()) {
02483             fListLevel = item;
02484             BrowseObj(obj);
02485             fLt->HighlightItem(fListLevel);
02486          }
02487       }
02488       DisplayDirectory();
02489    }
02490 }
02491 
02492 //______________________________________________________________________________
02493 void TRootBrowserLite::ToSystemDirectory(const char *dirname)
02494 {
02495    // display  directory
02496 
02497    TString dir = dirname;
02498 
02499    if (fListLevel) {
02500       TObject* obj = (TObject*)fListLevel->GetUserData();
02501 
02502       if (obj && (obj->IsA() == TSystemDirectory::Class())) {
02503          TObject* old = obj;
02504          fListLevel->Rename(dir.Data());
02505          obj = new TSystemDirectory(dir.Data(), dir.Data());
02506          while (fListLevel->GetFirstChild())
02507             fLt->RecursiveDeleteItem(fListLevel->GetFirstChild(),
02508                                      fListLevel->GetFirstChild()->GetUserData());
02509 
02510          fListLevel->SetUserData(obj);
02511          gROOT->GetListOfBrowsables()->Remove(old);
02512          delete old;
02513          gROOT->GetListOfBrowsables()->Add(obj);
02514          fTreeLock = kTRUE;
02515          BrowseObj(obj);
02516          fTreeLock = kFALSE;
02517 
02518          fClient->NeedRedraw(fLt, kTRUE);
02519          fClient->NeedRedraw(fIconBox);
02520          DisplayDirectory();
02521          //gSystem->ChangeDirectory(dir.Data());
02522          fStatusBar->SetText(dir.Data(), 1);
02523          ClearHistory();   // clear browsing history
02524       }
02525    }
02526    return;
02527 }
02528 
02529 //______________________________________________________________________________
02530 void TRootBrowserLite::SetDrawOption(Option_t *option)
02531 {
02532    // sets drawing option
02533 
02534    fDrawOption->GetTextEntry()->SetText(option);
02535 }
02536 
02537 //______________________________________________________________________________
02538 Option_t *TRootBrowserLite::GetDrawOption() const
02539 {
02540    // returns drawing option
02541 
02542    return fDrawOption->GetTextEntry()->GetText();
02543 }
02544 //______________________________________________________________________________
02545 void TRootBrowserLite::DoubleClicked(TObject *obj)
02546 {
02547    // Emits signal when double clicking on icon.
02548 
02549    Emit("DoubleClicked(TObject*)", (Long_t)obj);
02550 }
02551 
02552 //______________________________________________________________________________
02553 void TRootBrowserLite::Checked(TObject *obj, Bool_t checked)
02554 {
02555    // Emits signal when double clicking on icon.
02556    Long_t args[2];
02557 
02558    args[0] = (Long_t)obj;
02559    args[1] = checked;
02560 
02561    Emit("Checked(TObject*,Bool_t)", args);
02562 }
02563 
02564 //______________________________________________________________________________
02565 void TRootBrowserLite::IconBoxAction(TObject *obj)
02566 {
02567    // Default action when double clicking on icon.
02568 
02569    Bool_t browsable = kFALSE;
02570    const char *dirname = 0;
02571    if (obj) {
02572 
02573       TRootBrowserCursorSwitcher cursorSwitcher(fIconBox, fLt);
02574 
02575       Bool_t useLock = kTRUE;
02576 
02577       if (obj->IsA()->GetMethodWithPrototype("Browse", "TBrowser*"))
02578          browsable = kTRUE;
02579 
02580       if (obj->InheritsFrom("TLeaf")) {
02581          TObject *dir = (TObject *)gROOT->ProcessLine(Form("((%s *)0x%lx)->GetBranch()->GetDirectory();",
02582                                                       obj->ClassName(), (ULong_t)obj));
02583          if (!dir) {
02584             browsable = kFALSE;
02585          }
02586       }
02587       if (obj->InheritsFrom("TBranchElement")) {
02588          TObject *dir = (TObject *)gROOT->ProcessLine(Form("((%s *)0x%lx)->GetDirectory();",
02589                                                       obj->ClassName(), (ULong_t)obj));
02590          if (!dir) {
02591             browsable = kFALSE;
02592          }
02593       }
02594 
02595       if (obj->InheritsFrom("TKey")) {
02596          TKey *key = dynamic_cast<TKey*>(obj);
02597          if (key && key->GetClassName() && (!strcmp(key->GetClassName(), "TFormula")))
02598             browsable = kFALSE;
02599       }
02600 
02601       if (obj->IsA() == TSystemDirectory::Class()) {
02602          useLock = kFALSE;
02603 
02604          TString t(obj->GetName());
02605          if (t == ".") goto out;
02606          if (t == "..") {
02607             if (fListLevel && fListLevel->GetParent()) {
02608                fListLevel = fListLevel->GetParent();
02609                obj = (TObject*)fListLevel->GetUserData();
02610                if (fListLevel->GetParent()) {
02611                   fListLevel = fListLevel->GetParent();
02612                } else  {
02613                   obj = (TObject*)fListLevel->GetUserData();
02614                   fListLevel = 0;
02615                }
02616             } else {
02617                dirname = gSystem->DirName(gSystem->pwd());
02618                ToSystemDirectory(dirname);
02619                return;
02620             }
02621          }
02622       }
02623 
02624       if (obj->IsFolder()) {
02625          fIconBox->RemoveAll();
02626          TGListTreeItem *itm = 0;
02627 
02628          if (fListLevel) {
02629             fLt->OpenItem(fListLevel);
02630             itm = fListLevel->GetFirstChild();
02631          } else {
02632             itm = fLt->GetFirstItem();
02633          }
02634 
02635          while (itm && (itm->GetUserData() != obj)) {
02636             itm = itm->GetNextSibling();
02637          }
02638 
02639          if (!itm && fListLevel) {
02640             // special case for remote objects
02641             Bool_t isRemote = kFALSE;
02642             if (obj->InheritsFrom("TRemoteObject"))
02643                isRemote = kTRUE;
02644             else if (fListLevel) {
02645                // check also if one of its parents is a remote object
02646                TGListTreeItem *top = fListLevel;
02647                while (top->GetParent()) {
02648                   TObject *tobj = (TObject *) top->GetUserData();
02649                   if (tobj && (tobj->InheritsFrom("TRemoteObject") ||
02650                      tobj->InheritsFrom("TApplicationRemote"))) {
02651                      isRemote = kTRUE;
02652                      break;
02653                   }
02654                   top = top->GetParent();
02655                }
02656             }
02657             if (isRemote) {
02658                // add the remote object only if not already in the list
02659                if ((!fLt->FindChildByName(fListLevel, obj->GetName())) &&
02660                    (!fLt->FindChildByData(fListLevel, obj))) {
02661                   itm = fLt->AddItem(fListLevel, obj->GetName());
02662                   if (itm) itm->SetUserData(obj);
02663                }
02664                else {
02665                   // set the current item to the one found in the list
02666                   itm = fLt->FindChildByData(fListLevel, obj) ?
02667                      fLt->FindChildByData(fListLevel, obj) :
02668                      fLt->FindChildByName(fListLevel, obj->GetName());
02669                }
02670             }
02671             else {
02672                itm = fLt->AddItem(fListLevel, obj->GetName());
02673                if (itm) itm->SetUserData(obj);
02674             }
02675          }
02676 
02677          if (itm) {
02678             fListLevel = itm;
02679             DisplayDirectory();
02680             TObject *kobj = (TObject *)itm->GetUserData();
02681 
02682             if (kobj->IsA() == TKey::Class()) {
02683                Chdir(fListLevel->GetParent());
02684                //kobj = gROOT->FindObject(kobj->GetName());
02685                kobj = gDirectory->FindObjectAny(kobj->GetName());
02686 
02687                if (kobj) {
02688                   TGListTreeItem *parent = fListLevel->GetParent();
02689                   DeleteListTreeItem(fListLevel);
02690                   TGListTreeItem *kitem = fLt->AddItem(parent, kobj->GetName(), kobj);
02691                   if (kitem) {
02692                      obj = kobj;
02693                      useLock = kFALSE;
02694                      kitem->SetUserData(kobj);
02695                      fListLevel = kitem;
02696                   } else
02697                      fListLevel = parent;
02698                }
02699             }
02700             HighlightListLevel();
02701          }
02702       }
02703 
02704       if (browsable) {
02705          if (useLock) fTreeLock = kTRUE;
02706          Emit("BrowseObj(TObject*)", (Long_t)obj);
02707          obj->Browse(fBrowser);
02708          if (useLock) fTreeLock = kFALSE;
02709       }
02710 
02711 out:
02712       if (obj->IsA() != TSystemFile::Class()) {
02713          if (obj->IsFolder()) {
02714             fIconBox->Refresh();
02715          }
02716 
02717          if (fBrowser) {
02718             fBrowser->SetRefreshFlag(kFALSE);
02719          }
02720 
02721          fClient->NeedRedraw(fIconBox);
02722          fClient->NeedRedraw(fLt, kTRUE);
02723       }
02724    }
02725 }
02726 
02727 //______________________________________________________________________________
02728 void TRootBrowserLite::RecursiveRemove(TObject *obj)
02729 {
02730    // Recursively remove object from browser.
02731 
02732    // don't delete fIconBox items here (it's status will be updated
02733    // via TBrowser::Refresh() which should be called once all objects have
02734    // been removed.
02735 
02736    TGListTreeItem *item = fLt->FindItemByObj(fLt->GetFirstItem(), obj);
02737    if (item == 0)
02738       return;
02739    if (fListLevel && (item == fListLevel)) {
02740       TGListTreeItem *parent = item->GetParent();
02741       if (parent) {
02742          fListLevel = parent;
02743          fLt->ClearHighlighted();
02744          fLt->HighlightItem(fListLevel);
02745          fLt->OpenItem(fListLevel);
02746       }
02747       else
02748          fListLevel = 0;
02749    }
02750    DeleteListTreeItem(item);
02751 }
02752 
02753 //______________________________________________________________________________
02754 void TRootBrowserLite::Refresh(Bool_t force)
02755 {
02756    // Refresh the browser contents.
02757 
02758    Bool_t refresh = fBrowser && fBrowser->GetRefreshFlag();
02759 
02760    if (fTextEdit && !gROOT->IsExecutingMacro() && force) {
02761       fTextEdit->LoadFile(fTextFileName.Data());
02762       fClient->NeedRedraw(fTextEdit);
02763       return;
02764    }
02765 
02766    if ( (refresh || force) && !fIconBox->WasGrouped()
02767       && fIconBox->NumItems()<fIconBox->GetGroupSize() ) {
02768 
02769       TRootBrowserCursorSwitcher cursorSwitcher(fIconBox, fLt);
02770       static UInt_t prev = 0;
02771       UInt_t curr =  gROOT->GetListOfBrowsables()->GetSize();
02772       if (!prev) prev = curr;
02773 
02774       if (prev != curr) { // refresh gROOT
02775          TGListTreeItem *sav = fListLevel;
02776          fListLevel = 0;
02777          BrowseObj(gROOT);
02778          fListLevel = sav;
02779          prev = curr;
02780       }
02781 
02782       // Refresh the IconBox
02783       if (fListLevel) {
02784          TObject *obj = (TObject *)fListLevel->GetUserData();
02785          if (obj) {
02786             fTreeLock = kTRUE;
02787             BrowseObj(obj);
02788             fTreeLock = kFALSE;
02789          }
02790       }
02791    }
02792    fClient->NeedRedraw(fLt, kTRUE);
02793 }
02794 
02795 //______________________________________________________________________________
02796 void TRootBrowserLite::ShowToolBar(Bool_t show)
02797 {
02798    // Show or hide toolbar.
02799 
02800    if (show) {
02801       ShowFrame(fToolBar);
02802       ShowFrame(fToolBarSep);
02803       fViewMenu->CheckEntry(kViewToolBar);
02804    } else {
02805       HideFrame(fToolBar);
02806       HideFrame(fToolBarSep);
02807       fViewMenu->UnCheckEntry(kViewToolBar);
02808    }
02809 }
02810 
02811 //______________________________________________________________________________
02812 void TRootBrowserLite::ShowStatusBar(Bool_t show)
02813 {
02814    // Show or hide statusbar.
02815 
02816    if (show) {
02817       ShowFrame(fStatusBar);
02818       fViewMenu->CheckEntry(kViewStatusBar);
02819    } else {
02820       HideFrame(fStatusBar);
02821       fViewMenu->UnCheckEntry(kViewStatusBar);
02822    }
02823 }
02824 
02825 //______________________________________________________________________________
02826 void TRootBrowserLite::SetDefaults(const char *iconStyle, const char *sortBy)
02827 {
02828    // Set defaults depending on settings in the user's .rootrc.
02829 
02830    const char *opt;
02831 
02832    // IconStyle: big, small, list, details
02833    if (iconStyle)
02834       opt = iconStyle;
02835    else
02836       opt = gEnv->GetValue("Browser.IconStyle", "small");
02837    if (!strcasecmp(opt, "big"))
02838       SetViewMode(kViewLargeIcons, kTRUE);
02839    else if (!strcasecmp(opt, "small"))
02840       SetViewMode(kViewSmallIcons, kTRUE);
02841    else if (!strcasecmp(opt, "list"))
02842       SetViewMode(kViewList, kTRUE);
02843    else if (!strcasecmp(opt, "details"))
02844       SetViewMode(kViewDetails, kTRUE);
02845    else
02846       SetViewMode(kViewSmallIcons, kTRUE);
02847 
02848    // SortBy: name, type, size, date
02849    if (sortBy)
02850       opt = sortBy;
02851    else
02852       opt = gEnv->GetValue("Browser.SortBy", "name");
02853    if (!strcasecmp(opt, "name"))
02854       SetSortMode(kViewArrangeByName);
02855    else if (!strcasecmp(opt, "type"))
02856       SetSortMode(kViewArrangeByType);
02857    else if (!strcasecmp(opt, "size"))
02858       SetSortMode(kViewArrangeBySize);
02859    else if (!strcasecmp(opt, "date"))
02860       SetSortMode(kViewArrangeByDate);
02861    else
02862       SetSortMode(kViewArrangeByName);
02863 
02864    fIconBox->Refresh();
02865 }
02866 
02867 //______________________________________________________________________________
02868 void TRootBrowserLite::SetViewMode(Int_t new_mode, Bool_t force)
02869 {
02870    // Set iconbox's view mode and update menu and toolbar buttons accordingly.
02871 
02872    int i, bnum;
02873    EListViewMode lv;
02874 
02875    if (force || (fViewMode != new_mode)) {
02876 
02877       switch (new_mode) {
02878          default:
02879             if (!force)
02880                return;
02881             else
02882                new_mode = kViewLargeIcons;
02883             // intentionally no break
02884          case kViewLargeIcons:
02885             bnum = 2;
02886             lv = kLVLargeIcons;
02887             break;
02888          case kViewSmallIcons:
02889             bnum = 3;
02890             lv = kLVSmallIcons;
02891             break;
02892          case kViewList:
02893             bnum = 4;
02894             lv = kLVList;
02895             break;
02896          case kViewDetails:
02897             bnum = 5;
02898             lv = kLVDetails;
02899             break;
02900       }
02901 
02902       fViewMode = new_mode;
02903       fViewMenu->RCheckEntry(fViewMode, kViewLargeIcons, kViewDetails);
02904 
02905       for (i = 2; i <= 5; ++i)
02906          gToolBarData[i].fButton->SetState((i == bnum) ? kButtonEngaged : kButtonUp);
02907 
02908       fListView->SetViewMode(lv);
02909       TGTextButton** buttons = fListView->GetHeaderButtons();
02910       if ((lv == kLVDetails) && (buttons)) {
02911          if (!strcmp(fListView->GetHeader(1), "Attributes")) {
02912             buttons[0]->Connect("Clicked()", "TRootBrowserLite", this,
02913                                 TString::Format("SetSortMode(=%d)", kViewArrangeByName));
02914             buttons[1]->Connect("Clicked()", "TRootBrowserLite", this,
02915                                 TString::Format("SetSortMode(=%d)", kViewArrangeByType));
02916             buttons[2]->Connect("Clicked()", "TRootBrowserLite", this,
02917                                 TString::Format("SetSortMode(=%d)", kViewArrangeBySize));
02918             buttons[5]->Connect("Clicked()", "TRootBrowserLite", this,
02919                                 TString::Format("SetSortMode(=%d)", kViewArrangeByDate));
02920          }
02921       }
02922       fIconBox->AdjustPosition();
02923    }
02924 }
02925 
02926 //______________________________________________________________________________
02927 void TRootBrowserLite::SetSortMode(Int_t new_mode)
02928 {
02929    // Set iconbox's sort mode and update menu radio buttons accordingly.
02930 
02931    EFSSortMode smode;
02932 
02933    switch (new_mode) {
02934       default:
02935          new_mode = kViewArrangeByName;
02936          // intentionally no break
02937       case kViewArrangeByName:
02938          smode = kSortByName;
02939          break;
02940       case kViewArrangeByType:
02941          smode = kSortByType;
02942          break;
02943       case kViewArrangeBySize:
02944          smode = kSortBySize;
02945          break;
02946       case kViewArrangeByDate:
02947          smode = kSortByDate;
02948          break;
02949    }
02950 
02951    fSortMode = new_mode;
02952    fSortMenu->RCheckEntry(fSortMode, kViewArrangeByName, kViewArrangeByDate);
02953 
02954    fIconBox->Sort(smode);
02955 }
02956 
02957 //______________________________________________________________________________
02958 void TRootBrowserLite::Search()
02959 {
02960    // starts serach dialog
02961 
02962    if (!fTextEdit) {
02963       fIconBox->Search(kFALSE);
02964    } else {
02965       fTextEdit->Search(kFALSE);
02966    }
02967 }
02968 
02969 //______________________________________________________________________________
02970 static Bool_t isBinary(const char *str, int len)
02971 {
02972    // test
02973 
02974    for (int i = 0; i < len; i++) {
02975       char c = str[i];
02976       if (((c < 32) || (c > 126)) && (c != '\t') && (c != '\r') && (c != '\n')) {
02977          return kTRUE;
02978       }
02979    }
02980    return kFALSE;
02981 }
02982 
02983 //______________________________________________________________________________
02984 void TRootBrowserLite::HideTextEdit()
02985 {
02986    // hide text edit
02987 
02988    if (!fTextEdit) return;
02989 
02990    ShowMacroButtons(kFALSE);
02991    fTextEdit->UnmapWindow();
02992    fV2->RemoveFrame(fTextEdit);
02993    fV2->AddFrame(fListView, fExpandLayout);
02994    TGButton *savbtn = fToolBar->GetButton(kViewSave);
02995    savbtn->Disconnect();
02996    fTextEdit->DestroyWindow();
02997    delete fTextEdit;
02998    fTextEdit = 0;
02999    fListView->Resize(fV2->GetWidth(), fV2->GetHeight());
03000    fV2->MapSubwindows();
03001    fV2->Layout();
03002    fBrowseTextFile = kFALSE;
03003    fTextFileName = "";
03004 }
03005 
03006 //______________________________________________________________________________
03007 void TRootBrowserLite::BrowseTextFile(const char *file)
03008 {
03009    // browse text file
03010 
03011    Bool_t loaded = (fTextEdit != 0);
03012    if (gSystem->AccessPathName(file, kReadPermission)) {
03013       if (loaded) {
03014          HistoryBackward();
03015       }
03016       return;
03017    }
03018    const int bufferSize = 1024;
03019    char buffer[bufferSize];
03020 
03021    FILE *fd = fopen(file, "rb");
03022    if (fd == 0) {
03023       if (loaded) {
03024          HistoryBackward();
03025       }
03026       return;
03027    }
03028    int sz = fread(buffer, 1, bufferSize, fd);
03029    fclose(fd);
03030 
03031    if (isBinary(buffer, sz)) {
03032       if (loaded) {
03033          HistoryBackward();
03034       }
03035       return;
03036    }
03037 
03038    if (!fTextEdit) {
03039       fTextEdit = new TGTextEdit(fV2, fV2->GetWidth(), fV2->GetHeight(),
03040                                  kSunkenFrame | kDoubleBorder);
03041       TColor *col = gROOT->GetColor(19);
03042       fTextEdit->SetBackgroundColor(col->GetPixel());
03043       if (TGSearchDialog::SearchDialog()) {
03044          TGSearchDialog::SearchDialog()->Connect("TextEntered(char *)", "TGTextEdit",
03045                                                  fTextEdit, "Search(char *,Bool_t,Bool_t)");
03046       }
03047       fV2->AddFrame(fTextEdit, fExpandLayout);
03048       TGButton *savbtn = fToolBar->GetButton(kViewSave);
03049       savbtn->Connect("Released()", "TGTextEdit", fTextEdit, "SaveFile(=0,kTRUE)");
03050    }
03051    fTextFileName = file;
03052    fTextEdit->LoadFile(file);
03053    if (loaded) return;
03054 
03055    if (fTextFileName.EndsWith(".C")) {
03056       ShowMacroButtons();
03057    } else {
03058       fTextEdit->SetReadOnly();
03059    }
03060    fListView->UnmapWindow();
03061    fV2->RemoveFrame(fListView);
03062    fTextEdit->MapWindow();
03063    fV2->MapSubwindows();
03064    fV2->Layout();
03065    fBrowseTextFile = kTRUE;
03066 
03067    if (fListLevel) {
03068       AddToHistory(fListLevel);
03069    }
03070    TGButton *btn = fToolBar->GetButton(kHistoryForw);
03071 
03072    if (btn) {
03073       btn->SetState(kButtonDisabled);
03074    }
03075 
03076    TGButton *btn2 = fToolBar->GetButton(kHistoryBack);
03077 
03078    if (btn2) {
03079       btn2->SetState(kButtonUp);
03080    }
03081 }
03082 
03083 //______________________________________________________________________________
03084 void TRootBrowserLite::ExecMacro()
03085 {
03086    // executed browsed text macro
03087 
03088    char *tmpfile = gSystem->ConcatFileName(gSystem->TempDirectory(),
03089                                            fTextFileName.Data());
03090 
03091    gROOT->SetExecutingMacro(kTRUE);
03092    fTextEdit->SaveFile(tmpfile, kFALSE);
03093    gROOT->Macro(tmpfile);
03094    gSystem->Unlink(tmpfile);
03095    delete [] tmpfile;
03096    gROOT->SetExecutingMacro(kFALSE);
03097 }
03098 
03099 //______________________________________________________________________________
03100 void TRootBrowserLite::InterruptMacro()
03101 {
03102    // interrupt browsed macro execution
03103 
03104    gROOT->SetInterrupt(kTRUE);
03105 }
03106 
03107 //______________________________________________________________________________
03108 void TRootBrowserLite::ShowMacroButtons(Bool_t show)
03109 {
03110    // show/hide macro buttons
03111 
03112    TGButton *bt1 = fToolBar->GetButton(kViewExec);
03113    TGButton *bt2 = fToolBar->GetButton(kViewInterrupt);
03114    TGButton *bt3 = fToolBar->GetButton(kViewSave);
03115 
03116    static Bool_t connected = kFALSE;
03117 
03118    if (!show) {
03119       bt1->UnmapWindow();
03120       bt2->UnmapWindow();
03121       bt3->UnmapWindow();
03122    } else {
03123       bt1->MapWindow();
03124       bt2->MapWindow();
03125       bt3->MapWindow();
03126 
03127       if (!connected && fTextEdit) {
03128          bt1->Connect("Pressed()", "TRootBrowserLite", this, "ExecMacro()");
03129          bt2->Connect("Pressed()", "TRootBrowserLite", this, "InterruptMacro()");
03130          connected = kTRUE;
03131       }
03132    }
03133 }
03134 
03135 //______________________________________________________________________________
03136 void TRootBrowserLite::SetStatusText(const char *txt, Int_t col)
03137 {
03138    // Set text in column col in status bar.
03139 
03140    ShowStatusBar(kTRUE);
03141    TGStatusBar* status = GetStatusBar();
03142    if (status!=0) {
03143       status->SetText(txt, col);
03144    }
03145 }
03146 
03147 //______________________________________________________________________________
03148 TBrowserImp *TRootBrowserLite::NewBrowser(TBrowser *b, const char *title,
03149                                       UInt_t width, UInt_t height,
03150                                       Option_t * /*opt*/)
03151 {
03152    // Interface method to the old browser.
03153 
03154    TRootBrowserLite *browser = new TRootBrowserLite(b, title, width, height);
03155    return (TBrowserImp *)browser;
03156 }
03157 
03158 //______________________________________________________________________________
03159 TBrowserImp *TRootBrowserLite::NewBrowser(TBrowser *b, const char *title, Int_t x,
03160                                       Int_t y, UInt_t width, UInt_t height,
03161                                       Option_t * /*opt*/)
03162 {
03163    // Interface method to the old browser.
03164 
03165    TRootBrowserLite *browser = new TRootBrowserLite(b, title, x, y, width, height);
03166    return (TBrowserImp *)browser;
03167 }

Generated on Tue Jul 5 14:22:07 2011 for ROOT_528-00b_version by  doxygen 1.5.1