49class TViewUpdateTimer :
public TTimer {
61class TGFileIcon :
public TGIcon {
71 TGIcon(p, pic, 0, 0, options, back) { fLpic = lpic; }
96 switch (fContainer->fSortType) {
100 type1 =
f1->GetType();
110 if (type1 < type2)
return -1;
111 if (type1 > type2)
return 1;
112 return strcmp(
f1->GetItemName()->GetString(),
124 type1 =
f1->GetType();
134 if (type1 < type2)
return -1;
135 if (type1 > type2)
return 1;
136 return strcmp(
f1->GetItemName()->GetString(),
148 type1 =
f1->GetType();
158 if (type1 < type2)
return -1;
159 if (type1 > type2)
return 1;
160 return strcmp(
f1->GetItemName()->GetString(),
166 type1 =
f1->GetType();
172 else if (
R_ISLNK(type1)) type1 = 2;
173 else if (
R_ISSOCK(type1)) type1 = 3;
174 else if (
R_ISFIFO(type1)) type1 = 4;
179 else if (
R_ISLNK(type2)) type2 = 2;
180 else if (
R_ISSOCK(type2)) type2 = 3;
181 else if (
R_ISFIFO(type2)) type2 = 4;
185 if (type1 < type2)
return -1;
186 if (type1 > type2)
return 1;
187 return strcmp(
f1->GetItemName()->GetString(),
191 if (
f1->GetSize() < f2->
GetSize())
return -1;
192 if (
f1->GetSize() > f2->
GetSize())
return 1;
193 return strcmp(
f1->GetItemName()->GetString(),
197 time_t loctimeF1 = (time_t)
f1->GetModTime();
199 struct tm tmF1 = *localtime(&loctimeF1);
203 struct tm tmF2 = *localtime(&loctimeF2);
205 if ( tmF1.tm_year != tmF2.tm_year )
206 return (tmF1.tm_year < tmF2.tm_year) ? +1 : -1;
207 else if ( tmF1.tm_mon != tmF2.tm_mon )
208 return (tmF1.tm_mon < tmF2.tm_mon) ? +1 : -1;
209 else if ( tmF1.tm_mday != tmF2.tm_mday )
210 return (tmF1.tm_mday < tmF2.tm_mday) ? +1 : -1;
211 else if ( tmF1.tm_hour != tmF2.tm_hour )
212 return (tmF1.tm_hour < tmF2.tm_hour) ? +1 : -1;
213 else if ( tmF1.tm_min != tmF2.tm_min )
214 return (tmF1.tm_min < tmF2.tm_min) ? +1 : -1;
215 else if ( tmF1.tm_sec != tmF2.tm_sec )
216 return (tmF1.tm_sec < tmF2.tm_sec) ? +1 : -1;
226Bool_t TViewUpdateTimer::Notify()
228 fContainer->HandleTimer(0);
237void TGFileIcon::DoRedraw()
240 if (fLpic) fLpic->
Draw(fId, GetBckgndGC()(), 0, 0);
264 Init(blpic, slpic, buf, viewMode);
277 Init(blpic, slpic, stat, viewMode);
310 snprintf(tmp,
sizeof(tmp),
"%c%c%c%c%c%c%c%c%c%c",
337 fsize = bsize =
fSize;
342 snprintf(tmp,
sizeof(tmp),
"%lld.%lldM", fsize/1024, (fsize%1024)/103);
344 snprintf(tmp,
sizeof(tmp),
"%lld.%lldK", bsize/1024, (bsize%1024)/103);
347 snprintf(tmp,
sizeof(tmp),
"%lld", bsize);
367 newtime = localtime(&loctime);
369 snprintf(tmp,
sizeof(tmp),
"%d-%02d-%02d %02d:%02d", newtime->tm_year + 1900,
370 newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour,
448 fRefresh =
new TViewUpdateTimer(
this, 1000);
467 Error(
"TGFileContainer",
"required pixmap(s) missing\n");
483 fRefresh =
new TViewUpdateTimer(
this, 1000);
502 Error(
"TGFileContainer",
"required pixmap(s) missing\n");
544 nw->fContainer =
this;
594 const char *ext =
name ? strrchr(
name,
'.') : 0;
598 if (
fCachePictures && ext && cached_spic && cached_lpic && (cached_ext == ext)) {
601 if (!is_link)
return;
606 if (is_link && fname.
EndsWith(
".lnk")) {
613 if (!*lpic) *lpic = *pic;
618 if (!is_link)
return;
647 if (img2) img1->
Merge(img2);
648 lnk_name = ((
const TGPicture *)*pic)->GetName();
653 if (img2)
delete img2;
661 if (img2) img1->
Merge(img2);
662 lnk_name = ((
const TGPicture *)*lpic)->GetName();
667 if (img2)
delete img2;
737 if (strcmp(
name,
".") && strcmp(
name,
".."))
761 Info(
"AddFile",
"Broken symlink of %s.",
name);
764 msg.
Form(
"Can't read file attributes of \"%s\": %s.",
786 item =
new TGFileItem(
this, lpic, slpic, spic, pic,
847 fRefresh =
new TViewUpdateTimer(
this, msec);
859 out << std::endl <<
" // container frame" << std::endl;
860 out <<
" TGFileContainer *";
871 out <<
");" << std::endl;
878 if (option && strstr(option,
"keep_names"))
879 out <<
" " <<
GetName() <<
"->SetName(\"" <<
GetName() <<
"\");" << std::endl;
881 <<
GetName() <<
");" << std::endl;
882 out <<
" " <<
GetName() <<
"->DisplayDirectory();" << std::endl;
883 out <<
" " <<
GetName() <<
"->AddFile("<< quote <<
".." << quote <<
");" << std::endl;
884 out <<
" " <<
GetName() <<
"->StopRefreshTimer();" << std::endl;
Int_t Compare(const void *item1, const void *item2)
Bool_t R_ISFIFO(Int_t mode)
Bool_t R_ISSOCK(Int_t mode)
Bool_t R_ISBLK(Int_t mode)
Bool_t R_ISREG(Int_t mode)
Bool_t R_ISLNK(Int_t mode)
Bool_t R_ISDIR(Int_t mode)
R__EXTERN TSystem * gSystem
Bool_t R_ISCHR(Int_t mode)
virtual void Layout()
Create layout for canvas.
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
TGMimeTypes * GetMimeTypeList() const
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
TGPicturePool * GetPicturePool() const
void FreePicture(const TGPicture *pic)
Free picture resource.
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
static TGLayoutHints * fgDefaultHints
const TGWindow * fMsgWindow
TGCanvas * GetCanvas() const
virtual void RemoveAll()
Remove all items from the container.
const TGPicture * fSlink_s
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 TGFileItem * AddFile(const char *name, const TGPicture *pic=0, const TGPicture *lpic=0)
Add file in container.
void CreateFileList()
This function creates the file list from current dir.
const TGPicture * fFolder_s
TViewUpdateTimer * fRefresh
void StopRefreshTimer()
stop refresh timer
virtual Bool_t HandleTimer(TTimer *t)
Refresh container contents.
virtual void Sort(EFSSortMode sortType)
Sort file system list view container according to sortType.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame.
virtual void ChangeDirectory(const char *path)
Change current directory.
const TGPicture * fSlink_t
virtual void DisplayDirectory()
Display the contents of the current directory in the container.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a file container widget as a C++ statement(s) on output stream out.
void StartRefreshTimer(ULong_t msec=1000)
start refreshing
const TGPicture * fFolder_t
friend class TGFSFrameElement
virtual ~TGFileContainer()
Delete list view file container.
virtual void SetFilter(const char *filter)
Set file selection filter.
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.
virtual TGFileItem * AddRemoteFile(TObject *obj, const TGPicture *ipic=0, const TGPicture *ilpic=0)
Add remote file in container.
const TGPicture * fLcurrent
void Init(const TGPicture *blpic, const TGPicture *slpic, FileStat_t &stat, EListViewMode viewMode)
Common initializer for file list view item.
Long_t GetModTime() const
virtual void DoRedraw()
Draw list view container item.
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 SetViewMode(EListViewMode viewMode)
Set container item view mode.
virtual ~TGFileItem()
Destructor.
static Pixel_t GetWhitePixel()
Get white pixel value.
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
virtual UInt_t GetOptions() const
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
virtual void DoRedraw()
Redraw picture.
virtual void AddItem(TGLVEntry *item)
virtual void DoRedraw()
Redraw list view item.
virtual void SetViewMode(EListViewMode viewMode)
Set the view mode for this list item.
TGString * GetItemName() const
const TGPicture * GetIcon(const char *filename, Bool_t small_icon)
Return icon belonging to mime type of filename.
void FreePicture(const TGPicture *pic)
Remove picture from cache if nobody is using it anymore.
const TGPicture * GetPicture(const char *name)
Get a picture from the picture pool.
void Draw(Option_t *="")
Default Draw method for all objects.
const char * GetString() const
virtual void SetWindowName(const char *name=0)
Set window name.
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
const TGWindow * GetParent() const
An abstract interface to image processing library.
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
virtual void SetImage(const Double_t *, UInt_t, UInt_t, TImagePalette *=0)
static TImage * Create()
Create an image.
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
virtual Pixmap_t GetPixmap()
virtual Pixmap_t GetMask()
virtual void Add(TObject *obj)
virtual void Clear(Option_t *option="")
Remove all objects from the list.
virtual void Sort(Bool_t order=kSortAscending)
Sort linked list.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual Bool_t IsSortable() const
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual Int_t Compare(const TObject *obj) const
Compare abstract method.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Regular expression class.
The TRemoteObject class provides protocol for browsing ROOT objects from a remote ROOT session.
Bool_t GetFileStat(FileStat_t *sbuf)
Get remote file status.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
const char * Data() const
TString & Prepend(const char *cs)
TString & Remove(Ssiz_t pos)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
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 const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual const char * WorkingDirectory()
Return working directory.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
virtual const char * GetError()
Return system error string.
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
Handles synchronous and a-synchronous timer events.
virtual Bool_t Notify()
Notify when timer times out.
static constexpr double ms