Changeset 2058 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 05/05/03 10:37:08 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r2052 r2058 108 108 fName = name; 109 109 110 *fLog << inf << "Instantiated MEvtLoop (" << name << "), using ROOT v" << ROOTVER << endl; 110 fLog->Underline(); 111 *fLog << inf << "Instantiated MEvtLoop (" << name << "), using ROOT v" << ROOTVER << "\033[0m" << endl; 111 112 } 112 113 … … 240 241 return kTRUE; 241 242 default: 243 *fLog << warn << "MEvtloop: fDisplay->ChecStatus() has returned unknown status #" << fDisplay->CheckStatus() << "... cleared." << endl; 242 244 fDisplay->ClearStatus(); 243 *fLog << warn << "Display shows unknown status... cleared." << endl;244 245 break; 245 246 } -
trunk/MagicSoft/Mars/mbase/MLog.cc
r2054 r2058 80 80 #include <pthread.h> 81 81 #endif 82 #include <TG ListBox.h>82 #include <TGTextView.h> 83 83 84 84 #include "MLogManip.h" … … 133 133 // which is used for the output (i) 134 134 // 135 MLog::MLog(int i) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(i), fIsNull(kFALSE), f GuiLineId(0), fout(NULL), fOutAllocated(kFALSE), fgui(NULL), fNumLines(0)135 MLog::MLog(int i) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(i), fIsNull(kFALSE), fout(NULL), fOutAllocated(kFALSE), fgui(NULL), fNumLines(0) 136 136 { 137 137 Init(); … … 143 143 // ofstream as the default output device 144 144 // 145 MLog::MLog(ofstream &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), f GuiLineId(0), fout(&out), fOutAllocated(kFALSE), fgui(NULL), fNumLines(0)145 MLog::MLog(ofstream &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fout(&out), fOutAllocated(kFALSE), fgui(NULL), fNumLines(0) 146 146 { 147 147 Init(); … … 151 151 // 152 152 // default constructor which initializes the streamer and sets the given 153 // TG ListBoxas the default output device154 // 155 MLog::MLog(TG ListBox &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eGui), fGuiLineId(0),fout(NULL), fOutAllocated(kFALSE), fgui(&out), fNumLines(0)153 // TGTextView as the default output device 154 // 155 MLog::MLog(TGTextView &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eGui), fout(NULL), fOutAllocated(kFALSE), fgui(&out), fNumLines(0) 156 156 { 157 157 Init(); … … 164 164 // or not. 165 165 // 166 MLog::MLog(const char *fname, int flag) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), f GuiLineId(0), fgui(NULL), fNumLines(0)166 MLog::MLog(const char *fname, int flag) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fgui(NULL), fNumLines(0) 167 167 { 168 168 Init(); … … 193 193 fDebugLevel = log.fDebugLevel; 194 194 fDevice = log.fDevice; 195 } 196 197 void MLog::Underline() 198 { 199 if (fDevice&eStdout) 200 cout << kUnderline; 201 202 if (fDevice&eStderr) 203 cerr << kUnderline; 195 204 } 196 205 … … 272 281 } 273 282 283 #include <TVirtualX.h> 274 284 void MLog::UpdateGui() 275 285 { … … 279 289 // lock mutex 280 290 Lock(); 291 292 TGText &txt=*fgui->GetText(); 281 293 282 294 // copy lines to TGListBox … … 285 297 // Replace all tabs by 7 white spaces 286 298 fGuiLines[i]->ReplaceAll("\t", " "); 287 fgui->AddEntry(*fGuiLines[i], fGuiLineId++);299 txt.InsText(TGLongPosition(0, txt.RowCount()), *fGuiLines[i]); 288 300 delete fGuiLines[i]; 289 301 } … … 292 304 fNumLines=0; 293 305 294 // cut list box top 1000 lines 295 fgui->RemoveEntries(0, fGuiLineId-1000); 306 // cut text box top 1000 lines 307 while (txt.RowCount()>1000) 308 txt.DelLine(0); 309 296 310 // show last entry 297 fgui->SetTopEntry(fGuiLineId-1); 311 fgui->Layout(); 312 fgui->SetVsbPosition(txt.RowCount()-1); 313 298 314 // tell a main loop, that list box contents have changed 299 315 fgui->SetBit(kHasChanged); -
trunk/MagicSoft/Mars/mbase/MLog.h
r2054 r2058 18 18 19 19 20 class TG ListBox;20 class TGTextView; 21 21 22 22 class MLog : public streambuf, public ostream, public TObject … … 54 54 Bool_t fIsNull; //! Switch output completely off 55 55 56 Int_t fGuiLineId; //! 57 58 ofstream *fout; //! possible file output stream 59 Bool_t fOutAllocated; //! flag if fout is created by MLogging 60 TGListBox *fgui; //! Listbox output 56 ofstream *fout; //! possible file output stream 57 Bool_t fOutAllocated; //! flag if fout is created by MLogging 58 TGTextView *fgui; //! Text View output 61 59 62 60 Bool_t fIsDirectGui; //! Pipe text directly to the GUI (for single threaded environments) … … 84 82 MLog(int i=eStdout); 85 83 MLog(ofstream &out); 86 MLog(TG ListBox&out);84 MLog(TGTextView &out); 87 85 MLog(const char *fname, int flag=-1); 88 86 … … 97 95 void UpdateGui(); 98 96 97 void Underline(); 98 99 99 void SetDebugLevel(int i) { fDebugLevel = i; } 100 100 int GetDebugLevel() const { return fDebugLevel; } … … 104 104 void DisableOutputDevice(Flags_t f) { fDevice &= ~f; } 105 105 void operator=(ofstream &out) { SetOutputFile(out); } 106 void operator=(TG ListBox *out){ SetOutputGui(out); }106 void operator=(TGTextView *out) { SetOutputGui(out); } 107 107 108 108 Bool_t IsOutputDeviceEnabled(int i) const { return fDevice & i; } 109 109 110 void SetOutputGui(TG ListBox*out, int flag=-1)110 void SetOutputGui(TGTextView *out, int flag=-1) 111 111 { 112 112 fgui = out;
Note:
See TracChangeset
for help on using the changeset viewer.