From a2d0334e611477a14ae84221b25ac3ae7fa7ff90 Mon Sep 17 00:00:00 2001
From: Rene Brun <Rene.Brun@cern.ch>
Date: Wed, 12 Dec 2007 11:29:38 +0000
Subject: [PATCH] From Bertrand: - Added help on remote sessions - Added help
 menu in the new browser

git-svn-id: http://root.cern.ch/svn/root/trunk@21331 27541ba8-7e3a-0410-8455-c3a389f83636
---
 gui/inc/HelpText.h           |  2 +
 gui/inc/TRootBrowser.h       |  1 +
 gui/src/HelpText.cxx         | 60 ++++++++++++++++++++++++-
 gui/src/TRootBrowser.cxx     | 87 ++++++++++++++++++++++++++++++++++++
 gui/src/TRootBrowserLite.cxx | 11 ++++-
 pythia6/src/TPythia6.cxx     |  2 +-
 6 files changed, 159 insertions(+), 4 deletions(-)

diff --git a/gui/inc/HelpText.h b/gui/inc/HelpText.h
index dd7bff309f3..ca3e3aa4c06 100644
--- a/gui/inc/HelpText.h
+++ b/gui/inc/HelpText.h
@@ -15,6 +15,7 @@
 
 R__EXTERN const char gHelpAbout[];
 R__EXTERN const char gHelpBrowser[];
+R__EXTERN const char gHelpBrowserLite[];
 R__EXTERN const char gHelpGLViewer[];
 R__EXTERN const char gHelpPostscript[];
 R__EXTERN const char gHelpButtons[];
@@ -23,3 +24,4 @@ R__EXTERN const char gHelpPullDownMenus[];
 R__EXTERN const char gHelpCanvas[];
 R__EXTERN const char gHelpObjects[];
 R__EXTERN const char gHelpTextEditor[];
+R__EXTERN const char gHelpRemote[];
diff --git a/gui/inc/TRootBrowser.h b/gui/inc/TRootBrowser.h
index edca016a71d..0897336ee10 100644
--- a/gui/inc/TRootBrowser.h
+++ b/gui/inc/TRootBrowser.h
@@ -74,6 +74,7 @@ protected:
    TGMenuBar         *fMenuBar;                    // Main (owned) menu bar
    TGPopupMenu       *fMenuFile;                   // "File" popup menu
    TGPopupMenu       *fMenuExecPlugin;             // "Exec Plugin" popup menu
+   TGPopupMenu       *fMenuHelp;                   // "Browser Help" popup menu
    TGCompositeFrame  *fActMenuBar;                 // Actual (active) menu bar
    TBrowserImp       *fActBrowser;                 // Actual (active) browser imp
    TList              fBrowsers;                   // List of (sub)browsers
diff --git a/gui/src/HelpText.cxx b/gui/src/HelpText.cxx
index e4f1184472f..6b77c54577c 100644
--- a/gui/src/HelpText.cxx
+++ b/gui/src/HelpText.cxx
@@ -24,8 +24,47 @@ communication classes allowing the transfer of complete objects\n\
 from one process to another.\n\
 ";
 
-
 const char gHelpBrowser[] = "\
+The ROOT general object browser (see TBrowser) can be used to \n\
+browse collections such as the list of classes, geometries, files \n\
+and TTrees. A browser can be started from the Start Browser item in \n\
+the canvas View menu or by creating a browser object. \n\
+More than one browser can be active at any time. \n\
+A Browser window has three main tabs, separated by horizontal and \n\
+vertical splitters.\n\
+By default, the left pane contains the file browser, which is the core \n\
+of the browser. \n\
+From there, user can: \n\
+ - Execute Root macros: \n\
+   To execute the macro, double-click on the file icon. \n\
+   NB: the editor must not be active on the right tab, otherwise the \n\
+   macro will be opened in the editor. \n\
+ - Open text files in the editor: \n\
+   To open the file, double-click on the file icon while the editor \n\
+   tab being active on the right tab. \n\
+   It is also possible to drag the file from the list tree and drop it \n\
+   in the editor. \n\
+   Once the file is opened in the editor, if it is a Root Macro, it \n\
+   can be executed with the button 'execute' in the editors's tool bar. \n\
+ - Display picture files in the canvas: \n\
+   Drag the picture file from the list tree and drop it in the canvas. \n\
+ - Browse ROOT files: \n\
+   To open the file, double-click on the file icon. Its content will be \n\
+   displayed in the list tree. \n\
+   From there, user can double-click on any item (i.e. histogram) to \n\
+   display it in the canvas. \n\
+   It is also possible to drag the item from the list tree and drop it \n\
+   in the canvas. \n\
+ - Browse ROOT files from Web: \n\
+   From the 'Browser' menu, select 'New HTML'. A new tab is created, \n\
+   containing a HTML browser. \n\
+   From there, type the URL from where you want to access Root files. \n\
+   Click once on the file you want to open. The file is opened and the \n\
+   browser automatically switch to the 'ROOT Files' folder in the list \n\
+   tree. Now, just browse the file as a local Root file. \n\
+";
+
+const char gHelpBrowserLite[] = "\
 The ROOT general object browser (see TBrowser) can be used to browse collections\n\
 such as the list of classes, geometries, files and TTrees. A browser can be \n\
 started from the Start Browser item in the canvas View menu or by creating a \n\
@@ -403,3 +442,22 @@ Ctrl+K            Delete characters from current position to the end of\n\
                   line.\n\
 Ctrl+U            Delete current line.\n\
 ";
