@@ -4959,7 +4959,8 @@ static Bool_t ContainsTImage(TList *li)
49594959// / generated in some loop one needs to detect the special cases of first
49604960// / and last page and then munge the argument to Print() accordingly.
49614961// /
4962- // / The "[" and "]" can be used instead of "(" and ")".
4962+ // / The "[" and "]" can be used instead of "(" and ")" to open / close without
4963+ // / actual printing.
49634964// /
49644965// / Example:
49654966// / ~~~ {.cpp}
@@ -5019,6 +5020,9 @@ void TPad::Print(const char *filename, Option_t *option)
50195020 TString opt = !option ? opt_default : option;
50205021 Bool_t image = kFALSE ;
50215022
5023+ Bool_t title = kFALSE ;
5024+ if (strstr (opt," Title:" )) title = kTRUE ;
5025+
50225026 if (!fs1.Length ()) {
50235027 psname = GetName ();
50245028 psname += opt;
@@ -5036,25 +5040,25 @@ void TPad::Print(const char *filename, Option_t *option)
50365040
50375041 // Save pad/canvas in alternative formats
50385042 TImage::EImageFileTypes gtype = TImage::kUnknown ;
5039- if (strstr (opt, " gif+" )) {
5043+ if (!title && strstr (opt, " gif+" )) {
50405044 gtype = TImage::kAnimGif ;
50415045 image = kTRUE ;
5042- } else if (strstr (opt, " gif" )) {
5046+ } else if (!title && strstr (opt, " gif" )) {
50435047 gtype = TImage::kGif ;
50445048 image = kTRUE ;
5045- } else if (strstr (opt, " png" )) {
5049+ } else if (!title && strstr (opt, " png" )) {
50465050 gtype = TImage::kPng ;
50475051 image = kTRUE ;
5048- } else if (strstr (opt, " jpg" )) {
5052+ } else if (!title && strstr (opt, " jpg" )) {
50495053 gtype = TImage::kJpeg ;
50505054 image = kTRUE ;
5051- } else if (strstr (opt, " tiff" )) {
5055+ } else if (!title && strstr (opt, " tiff" )) {
50525056 gtype = TImage::kTiff ;
50535057 image = kTRUE ;
5054- } else if (strstr (opt, " xpm" )) {
5058+ } else if (!title && strstr (opt, " xpm" )) {
50555059 gtype = TImage::kXpm ;
50565060 image = kTRUE ;
5057- } else if (strstr (opt, " bmp" )) {
5061+ } else if (!title && strstr (opt, " bmp" )) {
50585062 gtype = TImage::kBmp ;
50595063 image = kTRUE ;
50605064 }
@@ -5105,32 +5109,32 @@ void TPad::Print(const char *filename, Option_t *option)
51055109 }
51065110
51075111 // ==============Save pad/canvas as a C++ script==============================
5108- if (strstr (opt," cxx" )) {
5112+ if (!title && strstr (opt," cxx" )) {
51095113 GetCanvas ()->SaveSource (psname, " " );
51105114 return ;
51115115 }
51125116
51135117 // ==============Save pad/canvas as a root file===============================
5114- if (strstr (opt," root" )) {
5118+ if (!title && strstr (opt," root" )) {
51155119 if (gDirectory ) gDirectory ->SaveObjectAs (this ,psname.Data ()," " );
51165120 return ;
51175121 }
51185122
51195123 // ==============Save pad/canvas as a XML file================================
5120- if (strstr (opt," xml" )) {
5124+ if (!title && strstr (opt," xml" )) {
51215125 // Plugin XML driver
51225126 if (gDirectory ) gDirectory ->SaveObjectAs (this ,psname.Data ()," " );
51235127 return ;
51245128 }
51255129
51265130 // ==============Save pad/canvas as a JSON file================================
5127- if (strstr (opt," json" )) {
5131+ if (!title && strstr (opt," json" )) {
51285132 if (gDirectory ) gDirectory ->SaveObjectAs (this ,psname.Data ()," " );
51295133 return ;
51305134 }
51315135
51325136 // ==============Save pad/canvas as a SVG file================================
5133- if (strstr (opt," svg" )) {
5137+ if (!title && strstr (opt," svg" )) {
51345138 gVirtualPS = (TVirtualPS*)gROOT ->GetListOfSpecials ()->FindObject (psname);
51355139
51365140 Bool_t noScreen = kFALSE ;
@@ -5171,7 +5175,7 @@ void TPad::Print(const char *filename, Option_t *option)
51715175 }
51725176
51735177 // ==============Save pad/canvas as a TeX file================================
5174- if (strstr (opt," tex" ) || strstr (opt," Standalone" )) {
5178+ if (!title && ( strstr (opt," tex" ) || strstr (opt," Standalone" ) )) {
51755179 gVirtualPS = (TVirtualPS*)gROOT ->GetListOfSpecials ()->FindObject (psname);
51765180
51775181 Bool_t noScreen = kFALSE ;
@@ -5259,7 +5263,7 @@ void TPad::Print(const char *filename, Option_t *option)
52595263 if (!gVirtualPS || mustOpen) {
52605264
52615265 const char *pluginName = " ps" ; // Plugin Postscript driver
5262- if (strstr (opt," pdf" ) || strstr (opt, " Title: " ) || strstr (opt," EmbedFonts" ))
5266+ if (strstr (opt," pdf" ) || title || strstr (opt," EmbedFonts" ))
52635267 pluginName = " pdf" ;
52645268 else if (image)
52655269 pluginName = " image" ; // Plugin TImageDump driver
@@ -7023,7 +7027,7 @@ TObject *TPad::WaitPrimitive(const char *pname, const char *emode)
70237027 TObject *obj = nullptr ;
70247028 Bool_t testlast = kFALSE ;
70257029 Bool_t hasname = pname && (strlen (pname) > 0 );
7026- if (!pname[0 ] && !emode[0 ]) testlast = kTRUE ;
7030+ if (( !pname || !pname [0 ]) && ( !emode || !emode [0 ]) ) testlast = kTRUE ;
70277031 if (testlast) gROOT ->SetEditorMode ();
70287032 while (!gSystem ->ProcessEvents () && gROOT ->GetSelectedPad () && gPad ) {
70297033 if (gROOT ->GetEditorMode () == 0 ) {
0 commit comments