]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MONITOR/AliMonitorClient.h
Coding conventions (Annalisa)
[u/mrichter/AliRoot.git] / MONITOR / AliMonitorClient.h
1 #ifndef ALIMONITORCLIENT_H
2 #define ALIMONITORCLIENT_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 #include <TGFrame.h>
9 #include <RQ_OBJECT.h>
10 #include "AliMonitorDialog.h"
11
12 class TGListTreeItem;
13 class TGLayoutHints;
14 class TGPopupMenu;
15 class TGMenuBar;
16 class TGHorizontal3DLine;
17 class TGToolBar;
18 class TGNumberEntry;
19 class TGPicture;
20 class TGButton;
21 class TGCanvas;
22 class TGListTree;
23 class TGVSplitter;
24 class TGHSplitter;
25 class TRootEmbeddedCanvas;
26 class TGTextView;
27 class TGLabel;
28 class TGTextEntry;
29 class TSocket;
30 class TFileHandler;
31 class TFolder;
32 class TTimer;
33 class AliMonitorHisto;
34
35
36 class AliMonitorClient : public TGMainFrame {
37
38 RQ_OBJECT("AliMonitorClient")
39
40 public:
41   AliMonitorClient();
42   AliMonitorClient(const AliMonitorClient& client);
43   AliMonitorClient& operator = (const AliMonitorClient& client);
44   virtual ~AliMonitorClient();
45
46   void               CloseWindow();
47
48   void               OnNewData();
49
50   void               OnMenuActivated(Int_t id);
51
52   void               OnEventNumberChanged();
53   void               OnEventButtonPressed();
54   void               OnSumButtonPressed();
55   void               OnRunButtonPressed();
56   void               OnLoopButtonClicked();
57   void               OnPreviousButtonClicked();
58   void               OnNextButtonClicked();
59   void               OnCopyButtonClicked();
60   void               OnSaveButtonClicked();
61   void               OnPrintButtonClicked();
62
63   void               OnTreeClicked(TGListTreeItem* item, Int_t btn);
64   void               OnTreeReturnPressed(TGListTreeItem* item);
65
66   void               OnLoopTimer();
67
68 private:
69   TFolder*           CreateTopFolder() const;
70   AliMonitorHisto*   GetHisto(const char* folderName, const char* histoName);
71   TGListTreeItem*    GetItem(TGListTreeItem* base, const char* folderName, 
72                              const char* histoName, Bool_t create);
73
74   Bool_t             ConnectToServer();
75   void               DisconnectFromServer();
76   Bool_t             OpenFile();
77
78   void               ViewToolBar(Bool_t visible);
79   void               ViewTree(Bool_t visible);
80   void               ViewDescription(Bool_t visible);
81   void               ViewReference(Bool_t visible);
82   void               ViewStatistics(Bool_t visible);
83
84   Bool_t             AddFavorite();
85   Bool_t             DeleteFavorite();
86   Bool_t             LoadFavorites(Bool_t dialog = kTRUE);
87   Bool_t             SaveFavorites();
88   Bool_t             SaveFavoritesAs();
89
90   Bool_t             LoadReference(Bool_t dialog = kTRUE);
91   void               SetReference();
92   Bool_t             TakeCurrentReference();
93   void               TakeReferenceHisto(const char* folderName,
94                                         AliMonitorHisto* histo);
95   void               TakeReferenceFolder(TGListTreeItem* item);
96   Bool_t             SaveReference();
97   Bool_t             SaveReferenceAs();
98
99   void               LoadSettings();
100   void               SaveSettings();
101
102   void               StopLoop();
103   Bool_t             GetBaseItem();
104   Bool_t             GoToNextItem();
105   Bool_t             GoToPreviousItem();
106   void               UpdateItem(Bool_t highlight);
107
108   Bool_t             CheckForNewData();
109   void               ClearItems(TGListTreeItem* base) const;
110   void               CleanUpTree(TGListTreeItem* base);
111   void               UpdateTree();
112   void               UpdateFavoritesTree();
113   void               UpdateComparisonTree();
114   void               UpdateDescription();
115   void               UpdateHisto();
116   void               UpdateAll();
117
118   TGLayoutHints*     fMenuBarLayout;           // layout of the menu bar
119   TGLayoutHints*     fMenuBarItemLayout;       // layout of the menu items
120   TGLayoutHints*     fMenuBarHelpLayout;       // layout of the help menu
121   TGPopupMenu*       fMenuFile;                // the file menu
122   TGPopupMenu*       fMenuView;                // the view menu
123   TGPopupMenu*       fMenuFavorites;           // the favorites menu
124   TGPopupMenu*       fMenuReference;           // the reference menu
125   TGPopupMenu*       fMenuOptions;             // the options menu
126   TGPopupMenu*       fMenuHelp;                // the help menu
127   TGMenuBar*         fMenuBar;                 // the menu bar
128
129   TGLayoutHints*     fToolBarLayout;           // layout of the tool bar
130   TGHorizontal3DLine* fToolBarSep;             // separation of the tool bar
131   TGToolBar*         fToolBar;                 // the tool bar
132   TGLayoutHints*     fEventNumberLayout;       // layout of the event number
133   TGNumberEntry*     fEventNumber;             // the event number
134   TGButton*          fEventButton;             // the button for one event
135   TGButton*          fSumButton;               // the button for the sum of events
136   TGButton*          fRunButton;               // the button for a run
137   TGButton*          fLoopButton;              // the botton for the loop
138   const TGPicture*   fLoopOnPicture;           // the picture for running loop
139   const TGPicture*   fLoopOffPicture;          // the picture for stoped loop
140   TGButton*          fPreviousButton;          // the button for previous histo
141   TGButton*          fNextButton;              // the button for next histo
142   TGButton*          fCopyButton;              // the button for copy histo
143   TGButton*          fSaveButton;              // the button for save histo
144   TGButton*          fPrintButton;             // the button for print histo
145
146   TGLayoutHints*     fBottomLayout;            // layout at bottom
147   TGLayoutHints*     fLeftLayout;              // layout at left
148   TGLayoutHints*     fExpandLayout;            // expanded layout
149
150   TGVerticalFrame*   fVerticalFrame;           // frame for tree/histo and description
151   TGHorizontalFrame* fHorizontalFrame;         // frame for tree and histo
152
153   TGCompositeFrame*  fTreeFrame;               // frame for tree
154   TGCanvas*          fTreeCanvas;              // canvas for tree
155   TGListTree*        fTree;                    // tree with histos
156   const TGPicture*   fHistoPicture;            // picture for histo item
157   TGListTreeItem*    fAllItem;                 // top item for all histos
158   TGListTreeItem*    fFavoritesItem;           // top item for favorites
159   TGListTreeItem*    fComparisonItem;          // top item for comparison
160
161   TGVSplitter*       fTreeSplitter;            // splitter for tree and histo
162
163   TGCompositeFrame*  fDrawFrame;               // frame for histo
164   TRootEmbeddedCanvas* fDrawCanvas;            // canvas for histo
165
166   TGHSplitter*       fDescriptionSplitter;     // splitter tree/histo and description
167
168   TGCompositeFrame*  fDescriptionFrame;        // frame for description
169   TGTextView*        fDescription;             // description text
170
171   TString            fServerName;              // name of the monitor server
172   TSocket*           fSocket;                  // socket to the monitor server
173   TFileHandler*      fSocketHandler;           // handler for fSocket
174
175   TFolder*           fFolder;                  // folder with histos
176
177   TGListTreeItem*    fCurrentItem;             // current tree item
178   TGListTreeItem*    fBaseItem;                // base item of current item
179   TTimer*            fLoopTimer;               // timer for loop over histos
180   Int_t              fLoopInterval;            // loop interval
181
182   TString            fFavoritesFileName;       // file name of favorites
183
184   TString            fReferenceFileName;       // file name with reference histos
185   TFolder*           fReference;               // folder with reference histos
186
187   TString            fPrintCommand;            // print command
188
189   static const char* fgSettingsFileName;       // file name of settings
190
191
192   class AliMonitorStringDlg : public AliMonitorDialog {
193
194   public:
195     AliMonitorStringDlg(TString& string, TGFrame* main, const char* title,
196                         const char* label);
197     AliMonitorStringDlg(const AliMonitorStringDlg& dlg) : 
198       AliMonitorDialog(dlg), fString(dlg.fString) {
199       Fatal("AliMonitorStringDlg", "copy constructor not implemented");
200     }
201     AliMonitorStringDlg& operator = (const AliMonitorStringDlg& /*dlg*/) {
202       Fatal("operator =", "assignment operator not implemented");
203       return *this;
204     }
205     virtual ~AliMonitorStringDlg();
206
207     virtual void       OnOkClicked();
208
209   private:
210     TGLayoutHints*     fStringLayout;    // layout of the text entry
211     TGLabel*           fStringLabel;     // label for the text entry
212     TGTextEntry*       fStringEntry;     // the text enty
213
214     TString&           fString;          // result
215   };
216
217
218   class AliMonitorNumberDlg : public AliMonitorDialog {
219
220   public:
221     AliMonitorNumberDlg(Float_t& value, TGFrame* main, const char* title,
222                         const char* label, Float_t min);
223     AliMonitorNumberDlg(const AliMonitorNumberDlg& dlg) : 
224       AliMonitorDialog(dlg), fNumber(dlg.fNumber) {
225       Fatal("AliMonitorNumberDlg", "copy constructor not implemented");
226     }
227     AliMonitorNumberDlg& operator = (const AliMonitorNumberDlg& /*dlg*/) {
228       Fatal("operator =", "assignment operator not implemented");
229       return *this;
230     }
231     virtual ~AliMonitorNumberDlg();
232
233     virtual void       OnOkClicked();
234
235   private:
236     TGLayoutHints*     fNumberLayout;    // layout of the number entry
237     TGLabel*           fNumberLabel;     // label for the number entry
238     TGNumberEntry*     fNumberEntry;     // the number entry
239
240     Float_t&           fNumber;          // result
241   };
242
243
244   ClassDef(AliMonitorClient, 0)   // class for receiving and displaying monitor histograms
245 };
246  
247
248 #endif
249
250
251
252
253
254
255
256
257