Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4GUI/TGo4HistogramInfoSlots.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "TGo4HistogramInfoSlots.h"
00017 
00018 #include <iostream.h>
00019 
00020 #include "Go4LockGuard/TGo4LockGuard.h"
00021 #include "Go4CommandsAnalysis/TGo4ComGetObject.h"
00022 #include "Go4CommandsAnalysis/TGo4ComGetObjectStatus.h"
00023 #include "Go4Analysis/TGo4AnalysisObjectManager.h"
00024 #include "Go4StatusAnalysis/TGo4HistogramStatus.h"
00025 #include "Go4GUIRegistry/TGo4GUIRegistry.h"
00026 #include "TGo4WindowEditSlots.h"
00027 #include "TGo4MainWindow.h"
00028 #include "TGo4PreviewPanel.h"
00029 #include "TGo4QRootCanvas.h"
00030 #include "TGo4HistogramInfoStatus.h"
00031 #include "TGo4HistogramInfo.h"
00032 
00033 TGo4HistogramInfoSlots::TGo4HistogramInfoSlots(const char * name, const char * title,  TGo4HistogramInfo * p)
00034    :TGo4SlotsBaseClass(name , title), fxTGo4HistogramInfo(p), fiCondArrayType(0)
00035    {
00036    TGo4LockGuard Global;
00037    char StatusName[64];
00038    fxTGo4GUIRegistry=TGo4GUIRegistry::Instance();
00039    snprintf(StatusName,63,"%s","HistogramInfoStatus" );
00040    fxTGo4HistogramInfoStatus= new TGo4HistogramInfoStatus(StatusName, "DynEntryStatus");
00041    fxTGo4GUIRegistry->RegisterSlotClass(this, fxTGo4HistogramInfoStatus, p);
00042 
00043 }
00044 void TGo4HistogramInfoSlots::AddObject(TNamed *fxData)
00045 {
00046    if(fxData==0) return;
00047 //   cout <<"TGo4HistogramInfoSlots got object "<< fxData << endl;
00048 //   cout <<"Name:"<<fxData->GetName() << endl;
00049    if  (fxData->InheritsFrom("TGo4HistogramStatus"))
00050       {
00051        // refresh the histogram information displayed
00052           TGo4HistogramStatus* hs=dynamic_cast<TGo4HistogramStatus*>(fxData);
00053           fxTGo4HistogramInfo->RefreshHistogramInfo(hs);
00054       }
00055    else if (fxData->InheritsFrom("TH1"))
00056       {
00057          // display histogram: we handle it here, because viewpanel
00058          // can not be target for redirection, we need object in membrowser!
00059          TGo4MainWindow* mw= (TGo4MainWindow*) fxTGo4GUIRegistry->GetMainWindow();
00060          TGo4PreviewPanel* viewpanel =mw->ViewPanelSlot(1);
00061          TQRootCanvas* can=viewpanel->GetQCanvas();
00062          TPad* pad=viewpanel->GetActivePad();
00063          TGo4SlotsBaseClass* membrowser= fxTGo4GUIRegistry->GetSlotClass("TGo4BrowserSlots");
00064          membrowser->AddObject(fxData,can,pad);
00065       }
00066    else
00067       {
00068          //cerr <<"ERROR in TGo4HistogramInfoSlots: AddObject got unknown type" << endl;
00069       }
00070 
00071 }
00072 
00073 void TGo4HistogramInfoSlots::SetGUI(TGo4HistogramInfo *GUI)
00074 {
00075    fxTGo4HistogramInfo=GUI;
00076 
00077 }
00078 void TGo4HistogramInfoSlots::StatusChanged(TGo4Status *status)
00079 {
00080    TGo4LockGuard Global;
00081 
00082 
00083 }
00084 TGo4HistogramInfoSlots::~TGo4HistogramInfoSlots()
00085 {
00086    TGo4LockGuard Global;
00087    delete fxTGo4HistogramInfoStatus;
00088 
00089 }
00090 
00091 TGo4Status * TGo4HistogramInfoSlots::GetStatus()
00092 {
00093    return fxTGo4HistogramInfoStatus;
00094 }
00095 
00096 
00097 
00098 
00099 void TGo4HistogramInfoSlots::SendHistogramInfoCommand()
00100 {
00101  // request for the histogram status to display it
00102   TGo4LockGuard main;
00103   const Text_t* histoname=fxTGo4HistogramInfo->GetHistogramName();
00104   TGo4ComGetObjectStatus *com = new TGo4ComGetObjectStatus(histoname);
00105   com->SetFolderName(TGo4AnalysisObjectManager::fgcHISTFOLDER);
00106   TString name=histoname;      // workaround for the case that
00107   name.Append("_status");      // histogram is in monitoring list
00108   fxTGo4GUIRegistry->SubmitCommand(com,name.Data(),this);
00109   // Method AddObject will handle histogram status when coming
00110 }
00111 
00112 
00113 void TGo4HistogramInfoSlots::SendHistogramPrintCommand()
00114 {
00115   TGo4LockGuard main;
00116   fxTGo4GUIRegistry->SubmitCommand("ANPrhis");
00117 }
00118 
00119 void TGo4HistogramInfoSlots::SendHistogramRequestCommand()
00120 {
00121    TGo4LockGuard main;
00122    const Text_t* histoname=fxTGo4HistogramInfo->GetHistogramName();
00123    TGo4ComGetObject *hcom = new TGo4ComGetObject(histoname);
00124    fxTGo4GUIRegistry->SubmitCommand(hcom,histoname,this);
00125 }
00126 
00127 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:00 2005 for Go4-v2.10-5 by doxygen1.2.15