]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Alieve/ITSScaledModuleEditor.cxx
Put black-listed classes out of Alieve namespace.
[u/mrichter/AliRoot.git] / EVE / Alieve / ITSScaledModuleEditor.cxx
1 // $Header$
2
3 #include "ITSScaledModuleEditor.h"
4 #include <Alieve/ITSScaledModule.h>
5 #include <TEveTransEditor.h>
6 #include <TEveGValuators.h>
7
8 #include <TVirtualPad.h>
9 #include <TColor.h>
10 #include <TMath.h>
11
12 #include <TGedEditor.h>
13 #include <TGLabel.h>
14 #include <TG3DLine.h>
15 #include <TGButton.h>
16 #include <TGNumberEntry.h>
17 #include <TGColorSelect.h>
18 #include <TGComboBox.h>
19 using namespace Alieve;
20
21 //______________________________________________________________________
22 // ITSScaledModuleEditor 
23 //
24
25 ClassImp(ITSScaledModuleEditor)
26
27   ITSScaledModuleEditor::ITSScaledModuleEditor(const TGWindow *p, Int_t width, Int_t height,
28                                                UInt_t options, Pixel_t back) :
29     TGedFrame(p, width, height, options | kVerticalFrame, back),
30
31     fInfoFrame(0),
32
33     fModule(0), 
34
35     fScale(0),
36     fStatistic(0),
37     fInfoLabel0(0),
38     fInfoLabel1(0)
39 {
40   MakeTitle("ITSScaledModule");
41   // Create widgets
42   {
43     TGHorizontalFrame* f = new TGHorizontalFrame(this);
44     TGLabel *l = new TGLabel(f, "Scale:");
45     f->AddFrame(l, new TGLayoutHints(kLHintsTop | kLHintsCenterY, 0, 5, 1, 1));
46     fScale = new TGNumberEntry(f, 0, 2, -1,
47                                TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive,
48                                TGNumberFormat::kNELLimitMinMax, 1, 5);
49     fScale->GetNumberEntry()->SetToolTipText("Set cell size.");
50     f->AddFrame(fScale, new TGLayoutHints(kLHintsLeft, 1, 7, 1, 1));
51     fScale->Associate(f);
52     fScale->Connect("ValueSet(Long_t)", "Alieve::ITSScaledModuleEditor", this, "DoScale()");
53     
54     TGLabel* lab = new TGLabel(f, "Statistic:");
55     f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 2, 1, 2));
56     fStatistic = new TGComboBox(f);
57     fStatistic->AddEntry("Occup", 0);
58     fStatistic->AddEntry("Average", 1);
59     fStatistic->AddEntry("RMS", 2);
60     TGListBox* lb = fStatistic->GetListBox();
61     lb->Resize(lb->GetWidth(), 3*16);
62     fStatistic->Resize(74, 20);
63     fStatistic->Connect("Selected(Int_t)", "Alieve::ITSScaledModuleEditor", this, "DoStatType(Int_t)");
64     f->AddFrame(fStatistic, new TGLayoutHints(kLHintsLeft, 1, 2, 1, 1));
65     AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
66   }
67
68   CreateInfoFrame();
69 }
70
71 /*************************************************************************/
72 ITSScaledModuleEditor::~ITSScaledModuleEditor()
73 {}
74
75 /*************************************************************************/
76 void ITSScaledModuleEditor::CreateInfoFrame()
77 {
78   fInfoFrame = CreateEditorTabSubFrame("Info");
79   TGCompositeFrame *title1 = new TGCompositeFrame(fInfoFrame, 145, 10, 
80                                                   kHorizontalFrame | 
81                                                   kLHintsExpandX   | 
82                                                   kFixedWidth      | 
83                                                   kOwnBackground);
84
85   title1->AddFrame(new TGLabel(title1, "ScaledDigits Info"), 
86                    new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
87   title1->AddFrame(new TGHorizontal3DLine(title1),
88                    new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
89   fInfoFrame->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
90
91
92   Int_t lp = 2;
93   fInfoLabel0 = new TGLabel(fInfoFrame);
94   fInfoLabel0->SetTextJustify(kTextLeft);
95   fInfoFrame->AddFrame(fInfoLabel0, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
96                                           lp, 0, 8, 0));
97
98   fInfoLabel1 = new TGLabel(fInfoFrame);
99   fInfoLabel1->SetTextJustify(kTextLeft);
100   fInfoFrame->AddFrame(fInfoLabel1, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
101                                           lp, 0, 2, 8));
102
103 }
104
105 /**************************************************************************/
106
107 void ITSScaledModuleEditor::SetModel(TObject* obj)
108 {
109   fModule = dynamic_cast<ITSScaledModule*>(obj); 
110
111   // widgets
112   fScale->SetIntNumber(fModule->GetScaleInfo()->GetScale());
113   fStatistic->Select(fModule->GetScaleInfo()->GetStatType(), kFALSE);
114
115   // text info  
116   Int_t cnx, cnz, total;
117   fModule->GetScaleData(cnx, cnz, total);
118   fInfoLabel0->SetText(Form("Cell size:  Nx=%d Nz=%d", cnx, cnz));
119   fInfoLabel1->SetText(Form("Num cells:  %d", total));
120 }
121
122
123 /**************************************************************************/
124
125 void ITSScaledModuleEditor::DoScale()
126 {
127   fModule->GetScaleInfo()->ScaleChanged(fScale->GetIntNumber());
128
129   Int_t cnx, cnz, total;
130   fModule->GetScaleData(cnx, cnz, total);
131   fInfoLabel0->SetText(Form("Cell size:  Nx=%d Nz=%d", cnx, cnz));
132   Update();
133   fGedEditor->SetModel(fGedEditor->GetPad(), fGedEditor->GetModel(), kButton1Down);
134 }
135
136 /**************************************************************************/
137
138 void ITSScaledModuleEditor::DoStatType(Int_t v)
139 {
140   fModule->GetScaleInfo()->StatTypeChanged(v);
141   Update();
142   fGedEditor->SetModel(fGedEditor->GetPad(), fGedEditor->GetModel(), kButton1Down);
143 }