+
+const char gHelpRemote[] = "\
+Remote session help:\n\
+.R [user@]host[:dir] [-l user] [-d dbg] [[<]script] | [host] -close\n\
+Create a ROOT session on the specified remote host.\n\
+The variable \"dir\" is the remote directory to be used as working dir.\n\
+The username can be specified in two ways, \"-l\" having the priority\n\
+(as in ssh). A \"dbg\" value > 0 gives increasing verbosity.\n\
+The last argument \"script\" allows to specify an alternative script to\n\
+be executed remotely to startup the session, \"roots\" being\n\
+the default. If the script is preceeded by a \"<\" the script will be\n\
+sourced, after which \"roots\" is executed. The sourced script can be \n\
+used to change the PATH and other variables, allowing an alternative\n\
+\"roots\" script to be found.\n\
+To close down a session do \".R host -close\".\n\
+To switch between sessions do \".R host\", to switch to the local\n\
+session do \".R\".\n\
+To list all open sessions do \"gApplication->GetApplications()->Print()\".\n\
+";
diff --git a/gui/src/TRootBrowser.cxx b/gui/src/TRootBrowser.cxx
index bb8bc919f7f..5fcbefc788e 100644
--- a/gui/src/TRootBrowser.cxx
+++ b/gui/src/TRootBrowser.cxx
@@ -72,6 +72,8 @@
 #include "TRootBrowser.h"
 #include "TGFileBrowser.h"
 #include "TGInputDialog.h"
+#include "TRootHelpDialog.h"
+#include "HelpText.h"
 
 #include "Getline.h"
 
@@ -95,6 +97,14 @@ enum ENewBrowserMessages {
    kBrowse = 11011,
    kOpenFile,
    kClone,
+   kHelpAbout,
+   kHelpOnBrowser,
+   kHelpOnCanvas,
+   kHelpOnMenus,
+   kHelpOnGraphicsEd,
+   kHelpOnObjects,
+   kHelpOnPS,
+   kHelpOnRemote,
    kNewEditor,
    kNewCanvas,
    kNewHtml,
@@ -167,6 +177,20 @@ void TRootBrowser::CreateBrowser(const char *name)
    fMenuFile  = new TGPopupMenu(gClient->GetDefaultRoot());
    fMenuFile->AddEntry("&Browse...             Ctrl+B", kBrowse);
    fMenuFile->AddEntry("&Open...                 Ctrl+O", kOpenFile);
+   fMenuFile->AddSeparator();
+   
+   fMenuHelp = new TGPopupMenu(fClient->GetRoot());
+   fMenuHelp->AddEntry("&About ROOT...",        kHelpAbout);
+   fMenuHelp->AddSeparator();
+   fMenuHelp->AddEntry("Help On Browser...",    kHelpOnBrowser);
+   fMenuHelp->AddEntry("Help On Canvas...",     kHelpOnCanvas);
+   fMenuHelp->AddEntry("Help On Menus...",      kHelpOnMenus);
+   fMenuHelp->AddEntry("Help On Graphics Editor...", kHelpOnGraphicsEd);
+   fMenuHelp->AddEntry("Help On Objects...",    kHelpOnObjects);
+   fMenuHelp->AddEntry("Help On PostScript...", kHelpOnPS);
+   fMenuHelp->AddEntry("Help On Remote Session...", kHelpOnRemote);
+   fMenuFile->AddPopup("Browser Help...", fMenuHelp);
+   
    fMenuFile->AddSeparator();
    fMenuFile->AddEntry("&Clone                   Ctrl+N", kClone);
    fMenuFile->AddSeparator();
@@ -284,6 +308,7 @@ TRootBrowser::~TRootBrowser()
    delete fLH5;
    delete fLH6;
    delete fLH7;
+   delete fMenuHelp;
    delete fMenuExecPlugin;
    delete fMenuFile;
    delete fMenuBar;
@@ -570,6 +595,7 @@ void TRootBrowser::HandleMenu(Int_t id)
 {
    // Handle menu entries events.
 
+   TRootHelpDialog *hd;
    TString cmd;
    static Int_t eNr = 1;
    TGPopupMenu *sender = (TGPopupMenu *)gTQSender;
@@ -601,6 +627,67 @@ void TRootBrowser::HandleMenu(Int_t id)
                                   gSystem->UnixPathName(fi.fFilename)));
             }
          }
