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 override { if (fItem) printf("%s\n", fItem->GetText()); }
188};
189
190
191////////////////////////////////////////////////////////////////////////////////////
193public:
194 void RecursiveRemove(TObject *obj) override
195 {
197 TIter next(this);
198
199 while ((cur = (TRootBrowserHistoryCursor*)next())) {
200 if (cur->fItem->GetUserData() == obj) {
201 Remove(cur);
202 delete cur;
203 }
204 }
205 }
206
209 TIter next(this);
210
211 while ((cur = (TRootBrowserHistoryCursor*)next())) {
212 if (cur->fItem == item) {
213 Remove(cur);
214 delete cur;
215 }
216 }
217 }
218};
219
220
221////////////////////////////////////////////////////////////////////////////////////
223private:
226public:
228 if (w1) gVirtualX->SetCursor(w1->GetId(), gVirtualX->CreateCursor(kWatch));
229 if (w2) gVirtualX->SetCursor(w2->GetId(), gVirtualX->CreateCursor(kWatch));
230 }
232 if (fW1) gVirtualX->SetCursor(fW1->GetId(), gVirtualX->CreateCursor(kPointer));
233 if (fW2) gVirtualX->SetCursor(fW2->GetId(), gVirtualX->CreateCursor(kPointer));
234 }
235};
236
237////////////////////////////////////////////////////////////////////////////////////
238class TIconBoxThumb : public TObject {
239public:
243
244 TIconBoxThumb(const char *name, const TGPicture *spic, const TGPicture *pic) {
245 fName = name;
246 fSmall = spic;
247 fLarge = pic;
248 }
249 ULong_t Hash() const override { return fName.Hash(); }
250 const char *GetName() const override { return fName.Data(); }
251};
252
253
254
255//----- Special ROOT object item (this are items in the icon box, see
256//----- TRootIconBox)
257////////////////////////////////////////////////////////////////////////////////////
258class TRootObjItem : public TGFileItem {
259public:
260 TRootObjItem(const TGWindow *p, const TGPicture *bpic,
261 const TGPicture *spic, TGString *name,
262 TObject *obj, TClass *cl, EListViewMode viewMode = kLVSmallIcons);
263
265 {
266 TObject *object = nullptr;
267 if (fObj->IsA() == TKey::Class())
268 object = ((TKey *)fObj)->ReadObj();
269 else
270 object = fObj;
271 if (object) {
273 fBuf->WriteObject(object);
276 }
277 fDNDData.fDataType = gVirtualX->InternAtom("application/root", kFALSE);
278 return &fDNDData;
279 }
280
282 {
283 if (GetParent())
284 return ((TGFrame *)GetParent())->HandleDNDFinished();
285 return kFALSE;
286 }
287
288protected:
291};
292
293////////////////////////////////////////////////////////////////////////////////
294/// Create an icon box item.
295
297 const TGPicture *spic, TGString *name,
298 TObject *obj, TClass *, EListViewMode viewMode) :
299 TGFileItem(p, bpic, 0, spic, 0, name, 0, 0, 0, 0, 0, viewMode)
300{
301 fObj = obj;
302 fDNDData.fData = 0;
304
305 if (fSubnames) {
306 for (Int_t i = 0; fSubnames[i] != 0; ++i) delete fSubnames[i];
307 }
308 delete [] fSubnames;
309 fSubnames = new TGString* [2];
310
311 fSubnames[0] = new TGString(obj->GetTitle());
312
313 fSubnames[1] = 0;
314
315 if (obj->IsA()->HasDefaultConstructor()) {
317 }
318 if ((obj->IsA() == TFolder::Class()) ||
319 (obj->IsA() == TClass::Class())) {
321 }
322
323 int i;
324 for (i = 0; fSubnames[i] != 0; ++i)
325 ;
326 fCtw = new int[i];
327 for (i = 0; fSubnames[i] != 0; ++i)
328 fCtw[i] = gVirtualX->TextWidth(fFontStruct, fSubnames[i]->GetString(),
329 fSubnames[i]->GetLength());
330}
331
332class TRootIconBox;
333////////////////////////////////////////////////////////////////////////////////////
334class TRootIconList : public TList {
335
336private:
337 TRootIconBox *fIconBox; // iconbox to which list belongs
338 const TGPicture *fPic; // list view icon
339
340public:
341 TRootIconList(TRootIconBox* box = nullptr);
342 ~TRootIconList() override;
343 void UpdateName();
344 const char *GetTitle() const override{ return "ListView Container"; }
345 Bool_t IsFolder() const override { return kFALSE; }
346 void Browse(TBrowser *b) override;
347 const TGPicture *GetPicture() const { return fPic; }
348};
349
350////////////////////////////////////////////////////////////////////////////////
351/// constructor
352
354{
355 fPic = gClient->GetPicture("listview.xpm");
356 fIconBox = box;
357 fName = "empty";
358}
359
360////////////////////////////////////////////////////////////////////////////////
361/// destructor
362
364{
365 gClient->FreePicture(fPic);
366}
367
368////////////////////////////////////////////////////////////////////////////////
369/// composite name
370
372{
373 if (!First()) return;
374
375 if (fSize==1) {
376 fName = First()->GetName();
377 return;
378 }
379
380 fName = First()->GetName();
381 fName += "-";
382 fName += Last()->GetName();
383}
384
385//----- Special ROOT object container (this is the icon box on the
386//----- right side of the browser)
387////////////////////////////////////////////////////////////////////////////////////
389friend class TRootIconList;
390friend class TRootBrowserLite;
391
392private:
393 Bool_t fCheckHeaders; // if true check headers
398 TList *fGarbage; // garbage for TRootIconList's
399 Int_t fGroupSize; // the total number of items when icon box switched to "global view" mode
406 THashTable *fThumbnails; // hash table with thumbnailed pictures
409
410 void *FindItem(const TString& name,
411 Bool_t direction = kTRUE,
412 Bool_t caseSensitive = kTRUE,
413 Bool_t beginWith = kFALSE) override;
414 void RemoveGarbage();
415
416public:
418 UInt_t options = kSunkenFrame,
420
421 ~TRootIconBox() override;
422
423 void AddObjItem(const char *name, TObject *obj, TClass *cl);
424 void GetObjPictures(const TGPicture **pic, const TGPicture **spic,
425 TObject *obj, const char *name);
426 void SetObjHeaders();
427 void Refresh();
428 void RemoveAll() override;
429 void SetGroupSize(Int_t siz) { fGroupSize = siz; }
430 Int_t GetGroupSize() const { return fGroupSize; }
431 TGFrameElement *FindFrame(Int_t x, Int_t y, Bool_t exclude=kTRUE) override { return TGContainer::FindFrame(x,y,exclude); }
432 Bool_t WasGrouped() const { return fWasGrouped; }
433};
434
435////////////////////////////////////////////////////////////////////////////////
436/// Create iconbox containing ROOT objects in browser.
437
439 ULong_t back) : TGFileContainer(lv, options, back)
440{
441 fListView = lv;
442 fBrowser = browser;
443
445 fTotal = 0;
446 fGarbage = new TList();
447 fCurrentList = 0;
448 fCurrentItem = 0;
450 fGroupSize = 1000;
451 fCurrentName = 0;
453 fActiveObject = 0;
454 fIsEmpty = kTRUE;
455 fLargeCachedPic = 0;
456 fSmallCachedPic = 0;
457
458 // Don't use timer HERE (timer is set in TBrowser).
460 fRefresh = 0;
461 fThumbnails = new THashTable(50);
463}
464
465////////////////////////////////////////////////////////////////////////////////
466/// destructor
467
469{
470 RemoveAll();
472 delete fGarbage;
473 delete fThumbnails;
474}
475
476////////////////////////////////////////////////////////////////////////////////
477/// Retrieve icons associated with class "name". Association is made
478/// via the user's ~/.root.mimes file or via $ROOTSYS/etc/root.mimes.
479
480void TRootIconBox::GetObjPictures(const TGPicture **pic, const TGPicture **spic,
481 TObject *obj, const char *name)
482{
483 static TImage *im = 0;
484 if (!im) {
485 im = TImage::Create();
486 }
487
488 TString xpm_magic(name, 3);
489 Bool_t xpm = xpm_magic == "/* ";
490 const char *iconname = xpm ? obj->GetName() : name;
491
492 if (obj->IsA()->InheritsFrom("TGeoVolume")) {
493 iconname = obj->GetIconName() ? obj->GetIconName() : obj->IsA()->GetName();
494 }
495
496 if (fCachedPicName == iconname) {
497 *pic = fLargeCachedPic;
498 *spic = fSmallCachedPic;
499 return;
500 }
501
502 *pic = fClient->GetMimeTypeList()->GetIcon(iconname, kFALSE);
503
504 if (!(*pic) && xpm) {
505 if (im && im->SetImageBuffer((char**)&name, TImage::kXpm)) {
506 *pic = fClient->GetPicturePool()->GetPicture(iconname, im->GetPixmap(),
507 im->GetMask());
508 im->Scale(im->GetWidth()/2, im->GetHeight()/2);
509 *spic = fClient->GetPicturePool()->GetPicture(iconname, im->GetPixmap(),
510 im->GetMask());
511 }
512
513 fClient->GetMimeTypeList()->AddType("[thumbnail]", iconname, iconname, iconname, "->Browse()");
514 return;
515 }
516
517 if (*pic == 0) {
518 if (obj->IsFolder()) {
519 *pic = fFolder_s;
520 } else {
521 *pic = fDoc_s;
522 }
523 }
524 fLargeCachedPic = *pic;
525
526 *spic = fClient->GetMimeTypeList()->GetIcon(iconname, kTRUE);
527
528 if (*spic == 0) {
529 if (obj->IsFolder())
530 *spic = fFolder_t;
531 else
532 *spic = fDoc_t;
533 }
534 fSmallCachedPic = *spic;
535 fCachedPicName = iconname;
536}
537
538////////////////////////////////////////////////////////////////////////////////
539/// delete all TRootIconLists from garbage
540
542{
543 TIter next(fGarbage);
544 TList *li;
545
546 while ((li=(TList *)next())) {
547 li->Clear("nodelete");
548 }
549 fGarbage->Delete();
550}
551
552////////////////////////////////////////////////////////////////////////////////
553/// Add object to iconbox. Class is used to get the associated icons
554/// via the mime file (see GetObjPictures()).
555
556void TRootIconBox::AddObjItem(const char *name, TObject *obj, TClass *cl)
557{
558 if (!cl) return;
559
560 Bool_t isSystemFile = kFALSE;
561 TGFileItem *fi;
563 const TGPicture *pic = 0;
564 const TGPicture *spic = 0;
565
566 if (obj->InheritsFrom("TRemoteObject")) {
567 // check if the real remote object is a system file or directory
568 TRemoteObject *robj = (TRemoteObject *)obj;
569 if ((TString(robj->GetClassName()) == "TSystemFile") ||
570 (TString(robj->GetClassName()) == "TSystemDirectory"))
571 isSystemFile = kTRUE;
572 }
573
574 if (isSystemFile || obj->IsA() == TSystemFile::Class() ||
575 obj->IsA() == TSystemDirectory::Class()) {
576 if (fCheckHeaders) {
577 if (strcmp(fListView->GetHeader(1), "Attributes")) {
580 if (buttons) {
581 buttons[0]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
582 TString::Format("SetSortMode(=%d)", kViewArrangeByName));
583 buttons[1]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
584 TString::Format("SetSortMode(=%d)", kViewArrangeByType));
585 buttons[2]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
586 TString::Format("SetSortMode(=%d)", kViewArrangeBySize));
587 buttons[5]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
588 TString::Format("SetSortMode(=%d)", kViewArrangeByDate));
589 }
590 }
592 }
593
594 TIconBoxThumb *thumb = 0;
595 char *thumbname = gSystem->ConcatFileName(gSystem->WorkingDirectory(), name);
597 thumbname);
598 delete []thumbname;
599
600 if (thumb) {
601 spic = thumb->fSmall;
602 pic = thumb->fLarge;
603 }
604
605 if (obj->InheritsFrom("TRemoteObject"))
606 // special case for remote object
607 fi = AddRemoteFile(obj, spic, pic);
608 else
609 fi = AddFile(name, spic, pic);
610 if (fi) {
611 fi->SetUserData(obj);
612 if (obj->IsA() == TSystemFile::Class()) {
613 TString str;
615 str = TString::Format("file://%s/%s\r\n",
617 obj->GetName());
618 data.fData = (void *)str.Data();
619 data.fDataLength = str.Length()+1;
620 data.fDataType = gVirtualX->InternAtom("text/uri-list", kFALSE);
621 fi->SetDNDData(&data);
622 fi->SetDNDSource(kTRUE);
623 }
624 }
625
627 return;
628 }
629
630 if (!fCurrentList) {
631 fCurrentList = new TRootIconList(this);
633 }
634
635 fCurrentList->Add(obj);
638
639 TGFrameElement *el;
640 TIter next(fList);
641 while ((el = (TGFrameElement *) next())) {
642 TGLVEntry *f = (TGLVEntry *) el->fFrame;
643 if (f->GetUserData() == obj) {
644 return;
645 }
646 }
647
648 if (fGrouped && fCurrentItem && (fCurrentList->GetSize()>1)) {
650 }
651
653
654 if ((fCurrentList->GetSize() < fGroupSize) && !fGrouped) {
655 GetObjPictures(&pic, &spic, obj, obj->GetIconName() ?
656 obj->GetIconName() : cl->GetName());
657
658 if (fCheckHeaders) {
659 if (strcmp(fListView->GetHeader(1), "Title")) {
661 }
663 }
664
665 fi = new TRootObjItem(this, pic, spic, new TGString(name), obj, cl, view);
666
667 fi->SetUserData(obj);
668 AddItem(fi);
669 return;
670 }
671
672 if (fGrouped && (fCurrentList->GetSize()==1)) {
678 fTotal = fList->GetSize();
679 return;
680 }
681
682 if ((fCurrentList->GetSize()==fGroupSize) && !fGrouped) {
683 fGrouped = kTRUE;
684
685 // clear fList
686 TGFrameElement *el2;
687 TIter nextl(fList);
688
689 while ((el2 = (TGFrameElement *) nextl())) {
690 el2->fFrame->DestroyWindow();
691 delete el2->fFrame;
692 fList->Remove(el2);
693 delete el2;
694 }
695
700 AddItem(fi);
701
702 fCurrentList = new TRootIconList(this);
704 fTotal = 1;
705 return;
706 }
707
709 fCurrentList = new TRootIconList(this);
711 return;
712 }
713}
714
715////////////////////////////////////////////////////////////////////////////////
716/// browse icon list
717
719{
720 if (!fIconBox) return;
721
722 TObject *obj;
723 TGFileItem *fi;
724 const TGPicture *pic = 0;
725 const TGPicture *spic = 0;
726 TClass *cl;
728 TKey *key = 0;
729
731 TObjLink *lnk = FirstLink();
732
733 while (lnk) {
734 obj = lnk->GetObject();
735 lnk = lnk->Next();
736
737 if (obj->IsA() == TKey::Class()) {
738 cl = TClass::GetClass(((TKey *)obj)->GetClassName());
739 key = (TKey *)obj;
740 } else if (obj->IsA() == TKeyMapFile::Class()) {
741 cl = TClass::GetClass(((TKeyMapFile *)obj)->GetTitle());
742 } else if (obj->InheritsFrom("TRemoteObject")) {
743 // special case for remote object: get real object class
744 TRemoteObject *robj = (TRemoteObject *)obj;
745 cl = TClass::GetClass(robj->GetClassName());
746 } else {
747 cl = obj->IsA();
748 }
749
750 name = obj->GetName();
751
752 if (key && obj->IsA() == TKey::Class()) {
753 name += ";";
754 name += key->GetCycle();
755 }
756
757 fIconBox->GetObjPictures(&pic, &spic, obj, obj->GetIconName() ?
758 obj->GetIconName() : cl->GetName());
759
760 fi = new TRootObjItem((const TGWindow*)fIconBox, pic, spic, new TGString(name.Data()),
761 obj, cl, (EListViewMode)fIconBox->GetViewMode());
762 fi->SetUserData(obj);
763 fIconBox->AddItem(fi);
764 fIconBox->fTotal++;
765
766 if (obj==fIconBox->fActiveObject) {
768 }
769 }
770
771 fIconBox->fGarbage->Remove(this);
773 fIconBox->fGarbage->Add(this); // delete this later
774
775 fIconBox->Refresh();
777
779}
780
781////////////////////////////////////////////////////////////////////////////////
782/// Find a frame which assosiated object has a name containing a "name" string.
783
785 Bool_t caseSensitive,Bool_t beginWith)
786{
787 if (!fGrouped) {
788 return TGContainer::FindItem(name, direction, caseSensitive, beginWith);
789 }
790
791 if (name.IsNull()) return 0;
792 int idx = kNPOS;
793
794 TGFrameElement* el = 0;
795 TString str;
797
798 fLastDir = direction;
799 fLastCase = caseSensitive;
800 fLastName = name;
801
802 if (fLastActiveEl) {
803 el = fLastActiveEl;
804
805 if (direction) {
806 el = (TGFrameElement *)fList->After(el);
807 } else {
808 el = (TGFrameElement *)fList->Before(el);
809 }
810 } else {
811 if (direction) el = (TGFrameElement *)fList->First();
812 else el = (TGFrameElement *)fList->Last();
813 }
814
815 TGLVEntry* lv = 0;
816 TObject* obj = 0;
817 TList* li = 0;
818
819 while (el) {
820 lv = (TGLVEntry*)el->fFrame;
821 li = (TList*)lv->GetUserData();
822
823 TIter next(li);
824
825 while ((obj=next())) {
826 str = obj->GetName();
827 idx = str.Index(name,0,cmp);
828
829 if (idx!=kNPOS) {
830 if (beginWith) {
831 if (idx==0) {
832 fActiveObject = obj;
833 return el;
834 }
835 } else {
836 fActiveObject = obj;
837 return el;
838 }
839 }
840 }
841 if (direction) {
842 el = (TGFrameElement *)fList->After(el);
843 } else {
844 el = (TGFrameElement *)fList->Before(el);
845 }
846 }
847 fActiveObject = 0;
848 return 0;
849}
850
851////////////////////////////////////////////////////////////////////////////////
852/// Set list box headers used to display detailed object iformation.
853/// Currently this is only "Name" and "Title".
854
856{
859 fListView->SetHeader("Title", kTextLeft, kTextLeft, 1);
860}
861
862////////////////////////////////////////////////////////////////////////////////
863/// Sort icons, and send message to browser with number of objects
864/// in box.
865
867{
868 // This automatically calls layout
870
871 // Make TRootBrowserLite display total objects in status bar
873
876}
877
878////////////////////////////////////////////////////////////////////////////////
879/// Remove all items from icon box
880
882{
883 if (fIsEmpty) return;
884
888 fCurrentItem = 0;
889 fCurrentList = 0;
890 fIsEmpty = kTRUE;
891}
892
893
894//_____________________________________________________________________________
895//
896// TRootBrowserLite
897//
898// ROOT object browser (looking like Windows Explorer).
899//_____________________________________________________________________________
900
902
903////////////////////////////////////////////////////////////////////////////////
904/// Create browser with a specified width and height.
905
907 : TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
908{
910
912 if (b) Show();
913}
914
915////////////////////////////////////////////////////////////////////////////////
916/// Create browser with a specified width and height and at position x, y.
917
920 : TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
921{
923
925 SetWMPosition(x, y);
926 if (b) Show();
927}
928
929////////////////////////////////////////////////////////////////////////////////
930/// Browser destructor.
931
933{
934 if (fIconPic) gClient->FreePicture(fIconPic);
935
936 delete fToolBarSep;
937
938 fToolBar->Cleanup();
939 delete fToolBar;
940 delete fStatusBar;
941 delete fV1;
942 delete fV2;
943 delete fLbl1;
944 delete fLbl2;
945 delete fHf;
946 delete fTreeHdr;
947 delete fListHdr;
948 delete fIconBox;
949 delete fListView;
950 delete fLt;
951 delete fTreeView;
952
953 delete fMenuBar;
954 delete fFileMenu;
955 delete fViewMenu;
956 delete fOptionMenu;
957 delete fHelpMenu;
958 delete fSortMenu;
959
960 delete fMenuBarLayout;
961 delete fMenuBarItemLayout;
962 delete fMenuBarHelpLayout;
963 delete fBarLayout;
964
965 delete fTextEdit;
966
967 if (fWidgets) fWidgets->Delete();
968 delete fWidgets;
969
970 fHistory->Delete();
971 delete fHistory;
972}
973
974////////////////////////////////////////////////////////////////////////////////
975/// Create the actual browser.
976
978{
979 fWidgets = new TList;
981 fHistoryCursor = 0;
983
984 // Create menus
986 fFileMenu->AddEntry("&New Browser", kFileNewBrowser);
987 fFileMenu->AddEntry("New Browser &Lite", kFileNewBrowserLite);
988 fFileMenu->AddEntry("New Canvas", kFileNewCanvas);
989 fFileMenu->AddEntry("&Gui Builder", kFileNewBuilder);
990 fFileMenu->AddEntry("&Open...", kFileOpen);
992 fFileMenu->AddEntry("&Save", kFileSave);
993 fFileMenu->AddEntry("Save &As...", kFileSaveAs);
995 fFileMenu->AddEntry("&Print...", kFilePrint);
997 fFileMenu->AddEntry("&Close Browser", kFileCloseBrowser);
999 fFileMenu->AddEntry("&Quit ROOT", kFileQuit);
1000
1001 //fFileMenu->DefaultEntry(kFileNewCanvas);
1005
1012 fSortMenu->AddEntry("&Auto Arrange", kViewArrangeAuto);
1013
1015
1017 fViewMenu->AddEntry("&Toolbar", kViewToolBar);
1018 fViewMenu->AddEntry("Status &Bar", kViewStatusBar);
1020 fViewMenu->AddEntry("Lar&ge Icons", kViewLargeIcons);
1021 fViewMenu->AddEntry("S&mall Icons", kViewSmallIcons);
1022 fViewMenu->AddEntry("&List", kViewList);
1023 fViewMenu->AddEntry("&Details", kViewDetails);
1025 fViewMenu->AddEntry("Show &Hidden", kViewHidden);
1026 fViewMenu->AddPopup("Arrange &Icons", fSortMenu);
1027 fViewMenu->AddEntry("Lin&e up Icons", kViewLineUp);
1028 fViewMenu->AddEntry("&Group Icons", kViewGroupLV);
1029
1031 fViewMenu->AddEntry("&Refresh (F5)", kViewRefresh);
1032
1035
1036 if (fBrowser) {
1037 if (gEnv->GetValue("Browser.ShowHidden", 0)) {
1040 } else {
1043 }
1044 }
1045
1047 fOptionMenu->AddEntry("&Show Cycles", kOptionShowCycles);
1048 fOptionMenu->AddEntry("&AutoThumbnail", kOptionAutoThumbnail);
1049
1051 fHelpMenu->AddEntry("&About ROOT...", kHelpAbout);
1053 fHelpMenu->AddEntry("Help On Browser...", kHelpOnBrowser);
1054 fHelpMenu->AddEntry("Help On Canvas...", kHelpOnCanvas);
1055 fHelpMenu->AddEntry("Help On Menus...", kHelpOnMenus);
1056 fHelpMenu->AddEntry("Help On Graphics Editor...", kHelpOnGraphicsEd);
1057 fHelpMenu->AddEntry("Help On Objects...", kHelpOnObjects);
1058 fHelpMenu->AddEntry("Help On PostScript...", kHelpOnPS);
1059 fHelpMenu->AddEntry("Help On Remote Session...", kHelpOnRemote);
1060
1061 // This main frame will process the menu commands
1062 fFileMenu->Associate(this);
1063 fViewMenu->Associate(this);
1064 fSortMenu->Associate(this);
1065 fOptionMenu->Associate(this);
1066 fHelpMenu->Associate(this);
1067
1068 // Create menubar layout hints
1072
1073 // Create menubar
1074 fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
1079
1081
1082 // Create toolbar and separator
1083
1084 fToolBarSep = new TGHorizontal3DLine(this);
1085 fToolBar = new TGToolBar(this, 60, 20, kHorizontalFrame);
1087
1091 fFSComboBox->Associate(this);
1092
1093 int spacing = 8;
1094
1095 for (int i = 0; gToolBarData[i].fPixmap; i++) {
1096 if (strlen(gToolBarData[i].fPixmap) == 0) {
1097 spacing = 8;
1098 continue;
1099 }
1100 fToolBar->AddButton(this, &gToolBarData[i], spacing);
1101 spacing = 0;
1102 }
1103
1104 fDrawOption = new TGComboBox(fToolBar, "");
1105 TGTextEntry *dropt_entry = fDrawOption->GetTextEntry();
1106 dropt_entry->SetToolTipText("Object Draw Option", 300);
1107 fDrawOption->Resize(80, 10);
1109 lb->Resize(lb->GetWidth(), 120);
1110 Int_t dropt = 1;
1111 fDrawOption->AddEntry("", dropt++);
1112 fDrawOption->AddEntry("same", dropt++);
1113 fDrawOption->AddEntry("box", dropt++);
1114 fDrawOption->AddEntry("lego", dropt++);
1115 fDrawOption->AddEntry("colz", dropt++);
1116 fDrawOption->AddEntry("alp", dropt++);
1117 fDrawOption->AddEntry("text", dropt++);
1118
1120 fToolBar->AddFrame(new TGLabel(fToolBar,"Option"),
1121 new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2,2,2,0));
1122
1126
1127 // Create panes
1128
1129 fHf = new TGHorizontalFrame(this, 10, 10);
1130
1131 fV1 = new TGVerticalFrame(fHf, 10, 10, kFixedWidth);
1132 fV2 = new TGVerticalFrame(fHf, 10, 10);
1133 fTreeHdr = new TGCompositeFrame(fV1, 10, 10, kSunkenFrame);
1134 fListHdr = new TGCompositeFrame(fV2, 10, 10, kSunkenFrame);
1135
1136 fLbl1 = new TGLabel(fTreeHdr, "All Folders");
1137 fLbl2 = new TGLabel(fListHdr, "Contents of \".\"");
1138
1139 TGLayoutHints *lo;
1140
1141 lo = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 0, 0);
1142 fWidgets->Add(lo);
1143 fTreeHdr->AddFrame(fLbl1, lo);
1144 fListHdr->AddFrame(fLbl2, lo);
1145
1146 lo = new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 1, 2);
1147 fWidgets->Add(lo);
1148 fV1->AddFrame(fTreeHdr, lo);
1149 fV2->AddFrame(fListHdr, lo);
1150
1152
1154 fWidgets->Add(lo);
1155 fHf->AddFrame(fV1, lo);
1156
1157 TGVSplitter *splitter = new TGVSplitter(fHf);
1158 splitter->SetFrame(fV1, kTRUE);
1160 fWidgets->Add(splitter);
1161 fWidgets->Add(lo);
1162 fHf->AddFrame(splitter, lo);
1163
1165 fWidgets->Add(lo);
1166 fHf->AddFrame(fV2, lo);
1167
1168 // Create tree
1169 fTreeView = new TGCanvas(fV1, 10, 10, kSunkenFrame | kDoubleBorder); // canvas
1171 fLt->Associate(this);
1172 fLt->SetAutoTips();
1173
1177
1178 // Create list view (icon box)
1179 fListView = new TGListView(fV2, 520, 250); // canvas
1180 // container
1182 fIconBox->Associate(this);
1183 fListView->SetIncrements(1, 19); // set vertical scroll one line height at a time
1185
1186 TString str = gEnv->GetValue("Browser.AutoThumbnail", "yes");
1187 str.ToLower();
1188 fIconBox->fAutoThumbnail = (str == "yes") || atoi(str.Data());
1191
1192 str = gEnv->GetValue("Browser.GroupView", "10000");
1193 Int_t igv = atoi(str.Data());
1194
1195 if (igv>10) {
1197 fIconBox->SetGroupSize(igv);
1198 }
1199
1200 // reuse lo from "create tree"
1202
1203 AddFrame(fHf, lo);
1204
1205 // Statusbar
1206
1207 int parts[] = { 26, 74 };
1208 fStatusBar = new TGStatusBar(this, 60, 10);
1209 fStatusBar->SetParts(parts, 2);
1210 lo = new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 0, 0, 3, 0);
1211 AddFrame(fStatusBar, lo);
1212
1213 fTextEdit = 0;
1214
1215 // Misc
1216 TString bname(name);
1217 bname.Prepend("Old ");
1218 SetWindowName(bname.Data());
1219 SetIconName(bname.Data());
1220 fIconPic = SetIconPixmap("rootdb_s.xpm");
1221 SetClassHints("ROOT", "Browser");
1222
1223 SetWMSizeHints(600, 350, 10000, 10000, 2, 2);
1224
1225 fListLevel = 0;
1226 fTreeLock = kFALSE;
1227
1228 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Escape), 0, kTRUE);
1229 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_F5), 0, kTRUE);
1230 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Right), kKeyMod1Mask, kTRUE);
1231 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Left), kKeyMod1Mask, kTRUE);
1232 ClearHistory();
1234
1235 gVirtualX->SetDNDAware(fId, fDNDTypeList);
1236 MapSubwindows();
1237 SetDefaults();
1238 Resize();
1240
1241 printf("\n You are using the old ROOT browser! A new version is available. To use it:\n");
1242 printf(" Select the \"New Browser\" entry from the \"File\" menu in the browser, or change\n");
1243 printf(" \"Browser.Name:\" from \"TRootBrowserLite\" to \"TRootBrowser\" in system.rootrc\n\n");
1244
1245 Connect(fLt, "Checked(TObject*, Bool_t)", "TRootBrowserLite",
1246 this, "Checked(TObject *,Bool_t)");
1247}
1248
1249////////////////////////////////////////////////////////////////////////////////
1250/// handle keys
1251
1253{
1254 if (event->fType == kGKeyPress) {
1255 UInt_t keysym;
1256 char input[10];
1257 gVirtualX->LookupString(event, input, sizeof(input), keysym);
1258
1259 if (!event->fState && (EKeySym)keysym == kKey_F5) {
1260 Refresh(kTRUE);
1261 return kTRUE;
1262 }
1263 if (!event->fState && (EKeySym)keysym == kKey_Escape) {
1265 }
1266
1267 if (event->fState & kKeyMod1Mask) {
1268 switch ((EKeySym)keysym & ~0x20) {
1269 case kKey_Right:
1271 return kTRUE;
1272 case kKey_Left:
1274 return kTRUE;
1275 default:
1276 break;
1277 }
1278 }
1279 }
1280 return TGMainFrame::HandleKey(event);
1281}
1282
1283////////////////////////////////////////////////////////////////////////////////
1284/// Add items to the browser. This function has to be called
1285/// by the Browse() member function of objects when they are
1286/// called by a browser. If check < 0 (default) no check box is drawn,
1287/// if 0 then unchecked checkbox is added, if 1 checked checkbox is added.
1288
1289void TRootBrowserLite::Add(TObject *obj, const char *name, Int_t check)
1290{
1291 if (!obj)
1292 return;
1293 if (obj->InheritsFrom("TObjectSpy"))
1294 return;
1295 if (!name) name = obj->GetName();
1296
1297 AddToBox(obj, name);
1298 if (check > -1) {
1299 TGFrameElement *el;
1300 TIter next(fIconBox->fList);
1301 if (!obj->IsFolder()) {
1302 while ((el = (TGFrameElement *) next())) {
1303 TGLVEntry *f = (TGLVEntry *) el->fFrame;
1304 if (f->GetUserData() == obj) {
1305 f->SetCheckedEntry(check);
1306 }
1307 }
1308 }
1309 }
1310
1311 // Don't show current dir and up dir links in the tree
1312 if (name[0] == '.' && ((name[1] == '\0') || (name[1] == '.' && name[2] == '\0')))
1313 return;
1314
1315 if (obj->IsFolder())
1316 AddToTree(obj, name, check);
1317}
1318
1319////////////////////////////////////////////////////////////////////////////////
1320/// Add a checkbox in the TGListTreeItem corresponding to obj
1321/// and a checkmark on TGLVEntry if check = kTRUE.
1322
1324{
1325 if (obj) {
1327 while (item) {
1328 fLt->SetCheckBox(item, kTRUE);
1329 fLt->CheckItem(item, check);
1330 item = fLt->FindItemByObj(item->GetNextSibling(), obj);
1331 }
1332 TGFrameElement *el;
1333 TIter next(fIconBox->fList);
1334 while ((el = (TGFrameElement *) next())) {
1335 TGLVEntry *f = (TGLVEntry *) el->fFrame;
1336 if (f->GetUserData() == obj) {
1337 f->SetCheckedEntry(check);
1338 }
1339 }
1340 }
1341}
1342
1343////////////////////////////////////////////////////////////////////////////////
1344/// Check / uncheck the TGListTreeItem corresponding to this
1345/// object and add a checkmark on TGLVEntry if check = kTRUE.
1346
1348{
1349 if (obj) {
1351 while (item) {
1352 fLt->CheckItem(item, check);
1353 item = fLt->FindItemByObj(item->GetNextSibling(), obj);
1354 TGFrameElement *el;
1355 TIter next(fIconBox->fList);
1356 if (!obj->IsFolder()) {
1357 while ((el = (TGFrameElement *) next())) {
1358 TGLVEntry *f = (TGLVEntry *) el->fFrame;
1359 if (f->GetUserData() == obj) {
1360 f->SetCheckedEntry(check);
1361 }
1362 }
1363 }
1364 }
1365 }
1366}
1367
1368////////////////////////////////////////////////////////////////////////////////
1369/// Remove checkbox from TGListTree and checkmark from TGListView.
1370
1372{
1373 if (obj) {
1375 while (item) {
1376 fLt->SetCheckBox(item, kFALSE);
1377 item = fLt->FindItemByObj(item->GetNextSibling(), obj);
1378 TGFrameElement *el;
1379 TIter next(fIconBox->fList);
1380 if (!obj->IsFolder()) {
1381 while ((el = (TGFrameElement *) next())) {
1382 TGLVEntry *f = (TGLVEntry *) el->fFrame;
1383 if (f->GetUserData() == obj) {
1384 f->SetCheckedEntry(kFALSE);
1385 }
1386 }
1387 }
1388 }
1389 }
1390}
1391
1392////////////////////////////////////////////////////////////////////////////////
1393/// Add items to the iconbox of the browser.
1394
1396{
1397 if (obj) {
1398 if (!name) name = obj->GetName() ? obj->GetName() : "NoName";
1399 //const char *titlePtr = obj->GetTitle() ? obj->GetTitle() : " ";
1400
1401 TClass *objClass = 0;
1402
1403 if (obj->IsA() == TKey::Class())
1404 objClass = TClass::GetClass(((TKey *)obj)->GetClassName());
1405 else if (obj->IsA() == TKeyMapFile::Class())
1406 objClass = TClass::GetClass(((TKeyMapFile *)obj)->GetTitle());
1407 else if (obj->InheritsFrom("TRemoteObject")) {
1408 // special case for remote object: get real object class
1409 TRemoteObject *robj = (TRemoteObject *)obj;
1410 if (!strcmp(robj->GetClassName(), "TKey"))
1411 objClass = TClass::GetClass(robj->GetKeyClassName());
1412 else
1413 objClass = TClass::GetClass(robj->GetClassName());
1414 }
1415 else
1416 objClass = obj->IsA();
1417
1418 fIconBox->AddObjItem(name, obj, objClass);
1419 }
1420}
1421
1422////////////////////////////////////////////////////////////////////////////////
1423/// Add items to the current TGListTree of the browser.
1424
1425void TRootBrowserLite::AddToTree(TObject *obj, const char *name, Int_t check)
1426{
1427 if (!obj)
1428 return;
1429 if (obj->InheritsFrom("TApplication"))
1430 fListLevel = 0;
1431 if (!fTreeLock) {
1432 if (!name) name = obj->GetName();
1433 if (name[0] == '.' && name[1] == '.')
1434 Info("AddToTree", "up one level %s", name);
1435 if(check > -1) {
1436 TGListTreeItem *item = fLt->AddItem(fListLevel, name, obj, 0, 0, kTRUE);
1437 if (item) fLt->CheckItem(item, (Bool_t)check);
1438 TString tip(obj->ClassName());
1439 if (obj->GetTitle()) {
1440 tip += " ";
1441 tip += obj->GetTitle();
1442 }
1443 fLt->SetToolTipItem(item, tip.Data());
1444 } else {
1445 // special case for remote object
1446 if (obj->InheritsFrom("TRemoteObject")) {
1447 // Nothing to do
1448 } else if (fListLevel) {
1449 // check also if one of its parents is a remote object
1451 while (top->GetParent()) {
1452 TObject *tobj = (TObject *) top->GetUserData();
1453 if (tobj && (tobj->InheritsFrom("TRemoteObject") ||
1454 tobj->InheritsFrom("TApplicationRemote"))) {
1455 break;
1456 }
1457 top = top->GetParent();
1458 }
1459 }
1460 // add the object only if not already in the list
1461 if ((!fLt->FindChildByName(fListLevel, name)) &&
1462 (!fLt->FindChildByData(fListLevel, obj))) {
1464 Long64_t bsize, fsize, objsize = 0;
1465 TString objinfo = obj->GetObjectInfo(1, 1);
1466 TString infos = obj->GetName();
1467 infos += "\n";
1468 infos += obj->GetTitle();
1469 if (!objinfo.IsNull() && !objinfo.BeginsWith("x=")) {
1470 objsize = objinfo.Atoll();
1471 if (objsize > 0) {
1472 infos += "\n";
1473 bsize = fsize = objsize;
1474 if (fsize > 1024) {
1475 fsize /= 1024;
1476 if (fsize > 1024) {
1477 // 3.7MB is more informative than just 3MB
1478 infos += TString::Format("Size: %lld.%lldM", fsize/1024,
1479 (fsize%1024)/103);
1480 } else {
1481 infos += TString::Format("Size: %lld.%lldK", bsize/1024,
1482 (bsize%1024)/103);
1483 }
1484 } else {
1485 infos += TString::Format("Size: %lld bytes", bsize);
1486 }
1487 }
1488 }
1489 if (it)
1490 it->SetTipText(infos.Data());
1491 }
1492 }
1493 }
1494}
1495
1496////////////////////////////////////////////////////////////////////////////////
1497/// Browse object. This, in turn, will trigger the calling of
1498/// TRootBrowserLite::Add() which will fill the IconBox and the tree.
1499/// Emits signal "BrowseObj(TObject*)".
1500
1502{
1504 Emit("BrowseObj(TObject*)", (Longptr_t)obj);
1505
1506 if (obj != gROOT) {
1507 if (!fLt->FindItemByObj(fLt->GetFirstItem(), obj)) {
1508 fListLevel = 0;
1509 Add(obj);
1512 if (obj->IsFolder())
1514 fLt->ClearViewPort();
1516 }
1517 }
1518
1519 if (obj->IsFolder()) fIconBox->RemoveAll();
1520 obj->Browse(fBrowser);
1521 if ((fListLevel && obj->IsFolder()) || (!fListLevel && (obj == gROOT))) {
1522 fIconBox->Refresh();
1523 }
1524
1525 if (fBrowser) {
1527 }
1529
1532}
1533
1534////////////////////////////////////////////////////////////////////////////////
1535/// add new draw option to the "history"
1536
1538{
1539 TString opt = GetDrawOption();
1542
1543 TIter next(lbc->GetList());
1544 TGFrameElement *el;
1545
1546 while ((el = (TGFrameElement *)next())) {
1547 TGTextLBEntry *lbe = (TGTextLBEntry *)el->fFrame;
1548 if (lbe->GetText()->GetString() == opt) {
1549 return;
1550 }
1551 }
1552
1554 fDrawOption->AddEntry(opt.Data(), nn);
1555 fDrawOption->Select(nn);
1556}
1557
1558////////////////////////////////////////////////////////////////////////////////
1559/// returns pointer to fIconBox object
1560
1562{
1563 return (TGFileContainer*)fIconBox;
1564}
1565
1566////////////////////////////////////////////////////////////////////////////////
1567/// Really delete the browser and the this GUI.
1568
1570{
1572 delete this;
1573}
1574
1575////////////////////////////////////////////////////////////////////////////////
1576/// In case window is closed via WM we get here.
1577
1579{
1580 DeleteWindow();
1581}
1582
1583////////////////////////////////////////////////////////////////////////////////
1584/// Display in statusbar total number of objects and number of
1585/// selected objects in IconBox.
1586
1588{
1589 char tmp[64];
1590 const char *fmt;
1591
1592 if (selected)
1593 fmt = "%d Object%s, %d selected.";
1594 else
1595 fmt = "%d Object%s.";
1596
1597 snprintf(tmp, 64, fmt, total, (total == 1) ? "" : "s", selected);
1598 fStatusBar->SetText(tmp, 0);
1599}
1600
1601////////////////////////////////////////////////////////////////////////////////
1602/// Display current directory in second label, fLbl2.
1603
1605{
1606 char *p, path[1024];
1607
1609 p = path;
1610 while (*p && *(p+1) == '/') ++p;
1611 if (!p[0])
1612 fLbl2->SetText(new TGString("Contents of \".\""));
1613 else
1614 fLbl2->SetText(new TGString(Form("Contents of \"%s\"", p)));
1615 fListHdr->Layout();
1616
1617 // Get full pathname for FS combobox (previously truncated to 12 levels deep)
1619 p = path;
1620 while (*p && *(p+1) == '/') ++p;
1622
1623 if (fListLevel) {
1624 // disable/enable up level navigation
1626 TString dirname = gSystem->GetDirName(p);
1627
1629 Bool_t disableUp = dirname == "/";
1630
1631 // normal file directory
1632 if (disableUp && (obj) && (obj->IsA() == TSystemDirectory::Class())) {
1633 disableUp = strlen(p) == 1;
1634 }
1635 btn->SetState(disableUp ? kButtonDisabled : kButtonUp);
1637 }
1638}
1639
1640////////////////////////////////////////////////////////////////////////////////
1641/// Execute default action for selected object (action is specified
1642/// in the $HOME/.root.mimes or $ROOTSYS/etc/root.mimes file.
1643/// Emits signal "ExecuteDefaultAction(TObject*)".
1644
1646{
1647 TRootBrowserCursorSwitcher cursorSwitcher(fIconBox, fLt);
1648 char action[512];
1650 TVirtualPad *wasp = gPad ? (TVirtualPad*)gPad->GetCanvas() : nullptr;
1651 TFile *wasf = gFile;
1652
1653 // Special case for file system objects...
1654 if (obj->IsA() == TSystemFile::Class() ||
1655 obj->InheritsFrom("TRemoteObject")) {
1656 TString act;
1657 TString ext = obj->GetName();
1658
1659 if (fClient->GetMimeTypeList()->GetAction(obj->GetName(), action)) {
1660 act = action;
1661 act.ReplaceAll("%s", obj->GetName());
1662 gInterpreter->SaveGlobalsContext();
1663
1664 if (act[0] == '!') {
1665 act.Remove(0, 1);
1666 gSystem->Exec(act.Data());
1667 } else {
1668 // special case for remote object: remote process
1669 if (obj->InheritsFrom("TRemoteObject"))
1672 }
1673 Emit("ExecuteDefaultAction(TObject*)", (Longptr_t)obj);
1674 }
1675
1676 // special case for remote object: browse real object
1677 if (obj->InheritsFrom("TRemoteObject") && ext.EndsWith(".root")) {
1678 TRootBrowserCursorSwitcher cursorSwitcher2(fIconBox, fLt);
1680 gApplication->ProcessLine("((TApplicationServer *)gApplication)->BrowseFile(0);");
1681 Refresh();
1682 }
1683 ////////// new TFile was opened. Add it to the browser /////
1684 if (gFile && (wasf != gFile) && ext.EndsWith(".root")) {
1685 TGListTreeItem *itm = fLt->FindChildByData(0, gROOT->GetListOfFiles());
1686
1687 if (itm) {
1689 fListLevel = itm;
1692 itm = fLt->AddItem(fListLevel, gFile->GetName());
1693 itm->SetUserData(gFile);
1695 return;
1696 }
1697 }
1698
1699 // only valid for local text files
1700 if (!obj->InheritsFrom("TRemoteObject"))
1701 BrowseTextFile(obj->GetName());
1702
1703 /////////////// cache and change file's icon ///////////////////////
1704 TVirtualPad *nowp = gPad ? (TVirtualPad*)gPad->GetCanvas() : nullptr;
1705
1706 if (fIconBox->fAutoThumbnail && nowp && (nowp != wasp)) {
1707 TSystemFile *sf = (TSystemFile*)obj;
1708 const TGPicture *pic, *spic;
1709
1710 TString path;
1711 if (gSystem->IsAbsoluteFileName(sf->GetName())) {
1712 path = sf->GetName();
1713 } else {
1714 char *buf = gSystem->ConcatFileName(gSystem->WorkingDirectory(), sf->GetName());
1715 path = buf;
1716 delete [] buf;
1717 }
1718
1720
1721 if (!thumb) {
1722 TImage *img = TImage::Create();
1723 nowp->Modified();
1724 nowp->Update();
1725 img->FromPad(nowp);
1726
1727 if (!img->IsValid()) {
1728 return;
1729 }
1730
1731 static const UInt_t sz = 72;
1732 UInt_t w = sz;
1733 UInt_t h = sz;
1734
1735 auto imgw = img->GetWidth();
1736 auto imgh = img->GetHeight();
1737
1738 if (imgw > imgh) {
1739 h = (imgh*sz) / (imgw > 0 ? imgw : 1);
1740 } else {
1741 w = (imgw*sz) / (imgh > 0 ? imgh : 1);
1742 }
1743
1744 w = (w < 54) ? 54 : w;
1745 h = (h < 54) ? 54 : h;
1746
1747 img->Scale(w, h);
1748 img->Merge(img, "tint"); // contrasting
1749 img->DrawBox(0, 0, w, h, "#ffff00", 1); // yellow frame
1750
1751 pic = fClient->GetPicturePool()->GetPicture(path.Data(), img->GetPixmap(), 0);
1752 img->Scale(w/3, h/3);
1753 spic = fClient->GetPicturePool()->GetPicture(path.Data(), img->GetPixmap(), 0);
1754
1755 thumb = new TIconBoxThumb(path.Data(), spic, pic);
1756 fIconBox->fThumbnails->Add(thumb);
1757 delete img;
1758 }
1759 }
1760 return;
1761 }
1762
1763 // For other objects the default action is still hard coded in
1764 // their Browse() member function.
1765}
1766
1767////////////////////////////////////////////////////////////////////////////////
1768/// Handle menu and other command generated by the user.
1769
1771{
1772 TRootHelpDialog *hd;
1773 TRootBrowserCursorSwitcher *cursorSwitcher = 0;
1774 TDirectory *tdir = 0;
1775 TString cmd;
1776
1777 if (GET_SUBMSG(msg) != kCT_SELCHANGED) {
1778 cursorSwitcher = new TRootBrowserCursorSwitcher(fIconBox, fLt);
1779 }
1780
1781 TObject *obj;
1782 TGListTreeItem *item = 0;
1783
1784 gVirtualX->Update();
1785
1786 switch (GET_MSG(msg)) {
1787
1788 case kC_COMMAND:
1789
1790 switch (GET_SUBMSG(msg)) {
1791
1792 case kCM_BUTTON:
1793 // fallthrough
1794 case kCM_MENU:
1795
1796 switch ((ERootBrowserCommands)parm1) {
1797 // Handle File menu items...
1799 new TBrowser("Browser", "ROOT Object Browser");
1800 break;
1801 case kFileNewBrowser:
1802 gEnv->SetValue("Browser.Name", "TRootBrowser");
1803 new TBrowser();
1804 gEnv->SetValue("Browser.Name", "TRootBrowserLite");
1805 break;
1806 case kFileNewCanvas:
1807 gROOT->MakeDefCanvas();
1808 break;
1809 case kFileNewBuilder:
1811 break;
1812 case kFileOpen:
1813 {
1814 static TString dir(".");
1815 TGFileInfo fi;
1817 fi.SetIniDir(dir);
1818 new TGFileDialog(fClient->GetDefaultRoot(), this,
1819 kFDOpen,&fi);
1820 dir = fi.fIniDir;
1821 if (fi.fMultipleSelection && fi.fFileNamesList) {
1822 TObjString *el;
1823 TIter next(fi.fFileNamesList);
1824 while ((el = (TObjString *) next())) {
1825 new TFile(el->GetString(), "update");
1826 }
1827 }
1828 else if (fi.fFilename) {
1829 new TFile(fi.fFilename, "update");
1830 }
1831 }
1832 break;
1833 case kFileSave:
1834 case kFileSaveAs:
1835 break;
1836 case kFilePrint:
1837 break;
1838 case kFileCloseBrowser:
1840 break;
1841 case kFileQuit:
1843 break;
1844
1845 // Handle View menu items...
1846 case kViewToolBar:
1849 else
1850 ShowToolBar();
1851 break;
1852 case kViewStatusBar:
1855 else
1856 ShowStatusBar();
1857 break;
1858 case kViewLargeIcons:
1859 case kViewSmallIcons:
1860 case kViewList:
1861 case kViewDetails:
1862 SetViewMode((Int_t)parm1);
1863 break;
1864 case kViewHidden:
1868 } else {
1871 }
1872 Refresh(kTRUE);
1873 break;
1874 case kViewArrangeByName:
1875 case kViewArrangeByType:
1876 case kViewArrangeBySize:
1877 case kViewArrangeByDate:
1878 SetSortMode((Int_t)parm1);
1879 break;
1880 case kViewLineUp:
1881 break;
1882 case kViewRefresh:
1883 Refresh(kTRUE);
1884 break;
1885 case kViewGroupLV:
1888 TString gv = gEnv->GetValue("Browser.GroupView", "10000");
1889 Int_t igv = atoi(gv.Data());
1890
1891 if (igv > 10) {
1892 fIconBox->SetGroupSize(igv);
1893 }
1894 } else {
1896 fIconBox->SetGroupSize(10000000); // very large value
1897 }
1898 break;
1899
1900 // Handle Option menu items...
1901 case kOptionShowCycles:
1902 printf("Currently the browser always shows all cycles\n");
1903 break;
1904
1910 Refresh(kTRUE);
1911 } else {
1914 }
1915 break;
1916
1917 // Handle toolbar button...
1918 case kOneLevelUp:
1919 {
1920 if (fBrowseTextFile) {
1921 HideTextEdit();
1922 break;
1923 }
1924 if (!fListLevel || !fListLevel->IsActive()) break;
1925
1926 if (fListLevel && fIconBox->WasGrouped()) {
1927 if (fListLevel) {
1928 item = fListLevel->GetParent();
1929 if (item) fListLevel = item;
1930 obj = (TObject *) fListLevel->GetUserData();
1932 if (obj) BrowseObj(obj);
1933 }
1934
1936 break;
1937 }
1938 if (fListLevel) item = fListLevel->GetParent();
1939
1940
1941 if (item) {
1942 fListLevel = item;
1943 obj = (TObject *)fListLevel->GetUserData();
1946 if (obj) BrowseObj(obj);
1948 } else {
1949 obj = (TObject *)fListLevel->GetUserData();
1950 if (obj) ToSystemDirectory(gSystem->GetDirName(obj->GetTitle()));
1951 }
1952 break;
1953 }
1954
1955 // toolbar buttons
1956 case kHistoryBack:
1958 break;
1959 case kHistoryForw:
1961 break;
1962
1963 case kViewFind:
1964 Search();
1965 break;
1966
1967 // Handle Help menu items...
1968 case kHelpAbout:
1969 {
1970#ifdef R__UNIX
1971 TString rootx = TROOT::GetBinDir() + "/root -a &";
1972 gSystem->Exec(rootx);
1973#else
1974#ifdef WIN32
1976#else
1977 char str[32];
1978 sprintf(str, "About ROOT %s...", gROOT->GetVersion());
1979 hd = new TRootHelpDialog(this, str, 600, 400);
1980 hd->SetText(gHelpAbout);
1981 hd->Popup();
1982#endif
1983#endif
1984 }
1985 break;
1986 case kHelpOnCanvas:
1987 hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
1988 hd->SetText(gHelpCanvas);
1989 hd->Popup();
1990 break;
1991 case kHelpOnMenus:
1992 hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
1994 hd->Popup();
1995 break;
1996 case kHelpOnGraphicsEd:
1997 hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
1999 hd->Popup();
2000 break;
2001 case kHelpOnBrowser:
2002 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
2004 hd->Popup();
2005 break;
2006 case kHelpOnObjects:
2007 hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
2008 hd->SetText(gHelpObjects);
2009 hd->Popup();
2010 break;
2011 case kHelpOnPS:
2012 hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
2014 hd->Popup();
2015 break;
2016 case kHelpOnRemote:
2017 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
2018 hd->SetText(gHelpRemote);
2019 hd->Popup();
2020 break;
2021 default:
2022 break;
2023 }
2024 break;
2025 case kCM_COMBOBOX:
2026 if (parm1 == kFSComboBox) {
2028 if (e) {
2029 const char *dirname = e->GetPath()->GetString();
2030 item = fLt->FindItemByPathname(dirname);
2031 if (item) {
2032 fListLevel = item;
2036 } else {
2037 ToSystemDirectory(dirname);
2038 }
2039 }
2040 }
2041 break;
2042 default:
2043 break;
2044 }
2045
2046 break;
2047
2048 case kC_LISTTREE:
2049 switch (GET_SUBMSG(msg)) {
2050
2051 case kCT_ITEMCLICK:
2052 // tell coverity that parm1 is a Long_t, and not an enum (even
2053 // if we compare it with an enum value) and the meaning of
2054 // parm1 depends on GET_MSG(msg) and GET_SUBMSG(msg)
2055 // coverity[mixed_enums]
2056 if (((EMouseButton)parm1 == kButton1) ||
2057 ((EMouseButton)parm1 == kButton3)) {
2058 HideTextEdit();
2059 TGListTreeItem *item2;
2060 TObject *obj2 = 0;
2061 if ((item2 = fLt->GetSelected()) != 0 ) {
2062 ListTreeHighlight(item2);
2063 fStatusBar->SetText("", 1); // clear
2064 }
2065 if (item2 && parm1 == kButton3) {
2066 Int_t x = (Int_t)(parm2 & 0xffff);
2067 Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
2068 obj2 = (TObject *) item2->GetUserData();
2069 if (obj2) {
2070 if (obj2->InheritsFrom("TTree")) {
2071 // if a tree not attached to any directory (e.g. in a TFolder)
2072 // then attach it to the current directory (gDirectory)
2073 cmd = TString::Format("((TTree *)0x%zx)->GetDirectory();",
2074 (size_t)obj2);
2075 tdir = (TDirectory *)gROOT->ProcessLine(cmd.Data());
2076 if (!tdir) {
2077 cmd = TString::Format("((TTree *)0x%zx)->SetDirectory(gDirectory);",
2078 (size_t)obj2);
2079 gROOT->ProcessLine(cmd.Data());
2080 }
2081 }
2082 fBrowser->GetContextMenu()->Popup(x, y, obj2, fBrowser);
2083 }
2084 }
2087 fListView->Layout();
2088 }
2089 break;
2090
2091 case kCT_ITEMDBLCLICK:
2092 if (parm1 == kButton1) {
2093 if (fBrowseTextFile) {
2094 HideTextEdit();
2095 }
2096 if (fListLevel && fIconBox->WasGrouped()) {
2097 TObject *obj2;
2098 TGListTreeItem *item2;
2099
2100 if (fListLevel) {
2101 item2 = fListLevel->GetParent();
2102 if (item2) fListLevel = item2;
2103
2104 obj2 = (TObject *) fListLevel->GetUserData();
2106 if (obj2) {
2107 BrowseObj(obj2);
2108 }
2109 }
2110 break;
2111 }
2112 }
2113
2114 default:
2115 break;
2116 }
2117 break;
2118
2119 case kC_CONTAINER:
2120 switch (GET_SUBMSG(msg)) {
2121
2122 case kCT_ITEMCLICK:
2123 if (fIconBox->NumSelected() == 1) {
2124 // display title of selected object
2125 TGFileItem *item2;
2126 void *p = 0;
2127 if ((item2 = (TGFileItem *)fIconBox->GetNextSelected(&p)) != 0) {
2128 TObject *obj2 = (TObject *)item2->GetUserData();
2129
2130 TGListTreeItem *itm = 0;
2131 if (!fListLevel) itm = fLt->GetFirstItem();
2132 else itm = fListLevel->GetFirstChild();
2133 //Bool_t found = kFALSE;
2134
2135 while (itm) {
2136 if (itm->GetUserData() == obj2) break;
2137 itm = itm->GetNextSibling();
2138 }
2139
2140 if (itm) {
2141 if ((fListLevel && fListLevel->IsOpen()) || !fListLevel) {
2143 fLt->HighlightItem(itm);
2145 }
2146 }
2147
2148 if (obj2) fStatusBar->SetText(obj2->GetName(), 1);
2149 }
2150 }
2151 if (parm1 == kButton3) {
2152 // show context menu for selected object
2153 if (fIconBox->NumSelected() == 1) {
2154 void *p = 0;
2155 TGFileItem *item2;
2156 if ((item2 = (TGFileItem *) fIconBox->GetNextSelected(&p)) != 0) {
2157 Int_t x = (Int_t)(parm2 & 0xffff);
2158 Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
2159 TObject *obj2 = (TObject *)item2->GetUserData();
2160 if (obj2) {
2161 if (obj2->IsA() == TKey::Class()) {
2162 TKey *key = (TKey*)obj2;
2163 TClass *cl = TClass::GetClass(key->GetClassName());
2164 TString name = key->GetName();
2165 name += ";";
2166 name += key->GetCycle();
2167 //void *add = gROOT->FindObject((char *) name.Data());//key->GetName());
2168 void *add = gDirectory->FindObjectAny((char *) name.Data());
2169 if (cl->IsTObject()) {
2170 obj2 = (TObject*)add; // cl->DynamicCast(TObject::Class(),startadd);
2171 item2->SetUserData(obj2);
2172 } else {
2173 Error("ProcessMessage","do not support non TObject (like %s) yet",
2174 cl->GetName());
2175 break;
2176 }
2177 }
2178 if (obj2 && obj2->InheritsFrom("TTree")) {
2179 // if a tree not attached to any directory (e.g. in a TFolder)
2180 // then attach it to the current directory (gDirectory)
2181 cmd = TString::Format("((TTree *)0x%zx)->GetDirectory();",
2182 (size_t)obj2);
2183 tdir = (TDirectory *)gROOT->ProcessLine(cmd.Data());
2184 if (!tdir) {
2185 cmd = TString::Format("((TTree *)0x%zx)->SetDirectory(gDirectory);",
2186 (size_t)obj2);
2187 gROOT->ProcessLine(cmd.Data());
2188 }
2189 }
2190 fBrowser->GetContextMenu()->Popup(x, y, obj2, fBrowser);
2191 }
2192 }
2193 }
2194 }
2195 break;
2196 case kCT_ITEMDBLCLICK:
2197 if (parm1 == kButton1) {
2198 if (fIconBox->NumSelected() == 1) {
2199 void *p = 0;
2200 TGFileItem *item2;
2201 if ((item2 = (TGFileItem *) fIconBox->GetNextSelected(&p)) != 0) {
2202 TObject *obj2 = (TObject *)item2->GetUserData();
2203 if (obj2) {
2204 DoubleClicked(obj2);
2205 IconBoxAction(obj2);
2206 }
2207 delete cursorSwitcher;
2208 return kTRUE; //
2209 }
2210 }
2211 }
2212 break;
2213 case kCT_SELCHANGED:
2214 DisplayTotal((Int_t)parm1, (Int_t)parm2);
2215 break;
2216 default:
2217 break;
2218 }
2219
2220 break;
2221
2222 default:
2223 break;
2224 }
2225
2226 delete cursorSwitcher;
2227
2229 return kTRUE;
2230}
2231
2232////////////////////////////////////////////////////////////////////////////////
2233/// Make object associated with item the current directory.
2234
2236{
2237 if (item) {
2238 TGListTreeItem *i = item;
2239 TString dir;
2240 while (i) {
2241 TObject *obj = (TObject*) i->GetUserData();
2242 if (obj) {
2243 if (obj->IsA() == TDirectoryFile::Class()) {
2244 dir = "/" + dir;
2245 dir = obj->GetName() + dir;
2246 }
2247 if (obj->IsA() == TFile::Class()) {
2248 dir = ":/" + dir;
2249 dir = obj->GetName() + dir;
2250 }
2251 if (obj->IsA() == TKey::Class()) {
2252 if (strcmp(((TKey*)obj)->GetClassName(), "TDirectoryFile") == 0) {
2253 dir = "/" + dir;
2254 dir = obj->GetName() + dir;
2255 }
2256 }
2257 }
2258 i = i->GetParent();
2259 }
2260
2261 if (gDirectory && dir.Length()) gDirectory->cd(dir.Data());
2262 }
2263}
2264
2265////////////////////////////////////////////////////////////////////////////////
2266/// helper method to track history
2267
2269{
2270 if (!fListLevel) return;
2271
2274}
2275
2276////////////////////////////////////////////////////////////////////////////////
2277/// helper method to track history
2278
2280{
2283
2284 if (!item || (fHistoryCursor &&
2285 (item == ((TRootBrowserHistoryCursor*)fHistoryCursor)->fItem))) return;
2286
2288 fHistory->Remove(cur);
2289 delete cur;
2290 }
2291
2292 cur = new TRootBrowserHistoryCursor(item);
2293 fHistory->Add(cur);
2294 fHistoryCursor = cur;
2295 btn->SetState(kButtonUp);
2296}
2297
2298////////////////////////////////////////////////////////////////////////////////
2299/// clear navigation history
2300
2302{
2303 fHistory->Delete();
2308}
2309
2310////////////////////////////////////////////////////////////////////////////////
2311/// go to the past
2312
2314{
2315 if (fBrowseTextFile) {
2316 HideTextEdit();
2317 return kFALSE;
2318 }
2322
2323 if (!cur) {
2325 return kFALSE;
2326 }
2327
2329 fHistoryCursor = cur;
2330 fListLevel = cur->fItem;
2334
2335 btn2->SetState(kButtonUp);
2337 if (!cur) {
2339 return kFALSE;
2340 }
2341
2342 return kTRUE;
2343}
2344
2345////////////////////////////////////////////////////////////////////////////////
2346/// go to the future
2347
2349{
2350 if (fBrowseTextFile) {
2351 HideTextEdit();
2352 return kFALSE;
2353 }
2354
2358
2359 if (!cur) {
2361 return kFALSE;
2362 }
2363
2365 fHistoryCursor = cur;
2366 fListLevel = cur->fItem;
2370
2371 btn2->SetState(kButtonUp);
2372
2374 if (!cur) {
2376 return kFALSE;
2377 }
2378
2379 return kTRUE;
2380}
2381
2382////////////////////////////////////////////////////////////////////////////////
2383/// delete list tree item, remove it from history
2384
2386{
2387 ((TRootBrowserHistory*)fHistory)->DeleteItem(item);
2388 fLt->DeleteItem(item);
2389}
2390
2391////////////////////////////////////////////////////////////////////////////////
2392/// Open tree item and list in iconbox its contents.
2393
2395{
2396 if (item) {
2397 TObject *obj = (TObject *) item->GetUserData();
2398
2399 if (obj) {
2400 if (obj->IsA() == TKey::Class()) {
2401
2402 TKey *key = (TKey *)obj;
2403 TString name = obj->GetName();
2404 name += ";";
2405 name += key->GetCycle();
2406 Chdir(item->GetParent());
2407 //TObject *k_obj = gROOT->FindObject(name);
2408 TObject *k_obj = gDirectory->FindObjectAny(name);
2409
2410 if (k_obj) {
2411 item->SetUserData(k_obj);
2412 obj = k_obj;
2413 }
2414 } else if (obj->InheritsFrom(TDirectoryFile::Class())) {
2415 Chdir(item->GetParent());
2416 }
2417 else if (obj->InheritsFrom("TApplicationRemote")) {
2418 if (!gApplication->GetAppRemote()) {
2419 gROOT->ProcessLine(Form(".R %s", item->GetText()));
2420 if (gApplication->GetAppRemote()) {
2421 Getlinem(kInit, TString::Format("\n%s:root [0]",
2423 }
2424 }
2425 }
2426 else if (obj->InheritsFrom("TRemoteObject")) {
2427 // special case for remote object
2428 TRemoteObject *robj = (TRemoteObject *)obj;
2429 // the real object is a TKey
2430 if (!strcmp(robj->GetClassName(), "TKey")) {
2431 TGListTreeItem *parent = item;
2432 TRemoteObject *probj = (TRemoteObject *)parent->GetUserData();
2433 // find the TFile remote object containing the TKey
2434 while ( probj && strcmp(probj->GetClassName(), "TFile")) {
2435 parent = parent->GetParent();
2436 probj = (TRemoteObject *)parent->GetUserData();
2437 }
2438 if (probj) {
2439 // remotely browse file (remotely call TFile::cd())
2442 TString::Format("((TApplicationServer *)gApplication)->BrowseFile(\"%s\");",
2443 probj->GetName()));
2444 }
2445 }
2446 }
2447 if (item->GetParent() && item->GetParent()->GetUserData() &&
2448 ((TObject *)item->GetParent()->GetUserData())->InheritsFrom("TApplicationRemote")) {
2449 // switch to remote session
2450 if (!gApplication->GetAppRemote()) {
2451 gROOT->ProcessLine(Form(".R %s", item->GetParent()->GetText()));
2452 if (gApplication->GetAppRemote()) {
2453 Getlinem(kInit, TString::Format("\n%s:root [0]",
2455 }
2456 }
2457 else if (!strcmp(item->GetText(), "ROOT Files")) {
2458 // update list of files opened in the remote session
2460 gApplication->ProcessLine("((TApplicationServer *)gApplication)->BrowseFile(0);");
2461 }
2462 }
2463 else {
2464 // check if the listtree item is from a local session or
2465 // from a remote session, then switch to the session it belongs to
2466 TGListTreeItem *top = item;
2467 while (top->GetParent()) {
2468 top = top->GetParent();
2469 }
2470 TObject *topobj = (TObject *) top->GetUserData();
2471 if (topobj && topobj->InheritsFrom("TApplicationRemote")) {
2472 // it belongs to a remote session
2473 if (!gApplication->GetAppRemote()) {
2474 // switch to remote session if not already in
2475 gROOT->ProcessLine(Form(".R %s", top->GetText()));
2476 if (gApplication->GetAppRemote()) {
2477 Getlinem(kInit, TString::Format("\n%s:root [0]",
2479 }
2480 }
2481 }
2482 else if (gApplication->GetAppRemote()) {
2483 // switch back to local session if not already in
2485 Getlinem(kInit, "\nroot [0]");
2486 }
2487 }
2488
2489 if (!fListLevel || !fListLevel->IsActive()) {
2490 fListLevel = item;
2491 BrowseObj(obj);
2493 }
2494 }
2496 }
2497}
2498
2499////////////////////////////////////////////////////////////////////////////////
2500/// display directory
2501
2503{
2504 TString dir = dirname;
2505
2506 if (fListLevel) {
2508
2509 if (obj && (obj->IsA() == TSystemDirectory::Class())) {
2510 TObject* old = obj;
2511 fListLevel->Rename(dir.Data());
2512 obj = new TSystemDirectory(dir.Data(), dir.Data());
2513 while (fListLevel->GetFirstChild())
2516
2517 fListLevel->SetUserData(obj);
2518 gROOT->GetListOfBrowsables()->Remove(old);
2519 delete old;
2520 gROOT->GetListOfBrowsables()->Add(obj);
2521 fTreeLock = kTRUE;
2522 BrowseObj(obj);
2523 fTreeLock = kFALSE;
2524
2528 //gSystem->ChangeDirectory(dir.Data());
2529 fStatusBar->SetText(dir.Data(), 1);
2530 ClearHistory(); // clear browsing history
2531 }
2532 }
2533 return;
2534}
2535
2536////////////////////////////////////////////////////////////////////////////////
2537/// sets drawing option
2538
2540{
2542}
2543
2544////////////////////////////////////////////////////////////////////////////////
2545/// returns drawing option
2546
2548{
2549 return fDrawOption->GetTextEntry()->GetText();
2550}
2551////////////////////////////////////////////////////////////////////////////////
2552/// Emits signal when double clicking on icon.
2553
2555{
2556 Emit("DoubleClicked(TObject*)", (Longptr_t)obj);
2557}
2558
2559////////////////////////////////////////////////////////////////////////////////
2560/// Emits signal when double clicking on icon.
2561
2563{
2564 Longptr_t args[2];
2565
2566 args[0] = (Longptr_t)obj;
2567 args[1] = checked;
2568
2569 Emit("Checked(TObject*,Bool_t)", args);
2570}
2571
2572////////////////////////////////////////////////////////////////////////////////
2573/// Default action when double clicking on icon.
2574
2576{
2577 Bool_t browsable = kFALSE;
2578 if (obj) {
2579
2580 TRootBrowserCursorSwitcher cursorSwitcher(fIconBox, fLt);
2581
2582 Bool_t useLock = kTRUE;
2583
2584 if (obj->IsA()->GetMethodWithPrototype("Browse", "TBrowser*"))
2585 browsable = kTRUE;
2586
2587 if (obj->InheritsFrom("TLeaf")) {
2588 TObject *dir = (TObject *)gROOT->ProcessLine(Form("((%s *)0x%zx)->GetBranch()->GetDirectory();",
2589 obj->ClassName(), (size_t)obj));
2590 if (!dir) {
2591 browsable = kFALSE;
2592 }
2593 }
2594 if (obj->InheritsFrom("TBranchElement")) {
2595 TObject *dir = (TObject *)gROOT->ProcessLine(Form("((%s *)0x%zx)->GetDirectory();",
2596 obj->ClassName(), (size_t)obj));
2597 if (!dir) {
2598 browsable = kFALSE;
2599 }
2600 }
2601
2602 if (obj->InheritsFrom("TKey")) {
2603 TKey *key = dynamic_cast<TKey*>(obj);
2604 if (key && key->GetClassName() && (!strcmp(key->GetClassName(), "TFormula")))
2605 browsable = kFALSE;
2606 }
2607
2608 if (obj->IsA() == TSystemDirectory::Class()) {
2609 useLock = kFALSE;
2610
2611 TString t(obj->GetName());
2612 if (t == ".") goto out;
2613 if (t == "..") {
2614 if (fListLevel && fListLevel->GetParent()) {
2616 obj = (TObject*)fListLevel->GetUserData();
2617 if (fListLevel->GetParent()) {
2619 } else {
2620 obj = (TObject*)fListLevel->GetUserData();
2621 fListLevel = 0;
2622 }
2623 } else {
2624 TString dirname = gSystem->GetDirName(gSystem->pwd());
2625 ToSystemDirectory(dirname);
2626 return;
2627 }
2628 }
2629 }
2630
2631 if (obj && obj->IsFolder()) {
2633 TGListTreeItem *itm = nullptr;
2634
2635 if (fListLevel) {
2637 itm = fListLevel->GetFirstChild();
2638 } else {
2639 itm = fLt->GetFirstItem();
2640 }
2641
2642 while (itm && (itm->GetUserData() != obj)) {
2643 itm = itm->GetNextSibling();
2644 }
2645
2646 if (!itm && fListLevel) {
2647 // special case for remote objects
2648 Bool_t isRemote = kFALSE;
2649 if (obj->InheritsFrom("TRemoteObject"))
2650 isRemote = kTRUE;
2651 else if (fListLevel) {
2652 // check also if one of its parents is a remote object
2654 while (top->GetParent()) {
2655 TObject *tobj = (TObject *) top->GetUserData();
2656 if (tobj && (tobj->InheritsFrom("TRemoteObject") ||
2657 tobj->InheritsFrom("TApplicationRemote"))) {
2658 isRemote = kTRUE;
2659 break;
2660 }
2661 top = top->GetParent();
2662 }
2663 }
2664 if (isRemote) {
2665 // add the remote object only if not already in the list
2666 if ((!fLt->FindChildByName(fListLevel, obj->GetName())) &&
2667 (!fLt->FindChildByData(fListLevel, obj))) {
2668 itm = fLt->AddItem(fListLevel, obj->GetName());
2669 if (itm) itm->SetUserData(obj);
2670 }
2671 else {
2672 // set the current item to the one found in the list
2673 itm = fLt->FindChildByData(fListLevel, obj) ?
2676 }
2677 }
2678 else {
2679 itm = fLt->AddItem(fListLevel, obj->GetName());
2680 if (itm) itm->SetUserData(obj);
2681 }
2682 }
2683
2684 if (itm) {
2685 fListLevel = itm;
2687 TObject *kobj = (TObject *)itm->GetUserData();
2688
2689 if (kobj && kobj->IsA() == TKey::Class()) {
2691 //kobj = gROOT->FindObject(kobj->GetName());
2692 kobj = gDirectory->FindObjectAny(kobj->GetName());
2693
2694 if (kobj) {
2695 TGListTreeItem *parent = fListLevel->GetParent();
2697 TGListTreeItem *kitem = fLt->AddItem(parent, kobj->GetName(), kobj);
2698 if (kitem) {
2699 obj = kobj;
2700 useLock = kFALSE;
2701 kitem->SetUserData(kobj);
2702 fListLevel = kitem;
2703 } else
2704 fListLevel = parent;
2705 }
2706 }
2708 }
2709 }
2710
2711 if (browsable) {
2712 if (useLock) fTreeLock = kTRUE;
2713 Emit("BrowseObj(TObject*)", (Longptr_t)obj);
2714 if (obj) obj->Browse(fBrowser);
2715 if (useLock) fTreeLock = kFALSE;
2716 }
2717
2718out:
2719 if (obj && obj->IsA() != TSystemFile::Class()) {
2720 if (obj->IsFolder()) {
2721 fIconBox->Refresh();
2722 }
2723
2724 if (fBrowser) {
2726 }
2727
2730 }
2731 }
2732}
2733
2734////////////////////////////////////////////////////////////////////////////////
2735/// Recursively remove object from browser.
2736
2738{
2739 // don't delete fIconBox items here (it's status will be updated
2740 // via TBrowser::Refresh() which should be called once all objects have
2741 // been removed.
2742
2744 if (item == 0)
2745 return;
2746 if (fListLevel && (item == fListLevel)) {
2747 TGListTreeItem *parent = item->GetParent();
2748 if (parent) {
2749 fListLevel = parent;
2753 }
2754 else
2755 fListLevel = 0;
2756 }
2757 DeleteListTreeItem(item);
2758}
2759
2760////////////////////////////////////////////////////////////////////////////////
2761/// Refresh the browser contents.
2762
2764{
2765 Bool_t refresh = fBrowser && fBrowser->GetRefreshFlag();
2766
2767 if (fTextEdit && !gROOT->IsExecutingMacro() && force) {
2770 return;
2771 }
2772
2773 if ( (refresh || force) && !fIconBox->WasGrouped()
2775
2776 TRootBrowserCursorSwitcher cursorSwitcher(fIconBox, fLt);
2777 static UInt_t prev = 0;
2778 UInt_t curr = gROOT->GetListOfBrowsables()->GetSize();
2779 if (!prev) prev = curr;
2780
2781 if (prev != curr) { // refresh gROOT
2783 fListLevel = 0;
2785 fListLevel = sav;
2786 prev = curr;
2787 }
2788
2789 // Refresh the IconBox
2790 if (fListLevel) {
2792 if (obj) {
2793 fTreeLock = kTRUE;
2794 BrowseObj(obj);
2795 fTreeLock = kFALSE;
2796 }
2797 }
2798 }
2800}
2801
2802////////////////////////////////////////////////////////////////////////////////
2803/// Show or hide toolbar.
2804
2806{
2807 if (show) {
2811 } else {
2815 }
2816}
2817
2818////////////////////////////////////////////////////////////////////////////////
2819/// Show or hide statusbar.
2820
2822{
2823 if (show) {
2826 } else {
2829 }
2830}
2831
2832////////////////////////////////////////////////////////////////////////////////
2833/// Set defaults depending on settings in the user's .rootrc.
2834
2835void TRootBrowserLite::SetDefaults(const char *iconStyle, const char *sortBy)
2836{
2837 const char *opt;
2838
2839 // IconStyle: big, small, list, details
2840 if (iconStyle)
2841 opt = iconStyle;
2842 else
2843 opt = gEnv->GetValue("Browser.IconStyle", "small");
2844 if (!strcasecmp(opt, "big"))
2846 else if (!strcasecmp(opt, "small"))
2848 else if (!strcasecmp(opt, "list"))
2850 else if (!strcasecmp(opt, "details"))
2852 else
2854
2855 // SortBy: name, type, size, date
2856 if (sortBy)
2857 opt = sortBy;
2858 else
2859 opt = gEnv->GetValue("Browser.SortBy", "name");
2860 if (!strcasecmp(opt, "name"))
2862 else if (!strcasecmp(opt, "type"))
2864 else if (!strcasecmp(opt, "size"))
2866 else if (!strcasecmp(opt, "date"))
2868 else
2870
2871 fIconBox->Refresh();
2872}
2873
2874////////////////////////////////////////////////////////////////////////////////
2875/// Set iconbox's view mode and update menu and toolbar buttons accordingly.
2876
2878{
2879 int i, bnum;
2881
2882 if (force || (fViewMode != new_mode)) {
2883
2884 switch (new_mode) {
2885 default:
2886 if (!force)
2887 return;
2888 else
2889 new_mode = kViewLargeIcons;
2890 // intentionally no break
2891 case kViewLargeIcons:
2892 bnum = 2;
2893 lv = kLVLargeIcons;
2894 break;
2895 case kViewSmallIcons:
2896 bnum = 3;
2897 lv = kLVSmallIcons;
2898 break;
2899 case kViewList:
2900 bnum = 4;
2901 lv = kLVList;
2902 break;
2903 case kViewDetails:
2904 bnum = 5;
2905 lv = kLVDetails;
2906 break;
2907 }
2908
2909 fViewMode = new_mode;
2911
2912 for (i = 2; i <= 5; ++i)
2913 gToolBarData[i].fButton->SetState((i == bnum) ? kButtonEngaged : kButtonUp);
2914
2917 if ((lv == kLVDetails) && (buttons)) {
2918 if (!strcmp(fListView->GetHeader(1), "Attributes")) {
2919 buttons[0]->Connect("Clicked()", "TRootBrowserLite", this,
2920 TString::Format("SetSortMode(=%d)", kViewArrangeByName));
2921 buttons[1]->Connect("Clicked()", "TRootBrowserLite", this,
2922 TString::Format("SetSortMode(=%d)", kViewArrangeByType));
2923 buttons[2]->Connect("Clicked()", "TRootBrowserLite", this,
2924 TString::Format("SetSortMode(=%d)", kViewArrangeBySize));
2925 buttons[5]->Connect("Clicked()", "TRootBrowserLite", this,
2926 TString::Format("SetSortMode(=%d)", kViewArrangeByDate));
2927 }
2928 }
2930 }
2931}
2932
2933////////////////////////////////////////////////////////////////////////////////
2934/// Set iconbox's sort mode and update menu radio buttons accordingly.
2935
2937{
2938 EFSSortMode smode;
2939
2940 switch (new_mode) {
2941 default:
2942 new_mode = kViewArrangeByName;
2943 // intentionally no break
2944 case kViewArrangeByName:
2945 smode = kSortByName;
2946 break;
2947 case kViewArrangeByType:
2948 smode = kSortByType;
2949 break;
2950 case kViewArrangeBySize:
2951 smode = kSortBySize;
2952 break;
2953 case kViewArrangeByDate:
2954 smode = kSortByDate;
2955 break;
2956 }
2957
2958 fSortMode = new_mode;
2960
2961 fIconBox->Sort(smode);
2962}
2963
2964////////////////////////////////////////////////////////////////////////////////
2965/// starts serach dialog
2966
2968{
2969 if (!fTextEdit) {
2971 } else {
2973 }
2974}
2975
2976////////////////////////////////////////////////////////////////////////////////
2977/// test
2978
2979static Bool_t isBinary(const char *str, int len)
2980{
2981 for (int i = 0; i < len; i++) {
2982 char c = str[i];
2983 if (((c < 32) || (c > 126)) && (c != '\t') && (c != '\r') && (c != '\n')) {
2984 return kTRUE;
2985 }
2986 }
2987 return kFALSE;
2988}
2989
2990////////////////////////////////////////////////////////////////////////////////
2991/// hide text edit
2992
2994{
2995 if (!fTextEdit) return;
2996
3002 savbtn->Disconnect();
3004 delete fTextEdit;
3005 fTextEdit = 0;
3007 fV2->MapSubwindows();
3008 fV2->Layout();
3010 fTextFileName = "";
3011}
3012
3013////////////////////////////////////////////////////////////////////////////////
3014/// browse text file
3015
3017{
3018 Bool_t loaded = (fTextEdit != 0);
3020 if (loaded) {
3022 }
3023 return;
3024 }
3025 const int bufferSize = 1024;
3026 char buffer[bufferSize];
3027
3028 FILE *fd = fopen(file, "rb");
3029 if (fd == 0) {
3030 if (loaded) {
3032 }
3033 return;
3034 }
3035 int sz = fread(buffer, 1, bufferSize, fd);
3036 fclose(fd);
3037
3038 if ((sz > 0) && isBinary(buffer, sz)) {
3039 if (loaded) {
3041 }
3042 return;
3043 }
3044
3045 if (!fTextEdit) {
3048 TColor *col = gROOT->GetColor(19);
3049 if (col)
3052 TGSearchDialog::SearchDialog()->Connect("TextEntered(char *)", "TGTextEdit",
3053 fTextEdit, "Search(char *,Bool_t,Bool_t)");
3054 }
3057 savbtn->Connect("Released()", "TGTextEdit", fTextEdit, "SaveFile(=0,kTRUE)");
3058 }
3059 fTextFileName = file;
3060 fTextEdit->LoadFile(file);
3061 if (loaded) return;
3062
3063 if (fTextFileName.EndsWith(".C")) {
3065 } else {
3067 }
3071 fV2->MapSubwindows();
3072 fV2->Layout();
3074
3075 if (fListLevel) {
3077 }
3079
3080 if (btn) {
3082 }
3083
3085
3086 if (btn2) {
3087 btn2->SetState(kButtonUp);
3088 }
3089}
3090
3091////////////////////////////////////////////////////////////////////////////////
3092/// executed browsed text macro
3093
3095{
3096 char *tmpfile = gSystem->ConcatFileName(gSystem->TempDirectory(),
3098
3099 gROOT->SetExecutingMacro(kTRUE);
3100 fTextEdit->SaveFile(tmpfile, kFALSE);
3101 gROOT->Macro(tmpfile);
3102 gSystem->Unlink(tmpfile);
3103 delete [] tmpfile;
3104 gROOT->SetExecutingMacro(kFALSE);
3105}
3106
3107////////////////////////////////////////////////////////////////////////////////
3108/// interrupt browsed macro execution
3109
3111{
3112 gROOT->SetInterrupt(kTRUE);
3113}
3114
3115////////////////////////////////////////////////////////////////////////////////
3116/// show/hide macro buttons
3117
3119{
3123
3124 static Bool_t connected = kFALSE;
3125
3126 if (!show) {
3127 bt1->UnmapWindow();
3128 bt2->UnmapWindow();
3129 bt3->UnmapWindow();
3130 } else {
3131 bt1->MapWindow();
3132 bt2->MapWindow();
3133 bt3->MapWindow();
3134
3135 if (!connected && fTextEdit) {
3136 bt1->Connect("Pressed()", "TRootBrowserLite", this, "ExecMacro()");
3137 bt2->Connect("Pressed()", "TRootBrowserLite", this, "InterruptMacro()");
3138 connected = kTRUE;
3139 }
3140 }
3141}
3142
3143////////////////////////////////////////////////////////////////////////////////
3144/// Set text in column col in status bar.
3145
3146void TRootBrowserLite::SetStatusText(const char *txt, Int_t col)
3147{
3149 TGStatusBar* status = GetStatusBar();
3150 if (status!=0) {
3151 status->SetText(txt, col);
3152 }
3153}
3154
3155////////////////////////////////////////////////////////////////////////////////
3156/// Interface method to the old browser.
3157
3160 Option_t * /*opt*/)
3161{
3162 TRootBrowserLite *browser = new TRootBrowserLite(b, title, width, height);
3163 return (TBrowserImp *)browser;
3164}
3165
3166////////////////////////////////////////////////////////////////////////////////
3167/// Interface method to the old browser.
3168
3171 Option_t * /*opt*/)
3172{
3173 TRootBrowserLite *browser = new TRootBrowserLite(b, title, x, y, width, height);
3174 return (TBrowserImp *)browser;
3175}
Handle_t Atom_t
WM token.
Definition GuiTypes.h:37
@ kGKeyPress
Definition GuiTypes.h:60
@ kWatch
Definition GuiTypes.h:375
@ kPointer
Definition GuiTypes.h:375
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
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
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
long Longptr_t
Definition RtypesCore.h:82
unsigned long ULong_t
Definition RtypesCore.h:55
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Ssiz_t kNPOS
Definition RtypesCore.h:124
long long Long64_t
Definition RtypesCore.h:80
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
R__EXTERN TApplication * gApplication
#define gDirectory
Definition TDirectory.h:384
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:218
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:185
#define gFile
Definition TFile.h:347
@ kButtonDisabled
Definition TGButton.h:56
@ kButtonUp
Definition TGButton.h:53
@ kButtonEngaged
Definition TGButton.h:55
#define gClient
Definition TGClient.h:156
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
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void SetIconPixmap
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void SetWMPosition
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize MapSubwindows
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t SetWMSizeHints
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
char name[80]
Definition TGX11.cxx:110
#define gInterpreter
#define gROOT
Definition TROOT.h:406
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,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
@ kReadPermission
Definition TSystem.h:45
R__EXTERN TSystem * gSystem
Definition TSystem.h:555
#define gPad
#define gVirtualX
Definition TVirtualX.h:337
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=nullptr)
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="") override
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:81
static TClass * Class()
TMethod * GetMethodWithPrototype(const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Find the method with a given prototype.
Definition TClass.cxx:4456
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Definition TClass.cxx:5938
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
Definition TClass.cxx:4874
Bool_t HasDefaultConstructor(Bool_t testio=kFALSE) const
Return true if we have access to a constructor usable for I/O.
Definition TClass.cxx:7393
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:2968
const char * GetName() const override
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:21
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:1839
ULong_t GetPixel() const
Return pixel value corresponding to this color.
Definition TColor.cxx:1510
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.
static TClass * Class()
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 an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:53
static TClass * Class()
static TClass * Class()
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 void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
virtual TList * GetList() const
Definition TGFrame.h:310
UInt_t GetDefaultWidth() const override
Definition TGFrame.h:312
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
UInt_t GetDefaultHeight() const override
Definition TGFrame.h:314
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1204
TList * fList
container of frame elements
Definition TGFrame.h:292
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition TGFrame.cxx:1149
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1022
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 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
void RemoveAll() override
Remove all items from the container.
Definition TGCanvas.cxx:641
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
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
Definition TGFrame.cxx:629
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
void MapWindow() override
map window
Definition TGFrame.h:204
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
void UnmapWindow() override
unmap window
Definition TGFrame.h:206
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition TGFrame.cxx:645
UInt_t GetHeight() const
Definition TGFrame.h:225
static Pixel_t fgWhitePixel
Definition TGFrame.h:103
UInt_t GetWidth() const
Definition TGFrame.h:224
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:385
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 AddItem(TGLVEntry *item)
Definition TGListView.h:207
void ActivateItem(TGFrameElement *el) override
Select/activate item.
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
void Resize(UInt_t w, UInt_t h) override
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 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...
void Layout() override
Layout list view components (container and contents of container).
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:397
Atom_t * fDNDTypeList
handles DND types
Definition TGFrame.h:413
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:1858
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1801
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1788
Bool_t HandleKey(Event_t *event) override
Handle keyboard events.
Definition TGFrame.cxx:1606
The TGMenu.h header contains all different menu classes.
Definition TGMenu.h:282
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=nullptr)
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:25
Handle_t GetId() const
Definition TGObject.h:41
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:24
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.
Bool_t Search(const char *string, Bool_t direction=kTRUE, Bool_t caseSensitive=kFALSE) override
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 TGButton * GetButton(Int_t id) const
Finds and returns a pointer to the button with the specified identifier id.
void Cleanup() override
Cleanup and delete all objects contained in this composite frame.
void SetFrame(TGFrame *frame, Bool_t left) override
Set frame to be resized.
A composite frame that layout their children in vertical way.
Definition TGFrame.h:374
void SetBackgroundColor(Pixel_t) override
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:57
virtual void DestroyWindow()
destroy window
Definition TGWindow.cxx:192
const TGWindow * GetParent() const
Definition TGWindow.h:83
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) override
Add object to the hash table.
TObject * FindObject(const char *name) const override
Find object using its name.
void Delete(Option_t *option="") override
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
const char * GetName() const override
Returns name of object.
ULong_t Hash() const override
Return hash value for this 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
static TClass * Class()
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:75
TClass * IsA() const override
Definition TKey.h:116
static TClass * Class()
Short_t GetCycle() const
Return cycle number associated to this key.
Definition TKey.cxx:581
A doubly linked list.
Definition TList.h:38
TObject * After(const TObject *obj) const override
Returns the object after object obj.
Definition TList.cxx:328
static TClass * Class()
void Clear(Option_t *option="") override
Remove all objects from the list.
Definition TList.cxx:400
TObject * Before(const TObject *obj) const override
Returns the object before object obj.
Definition TList.cxx:369
void Add(TObject *obj) override
Definition TList.h:83
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:820
TObject * Last() const override
Return the last object in the list. Returns 0 when list is empty.
Definition TList.cxx:691
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:657
virtual TObjLink * FirstLink() const
Definition TList.h:104
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:468
const char * GetName() const override
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:555
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:439
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
Definition TObject.cxx:198
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:199
virtual const char * GetIconName() const
Returns mime type name of object.
Definition TObject.cxx:449
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:207
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
Definition TObject.cxx:468
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:780
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:525
virtual const char * GetTitle() const
Returns title of object.
Definition TObject.cxx:483
virtual TClass * IsA() const
Definition TObject.h:243
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=nullptr, void *receiver=nullptr, const char *slot=nullptr)
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:2989
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)
void Print(Option_t *) const override
This method must be overridden when a class wants to print itself.
TRootBrowserHistoryCursor(TGListTreeItem *item)
void DeleteItem(TGListTreeItem *item)
void RecursiveRemove(TObject *obj) override
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
~TRootBrowserLite() override
Browser destructor.
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
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
~TRootIconBox() override
destructor
TGFrameElement * FindFrame(Int_t x, Int_t y, Bool_t exclude=kTRUE) override
Find frame located int container at position x,y.
const TGPicture * fSmallCachedPic
TObject * fActiveObject
TGString * fCurrentName
void RemoveGarbage()
delete all TRootIconLists from garbage
void SetGroupSize(Int_t siz)
Bool_t WasGrouped() const
const TGPicture * fLargeCachedPic
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 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".
void * FindItem(const TString &name, Bool_t direction=kTRUE, Bool_t caseSensitive=kTRUE, Bool_t beginWith=kFALSE) override
Find a frame which assosiated object has a name containing a "name" string.
TRootIconList * fCurrentList
TRootBrowserLite * fBrowser
void SetObjHeaders()
Set list box headers used to display detailed object iformation.
void RemoveAll() override
Remove all items from icon box.
TRootIconBox * fIconBox
void UpdateName()
composite name
void Browse(TBrowser *b) override
browse icon list
const TGPicture * fPic
TRootIconList(TRootIconBox *box=nullptr)
constructor
const char * GetTitle() const override
Returns title of object.
Bool_t IsFolder() const override
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
const TGPicture * GetPicture() const
~TRootIconList() override
destructor
TRootObjItem(const TGWindow *p, const TGPicture *bpic, const TGPicture *spic, TGString *name, TObject *obj, TClass *cl, EListViewMode viewMode=kLVSmallIcons)
Create an icon box item.
TDNDData * GetDNDData(Atom_t) override
Bool_t HandleDNDFinished() override
Basic string class.
Definition TString.h:139
Ssiz_t Length() const
Definition TString.h:417
void ToLower()
Change string to lower-case.
Definition TString.cxx:1182
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition TString.cxx:2244
const char * Data() const
Definition TString.h:376
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:704
ECaseCompare
Definition TString.h:277
@ kIgnoreCase
Definition TString.h:277
@ kExact
Definition TString.h:277
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition TString.h:623
TString & Prepend(const char *cs)
Definition TString.h:673
Bool_t IsNull() const
Definition TString.h:414
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Definition TString.cxx:677
TString & Remove(Ssiz_t pos)
Definition TString.h:685
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:2378
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:651
Long64_t Atoll() const
Return long long value of string.
Definition TString.cxx:2014
Describes an Operating System directory for the browser.
static TClass * Class()
A TSystemFile describes an operating system file.
Definition TSystemFile.h:29
static TClass * Class()
const char * pwd()
Definition TSystem.h:418
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:653
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:951
virtual const char * WorkingDirectory()
Return working directory.
Definition TSystem.cxx:871
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
const char * fPicnamePrefix
const TGPicture * fIcon[2]
Event structure.
Definition GuiTypes.h:174
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:175
UInt_t fState
key or button mask
Definition GuiTypes.h:181
const char * fPixmap
Definition TGToolBar.h:24
TLine lv
Definition textalign.C:5