Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
IPNL_GAMMA
gammaware
Commits
947fd3eb
Commit
947fd3eb
authored
Oct 13, 2021
by
Stezowski Olivier
Browse files
Merge branch 'preprod' into 'master'
Merge preprod to master See merge request
!66
parents
90763052
c4087ae0
Pipeline
#140328
passed with stage
in 9 minutes and 58 seconds
Changes
104
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1881 additions
and
659 deletions
+1881
-659
src/root/gui/cubix/src/CXFit.h
src/root/gui/cubix/src/CXFit.h
+4
-4
src/root/gui/cubix/src/CXGFileBrowser.cpp
src/root/gui/cubix/src/CXGFileBrowser.cpp
+119
-121
src/root/gui/cubix/src/CXGFileBrowser.h
src/root/gui/cubix/src/CXGFileBrowser.h
+1
-1
src/root/gui/cubix/src/CXGammaSearch.cpp
src/root/gui/cubix/src/CXGammaSearch.cpp
+12
-3
src/root/gui/cubix/src/CXGateBox.cpp
src/root/gui/cubix/src/CXGateBox.cpp
+1
-0
src/root/gui/cubix/src/CXGuiLSPlayer.cpp
src/root/gui/cubix/src/CXGuiLSPlayer.cpp
+95
-51
src/root/gui/cubix/src/CXGuiLSPlayer.h
src/root/gui/cubix/src/CXGuiLSPlayer.h
+22
-1
src/root/gui/cubix/src/CXHist1DCalib.cpp
src/root/gui/cubix/src/CXHist1DCalib.cpp
+422
-0
src/root/gui/cubix/src/CXHist1DCalib.h
src/root/gui/cubix/src/CXHist1DCalib.h
+80
-0
src/root/gui/cubix/src/CXHist1DPlayer.cpp
src/root/gui/cubix/src/CXHist1DPlayer.cpp
+236
-13
src/root/gui/cubix/src/CXHist1DPlayer.h
src/root/gui/cubix/src/CXHist1DPlayer.h
+28
-2
src/root/gui/cubix/src/CXHist2DPlayer.cpp
src/root/gui/cubix/src/CXHist2DPlayer.cpp
+38
-5
src/root/gui/cubix/src/CXHist2DPlayer.h
src/root/gui/cubix/src/CXHist2DPlayer.h
+6
-1
src/root/gui/cubix/src/CXHistoManipulator.cpp
src/root/gui/cubix/src/CXHistoManipulator.cpp
+1
-0
src/root/gui/cubix/src/CXLevelSchemePlayer.cpp
src/root/gui/cubix/src/CXLevelSchemePlayer.cpp
+277
-147
src/root/gui/cubix/src/CXLevelSchemePlayer.h
src/root/gui/cubix/src/CXLevelSchemePlayer.h
+15
-5
src/root/gui/cubix/src/CXMainWindow.cpp
src/root/gui/cubix/src/CXMainWindow.cpp
+279
-266
src/root/gui/cubix/src/CXMainWindow.h
src/root/gui/cubix/src/CXMainWindow.h
+32
-17
src/root/gui/cubix/src/CXNDManager.cpp
src/root/gui/cubix/src/CXNDManager.cpp
+145
-12
src/root/gui/cubix/src/CXNDManager.h
src/root/gui/cubix/src/CXNDManager.h
+68
-10
No files found.
src/root/gui/cubix/src/CXFit.h
View file @
947fd3eb
...
...
@@ -37,10 +37,10 @@ public:
void
Update
();
void
Fit
();
d
ouble
DoubleTailedStepedGaussian
(
d
ouble
*
xx
,
d
ouble
*
pp
);
d
ouble
StepedBackground
(
d
ouble
*
xx
,
d
ouble
*
pp
);
d
ouble
PeakFunction
(
d
ouble
*
xx
,
d
ouble
*
pp
);
d
ouble
Residue
(
d
ouble
*
xx
,
d
ouble
*
pp
);
D
ouble
_t
DoubleTailedStepedGaussian
(
D
ouble
_t
*
xx
,
D
ouble
_t
*
pp
);
D
ouble
_t
StepedBackground
(
D
ouble
_t
*
xx
,
D
ouble
_t
*
pp
);
D
ouble
_t
PeakFunction
(
D
ouble
_t
*
xx
,
D
ouble
_t
*
pp
);
D
ouble
_t
Residue
(
D
ouble
_t
*
xx
,
D
ouble
_t
*
pp
);
void
Clear
(
TVirtualPad
*
pad
=
nullptr
);
...
...
src/root/gui/cubix/src/CXGFileBrowser.cpp
View file @
947fd3eb
...
...
@@ -38,9 +38,9 @@
#include "TKeyMapFile.h"
#include "TVirtualPad.h"
#include "Getline.h"
#include <time
.h
>
#include <string
.h
>
#include <stdlib
.h
>
#include <
c
time>
#include <
c
string>
#include <
c
stdlib>
#include "CXGFileBrowser.h"
#include "TRootBrowser.h"
...
...
@@ -51,6 +51,8 @@
#include "TBaseClass.h"
#include "RConfigure.h"
#include "TVirtualX.h"
#include "TObjString.h"
#ifdef WIN32
const
char
rootdir
[]
=
"
\\
"
;
...
...
@@ -104,10 +106,10 @@ ClassImp(CXGFileBrowser)
/// CXGFileBrowser constructor.
CXGFileBrowser
::
CXGFileBrowser
(
const
TGWindow
*
p
,
TBrowser
*
b
,
UInt_t
w
,
UInt_t
h
)
:
TGMainFrame
(
p
,
w
,
h
),
TBrowserImp
(
b
),
fNewBrowser
(
0
)
:
TGMainFrame
(
p
,
w
,
h
),
TBrowserImp
(
b
),
fNewBrowser
(
nullptr
)
{
if
(
p
&&
p
!=
gClient
->
GetDefaultRoot
())
fNewBrowser
=
(
TRootBrowser
*
)
p
->
GetMainFrame
();
fNewBrowser
=
dynamic_cast
<
TRootBrowser
*>
(
const_cast
<
TGWindow
*>
(
p
->
GetMainFrame
()
))
;
// if (fNewBrowser)
// fNewBrowser->SetActBrowser(this);
CreateBrowser
();
...
...
@@ -120,7 +122,7 @@ CXGFileBrowser::CXGFileBrowser(const TGWindow *p, TBrowser* b, UInt_t w, UInt_t
void
CXGFileBrowser
::
CreateBrowser
()
{
fCachedPic
=
0
;
fCachedPic
=
nullptr
;
SetCleanup
(
kDeepCleanup
);
fTopFrame
=
new
TGHorizontalFrame
(
this
,
100
,
30
);
...
...
@@ -214,13 +216,13 @@ void CXGFileBrowser::CreateBrowser()
kLHintsExpandX
,
2
,
2
,
2
,
2
));
fContextMenu
=
new
TContextMenu
(
"FileBrowserContextMenu"
);
fFilter
=
0
;
fFilter
=
nullptr
;
fGroupSize
=
1000
;
fListLevel
=
0
;
fCurrentDir
=
0
;
fRootDir
=
0
;
fDir
=
0
;
fFile
=
0
;
fListLevel
=
nullptr
;
fCurrentDir
=
nullptr
;
fRootDir
=
nullptr
;
fDir
=
nullptr
;
fFile
=
nullptr
;
fNKeys
=
0
;
fCnt
=
0
;
fFilterStr
=
"*"
;
...
...
@@ -243,7 +245,7 @@ void CXGFileBrowser::CreateBrowser()
TQObject
::
Connect
(
"TPad"
,
"Modified()"
,
"CXGFileBrowser"
,
this
,
"PadModified()"
);
fListLevel
=
0
;
fListLevel
=
nullptr
;
MapSubwindows
();
Resize
(
GetDefaultSize
());
MapWindow
();
...
...
@@ -292,7 +294,7 @@ static const char *FormatToolTip(TObject *obj, Int_t maxlen=0)
static
TString
infos
;
if
(
!
obj
)
{
infos
.
Clear
();
return
0
;
return
nullptr
;
}
infos
=
obj
->
GetName
();
if
(
obj
->
GetTitle
())
{
...
...
@@ -347,7 +349,7 @@ void CXGFileBrowser::Add(TObject *obj, const char *name, Int_t check)
}
else
{
if
(
obj
&&
obj
->
InheritsFrom
(
"TApplication"
))
fListLevel
=
0
;
fListLevel
=
nullptr
;
if
(
obj
&&
obj
->
InheritsFrom
(
"TSystemDirectory"
))
return
;
}
...
...
@@ -356,7 +358,7 @@ void CXGFileBrowser::Add(TObject *obj, const char *name, Int_t check)
if
(
name
)
oname
=
name
;
else
if
(
obj
)
oname
=
obj
->
GetName
();
// check if the current item is filtered
mFiltered_i
it
=
fFilteredItems
.
find
(
fListLevel
);
auto
it
=
fFilteredItems
.
find
(
fListLevel
);
if
(
it
!=
fFilteredItems
.
end
())
{
// check if the item (object) name match the filter
const
char
*
filter
=
(
const
char
*
)(
*
it
).
second
;
...
...
@@ -365,7 +367,7 @@ void CXGFileBrowser::Add(TObject *obj, const char *name, Int_t check)
if
(
oname
.
Index
(
re
)
==
kNPOS
)
return
;
}
}
const
TGPicture
*
pic
=
0
;
const
TGPicture
*
pic
=
nullptr
;
if
(
obj
&&
obj
->
InheritsFrom
(
"TKey"
)
&&
(
obj
->
IsA
()
!=
TClass
::
Class
()))
AddKey
(
fListLevel
,
obj
,
name
);
else
if
(
obj
)
{
...
...
@@ -390,7 +392,7 @@ void CXGFileBrowser::Add(TObject *obj, const char *name, Int_t check)
// check also if one of its parents is a remote object
TGListTreeItem
*
top
=
fListLevel
;
while
(
top
->
GetParent
())
{
TObject
*
tobj
=
(
TObject
*
)
top
->
GetUserData
();
auto
*
tobj
=
static_cast
<
TObject
*>
(
top
->
GetUserData
()
)
;
if
(
tobj
&&
(
tobj
->
InheritsFrom
(
"TRemoteObject"
)
||
tobj
->
InheritsFrom
(
"TApplicationRemote"
)))
{
isRemote
=
kTRUE
;
...
...
@@ -400,7 +402,7 @@ void CXGFileBrowser::Add(TObject *obj, const char *name, Int_t check)
}
}
if
(
isRemote
)
{
TRemoteObject
*
robj
=
(
TRemoteObject
*
)
obj
;
auto
*
robj
=
dynamic_cast
<
TRemoteObject
*
>
(
obj
)
;
if
(
!
strcmp
(
robj
->
GetClassName
(),
"TKey"
))
{
AddKey
(
fListLevel
,
obj
,
name
);
}
...
...
@@ -441,18 +443,18 @@ void CXGFileBrowser::AddRemoteFile(TObject *obj)
type
=
0
;
is_link
=
kFALSE
;
TRemoteObject
*
robj
=
(
TRemoteObject
*
)
obj
;
auto
*
robj
=
dynamic_cast
<
TRemoteObject
*>
(
obj
)
;
robj
->
GetFileStat
(
&
sbuf
);
is_link
=
sbuf
.
fIsLink
;
type
=
sbuf
.
fMode
;
filename
=
robj
->
GetName
();
if
(
R_ISDIR
(
type
)
||
fFilter
==
0
||
if
(
R_ISDIR
(
type
)
||
fFilter
==
nullptr
||
(
fFilter
&&
filename
.
Index
(
*
fFilter
)
!=
kNPOS
))
{
GetFilePictures
(
&
spic
,
type
,
is_link
,
filename
);
TGPicture
*
pic
=
(
TGPicture
*
)
spic
;
pic
->
AddReference
();
auto
*
pic
=
const_cast
<
TGPicture
*
>
(
spic
)
;
pic
->
AddReference
();
if
((
!
fListTree
->
FindChildByName
(
fListLevel
,
filename
))
&&
(
!
fListTree
->
FindChildByData
(
fListLevel
,
obj
)))
...
...
@@ -471,7 +473,7 @@ void CXGFileBrowser::BrowseObj(TObject *obj)
fNewBrowser
->
SetActBrowser
(
this
);
if
(
obj
!=
gROOT
)
{
if
(
!
fListTree
->
FindItemByObj
(
fListTree
->
GetFirstItem
(),
obj
))
{
fListLevel
=
0
;
fListLevel
=
nullptr
;
Add
(
obj
);
fListLevel
=
fListTree
->
FindItemByObj
(
fListTree
->
GetFirstItem
(),
obj
);
fListTree
->
HighlightItem
(
fListLevel
);
...
...
@@ -487,7 +489,7 @@ void CXGFileBrowser::BrowseObj(TObject *obj)
TList
*
curvol
=
gSystem
->
GetVolumes
(
"cur"
);
if
(
volumes
&&
curvol
)
{
const
char
*
curdrive
;
TNamed
*
named
=
(
TNamed
*
)
curvol
->
At
(
0
);
auto
*
named
=
(
TNamed
*
)
curvol
->
At
(
0
);
if
(
named
)
curdrive
=
named
->
GetName
();
else
...
...
@@ -507,7 +509,7 @@ void CXGFileBrowser::BrowseObj(TObject *obj)
}
GotoDir
(
gSystem
->
WorkingDirectory
());
if
(
gROOT
->
GetListOfFiles
()
&&
!
gROOT
->
GetListOfFiles
()
->
IsEmpty
())
Selected
(
0
);
Selected
(
nullptr
);
}
}
...
...
@@ -535,10 +537,10 @@ void CXGFileBrowser::GetFilePictures(const TGPicture **pic, Int_t file_type,
Bool_t
is_link
,
const
char
*
name
)
{
static
TString
cached_ext
;
static
const
TGPicture
*
cached_spic
=
0
;
const
char
*
ext
=
name
?
strrchr
(
name
,
'.'
)
:
0
;
static
const
TGPicture
*
cached_spic
=
nullptr
;
const
char
*
ext
=
name
?
strrchr
(
name
,
'.'
)
:
nullptr
;
TString
sname
=
name
?
name
:
" "
;
*
pic
=
0
;
*
pic
=
nullptr
;
if
(
ext
&&
cached_spic
&&
(
cached_ext
==
ext
))
{
*
pic
=
cached_spic
;
...
...
@@ -556,10 +558,10 @@ void CXGFileBrowser::GetFilePictures(const TGPicture **pic, Int_t file_type,
}
}
}
else
{
*
pic
=
0
;
*
pic
=
nullptr
;
}
if
(
*
pic
==
0
)
{
if
(
*
pic
==
nullptr
)
{
*
pic
=
gClient
->
GetPicture
(
"doc_t.xpm"
);
if
(
R_ISREG
(
file_type
)
&&
(
file_type
)
&
kS_IXUSR
)
{
...
...
@@ -577,7 +579,7 @@ void CXGFileBrowser::GetFilePictures(const TGPicture **pic, Int_t file_type,
*
pic
=
gClient
->
GetPicture
(
"slink_t.xpm"
);
}
cached_spic
=
0
;
cached_spic
=
nullptr
;
cached_ext
=
""
;
}
...
...
@@ -586,9 +588,9 @@ void CXGFileBrowser::GetFilePictures(const TGPicture **pic, Int_t file_type,
void
CXGFileBrowser
::
RecursiveRemove
(
TObject
*
obj
)
{
TGListTreeItem
*
itm
=
0
,
*
item
=
0
;
TGListTreeItem
*
itm
=
nullptr
,
*
item
=
nullptr
;
if
(
obj
->
InheritsFrom
(
"TFile"
))
{
itm
=
fListTree
->
FindChildByData
(
0
,
gROOT
->
GetListOfFiles
());
itm
=
fListTree
->
FindChildByData
(
nullptr
,
gROOT
->
GetListOfFiles
());
if
(
itm
)
item
=
fListTree
->
FindChildByData
(
itm
,
obj
);
if
(
item
)
{
...
...
@@ -598,12 +600,12 @@ void CXGFileBrowser::RecursiveRemove(TObject *obj)
fFilteredItems
.
erase
(
item
);
fListTree
->
DeleteItem
(
item
);
}
itm
=
fRootDir
?
fRootDir
->
GetFirstChild
()
:
0
;
itm
=
fRootDir
?
fRootDir
->
GetFirstChild
()
:
nullptr
;
while
(
itm
)
{
item
=
fListTree
->
FindItemByObj
(
itm
,
obj
);
if
(
item
)
{
fListTree
->
DeleteChildren
(
item
);
item
->
SetUserData
(
0
);
item
->
SetUserData
(
nullptr
);
}
itm
=
itm
->
GetNextSibling
();
}
...
...
@@ -633,7 +635,7 @@ void CXGFileBrowser::Refresh(Bool_t /*force*/)
if
(
prev
!=
curr
)
{
// refresh gROOT
TGListTreeItem
*
sav
=
fListLevel
;
fListLevel
=
0
;
fListLevel
=
nullptr
;
BrowseObj
(
gROOT
);
fListLevel
=
sav
;
prev
=
curr
;
...
...
@@ -654,15 +656,15 @@ void CXGFileBrowser::Update()
//fListTree->DeleteChildren(item);
TGListTreeItem
*
curr
=
fListTree
->
GetSelected
();
// GetCurrent() ??
if
(
curr
)
{
TObject
*
obj
=
(
TObject
*
)
curr
->
GetUserData
();
auto
*
obj
=
static_cast
<
TObject
*>
(
curr
->
GetUserData
()
)
;
if
(
obj
&&
!
obj
->
TestBit
(
kNotDeleted
))
{
// if the item to be deleted has a filter,
// delete its entry in the map
if
(
CheckFiltered
(
curr
))
fFilteredItems
.
erase
(
curr
);
fListTree
->
DeleteItem
(
curr
);
curr
=
0
;
obj
=
0
;
curr
=
nullptr
;
obj
=
nullptr
;
}
else
if
(
obj
&&
obj
->
TestBit
(
kNotDeleted
)
&&
obj
->
InheritsFrom
(
"TObjString"
)
&&
curr
->
GetParent
())
{
...
...
@@ -679,8 +681,8 @@ void CXGFileBrowser::Update()
if
(
CheckFiltered
(
curr
))
fFilteredItems
.
erase
(
curr
);
fListTree
->
DeleteItem
(
curr
);
curr
=
0
;
obj
=
0
;
curr
=
nullptr
;
obj
=
nullptr
;
}
}
}
...
...
@@ -693,7 +695,7 @@ void CXGFileBrowser::Update()
TString
savdir
=
gSystem
->
WorkingDirectory
();
if
(
isdir
)
{
TGListTreeItem
*
del
=
0
,
*
itm
=
item
->
GetFirstChild
();
TGListTreeItem
*
del
=
nullptr
,
*
itm
=
item
->
GetFirstChild
();
while
(
itm
)
{
fListTree
->
GetPathnameFromItem
(
itm
,
path
);
if
(
strlen
(
path
)
>
1
)
{
...
...
@@ -709,7 +711,7 @@ void CXGFileBrowser::Update()
}
}
if
(
del
)
del
=
0
;
del
=
nullptr
;
else
itm
=
itm
->
GetNextSibling
();
}
...
...
@@ -731,36 +733,36 @@ void CXGFileBrowser::Update()
void
CXGFileBrowser
::
AddFSDirectory
(
const
char
*
entry
,
const
char
*
path
,
Option_t
*
opt
)
{
TGListTreeItem
*
item
=
0
;
if
((
opt
==
0
)
||
(
!
opt
[
0
]))
{
if
(
fRootDir
==
0
&&
!
fListTree
->
FindChildByName
(
0
,
rootdir
))
item
=
fRootDir
=
fListTree
->
AddItem
(
0
,
rootdir
);
TGListTreeItem
*
item
=
nullptr
;
if
((
opt
==
nullptr
)
||
(
!
opt
[
0
]))
{
if
(
fRootDir
==
nullptr
&&
!
fListTree
->
FindChildByName
(
nullptr
,
rootdir
))
item
=
fRootDir
=
fListTree
->
AddItem
(
nullptr
,
rootdir
);
return
;
}
if
(
strstr
(
opt
,
"SetRootDir"
))
{
if
(
!
fListTree
->
FindChildByName
(
0
,
entry
))
item
=
fRootDir
=
fListTree
->
AddItem
(
0
,
entry
);
if
(
!
fListTree
->
FindChildByName
(
nullptr
,
entry
))
item
=
fRootDir
=
fListTree
->
AddItem
(
nullptr
,
entry
);
}
else
if
(
strstr
(
opt
,
"Add"
))
{
// MT: i give up! wanted to place entries for selected
// directories like home, pwd, alice-macros.
// TGListTreeItem *lti = fListTree->AddItem(0, entry);
//
if
(
!
fListTree
->
FindChildByName
(
0
,
entry
))
item
=
fListTree
->
AddItem
(
0
,
entry
);
if
(
!
fListTree
->
FindChildByName
(
nullptr
,
entry
))
item
=
fListTree
->
AddItem
(
nullptr
,
entry
);
}
if
(
item
&&
path
)
{
TString
infos
=
path
;
item
->
SetTipText
(
path
);
TGPicture
*
pic
=
0
;
TGPicture
*
pic
=
nullptr
;
if
(
infos
.
Contains
(
"Removable"
))
pic
=
(
TGPicture
*
)
gClient
->
GetPicture
(
"fdisk_t.xpm"
);
pic
=
const_cast
<
TGPicture
*
>
(
gClient
->
GetPicture
(
"fdisk_t.xpm"
)
)
;
else
if
(
infos
.
Contains
(
"Local"
))
pic
=
(
TGPicture
*
)
gClient
->
GetPicture
(
"hdisk_t.xpm"
);
pic
=
const_cast
<
TGPicture
*
>
(
gClient
->
GetPicture
(
"hdisk_t.xpm"
)
)
;
else
if
(
infos
.
Contains
(
"CD"
))
pic
=
(
TGPicture
*
)
gClient
->
GetPicture
(
"cdrom_t.xpm"
);
pic
=
const_cast
<
TGPicture
*
>
(
gClient
->
GetPicture
(
"cdrom_t.xpm"
)
)
;
else
if
(
infos
.
Contains
(
"Network"
))
pic
=
(
TGPicture
*
)
gClient
->
GetPicture
(
"netdisk_t.xpm"
);
pic
=
const_cast
<
TGPicture
*
>
(
gClient
->
GetPicture
(
"netdisk_t.xpm"
)
)
;
if
(
pic
)
item
->
SetPictures
(
pic
,
pic
);
}
...
...
@@ -777,7 +779,7 @@ void CXGFileBrowser::AddKey(TGListTreeItem *itm, TObject *obj, const char *name)
static
TGListTreeItem
*
item
=
itm
;
const
TGPicture
*
pic
;
if
(
itm
==
0
)
return
;
if
(
itm
==
nullptr
)
return
;
if
((
fCnt
==
0
)
||
(
olditem
!=
itm
))
{
olditem
=
item
=
itm
;
...
...
@@ -822,12 +824,12 @@ void CXGFileBrowser::ApplyFilter(Int_t id)
// Long64_t size;
// Long_t fid, flags, modtime;
if
(
fFilter
)
delete
fFilter
;
fFilter
=
0
;
delete
fFilter
;
fFilter
=
nullptr
;
if
((
id
>
1
)
&&
(
id
<
5
))
fFilter
=
new
TRegexp
(
filters
[
id
],
kTRUE
);
else
if
((
id
<
0
)
||
(
id
>
4
))
{
TGTextLBEntry
*
lbe
=
(
TGTextLBEntry
*
)
fFileType
->
GetSelectedEntry
();
auto
*
lbe
=
dynamic_cast
<
TGTextLBEntry
*>
(
fFileType
->
GetSelectedEntry
()
)
;
if
(
lbe
)
{
const
char
*
text
=
lbe
->
GetTitle
();
fFilter
=
new
TRegexp
(
text
,
kTRUE
);
...
...
@@ -851,7 +853,7 @@ void CXGFileBrowser::Chdir(TGListTreeItem *item)
if
(
item
)
{
TGListTreeItem
*
i
=
item
;
while
(
i
)
{
TObject
*
obj
=
(
TObject
*
)
i
->
GetUserData
();
auto
*
obj
=
static_cast
<
TObject
*
>
(
i
->
GetUserData
()
)
;
if
((
obj
)
&&
obj
->
InheritsFrom
(
"TDirectory"
))
{
((
TDirectory
*
)
obj
)
->
cd
();
break
;
...
...
@@ -867,7 +869,7 @@ void CXGFileBrowser::Chdir(TGListTreeItem *item)
void
CXGFileBrowser
::
CheckRemote
(
TGListTreeItem
*
item
)
{
if
(
!
item
)
return
;
TObject
*
obj
=
(
TObject
*
)
item
->
GetUserData
();
auto
*
obj
=
static_cast
<
TObject
*>
(
item
->
GetUserData
()
)
;
if
(
obj
)
{
if
(
obj
->
InheritsFrom
(
"TApplicationRemote"
))
{
if
(
!
gApplication
->
GetAppRemote
())
{
...
...
@@ -879,7 +881,7 @@ void CXGFileBrowser::CheckRemote(TGListTreeItem *item)
}
}
if
(
item
->
GetParent
()
&&
item
->
GetParent
()
->
GetUserData
()
&&
((
TObject
*
)
item
->
GetParent
()
->
GetUserData
())
->
InheritsFrom
(
"TApplicationRemote"
))
{
static_cast
<
TObject
*>
(
item
->
GetParent
()
->
GetUserData
())
->
InheritsFrom
(
"TApplicationRemote"
))
{
// switch to remote session
if
(
!
gApplication
->
GetAppRemote
())
{
gROOT
->
ProcessLine
(
TString
::
Format
(
".R %s"
,
item
->
GetParent
()
->
GetText
()));
...
...
@@ -901,7 +903,7 @@ void CXGFileBrowser::CheckRemote(TGListTreeItem *item)
while
(
top
->
GetParent
())
{
top
=
top
->
GetParent
();
}
TObject
*
topobj
=
(
TObject
*
)
top
->
GetUserData
();
auto
*
topobj
=
static_cast
<
TObject
*>
(
top
->
GetUserData
()
)
;
if
(
topobj
&&
topobj
->
InheritsFrom
(
"TApplicationRemote"
))
{
// it belongs to a remote session
if
(
!
gApplication
->
GetAppRemote
())
{
...
...
@@ -939,7 +941,7 @@ Bool_t CXGFileBrowser::CheckFiltered(TGListTreeItem *item, Bool_t but)
// if there is no filter (the map is empty) then just return
if
(
fFilteredItems
.
empty
())
return
kFALSE
;
mFiltered_i
it
=
fFilteredItems
.
find
(
item
);
auto
it
=
fFilteredItems
.
find
(
item
);
if
(
it
!=
fFilteredItems
.
end
())
{
// if the item is in the map, take the filter regexp string
filter
=
(
const
char
*
)(
*
it
).
second
;
...
...
@@ -968,7 +970,7 @@ Bool_t CXGFileBrowser::CheckFiltered(TGListTreeItem *item, Bool_t but)
/// Check if the list tree item children are alphabetically sorted.
/// If the but argument is true, the "sort" button state is set accordingly.
Bool_t
CXGFileBrowser
::
CheckSorted
(
TGListTreeItem
*
item
,
Bool_t
but
)
Bool_t
CXGFileBrowser
::
CheckSorted
(
TGListTreeItem
*
item
,
Bool_t
/*
but
*/
)
{
Bool_t
found
=
kFALSE
;
TGListTreeItem
*
itm
;
...
...
@@ -976,8 +978,8 @@ Bool_t CXGFileBrowser::CheckSorted(TGListTreeItem *item, Bool_t but)
itm
=
item
;
else
itm
=
item
->
GetParent
();
for
(
sLTI_i
p
=
fSortedItem
s
.
begin
();
p
!=
fSortedItems
.
end
();
++
p
)
{
if
(
itm
==
(
TGListTreeItem
*
)(
*
p
)
)
{
for
(
auto
&
fSortedItem
:
fSortedItems
)
{
if
(
itm
==
fSortedItem
)
{
found
=
kTRUE
;
break
;
}
...
...
@@ -998,9 +1000,9 @@ void CXGFileBrowser::Clicked(TGListTreeItem *item, Int_t btn, Int_t x, Int_t y)
CheckSorted
(
item
,
kTRUE
);
CheckFiltered
(
item
,
kTRUE
);
CheckRemote
(
item
);
TObject
*
selected
=
0
;
TObject
*
selected
=
nullptr
;
TString
fullpath
=
FullPathName
(
item
);
TObject
*
obj
=
(
TObject
*
)
item
->
GetUserData
();
auto
*
obj
=
static_cast
<
TObject
*>
(
item
->
GetUserData
()
)
;
if
(
obj
&&
(
!
obj
->
InheritsFrom
(
"TObjString"
)
||
gSystem
->
AccessPathName
(
fullpath
.
Data
())))
{
if
(
obj
->
InheritsFrom
(
"TKey"
)
&&
(
obj
->
IsA
()
!=
TClass
::
Class
()))
{
...
...
@@ -1011,9 +1013,9 @@ void CXGFileBrowser::Clicked(TGListTreeItem *item, Int_t btn, Int_t x, Int_t y)
TString
name
=
((
TKey
*
)
obj
)
->
GetName
();
name
+=
";"
;
name
+=
((
TKey
*
)
obj
)
->
GetCycle
();
void
*
add
=
gDirectory
->
FindObjectAny
(
(
char
*
)
name
.
Data
());
void
*
add
=
gDirectory
->
FindObjectAny
(
name
.
Data
());
if
(
add
&&
cl
->
IsTObject
())
{
obj
=
(
TObject
*
)
add
;
obj
=
static_cast
<
TObject
*
>
(
add
)
;
// don't change the user data, to avoid deletion of the
// list tree item by RecursiveRemove()
// it is better to read the object each time anyway,
...
...
@@ -1039,7 +1041,7 @@ void CXGFileBrowser::Clicked(TGListTreeItem *item, Int_t btn, Int_t x, Int_t y)
if
(
flags
&
2
)
{
fCurrentDir
=
item
;
if
(
btn
==
kButton3
)
{
if
(
fDir
)
delete
fDir
;
delete
fDir
;
fDir
=
new
TSystemDirectory
(
item
->
GetText
(),
fullpath
.
Data
());
fContextMenu
->
Popup
(
x
,
y
,
fDir
,
fBrowser
);
}
...
...
@@ -1047,7 +1049,7 @@ void CXGFileBrowser::Clicked(TGListTreeItem *item, Int_t btn, Int_t x, Int_t y)
else
{
fCurrentDir
=
item
->
GetParent
();
if
(
btn
==
kButton3
)
{
if
(
fFile
)
delete
fFile
;
delete
fFile
;
fFile
=
new
TSystemFile
(
item
->
GetText
(),
fullpath
.
Data
());
fContextMenu
->
Popup
(
x
,
y
,
fFile
,
fBrowser
);
}
...
...
@@ -1073,7 +1075,7 @@ void CXGFileBrowser::Clicked(TGListTreeItem *item, Int_t btn, Int_t x, Int_t y)
if
(
selected
&&
gPad
&&
IsObjectEditable
(
selected
->
IsA
()))
{
TVirtualPadEditor
*
ved
=
TVirtualPadEditor
::
GetPadEditor
(
kFALSE
);
if
(
ved
)
{
TGedEdi
to
r
*
ged
=
(
TGedEditor
*
)
ved
;
au
to
*
ged
=
dynamic_cast
<
TGedEditor
*>
(
ved
)
;
ged
->
SetModel
(
gPad
,
selected
,
kButton1Down
);
}
}
...
...
@@ -1176,7 +1178,7 @@ static const TGPicture *MakeLinkPic(const TGPicture *pic)
{
if
(
pic
)
{
TImage
*
img1
=
TImage
::
Create
();
if
(
img1
==
0
)
return
pic
;
if
(
img1
==
nullptr
)
return
pic
;
img1
->
SetImage
(((
const
TGPicture
*
)
pic
)
->
GetPicture
(),
((
const
TGPicture
*
)
pic
)
->
GetMask
());
TImage
*
img2
=
TImage
::
Open
(
"slink_t.xpm"
);
...
...
@@ -1185,7 +1187,7 @@ static const TGPicture *MakeLinkPic(const TGPicture *pic)
lnk_name
.
Prepend
(
"lnk_"
);
const
TGPicture
*
merged
=
gClient
->
GetPicturePool
()
->
GetPicture
(
lnk_name
.
Data
(),
img1
->
GetPixmap
(),
img1
->
GetMask
());
if
(
img2
)
delete
img2
;
delete
img2
;
delete
img1
;
return
merged
;
}
...
...
@@ -1218,7 +1220,7 @@ void CXGFileBrowser::DoubleClicked(TGListTreeItem *item, Int_t /*btn*/)
CheckFiltered
(
item
,
kTRUE
);
CheckRemote
(
item
);
TGListTreeItem
*
pitem
=
item
->
GetParent
();
TObject
*
obj
=
(
TObject
*
)
item
->
GetUserData
();
auto
*
obj
=
static_cast
<
TObject
*
>
(
item
->
GetUserData
()
)
;
if
(
obj
&&
!
obj
->
InheritsFrom
(
"TSystemFile"
))
{
TString
ext
=
obj
->
GetName
();
if
(
obj
->
InheritsFrom
(
"TDirectory"
)
&&
(
obj
->
IsA
()
!=
TClass
::
Class
()))
{
...
...
@@ -1235,7 +1237,7 @@ void CXGFileBrowser::DoubleClicked(TGListTreeItem *item, Int_t /*btn*/)
TString
name
=
((
TKey
*
)
obj
)
->
GetName
();
name
+=
";"
;
name
+=
((
TKey
*
)
obj
)
->
GetCycle
();
void
*
add
=
gDirectory
->
FindObjectAny
(
(
char
*
)
name
.
Data
());
void
*
add
=
gDirectory
->
FindObjectAny
(
name
.
Data
());
if
(
add
&&
cl
->
IsTObject
())
{
obj
=
(
TObject
*
)
add
;
// don't change the user data, to avoid deletion of the
...
...
@@ -1252,10 +1254,10 @@ void CXGFileBrowser::DoubleClicked(TGListTreeItem *item, Int_t /*btn*/)
}
else
if
(
obj
->
InheritsFrom
(
"TRemoteObject"
))
{
// the real object is a TKey
TRemoteObject
*
robj
=
(
TRemoteObject
*
)
obj
;
auto
*
robj
=
dynamic_cast
<
TRemoteObject
*>
(
obj
)
;
if
(
!
strcmp
(
robj
->
GetClassName
(),
"TKey"
))
{
TGListTreeItem
*
parent
=
item
;
TRemoteObject
*
probj
=
(
TRemoteObject
*
)
parent
->
GetUserData
();
auto
*
probj
=
static_cast
<
TRemoteObject
*
>
(
parent
->
GetUserData
()
)
;
// find the TFile remote object containing the TKey
while
(
probj
&&
strcmp
(
probj
->
GetClassName
(),
"TFile"
))
{
parent
=
parent
->
GetParent
();
...
...
@@ -1355,8 +1357,8 @@ void CXGFileBrowser::DoubleClicked(TGListTreeItem *item, Int_t /*btn*/)
sbuf
.
fIsLink
)
{
// change the pictures if it is a symlink
// (shortcut on Windows)
const
TGPicture
*
opened
=
0
,
*
l_opened
=
0
;
const
TGPicture
*
closed
=
0
,
*
l_closed
=
0
;
const
TGPicture
*
opened
=
nullptr
,
*
l_opened
=
nullptr
;
const
TGPicture
*
closed
=
nullptr
,
*
l_closed
=
nullptr
;
opened
=
fClient
->
GetPicture
(
"ofolder_t.xpm"
);
if
(
opened
)
l_opened
=
MakeLinkPic
(
opened
);
closed
=
fClient
->
GetPicture
(
"folder_t.xpm"
);
...
...
@@ -1371,7 +1373,7 @@ void CXGFileBrowser::DoubleClicked(TGListTreeItem *item, Int_t /*btn*/)
// uncomment line below to set directories as
// DND targets
//itm->SetDNDTarget(kTRUE);
itm
->
SetUserData
(
0
);
itm
->
SetUserData
(
nullptr
);
}
}
}
...
...
@@ -1380,7 +1382,7 @@ void CXGFileBrowser::DoubleClicked(TGListTreeItem *item, Int_t /*btn*/)
TIter
nextf
(
files
);
while
((
file
=
(
TSystemFile
*
)
nextf
()))
{
fname
=
pname
=
file
->
GetName
();
if
(
!
file
->
IsDirectory
()
&&
(
fFilter
==
0
||
if
(
!
file
->
IsDirectory
()
&&
(
fFilter
==
nullptr
||
(
fFilter
&&
fname
.
Index
(
*
fFilter
)
!=
kNPOS
)))
{
if
(
!
fShowHidden
&&
fname
.
BeginsWith
(
"."
))
continue
;
...
...
@@ -1428,7 +1430,7 @@ void CXGFileBrowser::DoubleClicked(TGListTreeItem *item, Int_t /*btn*/)
TSystemFile
f
(
lnkname
.
Data
(),
fullpath
.
Data
());
TString
fname
=
f
.
GetName
();
if
(
fname
.
EndsWith
(
".root"
))
{
TDirectory
*
rfile
=
0
;
TDirectory
*
rfile
=
nullptr
;
gSystem
->
ChangeDirectory
(
dirname
.
Data
());
rfile
=
(
TDirectory
*
)
gROOT
->
GetListOfFiles
()
->
FindObject
(
obj
);
if
(
!
rfile
)
{
...
...
@@ -1438,11 +1440,11 @@ void CXGFileBrowser::DoubleClicked(TGListTreeItem *item, Int_t /*btn*/)
// replace actual user data (TObjString) by the TDirectory...
if
(
item
->
GetUserData
())
{
// first delete the data to avoid memory leaks
TObject
*
obj2
=
static_cast
<
TObject
*>
(
item
->
GetUserData
());
auto
*
obj2
=
static_cast
<
TObject
*>
(
item
->
GetUserData
());
// only delete TObjString as they are the only objects
// created who have to be deleted
TObjString
*
ostr
=
dynamic_cast
<
TObjString
*>
(
obj2
);
if
(
ostr
)
delete
ostr
;
auto
*
ostr
=
dynamic_cast
<
TObjString
*>
(
obj2
);
delete
ostr
;
}
item
->
SetUserData
(
rfile
);
fNKeys
=
rfile
->
GetListOfKeys
()
->
GetEntries
();
...
...
@@ -1460,13 +1462,13 @@ void CXGFileBrowser::DoubleClicked(TGListTreeItem *item, Int_t /*btn*/)
else
if
(
IsTextFile
(
fullpath
.
Data
()))
{
gSystem
->
ChangeDirectory
(
dirname
.
Data
());
if
(
fNewBrowser
)
{