53#include "RConfigure.h"
78class TCursorSwitcher {
109 if (p && p !=
gClient->GetDefaultRoot())
182 "TGFileBrowser",
this,
"DoubleClicked(TGListTreeItem *, Int_t)");
184 "TGFileBrowser",
this,
"Clicked(TGListTreeItem *, Int_t, Int_t, Int_t)");
186 this,
"Checked(TObject*, Bool_t)");
205 "ApplyFilter(Int_t)");
207 this,
"ApplyFilter(Int_t = -1)");
237 "TGFileBrowser",
this,
"Selected(char*)");
240 "TGFileBrowser",
this,
"PadModified()");
299 if (maxlen > 0 && infos.
Length() > maxlen) {
306 objsize = objinfo.
Atoll();
309 bsize = fsize = objsize;
354 else if (obj) oname = obj->
GetName();
359 const char *filter = (
const char *)(*it).second;
486 if (volumes && curvol) {
487 const char *curdrive;
495 while ((drive = (
TNamed *)next())) {
497 (strcmp(drive->
GetName(), curdrive) == 0) ?
498 "SetRootDir" :
"Add");
507 if (
gROOT->GetListOfFiles() && !
gROOT->GetListOfFiles()->IsEmpty())
537 const char *ext =
name ? strrchr(
name,
'.') : 0;
541 if (ext && cached_spic && (cached_ext == ext)) {
561 *pic =
gClient->GetPicture(
"doc_t.xpm");
564 *pic =
gClient->GetPicture(
"app_t.xpm");
567 *pic =
gClient->GetPicture(
"folder_t.xpm");
570 *pic =
gClient->GetPicture(
"rootdb_t.xpm");
575 *pic =
gClient->GetPicture(
"slink_t.xpm");
604 item->SetUserData(0);
627 TCursorSwitcher cursorSwitcher(
this,
fListTree);
629 UInt_t curr =
gROOT->GetListOfBrowsables()->GetSize();
630 if (!prev) prev = curr;
647 Long_t id = 0, flags = 0, modtime = 0;
668 if (strlen(path) > 1) {
672 if ((res == 0) && (flags & 2)) {
688 flags =
id = size = modtime = 0;
697 if (strlen(path) > 1) {
733 if ((opt == 0) || (!opt[0])) {
738 if (strstr(opt,
"SetRootDir")) {
742 else if (strstr(opt,
"Add")) {
778 if (itm == 0)
return;
780 if ((
fCnt == 0) || (olditem != itm)) {
781 olditem = item = itm;
825 if ((
id > 1) && (
id < 5))
827 else if ((
id < 0) || (
id > 4)) {
889 else if (!strcmp(item->
GetText(),
"ROOT Files")) {
903 if (topobj && topobj->
InheritsFrom(
"TApplicationRemote")) {
917 Getlinem(kInit,
"\nroot [0]");
924 Getlinem(kInit,
"\nroot [0]");
943 filter = (
const char *)(*it).second;
953 filter.
Prepend(
"Showing only \'");
995 Long_t id = 0, flags = 0, modtime = 0;
1008 const char *clname = ((
TKey *)obj)->GetClassName();
1009 if (clname && strcmp(clname,
"TGeoManager")) {
1036 if (strlen(path) > 3) {
1061 if (selected->InheritsFrom(
"TBranch"))
1063 if (selected->InheritsFrom(
"TTree")) {
1122 _splitpath(fullpath.
Data(), winDrive, winDir, winName, winExt);
1140 Int_t weirdcount = 0;
1148 infile = fopen(candidate,
"r");
1151 nchars = fread(buffer, 1, 512, infile);
1154 for (i = 0; i < nchars; i++) {
1155 if (buffer[i] & 128)
1157 if (buffer[i] ==
'\0')
1161 if ((nchars > 0) && ((weirdcount * 100 / nchars) > 30))
1180 if (img1 == 0)
return pic;
1184 if (img2) img1->
Merge(img2);
1187 merged =
gClient->GetPicturePool()->GetPicture(lnk_name.
Data(),
1189 if (img2)
delete img2;
1218 TCursorSwitcher switcher(
this,
fListTree);
1235 const char *clname = ((
TKey *)obj)->GetClassName();
1263 while ( probj && strcmp(probj->
GetClassName(),
"TFile")) {
1267 if (probj && !strcmp(probj->
GetClassName(),
"TFile")) {
1271 TString::Format(
"((TApplicationServer *)gApplication)->BrowseFile(\"%s\");",
1276 if (
gClient->GetMimeTypeList()->GetAction(obj->
GetName(), action)) {
1279 if ((act[0] !=
'!') && (strcmp(pitem->
GetText(),
"ROOT Files"))) {
1285 if ((ext.
EndsWith(
".root")) && (strcmp(pitem->
GetText(),
"ROOT Files"))) {
1294 if (
gClient->GetMimeTypeList()->GetAction(obj->IsA()->
GetName(), action)) {
1302 if (act[0] ==
'!') {
1330 flags =
id = size = modtime = 0;
1349 fname =
file->GetName();
1350 if (
file->IsDirectory()) {
1353 if ((fname!=
"..") && (fname!=
".")) {
1360 const TGPicture *opened = 0, *l_opened = 0;
1361 const TGPicture *closed = 0, *l_closed = 0;
1366 if (l_opened && l_closed)
1384 fname = pname =
file->GetName();
1396 pic =
gClient->GetMimeTypeList()->GetIcon(pname,
kTRUE);
1413 if (size && modtime) {
1427 if (is_link && lnkname.
EndsWith(
".lnk"))
1447 if (ostr)
delete ostr;
1473 fullname.ReplaceAll(
"\\",
"\\\\");
1476 (
ULong_t)embed, fullname.Data()));
1480 (
ULong_t)embed, fullname.Data()));
1513 if (
gClient->GetMimeTypeList()->GetAction(obj->
GetName(), action)) {
1518 if (act[0] ==
'!') {
1548 fsize = bsize = size;
1553 infos +=
TString::Format(
"Size: %lld.%lldM", fsize/1024, (fsize%1024)/103);
1555 infos +=
TString::Format(
"Size: %lld.%lldK", bsize/1024, (bsize%1024)/103);
1561 time_t loctime = (time_t) modtime;
1562 newtime = localtime(&loctime);
1566 newtime->tm_year + 1900,
1567 newtime->tm_mon+1, newtime->tm_mday,
1568 newtime->tm_hour, newtime->tm_min);
1579 const char *clname = 0;
1587 objClass = obj->IsA();
1592 clname = ((
TKey *)obj)->GetClassName();
1606 objClass = obj->IsA();
1615 Bool_t xpm = xpm_magic ==
"/* ";
1616 const char *iconname = xpm ? obj->
GetName() :
name;
1626 *pic =
gClient->GetMimeTypeList()->GetIcon(iconname,
kTRUE);
1627 if (!(*pic) && xpm) {
1633 gClient->GetMimeTypeList()->AddType(
"[thumbnail]", iconname, iconname, iconname,
"->Browse()");
1653 Long_t bsize, blocks, bfree;
1657 if (item == 0)
return;
1680 if (
id == 0x5346414f ||
id == 0x6969 ||
id == 0x65735546 ||
id == 0xff534d42 ||
id == 0x517b)
1682 if (
first.Length() == 2 &&
first.EndsWith(
":")) {
1773 "Enter filter expression:\n(empty string \"\" or \"*\" to remove filter)",
1777 if ((filter[0] == 0) && (filter[1] == 0)) {
1781 else if (((filter[0] == 0) && (filter[1] == 1)) || !strcmp(filter,
"*")) {
R__EXTERN TApplication * gApplication
static Bool_t IsObjectEditable(TClass *cl)
Helper function checking if a class has a graphic properties editor.
static const TGPicture * MakeLinkPic(const TGPicture *pic)
Create a symlink (shortcut on Windows) icon by merging the picture passed as argument and the slink_t...
static const char * FormatToolTip(TObject *obj, Int_t maxlen=0)
Format the tooltip information, based on the object passed in argument.
static Bool_t IsTextFile(const char *candidate)
Returns true if given a text file Uses the specification given on p86 of the Camel book.
char * Form(const char *fmt,...)
char * StrDup(const char *str)
Duplicate the string str.
Bool_t R_ISREG(Int_t mode)
Bool_t R_ISDIR(Int_t mode)
R__EXTERN TSystem * gSystem
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 "....
Each class (see TClass) has a linked list of its base class(es).
TClass * GetClassPointer(Bool_t load=kTRUE)
Get pointer to the base class TClass.
ABC describing GUI independent browser implementation protocol.
Using a TBrowser one can browse all ROOT objects.
void SetDrawOption(Option_t *option="")
Set drawing option for object.
TClass instances represent classes, structs and namespaces in the ROOT type system.
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
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.
virtual Int_t GetEntries() const
Describe directory structure in memory.
virtual void Browse(TBrowser *b)
Browse the content of the directory.
virtual TList * GetListOfKeys() const
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
void FreePicture(const TGPicture *pic)
Free picture resource.
virtual TGLBEntry * GetSelectedEntry() const
virtual TGTextEntry * GetTextEntry() const
virtual void AddEntry(TGString *s, Int_t id)
virtual TGListBox * GetListBox() const
virtual TList * GetList() const
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
virtual void ClearViewPort()
Clear view port and redraw full content.
TGListTreeItem * fRootDir
Bool_t CheckFiltered(TGListTreeItem *item, Bool_t but=kFALSE)
Check if there is a filter active on the children of the list tree item.
TString DirName(TGListTreeItem *item)
returns the directory path
TGFileBrowser(const TGWindow *p, TBrowser *b=0, UInt_t w=200, UInt_t h=400)
TGFileBrowser constructor.
TGHorizontalFrame * fBotFrame
void GetObjPicture(const TGPicture **pic, TObject *obj)
Retrieve icons associated with class "name".
void CreateBrowser()
Create the actual file browser.
virtual void Refresh(Bool_t force=kFALSE)
Refresh content of the list tree.
void AddKey(TGListTreeItem *itm, TObject *obj, const char *name=0)
display content of ROOT file
TGListTreeItem * fCurrentDir
Bool_t CheckSorted(TGListTreeItem *item, Bool_t but=kFALSE)
Check if the list tree item children are alphabetically sorted.
void Clicked(TGListTreeItem *item, Int_t btn, Int_t x, Int_t y)
Process mouse clicks in TGListTree.
void AddFSDirectory(const char *entry, const char *path=0, Option_t *opt="")
Add file system directory in the list tree.
void DoubleClicked(TGListTreeItem *item, Int_t btn)
Process double clicks in TGListTree.
void ApplyFilter(Int_t id)
Apply filter selected in combo box to the file tree view.
TGPictureButton * fFilterButton
void PadModified()
Slot used to switch to the tab containing the current pad/canvas (gPad) used e.g.
void GotoDir(const char *path)
Go to the directory "path" and open all the parent list tree items.
void ToggleSort()
Toggle the sort mode and set the "sort button" state accordingly.
TGListTreeItem * fListLevel
void AddRemoteFile(TObject *obj)
Add remote file in list tree.
void GetFilePictures(const TGPicture **pic, Int_t file_type, Bool_t is_link, const char *name)
Determine the file picture for the given file type.
virtual void BrowseObj(TObject *obj)
Browse object.
virtual void RecursiveRemove(TObject *obj)
Recursively remove object.
const TGPicture * fCachedPic
void RequestFilter()
Open a dialog box asking for a string to be used as filter (regexp), and add an entry in the map of f...
TContextMenu * fContextMenu
TRootBrowser * fNewBrowser
Option_t * GetDrawOption() const
returns drawing option
char * FormatFileInfo(const char *fname, Long64_t size, Long_t modtime)
Format file information to be displayed in the tooltip.
TString FullPathName(TGListTreeItem *item)
returns an absolute path
TGPictureButton * fSortButton
mFiltered_t::iterator mFiltered_i
void Checked(TObject *obj, Bool_t check)
Emits signal when double clicking on icon.
const TGPicture * fFileIcon
virtual ~TGFileBrowser()
Destructor.
TGPictureButton * fRefreshButton
void CheckRemote(TGListTreeItem *item)
Check if the current list tree item points to a remote object.
void Update()
Update content of the list tree.
const TGPicture * fRootIcon
void Selected(char *)
A ROOT File has been selected in TGHtmlBrowser.
mFiltered_t fFilteredItems
Long_t XXExecuteDefaultAction(TObject *obj)
Execute default action for selected object (action is specified in the $HOME/.root....
void Chdir(TGListTreeItem *item)
Make object associated with item the current directory.
TGHorizontalFrame * fTopFrame
virtual void Add(TObject *obj, const char *name=0, Int_t check=-1)
Add items to the browser.
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
TGListTreeItem * GetFirstChild() const
void Rename(const char *new_name)
virtual const char * GetText() const =0
TGListTreeItem * GetNextSibling() const
TGListTreeItem * GetParent() const
virtual void SetTipText(const char *)
virtual void SetActive(Bool_t)
void SetDNDSource(Bool_t onoff)
virtual void SetPictures(const TGPicture *, const TGPicture *)
virtual void * GetUserData() const =0
virtual void SetUserData(void *, Bool_t=kFALSE)
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.
Int_t DeleteChildren(TGListTreeItem *item)
Delete children of item from list.
void CheckItem(TGListTreeItem *item, Bool_t check=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
Int_t RecursiveDeleteItem(TGListTreeItem *item, void *userData)
Delete item with fUserData == ptr.
Int_t DeleteItem(TGListTreeItem *item)
Delete item from list tree.
void SetSelected(TGListTreeItem *item)
TGListTreeItem * GetFirstItem() const
TGListTreeItem * FindChildByName(TGListTreeItem *item, const char *name)
Find child of item by name.
Int_t SortChildren(TGListTreeItem *item)
Sort children of item.
void AdjustPosition(TGListTreeItem *item)
Move content to position of item.
void HighlightItem(TGListTreeItem *item)
Highlight item.
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.
TGCompositeFrame * GetCurrentContainer() const
TGTabElement * GetTabTab(Int_t tabIndex) const
Return the tab element of tab with index tabIndex.
Int_t GetNumberOfTabs() const
Return number of tabs.
virtual Bool_t SetTab(Int_t tabIndex, Bool_t emit=kTRUE)
Brings the composite frame with the index tabIndex to the front and generate the following event if t...
TGCompositeFrame * GetTabContainer(Int_t tabIndex) const
Return container of tab with index tabIndex.
const char * GetText() const
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
virtual const char * GetTitle() const
Returns title of object.
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event, Bool_t force=kFALSE)
Activate object editors according to the selected object.
An abstract interface to image processing library.
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
virtual UInt_t GetWidth() const
virtual void SetImage(const Double_t *, UInt_t, UInt_t, TImagePalette *=0)
static TImage * Create()
Create an image.
virtual Bool_t SetImageBuffer(char **, EImageFileTypes=TImage::kPng)
virtual void Scale(UInt_t, UInt_t)
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
virtual Pixmap_t GetPixmap()
virtual Pixmap_t GetMask()
virtual UInt_t GetHeight() const
Utility class for browsing TMapFile objects.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
virtual void Sort(Bool_t order=kSortAscending)
Sort linked list.
The TNamed class is the base class for all named ROOT classes.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
Int_t GetEntriesFast() const
TObject * At(Int_t idx) const
Collectable string class.
Mother of all ROOT objects.
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
@ kNotDeleted
object has not been deleted
virtual const char * GetName() const
Returns name of object.
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual const char * GetIconName() const
Returns mime type name of object.
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad...
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual const char * GetTitle() const
Returns title of object.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
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.
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Regular expression class.
The TRemoteObject class provides protocol for browsing ROOT objects from a remote ROOT session.
const char * GetClassName() const
Bool_t GetFileStat(FileStat_t *sbuf)
Get remote file status.
const char * GetKeyClassName() const
void SetActBrowser(TBrowserImp *b)
virtual void Checked(TObject *obj, Bool_t check)
Emits signal when double clicking on icon.
TGTab * GetTabRight() const
void ToLower()
Change string to lower-case.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
void Clear()
Clear string without changing its capacity.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Prepend(const char *cs)
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Long64_t Atoll() const
Return long long value of string.
Describes an Operating System directory for the browser.
virtual TList * GetListOfFiles() const
Returns a TList of TSystemFile objects representing the contents of the directory.
A TSystemFile describes an operating system file.
virtual int GetFsInfo(const char *path, Long_t *id, Long_t *bsize, Long_t *blocks, Long_t *bfree)
Get info about a file system: fs type, block size, number of blocks, number of free blocks.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
virtual TList * GetVolumes(Option_t *) const
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual const char * WorkingDirectory()
Return working directory.
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
This static function calls a slot after a given time interval.
Abstract base class used by ROOT graphics editor.
static TVirtualPadEditor * GetPadEditor(Bool_t load=kTRUE)
Returns the pad editor dialog. Static method.
static constexpr double s
UInt_t GetListOfKeys(TList &keys, TString inherits, TDirectory *dir=0)