X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MONITOR%2FAliMonitorControl.cxx;h=1788dd4a5309fcb806af67f48966c8d0291bebe3;hb=e079adac340cd38db0b469fe7b10ca2452a11102;hp=a0d10e431391a46838037284d2a063ec6666a62c;hpb=19fa3b1b33facae6b75a1ec82ebee788737c2370;p=u%2Fmrichter%2FAliRoot.git diff --git a/MONITOR/AliMonitorControl.cxx b/MONITOR/AliMonitorControl.cxx index a0d10e43139..1788dd4a530 100644 --- a/MONITOR/AliMonitorControl.cxx +++ b/MONITOR/AliMonitorControl.cxx @@ -22,48 +22,42 @@ /////////////////////////////////////////////////////////////////////////////// +#include #include "AliMonitorControl.h" #include "AliMonitorHisto.h" -#include "AliMonitorDialog.h" +#include "AliLog.h" #include #include #include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "AliMonitorProcess.h" ClassImp(AliMonitorControl) -//_____________________________________________________________________________ -class AliMonitorBufferDlg : public AliMonitorDialog { - -public: - AliMonitorBufferDlg(Int_t& size, TGFrame* main); - virtual ~AliMonitorBufferDlg(); - - virtual void OnOkClicked(); - -private: - TGLayoutHints* fBufferLayout; - TGLabel* fBufferLabel; - TGNumberEntry* fBufferEntry; - - Int_t& fSize; -}; - //_____________________________________________________________________________ -AliMonitorBufferDlg::AliMonitorBufferDlg(Int_t& size, TGFrame* main) : - AliMonitorDialog(main, 250, 80), fSize(size) +AliMonitorControl::AliMonitorBufferDlg::AliMonitorBufferDlg(Int_t& size, + TGFrame* main) : + AliMonitorDialog(main, 250, 80), + fBufferLayout(new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2)), + fBufferLabel(new TGLabel(fFrame, "size of histogram buffer:")), + fBufferEntry(new TGNumberEntry(fFrame, size, 2, -1, + TGNumberFormat::kNESInteger)), + fSize(size) { // create a dialog for setting the size of the buffer for monitor histos - fBufferLayout = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2); - fBufferLabel = new TGLabel(fFrame, "size of histogram buffer:"); fFrame->AddFrame(fBufferLabel, fBufferLayout); - fBufferEntry = new TGNumberEntry(fFrame, size, 2, -1, - TGNumberFormat::kNESInteger); fBufferEntry->SetLimits(TGNumberFormat::kNELLimitMinMax, 1, 99); fFrame->AddFrame(fBufferEntry, fBufferLayout); @@ -76,7 +70,7 @@ AliMonitorBufferDlg::AliMonitorBufferDlg(Int_t& size, TGFrame* main) : } //_____________________________________________________________________________ -AliMonitorBufferDlg::~AliMonitorBufferDlg() +AliMonitorControl::AliMonitorBufferDlg::~AliMonitorBufferDlg() { // clean up @@ -86,28 +80,19 @@ AliMonitorBufferDlg::~AliMonitorBufferDlg() } //_____________________________________________________________________________ -void AliMonitorBufferDlg::OnOkClicked() +void AliMonitorControl::AliMonitorBufferDlg::OnOkClicked() { fSize = fBufferEntry->GetIntNumber(); } //_____________________________________________________________________________ -class AliMonitorClientsDlg : public AliMonitorDialog { - -public: - AliMonitorClientsDlg(TObjArray* clients, TGFrame* main); - virtual ~AliMonitorClientsDlg(); - -private: - TGLayoutHints* fClientsLayout; - TGTextView* fClients; -}; - - -//_____________________________________________________________________________ -AliMonitorClientsDlg::AliMonitorClientsDlg(TObjArray* clients, TGFrame* main) : - AliMonitorDialog(main, 450, 300, kFALSE) +AliMonitorControl::AliMonitorClientsDlg::AliMonitorClientsDlg(TObjArray* clients, + TGFrame* main) : + AliMonitorDialog(main, 450, 300, kFALSE), + fClientsLayout(new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, + 0, 0, 0, 0)), + fClients(new TGTextView(fFrame, 420, 230)) { // create a dialog to display the list of clients @@ -115,9 +100,6 @@ AliMonitorClientsDlg::AliMonitorClientsDlg(TObjArray* clients, TGFrame* main) : fFrameLayout = new TGLayoutHints(kLHintsCenterX | kLHintsTop, 10, 10, 15, 15); ((TGFrameElement*)(fMain->GetList()->First()))->fLayout = fFrameLayout; - fClientsLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, - 0, 0, 0, 0); - fClients = new TGTextView(fFrame, 420, 230); fFrame->AddFrame(fClients, fClientsLayout); char line[256]; @@ -144,7 +126,7 @@ AliMonitorClientsDlg::AliMonitorClientsDlg(TObjArray* clients, TGFrame* main) : } //_____________________________________________________________________________ -AliMonitorClientsDlg::~AliMonitorClientsDlg() +AliMonitorControl::AliMonitorClientsDlg::~AliMonitorClientsDlg() { // clean up @@ -161,11 +143,50 @@ enum {kMenuFileExit, kMenuFileAbort, //_____________________________________________________________________________ -AliMonitorControl::AliMonitorControl(AliMonitorProcess* process) +AliMonitorControl::AliMonitorControl(AliMonitorProcess* process): + TObject(), + fQObject(), + fMonitorProcess(process), + fColorStatus(0), + fColorStart(0), + fColorStop(0), + fMain(new TGMainFrame(gClient->GetRoot(), 380, 200)), + fMenuBarLayout(new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 1, 1)), + fMenuBarItemLayout(new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0)), + fMenuBarHelpLayout(new TGLayoutHints(kLHintsTop | kLHintsRight)), + fMenuFile(new TGPopupMenu(gClient->GetRoot())), + fMenuOptions(new TGPopupMenu(gClient->GetRoot())), + fMenuHelp(new TGPopupMenu(gClient->GetRoot())), + fMenuBar(new TGMenuBar(fMain, 1, 1, kHorizontalFrame)), + fFrameLayout(new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2)), + fFrame(new TGVerticalFrame(fMain, 0, 0, kChildFrame | kSunkenFrame)), + fStatusLayout(new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 10, 2, 2, 2)), + fStatusFrameLayout(new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 2, 2)), + fStatus1Frame(new TGHorizontalFrame(fFrame, 0, 0)), + fRunNumberLabel(new TGLabel(fStatus1Frame, "current run:")), + fRunNumber(new TGTextEntry(fStatus1Frame, "-")), + fEventNumberLabel(new TGLabel(fStatus1Frame," event:")), + fEventNumber(new TGTextEntry(fStatus1Frame, "-/-/-")), + fStatus2Frame(new TGHorizontalFrame(fFrame, 0, 0)), + fStatusLabel(new TGLabel(fStatus2Frame, "current status:")), + fStatus(new TGTextEntry(fStatus2Frame, "stopped")), + fStatus3Frame(new TGHorizontalFrame(fFrame, 0, 0)), + fEventsLabel(new TGLabel(fStatus3Frame, "monitored events:")), + fEvents(new TGTextEntry(fStatus3Frame, "-")), + fClientsLabel(new TGLabel(fStatus3Frame, " number of clients:")), + fClients(new TGTextEntry(fStatus3Frame, "-")), + fButtonFrameLayout(new TGLayoutHints(kLHintsExpandX | kLHintsBottom, 50, 50, 10, 10)), + fButtonFrame(new TGHorizontalFrame(fMain, 0, 0)), + fButtonLayout(new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 2, 2, 2, 2)), + fResetButton(new TGTextButton(fButtonFrame, " &Reset ", 1)), + fStartStopButton(new TGTextButton(fButtonFrame, " &Start ", 2)), + fStartButtonStatus(kTRUE), + fTerminating(kFALSE), + fTimer(new TTimer(this, 10, kTRUE)) + { // initialize the monitoring control window - fMonitorProcess = process; // colors @@ -173,35 +194,22 @@ AliMonitorControl::AliMonitorControl(AliMonitorProcess* process) gClient->GetColorByName("green", fColorStart); gClient->GetColorByName("red", fColorStop); - // main window - fMain = new TGMainFrame(gClient->GetRoot(), 380, 200); - - // menu bar - fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, - 0, 0, 1, 1); - fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0); - fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight); - - fMenuFile = new TGPopupMenu(gClient->GetRoot()); fMenuFile->AddEntry("E&xit", kMenuFileExit); fMenuFile->AddEntry("&Abort", kMenuFileAbort); fMenuFile->DisableEntry(kMenuFileAbort); fMenuFile->Connect("Activated(Int_t)", "AliMonitorControl", this, "HandleMenu(Int_t)"); - fMenuOptions = new TGPopupMenu(gClient->GetRoot()); fMenuOptions->AddEntry("&Histogram buffer...", kMenuOptBuffer); fMenuOptions->AddEntry("List of &Clients...", kMenuOptClients); fMenuOptions->Connect("Activated(Int_t)", "AliMonitorControl", this, "HandleMenu(Int_t)"); - fMenuHelp = new TGPopupMenu(gClient->GetRoot()); fMenuHelp->AddEntry("&Documentation...", kMenuHelpDoc); fMenuHelp->AddEntry("A&bout...", kMenuHelpAbout); fMenuHelp->Connect("Activated(Int_t)", "AliMonitorControl", this, "HandleMenu(Int_t)"); - fMenuBar = new TGMenuBar(fMain, 1, 1, kHorizontalFrame); fMenuBar->AddPopup("&File", fMenuFile, fMenuBarItemLayout); fMenuBar->AddPopup("&Options", fMenuOptions, fMenuBarItemLayout); fMenuBar->AddPopup("&Help", fMenuHelp, fMenuBarHelpLayout); @@ -210,32 +218,19 @@ AliMonitorControl::AliMonitorControl(AliMonitorProcess* process) // status frame - fFrameLayout = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, - 2, 2, 2, 2); - fFrame = new TGVerticalFrame(fMain, 0, 0, kChildFrame | kSunkenFrame); fMain->AddFrame(fFrame, fFrameLayout); - fStatusLayout = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 10, 2, 2, 2); - fStatusFrameLayout = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 2, 2); - - // run and event number - fStatus1Frame = new TGHorizontalFrame(fFrame, 0, 0); fFrame->AddFrame(fStatus1Frame, fStatusFrameLayout); - fRunNumberLabel = new TGLabel(fStatus1Frame, "current run:"); fStatus1Frame->AddFrame(fRunNumberLabel, fStatusLayout); - fRunNumber = new TGTextEntry(fStatus1Frame, "-"); fRunNumber->Resize(60, fRunNumber->GetDefaultHeight()); fRunNumber->SetAlignment(kTextRight); fRunNumber->SetEnabled(kFALSE); fRunNumber->SetBackgroundColor(fColorStatus); fStatus1Frame->AddFrame(fRunNumber, fStatusLayout); - fEventNumberLabel = new TGLabel(fStatus1Frame, - " event:"); fStatus1Frame->AddFrame(fEventNumberLabel, fStatusLayout); - fEventNumber = new TGTextEntry(fStatus1Frame, "-/-/-"); fEventNumber->Resize(100, fEventNumber->GetDefaultHeight()); fEventNumber->SetAlignment(kTextRight); fEventNumber->SetEnabled(kFALSE); @@ -244,12 +239,9 @@ AliMonitorControl::AliMonitorControl(AliMonitorProcess* process) // process status - fStatus2Frame = new TGHorizontalFrame(fFrame, 0, 0); fFrame->AddFrame(fStatus2Frame, fStatusFrameLayout); - fStatusLabel = new TGLabel(fStatus2Frame, "current status:"); fStatus2Frame->AddFrame(fStatusLabel, fStatusLayout); - fStatus = new TGTextEntry(fStatus2Frame, "stopped"); fStatus->Resize(250, fStatus->GetDefaultHeight()); fStatus->SetAlignment(kTextLeft); fStatus->SetEnabled(kFALSE); @@ -258,21 +250,16 @@ AliMonitorControl::AliMonitorControl(AliMonitorProcess* process) // process status - fStatus3Frame = new TGHorizontalFrame(fFrame, 0, 0); fFrame->AddFrame(fStatus3Frame, fStatusFrameLayout); - fEventsLabel = new TGLabel(fStatus3Frame, "monitored events:"); fStatus3Frame->AddFrame(fEventsLabel, fStatusLayout); - fEvents = new TGTextEntry(fStatus3Frame, "-"); fEvents->Resize(60, fEvents->GetDefaultHeight()); fEvents->SetAlignment(kTextRight); fEvents->SetEnabled(kFALSE); fEvents->SetBackgroundColor(fColorStatus); fStatus3Frame->AddFrame(fEvents, fStatusLayout); - fClientsLabel = new TGLabel(fStatus3Frame, " number of clients:"); fStatus3Frame->AddFrame(fClientsLabel, fStatusLayout); - fClients = new TGTextEntry(fStatus3Frame, "-"); fClients->Resize(40, fClients->GetDefaultHeight()); fClients->SetAlignment(kTextRight); fClients->SetEnabled(kFALSE); @@ -281,23 +268,15 @@ AliMonitorControl::AliMonitorControl(AliMonitorProcess* process) // buttons - fButtonFrameLayout = new TGLayoutHints(kLHintsExpandX | kLHintsBottom, - 50, 50, 10, 10); - fButtonFrame = new TGHorizontalFrame(fMain, 0, 0); fMain->AddFrame(fButtonFrame, fButtonFrameLayout); - fButtonLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, - 2, 2, 2, 2); - fResetButton = new TGTextButton(fButtonFrame, " &Reset ", 1); fResetButton->Connect("Clicked()", "AliMonitorControl", this, "DoReset()"); fButtonFrame->AddFrame(fResetButton, fButtonLayout); - fStartStopButton = new TGTextButton(fButtonFrame, " &Start ", 2); fStartStopButton->SetBackgroundColor(0x00FF00); fStartStopButton->Connect("Clicked()", "AliMonitorControl", this, "DoStartStop()"); fButtonFrame->AddFrame(fStartStopButton, fButtonLayout); - fStartButtonStatus = kTRUE; // main window @@ -312,9 +291,6 @@ AliMonitorControl::AliMonitorControl(AliMonitorProcess* process) fMain->MapWindow(); - fTerminating = kFALSE; - - fTimer = new TTimer(this, 10, kTRUE); fTimer->TurnOn(); } @@ -376,7 +352,10 @@ void AliMonitorControl::HandleMenu(Int_t id) kMBIconQuestion, kMBYes | kMBNo, &result); if (result == kMBYes) { fMenuFile->EnableEntry(kMenuFileAbort); - if (fMonitorProcess->IsStopped()) exit(0); + if (fMonitorProcess->IsStopped()) { + delete fMonitorProcess; + gApplication->Terminate(0); + } fMonitorProcess->Stop(); fTerminating = kTRUE; } @@ -463,7 +442,10 @@ Bool_t AliMonitorControl::HandleTimer(TTimer* timer) // update the displayed information timer->TurnOff(); - if (fTerminating && fMonitorProcess->IsStopped()) exit(0); + if (fTerminating && fMonitorProcess->IsStopped()) { + delete fMonitorProcess; + gApplication->Terminate(0); + } UpdateStatus(); gSystem->ProcessEvents(); timer->TurnOn();