86 TGIcon(p, pic, 0, 0, options, back) {
fLpic = lpic; }
115 type1 =
f1->GetType();
125 if (type1 < type2)
return -1;
126 if (type1 > type2)
return 1;
127 return strcmp(
f1->GetItemName()->GetString(),
139 type1 =
f1->GetType();
149 if (type1 < type2)
return -1;
150 if (type1 > type2)
return 1;
151 return strcmp(
f1->GetItemName()->GetString(),
163 type1 =
f1->GetType();
173 if (type1 < type2)
return -1;
174 if (type1 > type2)
return 1;
175 return strcmp(
f1->GetItemName()->GetString(),
181 type1 =
f1->GetType();
187 else if (
R_ISLNK(type1)) type1 = 2;
188 else if (
R_ISSOCK(type1)) type1 = 3;
189 else if (
R_ISFIFO(type1)) type1 = 4;
194 else if (
R_ISLNK(type2)) type2 = 2;
195 else if (
R_ISSOCK(type2)) type2 = 3;
196 else if (
R_ISFIFO(type2)) type2 = 4;
200 if (type1 < type2)
return -1;
201 if (type1 > type2)
return 1;
202 return strcmp(
f1->GetItemName()->GetString(),
206 if (
f1->GetSize() < f2->
GetSize())
return -1;
207 if (
f1->GetSize() > f2->
GetSize())
return 1;
208 return strcmp(
f1->GetItemName()->GetString(),
212 time_t loctimeF1 = (time_t)
f1->GetModTime();
214 struct tm tmF1 = *localtime(&loctimeF1);
218 struct tm tmF2 = *localtime(&loctimeF2);
220 if ( tmF1.tm_year != tmF2.tm_year )
221 return (tmF1.tm_year < tmF2.tm_year) ? +1 : -1;
222 else if ( tmF1.tm_mon != tmF2.tm_mon )
223 return (tmF1.tm_mon < tmF2.tm_mon) ? +1 : -1;
224 else if ( tmF1.tm_mday != tmF2.tm_mday )
225 return (tmF1.tm_mday < tmF2.tm_mday) ? +1 : -1;
226 else if ( tmF1.tm_hour != tmF2.tm_hour )
227 return (tmF1.tm_hour < tmF2.tm_hour) ? +1 : -1;
228 else if ( tmF1.tm_min != tmF2.tm_min )
229 return (tmF1.tm_min < tmF2.tm_min) ? +1 : -1;
230 else if ( tmF1.tm_sec != tmF2.tm_sec )
231 return (tmF1.tm_sec < tmF2.tm_sec) ? +1 : -1;
279 Init(blpic, slpic, buf, viewMode);
292 Init(blpic, slpic, stat, viewMode);
325 snprintf(tmp,
sizeof(tmp),
"%c%c%c%c%c%c%c%c%c%c",
352 fsize = bsize =
fSize;
357 snprintf(tmp,
sizeof(tmp),
"%lld.%lldM", fsize/1024, (fsize%1024)/103);
359 snprintf(tmp,
sizeof(tmp),
"%lld.%lldK", bsize/1024, (bsize%1024)/103);
362 snprintf(tmp,
sizeof(tmp),
"%lld", bsize);
382 newtime = localtime(&loctime);
384 snprintf(tmp,
sizeof(tmp),
"%d-%02d-%02d %02d:%02d", newtime->tm_year + 1900,
385 newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour,
466 fDNDData.fData =
calloc(data->fDataLength,
sizeof(
unsigned char));
468 memcpy(
fDNDData.fData, data->fData, data->fDataLength);
469 fDNDData.fDataLength = data->fDataLength;
470 fDNDData.fDataType = data->fDataType;
480 fBuf->WriteObject(obj);
519 Error(
"TGFileContainer",
"required pixmap(s) missing\n");
554 Error(
"TGFileContainer",
"required pixmap(s) missing\n");
578 fClient->GetPicturePool()->FreePicture(pic);
650 const char *ext =
name ? strrchr(
name,
'.') : 0;
654 if (
fCachePictures && ext && cached_spic && cached_lpic && (cached_ext == ext)) {
657 if (!is_link)
return;
662 if (is_link && fname.
EndsWith(
".lnk")) {
669 if (!*lpic) *lpic = *pic;
674 if (!is_link)
return;
703 if (img2) img1->
Merge(img2);
704 lnk_name = ((
const TGPicture *)*pic)->GetName();
706 *pic =
fClient->GetPicturePool()->GetPicture(lnk_name.
Data(),
709 if (img2)
delete img2;
717 if (img2) img1->
Merge(img2);
718 lnk_name = ((
const TGPicture *)*lpic)->GetName();
720 *lpic =
fClient->GetPicturePool()->GetPicture(lnk_name.
Data(),
723 if (img2)
delete img2;
745 char *exppath =
gSystem->ExpandPathName(path);
746 if (
gSystem->ChangeDirectory(exppath)) {
782 if (
gSystem->GetPathInfo(
".", sbuf) == 0)
786 if ((dirp =
gSystem->OpenDirectory(
".")) == 0) {
793 if (strcmp(
name,
".") && strcmp(
name,
".."))
817 Info(
"AddFile",
"Broken symlink of %s.",
name);
818 }
else if (errno != ENOENT) {
820 msg.
Form(
"Can't read file attributes of \"%s\": %s.",
842 item =
new TGFileItem(
this, lpic, slpic, spic, pic,
915 out <<
"\n // container frame\n";
916 out <<
" TGFileContainer *" <<
GetName() <<
" = new TGFileContainer(";
923 out << extra_args <<
");\n";
925 if (option && strstr(option,
"keep_names"))
926 out <<
" " <<
GetName() <<
"->SetName(\"" <<
GetName() <<
"\");\n";
928 out <<
" " <<
GetName() <<
"->DisplayDirectory();\n";
929 out <<
" " <<
GetName() <<
"->AddFile(\"..\");\n";
930 out <<
" " <<
GetName() <<
"->StopRefreshTimer();\n";
ULong_t Pixel_t
Pixel value.
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
long long Long64_t
Portable signed long integer 8 bytes.
const char Option_t
Option string (const char).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
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)
Bool_t R_ISCHR(Int_t mode)
Drag and drop data container.
void Layout() override
Create layout for canvas.
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
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
TGFrameElement(const TGFrameElement &)
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
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
TString SaveCtorArgs(std::ostream &out, UInt_t dflt_options=kChildFrame, Bool_t check_white_pixel=kFALSE)
Return options and custom color as constructor args Used in the SavePrimitive methods,...
static const TGGC & GetBckgndGC()
Get background color graphics context.
void DoRedraw() override
Redraw picture.
TGIcon(const TGIcon &)=delete
virtual void AddItem(TGLVEntry *item)
TGLVContainer(const TGLVContainer &)=delete
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
TGLVEntry(const TGLVEntry &)=delete
Int_t * fCtw
width of sub names
This class describes layout hints used by the layout classes.
TGClient * fClient
Connection to display server.
Handle_t fId
X11/Win32 Window identifier.
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
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()
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
TObject()
TObject constructor.
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
Handles synchronous and a-synchronous timer events.
void Reset()
Reset the timer.
TTimer(const TTimer &)=delete
TViewUpdateTimer(TGFileContainer *t, Long_t ms)
Bool_t Notify() override
Reset the timer.
TGFileContainer * fContainer