Logo ROOT   6.12/07
Reference Guide
TSessionLogView.cxx
Go to the documentation of this file.
1 // @(#)root/sessionviewer:$Id$
2 // Author: Bertrand Bellenot, Gerri Ganis 15/09/2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "TSessionLogView.h"
13 #include "TSessionViewer.h"
14 #include "TProof.h"
15 #include "KeySymbols.h"
16 
17 //_____________________________________________________________________________
18 //
19 // TSessionLogView
20 //
21 // Dialog used to display session logs from the session viewer
22 //_____________________________________________________________________________
23 
25 
26 ////////////////////////////////////////////////////////////////////////////////
27 /// Create an editor in a dialog.
28 
30  TGTransientFrame(gClient->GetRoot(), viewer, w, h)
31 {
32  fViewer = viewer;
33  fTextView = new TGTextView(this, w, h, kSunkenFrame | kDoubleBorder);
34  fL1 = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 3, 3, 3, 3);
36 
37  fClose = new TGTextButton(this, " &Close ");
38  fL2 = new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 5, 5);
40 
41  SetTitle();
42  fViewer->SetLogWindow(this);
43 
44  MapSubwindows();
45 
47 }
48 
49 ////////////////////////////////////////////////////////////////////////////////
50 
52 {
53 }
54 
55 ////////////////////////////////////////////////////////////////////////////////
56 /// Set title in editor window.
57 
59 {
60  TString title;
61  title.Form("PROOF Processing Logs: %s", (fViewer->GetActDesc()->fProof ?
62  fViewer->GetActDesc()->fProof->GetMaster() : "<dummy>"));
63  SetWindowName(title);
64  SetIconName(title);
65 }
66 
67 ////////////////////////////////////////////////////////////////////////////////
68 /// Show editor.
69 
71 {
72  MapWindow();
73 }
74 
75 ////////////////////////////////////////////////////////////////////////////////
76 /// Load a text buffer in the editor.
77 
78 void TSessionLogView::AddBuffer(const char *buffer)
79 {
80  TGText txt;
81  txt.LoadBuffer(buffer);
82  fTextView->AddText(&txt);
84 }
85 
86 ////////////////////////////////////////////////////////////////////////////////
87 /// Clear log window.
88 
90 {
91  fTextView->Clear();
92 }
93 
94 ////////////////////////////////////////////////////////////////////////////////
95 /// Load a text buffer in the editor.
96 
97 void TSessionLogView::LoadBuffer(const char *buffer)
98 {
99  fTextView->LoadBuffer(buffer);
101 }
102 
103 ////////////////////////////////////////////////////////////////////////////////
104 /// Load a file in the editor.
105 
107 {
108  fTextView->LoadFile(file);
110 }
111 
112 ////////////////////////////////////////////////////////////////////////////////
113 /// Called when closed via window manager action.
114 
116 {
117  if (fViewer->GetActDesc()->fProof) {
119  "LogMessage(const char*,Bool_t)", fViewer,
120  "LogMessage(const char*,Bool_t)");
121  }
122  fViewer->SetLogWindow(0);
123  delete fTextView;
124  delete fClose;
125  delete fL1;
126  delete fL2;
127  DestroyWindow();
128 }
129 
130 ////////////////////////////////////////////////////////////////////////////////
131 /// Process OK button.
132 
134 {
135  switch (GET_MSG(msg)) {
136  case kC_COMMAND:
137  switch (GET_SUBMSG(msg)) {
138  case kCM_BUTTON:
139  // Only one button and one action...
140  CloseWindow();
141  break;
142  default:
143  break;
144  }
145  break;
146  default:
147  break;
148  }
149  return kTRUE;
150 }
151 
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
virtual void Clear(Option_t *="")
Clear text view widget.
Definition: TGTextView.cxx:428
virtual Bool_t LoadBuffer(const char *txtbuf)
Load text from a text buffer. Return false in case of failure.
Definition: TGTextView.cxx:469
void LoadBuffer(const char *buffer)
Load a text buffer in the editor.
Definition: TGText.h:67
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1746
TSessionViewer * fViewer
TH1 * h
Definition: legend2.C:5
TGLayoutHints * fL1
void LoadFile(const char *file)
Load a file in the editor.
Basic string class.
Definition: TString.h:125
#define gClient
Definition: TGClient.h:166
bool Bool_t
Definition: RtypesCore.h:59
TGLayoutHints * fL2
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process OK button.
void SetLogWindow(TSessionLogView *log)
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition: TGFrame.cxx:1759
Bool_t LoadBuffer(const char *txtbuf)
Load a 0 terminated buffer. Lines will be split at &#39; &#39;.
Definition: TGText.cxx:512
void SetTitle()
Set title in editor window.
TGTextButton * fClose
TGTextView * fTextView
virtual void ShowBottom()
Show bottom of the page.
virtual Bool_t LoadFile(const char *fname, long startpos=0, long length=-1)
Load a file in the text view widget.
Definition: TGTextView.cxx:452
TSessionDescription * GetActDesc() const
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.h:375
Int_t GET_SUBMSG(Long_t val)
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2343
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void AddText(TGText *text)
Add text to the view widget.
Definition: TGTextView.cxx:206
void Popup()
Show editor.
Int_t GET_MSG(Long_t val)
long Long_t
Definition: RtypesCore.h:50
#define ClassImp(name)
Definition: Rtypes.h:359
const char * GetMaster() const
Definition: TProof.h:903
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1025
void ClearLogView()
Clear log window.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
TSessionLogView(TSessionViewer *viewer, UInt_t w, UInt_t h)
Create an editor in a dialog.
void CloseWindow()
Called when closed via window manager action.
Definition: file.py:1
virtual void MapWindow()
Definition: TGFrame.h:251
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual void DestroyWindow()
Definition: TGWindow.h:92
void AddBuffer(const char *buffer)
Load a text buffer in the editor.
virtual ~TSessionLogView()