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;
361 const char *filter = it->second.c_str();
368 if (obj && obj->
InheritsFrom(
"TKey") && (obj->IsA() != TClass::Class()))
488 if (volumes && curvol) {
489 const char *curdrive;
497 while ((drive = (
TNamed *)next())) {
499 (strcmp(drive->
GetName(), curdrive) == 0) ?
500 "SetRootDir" :
"Add");
509 if (
gROOT->GetListOfFiles() && !
gROOT->GetListOfFiles()->IsEmpty())
539 const char *ext =
name ? strrchr(
name,
'.') : 0;
543 if (ext && cached_spic && (cached_ext == ext)) {
606 item->SetUserData(0);
629 TCursorSwitcher cursorSwitcher(
this,
fListTree);
631 UInt_t curr =
gROOT->GetListOfBrowsables()->GetSize();
632 if (!prev) prev = curr;
649 Long_t id = 0, flags = 0, modtime = 0;
670 if (strlen(path) > 1) {
674 if ((res == 0) && (flags & 2)) {
690 flags =
id = size = modtime = 0;
699 if (strlen(path) > 1) {
735 if ((opt == 0) || (!opt[0])) {
740 if (strstr(opt,
"SetRootDir")) {
744 else if (strstr(opt,
"Add")) {
780 if (itm == 0)
return;
782 if ((
fCnt == 0) || (olditem != itm)) {
783 olditem = item = itm;
827 if ((
id > 1) && (
id < 5))
829 else if ((
id < 0) || (
id > 4)) {
891 else if (!strcmp(item->
GetText(),
"ROOT Files")) {
905 if (topobj && topobj->
InheritsFrom(
"TApplicationRemote")) {
919 Getlinem(kInit,
"\nroot [0]");
926 Getlinem(kInit,
"\nroot [0]");
945 filter = it->second.c_str();
955 filter.
Prepend(
"Showing only \'");
997 Long_t id = 0, flags = 0, modtime = 0;
1008 if (obj->
InheritsFrom(
"TKey") && (obj->IsA() != TClass::Class())) {
1010 const char *clname = ((
TKey *)obj)->GetClassName();
1011 if (clname && strcmp(clname,
"TGeoManager")) {
1038 if (strlen(path) > 3) {
1060 if (selected && (selected->IsA() != TClass::Class())) {
1063 if (selected->InheritsFrom(
"TBranch"))
1065 if (selected->InheritsFrom(
"TTree")) {
1124 _splitpath(fullpath.
Data(), winDrive, winDir, winName, winExt);
1142 Int_t weirdcount = 0;
1150 infile = fopen(candidate,
"r");
1153 nchars = fread(buffer, 1, 512, infile);
1156 for (i = 0; i < nchars; i++) {
1157 if (buffer[i] & 128)
1159 if (buffer[i] ==
'\0')
1163 if ((nchars > 0) && ((weirdcount * 100 / nchars) > 30))
1182 if (img1 == 0)
return pic;
1186 if (img2) img1->
Merge(img2);
1191 if (img2)
delete img2;
1221 TCursorSwitcher switcher(
this,
fListTree);
1230 if (obj->
InheritsFrom(
"TDirectory") && (obj->IsA() != TClass::Class())) {
1236 else if (obj->
InheritsFrom(
"TKey") && (obj->IsA() != TClass::Class())) {
1238 const char *clname = ((
TKey *)obj)->GetClassName();
1266 while ( probj && strcmp(probj->
GetClassName(),
"TFile")) {
1270 if (probj && !strcmp(probj->
GetClassName(),
"TFile")) {
1274 TString::Format(
"((TApplicationServer *)gApplication)->BrowseFile(\"%s\");",
1279 if (
gClient->GetMimeTypeList()->GetAction(obj->
GetName(), action)) {
1282 if ((act[0] !=
'!') && (strcmp(pitem->
GetText(),
"ROOT Files"))) {
1288 if ((ext.
EndsWith(
".root")) && (strcmp(pitem->
GetText(),
"ROOT Files"))) {
1297 if (
gClient->GetMimeTypeList()->GetAction(obj->IsA()->
GetName(), action)) {
1305 if (act[0] ==
'!') {
1334 flags =
id = size = modtime = 0;
1353 fname =
file->GetName();
1354 if (
file->IsDirectory()) {
1357 if ((fname!=
"..") && (fname!=
".")) {
1364 const TGPicture *opened = 0, *l_opened = 0;
1365 const TGPicture *closed = 0, *l_closed = 0;
1370 if (l_opened && l_closed)
1388 fname = pname =
file->GetName();
1400 pic =
gClient->GetMimeTypeList()->GetIcon(pname,
kTRUE);
1419 if (size && modtime) {
1433 if (is_link && lnkname.
EndsWith(
".lnk"))
1453 if (ostr)
delete ostr;
1519 if (
gClient->GetMimeTypeList()->GetAction(obj->
GetName(), action)) {
1524 if (act[0] ==
'!') {
1554 fsize = bsize = size;
1559 infos +=
TString::Format(
"Size: %lld.%lldM", fsize/1024, (fsize%1024)/103);
1561 infos +=
TString::Format(
"Size: %lld.%lldK", bsize/1024, (bsize%1024)/103);
1567 time_t loctime = (time_t) modtime;
1568 newtime = localtime(&loctime);
1572 newtime->tm_year + 1900,
1573 newtime->tm_mon+1, newtime->tm_mday,
1574 newtime->tm_hour, newtime->tm_min);
1585 const char *clname = 0;
1592 if (obj->IsA() == TClass::Class()) {
1593 objClass = obj->IsA();
1598 clname = ((
TKey *)obj)->GetClassName();
1612 objClass = obj->IsA();
1621 Bool_t xpm = xpm_magic ==
"/* ";
1622 const char *iconname = xpm ? obj->
GetName() :
name;
1632 *pic =
gClient->GetMimeTypeList()->GetIcon(iconname,
kTRUE);
1633 if (!(*pic) && xpm) {
1639 gClient->GetMimeTypeList()->AddType(
"[thumbnail]", iconname, iconname, iconname,
"->Browse()");
1659 Long_t bsize, blocks, bfree;
1663 if (item == 0)
return;
1686 if (
id == 0x5346414f ||
id == 0x6969 ||
id == 0x65735546 ||
id == 0xff534d42 ||
id == 0x517b)
1688 if (
first.Length() == 2 &&
first.EndsWith(
":")) {
1779 "Enter filter expression:\n(empty string \"\" or \"*\" to remove filter)",
1783 if ((filter[0] == 0) && (filter[1] == 0)) {
1787 else if (((filter[0] == 0) && (filter[1] == 1)) || !strcmp(filter,
"*")) {
1854 if (itemname.
Length() > 0) {
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.
TBrowser * fBrowser
TBrowser associated with this implementation.
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.
TObject * FindObject(const char *name) const override
Find object by name in the list of memory objects.
virtual TList * GetListOfKeys() const
void Browse(TBrowser *b) override
Browse the content of the directory.
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
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 MapWindow()
map window
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.
Pixmap_t GetPicture() const
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).
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.
@ kNotDeleted
object has not been deleted
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 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 local pathname to a Unix pathname.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual const char * WorkingDirectory()
Return working directory.
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
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.