TSessionLogView.cxx

Go to the documentation of this file.
00001 // @(#)root/sessionviewer:$Id: TSessionLogView.cxx 32548 2010-03-11 11:43:06Z bellenot $
00002 // Author: Bertrand Bellenot, Gerri Ganis 15/09/2005
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #include "TSessionLogView.h"
00013 #include "TSessionViewer.h"
00014 #include "TProof.h"
00015 #include "KeySymbols.h"
00016 
00017 //_____________________________________________________________________________
00018 //
00019 // TSessionLogView
00020 //
00021 // Dialog used to display session logs from the session viewer
00022 //_____________________________________________________________________________
00023 
00024 ClassImp(TSessionLogView)
00025 
00026 //____________________________________________________________________________
00027 TSessionLogView::TSessionLogView(TSessionViewer *viewer, UInt_t w, UInt_t h) :
00028    TGTransientFrame(gClient->GetRoot(), viewer, w, h)
00029 {
00030    // Create an editor in a dialog.
00031 
00032    fViewer = viewer;
00033    fTextView = new TGTextView(this, w, h, kSunkenFrame | kDoubleBorder);
00034    fL1 = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 3, 3, 3, 3);
00035    AddFrame(fTextView, fL1);
00036 
00037    fClose = new TGTextButton(this, "  &Close  ");
00038    fL2 = new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 5, 5);
00039    AddFrame(fClose, fL2);
00040 
00041    SetTitle();
00042    fViewer->SetLogWindow(this);
00043 
00044    MapSubwindows();
00045 
00046    Resize(GetDefaultSize());
00047 }
00048 
00049 //____________________________________________________________________________
00050 TSessionLogView::~TSessionLogView()
00051 {
00052 }
00053 
00054 //____________________________________________________________________________
00055 void TSessionLogView::SetTitle()
00056 {
00057    // Set title in editor window.
00058 
00059    TString title;
00060    title.Form("PROOF Processing Logs: %s", (fViewer->GetActDesc()->fProof ?
00061               fViewer->GetActDesc()->fProof->GetMaster() : "<dummy>"));
00062    SetWindowName(title);
00063    SetIconName(title);
00064 }
00065 
00066 //____________________________________________________________________________
00067 void TSessionLogView::Popup()
00068 {
00069    // Show editor.
00070 
00071    MapWindow();
00072 }
00073 
00074 //____________________________________________________________________________
00075 void TSessionLogView::AddBuffer(const char *buffer)
00076 {
00077    // Load a text buffer in the editor.
00078 
00079    TGText txt;
00080    txt.LoadBuffer(buffer);
00081    fTextView->AddText(&txt);
00082    fTextView->ShowBottom();
00083 }
00084 
00085 //____________________________________________________________________________
00086 void TSessionLogView::ClearLogView()
00087 {
00088    // Clear log window.
00089 
00090    fTextView->Clear();
00091 }
00092 
00093 //____________________________________________________________________________
00094 void TSessionLogView::LoadBuffer(const char *buffer)
00095 {
00096    // Load a text buffer in the editor.
00097 
00098    fTextView->LoadBuffer(buffer);
00099    fTextView->ShowBottom();
00100 }
00101 
00102 //____________________________________________________________________________
00103 void TSessionLogView::LoadFile(const char *file)
00104 {
00105    // Load a file in the editor.
00106 
00107    fTextView->LoadFile(file);
00108    fTextView->ShowBottom();
00109 }
00110 
00111 //____________________________________________________________________________
00112 void TSessionLogView::CloseWindow()
00113 {
00114    // Called when closed via window manager action.
00115    if (fViewer->GetActDesc()->fProof) {
00116       fViewer->GetActDesc()->fProof->Disconnect(
00117             "LogMessage(const char*,Bool_t)", fViewer,
00118             "LogMessage(const char*,Bool_t)");
00119    }
00120    fViewer->SetLogWindow(0);
00121    delete fTextView;
00122    delete fClose;
00123    delete fL1;
00124    delete fL2;
00125    DestroyWindow();
00126 }
00127 
00128 //____________________________________________________________________________
00129 Bool_t TSessionLogView::ProcessMessage(Long_t msg, Long_t, Long_t)
00130 {
00131    // Process OK button.
00132 
00133    switch (GET_MSG(msg)) {
00134       case kC_COMMAND:
00135          switch (GET_SUBMSG(msg)) {
00136             case kCM_BUTTON:
00137                // Only one button and one action...
00138                CloseWindow();
00139                break;
00140             default:
00141                break;
00142          }
00143          break;
00144       default:
00145          break;
00146    }
00147    return kTRUE;
00148 }
00149 

Generated on Tue Jul 5 14:22:42 2011 for ROOT_528-00b_version by  doxygen 1.5.1