forked from mcoquet642/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEventManagerFrame.cxx
More file actions
118 lines (99 loc) · 3.82 KB
/
EventManagerFrame.cxx
File metadata and controls
118 lines (99 loc) · 3.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file EventManagerFrame.cxx
/// \brief GUI (bottom buttons) for visualisation
/// \author julian.myrcha@cern.ch
/// \author p.nowakowski@cern.ch
#include <TGButton.h>
#include <TGNumberEntry.h>
#include <TGLabel.h>
#include <EventVisualisationView/EventManagerFrame.h>
#include <EventVisualisationView/MultiView.h>
#include <EventVisualisationBase/DataSourceOffline.h>
#include <EventVisualisationDetectors/DataReaderVSD.h>
#include <Rtypes.h>
#include <iostream>
ClassImp(o2::event_visualisation::EventManagerFrame);
namespace o2
{
namespace event_visualisation
{
EventManagerFrame::EventManagerFrame(o2::event_visualisation::EventManager& eventManager)
: TGMainFrame(gClient->GetRoot(), 400, 100, kVerticalFrame)
{
mEventManager = &eventManager;
const TString cls("o2::event_visualisation::EventManagerFrame");
TGTextButton* b = nullptr;
TGHorizontalFrame* f = new TGHorizontalFrame(this);
{
Int_t width = 50;
this->AddFrame(f, new TGLayoutHints(kLHintsExpandX, 0, 0, 2, 2));
b = EventManagerFrame::makeButton(f, "First", width);
b->Connect("Clicked()", cls, this, "DoFirstEvent()");
b = EventManagerFrame::makeButton(f, "Prev", width);
b->Connect("Clicked()", cls, this, "DoPrevEvent()");
mEventId = new TGNumberEntry(f, 0, 5, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax, 0, 10000);
f->AddFrame(mEventId, new TGLayoutHints(kLHintsNormal, 10, 5, 0, 0));
mEventId->Connect("ValueSet(Long_t)", cls, this, "DoSetEvent()");
TGLabel* infoLabel = new TGLabel(f);
f->AddFrame(infoLabel, new TGLayoutHints(kLHintsNormal, 5, 10, 4, 0));
b = EventManagerFrame::makeButton(f, "Next", width);
b->Connect("Clicked()", cls, this, "DoNextEvent()");
b = EventManagerFrame::makeButton(f, "Last", width);
b->Connect("Clicked()", cls, this, "DoLastEvent()");
b = EventManagerFrame::makeButton(f, "Screenshot", 2 * width);
b->Connect("Clicked()", cls, this, "DoScreenshot()");
}
SetCleanup(kDeepCleanup);
Layout();
MapSubwindows();
MapWindow();
}
TGTextButton* EventManagerFrame::makeButton(TGCompositeFrame* p, const char* txt,
Int_t width, Int_t lo, Int_t ro, Int_t to, Int_t bo)
{
TGTextButton* b = new TGTextButton(p, txt);
//b->SetFont("-adobe-helvetica-bold-r-*-*-48-*-*-*-*-*-iso8859-1");
if (width > 0) {
b->SetWidth(width);
b->ChangeOptions(b->GetOptions() | kFixedWidth);
}
p->AddFrame(b, new TGLayoutHints(kLHintsNormal, lo, ro, to, bo));
return b;
}
void EventManagerFrame::DoFirstEvent()
{
mEventManager->GotoEvent(0);
mEventId->SetIntNumber(mEventManager->getCurrentEvent());
}
void EventManagerFrame::DoPrevEvent()
{
mEventManager->PrevEvent();
mEventId->SetIntNumber(mEventManager->getCurrentEvent());
}
void EventManagerFrame::DoNextEvent()
{
mEventManager->NextEvent();
mEventId->SetIntNumber(mEventManager->getCurrentEvent());
}
void EventManagerFrame::DoLastEvent()
{
mEventManager->GotoEvent(-1); /// -1 means last available
mEventId->SetIntNumber(mEventManager->getCurrentEvent());
}
void EventManagerFrame::DoSetEvent()
{
}
void EventManagerFrame::DoScreenshot()
{
}
} // namespace event_visualisation
}