00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TGo4QConItem.h"
00017
00018 #include <iostream.h>
00019
00020 #include "TKey.h"
00021
00022 #include "Go4StatusAnalysis/TGo4ConditionStatus.h"
00023 #include "Go4CommandsAnalysis/TGo4ComGetObject.h"
00024 #include "Go4GUIRegistry/TGo4GUIRegistry.h"
00025 #include "Go4GUI/TGo4WindowEditSlots.h"
00026 #include "Go4GUI/TGo4WindowEditStatus.h"
00027
00028 TGo4QConItem::TGo4QConItem( QListViewItem* parent, const char* pixmap, const QString & text, const QString & text1, const QString & text2)
00029 :TGo4QItem (parent, pixmap, text, text1, text2)
00030 {
00031 }
00032
00033 TGo4QConItem::TGo4QConItem( QListView* parent, const char* pixmap, const QString & text, const QString & text1, const QString & text2)
00034 :TGo4QItem(parent, pixmap, text, text1, text2)
00035 {
00036 }
00037
00038 TGo4QConItem::~TGo4QConItem(){}
00039
00040 void TGo4QConItem::ItemDBkRemote()
00041 {
00042 char buffer[256];
00043 sprintf(buffer,"%s","");
00044 TGo4WindowEditSlots *WinCondEditor= GetEditor();
00045 TGo4Condition* con;
00046 const Text_t* hname;
00047 bool ishistogramlink;
00048 if(WinCondEditor)
00049 {
00050 TGo4WindowEditStatus* cstate= (TGo4WindowEditStatus*) WinCondEditor->GetStatus();
00051 con=cstate->GetCondition();
00052 }
00053 if(con)
00054 {
00055
00056 ishistogramlink=con->IsHistogramLink();
00057 hname=con->GetLinkedHistogram();
00058
00059 }
00060 else
00061 {
00062
00063
00064 ishistogramlink=IsHistoLink();
00065 hname=GetHistogram();
00066
00067 }
00068
00069 if(ishistogramlink)
00070 {
00071 TGo4ComGetObject *hcom = new TGo4ComGetObject(hname);
00072 fxTGo4GUIRegistry->SubmitCommand(hcom,hname);
00073
00074 }
00075 if(parent()!=0) snprintf(buffer,255,"%s/",parent()->text(0).data());
00076 strcat(buffer,text(0));
00077 TGo4ComGetObject* com = new TGo4ComGetObject(buffer);
00078 fxTGo4GUIRegistry->SubmitCommand(com, text(0).data(),WinCondEditor);
00079 }
00080
00081
00082 void TGo4QConItem::ItemDBkLocal()
00083 {
00084 TGo4WindowEditSlots *WinCondEditor= GetEditor();
00085 if(fxItemObject!=0){
00086 WinCondEditor->AddObject((TNamed *)fxItemObject);
00087 }else if(fxObj!=0){
00088 WinCondEditor->AddObject((TNamed *)fxObj);
00089 }else if(fxKey!=0){
00090 TObject *Obj=fxKey->ReadObj();
00091 WinCondEditor->AddObject((TNamed *)Obj);
00092 SetFileObj(Obj);
00093 }
00094 }
00095
00096 TGo4WindowEditSlots *TGo4QConItem::GetEditor()
00097 {
00098 char SlotName[256];
00099 snprintf(SlotName,255,"%s%s",text(0).data(),"_Slots" );
00100 TGo4WindowEditSlots *WinCondEditor= dynamic_cast <TGo4WindowEditSlots *>
00101 (fxTGo4GUIRegistry->GetSlotClass(SlotName));
00102 if(WinCondEditor==0){
00103 WinCondEditor = new TGo4WindowEditSlots(SlotName, "Condition Editor");
00104 }
00105 return WinCondEditor;
00106 }
00107
00108 void TGo4QConItem::SetStatus(TGo4Status* status) {
00109 TGo4ConditionStatus* condstatus = dynamic_cast<TGo4ConditionStatus*> (status);
00110 if (status) {
00111 SetHistoLink(condstatus->IsHistogram());
00112 SetHistogram(condstatus->GetHistogram());
00113 }
00114 }
00115
00116
00117