GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4WinCondView.cxx
Go to the documentation of this file.
1 // $Id: TGo4WinCondView.cxx 2746 2020-04-16 09:10:17Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4WinCondView.h"
15 
16 #include "TVirtualPad.h"
17 
18 #include "TGo4WinCond.h"
19 
20 TGo4WinCondView::TGo4WinCondView(Double_t x1,Double_t y1,Double_t x2,Double_t y2)
21  :TBox(x1,y1,x2,y2), fbExecutesMouseEvent(kFALSE), fxWinCondition(0)
22 {
23  SetBit(kMustCleanup);
24  //SetBit(kCanDelete, kFALSE);
25 }
26 
28  : TBox(),fbExecutesMouseEvent(kFALSE),fxWinCondition(0)
29 {
30  SetBit(kMustCleanup);
31  //SetBit(kCanDelete, kFALSE);
32 }
33 
35 {
36 }
37 
38 
39 void TGo4WinCondView::Paint(Option_t* opt)
40 {
41 if(fxWinCondition) TBox::Paint(opt);
42 // we have a valid condition set from painter. Otherwise,
43 // suppress painting of condition view without owner. This case
44 // happens after insert canvas in go4 (separate cloning
45 // of lists of primitive members), thus leading to a
46 // second "ghost condition box"
47 
48 }
49 void TGo4WinCondView::ExecuteEvent(Int_t event, Int_t px, Int_t py)
50 {
51  // note: This method is never called in ROOT>=4.03/02 when
52  // logscale is enabled on pad.
53  // So no mouse modifications of condition possible
54  // TO BE INVESTIGATED! JA
55  if (!gPad)
56  return;
57 
58  if (event == kButton1Down && fxWinCondition) {
59  fbExecutesMouseEvent = kTRUE; // only lock painting if we really touch the box JAM
60  }
61 
62  TBox::ExecuteEvent(event, px, py);
63  if (event == kButton1Up && fxWinCondition) {
64  Pop(); // do condition under edit into foreground, for condarray
65  fxWinCondition->ResetLabel("pop"); // always pop our label to foreground
66  // here we update the condition values if necessary:
67  Double_t epsilon = fxWinCondition->GetUpdateEpsilon();
68  Double_t xmin = 0, xmax = 0, ymin = 0, ymax = 0;
69  Int_t dim = 0;
70  fxWinCondition->GetValues(dim, xmin, xmax, ymin, ymax);
71 
72  // note: newer root versions treat log scale correctly in TBox
73  Double_t X1 = GetX1(), X2 = GetX2(), Y1 = GetY1(), Y2 = GetY2();
74 
75  if (dim > 1) {
76  // check if update is needed:
77  if ((TMath::Abs(xmin - X1) > epsilon) || (TMath::Abs(xmax - X2) > epsilon) ||
78  (TMath::Abs(ymin - Y1) > epsilon) || (TMath::Abs(ymax - Y2) > epsilon)) {
79  // std::cout <<"ExecuteEvent modified 2d condition with colors, epsilon="<<epsilon << std::endl;
80  fxWinCondition->SetValues(X1, X2, Y1, Y2);
81  fxWinCondition->SetLineColor(GetLineColor());
82  fxWinCondition->SetLineWidth(GetLineWidth());
83  fxWinCondition->SetLineStyle(GetLineStyle());
84  fxWinCondition->SetFillColor(GetFillColor());
85  fxWinCondition->SetFillStyle(GetFillStyle());
87  }
88  } else {
89  if ((TMath::Abs(xmin - X1) > epsilon) || (TMath::Abs(xmax - X2) > epsilon)) {
90  // std::cout <<"ExecuteEvent modified 1d condition with colors, epsilon="<<epsilon << std::endl;
91  fxWinCondition->SetValues(X1, X2);
92  fxWinCondition->SetLineColor(GetLineColor());
93  fxWinCondition->SetLineWidth(GetLineWidth());
94  fxWinCondition->SetLineStyle(GetLineStyle());
95  fxWinCondition->SetFillColor(GetFillColor());
96  fxWinCondition->SetFillStyle(GetFillStyle());
98  }
99  } // if(dim>1)
100  fbExecutesMouseEvent = kFALSE; // only release execute event lock when we finish the move JAM
101 
102  } // if(event==...)
103 }
104 
105 const char* TGo4WinCondView::GetName() const
106 {
107  return fxWinCondition ? fxWinCondition->GetName() : 0;
108 }
109 
110 
111 void TGo4WinCondView::SetName(const char* nam)
112 {
113  if(fxWinCondition) fxWinCondition->SetName(nam);
114 }
115 
116 void TGo4WinCondView::SetToLimits(Double_t x1, Double_t x2, Double_t y1, Double_t y2)
117 {
118  if (fxWinCondition == 0)
119  return;
120  if (fxWinCondition->GetDimension() > 1)
121  fxWinCondition->SetValues(x1, x2, y1, y2);
122  else
123  fxWinCondition->SetValues(x1, x2);
124 }
125 
127 {
129 }
130 
132 {
134 }
135 
137 {
139 }
140 
142 {
144 }
145 
147 {
149 }
150 
152 {
154 }
155 
157 {
159 }
160 
162 {
164 }
165 
167 {
169 }
170 
172 {
174 }
175 
176 
177 void TGo4WinCondView::SetNumFormat(const char* fmt)
178 {
180 }
181 
182 
183 //void TGo4WinCondView::DeleteRegion()
184 //{
185 // if(fxWinCondition && !fxWinCondition->IsOwnedByEditor())
186 // {
187 // fxWinCondition->Delete("");
188 // }
189 //}
190 
192 {
194 }
195 
197 {
199 }
200 
Double_t GetUpdateEpsilon()
void SetYRMSDraw(Bool_t on)
virtual void SetIntDraw(Bool_t on)
TGo4WinCond * fxWinCondition
virtual void SetYMaxDraw(Bool_t on)
void SetToLimits(Double_t x1, Double_t x2, Double_t y1=0, Double_t y2=0)
virtual void SetCMaxDraw(Bool_t on)
Int_t GetDimension()
virtual void SetYRMSDraw(Bool_t on)
void SetName(const char *nam)
virtual void GetValues(Int_t &dim, Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2)
void SetCMaxDraw(Bool_t on)
virtual void Paint(Option_t *opt="")
virtual void SetXMeanDraw(Bool_t on)
virtual void SetLabelNumFormat(const char *fmt)
virtual void SetXMaxDraw(Bool_t on)
void SetYMaxDraw(Bool_t on)
void SetXRMSDraw(Bool_t on)
virtual void SetValues(Double_t low1, Double_t up1)
void SetLabelDraw(Bool_t on)
virtual ~TGo4WinCondView()
void ResetLabel(Option_t *opt="reset")
virtual void SetXRMSDraw(Bool_t on)
virtual void SetLimitsDraw(Bool_t on)
void SetXMaxDraw(Bool_t on)
const char * GetName() const
virtual void SetChanged(Bool_t on=kTRUE)
Bool_t fbExecutesMouseEvent
void SetIntDraw(Bool_t on)
void SetLimitsDraw(Bool_t on)
void SetYMeanDraw(Bool_t on)
virtual void SetYMeanDraw(Bool_t on)
void SetXMeanDraw(Bool_t on)
virtual void SetLabelDraw(Bool_t on)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
void SetNumFormat(const char *fmt="%.4E")