]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/EveBase/AliEveMacroEditor.cxx
AliEveEventManager
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveMacroEditor.cxx
CommitLineData
f6afd0e1 1// @(#)root/eve:$Id$
2// Author: Matevz Tadel 2007
3
4/**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
9
10#include "AliEveMacroEditor.h"
11#include "AliEveMacro.h"
12
13#include "TVirtualPad.h"
14
15// Cleanup these includes:
16#include "TGLabel.h"
17#include "TGNumberEntry.h"
18#include "TGColorSelect.h"
19#include "TGTextEntry.h"
20
21#include "TGComboBox.h"
22
23//______________________________________________________________________________
24// GUI editor for AliEveMacro.
25//
26
27ClassImp(AliEveMacroEditor)
28
29//______________________________________________________________________________
30AliEveMacroEditor::AliEveMacroEditor(const TGWindow *p, Int_t width, Int_t height,
31 UInt_t options, Pixel_t back) :
32 TGedFrame(p, width, height, options | kVerticalFrame, back),
33 fM(0),
34 fSources(0),
7b2d546e 35 fTags(0),
f6afd0e1 36 fMacro(0),
37 fFunc(0),
38 fArgs(0),
39 fActive(0)
40{
41 // Constructor.
42
43 MakeTitle("AliEveMacro");
44
45 TGHorizontalFrame *f = 0;
46 //TGLabel *l = 0;
47 Int_t labelW = 48;
48 {
49 f = MkHFrame();
50 MkLabel(f, "Active: ", labelW);
51
52 fActive = new TGCheckButton(f);
53 f->AddFrame(fActive); // new TGLayoutHints());
54 fActive->Connect("Clicked()", "AliEveMacroEditor", this,
55 "DoActive()");
56
7b2d546e 57 MkLabel(f, "Source: ", 56);
f6afd0e1 58 fSources = new TGComboBox(f);
59 f->AddFrame(fSources); // new TGLayoutHints());
60 fSources->AddEntry("None", AliEveMacro::kNone);
61 fSources->AddEntry("RunLoader", AliEveMacro::kRunLoader);
62 fSources->AddEntry("ESD", AliEveMacro::kESD);
63 fSources->AddEntry("ESDfriend", AliEveMacro::kESDfriend);
29207369 64 fSources->AddEntry("RawReader", AliEveMacro::kRawReader);
f6afd0e1 65 {
66 TGListBox* lb = fSources->GetListBox();
67 lb->Resize(lb->GetWidth(), 5*16);
68 }
7b2d546e 69 fSources->Resize(92, 20);
f6afd0e1 70 fSources->Connect("Selected(Int_t)", "AliEveMacroEditor", this,
71 "DoSources(Int_t)");
7b2d546e 72
73 MkLabel(f, "Tags: ", 40);
74 fTags = new TGTextEntry(f);
75 f->AddFrame(fTags, new TGLayoutHints(kLHintsNormal|kLHintsExpandX));
76 fTags->Connect("TextChanged(const char *)", "AliEveMacroEditor", this,
77 "DoTags()");
f6afd0e1 78 }
79 {
80 f = MkHFrame();
81 MkLabel(f, "Macro: ", labelW);
82 fMacro = new TGTextEntry(f);
7b2d546e 83 f->AddFrame(fMacro, new TGLayoutHints(kLHintsNormal));//|kLHintsExpandX));
f6afd0e1 84 fMacro->Connect("TextChanged(const char *)", "AliEveMacroEditor", this,
85 "DoMacro()");
86
87 MkLabel(f, "Func: ", labelW);
88 fFunc = new TGTextEntry(f);
89 f->AddFrame(fFunc, new TGLayoutHints(kLHintsNormal|kLHintsExpandX));
90 fFunc->Connect("TextChanged(const char *)", "AliEveMacroEditor", this,
91 "DoFunc()");
92 }
93 {
94 f = MkHFrame();
95 MkLabel(f, "Args: ", labelW);
96 fArgs = new TGTextEntry(f);
97 f->AddFrame(fArgs, new TGLayoutHints(kLHintsNormal|kLHintsExpandX));
98 fArgs->Connect("TextChanged(const char *)", "AliEveMacroEditor", this,
99 "DoArgs()");
100 }
101}
102
103/******************************************************************************/
104
105//______________________________________________________________________________
106void AliEveMacroEditor::SetModel(TObject* obj)
107{
108 // Set model object.
109
110 fM = dynamic_cast<AliEveMacro*>(obj);
111
112 fSources->Select (fM->GetSources(), kFALSE);
113 // TGTextEntry emits a signal no matter what ...
114 TQObject::BlockAllSignals(kTRUE);
7b2d546e 115 fTags ->SetText (fM->GetTags());
f6afd0e1 116 fMacro ->SetText (fM->GetMacro());
117 fFunc ->SetText (fM->GetFunc());
118 fArgs ->SetText (fM->GetArgs());
119 TQObject::BlockAllSignals(kFALSE);
120 fActive ->SetState(fM->fActive ? kButtonDown : kButtonUp);
121}
122
123//______________________________________________________________________________
124void AliEveMacroEditor::DoSources(Int_t v)
125{
126 // Slot for Sources.
127
128 fM->SetSources(v);
129 Update();
130}
131
7b2d546e 132//______________________________________________________________________________
133void AliEveMacroEditor::DoTags()
134{
135 // Slot for Tags.
136
137 fM->SetTags(fTags->GetText());
138 Update();
139}
140
f6afd0e1 141//______________________________________________________________________________
142void AliEveMacroEditor::DoMacro()
143{
144 // Slot for Macro.
145
146 fM->SetMacro(fMacro->GetText());
147 Update();
148}
149
150//______________________________________________________________________________
151void AliEveMacroEditor::DoFunc()
152{
153 // Slot for Func.
154
155 fM->SetFunc(fFunc->GetText());
156 Update();
157}
158//______________________________________________________________________________
159void AliEveMacroEditor::DoArgs()
160{
161 // Slot for Args.
162
163 fM->SetArgs(fArgs->GetText());
164 Update();
165}
166
167//______________________________________________________________________________
168void AliEveMacroEditor::DoActive()
169{
170 // Slot for Active.
171
172 fM->SetActive(fActive->IsOn());
173 Update();
174}
175
176/******************************************************************************/
177
178TGHorizontalFrame* AliEveMacroEditor::MkHFrame(TGCompositeFrame* p)
179{
180 // Make standard horizontal frame.
181
182 if (p == 0)
183 p = this;
184 TGHorizontalFrame* f = new TGHorizontalFrame(p);
185 p->AddFrame(f, new TGLayoutHints(kLHintsNormal|kLHintsExpandX));
186 return f;
187}
188
189TGLabel* AliEveMacroEditor::MkLabel(TGCompositeFrame* p, const char* txt, Int_t width,
190 Int_t lo, Int_t ro, Int_t to, Int_t bo)
191{
192 // Make standard label.
193
194 TGLabel *l = new TGLabel(p, txt);
195 p->AddFrame(l, new TGLayoutHints(kLHintsNormal, lo,ro,to,bo));
196 l->SetTextJustify(kTextRight);
197 l->SetWidth(width);
198 l->ChangeOptions(l->GetOptions() | kFixedWidth);
199 return l;
200}