Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TRootBrowserLite.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 27/02/98
3
4/*************************************************************************
5 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12
13/** \class TRootBrowserLite
14 \ingroup guiwidgets
15
16This class creates a ROOT object browser (looking like Windows
17Explorer). The widgets used are the new native ROOT GUI widgets.
18
19*/
20
21
22#include "RConfigure.h"
23
24#include "TRootBrowserLite.h"
25#include "TRootApplication.h"
26#include "TGCanvas.h"
27#include "TGMenu.h"
28#include "TGFileDialog.h"
29#include "TGStatusBar.h"
30#include "TGFSComboBox.h"
31#include "TGLabel.h"
32#include "TGButton.h"
33#include "TGListView.h"
34#include "TGListTree.h"
35#include "TGToolBar.h"
36#include "TGSplitter.h"
37#include "TG3DLine.h"
38#include "TGFSContainer.h"
39#include "TGMimeTypes.h"
40#include "TRootHelpDialog.h"
41#include "TGTextEntry.h"
42#include "TGTextEdit.h"
43#include "TGTextEditDialogs.h"
44
45#include "TROOT.h"
46#include "TEnv.h"
47#include "TBrowser.h"
48#include "TApplication.h"
49#include "TFile.h"
50#include "TKey.h"
51#include "TKeyMapFile.h"
52#include "TClass.h"
53#include "TContextMenu.h"
54#include "TSystem.h"
55#include "TSystemDirectory.h"
56#include "TSystemFile.h"
57#include "TRemoteObject.h"
58#include "TInterpreter.h"
59#include "TGuiBuilder.h"
60#include "TImage.h"
61#include "TVirtualPad.h"
62#include "KeySymbols.h"
63#include "THashTable.h"
64#include "TColor.h"
65#include "TObjString.h"
66#include "TGDNDManager.h"
67#include "TBufferFile.h"
68#include "TFolder.h"
69#include "Getline.h"
70#include "snprintf.h"
71#include "TVirtualX.h"
72
73#include "HelpText.h"
74
75#ifdef WIN32
76#include "TWin32SplashThread.h"
77#endif
78
79// Browser menu command ids
91
105
106 kViewArrangeByName, // Arrange submenu
112
115
118
119 kOneLevelUp, // One level up toolbar button
120 kFSComboBox, // File system combobox in toolbar
121
131
132
133//----- Struct for default icons
134
136 const char *fPicnamePrefix;
137 const TGPicture *fIcon[2];
138};
139
140#if 0
141static DefaultIcon_t gDefaultIcon[] = {
142 { "folder", { 0, 0 } },
143 { "app", { 0, 0 } },
144 { "doc", { 0, 0 } },
145 { "slink", { 0, 0 } },
146 { "histo", { 0, 0 } },
147 { "object", { 0, 0 } }
148};
149#endif
150
151
152//----- Toolbar stuff...
153
155 { "tb_uplevel.xpm", "Up One Level", kFALSE, kOneLevelUp, 0 },
156 { "", "", kFALSE, -1, 0 },
157 { "tb_bigicons.xpm", "Large Icons", kTRUE, kViewLargeIcons, 0 },
158 { "tb_smicons.xpm", "Small Icons", kTRUE, kViewSmallIcons, 0 },
159 { "tb_list.xpm", "List", kTRUE, kViewList, 0 },
160 { "tb_details.xpm", "Details", kTRUE, kViewDetails, 0 },
161 { "", "", kFALSE, -1, 0 },
162 { "tb_back.xpm", "Back", kFALSE, kHistoryBack, 0 },
163 { "tb_forw.xpm", "Forward", kFALSE, kHistoryForw, 0 },
164 { "tb_refresh.xpm", "Refresh (F5)", kFALSE, kViewRefresh, 0 },
165 { "", "", kFALSE, -1, 0 },
166 { "tb_find.xpm", "Find (Ctrl-F)", kFALSE, kViewFind, 0 },
167 { "", "", kFALSE, -1, 0 },
168 { "macro_t.xpm", "Execute Macro", kFALSE, kViewExec, 0 },
169 { "interrupt.xpm", "Interrupt Macro",kFALSE, kViewInterrupt, 0 },
170 { "filesaveas.xpm", "Save Macro", kFALSE, kViewSave, 0 },
171 { 0, 0, kFALSE, 0, 0 }
172};
173
174
175//----- TGFileDialog file types
176
177static const char *gOpenTypes[] = { "ROOT files", "*.root",
178 "All files", "*",
179 0, 0 };
180
181////////////////////////////////////////////////////////////////////////////////////
183public:
185
187 void Print(Option_t *) const { if (fItem) printf("%s\n", fItem->GetText()); }
188};
189
190
191////////////////////////////////////////////////////////////////////////////////////
193public:
196 TIter next(this);
197
198 while ((cur = (TRootBrowserHistoryCursor*)next())) {
199 if (cur->fItem->GetUserData() == obj) {
200 Remove(cur);
201 delete cur;
202 }
203 }
204 }
205
208 TIter next(this);
209
210 while ((cur = (TRootBrowserHistoryCursor*)next())) {
211 if (cur->fItem == item) {
212 Remove(cur);
213 delete cur;
214 }
215 }
216 }
217};
218
219
220////////////////////////////////////////////////////////////////////////////////////
222private:
225public:
227 if (w1) gVirtualX->SetCursor(w1->GetId(), gVirtualX->CreateCursor(kWatch));
228 if (w2) gVirtualX->SetCursor(w2->GetId(), gVirtualX->CreateCursor(kWatch));
229 }
231 if (fW1) gVirtualX->SetCursor(fW1->GetId(), gVirtualX->CreateCursor(kPointer));
232 if (fW2) gVirtualX->SetCursor(fW2->GetId(), gVirtualX->CreateCursor(kPointer));
233 }
234};
235
236////////////////////////////////////////////////////////////////////////////////////
237class TIconBoxThumb : public TObject {
238public:
242
243 TIconBoxThumb(const char *name, const TGPicture *spic, const TGPicture *pic) {
244 fName = name;
245 fSmall = spic;
246 fLarge = pic;
247 }
248 ULong_t Hash() const { return fName.Hash(); }
249 const char *GetName() const { return fName.Data(); }
250};
251
252
253
254//----- Special ROOT object item (this are items in the icon box, see
255//----- TRootIconBox)
256////////////////////////////////////////////////////////////////////////////////////
257class TRootObjItem : public TGFileItem {
258public:
259 TRootObjItem(const TGWindow *p, const TGPicture *bpic,
260 const TGPicture *spic, TGString *name,
261 TObject *obj, TClass *cl, EListViewMode viewMode = kLVSmallIcons);
262
264 TObject *object = 0;
265 if (fObj->IsA() == TKey::Class())
266 object = ((TKey *)fObj)->ReadObj();
267 else
268 object = fObj;
269 if (object) {
271 fBuf->WriteObject(object);
274 }
275 fDNDData.fDataType = gVirtualX->InternAtom("application/root", kFALSE);
276 return &fDNDData;
277 }
278
280 if (GetParent())
281 return ((TGFrame *)GetParent())->HandleDNDFinished();
282 return kFALSE;
283 }
284
285protected:
288};
289
290////////////////////////////////////////////////////////////////////////////////
291/// Create an icon box item.
292
294 const TGPicture *spic, TGString *name,
295 TObject *obj, TClass *, EListViewMode viewMode) :
296 TGFileItem(p, bpic, 0, spic, 0, name, 0, 0, 0, 0, 0, viewMode)
297{
298 fObj = obj;
299 fDNDData.fData = 0;
301
302 if (fSubnames) {
303 for (Int_t i = 0; fSubnames[i] != 0; ++i) delete fSubnames[i];
304 }
305 delete [] fSubnames;
306 fSubnames = new TGString* [2];
307
308 fSubnames[0] = new TGString(obj->GetTitle());
309
310 fSubnames[1] = 0;
311
312 if (obj->IsA()->HasDefaultConstructor()) {
314 }
315 if ((obj->IsA() == TFolder::Class()) ||
316 (obj->IsA() == TClass::Class())) {
318 }
319
320 int i;
321 for (i = 0; fSubnames[i] != 0; ++i)
322 ;
323 fCtw = new int[i];
324 for (i = 0; fSubnames[i] != 0; ++i)
325 fCtw[i] = gVirtualX->TextWidth(fFontStruct, fSubnames[i]->GetString(),
326 fSubnames[i]->GetLength());
327}
328
329class TRootIconBox;
330////////////////////////////////////////////////////////////////////////////////////
331class TRootIconList : public TList {
332
333private:
334 TRootIconBox *fIconBox; // iconbox to which list belongs
335 const TGPicture *fPic; // list view icon
336
337public:
339 virtual ~TRootIconList();
340 void UpdateName();
341 const char *GetTitle() const { return "ListView Container"; }
342 Bool_t IsFolder() const { return kFALSE; }
343 void Browse(TBrowser *b);
344 const TGPicture *GetPicture() const { return fPic; }
345};
346
347////////////////////////////////////////////////////////////////////////////////
348/// constructor
349
351{
352 fPic = gClient->GetPicture("listview.xpm");
353 fIconBox = box;
354 fName = "empty";
355}
356
357////////////////////////////////////////////////////////////////////////////////
358/// destructor
359
361{
362 gClient->FreePicture(fPic);
363}
364
365////////////////////////////////////////////////////////////////////////////////
366/// composite name
367
369{
370 if (!First()) return;
371
372 if (fSize==1) {
373 fName = First()->GetName();
374 return;
375 }
376
377 fName = First()->GetName();
378 fName += "-";
379 fName += Last()->GetName();
380}
381
382//----- Special ROOT object container (this is the icon box on the
383//----- right side of the browser)
384////////////////////////////////////////////////////////////////////////////////////
386friend class TRootIconList;
387friend class TRootBrowserLite;
388
389private:
390 Bool_t fCheckHeaders; // if true check headers
395 TList *fGarbage; // garbage for TRootIconList's
396 Int_t fGroupSize; // the total number of items when icon box switched to "global view" mode
403 THashTable *fThumbnails; // hash table with thumbnailed pictures
406
407 void *FindItem(const TString& name,
408 Bool_t direction = kTRUE,
409 Bool_t caseSensitive = kTRUE,
410 Bool_t beginWith = kFALSE);
411 void RemoveGarbage();
412
413public:
415 UInt_t options = kSunkenFrame,
417
418 virtual ~TRootIconBox();
419
420 void AddObjItem(const char *name, TObject *obj, TClass *cl);
421 void GetObjPictures(const TGPicture **pic, const TGPicture **spic,
422 TObject *obj, const char *name);
423 void SetObjHeaders();
424 void Refresh();
425 void RemoveAll();
426 void SetGroupSize(Int_t siz) { fGroupSize = siz; }
427 Int_t GetGroupSize() const { return fGroupSize; }
429 Bool_t WasGrouped() const { return fWasGrouped; }
430};
431
432////////////////////////////////////////////////////////////////////////////////
433/// Create iconbox containing ROOT objects in browser.
434
436 ULong_t back) : TGFileContainer(lv, options, back)
437{
438 fListView = lv;
439 fBrowser = browser;
440
442 fTotal = 0;
443 fGarbage = new TList();
444 fCurrentList = 0;
445 fCurrentItem = 0;
447 fGroupSize = 1000;
448 fCurrentName = 0;
450 fActiveObject = 0;
451 fIsEmpty = kTRUE;
452 fLargeCachedPic = 0;
453 fSmallCachedPic = 0;
454
455 // Don't use timer HERE (timer is set in TBrowser).
457 fRefresh = 0;
458 fThumbnails = new THashTable(50);
460}
461
462////////////////////////////////////////////////////////////////////////////////
463/// destructor
464
466{
467 RemoveAll();
469 delete fGarbage;
470 delete fThumbnails;
471}
472
473////////////////////////////////////////////////////////////////////////////////
474/// Retrieve icons associated with class "name". Association is made
475/// via the user's ~/.root.mimes file or via $ROOTSYS/etc/root.mimes.
476
477void TRootIconBox::GetObjPictures(const TGPicture **pic, const TGPicture **spic,
478 TObject *obj, const char *name)
479{
480 static TImage *im = 0;
481 if (!im) {
482 im = TImage::Create();
483 }
484
485 TString xpm_magic(name, 3);
486 Bool_t xpm = xpm_magic == "/* ";
487 const char *iconname = xpm ? obj->GetName() : name;
488
489 if (obj->IsA()->InheritsFrom("TGeoVolume")) {
490 iconname = obj->GetIconName() ? obj->GetIconName() : obj->IsA()->GetName();
491 }
492
493 if (fCachedPicName == iconname) {
494 *pic = fLargeCachedPic;
495 *spic = fSmallCachedPic;
496 return;
497 }
498
499 *pic = fClient->GetMimeTypeList()->GetIcon(iconname, kFALSE);
500
501 if (!(*pic) && xpm) {
502 if (im && im->SetImageBuffer((char**)&name, TImage::kXpm)) {
503 *pic = fClient->GetPicturePool()->GetPicture(iconname, im->GetPixmap(),
504 im->GetMask());
505 im->Scale(im->GetWidth()/2, im->GetHeight()/2);
506 *spic = fClient->GetPicturePool()->GetPicture(iconname, im->GetPixmap(),
507 im->GetMask());
508 }
509
510 fClient->GetMimeTypeList()->AddType("[thumbnail]", iconname, iconname, iconname, "->Browse()");
511 return;
512 }
513
514 if (*pic == 0) {
515 if (obj->IsFolder()) {
516 *pic = fFolder_s;
517 } else {
518 *pic = fDoc_s;
519 }
520 }
521 fLargeCachedPic = *pic;
522
523 *spic = fClient->GetMimeTypeList()->GetIcon(iconname, kTRUE);
524
525 if (*spic == 0) {
526 if (obj->IsFolder())
527 *spic = fFolder_t;
528 else
529 *spic = fDoc_t;
530 }
531 fSmallCachedPic = *spic;
532 fCachedPicName = iconname;
533}
534
535////////////////////////////////////////////////////////////////////////////////
536/// delete all TRootIconLists from garbage
537
539{
540 TIter next(fGarbage);
541 TList *li;
542
543 while ((li=(TList *)next())) {
544 li->Clear("nodelete");
545 }
546 fGarbage->Delete();
547}
548
549////////////////////////////////////////////////////////////////////////////////
550/// Add object to iconbox. Class is used to get the associated icons
551/// via the mime file (see GetObjPictures()).
552
553void TRootIconBox::AddObjItem(const char *name, TObject *obj, TClass *cl)
554{
555 if (!cl) return;
556
557 Bool_t isSystemFile = kFALSE;
558 TGFileItem *fi;
560 const TGPicture *pic = 0;
561 const TGPicture *spic = 0;
562
563 if (obj->InheritsFrom("TRemoteObject")) {
564 // check if the real remote object is a system file or directory
565 TRemoteObject *robj = (TRemoteObject *)obj;
566 if ((TString(robj->GetClassName()) == "TSystemFile") ||
567 (TString(robj->GetClassName()) == "TSystemDirectory"))
568 isSystemFile = kTRUE;
569 }
570
571 if (isSystemFile || obj->IsA() == TSystemFile::Class() ||
572 obj->IsA() == TSystemDirectory::Class()) {
573 if (fCheckHeaders) {
574 if (strcmp(fListView->GetHeader(1), "Attributes")) {
577 if (buttons) {
578 buttons[0]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
579 TString::Format("SetSortMode(=%d)", kViewArrangeByName));
580 buttons[1]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
581 TString::Format("SetSortMode(=%d)", kViewArrangeByType));
582 buttons[2]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
583 TString::Format("SetSortMode(=%d)", kViewArrangeBySize));
584 buttons[5]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
585 TString::Format("SetSortMode(=%d)", kViewArrangeByDate));
586 }
587 }
589 }
590
591 TIconBoxThumb *thumb = 0;
592 char *thumbname = gSystem->ConcatFileName(gSystem->WorkingDirectory(), name);
594 thumbname);
595 delete []thumbname;
596
597 if (thumb) {
598 spic = thumb->fSmall;
599 pic = thumb->fLarge;
600 }
601
602 if (obj->InheritsFrom("TRemoteObject"))
603 // special case for remote object
604 fi = AddRemoteFile(obj, spic, pic);
605 else
606 fi = AddFile(name, spic, pic);
607 if (fi) {
608 fi->SetUserData(obj);
609 if (obj->IsA() == TSystemFile::Class()) {
610 TString str;
611 TDNDData data;
612 str = TString::Format("file://%s/%s\r\n",
614 obj->GetName());
615 data.fData = (void *)str.Data();
616 data.fDataLength = str.Length()+1;
617 data.fDataType = gVirtualX->InternAtom("text/uri-list", kFALSE);
618 fi->SetDNDData(&data);
619 fi->SetDNDSource(kTRUE);
620 }
621 }
622
624 return;
625 }
626
627 if (!fCurrentList) {
628 fCurrentList = new TRootIconList(this);
630 }
631
632 fCurrentList->Add(obj);
635
636 TGFrameElement *el;
637 TIter next(fList);
638 while ((el = (TGFrameElement *) next())) {
639 TGLVEntry *f = (TGLVEntry *) el->fFrame;
640 if (f->GetUserData() == obj) {
641 return;
642 }
643 }
644
645 if (fGrouped && fCurrentItem && (fCurrentList->GetSize()>1)) {
647 }
648
650
651 if ((fCurrentList->GetSize() < fGroupSize) && !fGrouped) {
652 GetObjPictures(&pic, &spic, obj, obj->GetIconName() ?
653 obj->GetIconName() : cl->GetName());
654
655 if (fCheckHeaders) {
656 if (strcmp(fListView->GetHeader(1), "Title")) {
658 }
660 }
661
662 fi = new TRootObjItem(this, pic, spic, new TGString(name), obj, cl, view);
663
664 fi->SetUserData(obj);
665 AddItem(fi);
666 return;
667 }
668
669 if (fGrouped && (fCurrentList->GetSize()==1)) {
672 fCurrentName,fCurrentList, TList::Class(), view);
675 fTotal = fList->GetSize();
676 return;
677 }
678
679 if ((fCurrentList->GetSize()==fGroupSize) && !fGrouped) {
680 fGrouped = kTRUE;
681
682 // clear fList
683 TGFrameElement *el2;
684 TIter nextl(fList);
685
686 while ((el2 = (TGFrameElement *) nextl())) {
687 el2->fFrame->DestroyWindow();
688 delete el2->fFrame;
689 fList->Remove(el2);
690 delete el2;
691 }
692
695 fCurrentName, fCurrentList, TList::Class(), view);
697 AddItem(fi);
698
699 fCurrentList = new TRootIconList(this);
701 fTotal = 1;
702 return;
703 }
704
706 fCurrentList = new TRootIconList(this);
708 return;
709 }
710}
711
712////////////////////////////////////////////////////////////////////////////////
713/// browse icon list
714
716{
717 if (!fIconBox) return;
718
719 TObject *obj;
720 TGFileItem *fi;
721 const TGPicture *pic = 0;
722 const TGPicture *spic = 0;
723 TClass *cl;
725 TKey *key = 0;
726
728 TObjLink *lnk = FirstLink();
729
730 while (lnk) {
731 obj = lnk->GetObject();
732 lnk = lnk->Next();
733
734 if (obj->IsA() == TKey::Class()) {
735 cl = TClass::GetClass(((TKey *)obj)->GetClassName());
736 key = (TKey *)obj;
737 } else if (obj->IsA() == TKeyMapFile::Class()) {
738 cl = TClass::GetClass(((TKeyMapFile *)obj)->GetTitle());
739 } else if (obj->InheritsFrom("TRemoteObject")) {
740 // special case for remote object: get real object class
741 TRemoteObject *robj = (TRemoteObject *)obj;
742 cl = TClass::GetClass(robj->GetClassName());
743 } else {
744 cl = obj->IsA();
745 }
746
747 name = obj->GetName();
748
749 if (key && obj->IsA() == TKey::Class()) {
750 name += ";";
751 name += key->GetCycle();
752 }
753
754 fIconBox->GetObjPictures(&pic, &spic, obj, obj->GetIconName() ?
755 obj->GetIconName() : cl->GetName());
756
757 fi = new TRootObjItem((const TGWindow*)fIconBox, pic, spic, new TGString(name.Data()),
758 obj, cl, (EListViewMode)fIconBox->GetViewMode());
759 fi->SetUserData(obj);
760 fIconBox->AddItem(fi);
761 fIconBox->fTotal++;
762
763 if (obj==fIconBox->fActiveObject) {
765 }
766 }
767
768 fIconBox->fGarbage->Remove(this);
770 fIconBox->fGarbage->Add(this); // delete this later
771
772 fIconBox->Refresh();
774
776}
777
778////////////////////////////////////////////////////////////////////////////////
779/// Find a frame which assosiated object has a name containing a "name" string.
780
782 Bool_t caseSensitive,Bool_t beginWith)
783{
784 if (!fGrouped) {
785 return TGContainer::FindItem(name, direction, caseSensitive, beginWith);
786 }
787
788 if (name.IsNull()) return 0;
789 int idx = kNPOS;
790
791 TGFrameElement* el = 0;
792 TString str;
794
795 fLastDir = direction;
796 fLastCase = caseSensitive;
797 fLastName = name;
798
799 if (fLastActiveEl) {
800 el = fLastActiveEl;
801
802 if (direction) {
803 el = (TGFrameElement *)fList->After(el);
804 } else {
805 el = (TGFrameElement *)fList->Before(el);
806 }
807 } else {
808 if (direction) el = (TGFrameElement *)fList->First();
809 else el = (TGFrameElement *)fList->Last();
810 }
811
812 TGLVEntry* lv = 0;
813 TObject* obj = 0;
814 TList* li = 0;
815
816 while (el) {
817 lv = (TGLVEntry*)el->fFrame;
818 li = (TList*)lv->GetUserData();
819
820 TIter next(li);
821
822 while ((obj=next())) {
823 str = obj->GetName();
824 idx = str.Index(name,0,cmp);
825
826 if (idx!=kNPOS) {
827 if (beginWith) {
828 if (idx==0) {
829 fActiveObject = obj;
830 return el;
831 }
832 } else {
833 fActiveObject = obj;
834 return el;
835 }
836 }
837 }
838 if (direction) {
839 el = (TGFrameElement *)fList->After(el);
840 } else {
841 el = (TGFrameElement *)fList->Before(el);
842 }
843 }
844 fActiveObject = 0;
845 return 0;
846}
847
848////////////////////////////////////////////////////////////////////////////////
849/// Set list box headers used to display detailed object iformation.
850/// Currently this is only "Name" and "Title".
851
853{
856 fListView->SetHeader("Title", kTextLeft, kTextLeft, 1);
857}
858
859////////////////////////////////////////////////////////////////////////////////
860/// Sort icons, and send message to browser with number of objects
861/// in box.
862
864{
865 // This automatically calls layout
867
868 // Make TRootBrowserLite display total objects in status bar
870
873}
874
875////////////////////////////////////////////////////////////////////////////////
876/// Remove all items from icon box
877
879{
880 if (fIsEmpty) return;
881
885 fCurrentItem = 0;
886 fCurrentList = 0;
887 fIsEmpty = kTRUE;
888}
889
890
891//_____________________________________________________________________________
892//
893// TRootBrowserLite
894//
895// ROOT object browser (looking like Windows Explorer).
896//_____________________________________________________________________________
897
899
900////////////////////////////////////////////////////////////////////////////////
901/// Create browser with a specified width and height.
902
904 : TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
905{
907
908 Resize(width, height);
909 if (b) Show();
910}
911
912////////////////////////////////////////////////////////////////////////////////
913/// Create browser with a specified width and height and at position x, y.
914
916 UInt_t width, UInt_t height)
917 : TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
918{
920
921 MoveResize(x, y, width, height);
922 SetWMPosition(x, y);
923 if (b) Show();
924}
925
926////////////////////////////////////////////////////////////////////////////////
927/// Browser destructor.
928
930{
931 if (fIconPic) gClient->FreePicture(fIconPic);
932
933 delete fToolBarSep;
934
935 fToolBar->Cleanup();
936 delete fToolBar;
937 delete fStatusBar;
938 delete fV1;
939 delete fV2;
940 delete fLbl1;
941 delete fLbl2;
942 delete fHf;
943 delete fTreeHdr;
944 delete fListHdr;
945 delete fIconBox;
946 delete fListView;
947 delete fLt;
948 delete fTreeView;
949
950 delete fMenuBar;
951 delete fFileMenu;
952 delete fViewMenu;
953 delete fOptionMenu;
954 delete fHelpMenu;
955 delete fSortMenu;
956
957 delete fMenuBarLayout;
958 delete fMenuBarItemLayout;
959 delete fMenuBarHelpLayout;
960 delete fBarLayout;
961
962 delete fTextEdit;
963
964 if (fWidgets) fWidgets->Delete();
965 delete fWidgets;
966
967 fHistory->Delete();
968 delete fHistory;
969}
970
971////////////////////////////////////////////////////////////////////////////////
972/// Create the actual browser.
973
975{
976 fWidgets = new TList;
978 fHistoryCursor = 0;
980
981 // Create menus
983 fFileMenu->AddEntry("&New Browser", kFileNewBrowser);
984 fFileMenu->AddEntry("New Browser &Lite", kFileNewBrowserLite);
985 fFileMenu->AddEntry("New Canvas", kFileNewCanvas);
986 fFileMenu->AddEntry("&Gui Builder", kFileNewBuilder);
987 fFileMenu->AddEntry("&Open...", kFileOpen);
989 fFileMenu->AddEntry("&Save", kFileSave);
990 fFileMenu->AddEntry("Save &As...", kFileSaveAs);
992 fFileMenu->AddEntry("&Print...", kFilePrint);
994 fFileMenu->AddEntry("&Close Browser", kFileCloseBrowser);
996 fFileMenu->AddEntry("&Quit ROOT", kFileQuit);
997
998 //fFileMenu->DefaultEntry(kFileNewCanvas);
1002
1009 fSortMenu->AddEntry("&Auto Arrange", kViewArrangeAuto);
1010
1012
1014 fViewMenu->AddEntry("&Toolbar", kViewToolBar);
1015 fViewMenu->AddEntry("Status &Bar", kViewStatusBar);
1017 fViewMenu->AddEntry("Lar&ge Icons", kViewLargeIcons);
1018 fViewMenu->AddEntry("S&mall Icons", kViewSmallIcons);
1019 fViewMenu->AddEntry("&List", kViewList);
1020 fViewMenu->AddEntry("&Details", kViewDetails);
1022 fViewMenu->AddEntry("Show &Hidden", kViewHidden);
1023 fViewMenu->AddPopup("Arrange &Icons", fSortMenu);
1024 fViewMenu->AddEntry("Lin&e up Icons", kViewLineUp);
1025 fViewMenu->AddEntry("&Group Icons", kViewGroupLV);
1026
1028 fViewMenu->AddEntry("&Refresh (F5)", kViewRefresh);
1029
1032
1033 if (fBrowser) {
1034 if (gEnv->GetValue("Browser.ShowHidden", 0)) {
1037 } else {
1040 }
1041 }
1042
1044 fOptionMenu->AddEntry("&Show Cycles", kOptionShowCycles);
1045 fOptionMenu->AddEntry("&AutoThumbnail", kOptionAutoThumbnail);
1046
1048 fHelpMenu->AddEntry("&About ROOT...", kHelpAbout);
1050 fHelpMenu->AddEntry("Help On Browser...", kHelpOnBrowser);
1051 fHelpMenu->AddEntry("Help On Canvas...", kHelpOnCanvas);
1052 fHelpMenu->AddEntry("Help On Menus...", kHelpOnMenus);
1053 fHelpMenu->AddEntry("Help On Graphics Editor...", kHelpOnGraphicsEd);
1054 fHelpMenu->AddEntry("Help On Objects...", kHelpOnObjects);
1055 fHelpMenu->AddEntry("Help On PostScript...", kHelpOnPS);
1056 fHelpMenu->AddEntry("Help On Remote Session...", kHelpOnRemote);
1057
1058 // This main frame will process the menu commands
1059 fFileMenu->Associate(this);
1060 fViewMenu->Associate(this);
1061 fSortMenu->Associate(this);
1062 fOptionMenu->Associate(this);
1063 fHelpMenu->Associate(this);
1064
1065 // Create menubar layout hints
1069
1070 // Create menubar
1071 fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
1076
1078
1079 // Create toolbar and separator
1080
1081 fToolBarSep = new TGHorizontal3DLine(this);
1082 fToolBar = new TGToolBar(this, 60, 20, kHorizontalFrame);
1084
1088 fFSComboBox->Associate(this);
1089
1090 int spacing = 8;
1091
1092 for (int i = 0; gToolBarData[i].fPixmap; i++) {
1093 if (strlen(gToolBarData[i].fPixmap) == 0) {
1094 spacing = 8;
1095 continue;
1096 }
1097 fToolBar->AddButton(this, &gToolBarData[i], spacing);
1098 spacing = 0;
1099 }
1100
1101 fDrawOption = new TGComboBox(fToolBar, "");
1102 TGTextEntry *dropt_entry = fDrawOption->GetTextEntry();
1103 dropt_entry->SetToolTipText("Object Draw Option", 300);
1104 fDrawOption->Resize(80, 10);
1106 lb->Resize(lb->GetWidth(), 120);
1107 Int_t dropt = 1;
1108 fDrawOption->AddEntry("", dropt++);
1109 fDrawOption->AddEntry("same", dropt++);
1110 fDrawOption->AddEntry("box", dropt++);
1111 fDrawOption->AddEntry("lego", dropt++);
1112 fDrawOption->AddEntry("colz", dropt++);
1113 fDrawOption->AddEntry("alp", dropt++);
1114 fDrawOption->AddEntry("text", dropt++);
1115
1117 fToolBar->AddFrame(new TGLabel(fToolBar,"Option"),
1118 new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2,2,2,0));
1119
1123
1124 // Create panes
1125
1126 fHf = new TGHorizontalFrame(this, 10, 10);
1127
1128 fV1 = new TGVerticalFrame(fHf, 10, 10, kFixedWidth);
1129 fV2 = new TGVerticalFrame(fHf, 10, 10);
1130 fTreeHdr = new TGCompositeFrame(fV1, 10, 10, kSunkenFrame);
1131 fListHdr = new TGCompositeFrame(fV2, 10, 10, kSunkenFrame);
1132
1133 fLbl1 = new TGLabel(fTreeHdr, "All Folders");
1134 fLbl2 = new TGLabel(fListHdr, "Contents of \".\"");
1135
1136 TGLayoutHints *lo;
1137
1138 lo = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 0, 0);
1139 fWidgets->Add(lo);
1140 fTreeHdr->AddFrame(fLbl1, lo);
1141 fListHdr->AddFrame(fLbl2, lo);
1142
1143 lo = new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 1, 2);
1144 fWidgets->Add(lo);
1145 fV1->AddFrame(fTreeHdr, lo);
1146 fV2->AddFrame(fListHdr, lo);
1147
1149
1151 fWidgets->Add(lo);
1152 fHf->AddFrame(fV1, lo);
1153
1155 splitter->SetFrame(fV1, kTRUE);
1158 fWidgets->Add(lo);
1159 fHf->AddFrame(splitter, lo);
1160
1162 fWidgets->Add(lo);
1163 fHf->AddFrame(fV2, lo);
1164
1165 // Create tree
1166 fTreeView = new TGCanvas(fV1, 10, 10, kSunkenFrame | kDoubleBorder); // canvas
1168 fLt->Associate(this);
1169 fLt->SetAutoTips();
1170
1174
1175 // Create list view (icon box)
1176 fListView = new TGListView(fV2, 520, 250); // canvas
1177 // container
1179 fIconBox->Associate(this);
1180 fListView->SetIncrements(1, 19); // set vertical scroll one line height at a time
1182
1183 TString str = gEnv->GetValue("Browser.AutoThumbnail", "yes");
1184 str.ToLower();
1185 fIconBox->fAutoThumbnail = (str == "yes") || atoi(str.Data());
1188
1189 str = gEnv->GetValue("Browser.GroupView", "10000");
1190 Int_t igv = atoi(str.Data());
1191
1192 if (igv>10) {
1194 fIconBox->SetGroupSize(igv);
1195 }
1196
1197 // reuse lo from "create tree"
1199
1200 AddFrame(fHf, lo);
1201
1202 // Statusbar
1203
1204 int parts[] = { 26, 74 };
1205 fStatusBar = new TGStatusBar(this, 60, 10);
1206 fStatusBar->SetParts(parts, 2);
1207 lo = new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 0, 0, 3, 0);
1208 AddFrame(fStatusBar, lo);
1209
1210 fTextEdit = 0;
1211
1212 // Misc
1213 TString bname(name);
1214 bname.Prepend("Old ");
1215 SetWindowName(bname.Data());
1216 SetIconName(bname.Data());
1217 fIconPic = SetIconPixmap("rootdb_s.xpm");
1218 SetClassHints("ROOT", "Browser");
1219
1220 SetWMSizeHints(600, 350, 10000, 10000, 2, 2);
1221
1222 fListLevel = 0;
1223 fTreeLock = kFALSE;
1224
1225 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Escape), 0, kTRUE);
1226 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_F5), 0, kTRUE);
1227 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Right), kKeyMod1Mask, kTRUE);
1228 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Left), kKeyMod1Mask, kTRUE);
1229 ClearHistory();
1231
1232 gVirtualX->SetDNDAware(fId, fDNDTypeList);
1233 MapSubwindows();
1234 SetDefaults();
1235 Resize();
1237
1238 printf("\n You are using the old ROOT browser! A new version is available. To use it:\n");
1239 printf(" Select the \"New Browser\" entry from the \"File\" menu in the browser, or change\n");
1240 printf(" \"Browser.Name:\" from \"TRootBrowserLite\" to \"TRootBrowser\" in system.rootrc\n\n");
1241
1242 Connect(fLt, "Checked(TObject*, Bool_t)", "TRootBrowserLite",
1243 this, "Checked(TObject *,Bool_t)");
1244}
1245
1246////////////////////////////////////////////////////////////////////////////////
1247/// handle keys
1248
1250{
1251 if (event->fType == kGKeyPress) {
1252 UInt_t keysym;
1253 char input[10];
1254 gVirtualX->LookupString(event, input, sizeof(input), keysym);
1255
1256 if (!event->fState && (EKeySym)keysym == kKey_F5) {
1257 Refresh(kTRUE);
1258 return kTRUE;
1259 }
1260 if (!event->fState && (EKeySym)keysym == kKey_Escape) {
1262 }
1263
1264 if (event->fState & kKeyMod1Mask) {
1265 switch ((EKeySym)keysym & ~0x20) {
1266 case kKey_Right:
1268 return kTRUE;
1269 case kKey_Left:
1271 return kTRUE;
1272 default:
1273 break;
1274 }
1275 }
1276 }
1278}
1279
1280////////////////////////////////////////////////////////////////////////////////
1281/// Add items to the browser. This function has to be called
1282/// by the Browse() member function of objects when they are
1283/// called by a browser. If check < 0 (default) no check box is drawn,
1284/// if 0 then unchecked checkbox is added, if 1 checked checkbox is added.
1285
1286void TRootBrowserLite::Add(TObject *obj, const char *name, Int_t check)
1287{
1288 if (!obj)
1289 return;
1290 if (obj->InheritsFrom("TObjectSpy"))
1291 return;
1292 if (!name) name = obj->GetName();
1293
1294 AddToBox(obj, name);
1295 if (check > -1) {
1296 TGFrameElement *el;
1297 TIter next(fIconBox->fList);
1298 if (!obj->IsFolder()) {
1299 while ((el = (TGFrameElement *) next())) {
1300 TGLVEntry *f = (TGLVEntry *) el->fFrame;
1301 if (f->GetUserData() == obj) {
1302 f->SetCheckedEntry(check);
1303 }
1304 }
1305 }
1306 }
1307
1308 // Don't show current dir and up dir links in the tree
1309 if (name[0] == '.' && ((name[1] == '\0') || (name[1] == '.' && name[2] == '\0')))
1310 return;
1311
1312 if (obj->IsFolder())
1313 AddToTree(obj, name, check);
1314}
1315
1316////////////////////////////////////////////////////////////////////////////////
1317/// Add a checkbox in the TGListTreeItem corresponding to obj
1318/// and a checkmark on TGLVEntry if check = kTRUE.
1319
1321{
1322 if (obj) {
1324 while (item) {
1325 fLt->SetCheckBox(item, kTRUE);
1326 fLt->CheckItem(item, check);
1327 item = fLt->FindItemByObj(item->GetNextSibling(), obj);
1328 }
1329 TGFrameElement *el;
1330 TIter next(fIconBox->fList);
1331 while ((el = (TGFrameElement *) next())) {
1332 TGLVEntry *f = (TGLVEntry *) el->fFrame;
1333 if (f->GetUserData() == obj) {
1334 f->SetCheckedEntry(check);
1335 }
1336 }
1337 }
1338}
1339
1340////////////////////////////////////////////////////////////////////////////////
1341/// Check / uncheck the TGListTreeItem corresponding to this
1342/// object and add a checkmark on TGLVEntry if check = kTRUE.
1343
1345{
1346 if (obj) {
1348 while (item) {
1349 fLt->CheckItem(item, check);
1350 item = fLt->FindItemByObj(item->GetNextSibling(), obj);
1351 TGFrameElement *el;
1352 TIter next(fIconBox->fList);
1353 if (!obj->IsFolder()) {
1354 while ((el = (TGFrameElement *) next())) {
1355 TGLVEntry *f = (TGLVEntry *) el->fFrame;
1356 if (f->GetUserData() == obj) {
1357 f->SetCheckedEntry(check);
1358 }
1359 }
1360 }
1361 }
1362 }
1363}
1364
1365////////////////////////////////////////////////////////////////////////////////
1366/// Remove checkbox from TGListTree and checkmark from TGListView.
1367
1369{
1370 if (obj) {
1372 while (item) {
1373 fLt->SetCheckBox(item, kFALSE);
1374 item = fLt->FindItemByObj(item->GetNextSibling(), obj);
1375 TGFrameElement *el;
1376 TIter next(fIconBox->fList);
1377 if (!obj->IsFolder()) {
1378 while ((el = (TGFrameElement *) next())) {
1379 TGLVEntry *f = (TGLVEntry *) el->fFrame;
1380 if (f->GetUserData() == obj) {
1381 f->SetCheckedEntry(kFALSE);
1382 }
1383 }
1384 }
1385 }
1386 }
1387}
1388
1389////////////////////////////////////////////////////////////////////////////////
1390/// Add items to the iconbox of the browser.
1391
1393{
1394 if (obj) {
1395 if (!name) name = obj->GetName() ? obj->GetName() : "NoName";
1396 //const char *titlePtr = obj->GetTitle() ? obj->GetTitle() : " ";
1397
1398 TClass *objClass = 0;
1399
1400 if (obj->IsA() == TKey::Class())
1401 objClass = TClass::GetClass(((TKey *)obj)->GetClassName());
1402 else if (obj->IsA() == TKeyMapFile::Class())
1403 objClass = TClass::GetClass(((TKeyMapFile *)obj)->GetTitle());
1404 else if (obj->InheritsFrom("TRemoteObject")) {
1405 // special case for remote object: get real object class
1406 TRemoteObject *robj = (TRemoteObject *)obj;
1407 if (!strcmp(robj->GetClassName(), "TKey"))
1408 objClass = TClass::GetClass(robj->GetKeyClassName());
1409 else
1410 objClass = TClass::GetClass(robj->GetClassName());
1411 }
1412 else
1413 objClass = obj->IsA();
1414
1415 fIconBox->AddObjItem(name, obj, objClass);
1416 }
1417}
1418
1419////////////////////////////////////////////////////////////////////////////////
1420/// Add items to the current TGListTree of the browser.
1421
1422void TRootBrowserLite::AddToTree(TObject *obj, const char *name, Int_t check)
1423{
1424 if (!obj)
1425 return;
1426 if (obj->InheritsFrom("TApplication"))
1427 fListLevel = 0;
1428 if (!fTreeLock) {
1429 if (!name) name = obj->GetName();
1430 if (name[0] == '.' && name[1] == '.')
1431 Info("AddToTree", "up one level %s", name);
1432 if(check > -1) {
1433 TGListTreeItem *item = fLt->AddItem(fListLevel, name, obj, 0, 0, kTRUE);
1434 if (item) fLt->CheckItem(item, (Bool_t)check);
1435 TString tip(obj->ClassName());
1436 if (obj->GetTitle()) {
1437 tip += " ";
1438 tip += obj->GetTitle();
1439 }
1440 fLt->SetToolTipItem(item, tip.Data());
1441 } else {
1442 // special case for remote object
1443 if (obj->InheritsFrom("TRemoteObject")) {
1444 // Nothing to do
1445 } else if (fListLevel) {
1446 // check also if one of its parents is a remote object
1448 while (top->GetParent()) {
1449 TObject *tobj = (TObject *) top->GetUserData();
1450 if (tobj && (tobj->InheritsFrom("TRemoteObject") ||
1451 tobj->InheritsFrom("TApplicationRemote"))) {
1452 break;
1453 }
1454 top = top->GetParent();
1455 }
1456 }
1457 // add the object only if not already in the list
1458 if ((!fLt->FindChildByName(fListLevel, name)) &&
1459 (!fLt->FindChildByData(fListLevel, obj))) {
1461 Long64_t bsize, fsize, objsize = 0;
1462 TString objinfo = obj->GetObjectInfo(1, 1);
1463 TString infos = obj->GetName();
1464 infos += "\n";
1465 infos += obj->GetTitle();
1466 if (!objinfo.IsNull() && !objinfo.BeginsWith("x=")) {
1467 objsize = objinfo.Atoll();
1468 if (objsize > 0) {
1469 infos += "\n";
1470 bsize = fsize = objsize;
1471 if (fsize > 1024) {
1472 fsize /= 1024;
1473 if (fsize > 1024) {
1474 // 3.7MB is more informative than just 3MB
1475 infos += TString::Format("Size: %lld.%lldM", fsize/1024,
1476 (fsize%1024)/103);
1477 } else {
1478 infos += TString::Format("Size: %lld.%lldK", bsize/1024,
1479 (bsize%1024)/103);
1480 }
1481 } else {
1482 infos += TString::Format("Size: %lld bytes", bsize);
1483 }
1484 }
1485 }
1486 if (it)
1487 it->SetTipText(infos.Data());
1488 }
1489 }
1490 }
1491}
1492
1493////////////////////////////////////////////////////////////////////////////////
1494/// Browse object. This, in turn, will trigger the calling of
1495/// TRootBrowserLite::Add() which will fill the IconBox and the tree.
1496/// Emits signal "BrowseObj(TObject*)".
1497
1499{
1501 Emit("BrowseObj(TObject*)", (Longptr_t)obj);
1502
1503 if (obj != gROOT) {
1504 if (!fLt->FindItemByObj(fLt->GetFirstItem(), obj)) {
1505 fListLevel = 0;
1506 Add(obj);
1509 if (obj->IsFolder())
1511 fLt->ClearViewPort();
1513 }
1514 }
1515
1516 if (obj->IsFolder()) fIconBox->RemoveAll();
1517 obj->Browse(fBrowser);
1518 if ((fListLevel && obj->IsFolder()) || (!fListLevel && (obj == gROOT))) {
1519 fIconBox->Refresh();
1520 }
1521
1522 if (fBrowser) {
1524 }
1526
1529}
1530
1531////////////////////////////////////////////////////////////////////////////////
1532/// add new draw option to the "history"
1533
1535{
1536 TString opt = GetDrawOption();
1539
1540 TIter next(lbc->GetList());
1541 TGFrameElement *el;
1542
1543 while ((el = (TGFrameElement *)next())) {
1544 TGTextLBEntry *lbe = (TGTextLBEntry *)el->fFrame;
1545 if (lbe->GetText()->GetString() == opt) {
1546 return;
1547 }
1548 }
1549
1551 fDrawOption->AddEntry(opt.Data(), nn);
1552 fDrawOption->Select(nn);
1553}
1554
1555////////////////////////////////////////////////////////////////////////////////
1556/// returns pointer to fIconBox object
1557
1559{
1560 return (TGFileContainer*)fIconBox;
1561}
1562
1563////////////////////////////////////////////////////////////////////////////////
1564/// Really delete the browser and the this GUI.
1565
1567{
1569 delete this;
1570}
1571
1572////////////////////////////////////////////////////////////////////////////////
1573/// In case window is closed via WM we get here.
1574
1576{
1577 DeleteWindow();
1578}
1579
1580////////////////////////////////////////////////////////////////////////////////
1581/// Display in statusbar total number of objects and number of
1582/// selected objects in IconBox.
1583
1585{
1586 char tmp[64];
1587 const char *fmt;
1588
1589 if (selected)
1590 fmt = "%d Object%s, %d selected.";
1591 else
1592 fmt = "%d Object%s.";
1593
1594 snprintf(tmp, 64, fmt, total, (total == 1) ? "" : "s", selected);
1595 fStatusBar->SetText(tmp, 0);
1596}
1597
1598////////////////////////////////////////////////////////////////////////////////
1599/// Display current directory in second label, fLbl2.
1600
1602{
1603 char *p, path[1024];
1604
1606 p = path;
1607 while (*p && *(p+1) == '/') ++p;
1608 if (!p[0])
1609 fLbl2->SetText(new TGString("Contents of \".\""));
1610 else
1611 fLbl2->SetText(new TGString(Form("Contents of \"%s\"", p)));
1612 fListHdr->Layout();
1613
1614 // Get full pathname for FS combobox (previously truncated to 12 levels deep)
1616 p = path;
1617 while (*p && *(p+1) == '/') ++p;
1618 fFSComboBox->Update(p);
1619
1620 if (fListLevel) {
1621 // disable/enable up level navigation
1623 TString dirname = gSystem->GetDirName(p);
1624
1626 Bool_t disableUp = dirname == "/";
1627
1628 // normal file directory
1629 if (disableUp && (obj) && (obj->IsA() == TSystemDirectory::Class())) {
1630 disableUp = strlen(p) == 1;
1631 }
1632 btn->SetState(disableUp ? kButtonDisabled : kButtonUp);
1634 }
1635}
1636
1637////////////////////////////////////////////////////////////////////////////////
1638/// Execute default action for selected object (action is specified
1639/// in the $HOME/.root.mimes or $ROOTSYS/etc/root.mimes file.
1640/// Emits signal "ExecuteDefaultAction(TObject*)".
1641
1643{
1644 TRootBrowserCursorSwitcher cursorSwitcher(fIconBox, fLt);
1645 char action[512];
1647 TVirtualPad *wasp = gPad ? (TVirtualPad*)gPad->GetCanvas() : 0;
1648 TFile *wasf = gFile;
1649
1650 // Special case for file system objects...
1651 if (obj->IsA() == TSystemFile::Class() ||
1652 obj->InheritsFrom("TRemoteObject")) {
1653 TString act;
1654 TString ext = obj->GetName();
1655
1656 if (fClient->GetMimeTypeList()->GetAction(obj->GetName(), action)) {
1657 act = action;
1658 act.ReplaceAll("%s", obj->GetName());
1659 gInterpreter->SaveGlobalsContext();
1660
1661 if (act[0] == '!') {
1662 act.Remove(0, 1);
1663 gSystem->Exec(act.Data());
1664 } else {
1665 // special case for remote object: remote process
1666 if (obj->InheritsFrom("TRemoteObject"))
1669 }
1670 Emit("ExecuteDefaultAction(TObject*)", (Longptr_t)obj);
1671 }
1672
1673 // special case for remote object: browse real object
1674 if (obj->InheritsFrom("TRemoteObject") && ext.EndsWith(".root")) {
1675 TRootBrowserCursorSwitcher cursorSwitcher2(fIconBox, fLt);
1677 gApplication->ProcessLine("((TApplicationServer *)gApplication)->BrowseFile(0);");
1678 Refresh();
1679 }
1680 ////////// new TFile was opened. Add it to the browser /////
1681 if (gFile && (wasf != gFile) && ext.EndsWith(".root")) {
1682 TGListTreeItem *itm = fLt->FindChildByData(0, gROOT->GetListOfFiles());
1683
1684 if (itm) {
1686 fListLevel = itm;
1689 itm = fLt->AddItem(fListLevel, gFile->GetName());
1690 itm->SetUserData(gFile);
1692 return;
1693 }
1694 }
1695
1696 // only valid for local text files
1697 if (!obj->InheritsFrom("TRemoteObject"))
1698 BrowseTextFile(obj->GetName());
1699
1700 /////////////// cache and change file's icon ///////////////////////
1701 TVirtualPad *nowp = gPad ? (TVirtualPad*)gPad->GetCanvas() : 0;
1702
1703 if (fIconBox->fAutoThumbnail && nowp && (nowp != wasp)) {
1704 TSystemFile *sf = (TSystemFile*)obj;
1705 const TGPicture *pic, *spic;
1706
1707 TString path;
1708 if (gSystem->IsAbsoluteFileName(sf->GetName())) {
1709 path = sf->GetName();
1710 } else {
1711 char *buf = gSystem->ConcatFileName(gSystem->WorkingDirectory(), sf->GetName());
1712 path = buf;
1713 delete [] buf;
1714 }
1715
1717
1718 if (!thumb) {
1719 TImage *img = TImage::Create();
1720 nowp->Modified();
1721 nowp->Update();
1722 img->FromPad(nowp);
1723
1724 if (!img->IsValid()) {
1725 return;
1726 }
1727
1728 static const UInt_t sz = 72;
1729 UInt_t w = sz;
1730 UInt_t h = sz;
1731
1732 auto imgw = img->GetWidth();
1733 auto imgh = img->GetHeight();
1734
1735 if (imgw > imgh) {
1736 h = (imgh*sz) / (imgw > 0 ? imgw : 1);
1737 } else {
1738 w = (imgw*sz) / (imgh > 0 ? imgh : 1);
1739 }
1740
1741 w = (w < 54) ? 54 : w;
1742 h = (h < 54) ? 54 : h;
1743
1744 img->Scale(w, h);
1745 img->Merge(img, "tint"); // contrasting
1746 img->DrawBox(0, 0, w, h, "#ffff00", 1); // yellow frame
1747
1748 pic = fClient->GetPicturePool()->GetPicture(path.Data(), img->GetPixmap(), 0);
1749 img->Scale(w/3, h/3);
1750 spic = fClient->GetPicturePool()->GetPicture(path.Data(), img->GetPixmap(), 0);
1751
1752 thumb = new TIconBoxThumb(path.Data(), spic, pic);
1753 fIconBox->fThumbnails->Add(thumb);
1754 delete img;
1755 }
1756 }
1757 return;
1758 }
1759
1760 // For other objects the default action is still hard coded in
1761 // their Browse() member function.
1762}
1763
1764////////////////////////////////////////////////////////////////////////////////
1765/// Handle menu and other command generated by the user.
1766
1768{
1769 TRootHelpDialog *hd;
1770 TRootBrowserCursorSwitcher *cursorSwitcher = 0;
1771 TDirectory *tdir = 0;
1772 TString cmd;
1773
1774 if (GET_SUBMSG(msg) != kCT_SELCHANGED) {
1775 cursorSwitcher = new TRootBrowserCursorSwitcher(fIconBox, fLt);
1776 }
1777
1778 TObject *obj;
1779 TGListTreeItem *item = 0;
1780
1781 gVirtualX->Update();
1782
1783 switch (GET_MSG(msg)) {
1784
1785 case kC_COMMAND:
1786
1787 switch (GET_SUBMSG(msg)) {
1788
1789 case kCM_BUTTON:
1790 // fallthrough
1791 case kCM_MENU:
1792
1793 switch ((ERootBrowserCommands)parm1) {
1794 // Handle File menu items...
1796 new TBrowser("Browser", "ROOT Object Browser");
1797 break;
1798 case kFileNewBrowser:
1799 gEnv->SetValue("Browser.Name", "TRootBrowser");
1800 new TBrowser();
1801 gEnv->SetValue("Browser.Name", "TRootBrowserLite");
1802 break;
1803 case kFileNewCanvas:
1804 gROOT->MakeDefCanvas();
1805 break;
1806 case kFileNewBuilder:
1808 break;
1809 case kFileOpen:
1810 {
1811 static TString dir(".");
1812 TGFileInfo fi;
1814 fi.SetIniDir(dir);
1815 new TGFileDialog(fClient->GetDefaultRoot(), this,
1816 kFDOpen,&fi);
1817 dir = fi.fIniDir;
1818 if (fi.fMultipleSelection && fi.fFileNamesList) {
1819 TObjString *el;
1820 TIter next(fi.fFileNamesList);
1821 while ((el = (TObjString *) next())) {
1822 new TFile(el->GetString(), "update");
1823 }
1824 }
1825 else if (fi.fFilename) {
1826 new TFile(fi.fFilename, "update");
1827 }
1828 }
1829 break;
1830 case kFileSave:
1831 case kFileSaveAs:
1832 break;
1833 case kFilePrint:
1834 break;
1835 case kFileCloseBrowser:
1837 break;
1838 case kFileQuit:
1840 break;
1841
1842 // Handle View menu items...
1843 case kViewToolBar:
1846 else
1847 ShowToolBar();
1848 break;
1849 case kViewStatusBar:
1852 else
1853 ShowStatusBar();
1854 break;
1855 case kViewLargeIcons:
1856 case kViewSmallIcons:
1857 case kViewList:
1858 case kViewDetails:
1859 SetViewMode((Int_t)parm1);
1860 break;
1861 case kViewHidden:
1865 } else {
1868 }
1869 Refresh(kTRUE);
1870 break;
1871 case kViewArrangeByName:
1872 case kViewArrangeByType:
1873 case kViewArrangeBySize:
1874 case kViewArrangeByDate:
1875 SetSortMode((Int_t)parm1);
1876 break;
1877 case kViewLineUp:
1878 break;
1879 case kViewRefresh:
1880 Refresh(kTRUE);
1881 break;
1882 case kViewGroupLV:
1885 TString gv = gEnv->GetValue("Browser.GroupView", "10000");
1886 Int_t igv = atoi(gv.Data());
1887
1888 if (igv > 10) {
1889 fIconBox->SetGroupSize(igv);
1890 }
1891 } else {
1893 fIconBox->SetGroupSize(10000000); // very large value
1894 }
1895 break;
1896
1897 // Handle Option menu items...
1898 case kOptionShowCycles:
1899 printf("Currently the browser always shows all cycles\n");
1900 break;
1901
1907 Refresh(kTRUE);
1908 } else {
1911 }
1912 break;
1913
1914 // Handle toolbar button...
1915 case kOneLevelUp:
1916 {
1917 if (fBrowseTextFile) {
1918 HideTextEdit();
1919 break;
1920 }
1921 if (!fListLevel || !fListLevel->IsActive()) break;
1922
1923 if (fListLevel && fIconBox->WasGrouped()) {
1924 if (fListLevel) {
1925 item = fListLevel->GetParent();
1926 if (item) fListLevel = item;
1927 obj = (TObject *) fListLevel->GetUserData();
1929 if (obj) BrowseObj(obj);
1930 }
1931
1933 break;
1934 }
1935 if (fListLevel) item = fListLevel->GetParent();
1936
1937
1938 if (item) {
1939 fListLevel = item;
1940 obj = (TObject *)fListLevel->GetUserData();
1943 if (obj) BrowseObj(obj);
1945 } else {
1946 obj = (TObject *)fListLevel->GetUserData();
1947 if (obj) ToSystemDirectory(gSystem->GetDirName(obj->GetTitle()));
1948 }
1949 break;
1950 }
1951
1952 // toolbar buttons
1953 case kHistoryBack:
1955 break;
1956 case kHistoryForw:
1958 break;
1959
1960 case kViewFind:
1961 Search();
1962 break;
1963
1964 // Handle Help menu items...
1965 case kHelpAbout:
1966 {
1967#ifdef R__UNIX
1968 TString rootx = TROOT::GetBinDir() + "/root -a &";
1969 gSystem->Exec(rootx);
1970#else
1971#ifdef WIN32
1973#else
1974 char str[32];
1975 sprintf(str, "About ROOT %s...", gROOT->GetVersion());
1976 hd = new TRootHelpDialog(this, str, 600, 400);
1977 hd->SetText(gHelpAbout);
1978 hd->Popup();
1979#endif
1980#endif
1981 }
1982 break;
1983 case kHelpOnCanvas:
1984 hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
1985 hd->SetText(gHelpCanvas);
1986 hd->Popup();
1987 break;
1988 case kHelpOnMenus:
1989 hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
1991 hd->Popup();
1992 break;
1993 case kHelpOnGraphicsEd:
1994 hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
1996 hd->Popup();
1997 break;
1998 case kHelpOnBrowser:
1999 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
2001 hd->Popup();
2002 break;
2003 case kHelpOnObjects:
2004 hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
2005 hd->SetText(gHelpObjects);
2006 hd->Popup();
2007 break;
2008 case kHelpOnPS:
2009 hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
2011 hd->Popup();
2012 break;
2013 case kHelpOnRemote:
2014 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
2015 hd->SetText(gHelpRemote);
2016 hd->Popup();
2017 break;
2018 default:
2019 break;
2020 }
2021 break;
2022 case kCM_COMBOBOX:
2023 if (parm1 == kFSComboBox) {
2025 if (e) {
2026 const char *dirname = e->GetPath()->GetString();
2027 item = fLt->FindItemByPathname(dirname);
2028 if (item) {
2029 fListLevel = item;
2033 } else {
2034 ToSystemDirectory(dirname);
2035 }
2036 }
2037 }
2038 break;
2039 default:
2040 break;
2041 }
2042
2043 break;
2044
2045 case kC_LISTTREE:
2046 switch (GET_SUBMSG(msg)) {
2047
2048 case kCT_ITEMCLICK:
2049 // tell coverity that parm1 is a Long_t, and not an enum (even
2050 // if we compare it with an enum value) and the meaning of
2051 // parm1 depends on GET_MSG(msg) and GET_SUBMSG(msg)
2052 // coverity[mixed_enums]
2053 if (((EMouseButton)parm1 == kButton1) ||
2054 ((EMouseButton)parm1 == kButton3)) {
2055 HideTextEdit();
2056 TGListTreeItem *item2;
2057 TObject *obj2 = 0;
2058 if ((item2 = fLt->GetSelected()) != 0 ) {
2059 ListTreeHighlight(item2);
2060 fStatusBar->SetText("", 1); // clear
2061 }
2062 if (item2 && parm1 == kButton3) {
2063 Int_t x = (Int_t)(parm2 & 0xffff);
2064 Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
2065 obj2 = (TObject *) item2->GetUserData();
2066 if (obj2) {
2067 if (obj2->InheritsFrom("TTree")) {
2068 // if a tree not attached to any directory (e.g. in a TFolder)
2069 // then attach it to the current directory (gDirectory)
2070 cmd = TString::Format("((TTree *)0x%zx)->GetDirectory();",
2071 (size_t)obj2);
2072 tdir = (TDirectory *)gROOT->ProcessLine(cmd.Data());
2073 if (!tdir) {
2074 cmd = TString::Format("((TTree *)0x%zx)->SetDirectory(gDirectory);",
2075 (size_t)obj2);
2076 gROOT->ProcessLine(cmd.Data());
2077 }
2078 }
2079 fBrowser->GetContextMenu()->Popup(x, y, obj2, fBrowser);
2080 }
2081 }
2084 fListView->Layout();
2085 }
2086 break;
2087
2088 case kCT_ITEMDBLCLICK:
2089 if (parm1 == kButton1) {
2090 if (fBrowseTextFile) {
2091 HideTextEdit();
2092 }
2093 if (fListLevel && fIconBox->WasGrouped()) {
2094 TObject *obj2;
2095 TGListTreeItem *item2;
2096
2097 if (fListLevel) {
2098 item2 = fListLevel->GetParent();
2099 if (item2) fListLevel = item2;
2100
2101 obj2 = (TObject *) fListLevel->GetUserData();
2103 if (obj2) {
2104 BrowseObj(obj2);
2105 }
2106 }
2107 break;
2108 }
2109 }
2110
2111 default:
2112 break;
2113 }
2114 break;
2115
2116 case kC_CONTAINER:
2117 switch (GET_SUBMSG(msg)) {
2118
2119 case kCT_ITEMCLICK:
2120 if (fIconBox->NumSelected() == 1) {
2121 // display title of selected object
2122 TGFileItem *item2;
2123 void *p = 0;
2124 if ((item2 = (TGFileItem *)fIconBox->GetNextSelected(&p)) != 0) {
2125 TObject *obj2 = (TObject *)item2->GetUserData();
2126
2127 TGListTreeItem *itm = 0;
2128 if (!fListLevel) itm = fLt->GetFirstItem();
2129 else itm = fListLevel->GetFirstChild();
2130 //Bool_t found = kFALSE;
2131
2132 while (itm) {
2133 if (itm->GetUserData() == obj2) break;
2134 itm = itm->GetNextSibling();
2135 }
2136
2137 if (itm) {
2138 if ((fListLevel && fListLevel->IsOpen()) || !fListLevel) {
2140 fLt->HighlightItem(itm);
2142 }
2143 }
2144
2145 if (obj2) fStatusBar->SetText(obj2->GetName(), 1);
2146 }
2147 }
2148 if (parm1 == kButton3) {
2149 // show context menu for selected object
2150 if (fIconBox->NumSelected() == 1) {
2151 void *p = 0;
2152 TGFileItem *item2;
2153 if ((item2 = (TGFileItem *) fIconBox->GetNextSelected(&p)) != 0) {
2154 Int_t x = (Int_t)(parm2 & 0xffff);
2155 Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
2156 TObject *obj2 = (TObject *)item2->GetUserData();
2157 if (obj2) {
2158 if (obj2->IsA() == TKey::Class()) {
2159 TKey *key = (TKey*)obj2;
2160 TClass *cl = TClass::GetClass(key->GetClassName());
2161 TString name = key->GetName();
2162 name += ";";
2163 name += key->GetCycle();
2164 //void *add = gROOT->FindObject((char *) name.Data());//key->GetName());
2165 void *add = gDirectory->FindObjectAny((char *) name.Data());
2166 if (cl->IsTObject()) {
2167 obj2 = (TObject*)add; // cl->DynamicCast(TObject::Class(),startadd);
2168 item2->SetUserData(obj2);
2169 } else {
2170 Error("ProcessMessage","do not support non TObject (like %s) yet",
2171 cl->GetName());
2172 break;
2173 }
2174 }
2175 if (obj2 && obj2->InheritsFrom("TTree")) {
2176 // if a tree not attached to any directory (e.g. in a TFolder)
2177 // then attach it to the current directory (gDirectory)
2178 cmd = TString::Format("((TTree *)0x%zx)->GetDirectory();",
2179 (size_t)obj2);
2180 tdir = (TDirectory *)gROOT->ProcessLine(cmd.Data());
2181 if (!tdir) {
2182 cmd = TString::Format("((TTree *)0x%zx)->SetDirectory(gDirectory);",
2183 (size_t)obj2);
2184 gROOT->ProcessLine(cmd.Data());
2185 }
2186 }
2187 fBrowser->GetContextMenu()->Popup(x, y, obj2, fBrowser);
2188 }
2189 }
2190 }
2191 }
2192 break;
2193 case kCT_ITEMDBLCLICK:
2194 if (parm1 == kButton1) {
2195 if (fIconBox->NumSelected() == 1) {
2196 void *p = 0;
2197 TGFileItem *item2;
2198 if ((item2 = (TGFileItem *) fIconBox->GetNextSelected(&p)) != 0) {
2199 TObject *obj2 = (TObject *)item2->GetUserData();
2200 if (obj2) {
2201 DoubleClicked(obj2);
2202 IconBoxAction(obj2);
2203 }
2204 delete cursorSwitcher;
2205 return kTRUE; //
2206 }
2207 }
2208 }
2209 break;
2210 case kCT_SELCHANGED:
2211 DisplayTotal((Int_t)parm1, (Int_t)parm2);
2212 break;
2213 default:
2214 break;
2215 }
2216
2217 break;
2218
2219 default:
2220 break;
2221 }
2222
2223 delete cursorSwitcher;
2224
2226 return kTRUE;
2227}
2228
2229////////////////////////////////////////////////////////////////////////////////
2230/// Make object associated with item the current directory.
2231
2233{
2234 if (item) {
2235 TGListTreeItem *i = item;
2236 TString dir;
2237 while (i) {
2238 TObject *obj = (TObject*) i->GetUserData();
2239 if (obj) {
2240 if (obj->IsA() == TDirectoryFile::Class()) {
2241 dir = "/" + dir;
2242 dir = obj->GetName() + dir;
2243 }
2244 if (obj->IsA() == TFile::Class()) {
2245 dir = ":/" + dir;
2246 dir = obj->GetName() + dir;
2247 }
2248 if (obj->IsA() == TKey::Class()) {
2249 if (strcmp(((TKey*)obj)->GetClassName(), "TDirectoryFile") == 0) {
2250 dir = "/" + dir;
2251 dir = obj->GetName() + dir;
2252 }
2253 }
2254 }
2255 i = i->GetParent();
2256 }
2257
2258 if (gDirectory && dir.Length()) gDirectory->cd(dir.Data());
2259 }
2260}
2261
2262////////////////////////////////////////////////////////////////////////////////
2263/// helper method to track history
2264
2266{
2267 if (!fListLevel) return;
2268
2271}
2272
2273////////////////////////////////////////////////////////////////////////////////
2274/// helper method to track history
2275
2277{
2280
2281 if (!item || (fHistoryCursor &&
2282 (item == ((TRootBrowserHistoryCursor*)fHistoryCursor)->fItem))) return;
2283
2285 fHistory->Remove(cur);
2286 delete cur;
2287 }
2288
2289 cur = new TRootBrowserHistoryCursor(item);
2290 fHistory->Add(cur);
2291 fHistoryCursor = cur;
2292 btn->SetState(kButtonUp);
2293}
2294
2295////////////////////////////////////////////////////////////////////////////////
2296/// clear navigation history
2297
2299{
2300 fHistory->Delete();
2305}
2306
2307////////////////////////////////////////////////////////////////////////////////
2308/// go to the past
2309
2311{
2312 if (fBrowseTextFile) {
2313 HideTextEdit();
2314 return kFALSE;
2315 }
2319
2320 if (!cur) {
2322 return kFALSE;
2323 }
2324
2326 fHistoryCursor = cur;
2327 fListLevel = cur->fItem;
2331
2332 btn2->SetState(kButtonUp);
2334 if (!cur) {
2336 return kFALSE;
2337 }
2338
2339 return kTRUE;
2340}
2341
2342////////////////////////////////////////////////////////////////////////////////
2343/// go to the future
2344
2346{
2347 if (fBrowseTextFile) {
2348 HideTextEdit();
2349 return kFALSE;
2350 }
2351
2355
2356 if (!cur) {
2358 return kFALSE;
2359 }
2360
2362 fHistoryCursor = cur;
2363 fListLevel = cur->fItem;
2367
2368 btn2->SetState(kButtonUp);
2369
2371 if (!cur) {
2373 return kFALSE;
2374 }
2375
2376 return kTRUE;
2377}
2378
2379////////////////////////////////////////////////////////////////////////////////
2380/// delete list tree item, remove it from history
2381
2383{
2384 ((TRootBrowserHistory*)fHistory)->DeleteItem(item);
2385 fLt->DeleteItem(item);
2386}
2387
2388////////////////////////////////////////////////////////////////////////////////
2389/// Open tree item and list in iconbox its contents.
2390
2392{
2393 if (item) {
2394 TObject *obj = (TObject *) item->GetUserData();
2395
2396 if (obj) {
2397 if (obj->IsA() == TKey::Class()) {
2398
2399 TKey *key = (TKey *)obj;
2400 TString name = obj->GetName();
2401 name += ";";
2402 name += key->GetCycle();
2403 Chdir(item->GetParent());
2404 //TObject *k_obj = gROOT->FindObject(name);
2405 TObject *k_obj = gDirectory->FindObjectAny(name);
2406
2407 if (k_obj) {
2408 item->SetUserData(k_obj);
2409 obj = k_obj;
2410 }
2411 } else if (obj->InheritsFrom(TDirectoryFile::Class())) {
2412 Chdir(item->GetParent());
2413 }
2414 else if (obj->InheritsFrom("TApplicationRemote")) {
2415 if (!gApplication->GetAppRemote()) {
2416 gROOT->ProcessLine(Form(".R %s", item->GetText()));
2417 if (gApplication->GetAppRemote()) {
2418 Getlinem(kInit, TString::Format("\n%s:root [0]",
2420 }
2421 }
2422 }
2423 else if (obj->InheritsFrom("TRemoteObject")) {
2424 // special case for remote object
2425 TRemoteObject *robj = (TRemoteObject *)obj;
2426 // the real object is a TKey
2427 if (!strcmp(robj->GetClassName(), "TKey")) {
2428 TGListTreeItem *parent = item;
2429 TRemoteObject *probj = (TRemoteObject *)parent->GetUserData();
2430 // find the TFile remote object containing the TKey
2431 while ( probj && strcmp(probj->GetClassName(), "TFile")) {
2432 parent = parent->GetParent();
2433 probj = (TRemoteObject *)parent->GetUserData();
2434 }
2435 if (probj) {
2436 // remotely browse file (remotely call TFile::cd())
2439 TString::Format("((TApplicationServer *)gApplication)->BrowseFile(\"%s\");",
2440 probj->GetName()));
2441 }
2442 }
2443 }
2444 if (item->GetParent() && item->GetParent()->GetUserData() &&
2445 ((TObject *)item->GetParent()->GetUserData())->InheritsFrom("TApplicationRemote")) {
2446 // switch to remote session
2447 if (!gApplication->GetAppRemote()) {
2448 gROOT->ProcessLine(Form(".R %s", item->GetParent()->GetText()));
2449 if (gApplication->GetAppRemote()) {
2450 Getlinem(kInit, TString::Format("\n%s:root [0]",
2452 }
2453 }
2454 else if (!strcmp(item->GetText(), "ROOT Files")) {
2455 // update list of files opened in the remote session
2457 gApplication->ProcessLine("((TApplicationServer *)gApplication)->BrowseFile(0);");
2458 }
2459 }
2460 else {
2461 // check if the listtree item is from a local session or
2462 // from a remote session, then switch to the session it belongs to
2463 TGListTreeItem *top = item;
2464 while (top->GetParent()) {
2465 top = top->GetParent();
2466 }
2467 TObject *topobj = (TObject *) top->GetUserData();
2468 if (topobj && topobj->InheritsFrom("TApplicationRemote")) {
2469 // it belongs to a remote session
2470 if (!gApplication->GetAppRemote()) {
2471 // switch to remote session if not already in
2472 gROOT->ProcessLine(Form(".R %s", top->GetText()));
2473 if (gApplication->GetAppRemote()) {
2474 Getlinem(kInit, TString::Format("\n%s:root [0]",
2476 }
2477 }
2478 }
2479 else if (gApplication->GetAppRemote()) {
2480 // switch back to local session if not already in
2482 Getlinem(kInit, "\nroot [0]");
2483 }
2484 }
2485
2486 if (!fListLevel || !fListLevel->IsActive()) {
2487 fListLevel = item;
2488 BrowseObj(obj);
2490 }
2491 }
2493 }
2494}
2495
2496////////////////////////////////////////////////////////////////////////////////
2497/// display directory
2498
2500{
2501 TString dir = dirname;
2502
2503 if (fListLevel) {
2505
2506 if (obj && (obj->IsA() == TSystemDirectory::Class())) {
2507 TObject* old = obj;
2508 fListLevel->Rename(dir.Data());
2509 obj = new TSystemDirectory(dir.Data(), dir.Data());
2510 while (fListLevel->GetFirstChild())
2513
2514 fListLevel->SetUserData(obj);
2515 gROOT->GetListOfBrowsables()->Remove(old);
2516 delete old;
2517 gROOT->GetListOfBrowsables()->Add(obj);
2518 fTreeLock = kTRUE;
2519 BrowseObj(obj);
2520 fTreeLock = kFALSE;
2521
2525 //gSystem->ChangeDirectory(dir.Data());
2526 fStatusBar->SetText(dir.Data(), 1);
2527 ClearHistory(); // clear browsing history
2528 }
2529 }
2530 return;
2531}
2532
2533////////////////////////////////////////////////////////////////////////////////
2534/// sets drawing option
2535
2537{
2538 fDrawOption->GetTextEntry()->SetText(option);
2539}
2540
2541////////////////////////////////////////////////////////////////////////////////
2542/// returns drawing option
2543
2545{
2546 return fDrawOption->GetTextEntry()->GetText();
2547}
2548////////////////////////////////////////////////////////////////////////////////
2549/// Emits signal when double clicking on icon.
2550
2552{
2553 Emit("DoubleClicked(TObject*)", (Longptr_t)obj);
2554}
2555
2556////////////////////////////////////////////////////////////////////////////////
2557/// Emits signal when double clicking on icon.
2558
2560{
2561 Longptr_t args[2];
2562
2563 args[0] = (Longptr_t)obj;
2564 args[1] = checked;
2565
2566 Emit("Checked(TObject*,Bool_t)", args);
2567}
2568
2569////////////////////////////////////////////////////////////////////////////////
2570/// Default action when double clicking on icon.
2571
2573{
2574 Bool_t browsable = kFALSE;
2575 if (obj) {
2576
2577 TRootBrowserCursorSwitcher cursorSwitcher(fIconBox, fLt);
2578
2579 Bool_t useLock = kTRUE;
2580
2581 if (obj->IsA()->GetMethodWithPrototype("Browse", "TBrowser*"))
2582 browsable = kTRUE;
2583
2584 if (obj->InheritsFrom("TLeaf")) {
2585 TObject *dir = (TObject *)gROOT->ProcessLine(Form("((%s *)0x%zx)->GetBranch()->GetDirectory();",
2586 obj->ClassName(), (size_t)obj));
2587 if (!dir) {
2588 browsable = kFALSE;
2589 }
2590 }
2591 if (obj->InheritsFrom("TBranchElement")) {
2592 TObject *dir = (TObject *)gROOT->ProcessLine(Form("((%s *)0x%zx)->GetDirectory();",
2593 obj->ClassName(), (size_t)obj));
2594 if (!dir) {
2595 browsable = kFALSE;
2596 }
2597 }
2598
2599 if (obj->InheritsFrom("TKey")) {
2600 TKey *key = dynamic_cast<TKey*>(obj);
2601 if (key && key->GetClassName() && (!strcmp(key->GetClassName(), "TFormula")))
2602 browsable = kFALSE;
2603 }
2604
2605 if (obj->IsA() == TSystemDirectory::Class()) {
2606 useLock = kFALSE;
2607
2608 TString t(obj->GetName());
2609 if (t == ".") goto out;
2610 if (t == "..") {
2611 if (fListLevel && fListLevel->GetParent()) {
2613 obj = (TObject*)fListLevel->GetUserData();
2614 if (fListLevel->GetParent()) {
2616 } else {
2617 obj = (TObject*)fListLevel->GetUserData();
2618 fListLevel = 0;
2619 }
2620 } else {
2621 TString dirname = gSystem->GetDirName(gSystem->pwd());
2622 ToSystemDirectory(dirname);
2623 return;
2624 }
2625 }
2626 }
2627
2628 if (obj && obj->IsFolder()) {
2630 TGListTreeItem *itm = nullptr;
2631
2632 if (fListLevel) {
2634 itm = fListLevel->GetFirstChild();
2635 } else {
2636 itm = fLt->GetFirstItem();
2637 }
2638
2639 while (itm && (itm->GetUserData() != obj)) {
2640 itm = itm->GetNextSibling();
2641 }
2642
2643 if (!itm && fListLevel) {
2644 // special case for remote objects
2645 Bool_t isRemote = kFALSE;
2646 if (obj->InheritsFrom("TRemoteObject"))
2647 isRemote = kTRUE;
2648 else if (fListLevel) {
2649 // check also if one of its parents is a remote object
2651 while (top->GetParent()) {
2652 TObject *tobj = (TObject *) top->GetUserData();
2653 if (tobj && (tobj->InheritsFrom("TRemoteObject") ||
2654 tobj->InheritsFrom("TApplicationRemote"))) {
2655 isRemote = kTRUE;
2656 break;
2657 }
2658 top = top->GetParent();
2659 }
2660 }
2661 if (isRemote) {
2662 // add the remote object only if not already in the list
2663 if ((!fLt->FindChildByName(fListLevel, obj->GetName())) &&
2664 (!fLt->FindChildByData(fListLevel, obj))) {
2665 itm = fLt->AddItem(fListLevel, obj->GetName());
2666 if (itm) itm->SetUserData(obj);
2667 }
2668 else {
2669 // set the current item to the one found in the list
2670 itm = fLt->FindChildByData(fListLevel, obj) ?
2673 }
2674 }
2675 else {
2676 itm = fLt->AddItem(fListLevel, obj->GetName());
2677 if (itm) itm->SetUserData(obj);
2678 }
2679 }
2680
2681 if (itm) {
2682 fListLevel = itm;
2684 TObject *kobj = (TObject *)itm->GetUserData();
2685
2686 if (kobj && kobj->IsA() == TKey::Class()) {
2688 //kobj = gROOT->FindObject(kobj->GetName());
2689 kobj = gDirectory->FindObjectAny(kobj->GetName());
2690
2691 if (kobj) {
2692 TGListTreeItem *parent = fListLevel->GetParent();
2694 TGListTreeItem *kitem = fLt->AddItem(parent, kobj->GetName(), kobj);
2695 if (kitem) {
2696 obj = kobj;
2697 useLock = kFALSE;
2698 kitem->SetUserData(kobj);
2699 fListLevel = kitem;
2700 } else
2701 fListLevel = parent;
2702 }
2703 }
2705 }
2706 }
2707
2708 if (browsable) {
2709 if (useLock) fTreeLock = kTRUE;
2710 Emit("BrowseObj(TObject*)", (Longptr_t)obj);
2711 if (obj) obj->Browse(fBrowser);
2712 if (useLock) fTreeLock = kFALSE;
2713 }
2714
2715out:
2716 if (obj && obj->IsA() != TSystemFile::Class()) {
2717 if (obj->IsFolder()) {
2718 fIconBox->Refresh();
2719 }
2720
2721 if (fBrowser) {
2723 }
2724
2727 }
2728 }
2729}
2730
2731////////////////////////////////////////////////////////////////////////////////
2732/// Recursively remove object from browser.
2733
2735{
2736 // don't delete fIconBox items here (it's status will be updated
2737 // via TBrowser::Refresh() which should be called once all objects have
2738 // been removed.
2739
2741 if (item == 0)
2742 return;
2743 if (fListLevel && (item == fListLevel)) {
2744 TGListTreeItem *parent = item->GetParent();
2745 if (parent) {
2746 fListLevel = parent;
2750 }
2751 else
2752 fListLevel = 0;
2753 }
2754 DeleteListTreeItem(item);
2755}
2756
2757////////////////////////////////////////////////////////////////////////////////
2758/// Refresh the browser contents.
2759
2761{
2762 Bool_t refresh = fBrowser && fBrowser->GetRefreshFlag();
2763
2764 if (fTextEdit && !gROOT->IsExecutingMacro() && force) {
2767 return;
2768 }
2769
2770 if ( (refresh || force) && !fIconBox->WasGrouped()
2772
2773 TRootBrowserCursorSwitcher cursorSwitcher(fIconBox, fLt);
2774 static UInt_t prev = 0;
2775 UInt_t curr = gROOT->GetListOfBrowsables()->GetSize();
2776 if (!prev) prev = curr;
2777
2778 if (prev != curr) { // refresh gROOT
2780 fListLevel = 0;
2782 fListLevel = sav;
2783 prev = curr;
2784 }
2785
2786 // Refresh the IconBox
2787 if (fListLevel) {
2789 if (obj) {
2790 fTreeLock = kTRUE;
2791 BrowseObj(obj);
2792 fTreeLock = kFALSE;
2793 }
2794 }
2795 }
2797}
2798
2799////////////////////////////////////////////////////////////////////////////////
2800/// Show or hide toolbar.
2801
2803{
2804 if (show) {
2808 } else {
2812 }
2813}
2814
2815////////////////////////////////////////////////////////////////////////////////
2816/// Show or hide statusbar.
2817
2819{
2820 if (show) {
2823 } else {
2826 }
2827}
2828
2829////////////////////////////////////////////////////////////////////////////////
2830/// Set defaults depending on settings in the user's .rootrc.
2831
2832void TRootBrowserLite::SetDefaults(const char *iconStyle, const char *sortBy)
2833{
2834 const char *opt;
2835
2836 // IconStyle: big, small, list, details
2837 if (iconStyle)
2838 opt = iconStyle;
2839 else
2840 opt = gEnv->GetValue("Browser.IconStyle", "small");
2841 if (!strcasecmp(opt, "big"))
2843 else if (!strcasecmp(opt, "small"))
2845 else if (!strcasecmp(opt, "list"))
2847 else if (!strcasecmp(opt, "details"))
2849 else
2851
2852 // SortBy: name, type, size, date
2853 if (sortBy)
2854 opt = sortBy;
2855 else
2856 opt = gEnv->GetValue("Browser.SortBy", "name");
2857 if (!strcasecmp(opt, "name"))
2859 else if (!strcasecmp(opt, "type"))
2861 else if (!strcasecmp(opt, "size"))
2863 else if (!strcasecmp(opt, "date"))
2865 else
2867
2868 fIconBox->Refresh();
2869}
2870
2871////////////////////////////////////////////////////////////////////////////////
2872/// Set iconbox's view mode and update menu and toolbar buttons accordingly.
2873
2875{
2876 int i, bnum;
2878
2879 if (force || (fViewMode != new_mode)) {
2880
2881 switch (new_mode) {
2882 default:
2883 if (!force)
2884 return;
2885 else
2886 new_mode = kViewLargeIcons;
2887 // intentionally no break
2888 case kViewLargeIcons:
2889 bnum = 2;
2890 lv = kLVLargeIcons;
2891 break;
2892 case kViewSmallIcons:
2893 bnum = 3;
2894 lv = kLVSmallIcons;
2895 break;
2896 case kViewList:
2897 bnum = 4;
2898 lv = kLVList;
2899 break;
2900 case kViewDetails:
2901 bnum = 5;
2902 lv = kLVDetails;
2903 break;
2904 }
2905
2906 fViewMode = new_mode;
2908
2909 for (i = 2; i <= 5; ++i)
2910 gToolBarData[i].fButton->SetState((i == bnum) ? kButtonEngaged : kButtonUp);
2911
2914 if ((lv == kLVDetails) && (buttons)) {
2915 if (!strcmp(fListView->GetHeader(1), "Attributes")) {
2916 buttons[0]->Connect("Clicked()", "TRootBrowserLite", this,
2917 TString::Format("SetSortMode(=%d)", kViewArrangeByName));
2918 buttons[1]->Connect("Clicked()", "TRootBrowserLite", this,
2919 TString::Format("SetSortMode(=%d)", kViewArrangeByType));
2920 buttons[2]->Connect("Clicked()", "TRootBrowserLite", this,
2921 TString::Format("SetSortMode(=%d)", kViewArrangeBySize));
2922 buttons[5]->Connect("Clicked()", "TRootBrowserLite", this,
2923 TString::Format("SetSortMode(=%d)", kViewArrangeByDate));
2924 }
2925 }
2927 }
2928}
2929
2930////////////////////////////////////////////////////////////////////////////////
2931/// Set iconbox's sort mode and update menu radio buttons accordingly.
2932
2934{
2935 EFSSortMode smode;
2936
2937 switch (new_mode) {
2938 default:
2939 new_mode = kViewArrangeByName;
2940 // intentionally no break
2941 case kViewArrangeByName:
2942 smode = kSortByName;
2943 break;
2944 case kViewArrangeByType:
2945 smode = kSortByType;
2946 break;
2947 case kViewArrangeBySize:
2948 smode = kSortBySize;
2949 break;
2950 case kViewArrangeByDate:
2951 smode = kSortByDate;
2952 break;
2953 }
2954
2955 fSortMode = new_mode;
2957
2958 fIconBox->Sort(smode);
2959}
2960
2961////////////////////////////////////////////////////////////////////////////////
2962/// starts serach dialog
2963
2965{
2966 if (!fTextEdit) {
2968 } else {
2970 }
2971}
2972
2973////////////////////////////////////////////////////////////////////////////////
2974/// test
2975
2976static Bool_t isBinary(const char *str, int len)
2977{
2978 for (int i = 0; i < len; i++) {
2979 char c = str[i];
2980 if (((c < 32) || (c > 126)) && (c != '\t') && (c != '\r') && (c != '\n')) {
2981 return kTRUE;
2982 }
2983 }
2984 return kFALSE;
2985}
2986
2987////////////////////////////////////////////////////////////////////////////////
2988/// hide text edit
2989
2991{
2992 if (!fTextEdit) return;
2993
2999 savbtn->Disconnect();
3001 delete fTextEdit;
3002 fTextEdit = 0;
3004 fV2->MapSubwindows();
3005 fV2->Layout();
3007 fTextFileName = "";
3008}
3009
3010////////////////////////////////////////////////////////////////////////////////
3011/// browse text file
3012
3014{
3015 Bool_t loaded = (fTextEdit != 0);
3017 if (loaded) {
3019 }
3020 return;
3021 }
3022 const int bufferSize = 1024;
3023 char buffer[bufferSize];
3024
3025 FILE *fd = fopen(file, "rb");
3026 if (fd == 0) {
3027 if (loaded) {
3029 }
3030 return;
3031 }
3032 int sz = fread(buffer, 1, bufferSize, fd);
3033 fclose(fd);
3034
3035 if ((sz > 0) && isBinary(buffer, sz)) {
3036 if (loaded) {
3038 }
3039 return;
3040 }
3041
3042 if (!fTextEdit) {
3045 TColor *col = gROOT->GetColor(19);
3046 if (col)
3049 TGSearchDialog::SearchDialog()->Connect("TextEntered(char *)", "TGTextEdit",
3050 fTextEdit, "Search(char *,Bool_t,Bool_t)");
3051 }
3054 savbtn->Connect("Released()", "TGTextEdit", fTextEdit, "SaveFile(=0,kTRUE)");
3055 }
3058 if (loaded) return;
3059
3060 if (fTextFileName.EndsWith(".C")) {
3062 } else {
3064 }
3068 fV2->MapSubwindows();
3069 fV2->Layout();
3071
3072 if (fListLevel) {
3074 }
3076
3077 if (btn) {
3079 }
3080
3082
3083 if (btn2) {
3084 btn2->SetState(kButtonUp);
3085 }
3086}
3087
3088////////////////////////////////////////////////////////////////////////////////
3089/// executed browsed text macro
3090
3092{
3093 char *tmpfile = gSystem->ConcatFileName(gSystem->TempDirectory(),
3095
3096 gROOT->SetExecutingMacro(kTRUE);
3097 fTextEdit->SaveFile(tmpfile, kFALSE);
3098 gROOT->Macro(tmpfile);
3099 gSystem->Unlink(tmpfile);
3100 delete [] tmpfile;
3101 gROOT->SetExecutingMacro(kFALSE);
3102}
3103
3104////////////////////////////////////////////////////////////////////////////////
3105/// interrupt browsed macro execution
3106
3108{
3109 gROOT->SetInterrupt(kTRUE);
3110}
3111
3112////////////////////////////////////////////////////////////////////////////////
3113/// show/hide macro buttons
3114
3116{
3120
3121 static Bool_t connected = kFALSE;
3122
3123 if (!show) {
3124 bt1->UnmapWindow();
3125 bt2->UnmapWindow();
3126 bt3->UnmapWindow();
3127 } else {
3128 bt1->MapWindow();
3129 bt2->MapWindow();
3130 bt3->MapWindow();
3131
3132 if (!connected && fTextEdit) {
3133 bt1->Connect("Pressed()", "TRootBrowserLite", this, "ExecMacro()");
3134 bt2->Connect("Pressed()", "TRootBrowserLite", this, "InterruptMacro()");
3135 connected = kTRUE;
3136 }
3137 }
3138}
3139
3140////////////////////////////////////////////////////////////////////////////////
3141/// Set text in column col in status bar.
3142
3143void TRootBrowserLite::SetStatusText(const char *txt, Int_t col)
3144{
3146 TGStatusBar* status = GetStatusBar();
3147 if (status!=0) {
3148 status->SetText(txt, col);
3149 }
3150}
3151
3152////////////////////////////////////////////////////////////////////////////////
3153/// Interface method to the old browser.
3154
3156 UInt_t width, UInt_t height,
3157 Option_t * /*opt*/)
3158{
3159 TRootBrowserLite *browser = new TRootBrowserLite(b, title, width, height);
3160 return (TBrowserImp *)browser;
3161}
3162
3163////////////////////////////////////////////////////////////////////////////////
3164/// Interface method to the old browser.
3165
3167 Int_t y, UInt_t width, UInt_t height,
3168 Option_t * /*opt*/)
3169{
3170 TRootBrowserLite *browser = new TRootBrowserLite(b, title, x, y, width, height);
3171 return (TBrowserImp *)browser;
3172}
@ kGKeyPress
Definition GuiTypes.h:60
const Mask_t kKeyMod1Mask
typically the Alt key
Definition GuiTypes.h:198
@ kSunkenFrame
Definition GuiTypes.h:383
@ kDoubleBorder
Definition GuiTypes.h:385
@ kFixedWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:382
Handle_t Atom_t
WM token.
Definition GuiTypes.h:37
@ kWatch
Definition GuiTypes.h:375
@ kPointer
Definition GuiTypes.h:375
EMouseButton
Button names.
Definition GuiTypes.h:214
@ kButton3
Definition GuiTypes.h:214
@ kButton1
Definition GuiTypes.h:214
R__EXTERN const char gHelpObjects[]
Definition HelpText.h:26
R__EXTERN const char gHelpPullDownMenus[]
Definition HelpText.h:24
R__EXTERN const char gHelpRemote[]
Definition HelpText.h:28
R__EXTERN const char gHelpAbout[]
Definition HelpText.h:17
R__EXTERN const char gHelpGraphicsEditor[]
Definition HelpText.h:23
R__EXTERN const char gHelpCanvas[]
Definition HelpText.h:25
R__EXTERN const char gHelpBrowserLite[]
Definition HelpText.h:19
R__EXTERN const char gHelpPostscript[]
Definition HelpText.h:21
EKeySym
Definition KeySymbols.h:25
@ kKey_Right
Definition KeySymbols.h:42
@ kKey_F5
Definition KeySymbols.h:61
@ kKey_Left
Definition KeySymbols.h:40
@ kKey_Escape
Definition KeySymbols.h:26
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
#define e(i)
Definition RSha256.hxx:103
const Ssiz_t kNPOS
Definition RtypesCore.h:124
int Int_t
Definition RtypesCore.h:45
long Longptr_t
Definition RtypesCore.h:82
const Bool_t kFALSE
Definition RtypesCore.h:101
unsigned long ULong_t
Definition RtypesCore.h:55
bool Bool_t
Definition RtypesCore.h:63
long long Long64_t
Definition RtypesCore.h:80
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
R__EXTERN TApplication * gApplication
#define gDirectory
Definition TDirectory.h:385
include TDocParser_001 C image html pict1_TDocParser_001 png width
R__EXTERN TEnv * gEnv
Definition TEnv.h:170
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:220
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:187
#define gFile
Definition TFile.h:345
@ kButtonDisabled
Definition TGButton.h:56
@ kButtonUp
Definition TGButton.h:53
@ kButtonEngaged
Definition TGButton.h:55
#define gClient
Definition TGClient.h:157
R__EXTERN TGDNDManager * gDNDManager
EFSSortMode
@ kSortByDate
@ kSortByName
@ kSortByType
@ kSortBySize
@ kFDOpen
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
EListViewMode
Definition TGListView.h:21
@ kLVDetails
Definition TGListView.h:25
@ kLVSmallIcons
Definition TGListView.h:23
@ kLVList
Definition TGListView.h:24
@ kLVLargeIcons
Definition TGListView.h:22
@ kTextLeft
Definition TGWidget.h:23
static unsigned int total
char name[80]
Definition TGX11.cxx:110
#define gInterpreter
#define gROOT
Definition TROOT.h:404
ERootBrowserCommands
@ kFSComboBox
@ kFilePrint
@ kHistoryBack
@ kHelpOnCanvas
@ kViewArrangeByName
@ kViewArrangeAuto
@ kViewLineUp
@ kFileSaveAs
@ kViewLargeIcons
@ kViewRefresh
@ kFileQuit
@ kViewArrangeByDate
@ kFileCloseBrowser
@ kHelpOnGraphicsEd
@ kFileNewBrowser
@ kFileNewCanvas
@ kOptionAutoThumbnail
@ kViewSave
@ kViewInterrupt
@ kViewStatusBar
@ kViewToolBar
@ kViewArrangeByType
@ kHelpOnObjects
@ kViewExec
@ kFileNewBrowserLite
@ kHelpOnBrowser
@ kOneLevelUp
@ kHelpOnRemote
@ kViewHidden
@ kHelpOnMenus
@ kViewSmallIcons
@ kViewGroupLV
@ kHelpOnPS
@ kViewList
@ kFileNewBuilder
@ kViewFind
@ kOptionShowCycles
@ kViewDetails
@ kHistoryForw
@ kHelpAbout
@ kFileSave
@ kFileOpen
@ kViewArrangeBySize
static Bool_t isBinary(const char *str, int len)
test
static ToolBarData_t gToolBarData[]
static const char * gOpenTypes[]
char * Form(const char *fmt,...)
@ kReadPermission
Definition TSystem.h:47
R__EXTERN TSystem * gSystem
Definition TSystem.h:559
#define gPad
#define gVirtualX
Definition TVirtualX.h:338
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Int_t GET_MSG(Long_t val)
@ kCT_SELCHANGED
@ kCM_COMBOBOX
@ kCM_MENU
@ kCT_ITEMCLICK
@ kC_COMMAND
@ kCM_BUTTON
@ kC_LISTTREE
@ kCT_ITEMDBLCLICK
@ kC_CONTAINER
Int_t GET_SUBMSG(Long_t val)
#define snprintf
Definition civetweb.c:1540
virtual Longptr_t ProcessLine(const char *line, Bool_t sync=kFALSE, Int_t *error=0)
Process a single command line, either a C++ statement or an interpreter command starting with a "....
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
TApplication * GetAppRemote() const
virtual const char * ApplicationName() const
ABC describing GUI independent browser implementation protocol.
Definition TBrowserImp.h:29
TBrowser * fBrowser
TBrowser associated with this implementation.
Definition TBrowserImp.h:32
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
void SetDrawOption(Option_t *option="")
Set drawing option for object.
Definition TBrowser.h:105
void SetRefreshFlag(Bool_t flag)
Definition TBrowser.h:99
TContextMenu * GetContextMenu() const
Definition TBrowser.h:96
@ kNoHidden
Definition TBrowser.h:55
Bool_t GetRefreshFlag() const
Definition TBrowser.h:97
void SetBrowserImp(TBrowserImp *i)
Definition TBrowser.h:95
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
Definition TBufferFile.h:47
void WriteObject(const TObject *obj, Bool_t cacheReuse=kTRUE) override
Write object to I/O buffer.
@ kWrite
Definition TBuffer.h:73
Int_t Length() const
Definition TBuffer.h:100
char * Buffer() const
Definition TBuffer.h:96
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:80
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Definition TClass.cxx:5924
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition TClass.cxx:2966
virtual const char * GetName() const
Return name of this collection.
TString fName
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
The color creation and management class.
Definition TColor.h:19
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1822
ULong_t GetPixel() const
Return pixel value corresponding to this color.
Definition TColor.cxx:1493
virtual void Popup(Int_t x, Int_t y, TObject *obj, TVirtualPad *c=nullptr, TVirtualPad *p=nullptr)
Popup context menu at given location in canvas c and pad p for selected object.
Drag and drop data container.
Atom_t fDataType
Data type description.
Int_t fDataLength
Length of data.
void * fData
Actual data.
Describe directory structure in memory.
Definition TDirectory.h:45
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition TEnv.cxx:491
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
Set the value of a resource or create a new resource.
Definition TEnv.cxx:736
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition TFile.h:54
A button abstract base class.
Definition TGButton.h:68
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition TGButton.cxx:235
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition TGCanvas.h:192
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition TGClient.cxx:234
TGMimeTypes * GetMimeTypeList() const
Definition TGClient.h:146
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:372
TGPicturePool * GetPicturePool() const
Definition TGClient.h:126
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition TGComboBox.h:47
virtual TGLBEntry * GetSelectedEntry() const
Definition TGComboBox.h:115
virtual TGTextEntry * GetTextEntry() const
Definition TGComboBox.h:111
virtual void AddEntry(TGString *s, Int_t id)
Definition TGComboBox.h:86
virtual TGListBox * GetListBox() const
Definition TGComboBox.h:110
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
virtual Int_t GetNumberOfEntries() const
Definition TGComboBox.h:107
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
virtual TList * GetList() const
Definition TGFrame.h:310
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
virtual UInt_t GetDefaultWidth() const
Definition TGFrame.h:312
virtual void Layout()
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1204
TList * fList
container of frame elements
Definition TGFrame.h:292
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:314
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1022
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition TGFrame.cxx:1149
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1190
virtual void Associate(const TGWindow *w)
Definition TGCanvas.h:89
virtual void ClearViewPort()
Clear view port and redraw full content.
Definition TGCanvas.cxx:891
const TGWindow * fMsgWindow
window handling container messages
Definition TGCanvas.h:42
virtual TGFrameElement * FindFrame(Int_t x, Int_t y, Bool_t exclude=kTRUE)
Find frame located int container at position x,y.
virtual void AdjustPosition()
Move content to position of highlighted/activated frame.
virtual const TGFrame * GetNextSelected(void **current)
Return the next selected item.
Definition TGCanvas.cxx:681
virtual void Search(Bool_t close=kTRUE)
Invokes search dialog. Looks for item with the entered name.
Bool_t fLastDir
direction of last search
Definition TGCanvas.h:52
virtual Int_t NumSelected() const
Definition TGCanvas.h:104
virtual void SetVsbPosition(Int_t newPos)
Set position of vertical scrollbar.
Int_t fSelected
number of selected items
Definition TGCanvas.h:49
virtual void SetHsbPosition(Int_t newPos)
set new hor. position
TString fLastName
the name of object of last search
Definition TGCanvas.h:55
virtual void RemoveAll()
Remove all items from the container.
Definition TGCanvas.cxx:641
virtual Int_t NumItems() const
Definition TGCanvas.h:105
virtual void * FindItem(const TString &name, Bool_t direction=kTRUE, Bool_t caseSensitive=kTRUE, Bool_t subString=kFALSE)
Bool_t fLastCase
case sensitivity of last search
Definition TGCanvas.h:53
Int_t fTotal
total items
Definition TGCanvas.h:48
virtual TGPosition GetPagePosition() const
Returns page position.
Definition TGCanvas.cxx:737
TGFrameElement * fLastActiveEl
last active item
Definition TGCanvas.h:43
Bool_t IsDragging() const
Bool_t EndDrag()
End dragging.
This is a combo box that is used in the File Selection dialog box.
virtual void Update(const char *path)
Update file system combo box.
const TGPicture * fFolder_s
big folder icon
TViewUpdateTimer * fRefresh
refresh timer
void StopRefreshTimer()
stop refresh timer
const TGPicture * fDoc_t
small document icon
virtual void Sort(EFSSortMode sortType)
Sort file system list view container according to sortType.
const TGPicture * fDoc_s
big document icon
virtual TGFileItem * AddFile(const char *name, const TGPicture *pic=nullptr, const TGPicture *lpic=nullptr)
Add file in container.
virtual TGFileItem * AddRemoteFile(TObject *obj, const TGPicture *ipic=nullptr, const TGPicture *ilpic=nullptr)
Add remote file in container.
const TGPicture * fFolder_t
small folder icon
EFSSortMode fSortType
sorting mode of contents
This class creates a file selection dialog.
TList * fFileNamesList
list of selected file names
char * fFilename
selected file name
const char ** fFileTypes
file types used to filter selectable files
char * fIniDir
on input: initial directory, on output: new directory
Bool_t fMultipleSelection
if true, allow multiple file selection
void SetIniDir(const char *inidir)
Set directory name.
TBufferFile * fBuf
buffer used for Drag and Drop
void SetDNDData(TDNDData *data)
Set drag and drop data.
TGFrame * fFrame
Definition TGLayout.h:112
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:683
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:276
void SetDNDSource(Bool_t onoff)
Definition TGFrame.h:268
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition TGFrame.cxx:645
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition TGFrame.cxx:605
UInt_t GetHeight() const
Definition TGFrame.h:225
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition TGFrame.cxx:629
virtual void MapWindow()
map window
Definition TGFrame.h:204
static Pixel_t fgWhitePixel
Definition TGFrame.h:103
UInt_t GetWidth() const
Definition TGFrame.h:224
virtual void UnmapWindow()
unmap window
Definition TGFrame.h:206
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition TG3DLine.h:18
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:386
A Composite frame that contains a list of TGLBEnties.
Definition TGListBox.h:163
TGListView * fListView
listview which contains this container
Definition TGListView.h:190
virtual void ActivateItem(TGFrameElement *el)
Select/activate item.
virtual void AddItem(TGLVEntry *item)
Definition TGListView.h:207
EListViewMode GetViewMode() const
Definition TGListView.h:214
TGString ** fSubnames
sub names of item (details)
Definition TGListView.h:44
FontStruct_t fFontStruct
text font
Definition TGListView.h:59
void * GetUserData() const
Definition TGListView.h:95
Int_t * fCtw
width of sub names
Definition TGListView.h:47
void SetUserData(void *userData)
Definition TGListView.h:94
This class handles GUI labels.
Definition TGLabel.h:24
virtual void SetText(TGString *newText)
Set new text in label.
Definition TGLabel.cxx:180
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
A listbox is a box, possibly with scrollbar, containing entries.
Definition TGListBox.h:221
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
virtual TGFrame * GetContainer() const
Definition TGListBox.h:267
TGListTreeItem * GetFirstChild() const
Definition TGListTree.h:59
void Rename(const char *new_name)
Definition TGListTree.h:71
virtual Bool_t IsActive() const =0
virtual const char * GetText() const =0
TGListTreeItem * GetNextSibling() const
Definition TGListTree.h:62
TGListTreeItem * GetParent() const
Definition TGListTree.h:58
virtual void SetTipText(const char *)
Definition TGListTree.h:77
virtual Bool_t IsOpen() const
Definition TGListTree.h:64
virtual void * GetUserData() const =0
virtual void SetUserData(void *, Bool_t=kFALSE)
Definition TGListTree.h:79
A list tree is a widget that can contain a number of items arranged in a tree structure.
Definition TGListTree.h:195
TGListTreeItem * FindItemByObj(TGListTreeItem *item, void *ptr)
Find item with fUserData == ptr.
void ClearHighlighted()
Un highlight items.
void AddItem(TGListTreeItem *parent, TGListTreeItem *item)
Add given item to list tree.
void CheckItem(TGListTreeItem *item, Bool_t check=kTRUE)
Set check button state for the node 'item'.
void SetAutoTips(Bool_t on=kTRUE)
Definition TGListTree.h:351
void SetCheckBox(TGListTreeItem *item, Bool_t on=kTRUE)
Set check button state for the node 'item'.
void OpenItem(TGListTreeItem *item)
Open item in list tree (i.e. show child items).
TGListTreeItem * GetSelected() const
Definition TGListTree.h:382
Int_t RecursiveDeleteItem(TGListTreeItem *item, void *userData)
Delete item with fUserData == ptr.
Int_t DeleteItem(TGListTreeItem *item)
Delete item from list tree.
TGListTreeItem * GetFirstItem() const
Definition TGListTree.h:381
TGListTreeItem * FindChildByName(TGListTreeItem *item, const char *name)
Find child of item by name.
void AdjustPosition(TGListTreeItem *item)
Move content to position of item.
void HighlightItem(TGListTreeItem *item)
Highlight item.
TGListTreeItem * FindItemByPathname(const char *path)
Find item by pathname.
TGListTreeItem * FindChildByData(TGListTreeItem *item, void *userData)
Find child of item by userData.
void SetToolTipItem(TGListTreeItem *item, const char *string)
Set tooltip text for this item.
void GetPathnameFromItem(TGListTreeItem *item, char *path, Int_t depth=0)
Get pathname from item.
A list view is a widget that can contain a number of items arranged in a grid or list.
Definition TGListView.h:115
virtual void AdjustHeaders()
Definition TGListView.h:154
virtual void Layout()
Layout list view components (container and contents of container).
virtual void SetHeader(const char *s, Int_t hmode, Int_t cmode, Int_t idx)
Set header button idx [0-fNColumns>, hmode is the x text alignmode (ETextJustification) for the heade...
virtual void SetIncrements(Int_t hInc, Int_t vInc)
Set horizontal and vertical scrollbar increments.
EListViewMode GetViewMode() const
Definition TGListView.h:161
TGTextButton ** GetHeaderButtons()
Definition TGListView.h:159
virtual void SetViewMode(EListViewMode viewMode)
Set list view mode.
virtual void SetHeaders(Int_t ncolumns)
Set number of headers, i.e.
virtual void SetDefaultHeaders()
Default headers are: Name, Attributes, Size, Owner, Group, Modified.
virtual void LayoutHeader(TGFrame *head)
Layout list view components (container and contents of container).
virtual const char * GetHeader(Int_t idx) const
Returns name of header idx.
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:398
Atom_t * fDNDTypeList
handles DND types
Definition TGFrame.h:414
virtual void SendCloseMessage()
Send close message to self.
Definition TGFrame.cxx:1744
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition TGFrame.cxx:1856
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1801
virtual Bool_t HandleKey(Event_t *event)
Handle keyboard events.
Definition TGFrame.cxx:1606
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
Definition TGFrame.cxx:1879
void SetWMSizeHints(UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc)
Give the window manager minimum and maximum size hints.
Definition TGFrame.cxx:1904
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1788
const TGPicture * SetIconPixmap(const char *iconName)
Set window icon pixmap by name.
Definition TGFrame.cxx:1816
The TGMenu.h header contains all different menu classes.
Definition TGMenu.h:282
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=0)
Add popup menu to menu bar.
Definition TGMenu.cxx:418
void AddType(const char *type, const char *pat, const char *icon, const char *sicon, const char *action)
Add a mime type to the list of mime types.
const TGPicture * GetIcon(const char *filename, Bool_t small_icon)
Return icon belonging to mime type of filename.
Bool_t GetAction(const char *filename, char *action)
Return in action the mime action string belonging to filename.
TGClient * fClient
Connection to display server.
Definition TGObject.h:27
Handle_t GetId() const
Definition TGObject.h:37
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:26
const TGPicture * GetPicture(const char *name)
Get a picture from the picture pool.
Definition TGPicture.cxx:82
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
Pixmap_t GetPicture() const
Definition TGPicture.h:54
This class creates a popup menu object.
Definition TGMenu.h:110
virtual Bool_t IsEntryChecked(Int_t id)
Return true if menu item is checked.
Definition TGMenu.cxx:1845
virtual void AddPopup(TGHotString *s, TGPopupMenu *popup, TGMenuEntry *before=nullptr, const TGPicture *p=nullptr)
Add a (cascading) popup menu to a popup menu.
Definition TGMenu.cxx:1152
virtual void CheckEntry(Int_t id)
Check a menu entry (i.e. add a check mark in front of it).
Definition TGMenu.cxx:1782
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition TGMenu.cxx:1724
virtual void UnCheckEntry(Int_t id)
Uncheck menu entry (i.e. remove check mark).
Definition TGMenu.cxx:1807
virtual void Associate(const TGWindow *w)
Definition TGMenu.h:206
virtual void AddSeparator(TGMenuEntry *before=nullptr)
Add a menu separator to the menu.
Definition TGMenu.cxx:1060
virtual void RCheckEntry(Int_t id, Int_t IDfirst, Int_t IDlast)
Radio-select entry (note that they cannot be unselected, the selection must be moved to another entry...
Definition TGMenu.cxx:1860
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=nullptr, const TGPicture *p=nullptr, TGMenuEntry *before=nullptr)
Add a menu entry.
Definition TGMenu.cxx:990
Int_t fY
y position
Definition TGDimension.h:39
Int_t fX
x position
Definition TGDimension.h:38
static TGSearchDialog *& SearchDialog()
Return global search dialog.
Provides a StatusBar widget.
Definition TGStatusBar.h:21
virtual void SetText(TGString *text, Int_t partidx=0)
Set text in partition partidx in status bar.
virtual void SetParts(Int_t npart)
Divide the status bar in npart equal sized parts.
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition TGString.h:20
Int_t GetLength() const
Definition TGString.h:29
virtual void SetString(const char *s)
Definition TGString.h:31
const char * GetString() const
Definition TGString.h:30
Yield an action as soon as it is clicked.
Definition TGButton.h:142
A TGTextEdit is a specialization of TGTextView.
Definition TGTextEdit.h:22
virtual Bool_t SaveFile(const char *fname, Bool_t saveas=kFALSE)
Save file.
virtual Bool_t Search(const char *string, Bool_t direction=kTRUE, Bool_t caseSensitive=kFALSE)
Search for string in the specified direction.
A TGTextEntry is a one line text input widget.
Definition TGTextEntry.h:24
const char * GetText() const
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line.
Text string listbox entries.
Definition TGListBox.h:48
const TGString * GetText() const
Definition TGListBox.h:79
virtual Bool_t LoadFile(const char *fname, long startpos=0, long length=-1)
Load a file in the text view widget.
virtual void SetReadOnly(Bool_t on=kTRUE)
Definition TGTextView.h:117
A toolbar is a composite frame that contains TGPictureButtons.
Definition TGToolBar.h:33
virtual TGButton * AddButton(const TGWindow *w, ToolBarData_t *button, Int_t spacing=0)
Add button to toolbar.
Definition TGToolBar.cxx:92
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
virtual TGButton * GetButton(Int_t id) const
Finds and returns a pointer to the button with the specified identifier id.
A composite frame that layout their children in vertical way.
Definition TGFrame.h:375
virtual void SetBackgroundColor(Pixel_t)
Set background color of the canvas frame.
Definition TGView.cxx:590
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:72
ROOT GUI Window base class.
Definition TGWindow.h:23
@ kEditDisable
disable edit of this window
Definition TGWindow.h:50
virtual void DestroyWindow()
destroy window
Definition TGWindow.cxx:192
const TGWindow * GetParent() const
Definition TGWindow.h:76
static TGuiBuilder * Instance()
return an instance of TGuiBuilder object
THashTable implements a hash table to store TObject's.
Definition THashTable.h:35
void Add(TObject *obj)
Add object to the hash table.
TObject * FindObject(const char *name) const
Find object using its name.
void Delete(Option_t *option="")
Remove all objects from the table AND delete all heap based objects.
const TGPicture * fSmall
TIconBoxThumb(const char *name, const TGPicture *spic, const TGPicture *pic)
const TGPicture * fLarge
ULong_t Hash() const
Return hash value for this object.
const char * GetName() const
Returns name of object.
An abstract interface to image processing library.
Definition TImage.h:29
virtual void FromPad(TVirtualPad *, Int_t=0, Int_t=0, UInt_t=0, UInt_t=0)
Definition TImage.h:122
@ kXpm
Definition TImage.h:37
virtual UInt_t GetWidth() const
Definition TImage.h:228
virtual void DrawBox(Int_t, Int_t, Int_t, Int_t, const char *="#000000", UInt_t=1, Int_t=0)
Definition TImage.h:188
static TImage * Create()
Create an image.
Definition TImage.cxx:35
virtual Bool_t SetImageBuffer(char **, EImageFileTypes=TImage::kPng)
Definition TImage.h:242
virtual Bool_t IsValid() const
Definition TImage.h:230
virtual void Scale(UInt_t, UInt_t)
Definition TImage.h:141
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
Definition TImage.h:172
virtual Pixmap_t GetPixmap()
Definition TImage.h:235
virtual Pixmap_t GetMask()
Definition TImage.h:236
virtual UInt_t GetHeight() const
Definition TImage.h:229
Utility class for browsing TMapFile objects.
Definition TKeyMapFile.h:20
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition TKey.h:28
virtual const char * GetClassName() const
Definition TKey.h:76
Short_t GetCycle() const
Return cycle number associated to this key.
Definition TKey.cxx:577
A doubly linked list.
Definition TList.h:38
virtual void Add(TObject *obj)
Definition TList.h:81
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
Definition TList.cxx:330
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition TList.cxx:822
virtual TObjLink * FirstLink() const
Definition TList.h:102
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Definition TList.cxx:693
virtual TObject * Before(const TObject *obj) const
Returns the object before object obj.
Definition TList.cxx:371
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:470
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:659
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition TList.cxx:402
virtual const char * GetName() const
Returns name of object.
Definition TNamed.h:47
Collectable string class.
Definition TObjString.h:28
const TString & GetString() const
Definition TObjString.h:46
Mother of all ROOT objects.
Definition TObject.h:41
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition TObject.cxx:545
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:429
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
Definition TObject.cxx:191
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:201
virtual const char * GetIconName() const
Returns mime type name of object.
Definition TObject.cxx:439
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:200
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
Definition TObject.cxx:458
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:766
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:515
virtual const char * GetTitle() const
Returns title of object.
Definition TObject.cxx:473
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition TQObject.cxx:869
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
static const TString & GetBinDir()
Get the binary directory in the installation. Static utility function.
Definition TROOT.cxx:2917
The TRemoteObject class provides protocol for browsing ROOT objects from a remote ROOT session.
const char * GetClassName() const
const char * GetKeyClassName() const
TRootBrowserCursorSwitcher(TGWindow *w1, TGWindow *w2)
TRootBrowserHistoryCursor(TGListTreeItem *item)
void Print(Option_t *) const
This method must be overridden when a class wants to print itself.
void DeleteItem(TGListTreeItem *item)
void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
This class creates a ROOT object browser (looking like Windows Explorer).
TGCompositeFrame * fTreeHdr
TGPopupMenu * fOptionMenu
friend class TRootIconBox
Bool_t HistoryBackward()
go to the past
void SetStatusText(const char *txt, Int_t col) override
Set text in column col in status bar.
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Handle menu and other command generated by the user.
void SetViewMode(Int_t new_mode, Bool_t force=kFALSE)
Set iconbox's view mode and update menu and toolbar buttons accordingly.
void Refresh(Bool_t force=kFALSE) override
Refresh the browser contents.
TGLayoutHints * fMenuBarHelpLayout
void ListTreeHighlight(TGListTreeItem *item)
Open tree item and list in iconbox its contents.
TGFileContainer * GetIconBox() const
returns pointer to fIconBox object
void SetSortMode(Int_t new_mode)
Set iconbox's sort mode and update menu radio buttons accordingly.
void ClearHistory()
clear navigation history
TGListTreeItem * fListLevel
current TGListTree level
TGLayoutHints * fExpandLayout
void RecursiveRemove(TObject *obj) override
Recursively remove object from browser.
TGPopupMenu * fFileMenu
TGPopupMenu * fSortMenu
void BrowseTextFile(const char *file)
browse text file
Option_t * GetDrawOption() const override
returns drawing option
void ReallyDelete() override
Really delete the browser and the this GUI.
virtual void DoubleClicked(TObject *obj)
Emits signal when double clicking on icon.
TGLayoutHints * fComboLayout
void Chdir(TGListTreeItem *item)
Make object associated with item the current directory.
void ExecMacro()
executed browsed text macro
TGComboBox * fDrawOption
drawing option entry
virtual void ShowToolBar(Bool_t show=kTRUE)
Show or hide toolbar.
void HighlightListLevel()
helper method to track history
Bool_t HistoryForward()
go to the future
static TBrowserImp * NewBrowser(TBrowser *b=nullptr, const char *title="ROOT Browser", UInt_t width=800, UInt_t height=500, Option_t *opt="")
Interface method to the old browser.
TGLayoutHints * fMenuBarLayout
virtual void AddToTree(TObject *obj, const char *name, Int_t check=-1)
Add items to the current TGListTree of the browser.
TRootIconBox * fIconBox
const TGPicture * fIconPic
icon picture
void AddToHistory(TGListTreeItem *item)
helper method to track history
TGLayoutHints * fBarLayout
TGHorizontalFrame * fHf
void BrowseObj(TObject *obj) override
Browse object.
Bool_t fTreeLock
true when we want to lock TGListTree
void Show() override
virtual void Checked(TObject *obj, Bool_t check)
Emits signal when double clicking on icon.
void DisplayTotal(Int_t total, Int_t selected)
Display in statusbar total number of objects and number of selected objects in IconBox.
TGVerticalFrame * fV1
void CloseWindow() override
In case window is closed via WM we get here.
Int_t fSortMode
current IconBox sort mode
void IconBoxAction(TObject *obj)
Default action when double clicking on icon.
TGLayoutHints * fMenuBarItemLayout
void HideTextEdit()
hide text edit
TGStatusBar * GetStatusBar() const
TGVerticalFrame * fV2
void DisplayDirectory()
Display current directory in second label, fLbl2.
void ShowMacroButtons(Bool_t show=kTRUE)
show/hide macro buttons
virtual void AddToBox(TObject *obj, const char *name)
Add items to the iconbox of the browser.
virtual void ShowStatusBar(Bool_t show=kTRUE)
Show or hide statusbar.
TRootBrowserLite(const TRootBrowserLite &)=delete
void Search()
starts serach dialog
TGPopupMenu * fHelpMenu
TList * fHistory
history of browsing
TGListView * fListView
void CheckObjectItem(TObject *obj, Bool_t check=kFALSE) override
Check / uncheck the TGListTreeItem corresponding to this object and add a checkmark on TGLVEntry if c...
Bool_t HandleKey(Event_t *event) override
handle keys
TObject * fHistoryCursor
current history position
Int_t fViewMode
current IconBox view mode
virtual void SetDefaults(const char *iconStyle=nullptr, const char *sortBy=nullptr)
Set defaults depending on settings in the user's .rootrc.
TGFSComboBox * fFSComboBox
void InterruptMacro()
interrupt browsed macro execution
void SetDrawOption(Option_t *option="") override
sets drawing option
virtual ~TRootBrowserLite()
Browser destructor.
TGCompositeFrame * fListHdr
void UpdateDrawOption()
add new draw option to the "history"
TGTextEdit * fTextEdit
contents of browsed text file
TGStatusBar * fStatusBar
void CreateBrowser(const char *name)
Create the actual browser.
void ToSystemDirectory(const char *dirname)
display directory
TGPopupMenu * fViewMenu
void ExecuteDefaultAction(TObject *obj) override
Execute default action for selected object (action is specified in the $HOME/.root....
void AddCheckBox(TObject *obj, Bool_t check=kFALSE) override
Add a checkbox in the TGListTreeItem corresponding to obj and a checkmark on TGLVEntry if check = kTR...
void Add(TObject *obj, const char *name=nullptr, Int_t check=-1) override
Add items to the browser.
void DeleteListTreeItem(TGListTreeItem *item)
delete list tree item, remove it from history
TGHorizontal3DLine * fToolBarSep
void RemoveCheckBox(TObject *obj) override
Remove checkbox from TGListTree and checkmark from TGListView.
A TRootHelpDialog is used to display help text (or any text in a dialog window).
void SetText(const char *helpText)
Set help text from helpText buffer in TGTextView.
void Popup()
Show help dialog.
THashTable * fThumbnails
friend class TRootIconList
const TGPicture * fSmallCachedPic
virtual ~TRootIconBox()
destructor
TObject * fActiveObject
TGString * fCurrentName
void RemoveGarbage()
delete all TRootIconLists from garbage
void SetGroupSize(Int_t siz)
Bool_t WasGrouped() const
const TGPicture * fLargeCachedPic
void * FindItem(const TString &name, Bool_t direction=kTRUE, Bool_t caseSensitive=kTRUE, Bool_t beginWith=kFALSE)
Find a frame which assosiated object has a name containing a "name" string.
TGFrameElement * FindFrame(Int_t x, Int_t y, Bool_t exclude=kTRUE)
Find frame located int container at position x,y.
void AddObjItem(const char *name, TObject *obj, TClass *cl)
Add object to iconbox.
TRootIconBox(TRootBrowserLite *browser, TGListView *lv, UInt_t options=kSunkenFrame, ULong_t back=GetDefaultFrameBackground())
Create iconbox containing ROOT objects in browser.
Int_t GetGroupSize() const
TRootObjItem * fCurrentItem
void RemoveAll()
Remove all items from icon box.
void Refresh()
Sort icons, and send message to browser with number of objects in box.
void GetObjPictures(const TGPicture **pic, const TGPicture **spic, TObject *obj, const char *name)
Retrieve icons associated with class "name".
TRootIconList * fCurrentList
TRootBrowserLite * fBrowser
void SetObjHeaders()
Set list box headers used to display detailed object iformation.
TRootIconList(TRootIconBox *box=0)
constructor
TRootIconBox * fIconBox
void UpdateName()
composite name
virtual ~TRootIconList()
destructor
const TGPicture * fPic
const char * GetTitle() const
Returns title of object.
const TGPicture * GetPicture() const
void Browse(TBrowser *b)
browse icon list
Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
TRootObjItem(const TGWindow *p, const TGPicture *bpic, const TGPicture *spic, TGString *name, TObject *obj, TClass *cl, EListViewMode viewMode=kLVSmallIcons)
Create an icon box item.
virtual TDNDData * GetDNDData(Atom_t)
virtual Bool_t HandleDNDFinished()
Basic string class.
Definition TString.h:136
Ssiz_t Length() const
Definition TString.h:410
void ToLower()
Change string to lower-case.
Definition TString.cxx:1150
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition TString.cxx:2202
const char * Data() const
Definition TString.h:369
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:692
ECaseCompare
Definition TString.h:268
@ kIgnoreCase
Definition TString.h:268
@ kExact
Definition TString.h:268
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition TString.h:615
TString & Prepend(const char *cs)
Definition TString.h:661
Bool_t IsNull() const
Definition TString.h:407
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Definition TString.cxx:662
TString & Remove(Ssiz_t pos)
Definition TString.h:673
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2336
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:639
Long64_t Atoll() const
Return long long value of string.
Definition TString.cxx:1972
Describes an Operating System directory for the browser.
A TSystemFile describes an operating system file.
Definition TSystemFile.h:29
const char * pwd()
Definition TSystem.h:422
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Definition TSystem.cxx:1071
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition TSystem.cxx:656
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition TSystem.cxx:1296
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition TSystem.cxx:1063
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
Definition TSystem.cxx:952
virtual const char * WorkingDirectory()
Return working directory.
Definition TSystem.cxx:872
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
Definition TSystem.cxx:1032
virtual int Unlink(const char *name)
Unlink, i.e.
Definition TSystem.cxx:1381
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
Definition TSystem.cxx:1482
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
virtual void Modified(Bool_t flag=1)=0
virtual void Update()=0
virtual TCanvas * GetCanvas() const =0
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition fillpatterns.C:1
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Definition file.py:1
const char * fPicnamePrefix
const TGPicture * fIcon[2]
Event structure.
Definition GuiTypes.h:174
const char * fPixmap
Definition TGToolBar.h:24
auto * lv
Definition textalign.C:5
REAL splitter
Definition triangle.c:617