Avoid jumping of entries in data-selector window -- restore scrollbar position after...
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveCosmicRayFitterEditor.cxx
CommitLineData
e7aa1ed8 1// $Id$
2// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
9
10#include "AliEveCosmicRayFitterEditor.h"
11#include "AliEveCosmicRayFitter.h"
12
13#include <TGButton.h>
14
15
16//_____________________________________________________________________________
17// AliEveCosmicRayFitterEditor
18//
19
20ClassImp(AliEveCosmicRayFitterEditor)
21
22AliEveCosmicRayFitterEditor::AliEveCosmicRayFitterEditor(const TGWindow *p, Int_t width, Int_t height,
23 UInt_t options, Pixel_t back) :
24 TGedFrame(p, width, height, options | kVerticalFrame, back),
25 fM(0),
26 fFit(0),
27 fReset(0),
28 fStart(0),
29 fStop(0),
30 fGraph(0)
31{
32 // Constructor.
33
34 MakeTitle("AliEveCosmicRayFitter");
35
36 fStart = new TGTextButton(this, "Start");
37 AddFrame(fStart, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 1, 3, 1));
38 fStart->Connect("Clicked()",
39 "AliEveCosmicRayFitterEditor", this, "DoStart()");
40
41 fFit = new TGTextButton(this, "Fit");
42 AddFrame(fFit, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 1, 1, 1));
43 fFit->Connect("Clicked()",
44 "AliEveCosmicRayFitterEditor", this, "DoFit()");
45
46 fReset = new TGTextButton(this, "Reset");
47 AddFrame(fReset, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 1, 1, 1));
48 fReset->Connect("Clicked()",
49 "AliEveCosmicRayFitterEditor", this, "DoReset()");
50
51 fStop = new TGTextButton(this, "Stop");
52 AddFrame(fStop, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 1, 1, 4));
53 fStop->Connect("Clicked()",
54 "AliEveCosmicRayFitterEditor", this, "DoStop()");
55
56 fGraph = new TGTextButton(this, "DebugGraph");
57 AddFrame(fGraph, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 2, 4, 1));
58 fGraph->Connect("Clicked()",
59 "AliEveCosmicRayFitterEditor", this, "DoGraph()");
60 }
61
62/******************************************************************************/
63
64void AliEveCosmicRayFitterEditor::SetModel(TObject* obj)
65{
66 // Set model object.
67
68 fM = dynamic_cast<AliEveCosmicRayFitter*>(obj);
69
70 if(fM->GetConnected())
71 {
72 fStart->SetState(kButtonDisabled);
73 fStop->SetState(kButtonUp);
74 }
75 else
76 {
77 fStop->SetState(kButtonDisabled);
78 fStart->SetState(kButtonEngaged);
79 fStart->SetState(kButtonUp);
80 }
81}
82
83/**************************************************************************/
84
85void AliEveCosmicRayFitterEditor::DoFit()
86{
87 // Fit slot.
88
89 fM->FitTrack();
90 Update();
91}
92
93void AliEveCosmicRayFitterEditor::DoReset()
94{
95 // Reset slot.
96
97 fM->Reset();
98 Update();
99}
100
101void AliEveCosmicRayFitterEditor::DoStart()
102{
103 // Start selection slot.
104
105 fM->Start();
106 fStart->SetState(kButtonDisabled);
107 fStop->SetState(kButtonUp);
108}
109
110void AliEveCosmicRayFitterEditor::DoStop()
111{
112 // Stop selection slot.
113
114 fM->Stop();
115 fStop->SetState(kButtonDisabled);
116 fStart->SetState(kButtonUp);
117}
118
119void AliEveCosmicRayFitterEditor::DoGraph()
120{
121 // Draw graph slot.
122
123 fM->DrawDebugGraph();
124 Update();
125}