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

/Go4GUI/TGo4EditDynEntrySlots.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 "TGo4EditDynEntrySlots.h"
00017 
00018 #include <iostream.h>
00019 
00020 #include "Go4LockGuard/TGo4LockGuard.h"
00021 #include "Go4GUIRegistry/TGo4GUIRegistry.h"
00022 #include "Go4CommandsAnalysis/TGo4ComSetDynamicEntry.h"
00023 #include "Go4CommandsAnalysis/TGo4ComGetDynamicEntryStatus.h"
00024 #include "Go4CommandsAnalysis/TGo4ComClearObject.h"
00025 #include "Go4StatusAnalysis/TGo4HistogramStatus.h"
00026 #include "Go4CommandsAnalysis/TGo4ComSetCondition.h"
00027 #include "Go4ConditionsBase/TGo4Condition.h"
00028 #include "Go4CommandsTaskHandler/TGo4ComExecLine.h"
00029 #include "TGo4WindowEditSlots.h"
00030 #include "TGo4EditDynEntryStatus.h"
00031 #include "TGo4EditDynEntry.h"
00032 
00033 TGo4EditDynEntrySlots::TGo4EditDynEntrySlots(const char * name, const char * title,  TGo4EditDynEntry * p)
00034    :TGo4SlotsBaseClass(name , title), fxTGo4EditDynEntry(p), fiCondArrayType(0)
00035    {
00036    TGo4LockGuard Global;
00037    char StatusName[256];
00038    fxTGo4GUIRegistry=TGo4GUIRegistry::Instance();
00039    snprintf(StatusName,255,"%s%s",name,"_Status" );
00040    fxTGo4EditDynEntryStatus= new TGo4EditDynEntryStatus(StatusName, "DynEntryStatus");
00041    fxTGo4GUIRegistry->RegisterSlotClass(this, fxTGo4EditDynEntryStatus, p);
00042 
00043 }
00044 void TGo4EditDynEntrySlots::AddObject(TNamed *fxData)
00045 {
00046    if(fxData==0) return;
00047 //   cout <<"TGo4EditDynEntrySlots got object "<< fxData << endl;
00048 //   cout <<"Name:"<<fxData->GetName() << endl;
00049    if(fxData->InheritsFrom("TGo4DynamicEntryStatus"))
00050       {
00051          // case with information from analysis:
00052          // refresh the entry status
00053          fxTGo4EditDynEntryStatus->UpdateEntry(dynamic_cast<TGo4DynamicEntryStatus*>(fxData));
00054       }
00055    else if(fxData->InheritsFrom("TGo4DynamicEntry"))
00056       {
00057          // case of object from file:
00058          TGo4DynamicEntry* entry=dynamic_cast<TGo4DynamicEntry*>(fxData);
00059          TGo4DynamicEntryStatus* state=entry->CreateStatus();
00060          fxTGo4EditDynEntryStatus->UpdateEntry(state);
00061          delete state;
00062       }
00063    else
00064       {
00065          //cerr <<"ERROR in TGo4EditDynEntrySlots: AddObject got unknown type" << endl;
00066          return;
00067       }
00068 // create gui if not exisiting
00069 if(fxTGo4EditDynEntry==0)
00070    {
00071    //cout <<"Slots creating new EditDynEntry" << endl;
00072    fxTGo4EditDynEntry= new TGo4EditDynEntry(fxTGo4GUIRegistry->GetCentralWindow(),
00073                                   fxData->GetName());
00074 
00075    } else{   }
00076 fxTGo4EditDynEntry->SetEntryEdit(false);
00077 fxTGo4EditDynEntry->RefreshDisplay(fxTGo4EditDynEntryStatus);
00078 fxTGo4EditDynEntry->SetPleaseUpdate(false);
00079 }
00080 
00081 void TGo4EditDynEntrySlots::SetGUI(TGo4EditDynEntry *GUI)
00082 {
00083    fxTGo4EditDynEntry=GUI;
00084 
00085 }
00086 void TGo4EditDynEntrySlots::StatusChanged(TGo4Status *status)
00087 {
00088    TGo4LockGuard Global;
00089 
00090 
00091 }
00092 TGo4EditDynEntrySlots::~TGo4EditDynEntrySlots()
00093 {
00094    TGo4LockGuard Global;
00095    delete fxTGo4EditDynEntryStatus;
00096 
00097 }
00098 
00099 TGo4Status * TGo4EditDynEntrySlots::GetStatus()
00100 {
00101    return fxTGo4EditDynEntryStatus;
00102 }
00103 
00104 
00105 void TGo4EditDynEntrySlots::SendRefreshCommand()
00106 {
00107    TGo4LockGuard main;
00108    TGo4DynamicEntryStatus* state=fxTGo4EditDynEntryStatus->GetEntryStatus();
00109    if(state==0) return;
00110    const Text_t* entryname=state->GetName();
00111    TGo4ComGetDynamicEntryStatus* com = new TGo4ComGetDynamicEntryStatus(entryname);
00112    fxTGo4GUIRegistry->SubmitCommand(com, entryname, this);
00113 }
00114 
00115 void TGo4EditDynEntrySlots::SendApplyCommand()
00116 {
00117   TGo4LockGuard main;
00118   TGo4DynamicEntryStatus* state=fxTGo4EditDynEntryStatus->GetEntryStatus();
00119   if(state==0) return;
00120   const Text_t* entryname=state->GetName();
00121   TGo4ComSetDynamicEntry* com = new TGo4ComSetDynamicEntry(entryname);
00122   // status object is owned by command, we have to clone our settings:
00123   com->SetEntryStatus(dynamic_cast<TGo4DynamicEntryStatus*>(state->Clone()));
00124   fxTGo4GUIRegistry->SubmitCommand(com);
00125 }
00126 
00127 
00128 void TGo4EditDynEntrySlots::SendHistogramClearCommand()
00129 {
00130   TGo4LockGuard main;
00131   TGo4DynamicEntryStatus* state=fxTGo4EditDynEntryStatus->GetEntryStatus();
00132   if(state==0) return;
00133   const Text_t* histoname=state->GetHistogramName();
00134   TGo4ComClearObject *com = new TGo4ComClearObject(histoname);
00135   fxTGo4GUIRegistry->SubmitCommand(com);
00136 }
00137 
00138 
00139 void TGo4EditDynEntrySlots::SendHistogramPrintCommand()
00140 {
00141   TGo4LockGuard main;
00142   fxTGo4GUIRegistry->SubmitCommand("ANPrhis");
00143 }
00144 
00145 void TGo4EditDynEntrySlots::SendDynListPrintCommand()
00146 {
00147   TGo4LockGuard main;
00148   fxTGo4GUIRegistry->SubmitCommand("ANPrdyn");
00149 }
00150 
00151 void TGo4EditDynEntrySlots::SendNewConditionCommand(
00152                            const Text_t* name,
00153                            const Text_t* classname)
00154 {
00155 
00156  if(name=="") return;
00157  TGo4LockGuard main;
00158  //if(strstr(name,"/")) return; // disable subfolder creation
00159  //cout <<"new condition for "<<name <<",class "<<classname << endl;
00160  TGo4Condition* condi;
00161  TClass* nclass=gROOT->GetClass(classname);
00162  if(nclass && nclass->InheritsFrom("TGo4Condition"))
00163     {
00164        condi= (TGo4Condition*) nclass->New();
00165        //cout <<"created condition object of class "<<classname << endl;
00166        condi->SetName(name); // preserve old parameter name
00167        TGo4ComSetCondition *com = new TGo4ComSetCondition(name);
00168        com->SetCondition(condi);
00169        fxTGo4GUIRegistry->SubmitCommand(com, name, 0);
00170        delete condi;
00171     }
00172  else
00173    {
00174       //cout <<"Could not set condition to class "<< name << endl;
00175    }
00176 }
00177 
00178 void TGo4EditDynEntrySlots::SendResetBackStoreCommand()
00179 {
00180   TGo4ComExecLine *com = new TGo4ComExecLine("@ResetBackStores();");
00181   fxTGo4GUIRegistry->SubmitCommand(com);
00182 }
00183 
00184 void TGo4EditDynEntrySlots::SendSetDynListIntervalCommand(Int_t value)
00185 {
00186   if(value<1) return;
00187   Text_t buf[256];
00188   snprintf(buf,256,"@SetDynListInterval(%d);",value);
00189   TGo4ComExecLine *com = new TGo4ComExecLine(buf);
00190   fxTGo4GUIRegistry->SubmitCommand(com);
00191 }
00192 
00193 
00194 //----------------------------END OF GO4 SOURCE FILE ---------------------

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