117 type1 =
f1->GetType();
127 if (type1 < type2)
return -1;
128 if (type1 > type2)
return 1;
129 return strcmp(
f1->GetItemName()->GetString(),
141 type1 =
f1->GetType();
151 if (type1 < type2)
return -1;
152 if (type1 > type2)
return 1;
153 return strcmp(
f1->GetItemName()->GetString(),
165 type1 =
f1->GetType();
175 if (type1 < type2)
return -1;
176 if (type1 > type2)
return 1;
177 return strcmp(
f1->GetItemName()->GetString(),
183 type1 =
f1->GetType();
189 else if (
R_ISLNK(type1)) type1 = 2;
190 else if (
R_ISSOCK(type1)) type1 = 3;
191 else if (
R_ISFIFO(type1)) type1 = 4;
196 else if (
R_ISLNK(type2)) type2 = 2;
197 else if (
R_ISSOCK(type2)) type2 = 3;
198 else if (
R_ISFIFO(type2)) type2 = 4;
202 if (type1 < type2)
return -1;
203 if (type1 > type2)
return 1;
204 return strcmp(
f1->GetItemName()->GetString(),
208 if (
f1->GetSize() < f2->
GetSize())
return -1;
209 if (
f1->GetSize() > f2->
GetSize())
return 1;
210 return strcmp(
f1->GetItemName()->GetString(),
214 time_t loctimeF1 = (time_t)
f1->GetModTime();
216 struct tm tmF1 = *localtime(&loctimeF1);
220 struct tm tmF2 = *localtime(&loctimeF2);
222 if ( tmF1.tm_year != tmF2.tm_year )
223 return (tmF1.tm_year < tmF2.tm_year) ? +1 : -1;
224 else if ( tmF1.tm_mon != tmF2.tm_mon )
225 return (tmF1.tm_mon < tmF2.tm_mon) ? +1 : -1;
226 else if ( tmF1.tm_mday != tmF2.tm_mday )
227 return (tmF1.tm_mday < tmF2.tm_mday) ? +1 : -1;
228 else if ( tmF1.tm_hour != tmF2.tm_hour )
229 return (tmF1.tm_hour < tmF2.tm_hour) ? +1 : -1;
230 else if ( tmF1.tm_min != tmF2.tm_min )
231 return (tmF1.tm_min < tmF2.tm_min) ? +1 : -1;
232 else if ( tmF1.tm_sec != tmF2.tm_sec )
233 return (tmF1.tm_sec < tmF2.tm_sec) ? +1 : -1;
281 Init(blpic, slpic, buf, viewMode);
294 Init(blpic, slpic, stat, viewMode);
327 snprintf(tmp,
sizeof(tmp),
"%c%c%c%c%c%c%c%c%c%c",
354 fsize = bsize =
fSize;
359 snprintf(tmp,
sizeof(tmp),
"%lld.%lldM", fsize/1024, (fsize%1024)/103);
361 snprintf(tmp,
sizeof(tmp),
"%lld.%lldK", bsize/1024, (bsize%1024)/103);
364 snprintf(tmp,
sizeof(tmp),
"%lld", bsize);
384 newtime = localtime(&loctime);
386 snprintf(tmp,
sizeof(tmp),
"%d-%02d-%02d %02d:%02d", newtime->tm_year + 1900,
387 newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour,
521 Error(
"TGFileContainer",
"required pixmap(s) missing\n");
556 Error(
"TGFileContainer",
"required pixmap(s) missing\n");
648 const char *ext =
name ? strrchr(
name,
'.') : 0;
652 if (
fCachePictures && ext && cached_spic && cached_lpic && (cached_ext == ext)) {
655 if (!is_link)
return;
660 if (is_link && fname.
EndsWith(
".lnk")) {
667 if (!*lpic) *lpic = *pic;
672 if (!is_link)
return;
701 if (img2) img1->
Merge(img2);
702 lnk_name = ((
const TGPicture *)*pic)->GetName();
707 if (img2)
delete img2;
715 if (img2) img1->
Merge(img2);
716 lnk_name = ((
const TGPicture *)*lpic)->GetName();
721 if (img2)
delete img2;
791 if (strcmp(
name,
".") && strcmp(
name,
".."))
815 Info(
"AddFile",
"Broken symlink of %s.",
name);
818 msg.
Form(
"Can't read file attributes of \"%s\": %s.",
840 item =
new TGFileItem(
this, lpic, slpic, spic, pic,
913 out << std::endl <<
" // container frame" << std::endl;
914 out <<
" TGFileContainer *";
925 out <<
");" << std::endl;
933 out <<
" " <<
GetName() <<
"->SetName(\"" <<
GetName() <<
"\");" << std::endl;
935 <<
GetName() <<
");" << std::endl;
936 out <<
" " <<
GetName() <<
"->DisplayDirectory();" << std::endl;
937 out <<
" " <<
GetName() <<
"->AddFile("<< quote <<
".." << quote <<
");" << std::endl;
938 out <<
" " <<
GetName() <<
"->StopRefreshTimer();" << std::endl;
ULong_t Pixel_t
Pixel value.
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
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)
void WriteObject(const TObject *obj, Bool_t cacheReuse=kTRUE) override
Write object to I/O buffer.
Drag and drop data container.
Atom_t fDataType
Data type description.
Int_t fDataLength
Length of data.
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
void Layout() override
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.
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
TList * fList
container of frame elements
static TGLayoutHints * fgDefaultHints
const TGWindow * fMsgWindow
window handling container messages
TGCanvas * GetCanvas() const
Int_t fSelected
number of selected items
void RemoveAll() override
Remove all items from the container.
Int_t Compare(const TObject *obj) const override
Sort frame elements in file selection list view container.
TGFileContainer * fContainer
Bool_t IsSortable() const override
const TGPicture * fSlink_s
big symbolic link icon
void CreateFileList()
This function creates the file list from current dir.
const TGPicture * fFolder_s
big folder icon
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a file container widget as a C++ statement(s) on output stream out.
Bool_t HandleTimer(TTimer *t) override
Refresh container contents.
TList * fCleanups
list of pictures to cleanup
TString fDirectory
current directory
TViewUpdateTimer * fRefresh
refresh timer
void StopRefreshTimer()
stop refresh timer
const TGPicture * fDoc_t
small document icon
const TGPicture * fApp_t
small application icon
const TGPicture * fApp_s
big application icon
void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr) override
Add frame to the composite frame.
virtual void Sort(EFSSortMode sortType)
Sort file system list view container according to sortType.
const TGPicture * fDoc_s
big document icon
~TGFileContainer() override
Delete list view file container.
Bool_t fCachePictures
kTRUE use caching
virtual void ChangeDirectory(const char *path)
Change current directory.
const TGPicture * fSlink_t
small symbolic link icon
virtual void DisplayDirectory()
Display the contents of the current directory in the container.
ULong_t fMtime
directory modification time
virtual TGFileItem * AddFile(const char *name, const TGPicture *pic=nullptr, const TGPicture *lpic=nullptr)
Add file in container.
virtual TGFileItem * AddRemoteFile(TObject *obj, const TGPicture *ipic=nullptr, const TGPicture *ilpic=nullptr)
Add remote file in container.
void StartRefreshTimer(ULong_t msec=1000)
start refreshing
const TGPicture * fFolder_t
small folder icon
TRegexp * fFilter
file filter
friend class TGFSFrameElement
Bool_t fDisplayStat
kFALSE to interrupt display directory contents in case of many files inside
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.
TGFileContainer(const TGWindow *p=nullptr, 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.
EFSSortMode fSortType
sorting mode of contents
Utility class used by the file selection dialog (TGFSDialog).
TGFileIcon(const TGWindow *p, const TGPicture *pic, const TGPicture *lpic, UInt_t options=kChildFrame, Pixel_t back=GetWhitePixel())
void DoRedraw() override
Draw icon.
Int_t fGid
file uid and gid
void DoRedraw() override
Draw list view container item.
const TGPicture * fLcurrent
current icon
void SetViewMode(EListViewMode viewMode) override
Set container item view mode.
TBufferFile * fBuf
buffer used for Drag and Drop
const TGPicture * fBlpic
big icon
Atom_t HandleDNDEnter(Atom_t *) override
Handle drag and drop enter.
void Init(const TGPicture *blpic, const TGPicture *slpic, FileStat_t &stat, EListViewMode viewMode)
Common initializer for file list view item.
~TGFileItem() override
Destructor.
Long_t fModTime
modification time
const TGPicture * fSlpic
small icon
void SetDNDObject(TObject *obj)
Set drag and drop object.
TDNDData fDNDData
Drag and Drop data.
Long_t GetModTime() const
void SetDNDData(TDNDData *data)
Set drag and drop data.
TGFileItem(const TGWindow *p=nullptr, const TGPicture *bpic=nullptr, const TGPicture *blpic=nullptr, const TGPicture *spic=nullptr, const TGPicture *slpic=nullptr, TGString *name=nullptr, 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.
Bool_t fIsLink
true if symbolic link
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
static Pixel_t GetWhitePixel()
Get white pixel value.
UInt_t fHeight
frame height
Bool_t IsDNDTarget() const
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
virtual UInt_t GetOptions() const
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Pixel_t fBackground
frame background color
static const TGGC & GetBckgndGC()
Get background color graphics context.
This class handles GUI icons.
void DoRedraw() override
Redraw picture.
virtual void AddItem(TGLVEntry *item)
EListViewMode fViewMode
list view viewing mode
TGString ** fSubnames
sub names of item (details)
void DoRedraw() override
Redraw list view item.
FontStruct_t fFontStruct
text font
EListViewMode fViewMode
list view viewing mode
GContext_t fNormGC
drawing graphics context
virtual void SetViewMode(EListViewMode viewMode)
Set the view mode for this list item.
TGString * GetItemName() const
Int_t * fCtw
width of sub names
This class describes layout hints used by the layout classes.
const TGPicture * GetIcon(const char *filename, Bool_t small_icon)
Return icon belonging to mime type of filename.
TGClient * fClient
Connection to display server.
Handle_t fId
X11/Win32 Window identifier.
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.
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
void Draw(Option_t *="") override
Default Draw method for all objects.
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
const char * GetString() const
ROOT GUI Window base class.
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
const TGWindow * fParent
Parent window.
virtual void SetWindowName(const char *name=nullptr)
Set window name.
const TGWindow * GetParent() const
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
An abstract interface to image processing library.
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
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 void SetImage(const Double_t *, UInt_t, UInt_t, TImagePalette *=nullptr)
virtual Pixmap_t GetMask()
void Clear(Option_t *option="") override
Remove all objects from the list.
void Add(TObject *obj) override
virtual void Sort(Bool_t order=kSortAscending)
Sort linked list.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
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.
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.
void Reset()
Reset the timer.
TViewUpdateTimer(TGFileContainer *t, Long_t ms)
Bool_t Notify() override
Reset the timer.
TGFileContainer * fContainer