00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TParallelCoordEditor.h"
00013 #include "TParallelCoord.h"
00014 #include "TParallelCoordRange.h"
00015 #include "TParallelCoordVar.h"
00016
00017 #include "TGFrame.h"
00018 #include "TGButton.h"
00019 #include "TGButtonGroup.h"
00020 #include "TGNumberEntry.h"
00021 #include "TGLabel.h"
00022 #include "TGTextEntry.h"
00023 #include "TGComboBox.h"
00024 #include "TGColorSelect.h"
00025 #include "TColor.h"
00026 #include "TG3DLine.h"
00027 #include "TGSlider.h"
00028 #include "TGComboBox.h"
00029 #include "TGDoubleSlider.h"
00030 #include "TTree.h"
00031 #include "TGListBox.h"
00032 #include "TGedPatternSelect.h"
00033
00034 #include "Riostream.h"
00035
00036 ClassImp(TParallelCoordEditor)
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 enum EParallelWid {
00061 kGlobalLineColor,
00062 kLineTypeBgroup,
00063 kLineTypePoly,
00064 kLineTypeCurves,
00065 kGlobalLineWidth,
00066 kDotsSpacing,
00067 kDotsSpacingField,
00068 kSelectionSelect,
00069 kSelectLineColor,
00070 kSelectLineWidth,
00071 kActivateSelection,
00072 kDeleteSelection,
00073 kAddSelection,
00074 kAddSelectionEntry,
00075 kShowRanges,
00076 kPaintEntries,
00077 kEntriesToDraw,
00078 kFirstEntry,
00079 kNentries,
00080 kApplySelect,
00081 kUnApply,
00082 kDelayDrawing,
00083 kHideAllRanges,
00084 kVariables,
00085 kDeleteVar,
00086 kHistHeight,
00087 kHistWidth,
00088 kHistBinning,
00089 kRenameVar,
00090 kWeightCut,
00091 kHistColorSelect,
00092 kHistPatternSelect
00093 };
00094
00095
00096 TParallelCoordEditor::TParallelCoordEditor(const TGWindow* ,
00097 Int_t, Int_t ,
00098 UInt_t , Pixel_t )
00099 {
00100
00101
00102 fPriority = 1;
00103 fDelay = kTRUE;
00104
00105
00106 MakeTitle("Line");
00107
00108 TGHorizontalFrame *f1 = new TGHorizontalFrame(this);
00109 fGlobalLineColor = new TGColorSelect(f1,0,kGlobalLineColor);
00110 f1->AddFrame(fGlobalLineColor,new TGLayoutHints(kLHintsLeft | kLHintsTop));
00111 fGlobalLineWidth = new TGLineWidthComboBox(f1, kGlobalLineWidth);
00112 fGlobalLineWidth->Resize(91, 20);
00113 f1->AddFrame(fGlobalLineWidth, new TGLayoutHints(kLHintsLeft, 3, 1, 1, 1));
00114 AddFrame(f1, new TGLayoutHints(kLHintsLeft | kLHintsTop));
00115
00116 AddFrame(new TGLabel(this,"Dots spacing"),
00117 new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
00118
00119 TGHorizontalFrame *f2 = new TGHorizontalFrame(this);
00120 fDotsSpacing = new TGHSlider(f2,100,kSlider1|kScaleBoth,kDotsSpacing);
00121 fDotsSpacing->SetRange(0,60);
00122 f2->AddFrame(fDotsSpacing,new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
00123 fDotsSpacingField = new TGNumberEntryField(f2, kDotsSpacingField, 0,
00124 TGNumberFormat::kNESInteger,
00125 TGNumberFormat::kNEANonNegative);
00126 fDotsSpacingField->Resize(40,20);
00127 f2->AddFrame(fDotsSpacingField,new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
00128 AddFrame(f2, new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
00129
00130 fLineTypeBgroup = new TGButtonGroup(this,2,1,0,0, "Line type");
00131 fLineTypeBgroup->SetRadioButtonExclusive(kTRUE);
00132 fLineTypePoly = new TGRadioButton(fLineTypeBgroup,"Polyline", kLineTypePoly);
00133 fLineTypePoly->SetToolTipText("Draw the entries with a polyline");
00134 fLineTypeCurves = new TGRadioButton(fLineTypeBgroup,"Curves",
00135 kLineTypeCurves);
00136 fLineTypeCurves->SetToolTipText("Draw the entries with a curve");
00137 fLineTypeBgroup->ChangeOptions(kChildFrame|kVerticalFrame);
00138 AddFrame(fLineTypeBgroup, new TGLayoutHints(kLHintsCenterY | kLHintsLeft));
00139
00140
00141 MakeTitle("Selections");
00142
00143 fHideAllRanges = new TGCheckButton(this,"Hide all ranges",kHideAllRanges);
00144 AddFrame(fHideAllRanges);
00145
00146 fSelectionSelect = new TGComboBox(this,kSelectionSelect);
00147 fSelectionSelect->Resize(140,20);
00148 AddFrame(fSelectionSelect, new TGLayoutHints(kLHintsCenterY | kLHintsLeft,0,0,3,0));
00149
00150 TGHorizontalFrame *f3 = new TGHorizontalFrame(this);
00151 fSelectLineColor = new TGColorSelect(f3,0,kSelectLineColor);
00152 f3->AddFrame(fSelectLineColor,new TGLayoutHints(kLHintsLeft | kLHintsTop));
00153 fSelectLineWidth = new TGLineWidthComboBox(f3, kSelectLineWidth);
00154 fSelectLineWidth->Resize(94, 20);
00155 f3->AddFrame(fSelectLineWidth, new TGLayoutHints(kLHintsLeft, 3, 1, 1, 1));
00156 AddFrame(f3, new TGLayoutHints(kLHintsLeft | kLHintsTop,0,0,3,0));
00157
00158 fActivateSelection = new TGCheckButton(this,"Activate",kActivateSelection);
00159 fActivateSelection->SetToolTipText("Activate the current selection");
00160 AddFrame(fActivateSelection);
00161 fShowRanges = new TGCheckButton(this,"Show ranges",kShowRanges);
00162 AddFrame(fShowRanges);
00163
00164 TGHorizontalFrame *f5 = new TGHorizontalFrame(this);
00165 fAddSelectionField = new TGTextEntry(f5);
00166 fAddSelectionField->Resize(57,20);
00167 f5->AddFrame(fAddSelectionField, new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
00168 fAddSelection = new TGTextButton(f5,"Add");
00169 fAddSelection->SetToolTipText("Add a new selection (Right click on the axes to add a range).");
00170 f5->AddFrame(fAddSelection, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,3,0,0,0));
00171 fDeleteSelection = new TGTextButton(f5,"Delete",kDeleteSelection);
00172 fDeleteSelection->SetToolTipText("Delete the current selection");
00173 f5->AddFrame(fDeleteSelection, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,3,0,0,0));
00174 AddFrame(f5, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,3,0,0,0));
00175
00176 TGHorizontalFrame *f7 = new TGHorizontalFrame(this);
00177 fApplySelect = new TGTextButton(f7,"Apply to tree",kApplySelect);
00178 fApplySelect->SetToolTipText("Generate an entry list for the current selection and apply it to the tree.");
00179 f7->AddFrame(fApplySelect);
00180 fUnApply = new TGTextButton(f7,"Reset tree",kUnApply);
00181 fUnApply->SetToolTipText("Reset the tree entry list");
00182 f7->AddFrame(fUnApply, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,10,0,0,0));
00183 AddFrame(f7, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,0,0,3,0));
00184
00185
00186 MakeTitle("Entries");
00187
00188 fPaintEntries = new TGCheckButton(this,"Draw entries",kPaintEntries);
00189 AddFrame(fPaintEntries);
00190 fDelayDrawing = new TGCheckButton(this,"Delay Drawing", kDelayDrawing);
00191 AddFrame(fDelayDrawing);
00192
00193 fEntriesToDraw = new TGDoubleHSlider(this,140,kDoubleScaleBoth,kEntriesToDraw);
00194 AddFrame(fEntriesToDraw);
00195
00196 TGHorizontalFrame *f6 = new TGHorizontalFrame(this);
00197 TGVerticalFrame *v1 = new TGVerticalFrame(f6);
00198 TGVerticalFrame *v2 = new TGVerticalFrame(f6);
00199 v1->AddFrame(new TGLabel(v1,"First entry:"));
00200 fFirstEntry = new TGNumberEntryField(v1, kFirstEntry, 0,
00201 TGNumberFormat::kNESInteger,
00202 TGNumberFormat::kNEANonNegative);
00203 fFirstEntry->Resize(68,20);
00204 v1->AddFrame(fFirstEntry);
00205 v2->AddFrame(new TGLabel(v2,"# of entries:"));
00206 fNentries = new TGNumberEntryField(v2, kFirstEntry, 0,
00207 TGNumberFormat::kNESInteger,
00208 TGNumberFormat::kNEANonNegative);
00209 fNentries->Resize(68,20);
00210 v2->AddFrame(fNentries);
00211 f6->AddFrame(v1);
00212 f6->AddFrame(v2, new TGLayoutHints(kLHintsLeft,4,0,0,0));
00213 AddFrame(f6);
00214
00215 AddFrame(new TGLabel(this,"Weight cut:"));
00216
00217 TGHorizontalFrame *f8 = new TGHorizontalFrame(this);
00218 fWeightCut = new TGHSlider(f8,100,kSlider1|kScaleBoth,kDotsSpacing);
00219 fWeightCutField = new TGNumberEntryField(f8,kDotsSpacingField, 0,
00220 TGNumberFormat::kNESInteger,
00221 TGNumberFormat::kNEANonNegative);
00222 fWeightCutField->Resize(40,20);
00223 f8->AddFrame(fWeightCut);
00224 f8->AddFrame(fWeightCutField);
00225 AddFrame(f8);
00226
00227 MakeVariablesTab();
00228 }
00229
00230
00231
00232 void TParallelCoordEditor::MakeVariablesTab()
00233 {
00234
00235
00236 fVarTab = CreateEditorTabSubFrame("Variables");
00237
00238
00239 TGHorizontalFrame *f9 = new TGHorizontalFrame(fVarTab);
00240 fAddVariable = new TGTextEntry(f9);
00241 fAddVariable->Resize(71,20);
00242 f9->AddFrame(fAddVariable, new TGLayoutHints(kLHintsCenterY));
00243 fButtonAddVar = new TGTextButton(f9,"Add");
00244 fButtonAddVar->SetToolTipText("Add a new variable from the tree (must be a valid expression).");
00245 f9->AddFrame(fButtonAddVar, new TGLayoutHints(kLHintsCenterY,4,0,0,0));
00246 fVarTab->AddFrame(f9);
00247
00248 TGHorizontalFrame *f10 = new TGHorizontalFrame(fVarTab);
00249 fVariables = new TGComboBox(f10,kVariables);
00250 fVariables->Resize(105,20);
00251 f10->AddFrame(fVariables, new TGLayoutHints(kLHintsCenterY));
00252 fVarTab->AddFrame(f10,new TGLayoutHints(kLHintsLeft,0,0,2,0));
00253
00254 TGHorizontalFrame *f12 = new TGHorizontalFrame(fVarTab);
00255 fDeleteVar = new TGTextButton(f12,"Delete",kDeleteVar);
00256 fDeleteVar->SetToolTipText("Delete the current selected variable");
00257 f12->AddFrame(fDeleteVar, new TGLayoutHints(kLHintsCenterY,1,0,0,0));
00258 fRenameVar = new TGTextButton(f12,"Rename",kRenameVar);
00259 fRenameVar->SetToolTipText("Rename the current selected variable");
00260 f12->AddFrame(fRenameVar, new TGLayoutHints(kLHintsCenterY,4,0,0,0));
00261 fVarTab->AddFrame(f12,new TGLayoutHints(kLHintsLeft,0,0,2,0));
00262
00263 fVarTab->AddFrame(new TGLabel(fVarTab,"Axis histograms:"));
00264
00265 TGHorizontalFrame *f11 = new TGHorizontalFrame(fVarTab);
00266 TGVerticalFrame *v3 = new TGVerticalFrame(f11);
00267 TGVerticalFrame *v4 = new TGVerticalFrame(f11);
00268 v3->AddFrame(new TGLabel(v3,"Binning:"));
00269 fHistBinning = new TGNumberEntryField(v3, kHistWidth, 0,
00270 TGNumberFormat::kNESInteger,
00271 TGNumberFormat::kNEANonNegative);
00272 fHistBinning->Resize(68,20);
00273 v3->AddFrame(fHistBinning);
00274 v4->AddFrame(new TGLabel(v4,"Width:"));
00275 fHistWidth = new TGNumberEntryField(v4, kHistWidth, 0,
00276 TGNumberFormat::kNESInteger,
00277 TGNumberFormat::kNEANonNegative);
00278 fHistWidth->Resize(68,20);
00279 v4->AddFrame(fHistWidth, new TGLayoutHints(kLHintsLeft,4,0,0,0));
00280 f11->AddFrame(v3);
00281 f11->AddFrame(v4);
00282 fVarTab->AddFrame(f11);
00283
00284 fHistShowBoxes = new TGCheckButton(fVarTab,"Show box histograms");
00285 fVarTab->AddFrame(fHistShowBoxes);
00286
00287 fVarTab->AddFrame(new TGLabel(fVarTab,"Bar histograms style:"));
00288
00289 TGCompositeFrame *f13 = new TGCompositeFrame(fVarTab, 80, 20, kHorizontalFrame);
00290 fHistColorSelect = new TGColorSelect(f13, 0, kHistColorSelect);
00291 f13->AddFrame(fHistColorSelect, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
00292 fHistColorSelect->Associate(this);
00293 fHistPatternSelect = new TGedPatternSelect(f13, 1, kHistPatternSelect);
00294 f13->AddFrame(fHistPatternSelect, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
00295 fHistPatternSelect->Associate(this);
00296 fVarTab->AddFrame(f13, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
00297 }
00298
00299
00300
00301 TParallelCoordEditor::~TParallelCoordEditor()
00302 {
00303
00304
00305 delete fLineTypePoly;
00306 delete fLineTypeCurves;
00307 }
00308
00309
00310
00311 void TParallelCoordEditor::CleanUpSelections()
00312 {
00313
00314
00315 TList *list = fParallel->GetSelectList();
00316 fSelectionSelect->RemoveAll();
00317 Bool_t enable = list->GetSize() > 0;
00318 fSelectionSelect->SetEnabled(enable);
00319 fSelectLineColor->SetEnabled(enable);
00320 fSelectLineWidth->SetEnabled(enable);
00321 fActivateSelection->SetEnabled(enable);
00322 fShowRanges->SetEnabled(enable);
00323 fDeleteSelection->SetEnabled(enable);
00324 if (list->GetSize() > 0) {
00325 Int_t i = 0;
00326 TIter next(list);
00327 TParallelCoordSelect* sel;
00328 while ((sel = (TParallelCoordSelect*)next())) {
00329 fSelectionSelect->AddEntry(sel->GetTitle(),i);
00330 fSelectionSelect->GetListBox()->GetEntry(i)->SetBackgroundColor(TColor::Number2Pixel(sel->GetLineColor()));
00331 ++i;
00332 }
00333 sel = fParallel->GetCurrentSelection();
00334 fSelectionSelect->Select(list->IndexOf(sel),kFALSE);
00335 Color_t c;
00336 Pixel_t p;
00337 c = sel->GetLineColor();
00338 p = TColor::Number2Pixel(c);
00339 fSelectLineColor->SetColor(p);
00340 fSelectLineWidth->Select(sel->GetLineWidth());
00341 fActivateSelection->SetOn(sel->TestBit(TParallelCoordSelect::kActivated));
00342 fShowRanges->SetOn(sel->TestBit(TParallelCoordSelect::kShowRanges));
00343 }
00344 }
00345
00346
00347
00348 void TParallelCoordEditor::CleanUpVariables()
00349 {
00350
00351
00352 TList *list = fParallel->GetVarList();
00353 fVariables->RemoveAll();
00354 Bool_t enable = list->GetSize() > 0;
00355 fVariables->SetEnabled(enable);
00356 fDeleteVar->SetEnabled(enable);
00357 fHistShowBoxes->SetEnabled(enable);
00358 fHistWidth->SetEnabled(enable);
00359 fHistBinning->SetEnabled(enable);
00360 if (list->GetSize() > 0) {
00361 Int_t i = 0;
00362 TIter next(list);
00363 TParallelCoordVar* var;
00364 while ((var = (TParallelCoordVar*)next())) {
00365 fVariables->AddEntry(var->GetTitle(),i);
00366 ++i;
00367 }
00368 var = (TParallelCoordVar*)list->First();
00369 fVariables->Select(0,kFALSE);
00370 fHistShowBoxes->SetOn(var->TestBit(TParallelCoordVar::kShowBarHisto));
00371 fHistWidth->SetNumber(var->GetHistLineWidth());
00372 fHistBinning->SetNumber(var->GetHistBinning());
00373 }
00374 }
00375
00376
00377
00378 void TParallelCoordEditor::ConnectSignals2Slots()
00379 {
00380
00381
00382 fGlobalLineColor->Connect("ColorSelected(Pixel_t)","TParallelCoordEditor",
00383 this, "DoGlobalLineColor(Pixel_t)");
00384 fGlobalLineWidth->Connect("Selected(Int_t)","TParallelCoordEditor",
00385 this, "DoGlobalLineWidth(Int_t)");
00386 fDotsSpacing->Connect("Released()","TParallelCoordEditor",
00387 this, "DoDotsSpacing()");
00388 fDotsSpacing->Connect("PositionChanged(Int_t)","TParallelCoordEditor",
00389 this, "DoLiveDotsSpacing(Int_t)");
00390 fDotsSpacingField->Connect("ReturnPressed()","TParallelCoordEditor",
00391 this, "DoDotsSpacingField()");
00392 fLineTypeBgroup->Connect("Clicked(Int_t)", "TParallelCoordEditor",
00393 this, "DoLineType()");
00394 fSelectionSelect->Connect("Selected(const char*)","TParallelCoordEditor",
00395 this, "DoSelectionSelect(const char*)");
00396 fSelectLineColor->Connect("ColorSelected(Pixel_t)","TParallelCoordEditor",
00397 this, "DoSelectLineColor(Pixel_t)");
00398 fSelectLineWidth->Connect("Selected(Int_t)","TParallelCoordEditor",
00399 this, "DoSelectLineWidth(Int_t)");
00400 fActivateSelection->Connect("Toggled(Bool_t)","TParallelCoordEditor",
00401 this, "DoActivateSelection(Bool_t)");
00402 fShowRanges->Connect("Toggled(Bool_t)","TParallelCoordEditor",
00403 this, "DoShowRanges(Bool_t)");
00404 fDeleteSelection->Connect("Clicked()","TParallelCoordEditor",
00405 this, "DoDeleteSelection()");
00406 fAddSelection->Connect("Clicked()","TParallelCoordEditor",
00407 this, "DoAddSelection()");
00408 fPaintEntries->Connect("Toggled(Bool_t)","TParallelCoordEditor",
00409 this, "DoPaintEntries(Bool_t)");
00410 fEntriesToDraw->Connect("Released()","TParallelCoordEditor",
00411 this, "DoEntriesToDraw()");
00412 fEntriesToDraw->Connect("PositionChanged()","TParallelCoordEditor",
00413 this, "DoLiveEntriesToDraw()");
00414 fFirstEntry->Connect("ReturnPressed()","TParallelCoordEditor",
00415 this, "DoFirstEntry()");
00416 fNentries->Connect("ReturnPressed()","TParallelCoordEditor",
00417 this, "DoNentries()");
00418 fApplySelect->Connect("Clicked()","TParallelCoordEditor",
00419 this, "DoApplySelect()");
00420 fUnApply->Connect("Clicked()","TParallelCoordEditor",
00421 this, "DoUnApply()");
00422 fDelayDrawing->Connect("Toggled(Bool_t)","TParallelCoordEditor",
00423 this, "DoDelayDrawing(Bool_t)");
00424 fAddVariable->Connect("ReturnPressed()","TParallelCoordEditor",
00425 this, "DoAddVariable()");
00426 fButtonAddVar->Connect("Clicked()","TParallelCoordEditor",
00427 this, "DoAddVariable()");
00428 fHideAllRanges->Connect("Toggled(Bool_t)","TParallelCoordEditor",
00429 this, "DoHideAllRanges(Bool_t)");
00430 fVariables->Connect("Selected(const char*)","TParallelCoordEditor",
00431 this, "DoVariableSelect(const char*)");
00432 fDeleteVar->Connect("Clicked()","TParallelCoordEditor",
00433 this, "DoDeleteVar()");
00434 fHistWidth->Connect("ReturnPressed()","TParallelCoordEditor",
00435 this, "DoHistWidth()");
00436 fHistBinning->Connect("ReturnPressed()","TParallelCoordEditor",
00437 this, "DoHistBinning()");
00438 fWeightCut->Connect("Released()","TParallelCoordEditor",
00439 this, "DoWeightCut()");
00440 fWeightCut->Connect("PositionChanged(Int_t)","TParallelCoordEditor",
00441 this, "DoLiveWeightCut(Int_t)");
00442 fWeightCutField->Connect("ReturnPressed()","TParallelCoordEditor",
00443 this, "DoWeightCut()");
00444 fHistColorSelect->Connect("ColorSelected(Pixel_t)", "TParallelCoordEditor",
00445 this, "DoHistColorSelect(Pixel_t)");
00446 fHistPatternSelect->Connect("PatternSelected(Style_t)", "TParallelCoordEditor",
00447 this, "DoHistPatternSelect(Style_t)");
00448 fHistShowBoxes->Connect("Toggled(Bool_t)","TParallelCoordEditor",
00449 this, "DoHistShowBoxes(Bool_t)");
00450
00451 fInit = kFALSE;
00452 }
00453
00454
00455
00456 void TParallelCoordEditor::DoActivateSelection(Bool_t on)
00457 {
00458
00459
00460 if (fAvoidSignal) return;
00461
00462 fParallel->GetCurrentSelection()->SetActivated(on);
00463 Update();
00464 }
00465
00466
00467
00468 void TParallelCoordEditor::DoAddSelection()
00469 {
00470
00471
00472 TString title = fAddSelectionField->GetText();
00473 if(title == "") title = "Selection";
00474 TString titlebis = title;
00475 Bool_t found = kTRUE;
00476 Int_t i=1;
00477 while (found){
00478 if(fSelectionSelect->FindEntry(titlebis)) {
00479 titlebis = title;
00480 titlebis.Append(Form("(%d)",i));
00481 }
00482 else found = kFALSE;
00483 ++i;
00484 }
00485
00486 fParallel->AddSelection(titlebis.Data());
00487
00488 CleanUpSelections();
00489 }
00490
00491
00492
00493 void TParallelCoordEditor::DoAddVariable()
00494 {
00495
00496
00497 if (fAvoidSignal) return;
00498
00499 fParallel->AddVariable(fAddVariable->GetText());
00500 CleanUpVariables();
00501 Update();
00502 }
00503
00504
00505
00506 void TParallelCoordEditor::DoApplySelect()
00507 {
00508
00509
00510
00511
00512
00513 if (fAvoidSignal) return;
00514
00515 fParallel->ApplySelectionToTree();
00516 Update();
00517 SetModel(fParallel);
00518 }
00519
00520
00521
00522 void TParallelCoordEditor::DoDelayDrawing(Bool_t on)
00523 {
00524
00525
00526 if (fAvoidSignal) return;
00527
00528 fDelay = on;
00529 fParallel->SetLiveRangesUpdate(!on);
00530 }
00531
00532
00533
00534 void TParallelCoordEditor::DoDeleteSelection()
00535 {
00536
00537
00538 if (fAvoidSignal) return;
00539
00540 fParallel->DeleteSelection(fParallel->GetCurrentSelection());
00541
00542 CleanUpSelections();
00543 Update();
00544 }
00545
00546
00547
00548 void TParallelCoordEditor::DoDeleteVar()
00549 {
00550
00551
00552 if (fAvoidSignal) return;
00553
00554 TParallelCoordVar* var = fParallel->RemoveVariable(((TGTextLBEntry*)fVariables->GetSelectedEntry())->GetTitle());
00555 CleanUpVariables();
00556 if(var) Update();
00557 }
00558
00559
00560
00561 void TParallelCoordEditor::DoDotsSpacing()
00562 {
00563
00564
00565 if (fAvoidSignal) return;
00566
00567 fParallel->SetDotsSpacing(fDotsSpacing->GetPosition());
00568 fDotsSpacingField->SetNumber((Int_t)fDotsSpacing->GetPosition());
00569 Update();
00570 }
00571
00572
00573
00574 void TParallelCoordEditor::DoDotsSpacingField()
00575 {
00576
00577
00578 if (fAvoidSignal) return;
00579
00580 fParallel->SetDotsSpacing((Int_t)fDotsSpacingField->GetNumber());
00581 fDotsSpacing->SetPosition((Int_t)fDotsSpacingField->GetNumber());
00582 Update();
00583 }
00584
00585
00586
00587 void TParallelCoordEditor::DoEntriesToDraw()
00588 {
00589
00590
00591 if (fAvoidSignal) return;
00592
00593 Long64_t nentries,firstentry;
00594 firstentry = (Long64_t)fEntriesToDraw->GetMinPosition();
00595 nentries = (Long64_t)(fEntriesToDraw->GetMaxPosition() - fEntriesToDraw->GetMinPosition() + 1);
00596
00597 fParallel->SetCurrentFirst(firstentry);
00598 fParallel->SetCurrentN(nentries);
00599 Update();
00600 }
00601
00602
00603
00604 void TParallelCoordEditor::DoFirstEntry()
00605 {
00606
00607
00608 if (fAvoidSignal) return;
00609
00610 fParallel->SetCurrentFirst((Long64_t)fFirstEntry->GetNumber());
00611 fEntriesToDraw->SetPosition((Long64_t)fFirstEntry->GetNumber(),(Long64_t)fFirstEntry->GetNumber()+fParallel->GetCurrentN());
00612 Update();
00613 }
00614
00615
00616
00617 void TParallelCoordEditor::DoGlobalLineColor(Pixel_t a)
00618 {
00619
00620
00621 if (fAvoidSignal) return;
00622
00623 fParallel->SetLineColor(TColor::GetColor(a));
00624 Update();
00625 }
00626
00627
00628
00629 void TParallelCoordEditor::DoGlobalLineWidth(Int_t wid)
00630 {
00631
00632
00633 if (fAvoidSignal) return;
00634
00635 fParallel->SetLineWidth(wid);
00636 Update();
00637 }
00638
00639
00640
00641 void TParallelCoordEditor::DoHideAllRanges(Bool_t on)
00642 {
00643
00644
00645 if (fAvoidSignal) return;
00646
00647 TIter next(fParallel->GetSelectList());
00648 TParallelCoordSelect* sel;
00649 while((sel = (TParallelCoordSelect*)next())) sel->SetShowRanges(!on);
00650 fShowRanges->SetOn(!on);
00651 fShowRanges->SetEnabled(!on);
00652 fShowRanges->SetOn(!on);
00653 Update();
00654 }
00655
00656
00657
00658 void TParallelCoordEditor::DoHistBinning()
00659 {
00660
00661
00662 if (fAvoidSignal) return;
00663
00664 fParallel->SetAxisHistogramBinning((Int_t)fHistBinning->GetNumber());
00665 Update();
00666 }
00667
00668
00669
00670 void TParallelCoordEditor::DoHistColorSelect(Pixel_t p)
00671 {
00672
00673
00674 if (fAvoidSignal) return;
00675
00676 Color_t col = TColor::GetColor(p);
00677 TIter next(fParallel->GetVarList());
00678 TParallelCoordVar *var = NULL;
00679 while ((var = (TParallelCoordVar*)next())) var->SetFillColor(col);
00680 Update();
00681 }
00682
00683
00684
00685 void TParallelCoordEditor::DoHistShowBoxes(Bool_t s)
00686 {
00687
00688
00689 if (fAvoidSignal) return;
00690
00691 TIter next(fParallel->GetVarList());
00692 TParallelCoordVar* var;
00693 while ((var = (TParallelCoordVar*)next())) var->SetBit(TParallelCoordVar::kShowBarHisto,s);
00694 Update();
00695 }
00696
00697
00698
00699 void TParallelCoordEditor::DoHistPatternSelect(Style_t sty)
00700 {
00701
00702
00703 if (fAvoidSignal) return;
00704
00705 TIter next(fParallel->GetVarList());
00706 TParallelCoordVar *var = NULL;
00707 while ((var = (TParallelCoordVar*)next())) var->SetFillStyle(sty);
00708 Update();
00709 }
00710
00711
00712
00713 void TParallelCoordEditor::DoHistWidth()
00714 {
00715
00716
00717 if (fAvoidSignal) return;
00718
00719 fParallel->SetAxisHistogramLineWidth((Int_t)fHistWidth->GetNumber());
00720 Update();
00721 }
00722
00723
00724
00725 void TParallelCoordEditor::DoLineType()
00726 {
00727
00728
00729 if (fAvoidSignal) return;
00730
00731 if(fLineTypePoly->GetState() == kButtonDown) fParallel->SetCurveDisplay(kFALSE);
00732 else fParallel->SetCurveDisplay(kTRUE);
00733 Update();
00734 }
00735
00736
00737
00738 void TParallelCoordEditor::DoLiveDotsSpacing(Int_t a)
00739 {
00740
00741
00742 if (fAvoidSignal) return;
00743 fDotsSpacingField->SetNumber(a);
00744 fParallel->SetDotsSpacing(a);
00745 if(!fDelay) Update();
00746 }
00747
00748
00749
00750 void TParallelCoordEditor::DoLiveEntriesToDraw()
00751 {
00752
00753
00754 if (fAvoidSignal) return;
00755
00756 Long64_t nentries,firstentry;
00757 firstentry = (Long64_t)fEntriesToDraw->GetMinPosition();
00758 nentries = (Long64_t)(fEntriesToDraw->GetMaxPosition() - fEntriesToDraw->GetMinPosition() + 1);
00759
00760 fFirstEntry->SetNumber(firstentry);
00761 fNentries->SetNumber(nentries);
00762
00763 if (!fDelay) {
00764 fParallel->SetCurrentFirst(firstentry);
00765 fParallel->SetCurrentN(nentries);
00766 Update();
00767 }
00768 }
00769
00770
00771
00772 void TParallelCoordEditor::DoLiveWeightCut(Int_t n)
00773 {
00774
00775
00776 if (fAvoidSignal) return;
00777
00778 fWeightCutField->SetNumber(n);
00779 if (!fDelay) {
00780 fParallel->SetWeightCut(n);
00781 Update();
00782 }
00783 }
00784
00785
00786
00787 void TParallelCoordEditor::DoNentries()
00788 {
00789
00790
00791 if (fAvoidSignal) return;
00792
00793 fParallel->SetCurrentN((Long64_t)fNentries->GetNumber());
00794 fEntriesToDraw->SetPosition(fParallel->GetCurrentFirst(),fParallel->GetCurrentFirst()+fParallel->GetCurrentN());
00795 Update();
00796 }
00797
00798
00799
00800 void TParallelCoordEditor::DoPaintEntries(Bool_t on)
00801 {
00802
00803
00804 if (fAvoidSignal) return;
00805
00806 fParallel->SetBit(TParallelCoord::kPaintEntries,on);
00807 Update();
00808 }
00809
00810
00811
00812 void TParallelCoordEditor::DoSelectLineColor(Pixel_t a)
00813 {
00814
00815
00816 if (fAvoidSignal) return;
00817
00818 fParallel->GetCurrentSelection()->SetLineColor(TColor::GetColor(a));
00819 fSelectionSelect->GetSelectedEntry()->SetBackgroundColor(a);
00820 Update();
00821 }
00822
00823
00824
00825 void TParallelCoordEditor::DoSelectLineWidth(Int_t wid)
00826 {
00827
00828
00829 if (fAvoidSignal) return;
00830
00831 fParallel->GetCurrentSelection()->SetLineWidth(wid);
00832 Update();
00833 }
00834
00835
00836
00837 void TParallelCoordEditor::DoSelectionSelect(const char* title)
00838 {
00839
00840
00841 if (fAvoidSignal) return;
00842
00843 if (!fParallel->SetCurrentSelection(title)) return;
00844
00845 Color_t c = fParallel->GetCurrentSelection()->GetLineColor();
00846 Pixel_t p = TColor::Number2Pixel(c);
00847 fSelectLineColor->SetColor(p,kFALSE);
00848
00849 fSelectLineWidth->Select(fParallel->GetCurrentSelection()->GetLineWidth(),kFALSE);
00850
00851 fActivateSelection->SetOn(fParallel->GetCurrentSelection()->TestBit(TParallelCoordSelect::kActivated));
00852 fShowRanges->SetOn(fParallel->GetCurrentSelection()->TestBit(TParallelCoordSelect::kShowRanges));
00853 }
00854
00855
00856
00857 void TParallelCoordEditor::DoShowRanges(Bool_t s)
00858 {
00859
00860
00861 if (fAvoidSignal) return;
00862
00863 fParallel->GetCurrentSelection()->SetShowRanges(s);
00864 Update();
00865 }
00866
00867
00868
00869 void TParallelCoordEditor::DoUnApply()
00870 {
00871
00872
00873 if (fAvoidSignal) return;
00874
00875 fParallel->ResetTree();
00876 Update();
00877 SetModel(fParallel);
00878 }
00879
00880
00881
00882 void TParallelCoordEditor::DoVariableSelect(const char* )
00883 {
00884
00885
00886
00887 }
00888
00889
00890
00891 void TParallelCoordEditor::DoWeightCut()
00892 {
00893
00894
00895 if (fAvoidSignal) return;
00896
00897 Int_t n = (Int_t)fWeightCutField->GetNumber();
00898 fParallel->SetWeightCut(n);
00899 Update();
00900 }
00901
00902
00903
00904 void TParallelCoordEditor::SetModel(TObject* obj)
00905 {
00906
00907
00908 if (!obj) return;
00909 fParallel = dynamic_cast<TParallelCoord*>(obj);
00910 if (!fParallel) return;
00911 fAvoidSignal = kTRUE;
00912
00913 Color_t c = fParallel->GetLineColor();
00914 Pixel_t p = TColor::Number2Pixel(c);
00915 fGlobalLineColor->SetColor(p);
00916
00917 fGlobalLineWidth->Select(fParallel->GetLineWidth());
00918
00919 fPaintEntries->SetOn(fParallel->TestBit(TParallelCoord::kPaintEntries));
00920
00921 fDotsSpacing->SetPosition(fParallel->GetDotsSpacing());
00922
00923 fDotsSpacingField->SetNumber(fParallel->GetDotsSpacing());
00924
00925 Bool_t cur = fParallel->GetCurveDisplay();
00926 if (cur) fLineTypeBgroup->SetButton(kLineTypeCurves,kTRUE);
00927 else fLineTypeBgroup->SetButton(kLineTypePoly,kTRUE);
00928
00929 if(fInit) fHideAllRanges->SetOn(kFALSE);
00930
00931 CleanUpSelections();
00932 CleanUpVariables();
00933
00934 if (fInit) fEntriesToDraw->SetRange(0,fParallel->GetNentries());
00935 fEntriesToDraw->SetPosition(fParallel->GetCurrentFirst(), fParallel->GetCurrentFirst()+fParallel->GetCurrentN());
00936
00937 fFirstEntry->SetNumber(fParallel->GetCurrentFirst());
00938 fNentries->SetNumber(fParallel->GetCurrentN());
00939
00940 fDelayDrawing->SetOn(fDelay);
00941
00942 fWeightCut->SetRange(0,(Int_t)(fParallel->GetNentries()/10));
00943 fWeightCut->SetPosition(fParallel->GetWeightCut());
00944 fWeightCutField->SetNumber(fParallel->GetWeightCut());
00945
00946 fHistColorSelect->SetColor(TColor::Number2Pixel(((TParallelCoordVar*)fParallel->GetVarList()->Last())->GetFillColor()), kFALSE);
00947 fHistPatternSelect->SetPattern(((TParallelCoordVar*)fParallel->GetVarList()->Last())->GetFillStyle(),kFALSE);
00948
00949 if (fInit) ConnectSignals2Slots();
00950
00951 fAvoidSignal = kFALSE;
00952 }