00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TEveGridStepperEditor.h"
00013 #include "TEveGridStepper.h"
00014 #include "TEveGValuators.h"
00015
00016 #include "TVirtualPad.h"
00017 #include "TColor.h"
00018
00019 #include "TGLabel.h"
00020 #include "TGSlider.h"
00021 #include "TGButton.h"
00022 #include "TGNumberEntry.h"
00023
00024
00025
00026
00027
00028
00029 ClassImp(TEveGridStepperSubEditor)
00030
00031
00032 TEveGridStepperSubEditor::TEveGridStepperSubEditor(const TGWindow *p) :
00033 TGVerticalFrame(p),
00034 fM (0),
00035 fNx(0), fNy(0), fNz(0),
00036 fDx(0), fDy(0), fDz(0)
00037 {
00038
00039
00040 Int_t labelW = 15;
00041
00042 TGHorizontalFrame* hf = new TGHorizontalFrame(this);
00043
00044 {
00045 TGGroupFrame* f = new TGGroupFrame(hf, "NumRows", kVerticalFrame);
00046 f->SetWidth(30);
00047 hf->AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
00048
00049 fNx = new TEveGValuator(f,"X:", 200, 0);
00050 fNx->SetNELength(3);
00051 fNx->SetLabelWidth(labelW);
00052 fNx->SetShowSlider(kFALSE);
00053 fNx->Build();
00054 fNx->SetLimits(1, 15);
00055 fNx->Connect("ValueSet(Double_t)",
00056 "TEveGridStepperSubEditor", this, "DoNs()");
00057 f->AddFrame(fNx, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00058
00059 fNy = new TEveGValuator(f,"Y:", 200, 0);
00060 fNy->SetNELength(3);
00061 fNy->SetLabelWidth(labelW);
00062 fNy->SetShowSlider(kFALSE);
00063 fNy->Build();
00064 fNy->SetLimits(1, 15);
00065 fNy->Connect("ValueSet(Double_t)",
00066 "TEveGridStepperSubEditor", this, "DoNs()");
00067 f->AddFrame(fNy, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00068
00069 fNz = new TEveGValuator(f,"Z:", 200, 0);
00070 fNz->SetNELength(3);
00071 fNz->SetLabelWidth(labelW);
00072 fNz->SetShowSlider(kFALSE);
00073 fNz->Build();
00074 fNz->SetLimits(1, 15);
00075 fNz->Connect("ValueSet(Double_t)",
00076 "TEveGridStepperSubEditor", this, "DoNs()");
00077 f->AddFrame(fNz, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00078
00079
00080 }
00081 {
00082 TGGroupFrame* f = new TGGroupFrame(hf, "Step", kVerticalFrame);
00083 f->SetWidth(130);
00084 hf->AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
00085
00086 fDx = new TEveGValuator(f,"X:", 200, 0);
00087 fDx->SetNELength(5);
00088 fDx->SetLabelWidth(labelW);
00089 fDx->SetShowSlider(kFALSE);
00090 fDx->Build();
00091 fDx->SetLimits(0.1, 100, 101, TGNumberFormat::kNESRealOne);
00092 fDx->Connect("ValueSet(Double_t)",
00093 "TEveGridStepperSubEditor", this, "DoDs()");
00094 f->AddFrame(fDx, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00095
00096 fDy = new TEveGValuator(f,"Y:", 200, 0);
00097 fDy->SetNELength(5);
00098 fDy->SetLabelWidth(labelW);
00099 fDy->SetShowSlider(kFALSE);
00100 fDy->Build();
00101 fDy->SetLimits(0.1, 100, 101, TGNumberFormat::kNESRealOne);
00102 fDy->Connect("ValueSet(Double_t)",
00103 "TEveGridStepperSubEditor", this, "DoDs()");
00104 f->AddFrame(fDy, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00105
00106 fDz = new TEveGValuator(f,"Z:", 200, 0);
00107 fDz->SetNELength(5);
00108 fDz->SetLabelWidth(labelW);
00109 fDz->SetShowSlider(kFALSE);
00110 fDz->Build();
00111 fDz->SetLimits(0.1, 100, 101, TGNumberFormat::kNESRealOne);
00112 fDz->Connect("ValueSet(Double_t)",
00113 "TEveGridStepperSubEditor", this, "DoDs()");
00114 f->AddFrame(fDz, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00115
00116
00117 }
00118 AddFrame(hf, new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
00119 }
00120
00121
00122 void TEveGridStepperSubEditor::SetModel(TEveGridStepper* m)
00123 {
00124
00125
00126 fM = m;
00127
00128 fNx->SetValue(fM->fNx);
00129 fNy->SetValue(fM->fNy);
00130 fNz->SetValue(fM->fNz);
00131
00132 fDx->SetValue(fM->fDx);
00133 fDy->SetValue(fM->fDy);
00134 fDz->SetValue(fM->fDz);
00135 }
00136
00137
00138 void TEveGridStepperSubEditor::Changed()
00139 {
00140
00141
00142 Emit("Changed()");
00143 }
00144
00145
00146 void TEveGridStepperSubEditor::DoNs()
00147 {
00148
00149
00150 fM->SetNs((Int_t)fNx->GetValue(), (Int_t)fNy->GetValue(), (Int_t)fNz->GetValue());
00151 Changed();
00152 }
00153
00154
00155 void TEveGridStepperSubEditor::DoDs()
00156 {
00157
00158
00159 fM->SetDs(fDx->GetValue(), fDy->GetValue(), fDz->GetValue());
00160 Changed();
00161 }
00162
00163
00164
00165
00166
00167
00168
00169 ClassImp(TEveGridStepperEditor)
00170
00171
00172 TEveGridStepperEditor::TEveGridStepperEditor(const TGWindow *p, Int_t width, Int_t height,
00173 UInt_t options, Pixel_t back) :
00174 TGedFrame(p, width, height, options | kVerticalFrame, back),
00175 fM (0),
00176 fSE (0)
00177 {
00178
00179
00180 MakeTitle("TEveGridStepper");
00181
00182 fSE = new TEveGridStepperSubEditor(this);
00183 AddFrame(fSE, new TGLayoutHints(kLHintsTop, 2, 0, 2, 2));
00184 fSE->Connect("Changed()", "TEveGridStepperEditor", this, "Update()");
00185 }
00186
00187
00188 void TEveGridStepperEditor::SetModel(TObject* obj)
00189 {
00190
00191
00192 fM = dynamic_cast<TEveGridStepper*>(obj);
00193 fSE->SetModel(fM);
00194 }