AlcapDAQ  1
TOnlineFrame.h
Go to the documentation of this file.
1 #ifndef TONLINEFRAME_H_RBZGMWAC
2 #define TONLINEFRAME_H_RBZGMWAC
3 
4 #include "TApplication.h"
5 #include "TGButton.h"
6 #include "TRootEmbeddedCanvas.h"
7 #include "TGStatusBar.h"
8 #include "TCanvas.h"
9 #include "TROOT.h"
10 #include "TGTextEntry.h"
11 #include "TGLabel.h"
12 #include "TG3DLine.h"
13 #include "TGFileDialog.h"
14 #include "TMessage.h"
15 #include "TSocket.h"
16 #include "TObjArray.h"
17 #include <set>
18 #include <map>
19 
20 class TH1;
21 
22 class TOnlineFrame : public TGMainFrame
23 {
24 private:
25  TGHorizontalFrame *fTopFrame;
26  //TGHorizontalFrame *fScreenFrame;
27  TGButton *fUpdateButton;
28  TGButton *fPrintButton;
29  TGButton *fConnectButton;
30  TGButton *fFileOpenButton;
31  TRootEmbeddedCanvas *fEmbeddedCanvas;
32  TGCheckButton *fCycleDisplays;
33  TGCheckButton *fAutoUpdate;
34  TGTextEntry *fAutoUpdateTime;
35  TGTextEntry *fFileName;
37  TGStatusBar *fStatusBar;
38  TGTextEntry *fServerName;
39  TGTextEntry *fServerPort;
40  ULong_t run_nr;
41  TSocket *fpSock;
42 
43 public:
44  TOnlineFrame(const TGWindow * p,std::string module_file_name);
45  ~TOnlineFrame();
46 
47  void CloseWindow();
48  Bool_t ProcessMessage(Long_t msg, Long_t param1, Long_t param2);
49  void ConsiderCycling();
50  void ConsiderAutoupdate(const Bool_t force = kFALSE);
51  void runMacro(const char *macro);
52  void print_msg(const char *msg, const Int_t partidx = 0);
53  const char *getServerName() const;
54  void setServerName(const char *name);
55  const unsigned int getServerPort() const;
56  void setServerPort(const unsigned int port_nr);
57  const unsigned int getAutoUpdateTime() const;
58  TSocket *ConnectToServer();
59  TFile *OpenRootFile(const char *filename, const Bool_t update_filename = kTRUE );
60  TSocket *GetSocketHandle() {return fpSock;}
61  TH1* GetHist(const char * histname);
62  std::vector<TString> GetHistTitles();
63  //TH1 *GetHisto(TString histname) {return GetHisto(histname.Data());}
64  void UpdateDisplay();
65 
66  std::set<std::string> fLoadedMacros;
67  std::map<std::string, TGTextButton*> fButtons;
68 };
69 
70 struct screen_info
71 {
72  char visibleName[32];
73  std::string macroName;
74  std::string macroArgs;
75  bool hasArgs;
76 };
77 
78 
79 extern std::vector<screen_info> screens;
80 extern int width;
81 extern int height;
82 
83 #define B_UPDATE 1
84 #define B_AUTOUPDATE 2
85 #define B_CYCLE 3
86 #define B_PRINT 4
87 #define B_CONNECT 5
88 #define B_FILE_OPEN 6
89 #define SCREENS_BASE 10
90 
91 #define TE_ROOTFILE 1
92 
93 #endif /* end of include guard: TONLINEFRAME_H_RBZGMWAC */
94