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// //
14// TRootBrowserLite //
15// //
16// This class creates a ROOT object browser (looking like Windows //
17// Explorer). The widgets used are the new native ROOT GUI widgets. //
18// //
19//////////////////////////////////////////////////////////////////////////
20
21#include "RConfigure.h"
22
23#include "TRootBrowserLite.h"
24#include "TRootApplication.h"
25#include "TGCanvas.h"
26#include "TGMenu.h"
27#include "TGFileDialog.h"
28#include "TGStatusBar.h"
29#include "TGFSComboBox.h"
30#include "TGLabel.h"
31#include "TGButton.h"
32#include "TGListView.h"
33#include "TGListTree.h"
34#include "TGToolBar.h"
35#include "TGSplitter.h"
36#include "TG3DLine.h"
37#include "TGFSContainer.h"
38#include "TGMimeTypes.h"
39#include "TRootHelpDialog.h"
40#include "TGTextEntry.h"
41#include "TGTextEdit.h"
42#include "TGTextEditDialogs.h"
43
44#include "TROOT.h"
45#include "TEnv.h"
46#include "TBrowser.h"
47#include "TApplication.h"
48#include "TFile.h"
49#include "TKey.h"
50#include "TKeyMapFile.h"
51#include "TClass.h"
52#include "TContextMenu.h"
53#include "TSystem.h"
54#include "TSystemDirectory.h"
55#include "TSystemFile.h"
56#include "TRemoteObject.h"
57#include "TInterpreter.h"
58#include "TGuiBuilder.h"
59#include "TImage.h"
60#include "TVirtualPad.h"
61#include "KeySymbols.h"
62#include "THashTable.h"
63#include "TColor.h"
64#include "TObjString.h"
65#include "TGDNDManager.h"
66#include "TBufferFile.h"
67#include "TFolder.h"
68#include "Getline.h"
69#include "snprintf.h"
70#include "TVirtualX.h"
71
72#include "HelpText.h"
73
74#ifdef WIN32
75#include "TWin32SplashThread.h"
76#endif
77
78// Browser menu command ids
90
104
105 kViewArrangeByName, // Arrange submenu
111
114
117
118 kOneLevelUp, // One level up toolbar button
119 kFSComboBox, // File system combobox in toolbar
120
130
131
132//----- Struct for default icons
133
134struct DefaultIcon_t {
135 const char *fPicnamePrefix;
136 const TGPicture *fIcon[2];
137};
138
139#if 0
140static DefaultIcon_t gDefaultIcon[] = {
141 { "folder", { 0, 0 } },
142 { "app", { 0, 0 } },
143 { "doc", { 0, 0 } },
144 { "slink", { 0, 0 } },
145 { "histo", { 0, 0 } },
146 { "object", { 0, 0 } }
147};
148#endif
149
150
151//----- Toolbar stuff...
152
154 { "tb_uplevel.xpm", "Up One Level", kFALSE, kOneLevelUp, 0 },
155 { "", "", kFALSE, -1, 0 },
156 { "tb_bigicons.xpm", "Large Icons", kTRUE, kViewLargeIcons, 0 },
157 { "tb_smicons.xpm", "Small Icons", kTRUE, kViewSmallIcons, 0 },
158 { "tb_list.xpm", "List", kTRUE, kViewList, 0 },
159 { "tb_details.xpm", "Details", kTRUE, kViewDetails, 0 },
160 { "", "", kFALSE, -1, 0 },
161 { "tb_back.xpm", "Back", kFALSE, kHistoryBack, 0 },
162 { "tb_forw.xpm", "Forward", kFALSE, kHistoryForw, 0 },
163 { "tb_refresh.xpm", "Refresh (F5)", kFALSE, kViewRefresh, 0 },
164 { "", "", kFALSE, -1, 0 },
165 { "tb_find.xpm", "Find (Ctrl-F)", kFALSE, kViewFind, 0 },
166 { "", "", kFALSE, -1, 0 },
167 { "macro_t.xpm", "Execute Macro", kFALSE, kViewExec, 0 },
168 { "interrupt.xpm", "Interrupt Macro",kFALSE, kViewInterrupt, 0 },
169 { "filesaveas.xpm", "Save Macro", kFALSE, kViewSave, 0 },
170 { 0, 0, kFALSE, 0, 0 }
171};
172
173
174//----- TGFileDialog file types
175
176static const char *gOpenTypes[] = { "ROOT files", "*.root",
177 "All files", "*",
178 0, 0 };
179
180////////////////////////////////////////////////////////////////////////////////////
181class TRootBrowserHistoryCursor : public TObject {
182public:
183 TGListTreeItem *fItem;
184
185 TRootBrowserHistoryCursor(TGListTreeItem *item) : fItem(item) {}
186 void Print(Option_t *) const { if (fItem) printf("%s\n", fItem->GetText()); }
187};
188
189
190////////////////////////////////////////////////////////////////////////////////////
191class TRootBrowserHistory : public TList {
192public:
193 void RecursiveRemove(TObject *obj) {
194 TRootBrowserHistoryCursor *cur;
195 TIter next(this);
196
197 while ((cur = (TRootBrowserHistoryCursor*)next())) {
198 if (cur->fItem->GetUserData() == obj) {
199 Remove(cur);
200 delete cur;
201 }
202 }
203 }
204
205 void DeleteItem(TGListTreeItem *item) {
206 TRootBrowserHistoryCursor *cur;
207 TIter next(this);
208
209 while ((cur = (TRootBrowserHistoryCursor*)next())) {
210 if (cur->fItem == item) {
211 Remove(cur);
212 delete cur;
213 }
214 }
215 }
216};
217
218
219////////////////////////////////////////////////////////////////////////////////////
220class TRootBrowserCursorSwitcher {
221private:
222 TGWindow *fW1;
223 TGWindow *fW2;
224public:
225 TRootBrowserCursorSwitcher(TGWindow *w1, TGWindow *w2) : fW1(w1), fW2(w2) {
226 if (w1) gVirtualX->SetCursor(w1->GetId(), gVirtualX->CreateCursor(kWatch));
227 if (w2) gVirtualX->SetCursor(w2->GetId(), gVirtualX->CreateCursor(kWatch));
228 }
229 ~TRootBrowserCursorSwitcher() {
230 if (fW1) gVirtualX->SetCursor(fW1->GetId(), gVirtualX->CreateCursor(kPointer));
231 if (fW2) gVirtualX->SetCursor(fW2->GetId(), gVirtualX->CreateCursor(kPointer));
232 }
233};
234
235////////////////////////////////////////////////////////////////////////////////////
236class TIconBoxThumb : public TObject {
237public:
238 TString fName;
239 const TGPicture *fSmall;
240 const TGPicture *fLarge;
241
242 TIconBoxThumb(const char *name, const TGPicture *spic, const TGPicture *pic) {
243 fName = name;
244 fSmall = spic;
245 fLarge = pic;
246 }
247 ULong_t Hash() const { return fName.Hash(); }
248 const char *GetName() const { return fName.Data(); }
249};
250
251
252
253//----- Special ROOT object item (this are items in the icon box, see
254//----- TRootIconBox)
255////////////////////////////////////////////////////////////////////////////////////
256class TRootObjItem : public TGFileItem {
257public:
258 TRootObjItem(const TGWindow *p, const TGPicture *bpic,
259 const TGPicture *spic, TGString *name,
260 TObject *obj, TClass *cl, EListViewMode viewMode = kLVSmallIcons);
261
262 virtual TDNDData *GetDNDData(Atom_t) {
263 TObject *object = 0;
264 if (fObj->IsA() == TKey::Class())
265 object = ((TKey *)fObj)->ReadObj();
266 else
267 object = fObj;
268 if (object) {
270 fBuf->WriteObject(object);
271 fDNDData.fData = fBuf->Buffer();
272 fDNDData.fDataLength = fBuf->Length();
273 }
274 fDNDData.fDataType = gVirtualX->InternAtom("application/root", kFALSE);
275 return &fDNDData;
276 }
277
278 virtual Bool_t HandleDNDFinished() {
279 if (GetParent())
280 return ((TGFrame *)GetParent())->HandleDNDFinished();
281 return kFALSE;
282 }
283
284protected:
285 TObject *fObj;
287};
288
289////////////////////////////////////////////////////////////////////////////////
290/// Create an icon box item.
291
292TRootObjItem::TRootObjItem(const TGWindow *p, const TGPicture *bpic,
293 const TGPicture *spic, TGString *name,
294 TObject *obj, TClass *, EListViewMode viewMode) :
295 TGFileItem(p, bpic, 0, spic, 0, name, 0, 0, 0, 0, 0, viewMode)
296{
297 fObj = obj;
298 fDNDData.fData = 0;
299 fDNDData.fDataLength = 0;
300
301 if (fSubnames) {
302 for (Int_t i = 0; fSubnames[i] != 0; ++i) delete fSubnames[i];
303 }
304 delete [] fSubnames;
305 fSubnames = new TGString* [2];
306
307 fSubnames[0] = new TGString(obj->GetTitle());
308
309 fSubnames[1] = 0;
310
311 if (obj->IsA()->HasDefaultConstructor()) {
312 SetDNDSource(kTRUE);
313 }
314 if ((obj->IsA() == TFolder::Class()) ||
315 (obj->IsA() == TClass::Class())) {
316 SetDNDSource(kFALSE);
317 }
318
319 int i;
320 for (i = 0; fSubnames[i] != 0; ++i)
321 ;
322 fCtw = new int[i];
323 for (i = 0; fSubnames[i] != 0; ++i)
324 fCtw[i] = gVirtualX->TextWidth(fFontStruct, fSubnames[i]->GetString(),
325 fSubnames[i]->GetLength());
326}
327
328class TRootIconBox;
329////////////////////////////////////////////////////////////////////////////////////
330class TRootIconList : public TList {
331
332private:
333 TRootIconBox *fIconBox; // iconbox to which list belongs
334 const TGPicture *fPic; // list view icon
335
336public:
337 TRootIconList(TRootIconBox* box = 0);
338 virtual ~TRootIconList();
339 void UpdateName();
340 const char *GetTitle() const { return "ListView Container"; }
341 Bool_t IsFolder() const { return kFALSE; }
342 void Browse(TBrowser *b);
343 const TGPicture *GetPicture() const { return fPic; }
344};
345
346////////////////////////////////////////////////////////////////////////////////
347/// constructor
348
349TRootIconList::TRootIconList(TRootIconBox* box)
350{
351 fPic = gClient->GetPicture("listview.xpm");
352 fIconBox = box;
353 fName = "empty";
354}
355
356////////////////////////////////////////////////////////////////////////////////
357/// destructor
358
359TRootIconList::~TRootIconList()
360{
361 gClient->FreePicture(fPic);
362}
363
364////////////////////////////////////////////////////////////////////////////////
365/// composite name
366
367void TRootIconList::UpdateName()
368{
369 if (!First()) return;
370
371 if (fSize==1) {
372 fName = First()->GetName();
373 return;
374 }
375
376 fName = First()->GetName();
377 fName += "-";
378 fName += Last()->GetName();
379}
380
381//----- Special ROOT object container (this is the icon box on the
382//----- right side of the browser)
383////////////////////////////////////////////////////////////////////////////////////
384class TRootIconBox : public TGFileContainer {
385friend class TRootIconList;
386friend class TRootBrowserLite;
387
388private:
389 Bool_t fCheckHeaders; // if true check headers
390 TRootIconList *fCurrentList; //
391 TRootObjItem *fCurrentItem; //
392 Bool_t fGrouped; //
393 TString fCachedPicName; //
394 TList *fGarbage; // garbage for TRootIconList's
395 Int_t fGroupSize; // the total number of items when icon box switched to "global view" mode
396 TGString *fCurrentName; //
397 const TGPicture *fLargeCachedPic; //
398 const TGPicture *fSmallCachedPic; //
399 Bool_t fWasGrouped;
400 TObject *fActiveObject; //
401 Bool_t fIsEmpty;
402 THashTable *fThumbnails; // hash table with thumbnailed pictures
403 Bool_t fAutoThumbnail; //
404 TRootBrowserLite *fBrowser;
405
406 void *FindItem(const TString& name,
407 Bool_t direction = kTRUE,
408 Bool_t caseSensitive = kTRUE,
409 Bool_t beginWith = kFALSE);
410 void RemoveGarbage();
411
412public:
413 TRootIconBox(TRootBrowserLite *browser, TGListView *lv,
414 UInt_t options = kSunkenFrame,
416
417 virtual ~TRootIconBox();
418
419 void AddObjItem(const char *name, TObject *obj, TClass *cl);
420 void GetObjPictures(const TGPicture **pic, const TGPicture **spic,
421 TObject *obj, const char *name);
422 void SetObjHeaders();
423 void Refresh();
424 void RemoveAll();
425 void SetGroupSize(Int_t siz) { fGroupSize = siz; }
426 Int_t GetGroupSize() const { return fGroupSize; }
427 TGFrameElement *FindFrame(Int_t x, Int_t y, Bool_t exclude=kTRUE) { return TGContainer::FindFrame(x,y,exclude); }
428 Bool_t WasGrouped() const { return fWasGrouped; }
429};
430
431////////////////////////////////////////////////////////////////////////////////
432/// Create iconbox containing ROOT objects in browser.
433
434TRootIconBox::TRootIconBox(TRootBrowserLite *browser, TGListView *lv, UInt_t options,
435 ULong_t back) : TGFileContainer(lv, options, back)
436{
437 fListView = lv;
438 fBrowser = browser;
439
440 fCheckHeaders = kTRUE;
441 fTotal = 0;
442 fGarbage = new TList();
443 fCurrentList = 0;
444 fCurrentItem = 0;
445 fGrouped = kFALSE;
446 fGroupSize = 1000;
447 fCurrentName = 0;
448 fWasGrouped = kFALSE;
449 fActiveObject = 0;
450 fIsEmpty = kTRUE;
451 fLargeCachedPic = 0;
452 fSmallCachedPic = 0;
453
454 // Don't use timer HERE (timer is set in TBrowser).
455 StopRefreshTimer();
456 fRefresh = 0;
457 fThumbnails = new THashTable(50);
458 fAutoThumbnail = kTRUE;
459}
460
461////////////////////////////////////////////////////////////////////////////////
462/// destructor
463
464TRootIconBox::~TRootIconBox()
465{
466 RemoveAll();
467 RemoveGarbage();
468 delete fGarbage;
469 delete fThumbnails;
470}
471
472////////////////////////////////////////////////////////////////////////////////
473/// Retrieve icons associated with class "name". Association is made
474/// via the user's ~/.root.mimes file or via $ROOTSYS/etc/root.mimes.
475
476void TRootIconBox::GetObjPictures(const TGPicture **pic, const TGPicture **spic,
477 TObject *obj, const char *name)
478{
479 static TImage *im = 0;
480 if (!im) {
481 im = TImage::Create();
482 }
483
484 TString xpm_magic(name, 3);
485 Bool_t xpm = xpm_magic == "/* ";
486 const char *iconname = xpm ? obj->GetName() : name;
487
488 if (obj->IsA()->InheritsFrom("TGeoVolume")) {
489 iconname = obj->GetIconName() ? obj->GetIconName() : obj->IsA()->GetName();
490 }
491
492 if (fCachedPicName == iconname) {
493 *pic = fLargeCachedPic;
494 *spic = fSmallCachedPic;
495 return;
496 }
497
498 *pic = fClient->GetMimeTypeList()->GetIcon(iconname, kFALSE);
499
500 if (!(*pic) && xpm) {
501 if (im && im->SetImageBuffer((char**)&name, TImage::kXpm)) {
502 *pic = fClient->GetPicturePool()->GetPicture(iconname, im->GetPixmap(),
503 im->GetMask());
504 im->Scale(im->GetWidth()/2, im->GetHeight()/2);
505 *spic = fClient->GetPicturePool()->GetPicture(iconname, im->GetPixmap(),
506 im->GetMask());
507 }
508
509 fClient->GetMimeTypeList()->AddType("[thumbnail]", iconname, iconname, iconname, "->Browse()");
510 return;
511 }
512
513 if (*pic == 0) {
514 if (obj->IsFolder()) {
515 *pic = fFolder_s;
516 } else {
517 *pic = fDoc_s;
518 }
519 }
520 fLargeCachedPic = *pic;
521
522 *spic = fClient->GetMimeTypeList()->GetIcon(iconname, kTRUE);
523
524 if (*spic == 0) {
525 if (obj->IsFolder())
526 *spic = fFolder_t;
527 else
528 *spic = fDoc_t;
529 }
530 fSmallCachedPic = *spic;
531 fCachedPicName = iconname;
532}
533
534////////////////////////////////////////////////////////////////////////////////
535/// delete all TRootIconLists from garbage
536
537void TRootIconBox::RemoveGarbage()
538{
539 TIter next(fGarbage);
540 TList *li;
541
542 while ((li=(TList *)next())) {
543 li->Clear("nodelete");
544 }
545 fGarbage->Delete();
546}
547
548////////////////////////////////////////////////////////////////////////////////
549/// Add object to iconbox. Class is used to get the associated icons
550/// via the mime file (see GetObjPictures()).
551
552void TRootIconBox::AddObjItem(const char *name, TObject *obj, TClass *cl)
553{
554 if (!cl) return;
555
556 Bool_t isSystemFile = kFALSE;
557 TGFileItem *fi;
558 fWasGrouped = kFALSE;
559 const TGPicture *pic = 0;
560 const TGPicture *spic = 0;
561
562 if (obj->InheritsFrom("TRemoteObject")) {
563 // check if the real remote object is a system file or directory
564 TRemoteObject *robj = (TRemoteObject *)obj;
565 if ((TString(robj->GetClassName()) == "TSystemFile") ||
566 (TString(robj->GetClassName()) == "TSystemDirectory"))
567 isSystemFile = kTRUE;
568 }
569
570 if (isSystemFile || obj->IsA() == TSystemFile::Class() ||
571 obj->IsA() == TSystemDirectory::Class()) {
572 if (fCheckHeaders) {
573 if (strcmp(fListView->GetHeader(1), "Attributes")) {
576 if (buttons) {
577 buttons[0]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
578 TString::Format("SetSortMode(=%d)", kViewArrangeByName));
579 buttons[1]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
580 TString::Format("SetSortMode(=%d)", kViewArrangeByType));
581 buttons[2]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
582 TString::Format("SetSortMode(=%d)", kViewArrangeBySize));
583 buttons[5]->Connect("Clicked()", "TRootBrowserLite", fBrowser,
584 TString::Format("SetSortMode(=%d)", kViewArrangeByDate));
585 }
586 }
587 fCheckHeaders = kFALSE;
588 }
589
590 TIconBoxThumb *thumb = 0;
591 char *thumbname = gSystem->ConcatFileName(gSystem->WorkingDirectory(), name);
592 thumb = (TIconBoxThumb *)fThumbnails->FindObject(gSystem->IsAbsoluteFileName(name) ? name :
593 thumbname);
594 delete []thumbname;
595
596 if (thumb) {
597 spic = thumb->fSmall;
598 pic = thumb->fLarge;
599 }
600
601 if (obj->InheritsFrom("TRemoteObject"))
602 // special case for remote object
603 fi = AddRemoteFile(obj, spic, pic);
604 else
605 fi = AddFile(name, spic, pic);
606 if (fi) {
607 fi->SetUserData(obj);
608 if (obj->IsA() == TSystemFile::Class()) {
609 TString str;
610 TDNDData data;
611 str = TString::Format("file://%s/%s\r\n",
613 obj->GetName());
614 data.fData = (void *)str.Data();
615 data.fDataLength = str.Length()+1;
616 data.fDataType = gVirtualX->InternAtom("text/uri-list", kFALSE);
617 fi->SetDNDData(&data);
618 fi->SetDNDSource(kTRUE);
619 }
620 }
621
622 fIsEmpty = kFALSE;
623 return;
624 }
625
626 if (!fCurrentList) {
627 fCurrentList = new TRootIconList(this);
628 fGarbage->Add(fCurrentList);
629 }
630
631 fCurrentList->Add(obj);
632 fCurrentList->UpdateName();
633 fIsEmpty = kFALSE;
634
635 TGFrameElement *el;
636 TIter next(fList);
637 while ((el = (TGFrameElement *) next())) {
638 TGLVEntry *f = (TGLVEntry *) el->fFrame;
639 if (f->GetUserData() == obj) {
640 return;
641 }
642 }
643
644 if (fGrouped && fCurrentItem && (fCurrentList->GetSize()>1)) {
645 fCurrentName->SetString(fCurrentList->GetName());
646 }
647
649
650 if ((fCurrentList->GetSize() < fGroupSize) && !fGrouped) {
651 GetObjPictures(&pic, &spic, obj, obj->GetIconName() ?
652 obj->GetIconName() : cl->GetName());
653
654 if (fCheckHeaders) {
655 if (strcmp(fListView->GetHeader(1), "Title")) {
656 SetObjHeaders();
657 }
658 fCheckHeaders = kFALSE;
659 }
660
661 fi = new TRootObjItem(this, pic, spic, new TGString(name), obj, cl, view);
662
663 fi->SetUserData(obj);
664 AddItem(fi);
665 return;
666 }
667
668 if (fGrouped && (fCurrentList->GetSize()==1)) {
669 fCurrentName = new TGString(fCurrentList->GetName());
670 fCurrentItem = new TRootObjItem(this, fCurrentList->GetPicture(), fCurrentList->GetPicture(),
671 fCurrentName,fCurrentList, TList::Class(), view);
672 fCurrentItem->SetUserData(fCurrentList);
673 AddItem(fCurrentItem);
674 fTotal = fList->GetSize();
675 return;
676 }
677
678 if ((fCurrentList->GetSize()==fGroupSize) && !fGrouped) {
679 fGrouped = kTRUE;
680
681 // clear fList
682 TGFrameElement *el2;
683 TIter nextl(fList);
684
685 while ((el2 = (TGFrameElement *) nextl())) {
686 el2->fFrame->DestroyWindow();
687 delete el2->fFrame;
688 fList->Remove(el2);
689 delete el2;
690 }
691
692 fCurrentName = new TGString(fCurrentList->GetName());
693 fi = new TRootObjItem(this, fCurrentList->GetPicture(), fCurrentList->GetPicture(),
694 fCurrentName, fCurrentList, TList::Class(), view);
695 fi->SetUserData(fCurrentList);
696 AddItem(fi);
697
698 fCurrentList = new TRootIconList(this);
699 fGarbage->Add(fCurrentList);
700 fTotal = 1;
701 return;
702 }
703
704 if ((fCurrentList->GetSize()==fGroupSize) && fGrouped) {
705 fCurrentList = new TRootIconList(this);
706 fGarbage->Add(fCurrentList);
707 return;
708 }
709}
710
711////////////////////////////////////////////////////////////////////////////////
712/// browse icon list
713
714void TRootIconList::Browse(TBrowser *)
715{
716 if (!fIconBox) return;
717
718 TObject *obj;
719 TGFileItem *fi;
720 const TGPicture *pic = 0;
721 const TGPicture *spic = 0;
722 TClass *cl;
724 TKey *key = 0;
725
726 fIconBox->RemoveAll();
727 TObjLink *lnk = FirstLink();
728
729 while (lnk) {
730 obj = lnk->GetObject();
731 lnk = lnk->Next();
732
733 if (obj->IsA() == TKey::Class()) {
734 cl = TClass::GetClass(((TKey *)obj)->GetClassName());
735 key = (TKey *)obj;
736 } else if (obj->IsA() == TKeyMapFile::Class()) {
737 cl = TClass::GetClass(((TKeyMapFile *)obj)->GetTitle());
738 } else if (obj->InheritsFrom("TRemoteObject")) {
739 // special case for remote object: get real object class
740 TRemoteObject *robj = (TRemoteObject *)obj;
741 cl = TClass::GetClass(robj->GetClassName());
742 } else {
743 cl = obj->IsA();
744 }
745
746 name = obj->GetName();
747
748 if (key && obj->IsA() == TKey::Class()) {
749 name += ";";
750 name += key->GetCycle();
751 }
752
753 fIconBox->GetObjPictures(&pic, &spic, obj, obj->GetIconName() ?
754 obj->GetIconName() : cl->GetName());
755
756 fi = new TRootObjItem((const TGWindow*)fIconBox, pic, spic, new TGString(name.Data()),
757 obj, cl, (EListViewMode)fIconBox->GetViewMode());
758 fi->SetUserData(obj);
759 fIconBox->AddItem(fi);
760 fIconBox->fTotal++;
761
762 if (obj==fIconBox->fActiveObject) {
763 fIconBox->ActivateItem((TGFrameElement*)fIconBox->fList->Last());
764 }
765 }
766
767 fIconBox->fGarbage->Remove(this);
768 fIconBox->RemoveGarbage();
769 fIconBox->fGarbage->Add(this); // delete this later
770
771 fIconBox->Refresh();
772 fIconBox->AdjustPosition();
773
774 fIconBox->fWasGrouped = kTRUE;
775}
776
777////////////////////////////////////////////////////////////////////////////////
778/// Find a frame which assosiated object has a name containing a "name" string.
779
780void *TRootIconBox::FindItem(const TString& name, Bool_t direction,
781 Bool_t caseSensitive,Bool_t beginWith)
782{
783 if (!fGrouped) {
784 return TGContainer::FindItem(name, direction, caseSensitive, beginWith);
785 }
786
787 if (name.IsNull()) return 0;
788 int idx = kNPOS;
789
790 TGFrameElement* el = 0;
791 TString str;
793
794 fLastDir = direction;
795 fLastCase = caseSensitive;
796 fLastName = name;
797
798 if (fLastActiveEl) {
799 el = fLastActiveEl;
800
801 if (direction) {
802 el = (TGFrameElement *)fList->After(el);
803 } else {
804 el = (TGFrameElement *)fList->Before(el);
805 }
806 } else {
807 if (direction) el = (TGFrameElement *)fList->First();
808 else el = (TGFrameElement *)fList->Last();
809 }
810
811 TGLVEntry* lv = 0;
812 TObject* obj = 0;
813 TList* li = 0;
814
815 while (el) {
816 lv = (TGLVEntry*)el->fFrame;
817 li = (TList*)lv->GetUserData();
818
819 TIter next(li);
820
821 while ((obj=next())) {
822 str = obj->GetName();
823 idx = str.Index(name,0,cmp);
824
825 if (idx!=kNPOS) {
826 if (beginWith) {
827 if (idx==0) {
828 fActiveObject = obj;
829 return el;
830 }
831 } else {
832 fActiveObject = obj;
833 return el;
834 }
835 }
836 }
837 if (direction) {
838 el = (TGFrameElement *)fList->After(el);
839 } else {
840 el = (TGFrameElement *)fList->Before(el);
841 }
842 }
843 fActiveObject = 0;
844 return 0;
845}
846
847////////////////////////////////////////////////////////////////////////////////
848/// Set list box headers used to display detailed object iformation.
849/// Currently this is only "Name" and "Title".
850
851void TRootIconBox::SetObjHeaders()
852{
855 fListView->SetHeader("Title", kTextLeft, kTextLeft, 1);
856}
857
858////////////////////////////////////////////////////////////////////////////////
859/// Sort icons, and send message to browser with number of objects
860/// in box.
861
862void TRootIconBox::Refresh()
863{
864 // This automatically calls layout
865 Sort(fSortType);
866
867 // Make TRootBrowserLite display total objects in status bar
868 SendMessage(fMsgWindow, MK_MSG(kC_CONTAINER, kCT_SELCHANGED), fTotal, fSelected);
869
872}
873
874////////////////////////////////////////////////////////////////////////////////
875/// Remove all items from icon box
876
877void TRootIconBox::RemoveAll()
878{
879 if (fIsEmpty) return;
880
881 fCheckHeaders = kTRUE;
883 fGrouped = kFALSE;
884 fCurrentItem = 0;
885 fCurrentList = 0;
886 fIsEmpty = kTRUE;
887}
888
889
890//_____________________________________________________________________________
891//
892// TRootBrowserLite
893//
894// ROOT object browser (looking like Windows Explorer).
895//_____________________________________________________________________________
896
898
899////////////////////////////////////////////////////////////////////////////////
900/// Create browser with a specified width and height.
901
903 : TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
904{
906
907 Resize(width, height);
908 if (b) Show();
909}
910
911////////////////////////////////////////////////////////////////////////////////
912/// Create browser with a specified width and height and at position x, y.
913
915 UInt_t width, UInt_t height)
916 : TGMainFrame(gClient->GetDefaultRoot(), width, height), TBrowserImp(b)
917{
919
920 MoveResize(x, y, width, height);
921 SetWMPosition(x, y);
922 if (b) Show();
923}
924
925////////////////////////////////////////////////////////////////////////////////
926/// Browser destructor.
927
929{
930 if (fIconPic) gClient->FreePicture(fIconPic);
931
932 delete fToolBarSep;
933
934 fToolBar->Cleanup();
935 delete fToolBar;
936 delete fStatusBar;
937 delete fV1;
938 delete fV2;
939 delete fLbl1;
940 delete fLbl2;
941 delete fHf;
942 delete fTreeHdr;
943 delete fListHdr;
944 delete fIconBox;
945 delete fListView;
946 delete fLt;
947 delete fTreeView;
948
949 delete fMenuBar;
950 delete fFileMenu;
951 delete fViewMenu;
952 delete fOptionMenu;
953 delete fHelpMenu;
954 delete fSortMenu;
955
956 delete fMenuBarLayout;
957 delete fMenuBarItemLayout;
958 delete fMenuBarHelpLayout;
959 delete fBarLayout;
960
961 delete fTextEdit;
962
963 if (fWidgets) fWidgets->Delete();
964 delete fWidgets;
965
966 fHistory->Delete();
967 delete fHistory;
968}
969
970////////////////////////////////////////////////////////////////////////////////
971/// Create the actual browser.
972
974{
975 fWidgets = new TList;
976 fHistory = new TRootBrowserHistory;
977 fHistoryCursor = 0;
979
980 // Create menus
982 fFileMenu->AddEntry("&New Browser", kFileNewBrowser);
983 fFileMenu->AddEntry("New Browser &Lite", kFileNewBrowserLite);
984 fFileMenu->AddEntry("New Canvas", kFileNewCanvas);
985 fFileMenu->AddEntry("&Gui Builder", kFileNewBuilder);
986 fFileMenu->AddEntry("&Open...", kFileOpen);
988 fFileMenu->AddEntry("&Save", kFileSave);
989 fFileMenu->AddEntry("Save &As...", kFileSaveAs);
991 fFileMenu->AddEntry("&Print...", kFilePrint);
993 fFileMenu->AddEntry("&Close Browser", kFileCloseBrowser);
995 fFileMenu->AddEntry("&Quit ROOT", kFileQuit);
996
997 //fFileMenu->DefaultEntry(kFileNewCanvas);
1001
1008 fSortMenu->AddEntry("&Auto Arrange", kViewArrangeAuto);
1009
1011
1013 fViewMenu->AddEntry("&Toolbar", kViewToolBar);
1014 fViewMenu->AddEntry("Status &Bar", kViewStatusBar);
1016 fViewMenu->AddEntry("Lar&ge Icons", kViewLargeIcons);
1017 fViewMenu->AddEntry("S&mall Icons", kViewSmallIcons);
1018 fViewMenu->AddEntry("&List", kViewList);
1019 fViewMenu->AddEntry("&Details", kViewDetails);
1021 fViewMenu->AddEntry("Show &Hidden", kViewHidden);
1022 fViewMenu->AddPopup("Arrange &Icons", fSortMenu);
1023 fViewMenu->AddEntry("Lin&e up Icons", kViewLineUp);
1024 fViewMenu->AddEntry("&Group Icons", kViewGroupLV);
1025
1027 fViewMenu->AddEntry("&Refresh (F5)", kViewRefresh);
1028
1031
1032 if (fBrowser) {
1033 if (gEnv->GetValue("Browser.ShowHidden", 0)) {
1036 } else {
1039 }
1040 }
1041
1043 fOptionMenu->AddEntry("&Show Cycles", kOptionShowCycles);
1044 fOptionMenu->AddEntry("&AutoThumbnail", kOptionAutoThumbnail);
1045
1047 fHelpMenu->AddEntry("&About ROOT...", kHelpAbout);
1049 fHelpMenu->AddEntry("Help On Browser...", kHelpOnBrowser);
1050 fHelpMenu->AddEntry("Help On Canvas...", kHelpOnCanvas);
1051 fHelpMenu->AddEntry("Help On Menus...", kHelpOnMenus);
1052 fHelpMenu->AddEntry("Help On Graphics Editor...", kHelpOnGraphicsEd);
1053 fHelpMenu->AddEntry("Help On Objects...", kHelpOnObjects);
1054 fHelpMenu->AddEntry("Help On PostScript...", kHelpOnPS);
1055 fHelpMenu->AddEntry("Help On Remote Session...", kHelpOnRemote);
1056
1057 // This main frame will process the menu commands
1058 fFileMenu->Associate(this);
1059 fViewMenu->Associate(this);
1060 fSortMenu->Associate(this);
1061 fOptionMenu->Associate(this);
1062 fHelpMenu->Associate(this);
1063
1064 // Create menubar layout hints
1068
1069 // Create menubar
1070 fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
1075
1077
1078 // Create toolbar and separator
1079
1080 fToolBarSep = new TGHorizontal3DLine(this);
1081 fToolBar = new TGToolBar(this, 60, 20, kHorizontalFrame);
1083
1087 fFSComboBox->Associate(this);
1088
1089 int spacing = 8;
1090
1091 for (int i = 0; gToolBarData[i].fPixmap; i++) {
1092 if (strlen(gToolBarData[i].fPixmap) == 0) {
1093 spacing = 8;
1094 continue;
1095 }
1096 fToolBar->AddButton(this, &gToolBarData[i], spacing);
1097 spacing = 0;
1098 }
1099
1100 fDrawOption = new TGComboBox(fToolBar, "");
1101 TGTextEntry *dropt_entry = fDrawOption->GetTextEntry();
1102 dropt_entry->SetToolTipText("Object Draw Option", 300);
1103 fDrawOption->Resize(80, 10);
1105 lb->Resize(lb->GetWidth(), 120);
1106 Int_t dropt = 1;
1107 fDrawOption->AddEntry("", dropt++);
1108 fDrawOption->AddEntry("same", dropt++);
1109 fDrawOption->AddEntry("box", dropt++);
1110 fDrawOption->AddEntry("lego", dropt++);
1111 fDrawOption->AddEntry("colz", dropt++);
1112 fDrawOption->AddEntry("alp", dropt++);
1113 fDrawOption->AddEntry("text", dropt++);
1114
1116 fToolBar->AddFrame(new TGLabel(fToolBar,"Option"),
1117 new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2,2,2,0));
1118
1122
1123 // Create panes
1124
1125 fHf = new TGHorizontalFrame(this, 10, 10);
1126
1127 fV1 = new TGVerticalFrame(fHf, 10, 10, kFixedWidth);
1128 fV2 = new TGVerticalFrame(fHf, 10, 10);
1129 fTreeHdr = new TGCompositeFrame(fV1, 10, 10, kSunkenFrame);
1130 fListHdr = new TGCompositeFrame(fV2, 10, 10, kSunkenFrame);
1131
1132 fLbl1 = new TGLabel(fTreeHdr, "All Folders");
1133 fLbl2 = new TGLabel(fListHdr, "Contents of \".\"");
1134
1135 TGLayoutHints *lo;
1136
1137 lo = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 0, 0);
1138 fWidgets->Add(lo);
1139 fTreeHdr->AddFrame(fLbl1, lo);
1140 fListHdr->AddFrame(fLbl2, lo);
1141
1142 lo = new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 1, 2);
1143 fWidgets->Add(lo);
1144 fV1->AddFrame(fTreeHdr, lo);
1145 fV2->AddFrame(fListHdr, lo);
1146
1148
1150 fWidgets->Add(lo);
1151 fHf->AddFrame(fV1, lo);
1152
1154 splitter->SetFrame(fV1, kTRUE);
1157 fWidgets->Add(lo);
1158 fHf->AddFrame(splitter, lo);
1159
1161 fWidgets->Add(lo);
1162 fHf->AddFrame(fV2, lo);
1163
1164 // Create tree
1165 fTreeView = new TGCanvas(fV1, 10, 10, kSunkenFrame | kDoubleBorder); // canvas
1167 fLt->Associate(this);
1168 fLt->SetAutoTips();
1169
1173
1174 // Create list view (icon box)
1175 fListView = new TGListView(fV2, 520, 250); // canvas
1176 // container
1178 fIconBox->Associate(this);
1179 fListView->SetIncrements(1, 19); // set vertical scroll one line height at a time
1181
1182 TString str = gEnv->GetValue("Browser.AutoThumbnail", "yes");
1183 str.ToLower();
1184 fIconBox->fAutoThumbnail = (str == "yes") || atoi(str.Data());
1187
1188 str = gEnv->GetValue("Browser.GroupView", "10000");
1189 Int_t igv = atoi(str.Data());
1190
1191 if (igv>10) {
1193 fIconBox->SetGroupSize(igv);
1194 }
1195
1196 // reuse lo from "create tree"
1198
1199 AddFrame(fHf, lo);
1200
1201 // Statusbar
1202
1203 int parts[] = { 26, 74 };
1204 fStatusBar = new TGStatusBar(this, 60, 10);
1205 fStatusBar->SetParts(parts, 2);
1206 lo = new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 0, 0, 3, 0);
1207 AddFrame(fStatusBar, lo);
1208
1209 fTextEdit = 0;
1210
1211 // Misc
1212 TString bname(name);
1213 bname.Prepend("Old ");
1214 SetWindowName(bname.Data());
1215 SetIconName(bname.Data());
1216 fIconPic = SetIconPixmap("rootdb_s.xpm");
1217 SetClassHints("ROOT", "Browser");
1218
1219 SetWMSizeHints(600, 350, 10000, 10000, 2, 2);
1220
1221 fListLevel = 0;
1222 fTreeLock = kFALSE;
1223
1224 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Escape), 0, kTRUE);
1225 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_F5), 0, kTRUE);
1226 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Right), kKeyMod1Mask, kTRUE);
1227 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Left), kKeyMod1Mask, kTRUE);
1228 ClearHistory();
1230
1231 gVirtualX->SetDNDAware(fId, fDNDTypeList);
1232 MapSubwindows();
1233 SetDefaults();
1234 Resize();
1236
1237 printf("\n You are using the old ROOT browser! A new version is available. To use it:\n");
1238 printf(" Select the \"New Browser\" entry from the \"File\" menu in the browser, or change\n");
1239 printf(" \"Browser.Name:\" from \"TRootBrowserLite\" to \"TRootBrowser\" in system.rootrc\n\n");
1240
1241 Connect(fLt, "Checked(TObject*, Bool_t)", "TRootBrowserLite",
1242 this, "Checked(TObject *,Bool_t)");
1243}
1244
1245////////////////////////////////////////////////////////////////////////////////
1246/// handle keys
1247
1249{
1250 if (event->fType == kGKeyPress) {
1251 UInt_t keysym;
1252 char input[10];
1253 gVirtualX->LookupString(event, input, sizeof(input), keysym);
1254
1255 if (!event->fState && (EKeySym)keysym == kKey_F5) {
1256 Refresh(kTRUE);
1257 return kTRUE;
1258 }
1259 if (!event->fState && (EKeySym)keysym == kKey_Escape) {
1261 }
1262
1263 if (event->fState & kKeyMod1Mask) {
1264 switch ((EKeySym)keysym & ~0x20) {
1265 case kKey_Right:
1267 return kTRUE;
1268 case kKey_Left:
1270 return kTRUE;
1271 default:
1272 break;
1273 }
1274 }
1275 }
1276 return TGMainFrame::HandleKey(event);
1277}
1278
1279////////////////////////////////////////////////////////////////////////////////
1280/// Add items to the browser. This function has to be called
1281/// by the Browse() member function of objects when they are
1282/// called by a browser. If check < 0 (default) no check box is drawn,
1283/// if 0 then unchecked checkbox is added, if 1 checked checkbox is added.
1284
1285void TRootBrowserLite::Add(TObject *obj, const char *name, Int_t check)
1286{
1287 if (!obj)
1288 return;
1289 if (obj->InheritsFrom("TObjectSpy"))
1290 return;
1291 if (!name) name = obj->GetName();
1292
1293 AddToBox(obj, name);
1294 if (check > -1) {
1295 TGFrameElement *el;
1296 TIter next(fIconBox->fList);
1297 if (!obj->IsFolder()) {
1298 while ((el = (TGFrameElement *) next())) {
1299 TGLVEntry *f = (TGLVEntry *) el->fFrame;
1300 if (f->GetUserData() == obj) {
1301 f->SetCheckedEntry(check);
1302 }
1303 }
1304 }
1305 }
1306
1307 // Don't show current dir and up dir links in the tree
1308 if (name[0] == '.' && ((name[1] == '\0') || (name[1] == '.' && name[2] == '\0')))
1309 return;
1310
1311 if (obj->IsFolder())
1312 AddToTree(obj, name, check);
1313}
1314
1315////////////////////////////////////////////////////////////////////////////////
1316/// Add a checkbox in the TGListTreeItem corresponding to obj
1317/// and a checkmark on TGLVEntry if check = kTRUE.
1318
1320{
1321 if (obj) {
1323 while (item) {
1324 fLt->SetCheckBox(item, kTRUE);
1325 fLt->CheckItem(item, check);
1326 item = fLt->FindItemByObj(item->GetNextSibling(), obj);
1327 }
1328 TGFrameElement *el;
1329 TIter next(fIconBox->fList);
1330 while ((el = (TGFrameElement *) next())) {
1331 TGLVEntry *f = (TGLVEntry *) el->fFrame;
1332 if (f->GetUserData() == obj) {
1333 f->SetCheckedEntry(check);
1334 }
1335 }
1336 }
1337}
1338
1339////////////////////////////////////////////////////////////////////////////////
1340/// Check / uncheck the TGListTreeItem corresponding to this
1341/// object and add a checkmark on TGLVEntry if check = kTRUE.
1342
1344{
1345 if (obj) {
1347 while (item) {
1348 fLt->CheckItem(item, check);
1349 item = fLt->FindItemByObj(item->GetNextSibling(), obj);
1350 TGFrameElement *el;
1351 TIter next(fIconBox->fList);
1352 if (!obj->IsFolder()) {
1353 while ((el = (TGFrameElement *) next())) {
1354 TGLVEntry *f = (TGLVEntry *) el->fFrame;
1355 if (f->GetUserData() == obj) {
1356 f->SetCheckedEntry(check);
1357 }
1358 }
1359 }
1360 }
1361 }
1362}
1363
1364////////////////////////////////////////////////////////////////////////////////
1365/// Remove checkbox from TGListTree and checkmark from TGListView.
1366
1368{
1369 if (obj) {
1371 while (item) {
1372 fLt->SetCheckBox(item, kFALSE);
1373 item = fLt->FindItemByObj(item->GetNextSibling(), obj);
1374 TGFrameElement *el;
1375 TIter next(fIconBox->fList);
1376 if (!obj->IsFolder()) {
1377 while ((el = (TGFrameElement *) next())) {
1378 TGLVEntry *f = (TGLVEntry *) el->fFrame;
1379 if (f->GetUserData() == obj) {
1380 f->SetCheckedEntry(kFALSE);
1381 }
1382 }
1383 }
1384 }
1385 }
1386}
1387
1388////////////////////////////////////////////////////////////////////////////////
1389/// Add items to the iconbox of the browser.
1390
1392{
1393 if (obj) {
1394 if (!name) name = obj->GetName() ? obj->GetName() : "NoName";
1395 //const char *titlePtr = obj->GetTitle() ? obj->GetTitle() : " ";
1396
1397 TClass *objClass = 0;
1398
1399 if (obj->IsA() == TKey::Class())
1400 objClass = TClass::GetClass(((TKey *)obj)->GetClassName());
1401 else if (obj->IsA() == TKeyMapFile::Class())
1402 objClass = TClass::GetClass(((TKeyMapFile *)obj)->GetTitle());
1403 else if (obj->InheritsFrom("TRemoteObject")) {
1404 // special case for remote object: get real object class
1405 TRemoteObject *robj = (TRemoteObject *)obj;
1406 if (!strcmp(robj->GetClassName(), "TKey"))
1407 objClass = TClass::GetClass(robj->GetKeyClassName());
1408 else
1409 objClass = TClass::GetClass(robj->GetClassName());
1410 }
1411 else
1412 objClass = obj->IsA();
1413
1414 fIconBox->AddObjItem(name, obj, objClass);
1415 }
1416}
1417
1418////////////////////////////////////////////////////////////////////////////////
1419/// Add items to the current TGListTree of the browser.
1420
1421void TRootBrowserLite::AddToTree(TObject *obj, const char *name, Int_t check)
1422{
1423 if (!obj)
1424 return;
1425 if (obj->InheritsFrom("TApplication"))
1426 fListLevel = 0;
1427 if (!fTreeLock) {
1428 if (!name) name = obj->GetName();
1429 if (name[0] == '.' && name[1] == '.')
1430 Info("AddToTree", "up one level %s", name);
1431 if(check > -1) {
1432 TGListTreeItem *item = fLt->AddItem(fListLevel, name, obj, 0, 0, kTRUE);
1433 if (item) fLt->CheckItem(item, (Bool_t)check);
1434 TString tip(obj->ClassName());
1435 if (obj->GetTitle()) {
1436 tip += " ";
1437 tip += obj->GetTitle();
1438 }
1439 fLt->SetToolTipItem(item, tip.Data());
1440 } else {
1441 // special case for remote object
1442 if (obj->InheritsFrom("TRemoteObject")) {
1443 // Nothing to do
1444 } else if (fListLevel) {
1445 // check also if one of its parents is a remote object
1447 while (top->GetParent()) {
1448 TObject *tobj = (TObject *) top->GetUserData();
1449 if (tobj && (tobj->InheritsFrom("TRemoteObject") ||
1450 tobj->InheritsFrom("TApplicationRemote"))) {
1451 break;
1452 }
1453 top = top->GetParent();
1454 }
1455 }
1456 // add the object only if not already in the list
1457 if ((!fLt->FindChildByName(fListLevel, name)) &&
1458 (!fLt->FindChildByData(fListLevel, obj))) {
1460 Long64_t bsize, fsize, objsize = 0;
1461 TString objinfo = obj->GetObjectInfo(1, 1);
1462 TString infos = obj->GetName();
1463 infos += "\n";
1464 infos += obj->GetTitle();
1465 if (!objinfo.IsNull() && !objinfo.BeginsWith("x=")) {
1466 objsize = objinfo.Atoll();
1467 if (objsize > 0) {
1468 infos += "\n";
1469 bsize = fsize = objsize;
1470 if (fsize > 1024) {
1471 fsize /= 1024;
1472 if (fsize > 1024) {
1473 // 3.7MB is more informative than just 3MB
1474 infos += TString::Format("Size: %lld.%lldM", fsize/1024,
1475 (fsize%1024)/103);
1476 } else {
1477 infos += TString::Format("Size: %lld.%lldK", bsize/1024,
1478 (bsize%1024)/103);
1479 }
1480 } else {
1481 infos += TString::Format("Size: %lld bytes", bsize);
1482 }
1483 }
1484 }
1485 if (it)
1486 it->SetTipText(infos.Data());
1487 }
1488 }
1489 }
1490}
1491
1492////////////////////////////////////////////////////////////////////////////////
1493/// Browse object. This, in turn, will trigger the calling of
1494/// TRootBrowserLite::Add() which will fill the IconBox and the tree.
1495/// Emits signal "BrowseObj(TObject*)".
1496
1498{
1499 TGPosition pos = fIconBox->GetPagePosition();
1500 Emit("BrowseObj(TObject*)", (Long_t)obj);
1501
1502 if (obj != gROOT) {
1503 if (!fLt->FindItemByObj(fLt->GetFirstItem(), obj)) {
1504 fListLevel = 0;
1505 Add(obj);
1508 if (obj->IsFolder())
1510 fLt->ClearViewPort();
1512 }
1513 }
1514
1515 if (obj->IsFolder()) fIconBox->RemoveAll();
1516 obj->Browse(fBrowser);
1517 if ((fListLevel && obj->IsFolder()) || (!fListLevel && (obj == gROOT))) {
1518 fIconBox->Refresh();
1519 }
1520
1521 if (fBrowser) {
1523 }
1525
1526 fIconBox->SetHsbPosition(pos.fX);
1527 fIconBox->SetVsbPosition(pos.fY);
1528}
1529
1530////////////////////////////////////////////////////////////////////////////////
1531/// add new draw option to the "history"
1532
1534{
1535 TString opt = GetDrawOption();
1538
1539 TIter next(lbc->GetList());
1540 TGFrameElement *el;
1541
1542 while ((el = (TGFrameElement *)next())) {
1543 TGTextLBEntry *lbe = (TGTextLBEntry *)el->fFrame;
1544 if (lbe->GetText()->GetString() == opt) {
1545 return;
1546 }
1547 }
1548
1550 fDrawOption->AddEntry(opt.Data(), nn);
1551 fDrawOption->Select(nn);
1552}
1553
1554////////////////////////////////////////////////////////////////////////////////
1555/// returns pointer to fIconBox object
1556
1558{
1559 return (TGFileContainer*)fIconBox;
1560}
1561
1562////////////////////////////////////////////////////////////////////////////////
1563/// Really delete the browser and the this GUI.
1564
1566{
1568 delete this;
1569}
1570
1571////////////////////////////////////////////////////////////////////////////////
1572/// In case window is closed via WM we get here.
1573
1575{
1576 DeleteWindow();
1577}
1578
1579////////////////////////////////////////////////////////////////////////////////
1580/// Display in statusbar total number of objects and number of
1581/// selected objects in IconBox.
1582
1584{
1585 char tmp[64];
1586 const char *fmt;
1587
1588 if (selected)
1589 fmt = "%d Object%s, %d selected.";
1590 else
1591 fmt = "%d Object%s.";
1592
1593 snprintf(tmp, 64, fmt, total, (total == 1) ? "" : "s", selected);
1594 fStatusBar->SetText(tmp, 0);
1595}
1596
1597////////////////////////////////////////////////////////////////////////////////
1598/// Display current directory in second label, fLbl2.
1599
1601{
1602 char *p, path[1024];
1603
1605 p = path;
1606 while (*p && *(p+1) == '/') ++p;
1607 if (!p[0])
1608 fLbl2->SetText(new TGString("Contents of \".\""));
1609 else
1610 fLbl2->SetText(new TGString(Form("Contents of \"%s\"", p)));
1611 fListHdr->Layout();
1612
1613 // Get full pathname for FS combobox (previously truncated to 12 levels deep)
1615 p = path;
1616 while (*p && *(p+1) == '/') ++p;
1617 fFSComboBox->Update(p);
1618
1619 if (fListLevel) {
1620 // disable/enable up level navigation
1622 TString dirname = gSystem->GetDirName(p);
1623
1625 Bool_t disableUp = dirname == "/";
1626
1627 // normal file directory
1628 if (disableUp && (obj) && (obj->IsA() == TSystemDirectory::Class())) {
1629 disableUp = strlen(p) == 1;
1630 }
1631 btn->SetState(disableUp ? kButtonDisabled : kButtonUp);
1633 }
1634}
1635
1636////////////////////////////////////////////////////////////////////////////////
1637/// Execute default action for selected object (action is specified
1638/// in the $HOME/.root.mimes or $ROOTSYS/etc/root.mimes file.
1639/// Emits signal "ExecuteDefaultAction(TObject*)".
1640
1642{
1643 TRootBrowserCursorSwitcher cursorSwitcher(fIconBox, fLt);
1644 char action[512];
1646 TVirtualPad *wasp = gPad ? (TVirtualPad*)gPad->GetCanvas() : 0;
1647 TFile *wasf = gFile;
1648
1649 // Special case for file system objects...
1650 if (obj->IsA() == TSystemFile::Class() ||
1651 obj->InheritsFrom("TRemoteObject")) {
1652 TString act;
1653 TString ext = obj->GetName();
1654
1655 if (fClient->GetMimeTypeList()->GetAction(obj->GetName(), action)) {
1656 act = action;
1657 act.ReplaceAll("%s", obj->GetName());
1658 gInterpreter->SaveGlobalsContext();
1659
1660 if (act[0] == '!') {
1661 act.Remove(0, 1);
1662 gSystem->Exec(act.Data());
1663 } else {
1664 // special case for remote object: remote process
1665 if (obj->InheritsFrom("TRemoteObject"))
1668 }
1669 Emit("ExecuteDefaultAction(TObject*)", (Long_t)obj);
1670 }
1671
1672 // special case for remote object: browse real object
1673 if (obj->InheritsFrom("TRemoteObject") && ext.EndsWith(".root")) {
1674 TRootBrowserCursorSwitcher cursorSwitcher2(fIconBox, fLt);
1676 gApplication->ProcessLine("((TApplicationServer *)gApplication)->BrowseFile(0);");
1677 Refresh();
1678 }
1679 ////////// new TFile was opened. Add it to the browser /////
1680 if (gFile && (wasf != gFile) && ext.EndsWith(".root")) {
1681 TGListTreeItem *itm = fLt->FindChildByData(0, gROOT->GetListOfFiles());
1682
1683 if (itm) {
1685 fListLevel = itm;
1688 itm = fLt->AddItem(fListLevel, gFile->GetName());
1689 itm->SetUserData(gFile);
1691 return;
1692 }
1693 }
1694
1695 // only valid for local text files
1696 if (!obj->InheritsFrom("TRemoteObject"))
1697 BrowseTextFile(obj->GetName());
1698
1699 /////////////// cache and change file's icon ///////////////////////
1700 TVirtualPad *nowp = gPad ? (TVirtualPad*)gPad->GetCanvas() : 0;
1701
1702 if (fIconBox->fAutoThumbnail && nowp && (nowp != wasp)) {
1703 TSystemFile *sf = (TSystemFile*)obj;
1704 const TGPicture *pic, *spic;
1705
1706 TString path;
1707 if (gSystem->IsAbsoluteFileName(sf->GetName())) {
1708 path = sf->GetName();
1709 } else {
1710 char *buf = gSystem->ConcatFileName(gSystem->WorkingDirectory(), sf->GetName());
1711 path = buf;
1712 delete [] buf;
1713 }
1714
1715 TIconBoxThumb *thumb = (TIconBoxThumb*)fIconBox->fThumbnails->FindObject(path.Data());
1716
1717 if (thumb) {
1718 spic = thumb->fSmall;
1719 pic = thumb->fLarge;
1720 } else {
1721 TImage *img = TImage::Create();
1722 nowp->Modified();
1723 nowp->Update();
1724 img->FromPad(nowp);
1725
1726 if (!img->IsValid()) {
1727 return;
1728 }
1729
1730 static const UInt_t sz = 72;
1731 UInt_t w = sz;
1732 UInt_t h = sz;
1733
1734 auto imgw = img->GetWidth();
1735 auto imgh = img->GetHeight();
1736
1737 if (imgw > imgh) {
1738 h = (imgh*sz) / (imgw > 0 ? imgw : 1);
1739 } else {
1740 w = (imgw*sz) / (imgh > 0 ? imgh : 1);
1741 }
1742
1743 w = (w < 54) ? 54 : w;
1744 h = (h < 54) ? 54 : h;
1745
1746 img->Scale(w, h);
1747 img->Merge(img, "tint"); // contrasting
1748 img->DrawBox(0, 0, w, h, "#ffff00", 1); // yellow frame
1749
1750 pic = fClient->GetPicturePool()->GetPicture(path.Data(), img->GetPixmap(), 0);
1751 img->Scale(w/3, h/3);
1752 spic = fClient->GetPicturePool()->GetPicture(path.Data(), img->GetPixmap(), 0);
1753
1754 thumb = new TIconBoxThumb(path.Data(), spic, pic);
1755 fIconBox->fThumbnails->Add(thumb);
1756 delete img;
1757 }
1758 }
1759 return;
1760 }
1761
1762 // For other objects the default action is still hard coded in
1763 // their Browse() member function.
1764}
1765
1766////////////////////////////////////////////////////////////////////////////////
1767/// Handle menu and other command generated by the user.
1768
1770{
1771 TRootHelpDialog *hd;
1772 TRootBrowserCursorSwitcher *cursorSwitcher = 0;
1773 TDirectory *tdir = 0;
1774 TString cmd;
1775
1776 if (GET_SUBMSG(msg) != kCT_SELCHANGED) {
1777 cursorSwitcher = new TRootBrowserCursorSwitcher(fIconBox, fLt);
1778 }
1779
1780 TObject *obj;
1781 TGListTreeItem *item = 0;
1782
1783 gVirtualX->Update();
1784
1785 switch (GET_MSG(msg)) {
1786
1787 case kC_COMMAND:
1788
1789 switch (GET_SUBMSG(msg)) {
1790
1791 case kCM_BUTTON:
1792 // fallthrough
1793 case kCM_MENU:
1794
1795 switch ((ERootBrowserCommands)parm1) {
1796 // Handle File menu items...
1798 new TBrowser("Browser", "ROOT Object Browser");
1799 break;
1800 case kFileNewBrowser:
1801 gEnv->SetValue("Browser.Name", "TRootBrowser");
1802 new TBrowser();
1803 gEnv->SetValue("Browser.Name", "TRootBrowserLite");
1804 break;
1805 case kFileNewCanvas:
1806 gROOT->MakeDefCanvas();
1807 break;
1808 case kFileNewBuilder:
1810 break;
1811 case kFileOpen:
1812 {
1813 static TString dir(".");
1814 TGFileInfo fi;
1816 fi.SetIniDir(dir);
1817 new TGFileDialog(fClient->GetDefaultRoot(), this,
1818 kFDOpen,&fi);
1819 dir = fi.fIniDir;
1820 if (fi.fMultipleSelection && fi.fFileNamesList) {
1821 TObjString *el;
1822 TIter next(fi.fFileNamesList);
1823 while ((el = (TObjString *) next())) {
1824 new TFile(el->GetString(), "update");
1825 }
1826 }
1827 else if (fi.fFilename) {
1828 new TFile(fi.fFilename, "update");
1829 }
1830 }
1831 break;
1832 case kFileSave:
1833 case kFileSaveAs:
1834 break;
1835 case kFilePrint:
1836 break;
1837 case kFileCloseBrowser:
1839 break;
1840 case kFileQuit:
1842 break;
1843
1844 // Handle View menu items...
1845 case kViewToolBar:
1848 else
1849 ShowToolBar();
1850 break;
1851 case kViewStatusBar:
1854 else
1855 ShowStatusBar();
1856 break;
1857 case kViewLargeIcons:
1858 case kViewSmallIcons:
1859 case kViewList:
1860 case kViewDetails:
1861 SetViewMode((Int_t)parm1);
1862 break;
1863 case kViewHidden:
1867 } else {
1870 }
1871 Refresh(kTRUE);
1872 break;
1873 case kViewArrangeByName:
1874 case kViewArrangeByType:
1875 case kViewArrangeBySize:
1876 case kViewArrangeByDate:
1877 SetSortMode((Int_t)parm1);
1878 break;
1879 case kViewLineUp:
1880 break;
1881 case kViewRefresh:
1882 Refresh(kTRUE);
1883 break;
1884 case kViewGroupLV:
1887 TString gv = gEnv->GetValue("Browser.GroupView", "10000");
1888 Int_t igv = atoi(gv.Data());
1889
1890 if (igv > 10) {
1891 fIconBox->SetGroupSize(igv);
1892 }
1893 } else {
1895 fIconBox->SetGroupSize(10000000); // very large value
1896 }
1897 break;
1898
1899 // Handle Option menu items...
1900 case kOptionShowCycles:
1901 printf("Currently the browser always shows all cycles\n");
1902 break;
1903
1907 fIconBox->fThumbnails->Delete();
1908 fIconBox->fAutoThumbnail = kFALSE;
1909 Refresh(kTRUE);
1910 } else {
1912 fIconBox->fAutoThumbnail = kTRUE;
1913 }
1914 break;
1915
1916 // Handle toolbar button...
1917 case kOneLevelUp:
1918 {
1919 if (fBrowseTextFile) {
1920 HideTextEdit();
1921 break;
1922 }
1923 if (!fListLevel || !fListLevel->IsActive()) break;
1924
1925 if (fListLevel && fIconBox->WasGrouped()) {
1926 if (fListLevel) {
1927 item = fListLevel->GetParent();
1928 if (item) fListLevel = item;
1929 obj = (TObject *) fListLevel->GetUserData();
1931 if (obj) BrowseObj(obj);
1932 }
1933
1935 break;
1936 }
1937 if (fListLevel) item = fListLevel->GetParent();
1938
1939
1940 if (item) {
1941 fListLevel = item;
1942 obj = (TObject *)fListLevel->GetUserData();
1945 if (obj) BrowseObj(obj);
1947 } else {
1948 obj = (TObject *)fListLevel->GetUserData();
1949 if (obj) ToSystemDirectory(gSystem->GetDirName(obj->GetTitle()));
1950 }
1951 break;
1952 }
1953
1954 // toolbar buttons
1955 case kHistoryBack:
1957 break;
1958 case kHistoryForw:
1960 break;
1961
1962 case kViewFind:
1963 Search();
1964 break;
1965
1966 // Handle Help menu items...
1967 case kHelpAbout:
1968 {
1969#ifdef R__UNIX
1970 TString rootx = TROOT::GetBinDir() + "/root -a &";
1971 gSystem->Exec(rootx);
1972#else
1973#ifdef WIN32
1975#else
1976 char str[32];
1977 sprintf(str, "About ROOT %s...", gROOT->GetVersion());
1978 hd = new TRootHelpDialog(this, str, 600, 400);
1979 hd->SetText(gHelpAbout);
1980 hd->Popup();
1981#endif
1982#endif
1983 }
1984 break;
1985 case kHelpOnCanvas:
1986 hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
1987 hd->SetText(gHelpCanvas);
1988 hd->Popup();
1989 break;
1990 case kHelpOnMenus:
1991 hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
1993 hd->Popup();
1994 break;
1995 case kHelpOnGraphicsEd:
1996 hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
1998 hd->Popup();
1999 break;
2000 case kHelpOnBrowser:
2001 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
2003 hd->Popup();
2004 break;
2005 case kHelpOnObjects:
2006 hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
2007 hd->SetText(gHelpObjects);
2008 hd->Popup();
2009 break;
2010 case kHelpOnPS:
2011 hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
2013 hd->Popup();
2014 break;
2015 case kHelpOnRemote:
2016 hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
2017 hd->SetText(gHelpRemote);
2018 hd->Popup();
2019 break;
2020 default:
2021 break;
2022 }
2023 break;
2024 case kCM_COMBOBOX:
2025 if (parm1 == kFSComboBox) {
2027 if (e) {
2028 const char *dirname = e->GetPath()->GetString();
2029 item = fLt->FindItemByPathname(dirname);
2030 if (item) {
2031 fListLevel = item;
2035 } else {
2036 ToSystemDirectory(dirname);
2037 }
2038 }
2039 }
2040 break;
2041 default:
2042 break;
2043 }
2044
2045 break;
2046
2047 case kC_LISTTREE:
2048 switch (GET_SUBMSG(msg)) {
2049
2050 case kCT_ITEMCLICK:
2051 // tell coverity that parm1 is a Long_t, and not an enum (even
2052 // if we compare it with an enum value) and the meaning of
2053 // parm1 depends on GET_MSG(msg) and GET_SUBMSG(msg)
2054 // coverity[mixed_enums]
2055 if (((EMouseButton)parm1 == kButton1) ||
2056 ((EMouseButton)parm1 == kButton3)) {
2057 HideTextEdit();
2058 TGListTreeItem *item2;
2059 TObject *obj2 = 0;
2060 if ((item2 = fLt->GetSelected()) != 0 ) {
2061 ListTreeHighlight(item2);
2062 fStatusBar->SetText("", 1); // clear
2063 }
2064 if (item2 && parm1 == kButton3) {
2065 Int_t x = (Int_t)(parm2 & 0xffff);
2066 Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
2067 obj2 = (TObject *) item2->GetUserData();
2068 if (obj2) {
2069 if (obj2->InheritsFrom("TTree")) {
2070 // if a tree not attached to any directory (e.g. in a TFolder)
2071 // then attach it to the current directory (gDirectory)
2072 cmd = TString::Format("((TTree *)0x%lx)->GetDirectory();",
2073 (ULong_t)obj2);
2074 tdir = (TDirectory *)gROOT->ProcessLine(cmd.Data());
2075 if (!tdir) {
2076 cmd = TString::Format("((TTree *)0x%lx)->SetDirectory(gDirectory);",
2077 (ULong_t)obj2);
2078 gROOT->ProcessLine(cmd.Data());
2079 }
2080 }
2081 fBrowser->GetContextMenu()->Popup(x, y, obj2, fBrowser);
2082 }
2083 }
2086 fListView->Layout();
2087 }
2088 break;
2089
2090 case kCT_ITEMDBLCLICK:
2091 if (parm1 == kButton1) {
2092 if (fBrowseTextFile) {
2093 HideTextEdit();
2094 }
2095 if (fListLevel && fIconBox->WasGrouped()) {
2096 TObject *obj2;
2097 TGListTreeItem *item2;
2098
2099 if (fListLevel) {
2100 item2 = fListLevel->GetParent();
2101 if (item2) fListLevel = item2;
2102
2103 obj2 = (TObject *) fListLevel->GetUserData();
2105 if (obj2) {
2106 BrowseObj(obj2);
2107 }
2108 }
2109 break;
2110 }
2111 }
2112
2113 default:
2114 break;
2115 }
2116 break;
2117
2118 case kC_CONTAINER:
2119 switch (GET_SUBMSG(msg)) {
2120
2121 case kCT_ITEMCLICK:
2122 if (fIconBox->NumSelected() == 1) {
2123 // display title of selected object
2124 TGFileItem *item2;
2125 void *p = 0;
2126 if ((item2 = (TGFileItem *)fIconBox->GetNextSelected(&p)) != 0) {
2127 TObject *obj2 = (TObject *)item2->GetUserData();
2128
2129 TGListTreeItem *itm = 0;
2130 if (!fListLevel) itm = fLt->GetFirstItem();
2131 else itm = fListLevel->GetFirstChild();
2132 //Bool_t found = kFALSE;
2133
2134 while (itm) {
2135 if (itm->GetUserData() == obj2) break;
2136 itm = itm->GetNextSibling();
2137 }
2138
2139 if (itm) {
2140 if ((fListLevel && fListLevel->IsOpen()) || !fListLevel) {
2142 fLt->HighlightItem(itm);
2144 }
2145 }
2146
2147 if (obj2) fStatusBar->SetText(obj2->GetName(), 1);
2148 }
2149 }
2150 if (parm1 == kButton3) {
2151 // show context menu for selected object
2152 if (fIconBox->NumSelected() == 1) {
2153 void *p = 0;
2154 TGFileItem *item2;
2155 if ((item2 = (TGFileItem *) fIconBox->GetNextSelected(&p)) != 0) {
2156 Int_t x = (Int_t)(parm2 & 0xffff);
2157 Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
2158 TObject *obj2 = (TObject *)item2->GetUserData();
2159 if (obj2) {
2160 if (obj2->IsA() == TKey::Class()) {
2161 TKey *key = (TKey*)obj2;
2162 TClass *cl = TClass::GetClass(key->GetClassName());
2163 TString name = key->GetName();
2164 name += ";";
2165 name += key->GetCycle();
2166 //void *add = gROOT->FindObject((char *) name.Data());//key->GetName());
2167 void *add = gDirectory->FindObjectAny((char *) name.Data());
2168 if (cl->IsTObject()) {
2169 obj2 = (TObject*)add; // cl->DynamicCast(TObject::Class(),startadd);
2170 item2->SetUserData(obj2);
2171 } else {
2172 Error("ProcessMessage","do not support non TObject (like %s) yet",
2173 cl->GetName());
2174 break;
2175 }
2176 }
2177 if (obj2 && obj2->InheritsFrom("TTree")) {
2178 // if a tree not attached to any directory (e.g. in a TFolder)
2179 // then attach it to the current directory (gDirectory)
2180 cmd = TString::Format("((TTree *)0x%lx)->GetDirectory();",
2181 (ULong_t)obj2);
2182 tdir = (TDirectory *)gROOT->ProcessLine(cmd.Data());
2183 if (!tdir) {
2184 cmd = TString::Format("((TTree *)0x%lx)->SetDirectory(gDirectory);",
2185 (ULong_t)obj2);
2186 gROOT->ProcessLine(cmd.Data());
2187 }
2188 }
2189 fBrowser->GetContextMenu()->Popup(x, y, obj2, fBrowser);
2190 }
2191 }
2192 }
2193 }
2194 break;
2195 case kCT_ITEMDBLCLICK:
2196 if (parm1 == kButton1) {
2197 if (fIconBox->NumSelected() == 1) {
2198 void *p = 0;
2199 TGFileItem *item2;
2200 if ((item2 = (TGFileItem *) fIconBox->GetNextSelected(&p)) != 0) {
2201 TObject *obj2 = (TObject *)item2->GetUserData();
2202 if (obj2) {
2203 DoubleClicked(obj2);
2204 IconBoxAction(obj2);
2205 }
2206 delete cursorSwitcher;
2207 return kTRUE; //
2208 }
2209 }
2210 }
2211 break;
2212 case kCT_SELCHANGED:
2213 DisplayTotal((Int_t)parm1, (Int_t)parm2);
2214 break;
2215 default:
2216 break;
2217 }
2218
2219 break;
2220
2221 default:
2222 break;
2223 }
2224
2225 delete cursorSwitcher;
2226
2228 return kTRUE;
2229}
2230
2231////////////////////////////////////////////////////////////////////////////////
2232/// Make object associated with item the current directory.
2233
2235{
2236 if (item) {
2237 TGListTreeItem *i = item;
2238 TString dir;
2239 while (i) {
2240 TObject *obj = (TObject*) i->GetUserData();
2241 if (obj) {
2242 if (obj->IsA() == TDirectoryFile::Class()) {
2243 dir = "/" + dir;
2244 dir = obj->GetName() + dir;
2245 }
2246 if (obj->IsA() == TFile::Class()) {
2247 dir = ":/" + dir;
2248 dir = obj->GetName() + dir;
2249 }
2250 if (obj->IsA() == TKey::Class()) {
2251 if (strcmp(((TKey*)obj)->GetClassName(), "TDirectoryFile") == 0) {
2252 dir = "/" + dir;
2253 dir = obj->GetName() + dir;
2254 }
2255 }
2256 }
2257 i = i->GetParent();
2258 }
2259
2260 if (gDirectory && dir.Length()) gDirectory->cd(dir.Data());
2261 }
2262}
2263
2264////////////////////////////////////////////////////////////////////////////////
2265/// helper method to track history
2266
2268{
2269 if (!fListLevel) return;
2270
2273}
2274
2275////////////////////////////////////////////////////////////////////////////////
2276/// helper method to track history
2277
2279{
2281
2282 if (!item || (fHistoryCursor &&
2283 (item == ((TRootBrowserHistoryCursor*)fHistoryCursor)->fItem))) return;
2284
2285 TRootBrowserHistoryCursor *cur = (TRootBrowserHistoryCursor*)fHistoryCursor;
2286
2287 while ((cur = (TRootBrowserHistoryCursor*)fHistory->After(fHistoryCursor))) {
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 }
2319 TRootBrowserHistoryCursor *cur = (TRootBrowserHistoryCursor*)fHistory->Before(fHistoryCursor);
2322
2323 if (!cur) {
2325 return kFALSE;
2326 }
2327
2329 fHistoryCursor = cur;
2330 fListLevel = cur->fItem;
2334
2335 btn2->SetState(kButtonUp);
2336 cur = (TRootBrowserHistoryCursor*)fHistory->Before(fHistoryCursor);
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
2355 TRootBrowserHistoryCursor *cur = (TRootBrowserHistoryCursor*)fHistory->After(fHistoryCursor);
2358
2359 if (!cur) {
2361 return kFALSE;
2362 }
2363
2365 fHistoryCursor = cur;
2366 fListLevel = cur->fItem;
2370
2371 btn2->SetState(kButtonUp);
2372
2373 cur = (TRootBrowserHistoryCursor*)fHistory->After(fHistoryCursor);
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{
2541 fDrawOption->GetTextEntry()->SetText(option);
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*)", (Long_t)obj);
2557}
2558
2559////////////////////////////////////////////////////////////////////////////////
2560/// Emits signal when double clicking on icon.
2561
2563{
2564 Long_t args[2];
2565
2566 args[0] = (Long_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%lx)->GetBranch()->GetDirectory();",
2589 obj->ClassName(), (ULong_t)obj));
2590 if (!dir) {
2591 browsable = kFALSE;
2592 }
2593 }
2594 if (obj->InheritsFrom("TBranchElement")) {
2595 TObject *dir = (TObject *)gROOT->ProcessLine(Form("((%s *)0x%lx)->GetDirectory();",
2596 obj->ClassName(), (ULong_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()) {
2632 fIconBox->RemoveAll();
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*)", (Long_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()
2774 && fIconBox->NumItems()<fIconBox->GetGroupSize() ) {
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 }
2929 fIconBox->AdjustPosition();
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) {
2970 fIconBox->Search(kFALSE);
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 }
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
3159 UInt_t width, UInt_t height,
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
3170 Int_t y, UInt_t width, UInt_t height,
3171 Option_t * /*opt*/)
3172{
3173 TRootBrowserLite *browser = new TRootBrowserLite(b, title, x, y, width, height);
3174 return (TBrowserImp *)browser;
3175}
size_t fSize
@ kGKeyPress
Definition GuiTypes.h:60
const Mask_t kKeyMod1Mask
typically the Alt key
Definition GuiTypes.h:198
@ kSunkenFrame
Definition GuiTypes.h:383
@ kDoubleBorder
Definition GuiTypes.h:385
@ kFixedWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:382
Handle_t Atom_t
WM token.
Definition GuiTypes.h:37
@ kWatch
Definition GuiTypes.h:375
@ kPointer
Definition GuiTypes.h:375
EMouseButton
Button names.
Definition GuiTypes.h:214
@ kButton3
Definition GuiTypes.h:214
@ kButton1
Definition GuiTypes.h:214
R__EXTERN const char gHelpObjects[]
Definition HelpText.h:26
R__EXTERN const char gHelpPullDownMenus[]
Definition HelpText.h:24
R__EXTERN const char gHelpRemote[]
Definition HelpText.h:28
R__EXTERN const char gHelpAbout[]
Definition HelpText.h:17
R__EXTERN const char gHelpGraphicsEditor[]
Definition HelpText.h:23
R__EXTERN const char gHelpCanvas[]
Definition HelpText.h:25
R__EXTERN const char gHelpBrowserLite[]
Definition HelpText.h:19
R__EXTERN const char gHelpPostscript[]
Definition HelpText.h:21
EKeySym
Definition KeySymbols.h:25
@ kKey_Right
Definition KeySymbols.h:42
@ kKey_F5
Definition KeySymbols.h:61
@ kKey_Left
Definition KeySymbols.h:40
@ kKey_Escape
Definition KeySymbols.h:26
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
#define e(i)
Definition RSha256.hxx:103
const Ssiz_t kNPOS
Definition RtypesCore.h:115
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
const Bool_t kFALSE
Definition RtypesCore.h:92
unsigned long ULong_t
Definition RtypesCore.h:55
long Long_t
Definition RtypesCore.h:54
bool Bool_t
Definition RtypesCore.h:63
long long Long64_t
Definition RtypesCore.h:73
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
R__EXTERN TApplication * gApplication
#define gDirectory
Definition TDirectory.h:290
include TDocParser_001 C image html pict1_TDocParser_001 png width
R__EXTERN TEnv * gEnv
Definition TEnv.h:171
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:220
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:187
#define gFile
Definition TFile.h:343
@ kButtonDisabled
Definition TGButton.h:56
@ kButtonUp
Definition TGButton.h:53
@ kButtonEngaged
Definition TGButton.h:55
#define gClient
Definition TGClient.h:166
R__EXTERN TGDNDManager * gDNDManager
EFSSortMode
@ kSortByDate
@ kSortByName
@ kSortByType
@ kSortBySize
@ kFDOpen
@ kLHintsRight
Definition TGLayout.h:33
@ kLHintsExpandY
Definition TGLayout.h:38
@ kLHintsLeft
Definition TGLayout.h:31
@ kLHintsCenterY
Definition TGLayout.h:35
@ kLHintsBottom
Definition TGLayout.h:36
@ kLHintsTop
Definition TGLayout.h:34
@ kLHintsExpandX
Definition TGLayout.h:37
EListViewMode
Definition TGListView.h:39
@ kLVDetails
Definition TGListView.h:43
@ kLVSmallIcons
Definition TGListView.h:41
@ kLVList
Definition TGListView.h:42
@ kLVLargeIcons
Definition TGListView.h:40
@ kTextLeft
Definition TGWidget.h:33
static unsigned int total
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,...)
@ kReadPermission
Definition TSystem.h:47
R__EXTERN TSystem * gSystem
Definition TSystem.h:559
#define gPad
#define gVirtualX
Definition TVirtualX.h:338
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Int_t GET_MSG(Long_t val)
@ kCT_SELCHANGED
@ kCM_COMBOBOX
@ kCM_MENU
@ kCT_ITEMCLICK
@ kC_COMMAND
@ kCM_BUTTON
@ kC_LISTTREE
@ kCT_ITEMDBLCLICK
@ kC_CONTAINER
Int_t GET_SUBMSG(Long_t val)
#define snprintf
Definition civetweb.c:1540
virtual 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
virtual Long_t ProcessLine(const char *line, Bool_t sync=kFALSE, Int_t *error=0)
Process a single command line, either a C++ statement or an interpreter command starting with a "....
ABC describing GUI independent browser implementation protocol.
Definition TBrowserImp.h:29
TBrowser * fBrowser
TBrowser associated with this implementation.
Definition TBrowserImp.h:32
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
void SetDrawOption(Option_t *option="")
Set drawing option for object.
Definition TBrowser.h:105
void SetRefreshFlag(Bool_t flag)
Definition TBrowser.h:99
TContextMenu * GetContextMenu() const
Definition TBrowser.h:96
@ kNoHidden
Definition TBrowser.h:55
Bool_t GetRefreshFlag() const
Definition TBrowser.h:97
void SetBrowserImp(TBrowserImp *i)
Definition TBrowser.h:95
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
Definition TBufferFile.h:47
void WriteObject(const TObject *obj, Bool_t cacheReuse=kTRUE) override
Write object to I/O buffer.
@ kWrite
Definition TBuffer.h:73
Int_t Length() const
Definition TBuffer.h:100
char * Buffer() const
Definition TBuffer.h:96
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:80
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Definition TClass.cxx:5915
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:2957
void Browse(TBrowser *b)
Browse this collection (called by TBrowser).
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
The color creation and management class.
Definition TColor.h:19
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1769
ULong_t GetPixel() const
Return pixel value corresponding to this color.
Definition TColor.cxx:1437
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.
Atom_t fDataType
Int_t fDataLength
void * fData
Describe directory structure in memory.
Definition TDirectory.h:45
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition TEnv.cxx:491
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
Set the value of a resource or create a new resource.
Definition TEnv.cxx:736
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition TFile.h:54
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition TGButton.cxx:188
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition TGClient.cxx:233
TGMimeTypes * GetMimeTypeList() const
Definition TGClient.h:155
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:371
TGPicturePool * GetPicturePool() const
Definition TGClient.h:135
virtual TGLBEntry * GetSelectedEntry() const
Definition TGComboBox.h:135
virtual TGTextEntry * GetTextEntry() const
Definition TGComboBox.h:131
virtual void AddEntry(TGString *s, Int_t id)
Definition TGComboBox.h:106
virtual TGListBox * GetListBox() const
Definition TGComboBox.h:130
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:127
virtual TList * GetList() const
Definition TGFrame.h:346
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1102
virtual UInt_t GetDefaultWidth() const
Definition TGFrame.h:348
virtual void Layout()
Layout the elements of the composite frame.
Definition TGFrame.cxx:1242
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1149
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1189
TList * fList
Definition TGFrame.h:328
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:350
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1007
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition TGFrame.cxx:1134
virtual void RemoveAll()
Remove all frames from composite frame.
Definition TGFrame.cxx:1116
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1175
virtual void Associate(const TGWindow *w)
Definition TGCanvas.h:99
virtual void ClearViewPort()
Clear view port and redraw full content.
Definition TGCanvas.cxx:887
virtual TGFrameElement * FindFrame(Int_t x, Int_t y, Bool_t exclude=kTRUE)
Find frame located int container at position x,y.
virtual void RemoveAll()
Remove all items from the container.
Definition TGCanvas.cxx:637
virtual void * FindItem(const TString &name, Bool_t direction=kTRUE, Bool_t caseSensitive=kTRUE, Bool_t subString=kFALSE)
Bool_t IsDragging() const
Bool_t EndDrag()
End dragging.
virtual void Update(const char *path)
Update file system combo box.
TList * fFileNamesList
char * fFilename
const char ** fFileTypes
char * fIniDir
Bool_t fMultipleSelection
void SetIniDir(const char *inidir)
Set directory name.
TBufferFile * fBuf
TDNDData fDNDData
void SetDNDData(TDNDData *data)
Set drag and drop data.
virtual Bool_t HandleDNDFinished()
TGFrame * fFrame
Definition TGLayout.h:119
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
Definition TGFrame.cxx:630
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:668
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:261
void SetDNDSource(Bool_t onoff)
Definition TGFrame.h:292
virtual TDNDData * GetDNDData(Atom_t)
Definition TGFrame.h:299
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition TGFrame.cxx:590
UInt_t GetHeight() const
Definition TGFrame.h:249
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition TGFrame.cxx:614
virtual void MapWindow()
map window
Definition TGFrame.h:228
static Pixel_t fgWhitePixel
Definition TGFrame.h:127
UInt_t GetWidth() const
Definition TGFrame.h:248
virtual void UnmapWindow()
unmap window
Definition TGFrame.h:230
void * GetUserData() const
Definition TGListView.h:113
void SetUserData(void *userData)
Definition TGListView.h:112
virtual void SetText(TGString *newText)
Set new text in label.
Definition TGLabel.cxx:179
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
virtual TGFrame * GetContainer() const
Definition TGListBox.h:334
TGListTreeItem * GetFirstChild() const
Definition TGListTree.h:74
void Rename(const char *new_name)
Definition TGListTree.h:86
virtual Bool_t IsActive() const =0
virtual const char * GetText() const =0
TGListTreeItem * GetNextSibling() const
Definition TGListTree.h:77
TGListTreeItem * GetParent() const
Definition TGListTree.h:73
virtual void SetTipText(const char *)
Definition TGListTree.h:92
virtual Bool_t IsOpen() const
Definition TGListTree.h:79
virtual void * GetUserData() const =0
virtual void SetUserData(void *, Bool_t=kFALSE)
Definition TGListTree.h:94
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:366
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:397
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:396
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.
virtual void AdjustHeaders()
Definition TGListView.h:172
virtual void Layout()
Layout list view components (container and contents of container).
virtual void SetHeader(const char *s, Int_t hmode, Int_t cmode, Int_t idx)
Set header button idx [0-fNColumns>, hmode is the x text alignmode (ETextJustification) for the heade...
virtual void SetIncrements(Int_t hInc, Int_t vInc)
Set horizontal and vertical scrollbar increments.
EListViewMode GetViewMode() const
Definition TGListView.h:179
TGTextButton ** GetHeaderButtons()
Definition TGListView.h:177
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.
Atom_t * fDNDTypeList
Definition TGFrame.h:459
virtual void SendCloseMessage()
Send close message to self.
Definition TGFrame.cxx:1705
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition TGFrame.cxx:1817
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1762
virtual Bool_t HandleKey(Event_t *event)
Handle keyboard events.
Definition TGFrame.cxx:1567
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
Definition TGFrame.cxx:1840
void SetWMSizeHints(UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc)
Give the window manager minimum and maximum size hints.
Definition TGFrame.cxx:1865
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1749
const TGPicture * SetIconPixmap(const char *iconName)
Set window icon pixmap by name.
Definition TGFrame.cxx:1777
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=0)
Add popup menu to menu bar.
Definition TGMenu.cxx:417
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
Definition TGObject.h:37
Handle_t GetId() const
Definition TGObject.h:47
Handle_t fId
Definition TGObject.h:36
const TGPicture * GetPicture(const char *name)
Get a picture from the picture pool.
Definition TGPicture.cxx:80
Pixmap_t GetPicture() const
Definition TGPicture.h:65
virtual Bool_t IsEntryChecked(Int_t id)
Return true if menu item is checked.
Definition TGMenu.cxx:1844
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:1151
virtual void CheckEntry(Int_t id)
Check a menu entry (i.e. add a check mark in front of it).
Definition TGMenu.cxx:1781
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition TGMenu.cxx:1723
virtual void UnCheckEntry(Int_t id)
Uncheck menu entry (i.e. remove check mark).
Definition TGMenu.cxx:1806
virtual void Associate(const TGWindow *w)
Definition TGMenu.h:219
virtual void AddSeparator(TGMenuEntry *before=nullptr)
Add a menu separator to the menu.
Definition TGMenu.cxx:1059
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:1859
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:989
static TGSearchDialog *& SearchDialog()
Return global search dialog.
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.
virtual void SetString(const char *s)
Definition TGString.h:41
const char * GetString() const
Definition TGString.h:40
virtual Bool_t SaveFile(const char *fname, Bool_t saveas=kFALSE)
Save file.
virtual Bool_t Search(const char *string, Bool_t direction=kTRUE, Bool_t caseSensitive=kFALSE)
Search for string in the specified direction.
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.
const TGString * GetText() const
Definition TGListBox.h:114
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:129
virtual TGButton * AddButton(const TGWindow *w, ToolBarData_t *button, Int_t spacing=0)
Add button to toolbar.
Definition TGToolBar.cxx:91
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
virtual TGButton * GetButton(Int_t id) const
Finds and returns a pointer to the button with the specified identifier id.
virtual void SetBackgroundColor(Pixel_t)
Set background color of the canvas frame.
Definition TGView.cxx:579
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:82
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:335
@ kEditDisable
Definition TGWindow.h:58
virtual void DestroyWindow()
destroy window
Definition TGWindow.cxx:191
const TGWindow * GetParent() const
Definition TGWindow.h:84
static TGuiBuilder * Instance()
return an instance of TGuiBuilder object
THashTable implements a hash table to store TObject's.
Definition THashTable.h:35
TObject * FindObject(const char *name) const
Find object using its name.
An abstract interface to image processing library.
Definition TImage.h:29
virtual void FromPad(TVirtualPad *, Int_t=0, Int_t=0, UInt_t=0, UInt_t=0)
Definition TImage.h:122
@ kXpm
Definition TImage.h:37
virtual UInt_t GetWidth() const
Definition TImage.h:228
virtual void DrawBox(Int_t, Int_t, Int_t, Int_t, const char *="#000000", UInt_t=1, Int_t=0)
Definition TImage.h:188
static TImage * Create()
Create an image.
Definition TImage.cxx:35
virtual Bool_t SetImageBuffer(char **, EImageFileTypes=TImage::kPng)
Definition TImage.h:242
virtual Bool_t IsValid() const
Definition TImage.h:230
virtual void Scale(UInt_t, UInt_t)
Definition TImage.h:141
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
Definition TImage.h:172
virtual Pixmap_t GetPixmap()
Definition TImage.h:235
virtual Pixmap_t GetMask()
Definition TImage.h:236
virtual UInt_t GetHeight() const
Definition TImage.h:229
Utility class for browsing TMapFile objects.
Definition TKeyMapFile.h:20
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition TKey.h:28
virtual const char * GetClassName() const
Definition TKey.h:76
Short_t GetCycle() const
Return cycle number associated to this key.
Definition TKey.cxx:577
A doubly linked list.
Definition TList.h:44
virtual void Add(TObject *obj)
Definition TList.h:87
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
Definition TList.cxx:330
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition TList.cxx:822
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Definition TList.cxx:693
virtual void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
Definition TList.cxx:764
virtual TObject * Before(const TObject *obj) const
Returns the object before object obj.
Definition TList.cxx:371
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:470
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:659
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition TList.cxx:402
virtual const char * GetName() const
Returns name of object.
Definition TNamed.h:47
Collectable string class.
Definition TObjString.h:28
const TString & GetString() const
Definition TObjString.h:46
Mother of all ROOT objects.
Definition TObject.h:37
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition TObject.cxx:475
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:359
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
Definition TObject.cxx:121
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:187
virtual const char * GetIconName() const
Returns mime type name of object.
Definition TObject.cxx:369
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:130
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
Definition TObject.cxx:388
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:696
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:445
virtual const char * GetTitle() const
Returns title of object.
Definition TObject.cxx:403
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
Definition TObject.cxx:552
virtual ULong_t Hash() const
Return hash value for this object.
Definition TObject.cxx:435
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:866
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
static const TString & GetBinDir()
Get the binary directory in the installation. Static utility function.
Definition TROOT.cxx:2917
The TRemoteObject class provides protocol for browsing ROOT objects from a remote ROOT session.
const char * GetClassName() const
const char * GetKeyClassName() const
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.
void SetViewMode(Int_t new_mode, Bool_t force=kFALSE)
Set iconbox's view mode and update menu and toolbar buttons accordingly.
void Refresh(Bool_t force=kFALSE) override
Refresh the browser contents.
TGLayoutHints * fMenuBarHelpLayout
void ListTreeHighlight(TGListTreeItem *item)
Open tree item and list in iconbox its contents.
TGFileContainer * GetIconBox() const
returns pointer to fIconBox object
void SetSortMode(Int_t new_mode)
Set iconbox's sort mode and update menu radio buttons accordingly.
void ClearHistory()
clear navigation history
TGListTreeItem * fListLevel
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
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
void AddToHistory(TGListTreeItem *item)
helper method to track history
TGLayoutHints * fBarLayout
TGHorizontalFrame * fHf
void BrowseObj(TObject *obj) override
Browse object.
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.
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
TGListView * fListView
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) override
Handle menu and other command generated by the user.
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
virtual void SetDefaults(const char *iconStyle=nullptr, const char *sortBy=nullptr)
Set defaults depending on settings in the user's .rootrc.
TGFSComboBox * fFSComboBox
void InterruptMacro()
interrupt browsed macro execution
void SetDrawOption(Option_t *option="") override
sets drawing option
virtual ~TRootBrowserLite()
Browser destructor.
TGCompositeFrame * fListHdr
void UpdateDrawOption()
add new draw option to the "history"
TGTextEdit * fTextEdit
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.
void SetText(const char *helpText)
Set help text from helpText buffer in TGTextView.
void Popup()
Show help dialog.
Basic string class.
Definition TString.h:136
Ssiz_t Length() const
Definition TString.h:410
void ToLower()
Change string to lower-case.
Definition TString.cxx:1145
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition TString.cxx:2197
const char * Data() const
Definition TString.h:369
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:692
ECaseCompare
Definition TString.h:268
@ kIgnoreCase
Definition TString.h:268
@ kExact
Definition TString.h:268
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition TString.h:615
TString & Prepend(const char *cs)
Definition TString.h:661
Bool_t IsNull() const
Definition TString.h:407
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Definition TString.cxx:658
TString & Remove(Ssiz_t pos)
Definition TString.h:673
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2331
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:639
Long64_t Atoll() const
Return long long value of string.
Definition TString.cxx:1967
Describes an Operating System directory for the browser.
A TSystemFile describes an operating system file.
Definition TSystemFile.h:29
const char * pwd()
Definition TSystem.h:422
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Definition TSystem.cxx:1069
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition TSystem.cxx:654
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:1294
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition TSystem.cxx:1061
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
Definition TSystem.cxx:950
virtual const char * WorkingDirectory()
Return working directory.
Definition TSystem.cxx:870
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
Definition TSystem.cxx:1030
virtual int Unlink(const char *name)
Unlink, i.e.
Definition TSystem.cxx:1379
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
Definition TSystem.cxx:1480
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
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
Definition TMathBase.h:362
Definition file.py:1
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:33
auto * lv
Definition textalign.C:5
REAL splitter
Definition triangle.c:616