FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairEveAnimationControl.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2020 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 /*
9  * FairAnimationButton.cxx
10  *
11  * Created on: 26 maj 2020
12  * Author: Daniel Wielanek
13  * E-mail: daniel.wielanek@gmail.com
14  * Warsaw University of Technology, Faculty of Physics
15  */
17 
19  TGCompositeFrame *tab,
20  TString name,
21  Int_t width,
22  Int_t buttons)
23  : fWidth(width)
24  , fValMin(0)
25  , fValMax(10)
26  , fFunctionName("")
27  , fParent(frame)
28  , fTab(tab)
29  , fMin(nullptr)
30  , fMax(nullptr)
31  , fStep(nullptr)
32  , fTail(nullptr)
33  , fComboOpt(nullptr)
34  , fTypeOpt(nullptr)
35  , fBtnRunContinuous(nullptr)
36  , fBtnClearBuffer(nullptr)
37 {
38  SetName(name);
39 }
40 
42 {
43  TGGroupFrame *cuts = new TGGroupFrame(fTab, GetName());
44  cuts->SetTitlePos(TGGroupFrame::kCenter);
45  // cuts->SetLayoutManager(new TGMatrixLayout(cuts,6,2));
46  TGTextButton *start_button = new TGTextButton(cuts, "Start");
47  start_button->Resize(80, 25);
48  cuts->AddFrame(start_button, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5));
49  start_button->Connect("Clicked()", fParent->ClassName(), fParent, fFunctionName);
50 
51  TGCompositeFrame *frame1 = new TGCompositeFrame(cuts, fWidth, 30, kHorizontalFrame | kFixedWidth);
52  TGLabel *gAnimType = new TGLabel(frame1, "Animation type:");
53  frame1->AddFrame(gAnimType, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 1, 1));
54  fTypeOpt = new TGComboBox(frame1);
55  fTypeOpt->AddEntry("Event by Event", kEventByEvent);
56  fTypeOpt->AddEntry("Timeslice", kTimeSlice);
57  fTypeOpt->Select(kEventByEvent);
58  fTypeOpt->Resize(100, 20);
59  frame1->AddFrame(fTypeOpt, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
60  cuts->AddFrame(frame1, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
61 
62  TGCompositeFrame *frame2 = new TGCompositeFrame(cuts, fWidth, 30, kHorizontalFrame | kFixedWidth);
63  TGLabel *gLabelType = new TGLabel(frame2, "Scene type:");
64  frame2->AddFrame(gLabelType, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 2, 1));
65  fComboOpt = new TGComboBox(frame2);
66  fComboOpt->AddEntry("3D", k3D);
67  fComboOpt->AddEntry("RPhi", kXY);
68  fComboOpt->AddEntry("RhoZ", kZ);
69  fComboOpt->AddEntry("All", kAll);
70  fComboOpt->Select(0);
71  fComboOpt->Resize(100, 20);
72  frame2->AddFrame(fComboOpt, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
73  cuts->AddFrame(frame2, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
74 
75  TGCompositeFrame *frame3 = new TGCompositeFrame(cuts, fWidth, 30, kHorizontalFrame | kFixedWidth);
76  TGLabel *gLabelMin = new TGLabel(frame3, "Min:");
77  frame3->AddFrame(gLabelMin, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 2, 1));
78  fMin = new TGNumberEntry(frame3, 0, 6, -1, TGNumberFormat::kNESRealTwo);
79  fMin->SetNumber(fValMin);
80  frame3->AddFrame(fMin, new TGLayoutHints(kLHintsRight | kLHintsExpandX));
81  cuts->AddFrame(frame3, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
82 
83  TGCompositeFrame *frame4 = new TGCompositeFrame(cuts, fWidth, 30, kHorizontalFrame | kFixedWidth);
84  TGLabel *gLabelMax = new TGLabel(frame4, "Max:");
85  frame4->AddFrame(gLabelMax, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 2, 1));
86  fMax = new TGNumberEntry(frame4, 10, 6, -1, TGNumberFormat::kNESRealTwo);
87  fMax->SetNumber(fValMax);
88  frame4->AddFrame(fMax, new TGLayoutHints(kLHintsRight | kLHintsExpandX));
89  cuts->AddFrame(frame4, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
90 
91  TGCompositeFrame *frame5 = new TGCompositeFrame(cuts, fWidth, 30, kHorizontalFrame | kFixedWidth);
92  TGLabel *gLabelStep = new TGLabel(frame5, "Step:");
93  frame5->AddFrame(gLabelStep, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 2, 1));
94  fStep = new TGNumberEntry(frame5, 0, 6, -1, TGNumberFormat::kNESRealTwo);
95  frame5->AddFrame(fStep, new TGLayoutHints(kLHintsRight | kLHintsExpandX));
96  cuts->AddFrame(frame5, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
97 
98  TGCompositeFrame *frame6 = new TGCompositeFrame(cuts, fWidth, 30, kHorizontalFrame | kFixedWidth);
99  TGLabel *gLabelTail = new TGLabel(frame6, "Tail:");
100  frame6->AddFrame(gLabelTail, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 1, 1, 2, 1));
101  fTail = new TGNumberEntry(frame6, 0, 6, -1, TGNumberFormat::kNESRealTwo);
102  fTail->SetNumber(-1.0);
103  frame6->AddFrame(fTail, new TGLayoutHints(kLHintsRight | kLHintsExpandX));
104  cuts->AddFrame(frame6, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
105 
106  fBtnRunContinuous = new TGCheckButton(cuts, "Run Continuous");
107  cuts->AddFrame(fBtnRunContinuous, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
108 
109  fBtnClearBuffer = new TGCheckButton(cuts, "Clear Buffer at Start");
110  cuts->AddFrame(fBtnClearBuffer, new TGLayoutHints(kLHintsLeft | kLHintsExpandX));
111 
112  fTab->AddFrame(cuts, new TGLayoutHints(kLHintsRight | kLHintsExpandX, 1, 1, 2, 1));
113 }
114 
115 Double_t FairEveAnimationControl::GetMin() { return fMin->GetNumber(); }
116 
117 Double_t FairEveAnimationControl::GetMax() { return fMax->GetNumber(); }
118 
120 {
121  if (fStep)
122  return fStep->GetNumber();
123  return 1;
124 }
125 
127 {
128  return fTail->GetNumber();
129 }
130 
132 {
133  return fBtnRunContinuous->IsOn();
134 }
135 
137 {
138  return fBtnClearBuffer->IsOn();
139 }
140 
142 {
143  return static_cast<eScreenshotType>(fComboOpt->GetSelected());
144 }
145 
147 {
148  return static_cast<eAnimationType>(fTypeOpt->GetSelected());
149 }
150 
FairEveAnimationControl(TGedFrame *frame=0, TGCompositeFrame *tab=0, TString name="", Int_t width=170, Int_t buttons=2)