GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4WinCondView.cxx
Go to the documentation of this file.
1 // $Id$
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(nullptr)
22 {
23  SetBit(kMustCleanup);
24  //SetBit(kCanDelete, kFALSE);
25 }
26 
28  : TBox(),fbExecutesMouseEvent(kFALSE),fxWinCondition(nullptr)
29 {
30  SetBit(kMustCleanup);
31  //SetBit(kCanDelete, kFALSE);
32 }
33 
35 {
36 }
37 
38 void TGo4WinCondView::Paint(Option_t *opt)
39 {
40  if(fxWinCondition) TBox::Paint(opt);
41  // we have a valid condition set from painter. Otherwise,
42  // suppress painting of condition view without owner. This case
43  // happens after insert canvas in go4 (separate cloning
44  // of lists of primitive members), thus leading to a
45  // second "ghost condition box"
46 }
47 
48 void TGo4WinCondView::ExecuteEvent(Int_t event, Int_t px, Int_t py)
49 {
50  // note: This method is never called in ROOT>=4.03/02 when
51  // logscale is enabled on pad.
52  // So no mouse modifications of condition possible
53  // TO BE INVESTIGATED! JA
54  if (!gPad)
55  return;
56 
57  if (event == kButton1Down && fxWinCondition) {
58  fbExecutesMouseEvent = kTRUE; // only lock painting if we really touch the box JAM
59  }
60 
61  TBox::ExecuteEvent(event, px, py);
62  if (event == kButton1Up && fxWinCondition) {
63  Pop(); // do condition under edit into foreground, for condarray
64  fxWinCondition->ResetLabel("pop"); // always pop our label to foreground
65  // here we update the condition values if necessary:
66  Double_t epsilon = fxWinCondition->GetUpdateEpsilon();
67  Double_t xmin = 0, xmax = 0, ymin = 0, ymax = 0;
68  Int_t dim = 0;
69  fxWinCondition->GetValues(dim, xmin, xmax, ymin, ymax);
70 
71  // note: newer root versions treat log scale correctly in TBox
72  Double_t X1 = GetX1(), X2 = GetX2(), Y1 = GetY1(), Y2 = GetY2();
73 
74  if (dim > 1) {
75  // check if update is needed:
76  if ((TMath::Abs(xmin - X1) > epsilon) || (TMath::Abs(xmax - X2) > epsilon) ||
77  (TMath::Abs(ymin - Y1) > epsilon) || (TMath::Abs(ymax - Y2) > epsilon)) {
78  fxWinCondition->SetValues(X1, X2, Y1, Y2);
79  fxWinCondition->SetLineColor(GetLineColor());
80  fxWinCondition->SetLineWidth(GetLineWidth());
81  fxWinCondition->SetLineStyle(GetLineStyle());
82  fxWinCondition->SetFillColor(GetFillColor());
83  fxWinCondition->SetFillStyle(GetFillStyle());
85  }
86  } else {
87  if ((TMath::Abs(xmin - X1) > epsilon) || (TMath::Abs(xmax - X2) > epsilon)) {
88  fxWinCondition->SetValues(X1, X2);
89  fxWinCondition->SetLineColor(GetLineColor());
90  fxWinCondition->SetLineWidth(GetLineWidth());
91  fxWinCondition->SetLineStyle(GetLineStyle());
92  fxWinCondition->SetFillColor(GetFillColor());
93  fxWinCondition->SetFillStyle(GetFillStyle());
95  }
96  } // if(dim>1)
97  fbExecutesMouseEvent = kFALSE; // only release execute event lock when we finish the move JAM
98 
99  } // if(event==...)
100 }
101 
102 const char *TGo4WinCondView::GetName() const
103 {
104  return fxWinCondition ? fxWinCondition->GetName() : nullptr;
105 }
106 
107 void TGo4WinCondView::SetName(const char *nam)
108 {
109  if(fxWinCondition) fxWinCondition->SetName(nam);
110 }
111 
112 void TGo4WinCondView::SetToLimits(Double_t x1, Double_t x2, Double_t y1, Double_t y2)
113 {
114  if (!fxWinCondition)
115  return;
116  if (fxWinCondition->GetDimension() > 1)
117  fxWinCondition->SetValues(x1, x2, y1, y2);
118  else
119  fxWinCondition->SetValues(x1, x2);
120 }
121 
123 {
125 }
126 
128 {
130 }
131 
133 {
135 }
136 
138 {
140 }
141 
143 {
145 }
146 
148 {
150 }
151 
153 {
155 }
156 
158 {
160 }
161 
163 {
165 }
166 
168 {
170 }
171 
172 void TGo4WinCondView::SetNumFormat(const char *fmt)
173 {
175 }
176 
177 //void TGo4WinCondView::DeleteRegion()
178 //{
179 // if(fxWinCondition && !fxWinCondition->IsOwnedByEditor())
180 // {
181 // fxWinCondition->Delete("");
182 // }
183 //}
184 
186 {
188 }
189 
191 {
193 }
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)
void SetValues(Double_t low1, Double_t up1) override
virtual void SetYRMSDraw(Bool_t on)
void SetName(const char *nam)
void Paint(Option_t *opt="") override
void SetCMaxDraw(Bool_t on)
virtual void SetXMeanDraw(Bool_t on)
void GetValues(Int_t &dim, Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2) override
virtual void SetLabelNumFormat(const char *fmt)
virtual void SetXMaxDraw(Bool_t on)
void SetYMaxDraw(Bool_t on)
void SetXRMSDraw(Bool_t on)
Double_t GetUpdateEpsilon() const
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)
virtual void SetChanged(Bool_t on=kTRUE)
Bool_t fbExecutesMouseEvent
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
void SetIntDraw(Bool_t on)
void SetLimitsDraw(Bool_t on)
void SetYMeanDraw(Bool_t on)
const char * GetName() const override
Int_t GetDimension() const
virtual void SetYMeanDraw(Bool_t on)
void SetXMeanDraw(Bool_t on)
virtual void SetLabelDraw(Bool_t on)
void SetNumFormat(const char *fmt="%.4E")