forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TEveProjectionAxesEditor.cxx
170 lines (131 loc) · 6.02 KB
/
TEveProjectionAxesEditor.cxx
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// @(#)root/eve:$Id$
// Author: Matevz Tadel 2007
/*************************************************************************
* Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#include "TEveProjectionAxesEditor.h"
#include "TEveProjectionAxes.h"
#include "TEveGValuators.h"
#include "TGComboBox.h"
#include "TGButton.h"
#include "TGLabel.h"
#include "TG3DLine.h"
/** \class TEveProjectionAxesEditor
\ingroup TEve
GUI editor for TEveProjectionAxes.
*/
ClassImp(TEveProjectionAxesEditor);
////////////////////////////////////////////////////////////////////////////////
TEveProjectionAxesEditor::TEveProjectionAxesEditor(const TGWindow *p, Int_t width, Int_t height,
UInt_t options, Pixel_t back) :
TGedFrame(p, width, height, options | kVerticalFrame, back),
fM(nullptr),
fLabMode(nullptr),
fAxesMode(nullptr),
fCenterFrame(nullptr),
fDrawCenter(nullptr),
fDrawOrigin(nullptr)
{
// Constructor.
MakeTitle("TEveProjectionAxis");
Int_t labw=52;
{
TGHorizontalFrame* f = new TGHorizontalFrame(this);
TGCompositeFrame *labfr = new TGHorizontalFrame(f, labw, 20, kFixedSize);
labfr->AddFrame(new TGLabel(labfr, "Labels:") , new TGLayoutHints(kLHintsLeft | kLHintsBottom));
f->AddFrame(labfr, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 0, 1, 1, 1));
fLabMode = new TGComboBox(f, "Position");
fLabMode->AddEntry("Value", 1);
fLabMode->AddEntry("Position", 0);
fLabMode->GetTextEntry()->SetToolTipText("Set tick-marks on equidistant values/screen position.");
TGListBox* lb = fLabMode->GetListBox();
lb->Resize(lb->GetWidth(), 2*18);
fLabMode->Resize(80, 20);
fLabMode->Connect("Selected(Int_t)", "TEveProjectionAxesEditor", this, "DoLabMode(Int_t)");
f->AddFrame(fLabMode, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
AddFrame(f);
}
{
TGHorizontalFrame* f = new TGHorizontalFrame(this);
TGCompositeFrame *labfr = new TGHorizontalFrame(f, labw, 20, kFixedSize);
labfr->AddFrame(new TGLabel(labfr, "Axes:") , new TGLayoutHints(kLHintsLeft | kLHintsBottom));
f->AddFrame(labfr, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 0, 1, 1, 1));
fAxesMode = new TGComboBox(f, "All");
fAxesMode->AddEntry("Horizontal", TEveProjectionAxes::kHorizontal);
fAxesMode->AddEntry("Vertical",TEveProjectionAxes::kVertical);
fAxesMode->AddEntry("All", TEveProjectionAxes::kAll);
TGListBox* lb = fAxesMode->GetListBox();
lb->Resize(lb->GetWidth(), 2*18);
fAxesMode->Resize(80, 20);
fAxesMode->Connect("Selected(Int_t)", "TEveProjectionAxesEditor", this, "DoAxesMode(Int_t)");
f->AddFrame(fAxesMode, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
AddFrame(f);
}
//______________________________________________________________________________
// center tab
fCenterFrame = CreateEditorTabSubFrame("Center");
TGCompositeFrame *title1 = new TGCompositeFrame(fCenterFrame, 180, 10,
kHorizontalFrame |
kFitWidth |
kFixedWidth |
kOwnBackground);
title1->AddFrame(new TGLabel(title1, "Distortion Center"),
new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
title1->AddFrame(new TGHorizontal3DLine(title1),
new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
fCenterFrame->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
{
TGHorizontalFrame* hf1 = new TGHorizontalFrame(fCenterFrame);
fDrawOrigin = new TGCheckButton(hf1, "DrawOrigin");
hf1->AddFrame(fDrawOrigin, new TGLayoutHints(kLHintsLeft, 2,1,0,4));
fDrawOrigin->Connect("Toggled(Bool_t)", "TEveProjectionAxesEditor", this, "DoDrawOrigin()");
fDrawCenter = new TGCheckButton(hf1, "DrawCenter");
hf1->AddFrame(fDrawCenter, new TGLayoutHints(kLHintsLeft, 2,1,0,4));
fDrawCenter->Connect("Toggled(Bool_t)", "TEveProjectionAxesEditor", this, "DoDrawCenter()");
fCenterFrame->AddFrame(hf1, new TGLayoutHints(kLHintsTop, 0,0,0,0));
}
}
////////////////////////////////////////////////////////////////////////////////
/// Set model object.
void TEveProjectionAxesEditor::SetModel(TObject* obj)
{
fM = dynamic_cast<TEveProjectionAxes*>(obj);
fLabMode->Select(fM->GetLabMode(), kFALSE);
fAxesMode->Select(fM->GetAxesMode(), kFALSE);
fDrawCenter->SetState(fM->GetDrawCenter() ? kButtonDown : kButtonUp);
fDrawOrigin->SetState(fM->GetDrawOrigin() ? kButtonDown : kButtonUp);
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for setting draw of origin.
void TEveProjectionAxesEditor::DoDrawOrigin()
{
fM->SetDrawOrigin(fDrawOrigin->IsOn());
Update();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for setting draw of center.
void TEveProjectionAxesEditor::DoDrawCenter()
{
fM->SetDrawCenter(fDrawCenter->IsOn());
Update();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for setting tick-mark step mode.
void TEveProjectionAxesEditor::DoLabMode(Int_t mode)
{
TEveProjectionAxes::ELabMode em = (TEveProjectionAxes::ELabMode ) mode;
fM->SetLabMode(em);
Update();
}
////////////////////////////////////////////////////////////////////////////////
/// Slot for setting number of axes.
void TEveProjectionAxesEditor::DoAxesMode(Int_t mode)
{
TEveProjectionAxes::EAxesMode em = (TEveProjectionAxes::EAxesMode ) mode;
fM->SetAxesMode(em);
Update();
}