GSI Object Oriented Online Offline (Go4) GO4-6.4.0
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
18#include "TGo4WinCond.h"
19
20TGo4WinCondView::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
37
38void 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
48void 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());
84 fxWinCondition->SetChanged();
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());
94 fxWinCondition->SetChanged();
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
102const char *TGo4WinCondView::GetName() const
103{
104 return fxWinCondition ? fxWinCondition->GetName() : nullptr;
105}
106
107void TGo4WinCondView::SetName(const char *nam)
108{
109 if(fxWinCondition) fxWinCondition->SetName(nam);
110}
111
112void 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{
124 if(fxWinCondition) fxWinCondition->SetLabelDraw(on);
125}
126
128{
129 if(fxWinCondition) fxWinCondition->SetLimitsDraw(on);
130}
131
133{
134 if(fxWinCondition) fxWinCondition->SetIntDraw(on);
135}
136
138{
139 if(fxWinCondition) fxWinCondition->SetXMeanDraw(on);
140}
141
143{
144 if(fxWinCondition) fxWinCondition->SetYMeanDraw(on);
145}
146
148{
149 if(fxWinCondition) fxWinCondition->SetXRMSDraw(on);
150}
151
153{
154 if(fxWinCondition) fxWinCondition->SetYRMSDraw(on);
155}
156
158{
159 if(fxWinCondition) fxWinCondition->SetXMaxDraw(on);
160}
161
163{
164 if(fxWinCondition) fxWinCondition->SetYMaxDraw(on);
165}
166
168{
169 if(fxWinCondition) fxWinCondition->SetCMaxDraw(on);
170}
171
172void TGo4WinCondView::SetNumFormat(const char *fmt)
173{
174 if(fxWinCondition) fxWinCondition->SetLabelNumFormat(fmt);
175}
176
177//void TGo4WinCondView::DeleteRegion()
178//{
179// if(fxWinCondition && !fxWinCondition->IsOwnedByEditor())
180// {
181// fxWinCondition->Delete("");
182// }
183//}
184
186{
187 if(fxWinCondition) fxWinCondition->SaveLabelStyle();
188}
189
191{
192 if(fxWinCondition) fxWinCondition->ResetLabel();
193}
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()
TGo4WinCond * fxWinCondition
pointer to viewed condition for update after graphical action
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)
void SetXMaxDraw(Bool_t on)