TGUIManager.cxx
Go to the documentation of this file.
1 #include "TGUIManager.hxx"
2 #include "TEventDisplay.hxx"
3 
4 #include <TGFrame.h>
5 #include <TGButton.h>
6 #include <TGListBox.h>
7 #include <TGLabel.h>
8 #include <TGTextEntry.h>
9 
10 #include <TEveManager.h>
11 #include <TEveBrowser.h>
12 
13 #include <TSystem.h>
14 
18 }
19 
21  TEveBrowser* browser = gEve->GetBrowser();
22 
23  // Define the generic layout. The last four parameters are the padding
24  // around the widgets.
25  TGLayoutHints* layoutHints
26  = new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX,
27  2, 2, 2, 2);
28 
29  // Embed a new frame in the event browser to have control buttons.
30  browser->StartEmbedding(TRootBrowser::kLeft);
31  TGMainFrame* mainFrame = new TGMainFrame(gClient->GetRoot(), 1000, 600);
32  mainFrame->SetWindowName("Event Control");
33  mainFrame->SetCleanup(kDeepCleanup);
34 
35  TGVerticalFrame* hf = new TGVerticalFrame(mainFrame);
36  TGTextButton* textButton;
37 
38  // The general action buttons.
39  textButton = new TGTextButton(hf, "Previous Event");
40  textButton->SetToolTipText("Go to previous event.");
41  textButton->SetTextJustify(36);
42  textButton->SetMargins(0,0,0,0);
43  textButton->SetWrapLength(-1);
44  hf->AddFrame(textButton, layoutHints);
45  fPrevEventButton = textButton;
46 
47  textButton = new TGTextButton(hf, "Redraw Event");
48  textButton->SetToolTipText("Refresh the current view.");
49  textButton->SetTextJustify(36);
50  textButton->SetMargins(0,0,0,0);
51  textButton->SetWrapLength(-1);
52  hf->AddFrame(textButton, layoutHints);
53  fDrawEventButton = textButton;
54 
55  textButton = new TGTextButton(hf, "Next Event");
56  textButton->SetToolTipText("Go to previous event.");
57  textButton->SetTextJustify(36);
58  textButton->SetMargins(0,0,0,0);
59  textButton->SetWrapLength(-1);
60  hf->AddFrame(textButton, layoutHints);
61  fNextEventButton = textButton;
62 
63  // Create the buttons to select which types of objects are showed.
64  TGCheckButton *checkButton;
65 
66  /////////////////////
67  // Buttons to control how truth objects are drawn.
68  /////////////////////
69 
70  checkButton = new TGCheckButton(hf,"Show Trajectories");
71  checkButton->SetToolTipText(
72  "Show the GEANT4 trajectories and trajectory points.");
73  checkButton->SetTextJustify(36);
74  checkButton->SetMargins(0,0,0,0);
75  checkButton->SetWrapLength(-1);
76  hf->AddFrame(checkButton, layoutHints);
77  fShowTrajectoriesButton = checkButton;
78 
79  checkButton = new TGCheckButton(hf,"Show G4 Hits");
80  checkButton->SetToolTipText(
81  "Show the GEANT4 hits. This shows the energy deposition in the "
82  "defined sensitive detectors.");
83  checkButton->SetTextJustify(36);
84  checkButton->SetMargins(0,0,0,0);
85  checkButton->SetWrapLength(-1);
86  checkButton->SetOn();
87  hf->AddFrame(checkButton, layoutHints);
88  fShowG4HitsButton = checkButton;
89 
90  checkButton = new TGCheckButton(hf,"Recalculate view");
91  checkButton->SetToolTipText(
92  "Recalculate center of rotation based.");
93  checkButton->SetTextJustify(36);
94  checkButton->SetMargins(0,0,0,0);
95  checkButton->SetWrapLength(-1);
96  checkButton->SetOn();
97  hf->AddFrame(checkButton, layoutHints);
98  fRecalculateViewButton = checkButton;
99 
100 
101  // Do the final layout and mapping.
102  mainFrame->AddFrame(hf, layoutHints);
103  mainFrame->MapSubwindows();
104  mainFrame->Resize();
105  mainFrame->MapWindow();
106  browser->StopEmbedding();
107  browser->SetTabTitle("Control", 0);
108 }
109 
111  TEveBrowser* browser = gEve->GetBrowser();
112 
113  // Embed a new frame in the event browser to select fit objects.
114  browser->StartEmbedding(TRootBrowser::kLeft);
115  TGMainFrame* mainFrame = new TGMainFrame(gClient->GetRoot(), 1000, 600);
116  mainFrame->SetWindowName("Fit Selection");
117  mainFrame->SetCleanup(kDeepCleanup);
118 
119  TGVerticalFrame* hf = new TGVerticalFrame(mainFrame);
120 
121  // Create the listbox for the results.
122  fResultsList = new TGListBox(hf);
123  fResultsList->SetMultipleSelections(true);
124  TGLayoutHints* layoutList = new TGLayoutHints(kLHintsLeft
125  | kLHintsTop
126  | kLHintsExpandX
127  | kLHintsExpandY);
128  hf->AddFrame(fResultsList,layoutList);
129 
130  // Create a text entry button to choose a default result.
131  TGLabel* txt = new TGLabel(hf,"Default Result");
132  TGLayoutHints* layoutHints = new TGLayoutHints(kLHintsLeft
133  | kLHintsTop
134  | kLHintsExpandX,
135  2,2,2,2);
136  hf->AddFrame(txt,layoutHints);
137 
138  // Create a text entry button to choose a default result. This also sets
139  // the default default result. It should be possible to override this
140  // from the command line!
141  fDefaultResult = new TGTextEntry(hf);
142  fDefaultResult->SetText("TCaptainRecon/final");
143  fDefaultResult->SetToolTipText(
144  "Enter a regular expression to select algorithm results\n"
145  "to be shown. The usual regexp syntax applys:\n"
146  " . -- Match any character\n"
147  " .* -- Match any sequence of characters\n"
148  " | -- \'or\'\n"
149  "See grep for more details. A result is show if the\n"
150  "regexpn matchs any sub-string in the result name." );
151 
152  hf->AddFrame(fDefaultResult,layoutHints);
153 
154  // Do the final layout and mapping.
155  TGLayoutHints* layoutFrame
156  = new TGLayoutHints(kLHintsLeft
157  | kLHintsTop
158  | kLHintsExpandX
159  | kLHintsExpandY,
160  2, 2, 2, 2);
161  mainFrame->AddFrame(hf, layoutFrame);
162  mainFrame->MapSubwindows();
163  mainFrame->Resize();
164  mainFrame->MapWindow();
165  browser->StopEmbedding();
166  browser->SetTabTitle("Recon", 0);
167 }
168 
TGButton * fNextEventButton
TGButton * fShowTrajectoriesButton
TGTextEntry * fDefaultResult
A regular expression to select the default result(s) to be selected.
TGListBox * fResultsList
TGUIManager()
Actually construct all the GUI.
Definition: TGUIManager.cxx:15
TGButton * fShowG4HitsButton
TGButton * fPrevEventButton
void MakeControlTab()
Make a tab in the browser for control buttons.
Definition: TGUIManager.cxx:20
TGButton * fRecalculateViewButton
void MakeResultsTab()
Make a tab in the browser to select algorithms shown.
TGButton * fDrawEventButton