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

/Go4GUI/TGo4ParaEditSlots.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 "TGo4ParaEditSlots.h"
00017 
00018 #include <iostream.h>
00019 
00020 #include "Go4LockGuard/TGo4LockGuard.h"
00021 #include "Go4GUIRegistry/TGo4GUIRegistry.h"
00022 #include "Go4CommandsAnalysis/TGo4ComGetParameter.h"
00023 #include "Go4CommandsAnalysis/TGo4ComSetParameter.h"
00024 #include "Go4StatusBase/TGo4Parameter.h"
00025 #include "TGo4ParaEditStatus.h"
00026 #include "TGo4ParaEdit.h"
00027 
00028 TGo4ParaEditSlots::TGo4ParaEditSlots(const char * name, const char * title,  TGo4ParaEdit * p)
00029                        :TGo4SlotsBaseClass(name , title), fxTGo4ParaEdit(p)
00030 {
00031    TGo4LockGuard Global;
00032       char StatusName[256];
00033     fxTGo4GUIRegistry=TGo4GUIRegistry::Instance();
00034       snprintf(StatusName,255,"%s%s",name,"_Status" );
00035    fxTGo4ParaEditStatus= new TGo4ParaEditStatus(StatusName, "DynEntryStatus");
00036    fxTGo4GUIRegistry->RegisterSlotClass(this, fxTGo4ParaEditStatus, p);
00037 
00038 }
00039 void TGo4ParaEditSlots::AddObject(TNamed *fxData)
00040 {
00041   if(fxData==0) return;
00042   if(fxData->InheritsFrom("TGo4Parameter")) {
00043      // refresh the entry status
00044      fxTGo4ParaEditStatus->UpdateParameter(dynamic_cast<TGo4Parameter*>(fxData));
00045      // create gui if not exisiting
00046      if(fxTGo4ParaEdit==0) {
00047         //cout <<"Slots creating new EditDynEntry" << endl;
00048         fxTGo4ParaEdit= new TGo4ParaEdit(fxTGo4GUIRegistry->GetCentralWindow(),
00049                                          fxData->GetName());
00050       }
00051       fxTGo4ParaEdit->SetNewParaMode(false);
00052       fxTGo4ParaEdit->RefreshDisplay(fxTGo4ParaEditStatus);
00053       //fxTGo4ParaEdit->StatusMessage("Refreshed values from analysis.");
00054    } else
00055      cerr <<"ERROR in TGo4ParaEditSlots: AddObject got unknown type" << endl;
00056 }
00057 
00058 void TGo4ParaEditSlots::SetGUI(TGo4ParaEdit *GUI)
00059 {
00060    fxTGo4ParaEdit = GUI;
00061 
00062 }
00063 void TGo4ParaEditSlots::StatusChanged(TGo4Status *status)
00064 {
00065    TGo4LockGuard Global;
00066 }
00067 
00068 TGo4ParaEditSlots::~TGo4ParaEditSlots()
00069 {
00070    TGo4LockGuard Global;
00071    delete fxTGo4ParaEditStatus;
00072 }
00073 
00074 TGo4Status * TGo4ParaEditSlots::GetStatus()
00075 {
00076    return fxTGo4ParaEditStatus;
00077 }
00078 
00079 void TGo4ParaEditSlots::SendRefreshCommand()
00080 {
00081    TGo4LockGuard main;
00082    TGo4Parameter* para=fxTGo4ParaEditStatus->GetParameter();
00083    if(para==0) return;
00084    const Text_t* paraname=para->GetName();
00085    if(paraname==0 || !strcmp(paraname,"")) return;
00086    TGo4ComGetParameter* com = new TGo4ComGetParameter(paraname);
00087    fxTGo4GUIRegistry->SubmitCommand(com, paraname, this);
00088 }
00089 
00090 void TGo4ParaEditSlots::SendApplyCommand()
00091 {
00092   TGo4LockGuard main;
00093   TGo4Parameter* para=fxTGo4ParaEditStatus->GetParameter();
00094   if(para==0) return;
00095   const Text_t* paraname=para->GetName();
00096   if(paraname==0 || !strcmp(paraname,"")) return;
00097   TGo4ComSetParameter* com = new TGo4ComSetParameter(paraname);
00098   // status object is owned by command, we have to clone our settings:
00099   com->SetParameter(dynamic_cast<TGo4Parameter*>(para->Clone()));
00100   fxTGo4GUIRegistry->SubmitCommand(com);
00101 }
00102 
00103 
00104 //----------------------------END OF GO4 SOURCE FILE ---------------------

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