// @(#)root/sessionviewer:$Id$
// Author: Marek Biskup, Jakub Madejczyk, Bertrand Bellenot 10/08/2005

/*************************************************************************
 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TSessionViewer                                                       //
//                                                                      //
// Widget used to manage PROOF or local sessions, PROOF connections,    //
// queries construction and results handling.                           //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TApplication.h"
#include "TROOT.h"
#include "THashList.h"
#include "TClass.h"
#include "TSystem.h"
#include "TGFileDialog.h"
#include "TBrowser.h"
#include "TGButton.h"
#include "TGLayout.h"
#include "TGListTree.h"
#include "TGCanvas.h"
#include "TGLabel.h"
#include "TGTextEntry.h"
#include "TGNumberEntry.h"
#include "TGTableLayout.h"
#include "TGComboBox.h"
#include "TGSplitter.h"
#include "TGProgressBar.h"
#include "TGListView.h"
#include "TGMsgBox.h"
#include "TGMenu.h"
#include "TGStatusBar.h"
#include "TGIcon.h"
#include "TChain.h"
#include "TDSet.h"
#include "TFileInfo.h"
#include "TProof.h"
#include "TRandom.h"
#include "TSessionViewer.h"
#include "TSessionLogView.h"
#include "TQueryResult.h"
#include "TGTextView.h"
#include "TGMenu.h"
#include "TGToolBar.h"
#include "TGTab.h"
#include "TRootEmbeddedCanvas.h"
#include "TCanvas.h"
#include "TGMimeTypes.h"
#include "TInterpreter.h"
#include "TContextMenu.h"
#include "TG3DLine.h"
#include "TSessionDialogs.h"
#include "TEnv.h"
#include "TH2.h"
#include "TTreePlayer.h"
#include "TFileCollection.h"
#ifdef WIN32
#include "TWin32SplashThread.h"
#endif
#include <stdlib.h>

TSessionViewer *gSessionViewer = 0;

const char *kConfigFile = ".proofgui.conf";

ClassImp(TQueryDescription)
ClassImp(TSessionDescription)
ClassImp(TSessionServerFrame)
ClassImp(TSessionFrame)
ClassImp(TSessionQueryFrame)
ClassImp(TSessionOutputFrame)
ClassImp(TSessionInputFrame)
ClassImp(TSessionViewer)

const char *xpm_names[] = {
    "monitor01.xpm",
    "monitor02.xpm",
    "monitor03.xpm",
    "monitor04.xpm",
    0
};

const char *conftypes[] = {
   "Config files",  "*.conf",
   "All files",     "*.*",
    0,               0
};

const char *pkgtypes[] = {
   "Package files", "*.par",
   "All files",     "*.*",
    0,               0
};

const char *macrotypes[] = {
   "C files",       "*.[C|c]*",
   "All files",     "*",
   0,               0
};


const char *kFeedbackHistos[] = {
   "PROOF_PacketsHist",
   "PROOF_EventsHist",
   "PROOF_NodeHist",
   "PROOF_LatencyHist",
   "PROOF_ProcTimeHist",
   "PROOF_CpuTimeHist",
   0
};

const char* const kSession_RedirectFile = ".templog";
const char* const kSession_RedirectCmd = ".tempcmd";

// Menu command id's
enum ESessionViewerCommands {
   kFileLoadConfig,
   kFileSaveConfig,
   kFileCloseViewer,
   kFileQuit,

   kSessionNew,
   kSessionAdd,
   kSessionDelete,
   kSessionGetQueries,

   kSessionConnect,
   kSessionDisconnect,
   kSessionShutdown,
   kSessionCleanup,
   kSessionBrowse,
   kSessionShowStatus,
   kSessionReset,

   kQueryNew,
   kQueryEdit,
   kQueryDelete,
   kQuerySubmit,
   kQueryStartViewer,

   kOptionsAutoSave,
   kOptionsStatsHist,
   kOptionsStatsTrace,
   kOptionsSlaveStatsTrace,
   kOptionsFeedback,

   kHelpAbout
};

const char *xpm_toolbar[] = {
    "fileopen.xpm",
    "filesaveas.xpm",
    "",
    "connect.xpm",
    "disconnect.xpm",
    "",
    "query_new.xpm",
    "query_submit.xpm",
    "",
    "about.xpm",
    "",
    "quit.xpm",
    0
};

ToolBarData_t tb_data[] = {
  { "", "Open Config File",     kFALSE, kFileLoadConfig,    0 },
  { "", "Save Config File",     kFALSE, kFileSaveConfig,    0 },
  { "", 0,                      0,      -1,                 0 },
  { "", "Connect",              kFALSE, kSessionConnect,    0 },
  { "", "Disconnect",           kFALSE, kSessionDisconnect, 0 },
  { "", 0,                      0,      -1,                 0 },
  { "", "New Query",            kFALSE, kQueryNew,          0 },
  { "", "Submit Query",         kFALSE, kQuerySubmit,       0 },
  { "", 0,                      0,      -1,                 0 },
  { "", "About Root",           kFALSE, kHelpAbout,         0 },
  { "", 0,                      0,      -1,                 0 },
  { "", "Exit Root",            kFALSE, kFileQuit,          0 },
  { 0,  0,                      0,      0,                  0 }
};


////////////////////////////////////////////////////////////////////////////////
// Server Frame

//______________________________________________________________________________
TSessionServerFrame::TSessionServerFrame(TGWindow* p, Int_t w, Int_t h) :
   TGCompositeFrame(p, w, h), fFrmNewServer(0), fTxtName(0), fTxtAddress(0),
   fNumPort(0), fLogLevel(0), fTxtConfig(0), fTxtUsrName(0), fSync(0),
   fViewer(0), fBtnAdd(0), fBtnConnect(0)
{
   // Constructor.
}

//______________________________________________________________________________
TSessionServerFrame::~TSessionServerFrame()
{
   // Destructor.
   Cleanup();
}

//______________________________________________________________________________
void TSessionServerFrame::Build(TSessionViewer *gui)
{
   // Build server configuration frame.

   SetLayoutManager(new TGVerticalLayout(this));

   SetCleanup(kDeepCleanup);

   fViewer = gui;
   fFrmNewServer = new TGGroupFrame(this, "New Session");
   fFrmNewServer->SetCleanup(kDeepCleanup);

   AddFrame(fFrmNewServer, new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2));

   fFrmNewServer->SetLayoutManager(new TGMatrixLayout(fFrmNewServer, 0, 2, 8));

   fFrmNewServer->AddFrame(new TGLabel(fFrmNewServer, "Session Name:"),
                           new TGLayoutHints(kLHintsLeft, 3, 3, 3, 3));
   fFrmNewServer->AddFrame(fTxtName = new TGTextEntry(fFrmNewServer,
                           (const char *)0, 1), new TGLayoutHints());
   fTxtName->Resize(156, fTxtName->GetDefaultHeight());
   fTxtName->Associate(this);
   fFrmNewServer->AddFrame(new TGLabel(fFrmNewServer, "Server name:"),
                           new TGLayoutHints(kLHintsLeft, 3, 3, 3, 3));
   fFrmNewServer->AddFrame(fTxtAddress = new TGTextEntry(fFrmNewServer,
                           (const char *)0, 2), new TGLayoutHints());
   fTxtAddress->Resize(156, fTxtAddress->GetDefaultHeight());
   fTxtAddress->Associate(this);
   fFrmNewServer->AddFrame(new TGLabel(fFrmNewServer, "Port (default: 1093):"),
                           new TGLayoutHints(kLHintsLeft, 3, 3, 3, 3));
   fFrmNewServer->AddFrame(fNumPort = new TGNumberEntry(fFrmNewServer, 1093, 5,
            3, TGNumberFormat::kNESInteger,TGNumberFormat::kNEANonNegative,
            TGNumberFormat::kNELLimitMinMax, 0, 65535),new TGLayoutHints());
   fNumPort->Associate(this);
   fFrmNewServer->AddFrame(new TGLabel(fFrmNewServer, "Configuration File:"),
                           new TGLayoutHints(kLHintsLeft, 3, 3, 3, 3));
   fFrmNewServer->AddFrame(fTxtConfig = new TGTextEntry(fFrmNewServer,
                           (const char *)0, 4), new TGLayoutHints());
   fTxtConfig->Resize(156, fTxtConfig->GetDefaultHeight());
   fTxtConfig->Associate(this);
   fFrmNewServer->AddFrame(new TGLabel(fFrmNewServer, "Log Level:"),
                           new TGLayoutHints(kLHintsLeft, 3, 3, 3, 3));

   fFrmNewServer->AddFrame(fLogLevel = new TGNumberEntry(fFrmNewServer, 0, 5, 5,
                           TGNumberFormat::kNESInteger,
                           TGNumberFormat::kNEANonNegative,
                           TGNumberFormat::kNELLimitMinMax, 0, 5),
                           new TGLayoutHints(kLHintsLeft, 3, 3, 3, 3));
   fLogLevel->Associate(this);

   fFrmNewServer->AddFrame(new TGLabel(fFrmNewServer, "User Name:"),
            new TGLayoutHints(kLHintsLeft, 3, 3, 3, 3));
   fFrmNewServer->AddFrame(fTxtUsrName = new TGTextEntry(fFrmNewServer,
                           (const char *)0, 6), new TGLayoutHints());
   fTxtUsrName->Resize(156, fTxtUsrName->GetDefaultHeight());
   fTxtUsrName->Associate(this);

   fFrmNewServer->AddFrame(new TGLabel(fFrmNewServer, "Process mode :"),
            new TGLayoutHints(kLHintsLeft | kLHintsBottom | kLHintsExpandX,
            3, 3, 3, 3));
   fFrmNewServer->AddFrame(fSync = new TGCheckButton(fFrmNewServer,
      "&Synchronous"), new TGLayoutHints(kLHintsLeft | kLHintsBottom |
      kLHintsExpandX, 3, 3, 3, 3));
   fSync->SetToolTipText("Default Process Mode");
   fSync->SetState(kButtonDown);

   AddFrame(fBtnAdd = new TGTextButton(this, "             Save             "),
            new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 15, 5));
   fBtnAdd->SetToolTipText("Add server to the list");
   fBtnAdd->Connect("Clicked()", "TSessionServerFrame", this,
                    "OnBtnAddClicked()");
   AddFrame(fBtnConnect = new TGTextButton(this, "          Connect          "),
                 new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 15, 5));
   fBtnConnect->Connect("Clicked()", "TSessionServerFrame", this,
                        "OnBtnConnectClicked()");
   fBtnConnect->SetToolTipText("Connect to the selected server");

   fTxtConfig->Connect("DoubleClicked()", "TSessionServerFrame", this,
                       "OnConfigFileClicked()");

   fTxtName->Connect("TextChanged(char*)", "TSessionServerFrame", this,
                     "SettingsChanged()");
   fTxtAddress->Connect("TextChanged(char*)", "TSessionServerFrame", this,
                       "SettingsChanged()");
   fTxtConfig->Connect("TextChanged(char*)", "TSessionServerFrame", this,
                       "SettingsChanged()");
   fTxtUsrName->Connect("TextChanged(char*)", "TSessionServerFrame", this,
                        "SettingsChanged()");
   fSync->Connect("Clicked()", "TSessionServerFrame", this,
                  "SettingsChanged()");
   fLogLevel->Connect("ValueChanged(Long_t)", "TSessionServerFrame", this,
                      "SettingsChanged()");
   fLogLevel->Connect("ValueSet(Long_t)", "TSessionServerFrame", this,
                      "SettingsChanged()");
   fNumPort->Connect("ValueChanged(Long_t)", "TSessionServerFrame", this,
                     "SettingsChanged()");
   fNumPort->Connect("ValueSet(Long_t)", "TSessionServerFrame", this,
                     "SettingsChanged()");

}

//______________________________________________________________________________
void TSessionServerFrame::SettingsChanged()
{
   // Settings have changed, update GUI accordingly.

   TGTextEntry *sender = dynamic_cast<TGTextEntry*>((TQObject*)gTQSender);
   Bool_t issync = (fSync->GetState() == kButtonDown);
   if ((fViewer->GetActDesc()->fLocal) ||
       (strcmp(fViewer->GetActDesc()->GetName(), fTxtName->GetText())) ||
       (strcmp(fViewer->GetActDesc()->fAddress.Data(), fTxtAddress->GetText())) ||
       (strcmp(fViewer->GetActDesc()->fConfigFile.Data(), fTxtConfig->GetText())) ||
       (strcmp(fViewer->GetActDesc()->fUserName.Data(), fTxtUsrName->GetText())) ||
       (fViewer->GetActDesc()->fLogLevel != fLogLevel->GetIntNumber()) ||
       (fViewer->GetActDesc()->fPort != fNumPort->GetIntNumber()) ||
       (fViewer->GetActDesc()->fSync != issync)) {
      ShowFrame(fBtnAdd);
      HideFrame(fBtnConnect);
   }
   else {
      HideFrame(fBtnAdd);
      ShowFrame(fBtnConnect);
   }
   if (sender) {
      sender->SetFocus();
   }
}


//______________________________________________________________________________
Bool_t TSessionServerFrame::HandleExpose(Event_t * /*event*/)
{
   // Handle expose event in server frame.

   //fTxtName->SelectAll();
   //fTxtName->SetFocus();
   return kTRUE;
}

//______________________________________________________________________________
void TSessionServerFrame::OnConfigFileClicked()
{
   // Browse configuration files.

   // do nothing if connection in progress
   if (fViewer->IsBusy())
      return;
   TGFileInfo fi;
   fi.fFileTypes = conftypes;
   new TGFileDialog(fClient->GetRoot(), fViewer, kFDOpen, &fi);
   if (!fi.fFilename) return;
   fTxtConfig->SetText(gSystem->BaseName(fi.fFilename));
}

//______________________________________________________________________________
void TSessionServerFrame::OnBtnDeleteClicked()
{
   // Delete selected session configuration (remove it from the list).

   // do nothing if connection in progress
   if (fViewer->IsBusy())
      return;
   TString name(fTxtName->GetText());
   TIter next(fViewer->GetSessions());
   TSessionDescription *desc = fViewer->GetActDesc();

   if (desc->fLocal) {
      Int_t retval;
      new TGMsgBox(fClient->GetRoot(), this, "Error Deleting Session",
                   "Deleting Local Sessions is not allowed !",
                    kMBIconExclamation,kMBOk,&retval);
      return;
   }
   // ask for confirmation
   TString m;
   m.Form("Are you sure to delete the server \"%s\"",
          desc->fName.Data());
   Int_t result;
   new TGMsgBox(fClient->GetRoot(), this, "", m.Data(), 0,
                kMBOk | kMBCancel, &result);
   // if confirmed, delete it
   if (result == kMBOk) {
      // remove the Proof session from gROOT list of Proofs
      if (desc->fConnected && desc->fAttached && desc->fProof) {
         desc->fProof->Detach("S");
      }
      // remove it from our sessions list
      fViewer->GetSessions()->Remove((TObject *)desc);
      // update configuration file
      TGListTreeItem *item = fViewer->GetSessionHierarchy()->GetSelected();
      fViewer->GetSessionHierarchy()->DeleteItem(item);

      TObject *obj = fViewer->GetSessions()->Last();
      item = fViewer->GetSessionHierarchy()->FindChildByData(
               fViewer->GetSessionItem(), (void *)obj);
      if (item) {
         fViewer->GetSessionHierarchy()->ClearHighlighted();
         fViewer->GetSessionHierarchy()->OpenItem(item);
         fViewer->GetSessionHierarchy()->HighlightItem(item);
         fViewer->GetSessionHierarchy()->SetSelected(item);
         fViewer->GetSessionHierarchy()->ClearViewPort();
         fClient->NeedRedraw(fViewer->GetSessionHierarchy());
         fViewer->OnListTreeClicked(item, 1, 0, 0);
      }
   }
   if (fViewer->IsAutoSave())
      fViewer->WriteConfiguration();
}

//______________________________________________________________________________
void TSessionServerFrame::OnBtnConnectClicked()
{
   // Connect to selected server.

   // do nothing if connection in progress
   if (fViewer->IsBusy())
      return;

   if (!fViewer->GetSessions()->FindObject(fTxtName->GetText())) {
      OnBtnAddClicked();
   }
   else {
      fViewer->GetActDesc()->fAddress = fTxtAddress->GetText();
      fViewer->GetActDesc()->fPort = fNumPort->GetIntNumber();
      if (strlen(fTxtConfig->GetText()) > 1)
         fViewer->GetActDesc()->fConfigFile = TString(fTxtConfig->GetText());
      else
         fViewer->GetActDesc()->fConfigFile = "";
      fViewer->GetActDesc()->fLogLevel = fLogLevel->GetIntNumber();
      fViewer->GetActDesc()->fUserName = fTxtUsrName->GetText();
      fViewer->GetActDesc()->fSync = (fSync->GetState() == kButtonDown);
      if (fViewer->IsAutoSave())
         fViewer->WriteConfiguration();
   }
   // set flag busy
   fViewer->SetBusy();
   // avoid input events in list tree while connecting
   fViewer->GetSessionHierarchy()->RemoveInput(kPointerMotionMask |
         kEnterWindowMask | kLeaveWindowMask | kKeyPressMask);
   gVirtualX->GrabButton(fViewer->GetSessionHierarchy()->GetId(), kAnyButton,
         kAnyModifier, kButtonPressMask | kButtonReleaseMask, kNone, kNone, kFALSE);
   // set watch cursor to indicate connection in progress
   gVirtualX->SetCursor(fViewer->GetSessionHierarchy()->GetId(),
         gVirtualX->CreateCursor(kWatch));
   gVirtualX->SetCursor(GetId(),gVirtualX->CreateCursor(kWatch));
   // display connection progress bar in first part of status bar
   fViewer->GetStatusBar()->GetBarPart(0)->ShowFrame(fViewer->GetConnectProg());
   // connect to proof startup message (to update progress bar)
   TQObject::Connect("TProof", "StartupMessage(char *,Bool_t,Int_t,Int_t)",
         "TSessionViewer", fViewer, "StartupMessage(char *,Bool_t,Int_t,Int_t)");
   // collect and set-up configuration
   TString address = fTxtAddress->GetText();
   TString url;
   if (address == "lite://") {
      url = address;
   }
   else {
      // collect and set-up configuration
      url = fTxtUsrName->GetText();
      url += "@"; url += address.Data();
      if (fNumPort->GetIntNumber() > 0) {
         url += ":";
         url += fNumPort->GetIntNumber();
      }
   }

   TProofDesc *desc;
   fViewer->GetActDesc()->fProofMgr = TProofMgr::Create(url);
   if (!fViewer->GetActDesc()->fProofMgr ||
       !fViewer->GetActDesc()->fProofMgr->IsValid()) {
      // hide connection progress bar from status bar
      fViewer->GetStatusBar()->GetBarPart(0)->HideFrame(fViewer->GetConnectProg());
      // release busy flag
      fViewer->SetBusy(kFALSE);
      // restore cursors and input
      gVirtualX->SetCursor(GetId(), 0);
      gVirtualX->GrabButton(fViewer->GetSessionHierarchy()->GetId(), kAnyButton,
            kAnyModifier, kButtonPressMask | kButtonReleaseMask, kNone, kNone);
      fViewer->GetSessionHierarchy()->AddInput(kPointerMotionMask |
            kEnterWindowMask | kLeaveWindowMask | kKeyPressMask);
      gVirtualX->SetCursor(fViewer->GetSessionHierarchy()->GetId(), 0);
      return;
   }
   fViewer->UpdateListOfSessions();
   // check if the session already exist before to recreate it
   TList *sessions = fViewer->GetActDesc()->fProofMgr->QuerySessions("");
   if (sessions) {
      TIter nextp(sessions);
      // loop over existing Proof sessions
      while ((desc = (TProofDesc *)nextp())) {
         if ((desc->GetName() == fViewer->GetActDesc()->fTag) ||
             (desc->GetTitle() == fViewer->GetActDesc()->fName)) {
            fViewer->GetActDesc()->fProof =
               fViewer->GetActDesc()->fProofMgr->AttachSession(desc->GetLocalId(), kTRUE);
            fViewer->GetActDesc()->fTag = desc->GetName();
            fViewer->GetActDesc()->fProof->SetAlias(fViewer->GetActDesc()->fName);
            fViewer->GetActDesc()->fConnected = kTRUE;
            fViewer->GetActDesc()->fAttached = kTRUE;

            if (fViewer->GetOptionsMenu()->IsEntryChecked(kOptionsFeedback)) {
               Int_t i = 0;
               // browse list of feedback histos and check user's selected ones
               while (kFeedbackHistos[i]) {
                  if (fViewer->GetCascadeMenu()->IsEntryChecked(41+i)) {
                     fViewer->GetActDesc()->fProof->AddFeedback(kFeedbackHistos[i]);
                     fViewer->GetActDesc()->fNbHistos++;
                  }
                  i++;
               }
               // connect feedback signal
               fViewer->GetActDesc()->fProof->Connect("Feedback(TList *objs)",
                           "TSessionQueryFrame", fViewer->GetQueryFrame(),
                           "Feedback(TList *objs)");
               gROOT->Time();
            }
            else {
               // if feedback option not selected, clear Proof's feedback option
               fViewer->GetActDesc()->fProof->ClearFeedback();
            }

            break;
         }
      }
   }
   if (fViewer->GetActDesc()->fProof == 0) {
      if (fViewer->GetActDesc()->fProofMgr->IsValid()) {
         fViewer->GetActDesc()->fProof = fViewer->GetActDesc()->fProofMgr->CreateSession(
         fViewer->GetActDesc()->fConfigFile);
         desc = 0;
         sessions = fViewer->GetActDesc()->fProofMgr->QuerySessions("");
         if (sessions)
            desc = (TProofDesc *)sessions->Last();
         if (desc) {
            fViewer->GetActDesc()->fProof->SetAlias(fViewer->GetActDesc()->fName);
            fViewer->GetActDesc()->fTag = desc->GetName();
            fViewer->GetActDesc()->fConnected = kTRUE;
            fViewer->GetActDesc()->fAttached = kTRUE;
         }
      }
   }
   if (fViewer->GetActDesc()->fProof) {
      fViewer->GetActDesc()->fConfigFile = fViewer->GetActDesc()->fProof->GetConfFile();
      fViewer->GetActDesc()->fUserName   = fViewer->GetActDesc()->fProof->GetUser();
      fViewer->GetActDesc()->fPort       = fViewer->GetActDesc()->fProof->GetPort();
      fViewer->GetActDesc()->fLogLevel   = fViewer->GetActDesc()->fProof->GetLogLevel();
      if (fViewer->GetActDesc()->fLogLevel < 0)
         fViewer->GetActDesc()->fLogLevel = 0;
      if (fViewer->GetActDesc()->fProof->IsLite())
         fViewer->GetActDesc()->fAddress = "lite://";
      else
         fViewer->GetActDesc()->fAddress = fViewer->GetActDesc()->fProof->GetMaster();
      fViewer->GetActDesc()->fConnected = kTRUE;
      fViewer->GetActDesc()->fProof->SetBit(TProof::kUsingSessionGui);
   }
   fViewer->UpdateListOfSessions();

   // check if connected and valid
   if (fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid()) {
      // set log level
      fViewer->GetActDesc()->fProof->SetLogLevel(fViewer->GetActDesc()->fLogLevel);
      // set query type (synch / asynch)
      fViewer->GetActDesc()->fProof->SetQueryMode(fViewer->GetActDesc()->fSync ?
                             TProof::kSync : TProof::kAsync);
      // set connected flag
      fViewer->GetActDesc()->fConnected = kTRUE;
      // change list tree item picture to connected pixmap
      TGListTreeItem *item = fViewer->GetSessionHierarchy()->FindChildByData(
                              fViewer->GetSessionItem(),fViewer->GetActDesc());
      if (item) {
         item->SetPictures(fViewer->GetProofConPict(), fViewer->GetProofConPict());
         // update viewer
         fViewer->OnListTreeClicked(item, 1, 0, 0);
         fViewer->GetSessionHierarchy()->ClearViewPort();
         fClient->NeedRedraw(fViewer->GetSessionHierarchy());
      }
      // connect to progress related signals
      fViewer->GetActDesc()->fProof->Connect("Progress(Long64_t,Long64_t)",
                 "TSessionQueryFrame", fViewer->GetQueryFrame(),
                 "Progress(Long64_t,Long64_t)");
      fViewer->GetActDesc()->fProof->Connect("Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)",
                 "TSessionQueryFrame", fViewer->GetQueryFrame(),
                 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)");
      fViewer->GetActDesc()->fProof->Connect("Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)",
                 "TSessionQueryFrame", fViewer->GetQueryFrame(),
                 "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)");
      fViewer->GetActDesc()->fProof->Connect("StopProcess(Bool_t)",
                 "TSessionQueryFrame", fViewer->GetQueryFrame(),
                 "IndicateStop(Bool_t)");
      fViewer->GetActDesc()->fProof->Connect(
                 "ResetProgressDialog(const char*,Int_t,Long64_t,Long64_t)",
                 "TSessionQueryFrame", fViewer->GetQueryFrame(),
                 "ResetProgressDialog(const char*,Int_t,Long64_t,Long64_t)");
      // enable timer used for status bar icon's animation
      fViewer->EnableTimer();
      // change status bar right icon to connected pixmap
      fViewer->ChangeRightLogo("monitor01.xpm");
      // do not animate yet
      fViewer->SetChangePic(kFALSE);
      // connect to signal "query result ready"
      fViewer->GetActDesc()->fProof->Connect("QueryResultReady(char *)",
                       "TSessionViewer", fViewer, "QueryResultReady(char *)");
      // display connection information on status bar
      TString msg;
      msg.Form("PROOF Cluster %s ready", fViewer->GetActDesc()->fName.Data());
      fViewer->GetStatusBar()->SetText(msg.Data(), 1);
      fViewer->GetSessionFrame()->ProofInfos();
      fViewer->UpdateListOfPackages();
      fViewer->GetSessionFrame()->UpdateListOfDataSets();
      // Enable previously uploaded packages if in auto-enable mode
      if (fViewer->GetActDesc()->fAutoEnable) {
         TPackageDescription *package;
         TIter next(fViewer->GetActDesc()->fPackages);
         while ((package = (TPackageDescription *)next())) {
            if (!package->fEnabled) {
               if (fViewer->GetActDesc()->fProof->EnablePackage(package->fName) != 0)
                  Error("Submit", "Enable package failed");
               else {
                  package->fEnabled = kTRUE;
                  fViewer->GetSessionFrame()->UpdatePackages();
               }
            }
         }
      }
   }
   // hide connection progress bar from status bar
   fViewer->GetStatusBar()->GetBarPart(0)->HideFrame(fViewer->GetConnectProg());
   // release busy flag
   fViewer->SetBusy(kFALSE);
   // restore cursors and input
   gVirtualX->SetCursor(GetId(), 0);
   gVirtualX->GrabButton(fViewer->GetSessionHierarchy()->GetId(), kAnyButton,
         kAnyModifier, kButtonPressMask | kButtonReleaseMask, kNone, kNone);
   fViewer->GetSessionHierarchy()->AddInput(kPointerMotionMask |
         kEnterWindowMask | kLeaveWindowMask | kKeyPressMask);
   gVirtualX->SetCursor(fViewer->GetSessionHierarchy()->GetId(), 0);
}

//______________________________________________________________________________
void TSessionServerFrame::OnBtnNewServerClicked()
{
   // Reset server configuration fields.

   // do nothing if connection in progress
   if (fViewer->IsBusy())
      return;
   fViewer->GetSessionHierarchy()->ClearHighlighted();
   fViewer->GetSessionHierarchy()->OpenItem(fViewer->GetSessionItem());
   fViewer->GetSessionHierarchy()->HighlightItem(fViewer->GetSessionItem());
   fViewer->GetSessionHierarchy()->SetSelected(fViewer->GetSessionItem());
   fViewer->OnListTreeClicked(fViewer->GetSessionItem(), 1, 0, 0);
   fViewer->GetSessionHierarchy()->ClearViewPort();
   fClient->NeedRedraw(fViewer->GetSessionHierarchy());
   fTxtName->SetText("");
   fTxtAddress->SetText("");
   fTxtConfig->SetText("");
   fNumPort->SetIntNumber(1093);
   fLogLevel->SetIntNumber(0);
   fTxtUsrName->SetText("");
}

//______________________________________________________________________________
void TSessionServerFrame::OnBtnAddClicked()
{
   // Add newly created session configuration in the list of sessions.

   Int_t retval;
   Bool_t newSession = kTRUE;
   TSessionDescription* desc = 0;
   // do nothing if connection in progress
   if (fViewer->IsBusy())
      return;

   if ((!fTxtName->GetBuffer()->GetTextLength()) ||
       (!fTxtAddress->GetBuffer()->GetTextLength()) ||
       (!fTxtUsrName->GetBuffer()->GetTextLength())) {
      new TGMsgBox(fClient->GetRoot(), fViewer, "Error Adding Session",
                   "At least one required field is empty !",
                    kMBIconExclamation, kMBOk, &retval);
      return;
   }
   TObject *obj = fViewer->GetSessions()->FindObject(fTxtName->GetText());
   if (obj)
      desc = dynamic_cast<TSessionDescription*>(obj);
   if (desc) {
      new TGMsgBox(fClient->GetRoot(), fViewer, "Adding Session",
                   TString::Format("The session \"%s\" already exists ! Overwrite ?",
                   fTxtName->GetText()), kMBIconQuestion, kMBYes | kMBNo |
                   kMBCancel, &retval);
      if (retval != kMBYes)
         return;
      newSession = kFALSE;
   }
   if (newSession) {
      desc = new TSessionDescription();
      desc->fName = fTxtName->GetText();
      desc->fTag = "";
      desc->fQueries = new TList();
      desc->fPackages = new TList();
      desc->fActQuery = 0;
      desc->fProof = 0;
      desc->fProofMgr = 0;
      desc->fAutoEnable = kFALSE;
      desc->fAddress = fTxtAddress->GetText();
      desc->fPort = fNumPort->GetIntNumber();
      desc->fConnected = kFALSE;
      desc->fAttached = kFALSE;
      desc->fLocal = kFALSE;
      if (strlen(fTxtConfig->GetText()) > 1)
         desc->fConfigFile = TString(fTxtConfig->GetText());
      else
         desc->fConfigFile = "";
      desc->fLogLevel = fLogLevel->GetIntNumber();
      desc->fUserName = fTxtUsrName->GetText();
      desc->fSync = (fSync->GetState() == kButtonDown);
      // add newly created session config to our session list
      fViewer->GetSessions()->Add((TObject *)desc);
      // save into configuration file
      TGListTreeItem *item = fViewer->GetSessionHierarchy()->AddItem(
            fViewer->GetSessionItem(), desc->fName.Data(),
            fViewer->GetProofDisconPict(), fViewer->GetProofDisconPict());
      fViewer->GetSessionHierarchy()->SetToolTipItem(item, "Proof Session");
      item->SetUserData(desc);
      fViewer->GetSessionHierarchy()->ClearHighlighted();
      fViewer->GetSessionHierarchy()->OpenItem(fViewer->GetSessionItem());
      fViewer->GetSessionHierarchy()->OpenItem(item);
      fViewer->GetSessionHierarchy()->HighlightItem(item);
      fViewer->GetSessionHierarchy()->SetSelected(item);
      fViewer->GetSessionHierarchy()->ClearViewPort();
      fClient->NeedRedraw(fViewer->GetSessionHierarchy());
      fViewer->OnListTreeClicked(item, 1, 0, 0);
   }
   else {
      fViewer->GetActDesc()->fName = fTxtName->GetText();
      fViewer->GetActDesc()->fAddress = fTxtAddress->GetText();
      fViewer->GetActDesc()->fPort = fNumPort->GetIntNumber();
      if (strlen(fTxtConfig->GetText()) > 1)
         fViewer->GetActDesc()->fConfigFile = TString(fTxtConfig->GetText());
      fViewer->GetActDesc()->fLogLevel = fLogLevel->GetIntNumber();
      fViewer->GetActDesc()->fUserName = fTxtUsrName->GetText();
      fViewer->GetActDesc()->fSync = (fSync->GetState() == kButtonDown);
      TGListTreeItem *item2 = fViewer->GetSessionHierarchy()->GetSelected();
      item2->SetUserData(fViewer->GetActDesc());
      fViewer->OnListTreeClicked(fViewer->GetSessionHierarchy()->GetSelected(),
                                 1, 0, 0);
   }
   HideFrame(fBtnAdd);
   ShowFrame(fBtnConnect);
   if (fViewer->IsAutoSave())
      fViewer->WriteConfiguration();
}

//______________________________________________________________________________
void TSessionServerFrame::Update(TSessionDescription* desc)
{
   // Update fields with values from session description desc.

   if (desc->fLocal) {
      fTxtName->SetText("");
      fTxtAddress->SetText("");
      fNumPort->SetIntNumber(1093);
      fTxtConfig->SetText("");
      fTxtUsrName->SetText("");
      fLogLevel->SetIntNumber(0);
      return;
   }

   fTxtName->SetText(desc->fName);
   fTxtAddress->SetText(desc->fAddress);
   fNumPort->SetIntNumber(desc->fPort);
   fLogLevel->SetIntNumber(desc->fLogLevel);

   if (desc->fConfigFile.Length() > 1) {
      fTxtConfig->SetText(desc->fConfigFile);
   }
   else {
      fTxtConfig->SetText("");
   }
   fTxtUsrName->SetText(desc->fUserName);
}

//______________________________________________________________________________
Bool_t TSessionServerFrame::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
{
   // Process messages for session server frame.
   // Used to navigate between text entry fields.

   switch (GET_MSG(msg)) {
      case kC_TEXTENTRY:
         switch (GET_SUBMSG(msg)) {
            case kTE_ENTER:
            case kTE_TAB:
               switch (parm1) {
                  case 1: // session name
                     fTxtAddress->SelectAll();
                     fTxtAddress->SetFocus();
                     break;
                  case 2: // server address
                     fNumPort->GetNumberEntry()->SelectAll();
                     fNumPort->GetNumberEntry()->SetFocus();
                     break;
                  case 3: // port number
                     fTxtConfig->SelectAll();
                     fTxtConfig->SetFocus();
                     break;
                  case 4: // configuration file
                     fLogLevel->GetNumberEntry()->SelectAll();
                     fLogLevel->GetNumberEntry()->SetFocus();
                     break;
                  case 5: // log level
                     fTxtUsrName->SelectAll();
                     fTxtUsrName->SetFocus();
                     break;
                  case 6: // user name
                     fTxtName->SelectAll();
                     fTxtName->SetFocus();
                     break;
               }
               break;

            default:
               break;
         }
         break;

      default:
         break;
   }
   return kTRUE;
}

////////////////////////////////////////////////////////////////////////////////
// Session Frame

//______________________________________________________________________________
TSessionFrame::TSessionFrame(TGWindow* p, Int_t w, Int_t h) :
   TGCompositeFrame(p, w, h), fTab(0), fFA(0), fFB(0), fFC(0), fFD(0), fFE(0),
   fCommandTxt(0), fCommandBuf(0), fInfoTextView(0), fClearCheck(0),
   fBtnShowLog(0), fBtnNewQuery(0), fBtnGetQueries(0), fLBPackages(0),
   fBtnAdd(0), fBtnRemove(0), fBtnUp(0), fBtnDown(0), fBtnShow(0),
   fBtnShowEnabled(0), fChkMulti(0), fChkEnable(0), fBtnUpload(0),
   fBtnEnable(0), fBtnClear(0), fBtnDisable(0), fDSetView(0), fDataSetTree(0),
   fBtnUploadDSet(0), fBtnRemoveDSet(0), fBtnVerifyDSet(0), fBtnRefresh(0),
   fTxtParallel(0), fLogLevel(0), fApplyLogLevel(0), fApplyParallel(0),
   fViewer(0)
{
   // Constructor.

   for (int i=0;i<19;++i) fInfoLine[i] = 0;
}

//______________________________________________________________________________
TSessionFrame::~TSessionFrame()
{
   // Destructor.

   Cleanup();
}

//______________________________________________________________________________
void TSessionFrame::Build(TSessionViewer *gui)
{
   // Build session frame.

   SetLayoutManager(new TGVerticalLayout(this));
   SetCleanup(kDeepCleanup);
   fViewer  = gui;
   Int_t i,j;

   // main session tab
   fTab = new TGTab(this, 200, 200);
   AddFrame(fTab, new TGLayoutHints(kLHintsTop | kLHintsExpandX |
         kLHintsExpandY, 2, 2, 2, 2));

   // add "Status" tab element
   TGCompositeFrame *tf = fTab->AddTab("Status");
   fFA = new TGCompositeFrame(tf, 100, 100, kVerticalFrame);
   tf->AddFrame(fFA, new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX | kLHintsExpandY));

   // add first session information line
   fInfoLine[0] = new TGLabel(fFA, " ");
   fFA->AddFrame(fInfoLine[0], new TGLayoutHints(kLHintsCenterX |
         kLHintsExpandX, 5, 5, 15, 5));

   TGCompositeFrame* frmInfos = new TGHorizontalFrame(fFA, 350, 100);
   frmInfos->SetLayoutManager(new TGTableLayout(frmInfos, 9, 2));

   // add session information lines
   j = 0;
   for (i=0;i<17;i+=2) {
      fInfoLine[i+1] = new TGLabel(frmInfos, " ");
      frmInfos->AddFrame(fInfoLine[i+1], new TGTableLayoutHints(0, 1, j, j+1,
            kLHintsLeft | kLHintsCenterY, 5, 5, 2, 2));
      fInfoLine[i+2] = new TGLabel(frmInfos, " ");
      frmInfos->AddFrame(fInfoLine[i+2], new TGTableLayoutHints(1, 2, j, j+1,
            kLHintsLeft | kLHintsCenterY, 5, 5, 2, 2));
      j++;
   }
   fFA->AddFrame(frmInfos, new TGLayoutHints(kLHintsLeft | kLHintsTop |
         kLHintsExpandX  | kLHintsExpandY, 5, 5, 5, 5));

   // add "new query" and "get queries" buttons
   TGCompositeFrame* frmBut1 = new TGHorizontalFrame(fFA, 350, 100);
   frmBut1->SetCleanup(kDeepCleanup);
   frmBut1->AddFrame(fBtnNewQuery = new TGTextButton(frmBut1, "New Query..."),
         new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5));
   fBtnNewQuery->SetToolTipText("Open New Query Dialog");
   frmBut1->AddFrame(fBtnGetQueries = new TGTextButton(frmBut1, " Get Queries "),
         new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5));
   fBtnGetQueries->SetToolTipText("Get List of Queries from the server");
   fBtnShowLog = new TGTextButton(frmBut1, "Show log...");
   fBtnShowLog->SetToolTipText("Show Session log (opens log window)");
   frmBut1->AddFrame(fBtnShowLog, new TGLayoutHints(kLHintsLeft |
         kLHintsExpandX, 5, 5, 5, 5));
   fFA->AddFrame(frmBut1, new TGLayoutHints(kLHintsLeft | kLHintsBottom |
         kLHintsExpandX));

   // add "Commands" tab element
   tf = fTab->AddTab("Commands");
   fFC = new TGCompositeFrame(tf, 100, 100, kVerticalFrame);
   tf->AddFrame(fFC, new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX | kLHintsExpandY));

   // add command line label and text entry
   TGCompositeFrame* frmCmd = new TGHorizontalFrame(fFC, 350, 100);
   frmCmd->SetCleanup(kDeepCleanup);
   frmCmd->AddFrame(new TGLabel(frmCmd, "Command Line :"),
         new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5, 5, 15, 5));
   fCommandBuf = new TGTextBuffer(120);
   frmCmd->AddFrame(fCommandTxt = new TGTextEntry(frmCmd,
         fCommandBuf ),new TGLayoutHints(kLHintsLeft | kLHintsCenterY |
         kLHintsExpandX, 5, 5, 15, 5));
   fFC->AddFrame(frmCmd, new TGLayoutHints(kLHintsExpandX, 5, 5, 10, 5));
   // connect command line text entry to "return pressed" signal
   fCommandTxt->Connect("ReturnPressed()", "TSessionFrame", this,
         "OnCommandLine()");

   // check box for option "clear view"
   fClearCheck = new TGCheckButton(fFC, "Clear view after each command");
   fFC->AddFrame(fClearCheck,new TGLayoutHints(kLHintsLeft | kLHintsTop,
         10, 5, 5, 5));
   fClearCheck->SetState(kButtonUp);
   // add text view for redirected output
   fFC->AddFrame(new TGLabel(fFC, "Output :"),
      new TGLayoutHints(kLHintsLeft | kLHintsTop, 10, 5, 5, 5));
   fInfoTextView = new TGTextView(fFC, 330, 150, "", kSunkenFrame |
         kDoubleBorder);
   fFC->AddFrame(fInfoTextView, new TGLayoutHints(kLHintsLeft |
         kLHintsTop | kLHintsExpandX | kLHintsExpandY, 10, 10, 5, 5));

   // add "Packages" tab element
   tf = fTab->AddTab("Packages");
   fFB = new TGCompositeFrame(tf, 100, 100, kVerticalFrame);
   tf->AddFrame(fFB, new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX | kLHintsExpandY));

   // new frame containing packages listbox and control buttons
   TGCompositeFrame* frmcanvas = new TGHorizontalFrame(fFB, 350, 100);

   // packages listbox
   fLBPackages = new TGListBox(frmcanvas);
   fLBPackages->Resize(80,150);
   fLBPackages->SetMultipleSelections(kFALSE);
   frmcanvas->AddFrame(fLBPackages, new TGLayoutHints(kLHintsExpandX |
         kLHintsExpandY, 5, 5, 5, 5));
   // control buttons frame
   TGCompositeFrame* frmBut2 = new TGVerticalFrame(frmcanvas, 150, 100);

   fChkMulti = new TGCheckButton(frmBut2, "Multiple Selection");
   fChkMulti->SetToolTipText("Enable multiple selection in the package list");
   frmBut2->AddFrame(fChkMulti, new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));

   fBtnAdd = new TGTextButton(frmBut2, "     Add...     ");
   fBtnAdd->SetToolTipText("Add a package to the list");
   frmBut2->AddFrame(fBtnAdd,new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX, 5, 5, 5, 5));
   fBtnRemove = new TGTextButton(frmBut2, "Remove");
   fBtnRemove->SetToolTipText("Remove package from the list");
   frmBut2->AddFrame(fBtnRemove,new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX, 5, 5, 5, 5));
   fBtnUp = new TGTextButton(frmBut2, "Move Up");
   fBtnUp->SetToolTipText("Move package one step upward in the list");
   frmBut2->AddFrame(fBtnUp,new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX, 5, 5, 5, 5));
   fBtnDown = new TGTextButton(frmBut2, "Move Down");
   fBtnDown->SetToolTipText("Move package one step downward in the list");
   frmBut2->AddFrame(fBtnDown,new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX, 5, 5, 5, 5));
   frmcanvas->AddFrame(frmBut2, new TGLayoutHints(kLHintsLeft | kLHintsCenterY |
         kLHintsExpandY));
   fFB->AddFrame(frmcanvas, new TGLayoutHints(kLHintsLeft | kLHintsTop |
         kLHintsExpandX | kLHintsExpandY));

   TGCompositeFrame* frmLeg = new TGHorizontalFrame(fFB, 300, 100);
   frmLeg->SetCleanup(kDeepCleanup);
   TGPicture *pic1 = (TGPicture *)fClient->GetPicture("package.xpm");
   TGIcon *icn1 = new TGIcon(frmLeg, pic1, pic1->GetWidth(), pic1->GetHeight());
   frmLeg->AddFrame(icn1, new TGLayoutHints(kLHintsLeft | kLHintsTop,
         5, 5, 0, 5));
   frmLeg->AddFrame(new TGLabel(frmLeg, ": Local"),
         new TGLayoutHints(kLHintsLeft | kLHintsTop, 0, 10, 0, 5));

   TGPicture *pic2 = (TGPicture *)fClient->GetPicture("package_delete.xpm");
   TGIcon *icn2 = new TGIcon(frmLeg, pic2, pic2->GetWidth(), pic2->GetHeight());
   frmLeg->AddFrame(icn2, new TGLayoutHints(kLHintsLeft | kLHintsTop,
         5, 5, 0, 5));
   frmLeg->AddFrame(new TGLabel(frmLeg, ": Uploaded"),
         new TGLayoutHints(kLHintsLeft | kLHintsTop, 0, 10, 0, 5));

   TGPicture *pic3 = (TGPicture *)fClient->GetPicture("package_add.xpm");
   TGIcon *icn3 = new TGIcon(frmLeg, pic3, pic3->GetWidth(), pic3->GetHeight());
   frmLeg->AddFrame(icn3, new TGLayoutHints(kLHintsLeft | kLHintsTop,
         5, 5, 0, 5));
   frmLeg->AddFrame(new TGLabel(frmLeg, ": Enabled"),
         new TGLayoutHints(kLHintsLeft | kLHintsTop, 0, 10, 0, 5));
   fFB->AddFrame(frmLeg, new TGLayoutHints(kLHintsLeft | kLHintsTop |
         kLHintsExpandX, 0, 0, 0, 0));

   TGCompositeFrame* frmBtn = new TGHorizontalFrame(fFB, 300, 100);
   frmBtn->SetCleanup(kDeepCleanup);
   frmBtn->AddFrame(fBtnUpload = new TGTextButton(frmBtn,
         " Upload "), new TGLayoutHints(kLHintsLeft | kLHintsExpandX |
         kLHintsCenterY, 5, 5, 5, 5));
   fBtnUpload->SetToolTipText("Upload selected package(s) to the server");
   frmBtn->AddFrame(fBtnEnable = new TGTextButton(frmBtn,
         " Enable "), new TGLayoutHints(kLHintsLeft | kLHintsExpandX |
         kLHintsCenterY, 5, 5, 5, 5));
   fBtnEnable->SetToolTipText("Enable selected package(s) on the server");
   frmBtn->AddFrame(fBtnDisable = new TGTextButton(frmBtn,
         " Disable "), new TGLayoutHints(kLHintsLeft | kLHintsExpandX |
         kLHintsCenterY, 5, 5, 5, 5));
   fBtnDisable->SetToolTipText("Disable selected package(s) on the server");
   frmBtn->AddFrame(fBtnClear = new TGTextButton(frmBtn,
         " Clear "), new TGLayoutHints(kLHintsLeft | kLHintsExpandX |
         kLHintsCenterY, 5, 5, 5, 5));
   fBtnClear->SetToolTipText("Clear all packages on the server");
   fFB->AddFrame(frmBtn, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));

   fBtnClear->SetEnabled(kFALSE);

   TGCompositeFrame* frmBtn3 = new TGHorizontalFrame(fFB, 300, 100);
   frmBtn3->SetCleanup(kDeepCleanup);
   fBtnShow = new TGTextButton(frmBtn3, "Show packages");
   fBtnShow->SetToolTipText("Show (list) available packages on the server");
   frmBtn3->AddFrame(fBtnShow,new TGLayoutHints(kLHintsCenterY | kLHintsLeft |
         kLHintsExpandX, 5, 5, 5, 5));
   fBtnShowEnabled = new TGTextButton(frmBtn3, "Show Enabled");
   fBtnShowEnabled->SetToolTipText("Show (list) enabled packages on the server");
   frmBtn3->AddFrame(fBtnShowEnabled,new TGLayoutHints(kLHintsCenterY | kLHintsLeft |
         kLHintsExpandX, 5, 5, 5, 5));
   fFB->AddFrame(frmBtn3, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));

   fChkEnable = new TGCheckButton(fFB, "Enable at session startup");
   fChkEnable->SetToolTipText("Enable packages on the server at startup time");
   fFB->AddFrame(fChkEnable, new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));

   // add "DataSets" tab element
   tf = fTab->AddTab("DataSets");
   fFE = new TGCompositeFrame(tf, 100, 100, kVerticalFrame);
   tf->AddFrame(fFE, new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX | kLHintsExpandY));

   // new frame containing datasets treeview and control buttons
   TGCompositeFrame* frmdataset = new TGHorizontalFrame(fFE, 350, 100);

   // datasets list tree
   fDSetView = new TGCanvas(frmdataset, 200, 200, kSunkenFrame | kDoubleBorder);
   frmdataset->AddFrame(fDSetView, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
         5, 5, 5, 5));
   fDataSetTree = new TGListTree(fDSetView, kHorizontalFrame);
   fDataSetTree->AddItem(0, "DataSets");

   // control buttons frame
   TGCompositeFrame* frmBut3 = new TGVerticalFrame(frmdataset, 150, 100);

   fBtnUploadDSet = new TGTextButton(frmBut3, "     Upload...     ");
   fBtnUploadDSet->SetToolTipText("Upload a dataset to the cluster");
   frmBut3->AddFrame(fBtnUploadDSet, new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX, 5, 5, 5, 5));
   fBtnRemoveDSet = new TGTextButton(frmBut3, "Remove");
   fBtnRemoveDSet->SetToolTipText("Remove dataset from the cluster");
   frmBut3->AddFrame(fBtnRemoveDSet,new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX, 5, 5, 5, 5));
   fBtnVerifyDSet = new TGTextButton(frmBut3, "Verify");
   fBtnVerifyDSet->SetToolTipText("Verify dataset on the cluster");
   frmBut3->AddFrame(fBtnVerifyDSet,new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX, 5, 5, 5, 5));
   fBtnRefresh = new TGTextButton(frmBut3, "Refresh List");
   fBtnRefresh->SetToolTipText("Refresh List of DataSet/Files present on the cluster");
   frmBut3->AddFrame(fBtnRefresh,new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX, 5, 5, 15, 5));

   frmdataset->AddFrame(frmBut3, new TGLayoutHints(kLHintsLeft | kLHintsCenterY |
         kLHintsExpandY, 5, 5, 5, 0));

   fFE->AddFrame(frmdataset, new TGLayoutHints(kLHintsLeft | kLHintsTop |
         kLHintsExpandX | kLHintsExpandY));

   // add "Options" tab element
   tf = fTab->AddTab("Options");
   fFD = new TGCompositeFrame(tf, 100, 100, kVerticalFrame);
   tf->AddFrame(fFD, new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX | kLHintsExpandY));

   // add Log Level label and text entry
   TGCompositeFrame* frmLog = new TGHorizontalFrame(fFD, 310, 100, kFixedWidth);
   frmLog->SetCleanup(kDeepCleanup);
   frmLog->AddFrame(fApplyLogLevel = new TGTextButton(frmLog,
         "        Apply        "), new TGLayoutHints(kLHintsRight |
         kLHintsCenterY, 10, 5, 5, 5));
   fApplyLogLevel->SetToolTipText("Apply currently selected log level");
   fLogLevel = new TGNumberEntry(frmLog, 0, 5, 5, TGNumberFormat::kNESInteger,
         TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, 5);
   frmLog->AddFrame(fLogLevel, new TGLayoutHints(kLHintsRight |
         kLHintsCenterY, 5, 5, 5, 5));
   frmLog->AddFrame(new TGLabel(frmLog, "Log Level :"),
         new TGLayoutHints(kLHintsRight | kLHintsCenterY, 5, 5, 5, 5));
   fFD->AddFrame(frmLog, new TGLayoutHints(kLHintsLeft, 5, 5, 15, 5));

   // add Parallel Nodes label and text entry
   TGCompositeFrame* frmPar = new TGHorizontalFrame(fFD, 310, 100, kFixedWidth);
   frmPar->SetCleanup(kDeepCleanup);
   frmPar->AddFrame(fApplyParallel = new TGTextButton(frmPar,
         "        Apply        "), new TGLayoutHints(kLHintsRight |
         kLHintsCenterY, 10, 5, 5, 5));
   fApplyParallel->SetToolTipText("Apply currently selected parallel nodes");
   fTxtParallel = new TGTextEntry(frmPar);
   fTxtParallel->SetAlignment(kTextRight);
   fTxtParallel->SetText("99999");
   fTxtParallel->Resize(fLogLevel->GetDefaultWidth(), fTxtParallel->GetDefaultHeight());
   frmPar->AddFrame(fTxtParallel, new TGLayoutHints(kLHintsRight |
         kLHintsCenterY, 5, 5, 5, 5));
   frmPar->AddFrame(new TGLabel(frmPar, "Set Parallel Nodes :"),
         new TGLayoutHints(kLHintsRight | kLHintsCenterY, 5, 5, 5, 5));
   fFD->AddFrame(frmPar, new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));

   // connect button actions to functions
   fBtnShowLog->Connect("Clicked()", "TSessionFrame", this,
         "OnBtnShowLogClicked()");
   fBtnNewQuery->Connect("Clicked()", "TSessionFrame", this,
         "OnBtnNewQueryClicked()");
   fBtnGetQueries->Connect("Clicked()", "TSessionFrame", this,
         "OnBtnGetQueriesClicked()");

   fChkEnable->Connect("Toggled(Bool_t)", "TSessionFrame", this,
         "OnStartupEnable(Bool_t)");
   fChkMulti->Connect("Toggled(Bool_t)", "TSessionFrame", this,
         "OnMultipleSelection(Bool_t)");
   fBtnAdd->Connect("Clicked()", "TSessionFrame", this,
         "OnBtnAddClicked()");
   fBtnRemove->Connect("Clicked()", "TSessionFrame", this,
         "OnBtnRemoveClicked()");
   fBtnUp->Connect("Clicked()", "TSessionFrame", this,
         "OnBtnUpClicked()");
   fBtnDown->Connect("Clicked()", "TSessionFrame", this,
         "OnBtnDownClicked()");
   fApplyLogLevel->Connect("Clicked()", "TSessionFrame", this,
         "OnApplyLogLevel()");
   fApplyParallel->Connect("Clicked()", "TSessionFrame", this,
         "OnApplyParallel()");
   fBtnUpload->Connect("Clicked()", "TSessionFrame", this,
         "OnUploadPackages()");
   fBtnEnable->Connect("Clicked()", "TSessionFrame", this,
         "OnEnablePackages()");
   fBtnDisable->Connect("Clicked()", "TSessionFrame", this,
         "OnDisablePackages()");
   fBtnClear->Connect("Clicked()", "TSessionFrame", this,
         "OnClearPackages()");
   fBtnShowEnabled->Connect("Clicked()", "TSessionViewer", fViewer,
         "ShowEnabledPackages()");
   fBtnShow->Connect("Clicked()", "TSessionViewer", fViewer,
         "ShowPackages()");

   fBtnUploadDSet->Connect("Clicked()", "TSessionFrame", this,
         "OnBtnUploadDSet()");
   fBtnRemoveDSet->Connect("Clicked()", "TSessionFrame", this,
         "OnBtnRemoveDSet()");
   fBtnVerifyDSet->Connect("Clicked()", "TSessionFrame", this,
         "OnBtnVerifyDSet()");
   fBtnRefresh->Connect("Clicked()", "TSessionFrame", this,
         "UpdateListOfDataSets()");
}

//______________________________________________________________________________
void TSessionFrame::ProofInfos()
{
   // Display information on current session.

   TString buf;

   // if local session
   if (fViewer->GetActDesc()->fLocal) {
      buf.Form("*** Local Session on %s ***", gSystem->HostName());
      fInfoLine[0]->SetText(buf.Data());
      UserGroup_t *userGroup = gSystem->GetUserInfo();
      fInfoLine[1]->SetText("User :");
      if (userGroup) buf.Form("%s", userGroup->fRealName.Data());
      fInfoLine[2]->SetText(buf.Data());
      fInfoLine[3]->SetText("Working directory :");
      buf.Form("%s", gSystem->WorkingDirectory());
      fInfoLine[4]->SetText(buf.Data());
      fInfoLine[5]->SetText(" ");
      fInfoLine[6]->SetText(" ");
      fInfoLine[7]->SetText(" ");
      fInfoLine[8]->SetText(" ");
      fInfoLine[9]->SetText(" ");
      fInfoLine[10]->SetText(" ");
      fInfoLine[11]->SetText(" ");
      fInfoLine[12]->SetText(" ");
      fInfoLine[13]->SetText(" ");
      fInfoLine[14]->SetText(" ");
      fInfoLine[15]->SetText(" ");
      fInfoLine[16]->SetText(" ");
      fInfoLine[17]->SetText(" ");
      fInfoLine[18]->SetText(" ");
      if (userGroup) delete userGroup;
      Layout();
      Resize(GetDefaultSize());
      return;
   }
   // return if not a valid Proof session
   if (!fViewer->GetActDesc()->fConnected ||
       !fViewer->GetActDesc()->fAttached ||
       !fViewer->GetActDesc()->fProof ||
       !fViewer->GetActDesc()->fProof->IsValid())
      return;

   if (!fViewer->GetActDesc()->fProof->IsMaster()) {
      if (fViewer->GetActDesc()->fProof->IsParallel())
         buf.Form("*** Connected to %s (parallel mode, %d workers) ***",
               fViewer->GetActDesc()->fProof->GetMaster(),
               fViewer->GetActDesc()->fProof->GetParallel());
      else
         buf.Form("*** Connected to %s (sequential mode) ***",
               fViewer->GetActDesc()->fProof->GetMaster());
      fInfoLine[0]->SetText(buf.Data());
      fInfoLine[1]->SetText("Port number : ");
      buf.Form("%d", fViewer->GetActDesc()->fProof->GetPort());
      fInfoLine[2]->SetText(buf.Data());
      fInfoLine[3]->SetText("User : ");
      buf.Form("%s", fViewer->GetActDesc()->fProof->GetUser());
      fInfoLine[4]->SetText(buf.Data());
      fInfoLine[5]->SetText("Client protocol version : ");
      buf.Form("%d", fViewer->GetActDesc()->fProof->GetClientProtocol());
      fInfoLine[6]->SetText(buf.Data());
      fInfoLine[7]->SetText("Remote protocol version : ");
      buf.Form("%d", fViewer->GetActDesc()->fProof->GetRemoteProtocol());
      fInfoLine[8]->SetText(buf.Data());
      fInfoLine[9]->SetText("Log level : ");
      buf.Form("%d", fViewer->GetActDesc()->fProof->GetLogLevel());
      fInfoLine[10]->SetText(buf.Data());
      fInfoLine[11]->SetText("Session unique tag : ");
      buf.Form("%s", fViewer->GetActDesc()->fProof->IsValid() ?
            fViewer->GetActDesc()->fProof->GetSessionTag() : " ");
      fInfoLine[12]->SetText(buf.Data());
      fInfoLine[13]->SetText("Total MB's processed :");
      buf.Form("%.2f", float(fViewer->GetActDesc()->fProof->GetBytesRead())/(1024*1024));
      fInfoLine[14]->SetText(buf.Data());
      fInfoLine[15]->SetText("Total real time used (s) :");
      buf.Form("%.3f", fViewer->GetActDesc()->fProof->GetRealTime());
      fInfoLine[16]->SetText(buf.Data());
      fInfoLine[17]->SetText("Total CPU time used (s) :");
      buf.Form("%.3f", fViewer->GetActDesc()->fProof->GetCpuTime());
      fInfoLine[18]->SetText(buf.Data());
   }
   else {
      if (fViewer->GetActDesc()->fProof->IsParallel())
         buf.Form("*** Master server %s (parallel mode, %d workers) ***",
               fViewer->GetActDesc()->fProof->GetMaster(),
               fViewer->GetActDesc()->fProof->GetParallel());
      else
         buf.Form("*** Master server %s (sequential mode) ***",
               fViewer->GetActDesc()->fProof->GetMaster());
      fInfoLine[0]->SetText(buf.Data());
      fInfoLine[1]->SetText("Port number : ");
      buf.Form("%d", fViewer->GetActDesc()->fProof->GetPort());
      fInfoLine[2]->SetText(buf.Data());
      fInfoLine[3]->SetText("User : ");
      buf.Form("%s", fViewer->GetActDesc()->fProof->GetUser());
      fInfoLine[4]->SetText(buf.Data());
      fInfoLine[5]->SetText("Protocol version : ");
      buf.Form("%d", fViewer->GetActDesc()->fProof->GetClientProtocol());
      fInfoLine[6]->SetText(buf.Data());
      fInfoLine[7]->SetText("Image name : ");
      buf.Form("%s",fViewer->GetActDesc()->fProof->GetImage());
      fInfoLine[8]->SetText(buf.Data());
      fInfoLine[9]->SetText("Config directory : ");
      buf.Form("%s", fViewer->GetActDesc()->fProof->GetConfDir());
      fInfoLine[10]->SetText(buf.Data());
      fInfoLine[11]->SetText("Config file : ");
      buf.Form("%s", fViewer->GetActDesc()->fProof->GetConfFile());
      fInfoLine[12]->SetText(buf.Data());
      fInfoLine[13]->SetText("Total MB's processed :");
      buf.Form("%.2f", float(fViewer->GetActDesc()->fProof->GetBytesRead())/(1024*1024));
      fInfoLine[14]->SetText(buf.Data());
      fInfoLine[15]->SetText("Total real time used (s) :");
      buf.Form("%.3f", fViewer->GetActDesc()->fProof->GetRealTime());
      fInfoLine[16]->SetText(buf.Data());
      fInfoLine[17]->SetText("Total CPU time used (s) :");
      buf.Form("%.3f", fViewer->GetActDesc()->fProof->GetCpuTime());
      fInfoLine[18]->SetText(buf.Data());
   }
   Layout();
   Resize(GetDefaultSize());
}

//______________________________________________________________________________
void TSessionFrame::OnBtnUploadDSet()
{
   // Open Upload Dataset dialog.

   if (fViewer->IsBusy())
      return;
   if (fViewer->GetActDesc()->fLocal) return;
   new TUploadDataSetDlg(fViewer, 450, 360);
}

//______________________________________________________________________________
void TSessionFrame::UpdateListOfDataSets()
{
   // Update list of dataset present on the cluster.

   TObjString *dsetname;
   TFileInfo  *dsetfilename;
   // cleanup the list
   fDataSetTree->DeleteChildren(fDataSetTree->GetFirstItem());
   if (fViewer->GetActDesc()->fConnected && fViewer->GetActDesc()->fAttached &&
       fViewer->GetActDesc()->fProof && fViewer->GetActDesc()->fProof->IsValid() &&
       fViewer->GetActDesc()->fProof->IsParallel()) {

      const TGPicture *dseticon = fClient->GetPicture("rootdb_t.xpm");
      // ask for the list of datasets

      // TODO: is now returning a TMap; viewer has to be adapted
      TList *dsetlist = 0; //fViewer->GetActDesc()->fProof->GetDataSets();
      // coverity[dead_error_condition]: to be changed for TMap usage
      if (dsetlist) {
         TGListTreeItem *dsetitem;
         fDataSetTree->OpenItem(fDataSetTree->GetFirstItem());
         TIter nextdset(dsetlist);
         while ((dsetname = (TObjString *)nextdset())) {
            if (!fDataSetTree->FindItemByObj(fDataSetTree->GetFirstItem(), dsetname)) {
               // add the dataset in the tree
               dsetitem = fDataSetTree->AddItem(fDataSetTree->GetFirstItem(),
                                        dsetname->GetName(), dsetname);
               // ask for the list of files in the dataset
               TList *dsetfilelist = fViewer->GetActDesc()->fProof->GetDataSet(
                                                            dsetname->GetName())->GetList();
               if(dsetfilelist) {
                  TIter nextdsetfile(dsetfilelist);
                  while ((dsetfilename = (TFileInfo *)nextdsetfile())) {
                     if (! fDataSetTree->FindItemByObj(dsetitem, dsetfilename)) {
                        // if not already in, add the file name in the tree
                        fDataSetTree->AddItem(dsetitem,
                           dsetfilename->GetFirstUrl()->GetUrl(),
                           dsetfilename, dseticon, dseticon);
                     }
                  }
                  // open the dataset item in order to show the files
                  fDataSetTree->OpenItem(dsetitem);
               }
            }
         }
      }
   }
   // refresh list tree
   fClient->NeedRedraw(fDataSetTree);
}

//______________________________________________________________________________
void TSessionFrame::OnBtnRemoveDSet()
{
   // Remove dataset from the list and from the cluster.

   TGListTreeItem *item;
   TObjString *obj = 0;
   if (fViewer->GetActDesc()->fLocal) return;

   item = fDataSetTree->GetSelected();
   if (!item) return;
   if (item->GetParent() == 0) return;
   if (item->GetParent() == fDataSetTree->GetFirstItem()) {
      // Dataset itself
      obj = (TObjString *)item->GetUserData();
   }
   else if (item->GetParent()->GetParent() == fDataSetTree->GetFirstItem()) {
      // One file of the dataset
      obj = (TObjString *)item->GetParent()->GetUserData();
   }

   // if valid Proof session, set parallel slaves
   if (obj && fViewer->GetActDesc()->fProof &&
      fViewer->GetActDesc()->fProof->IsValid()) {
      fViewer->GetActDesc()->fProof->RemoveDataSet(obj->GetName());
      UpdateListOfDataSets();
   }
}

//______________________________________________________________________________
void TSessionFrame::OnBtnVerifyDSet()
{
   // Verify that the files in the selected dataset are present on the cluster.

   TGListTreeItem *item;
   TObjString *obj = 0;
   if (fViewer->GetActDesc()->fLocal) return;

   item = fDataSetTree->GetSelected();
   if (!item) return;
   if (item->GetParent() == 0) return;
   if (item->GetParent() == fDataSetTree->GetFirstItem()) {
      // Dataset itself
      obj = (TObjString *)item->GetUserData();
   }
   else if (item->GetParent()->GetParent() == fDataSetTree->GetFirstItem()) {
      // One file of the dataset
      obj = (TObjString *)item->GetParent()->GetUserData();
   }

   // if valid Proof session, set parallel slaves
   if (obj && fViewer->GetActDesc()->fProof &&
      fViewer->GetActDesc()->fProof->IsValid()) {
      fViewer->GetActDesc()->fProof->VerifyDataSet(obj->GetName());
   }
}

//______________________________________________________________________________
void TSessionFrame::OnApplyLogLevel()
{
   // Apply selected log level on current session.

   // if local session, do nothing
   if (fViewer->GetActDesc()->fLocal) return;
   // if valid Proof session, set log level
   if (fViewer->GetActDesc()->fProof &&
      fViewer->GetActDesc()->fProof->IsValid()) {
      fViewer->GetActDesc()->fLogLevel = fLogLevel->GetIntNumber();
      fViewer->GetActDesc()->fProof->SetLogLevel(fViewer->GetActDesc()->fLogLevel);
   }
   fViewer->GetSessionFrame()->ProofInfos();
}

//______________________________________________________________________________
void TSessionFrame::OnApplyParallel()
{
   // Apply selected number of workers on current Proof session.

   // if local session, do nothing
   if (fViewer->GetActDesc()->fLocal) return;
   // if valid Proof session, set parallel slaves
   if (fViewer->GetActDesc()->fProof &&
      fViewer->GetActDesc()->fProof->IsValid()) {
      Int_t nodes = atoi(fTxtParallel->GetText());
      fViewer->GetActDesc()->fProof->SetParallel(nodes);
   }
   fViewer->GetSessionFrame()->ProofInfos();
}

//______________________________________________________________________________
void TSessionFrame::OnMultipleSelection(Bool_t on)
{
   // Handle multiple selection check button.

   fLBPackages->SetMultipleSelections(on);
}

//______________________________________________________________________________
void TSessionFrame::OnStartupEnable(Bool_t on)
{
   // Handle multiple selection check button.

   if (fViewer->GetActDesc())
      fViewer->GetActDesc()->fAutoEnable = on;
}

//______________________________________________________________________________
void TSessionFrame::UpdatePackages()
{
   // Update list of packages.

   TPackageDescription *package;
   const TGPicture *pict;
   fLBPackages->RemoveEntries(0, fLBPackages->GetNumberOfEntries());
   TIter next(fViewer->GetActDesc()->fPackages);
   while ((package = (TPackageDescription *)next())) {
      if (package->fEnabled)
         pict = fClient->GetPicture("package_add.xpm");
      else if (package->fUploaded)
         pict = fClient->GetPicture("package_delete.xpm");
      else
         pict = fClient->GetPicture("package.xpm");
      TGIconLBEntry *entry = new TGIconLBEntry(fLBPackages->GetContainer(),
                                    package->fId, package->fPathName, pict);
      fLBPackages->AddEntry(entry, new TGLayoutHints(kLHintsExpandX | kLHintsTop));
   }
   fLBPackages->Layout();
   fClient->NeedRedraw(fLBPackages->GetContainer());
}

//______________________________________________________________________________
void TSessionFrame::OnUploadPackages()
{
   // Upload selected package(s) to the current session.

   // if local session, do nothing
   if (fViewer->GetActDesc()->fLocal) return;
   // if valid Proof session, upload packages
   if (fViewer->GetActDesc()->fProof &&
      fViewer->GetActDesc()->fProof->IsValid()) {
      TObject *obj;
      TList selected;
      fLBPackages->GetSelectedEntries(&selected);
      TIter next(&selected);
      while ((obj = next())) {
         TString name = obj->GetTitle();
         if (fViewer->GetActDesc()->fProof->UploadPackage(name.Data()) != 0)
            Error("Submit", "Upload package failed");
         else {
            TObject *o = fViewer->GetActDesc()->fPackages->FindObject(gSystem->BaseName(name));
            if (!o) continue;
            TPackageDescription *package =
               dynamic_cast<TPackageDescription *>(o);
            if (package) {
               package->fUploaded = kTRUE;
               ((TGIconLBEntry *)obj)->SetPicture(
                     fClient->GetPicture("package_delete.xpm"));
            }
         }
      }
      UpdatePackages();
   }
   fLBPackages->Layout();
   fClient->NeedRedraw(fLBPackages->GetContainer());
}

//______________________________________________________________________________
void TSessionFrame::OnEnablePackages()
{
   // Enable selected package(s) in the current session.

   // if local session, do nothing
   if (fViewer->GetActDesc()->fLocal) return;
   // if valid Proof session, enable packages
   if (fViewer->GetActDesc()->fProof &&
      fViewer->GetActDesc()->fProof->IsValid()) {
      TObject *obj;
      TList selected;
      fBtnEnable->SetState(kButtonDisabled);
      fLBPackages->GetSelectedEntries(&selected);
      TIter next(&selected);
      while ((obj = next())) {
         TString name = obj->GetTitle();
         TObject *o = fViewer->GetActDesc()->fPackages->FindObject(gSystem->BaseName(name));
         if (!o) continue;
         TPackageDescription *package =
            dynamic_cast<TPackageDescription *>(o);
         if (package) {
            if (!package->fUploaded) {
               if (fViewer->GetActDesc()->fProof->UploadPackage(name.Data()) != 0)
                  Error("Submit", "Upload package failed");
               else {
                  package->fUploaded = kTRUE;
                  ((TGIconLBEntry *)obj)->SetPicture(
                        fClient->GetPicture("package_delete.xpm"));
               }
            }
         }
         if (fViewer->GetActDesc()->fProof->EnablePackage(name) != 0)
            Error("Submit", "Enable package failed");
         else {
            package->fEnabled = kTRUE;
            ((TGIconLBEntry *)obj)->SetPicture(fClient->GetPicture("package_add.xpm"));
         }
      }
      UpdatePackages();
      fBtnEnable->SetState(kButtonUp);
   }
   fLBPackages->Layout();
   fClient->NeedRedraw(fLBPackages->GetContainer());
}

//______________________________________________________________________________
void TSessionFrame::OnDisablePackages()
{
   // Disable selected package(s) in the current session.

   // if local session, do nothing
   if (fViewer->GetActDesc()->fLocal) return;
   // if valid Proof session, disable (clear) packages
   if (fViewer->GetActDesc()->fProof &&
      fViewer->GetActDesc()->fProof->IsValid()) {
      TObject *obj;
      TList selected;
      fLBPackages->GetSelectedEntries(&selected);
      TIter next(&selected);
      while ((obj = next())) {
         TString name = obj->GetTitle();
         if (fViewer->GetActDesc()->fProof->ClearPackage(name) != 0)
            Error("Submit", "Clear package failed");
         else {
            TObject *o = fViewer->GetActDesc()->fPackages->FindObject(gSystem->BaseName(name));
            if (!o) continue;
            TPackageDescription *package =
               dynamic_cast<TPackageDescription *>(o);
            if (package) {
               package->fEnabled = kFALSE;
               package->fUploaded = kFALSE;
               ((TGIconLBEntry *)obj)->SetPicture(fClient->GetPicture("package.xpm"));
            }
         }
      }
      UpdatePackages();
   }
   fLBPackages->Layout();
   fClient->NeedRedraw(fLBPackages->GetContainer());
}

//______________________________________________________________________________
void TSessionFrame::OnClearPackages()
{
   // Clear (disable) all packages in the current session.

   TPackageDescription *package;
   // if local session, do nothing
   if (fViewer->GetActDesc()->fLocal) return;
   // if valid Proof session, clear packages
   if (fViewer->GetActDesc()->fProof &&
      fViewer->GetActDesc()->fProof->IsValid()) {
      if (fViewer->GetActDesc()->fProof->ClearPackages() != 0)
         Error("Submit", "Clear packages failed");
      else {
         TIter next(fViewer->GetActDesc()->fPackages);
         while ((package = (TPackageDescription *)next())) {
            package->fEnabled = kFALSE;
         }
      }
   }
   fLBPackages->Layout();
   fClient->NeedRedraw(fLBPackages->GetContainer());
}

//______________________________________________________________________________
void TSessionFrame::OnBtnAddClicked()
{
   // Open file dialog and add selected package file to the list.

   if (fViewer->IsBusy())
      return;
   TGFileInfo fi;
   TPackageDescription *package;
   TGIconLBEntry *entry;
   fi.fFileTypes = pkgtypes;
   new TGFileDialog(fClient->GetRoot(), fViewer, kFDOpen, &fi);
   if (fi.fMultipleSelection && fi.fFileNamesList) {
      TObjString *el;
      TIter next(fi.fFileNamesList);
      while ((el = (TObjString *) next())) {
         package = new TPackageDescription;
         package->fName = gSystem->BaseName(gSystem->UnixPathName(el->GetString()));
         package->fPathName = gSystem->UnixPathName(el->GetString());
         package->fId   = fViewer->GetActDesc()->fPackages->GetEntries();
         package->fUploaded = kFALSE;
         package->fEnabled = kFALSE;
         fViewer->GetActDesc()->fPackages->Add((TObject *)package);
         entry = new TGIconLBEntry(fLBPackages->GetContainer(),
                                   package->fId, package->fPathName,
                                   fClient->GetPicture("package.xpm"));
         fLBPackages->AddEntry(entry, new TGLayoutHints(kLHintsExpandX | kLHintsTop));
      }
   }
   else if (fi.fFilename) {
      package = new TPackageDescription;
      package->fName = gSystem->BaseName(gSystem->UnixPathName(fi.fFilename));
      package->fPathName = gSystem->UnixPathName(fi.fFilename);
      package->fId   = fViewer->GetActDesc()->fPackages->GetEntries();
      package->fUploaded = kFALSE;
      package->fEnabled = kFALSE;
      fViewer->GetActDesc()->fPackages->Add((TObject *)package);
      entry = new TGIconLBEntry(fLBPackages->GetContainer(),
                                package->fId, package->fPathName,
                                fClient->GetPicture("package.xpm"));
      fLBPackages->AddEntry(entry, new TGLayoutHints(kLHintsExpandX | kLHintsTop));
   }
   fLBPackages->Layout();
   fClient->NeedRedraw(fLBPackages->GetContainer());
}

//______________________________________________________________________________
void TSessionFrame::OnBtnRemoveClicked()
{
   // Remove selected package from the list.

   TPackageDescription *package;
   const TGPicture *pict;
   Int_t pos = fLBPackages->GetSelected();
   fLBPackages->RemoveEntries(0, fLBPackages->GetNumberOfEntries());
   fViewer->GetActDesc()->fPackages->Remove(
         fViewer->GetActDesc()->fPackages->At(pos));
   Int_t id = 0;
   TIter next(fViewer->GetActDesc()->fPackages);
   while ((package = (TPackageDescription *)next())) {
      package->fId = id;
      id++;
      if (package->fEnabled)
         pict = fClient->GetPicture("package_add.xpm");
      else if (package->fUploaded)
         pict = fClient->GetPicture("package_delete.xpm");
      else
         pict = fClient->GetPicture("package.xpm");
      TGIconLBEntry *entry = new TGIconLBEntry(fLBPackages->GetContainer(),
                                    package->fId, package->fPathName, pict);
      fLBPackages->AddEntry(entry, new TGLayoutHints(kLHintsExpandX | kLHintsTop));
   }
   fLBPackages->Layout();
   fClient->NeedRedraw(fLBPackages->GetContainer());
}

//______________________________________________________________________________
void TSessionFrame::OnBtnUpClicked()
{
   // Move selected package entry one position up in the list.

   TPackageDescription *package;
   const TGPicture *pict;
   Int_t pos = fLBPackages->GetSelected();
   if (pos <= 0) return;
   fLBPackages->RemoveEntries(0, fLBPackages->GetNumberOfEntries());
   package = (TPackageDescription *)fViewer->GetActDesc()->fPackages->At(pos);
   fViewer->GetActDesc()->fPackages->Remove(
         fViewer->GetActDesc()->fPackages->At(pos));
   package->fId -= 1;
   fViewer->GetActDesc()->fPackages->AddAt(package, package->fId);
   Int_t id = 0;
   TIter next(fViewer->GetActDesc()->fPackages);
   while ((package = (TPackageDescription *)next())) {
      package->fId = id;
      id++;
      if (package->fEnabled)
         pict = fClient->GetPicture("package_add.xpm");
      else if (package->fUploaded)
         pict = fClient->GetPicture("package_delete.xpm");
      else
         pict = fClient->GetPicture("package.xpm");
      TGIconLBEntry *entry = new TGIconLBEntry(fLBPackages->GetContainer(),
                                    package->fId, package->fPathName, pict);
      fLBPackages->AddEntry(entry, new TGLayoutHints(kLHintsExpandX | kLHintsTop));
   }
   fLBPackages->Select(pos-1);
   fLBPackages->Layout();
   fClient->NeedRedraw(fLBPackages->GetContainer());
}

//______________________________________________________________________________
void TSessionFrame::OnBtnDownClicked()
{
   // Move selected package entry one position down in the list.

   TPackageDescription *package;
   const TGPicture *pict;
   Int_t pos = fLBPackages->GetSelected();
   if (pos == -1 || pos == fViewer->GetActDesc()->fPackages->GetEntries()-1)
      return;
   fLBPackages->RemoveEntries(0, fLBPackages->GetNumberOfEntries());
   package = (TPackageDescription *)fViewer->GetActDesc()->fPackages->At(pos);
   fViewer->GetActDesc()->fPackages->Remove(
         fViewer->GetActDesc()->fPackages->At(pos));
   package->fId += 1;
   fViewer->GetActDesc()->fPackages->AddAt(package, package->fId);
   Int_t id = 0;
   TIter next(fViewer->GetActDesc()->fPackages);
   while ((package = (TPackageDescription *)next())) {
      package->fId = id;
      id++;
      if (package->fEnabled)
         pict = fClient->GetPicture("package_add.xpm");
      else if (package->fUploaded)
         pict = fClient->GetPicture("package_delete.xpm");
      else
         pict = fClient->GetPicture("package.xpm");
      TGIconLBEntry *entry = new TGIconLBEntry(fLBPackages->GetContainer(),
                                    package->fId, package->fPathName, pict);
      fLBPackages->AddEntry(entry, new TGLayoutHints(kLHintsExpandX | kLHintsTop));
   }
   fLBPackages->Select(pos+1);
   fLBPackages->Layout();
   fClient->NeedRedraw(fLBPackages->GetContainer());
}

//______________________________________________________________________________
void TSessionFrame::OnBtnDisconnectClicked()
{
   // Disconnect from current Proof session.

   // if local session, do nothing
   if (fViewer->GetActDesc()->fLocal) return;
   // if valid Proof session, disconnect (close)
   if (fViewer->GetActDesc()->fAttached &&
       fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid()) {
      fViewer->GetActDesc()->fProof->Detach();
   }
   // reset connected flag
   fViewer->GetActDesc()->fAttached = kFALSE;
   fViewer->GetActDesc()->fProof = 0;
   // disable animation timer
   fViewer->DisableTimer();
   // change list tree item picture to disconnected pixmap
   TGListTreeItem *item = fViewer->GetSessionHierarchy()->FindChildByData(
                           fViewer->GetSessionItem(), fViewer->GetActDesc());
   if (item) {
      item->SetPictures(fViewer->GetProofDisconPict(),
                        fViewer->GetProofDisconPict());
   }
   // update viewer
   fViewer->OnListTreeClicked(fViewer->GetSessionHierarchy()->GetSelected(),
                              1, 0, 0);
   fViewer->GetSessionHierarchy()->ClearViewPort();
   fClient->NeedRedraw(fViewer->GetSessionHierarchy());
   fViewer->GetStatusBar()->SetText("", 1);
}

//______________________________________________________________________________
void TSessionFrame::OnBtnShowLogClicked()
{
   // Show session log.

   fViewer->ShowLog(0);
}

//______________________________________________________________________________
void TSessionFrame::OnBtnNewQueryClicked()
{
   // Call "New Query" Dialog.

   TNewQueryDlg *dlg = new TNewQueryDlg(fViewer, 350, 310);
   dlg->Popup();
}

//______________________________________________________________________________
void TSessionFrame::OnBtnGetQueriesClicked()
{
   // Get list of queries from current Proof server and populate the list tree.

   TList *lqueries = 0;
   TQueryResult *query = 0;
   TQueryDescription *newquery = 0, *lquery = 0;
   if (fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid()) {
      lqueries = fViewer->GetActDesc()->fProof->GetListOfQueries();
   }
   if (lqueries) {
      TIter nextp(lqueries);
      // loop over list of queries received from Proof server
      while ((query = (TQueryResult *)nextp())) {
         // create new query description
         newquery = new TQueryDescription();
         newquery->fReference = TString::Format("%s:%s", query->GetTitle(),
                                                query->GetName());
         // check in our tree if it is already there
         TGListTreeItem *item =
            fViewer->GetSessionHierarchy()->FindChildByData(
                  fViewer->GetSessionItem(), fViewer->GetActDesc());
         // if already there, skip
         if (fViewer->GetSessionHierarchy()->FindChildByName(item,
             newquery->fReference.Data()))
            continue;
         // check also in our query description list
         Bool_t found = kFALSE;
         TIter nextp2(fViewer->GetActDesc()->fQueries);
         while ((lquery = (TQueryDescription *)nextp2())) {
            if (lquery->fReference.CompareTo(newquery->fReference) == 0) {
               found = kTRUE;
               break;
            }
         }
         if (found) continue;
         // build new query description with infos from Proof
         newquery->fStatus = query->IsFinalized() ?
               TQueryDescription::kSessionQueryFinalized :
               (TQueryDescription::ESessionQueryStatus)query->GetStatus();
         newquery->fSelectorString  = query->GetSelecImp()->GetName();
         newquery->fQueryName       = TString::Format("%s:%s", query->GetTitle(),
                                                      query->GetName());
         newquery->fOptions         = query->GetOptions();
         newquery->fEventList       = "";
         newquery->fNbFiles         = 0;
         newquery->fNoEntries       = query->GetEntries();
         newquery->fFirstEntry      = query->GetFirst();
         newquery->fResult          = query;
         newquery->fChain           = 0;
         fViewer->GetActDesc()->fQueries->Add((TObject *)newquery);
         TGListTreeItem *item2 = fViewer->GetSessionHierarchy()->AddItem(item,
                  newquery->fQueryName, fViewer->GetQueryConPict(),
                  fViewer->GetQueryConPict());
         item2->SetUserData(newquery);
         if (query->GetInputList())
            fViewer->GetSessionHierarchy()->AddItem(item2, "InputList");
         if (query->GetOutputList())
            fViewer->GetSessionHierarchy()->AddItem(item2, "OutputList");
      }
   }
   // at the end, update list tree
   fViewer->GetSessionHierarchy()->ClearViewPort();
   fClient->NeedRedraw(fViewer->GetSessionHierarchy());
}

//______________________________________________________________________________
void TSessionFrame::OnCommandLine()
{
   // Command line handling.

   // get command string
   const char *cmd = fCommandTxt->GetText();
   char opt[2];
   // form temporary file path
   TString pathtmp = TString::Format("%s/%s", gSystem->TempDirectory(),
                                     kSession_RedirectCmd);
   // if check box "clear view" is checked, open temp file in write mode
   // (overwrite), in append mode otherwise.
   if (fClearCheck->IsOn())
      snprintf(opt, 2, "w");
   else
      snprintf(opt, 2, "a");

   // if valid Proof session, pass the command to Proof
   if (fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid()) {
      // redirect stdout/stderr to temp file
      if (gSystem->RedirectOutput(pathtmp.Data(), opt) != 0) {
         Error("ShowStatus", "stdout/stderr redirection failed; skipping");
         return;
      }
      // execute command line
      fViewer->GetActDesc()->fProof->Exec(cmd);
      // restore back stdout/stderr
      if (gSystem->RedirectOutput(0) != 0) {
         Error("ShowStatus", "stdout/stderr retore failed; skipping");
         return;
      }
      // if check box "clear view" is checked, clear text view
      if (fClearCheck->IsOn())
         fInfoTextView->Clear();
      // load (display) temp file in text view
      fInfoTextView->LoadFile(pathtmp.Data());
      // set focus to "command line" text entry
      fCommandTxt->SetFocus();
   }
   else {
      // if no Proof session, or Proof session not valid,
      // lets execute command line by TApplication

      // redirect stdout/stderr to temp file
      if (gSystem->RedirectOutput(pathtmp.Data(), opt) != 0) {
         Error("ShowStatus", "stdout/stderr redirection failed; skipping");
      }
      // execute command line
      gApplication->ProcessLine(cmd);
      // restore back stdout/stderr
      if (gSystem->RedirectOutput(0) != 0) {
         Error("ShowStatus", "stdout/stderr retore failed; skipping");
      }
      // if check box "clear view" is checked, clear text view
      if (fClearCheck->IsOn())
         fInfoTextView->Clear();
      // load (display) temp file in text view
      fInfoTextView->LoadFile(pathtmp.Data());
      // set focus to "command line" text entry
      fCommandTxt->SetFocus();
   }
   // display bottom of text view
   fInfoTextView->ShowBottom();
}

//______________________________________________________________________________
void TSessionFrame::SetLocal(Bool_t local)
{
   // Switch widgets status/visibility for local/remote sessions.

   if (local) {
      fBtnGetQueries->SetState(kButtonDisabled);
      fBtnShowLog->SetState(kButtonDisabled);
      fTab->HideFrame(fTab->GetTabTab("Options"));
      fTab->HideFrame(fTab->GetTabTab("Packages"));
      fTab->HideFrame(fTab->GetTabTab("DataSets"));
   }
   else {
      fBtnGetQueries->SetState(kButtonUp);
      fBtnShowLog->SetState(kButtonUp);
      fTab->ShowFrame(fTab->GetTabTab("Options"));
      fTab->ShowFrame(fTab->GetTabTab("Packages"));
      fTab->ShowFrame(fTab->GetTabTab("DataSets"));
   }
}

//______________________________________________________________________________
void TSessionFrame::ShutdownSession()
{
   // Shutdown current session.

   // do nothing if connection in progress
   if (fViewer->IsBusy())
      return;

   if (fViewer->GetActDesc()->fLocal) {
      Int_t retval;
      new TGMsgBox(fClient->GetRoot(), this, "Error Shutting down Session",
                   "Shutting down Local Sessions is not allowed !",
                    kMBIconExclamation,kMBOk,&retval);
      return;
   }
   if (!fViewer->GetActDesc()->fAttached ||
       !fViewer->GetActDesc()->fProof ||
       !fViewer->GetActDesc()->fProof->IsValid())
      return;
   // ask for confirmation
   TString m;
   m.Form("Are you sure to shutdown the session \"%s\"",
          fViewer->GetActDesc()->fName.Data());
   Int_t result;
   new TGMsgBox(fClient->GetRoot(), this, "", m.Data(), 0,
                kMBOk | kMBCancel, &result);
   // if confirmed, delete it
   if (result != kMBOk)
      return;
   // remove the Proof session from gROOT list of Proofs
   fViewer->GetActDesc()->fProof->Detach("S");
   // reset connected flag
   fViewer->GetActDesc()->fAttached = kFALSE;
   fViewer->GetActDesc()->fProof = 0;
   // disable animation timer
   fViewer->DisableTimer();
   // change list tree item picture to disconnected pixmap
   TGListTreeItem *item = fViewer->GetSessionHierarchy()->FindChildByData(
                          fViewer->GetSessionItem(), fViewer->GetActDesc());
   if (item) {
      item->SetPictures(fViewer->GetProofDisconPict(),
                        fViewer->GetProofDisconPict());
   }
   // update viewer
   fViewer->OnListTreeClicked(fViewer->GetSessionHierarchy()->GetSelected(),
                              1, 0, 0);
   fViewer->GetSessionHierarchy()->ClearViewPort();
   fClient->NeedRedraw(fViewer->GetSessionHierarchy());
   fViewer->GetStatusBar()->SetText("", 1);
}

//////////////////////////////////////////////////////////////////////////
// Edit Query Frame
//////////////////////////////////////////////////////////////////////////

//______________________________________________________________________________
TEditQueryFrame::TEditQueryFrame(TGWindow* p, Int_t w, Int_t h) :
   TGCompositeFrame(p, w, h, kVerticalFrame), fFrmMore(0), fBtnMore(0),
   fTxtQueryName(0), fTxtChain(0), fTxtSelector(0), fTxtOptions(0),
   fNumEntries(0), fNumFirstEntry(0), fTxtParFile(0), fTxtEventList(0),
   fViewer(0), fQuery(0), fChain(0)
{
   // Create a new Query dialog, used by the Session Viewer, to Edit a Query if
   // the editmode flag is set, or to create a new one if not set.

}

//______________________________________________________________________________
TEditQueryFrame::~TEditQueryFrame()
{
   // Delete query dialog.

   Cleanup();
}

//______________________________________________________________________________
void TEditQueryFrame::Build(TSessionViewer *gui)
{
   // Build the "new query" dialog.

   TGButton *btnTmp;
   fViewer = gui;
   SetCleanup(kDeepCleanup);
   SetLayoutManager(new TGTableLayout(this, 6, 5));

   // add "Query Name" label and text entry
   AddFrame(new TGLabel(this, "Query Name :"),
         new TGTableLayoutHints(0, 1, 0, 1, kLHintsCenterY, 5, 5, 4, 0));
   AddFrame(fTxtQueryName = new TGTextEntry(this,
         (const char *)0, 1), new TGTableLayoutHints(1, 2, 0, 1,
         kLHintsCenterY, 5, 5, 4, 0));

   // add "TChain" label and text entry
   AddFrame(new TGLabel(this, "TChain :"),
         new TGTableLayoutHints(0, 1, 1, 2, kLHintsCenterY, 5, 5, 4, 0));
   AddFrame(fTxtChain = new TGTextEntry(this,
         (const char *)0, 2), new TGTableLayoutHints(1, 2, 1, 2,
         kLHintsCenterY, 5, 5, 4, 0));
   fTxtChain->SetToolTipText("Specify TChain or TDSet from memory or file");
   fTxtChain->SetEnabled(kFALSE);
   // add "Browse" button
   AddFrame(btnTmp = new TGTextButton(this, "Browse..."),
         new TGTableLayoutHints(2, 3, 1, 2, kLHintsCenterY, 5, 0, 4, 8));
   btnTmp->Connect("Clicked()", "TEditQueryFrame", this, "OnBrowseChain()");

   // add "Selector" label and text entry
   AddFrame(new TGLabel(this, "Selector :"),
         new TGTableLayoutHints(0, 1, 2, 3, kLHintsCenterY, 5, 5, 0, 0));
   AddFrame(fTxtSelector = new TGTextEntry(this,
         (const char *)0, 3), new TGTableLayoutHints(1, 2, 2, 3,
         kLHintsCenterY, 5, 5, 0, 0));
   // add "Browse" button
   AddFrame(btnTmp = new TGTextButton(this, "Browse..."),
         new TGTableLayoutHints(2, 3, 2, 3, kLHintsCenterY, 5, 0, 0, 8));
   btnTmp->Connect("Clicked()", "TEditQueryFrame", this, "OnBrowseSelector()");

   // add "Less <<" ("More >>") button
   AddFrame(fBtnMore = new TGTextButton(this, " Less << "),
         new TGTableLayoutHints(2, 3, 4, 5, kLHintsCenterY, 5, 5, 4, 0));
   fBtnMore->Connect("Clicked()", "TEditQueryFrame", this, "OnNewQueryMore()");

   // add (initially hidden) options frame
   fFrmMore = new TGCompositeFrame(this, 200, 200);
   fFrmMore->SetCleanup(kDeepCleanup);

   AddFrame(fFrmMore, new TGTableLayoutHints(0, 3, 5, 6,
         kLHintsExpandX | kLHintsExpandY));
   fFrmMore->SetLayoutManager(new TGTableLayout(fFrmMore, 4, 3));

   // add "Options" label and text entry
   fFrmMore->AddFrame(new TGLabel(fFrmMore, "Options :"),
         new TGTableLayoutHints(0, 1, 0, 1, kLHintsCenterY, 5, 5, 0, 0));
   fFrmMore->AddFrame(fTxtOptions = new TGTextEntry(fFrmMore,
         (const char *)0, 4), new TGTableLayoutHints(1, 2, 0, 1, 0, 17,
         0, 0, 8));
   //fTxtOptions->SetText("ASYN");
   fTxtOptions->SetText("");

   // add "Nb Entries" label and number entry
   fFrmMore->AddFrame(new TGLabel(fFrmMore, "Nb Entries :"),
         new TGTableLayoutHints(0, 1, 1, 2, kLHintsCenterY, 5, 5, 0, 0));
   fFrmMore->AddFrame(fNumEntries = new TGNumberEntry(fFrmMore, 0, 5, -1,
         TGNumberFormat::kNESInteger, TGNumberFormat::kNEAAnyNumber,
         TGNumberFormat::kNELNoLimits), new TGTableLayoutHints(1, 2, 1, 2,
         0, 17, 0, 0, 8));
   // coverity[negative_returns]: no problem with -1, the format is kNESInteger
   fNumEntries->SetIntNumber(-1);
   // add "First Entry" label and number entry
   fFrmMore->AddFrame(new TGLabel(fFrmMore, "First entry :"),
         new TGTableLayoutHints(0, 1, 2, 3, kLHintsCenterY, 5, 5, 0, 0));
   fFrmMore->AddFrame(fNumFirstEntry = new TGNumberEntry(fFrmMore, 0, 5, -1,
         TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
         TGNumberFormat::kNELNoLimits), new TGTableLayoutHints(1, 2, 2, 3, 0,
         17, 0, 0, 8));

   // add "Event list" label and text entry
   fFrmMore->AddFrame(new TGLabel(fFrmMore, "Event list :"),
         new TGTableLayoutHints(0, 1, 3, 4, kLHintsCenterY, 5, 5, 0, 0));
   fFrmMore->AddFrame(fTxtEventList = new TGTextEntry(fFrmMore,
         (const char *)0, 6), new TGTableLayoutHints(1, 2, 3, 4, 0, 17,
         5, 0, 0));
   // add "Browse" button
   fFrmMore->AddFrame(btnTmp = new TGTextButton(fFrmMore, "Browse..."),
         new TGTableLayoutHints(2, 3, 3, 4, 0, 6, 0, 0, 8));
   btnTmp->Connect("Clicked()", "TEditQueryFrame", this, "OnBrowseEventList()");

   fTxtQueryName->Associate(this);
   fTxtChain->Associate(this);
   fTxtSelector->Associate(this);
   fTxtOptions->Associate(this);
   fNumEntries->Associate(this);
   fNumFirstEntry->Associate(this);
   fTxtEventList->Associate(this);

   fTxtQueryName->Connect("TextChanged(char*)", "TEditQueryFrame", this,
                        "SettingsChanged()");
   fTxtChain->Connect("TextChanged(char*)", "TEditQueryFrame", this,
                        "SettingsChanged()");
   fTxtSelector->Connect("TextChanged(char*)", "TEditQueryFrame", this,
                        "SettingsChanged()");
   fTxtOptions->Connect("TextChanged(char*)", "TEditQueryFrame", this,
                        "SettingsChanged()");
   fNumEntries->Connect("ValueChanged(Long_t)", "TEditQueryFrame", this,
                        "SettingsChanged()");
   fNumFirstEntry->Connect("ValueChanged(Long_t)", "TEditQueryFrame", this,
                        "SettingsChanged()");
   fTxtEventList->Connect("TextChanged(char*)", "TEditQueryFrame", this,
                        "SettingsChanged()");
}

//______________________________________________________________________________
void TEditQueryFrame::OnNewQueryMore()
{
   // Show/hide options frame and update button text accordingly.

   if (IsVisible(fFrmMore)) {
      HideFrame(fFrmMore);
      fBtnMore->SetText(" More >> ");
   }
   else {
      ShowFrame(fFrmMore);
      fBtnMore->SetText(" Less << ");
   }
}

//______________________________________________________________________________
void TEditQueryFrame::OnBrowseChain()
{
   // Call new chain dialog.

   TNewChainDlg *dlg = new TNewChainDlg(fClient->GetRoot(), this);
   dlg->Connect("OnElementSelected(TObject *)", "TEditQueryFrame",
         this, "OnElementSelected(TObject *)");
}

//____________________________________________________________________________
void TEditQueryFrame::OnElementSelected(TObject *obj)
{
   // Handle OnElementSelected signal coming from new chain dialog.

   if (obj) {
      fChain = obj;
      if (obj->IsA() == TChain::Class())
         fTxtChain->SetText(((TChain *)fChain)->GetName());
      else if (obj->IsA() == TDSet::Class())
         fTxtChain->SetText(((TDSet *)fChain)->GetObjName());
   }
}

//______________________________________________________________________________
void TEditQueryFrame::OnBrowseSelector()
{
   // Open file browser to choose selector macro.

   TGFileInfo fi;
   fi.fFileTypes = macrotypes;
   new TGFileDialog(fClient->GetRoot(), this, kFDOpen, &fi);
   if (!fi.fFilename) return;
   fTxtSelector->SetText(gSystem->UnixPathName(fi.fFilename));
}

//______________________________________________________________________________
void TEditQueryFrame::OnBrowseEventList()
{
   //Browse event list

}

//______________________________________________________________________________
void TEditQueryFrame::OnBtnSave()
{
   // Save current settings in main session viewer.

   // if we are in edition mode and query description is valid,
   // use it, otherwise create a new one
   TQueryDescription *newquery;
   if (fQuery)
      newquery = fQuery;
   else
      newquery = new TQueryDescription();

   // update query description fields
   newquery->fSelectorString  = fTxtSelector->GetText();
   if (fChain) {
      newquery->fTDSetString  = fChain->GetName();
      newquery->fChain        = fChain;
   }
   else {
      newquery->fTDSetString = "";
      newquery->fChain       = 0;
   }
   newquery->fQueryName      = fTxtQueryName->GetText();
   newquery->fOptions        = fTxtOptions->GetText();
   newquery->fNoEntries      = fNumEntries->GetIntNumber();
   newquery->fFirstEntry     = fNumFirstEntry->GetIntNumber();
   newquery->fNbFiles        = 0;
   newquery->fResult         = 0;

   if (newquery->fChain) {
      if (newquery->fChain->IsA() == TChain::Class())
         newquery->fNbFiles = ((TChain *)newquery->fChain)->GetListOfFiles()->GetEntriesFast();
      else if (newquery->fChain->IsA() == TDSet::Class())
         newquery->fNbFiles = ((TDSet *)newquery->fChain)->GetListOfElements()->GetSize();
   }
   // update user data with modified query description
   TGListTreeItem *item = fViewer->GetSessionHierarchy()->GetSelected();
   fViewer->GetSessionHierarchy()->RenameItem(item, newquery->fQueryName);
   item->SetUserData(newquery);
   // update list tree
   fViewer->GetSessionHierarchy()->ClearViewPort();
   fClient->NeedRedraw(fViewer->GetSessionHierarchy());
   fTxtQueryName->SelectAll();
   fTxtQueryName->SetFocus();
   fViewer->WriteConfiguration();
   fViewer->GetQueryFrame()->Modified(kFALSE);
   if (fViewer->GetActDesc()->fLocal ||
      (fViewer->GetActDesc()->fConnected &&
       fViewer->GetActDesc()->fAttached &&
       fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid())) {
      fViewer->GetQueryFrame()->GetTab()->SetTab("Status");
      fViewer->GetQueryFrame()->OnBtnSubmit();
   }
}

//______________________________________________________________________________
void TEditQueryFrame::SettingsChanged()
{
   // Settings have changed, update GUI accordingly.

   if (fQuery) {
      if ((strcmp(fQuery->fSelectorString.Data(), fTxtSelector->GetText())) ||
          (strcmp(fQuery->fQueryName.Data(), fTxtQueryName->GetText())) ||
          (strcmp(fQuery->fOptions.Data(), fTxtOptions->GetText())) ||
          (fQuery->fNoEntries  != fNumEntries->GetIntNumber()) ||
          (fQuery->fFirstEntry != fNumFirstEntry->GetIntNumber()) ||
          (fQuery->fChain != fChain)) {
         fViewer->GetQueryFrame()->Modified(kTRUE);
      }
      else {
         fViewer->GetQueryFrame()->Modified(kFALSE);
      }
   }
   else {
      if ((fTxtQueryName->GetText()) &&
         ((fTxtQueryName->GetText()) ||
          (fTxtChain->GetText())))
         fViewer->GetQueryFrame()->Modified(kTRUE);
      else
         fViewer->GetQueryFrame()->Modified(kFALSE);
   }
}

//______________________________________________________________________________
void TEditQueryFrame::UpdateFields(TQueryDescription *desc)
{
   // Update entry fields with query description values.

   fChain = 0;
   fQuery = desc;
   fTxtChain->SetText("");
   if (desc->fChain) {
      fChain = desc->fChain;
      fTxtChain->SetText(desc->fTDSetString);
   }
   fTxtQueryName->SetText(desc->fQueryName);
   fTxtSelector->SetText(desc->fSelectorString);
   fTxtOptions->SetText(desc->fOptions);
   fNumEntries->SetIntNumber(desc->fNoEntries);
   fNumFirstEntry->SetIntNumber(desc->fFirstEntry);
   fTxtEventList->SetText(desc->fEventList);
}

////////////////////////////////////////////////////////////////////////////////
// Query Frame

//______________________________________________________________________________
TSessionQueryFrame::TSessionQueryFrame(TGWindow* p, Int_t w, Int_t h) :
   TGCompositeFrame(p, w, h), fBtnSubmit(0), fBtnFinalize(0), fBtnStop(0),
   fBtnAbort(0), fBtnShowLog(0), fBtnRetrieve(0), fBtnSave(0), fInfoTextView(0),
   fModified(0), fFiles(0), fFirst(0), fEntries(0), fPrevTotal(0),
   fPrevProcessed(0), fLabInfos(0), fLabStatus(0), fTotal(0), fRate(0),
   fStatus(kStopped), fTab(0), fFA(0), fFB(0), fFC(0), fFD(0), frmProg(0),
   fECanvas(0), fStatsCanvas(0), fViewer(0), fDesc(0)
{
   // Constructor
}

//______________________________________________________________________________
TSessionQueryFrame::~TSessionQueryFrame()
{
   // Destructor.

   Cleanup();
}

//______________________________________________________________________________
void TSessionQueryFrame::Build(TSessionViewer *gui)
{
   // Build query information frame.

   SetLayoutManager(new TGVerticalLayout(this));
   SetCleanup(kDeepCleanup);
   fFirst = fEntries = fPrevTotal = 0;
   fPrevProcessed = 0;
   fViewer = gui;
   fModified = kFALSE;

   // main query tab
   fTab = new TGTab(this, 200, 200);
   AddFrame(fTab, new TGLayoutHints(kLHintsTop | kLHintsExpandX |
         kLHintsExpandY, 2, 2, 2, 2));

   // add "Status" tab element
   TGCompositeFrame *tf = fTab->AddTab("Status");
   fFB = new TGCompositeFrame(tf, 100, 100, kVerticalFrame);
   tf->AddFrame(fFB, new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX | kLHintsExpandY));

   // new frame containing control buttons and feedback histos canvas
   TGCompositeFrame* frmcanvas = new TGHorizontalFrame(fFB, 350, 100);
   // control buttons frame
   TGCompositeFrame* frmBut2 = new TGVerticalFrame(frmcanvas, 150, 100);
   fBtnSubmit = new TGTextButton(frmBut2, "        Submit        ");
   fBtnSubmit->SetToolTipText("Submit (process) selected query");
   frmBut2->AddFrame(fBtnSubmit,new TGLayoutHints(kLHintsCenterY | kLHintsLeft |
         kLHintsExpandX, 5, 5, 5, 5));
   fBtnStop = new TGTextButton(frmBut2, "Stop");
   fBtnStop->SetToolTipText("Stop processing query");
   frmBut2->AddFrame(fBtnStop,new TGLayoutHints(kLHintsCenterY | kLHintsLeft |
         kLHintsExpandX, 5, 5, 5, 5));
   fBtnAbort = new TGTextButton(frmBut2, "Abort");
   fBtnAbort->SetToolTipText("Abort processing query");
   frmBut2->AddFrame(fBtnAbort,new TGLayoutHints(kLHintsCenterY | kLHintsLeft |
         kLHintsExpandX, 5, 5, 5, 5));
   frmcanvas->AddFrame(frmBut2, new TGLayoutHints(kLHintsLeft | kLHintsCenterY |
         kLHintsExpandY));
   // feedback histos embedded canvas
   fECanvas = new TRootEmbeddedCanvas("fECanvas", frmcanvas, 400, 150);
   fStatsCanvas = fECanvas->GetCanvas();
   fStatsCanvas->SetFillColor(10);
   fStatsCanvas->SetBorderMode(0);
   frmcanvas->AddFrame(fECanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
            4, 4, 4, 4));
   fFB->AddFrame(frmcanvas, new TGLayoutHints(kLHintsLeft | kLHintsTop |
         kLHintsExpandX | kLHintsExpandY));

   // progress infos label
   fLabInfos = new TGLabel(fFB, "                                  ");
   fFB->AddFrame(fLabInfos, new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));
   // progress status label
   fLabStatus = new TGLabel(fFB, "                                  ");
   fFB->AddFrame(fLabStatus, new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));

   //progress bar
   frmProg = new TGHProgressBar(fFB, TGProgressBar::kFancy, 350 - 20);
   frmProg->ShowPosition();
   frmProg->SetBarColor("green");
   fFB->AddFrame(frmProg, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
   // total progress infos
   fFB->AddFrame(fTotal = new TGLabel(fFB,
         " Estimated time left : 0 sec (--- events of --- processed) "),
         new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));
   // progress rate infos
   fFB->AddFrame(fRate = new TGLabel(fFB,
         " Processing Rate : -- events/sec    "),
         new TGLayoutHints(kLHintsLeft, 5, 5, 5, 5));

   // add "Results" tab element
   tf = fTab->AddTab("Results");
   fFC = new TGCompositeFrame(tf, 100, 100, kVerticalFrame);
   tf->AddFrame(fFC, new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX | kLHintsExpandY));
   // query result (header) information text view
   fInfoTextView = new TGTextView(fFC, 330, 185, "", kSunkenFrame |
         kDoubleBorder);
   fFC->AddFrame(fInfoTextView, new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandY | kLHintsExpandX, 5, 5, 10, 10));

   // add "Retrieve", "Finalize" and "Show Log" buttons
   TGCompositeFrame* frmBut3 = new TGHorizontalFrame(fFC, 350, 100);
   fBtnRetrieve = new TGTextButton(frmBut3, "Retrieve");
   fBtnRetrieve->SetToolTipText("Retrieve query results");
   frmBut3->AddFrame(fBtnRetrieve,new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX, 5, 5, 10, 10));
   fBtnFinalize = new TGTextButton(frmBut3, "Finalize");
   fBtnFinalize->SetToolTipText("Finalize query");
   frmBut3->AddFrame(fBtnFinalize,new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX, 5, 5, 10, 10));
   fBtnShowLog = new TGTextButton(frmBut3, "Show Log");
   fBtnShowLog->SetToolTipText("Show query log (open log window)");
   frmBut3->AddFrame(fBtnShowLog,new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX, 5, 5, 10, 10));
   fFC->AddFrame(frmBut3, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX));

   // add "Results" tab element
   tf = fTab->AddTab("Edit Query");
   fFD = new TEditQueryFrame(tf, 100, 100);
   fFD->Build(fViewer);
   tf->AddFrame(fFD, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 10, 0));
   TString btntxt;
   if (fViewer->GetActDesc()->fLocal ||
      (fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid())) {
      btntxt = "         Submit         ";
   }
   else {
      btntxt = "     Apply changes      ";
   }
   tf->AddFrame(fBtnSave = new TGTextButton(tf, btntxt),
                new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 5, 25, 5));

   // connect button actions to functions
   fBtnSave->Connect("Clicked()", "TEditQueryFrame", fFD,
         "OnBtnSave()");
   fBtnSubmit->Connect("Clicked()", "TSessionQueryFrame", this,
         "OnBtnSubmit()");
   fBtnFinalize->Connect("Clicked()", "TSessionQueryFrame", this,
         "OnBtnFinalize()");
   fBtnStop->Connect("Clicked()", "TSessionQueryFrame", this,
         "OnBtnStop()");
   fBtnAbort->Connect("Clicked()", "TSessionQueryFrame", this,
         "OnBtnAbort()");
   fBtnShowLog->Connect("Clicked()", "TSessionQueryFrame", this,
         "OnBtnShowLog()");
   fBtnRetrieve->Connect("Clicked()", "TSessionQueryFrame", this,
         "OnBtnRetrieve()");
//   fBtnSave->SetState(kButtonDisabled);
   Resize(350, 310);
}

//______________________________________________________________________________
void TSessionQueryFrame::Modified(Bool_t mod)
{
   // Notify changes in query editor settings.

   fModified = mod;
   if (fModified) {
      fBtnSave->SetState(kButtonUp);
   }
   else {
      fBtnSave->SetState(kButtonDisabled);
   }
   if (fViewer->GetActDesc()->fLocal ||
      (fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid()))
      fBtnSave->SetState(kButtonUp);
}

//______________________________________________________________________________
void TSessionQueryFrame::Feedback(TList *objs)
{
   // Feedback function connected to Feedback signal.
   // Used to update feedback histograms.

   // if no actual session, just return
   if (!fViewer->GetActDesc()->fAttached)
      return;
   if (!fViewer->GetActDesc()->fProof)
      return;
   if ((fViewer->GetActDesc()->fActQuery) &&
       (fViewer->GetActDesc()->fActQuery->fStatus !=
        TQueryDescription::kSessionQuerySubmitted) &&
       (fViewer->GetActDesc()->fActQuery->fStatus !=
        TQueryDescription::kSessionQueryRunning) )
      return;
   TProof *sender = dynamic_cast<TProof*>((TQObject*)gTQSender);
   // if Proof sender match actual session one, update feedback histos
   if (sender && (sender == fViewer->GetActDesc()->fProof))
      UpdateHistos(objs);
}

//______________________________________________________________________________
void TSessionQueryFrame::UpdateHistos(TList *objs)
{
   // Update feedback histograms.
   TVirtualPad *save = gPad;
   TObject *o;
   Int_t pos = 1;
   Int_t i = 0;
   while (kFeedbackHistos[i]) {
      // check if user has selected this histogram in the option menu
      if (fViewer->GetCascadeMenu()->IsEntryChecked(41+i)) {
         if ( (o = objs->FindObject(kFeedbackHistos[i]))) {
            fStatsCanvas->cd(pos);
            gPad->SetEditable(kTRUE);
            if (TH1 *h = dynamic_cast<TH1*>(o)) {
               h->SetStats(0);
               h->SetBarWidth(0.75);
               h->SetBarOffset(0.125);
               h->SetFillColor(9);
               h->Draw("bar");
               pos++;
            }
            else if (TH2 *h2 = dynamic_cast<TH2*>(o)) {
               h2->Draw();
               pos++;
            }
            gPad->Modified();
         }
      }
      i++;
   }
   // update canvas
   fStatsCanvas->cd();
   fStatsCanvas->Modified();
   fStatsCanvas->Update();
   if (save != 0) {
      save->cd();
   } else {
      gPad = 0;
   }
}

//______________________________________________________________________________
void TSessionQueryFrame::Progress(Long64_t total, Long64_t processed)
{
   // Update progress bar and status labels.

   Long_t tt;
   UInt_t hh=0, mm=0, ss=0;
   TString stm;
   // if no actual session, just return
   if (!fViewer->GetActDesc()->fProof)
      return;
   // if Proof sender does't match actual session one, return
   TProof *sender = dynamic_cast<TProof*>((TQObject*)gTQSender);
   if (!sender || (sender != fViewer->GetActDesc()->fProof))
      return;

   if ((fViewer->GetActDesc()->fActQuery) &&
       (fViewer->GetActDesc()->fActQuery->fStatus !=
        TQueryDescription::kSessionQuerySubmitted) &&
       (fViewer->GetActDesc()->fActQuery->fStatus !=
        TQueryDescription::kSessionQueryRunning) ) {
      fTotal->SetText(" Estimated time left : 0 sec (0 events of 0 processed)        ");
      fRate->SetText(" Processing Rate : 0.0f events/sec   ");
      frmProg->Reset();
      fFB->Layout();
      return;
   }

   if (total < 0)
      total = fPrevTotal;
   else
      fPrevTotal = total;

   // if no change since last call, just return
   if (fPrevProcessed == processed)
      return;
   TString buf;

   // Update information at first call
   if (fEntries != total) {
      buf.Form("PROOF cluster : \"%s\" - %d worker nodes",
               fViewer->GetActDesc()->fProof->GetMaster(),
               fViewer->GetActDesc()->fProof->GetParallel());
      fLabInfos->SetText(buf);

      fEntries = total;
      buf.Form(" %d files, %lld events, starting event %lld",
               fFiles, fEntries, fFirst);
      fLabStatus->SetText(buf);
   }

   // compute progress bar position and update
   Float_t pos = (Float_t)((Double_t)(processed * 100)/(Double_t)total);
   frmProg->SetPosition(pos);
   // if 100%, stop animation and set icon to "connected"
   if (pos >= 100.0) {
      fViewer->SetChangePic(kFALSE);
      fViewer->ChangeRightLogo("monitor01.xpm");
   }

   // get current time
   if ((fViewer->GetActDesc()->fActQuery->fStatus ==
        TQueryDescription::kSessionQueryRunning) ||
       (fViewer->GetActDesc()->fActQuery->fStatus ==
        TQueryDescription::kSessionQuerySubmitted))
      fViewer->GetActDesc()->fActQuery->fEndTime = gSystem->Now();
   TTime tdiff = fViewer->GetActDesc()->fActQuery->fEndTime -
                 fViewer->GetActDesc()->fActQuery->fStartTime;
   Float_t eta = 0;
   if (processed)
      eta = ((Float_t)((Long64_t)tdiff)*total/Float_t(processed) -
            Long64_t(tdiff))/1000.;

   tt = (Long_t)eta;
   if (tt > 0) {
      hh = (UInt_t)(tt / 3600);
      mm = (UInt_t)((tt % 3600) / 60);
      ss = (UInt_t)((tt % 3600) % 60);
   }
   if (hh)
      stm.Form("%d h %d min %d sec", hh, mm, ss);
   else if (mm)
      stm.Form("%d min %d sec", mm, ss);
   else
      stm.Form("%d sec", ss);
   if (processed == total) {
      // finished
      tt = (Long_t) Long64_t(tdiff)/1000;
      if (tt > 0) {
         hh = (UInt_t)(tt / 3600);
         mm = (UInt_t)((tt % 3600) / 60);
         ss = (UInt_t)((tt % 3600) % 60);
      }
      if (hh)
         stm.Form("%d h %d min %d sec", hh, mm, ss);
      else if (mm)
         stm.Form("%d min %d sec", mm, ss);
      else
         stm.Form("%d sec", ss);
      buf.Form(" Processed : %lld events in %s", total, stm.Data());
      fTotal->SetText(buf.Data());
   } else {
      // update status infos
      buf.Form(" Estimated time left : %s (%lld events of %lld processed)        ",
               stm.Data(), processed, total);
      fTotal->SetText(buf.Data());
   }
   if (processed > 0 && (Long64_t)tdiff > 0) {
      buf.Form(" Processing Rate : %.1f events/sec   ",
               (Float_t)processed/(Long64_t)tdiff*1000.);
      fRate->SetText(buf);
   }
   fPrevProcessed = processed;

   fFB->Layout();
}

//______________________________________________________________________________
void TSessionQueryFrame::Progress(Long64_t total, Long64_t processed,
                                  Long64_t /*bytesread*/, Float_t /*initTime*/,
                                  Float_t /*procTime*/, Float_t /*evtrti*/,
                                  Float_t /*mbrti*/, Int_t /*actw*/,
                                  Int_t /*tses*/, Float_t /*eses*/)
{
   // New version of Progress (just forward to the old version
   // for the time being).

   Progress(total, processed);
}

//______________________________________________________________________________
void TSessionQueryFrame::ProgressLocal(Long64_t total, Long64_t processed)
{
   // Update progress bar and status labels.

   Long_t tt;
   UInt_t hh=0, mm=0, ss=0;
   TString stm;
   TString cproc;
   Int_t status;

   switch (fViewer->GetActDesc()->fActQuery->fStatus) {

      case TQueryDescription::kSessionQueryAborted:
         cproc = " - ABORTED";
         status = kAborted;
         break;
      case TQueryDescription::kSessionQueryStopped:
         cproc = " - STOPPED";
         status = kStopped;
         break;
      case TQueryDescription::kSessionQueryRunning:
         cproc = " ";
         status = kRunning;
         break;
      case TQueryDescription::kSessionQueryCompleted:
      case TQueryDescription::kSessionQueryFinalized:
         cproc = " ";
         status = kDone;
         break;
      default:
         status = -1;
         break;
   }
   if (processed < 0) processed = 0;

   frmProg->SetBarColor("green");
   if (status == kAborted)
      frmProg->SetBarColor("red");
   else if (status == kStopped)
      frmProg->SetBarColor("yellow");
   else if (status == -1 ) {
      fTotal->SetText(" Estimated time left : 0 sec (0 events of 0 processed)        ");
      fRate->SetText(" Processing Rate : 0.0f events/sec   ");
      frmProg->Reset();
      fFB->Layout();
      return;
   }

   if (total < 0)
      total = fPrevTotal;
   else
      fPrevTotal = total;

   // if no change since last call, just return
   TString buf;

   // Update information at first call
   if (fEntries != total) {
      fLabInfos->SetText("Local Session");

      fEntries = total;
      buf.Form(" %d files, %lld events, starting event %lld",
               fFiles, fEntries, fFirst);
      fLabStatus->SetText(buf.Data());
   }

   // compute progress bar position and update
   Float_t pos = 0.0;
   if (processed > 0 && total > 0)
      pos = (Float_t)((Double_t)(processed * 100)/(Double_t)total);
   frmProg->SetPosition(pos);
   // if 100%, stop animation and set icon to "connected"
   if (pos >= 100.0) {
      fViewer->SetChangePic(kFALSE);
      fViewer->ChangeRightLogo("monitor01.xpm");
   }

   // get current time
   if (status == kRunning)
      fViewer->GetActDesc()->fActQuery->fEndTime = gSystem->Now();
   TTime tdiff = fViewer->GetActDesc()->fActQuery->fEndTime -
                 fViewer->GetActDesc()->fActQuery->fStartTime;
   Float_t eta = 0;
   if (processed)
      eta = ((Float_t)((Long64_t)tdiff)*total/(Float_t)(processed) -
            (Long64_t)(tdiff))/1000.;

   tt = (Long_t)eta;
   if (tt > 0) {
      hh = (UInt_t)(tt / 3600);
      mm = (UInt_t)((tt % 3600) / 60);
      ss = (UInt_t)((tt % 3600) % 60);
   }
   if (hh)
      stm = TString::Format("%d h %d min %d sec", hh, mm, ss);
   else if (mm)
      stm = TString::Format("%d min %d sec", mm, ss);
   else
      stm = TString::Format("%d sec", ss);
   if ((processed != total) && (status == kRunning)) {
      // update status infos
      buf.Form(" Estimated time left : %s (%lld events of %lld processed)        ",
               stm.Data(), processed, total);
      fTotal->SetText(buf);
   } else {
      tt = (Long_t) Long64_t(tdiff)/1000;
      if (tt > 0) {
         hh = (UInt_t)(tt / 3600);
         mm = (UInt_t)((tt % 3600) / 60);
         ss = (UInt_t)((tt % 3600) % 60);
      }
      if (hh)
         stm = TString::Format("%d h %d min %d sec", hh, mm, ss);
      else if (mm)
         stm = TString::Format("%d min %d sec", mm, ss);
      else
         stm = TString::Format("%d sec", ss);
      buf.Form(" Processed : %ld events in %s",
               (Long_t)processed, stm.Data());
      buf += cproc;
      fTotal->SetText(buf.Data());
   }
   if (processed > 0 && (Long64_t)tdiff > 0) {
      buf.Form(" Processing Rate : %.1f events/sec   ",
               (Float_t)processed/(Long64_t)tdiff*1000.);
      fRate->SetText(buf.Data());
   }
   fPrevProcessed = processed;

   fFB->Layout();
}

//______________________________________________________________________________
void TSessionQueryFrame::IndicateStop(Bool_t aborted)
{
   // Indicate that Cancel or Stop was clicked.

   if (aborted == kTRUE) {
      // Aborted
      frmProg->SetBarColor("red");
   }
   else {
      // Stopped
      frmProg->SetBarColor("yellow");
   }
   // disconnect progress related signals
   if (fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid()) {
      fViewer->GetActDesc()->fProof->Disconnect("Progress(Long64_t,Long64_t)",
               this, "Progress(Long64_t,Long64_t)");
      fViewer->GetActDesc()->fProof->Disconnect("Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)",
               this, "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)");
      fViewer->GetActDesc()->fProof->Disconnect("Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)",
               this, "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t,Int_t,Int_t,Float_t)");
      fViewer->GetActDesc()->fProof->Disconnect("StopProcess(Bool_t)", this,
               "IndicateStop(Bool_t)");
   }
}

//______________________________________________________________________________
void TSessionQueryFrame::ResetProgressDialog(const char * /*selector*/, Int_t files,
                                        Long64_t first, Long64_t entries)
{
   // Reset progress frame information fields.

   TString buf;
   fFiles         = files > 0 ? files : 0;
   fFirst         = first;
   fEntries       = entries;
   fPrevProcessed = 0;
   fPrevTotal     = 0;

   if (!fViewer->GetActDesc()->fLocal) {
      frmProg->SetBarColor("green");
      frmProg->Reset();
   }

   buf.Form("%0d files, %0lld events, starting event %0lld",
            fFiles > 0 ? fFiles : 0, fEntries > 0 ? fEntries : 0,
            fFirst >= 0 ? fFirst : 0);
   fLabStatus->SetText(buf.Data());
   // Reconnect the slots
   if (fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid()) {
      fViewer->GetActDesc()->fProof->Connect("Progress(Long64_t,Long64_t)",
               "TSessionQueryFrame", this, "Progress(Long64_t,Long64_t)");
      fViewer->GetActDesc()->fProof->Connect("Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)",
               "TSessionQueryFrame", this,
               "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)");
      fViewer->GetActDesc()->fProof->Connect("StopProcess(Bool_t)",
               "TSessionQueryFrame", this, "IndicateStop(Bool_t)");
      buf.Form("PROOF cluster : \"%s\" - %d worker nodes",
                fViewer->GetActDesc()->fProof->GetMaster(),
                fViewer->GetActDesc()->fProof->GetParallel());
      fLabInfos->SetText(buf.Data());
   }
   else if (fViewer->GetActDesc()->fLocal) {
      fStatsCanvas->Clear();
      fLabInfos->SetText("Local Session");
      fLabStatus->SetText(" ");
   }
   else {
      fLabInfos->SetText(" ");
      fLabStatus->SetText(" ");
   }
   fFB->Layout();
}

//______________________________________________________________________________
void TSessionQueryFrame::OnBtnFinalize()
{
   // Finalize query.

   // check if Proof is valid
   if (fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid()) {
      gPad->SetEditable(kFALSE);
      TGListTreeItem *item = fViewer->GetSessionHierarchy()->GetSelected();
      if (!item) return;
      TObject *obj = (TObject *)item->GetUserData();
      if ((obj) && (obj->IsA() == TQueryDescription::Class())) {
         // as it can take time, set watch cursor
         gVirtualX->SetCursor(GetId(),gVirtualX->CreateCursor(kWatch));
         TQueryDescription *query = (TQueryDescription *)obj;
         fViewer->GetActDesc()->fProof->Finalize(query->fReference);
         UpdateButtons(query);
         // restore cursor
         gVirtualX->SetCursor(GetId(), 0);
      }
   }
   if (fViewer->GetActDesc()->fLocal) {
      gPad->SetEditable(kFALSE);
      TChain *chain = (TChain *)fViewer->GetActDesc()->fActQuery->fChain;
      if (chain)
         ((TTreePlayer *)(chain->GetPlayer()))->GetSelectorFromFile()->Terminate();
   }
}

//______________________________________________________________________________
void TSessionQueryFrame::OnBtnStop()
{
   // Stop processing query.

   // check for proof validity
   if (fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid()) {
      fViewer->GetActDesc()->fProof->StopProcess(kFALSE);
   }
   if (fViewer->GetActDesc()->fLocal) {
      gROOT->SetInterrupt();
      fViewer->GetActDesc()->fActQuery->fStatus =
         TQueryDescription::kSessionQueryStopped;
   }
   // stop icon animation and set connected icon
   fViewer->ChangeRightLogo("monitor01.xpm");
   fViewer->SetChangePic(kFALSE);
}

//______________________________________________________________________________
void TSessionQueryFrame::OnBtnShowLog()
{
   // Show query log.

   TGListTreeItem *item = fViewer->GetSessionHierarchy()->GetSelected();
   if (!item) return;
   TObject *obj = (TObject *)item->GetUserData();
   if ((!obj) || (obj->IsA() != TQueryDescription::Class()))
      return;
   TQueryDescription *query = (TQueryDescription *)obj;
   fViewer->ShowLog(query->fReference.Data());
}

//______________________________________________________________________________
void TSessionQueryFrame::OnBtnRetrieve()
{
   // Retrieve query.

   // check for proof validity
   if (fViewer->GetActDesc()->fAttached &&
       fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid()) {
      TGListTreeItem *item = fViewer->GetSessionHierarchy()->GetSelected();
      if (!item) return;
      TObject *obj = (TObject *)item->GetUserData();
      if (obj && obj->IsA() == TQueryDescription::Class()) {
         // as it can take time, set watch cursor
         gVirtualX->SetCursor(GetId(), gVirtualX->CreateCursor(kWatch));
         TQueryDescription *query = (TQueryDescription *)obj;
         Int_t rc = fViewer->GetActDesc()->fProof->Retrieve(query->fReference);
         if (rc == 0)
            fViewer->OnCascadeMenu();
         // restore cursor
         gVirtualX->SetCursor(GetId(), 0);
      }
   }
   if (fViewer->GetActDesc()->fLocal) {
      TGListTreeItem *item=0, *item2=0;
      item = fViewer->GetSessionHierarchy()->FindItemByObj(fViewer->GetSessionItem(),
                                                           fViewer->GetActDesc());
      if (item) {
         item2 = fViewer->GetSessionHierarchy()->FindItemByObj(item,
                                    fViewer->GetActDesc()->fActQuery);
      }
      if (item2) {
         // add input and output list entries
         TChain *chain = (TChain *)fViewer->GetActDesc()->fActQuery->fChain;
         if (chain) {
            TSelector *selector = ((TTreePlayer *)(chain->GetPlayer()))->GetSelectorFromFile();
            if (selector) {
               TList *objlist = selector->GetOutputList();
               if (objlist)
                  if (!fViewer->GetSessionHierarchy()->FindChildByName(item2, "OutputList"))
                     fViewer->GetSessionHierarchy()->AddItem(item2, "OutputList");
            }
         }
      }
      // update list tree, query frame information, and buttons state
      fViewer->GetSessionHierarchy()->ClearViewPort();
      fClient->NeedRedraw(fViewer->GetSessionHierarchy());
      UpdateInfos();
      UpdateButtons(fViewer->GetActDesc()->fActQuery);
   }
}

//______________________________________________________________________________
void TSessionQueryFrame::OnBtnAbort()
{
   // Abort processing query.

   // check for proof validity
   if (fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid()) {
      fViewer->GetActDesc()->fProof->StopProcess(kTRUE);
   }
   if (fViewer->GetActDesc()->fLocal) {
      gROOT->SetInterrupt();
      fViewer->GetActDesc()->fActQuery->fStatus =
         TQueryDescription::kSessionQueryAborted;
   }
   // stop icon animation and set connected icon
   fViewer->ChangeRightLogo("monitor01.xpm");
   fViewer->SetChangePic(kFALSE);
}

//______________________________________________________________________________
void TSessionQueryFrame::OnBtnSubmit()
{
   // Submit query.

   Int_t retval;
   Long64_t id = 0;
   TGListTreeItem *item = fViewer->GetSessionHierarchy()->GetSelected();
   if (!item) return;
   // retrieve query description attached to list tree item
   TObject *obj = (TObject *)item->GetUserData();
   if (!obj || obj->IsA() != TQueryDescription::Class())
      return;
   TQueryDescription *newquery = (TQueryDescription *)obj;
   // reset progress information
   ResetProgressDialog(newquery->fSelectorString,
         newquery->fNbFiles, newquery->fFirstEntry, newquery->fNoEntries);
   // set query start time
   newquery->fStartTime = gSystem->Now();
   fViewer->GetActDesc()->fNbHistos = 0;
   // check for proof validity
   if (fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid()) {
      fViewer->GetActDesc()->fProof->SetBit(TProof::kUsingSessionGui);
      // set query description status to submitted
      newquery->fStatus = TQueryDescription::kSessionQuerySubmitted;
      // if feedback option selected
      if (fViewer->GetOptionsMenu()->IsEntryChecked(kOptionsFeedback)) {
         Int_t i = 0;
         // browse list of feedback histos and check user's selected ones
         while (kFeedbackHistos[i]) {
            if (fViewer->GetCascadeMenu()->IsEntryChecked(41+i)) {
               fViewer->GetActDesc()->fProof->AddFeedback(kFeedbackHistos[i]);
               fViewer->GetActDesc()->fNbHistos++;
            }
            i++;
         }
         // connect feedback signal
         fViewer->GetActDesc()->fProof->Connect("Feedback(TList *objs)",
                           "TSessionQueryFrame", fViewer->GetQueryFrame(),
                           "Feedback(TList *objs)");
         gROOT->Time();
      }
      else {
         // if feedback option not selected, clear Proof's feedback option
         fViewer->GetActDesc()->fProof->ClearFeedback();
      }
      // set current proof session
      fViewer->GetActDesc()->fProof->cd();
      // check if parameter file has been specified
      if (newquery->fChain) {
         if (fViewer->GetActDesc()->fProof->IsLite()) {
            newquery->fOptions = "";
         }
         // set query reference id
         newquery->fReference= TString::Format("session-%s:q%d",
                            fViewer->GetActDesc()->fProof->GetSessionTag(),
                            fViewer->GetActDesc()->fProof->GetSeqNum()+1);
         if (newquery->fChain->IsA() == TChain::Class()) {
            // TChain case
            newquery->fStatus = TQueryDescription::kSessionQuerySubmitted;
            ((TChain *)newquery->fChain)->SetProof(fViewer->GetActDesc()->fProof);
            id = ((TChain *)newquery->fChain)->Process(newquery->fSelectorString,
                    newquery->fOptions,
                    newquery->fNoEntries > 0 ? newquery->fNoEntries : 1234567890,
                    newquery->fFirstEntry);
         }
         else if (newquery->fChain->IsA() == TDSet::Class()) {
            // TDSet case
            newquery->fStatus = TQueryDescription::kSessionQuerySubmitted;
            id = ((TDSet *)newquery->fChain)->Process(newquery->fSelectorString,
                  newquery->fOptions,
                  newquery->fNoEntries,
                  newquery->fFirstEntry);
         }
      }
      else {
         Error("Submit", "No TChain defined; skipping");
         newquery->fStatus = TQueryDescription::kSessionQueryCreated;
         return;
      }
      // set query reference id to unique identifier
      newquery->fReference= TString::Format("session-%s:q%lld",
                            fViewer->GetActDesc()->fProof->GetSessionTag(), id);
      // start icon animation
      fViewer->SetChangePic(kTRUE);
   }
   else if (fViewer->GetActDesc()->fLocal) { // local session case
      // if feedback option selected
      if (fViewer->GetOptionsMenu()->IsEntryChecked(kOptionsFeedback)) {
         Int_t i = 0;
         // browse list of feedback histos and check user's selected ones
         while (kFeedbackHistos[i]) {
            if (fViewer->GetCascadeMenu()->IsEntryChecked(41+i)) {
               fViewer->GetActDesc()->fNbHistos++;
            }
            i++;
         }
      }
      if (newquery->fChain) {
         if (newquery->fChain->IsA() == TChain::Class()) {
            // TChain case
            newquery->fStatus = TQueryDescription::kSessionQueryRunning;
            fViewer->EnableTimer();
            UpdateButtons(newquery);
            gPad->SetEditable(kFALSE);
            ((TChain *)newquery->fChain)->SetTimerInterval(100);
            id = ((TChain *)newquery->fChain)->Process(newquery->fSelectorString,
                  newquery->fOptions,
                  newquery->fNoEntries > 0 ? newquery->fNoEntries : 1234567890,
                  newquery->fFirstEntry);
            ((TChain *)newquery->fChain)->SetTimerInterval(0);
            OnBtnRetrieve();
            TChain *chain = (TChain *)newquery->fChain;
            ProgressLocal(chain->GetEntries(),
                          chain->GetReadEntry()+1);
            if ((newquery->fStatus != TQueryDescription::kSessionQueryAborted) &&
                (newquery->fStatus != TQueryDescription::kSessionQueryStopped))
               newquery->fStatus = TQueryDescription::kSessionQueryCompleted;
            UpdateButtons(newquery);
         }
         else {
            new TGMsgBox(fClient->GetRoot(), this, "Error Submitting Query",
                         "Only TChains are allowed in Local Session (no TDSet) !",
                          kMBIconExclamation,kMBOk,&retval);
         }
      }
      else {
         Error("Submit", "No TChain defined; skipping");
         newquery->fStatus = TQueryDescription::kSessionQueryCreated;
         return;
      }
      // set query reference id to unique identifier
      newquery->fReference = TString::Format("local-session-%s:q%lld", newquery->fQueryName.Data(), id);
   }
   // update buttons state
   UpdateButtons(newquery);
}

//______________________________________________________________________________
void TSessionQueryFrame::UpdateButtons(TQueryDescription *desc)
{
   // Update buttons state for the current query status.

   TGListTreeItem *item = fViewer->GetSessionHierarchy()->GetSelected();
   if (!item) return;
   // retrieve query description attached to list tree item
   TObject *obj = (TObject *)item->GetUserData();
   if (!obj || obj->IsA() != TQueryDescription::Class())
      return;
   TQueryDescription *query = (TQueryDescription *)obj;
   if (desc != query) return;

   Bool_t submit_en = kFALSE;
   if ((fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid()) ||
       fViewer->GetActDesc()->fLocal)
      submit_en = kTRUE;

   switch (desc->fStatus) {
      case TQueryDescription::kSessionQueryFromProof:
         fBtnSubmit->SetEnabled(submit_en);
         fBtnFinalize->SetEnabled(kTRUE);
         fBtnStop->SetEnabled(kFALSE);
         fBtnAbort->SetEnabled(kFALSE);
         fBtnShowLog->SetEnabled(kTRUE);
         fBtnRetrieve->SetEnabled(kTRUE);
         break;

      case TQueryDescription::kSessionQueryCompleted:
         fBtnSubmit->SetEnabled(submit_en);
         fBtnFinalize->SetEnabled(kTRUE);
         if (((desc->fResult == 0) || (desc->fResult &&
              (desc->fResult->IsFinalized() ||
              (desc->fResult->GetInputObject("TDSet") == 0)))) &&
              !(fViewer->GetActDesc()->fLocal))
            fBtnFinalize->SetEnabled(kFALSE);
         fBtnStop->SetEnabled(kFALSE);
         fBtnAbort->SetEnabled(kFALSE);
         fBtnShowLog->SetEnabled(kTRUE);
         fBtnRetrieve->SetEnabled(kTRUE);
         break;

      case TQueryDescription::kSessionQueryCreated:
         fBtnSubmit->SetEnabled(submit_en);
         fBtnFinalize->SetEnabled(kFALSE);
         fBtnStop->SetEnabled(kFALSE);
         fBtnAbort->SetEnabled(kFALSE);
         fBtnShowLog->SetEnabled(kTRUE);
         fBtnRetrieve->SetEnabled(kFALSE);
         break;

      case TQueryDescription::kSessionQuerySubmitted:
         fBtnSubmit->SetEnabled(kFALSE);
         fBtnFinalize->SetEnabled(kFALSE);
         fBtnStop->SetEnabled(kTRUE);
         fBtnAbort->SetEnabled(kTRUE);
         fBtnShowLog->SetEnabled(kTRUE);
         fBtnRetrieve->SetEnabled(kFALSE);
         break;

      case TQueryDescription::kSessionQueryRunning:
         fBtnSubmit->SetEnabled(kFALSE);
         fBtnFinalize->SetEnabled(kFALSE);
         fBtnStop->SetEnabled(kTRUE);
         fBtnAbort->SetEnabled(kTRUE);
         fBtnShowLog->SetEnabled(kTRUE);
         fBtnRetrieve->SetEnabled(kFALSE);
         break;

      case TQueryDescription::kSessionQueryStopped:
         fBtnSubmit->SetEnabled(submit_en);
         fBtnFinalize->SetEnabled(kTRUE);
         fBtnStop->SetEnabled(kFALSE);
         fBtnAbort->SetEnabled(kFALSE);
         fBtnShowLog->SetEnabled(kTRUE);
         fBtnRetrieve->SetEnabled(kTRUE);
         break;

      case TQueryDescription::kSessionQueryAborted:
         fBtnSubmit->SetEnabled(submit_en);
         fBtnFinalize->SetEnabled(kFALSE);
         fBtnStop->SetEnabled(kFALSE);
         fBtnAbort->SetEnabled(kFALSE);
         fBtnShowLog->SetEnabled(kTRUE);
         fBtnRetrieve->SetEnabled(kFALSE);
         break;

      case TQueryDescription::kSessionQueryFinalized:
         fBtnSubmit->SetEnabled(submit_en);
         fBtnFinalize->SetEnabled(kFALSE);
         fBtnStop->SetEnabled(kFALSE);
         fBtnAbort->SetEnabled(kFALSE);
         fBtnShowLog->SetEnabled(kTRUE);
         fBtnRetrieve->SetEnabled(kFALSE);
         break;

      default:
         break;
   }
   if (fViewer->GetActDesc()->fLocal &&
       !(fViewer->GetActDesc()->fActQuery->fChain)) {
      fBtnFinalize->SetEnabled(kFALSE);
      fBtnRetrieve->SetEnabled(kFALSE);
   }
}

//______________________________________________________________________________
void TSessionQueryFrame::UpdateInfos()
{
   // Update query information (header) text view.

   TString buffer;
   const char *qst[] = {"aborted  ", "submitted", "running  ",
                        "stopped  ", "completed"};

   if (fViewer->GetActDesc()->fActQuery)
      fFD->UpdateFields(fViewer->GetActDesc()->fActQuery);

   if (fViewer->GetActDesc()->fLocal ||
      (fViewer->GetActDesc()->fConnected &&
       fViewer->GetActDesc()->fAttached &&
       fViewer->GetActDesc()->fProof &&
       fViewer->GetActDesc()->fProof->IsValid())) {
      fBtnSave->SetText("         Submit         ");
   }
   else {
      fBtnSave->SetText("     Apply changes      ");
   }
   fClient->NeedRedraw(fBtnSave);
   fInfoTextView->Clear();
   if (!fViewer->GetActDesc()->fActQuery ||
       !fViewer->GetActDesc()->fActQuery->fResult) {
      ResetProgressDialog("", 0, 0, 0);
      if (fViewer->GetActDesc()->fLocal) {
         if (fViewer->GetActDesc()->fActQuery) {
            TChain *chain = (TChain *)fViewer->GetActDesc()->fActQuery->fChain;
            if (chain) {
               ProgressLocal(chain->GetEntries(),
                             chain->GetReadEntry()+1);
            }
            else {
               ProgressLocal(0, 0);
            }
            UpdateButtons(fViewer->GetActDesc()->fActQuery);
         }
      }
      else {
         fTotal->SetText(" Estimated time left : 0 sec (0 events of 0 processed)        ");
         fRate->SetText(" Processing Rate : 0.0f events/sec   ");
         frmProg->Reset();
         fFB->Layout();
      }
      return;
   }
   TQueryResult *result = fViewer->GetActDesc()->fActQuery->fResult;

   // Status label
   Int_t st = (result->GetStatus() > 0 && result->GetStatus() <=
               TQueryResult::kCompleted) ? result->GetStatus() : 0;

   Int_t qry = result->GetSeqNum();

   buffer = TString::Format("------------------------------------------------------\n");
   // Print header
   if (!result->IsDraw()) {
      const char *fin = result->IsFinalized() ? "finalized" : qst[st];
      const char *arc = result->IsArchived() ? "(A)" : "";
      buffer = TString::Format(" Query No  : %d\n", qry);
      buffer += TString::Format(" Ref       : \"%s:%s\"\n", result->GetTitle(),
                                result->GetName());
      buffer += TString::Format(" Selector  : %s\n",
                                result->GetSelecImp()->GetTitle());
      buffer += TString::Format("Status    : %9s%s\n", fin, arc);
      buffer += TString::Format("------------------------------------------------------\n");
   } else {
      buffer += TString::Format(" Query No  : %d\n", qry);
      buffer += TString::Format(" Ref       : \"%s:%s\"\n", result->GetTitle(),
                                result->GetName());
      buffer += TString::Format(" Selector  : %s\n",
                                result->GetSelecImp()->GetTitle());
      buffer += TString::Format("------------------------------------------------------\n");
   }

   // Time information
   Int_t elapsed = (Int_t)(result->GetEndTime().Convert() -
                           result->GetStartTime().Convert());
   buffer += TString::Format(" Started   : %s\n",
                             result->GetStartTime().AsString());
   buffer += TString::Format(" Real time : %d sec (CPU time: %.1f sec)\n",
                             elapsed, result->GetUsedCPU());

   // Number of events processed, rate, size
   Double_t rate = 0.0;
   if (result->GetEntries() > -1 && elapsed > 0)
      rate = result->GetEntries() / (Double_t)elapsed ;
   Float_t size = ((Float_t)result->GetBytes())/(1024*1024);
   buffer += TString::Format(" Processed : %lld events (size: %.3f MBs)\n",
                             result->GetEntries(), size);
   buffer += TString::Format(" Rate      : %.1f evts/sec\n", rate);

   // Package information
   if (strlen(result->GetParList()) > 1) {
      buffer += TString::Format(" Packages  :  %s\n", result->GetParList());
   }

   // Result information
   TString res = result->GetResultFile();
   if (!result->IsArchived()) {
      Int_t dq = res.Index("queries");
      if (dq > -1) {
         res.Remove(0,res.Index("queries"));
         res.Insert(0,"<PROOF_SandBox>/");
      }
      if (res.BeginsWith("-")) {
         res = (result->GetStatus() == TQueryResult::kAborted) ?
               "not available" : "sent to client";
      }
   }
   if (res.Length() > 1) {
      buffer += TString::Format("------------------------------------------------------\n");
      buffer += TString::Format(" Results   : %s\n", res.Data());
   }

   if (result->GetOutputList() && result->GetOutputList()->GetSize() > 0) {
      buffer += TString::Format(" Outlist   : %d objects\n",
                                result->GetOutputList()->GetSize());
      buffer += TString::Format("------------------------------------------------------\n");
   }
   fInfoTextView->LoadBuffer(buffer.Data());

   //Float_t pos = Float_t((Double_t)(result->GetEntries() * 100)/(Double_t)total);
   if (result->GetStatus() == TQueryResult::kAborted)
      frmProg->SetBarColor("red");
   else if (result->GetStatus() == TQueryResult::kStopped)
      frmProg->SetBarColor("yellow");
   else
      frmProg->SetBarColor("green");

   frmProg->SetPosition(100.0);

   buffer = TString::Format(" Processed : %lld events in %.1f sec", result->GetEntries(),
                           (Float_t)elapsed);
   fTotal->SetText(buffer.Data());
   buffer = TString::Format(" Processing Rate : %.1f events/sec   ", rate);
   fRate->SetText(buffer.Data());
   fFB->Layout();
}

//////////////////////////////////////////////////////////////////////////////////////////
// Output frame

//______________________________________________________________________________
TSessionOutputFrame::TSessionOutputFrame(TGWindow* p, Int_t w, Int_t h) :
   TGCompositeFrame(p, w, h), fEntryTmp(0), fLVContainer(0), fViewer(0)
{
   // Constructor.
}

//______________________________________________________________________________
TSessionOutputFrame::~TSessionOutputFrame()
{
   // Destructor.

   delete fLVContainer; // this container is inside the TGListView and is not
                        // deleted automatically
   Cleanup();
}

//______________________________________________________________________________
void TSessionOutputFrame::Build(TSessionViewer *gui)
{
   // Build query output information frame.

   fViewer = gui;
   SetLayoutManager(new TGVerticalLayout(this));
   SetCleanup(kDeepCleanup);

   // Container of object TGListView
   TGListView *frmListView = new TGListView(this, 340, 190);
   fLVContainer = new TGLVContainer(frmListView, kSunkenFrame, GetWhitePixel());
   fLVContainer->Associate(frmListView);
   fLVContainer->SetCleanup(kDeepCleanup);
   AddFrame(frmListView, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
         4, 4, 4, 4));

   frmListView->Connect("Clicked(TGLVEntry*, Int_t, Int_t, Int_t)",
         "TSessionOutputFrame", this,
         "OnElementClicked(TGLVEntry* ,Int_t, Int_t, Int_t)");
   frmListView->Connect("DoubleClicked(TGLVEntry*, Int_t, Int_t, Int_t)",
         "TSessionOutputFrame", this,
         "OnElementDblClicked(TGLVEntry* ,Int_t, Int_t, Int_t)");
}

//______________________________________________________________________________
void TSessionOutputFrame::OnElementClicked(TGLVEntry* entry, Int_t btn, Int_t x,
                                           Int_t y)
{
   // Handle mouse clicks on list view items.

   TObject *obj = (TObject *)entry->GetUserData();
   if ((obj) && (btn ==3)) {
      // if right button, popup context menu
      fViewer->GetContextMenu()->Popup(x, y, obj, (TBrowser *)0);
   }
}

//______________________________________________________________________________
void TSessionOutputFrame::OnElementDblClicked(TGLVEntry* entry, Int_t , Int_t, Int_t)
{
   // Handle double-clicks on list view items.

   char action[512];
   TString act;
   TObject *obj = (TObject *)entry->GetUserData();
   if (!obj) return;
   TString ext = obj->GetName();
   gPad->SetEditable(kFALSE);
   // check default action from root.mimes
   if (fClient->GetMimeTypeList()->GetAction(obj->IsA()->GetName(), action)) {
      act = TString::Format("((%s*)0x%lx)%s", obj->IsA()->GetName(), (Long_t)obj, action);
      if (act[0] == '!') {
         act.Remove(0, 1);
         gSystem->Exec(act.Data());
      } else {
         // do not allow browse
         if (!act.Contains("Browse"))
            gROOT->ProcessLine(act.Data());
      }
   }
}

//______________________________________________________________________________
void TSessionOutputFrame::AddObject(TObject *obj)
{
   // Add object to output list view.

   TGLVEntry *item;
   if (obj) {
      item = new TGLVEntry(fLVContainer, obj->GetName(), obj->IsA()->GetName());
      item->SetUserData(obj);
      fLVContainer->AddItem(item);
   }
}

//////////////////////////////////////////////////////////////////////////////////////////
// Input Frame

//______________________________________________________________________________
TSessionInputFrame::TSessionInputFrame(TGWindow* p, Int_t w, Int_t h) :
   TGCompositeFrame(p, w, h), fViewer(0), fLVContainer(0)
{
   // Constructor.
}

//______________________________________________________________________________
TSessionInputFrame::~TSessionInputFrame()
{
   // Destructor.

   delete fLVContainer; // this container is inside the TGListView and is not
                        // deleted automatically
   Cleanup();
}

//______________________________________________________________________________
void TSessionInputFrame::Build(TSessionViewer *gui)
{
   // Build query input information frame.

   fViewer = gui;
   SetLayoutManager(new TGVerticalLayout(this));
   SetCleanup(kDeepCleanup);

   // Container of object TGListView
   TGListView *frmListView = new TGListView(this, 340, 190);
   fLVContainer = new TGLVContainer(frmListView, kSunkenFrame, GetWhitePixel());
   fLVContainer->Associate(frmListView);
   fLVContainer->SetCleanup(kDeepCleanup);
   AddFrame(frmListView, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
         4, 4, 4, 4));
}

//______________________________________________________________________________
void TSessionInputFrame::AddObject(TObject *obj)
{
   // Add object to input list view.

   TGLVEntry *item;
   if (obj) {
      item = new TGLVEntry(fLVContainer, obj->GetName(), obj->IsA()->GetName());
      item->SetUserData(obj);
      fLVContainer->AddItem(item);
   }
}

//////////////////////////////////////////////////////////////////////////////////////////
// Session Viewer Main Frame

//______________________________________________________________________________
TSessionViewer::TSessionViewer(const char *name, UInt_t w, UInt_t h) :
   TGMainFrame(gClient->GetRoot(), w, h), fSessionHierarchy(0), fSessionItem(0)
{
   // Main Session viewer constructor.

   // only one session viewer allowed
   if (gSessionViewer)
      // coverity[uninit_member]: already done
      return;
   Build();
   SetWindowName(name);
   Resize(w, h);
   gSessionViewer = this;
}

//______________________________________________________________________________
TSessionViewer::TSessionViewer(const char *name, Int_t x, Int_t y, UInt_t w,
                              UInt_t h) : TGMainFrame(gClient->GetRoot(), w, h),
                              fSessionHierarchy(0), fSessionItem(0)
{
   // Main Session viewer constructor.

   // only one session viewer allowed
   if (gSessionViewer)
      // coverity[uninit_member]: already done
      return;
   Build();
   SetWindowName(name);
   Move(x, y);
   Resize(w, h);
   gSessionViewer = this;
}

//______________________________________________________________________________
void TSessionViewer::ReadConfiguration(const char *filename)
{
   // Read configuration file and populate list of sessions
   // list of queries and list of packages.
   // Read and set also global options as feedback histos.

   if (fViewerEnv)
      delete fViewerEnv;
   fViewerEnv = new TEnv();

   const char *fn = (filename && strlen(filename)) ? filename : fConfigFile.Data();

   fViewerEnv->ReadFile(fn, kEnvUser);

   Bool_t bval = (Bool_t)fViewerEnv->GetValue("Option.Feedback", 1);
   if (bval)
      fOptionsMenu->CheckEntry(kOptionsFeedback);
   else
      fOptionsMenu->UnCheckEntry(kOptionsFeedback);

   bval = (Bool_t)fViewerEnv->GetValue("Option.MasterHistos", 1);
   if (bval) {
      fOptionsMenu->CheckEntry(kOptionsStatsHist);
      gEnv->SetValue("Proof.StatsHist", 1);
   }
   else {
      fOptionsMenu->UnCheckEntry(kOptionsStatsHist);
      gEnv->SetValue("Proof.StatsHist", 0);
   }
   bval = (Bool_t)fViewerEnv->GetValue("Option.MasterEvents", 0);
   if (bval)
      fOptionsMenu->CheckEntry(kOptionsStatsTrace);
   else
      fOptionsMenu->UnCheckEntry(kOptionsStatsTrace);
   bval = (Bool_t)fViewerEnv->GetValue("Option.WorkerEvents", 0);
   if (bval)
      fOptionsMenu->CheckEntry(kOptionsSlaveStatsTrace);
   else
      fOptionsMenu->UnCheckEntry(kOptionsSlaveStatsTrace);

   Int_t i = 0;
   while (kFeedbackHistos[i]) {
      bval = (Bool_t)fViewerEnv->GetValue(Form("Option.%s",kFeedbackHistos[i]),
                                          i == 1 ? 1 : 0);
      if (bval)
         fCascadeMenu->CheckEntry(41+i);
      else
         fCascadeMenu->UnCheckEntry(41+i);
      i++;
   }
   TSessionDescription *proofDesc;
   fSessions->Delete();
   if (fSessionItem)
      fSessionHierarchy->DeleteChildren(fSessionItem);
   else
      fSessionItem = fSessionHierarchy->AddItem(0, "Sessions", fBaseIcon,
            fBaseIcon);
   // add local session description
   TGListTreeItem *item = fSessionHierarchy->AddItem(fSessionItem, "Local",
                                                     fLocal, fLocal);
   fSessionHierarchy->SetToolTipItem(item, "Local Session");
   TSessionDescription *localdesc = new TSessionDescription();
   localdesc->fTag = "";
   localdesc->fName = "Local";
   localdesc->fAddress = "Local";
   localdesc->fPort = 0;
   localdesc->fConfigFile = "";
   localdesc->fLogLevel = 0;
   localdesc->fUserName = "";
   localdesc->fQueries = new TList();
   localdesc->fPackages = new TList();
   localdesc->fActQuery = 0;
   localdesc->fProof = 0;
   localdesc->fProofMgr = 0;
   localdesc->fAttached = kFALSE;
   localdesc->fConnected = kFALSE;
   localdesc->fLocal = kTRUE;
   localdesc->fSync = kTRUE;
   localdesc->fAutoEnable = kFALSE;
   localdesc->fNbHistos = 0;
   item->SetUserData(localdesc);
   fSessions->Add((TObject *)localdesc);
   fActDesc = localdesc;

   SysInfo_t info;
   gSystem->GetSysInfo(&info);
   // if the machine has more than one CPU, add one PROOF lite session
   // (not supported on Windows yet)
   if (!info.fOS.Contains("Microsoft") && info.fCpus > 1) {
      // add proof lite session description
      item = fSessionHierarchy->AddItem(fSessionItem, "Lite",
                                        fProofDiscon, fProofDiscon);
      fSessionHierarchy->SetToolTipItem(item, "PROOF Lite");
      TSessionDescription *litedesc = new TSessionDescription();
      litedesc->fTag = "";
      litedesc->fName = "PROOF Lite";
      litedesc->fAddress = "lite://";
      litedesc->fPort = 0;
      litedesc->fConfigFile = "";
      litedesc->fLogLevel = 0;
      litedesc->fUserName = "";
      litedesc->fQueries = new TList();
      litedesc->fPackages = new TList();
      litedesc->fActQuery = 0;
      litedesc->fProof = 0;
      litedesc->fProofMgr = 0;
      litedesc->fAttached = kFALSE;
      litedesc->fConnected = kFALSE;
      litedesc->fLocal = kFALSE;
      litedesc->fSync = kTRUE;
      litedesc->fAutoEnable = kFALSE;
      litedesc->fNbHistos = 0;
      item->SetUserData(litedesc);
      fSessions->Add((TObject *)litedesc);
      fActDesc = litedesc;
   }
   TIter next(fViewerEnv->GetTable());
   TEnvRec *er;
   while ((er = (TEnvRec*) next())) {
      const char *s;
      if ((s = strstr(er->GetName(), "SessionDescription."))) {
         const char *val = fViewerEnv->GetValue(s, (const char*)0);
         if (val) {
            Int_t cnt = 0;
            char *v = StrDup(val);
            s += 7;
            while (1) {
               TString name = strtok(!cnt ? v : 0, ";");
               if (name.IsNull()) break;
               TString sessiontag = strtok(0, ";");
               TString address = strtok(0, ";");
               if (address.IsNull()) break;
               TString port = strtok(0, ";");
               if (port.IsNull()) break;
               TString loglevel = strtok(0, ";");
               if (loglevel.IsNull()) break;
               TString configfile = strtok(0, ";");
               TString user = strtok(0, ";");
               if (user.IsNull()) break;
               TString sync = strtok(0, ";");
               TString autoen = strtok(0, ";");

               // build session description
               proofDesc = new TSessionDescription();
               proofDesc->fTag = sessiontag.Length() > 2 ? sessiontag.Data() : "";
               proofDesc->fName = name;
               proofDesc->fAddress = address;
               proofDesc->fPort = atoi(port);
               proofDesc->fConfigFile = configfile.Length() > 2 ? configfile.Data() : "";
               proofDesc->fLogLevel = atoi(loglevel);
               proofDesc->fConnected = kFALSE;
               proofDesc->fAttached = kFALSE;
               proofDesc->fLocal = kFALSE;
               proofDesc->fQueries = new TList();
               proofDesc->fPackages = new TList();
               proofDesc->fActQuery = 0;
               proofDesc->fProof = 0;
               proofDesc->fProofMgr = 0;
               proofDesc->fSync = (Bool_t)(atoi(sync));
               proofDesc->fAutoEnable = (Bool_t)(atoi(autoen));
               proofDesc->fUserName = user;
               fSessions->Add((TObject *)proofDesc);
               item = fSessionHierarchy->AddItem(
                     fSessionItem, proofDesc->fName.Data(),
                     fProofDiscon, fProofDiscon);
               fSessionHierarchy->SetToolTipItem(item, "Proof Session");
               item->SetUserData(proofDesc);
               fActDesc = proofDesc;
               cnt++;
            }
            delete [] v;
         }
      }
      if ((s = strstr(er->GetName(), "QueryDescription."))) {
         const char *val = fViewerEnv->GetValue(s, (const char*)0);
         if (val) {
            Int_t cnt = 0;
            char *v = StrDup(val);
            s += 7;
            while (1) {

               TString status = strtok(!cnt ? v : 0, ";");
               if (status.IsNull()) break;

               TString reference = strtok(0, ";");
               if (reference.IsNull()) break;
               TString queryname = strtok(0, ";");
               if (queryname.IsNull()) break;
               TString selector = strtok(0, ";");
               if (selector.IsNull()) break;
               TString dset = strtok(0, ";");
               TString options = strtok(0, ";");
               TString eventlist = strtok(0, ";");
               TString nbfiles = strtok(0, ";");
               TString nbentries = strtok(0, ";");
               TString firstentry = strtok(0, ";");

               TQueryDescription *newquery = new TQueryDescription();
               newquery->fStatus =
                  (TQueryDescription::ESessionQueryStatus)(atoi(status));
               newquery->fSelectorString  = selector.Length() > 2 ? selector.Data() : "";
               newquery->fReference       = reference.Length() > 2 ? reference.Data() : "";
               newquery->fTDSetString     = dset.Length() > 2 ? dset.Data() : "";
               newquery->fQueryName       = queryname.Length() > 2 ? queryname.Data() : "";
               newquery->fOptions         = options.Length() > 2 ? options.Data() : "";
               newquery->fEventList       = eventlist.Length() > 2 ? eventlist.Data() : "";
               newquery->fNbFiles         = atoi(nbfiles);
               newquery->fNoEntries       = atoi(nbentries);
               newquery->fFirstEntry      = atoi(firstentry);
               newquery->fResult          = 0;
               newquery->fChain           = 0;
               fActDesc->fQueries->Add((TObject *)newquery);
               cnt++;
               TGListTreeItem *item1 = fSessionHierarchy->FindChildByData(
                     fSessionItem, fActDesc);
               TGListTreeItem *item2 = fSessionHierarchy->AddItem(
                     item1, newquery->fQueryName, fQueryCon, fQueryCon);
               item2->SetUserData(newquery);
            }
            delete [] v;
         }
      }
   }
   fSessionHierarchy->ClearHighlighted();
   fSessionHierarchy->OpenItem(fSessionItem);
   if (fActDesc == localdesc) {
      fSessionHierarchy->HighlightItem(fSessionItem);
      fSessionHierarchy->SetSelected(fSessionItem);
   }
   else {
      fSessionHierarchy->OpenItem(item);
      fSessionHierarchy->HighlightItem(item);
      fSessionHierarchy->SetSelected(item);
   }
   fSessionHierarchy->ClearViewPort();
   fClient->NeedRedraw(fSessionHierarchy);
}

//______________________________________________________________________________
void TSessionViewer::UpdateListOfProofs()
{
   // Update list of existing Proof sessions.

   // get list of proof sessions
   Bool_t found  = kFALSE;
   Bool_t exists = kFALSE;
   TGListTreeItem *item = 0;
   TSeqCollection *proofs = gROOT->GetListOfProofs();
   TSessionDescription *desc = 0;
   TSessionDescription *newdesc;
   if (proofs) {
      TObject *o = proofs->First();
      if (o && dynamic_cast<TProofMgr *>(o)) {
         TProofMgr *mgr = dynamic_cast<TProofMgr *>(o);
         if (mgr && mgr->QuerySessions("L")) {
            TIter nxd(mgr->QuerySessions("L"));
            TProofDesc *d = 0;
            TProof *p = 0;
            while ((d = (TProofDesc *)nxd())) {
               TIter nextfs(fSessions);
               // check if session exists in the list
               exists = kFALSE;
               while ((desc = (TSessionDescription *)nextfs())) {
                  if ((desc->fTag == d->GetName()) ||
                      (desc->fName == d->GetTitle())) {
                     exists = kTRUE;
                     break;
                  }
               }
               TIter nexts(fSessions);
               found = kFALSE;
               p = d->GetProof();
               while ((desc = (TSessionDescription *)nexts())) {
                  if (desc->fConnected && desc->fAttached)
                     continue;
                  if (p && ((exists && ((desc->fTag == d->GetName()) ||
                      (desc->fName == d->GetTitle()))) ||
                      (!exists && (desc->fAddress == p->GetMaster())))) {
                     desc->fConnected  = kTRUE;
                     desc->fAttached   = kTRUE;
                     desc->fProof      = p;
                     desc->fProofMgr   = mgr;
                     desc->fTag        = d->GetName();
                     item = fSessionHierarchy->FindChildByData(fSessionItem,
                                                               desc);
                     if (item) {
                        item->SetPictures(fProofCon, fProofCon);
                        if (item == fSessionHierarchy->GetSelected()) {
                           fActDesc->fProof->Connect("Progress(Long64_t,Long64_t)",
                                    "TSessionQueryFrame", fQueryFrame,
                                    "Progress(Long64_t,Long64_t)");
                           fActDesc->fProof->Connect("Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)",
                                    "TSessionQueryFrame", fQueryFrame,
                                    "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)");
                           fActDesc->fProof->Connect("StopProcess(Bool_t)",
                                    "TSessionQueryFrame", fQueryFrame,
                                    "IndicateStop(Bool_t)");
                           fActDesc->fProof->Connect(
                              "ResetProgressDialog(const char*, Int_t,Long64_t,Long64_t)",
                              "TSessionQueryFrame", fQueryFrame,
                              "ResetProgressDialog(const char*,Int_t,Long64_t,Long64_t)");
                           // enable timer used for status bar icon's animation
                           EnableTimer();
                           // change status bar right icon to connected pixmap
                           ChangeRightLogo("monitor01.xpm");
                           // do not animate yet
                           SetChangePic(kFALSE);
                           // connect to signal "query result ready"
                           fActDesc->fProof->Connect("QueryResultReady(char *)",
                                    "TSessionViewer", this, "QueryResultReady(char *)");
                           // display connection information on status bar
                           TString msg;
                           msg.Form("PROOF Cluster %s ready", fActDesc->fName.Data());
                           fStatusBar->SetText(msg.Data(), 1);
                           UpdateListOfPackages();
                           fSessionFrame->UpdatePackages();
                           fSessionFrame->UpdateListOfDataSets();
                           fPopupSrv->DisableEntry(kSessionConnect);
                           fSessionMenu->DisableEntry(kSessionConnect);
                           fPopupSrv->EnableEntry(kSessionDisconnect);
                           fSessionMenu->EnableEntry(kSessionDisconnect);
                           if (fToolBar->GetButton(kSessionDisconnect))
                              fToolBar->GetButton(kSessionDisconnect)->SetState(kButtonUp);
                           if (fToolBar->GetButton(kSessionConnect))
                              fToolBar->GetButton(kSessionConnect)->SetState(kButtonDisabled);
                           fSessionFrame->SetLogLevel(fActDesc->fLogLevel);
                           // update session information frame
                           fSessionFrame->ProofInfos();
                           fSessionFrame->SetLocal(kFALSE);
                           if (fActFrame != fSessionFrame) {
                              fV2->HideFrame(fActFrame);
                              fV2->ShowFrame(fSessionFrame);
                              fActFrame = fSessionFrame;
                           }
                        }
                     }
                     if (desc->fLogLevel < 0)
                        desc->fLogLevel = 0;
                     found = kTRUE;
                     break;
                  }
               }
               if (found) continue;
               newdesc = new TSessionDescription();
               // and fill information from Proof session
               newdesc->fTag       = d->GetName();
               newdesc->fName      = d->GetTitle();
               newdesc->fAddress   = d->GetTitle();
               newdesc->fConnected = kFALSE;
               newdesc->fAttached  = kFALSE;
               newdesc->fProofMgr  = mgr;
               p = d->GetProof();
               if (p) {
                  newdesc->fConnected  = kTRUE;
                  newdesc->fAttached   = kTRUE;
                  if (p->IsLite())
                     newdesc->fAddress = "lite://";
                  else
                     newdesc->fAddress = p->GetMaster();
                  newdesc->fConfigFile = p->GetConfFile();
                  newdesc->fUserName   = p->GetUser();
                  newdesc->fPort       = p->GetPort();
                  newdesc->fLogLevel   = p->GetLogLevel();
                  newdesc->fProof      = p;
                  newdesc->fProof->Connect("Progress(Long64_t,Long64_t)",
                           "TSessionQueryFrame", fQueryFrame,
                           "Progress(Long64_t,Long64_t)");
                  newdesc->fProof->Connect("Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)",
                           "TSessionQueryFrame", fQueryFrame,
                           "Progress(Long64_t,Long64_t,Long64_t,Float_t,Float_t,Float_t,Float_t)");
                  newdesc->fProof->Connect("StopProcess(Bool_t)",
                           "TSessionQueryFrame", fQueryFrame,
                           "IndicateStop(Bool_t)");
                  newdesc->fProof->Connect(
                           "ResetProgressDialog(const char*, Int_t,Long64_t,Long64_t)",
                           "TSessionQueryFrame", fQueryFrame,
                           "ResetProgressDialog(const char*,Int_t,Long64_t,Long64_t)");
                  // enable timer used for status bar icon's animation
                  EnableTimer();
                  // change status bar right icon to connected pixmap
                  ChangeRightLogo("monitor01.xpm");
                  // do not animate yet
                  SetChangePic(kFALSE);
                  // connect to signal "query result ready"
                  newdesc->fProof->Connect("QueryResultReady(char *)",
                           "TSessionViewer", this, "QueryResultReady(char *)");
               }
               newdesc->fQueries    = new TList();
               newdesc->fPackages   = new TList();
               if (newdesc->fLogLevel < 0)
                  newdesc->fLogLevel = 0;
               newdesc->fActQuery   = 0;
               newdesc->fLocal = kFALSE;
               newdesc->fSync = kFALSE;
               newdesc->fAutoEnable = kFALSE;
               newdesc->fNbHistos = 0;
               // add new session description in list tree
               if (p)
                  item = fSessionHierarchy->AddItem(fSessionItem, newdesc->fName.Data(),
                           fProofCon, fProofCon);
               else
                  item = fSessionHierarchy->AddItem(fSessionItem, newdesc->fName.Data(),
                           fProofDiscon, fProofDiscon);
               fSessionHierarchy->SetToolTipItem(item, "Proof Session");
               item ->SetUserData(newdesc);
               // and in our session description list
               fSessions->Add(newdesc);
            }
         }
         return;
      }
      TIter nextp(proofs);
      TProof *proof;
      // loop over existing Proof sessions
      while ((proof = (TProof *)nextp())) {
         TIter nexts(fSessions);
         found = kFALSE;
         // check if session is already in the list
         while ((desc = (TSessionDescription *)nexts())) {
            if (desc->fProof == proof) {
               desc->fConnected = kTRUE;
               desc->fAttached = kTRUE;
               found = kTRUE;
               break;
            }
         }
         if (found) continue;
         // create new session description
         newdesc = new TSessionDescription();
         // and fill information from Proof session
         newdesc->fName       = proof->GetMaster();
         newdesc->fConfigFile = proof->GetConfFile();
         newdesc->fUserName   = proof->GetUser();
         newdesc->fPort       = proof->GetPort();
         newdesc->fLogLevel   = proof->GetLogLevel();
         if (newdesc->fLogLevel < 0)
            newdesc->fLogLevel = 0;
         if (proof->IsLite())
            newdesc->fAddress = "lite://";
         else
            newdesc->fAddress = proof->GetMaster();
         newdesc->fQueries    = new TList();
         newdesc->fPackages   = new TList();
         newdesc->fProof      = proof;
         newdesc->fActQuery   = 0;
         newdesc->fConnected = kTRUE;
         newdesc->fAttached = kTRUE;
         newdesc->fLocal = kFALSE;
         newdesc->fSync = kFALSE;
         newdesc->fAutoEnable = kFALSE;
         newdesc->fNbHistos = 0;
         // add new session description in list tree
         item = fSessionHierarchy->AddItem(fSessionItem, newdesc->fName.Data(),
                  fProofCon, fProofCon);
         fSessionHierarchy->SetToolTipItem(item, "Proof Session");
         item ->SetUserData(newdesc);
         // and in our session description list
         fSessions->Add(newdesc);
      }
   }
}

//______________________________________________________________________________
void TSessionViewer::UpdateListOfSessions()
{
   // Update list of existing Proof sessions.

   // get list of proof sessions
   TGListTreeItem *item;
   TList *sessions = fActDesc->fProofMgr->QuerySessions("");
   if (sessions) {
      TIter nextp(sessions);
      TProofDesc *pdesc;
      TProof *proof;
      TSessionDescription *newdesc;
      // loop over existing Proof sessions
      while ((pdesc = (TProofDesc *)nextp())) {
         TIter nexts(fSessions);
         TSessionDescription *desc = 0;
         Bool_t found = kFALSE;
         // check if session is already in the list
         while ((desc = (TSessionDescription *)nexts())) {
            if ((desc->fTag == pdesc->GetName()) ||
                (desc->fName == pdesc->GetTitle())) {
               desc->fConnected = kTRUE;
               found = kTRUE;
               break;
            }
         }
         if (found) continue;
         // create new session description
         newdesc = new TSessionDescription();
         // and fill information from Proof session
         newdesc->fTag        = pdesc->GetName();
         newdesc->fName       = pdesc->GetTitle();
         proof = pdesc->GetProof();
         if (proof) {
            newdesc->fConfigFile = proof->GetConfFile();
            newdesc->fUserName   = proof->GetUser();
            newdesc->fPort       = proof->GetPort();
            newdesc->fLogLevel   = proof->GetLogLevel();
            if (newdesc->fLogLevel < 0)
               newdesc->fLogLevel = 0;
            if (proof->IsLite())
               newdesc->fAddress = "lite://";
            else
               newdesc->fAddress = proof->GetMaster();
            newdesc->fProof      = proof;
         }
         else {
            newdesc->fProof      = 0;
            newdesc->fConfigFile = "";
            newdesc->fUserName   = fActDesc->fUserName;
            newdesc->fPort       = fActDesc->fPort;
            newdesc->fLogLevel   = 0;
            newdesc->fAddress    = fActDesc->fAddress;
         }
         newdesc->fQueries    = new TList();
         newdesc->fPackages   = new TList();
         newdesc->fProofMgr   = fActDesc->fProofMgr;
         newdesc->fActQuery   = 0;
         newdesc->fConnected  = kTRUE;
         newdesc->fAttached   = kFALSE;
         newdesc->fLocal      = kFALSE;
         newdesc->fSync       = kFALSE;
         newdesc->fAutoEnable = kFALSE;
         newdesc->fNbHistos   = 0;
         // add new session description in list tree
         item = fSessionHierarchy->AddItem(fSessionItem, newdesc->fName.Data(),
                  fProofDiscon, fProofDiscon);
         fSessionHierarchy->SetToolTipItem(item, "Proof Session");
         item ->SetUserData(newdesc);
         // and in our session description list
         fSessions->Add(newdesc);
         // set actual description to the last one
      }
   }
}

//______________________________________________________________________________
void TSessionViewer::WriteConfiguration(const char *filename)
{
   // Save actual configuration in config file "filename".

   TSessionDescription *session;
   TQueryDescription *query;
   Int_t scnt = 0, qcnt = 1;
   const char *fname = filename ? filename : fConfigFile.Data();

   delete fViewerEnv;
   gSystem->Unlink(fname);
   fViewerEnv = new TEnv();

   fViewerEnv->SetValue("Option.Feedback",
         (Int_t)fOptionsMenu->IsEntryChecked(kOptionsFeedback));
   fViewerEnv->SetValue("Option.MasterHistos",
         (Int_t)fOptionsMenu->IsEntryChecked(kOptionsStatsHist));
   fViewerEnv->SetValue("Option.MasterEvents",
         (Int_t)fOptionsMenu->IsEntryChecked(kOptionsStatsTrace));
   fViewerEnv->SetValue("Option.WorkerEvents",
         (Int_t)fOptionsMenu->IsEntryChecked(kOptionsSlaveStatsTrace));

   Int_t i = 0;
   // browse list of feedback histos and check user's selected ones
   while (kFeedbackHistos[i]) {
      fViewerEnv->SetValue(Form("Option.%s",kFeedbackHistos[i]),
         (Int_t)fCascadeMenu->IsEntryChecked(41+i));
      i++;
   }

   TIter snext(fSessions);
   while ((session = (TSessionDescription *) snext())) {
      if ((scnt > 0) && ((session->fAddress.Length() < 3) ||
           session->fUserName.Length() < 2)) {
         // skip gROOT's list of sessions
         continue;
      }
      if ((scnt > 0) && (session->fName == session->fAddress)) {
         // skip gROOT's list of proofs
         continue;
      }
      TString sessionstring;
      sessionstring += session->fName;
      sessionstring += ";";
      sessionstring += session->fTag.Length() > 1 ? session->fTag.Data() : " ";
      sessionstring += ";";
      sessionstring += session->fAddress;
      sessionstring += ";";
      sessionstring += TString::Format("%d", session->fPort);
      sessionstring += ";";
      sessionstring += TString::Format("%d", session->fLogLevel);
      sessionstring += ";";
      sessionstring += session->fConfigFile.Length() > 1 ? session->fConfigFile.Data() : " ";
      sessionstring += ";";
      sessionstring += session->fUserName;
      sessionstring += ";";
      sessionstring += TString::Format("%d", session->fSync);
      sessionstring += ";";
      sessionstring += TString::Format("%d", session->fAutoEnable);
      if (scnt > 0) // skip local session
         fViewerEnv->SetValue(Form("SessionDescription.%d",scnt), sessionstring);
      scnt++;

      TIter qnext(session->fQueries);
      while ((query = (TQueryDescription *) qnext())) {
         TString querystring;
         querystring += TString::Format("%d", query->fStatus);
         querystring += ";";
         querystring += query->fReference.Length() > 1 ? query->fReference.Data() : " ";
         querystring += ";";
         querystring += query->fQueryName;
         querystring += ";";
         querystring += query->fSelectorString.Length() > 1 ? query->fSelectorString.Data() : " ";
         querystring += ";";
         querystring += query->fTDSetString.Length() > 1 ? query->fTDSetString.Data() : " ";
         querystring += ";";
         querystring += query->fOptions.Length() > 1 ? query->fOptions.Data() : " ";
         querystring += ";";
         querystring += query->fEventList.Length() > 1 ? query->fEventList.Data() : " ";
         querystring += ";";
         querystring += TString::Format("%d",query->fNbFiles);
         querystring += ";";
         querystring += TString::Format("%lld",query->fNoEntries);
         querystring += ";";
         querystring += TString::Format("%lld",query->fFirstEntry);
         fViewerEnv->SetValue(Form("QueryDescription.%d",qcnt), querystring);
         qcnt++;
      }
   }

   fViewerEnv->WriteFile(fname);
}

//______________________________________________________________________________
void TSessionViewer::Build()
{
   // Build main session viewer frame and subframes.

   TString buf;
   fActDesc = 0;
   fActFrame = 0;
   fLogWindow = 0;
   fBusy = kFALSE;
   fAutoSave = kTRUE;
   fChangePic = kFALSE;
   fStart = fElapsed = 0;

   SetCleanup(kDeepCleanup);
   // set minimun size
   SetWMSizeHints(400 + 200, 370+50, 2000, 1000, 1, 1);

   // collect icons
   fLocal = fClient->GetPicture("local_session.xpm");
   fProofCon = fClient->GetPicture("proof_connected.xpm");
   fProofDiscon = fClient->GetPicture("proof_disconnected.xpm");
   fQueryCon = fClient->GetPicture("query_connected.xpm");
   fQueryDiscon = fClient->GetPicture("query_disconnected.xpm");
   fBaseIcon = fClient->GetPicture("proof_base.xpm");

   //--- File menu
   fFileMenu = new TGPopupMenu(fClient->GetDefaultRoot());
   fFileMenu->AddEntry("&Load Config...", kFileLoadConfig);
   fFileMenu->AddEntry("&Save Config...", kFileSaveConfig);
   fFileMenu->AddSeparator();
   fFileMenu->AddEntry("&Close Viewer",    kFileCloseViewer);
   fFileMenu->AddSeparator();
   fFileMenu->AddEntry("&Quit ROOT",       kFileQuit);

   //--- Session menu
   fSessionMenu = new TGPopupMenu(gClient->GetDefaultRoot());
   fSessionMenu->AddLabel("Session Management");
   fSessionMenu->AddSeparator();
   fSessionMenu->AddEntry("&New Session", kSessionNew);
   fSessionMenu->AddEntry("&Add to the list", kSessionAdd);
   fSessionMenu->AddEntry("De&lete", kSessionDelete);
   fSessionMenu->AddSeparator();
   fSessionMenu->AddEntry("&Connect...", kSessionConnect);
   fSessionMenu->AddEntry("&Disconnect", kSessionDisconnect);
   fSessionMenu->AddEntry("Shutdo&wn",  kSessionShutdown);
   fSessionMenu->AddEntry("&Show status",kSessionShowStatus);
   fSessionMenu->AddEntry("&Get Queries",kSessionGetQueries);
   fSessionMenu->AddSeparator();
   fSessionMenu->AddEntry("&Cleanup", kSessionCleanup);
   fSessionMenu->AddEntry("&Reset",kSessionReset);
   fSessionMenu->DisableEntry(kSessionAdd);

   //--- Query menu
   fQueryMenu = new TGPopupMenu(gClient->GetDefaultRoot());
   fQueryMenu->AddLabel("Query Management");
   fQueryMenu->AddSeparator();
   fQueryMenu->AddEntry("&New...", kQueryNew);
   fQueryMenu->AddEntry("&Edit", kQueryEdit);
   fQueryMenu->AddEntry("&Submit", kQuerySubmit);
   fQueryMenu->AddSeparator();
   fQueryMenu->AddEntry("Start &Viewer", kQueryStartViewer);
   fQueryMenu->AddSeparator();
   fQueryMenu->AddEntry("&Delete", kQueryDelete);

   fViewerEnv = 0;
#ifdef WIN32
   fConfigFile = TString::Format("%s\\%s", gSystem->HomeDirectory(), kConfigFile);
#else
   fConfigFile = TString::Format("%s/%s", gSystem->HomeDirectory(), kConfigFile);
#endif

   fCascadeMenu = new TGPopupMenu(fClient->GetDefaultRoot());
   Int_t i = 0;
   while (kFeedbackHistos[i]) {
      fCascadeMenu->AddEntry(kFeedbackHistos[i], 41+i);
      i++;
   }
   fCascadeMenu->AddEntry("User defined...", 50);
   // disable it for now (until implemented)
   fCascadeMenu->DisableEntry(50);

   //--- Options menu
   fOptionsMenu = new TGPopupMenu(fClient->GetDefaultRoot());
   fOptionsMenu->AddLabel("Global Options");
   fOptionsMenu->AddSeparator();
   fOptionsMenu->AddEntry("&Autosave Config", kOptionsAutoSave);
   fOptionsMenu->AddSeparator();
   fOptionsMenu->AddEntry("Master &Histos", kOptionsStatsHist);
   fOptionsMenu->AddEntry("&Master Events", kOptionsStatsTrace);
   fOptionsMenu->AddEntry("&Worker Events", kOptionsSlaveStatsTrace);
   fOptionsMenu->AddSeparator();
   fOptionsMenu->AddEntry("Feedback &Active", kOptionsFeedback);
   fOptionsMenu->AddSeparator();
   fOptionsMenu->AddPopup("&Feedback Histos", fCascadeMenu);
   fOptionsMenu->CheckEntry(kOptionsAutoSave);

   //--- Help menu
   fHelpMenu = new TGPopupMenu(gClient->GetDefaultRoot());
   fHelpMenu->AddEntry("&About ROOT...",  kHelpAbout);

   fFileMenu->Associate(this);
   fSessionMenu->Associate(this);
   fQueryMenu->Associate(this);
   fOptionsMenu->Associate(this);
   fCascadeMenu->Associate(this);
   fHelpMenu->Associate(this);

   //--- create menubar and add popup menus
   fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);

   fMenuBar->AddPopup("&File", fFileMenu, new TGLayoutHints(kLHintsTop |
         kLHintsLeft, 0, 4, 0, 0));
   fMenuBar->AddPopup("&Session", fSessionMenu, new TGLayoutHints(kLHintsTop |
         kLHintsLeft, 0, 4, 0, 0));
   fMenuBar->AddPopup("&Query",  fQueryMenu, new TGLayoutHints(kLHintsTop |
         kLHintsLeft, 0, 4, 0, 0));
   fMenuBar->AddPopup("&Options",  fOptionsMenu, new TGLayoutHints(kLHintsTop |
         kLHintsLeft, 0, 4, 0, 0));
   fMenuBar->AddPopup("&Help", fHelpMenu, new TGLayoutHints(kLHintsTop |
         kLHintsRight));

   TGHorizontal3DLine *toolBarSep = new TGHorizontal3DLine(this);
   AddFrame(toolBarSep, new TGLayoutHints(kLHintsTop | kLHintsExpandX));

   AddFrame(fMenuBar, new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX, 0, 0, 1, 1));

   toolBarSep = new TGHorizontal3DLine(this);
   AddFrame(toolBarSep, new TGLayoutHints(kLHintsTop | kLHintsExpandX));

   //---- toolbar

   int spacing = 8;
   fToolBar = new TGToolBar(this, 60, 20, kHorizontalFrame);
   for (int ii = 0; xpm_toolbar[ii]; ii++) {
      tb_data[ii].fPixmap = xpm_toolbar[ii];
      if (strlen(xpm_toolbar[ii]) == 0) {
         spacing = 8;
         continue;
      }
      fToolBar->AddButton(this, &tb_data[ii], spacing);
      spacing = 0;
   }
   AddFrame(fToolBar, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 0, 0));
   toolBarSep = new TGHorizontal3DLine(this);
   AddFrame(toolBarSep, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
   if (fToolBar->GetButton(kQuerySubmit))
      fToolBar->GetButton(kQuerySubmit)->SetState(kButtonDisabled);

   fPopupSrv = new TGPopupMenu(fClient->GetDefaultRoot());
   fPopupSrv->AddEntry("Connect",kSessionConnect);
   fPopupSrv->AddEntry("Disconnect",kSessionDisconnect);
   fPopupSrv->AddEntry("Shutdown",kSessionShutdown);
   fPopupSrv->AddEntry("Browse",kSessionBrowse);
   fPopupSrv->AddEntry("Show status",kSessionShowStatus);
   fPopupSrv->AddEntry("Delete", kSessionDelete);
   fPopupSrv->AddEntry("Get Queries",kSessionGetQueries);
   fPopupSrv->AddSeparator();
   fPopupSrv->AddEntry("Cleanup", kSessionCleanup);
   fPopupSrv->AddEntry("Reset",kSessionReset);
   fPopupSrv->Connect("Activated(Int_t)","TSessionViewer", this,
         "MyHandleMenu(Int_t)");

   fPopupQry = new TGPopupMenu(fClient->GetDefaultRoot());
   fPopupQry->AddEntry("Edit",kQueryEdit);
   fPopupQry->AddEntry("Submit",kQuerySubmit);
   fPopupQry->AddSeparator();
   fPopupQry->AddEntry("Start &Viewer", kQueryStartViewer);
   fPopupQry->AddSeparator();
   fPopupQry->AddEntry("Delete",kQueryDelete);
   fPopupQry->Connect("Activated(Int_t)","TSessionViewer", this,
         "MyHandleMenu(Int_t)");


   fSessionMenu->DisableEntry(kSessionGetQueries);
   fSessionMenu->DisableEntry(kSessionShowStatus);
   fPopupSrv->DisableEntry(kSessionGetQueries);
   fPopupSrv->DisableEntry(kSessionShowStatus);
   fPopupSrv->DisableEntry(kSessionDisconnect);
   fPopupSrv->DisableEntry(kSessionShutdown);
   fPopupSrv->DisableEntry(kSessionCleanup);
   fPopupSrv->DisableEntry(kSessionReset);
   fSessionMenu->DisableEntry(kSessionDisconnect);
   fSessionMenu->DisableEntry(kSessionShutdown);
   fSessionMenu->DisableEntry(kSessionCleanup);
   fSessionMenu->DisableEntry(kSessionReset);
   if (fToolBar->GetButton(kSessionDisconnect))
      fToolBar->GetButton(kSessionDisconnect)->SetState(kButtonDisabled);

   //--- Horizontal mother frame -----------------------------------------------
   fHf = new TGHorizontalFrame(this, 10, 10);
   fHf->SetCleanup(kDeepCleanup);

   //--- fV1 -------------------------------------------------------------------
   fV1 = new TGVerticalFrame(fHf, 100, 100, kFixedWidth);
   fV1->SetCleanup(kDeepCleanup);

   fTreeView = new TGCanvas(fV1, 100, 200, kSunkenFrame | kDoubleBorder);
   fV1->AddFrame(fTreeView, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
         2, 0, 0, 0));
   fSessionHierarchy = new TGListTree(fTreeView, kHorizontalFrame);
   fSessionHierarchy->DisableOpen();
   fSessionHierarchy->Connect("Clicked(TGListTreeItem*,Int_t,Int_t,Int_t)",
         "TSessionViewer", this,
         "OnListTreeClicked(TGListTreeItem*, Int_t, Int_t, Int_t)");
   fSessionHierarchy->Connect("DoubleClicked(TGListTreeItem*,Int_t)",
         "TSessionViewer", this,
         "OnListTreeDoubleClicked(TGListTreeItem*, Int_t)");
   fV1->Resize(fTreeView->GetDefaultWidth()+100, fV1->GetDefaultHeight());

   //--- fV2 -------------------------------------------------------------------
   fV2 = new TGVerticalFrame(fHf, 350, 310);
   fV2->SetCleanup(kDeepCleanup);

   //--- Server Frame ----------------------------------------------------------
   fServerFrame = new TSessionServerFrame(fV2, 350, 310);
   fSessions = new TList;
   ReadConfiguration();
   fServerFrame->Build(this);
   fV2->AddFrame(fServerFrame, new TGLayoutHints(kLHintsTop | kLHintsExpandX |
         kLHintsExpandY, 2, 0, 1, 2));

   //--- Session Frame ---------------------------------------------------------
   fSessionFrame = new TSessionFrame(fV2, 350, 310);
   fSessionFrame->Build(this);
   fV2->AddFrame(fSessionFrame, new TGLayoutHints(kLHintsTop | kLHintsExpandX |
         kLHintsExpandY, 2, 0, 1, 2));

   //--- Query Frame -----------------------------------------------------------
   fQueryFrame = new TSessionQueryFrame(fV2, 350, 310);
   fQueryFrame->Build(this);
   fV2->AddFrame(fQueryFrame, new TGLayoutHints(kLHintsTop | kLHintsExpandX |
         kLHintsExpandY, 2, 0, 1, 2));

   //--- Output Frame ----------------------------------------------------------
   fOutputFrame = new TSessionOutputFrame(fV2, 350, 310);
   fOutputFrame->Build(this);
   fV2->AddFrame(fOutputFrame, new TGLayoutHints(kLHintsTop | kLHintsExpandX |
         kLHintsExpandY, 2, 0, 1, 2));

   //--- Input Frame -----------------------------------------------------------
   fInputFrame = new TSessionInputFrame(fV2, 350, 310);
   fInputFrame->Build(this);
   fV2->AddFrame(fInputFrame, new TGLayoutHints(kLHintsTop | kLHintsExpandX |
         kLHintsExpandY, 2, 0, 1, 2));

   fHf->AddFrame(fV1, new TGLayoutHints(kLHintsLeft | kLHintsExpandY));

   // add vertical splitter between list tree and frames
   TGVSplitter *splitter = new TGVSplitter(fHf, 4);
   splitter->SetFrame(fV1, kTRUE);
   fHf->AddFrame(splitter,new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
   fHf->AddFrame(new TGVertical3DLine(fHf), new TGLayoutHints(kLHintsLeft |
         kLHintsExpandY));

   fHf->AddFrame(fV2, new TGLayoutHints(kLHintsRight | kLHintsExpandX |
         kLHintsExpandY));

   AddFrame(fHf, new TGLayoutHints(kLHintsRight | kLHintsExpandX |
         kLHintsExpandY));

   // if description available, update server infos frame
   if (fActDesc) {
      if (!fActDesc->fLocal) {
         fServerFrame->Update(fActDesc);
      }
      else {
         fServerFrame->SetAddEnabled();
         fServerFrame->SetConnectEnabled(kFALSE);
      }
   }

   //--- Status Bar ------------------------------------------------------------
   int parts[] = { 36, 49, 15 };
   fStatusBar = new TGStatusBar(this, 10, 10);
   fStatusBar->SetCleanup(kDeepCleanup);
   fStatusBar->SetParts(parts, 3);
   for (int p = 0; p < 3; ++p)
      fStatusBar->GetBarPart(p)->SetCleanup(kDeepCleanup);
   AddFrame(fStatusBar, new TGLayoutHints(kLHintsTop | kLHintsLeft |
         kLHintsExpandX, 0, 0, 1, 1));

   // connection icon (animation) and time info
   fStatusBar->SetText("      00:00:00", 2);
   TGCompositeFrame *leftpart = fStatusBar->GetBarPart(2);
   fRightIconPicture = (TGPicture *)fClient->GetPicture("proof_disconnected.xpm");
   fRightIcon = new TGIcon(leftpart, fRightIconPicture,
         fRightIconPicture->GetWidth(),fRightIconPicture->GetHeight());
   leftpart->AddFrame(fRightIcon, new TGLayoutHints(kLHintsLeft, 2, 0, 0, 0));

   // connection progress bar
   TGCompositeFrame *rightpart = fStatusBar->GetBarPart(0);
   fConnectProg = new TGHProgressBar(rightpart, TGProgressBar::kStandard, 100);
   fConnectProg->ShowPosition();
   fConnectProg->SetBarColor("green");
   rightpart->AddFrame(fConnectProg, new TGLayoutHints(kLHintsExpandX, 1, 1, 1, 1));

   // add user info
   fUserGroup = gSystem->GetUserInfo();
   buf.Form("User : %s - %s", fUserGroup->fRealName.Data(),
             fUserGroup->fGroup.Data());
   fStatusBar->SetText(buf.Data(), 1);

   fTimer = 0;

   // create context menu
   fContextMenu = new TContextMenu("SessionViewerContextMenu") ;

   SetWindowName("ROOT Session Viewer");
   MapSubwindows();
   MapWindow();

   // hide frames
   fServerFrame->SetAddEnabled(kFALSE);
   fStatusBar->GetBarPart(0)->HideFrame(fConnectProg);
   fV2->HideFrame(fSessionFrame);
   fV2->HideFrame(fQueryFrame);
   fV2->HideFrame(fOutputFrame);
   fV2->HideFrame(fInputFrame);
   fQueryFrame->GetQueryEditFrame()->OnNewQueryMore();
   fActFrame = fServerFrame;
   UpdateListOfProofs();
   Resize(610, 420);
}

//______________________________________________________________________________
TSessionViewer::~TSessionViewer()
{
   // Destructor.

   delete fUserGroup;
   if (gSessionViewer == this)
      gSessionViewer = 0;
}

//______________________________________________________________________________
void TSessionViewer::OnListTreeClicked(TGListTreeItem *entry, Int_t btn,
                                       Int_t x, Int_t y)
{
   // Handle mouse clicks in list tree.

   TList *objlist;
   TObject *obj;
   TString msg;

   fSessionMenu->DisableEntry(kSessionAdd);
   if (fToolBar->GetButton(kQuerySubmit))
      fToolBar->GetButton(kQuerySubmit)->SetState(kButtonDisabled);
   if (entry->GetParent() == 0) {  // PROOF
      // switch frames only if actual one doesn't match
      if (fActFrame != fServerFrame) {
         fV2->HideFrame(fActFrame);
         fV2->ShowFrame(fServerFrame);
         fActFrame = fServerFrame;
      }
      fSessionMenu->DisableEntry(kSessionDelete);
      fSessionMenu->EnableEntry(kSessionAdd);
      fServerFrame->SetAddEnabled();
      fServerFrame->SetConnectEnabled(kFALSE);
      fPopupSrv->DisableEntry(kSessionConnect);
      fSessionMenu->DisableEntry(kSessionConnect);
      if (fToolBar->GetButton(kSessionConnect))
         fToolBar->GetButton(kSessionConnect)->SetState(kButtonDisabled);
   }
   else if (entry->GetParent()->GetParent() == 0) { // Server
      if (entry->GetUserData()) {
         obj = (TObject *)entry->GetUserData();
         if (!obj || obj->IsA() != TSessionDescription::Class())
            return;
         // update server frame information
         fServerFrame->Update((TSessionDescription *)obj);
         fActDesc = (TSessionDescription*)obj;
         // if Proof valid, update connection infos
         if (fActDesc->fConnected && fActDesc->fAttached &&
             fActDesc->fProof && fActDesc->fProof->IsValid()) {
            fActDesc->fProof->cd();
            msg.Form("PROOF Cluster %s ready", fActDesc->fName.Data());
         }
         else {
            msg.Form("PROOF Cluster %s not connected", fActDesc->fName.Data());
         }
         fStatusBar->SetText(msg.Data(), 1);
      }
      if ((fActDesc->fConnected) && (fActDesc->fAttached)) {
         fPopupSrv->DisableEntry(kSessionConnect);
         fSessionMenu->DisableEntry(kSessionConnect);
         if (fToolBar->GetButton(kSessionConnect))
            fToolBar->GetButton(kSessionConnect)->SetState(kButtonDisabled);
         UpdateListOfPackages();
         fSessionFrame->UpdateListOfDataSets();
      }
      else {
         fPopupSrv->EnableEntry(kSessionConnect);
         fSessionMenu->EnableEntry(kSessionConnect);
         if (fToolBar->GetButton(kSessionConnect))
            fToolBar->GetButton(kSessionConnect)->SetState(kButtonUp);
      }
      // local session
      if (fActDesc->fLocal) {
         if (fActFrame != fSessionFrame) {
            fV2->HideFrame(fActFrame);
            fV2->ShowFrame(fSessionFrame);
            fActFrame = fSessionFrame;
            UpdateListOfPackages();
            fSessionFrame->UpdateListOfDataSets();
         }
         fSessionFrame->SetLocal();
         fServerFrame->SetAddEnabled();
         fServerFrame->SetConnectEnabled(kFALSE);
      }
      // proof session not connected
      if ((!fActDesc->fLocal) && (!fActDesc->fAttached) &&
          (fActFrame != fServerFrame)) {
         fV2->HideFrame(fActFrame);
         fV2->ShowFrame(fServerFrame);
         fActFrame = fServerFrame;
      }
      // proof session connected
      if ((!fActDesc->fLocal) && (fActDesc->fConnected) &&
          (fActDesc->fAttached)) {
         if (fActFrame != fSessionFrame) {
            fV2->HideFrame(fActFrame);
            fV2->ShowFrame(fSessionFrame);
            fActFrame = fSessionFrame;
         }
         fSessionFrame->SetLocal(kFALSE);
      }
      fSessionFrame->SetLogLevel(fActDesc->fLogLevel);
      fServerFrame->SetLogLevel(fActDesc->fLogLevel);
      if (fActDesc->fAutoEnable)
         fSessionFrame->CheckAutoEnPack(kTRUE);
      else
         fSessionFrame->CheckAutoEnPack(kFALSE);
      // update session information frame
      fSessionFrame->ProofInfos();
      fSessionFrame->UpdatePackages();
      fServerFrame->SetAddEnabled(kFALSE);
      fServerFrame->SetConnectEnabled();
   }
   else if (entry->GetParent()->GetParent()->GetParent() == 0) { // query
      obj = (TObject *)entry->GetParent()->GetUserData();
      if (obj && obj->IsA() == TSessionDescription::Class()) {
         fActDesc = (TSessionDescription *)obj;
      }
      obj = (TObject *)entry->GetUserData();
      if (obj && obj->IsA() == TQueryDescription::Class()) {
         fActDesc->fActQuery = (TQueryDescription *)obj;
      }
      // update query information and buttons state
      fQueryFrame->UpdateInfos();
      fQueryFrame->UpdateButtons(fActDesc->fActQuery);
      if (fActFrame != fQueryFrame) {
         fV2->HideFrame(fActFrame);
         fV2->ShowFrame(fQueryFrame);
         fActFrame = fQueryFrame;
      }
      if ((fActDesc->fConnected) && (fActDesc->fAttached) &&
          (fActDesc->fActQuery->fStatus != TQueryDescription::kSessionQueryRunning) &&
          (fActDesc->fActQuery->fStatus != TQueryDescription::kSessionQuerySubmitted) &&
          (fToolBar->GetButton(kQuerySubmit)) )
         fToolBar->GetButton(kQuerySubmit)->SetState(kButtonUp);
      // trick to update feedback histos
      OnCascadeMenu();
   }
   else {   // a list (input, output)
      obj = (TObject *)entry->GetParent()->GetParent()->GetUserData();
      if (obj && obj->IsA() == TSessionDescription::Class()) {
         fActDesc = (TSessionDescription *)obj;
      }
      obj = (TObject *)entry->GetParent()->GetUserData();
      if (obj && obj->IsA() == TQueryDescription::Class()) {
         fActDesc->fActQuery = (TQueryDescription *)obj;
      }
      if (fActDesc->fActQuery) {
         // update input/output list views
         fInputFrame->RemoveAll();
         fOutputFrame->RemoveAll();
         if (fActDesc->fActQuery->fResult) {
            objlist = fActDesc->fActQuery->fResult->GetOutputList();
            if (objlist) {
               TIter nexto(objlist);
               while ((obj = (TObject *) nexto())) {
                  fOutputFrame->AddObject(obj);
               }
            }
            objlist = fActDesc->fActQuery->fResult->GetInputList();
            if (objlist) {
               TIter nexti(objlist);
               while ((obj = (TObject *) nexti())) {
                  fInputFrame->AddObject(obj);
               }
            }
         }
         else {
            TChain *chain = (TChain *)fActDesc->fActQuery->fChain;
            if (chain) {
               objlist = ((TTreePlayer *)(chain->GetPlayer()))->GetSelectorFromFile()->GetOutputList();
               if (objlist) {
                  TIter nexto(objlist);
                  while ((obj = (TObject *) nexto())) {
                     fOutputFrame->AddObject(obj);
                  }
               }
            }
         }
         fInputFrame->Resize();
         fOutputFrame->Resize();
         fClient->NeedRedraw(fOutputFrame->GetLVContainer());
         fClient->NeedRedraw(fInputFrame->GetLVContainer());
      }
      // switch frames
      if (strstr(entry->GetText(),"Output")) {
         if (fActFrame != fOutputFrame) {
            fV2->HideFrame(fActFrame);
            fV2->ShowFrame(fOutputFrame);
            fActFrame = fOutputFrame;
         }
      }
      else if (strstr(entry->GetText(),"Input")) {
         if (fActFrame != fInputFrame) {
            fV2->HideFrame(fActFrame);
            fV2->ShowFrame(fInputFrame);
            fActFrame = fInputFrame;
         }
      }
   }
   if (btn == 3) { // right button
      // place popup menus
      TGListTreeItem *item = fSessionHierarchy->GetSelected();
      if (!item) return;
      obj = (TObject *)item->GetUserData();
      if (obj && obj->IsA() == TQueryDescription::Class()) {
         fPopupQry->PlaceMenu(x, y, 1, 1);
      }
      else if (obj && obj->IsA() == TSessionDescription::Class()) {
         if (!fActDesc->fLocal)
            fPopupSrv->PlaceMenu(x, y, 1, 1);
      }
   }
   // enable / disable menu entries
   if (fActDesc->fConnected && fActDesc->fAttached) {
      fSessionMenu->EnableEntry(kSessionGetQueries);
      fSessionMenu->EnableEntry(kSessionShowStatus);
      fPopupSrv->EnableEntry(kSessionGetQueries);
      fPopupSrv->EnableEntry(kSessionShowStatus);
      fPopupSrv->EnableEntry(kSessionDisconnect);
      fPopupSrv->EnableEntry(kSessionShutdown);
      fPopupSrv->EnableEntry(kSessionCleanup);
      fPopupSrv->EnableEntry(kSessionReset);
      fSessionMenu->EnableEntry(kSessionDisconnect);
      fSessionMenu->EnableEntry(kSessionShutdown);
      fSessionMenu->EnableEntry(kSessionCleanup);
      fSessionMenu->EnableEntry(kSessionReset);
      if (fToolBar->GetButton(kSessionDisconnect))
         fToolBar->GetButton(kSessionDisconnect)->SetState(kButtonUp);
      fQueryMenu->EnableEntry(kQuerySubmit);
      fPopupQry->EnableEntry(kQuerySubmit);
   }
   else {
      fSessionMenu->DisableEntry(kSessionGetQueries);
      fSessionMenu->DisableEntry(kSessionShowStatus);
      fPopupSrv->DisableEntry(kSessionGetQueries);
      fPopupSrv->DisableEntry(kSessionShowStatus);
      if (entry->GetParent() != 0)
         fSessionMenu->EnableEntry(kSessionDelete);
      fPopupSrv->EnableEntry(kSessionDelete);
      fPopupSrv->DisableEntry(kSessionDisconnect);
      fPopupSrv->DisableEntry(kSessionShutdown);
      fPopupSrv->DisableEntry(kSessionCleanup);
      fPopupSrv->DisableEntry(kSessionReset);
      fSessionMenu->DisableEntry(kSessionDisconnect);
      fSessionMenu->DisableEntry(kSessionShutdown);
      fSessionMenu->DisableEntry(kSessionCleanup);
      fSessionMenu->DisableEntry(kSessionReset);
      if (fToolBar->GetButton(kSessionDisconnect))
         fToolBar->GetButton(kSessionDisconnect)->SetState(kButtonDisabled);
      fQueryMenu->DisableEntry(kQuerySubmit);
      fPopupQry->DisableEntry(kQuerySubmit);
   }
   if (fActDesc->fLocal) {
      fSessionMenu->DisableEntry(kSessionDelete);
      fSessionMenu->DisableEntry(kSessionConnect);
      fSessionMenu->DisableEntry(kSessionDisconnect);
      fSessionMenu->DisableEntry(kSessionShutdown);
      fSessionMenu->DisableEntry(kSessionCleanup);
      fSessionMenu->DisableEntry(kSessionReset);
      if (fToolBar->GetButton(kSessionDisconnect))
         fToolBar->GetButton(kSessionDisconnect)->SetState(kButtonDisabled);
      if (fToolBar->GetButton(kSessionConnect))
         fToolBar->GetButton(kSessionConnect)->SetState(kButtonDisabled);
      fQueryMenu->EnableEntry(kQuerySubmit);
      fPopupQry->EnableEntry(kQuerySubmit);
   }
}

//______________________________________________________________________________
void TSessionViewer::OnListTreeDoubleClicked(TGListTreeItem *entry, Int_t /*btn*/)
{
   // Handle mouse double clicks in list tree (connect to server).

   if (entry == fSessionItem)
      return;
   if (entry->GetParent()->GetParent() == 0) { // Server
      if (entry->GetUserData()) {
         TObject *obj = (TObject *)entry->GetUserData();
         if ((!obj) || (obj->IsA() != TSessionDescription::Class()))
            return;
         fActDesc = (TSessionDescription*)obj;
         // if Proof valid, update connection infos
      }
      if ((!fActDesc->fLocal) && ((!fActDesc->fConnected) ||
          (!fActDesc->fAttached))) {
         fServerFrame->OnBtnConnectClicked();
      }
   }
}

//______________________________________________________________________________
void TSessionViewer::Terminate()
{
   // Terminate Session : save configuration, clean temporary files and close
   // Proof connections.

   // clean-up temporary files
   TString pathtmp;
   pathtmp = TString::Format("%s/%s", gSystem->TempDirectory(), kSession_RedirectFile);
   if (!gSystem->AccessPathName(pathtmp)) {
      gSystem->Unlink(pathtmp);
   }
   pathtmp = TString::Format("%s/%s", gSystem->TempDirectory(), kSession_RedirectCmd);
   if (!gSystem->AccessPathName(pathtmp)) {
      gSystem->Unlink(pathtmp);
   }
   // close opened Proof sessions (if any)
   TIter next(fSessions);
   TSessionDescription *desc = 0;
   while ((desc = (TSessionDescription *)next())) {
      if (desc->fAttached && desc->fProof &&
          desc->fProof->IsValid())
         desc->fProof->Detach();
   }
   // Save configuration
   if (fAutoSave)
      WriteConfiguration();
}

//______________________________________________________________________________
void TSessionViewer::CloseWindow()
{
   // Close main Session Viewer window.

   // clean-up temporary files
   TString pathtmp;
   pathtmp = TString::Format("%s/%s", gSystem->TempDirectory(), kSession_RedirectFile);
   if (!gSystem->AccessPathName(pathtmp)) {
      gSystem->Unlink(pathtmp);
   }
   pathtmp = TString::Format("%s/%s", gSystem->TempDirectory(), kSession_RedirectCmd);
   if (!gSystem->AccessPathName(pathtmp)) {
      gSystem->Unlink(pathtmp);
   }
   // Save configuration
   if (fAutoSave)
      WriteConfiguration();
   Cleanup();
   fSessions->Delete();
   if (fSessionItem)
      fSessionHierarchy->DeleteChildren(fSessionItem);
   delete fSessionHierarchy; // this has been put int TGCanvas which isn't a
                             // TGComposite frame and doesn't do cleanups.
   fClient->FreePicture(fLocal);
   fClient->FreePicture(fProofCon);
   fClient->FreePicture(fProofDiscon);
   fClient->FreePicture(fQueryCon);
   fClient->FreePicture(fQueryDiscon);
   fClient->FreePicture(fBaseIcon);
   delete fTimer;
   DeleteWindow();
}

//______________________________________________________________________________
void TSessionViewer::ChangeRightLogo(const char *name)
{
    // Change the right logo (used for animation).

   fClient->FreePicture(fRightIconPicture);
   fRightIconPicture = (TGPicture *)fClient->GetPicture(name);
   fRightIcon->SetPicture(fRightIconPicture);
}

//______________________________________________________________________________
void TSessionViewer::EnableTimer()
{
   // Enable animation timer.

   if (!fTimer) fTimer = new TTimer(this, 500);
   fTimer->Reset();
   fTimer->TurnOn();
   time( &fStart );
}

//______________________________________________________________________________
void TSessionViewer::DisableTimer()
{
   // Disable animation timer.

   if (fTimer)
      fTimer->TurnOff();
   ChangeRightLogo("proof_disconnected.xpm");
}

//______________________________________________________________________________
Bool_t TSessionViewer::HandleTimer(TTimer *)
{
   // Handle animation timer.

   TString buf;
   struct tm *connected;
   Int_t count = gRandom->Integer(4);
   if (count > 3) {
      count = 0;
   }
   if (fChangePic)
      ChangeRightLogo(xpm_names[count]);
   time( &fElapsed );
   time_t elapsed_time = (time_t)difftime( fElapsed, fStart );
   connected = gmtime( &elapsed_time );
   if (connected) {
      buf.Form("      %02d:%02d:%02d", connected->tm_hour,
               connected->tm_min, connected->tm_sec);
      fStatusBar->SetText(buf.Data(), 2);
   }
   else {
      fStatusBar->SetText("      00:00:00", 2);
   }

   if (fActDesc->fLocal) {
      if ((fActDesc->fActQuery) &&
         (fActDesc->fActQuery->fStatus ==
         TQueryDescription::kSessionQueryRunning)) {
         TChain *chain = (TChain *)fActDesc->fActQuery->fChain;
         if (chain)
            fQueryFrame->ProgressLocal(chain->GetEntries(),
                                       chain->GetReadEntry()+1);
      }
   }

   fTimer->Reset();
   return kTRUE;
}

//______________________________________________________________________________
void TSessionViewer::LogMessage(const char *msg, Bool_t all)
{
   // Load/append a log msg in the log frame.

   if (fLogWindow) {
      if (all) {
         // load buffer
         fLogWindow->LoadBuffer(msg);
      } else {
         // append
         fLogWindow->AddBuffer(msg);
      }
   }
}

//______________________________________________________________________________
void TSessionViewer::QueryResultReady(char *query)
{
   // Handle signal "query result ready" coming from Proof session.

   TString strtmp;
   strtmp.Form("Query Result Ready for %s", query);
   // show information on status bar
   ShowInfo(strtmp.Data());
   TGListTreeItem *item=0, *item2=0;
   TQueryDescription *lquery = 0;
   // loop over actual queries to find which one is ready

   TIter nexts(fSessions);
   TSessionDescription *desc = 0;
   // check if session is already in the list
   while ((desc = (TSessionDescription *)nexts())) {
      if (desc && !desc->fAttached)
         continue;
      TIter nextp(desc->fQueries);
      while ((lquery = (TQueryDescription *)nextp())) {
         if (lquery->fReference.Contains(query)) {
            // results are ready for this query
            lquery->fResult = desc->fProof->GetQueryResult(query);
            lquery->fStatus = TQueryDescription::kSessionQueryFromProof;
            if (!lquery->fResult)
               break;
            // get query status
            lquery->fStatus = lquery->fResult->IsFinalized() ?
               TQueryDescription::kSessionQueryFinalized :
               (TQueryDescription::ESessionQueryStatus)lquery->fResult->GetStatus();
            // get data set
            TObject *o = lquery->fResult->GetInputObject("TDSet");
            if (o)
               lquery->fChain = (TDSet *) o;
            item = fSessionHierarchy->FindItemByObj(fSessionItem, desc);
            if (item) {
               item2 = fSessionHierarchy->FindItemByObj(item, lquery);
            }
            if (item2) {
               // add input and output list entries
               if (lquery->fResult->GetInputList())
                  if (!fSessionHierarchy->FindChildByName(item2, "InputList"))
                     fSessionHierarchy->AddItem(item2, "InputList");
               if (lquery->fResult->GetOutputList())
                  if (!fSessionHierarchy->FindChildByName(item2, "OutputList"))
                     fSessionHierarchy->AddItem(item2, "OutputList");
            }
            // update list tree, query frame information, and buttons state
            fSessionHierarchy->ClearViewPort();
            fClient->NeedRedraw(fSessionHierarchy);
            fQueryFrame->UpdateInfos();
            fQueryFrame->UpdateButtons(lquery);
            break;
         }
      }
   }
}

//______________________________________________________________________________
void TSessionViewer::CleanupSession()
{
   // Clean-up Proof session.

   TGListTreeItem *item = fSessionHierarchy->GetSelected();
   if (!item) return;
   TObject *obj = (TObject *)item->GetUserData();
   if (!obj || obj->IsA() != TSessionDescription::Class()) return;
   if (!fActDesc->fProof || !fActDesc->fProof->IsValid()) return;
   TString m;
   m.Form("Are you sure to cleanup the session \"%s::%s\"",
         fActDesc->fName.Data(), fActDesc->fTag.Data());
   Int_t result;
   new TGMsgBox(fClient->GetRoot(), this, "", m.Data(), 0,
         kMBYes | kMBNo | kMBCancel, &result);
   if (result == kMBYes) {
      // send cleanup request for the session specified by the tag reference
      TString sessiontag;
      sessiontag.Form("session-%s",fActDesc->fTag.Data());
      fActDesc->fProof->CleanupSession(sessiontag.Data());
      // clear the list of queries
      fActDesc->fQueries->Clear();
      fSessionHierarchy->DeleteChildren(item);
      fSessionFrame->OnBtnGetQueriesClicked();
      if (fAutoSave)
         WriteConfiguration();
   }
   // update list tree
   fSessionHierarchy->ClearViewPort();
   fClient->NeedRedraw(fSessionHierarchy);
}

//______________________________________________________________________________
void TSessionViewer::ResetSession()
{
   // Reset Proof session.

   TGListTreeItem *item = fSessionHierarchy->GetSelected();
   if (!item) return;
   TObject *obj = (TObject *)item->GetUserData();
   if (!obj || obj->IsA() != TSessionDescription::Class()) return;
   if (!fActDesc->fProof || !fActDesc->fProof->IsValid()) return;
   TString m;
   m.Form("Do you really want to reset the session \"%s::%s\"",
         fActDesc->fName.Data(), fActDesc->fAddress.Data());
   Int_t result;
   new TGMsgBox(fClient->GetRoot(), this, "", m.Data(), 0,
         kMBYes | kMBNo | kMBCancel, &result);
   if (result == kMBYes) {
      // reset the session
      TProofMgr *mgr = TProof::Mgr(fActDesc->fAddress);
      if (mgr && mgr->IsValid()) {
         mgr->Reset(fActDesc->fUserName);
      }
      // reset connected flag
      fActDesc->fAttached = kFALSE;
      fActDesc->fProof = 0;
      // disable animation timer
      DisableTimer();
      // change list tree item picture to disconnected pixmap
      TGListTreeItem *item2 = fSessionHierarchy->FindChildByData(
                              fSessionItem, fActDesc);
      if (item2) item2->SetPictures(fProofDiscon, fProofDiscon);

      OnListTreeClicked(fSessionHierarchy->GetSelected(), 1, 0, 0);
      fSessionHierarchy->ClearViewPort();
      fClient->NeedRedraw(fSessionHierarchy);
      fStatusBar->SetText("", 1);
   }
   // update list tree
   fSessionHierarchy->ClearViewPort();
   fClient->NeedRedraw(fSessionHierarchy);
}

//______________________________________________________________________________
void TSessionViewer::DeleteQuery()
{
   // Delete query from list tree and ask user if they want to delete it also
   // from server.

   TGListTreeItem *item = fSessionHierarchy->GetSelected();
   if (!item) return;
   TObject *obj = (TObject *)item->GetUserData();
   if (!obj || obj->IsA() != TQueryDescription::Class()) return;
   TQueryDescription *query = (TQueryDescription *)obj;
   TString m;
   Int_t result = 0;

   if (fActDesc->fAttached && fActDesc->fProof && fActDesc->fProof->IsValid()) {
      if ((fActDesc->fActQuery->fStatus == TQueryDescription::kSessionQuerySubmitted) ||
          (fActDesc->fActQuery->fStatus == TQueryDescription::kSessionQueryRunning) ) {
         new TGMsgBox(fClient->GetRoot(), this, "Delete Query",
                      "Deleting running queries is not allowed", kMBIconExclamation,
                      kMBOk, &result);
         return;
      }
      m.Form("Do you want to delete query \"%s\" from server too ?",
            query->fQueryName.Data());
      new TGMsgBox(fClient->GetRoot(), this, "", m.Data(), kMBIconQuestion,
            kMBYes | kMBNo | kMBCancel, &result);
   }
   else {
      m.Form("Dou you really want to delete query \"%s\" ?",
            query->fQueryName.Data());
      new TGMsgBox(fClient->GetRoot(), this, "", m.Data(), kMBIconQuestion,
            kMBOk | kMBCancel, &result);
   }
   if (result == kMBYes) {
      fActDesc->fProof->Remove(query->fReference.Data());
      fActDesc->fQueries->Remove((TObject *)query);
      fSessionHierarchy->DeleteItem(item);
      delete query;
   }
   else if (result == kMBNo || result == kMBOk) {
      fActDesc->fQueries->Remove((TObject *)query);
      fSessionHierarchy->DeleteItem(item);
      delete query;
   }
   fSessionHierarchy->ClearViewPort();
   fClient->NeedRedraw(fSessionHierarchy);
   if (fAutoSave)
      WriteConfiguration();
}

//______________________________________________________________________________
void TSessionViewer::EditQuery()
{
   // Edit currently selected query.

   TGListTreeItem *item = fSessionHierarchy->GetSelected();
   if (!item) return;
   TObject *obj = (TObject *)item->GetUserData();
   if (!obj || obj->IsA() != TQueryDescription::Class()) return;
   TQueryDescription *query = (TQueryDescription *)obj;
   TNewQueryDlg *dlg = new TNewQueryDlg(this, 350, 310, query, kTRUE);
   dlg->Popup();
}

//______________________________________________________________________________
void TSessionViewer::StartViewer()
{
   // Start TreeViewer from selected TChain.

   TGListTreeItem *item = fSessionHierarchy->GetSelected();
   if (!item) return;
   TObject *obj = (TObject *)item->GetUserData();
   if (!obj || obj->IsA() != TQueryDescription::Class()) return;
   TQueryDescription *query = (TQueryDescription *)obj;
   if (!query->fChain && query->fResult &&
      (obj = query->fResult->GetInputObject("TDSet"))) {
      query->fChain = (TDSet *) obj;
   }
   if (!query->fChain) return;
   if (query->fChain->IsA() == TChain::Class())
      ((TChain *)query->fChain)->StartViewer();
   else if (query->fChain->IsA() == TDSet::Class())
      ((TDSet *)query->fChain)->StartViewer();
}

//______________________________________________________________________________
void TSessionViewer::ShowPackages()
{
   // Query the list of uploaded packages from proof and display it
   // into a new text window.

   Window_t wdummy;
   Int_t  ax, ay;

   if (fActDesc->fLocal) return;
   if (!fActDesc->fProof || !fActDesc->fProof->IsValid())
      return;
   TString pathtmp = TString::Format("%s/%s", gSystem->TempDirectory(),
            kSession_RedirectFile);
   // redirect stdout/stderr to temp file
   if (gSystem->RedirectOutput(pathtmp.Data(), "w") != 0) {
      Error("ShowStatus", "stdout/stderr redirection failed; skipping");
      return;
   }
   fActDesc->fProof->ShowPackages(kTRUE);
   // restore stdout/stderr
   if (gSystem->RedirectOutput(0) != 0) {
      Error("ShowStatus", "stdout/stderr retore failed; skipping");
      return;
   }
   if (!fLogWindow) {
      fLogWindow = new TSessionLogView(this, 700, 100);
   } else {
      // Clear window
      fLogWindow->Clear();
   }
   fLogWindow->LoadFile(pathtmp.Data());
   gVirtualX->TranslateCoordinates(GetId(), fClient->GetDefaultRoot()->GetId(),
                                    0, 0, ax, ay, wdummy);
   fLogWindow->Move(ax, ay + GetHeight() + 35);
   fLogWindow->Popup();
}

//______________________________________________________________________________
void TSessionViewer::UpdateListOfPackages()
{
   // Update the list of packages.

   TObjString *packname;
   TPackageDescription *package;
   if (fActDesc->fConnected && fActDesc->fAttached &&
       fActDesc->fProof && fActDesc->fProof->IsValid() &&
       fActDesc->fProof->IsParallel()) {
      //fActDesc->fPackages->Clear();
      TList *packlist = fActDesc->fProof->GetListOfEnabledPackages();
      if(packlist) {
         TIter nextenabled(packlist);
         while ((packname = (TObjString *)nextenabled())) {
            package = new TPackageDescription;
            package->fName = packname->GetName();
            package->fName += ".par";
            package->fPathName = package->fName;
            package->fId   = fActDesc->fPackages->GetEntries();
            package->fUploaded = kTRUE;
            package->fEnabled = kTRUE;
            if (!fActDesc->fPackages->FindObject(package->fName)) {
               fActDesc->fPackages->Add((TObject *)package);
            }
         }
      }
      packlist = fActDesc->fProof->GetListOfPackages();
      if(packlist) {
         TIter nextpack(packlist);
         while ((packname = (TObjString *)nextpack())) {
            package = new TPackageDescription;
            package->fName = packname->GetName();
            package->fName += ".par";
            package->fPathName = package->fName;
            package->fId   = fActDesc->fPackages->GetEntries();
            package->fUploaded = kTRUE;
            package->fEnabled = kFALSE;
            if (!fActDesc->fPackages->FindObject(package->fName)) {
               fActDesc->fPackages->Add((TObject *)package);
            }
         }
      }
   }
//   fSessionFrame->UpdatePackages();
}

//______________________________________________________________________________
void TSessionViewer::ShowEnabledPackages()
{
   // Query list of enabled packages from proof and display it
   // into a new text window.

   Window_t wdummy;
   Int_t  ax, ay;

   if (fActDesc->fLocal) return;
   if (!fActDesc->fProof || !fActDesc->fProof->IsValid())
      return;
   TString pathtmp = TString::Format("%s/%s", gSystem->TempDirectory(),
         kSession_RedirectFile);
   // redirect stdout/stderr to temp file
   if (gSystem->RedirectOutput(pathtmp.Data(), "w") != 0) {
      Error("ShowStatus", "stdout/stderr redirection failed; skipping");
      return;
   }
   fActDesc->fProof->ShowEnabledPackages(kTRUE);
   // restore stdout/stderr
   if (gSystem->RedirectOutput(0) != 0) {
      Error("ShowStatus", "stdout/stderr retore failed; skipping");
      return;
   }
   if (!fLogWindow) {
      fLogWindow = new TSessionLogView(this, 700, 100);
   } else {
      // Clear window
      fLogWindow->Clear();
   }
   fLogWindow->LoadFile(pathtmp.Data());
   gVirtualX->TranslateCoordinates(GetId(), fClient->GetDefaultRoot()->GetId(),
                                    0, 0, ax, ay, wdummy);
   fLogWindow->Move(ax, ay + GetHeight() + 35);
   fLogWindow->Popup();
}

//______________________________________________________________________________
void TSessionViewer::ShowLog(const char *queryref)
{
   // Display the content of the temporary log file for queryref
   // into a new text window.

   Window_t wdummy;
   Int_t  ax, ay;

   if (fActDesc->fProof) {
      gVirtualX->SetCursor(GetId(),gVirtualX->CreateCursor(kWatch));
      if (!fLogWindow) {
         fLogWindow = new TSessionLogView(this, 700, 100);
      } else {
         // Clear window
         fLogWindow->Clear();
      }
      fActDesc->fProof->Connect("LogMessage(const char*,Bool_t)",
            "TSessionViewer", this, "LogMessage(const char*,Bool_t)");
      Bool_t logonly = fActDesc->fProof->SendingLogToWindow();
      fActDesc->fProof->SendLogToWindow(kTRUE);
      if (queryref)
         fActDesc->fProof->ShowLog(queryref);
      else
         fActDesc->fProof->ShowLog(0);
      fActDesc->fProof->SendLogToWindow(logonly);
      // set log window position at the bottom of Session Viewer
      gVirtualX->TranslateCoordinates(GetId(),
            fClient->GetDefaultRoot()->GetId(), 0, 0, ax, ay, wdummy);
      fLogWindow->Move(ax, ay + GetHeight() + 35);
      fLogWindow->Popup();
      gVirtualX->SetCursor(GetId(), 0);
   }
}

//______________________________________________________________________________
void TSessionViewer::ShowInfo(const char *txt)
{
   // Display text in status bar.

   fStatusBar->SetText(txt,0);
   fClient->NeedRedraw(fStatusBar);
   gSystem->ProcessEvents();
}

//______________________________________________________________________________
void TSessionViewer::ShowStatus()
{
   // Retrieve and display Proof status.

   Window_t wdummy;
   Int_t  ax, ay;

   if (!fActDesc->fProof || !fActDesc->fProof->IsValid())
      return;
   TString pathtmp = TString::Format("%s/%s", gSystem->TempDirectory(),
            kSession_RedirectFile);
   // redirect stdout/stderr to temp file
   if (gSystem->RedirectOutput(pathtmp.Data(), "w") != 0) {
      Error("ShowStatus", "stdout/stderr redirection failed; skipping");
      return;
   }
   fActDesc->fProof->GetStatus();
   // restore stdout/stderr
   if (gSystem->RedirectOutput(0) != 0) {
      Error("ShowStatus", "stdout/stderr retore failed; skipping");
      return;
   }
   if (!fLogWindow) {
      fLogWindow = new TSessionLogView(this, 700, 100);
   } else {
      // Clear window
      fLogWindow->Clear();
   }
   fLogWindow->LoadFile(pathtmp.Data());
   gVirtualX->TranslateCoordinates(GetId(), fClient->GetDefaultRoot()->GetId(),
                                    0, 0, ax, ay, wdummy);
   fLogWindow->Move(ax, ay + GetHeight() + 35);
   fLogWindow->Popup();
}

//______________________________________________________________________________
void TSessionViewer::StartupMessage(char *msg, Bool_t, Int_t done, Int_t total)
{
   // Handle startup message (connection progress) coming from Proof session.

   Float_t pos = Float_t(Double_t(done * 100)/Double_t(total));
   fConnectProg->SetPosition(pos);
   fStatusBar->SetText(msg, 1);
}

//______________________________________________________________________________
void TSessionViewer::MyHandleMenu(Int_t id)
{
   // Handle session viewer custom popup menus.

   switch (id) {

      case kSessionDelete:
         fServerFrame->OnBtnDeleteClicked();
         break;

      case kSessionConnect:
         fServerFrame->OnBtnConnectClicked();
         break;

      case kSessionDisconnect:
         fSessionFrame->OnBtnDisconnectClicked();
         break;

      case kSessionShutdown:
         fSessionFrame->ShutdownSession();
         break;

      case kSessionCleanup:
         CleanupSession();
         break;

      case kSessionReset:
         ResetSession();
         break;

      case kSessionBrowse:
         if (fActDesc->fProof && fActDesc->fProof->IsValid()) {
            TBrowser *b = new TBrowser();
            fActDesc->fProof->Browse(b);
         }
         break;

      case kSessionShowStatus:
         ShowStatus();
         break;

      case kSessionGetQueries:
         fSessionFrame->OnBtnGetQueriesClicked();
         break;

      case kQueryEdit:
         EditQuery();
         break;

      case kQueryDelete:
         DeleteQuery();
         break;

      case kQueryStartViewer:
         StartViewer();
         break;

      case kQuerySubmit:
         fQueryFrame->OnBtnSubmit();
         break;
   }
}

//______________________________________________________________________________
void TSessionViewer::OnCascadeMenu()
{
   // Handle feedback histograms configuration menu.

   // divide stats canvas by number of selected feedback histos
   fQueryFrame->GetStatsCanvas()->cd();
   fQueryFrame->GetStatsCanvas()->Clear();
   fQueryFrame->GetStatsCanvas()->Modified();
   fQueryFrame->GetStatsCanvas()->Update();
   if (!fActDesc || !fActDesc->fActQuery) return;
   fActDesc->fNbHistos = 0;
   Int_t i = 0;

   if (fActDesc->fAttached && fActDesc->fProof &&
       fActDesc->fProof->IsValid()) {
      if (fOptionsMenu->IsEntryChecked(kOptionsFeedback)) {
         // browse list of feedback histos and check user's selected ones
         while (kFeedbackHistos[i]) {
            if (fCascadeMenu->IsEntryChecked(41+i)) {
               fActDesc->fProof->AddFeedback(kFeedbackHistos[i]);
            }
            i++;
         }
      }
      else {
         // if feedback option not selected, clear Proof's feedback option
         fActDesc->fProof->ClearFeedback();
      }
   }

   i = 0;
   // loop over feedback histo list
   while (kFeedbackHistos[i]) {
      // check if user has selected this histogram in the option menu
      if (fCascadeMenu->IsEntryChecked(41+i))
         fActDesc->fNbHistos++;
      i++;
   }
   fQueryFrame->GetStatsCanvas()->SetEditable(kTRUE);
   fQueryFrame->GetStatsCanvas()->Clear();
   if (fActDesc->fNbHistos == 4)
      fQueryFrame->GetStatsCanvas()->Divide(2, 2);
   else if (fActDesc->fNbHistos > 4)
      fQueryFrame->GetStatsCanvas()->Divide(3, 2);
   else
      fQueryFrame->GetStatsCanvas()->Divide(fActDesc->fNbHistos, 1);

   // if actual query has results, update feedback histos
   if (fActDesc->fActQuery && fActDesc->fActQuery->fResult &&
       fActDesc->fActQuery->fResult->GetOutputList()) {
      fQueryFrame->UpdateHistos(fActDesc->fActQuery->fResult->GetOutputList());
      fQueryFrame->ResetProgressDialog("", 0, 0, 0);
   }
   else if (fActDesc->fActQuery) {
      fQueryFrame->ResetProgressDialog(fActDesc->fActQuery->fSelectorString,
                                       fActDesc->fActQuery->fNbFiles,
                                       fActDesc->fActQuery->fFirstEntry,
                                       fActDesc->fActQuery->fNoEntries);
   }
   fQueryFrame->UpdateInfos();
}
//______________________________________________________________________________
Bool_t TSessionViewer::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
{
   // Handle messages send to the TSessionViewer object. E.g. all menu entries
   // messages.

   TNewQueryDlg *dlg;

   switch (GET_MSG(msg)) {
      case kC_COMMAND:
         switch (GET_SUBMSG(msg)) {
            case kCM_BUTTON:
            case kCM_MENU:
               switch (parm1) {

                  case kFileCloseViewer:
                     CloseWindow();
                     break;

                  case kFileLoadConfig:
                     {
                        TGFileInfo fi;
                        fi.fFilename = strdup((char *)gSystem->BaseName(fConfigFile));
                        fi.fIniDir = strdup((char *)gSystem->HomeDirectory());
                        fi.fFileTypes = conftypes;
                        new TGFileDialog(fClient->GetRoot(), this, kFDOpen, &fi);
                        if (fi.fFilename) {
                           fConfigFile = fi.fFilename;
                           ReadConfiguration(fConfigFile);
                           OnListTreeClicked(fSessionHierarchy->GetSelected(), 1, 0, 0);
                        }
                     }
                     break;

                  case kFileSaveConfig:
                     {
                        TGFileInfo fi;
                        fi.fFilename = strdup((char *)gSystem->BaseName(fConfigFile));
                        fi.fIniDir = strdup((char *)gSystem->HomeDirectory());
                        fi.fFileTypes = conftypes;
                        new TGFileDialog(fClient->GetRoot(), this, kFDSave, &fi);
                        if (fi.fFilename) {
                           fConfigFile = fi.fFilename;
                           WriteConfiguration(fConfigFile);
                        }
                     }
                     break;

                  case kFileQuit:
                     Terminate();
                     if (!gApplication->ReturnFromRun())
                        delete this;
                     gApplication->Terminate(0);
                     break;

                  case kSessionNew:
                     fServerFrame->OnBtnNewServerClicked();
                     break;

                  case kSessionAdd:
                     fServerFrame->OnBtnAddClicked();
                     break;

                  case kSessionDelete:
                     fServerFrame->OnBtnDeleteClicked();
                     break;

                  case kSessionCleanup:
                     CleanupSession();
                     break;

                  case kSessionReset:
                     ResetSession();
                     break;

                  case kSessionConnect:
                     fServerFrame->OnBtnConnectClicked();
                     break;

                  case kSessionDisconnect:
                     fSessionFrame->OnBtnDisconnectClicked();
                     break;

                  case kSessionShutdown:
                     fSessionFrame->ShutdownSession();
                     break;

                  case kSessionShowStatus:
                     ShowStatus();
                     break;

                  case kSessionGetQueries:
                     fSessionFrame->OnBtnGetQueriesClicked();
                     break;

                  case kQueryNew:
                     dlg = new TNewQueryDlg(this, 350, 310);
                     dlg->Popup();
                     break;

                  case kQueryEdit:
                     EditQuery();
                     break;

                  case kQueryDelete:
                     DeleteQuery();
                     break;

                  case kQueryStartViewer:
                     StartViewer();
                     break;

                  case kQuerySubmit:
                     fQueryFrame->OnBtnSubmit();
                     break;

                  case kOptionsAutoSave:
                     if(fOptionsMenu->IsEntryChecked(kOptionsAutoSave)) {
                        fOptionsMenu->UnCheckEntry(kOptionsAutoSave);
                        fAutoSave = kFALSE;
                     }
                     else {
                        fOptionsMenu->CheckEntry(kOptionsAutoSave);
                        fAutoSave = kTRUE;
                     }
                     break;

                  case kOptionsStatsHist:
                     if(fOptionsMenu->IsEntryChecked(kOptionsStatsHist)) {
                        fOptionsMenu->UnCheckEntry(kOptionsStatsHist);
                        gEnv->SetValue("Proof.StatsHist", 0);
                     }
                     else {
                        fOptionsMenu->CheckEntry(kOptionsStatsHist);
                        gEnv->SetValue("Proof.StatsHist", 1);
                     }
                     break;

                  case kOptionsStatsTrace:
                     if(fOptionsMenu->IsEntryChecked(kOptionsStatsTrace)) {
                        fOptionsMenu->UnCheckEntry(kOptionsStatsTrace);
                        gEnv->SetValue("Proof.StatsTrace", 0);
                     }
                     else {
                        fOptionsMenu->CheckEntry(kOptionsStatsTrace);
                        gEnv->SetValue("Proof.StatsTrace", 1);
                     }
                     break;

                  case kOptionsSlaveStatsTrace:
                     if(fOptionsMenu->IsEntryChecked(kOptionsSlaveStatsTrace)) {
                        fOptionsMenu->UnCheckEntry(kOptionsSlaveStatsTrace);
                        gEnv->SetValue("Proof.SlaveStatsTrace", 0);
                     }
                     else {
                        fOptionsMenu->CheckEntry(kOptionsSlaveStatsTrace);
                        gEnv->SetValue("Proof.SlaveStatsTrace", 1);
                     }
                     break;

                  case kOptionsFeedback:
                     if(fOptionsMenu->IsEntryChecked(kOptionsFeedback)) {
                        fOptionsMenu->UnCheckEntry(kOptionsFeedback);
                     }
                     else {
                        fOptionsMenu->CheckEntry(kOptionsFeedback);
                     }
                     break;

                  case 41:
                  case 42:
                  case 43:
                  case 44:
                  case 45:
                  case 46:
                     if (fCascadeMenu->IsEntryChecked(parm1)) {
                        fCascadeMenu->UnCheckEntry(parm1);
                     }
                     else {
                        fCascadeMenu->CheckEntry(parm1);
                     }
                     OnCascadeMenu();
                     break;

                  case 50:
                     if (fCascadeMenu->IsEntryChecked(parm1)) {
                        fCascadeMenu->UnCheckEntry(parm1);
                     }
                     else {
                        fCascadeMenu->CheckEntry(parm1);
                     }
                     OnCascadeMenu();
                     break;

                  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());
                        TRootHelpDialog *hd = new TRootHelpDialog(this, str, 600, 400);
                        hd->SetText(gHelpAbout);
                        hd->Popup();
#endif
#endif
                     }
                     break;

                  default:
                     break;
               }
            default:
               break;
         }
      default:
         break;
   }

   return kTRUE;
}
 TSessionViewer.cxx:1
 TSessionViewer.cxx:2
 TSessionViewer.cxx:3
 TSessionViewer.cxx:4
 TSessionViewer.cxx:5
 TSessionViewer.cxx:6
 TSessionViewer.cxx:7
 TSessionViewer.cxx:8
 TSessionViewer.cxx:9
 TSessionViewer.cxx:10
 TSessionViewer.cxx:11
 TSessionViewer.cxx:12
 TSessionViewer.cxx:13
 TSessionViewer.cxx:14
 TSessionViewer.cxx:15
 TSessionViewer.cxx:16
 TSessionViewer.cxx:17
 TSessionViewer.cxx:18
 TSessionViewer.cxx:19
 TSessionViewer.cxx:20
 TSessionViewer.cxx:21
 TSessionViewer.cxx:22
 TSessionViewer.cxx:23
 TSessionViewer.cxx:24
 TSessionViewer.cxx:25
 TSessionViewer.cxx:26
 TSessionViewer.cxx:27
 TSessionViewer.cxx:28
 TSessionViewer.cxx:29
 TSessionViewer.cxx:30
 TSessionViewer.cxx:31
 TSessionViewer.cxx:32
 TSessionViewer.cxx:33
 TSessionViewer.cxx:34
 TSessionViewer.cxx:35
 TSessionViewer.cxx:36
 TSessionViewer.cxx:37
 TSessionViewer.cxx:38
 TSessionViewer.cxx:39
 TSessionViewer.cxx:40
 TSessionViewer.cxx:41
 TSessionViewer.cxx:42
 TSessionViewer.cxx:43
 TSessionViewer.cxx:44
 TSessionViewer.cxx:45
 TSessionViewer.cxx:46
 TSessionViewer.cxx:47
 TSessionViewer.cxx:48
 TSessionViewer.cxx:49
 TSessionViewer.cxx:50
 TSessionViewer.cxx:51
 TSessionViewer.cxx:52
 TSessionViewer.cxx:53
 TSessionViewer.cxx:54
 TSessionViewer.cxx:55
 TSessionViewer.cxx:56
 TSessionViewer.cxx:57
 TSessionViewer.cxx:58
 TSessionViewer.cxx:59
 TSessionViewer.cxx:60
 TSessionViewer.cxx:61
 TSessionViewer.cxx:62
 TSessionViewer.cxx:63
 TSessionViewer.cxx:64
 TSessionViewer.cxx:65
 TSessionViewer.cxx:66
 TSessionViewer.cxx:67
 TSessionViewer.cxx:68
 TSessionViewer.cxx:69
 TSessionViewer.cxx:70
 TSessionViewer.cxx:71
 TSessionViewer.cxx:72
 TSessionViewer.cxx:73
 TSessionViewer.cxx:74
 TSessionViewer.cxx:75
 TSessionViewer.cxx:76
 TSessionViewer.cxx:77
 TSessionViewer.cxx:78
 TSessionViewer.cxx:79
 TSessionViewer.cxx:80
 TSessionViewer.cxx:81
 TSessionViewer.cxx:82
 TSessionViewer.cxx:83
 TSessionViewer.cxx:84
 TSessionViewer.cxx:85
 TSessionViewer.cxx:86
 TSessionViewer.cxx:87
 TSessionViewer.cxx:88
 TSessionViewer.cxx:89
 TSessionViewer.cxx:90
 TSessionViewer.cxx:91
 TSessionViewer.cxx:92
 TSessionViewer.cxx:93
 TSessionViewer.cxx:94
 TSessionViewer.cxx:95
 TSessionViewer.cxx:96
 TSessionViewer.cxx:97
 TSessionViewer.cxx:98
 TSessionViewer.cxx:99
 TSessionViewer.cxx:100
 TSessionViewer.cxx:101
 TSessionViewer.cxx:102
 TSessionViewer.cxx:103
 TSessionViewer.cxx:104
 TSessionViewer.cxx:105
 TSessionViewer.cxx:106
 TSessionViewer.cxx:107
 TSessionViewer.cxx:108
 TSessionViewer.cxx:109
 TSessionViewer.cxx:110
 TSessionViewer.cxx:111
 TSessionViewer.cxx:112
 TSessionViewer.cxx:113
 TSessionViewer.cxx:114
 TSessionViewer.cxx:115
 TSessionViewer.cxx:116
 TSessionViewer.cxx:117
 TSessionViewer.cxx:118
 TSessionViewer.cxx:119
 TSessionViewer.cxx:120
 TSessionViewer.cxx:121
 TSessionViewer.cxx:122
 TSessionViewer.cxx:123
 TSessionViewer.cxx:124
 TSessionViewer.cxx:125
 TSessionViewer.cxx:126
 TSessionViewer.cxx:127
 TSessionViewer.cxx:128
 TSessionViewer.cxx:129
 TSessionViewer.cxx:130
 TSessionViewer.cxx:131
 TSessionViewer.cxx:132
 TSessionViewer.cxx:133
 TSessionViewer.cxx:134
 TSessionViewer.cxx:135
 TSessionViewer.cxx:136
 TSessionViewer.cxx:137
 TSessionViewer.cxx:138
 TSessionViewer.cxx:139
 TSessionViewer.cxx:140
 TSessionViewer.cxx:141
 TSessionViewer.cxx:142
 TSessionViewer.cxx:143
 TSessionViewer.cxx:144
 TSessionViewer.cxx:145
 TSessionViewer.cxx:146
 TSessionViewer.cxx:147
 TSessionViewer.cxx:148
 TSessionViewer.cxx:149
 TSessionViewer.cxx:150
 TSessionViewer.cxx:151
 TSessionViewer.cxx:152
 TSessionViewer.cxx:153
 TSessionViewer.cxx:154
 TSessionViewer.cxx:155
 TSessionViewer.cxx:156
 TSessionViewer.cxx:157
 TSessionViewer.cxx:158
 TSessionViewer.cxx:159
 TSessionViewer.cxx:160
 TSessionViewer.cxx:161
 TSessionViewer.cxx:162
 TSessionViewer.cxx:163
 TSessionViewer.cxx:164
 TSessionViewer.cxx:165
 TSessionViewer.cxx:166
 TSessionViewer.cxx:167
 TSessionViewer.cxx:168
 TSessionViewer.cxx:169
 TSessionViewer.cxx:170
 TSessionViewer.cxx:171
 TSessionViewer.cxx:172
 TSessionViewer.cxx:173
 TSessionViewer.cxx:174
 TSessionViewer.cxx:175
 TSessionViewer.cxx:176
 TSessionViewer.cxx:177
 TSessionViewer.cxx:178
 TSessionViewer.cxx:179
 TSessionViewer.cxx:180
 TSessionViewer.cxx:181
 TSessionViewer.cxx:182
 TSessionViewer.cxx:183
 TSessionViewer.cxx:184
 TSessionViewer.cxx:185
 TSessionViewer.cxx:186
 TSessionViewer.cxx:187
 TSessionViewer.cxx:188
 TSessionViewer.cxx:189
 TSessionViewer.cxx:190
 TSessionViewer.cxx:191
 TSessionViewer.cxx:192
 TSessionViewer.cxx:193
 TSessionViewer.cxx:194
 TSessionViewer.cxx:195
 TSessionViewer.cxx:196
 TSessionViewer.cxx:197
 TSessionViewer.cxx:198
 TSessionViewer.cxx:199
 TSessionViewer.cxx:200
 TSessionViewer.cxx:201
 TSessionViewer.cxx:202
 TSessionViewer.cxx:203
 TSessionViewer.cxx:204
 TSessionViewer.cxx:205
 TSessionViewer.cxx:206
 TSessionViewer.cxx:207
 TSessionViewer.cxx:208
 TSessionViewer.cxx:209
 TSessionViewer.cxx:210
 TSessionViewer.cxx:211
 TSessionViewer.cxx:212
 TSessionViewer.cxx:213
 TSessionViewer.cxx:214
 TSessionViewer.cxx:215
 TSessionViewer.cxx:216
 TSessionViewer.cxx:217
 TSessionViewer.cxx:218
 TSessionViewer.cxx:219
 TSessionViewer.cxx:220
 TSessionViewer.cxx:221
 TSessionViewer.cxx:222
 TSessionViewer.cxx:223
 TSessionViewer.cxx:224
 TSessionViewer.cxx:225
 TSessionViewer.cxx:226
 TSessionViewer.cxx:227
 TSessionViewer.cxx:228
 TSessionViewer.cxx:229
 TSessionViewer.cxx:230
 TSessionViewer.cxx:231
 TSessionViewer.cxx:232
 TSessionViewer.cxx:233
 TSessionViewer.cxx:234
 TSessionViewer.cxx:235
 TSessionViewer.cxx:236
 TSessionViewer.cxx:237
 TSessionViewer.cxx:238
 TSessionViewer.cxx:239
 TSessionViewer.cxx:240
 TSessionViewer.cxx:241
 TSessionViewer.cxx:242
 TSessionViewer.cxx:243
 TSessionViewer.cxx:244
 TSessionViewer.cxx:245
 TSessionViewer.cxx:246
 TSessionViewer.cxx:247
 TSessionViewer.cxx:248
 TSessionViewer.cxx:249
 TSessionViewer.cxx:250
 TSessionViewer.cxx:251
 TSessionViewer.cxx:252
 TSessionViewer.cxx:253
 TSessionViewer.cxx:254
 TSessionViewer.cxx:255
 TSessionViewer.cxx:256
 TSessionViewer.cxx:257
 TSessionViewer.cxx:258
 TSessionViewer.cxx:259
 TSessionViewer.cxx:260
 TSessionViewer.cxx:261
 TSessionViewer.cxx:262
 TSessionViewer.cxx:263
 TSessionViewer.cxx:264
 TSessionViewer.cxx:265
 TSessionViewer.cxx:266
 TSessionViewer.cxx:267
 TSessionViewer.cxx:268
 TSessionViewer.cxx:269
 TSessionViewer.cxx:270
 TSessionViewer.cxx:271
 TSessionViewer.cxx:272
 TSessionViewer.cxx:273
 TSessionViewer.cxx:274
 TSessionViewer.cxx:275
 TSessionViewer.cxx:276
 TSessionViewer.cxx:277
 TSessionViewer.cxx:278
 TSessionViewer.cxx:279
 TSessionViewer.cxx:280
 TSessionViewer.cxx:281
 TSessionViewer.cxx:282
 TSessionViewer.cxx:283
 TSessionViewer.cxx:284
 TSessionViewer.cxx:285
 TSessionViewer.cxx:286
 TSessionViewer.cxx:287
 TSessionViewer.cxx:288
 TSessionViewer.cxx:289
 TSessionViewer.cxx:290
 TSessionViewer.cxx:291
 TSessionViewer.cxx:292
 TSessionViewer.cxx:293
 TSessionViewer.cxx:294
 TSessionViewer.cxx:295
 TSessionViewer.cxx:296
 TSessionViewer.cxx:297
 TSessionViewer.cxx:298
 TSessionViewer.cxx:299
 TSessionViewer.cxx:300
 TSessionViewer.cxx:301
 TSessionViewer.cxx:302
 TSessionViewer.cxx:303
 TSessionViewer.cxx:304
 TSessionViewer.cxx:305
 TSessionViewer.cxx:306
 TSessionViewer.cxx:307
 TSessionViewer.cxx:308
 TSessionViewer.cxx:309
 TSessionViewer.cxx:310
 TSessionViewer.cxx:311
 TSessionViewer.cxx:312
 TSessionViewer.cxx:313
 TSessionViewer.cxx:314
 TSessionViewer.cxx:315
 TSessionViewer.cxx:316
 TSessionViewer.cxx:317
 TSessionViewer.cxx:318
 TSessionViewer.cxx:319
 TSessionViewer.cxx:320
 TSessionViewer.cxx:321
 TSessionViewer.cxx:322
 TSessionViewer.cxx:323
 TSessionViewer.cxx:324
 TSessionViewer.cxx:325
 TSessionViewer.cxx:326
 TSessionViewer.cxx:327
 TSessionViewer.cxx:328
 TSessionViewer.cxx:329
 TSessionViewer.cxx:330
 TSessionViewer.cxx:331
 TSessionViewer.cxx:332
 TSessionViewer.cxx:333
 TSessionViewer.cxx:334
 TSessionViewer.cxx:335
 TSessionViewer.cxx:336
 TSessionViewer.cxx:337
 TSessionViewer.cxx:338
 TSessionViewer.cxx:339
 TSessionViewer.cxx:340
 TSessionViewer.cxx:341
 TSessionViewer.cxx:342
 TSessionViewer.cxx:343
 TSessionViewer.cxx:344
 TSessionViewer.cxx:345
 TSessionViewer.cxx:346
 TSessionViewer.cxx:347
 TSessionViewer.cxx:348
 TSessionViewer.cxx:349
 TSessionViewer.cxx:350
 TSessionViewer.cxx:351
 TSessionViewer.cxx:352
 TSessionViewer.cxx:353
 TSessionViewer.cxx:354
 TSessionViewer.cxx:355
 TSessionViewer.cxx:356
 TSessionViewer.cxx:357
 TSessionViewer.cxx:358
 TSessionViewer.cxx:359
 TSessionViewer.cxx:360
 TSessionViewer.cxx:361
 TSessionViewer.cxx:362
 TSessionViewer.cxx:363
 TSessionViewer.cxx:364
 TSessionViewer.cxx:365
 TSessionViewer.cxx:366
 TSessionViewer.cxx:367
 TSessionViewer.cxx:368
 TSessionViewer.cxx:369
 TSessionViewer.cxx:370
 TSessionViewer.cxx:371
 TSessionViewer.cxx:372
 TSessionViewer.cxx:373
 TSessionViewer.cxx:374
 TSessionViewer.cxx:375
 TSessionViewer.cxx:376
 TSessionViewer.cxx:377
 TSessionViewer.cxx:378
 TSessionViewer.cxx:379
 TSessionViewer.cxx:380
 TSessionViewer.cxx:381
 TSessionViewer.cxx:382
 TSessionViewer.cxx:383
 TSessionViewer.cxx:384
 TSessionViewer.cxx:385
 TSessionViewer.cxx:386
 TSessionViewer.cxx:387
 TSessionViewer.cxx:388
 TSessionViewer.cxx:389
 TSessionViewer.cxx:390
 TSessionViewer.cxx:391
 TSessionViewer.cxx:392
 TSessionViewer.cxx:393
 TSessionViewer.cxx:394
 TSessionViewer.cxx:395
 TSessionViewer.cxx:396
 TSessionViewer.cxx:397
 TSessionViewer.cxx:398
 TSessionViewer.cxx:399
 TSessionViewer.cxx:400
 TSessionViewer.cxx:401
 TSessionViewer.cxx:402
 TSessionViewer.cxx:403
 TSessionViewer.cxx:404
 TSessionViewer.cxx:405
 TSessionViewer.cxx:406
 TSessionViewer.cxx:407
 TSessionViewer.cxx:408
 TSessionViewer.cxx:409
 TSessionViewer.cxx:410
 TSessionViewer.cxx:411
 TSessionViewer.cxx:412
 TSessionViewer.cxx:413
 TSessionViewer.cxx:414
 TSessionViewer.cxx:415
 TSessionViewer.cxx:416
 TSessionViewer.cxx:417
 TSessionViewer.cxx:418
 TSessionViewer.cxx:419
 TSessionViewer.cxx:420
 TSessionViewer.cxx:421
 TSessionViewer.cxx:422
 TSessionViewer.cxx:423
 TSessionViewer.cxx:424
 TSessionViewer.cxx:425
 TSessionViewer.cxx:426
 TSessionViewer.cxx:427
 TSessionViewer.cxx:428
 TSessionViewer.cxx:429
 TSessionViewer.cxx:430
 TSessionViewer.cxx:431
 TSessionViewer.cxx:432
 TSessionViewer.cxx:433
 TSessionViewer.cxx:434
 TSessionViewer.cxx:435
 TSessionViewer.cxx:436
 TSessionViewer.cxx:437
 TSessionViewer.cxx:438
 TSessionViewer.cxx:439
 TSessionViewer.cxx:440
 TSessionViewer.cxx:441
 TSessionViewer.cxx:442
 TSessionViewer.cxx:443
 TSessionViewer.cxx:444
 TSessionViewer.cxx:445
 TSessionViewer.cxx:446
 TSessionViewer.cxx:447
 TSessionViewer.cxx:448
 TSessionViewer.cxx:449
 TSessionViewer.cxx:450
 TSessionViewer.cxx:451
 TSessionViewer.cxx:452
 TSessionViewer.cxx:453
 TSessionViewer.cxx:454
 TSessionViewer.cxx:455
 TSessionViewer.cxx:456
 TSessionViewer.cxx:457
 TSessionViewer.cxx:458
 TSessionViewer.cxx:459
 TSessionViewer.cxx:460
 TSessionViewer.cxx:461
 TSessionViewer.cxx:462
 TSessionViewer.cxx:463
 TSessionViewer.cxx:464
 TSessionViewer.cxx:465
 TSessionViewer.cxx:466
 TSessionViewer.cxx:467
 TSessionViewer.cxx:468
 TSessionViewer.cxx:469
 TSessionViewer.cxx:470
 TSessionViewer.cxx:471
 TSessionViewer.cxx:472
 TSessionViewer.cxx:473
 TSessionViewer.cxx:474
 TSessionViewer.cxx:475
 TSessionViewer.cxx:476
 TSessionViewer.cxx:477
 TSessionViewer.cxx:478
 TSessionViewer.cxx:479
 TSessionViewer.cxx:480
 TSessionViewer.cxx:481
 TSessionViewer.cxx:482
 TSessionViewer.cxx:483
 TSessionViewer.cxx:484
 TSessionViewer.cxx:485
 TSessionViewer.cxx:486
 TSessionViewer.cxx:487
 TSessionViewer.cxx:488
 TSessionViewer.cxx:489
 TSessionViewer.cxx:490
 TSessionViewer.cxx:491
 TSessionViewer.cxx:492
 TSessionViewer.cxx:493
 TSessionViewer.cxx:494
 TSessionViewer.cxx:495
 TSessionViewer.cxx:496
 TSessionViewer.cxx:497
 TSessionViewer.cxx:498
 TSessionViewer.cxx:499
 TSessionViewer.cxx:500
 TSessionViewer.cxx:501
 TSessionViewer.cxx:502
 TSessionViewer.cxx:503
 TSessionViewer.cxx:504
 TSessionViewer.cxx:505
 TSessionViewer.cxx:506
 TSessionViewer.cxx:507
 TSessionViewer.cxx:508
 TSessionViewer.cxx:509
 TSessionViewer.cxx:510
 TSessionViewer.cxx:511
 TSessionViewer.cxx:512
 TSessionViewer.cxx:513
 TSessionViewer.cxx:514
 TSessionViewer.cxx:515
 TSessionViewer.cxx:516
 TSessionViewer.cxx:517
 TSessionViewer.cxx:518
 TSessionViewer.cxx:519
 TSessionViewer.cxx:520
 TSessionViewer.cxx:521
 TSessionViewer.cxx:522
 TSessionViewer.cxx:523
 TSessionViewer.cxx:524
 TSessionViewer.cxx:525
 TSessionViewer.cxx:526
 TSessionViewer.cxx:527
 TSessionViewer.cxx:528
 TSessionViewer.cxx:529
 TSessionViewer.cxx:530
 TSessionViewer.cxx:531
 TSessionViewer.cxx:532
 TSessionViewer.cxx:533
 TSessionViewer.cxx:534
 TSessionViewer.cxx:535
 TSessionViewer.cxx:536
 TSessionViewer.cxx:537
 TSessionViewer.cxx:538
 TSessionViewer.cxx:539
 TSessionViewer.cxx:540
 TSessionViewer.cxx:541
 TSessionViewer.cxx:542
 TSessionViewer.cxx:543
 TSessionViewer.cxx:544
 TSessionViewer.cxx:545
 TSessionViewer.cxx:546
 TSessionViewer.cxx:547
 TSessionViewer.cxx:548
 TSessionViewer.cxx:549
 TSessionViewer.cxx:550
 TSessionViewer.cxx:551
 TSessionViewer.cxx:552
 TSessionViewer.cxx:553
 TSessionViewer.cxx:554
 TSessionViewer.cxx:555
 TSessionViewer.cxx:556
 TSessionViewer.cxx:557
 TSessionViewer.cxx:558
 TSessionViewer.cxx:559
 TSessionViewer.cxx:560
 TSessionViewer.cxx:561
 TSessionViewer.cxx:562
 TSessionViewer.cxx:563
 TSessionViewer.cxx:564
 TSessionViewer.cxx:565
 TSessionViewer.cxx:566
 TSessionViewer.cxx:567
 TSessionViewer.cxx:568
 TSessionViewer.cxx:569
 TSessionViewer.cxx:570
 TSessionViewer.cxx:571
 TSessionViewer.cxx:572
 TSessionViewer.cxx:573
 TSessionViewer.cxx:574
 TSessionViewer.cxx:575
 TSessionViewer.cxx:576
 TSessionViewer.cxx:577
 TSessionViewer.cxx:578
 TSessionViewer.cxx:579
 TSessionViewer.cxx:580
 TSessionViewer.cxx:581
 TSessionViewer.cxx:582
 TSessionViewer.cxx:583
 TSessionViewer.cxx:584
 TSessionViewer.cxx:585
 TSessionViewer.cxx:586
 TSessionViewer.cxx:587
 TSessionViewer.cxx:588
 TSessionViewer.cxx:589
 TSessionViewer.cxx:590
 TSessionViewer.cxx:591
 TSessionViewer.cxx:592
 TSessionViewer.cxx:593
 TSessionViewer.cxx:594
 TSessionViewer.cxx:595
 TSessionViewer.cxx:596
 TSessionViewer.cxx:597
 TSessionViewer.cxx:598
 TSessionViewer.cxx:599
 TSessionViewer.cxx:600
 TSessionViewer.cxx:601
 TSessionViewer.cxx:602
 TSessionViewer.cxx:603
 TSessionViewer.cxx:604
 TSessionViewer.cxx:605
 TSessionViewer.cxx:606
 TSessionViewer.cxx:607
 TSessionViewer.cxx:608
 TSessionViewer.cxx:609
 TSessionViewer.cxx:610
 TSessionViewer.cxx:611
 TSessionViewer.cxx:612
 TSessionViewer.cxx:613
 TSessionViewer.cxx:614
 TSessionViewer.cxx:615
 TSessionViewer.cxx:616
 TSessionViewer.cxx:617
 TSessionViewer.cxx:618
 TSessionViewer.cxx:619
 TSessionViewer.cxx:620
 TSessionViewer.cxx:621
 TSessionViewer.cxx:622
 TSessionViewer.cxx:623
 TSessionViewer.cxx:624
 TSessionViewer.cxx:625
 TSessionViewer.cxx:626
 TSessionViewer.cxx:627
 TSessionViewer.cxx:628
 TSessionViewer.cxx:629
 TSessionViewer.cxx:630
 TSessionViewer.cxx:631
 TSessionViewer.cxx:632
 TSessionViewer.cxx:633
 TSessionViewer.cxx:634
 TSessionViewer.cxx:635
 TSessionViewer.cxx:636
 TSessionViewer.cxx:637
 TSessionViewer.cxx:638
 TSessionViewer.cxx:639
 TSessionViewer.cxx:640
 TSessionViewer.cxx:641
 TSessionViewer.cxx:642
 TSessionViewer.cxx:643
 TSessionViewer.cxx:644
 TSessionViewer.cxx:645
 TSessionViewer.cxx:646
 TSessionViewer.cxx:647
 TSessionViewer.cxx:648
 TSessionViewer.cxx:649
 TSessionViewer.cxx:650
 TSessionViewer.cxx:651
 TSessionViewer.cxx:652
 TSessionViewer.cxx:653
 TSessionViewer.cxx:654
 TSessionViewer.cxx:655
 TSessionViewer.cxx:656
 TSessionViewer.cxx:657
 TSessionViewer.cxx:658
 TSessionViewer.cxx:659
 TSessionViewer.cxx:660
 TSessionViewer.cxx:661
 TSessionViewer.cxx:662
 TSessionViewer.cxx:663
 TSessionViewer.cxx:664
 TSessionViewer.cxx:665
 TSessionViewer.cxx:666
 TSessionViewer.cxx:667
 TSessionViewer.cxx:668
 TSessionViewer.cxx:669
 TSessionViewer.cxx:670
 TSessionViewer.cxx:671
 TSessionViewer.cxx:672
 TSessionViewer.cxx:673
 TSessionViewer.cxx:674
 TSessionViewer.cxx:675
 TSessionViewer.cxx:676
 TSessionViewer.cxx:677
 TSessionViewer.cxx:678
 TSessionViewer.cxx:679
 TSessionViewer.cxx:680
 TSessionViewer.cxx:681
 TSessionViewer.cxx:682
 TSessionViewer.cxx:683
 TSessionViewer.cxx:684
 TSessionViewer.cxx:685
 TSessionViewer.cxx:686
 TSessionViewer.cxx:687
 TSessionViewer.cxx:688
 TSessionViewer.cxx:689
 TSessionViewer.cxx:690
 TSessionViewer.cxx:691
 TSessionViewer.cxx:692
 TSessionViewer.cxx:693
 TSessionViewer.cxx:694
 TSessionViewer.cxx:695
 TSessionViewer.cxx:696
 TSessionViewer.cxx:697
 TSessionViewer.cxx:698
 TSessionViewer.cxx:699
 TSessionViewer.cxx:700
 TSessionViewer.cxx:701
 TSessionViewer.cxx:702
 TSessionViewer.cxx:703
 TSessionViewer.cxx:704
 TSessionViewer.cxx:705
 TSessionViewer.cxx:706
 TSessionViewer.cxx:707
 TSessionViewer.cxx:708
 TSessionViewer.cxx:709
 TSessionViewer.cxx:710
 TSessionViewer.cxx:711
 TSessionViewer.cxx:712
 TSessionViewer.cxx:713
 TSessionViewer.cxx:714
 TSessionViewer.cxx:715
 TSessionViewer.cxx:716
 TSessionViewer.cxx:717
 TSessionViewer.cxx:718
 TSessionViewer.cxx:719
 TSessionViewer.cxx:720
 TSessionViewer.cxx:721
 TSessionViewer.cxx:722
 TSessionViewer.cxx:723
 TSessionViewer.cxx:724
 TSessionViewer.cxx:725
 TSessionViewer.cxx:726
 TSessionViewer.cxx:727
 TSessionViewer.cxx:728
 TSessionViewer.cxx:729
 TSessionViewer.cxx:730
 TSessionViewer.cxx:731
 TSessionViewer.cxx:732
 TSessionViewer.cxx:733
 TSessionViewer.cxx:734
 TSessionViewer.cxx:735
 TSessionViewer.cxx:736
 TSessionViewer.cxx:737
 TSessionViewer.cxx:738
 TSessionViewer.cxx:739
 TSessionViewer.cxx:740
 TSessionViewer.cxx:741
 TSessionViewer.cxx:742
 TSessionViewer.cxx:743
 TSessionViewer.cxx:744
 TSessionViewer.cxx:745
 TSessionViewer.cxx:746
 TSessionViewer.cxx:747
 TSessionViewer.cxx:748
 TSessionViewer.cxx:749
 TSessionViewer.cxx:750
 TSessionViewer.cxx:751
 TSessionViewer.cxx:752
 TSessionViewer.cxx:753
 TSessionViewer.cxx:754
 TSessionViewer.cxx:755
 TSessionViewer.cxx:756
 TSessionViewer.cxx:757
 TSessionViewer.cxx:758
 TSessionViewer.cxx:759
 TSessionViewer.cxx:760
 TSessionViewer.cxx:761
 TSessionViewer.cxx:762
 TSessionViewer.cxx:763
 TSessionViewer.cxx:764
 TSessionViewer.cxx:765
 TSessionViewer.cxx:766
 TSessionViewer.cxx:767
 TSessionViewer.cxx:768
 TSessionViewer.cxx:769
 TSessionViewer.cxx:770
 TSessionViewer.cxx:771
 TSessionViewer.cxx:772
 TSessionViewer.cxx:773
 TSessionViewer.cxx:774
 TSessionViewer.cxx:775
 TSessionViewer.cxx:776
 TSessionViewer.cxx:777
 TSessionViewer.cxx:778
 TSessionViewer.cxx:779
 TSessionViewer.cxx:780
 TSessionViewer.cxx:781
 TSessionViewer.cxx:782
 TSessionViewer.cxx:783
 TSessionViewer.cxx:784
 TSessionViewer.cxx:785
 TSessionViewer.cxx:786
 TSessionViewer.cxx:787
 TSessionViewer.cxx:788
 TSessionViewer.cxx:789
 TSessionViewer.cxx:790
 TSessionViewer.cxx:791
 TSessionViewer.cxx:792
 TSessionViewer.cxx:793
 TSessionViewer.cxx:794
 TSessionViewer.cxx:795
 TSessionViewer.cxx:796
 TSessionViewer.cxx:797
 TSessionViewer.cxx:798
 TSessionViewer.cxx:799
 TSessionViewer.cxx:800
 TSessionViewer.cxx:801
 TSessionViewer.cxx:802
 TSessionViewer.cxx:803
 TSessionViewer.cxx:804
 TSessionViewer.cxx:805
 TSessionViewer.cxx:806
 TSessionViewer.cxx:807
 TSessionViewer.cxx:808
 TSessionViewer.cxx:809
 TSessionViewer.cxx:810
 TSessionViewer.cxx:811
 TSessionViewer.cxx:812
 TSessionViewer.cxx:813
 TSessionViewer.cxx:814
 TSessionViewer.cxx:815
 TSessionViewer.cxx:816
 TSessionViewer.cxx:817
 TSessionViewer.cxx:818
 TSessionViewer.cxx:819
 TSessionViewer.cxx:820
 TSessionViewer.cxx:821
 TSessionViewer.cxx:822
 TSessionViewer.cxx:823
 TSessionViewer.cxx:824
 TSessionViewer.cxx:825
 TSessionViewer.cxx:826
 TSessionViewer.cxx:827
 TSessionViewer.cxx:828
 TSessionViewer.cxx:829
 TSessionViewer.cxx:830
 TSessionViewer.cxx:831
 TSessionViewer.cxx:832
 TSessionViewer.cxx:833
 TSessionViewer.cxx:834
 TSessionViewer.cxx:835
 TSessionViewer.cxx:836
 TSessionViewer.cxx:837
 TSessionViewer.cxx:838
 TSessionViewer.cxx:839
 TSessionViewer.cxx:840
 TSessionViewer.cxx:841
 TSessionViewer.cxx:842
 TSessionViewer.cxx:843
 TSessionViewer.cxx:844
 TSessionViewer.cxx:845
 TSessionViewer.cxx:846
 TSessionViewer.cxx:847
 TSessionViewer.cxx:848
 TSessionViewer.cxx:849
 TSessionViewer.cxx:850
 TSessionViewer.cxx:851
 TSessionViewer.cxx:852
 TSessionViewer.cxx:853
 TSessionViewer.cxx:854
 TSessionViewer.cxx:855
 TSessionViewer.cxx:856
 TSessionViewer.cxx:857
 TSessionViewer.cxx:858
 TSessionViewer.cxx:859
 TSessionViewer.cxx:860
 TSessionViewer.cxx:861
 TSessionViewer.cxx:862
 TSessionViewer.cxx:863
 TSessionViewer.cxx:864
 TSessionViewer.cxx:865
 TSessionViewer.cxx:866
 TSessionViewer.cxx:867
 TSessionViewer.cxx:868
 TSessionViewer.cxx:869
 TSessionViewer.cxx:870
 TSessionViewer.cxx:871
 TSessionViewer.cxx:872
 TSessionViewer.cxx:873
 TSessionViewer.cxx:874
 TSessionViewer.cxx:875
 TSessionViewer.cxx:876
 TSessionViewer.cxx:877
 TSessionViewer.cxx:878
 TSessionViewer.cxx:879
 TSessionViewer.cxx:880
 TSessionViewer.cxx:881
 TSessionViewer.cxx:882
 TSessionViewer.cxx:883
 TSessionViewer.cxx:884
 TSessionViewer.cxx:885
 TSessionViewer.cxx:886
 TSessionViewer.cxx:887
 TSessionViewer.cxx:888
 TSessionViewer.cxx:889
 TSessionViewer.cxx:890
 TSessionViewer.cxx:891
 TSessionViewer.cxx:892
 TSessionViewer.cxx:893
 TSessionViewer.cxx:894
 TSessionViewer.cxx:895
 TSessionViewer.cxx:896
 TSessionViewer.cxx:897
 TSessionViewer.cxx:898
 TSessionViewer.cxx:899
 TSessionViewer.cxx:900
 TSessionViewer.cxx:901
 TSessionViewer.cxx:902
 TSessionViewer.cxx:903
 TSessionViewer.cxx:904
 TSessionViewer.cxx:905
 TSessionViewer.cxx:906
 TSessionViewer.cxx:907
 TSessionViewer.cxx:908
 TSessionViewer.cxx:909
 TSessionViewer.cxx:910
 TSessionViewer.cxx:911
 TSessionViewer.cxx:912
 TSessionViewer.cxx:913
 TSessionViewer.cxx:914
 TSessionViewer.cxx:915
 TSessionViewer.cxx:916
 TSessionViewer.cxx:917
 TSessionViewer.cxx:918
 TSessionViewer.cxx:919
 TSessionViewer.cxx:920
 TSessionViewer.cxx:921
 TSessionViewer.cxx:922
 TSessionViewer.cxx:923
 TSessionViewer.cxx:924
 TSessionViewer.cxx:925
 TSessionViewer.cxx:926
 TSessionViewer.cxx:927
 TSessionViewer.cxx:928
 TSessionViewer.cxx:929
 TSessionViewer.cxx:930
 TSessionViewer.cxx:931
 TSessionViewer.cxx:932
 TSessionViewer.cxx:933
 TSessionViewer.cxx:934
 TSessionViewer.cxx:935
 TSessionViewer.cxx:936
 TSessionViewer.cxx:937
 TSessionViewer.cxx:938
 TSessionViewer.cxx:939
 TSessionViewer.cxx:940
 TSessionViewer.cxx:941
 TSessionViewer.cxx:942
 TSessionViewer.cxx:943
 TSessionViewer.cxx:944
 TSessionViewer.cxx:945
 TSessionViewer.cxx:946
 TSessionViewer.cxx:947
 TSessionViewer.cxx:948
 TSessionViewer.cxx:949
 TSessionViewer.cxx:950
 TSessionViewer.cxx:951
 TSessionViewer.cxx:952
 TSessionViewer.cxx:953
 TSessionViewer.cxx:954
 TSessionViewer.cxx:955
 TSessionViewer.cxx:956
 TSessionViewer.cxx:957
 TSessionViewer.cxx:958
 TSessionViewer.cxx:959
 TSessionViewer.cxx:960
 TSessionViewer.cxx:961
 TSessionViewer.cxx:962
 TSessionViewer.cxx:963
 TSessionViewer.cxx:964
 TSessionViewer.cxx:965
 TSessionViewer.cxx:966
 TSessionViewer.cxx:967
 TSessionViewer.cxx:968
 TSessionViewer.cxx:969
 TSessionViewer.cxx:970
 TSessionViewer.cxx:971
 TSessionViewer.cxx:972
 TSessionViewer.cxx:973
 TSessionViewer.cxx:974
 TSessionViewer.cxx:975
 TSessionViewer.cxx:976
 TSessionViewer.cxx:977
 TSessionViewer.cxx:978
 TSessionViewer.cxx:979
 TSessionViewer.cxx:980
 TSessionViewer.cxx:981
 TSessionViewer.cxx:982
 TSessionViewer.cxx:983
 TSessionViewer.cxx:984
 TSessionViewer.cxx:985
 TSessionViewer.cxx:986
 TSessionViewer.cxx:987
 TSessionViewer.cxx:988
 TSessionViewer.cxx:989
 TSessionViewer.cxx:990
 TSessionViewer.cxx:991
 TSessionViewer.cxx:992
 TSessionViewer.cxx:993
 TSessionViewer.cxx:994
 TSessionViewer.cxx:995
 TSessionViewer.cxx:996
 TSessionViewer.cxx:997
 TSessionViewer.cxx:998
 TSessionViewer.cxx:999
 TSessionViewer.cxx:1000
 TSessionViewer.cxx:1001
 TSessionViewer.cxx:1002
 TSessionViewer.cxx:1003
 TSessionViewer.cxx:1004
 TSessionViewer.cxx:1005
 TSessionViewer.cxx:1006
 TSessionViewer.cxx:1007
 TSessionViewer.cxx:1008
 TSessionViewer.cxx:1009
 TSessionViewer.cxx:1010
 TSessionViewer.cxx:1011
 TSessionViewer.cxx:1012
 TSessionViewer.cxx:1013
 TSessionViewer.cxx:1014
 TSessionViewer.cxx:1015
 TSessionViewer.cxx:1016
 TSessionViewer.cxx:1017
 TSessionViewer.cxx:1018
 TSessionViewer.cxx:1019
 TSessionViewer.cxx:1020
 TSessionViewer.cxx:1021
 TSessionViewer.cxx:1022
 TSessionViewer.cxx:1023
 TSessionViewer.cxx:1024
 TSessionViewer.cxx:1025
 TSessionViewer.cxx:1026
 TSessionViewer.cxx:1027
 TSessionViewer.cxx:1028
 TSessionViewer.cxx:1029
 TSessionViewer.cxx:1030
 TSessionViewer.cxx:1031
 TSessionViewer.cxx:1032
 TSessionViewer.cxx:1033
 TSessionViewer.cxx:1034
 TSessionViewer.cxx:1035
 TSessionViewer.cxx:1036
 TSessionViewer.cxx:1037
 TSessionViewer.cxx:1038
 TSessionViewer.cxx:1039
 TSessionViewer.cxx:1040
 TSessionViewer.cxx:1041
 TSessionViewer.cxx:1042
 TSessionViewer.cxx:1043
 TSessionViewer.cxx:1044
 TSessionViewer.cxx:1045
 TSessionViewer.cxx:1046
 TSessionViewer.cxx:1047
 TSessionViewer.cxx:1048
 TSessionViewer.cxx:1049
 TSessionViewer.cxx:1050
 TSessionViewer.cxx:1051
 TSessionViewer.cxx:1052
 TSessionViewer.cxx:1053
 TSessionViewer.cxx:1054
 TSessionViewer.cxx:1055
 TSessionViewer.cxx:1056
 TSessionViewer.cxx:1057
 TSessionViewer.cxx:1058
 TSessionViewer.cxx:1059
 TSessionViewer.cxx:1060
 TSessionViewer.cxx:1061
 TSessionViewer.cxx:1062
 TSessionViewer.cxx:1063
 TSessionViewer.cxx:1064
 TSessionViewer.cxx:1065
 TSessionViewer.cxx:1066
 TSessionViewer.cxx:1067
 TSessionViewer.cxx:1068
 TSessionViewer.cxx:1069
 TSessionViewer.cxx:1070
 TSessionViewer.cxx:1071
 TSessionViewer.cxx:1072
 TSessionViewer.cxx:1073
 TSessionViewer.cxx:1074
 TSessionViewer.cxx:1075
 TSessionViewer.cxx:1076
 TSessionViewer.cxx:1077
 TSessionViewer.cxx:1078
 TSessionViewer.cxx:1079
 TSessionViewer.cxx:1080
 TSessionViewer.cxx:1081
 TSessionViewer.cxx:1082
 TSessionViewer.cxx:1083
 TSessionViewer.cxx:1084
 TSessionViewer.cxx:1085
 TSessionViewer.cxx:1086
 TSessionViewer.cxx:1087
 TSessionViewer.cxx:1088
 TSessionViewer.cxx:1089
 TSessionViewer.cxx:1090
 TSessionViewer.cxx:1091
 TSessionViewer.cxx:1092
 TSessionViewer.cxx:1093
 TSessionViewer.cxx:1094
 TSessionViewer.cxx:1095
 TSessionViewer.cxx:1096
 TSessionViewer.cxx:1097
 TSessionViewer.cxx:1098
 TSessionViewer.cxx:1099
 TSessionViewer.cxx:1100
 TSessionViewer.cxx:1101
 TSessionViewer.cxx:1102
 TSessionViewer.cxx:1103
 TSessionViewer.cxx:1104
 TSessionViewer.cxx:1105
 TSessionViewer.cxx:1106
 TSessionViewer.cxx:1107
 TSessionViewer.cxx:1108
 TSessionViewer.cxx:1109
 TSessionViewer.cxx:1110
 TSessionViewer.cxx:1111
 TSessionViewer.cxx:1112
 TSessionViewer.cxx:1113
 TSessionViewer.cxx:1114
 TSessionViewer.cxx:1115
 TSessionViewer.cxx:1116
 TSessionViewer.cxx:1117
 TSessionViewer.cxx:1118
 TSessionViewer.cxx:1119
 TSessionViewer.cxx:1120
 TSessionViewer.cxx:1121
 TSessionViewer.cxx:1122
 TSessionViewer.cxx:1123
 TSessionViewer.cxx:1124
 TSessionViewer.cxx:1125
 TSessionViewer.cxx:1126
 TSessionViewer.cxx:1127
 TSessionViewer.cxx:1128
 TSessionViewer.cxx:1129
 TSessionViewer.cxx:1130
 TSessionViewer.cxx:1131
 TSessionViewer.cxx:1132
 TSessionViewer.cxx:1133
 TSessionViewer.cxx:1134
 TSessionViewer.cxx:1135
 TSessionViewer.cxx:1136
 TSessionViewer.cxx:1137
 TSessionViewer.cxx:1138
 TSessionViewer.cxx:1139
 TSessionViewer.cxx:1140
 TSessionViewer.cxx:1141
 TSessionViewer.cxx:1142
 TSessionViewer.cxx:1143
 TSessionViewer.cxx:1144
 TSessionViewer.cxx:1145
 TSessionViewer.cxx:1146
 TSessionViewer.cxx:1147
 TSessionViewer.cxx:1148
 TSessionViewer.cxx:1149
 TSessionViewer.cxx:1150
 TSessionViewer.cxx:1151
 TSessionViewer.cxx:1152
 TSessionViewer.cxx:1153
 TSessionViewer.cxx:1154
 TSessionViewer.cxx:1155
 TSessionViewer.cxx:1156
 TSessionViewer.cxx:1157
 TSessionViewer.cxx:1158
 TSessionViewer.cxx:1159
 TSessionViewer.cxx:1160
 TSessionViewer.cxx:1161
 TSessionViewer.cxx:1162
 TSessionViewer.cxx:1163
 TSessionViewer.cxx:1164
 TSessionViewer.cxx:1165
 TSessionViewer.cxx:1166
 TSessionViewer.cxx:1167
 TSessionViewer.cxx:1168
 TSessionViewer.cxx:1169
 TSessionViewer.cxx:1170
 TSessionViewer.cxx:1171
 TSessionViewer.cxx:1172
 TSessionViewer.cxx:1173
 TSessionViewer.cxx:1174
 TSessionViewer.cxx:1175
 TSessionViewer.cxx:1176
 TSessionViewer.cxx:1177
 TSessionViewer.cxx:1178
 TSessionViewer.cxx:1179
 TSessionViewer.cxx:1180
 TSessionViewer.cxx:1181
 TSessionViewer.cxx:1182
 TSessionViewer.cxx:1183
 TSessionViewer.cxx:1184
 TSessionViewer.cxx:1185
 TSessionViewer.cxx:1186
 TSessionViewer.cxx:1187
 TSessionViewer.cxx:1188
 TSessionViewer.cxx:1189
 TSessionViewer.cxx:1190
 TSessionViewer.cxx:1191
 TSessionViewer.cxx:1192
 TSessionViewer.cxx:1193
 TSessionViewer.cxx:1194
 TSessionViewer.cxx:1195
 TSessionViewer.cxx:1196
 TSessionViewer.cxx:1197
 TSessionViewer.cxx:1198
 TSessionViewer.cxx:1199
 TSessionViewer.cxx:1200
 TSessionViewer.cxx:1201
 TSessionViewer.cxx:1202
 TSessionViewer.cxx:1203
 TSessionViewer.cxx:1204
 TSessionViewer.cxx:1205
 TSessionViewer.cxx:1206
 TSessionViewer.cxx:1207
 TSessionViewer.cxx:1208
 TSessionViewer.cxx:1209
 TSessionViewer.cxx:1210
 TSessionViewer.cxx:1211
 TSessionViewer.cxx:1212
 TSessionViewer.cxx:1213
 TSessionViewer.cxx:1214
 TSessionViewer.cxx:1215
 TSessionViewer.cxx:1216
 TSessionViewer.cxx:1217
 TSessionViewer.cxx:1218
 TSessionViewer.cxx:1219
 TSessionViewer.cxx:1220
 TSessionViewer.cxx:1221
 TSessionViewer.cxx:1222
 TSessionViewer.cxx:1223
 TSessionViewer.cxx:1224
 TSessionViewer.cxx:1225
 TSessionViewer.cxx:1226
 TSessionViewer.cxx:1227
 TSessionViewer.cxx:1228
 TSessionViewer.cxx:1229
 TSessionViewer.cxx:1230
 TSessionViewer.cxx:1231
 TSessionViewer.cxx:1232
 TSessionViewer.cxx:1233
 TSessionViewer.cxx:1234
 TSessionViewer.cxx:1235
 TSessionViewer.cxx:1236
 TSessionViewer.cxx:1237
 TSessionViewer.cxx:1238
 TSessionViewer.cxx:1239
 TSessionViewer.cxx:1240
 TSessionViewer.cxx:1241
 TSessionViewer.cxx:1242
 TSessionViewer.cxx:1243
 TSessionViewer.cxx:1244
 TSessionViewer.cxx:1245
 TSessionViewer.cxx:1246
 TSessionViewer.cxx:1247
 TSessionViewer.cxx:1248
 TSessionViewer.cxx:1249
 TSessionViewer.cxx:1250
 TSessionViewer.cxx:1251
 TSessionViewer.cxx:1252
 TSessionViewer.cxx:1253
 TSessionViewer.cxx:1254
 TSessionViewer.cxx:1255
 TSessionViewer.cxx:1256
 TSessionViewer.cxx:1257
 TSessionViewer.cxx:1258
 TSessionViewer.cxx:1259
 TSessionViewer.cxx:1260
 TSessionViewer.cxx:1261
 TSessionViewer.cxx:1262
 TSessionViewer.cxx:1263
 TSessionViewer.cxx:1264
 TSessionViewer.cxx:1265
 TSessionViewer.cxx:1266
 TSessionViewer.cxx:1267
 TSessionViewer.cxx:1268
 TSessionViewer.cxx:1269
 TSessionViewer.cxx:1270
 TSessionViewer.cxx:1271
 TSessionViewer.cxx:1272
 TSessionViewer.cxx:1273
 TSessionViewer.cxx:1274
 TSessionViewer.cxx:1275
 TSessionViewer.cxx:1276
 TSessionViewer.cxx:1277
 TSessionViewer.cxx:1278
 TSessionViewer.cxx:1279
 TSessionViewer.cxx:1280
 TSessionViewer.cxx:1281
 TSessionViewer.cxx:1282
 TSessionViewer.cxx:1283
 TSessionViewer.cxx:1284
 TSessionViewer.cxx:1285
 TSessionViewer.cxx:1286
 TSessionViewer.cxx:1287
 TSessionViewer.cxx:1288
 TSessionViewer.cxx:1289
 TSessionViewer.cxx:1290
 TSessionViewer.cxx:1291
 TSessionViewer.cxx:1292
 TSessionViewer.cxx:1293
 TSessionViewer.cxx:1294
 TSessionViewer.cxx:1295
 TSessionViewer.cxx:1296
 TSessionViewer.cxx:1297
 TSessionViewer.cxx:1298
 TSessionViewer.cxx:1299
 TSessionViewer.cxx:1300
 TSessionViewer.cxx:1301
 TSessionViewer.cxx:1302
 TSessionViewer.cxx:1303
 TSessionViewer.cxx:1304
 TSessionViewer.cxx:1305
 TSessionViewer.cxx:1306
 TSessionViewer.cxx:1307
 TSessionViewer.cxx:1308
 TSessionViewer.cxx:1309
 TSessionViewer.cxx:1310
 TSessionViewer.cxx:1311
 TSessionViewer.cxx:1312
 TSessionViewer.cxx:1313
 TSessionViewer.cxx:1314
 TSessionViewer.cxx:1315
 TSessionViewer.cxx:1316
 TSessionViewer.cxx:1317
 TSessionViewer.cxx:1318
 TSessionViewer.cxx:1319
 TSessionViewer.cxx:1320
 TSessionViewer.cxx:1321
 TSessionViewer.cxx:1322
 TSessionViewer.cxx:1323
 TSessionViewer.cxx:1324
 TSessionViewer.cxx:1325
 TSessionViewer.cxx:1326
 TSessionViewer.cxx:1327
 TSessionViewer.cxx:1328
 TSessionViewer.cxx:1329
 TSessionViewer.cxx:1330
 TSessionViewer.cxx:1331
 TSessionViewer.cxx:1332
 TSessionViewer.cxx:1333
 TSessionViewer.cxx:1334
 TSessionViewer.cxx:1335
 TSessionViewer.cxx:1336
 TSessionViewer.cxx:1337
 TSessionViewer.cxx:1338
 TSessionViewer.cxx:1339
 TSessionViewer.cxx:1340
 TSessionViewer.cxx:1341
 TSessionViewer.cxx:1342
 TSessionViewer.cxx:1343
 TSessionViewer.cxx:1344
 TSessionViewer.cxx:1345
 TSessionViewer.cxx:1346
 TSessionViewer.cxx:1347
 TSessionViewer.cxx:1348
 TSessionViewer.cxx:1349
 TSessionViewer.cxx:1350
 TSessionViewer.cxx:1351
 TSessionViewer.cxx:1352
 TSessionViewer.cxx:1353
 TSessionViewer.cxx:1354
 TSessionViewer.cxx:1355
 TSessionViewer.cxx:1356
 TSessionViewer.cxx:1357
 TSessionViewer.cxx:1358
 TSessionViewer.cxx:1359
 TSessionViewer.cxx:1360
 TSessionViewer.cxx:1361
 TSessionViewer.cxx:1362
 TSessionViewer.cxx:1363
 TSessionViewer.cxx:1364
 TSessionViewer.cxx:1365
 TSessionViewer.cxx:1366
 TSessionViewer.cxx:1367
 TSessionViewer.cxx:1368
 TSessionViewer.cxx:1369
 TSessionViewer.cxx:1370
 TSessionViewer.cxx:1371
 TSessionViewer.cxx:1372
 TSessionViewer.cxx:1373
 TSessionViewer.cxx:1374
 TSessionViewer.cxx:1375
 TSessionViewer.cxx:1376
 TSessionViewer.cxx:1377
 TSessionViewer.cxx:1378
 TSessionViewer.cxx:1379
 TSessionViewer.cxx:1380
 TSessionViewer.cxx:1381
 TSessionViewer.cxx:1382
 TSessionViewer.cxx:1383
 TSessionViewer.cxx:1384
 TSessionViewer.cxx:1385
 TSessionViewer.cxx:1386
 TSessionViewer.cxx:1387
 TSessionViewer.cxx:1388
 TSessionViewer.cxx:1389
 TSessionViewer.cxx:1390
 TSessionViewer.cxx:1391
 TSessionViewer.cxx:1392
 TSessionViewer.cxx:1393
 TSessionViewer.cxx:1394
 TSessionViewer.cxx:1395
 TSessionViewer.cxx:1396
 TSessionViewer.cxx:1397
 TSessionViewer.cxx:1398
 TSessionViewer.cxx:1399
 TSessionViewer.cxx:1400
 TSessionViewer.cxx:1401
 TSessionViewer.cxx:1402
 TSessionViewer.cxx:1403
 TSessionViewer.cxx:1404
 TSessionViewer.cxx:1405
 TSessionViewer.cxx:1406
 TSessionViewer.cxx:1407
 TSessionViewer.cxx:1408
 TSessionViewer.cxx:1409
 TSessionViewer.cxx:1410
 TSessionViewer.cxx:1411
 TSessionViewer.cxx:1412
 TSessionViewer.cxx:1413
 TSessionViewer.cxx:1414
 TSessionViewer.cxx:1415
 TSessionViewer.cxx:1416
 TSessionViewer.cxx:1417
 TSessionViewer.cxx:1418
 TSessionViewer.cxx:1419
 TSessionViewer.cxx:1420
 TSessionViewer.cxx:1421
 TSessionViewer.cxx:1422
 TSessionViewer.cxx:1423
 TSessionViewer.cxx:1424
 TSessionViewer.cxx:1425
 TSessionViewer.cxx:1426
 TSessionViewer.cxx:1427
 TSessionViewer.cxx:1428
 TSessionViewer.cxx:1429
 TSessionViewer.cxx:1430
 TSessionViewer.cxx:1431
 TSessionViewer.cxx:1432
 TSessionViewer.cxx:1433
 TSessionViewer.cxx:1434
 TSessionViewer.cxx:1435
 TSessionViewer.cxx:1436
 TSessionViewer.cxx:1437
 TSessionViewer.cxx:1438
 TSessionViewer.cxx:1439
 TSessionViewer.cxx:1440
 TSessionViewer.cxx:1441
 TSessionViewer.cxx:1442
 TSessionViewer.cxx:1443
 TSessionViewer.cxx:1444
 TSessionViewer.cxx:1445
 TSessionViewer.cxx:1446
 TSessionViewer.cxx:1447
 TSessionViewer.cxx:1448
 TSessionViewer.cxx:1449
 TSessionViewer.cxx:1450
 TSessionViewer.cxx:1451
 TSessionViewer.cxx:1452
 TSessionViewer.cxx:1453
 TSessionViewer.cxx:1454
 TSessionViewer.cxx:1455
 TSessionViewer.cxx:1456
 TSessionViewer.cxx:1457
 TSessionViewer.cxx:1458
 TSessionViewer.cxx:1459
 TSessionViewer.cxx:1460
 TSessionViewer.cxx:1461
 TSessionViewer.cxx:1462
 TSessionViewer.cxx:1463
 TSessionViewer.cxx:1464
 TSessionViewer.cxx:1465
 TSessionViewer.cxx:1466
 TSessionViewer.cxx:1467
 TSessionViewer.cxx:1468
 TSessionViewer.cxx:1469
 TSessionViewer.cxx:1470
 TSessionViewer.cxx:1471
 TSessionViewer.cxx:1472
 TSessionViewer.cxx:1473
 TSessionViewer.cxx:1474
 TSessionViewer.cxx:1475
 TSessionViewer.cxx:1476
 TSessionViewer.cxx:1477
 TSessionViewer.cxx:1478
 TSessionViewer.cxx:1479
 TSessionViewer.cxx:1480
 TSessionViewer.cxx:1481
 TSessionViewer.cxx:1482
 TSessionViewer.cxx:1483
 TSessionViewer.cxx:1484
 TSessionViewer.cxx:1485
 TSessionViewer.cxx:1486
 TSessionViewer.cxx:1487
 TSessionViewer.cxx:1488
 TSessionViewer.cxx:1489
 TSessionViewer.cxx:1490
 TSessionViewer.cxx:1491
 TSessionViewer.cxx:1492
 TSessionViewer.cxx:1493
 TSessionViewer.cxx:1494
 TSessionViewer.cxx:1495
 TSessionViewer.cxx:1496
 TSessionViewer.cxx:1497
 TSessionViewer.cxx:1498
 TSessionViewer.cxx:1499
 TSessionViewer.cxx:1500
 TSessionViewer.cxx:1501
 TSessionViewer.cxx:1502
 TSessionViewer.cxx:1503
 TSessionViewer.cxx:1504
 TSessionViewer.cxx:1505
 TSessionViewer.cxx:1506
 TSessionViewer.cxx:1507
 TSessionViewer.cxx:1508
 TSessionViewer.cxx:1509
 TSessionViewer.cxx:1510
 TSessionViewer.cxx:1511
 TSessionViewer.cxx:1512
 TSessionViewer.cxx:1513
 TSessionViewer.cxx:1514
 TSessionViewer.cxx:1515
 TSessionViewer.cxx:1516
 TSessionViewer.cxx:1517
 TSessionViewer.cxx:1518
 TSessionViewer.cxx:1519
 TSessionViewer.cxx:1520
 TSessionViewer.cxx:1521
 TSessionViewer.cxx:1522
 TSessionViewer.cxx:1523
 TSessionViewer.cxx:1524
 TSessionViewer.cxx:1525
 TSessionViewer.cxx:1526
 TSessionViewer.cxx:1527
 TSessionViewer.cxx:1528
 TSessionViewer.cxx:1529
 TSessionViewer.cxx:1530
 TSessionViewer.cxx:1531
 TSessionViewer.cxx:1532
 TSessionViewer.cxx:1533
 TSessionViewer.cxx:1534
 TSessionViewer.cxx:1535
 TSessionViewer.cxx:1536
 TSessionViewer.cxx:1537
 TSessionViewer.cxx:1538
 TSessionViewer.cxx:1539
 TSessionViewer.cxx:1540
 TSessionViewer.cxx:1541
 TSessionViewer.cxx:1542
 TSessionViewer.cxx:1543
 TSessionViewer.cxx:1544
 TSessionViewer.cxx:1545
 TSessionViewer.cxx:1546
 TSessionViewer.cxx:1547
 TSessionViewer.cxx:1548
 TSessionViewer.cxx:1549
 TSessionViewer.cxx:1550
 TSessionViewer.cxx:1551
 TSessionViewer.cxx:1552
 TSessionViewer.cxx:1553
 TSessionViewer.cxx:1554
 TSessionViewer.cxx:1555
 TSessionViewer.cxx:1556
 TSessionViewer.cxx:1557
 TSessionViewer.cxx:1558
 TSessionViewer.cxx:1559
 TSessionViewer.cxx:1560
 TSessionViewer.cxx:1561
 TSessionViewer.cxx:1562
 TSessionViewer.cxx:1563
 TSessionViewer.cxx:1564
 TSessionViewer.cxx:1565
 TSessionViewer.cxx:1566
 TSessionViewer.cxx:1567
 TSessionViewer.cxx:1568
 TSessionViewer.cxx:1569
 TSessionViewer.cxx:1570
 TSessionViewer.cxx:1571
 TSessionViewer.cxx:1572
 TSessionViewer.cxx:1573
 TSessionViewer.cxx:1574
 TSessionViewer.cxx:1575
 TSessionViewer.cxx:1576
 TSessionViewer.cxx:1577
 TSessionViewer.cxx:1578
 TSessionViewer.cxx:1579
 TSessionViewer.cxx:1580
 TSessionViewer.cxx:1581
 TSessionViewer.cxx:1582
 TSessionViewer.cxx:1583
 TSessionViewer.cxx:1584
 TSessionViewer.cxx:1585
 TSessionViewer.cxx:1586
 TSessionViewer.cxx:1587
 TSessionViewer.cxx:1588
 TSessionViewer.cxx:1589
 TSessionViewer.cxx:1590
 TSessionViewer.cxx:1591
 TSessionViewer.cxx:1592
 TSessionViewer.cxx:1593
 TSessionViewer.cxx:1594
 TSessionViewer.cxx:1595
 TSessionViewer.cxx:1596
 TSessionViewer.cxx:1597
 TSessionViewer.cxx:1598
 TSessionViewer.cxx:1599
 TSessionViewer.cxx:1600
 TSessionViewer.cxx:1601
 TSessionViewer.cxx:1602
 TSessionViewer.cxx:1603
 TSessionViewer.cxx:1604
 TSessionViewer.cxx:1605
 TSessionViewer.cxx:1606
 TSessionViewer.cxx:1607
 TSessionViewer.cxx:1608
 TSessionViewer.cxx:1609
 TSessionViewer.cxx:1610
 TSessionViewer.cxx:1611
 TSessionViewer.cxx:1612
 TSessionViewer.cxx:1613
 TSessionViewer.cxx:1614
 TSessionViewer.cxx:1615
 TSessionViewer.cxx:1616
 TSessionViewer.cxx:1617
 TSessionViewer.cxx:1618
 TSessionViewer.cxx:1619
 TSessionViewer.cxx:1620
 TSessionViewer.cxx:1621
 TSessionViewer.cxx:1622
 TSessionViewer.cxx:1623
 TSessionViewer.cxx:1624
 TSessionViewer.cxx:1625
 TSessionViewer.cxx:1626
 TSessionViewer.cxx:1627
 TSessionViewer.cxx:1628
 TSessionViewer.cxx:1629
 TSessionViewer.cxx:1630
 TSessionViewer.cxx:1631
 TSessionViewer.cxx:1632
 TSessionViewer.cxx:1633
 TSessionViewer.cxx:1634
 TSessionViewer.cxx:1635
 TSessionViewer.cxx:1636
 TSessionViewer.cxx:1637
 TSessionViewer.cxx:1638
 TSessionViewer.cxx:1639
 TSessionViewer.cxx:1640
 TSessionViewer.cxx:1641
 TSessionViewer.cxx:1642
 TSessionViewer.cxx:1643
 TSessionViewer.cxx:1644
 TSessionViewer.cxx:1645
 TSessionViewer.cxx:1646
 TSessionViewer.cxx:1647
 TSessionViewer.cxx:1648
 TSessionViewer.cxx:1649
 TSessionViewer.cxx:1650
 TSessionViewer.cxx:1651
 TSessionViewer.cxx:1652
 TSessionViewer.cxx:1653
 TSessionViewer.cxx:1654
 TSessionViewer.cxx:1655
 TSessionViewer.cxx:1656
 TSessionViewer.cxx:1657
 TSessionViewer.cxx:1658
 TSessionViewer.cxx:1659
 TSessionViewer.cxx:1660
 TSessionViewer.cxx:1661
 TSessionViewer.cxx:1662
 TSessionViewer.cxx:1663
 TSessionViewer.cxx:1664
 TSessionViewer.cxx:1665
 TSessionViewer.cxx:1666
 TSessionViewer.cxx:1667
 TSessionViewer.cxx:1668
 TSessionViewer.cxx:1669
 TSessionViewer.cxx:1670
 TSessionViewer.cxx:1671
 TSessionViewer.cxx:1672
 TSessionViewer.cxx:1673
 TSessionViewer.cxx:1674
 TSessionViewer.cxx:1675
 TSessionViewer.cxx:1676
 TSessionViewer.cxx:1677
 TSessionViewer.cxx:1678
 TSessionViewer.cxx:1679
 TSessionViewer.cxx:1680
 TSessionViewer.cxx:1681
 TSessionViewer.cxx:1682
 TSessionViewer.cxx:1683
 TSessionViewer.cxx:1684
 TSessionViewer.cxx:1685
 TSessionViewer.cxx:1686
 TSessionViewer.cxx:1687
 TSessionViewer.cxx:1688
 TSessionViewer.cxx:1689
 TSessionViewer.cxx:1690
 TSessionViewer.cxx:1691
 TSessionViewer.cxx:1692
 TSessionViewer.cxx:1693
 TSessionViewer.cxx:1694
 TSessionViewer.cxx:1695
 TSessionViewer.cxx:1696
 TSessionViewer.cxx:1697
 TSessionViewer.cxx:1698
 TSessionViewer.cxx:1699
 TSessionViewer.cxx:1700
 TSessionViewer.cxx:1701
 TSessionViewer.cxx:1702
 TSessionViewer.cxx:1703
 TSessionViewer.cxx:1704
 TSessionViewer.cxx:1705
 TSessionViewer.cxx:1706
 TSessionViewer.cxx:1707
 TSessionViewer.cxx:1708
 TSessionViewer.cxx:1709
 TSessionViewer.cxx:1710
 TSessionViewer.cxx:1711
 TSessionViewer.cxx:1712
 TSessionViewer.cxx:1713
 TSessionViewer.cxx:1714
 TSessionViewer.cxx:1715
 TSessionViewer.cxx:1716
 TSessionViewer.cxx:1717
 TSessionViewer.cxx:1718
 TSessionViewer.cxx:1719
 TSessionViewer.cxx:1720
 TSessionViewer.cxx:1721
 TSessionViewer.cxx:1722
 TSessionViewer.cxx:1723
 TSessionViewer.cxx:1724
 TSessionViewer.cxx:1725
 TSessionViewer.cxx:1726
 TSessionViewer.cxx:1727
 TSessionViewer.cxx:1728
 TSessionViewer.cxx:1729
 TSessionViewer.cxx:1730
 TSessionViewer.cxx:1731
 TSessionViewer.cxx:1732
 TSessionViewer.cxx:1733
 TSessionViewer.cxx:1734
 TSessionViewer.cxx:1735
 TSessionViewer.cxx:1736
 TSessionViewer.cxx:1737
 TSessionViewer.cxx:1738
 TSessionViewer.cxx:1739
 TSessionViewer.cxx:1740
 TSessionViewer.cxx:1741
 TSessionViewer.cxx:1742
 TSessionViewer.cxx:1743
 TSessionViewer.cxx:1744
 TSessionViewer.cxx:1745
 TSessionViewer.cxx:1746
 TSessionViewer.cxx:1747
 TSessionViewer.cxx:1748
 TSessionViewer.cxx:1749
 TSessionViewer.cxx:1750
 TSessionViewer.cxx:1751
 TSessionViewer.cxx:1752
 TSessionViewer.cxx:1753
 TSessionViewer.cxx:1754
 TSessionViewer.cxx:1755
 TSessionViewer.cxx:1756
 TSessionViewer.cxx:1757
 TSessionViewer.cxx:1758
 TSessionViewer.cxx:1759
 TSessionViewer.cxx:1760
 TSessionViewer.cxx:1761
 TSessionViewer.cxx:1762
 TSessionViewer.cxx:1763
 TSessionViewer.cxx:1764
 TSessionViewer.cxx:1765
 TSessionViewer.cxx:1766
 TSessionViewer.cxx:1767
 TSessionViewer.cxx:1768
 TSessionViewer.cxx:1769
 TSessionViewer.cxx:1770
 TSessionViewer.cxx:1771
 TSessionViewer.cxx:1772
 TSessionViewer.cxx:1773
 TSessionViewer.cxx:1774
 TSessionViewer.cxx:1775
 TSessionViewer.cxx:1776
 TSessionViewer.cxx:1777
 TSessionViewer.cxx:1778
 TSessionViewer.cxx:1779
 TSessionViewer.cxx:1780
 TSessionViewer.cxx:1781
 TSessionViewer.cxx:1782
 TSessionViewer.cxx:1783
 TSessionViewer.cxx:1784
 TSessionViewer.cxx:1785
 TSessionViewer.cxx:1786
 TSessionViewer.cxx:1787
 TSessionViewer.cxx:1788
 TSessionViewer.cxx:1789
 TSessionViewer.cxx:1790
 TSessionViewer.cxx:1791
 TSessionViewer.cxx:1792
 TSessionViewer.cxx:1793
 TSessionViewer.cxx:1794
 TSessionViewer.cxx:1795
 TSessionViewer.cxx:1796
 TSessionViewer.cxx:1797
 TSessionViewer.cxx:1798
 TSessionViewer.cxx:1799
 TSessionViewer.cxx:1800
 TSessionViewer.cxx:1801
 TSessionViewer.cxx:1802
 TSessionViewer.cxx:1803
 TSessionViewer.cxx:1804
 TSessionViewer.cxx:1805
 TSessionViewer.cxx:1806
 TSessionViewer.cxx:1807
 TSessionViewer.cxx:1808
 TSessionViewer.cxx:1809
 TSessionViewer.cxx:1810
 TSessionViewer.cxx:1811
 TSessionViewer.cxx:1812
 TSessionViewer.cxx:1813
 TSessionViewer.cxx:1814
 TSessionViewer.cxx:1815
 TSessionViewer.cxx:1816
 TSessionViewer.cxx:1817
 TSessionViewer.cxx:1818
 TSessionViewer.cxx:1819
 TSessionViewer.cxx:1820
 TSessionViewer.cxx:1821
 TSessionViewer.cxx:1822
 TSessionViewer.cxx:1823
 TSessionViewer.cxx:1824
 TSessionViewer.cxx:1825
 TSessionViewer.cxx:1826
 TSessionViewer.cxx:1827
 TSessionViewer.cxx:1828
 TSessionViewer.cxx:1829
 TSessionViewer.cxx:1830
 TSessionViewer.cxx:1831
 TSessionViewer.cxx:1832
 TSessionViewer.cxx:1833
 TSessionViewer.cxx:1834
 TSessionViewer.cxx:1835
 TSessionViewer.cxx:1836
 TSessionViewer.cxx:1837
 TSessionViewer.cxx:1838
 TSessionViewer.cxx:1839
 TSessionViewer.cxx:1840
 TSessionViewer.cxx:1841
 TSessionViewer.cxx:1842
 TSessionViewer.cxx:1843
 TSessionViewer.cxx:1844
 TSessionViewer.cxx:1845
 TSessionViewer.cxx:1846
 TSessionViewer.cxx:1847
 TSessionViewer.cxx:1848
 TSessionViewer.cxx:1849
 TSessionViewer.cxx:1850
 TSessionViewer.cxx:1851
 TSessionViewer.cxx:1852
 TSessionViewer.cxx:1853
 TSessionViewer.cxx:1854
 TSessionViewer.cxx:1855
 TSessionViewer.cxx:1856
 TSessionViewer.cxx:1857
 TSessionViewer.cxx:1858
 TSessionViewer.cxx:1859
 TSessionViewer.cxx:1860
 TSessionViewer.cxx:1861
 TSessionViewer.cxx:1862
 TSessionViewer.cxx:1863
 TSessionViewer.cxx:1864
 TSessionViewer.cxx:1865
 TSessionViewer.cxx:1866
 TSessionViewer.cxx:1867
 TSessionViewer.cxx:1868
 TSessionViewer.cxx:1869
 TSessionViewer.cxx:1870
 TSessionViewer.cxx:1871
 TSessionViewer.cxx:1872
 TSessionViewer.cxx:1873
 TSessionViewer.cxx:1874
 TSessionViewer.cxx:1875
 TSessionViewer.cxx:1876
 TSessionViewer.cxx:1877
 TSessionViewer.cxx:1878
 TSessionViewer.cxx:1879
 TSessionViewer.cxx:1880
 TSessionViewer.cxx:1881
 TSessionViewer.cxx:1882
 TSessionViewer.cxx:1883
 TSessionViewer.cxx:1884
 TSessionViewer.cxx:1885
 TSessionViewer.cxx:1886
 TSessionViewer.cxx:1887
 TSessionViewer.cxx:1888
 TSessionViewer.cxx:1889
 TSessionViewer.cxx:1890
 TSessionViewer.cxx:1891
 TSessionViewer.cxx:1892
 TSessionViewer.cxx:1893
 TSessionViewer.cxx:1894
 TSessionViewer.cxx:1895
 TSessionViewer.cxx:1896
 TSessionViewer.cxx:1897
 TSessionViewer.cxx:1898
 TSessionViewer.cxx:1899
 TSessionViewer.cxx:1900
 TSessionViewer.cxx:1901
 TSessionViewer.cxx:1902
 TSessionViewer.cxx:1903
 TSessionViewer.cxx:1904
 TSessionViewer.cxx:1905
 TSessionViewer.cxx:1906
 TSessionViewer.cxx:1907
 TSessionViewer.cxx:1908
 TSessionViewer.cxx:1909
 TSessionViewer.cxx:1910
 TSessionViewer.cxx:1911
 TSessionViewer.cxx:1912
 TSessionViewer.cxx:1913
 TSessionViewer.cxx:1914
 TSessionViewer.cxx:1915
 TSessionViewer.cxx:1916
 TSessionViewer.cxx:1917
 TSessionViewer.cxx:1918
 TSessionViewer.cxx:1919
 TSessionViewer.cxx:1920
 TSessionViewer.cxx:1921
 TSessionViewer.cxx:1922
 TSessionViewer.cxx:1923
 TSessionViewer.cxx:1924
 TSessionViewer.cxx:1925
 TSessionViewer.cxx:1926
 TSessionViewer.cxx:1927
 TSessionViewer.cxx:1928
 TSessionViewer.cxx:1929
 TSessionViewer.cxx:1930
 TSessionViewer.cxx:1931
 TSessionViewer.cxx:1932
 TSessionViewer.cxx:1933
 TSessionViewer.cxx:1934
 TSessionViewer.cxx:1935
 TSessionViewer.cxx:1936
 TSessionViewer.cxx:1937
 TSessionViewer.cxx:1938
 TSessionViewer.cxx:1939
 TSessionViewer.cxx:1940
 TSessionViewer.cxx:1941
 TSessionViewer.cxx:1942
 TSessionViewer.cxx:1943
 TSessionViewer.cxx:1944
 TSessionViewer.cxx:1945
 TSessionViewer.cxx:1946
 TSessionViewer.cxx:1947
 TSessionViewer.cxx:1948
 TSessionViewer.cxx:1949
 TSessionViewer.cxx:1950
 TSessionViewer.cxx:1951
 TSessionViewer.cxx:1952
 TSessionViewer.cxx:1953
 TSessionViewer.cxx:1954
 TSessionViewer.cxx:1955
 TSessionViewer.cxx:1956
 TSessionViewer.cxx:1957
 TSessionViewer.cxx:1958
 TSessionViewer.cxx:1959
 TSessionViewer.cxx:1960
 TSessionViewer.cxx:1961
 TSessionViewer.cxx:1962
 TSessionViewer.cxx:1963
 TSessionViewer.cxx:1964
 TSessionViewer.cxx:1965
 TSessionViewer.cxx:1966
 TSessionViewer.cxx:1967
 TSessionViewer.cxx:1968
 TSessionViewer.cxx:1969
 TSessionViewer.cxx:1970
 TSessionViewer.cxx:1971
 TSessionViewer.cxx:1972
 TSessionViewer.cxx:1973
 TSessionViewer.cxx:1974
 TSessionViewer.cxx:1975
 TSessionViewer.cxx:1976
 TSessionViewer.cxx:1977
 TSessionViewer.cxx:1978
 TSessionViewer.cxx:1979
 TSessionViewer.cxx:1980
 TSessionViewer.cxx:1981
 TSessionViewer.cxx:1982
 TSessionViewer.cxx:1983
 TSessionViewer.cxx:1984
 TSessionViewer.cxx:1985
 TSessionViewer.cxx:1986
 TSessionViewer.cxx:1987
 TSessionViewer.cxx:1988
 TSessionViewer.cxx:1989
 TSessionViewer.cxx:1990
 TSessionViewer.cxx:1991
 TSessionViewer.cxx:1992
 TSessionViewer.cxx:1993
 TSessionViewer.cxx:1994
 TSessionViewer.cxx:1995
 TSessionViewer.cxx:1996
 TSessionViewer.cxx:1997
 TSessionViewer.cxx:1998
 TSessionViewer.cxx:1999
 TSessionViewer.cxx:2000
 TSessionViewer.cxx:2001
 TSessionViewer.cxx:2002
 TSessionViewer.cxx:2003
 TSessionViewer.cxx:2004
 TSessionViewer.cxx:2005
 TSessionViewer.cxx:2006
 TSessionViewer.cxx:2007
 TSessionViewer.cxx:2008
 TSessionViewer.cxx:2009
 TSessionViewer.cxx:2010
 TSessionViewer.cxx:2011
 TSessionViewer.cxx:2012
 TSessionViewer.cxx:2013
 TSessionViewer.cxx:2014
 TSessionViewer.cxx:2015
 TSessionViewer.cxx:2016
 TSessionViewer.cxx:2017
 TSessionViewer.cxx:2018
 TSessionViewer.cxx:2019
 TSessionViewer.cxx:2020
 TSessionViewer.cxx:2021
 TSessionViewer.cxx:2022
 TSessionViewer.cxx:2023
 TSessionViewer.cxx:2024
 TSessionViewer.cxx:2025
 TSessionViewer.cxx:2026
 TSessionViewer.cxx:2027
 TSessionViewer.cxx:2028
 TSessionViewer.cxx:2029
 TSessionViewer.cxx:2030
 TSessionViewer.cxx:2031
 TSessionViewer.cxx:2032
 TSessionViewer.cxx:2033
 TSessionViewer.cxx:2034
 TSessionViewer.cxx:2035
 TSessionViewer.cxx:2036
 TSessionViewer.cxx:2037
 TSessionViewer.cxx:2038
 TSessionViewer.cxx:2039
 TSessionViewer.cxx:2040
 TSessionViewer.cxx:2041
 TSessionViewer.cxx:2042
 TSessionViewer.cxx:2043
 TSessionViewer.cxx:2044
 TSessionViewer.cxx:2045
 TSessionViewer.cxx:2046
 TSessionViewer.cxx:2047
 TSessionViewer.cxx:2048
 TSessionViewer.cxx:2049
 TSessionViewer.cxx:2050
 TSessionViewer.cxx:2051
 TSessionViewer.cxx:2052
 TSessionViewer.cxx:2053
 TSessionViewer.cxx:2054
 TSessionViewer.cxx:2055
 TSessionViewer.cxx:2056
 TSessionViewer.cxx:2057
 TSessionViewer.cxx:2058
 TSessionViewer.cxx:2059
 TSessionViewer.cxx:2060
 TSessionViewer.cxx:2061
 TSessionViewer.cxx:2062
 TSessionViewer.cxx:2063
 TSessionViewer.cxx:2064
 TSessionViewer.cxx:2065
 TSessionViewer.cxx:2066
 TSessionViewer.cxx:2067
 TSessionViewer.cxx:2068
 TSessionViewer.cxx:2069
 TSessionViewer.cxx:2070
 TSessionViewer.cxx:2071
 TSessionViewer.cxx:2072
 TSessionViewer.cxx:2073
 TSessionViewer.cxx:2074
 TSessionViewer.cxx:2075
 TSessionViewer.cxx:2076
 TSessionViewer.cxx:2077
 TSessionViewer.cxx:2078
 TSessionViewer.cxx:2079
 TSessionViewer.cxx:2080
 TSessionViewer.cxx:2081
 TSessionViewer.cxx:2082
 TSessionViewer.cxx:2083
 TSessionViewer.cxx:2084
 TSessionViewer.cxx:2085
 TSessionViewer.cxx:2086
 TSessionViewer.cxx:2087
 TSessionViewer.cxx:2088
 TSessionViewer.cxx:2089
 TSessionViewer.cxx:2090
 TSessionViewer.cxx:2091
 TSessionViewer.cxx:2092
 TSessionViewer.cxx:2093
 TSessionViewer.cxx:2094
 TSessionViewer.cxx:2095
 TSessionViewer.cxx:2096
 TSessionViewer.cxx:2097
 TSessionViewer.cxx:2098
 TSessionViewer.cxx:2099
 TSessionViewer.cxx:2100
 TSessionViewer.cxx:2101
 TSessionViewer.cxx:2102
 TSessionViewer.cxx:2103
 TSessionViewer.cxx:2104
 TSessionViewer.cxx:2105
 TSessionViewer.cxx:2106
 TSessionViewer.cxx:2107
 TSessionViewer.cxx:2108
 TSessionViewer.cxx:2109
 TSessionViewer.cxx:2110
 TSessionViewer.cxx:2111
 TSessionViewer.cxx:2112
 TSessionViewer.cxx:2113
 TSessionViewer.cxx:2114
 TSessionViewer.cxx:2115
 TSessionViewer.cxx:2116
 TSessionViewer.cxx:2117
 TSessionViewer.cxx:2118
 TSessionViewer.cxx:2119
 TSessionViewer.cxx:2120
 TSessionViewer.cxx:2121
 TSessionViewer.cxx:2122
 TSessionViewer.cxx:2123
 TSessionViewer.cxx:2124
 TSessionViewer.cxx:2125
 TSessionViewer.cxx:2126
 TSessionViewer.cxx:2127
 TSessionViewer.cxx:2128
 TSessionViewer.cxx:2129
 TSessionViewer.cxx:2130
 TSessionViewer.cxx:2131
 TSessionViewer.cxx:2132
 TSessionViewer.cxx:2133
 TSessionViewer.cxx:2134
 TSessionViewer.cxx:2135
 TSessionViewer.cxx:2136
 TSessionViewer.cxx:2137
 TSessionViewer.cxx:2138
 TSessionViewer.cxx:2139
 TSessionViewer.cxx:2140
 TSessionViewer.cxx:2141
 TSessionViewer.cxx:2142
 TSessionViewer.cxx:2143
 TSessionViewer.cxx:2144
 TSessionViewer.cxx:2145
 TSessionViewer.cxx:2146
 TSessionViewer.cxx:2147
 TSessionViewer.cxx:2148
 TSessionViewer.cxx:2149
 TSessionViewer.cxx:2150
 TSessionViewer.cxx:2151
 TSessionViewer.cxx:2152
 TSessionViewer.cxx:2153
 TSessionViewer.cxx:2154
 TSessionViewer.cxx:2155
 TSessionViewer.cxx:2156
 TSessionViewer.cxx:2157
 TSessionViewer.cxx:2158
 TSessionViewer.cxx:2159
 TSessionViewer.cxx:2160
 TSessionViewer.cxx:2161
 TSessionViewer.cxx:2162
 TSessionViewer.cxx:2163
 TSessionViewer.cxx:2164
 TSessionViewer.cxx:2165
 TSessionViewer.cxx:2166
 TSessionViewer.cxx:2167
 TSessionViewer.cxx:2168
 TSessionViewer.cxx:2169
 TSessionViewer.cxx:2170
 TSessionViewer.cxx:2171
 TSessionViewer.cxx:2172
 TSessionViewer.cxx:2173
 TSessionViewer.cxx:2174
 TSessionViewer.cxx:2175
 TSessionViewer.cxx:2176
 TSessionViewer.cxx:2177
 TSessionViewer.cxx:2178
 TSessionViewer.cxx:2179
 TSessionViewer.cxx:2180
 TSessionViewer.cxx:2181
 TSessionViewer.cxx:2182
 TSessionViewer.cxx:2183
 TSessionViewer.cxx:2184
 TSessionViewer.cxx:2185
 TSessionViewer.cxx:2186
 TSessionViewer.cxx:2187
 TSessionViewer.cxx:2188
 TSessionViewer.cxx:2189
 TSessionViewer.cxx:2190
 TSessionViewer.cxx:2191
 TSessionViewer.cxx:2192
 TSessionViewer.cxx:2193
 TSessionViewer.cxx:2194
 TSessionViewer.cxx:2195
 TSessionViewer.cxx:2196
 TSessionViewer.cxx:2197
 TSessionViewer.cxx:2198
 TSessionViewer.cxx:2199
 TSessionViewer.cxx:2200
 TSessionViewer.cxx:2201
 TSessionViewer.cxx:2202
 TSessionViewer.cxx:2203
 TSessionViewer.cxx:2204
 TSessionViewer.cxx:2205
 TSessionViewer.cxx:2206
 TSessionViewer.cxx:2207
 TSessionViewer.cxx:2208
 TSessionViewer.cxx:2209
 TSessionViewer.cxx:2210
 TSessionViewer.cxx:2211
 TSessionViewer.cxx:2212
 TSessionViewer.cxx:2213
 TSessionViewer.cxx:2214
 TSessionViewer.cxx:2215
 TSessionViewer.cxx:2216
 TSessionViewer.cxx:2217
 TSessionViewer.cxx:2218
 TSessionViewer.cxx:2219
 TSessionViewer.cxx:2220
 TSessionViewer.cxx:2221
 TSessionViewer.cxx:2222
 TSessionViewer.cxx:2223
 TSessionViewer.cxx:2224
 TSessionViewer.cxx:2225
 TSessionViewer.cxx:2226
 TSessionViewer.cxx:2227
 TSessionViewer.cxx:2228
 TSessionViewer.cxx:2229
 TSessionViewer.cxx:2230
 TSessionViewer.cxx:2231
 TSessionViewer.cxx:2232
 TSessionViewer.cxx:2233
 TSessionViewer.cxx:2234
 TSessionViewer.cxx:2235
 TSessionViewer.cxx:2236
 TSessionViewer.cxx:2237
 TSessionViewer.cxx:2238
 TSessionViewer.cxx:2239
 TSessionViewer.cxx:2240
 TSessionViewer.cxx:2241
 TSessionViewer.cxx:2242
 TSessionViewer.cxx:2243
 TSessionViewer.cxx:2244
 TSessionViewer.cxx:2245
 TSessionViewer.cxx:2246
 TSessionViewer.cxx:2247
 TSessionViewer.cxx:2248
 TSessionViewer.cxx:2249
 TSessionViewer.cxx:2250
 TSessionViewer.cxx:2251
 TSessionViewer.cxx:2252
 TSessionViewer.cxx:2253
 TSessionViewer.cxx:2254
 TSessionViewer.cxx:2255
 TSessionViewer.cxx:2256
 TSessionViewer.cxx:2257
 TSessionViewer.cxx:2258
 TSessionViewer.cxx:2259
 TSessionViewer.cxx:2260
 TSessionViewer.cxx:2261
 TSessionViewer.cxx:2262
 TSessionViewer.cxx:2263
 TSessionViewer.cxx:2264
 TSessionViewer.cxx:2265
 TSessionViewer.cxx:2266
 TSessionViewer.cxx:2267
 TSessionViewer.cxx:2268
 TSessionViewer.cxx:2269
 TSessionViewer.cxx:2270
 TSessionViewer.cxx:2271
 TSessionViewer.cxx:2272
 TSessionViewer.cxx:2273
 TSessionViewer.cxx:2274
 TSessionViewer.cxx:2275
 TSessionViewer.cxx:2276
 TSessionViewer.cxx:2277
 TSessionViewer.cxx:2278
 TSessionViewer.cxx:2279
 TSessionViewer.cxx:2280
 TSessionViewer.cxx:2281
 TSessionViewer.cxx:2282
 TSessionViewer.cxx:2283
 TSessionViewer.cxx:2284
 TSessionViewer.cxx:2285
 TSessionViewer.cxx:2286
 TSessionViewer.cxx:2287
 TSessionViewer.cxx:2288
 TSessionViewer.cxx:2289
 TSessionViewer.cxx:2290
 TSessionViewer.cxx:2291
 TSessionViewer.cxx:2292
 TSessionViewer.cxx:2293
 TSessionViewer.cxx:2294
 TSessionViewer.cxx:2295
 TSessionViewer.cxx:2296
 TSessionViewer.cxx:2297
 TSessionViewer.cxx:2298
 TSessionViewer.cxx:2299
 TSessionViewer.cxx:2300
 TSessionViewer.cxx:2301
 TSessionViewer.cxx:2302
 TSessionViewer.cxx:2303
 TSessionViewer.cxx:2304
 TSessionViewer.cxx:2305
 TSessionViewer.cxx:2306
 TSessionViewer.cxx:2307
 TSessionViewer.cxx:2308
 TSessionViewer.cxx:2309
 TSessionViewer.cxx:2310
 TSessionViewer.cxx:2311
 TSessionViewer.cxx:2312
 TSessionViewer.cxx:2313
 TSessionViewer.cxx:2314
 TSessionViewer.cxx:2315
 TSessionViewer.cxx:2316
 TSessionViewer.cxx:2317
 TSessionViewer.cxx:2318
 TSessionViewer.cxx:2319
 TSessionViewer.cxx:2320
 TSessionViewer.cxx:2321
 TSessionViewer.cxx:2322
 TSessionViewer.cxx:2323
 TSessionViewer.cxx:2324
 TSessionViewer.cxx:2325
 TSessionViewer.cxx:2326
 TSessionViewer.cxx:2327
 TSessionViewer.cxx:2328
 TSessionViewer.cxx:2329
 TSessionViewer.cxx:2330
 TSessionViewer.cxx:2331
 TSessionViewer.cxx:2332
 TSessionViewer.cxx:2333
 TSessionViewer.cxx:2334
 TSessionViewer.cxx:2335
 TSessionViewer.cxx:2336
 TSessionViewer.cxx:2337
 TSessionViewer.cxx:2338
 TSessionViewer.cxx:2339
 TSessionViewer.cxx:2340
 TSessionViewer.cxx:2341
 TSessionViewer.cxx:2342
 TSessionViewer.cxx:2343
 TSessionViewer.cxx:2344
 TSessionViewer.cxx:2345
 TSessionViewer.cxx:2346
 TSessionViewer.cxx:2347
 TSessionViewer.cxx:2348
 TSessionViewer.cxx:2349
 TSessionViewer.cxx:2350
 TSessionViewer.cxx:2351
 TSessionViewer.cxx:2352
 TSessionViewer.cxx:2353
 TSessionViewer.cxx:2354
 TSessionViewer.cxx:2355
 TSessionViewer.cxx:2356
 TSessionViewer.cxx:2357
 TSessionViewer.cxx:2358
 TSessionViewer.cxx:2359
 TSessionViewer.cxx:2360
 TSessionViewer.cxx:2361
 TSessionViewer.cxx:2362
 TSessionViewer.cxx:2363
 TSessionViewer.cxx:2364
 TSessionViewer.cxx:2365
 TSessionViewer.cxx:2366
 TSessionViewer.cxx:2367
 TSessionViewer.cxx:2368
 TSessionViewer.cxx:2369
 TSessionViewer.cxx:2370
 TSessionViewer.cxx:2371
 TSessionViewer.cxx:2372
 TSessionViewer.cxx:2373
 TSessionViewer.cxx:2374
 TSessionViewer.cxx:2375
 TSessionViewer.cxx:2376
 TSessionViewer.cxx:2377
 TSessionViewer.cxx:2378
 TSessionViewer.cxx:2379
 TSessionViewer.cxx:2380
 TSessionViewer.cxx:2381
 TSessionViewer.cxx:2382
 TSessionViewer.cxx:2383
 TSessionViewer.cxx:2384
 TSessionViewer.cxx:2385
 TSessionViewer.cxx:2386
 TSessionViewer.cxx:2387
 TSessionViewer.cxx:2388
 TSessionViewer.cxx:2389
 TSessionViewer.cxx:2390
 TSessionViewer.cxx:2391
 TSessionViewer.cxx:2392
 TSessionViewer.cxx:2393
 TSessionViewer.cxx:2394
 TSessionViewer.cxx:2395
 TSessionViewer.cxx:2396
 TSessionViewer.cxx:2397
 TSessionViewer.cxx:2398
 TSessionViewer.cxx:2399
 TSessionViewer.cxx:2400
 TSessionViewer.cxx:2401
 TSessionViewer.cxx:2402
 TSessionViewer.cxx:2403
 TSessionViewer.cxx:2404
 TSessionViewer.cxx:2405
 TSessionViewer.cxx:2406
 TSessionViewer.cxx:2407
 TSessionViewer.cxx:2408
 TSessionViewer.cxx:2409
 TSessionViewer.cxx:2410
 TSessionViewer.cxx:2411
 TSessionViewer.cxx:2412
 TSessionViewer.cxx:2413
 TSessionViewer.cxx:2414
 TSessionViewer.cxx:2415
 TSessionViewer.cxx:2416
 TSessionViewer.cxx:2417
 TSessionViewer.cxx:2418
 TSessionViewer.cxx:2419
 TSessionViewer.cxx:2420
 TSessionViewer.cxx:2421
 TSessionViewer.cxx:2422
 TSessionViewer.cxx:2423
 TSessionViewer.cxx:2424
 TSessionViewer.cxx:2425
 TSessionViewer.cxx:2426
 TSessionViewer.cxx:2427
 TSessionViewer.cxx:2428
 TSessionViewer.cxx:2429
 TSessionViewer.cxx:2430
 TSessionViewer.cxx:2431
 TSessionViewer.cxx:2432
 TSessionViewer.cxx:2433
 TSessionViewer.cxx:2434
 TSessionViewer.cxx:2435
 TSessionViewer.cxx:2436
 TSessionViewer.cxx:2437
 TSessionViewer.cxx:2438
 TSessionViewer.cxx:2439
 TSessionViewer.cxx:2440
 TSessionViewer.cxx:2441
 TSessionViewer.cxx:2442
 TSessionViewer.cxx:2443
 TSessionViewer.cxx:2444
 TSessionViewer.cxx:2445
 TSessionViewer.cxx:2446
 TSessionViewer.cxx:2447
 TSessionViewer.cxx:2448
 TSessionViewer.cxx:2449
 TSessionViewer.cxx:2450
 TSessionViewer.cxx:2451
 TSessionViewer.cxx:2452
 TSessionViewer.cxx:2453
 TSessionViewer.cxx:2454
 TSessionViewer.cxx:2455
 TSessionViewer.cxx:2456
 TSessionViewer.cxx:2457
 TSessionViewer.cxx:2458
 TSessionViewer.cxx:2459
 TSessionViewer.cxx:2460
 TSessionViewer.cxx:2461
 TSessionViewer.cxx:2462
 TSessionViewer.cxx:2463
 TSessionViewer.cxx:2464
 TSessionViewer.cxx:2465
 TSessionViewer.cxx:2466
 TSessionViewer.cxx:2467
 TSessionViewer.cxx:2468
 TSessionViewer.cxx:2469
 TSessionViewer.cxx:2470
 TSessionViewer.cxx:2471
 TSessionViewer.cxx:2472
 TSessionViewer.cxx:2473
 TSessionViewer.cxx:2474
 TSessionViewer.cxx:2475
 TSessionViewer.cxx:2476
 TSessionViewer.cxx:2477
 TSessionViewer.cxx:2478
 TSessionViewer.cxx:2479
 TSessionViewer.cxx:2480
 TSessionViewer.cxx:2481
 TSessionViewer.cxx:2482
 TSessionViewer.cxx:2483
 TSessionViewer.cxx:2484
 TSessionViewer.cxx:2485
 TSessionViewer.cxx:2486
 TSessionViewer.cxx:2487
 TSessionViewer.cxx:2488
 TSessionViewer.cxx:2489
 TSessionViewer.cxx:2490
 TSessionViewer.cxx:2491
 TSessionViewer.cxx:2492
 TSessionViewer.cxx:2493
 TSessionViewer.cxx:2494
 TSessionViewer.cxx:2495
 TSessionViewer.cxx:2496
 TSessionViewer.cxx:2497
 TSessionViewer.cxx:2498
 TSessionViewer.cxx:2499
 TSessionViewer.cxx:2500
 TSessionViewer.cxx:2501
 TSessionViewer.cxx:2502
 TSessionViewer.cxx:2503
 TSessionViewer.cxx:2504
 TSessionViewer.cxx:2505
 TSessionViewer.cxx:2506
 TSessionViewer.cxx:2507
 TSessionViewer.cxx:2508
 TSessionViewer.cxx:2509
 TSessionViewer.cxx:2510
 TSessionViewer.cxx:2511
 TSessionViewer.cxx:2512
 TSessionViewer.cxx:2513
 TSessionViewer.cxx:2514
 TSessionViewer.cxx:2515
 TSessionViewer.cxx:2516
 TSessionViewer.cxx:2517
 TSessionViewer.cxx:2518
 TSessionViewer.cxx:2519
 TSessionViewer.cxx:2520
 TSessionViewer.cxx:2521
 TSessionViewer.cxx:2522
 TSessionViewer.cxx:2523
 TSessionViewer.cxx:2524
 TSessionViewer.cxx:2525
 TSessionViewer.cxx:2526
 TSessionViewer.cxx:2527
 TSessionViewer.cxx:2528
 TSessionViewer.cxx:2529
 TSessionViewer.cxx:2530
 TSessionViewer.cxx:2531
 TSessionViewer.cxx:2532
 TSessionViewer.cxx:2533
 TSessionViewer.cxx:2534
 TSessionViewer.cxx:2535
 TSessionViewer.cxx:2536
 TSessionViewer.cxx:2537
 TSessionViewer.cxx:2538
 TSessionViewer.cxx:2539
 TSessionViewer.cxx:2540
 TSessionViewer.cxx:2541
 TSessionViewer.cxx:2542
 TSessionViewer.cxx:2543
 TSessionViewer.cxx:2544
 TSessionViewer.cxx:2545
 TSessionViewer.cxx:2546
 TSessionViewer.cxx:2547
 TSessionViewer.cxx:2548
 TSessionViewer.cxx:2549
 TSessionViewer.cxx:2550
 TSessionViewer.cxx:2551
 TSessionViewer.cxx:2552
 TSessionViewer.cxx:2553
 TSessionViewer.cxx:2554
 TSessionViewer.cxx:2555
 TSessionViewer.cxx:2556
 TSessionViewer.cxx:2557
 TSessionViewer.cxx:2558
 TSessionViewer.cxx:2559
 TSessionViewer.cxx:2560
 TSessionViewer.cxx:2561
 TSessionViewer.cxx:2562
 TSessionViewer.cxx:2563
 TSessionViewer.cxx:2564
 TSessionViewer.cxx:2565
 TSessionViewer.cxx:2566
 TSessionViewer.cxx:2567
 TSessionViewer.cxx:2568
 TSessionViewer.cxx:2569
 TSessionViewer.cxx:2570
 TSessionViewer.cxx:2571
 TSessionViewer.cxx:2572
 TSessionViewer.cxx:2573
 TSessionViewer.cxx:2574
 TSessionViewer.cxx:2575
 TSessionViewer.cxx:2576
 TSessionViewer.cxx:2577
 TSessionViewer.cxx:2578
 TSessionViewer.cxx:2579
 TSessionViewer.cxx:2580
 TSessionViewer.cxx:2581
 TSessionViewer.cxx:2582
 TSessionViewer.cxx:2583
 TSessionViewer.cxx:2584
 TSessionViewer.cxx:2585
 TSessionViewer.cxx:2586
 TSessionViewer.cxx:2587
 TSessionViewer.cxx:2588
 TSessionViewer.cxx:2589
 TSessionViewer.cxx:2590
 TSessionViewer.cxx:2591
 TSessionViewer.cxx:2592
 TSessionViewer.cxx:2593
 TSessionViewer.cxx:2594
 TSessionViewer.cxx:2595
 TSessionViewer.cxx:2596
 TSessionViewer.cxx:2597
 TSessionViewer.cxx:2598
 TSessionViewer.cxx:2599
 TSessionViewer.cxx:2600
 TSessionViewer.cxx:2601
 TSessionViewer.cxx:2602
 TSessionViewer.cxx:2603
 TSessionViewer.cxx:2604
 TSessionViewer.cxx:2605
 TSessionViewer.cxx:2606
 TSessionViewer.cxx:2607
 TSessionViewer.cxx:2608
 TSessionViewer.cxx:2609
 TSessionViewer.cxx:2610
 TSessionViewer.cxx:2611
 TSessionViewer.cxx:2612
 TSessionViewer.cxx:2613
 TSessionViewer.cxx:2614
 TSessionViewer.cxx:2615
 TSessionViewer.cxx:2616
 TSessionViewer.cxx:2617
 TSessionViewer.cxx:2618
 TSessionViewer.cxx:2619
 TSessionViewer.cxx:2620
 TSessionViewer.cxx:2621
 TSessionViewer.cxx:2622
 TSessionViewer.cxx:2623
 TSessionViewer.cxx:2624
 TSessionViewer.cxx:2625
 TSessionViewer.cxx:2626
 TSessionViewer.cxx:2627
 TSessionViewer.cxx:2628
 TSessionViewer.cxx:2629
 TSessionViewer.cxx:2630
 TSessionViewer.cxx:2631
 TSessionViewer.cxx:2632
 TSessionViewer.cxx:2633
 TSessionViewer.cxx:2634
 TSessionViewer.cxx:2635
 TSessionViewer.cxx:2636
 TSessionViewer.cxx:2637
 TSessionViewer.cxx:2638
 TSessionViewer.cxx:2639
 TSessionViewer.cxx:2640
 TSessionViewer.cxx:2641
 TSessionViewer.cxx:2642
 TSessionViewer.cxx:2643
 TSessionViewer.cxx:2644
 TSessionViewer.cxx:2645
 TSessionViewer.cxx:2646
 TSessionViewer.cxx:2647
 TSessionViewer.cxx:2648
 TSessionViewer.cxx:2649
 TSessionViewer.cxx:2650
 TSessionViewer.cxx:2651
 TSessionViewer.cxx:2652
 TSessionViewer.cxx:2653
 TSessionViewer.cxx:2654
 TSessionViewer.cxx:2655
 TSessionViewer.cxx:2656
 TSessionViewer.cxx:2657
 TSessionViewer.cxx:2658
 TSessionViewer.cxx:2659
 TSessionViewer.cxx:2660
 TSessionViewer.cxx:2661
 TSessionViewer.cxx:2662
 TSessionViewer.cxx:2663
 TSessionViewer.cxx:2664
 TSessionViewer.cxx:2665
 TSessionViewer.cxx:2666
 TSessionViewer.cxx:2667
 TSessionViewer.cxx:2668
 TSessionViewer.cxx:2669
 TSessionViewer.cxx:2670
 TSessionViewer.cxx:2671
 TSessionViewer.cxx:2672
 TSessionViewer.cxx:2673
 TSessionViewer.cxx:2674
 TSessionViewer.cxx:2675
 TSessionViewer.cxx:2676
 TSessionViewer.cxx:2677
 TSessionViewer.cxx:2678
 TSessionViewer.cxx:2679
 TSessionViewer.cxx:2680
 TSessionViewer.cxx:2681
 TSessionViewer.cxx:2682
 TSessionViewer.cxx:2683
 TSessionViewer.cxx:2684
 TSessionViewer.cxx:2685
 TSessionViewer.cxx:2686
 TSessionViewer.cxx:2687
 TSessionViewer.cxx:2688
 TSessionViewer.cxx:2689
 TSessionViewer.cxx:2690
 TSessionViewer.cxx:2691
 TSessionViewer.cxx:2692
 TSessionViewer.cxx:2693
 TSessionViewer.cxx:2694
 TSessionViewer.cxx:2695
 TSessionViewer.cxx:2696
 TSessionViewer.cxx:2697
 TSessionViewer.cxx:2698
 TSessionViewer.cxx:2699
 TSessionViewer.cxx:2700
 TSessionViewer.cxx:2701
 TSessionViewer.cxx:2702
 TSessionViewer.cxx:2703
 TSessionViewer.cxx:2704
 TSessionViewer.cxx:2705
 TSessionViewer.cxx:2706
 TSessionViewer.cxx:2707
 TSessionViewer.cxx:2708
 TSessionViewer.cxx:2709
 TSessionViewer.cxx:2710
 TSessionViewer.cxx:2711
 TSessionViewer.cxx:2712
 TSessionViewer.cxx:2713
 TSessionViewer.cxx:2714
 TSessionViewer.cxx:2715
 TSessionViewer.cxx:2716
 TSessionViewer.cxx:2717
 TSessionViewer.cxx:2718
 TSessionViewer.cxx:2719
 TSessionViewer.cxx:2720
 TSessionViewer.cxx:2721
 TSessionViewer.cxx:2722
 TSessionViewer.cxx:2723
 TSessionViewer.cxx:2724
 TSessionViewer.cxx:2725
 TSessionViewer.cxx:2726
 TSessionViewer.cxx:2727
 TSessionViewer.cxx:2728
 TSessionViewer.cxx:2729
 TSessionViewer.cxx:2730
 TSessionViewer.cxx:2731
 TSessionViewer.cxx:2732
 TSessionViewer.cxx:2733
 TSessionViewer.cxx:2734
 TSessionViewer.cxx:2735
 TSessionViewer.cxx:2736
 TSessionViewer.cxx:2737
 TSessionViewer.cxx:2738
 TSessionViewer.cxx:2739
 TSessionViewer.cxx:2740
 TSessionViewer.cxx:2741
 TSessionViewer.cxx:2742
 TSessionViewer.cxx:2743
 TSessionViewer.cxx:2744
 TSessionViewer.cxx:2745
 TSessionViewer.cxx:2746
 TSessionViewer.cxx:2747
 TSessionViewer.cxx:2748
 TSessionViewer.cxx:2749
 TSessionViewer.cxx:2750
 TSessionViewer.cxx:2751
 TSessionViewer.cxx:2752
 TSessionViewer.cxx:2753
 TSessionViewer.cxx:2754
 TSessionViewer.cxx:2755
 TSessionViewer.cxx:2756
 TSessionViewer.cxx:2757
 TSessionViewer.cxx:2758
 TSessionViewer.cxx:2759
 TSessionViewer.cxx:2760
 TSessionViewer.cxx:2761
 TSessionViewer.cxx:2762
 TSessionViewer.cxx:2763
 TSessionViewer.cxx:2764
 TSessionViewer.cxx:2765
 TSessionViewer.cxx:2766
 TSessionViewer.cxx:2767
 TSessionViewer.cxx:2768
 TSessionViewer.cxx:2769
 TSessionViewer.cxx:2770
 TSessionViewer.cxx:2771
 TSessionViewer.cxx:2772
 TSessionViewer.cxx:2773
 TSessionViewer.cxx:2774
 TSessionViewer.cxx:2775
 TSessionViewer.cxx:2776
 TSessionViewer.cxx:2777
 TSessionViewer.cxx:2778
 TSessionViewer.cxx:2779
 TSessionViewer.cxx:2780
 TSessionViewer.cxx:2781
 TSessionViewer.cxx:2782
 TSessionViewer.cxx:2783
 TSessionViewer.cxx:2784
 TSessionViewer.cxx:2785
 TSessionViewer.cxx:2786
 TSessionViewer.cxx:2787
 TSessionViewer.cxx:2788
 TSessionViewer.cxx:2789
 TSessionViewer.cxx:2790
 TSessionViewer.cxx:2791
 TSessionViewer.cxx:2792
 TSessionViewer.cxx:2793
 TSessionViewer.cxx:2794
 TSessionViewer.cxx:2795
 TSessionViewer.cxx:2796
 TSessionViewer.cxx:2797
 TSessionViewer.cxx:2798
 TSessionViewer.cxx:2799
 TSessionViewer.cxx:2800
 TSessionViewer.cxx:2801
 TSessionViewer.cxx:2802
 TSessionViewer.cxx:2803
 TSessionViewer.cxx:2804
 TSessionViewer.cxx:2805
 TSessionViewer.cxx:2806
 TSessionViewer.cxx:2807
 TSessionViewer.cxx:2808
 TSessionViewer.cxx:2809
 TSessionViewer.cxx:2810
 TSessionViewer.cxx:2811
 TSessionViewer.cxx:2812
 TSessionViewer.cxx:2813
 TSessionViewer.cxx:2814
 TSessionViewer.cxx:2815
 TSessionViewer.cxx:2816
 TSessionViewer.cxx:2817
 TSessionViewer.cxx:2818
 TSessionViewer.cxx:2819
 TSessionViewer.cxx:2820
 TSessionViewer.cxx:2821
 TSessionViewer.cxx:2822
 TSessionViewer.cxx:2823
 TSessionViewer.cxx:2824
 TSessionViewer.cxx:2825
 TSessionViewer.cxx:2826
 TSessionViewer.cxx:2827
 TSessionViewer.cxx:2828
 TSessionViewer.cxx: