53 #include "RConfigure.h" 78 class 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)");
236 "TGFileBrowser",
this,
"Selected(char*)");
239 "TGFileBrowser",
this,
"PadModified()");
297 if (maxlen > 0 && infos.
Length() > maxlen) {
304 objsize = objinfo.
Atoll();
307 bsize = fsize = objsize;
351 if (name) oname =
name;
352 else if (obj) oname = obj->
GetName();
357 const char *filter = (
const char *)(*it).second;
368 if (!name) name = obj->
GetName();
484 if (volumes && curvol) {
485 const char *curdrive;
493 while ((drive = (
TNamed *)next())) {
495 (strcmp(drive->
GetName(), curdrive) == 0) ?
496 "SetRootDir" :
"Add");
505 if (
gROOT->GetListOfFiles() && !
gROOT->GetListOfFiles()->IsEmpty())
535 const char *ext = name ? strrchr(name,
'.') : 0;
539 if (ext && cached_spic && (cached_ext == ext)) {
545 *pic =
gClient->GetMimeTypeList()->GetIcon(name,
kTRUE);
559 *pic =
gClient->GetPicture(
"doc_t.xpm");
562 *pic =
gClient->GetPicture(
"app_t.xpm");
565 *pic =
gClient->GetPicture(
"folder_t.xpm");
568 *pic =
gClient->GetPicture(
"rootdb_t.xpm");
573 *pic =
gClient->GetPicture(
"slink_t.xpm");
602 item->SetUserData(0);
625 TCursorSwitcher cursorSwitcher(
this,
fListTree);
627 UInt_t curr =
gROOT->GetListOfBrowsables()->GetSize();
628 if (!prev) prev = curr;
645 Long_t id = 0, flags = 0, modtime = 0;
666 if (strlen(path) > 1) {
670 if ((res == 0) && (flags & 2)) {
686 flags =
id = size = modtime = 0;
695 if (strlen(path) > 1) {
731 if ((opt == 0) || (!opt[0])) {
736 if (strstr(opt,
"SetRootDir")) {
740 else if (strstr(opt,
"Add")) {
776 if (itm == 0)
return;
778 if ((
fCnt == 0) || (olditem != itm)) {
779 olditem = item = itm;
781 if (!name) name = obj->
GetName();
823 if ((
id > 1) && (
id < 5))
825 else if ((
id < 0) || (
id > 4)) {
887 else if (!strcmp(item->
GetText(),
"ROOT Files")) {
901 if (topobj && topobj->
InheritsFrom(
"TApplicationRemote")) {
915 Getlinem(kInit,
"\nroot [0]");
922 Getlinem(kInit,
"\nroot [0]");
941 filter = (
const char *)(*it).second;
951 filter.
Prepend(
"Showing only \'");
993 Long_t id = 0, flags = 0, modtime = 0;
1006 const char *clname = ((
TKey *)obj)->GetClassName();
1007 if (clname && strcmp(clname,
"TGeoManager")) {
1011 name += ((
TKey *)obj)->GetCycle();
1034 if (strlen(path) > 3) {
1059 if (selected->InheritsFrom(
"TBranch"))
1061 if (selected->InheritsFrom(
"TTree")) {
1120 _splitpath(fullpath.
Data(), winDrive, winDir, winName, winExt);
1138 Int_t weirdcount = 0;
1146 infile = fopen(candidate,
"r");
1149 nchars = fread(buffer, 1, 512, infile);
1152 for (i = 0; i < nchars; i++) {
1153 if (buffer[i] & 128)
1155 if (buffer[i] ==
'\0')
1159 if ((nchars > 0) && ((weirdcount * 100 / nchars) > 30))
1178 if (img1 == 0)
return pic;
1182 if (img2) img1->
Merge(img2);
1185 merged =
gClient->GetPicturePool()->GetPicture(lnk_name.
Data(),
1187 if (img2)
delete img2;
1216 TCursorSwitcher switcher(
this,
fListTree);
1233 const char *clname = ((
TKey *)obj)->GetClassName();
1238 name += ((
TKey *)obj)->GetCycle();
1261 while ( probj && strcmp(probj->
GetClassName(),
"TFile")) {
1265 if (probj && !strcmp(probj->
GetClassName(),
"TFile")) {
1269 TString::Format(
"((TApplicationServer *)gApplication)->BrowseFile(\"%s\");",
1274 if (
gClient->GetMimeTypeList()->GetAction(obj->
GetName(), action)) {
1277 if ((act[0] !=
'!') && (strcmp(pitem->
GetText(),
"ROOT Files"))) {
1283 if ((ext.
EndsWith(
".root")) && (strcmp(pitem->
GetText(),
"ROOT Files"))) {
1292 if (
gClient->GetMimeTypeList()->GetAction(obj->IsA()->
GetName(), action)) {
1300 if (act[0] ==
'!') {
1328 flags =
id = size = modtime = 0;
1338 TList *files = dir.GetListOfFiles();
1351 if ((fname!=
"..") && (fname!=
".")) {
1358 const TGPicture *opened = 0, *l_opened = 0;
1359 const TGPicture *closed = 0, *l_closed = 0;
1364 if (l_opened && l_closed)
1382 fname = pname = file->
GetName();
1394 pic =
gClient->GetMimeTypeList()->GetIcon(pname,
kTRUE);
1411 if (size && modtime) {
1425 if (is_link && lnkname.
EndsWith(
".lnk"))
1430 if (fname.EndsWith(
".root")) {
1445 if (ostr)
delete ostr;
1455 else if (fname.EndsWith(
".png")) {
1470 TString fullname = f.GetTitle();
1474 (
ULong_t)embed, fullname.Data()));
1478 (
ULong_t)embed, fullname.Data()));
1511 if (
gClient->GetMimeTypeList()->GetAction(obj->
GetName(), action)) {
1516 if (act[0] ==
'!') {
1546 fsize = bsize = size;
1551 infos +=
TString::Format(
"Size: %lld.%lldM", fsize/1024, (fsize%1024)/103);
1553 infos +=
TString::Format(
"Size: %lld.%lldK", bsize/1024, (bsize%1024)/103);
1559 time_t loctime = (time_t) modtime;
1560 newtime = localtime(&loctime);
1564 newtime->tm_year + 1900,
1565 newtime->tm_mon+1, newtime->tm_mday,
1566 newtime->tm_hour, newtime->tm_min);
1577 const char *clname = 0;
1585 objClass = obj->IsA();
1590 clname = ((
TKey *)obj)->GetClassName();
1604 objClass = obj->IsA();
1613 Bool_t xpm = xpm_magic ==
"/* ";
1614 const char *iconname = xpm ? obj->
GetName() :
name;
1624 *pic =
gClient->GetMimeTypeList()->GetIcon(iconname,
kTRUE);
1625 if (!(*pic) && xpm) {
1631 gClient->GetMimeTypeList()->AddType(
"[thumbnail]", iconname, iconname, iconname,
"->Browse()");
1653 if (item == 0)
return;
1655 TObjArray *tokens = sPath.Tokenize(
"/");
1677 if (first == drive->
GetName()) {
1764 "Enter filter expression:\n(empty string \"\" or \"*\" to remove filter)",
1768 if ((filter[0] == 0) && (filter[1] == 0)) {
1772 else if (((filter[0] == 0) && (filter[1] == 1)) || !strcmp(filter,
"*")) {
TGCompositeFrame * GetCurrentContainer() const
virtual const char * GetName() const
Returns name of object.
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 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.
virtual TGTextEntry * GetTextEntry() 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 TList * GetListOfKeys() const
const char * GetClassName() const
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.
Utility class for browsing TMapFile objects.
TGListTreeItem * FindItemByObj(TGListTreeItem *item, void *ptr)
Find item with fUserData == ptr.
virtual UInt_t GetHeight() const
virtual const char * WorkingDirectory()
Return working directory.
TGCompositeFrame * GetTabContainer(Int_t tabIndex) const
Return container of tab with index tabIndex.
Int_t DeleteItem(TGListTreeItem *item)
Delete item from list tree.
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad...
Collectable string class.
TGListTreeItem * fCurrentDir
virtual UInt_t GetWidth() const
virtual const char * GetIconName() const
Returns mime type name of object.
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.
virtual Int_t GetEntries() const
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.
virtual const char * GetTitle() const
Returns title of object.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) 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.
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.
void ToLower()
Change string to lower-case.
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 void Draw(Option_t *option="")
Default Draw method for all objects.
An abstract interface to image processing library.
TGFileBrowser(const TGWindow *p, TBrowser *b=0, UInt_t w=200, UInt_t h=400)
TGFileBrowser constructor.
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
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
TObject * At(Int_t idx) const
virtual Bool_t IsDirectory(const char *dir=0) const
Check if object is a directory.
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
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.
TGPictureButton * fRefreshButton
virtual void SetImage(const Double_t *, UInt_t, UInt_t, TImagePalette *=0)
TGListTreeItem * GetSelected() const
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)
virtual void Sort(Bool_t order=kSortAscending)
Sort linked list.
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 * GetKeyClassName() const
void Clear()
Clear string without changing its capacity.
TString & Append(const char *cs)
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
void PadModified()
Slot used to switch to the tab containing the current pad/canvas (gPad) used e.g. ...
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
virtual TList * GetList() const
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Long64_t Atoll() const
Return long long value of string.
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.
object has not been deleted
TApplication * GetAppRemote() const
void Chdir(TGListTreeItem *item)
Make object associated with item the current directory.
Describes an Operating System directory for the browser.
virtual TGListBox * GetListBox() 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.
virtual const char * ApplicationName() const
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
void CreateBrowser()
Create the actual file browser.
R__EXTERN TSystem * gSystem
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
TGListTreeItem * GetNextSibling() const
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 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 InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
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
Int_t GetEntriesFast() const
char * Form(const char *fmt,...)
void ClearHighlighted()
Un highlight items.
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.
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.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Option_t * GetDrawOption() const
returns drawing option
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.
TGTab * GetTabRight() const
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
const char * GetText() const
TString & Remove(Ssiz_t pos)
TGListTreeItem * GetParent() const
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 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)
Describe directory structure in memory.
TGListTreeItem * GetFirstChild() const
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 Contains(const char *pat, ECaseCompare cmp=kExact) const
static constexpr double s
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 SetModel(TVirtualPad *pad, TObject *obj, Int_t event, Bool_t force=kFALSE)
Activate object editors according to the selected object.
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
virtual void SetPictures(const TGPicture *, const TGPicture *)
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 const char * GetTitle() const
Returns title of object.
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
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.
TGListTreeItem * fListLevel
const TGPicture * fFileIcon
TGTabElement * GetTabTab(Int_t tabIndex) const
Return the tab element of tab with index tabIndex.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
void SetDNDSource(Bool_t onoff)
virtual TList * GetVolumes(Option_t *) const
void SetActBrowser(TBrowserImp *b)
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects)...
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 Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
static TImage * Create()
Create an image.
Bool_t GetFileStat(FileStat_t *sbuf)
Get remote file status.
virtual const char * GetName() const
Returns name of object.
void HighlightItem(TGListTreeItem *item)
Highlight item.
TGListTreeItem * GetFirstItem() const
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Int_t GetNumberOfTabs() const
Return number of tabs.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
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.
virtual const char * GetTitle() const
Returns title of object.
ABC describing GUI independent browser implementation protocol.
void GetObjPicture(const TGPicture **pic, TObject *obj)
Retrieve icons associated with class "name".
virtual TGLBEntry * GetSelectedEntry() const
TGHorizontalFrame * fBotFrame
const char * Data() const