34 ClassImp(TEveTextEditor);
39 TEveTextEditor::TEveTextEditor(
const TGWindow *p, Int_t width, Int_t height,
40 UInt_t options, Pixel_t back) :
41 TGedFrame(p, width, height, options | kVerticalFrame, back),
52 MakeTitle(
"TEveText");
55 fText =
new TGTextEntry(
this);
56 fText->Resize(135, fText->GetDefaultHeight());
57 AddFrame(fText,
new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
58 fText->Connect(
"TextChanged(const char *)",
"TEveTextEditor",
this,
"DoText(const char *)");
61 fSize = MakeLabeledCombo(
"Size:");
62 Int_t* fsp = &TGLFontManager::GetFontSizeArray()->front();
63 Int_t nums = TGLFontManager::GetFontSizeArray()->size();
64 for(Int_t i= 0; i< nums; i++)
66 fSize->AddEntry(Form(
"%-2d", fsp[i]), fsp[i]);
68 fSize->Connect(
"Selected(Int_t)",
"TEveTextEditor",
this,
"DoFontSize()");
71 fFile = MakeLabeledCombo(
"File:");
72 TObjArray* farr = TGLFontManager::GetFontFileArray();
76 while ((os = (TObjString*) next()) != 0)
78 fFile->AddEntry(Form(
"%s", os->GetString().Data()), cnt);
81 fFile->Connect(
"Selected(Int_t)",
"TEveTextEditor",
this,
"DoFontFile()");
84 fMode = MakeLabeledCombo(
"Mode:");
85 fMode->AddEntry(
"Bitmap", TGLFont::kBitmap);
86 fMode->AddEntry(
"Pixmap", TGLFont::kPixmap);
87 fMode->AddEntry(
"Texture", TGLFont::kTexture);
88 fMode->AddEntry(
"Outline", TGLFont::kOutline);
89 fMode->AddEntry(
"Polygon", TGLFont::kPolygon);
90 fMode->AddEntry(
"Extrude", TGLFont::kExtrude);
91 fMode->Connect(
"Selected(Int_t)",
"TEveTextEditor",
this,
"DoFontMode()");
93 fExtrude =
new TEveGValuator(
this,
"Depth:", 90, 0);
94 fExtrude->SetLabelWidth(45);
95 fExtrude->SetNELength(5);
98 fExtrude->SetLimits(0.01, 10, 100, TGNumberFormat::kNESRealTwo);
99 fExtrude->SetToolTip(
"Extrusion depth.");
100 fExtrude->Connect(
"ValueSet(Double_t)",
"TEveTextEditor",
this,
"DoExtrude()");
101 AddFrame(fExtrude,
new TGLayoutHints(kLHintsTop, 4, 1, 1, 1));
104 TGCompositeFrame *f1 =
new TGCompositeFrame(
this, 145, 10, kHorizontalFrame | kFitWidth | kFixedWidth );
105 f1->AddFrame(
new TGLabel(f1,
"GLConfig"),
new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
106 f1->AddFrame(
new TGHorizontal3DLine(f1),
new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
107 AddFrame(f1,
new TGLayoutHints(kLHintsTop, 0, 0, 8, 0));
109 TGCompositeFrame *alf =
new TGCompositeFrame(
this, 145, 10, kHorizontalFrame );
110 fAutoLighting =
new TGCheckButton(alf,
"AutoLighting");
111 alf->AddFrame(fAutoLighting,
new TGLayoutHints(kLHintsLeft, 1,2,0,0));
112 fAutoLighting->Connect(
"Toggled(Bool_t)",
"TEveTextEditor",
this,
"DoAutoLighting()");
113 fLighting =
new TGCheckButton(alf,
"Lighting");
114 alf->AddFrame(fLighting,
new TGLayoutHints(kLHintsLeft, 1,2,0,0));
115 fLighting->Connect(
"Toggled(Bool_t)",
"TEveTextEditor",
this,
"DoLighting()");
116 AddFrame(alf,
new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
122 TGComboBox* TEveTextEditor::MakeLabeledCombo(
const char* name)
126 TGHorizontalFrame* hf =
new TGHorizontalFrame(
this);
128 TGCompositeFrame *labfr =
new TGHorizontalFrame(hf, labelW, labelH, kFixedSize);
129 TGLabel* label =
new TGLabel(labfr, name);
130 labfr->AddFrame(label,
new TGLayoutHints(kLHintsLeft | kLHintsBottom));
131 hf->AddFrame(labfr,
new TGLayoutHints(kLHintsLeft));
133 TGLayoutHints* clh =
new TGLayoutHints(kLHintsLeft, 0,0,0,0);
134 TGComboBox* combo =
new TGComboBox(hf);
135 combo->Resize(90, 20);
136 hf->AddFrame(combo, clh);
138 AddFrame(hf,
new TGLayoutHints(kLHintsTop, 4, 1, 1, 1));
145 void TEveTextEditor::SetModel(TObject* obj)
147 fM =
dynamic_cast<TEveText*
>(obj);
148 if (strcmp(fM->GetText(), fText->GetText()))
149 fText->SetText(fM->GetText());
151 fSize->Select(fM->GetFontSize(), kFALSE);
152 fFile->Select(fM->GetFontFile(), kFALSE);
155 fMode->Select(fM->GetFontMode(), kFALSE);
158 fAutoLighting->SetState(fM->GetAutoLighting() ? kButtonDown : kButtonUp);
159 if (fM->GetAutoLighting()) {
160 fLighting->SetDisabledAndSelected(fM->GetLighting() ? kButtonDown : kButtonUp);
162 fLighting->SetEnabled();
163 fLighting->SetState(fM->GetLighting() ? kButtonDown : kButtonUp);
167 if (fM->GetFontMode() == TGLFont::kExtrude)
170 fExtrude->SetValue(fM->GetExtrude());
181 void TEveTextEditor::DoText(
const char* )
183 fM->SetText(fText->GetText());
190 void TEveTextEditor::DoFontSize()
192 fM->SetFontSize(fSize->GetSelected(), kFALSE);
199 void TEveTextEditor::DoFontFile()
201 fM->SetFontFile(fFile->GetSelected());
207 void TEveTextEditor::DoFontMode()
209 fM->SetFontMode(fMode->GetSelected());
216 void TEveTextEditor::DoExtrude()
218 fM->SetExtrude(fExtrude->GetValue());
225 void TEveTextEditor::DoAutoLighting()
227 fM->SetAutoLighting(fAutoLighting->IsOn());
234 void TEveTextEditor::DoLighting()
236 fM->SetLighting(fLighting->IsOn());