51 #include "RConfigure.h"
56 const char rootdir[] =
"/";
76 class TCursorSwitcher {
107 if (p && p !=
gClient->GetDefaultRoot())
110 fNewBrowser->SetActBrowser(
this);
113 if (fBrowser)
Show();
180 "TGFileBrowser",
this,
"DoubleClicked(TGListTreeItem *, Int_t)");
182 "TGFileBrowser",
this,
"Clicked(TGListTreeItem *, Int_t, Int_t, Int_t)");
184 this,
"Checked(TObject*, Bool_t)");
203 "ApplyFilter(Int_t)");
205 this,
"ApplyFilter(Int_t = -1)");
234 "TGFileBrowser",
this,
"Selected(char*)");
237 "TGFileBrowser",
this,
"PadModified()");
295 if (maxlen > 0 && infos.
Length() > maxlen) {
302 objsize = objinfo.
Atoll();
305 bsize = fsize = objsize;
349 if (name) oname =
name;
350 else if (obj) oname = obj->
GetName();
355 const char *filter = (
const char *)(*it).second;
366 if (!name) name = obj->
GetName();
482 if (volumes && curvol) {
483 const char *curdrive;
493 (strcmp(drive->
GetName(), curdrive) == 0) ?
494 "SetRootDir" :
"Add");
503 if (
gROOT->GetListOfFiles() && !
gROOT->GetListOfFiles()->IsEmpty())
533 const char *ext = name ? strrchr(name,
'.') : 0;
537 if (ext && cached_spic && (cached_ext == ext)) {
543 *pic =
gClient->GetMimeTypeList()->GetIcon(name,
kTRUE);
557 *pic =
gClient->GetPicture(
"doc_t.xpm");
560 *pic =
gClient->GetPicture(
"app_t.xpm");
563 *pic =
gClient->GetPicture(
"folder_t.xpm");
566 *pic =
gClient->GetPicture(
"rootdb_t.xpm");
571 *pic =
gClient->GetPicture(
"slink_t.xpm");
600 item->SetUserData(0);
623 TCursorSwitcher cursorSwitcher(
this,
fListTree);
625 UInt_t curr =
gROOT->GetListOfBrowsables()->GetSize();
626 if (!prev) prev = curr;
643 Long_t id = 0, flags = 0, modtime = 0;
665 if (strlen(path) > 1) {
669 if ((res == 0) && (flags & 2)) {
686 if (selected && selected->InheritsFrom(
"TBranch"))
690 flags =
id = size = modtime = 0;
699 if (strlen(path) > 1) {
743 if ((opt == 0) || (!opt[0])) {
748 if (strstr(opt,
"SetRootDir")) {
752 else if (strstr(opt,
"Add")) {
788 if (itm == 0)
return;
790 if ((
fCnt == 0) || (olditem != itm)) {
791 olditem = item = itm;
793 if (!name) name = obj->
GetName();
835 if ((
id > 1) && (
id < 5))
837 else if ((
id < 0) || (
id > 4)) {
899 else if (!strcmp(item->
GetText(),
"ROOT Files")) {
913 if (topobj && topobj->
InheritsFrom(
"TApplicationRemote")) {
927 Getlinem(kInit,
"\nroot [0]");
934 Getlinem(kInit,
"\nroot [0]");
953 filter = (
const char *)(*it).second;
963 filter.
Prepend(
"Showing only \'");
1005 Long_t id = 0, flags = 0, modtime = 0;
1019 if (clname && strcmp(clname,
"TGeoManager")) {
1031 if (obj->InheritsFrom(
"TDirectory") || obj->InheritsFrom(
"TList"))
1046 if (strlen(path) > 3) {
1070 if (selected && selected->InheritsFrom(
"TBranch"))
1072 if (selected && selected->InheritsFrom(
"TTree")) {
1130 _splitpath(fullpath.
Data(), winDrive, winDir, winName, winExt);
1148 Int_t weirdcount = 0;
1156 infile = fopen(candidate,
"r");
1159 nchars = fread(buffer, 1, 512, infile);
1162 for (i = 0; i < nchars; i++) {
1163 if (buffer[i] & 128)
1165 if (buffer[i] ==
'\0')
1169 if ((nchars > 0) && ((weirdcount * 100 / nchars) > 30))
1188 if (img1 == 0)
return pic;
1192 if (img2) img1->
Merge(img2);
1195 merged =
gClient->GetPicturePool()->GetPicture(lnk_name.
Data(),
1197 if (img2)
delete img2;
delete img1;
1225 TCursorSwitcher switcher(
this,
fListTree);
1255 if (obj->InheritsFrom(
"TDirectory") || obj->InheritsFrom(
"TList"))
1271 while ( probj && strcmp(probj->
GetClassName(),
"TFile")) {
1275 if (probj && !strcmp(probj->
GetClassName(),
"TFile")) {
1279 TString::Format(
"((TApplicationServer *)gApplication)->BrowseFile(\"%s\");",
1284 if (
gClient->GetMimeTypeList()->GetAction(obj->
GetName(), action)) {
1287 if ((act[0] !=
'!') && (strcmp(pitem->
GetText(),
"ROOT Files"))) {
1293 if ((ext.
EndsWith(
".root")) && (strcmp(pitem->
GetText(),
"ROOT Files"))) {
1302 if (
gClient->GetMimeTypeList()->GetAction(obj->IsA()->
GetName(), action)) {
1310 if (act[0] ==
'!') {
1338 flags =
id = size = modtime = 0;
1348 TList *files =
dir.GetListOfFiles();
1361 if ((fname!=
"..") && (fname!=
".")) {
1368 const TGPicture *opened = 0, *l_opened = 0;
1374 if (l_opened && l_closed)
1392 fname = pname = file->
GetName();
1404 pic =
gClient->GetMimeTypeList()->GetIcon(pname,
kTRUE);
1421 if (size && modtime) {
1435 if (is_link && lnkname.
EndsWith(
".lnk"))
1440 if (fname.EndsWith(
".root")) {
1455 if (ostr)
delete ostr;
1465 else if (fname.EndsWith(
".png")) {
1481 fullname.ReplaceAll(
"\\",
"\\\\");
1484 (
ULong_t)embed, fullname.Data()));
1488 (
ULong_t)embed, fullname.Data()));
1521 if (
gClient->GetMimeTypeList()->GetAction(obj->
GetName(), action)) {
1526 if (act[0] ==
'!') {
1556 fsize = bsize = size;
1561 infos +=
TString::Format(
"Size: %lld.%lldM", fsize/1024, (fsize%1024)/103);
1563 infos +=
TString::Format(
"Size: %lld.%lldK", bsize/1024, (bsize%1024)/103);
1569 time_t loctime = (time_t) modtime;
1570 newtime = localtime(&loctime);
1574 newtime->tm_year + 1900,
1575 newtime->tm_mon+1, newtime->tm_mday,
1576 newtime->tm_hour, newtime->tm_min);
1587 const char *clname = 0;
1595 objClass = obj->IsA();
1614 objClass = obj->IsA();
1623 Bool_t xpm = xpm_magic ==
"/* ";
1624 const char *iconname = xpm ? obj->
GetName() :
name;
1634 *pic =
gClient->GetMimeTypeList()->GetIcon(iconname,
kTRUE);
1635 if (!(*pic) && xpm) {
1641 gClient->GetMimeTypeList()->AddType(
"[thumbnail]", iconname, iconname, iconname,
"->Browse()");
1663 if (item == 0)
return;
1665 TObjArray *tokens = sPath.Tokenize(
"/");
1681 if (first == drive->
GetName()) {
1768 "Enter filter expression:\n(empty string \"\" or \"*\" to remove filter)",
1772 if ((filter[0] == 0) && (filter[1] == 0)) {
1776 else if (((filter[0] == 0) && (filter[1] == 1)) || !strcmp(filter,
"*")) {
virtual Int_t GetEntries() const
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...
virtual const char * GetTitle() const
Returns title of object.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
TApplication * GetAppRemote() 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 "...
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
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...
virtual void Checked(TObject *obj, Bool_t check)
Emits signal when double clicking on icon.
void AddKey(TGListTreeItem *itm, TObject *obj, const char *name=0)
display content of ROOT file
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Bool_t CheckFiltered(TGListTreeItem *item, Bool_t but=kFALSE)
Check if there is a filter active on the children of the list tree item.
virtual void * GetUserData() const =0
TGListTreeItem * FindChildByData(TGListTreeItem *item, void *userData)
Find child of item by userData.
TGListTreeItem * FindItemByObj(TGListTreeItem *item, void *ptr)
Find item with fUserData == ptr.
virtual const char * WorkingDirectory()
Return working directory.
Int_t DeleteItem(TGListTreeItem *item)
Delete item from list tree.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual TList * GetListOfKeys() const
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
Collectable string class.
TGListTreeItem * fCurrentDir
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
TRootBrowser * fNewBrowser
TClass * GetClassPointer(Bool_t load=kTRUE)
Get pointer to the base class TClass.
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.
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
void ApplyFilter(Int_t id)
Apply filter selected in combo box to the file tree view.
Regular expression class.
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
static const char * filename()
virtual UInt_t GetWidth() const
UInt_t GetListOfKeys(TList &keys, TString inherits, TDirectory *dir=0)
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
virtual TList * GetList() const
ClassImp(TGFileBrowser) TGFileBrowser
TGFileBrowser constructor.
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.
Int_t DeleteChildren(TGListTreeItem *item)
Delete children of item from list.
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
TGPictureButton * fFilterButton
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects)...
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current pad.
virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event)
Activate object editors according to the selected object.
An abstract interface to image processing library.
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
Int_t GetEntriesFast() const
Bool_t CheckSorted(TGListTreeItem *item, Bool_t but=kFALSE)
Check if the list tree item children are alphabetically sorted.
TString & Prepend(const char *cs)
R__EXTERN TApplication * gApplication
TGCompositeFrame * GetTabContainer(Int_t tabIndex) const
Return container of tab with index tabIndex.
virtual TGLBEntry * GetSelectedEntry() const
const char * GetKeyClassName() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
void AddFSDirectory(const char *entry, const char *path=0, Option_t *opt="")
Add file system directory in the list tree.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
void DoubleClicked(TGListTreeItem *item, Int_t btn)
Process double clicks in TGListTree.
TGPictureButton * fRefreshButton
virtual void SetImage(const Double_t *, UInt_t, UInt_t, TImagePalette *=0)
virtual const char * GetTitle() const
Returns title of object.
Bool_t R_ISREG(Int_t mode)
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Pixmap_t GetPixmap()
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
virtual void Scale(UInt_t, UInt_t)
Int_t GetNumberOfTabs() const
Return number of tabs.
const char * Data() const
TGListTreeItem * GetParent() const
TGListTreeItem * FindChildByName(TGListTreeItem *item, const char *name)
Find child of item by name.
The TRemoteObject class provides protocol for browsing ROOT objects from a remote ROOT session...
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
static TVirtualPadEditor * GetPadEditor(Bool_t load=kTRUE)
Returns the pad editor dialog. Static method.
TGHorizontalFrame * fTopFrame
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
void ToggleSort()
Toggle the sort mode and set the "sort button" state accordingly.
virtual void SetActive(Bool_t)
void AdjustPosition(TGListTreeItem *item)
Move content to position of item.
The TNamed class is the base class for all named ROOT classes.
virtual void SetUserData(void *, Bool_t=kFALSE)
void SetToolTipItem(TGListTreeItem *item, const char *string)
Set tooltip text for this item.
void FreePicture(const TGPicture *pic)
Free picture resource.
void AddRemoteFile(TObject *obj)
Add remote file in list tree.
const char * GetText() const
void Clear()
Clear string without changing its capacity.
if(pyself &&pyself!=Py_None)
TString & Append(const char *cs)
void PadModified()
Slot used to switch to the tab containing the current pad/canvas (gPad) used e.g. ...
virtual const char * GetIconName() const
Returns mime type name of object.
static Bool_t IsTextFile(const char *candidate)
Returns true if given a text file Uses the specification given on p86 of the Camel book...
TString FullPathName(TGListTreeItem *item)
returns an absolute path
char * FormatFileInfo(const char *fname, Long64_t size, Long_t modtime)
Format file information to be displayed in the tooltip.
TGListTreeItem * GetFirstItem() const
void Chdir(TGListTreeItem *item)
Make object associated with item the current directory.
Describes an Operating System directory for the browser.
virtual UInt_t GetHeight() const
void OpenItem(TGListTreeItem *item)
Open item in list tree (i.e. show child items).
virtual void SetTipText(const char *)
TContextMenu * fContextMenu
virtual void BrowseObj(TObject *obj)
Browse object.
Using a TBrowser one can browse all ROOT 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...
virtual void Browse(TBrowser *b)
Browse the content of the directory.
TGTabElement * GetTabTab(Int_t tabIndex) const
Return the tab element of tab with index tabIndex.
TGListTreeItem * GetNextSibling() const
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
void CreateBrowser()
Create the actual file browser.
TGListTreeItem * GetFirstChild() const
R__EXTERN TSystem * gSystem
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 Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
virtual void Refresh(Bool_t force=kFALSE)
Refresh content of the list tree.
void GetPathnameFromItem(TGListTreeItem *item, char *path, Int_t depth=0)
Get pathname from item.
void AddItem(TGListTreeItem *parent, TGListTreeItem *item)
Add given item to list tree.
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...
TGListTreeItem * fRootDir
virtual const char * GetText() const =0
Bool_t TestBit(UInt_t f) const
char * Form(const char *fmt,...)
void ClearHighlighted()
Un highlight items.
virtual TGListBox * GetListBox() const
virtual void RecursiveRemove(TObject *obj)
Recursively remove object.
void Clicked(TGListTreeItem *item, Int_t btn, Int_t x, Int_t y)
Process mouse clicks in TGListTree.
virtual const char * GetName() const
Returns name of object.
TGPictureButton * fSortButton
TString DirName(TGListTreeItem *item)
returns the directory path
The ROOT global object gROOT contains a list of all defined classes.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
mFiltered_t::iterator mFiltered_i
Int_t SortChildren(TGListTreeItem *item)
Sort children of item.
void Rename(const char *new_name)
mFiltered_t fFilteredItems
Each class (see TClass) has a linked list of its base class(es).
void Selected(char *)
A ROOT File has been selected in TGHtmlBrowser.
virtual void ClearViewPort()
Clear view port and redraw full content.
static const char * FormatToolTip(TObject *obj, Int_t maxlen=0)
Format the tooltip information, based on the object passed in argument.
char * StrDup(const char *str)
Duplicate the string str.
const TGPicture * fRootIcon
TGListTreeItem * GetSelected() const
TString & Remove(Ssiz_t pos)
Long_t XXExecuteDefaultAction(TObject *obj)
Execute default action for selected object (action is specified in the $HOME/.root.mimes or $ROOTSYS/etc/root.mimes file.
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
virtual Bool_t IsDirectory(const char *dir=0) const
Check if object is a directory.
virtual const char * GetName() const
Returns name of object.
Option_t * GetDrawOption() const
returns drawing option
virtual Pixmap_t GetMask()
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
virtual void AddEntry(TGString *s, Int_t id)
Long64_t Atoll() const
Return long long value of string.
Describe directory structure in memory.
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
void GotoDir(const char *path)
Go to the directory "path" and open all the parent list tree items.
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Abstract base class used by ROOT graphics editor.
virtual ~TGFileBrowser()
Destructor.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
const TGPicture * fCachedPic
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 void MapSubwindows()
Map all sub windows that are part of the composite frame.
const char * GetClassName() const
virtual void SetPictures(const TGPicture *, const TGPicture *)
TGCompositeFrame * GetCurrentContainer() const
Mother of all ROOT objects.
void CheckRemote(TGListTreeItem *item)
Check if the current list tree item points to a remote object.
virtual void Add(TObject *obj, const char *name=0, Int_t check=-1)
Add items to the browser.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
A TSystemFile describes an operating system file.
Bool_t R_ISDIR(Int_t mode)
static Bool_t IsObjectEditable(TClass *cl)
Helper function checking if a class has a graphic properties editor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TGListTreeItem * fListLevel
const TGPicture * fFileIcon
virtual TList * GetVolumes(Option_t *) const
void SetDNDSource(Bool_t onoff)
void SetActBrowser(TBrowserImp *b)
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
void Checked(TObject *obj, Bool_t check)
Emits signal when double clicking on icon.
void CheckItem(TGListTreeItem *item, Bool_t check=kTRUE)
Set check button state for the node 'item'.
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
TObject * At(Int_t idx) const
Bool_t GetFileStat(FileStat_t *sbuf)
Get remote file status.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual const char * ApplicationName() const
void HighlightItem(TGListTreeItem *item)
Highlight item.
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
virtual const char * GetTitle() const
Returns title of object.
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
TGTab * GetTabRight() const
virtual TGMainFrame * GetMainFrame() const
virtual Bool_t SetImageBuffer(char **, EImageFileTypes=TImage::kPng)
void SetDrawOption(Option_t *option="")
Set drawing option for object.
void Update()
Update content of the list tree.
void SetSelected(TGListTreeItem *item)
Int_t RecursiveDeleteItem(TGListTreeItem *item, void *userData)
Delete item with fUserData == ptr.
ABC describing GUI independent browser implementation protocol.
void GetObjPicture(const TGPicture **pic, TObject *obj)
Retrieve icons associated with class "name".
TGHorizontalFrame * fBotFrame
virtual TGTextEntry * GetTextEntry() const