GSI Object Oriented Online Offline (Go4) GO4-6.4.5
Loading...
Searching...
No Matches
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#include "TMath.h"
18
19#include "TGo4WinCond.h"
20
21TGo4WinCondView::TGo4WinCondView(Double_t x1,Double_t y1,Double_t x2,Double_t y2)
22 :TBox(x1,y1,x2,y2), fbExecutesMouseEvent(kFALSE), fxWinCondition(nullptr)
23{
24 SetBit(kMustCleanup);
25 //SetBit(kCanDelete, kFALSE);
26}
27
29 : TBox(),fbExecutesMouseEvent(kFALSE),fxWinCondition(nullptr)
30{
31 SetBit(kMustCleanup);
32 //SetBit(kCanDelete, kFALSE);
33}
34
38
39void 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
49void 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 fxWinCondition->SetValues(X1, X2, Y1, Y2);
80 fxWinCondition->SetLineColor(GetLineColor());
81 fxWinCondition->SetLineWidth(GetLineWidth());
82 fxWinCondition->SetLineStyle(GetLineStyle());
83 fxWinCondition->SetFillColor(GetFillColor());
84 fxWinCondition->SetFillStyle(GetFillStyle());
85 fxWinCondition->SetChanged();
86 }
87 } else {
88 if ((TMath::Abs(xmin - X1) > epsilon) || (TMath::Abs(xmax - X2) > epsilon)) {
89 fxWinCondition->SetValues(X1, X2);
90 fxWinCondition->SetLineColor(GetLineColor());
91 fxWinCondition->SetLineWidth(GetLineWidth());
92 fxWinCondition->SetLineStyle(GetLineStyle());
93 fxWinCondition->SetFillColor(GetFillColor());
94 fxWinCondition->SetFillStyle(GetFillStyle());
95 fxWinCondition->SetChanged();
96 }
97 } // if(dim>1)
98 fbExecutesMouseEvent = kFALSE; // only release execute event lock when we finish the move JAM
99
100 } // if(event==...)
101}
102
103const char *TGo4WinCondView::GetName() const
104{
105 return fxWinCondition ? fxWinCondition->GetName() : nullptr;
106}
107
108void TGo4WinCondView::SetName(const char *nam)
109{
110 if(fxWinCondition) fxWinCondition->SetName(nam);
111}
112
113void TGo4WinCondView::SetToLimits(Double_t x1, Double_t x2, Double_t y1, Double_t y2)
114{
115 if (!fxWinCondition)
116 return;
117 if (fxWinCondition->GetDimension() > 1)
118 fxWinCondition->SetValues(x1, x2, y1, y2);
119 else
120 fxWinCondition->SetValues(x1, x2);
121}
122
124{
125 if(fxWinCondition) fxWinCondition->SetLabelDraw(on);
126}
127
129{
130 if(fxWinCondition) fxWinCondition->SetLimitsDraw(on);
131}
132
134{
135 if(fxWinCondition) fxWinCondition->SetIntDraw(on);
136}
137
139{
140 if(fxWinCondition) fxWinCondition->SetXMeanDraw(on);
141}
142
144{
145 if(fxWinCondition) fxWinCondition->SetYMeanDraw(on);
146}
147
149{
150 if(fxWinCondition) fxWinCondition->SetXRMSDraw(on);
151}
152
154{
155 if(fxWinCondition) fxWinCondition->SetYRMSDraw(on);
156}
157
159{
160 if(fxWinCondition) fxWinCondition->SetXMaxDraw(on);
161}
162
164{
165 if(fxWinCondition) fxWinCondition->SetYMaxDraw(on);
166}
167
169{
170 if(fxWinCondition) fxWinCondition->SetCMaxDraw(on);
171}
172
173void TGo4WinCondView::SetNumFormat(const char *fmt)
174{
175 if(fxWinCondition) fxWinCondition->SetLabelNumFormat(fmt);
176}
177
178//void TGo4WinCondView::DeleteRegion()
179//{
180// if(fxWinCondition && !fxWinCondition->IsOwnedByEditor())
181// {
182// fxWinCondition->Delete("");
183// }
184//}
185
187{
188 if(fxWinCondition) fxWinCondition->SaveLabelStyle();
189}
190
192{
193 if(fxWinCondition) fxWinCondition->ResetLabel();
194}
void SetXRMSDraw(Bool_t on)
const char * GetName() const override
void SetLabelDraw(Bool_t on)
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
void SetCMaxDraw(Bool_t on)
void SetIntDraw(Bool_t on)
void SetXMeanDraw(Bool_t on)
void ResetLabel()
Will reset label position to defaults.
void SetYMeanDraw(Bool_t on)
void SetName(const char *nam)
void SetNumFormat(const char *fmt="%.4E")
void SaveLabelStyle()
This will save draw flags into static default setup.
void Paint(Option_t *opt="") override
void SetToLimits(Double_t x1, Double_t x2, Double_t y1=0, Double_t y2=0)
Delete condition instead of view:
virtual ~TGo4WinCondView()
void SetYRMSDraw(Bool_t on)
Bool_t fbExecutesMouseEvent
JAM this one will suppress condition repaint during execution of mouse events.
void SetLimitsDraw(Bool_t on)
void SetYMaxDraw(Bool_t on)
TGo4WinCond * fxWinCondition
pointer to viewed condition for update after graphical action
void SetXMaxDraw(Bool_t on)