00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TEveProjectionAxesEditor.h"
00013 #include "TEveProjectionAxes.h"
00014 #include "TEveGValuators.h"
00015
00016 #include "TGComboBox.h"
00017 #include "TGButton.h"
00018 #include "TGLabel.h"
00019 #include "TG3DLine.h"
00020
00021
00022
00023
00024
00025 ClassImp(TEveProjectionAxesEditor);
00026
00027
00028 TEveProjectionAxesEditor::TEveProjectionAxesEditor(const TGWindow *p, Int_t width, Int_t height,
00029 UInt_t options, Pixel_t back) :
00030 TGedFrame(p, width, height, options | kVerticalFrame, back),
00031 fM(0),
00032
00033 fLabMode(0),
00034 fAxesMode(0),
00035
00036 fCenterFrame(0),
00037 fDrawCenter(0),
00038 fDrawOrigin(0)
00039 {
00040
00041
00042 MakeTitle("TEveProjectionAxis");
00043 Int_t labw=52;
00044
00045 {
00046 TGHorizontalFrame* f = new TGHorizontalFrame(this);
00047
00048 TGCompositeFrame *labfr = new TGHorizontalFrame(f, labw, 20, kFixedSize);
00049 labfr->AddFrame(new TGLabel(labfr, "Labels:") , new TGLayoutHints(kLHintsLeft | kLHintsBottom));
00050 f->AddFrame(labfr, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 0, 1, 1, 1));
00051
00052 fLabMode = new TGComboBox(f, "Position");
00053 fLabMode->AddEntry("Value", 1);
00054 fLabMode->AddEntry("Position", 0);
00055 fLabMode->GetTextEntry()->SetToolTipText("Set tick-marks on equidistant values/screen position.");
00056 TGListBox* lb = fLabMode->GetListBox();
00057 lb->Resize(lb->GetWidth(), 2*18);
00058 fLabMode->Resize(80, 20);
00059 fLabMode->Connect("Selected(Int_t)", "TEveProjectionAxesEditor", this, "DoLabMode(Int_t)");
00060 f->AddFrame(fLabMode, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00061 AddFrame(f);
00062 }
00063
00064 {
00065 TGHorizontalFrame* f = new TGHorizontalFrame(this);
00066 TGCompositeFrame *labfr = new TGHorizontalFrame(f, labw, 20, kFixedSize);
00067 labfr->AddFrame(new TGLabel(labfr, "Axes:") , new TGLayoutHints(kLHintsLeft | kLHintsBottom));
00068 f->AddFrame(labfr, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 0, 1, 1, 1));
00069
00070
00071 fAxesMode = new TGComboBox(f, "All");
00072 fAxesMode->AddEntry("Horizontal", TEveProjectionAxes::kHorizontal);
00073 fAxesMode->AddEntry("Vertical",TEveProjectionAxes::kVertical);
00074 fAxesMode->AddEntry("All", TEveProjectionAxes::kAll);
00075 TGListBox* lb = fAxesMode->GetListBox();
00076 lb->Resize(lb->GetWidth(), 2*18);
00077 fAxesMode->Resize(80, 20);
00078 fAxesMode->Connect("Selected(Int_t)", "TEveProjectionAxesEditor", this, "DoAxesMode(Int_t)");
00079 f->AddFrame(fAxesMode, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00080 AddFrame(f);
00081 }
00082
00083
00084
00085
00086 fCenterFrame = CreateEditorTabSubFrame("Center");
00087
00088 TGCompositeFrame *title1 = new TGCompositeFrame(fCenterFrame, 180, 10,
00089 kHorizontalFrame |
00090 kLHintsExpandX |
00091 kFixedWidth |
00092 kOwnBackground);
00093 title1->AddFrame(new TGLabel(title1, "Distortion Center"),
00094 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00095 title1->AddFrame(new TGHorizontal3DLine(title1),
00096 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
00097 fCenterFrame->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
00098
00099
00100 {
00101
00102 TGHorizontalFrame* hf1 = new TGHorizontalFrame(fCenterFrame);
00103
00104 fDrawOrigin = new TGCheckButton(hf1, "DrawOrigin");
00105 hf1->AddFrame(fDrawOrigin, new TGLayoutHints(kLHintsLeft, 2,1,0,4));
00106 fDrawOrigin->Connect("Toggled(Bool_t)"," TEveProjectionAxesEditor", this, "DoDrawOrigin()");
00107
00108
00109 fDrawCenter = new TGCheckButton(hf1, "DrawCenter");
00110 hf1->AddFrame(fDrawCenter, new TGLayoutHints(kLHintsLeft, 2,1,0,4));
00111 fDrawCenter->Connect("Toggled(Bool_t)"," TEveProjectionAxesEditor", this, "DoDrawCenter()");
00112
00113 fCenterFrame->AddFrame(hf1, new TGLayoutHints(kLHintsTop, 0,0,0,0));
00114
00115 }
00116 }
00117
00118
00119
00120
00121 void TEveProjectionAxesEditor::SetModel(TObject* obj)
00122 {
00123
00124
00125 fM = dynamic_cast<TEveProjectionAxes*>(obj);
00126
00127 fLabMode->Select(fM->GetLabMode(), kFALSE);
00128 fAxesMode->Select(fM->GetAxesMode(), kFALSE);
00129 fDrawCenter->SetState(fM->GetDrawCenter() ? kButtonDown : kButtonUp);
00130 fDrawOrigin->SetState(fM->GetDrawOrigin() ? kButtonDown : kButtonUp);
00131
00132 }
00133
00134
00135 void TEveProjectionAxesEditor::DoDrawOrigin()
00136 {
00137
00138
00139 fM->SetDrawOrigin(fDrawOrigin->IsOn());
00140 Update();
00141 }
00142
00143
00144 void TEveProjectionAxesEditor::DoDrawCenter()
00145 {
00146
00147
00148 fM->SetDrawCenter(fDrawCenter->IsOn());
00149 Update();
00150 }
00151
00152
00153 void TEveProjectionAxesEditor::DoLabMode(Int_t mode)
00154 {
00155
00156
00157 TEveProjectionAxes::ELabMode em = (TEveProjectionAxes::ELabMode ) mode;
00158 fM->SetLabMode(em);
00159 Update();
00160 }
00161
00162
00163 void TEveProjectionAxesEditor::DoAxesMode(Int_t mode)
00164 {
00165
00166
00167 TEveProjectionAxes::EAxesMode em = (TEveProjectionAxes::EAxesMode ) mode;
00168 fM->SetAxesMode(em);
00169 Update();
00170 }