00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TSessionLogView.h"
00013 #include "TSessionViewer.h"
00014 #include "TProof.h"
00015 #include "KeySymbols.h"
00016
00017
00018
00019
00020
00021
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
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
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
00070
00071 MapWindow();
00072 }
00073
00074
00075 void TSessionLogView::AddBuffer(const char *buffer)
00076 {
00077
00078
00079 TGText txt;
00080 txt.LoadBuffer(buffer);
00081 fTextView->AddText(&txt);
00082 fTextView->ShowBottom();
00083 }
00084
00085
00086 void TSessionLogView::ClearLogView()
00087 {
00088
00089
00090 fTextView->Clear();
00091 }
00092
00093
00094 void TSessionLogView::LoadBuffer(const char *buffer)
00095 {
00096
00097
00098 fTextView->LoadBuffer(buffer);
00099 fTextView->ShowBottom();
00100 }
00101
00102
00103 void TSessionLogView::LoadFile(const char *file)
00104 {
00105
00106
00107 fTextView->LoadFile(file);
00108 fTextView->ShowBottom();
00109 }
00110
00111
00112 void TSessionLogView::CloseWindow()
00113 {
00114
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
00132
00133 switch (GET_MSG(msg)) {
00134 case kC_COMMAND:
00135 switch (GET_SUBMSG(msg)) {
00136 case kCM_BUTTON:
00137
00138 CloseWindow();
00139 break;
00140 default:
00141 break;
00142 }
00143 break;
00144 default:
00145 break;
00146 }
00147 return kTRUE;
00148 }
00149