00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
00048
00049 if(fxData->InheritsFrom("TGo4DynamicEntryStatus"))
00050 {
00051
00052
00053 fxTGo4EditDynEntryStatus->UpdateEntry(dynamic_cast<TGo4DynamicEntryStatus*>(fxData));
00054 }
00055 else if(fxData->InheritsFrom("TGo4DynamicEntry"))
00056 {
00057
00058 TGo4DynamicEntry* entry=dynamic_cast<TGo4DynamicEntry*>(fxData);
00059 TGo4DynamicEntryStatus* state=entry->CreateStatus();
00060 fxTGo4EditDynEntryStatus->UpdateEntry(state);
00061 delete state;
00062 }
00063 else
00064 {
00065
00066 return;
00067 }
00068
00069 if(fxTGo4EditDynEntry==0)
00070 {
00071
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
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
00159
00160 TGo4Condition* condi;
00161 TClass* nclass=gROOT->GetClass(classname);
00162 if(nclass && nclass->InheritsFrom("TGo4Condition"))
00163 {
00164 condi= (TGo4Condition*) nclass->New();
00165
00166 condi->SetName(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
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