00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
00044 fxTGo4ParaEditStatus->UpdateParameter(dynamic_cast<TGo4Parameter*>(fxData));
00045
00046 if(fxTGo4ParaEdit==0) {
00047
00048 fxTGo4ParaEdit= new TGo4ParaEdit(fxTGo4GUIRegistry->GetCentralWindow(),
00049 fxData->GetName());
00050 }
00051 fxTGo4ParaEdit->SetNewParaMode(false);
00052 fxTGo4ParaEdit->RefreshDisplay(fxTGo4ParaEditStatus);
00053
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
00099 com->SetParameter(dynamic_cast<TGo4Parameter*>(para->Clone()));
00100 fxTGo4GUIRegistry->SubmitCommand(com);
00101 }
00102
00103
00104