+         break;
+                  // Handle Help menu items...
+      case kHelpAbout:
+         {
+#ifdef R__UNIX
+            TString rootx;
+# ifdef ROOTBINDIR
+            rootx = ROOTBINDIR;
+# else
+            rootx = gSystem->Getenv("ROOTSYS");
+            if (!rootx.IsNull()) rootx += "/bin";
+# endif
+            rootx += "/root -a &";
+            gSystem->Exec(rootx);
+#else
+#ifdef WIN32
+            new TWin32SplashThread(kTRUE);
+#else
+            char str[32];
+            sprintf(str, "About ROOT %s...", gROOT->GetVersion());
+            hd = new TRootHelpDialog(this, str, 600, 400);
+            hd->SetText(gHelpAbout);
+            hd->Popup();
+#endif
+#endif
+         }
+         break;
+      case kHelpOnCanvas:
+         hd = new TRootHelpDialog(this, "Help on Canvas...", 600, 400);
+         hd->SetText(gHelpCanvas);
+         hd->Popup();
+         break;
+      case kHelpOnMenus:
+         hd = new TRootHelpDialog(this, "Help on Menus...", 600, 400);
+         hd->SetText(gHelpPullDownMenus);
+         hd->Popup();
+         break;
+      case kHelpOnGraphicsEd:
+         hd = new TRootHelpDialog(this, "Help on Graphics Editor...", 600, 400);
+         hd->SetText(gHelpGraphicsEditor);
+         hd->Popup();
+         break;
+      case kHelpOnBrowser:
+         hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
+         hd->SetText(gHelpBrowser);
+         hd->Popup();
+         break;
+      case kHelpOnObjects:
+         hd = new TRootHelpDialog(this, "Help on Objects...", 600, 400);
+         hd->SetText(gHelpObjects);
+         hd->Popup();
+         break;
+      case kHelpOnPS:
+         hd = new TRootHelpDialog(this, "Help on PostScript...", 600, 400);
+         hd->SetText(gHelpPostscript);
+         hd->Popup();
+         break;
+      case kHelpOnRemote:
+         hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
+         hd->SetText(gHelpRemote);
+         hd->Popup();
          break;
       case kClone:
          CloneBrowser();
diff --git a/gui/src/TRootBrowserLite.cxx b/gui/src/TRootBrowserLite.cxx
index 26a8c703134..8f2cf2713f4 100644
--- a/gui/src/TRootBrowserLite.cxx
+++ b/gui/src/TRootBrowserLite.cxx
@@ -122,7 +122,8 @@ enum ERootBrowserCommands {
    kHelpOnMenus,
    kHelpOnGraphicsEd,
    kHelpOnObjects,
-   kHelpOnPS
+   kHelpOnPS,
+   kHelpOnRemote
 };
 
 
@@ -1040,6 +1041,7 @@ void TRootBrowserLite::CreateBrowser(const char *name)
    fHelpMenu->AddEntry("Help On Graphics Editor...", kHelpOnGraphicsEd);
    fHelpMenu->AddEntry("Help On Objects...",    kHelpOnObjects);
    fHelpMenu->AddEntry("Help On PostScript...", kHelpOnPS);
+   fHelpMenu->AddEntry("Help On Remote Session...", kHelpOnRemote);
 
    // This main frame will process the menu commands
    fFileMenu->Associate(this);
@@ -1934,7 +1936,7 @@ Bool_t TRootBrowserLite::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
                      break;
                   case kHelpOnBrowser:
                      hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
-                     hd->SetText(gHelpBrowser);
+                     hd->SetText(gHelpBrowserLite);
                      hd->Popup();
                      break;
                   case kHelpOnObjects:
@@ -1947,6 +1949,11 @@ Bool_t TRootBrowserLite::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
                      hd->SetText(gHelpPostscript);
                      hd->Popup();
                      break;
+                  case kHelpOnRemote:
+                     hd = new TRootHelpDialog(this, "Help on Browser...", 600, 400);
+                     hd->SetText(gHelpRemote);
+                     hd->Popup();
+                     break;
                }
             case kCM_COMBOBOX:
                if (parm1 == kFSComboBox) {
diff --git a/pythia6/src/TPythia6.cxx b/pythia6/src/TPythia6.cxx
index 2ddd988efc7..5aed12e4ad4 100644
--- a/pythia6/src/TPythia6.cxx
+++ b/pythia6/src/TPythia6.cxx
@@ -1,6 +1,6 @@
 // @(#)root/pythia6:$Id$
 // Author: Rene Brun   19/10/99
-//
+
 ////////////////////////////////////////////////////////////////////////////////
 //                                                                            //
 // TPythia6                                                                   //
-- 
GitLab