60 class TGFileIcon :
public TGIcon {
70 TGIcon(p, pic, 0, 0, options, back) { fLpic = lpic; }
95 switch (fContainer->fSortType) {
109 if (type1 < type2)
return -1;
110 if (type1 > type2)
return 1;
133 if (type1 < type2)
return -1;
134 if (type1 > type2)
return 1;
157 if (type1 < type2)
return -1;
158 if (type1 > type2)
return 1;
171 else if (
R_ISLNK(type1)) type1 = 2;
172 else if (
R_ISSOCK(type1)) type1 = 3;
173 else if (
R_ISFIFO(type1)) type1 = 4;
174 else if (
R_ISREG(type1) && (type1 & kS_IXUSR)) type1 = 5;
178 else if (
R_ISLNK(type2)) type2 = 2;
179 else if (
R_ISSOCK(type2)) type2 = 3;
180 else if (
R_ISFIFO(type2)) type2 = 4;
181 else if (
R_ISREG(type2) && (type2 & kS_IXUSR)) type2 = 5;
184 if (type1 < type2)
return -1;
185 if (type1 > type2)
return 1;
198 struct tm tmF1 = *localtime(&loctimeF1);
202 struct tm tmF2 = *localtime(&loctimeF2);
204 if ( tmF1.tm_year != tmF2.tm_year )
205 return (tmF1.tm_year < tmF2.tm_year) ? +1 : -1;
206 else if ( tmF1.tm_mon != tmF2.tm_mon )
207 return (tmF1.tm_mon < tmF2.tm_mon) ? +1 : -1;
208 else if ( tmF1.tm_mday != tmF2.tm_mday )
209 return (tmF1.tm_mday < tmF2.tm_mday) ? +1 : -1;
210 else if ( tmF1.tm_hour != tmF2.tm_hour )
211 return (tmF1.tm_hour < tmF2.tm_hour) ? +1 : -1;
212 else if ( tmF1.tm_min != tmF2.tm_min )
213 return (tmF1.tm_min < tmF2.tm_min) ? +1 : -1;
214 else if ( tmF1.tm_sec != tmF2.tm_sec )
215 return (tmF1.tm_sec < tmF2.tm_sec) ? +1 : -1;
227 fContainer->HandleTimer(0);
236 void TGFileIcon::DoRedraw()
239 if (fLpic) fLpic->Draw(fId, GetBckgndGC()(), 0, 0);
252 TGLVEntry(p, bpic, spic, name, 0, viewMode, options, back)
263 Init(blpic, slpic, buf, viewMode);
274 TGLVEntry(p, bpic, spic, name, 0, viewMode, options, back)
276 Init(blpic, slpic, stat, viewMode);
309 snprintf(tmp,
sizeof(tmp),
"%c%c%c%c%c%c%c%c%c%c",
336 fsize = bsize =
fSize;
341 snprintf(tmp,
sizeof(tmp),
"%lld.%lldM", fsize/1024, (fsize%1024)/103);
343 snprintf(tmp,
sizeof(tmp),
"%lld.%lldK", bsize/1024, (bsize%1024)/103);
346 snprintf(tmp,
sizeof(tmp),
"%lld", bsize);
366 newtime = localtime(&loctime);
368 snprintf(tmp,
sizeof(tmp),
"%d-%02d-%02d %02d:%02d", newtime->tm_year + 1900,
369 newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour,
466 Error(
"TGFileContainer",
"required pixmap(s) missing\n");
501 Error(
"TGFileContainer",
"required pixmap(s) missing\n");
543 nw->fContainer =
this;
593 const char *ext = name ? strrchr(name,
'.') : 0;
597 if (
fCachePictures && ext && cached_spic && cached_lpic && (cached_ext == ext)) {
600 if (!is_link)
return;
605 if (is_link && fname.
EndsWith(
".lnk")) {
612 if (!*lpic) *lpic = *pic;
617 if (!is_link)
return;
628 if (
R_ISREG(file_type) && (file_type) & kS_IXUSR) {
646 if (img2) img1->
Merge(img2);
647 lnk_name = ((
const TGPicture *)*pic)->GetName();
652 if (img2)
delete img2;
delete img1;
659 if (img2) img1->
Merge(img2);
660 lnk_name = ((
const TGPicture *)*lpic)->GetName();
665 if (img2)
delete img2;
delete img1;
732 if (strcmp(name,
".") && strcmp(name,
".."))
756 Info(
"AddFile",
"Broken symlink of %s.", name);
759 msg.
Form(
"Can't read file attributes of \"%s\": %s.",
781 item =
new TGFileItem(
this, lpic, slpic, spic, pic,
854 out << std::endl <<
" // container frame" << std::endl;
855 out <<
" TGFileContainer *";
866 out <<
");" << std::endl;
873 if (option && strstr(option,
"keep_names"))
874 out <<
" " <<
GetName() <<
"->SetName(\"" <<
GetName() <<
"\");" << std::endl;
876 <<
GetName() <<
");" << std::endl;
877 out <<
" " <<
GetName() <<
"->DisplayDirectory();" << std::endl;
878 out <<
" " <<
GetName() <<
"->AddFile("<< quote <<
".." << quote <<
");" << std::endl;
879 out <<
" " <<
GetName() <<
"->StopRefreshTimer();" << std::endl;
Bool_t R_ISSOCK(Int_t mode)
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
void Init(const TGPicture *blpic, const TGPicture *slpic, FileStat_t &stat, EListViewMode viewMode)
Common initializer for file list view item.
Bool_t R_ISCHR(Int_t mode)
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Bool_t R_ISLNK(Int_t mode)
TGPicturePool * GetPicturePool() const
virtual void RemoveAll()
Remove all items from the container.
const TGPicture * fFolder_s
virtual const char * WorkingDirectory()
Return working directory.
const TGPicture * fLcurrent
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
void StopRefreshTimer()
stop refresh timer
const TGWindow * GetParent() const
const TGPicture * GetIcon(const char *filename, Bool_t small_icon)
Return icon belonging to mime type of filename.
void StartRefreshTimer(ULong_t msec=1000)
start refreshing
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.
Long_t GetModTime() const
static Pixel_t GetWhitePixel()
Get white pixel value.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Regular expression class.
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
static const char * filename()
virtual TGFileItem * AddRemoteFile(TObject *obj, const TGPicture *ipic=0, const TGPicture *ilpic=0)
Add remote file in container.
An abstract interface to image processing library.
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
TString & Prepend(const char *cs)
const TGWindow * fMsgWindow
virtual void SetViewMode(EListViewMode viewMode)
Set container item view mode.
virtual void SetImage(const Double_t *, UInt_t, UInt_t, TImagePalette *=0)
TGString * GetItemName() const
Bool_t R_ISREG(Int_t mode)
virtual Pixmap_t GetPixmap()
virtual void Sort(Bool_t order=kSortAscending)
Sort linked list.
void Draw(Option_t *="")
Default Draw method for all objects.
friend class TGFSFrameElement
const char * Data() const
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
const TGPicture * fFolder_t
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 Pixel_t GetDefaultFrameBackground()
Get default frame background.
virtual void ChangeDirectory(const char *path)
Change current directory.
virtual UInt_t GetOptions() const
void CreateFileList()
This function creates the file list from current dir.
void FreePicture(const TGPicture *pic)
Free picture resource.
if(pyself &&pyself!=Py_None)
void FreePicture(const TGPicture *pic)
Remove picture from cache if nobody is using it anymore.
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
virtual void Sort(EFSSortMode sortType)
Sort file system list view container according to sortType.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual Bool_t HandleTimer(TTimer *t)
Refresh container contents.
virtual Bool_t IsSortable() const
TGFileContainer(const TGWindow *p=0, UInt_t w=1, UInt_t h=1, UInt_t options=kSunkenFrame, Pixel_t back=GetDefaultFrameBackground())
Create a list view container which will hold the contents of the current directory.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
R__EXTERN TSystem * gSystem
static TGLayoutHints * fgDefaultHints
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
TViewUpdateTimer * fRefresh
TGCanvas * GetCanvas() const
virtual TGFileItem * AddFile(const char *name, const TGPicture *pic=0, const TGPicture *lpic=0)
Add file in container.
const TGPicture * GetPicture(const char *name)
Get a picture from the picture pool.
Handles synchronous and a-synchronous timer events.
virtual const char * GetName() const
Returns name of object.
virtual void AddItem(TGLVEntry *item)
void Reset(Detail::TBranchProxy *x)
virtual void FreeDirectory(void *dirp)
Free a directory.
const TGPicture * fSlink_s
TGMimeTypes * GetMimeTypeList() const
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a file container widget as a C++ statement(s) on output stream out.
TString & Remove(Ssiz_t pos)
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
TViewUpdateTimer(TGFileContainer *t, Long_t ms)
virtual Pixmap_t GetMask()
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
const TGPicture * fSlink_t
virtual void SetViewMode(EListViewMode viewMode)
Set the view mode for this list item.
virtual void Clear(Option_t *option="")
Remove all objects from the list.
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
virtual void DoRedraw()
Redraw picture.
Mother of all ROOT objects.
virtual void Layout()
Create layout for canvas.
Bool_t R_ISDIR(Int_t mode)
virtual void SetFilter(const char *filter)
Set file selection filter.
virtual ~TGFileItem()
Destructor.
virtual void Add(TObject *obj)
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
Int_t Compare(const void *item1, const void *item2)
virtual void DoRedraw()
Draw list view container item.
virtual void GetFilePictures(const TGPicture **pic, const TGPicture **lpic, Int_t file_type, Bool_t is_link, const char *ext, Bool_t small)
Determine the file picture for the given file type.
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
virtual void DisplayDirectory()
Display the contents of the current directory in the container.
virtual Int_t Compare(const TObject *obj) const
Compare abstract method.
Bool_t R_ISBLK(Int_t mode)
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual void DoRedraw()
Redraw list view item.
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
const char * GetString() const
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
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 ~TGFileContainer()
Delete list view file container.
Bool_t R_ISFIFO(Int_t mode)
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
virtual const char * GetError()
Return system error string.
TGFileItem(const TGWindow *p=0, const TGPicture *bpic=0, const TGPicture *blpic=0, const TGPicture *spic=0, const TGPicture *slpic=0, TGString *name=0, Int_t type=0, Long64_t size=1, Int_t uid=0, Int_t gid=0, Long_t modtime=0, EListViewMode viewMode=kLVList, UInt_t options=kVerticalFrame, Pixel_t back=GetWhitePixel())
Create a list view item.
virtual void SetWindowName(const char *name=0)
Set window name.