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

/Go4QtBaseWidgets/TGo4QConItem.cpp

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 "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           // normal operation: we use the settings on gui
00056           ishistogramlink=con->IsHistogramLink();
00057           hname=con->GetLinkedHistogram();
00058           //cout <<"Condition item gets pars from condition"<<hname << endl;
00059       }
00060    else
00061       {
00062           // this is for the first doubleclick when condition
00063           // was not yet on gui side:
00064           ishistogramlink=IsHistoLink();
00065           hname=GetHistogram();
00066           //cout <<"Condition item gets pars from self"<<hname << endl;
00067       }
00068    // test if condition has associated histo and request it
00069    if(ishistogramlink)
00070       {
00071           TGo4ComGetObject *hcom = new TGo4ComGetObject(hname);
00072           fxTGo4GUIRegistry->SubmitCommand(hcom,hname);
00073           //cout <<"Condition item requests linked histo"<<hname << endl;
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 //----------------------------END OF GO4 SOURCE FILE ---------------------

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