00001
00002
00003
00004 #ifndef FROOT_TFndSCCgui
00005 #define FROOT_TFndSCCgui
00006
00007 #ifndef ROOT_TGMenu
00008 #include "TGMenu.h"
00009 #endif
00010 #ifndef ROOT_TGButtonGroup
00011 #include "TGButtonGroup.h"
00012 #endif
00013 #ifndef ROOT_TGCanvas
00014 #include "TGCanvas.h"
00015 #endif
00016 #ifndef ROOT_TRootCanvas
00017 #include "TRootCanvas.h"
00018 #endif
00019 #ifndef ROOT_TRootGuiBuilder
00020 #include "TRootGuiBuilder.h"
00021 #endif
00022 #ifndef ROOT_TGDockableFrame
00023 #include "TGDockableFrame.h"
00024 #endif
00025 #ifndef ROOT_TGToolBar
00026 #include "TGToolBar.h"
00027 #endif
00028 #ifndef ROOT_TGButton
00029 #include "TGButton.h"
00030 #endif
00031 #ifndef ROOT_TGToolTip
00032 #include "TGToolTip.h"
00033 #endif
00034 #ifndef ROOT_TGuiBldDragManager
00035 #include "TGuiBldDragManager.h"
00036 #endif
00037 #ifndef ROOT_TGMdiMainFrame
00038 #include "TGMdiMainFrame.h"
00039 #endif
00040 #ifndef ROOT_TGLabel
00041 #include "TGLabel.h"
00042 #endif
00043 #ifndef ROOT_TG3DLine
00044 #include "TG3DLine.h"
00045 #endif
00046 #ifndef ROOT_TGNumberEntry
00047 #include "TGNumberEntry.h"
00048 #endif
00049 #ifndef ROOT_TGuiBldHintsButton
00050 #include "TGuiBldHintsButton.h"
00051 #endif
00052 #ifndef ROOT_TGuiBldHintsEditor
00053 #include "TGuiBldHintsEditor.h"
00054 #endif
00055 #ifndef ROOT_TGuiBldEditor
00056 #include "TGuiBldEditor.h"
00057 #endif
00058 #ifndef ROOT_TGShutter
00059 #include "TGShutter.h"
00060 #endif
00061 #ifndef ROOT_TGStatusBar
00062 #include "TGStatusBar.h"
00063 #endif
00064 #ifndef ROOT_TGTab
00065 #include "TGTab.h"
00066 #endif
00067 #ifndef ROOT_TGSplitter
00068 #include "TGSplitter.h"
00069 #endif
00070 #ifndef ROOT_TGMdiMenu
00071 #include "TGMdiMenu.h"
00072 #endif
00073 #ifndef ROOT_TGListBox
00074 #include "TGListBox.h"
00075 #endif
00076 #ifndef ROOT_TGListView
00077 #include "TGListView.h"
00078 #endif
00079 #ifndef ROOT_TGFSContainer
00080 #include "TGFSContainer.h"
00081 #endif
00082 #ifndef ROOT_TGFSComboBox
00083 #include "TGFSComboBox.h"
00084 #endif
00085 #ifndef ROOT_TGFileDialog
00086 #include "TGFileDialog.h"
00087 #endif
00088 #ifndef ROOT_TGScrollBar
00089 #include "TGScrollBar.h"
00090 #endif
00091 #ifndef ROOT_TGMdiDecorFrame
00092 #include "TGMdiDecorFrame.h"
00093 #endif
00094 #ifndef ROOT_TGMdiFrame
00095 #include "TGMdiFrame.h"
00096 #endif
00097 #ifndef ROOT_TRootEmbeddedCanvas
00098 #include "TRootEmbeddedCanvas.h"
00099 #endif
00100 #ifndef ROOT_TCanvas
00101 #include "TCanvas.h"
00102 #endif
00103
00104 #include "TColor.h"
00105
00106
00110 #include "TRegexp.h"
00111 #include "TApplication.h"
00112 #include "TTimer.h"
00113 #include "TThread.h"
00114 #include "FROOT.h"
00115 #include "Scc.h"
00116 #include "Gui.h"
00117
00118 #include "TFndSCCMan.h"
00119
00120 using namespace FROOT;
00121 using namespace Scc;
00122
00123 #define SCC_SUMMARY_NUM 5
00124 #define SCC_PICTURES 10
00125
00126 class TFndSCCgui: public TFndSCCMan {
00127
00128 enum CanReceive_e {k_CanReceive = 0, k_WaitReceive, k_DontReceive};
00129
00130 public:
00131 enum Scc_Msg_Reset_e {
00132 SCC_MSG_RESET_NORM = 0,
00133 SCC_MSG_RESET_ALL = 1,
00134 };
00135
00136 private:
00137 Int_t fCanReceive;
00138
00139 TTimer *fTimer;
00140
00141 TString fFontType;
00142 UInt_t fFontSize;
00143 TString fFontISO;
00144 TString fFontString;
00145
00146 TGMainFrame *fMainFrame;
00147 TGLabel *fLblTitle;
00148 TGCompositeFrame *fCompFrame;
00149
00150 TGGroupFrame *fGrpFrm[K_N_SLOWS];
00151
00152
00153 TGTextEntry *fTxtSockMsg[K_N_SLOWS];
00154 TGStatusBar *fStatusReceiveRun[K_N_SLOWS];
00155
00156 TGTextEntry *fTxtDateMsg[K_N_SLOWS];
00157 TGTextEntry *fTxtTimeMsg[K_N_SLOWS];
00158 TGTextEntry *fTxtMsg[K_N_SLOWS];
00159
00160 TGLabel *fLblEvtSize[K_N_SLOWS];
00161 TGTextEntry *fTxtEvtSize[K_N_SLOWS];
00162
00163 TGTextButton *fButPrintInfo[K_N_SLOWS];
00164 TGStatusBar *fStatusReceiveMsg[K_N_SLOWS];
00165
00166
00167 TGLabel *fLmdMixLbl;
00168 TGTextEntry *fLmdMixture;
00169
00170 TGLabel *fStbMixLbl;
00171 TGTextEntry *fStbMixture;
00172
00173 TGLabel *fGasSecurLbl[K_N_SECUR_SWITCHES];
00174 TGTextEntry *fGasSecurInd[K_N_SECUR_SWITCHES];
00175
00176
00177 TGGroupFrame *fGrpFrmRcvCntrl;
00178 TGGroupFrame *fGrpFrmSCC2DAQ;
00179 TGPictureButton *fPictBut;
00180
00181 const TGPicture *fPictureList[SCC_PICTURES];
00182 Int_t fCurPicture;
00183
00184 TGTextButton *fQuitBut;
00185
00186 TGTextButton *fButSCCRunReceiver[K_N_SLOWS+1];
00187 TGTextButton *fButStartAllRcv;
00188 TGTextButton *fButStopAllRcv;
00189
00190 TGLabel *fLblSCCLastEvts;
00191 TGLabel *fLblSCCDateLastEvts;
00192 TGLabel *fLblSCCTimeLastEvts;
00193 TGLabel *fLblSCCBytesLastEvts;
00194
00195 TGTextEntry *fTxtSCC_LastDate[SCC_SUMMARY_NUM];
00196 TGTextEntry *fTxtSCC_LastTime[SCC_SUMMARY_NUM];
00197 TGTextEntry *fTxtSCC_LastBytes[SCC_SUMMARY_NUM];
00198
00199 Bool_t fLastErrorSolved[K_N_SLOWS];
00200
00201
00202 TGTextButton *fButPrintAllInfo;
00203 TGStatusBar *fStatusSCC2DAQ;
00204
00205
00206
00207
00208
00209
00210 protected:
00211 TString fLastError[K_N_SLOWS];
00212 TString fVocalErrorMessage[K_N_SLOWS];
00213
00214
00215
00216 private:
00217 void DisableTxtEntry(TGTextEntry *txt_entry);
00218 void RedrawTextEntry(TGTextEntry *txt_entry);
00219 void ModifyTextEntry(TGTextEntry *txt_entry,const Char_t *text,Pixel_t bck_col=TColor::RGB2Pixel(255,255,255),Pixel_t frg_col=TColor::RGB2Pixel(1,1,1));
00220 void SetCanReceiveFlag(Int_t can_emit);
00221
00222 virtual void BuildSingleSlwFrame(Int_t slow_id);
00223 virtual void AdjustSingleSlwFrame(Int_t slow_id);
00224 virtual void Relax(Bool_t more=kFALSE);
00225
00226 public:
00227 TFndSCCgui();
00228 virtual ~TFndSCCgui();
00229 void CloseWindow();
00230
00231 void ResetMessages(Int_t slow_det, TString default_msg="",Scc_Msg_Reset_e reset_mode = SCC_MSG_RESET_NORM);
00232 void ResetMessages(TString default_msg="",Scc_Msg_Reset_e reset_mode = SCC_MSG_RESET_NORM);
00233
00234 void BuildGUI();
00235 void MapGUI();
00236
00237 void MakeConnections(Bool_t ConnectDisconnect = kTRUE);
00238
00239 void SetFontType(TString ftype);
00240 void SetFontSize(Float_t fsize);
00241 void ChangePicture();
00242 void ReceivedEvent(Int_t slow_det,Int_t part);
00243 void SocketError(Int_t slow_det);
00244
00245 void EnableConnections(Bool_t enabled);
00246
00247
00248 void StartStopTofi() { StartStopSlowReceiver(TOFI); }
00249 void StartStopTofo() { StartStopSlowReceiver(TOFO); }
00250 void StartStopLMD() { StartStopSlowReceiver(LMD); }
00251 void StartStopSTB() { StartStopSlowReceiver(STB); }
00252 void StartStopGAS() { StartStopSlowReceiver(GAS); }
00253 void StartStopSIL() { StartStopSlowReceiver(SIL); }
00254 void StartStopMAG() { StartStopSlowReceiver(MAG); }
00255 void StartStopLowVolt() { TThread::Printf("TFndSCCgui::StartStopLowVolt called"); }
00256
00257 void StartAllReceivers()
00258 {
00259
00260 for(Int_t i=0;i<=SIL;i++){
00261 if(IsReceiveThreadRunning(i) != TThread::kRunningState) StartStopSlowReceiver(i);
00262
00263 }
00264 }
00265 void StopAllReceivers()
00266 {
00267
00268 for(Int_t i=0;i<K_N_SLOWS;i++){
00269 if(IsReceiveThreadRunning(i) == TThread::kRunningState) StartStopSlowReceiver(i);
00270
00271 }
00272 }
00273
00274 Int_t PrintAllInfoFromGUI() { return PrintAllInfo(kTRUE); }
00275 void PrintInfoTofi() { PrintSlowDetInfo(TOFI, kTRUE); }
00276 void PrintInfoTofo() { PrintSlowDetInfo(TOFO, kTRUE); }
00277 void PrintInfoLMD() { PrintSlowDetInfo(LMD, kTRUE); }
00278 void PrintInfoSTB() { PrintSlowDetInfo(STB, kTRUE); }
00279 void PrintInfoGAS() { PrintSlowDetInfo(GAS, kTRUE); }
00280 void PrintInfoSIL() { PrintSlowDetInfo(SIL, kTRUE); }
00281 void PrintInfoMAG() { PrintSlowDetInfo(MAG, kTRUE); }
00282
00283 void StartStopSlowReceiver(Int_t slow_det);
00284
00285
00286
00287 void ScheduledOperationPerformed(E_SCC_MAN_GuiComm_t oper,Bool_t UpdateTime = kFALSE);
00288
00289
00290 void MethodTest() {
00291 TThread::Printf("Current state: %d",fMainFrame->IsActive());
00292 TThread::Printf("NumberOfSignals: %d",fMainFrame->NumberOfSignals());
00293 SocketError(TOFI);
00294 }
00295
00296 ClassDef(TFndSCCgui,0)
00297 };
00298 #endif // FROOT_TFndSCCgui