Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4ConditionsBase/TGo4WinCondView.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "TGo4WinCondView.h"
00017 
00018 #include <iostream.h>
00019 
00020 #include "Buttons.h"
00021 #include "TPad.h"
00022 
00023 #include "TGo4WinCond.h"
00024 
00025 TGo4WinCondView::TGo4WinCondView(Double_t x1,Double_t y1,Double_t x2,Double_t y2)
00026    :TBox(x1,y1,x2,y2), fxWinCondition(0)
00027 {
00028 }
00029 
00030 TGo4WinCondView::TGo4WinCondView()
00031    : TBox(),fxWinCondition(0)
00032 {
00033 }
00034 
00035 TGo4WinCondView::~TGo4WinCondView()
00036 {
00037 }
00038 
00039 void TGo4WinCondView::Paint(Option_t* opt)
00040 {
00041 if(fxWinCondition) TBox::Paint(opt);
00042 // we have a valid condition set from painter. Otherwise,
00043 // suppress painting of condition view without owner. This case
00044 // happens after insert canvas in go4 (separate cloning
00045 // of lists of primitive members), thus leading to a
00046 // second "ghost condition box"
00047 
00048 }
00049 void TGo4WinCondView::ExecuteEvent(Int_t event, Int_t px, Int_t py)
00050 {
00051 // note: This method is never called in ROOT>=4.03/02 when
00052 // logscale is enabled on pad. 
00053 // So no mouse modifications of condition possible
00054 // TO BE INVESTIGATED!  JA
00055 if(gPad==0) return;
00056 TBox::ExecuteEvent(event,px,py);
00057 if(event==kButton1Up && fxWinCondition)
00058    {
00059    Pop(); // do condition under edit into foreground, for condarray
00060    // here we update the condition values if necessary:
00061    Double_t epsilon=fxWinCondition->GetUpdateEpsilon();
00062    Double_t xmin=0;
00063    Double_t xmax=0;
00064    Double_t ymin=0;
00065    Double_t ymax=0;
00066    Int_t dim=0;
00067    fxWinCondition->GetValues(dim,xmin,xmax,ymin, ymax);
00068    
00069 //   cout <<"\nExecute Event Before Padto:"<< endl;
00070 //   cout <<" x1="<<GetX1() << endl;
00071 //   cout <<" x1="<<GetX2() << endl;
00072 //   cout <<" y1="<<GetY1() << endl;
00073 //   cout <<" y1="<<GetY2() << endl;
00074 // note: newer root versions treat log scale correctly in TBox   
00075 #if __GO4ROOTVERSION__ < 40302   
00076 
00077    Double_t X1=gPad->PadtoX(GetX1()); // regard the log scale!
00078    Double_t X2=gPad->PadtoX(GetX2());
00079    Double_t Y1=gPad->PadtoY(GetY1());
00080    Double_t Y2=gPad->PadtoY(GetY2());
00081 #else
00082    Double_t X1=GetX1(); 
00083    Double_t X2=GetX2();
00084    Double_t Y1=GetY1();
00085    Double_t Y2=GetY2();
00086 #endif   
00087 //   cout <<"\nExecute Event After Padto:"<< endl;
00088 //   cout <<" x1="<<X1 << endl;
00089 //   cout <<" x1="<<X2 << endl;
00090 //   cout <<" y1="<<Y1 << endl;
00091 //   cout <<" y1="<<Y2 << endl;
00092    
00093    if(dim>1)
00094          {
00095             // check if update is needed:
00096            if((TMath::Abs(xmin-X1) > epsilon) ||
00097                (TMath::Abs(xmax-X2) > epsilon) ||
00098                (TMath::Abs(ymin-Y1) > epsilon) ||
00099                (TMath::Abs(ymax-Y2) > epsilon) )
00100                {
00101                   //cout <<"ExecuteEvent modified 2d condition with colors" << endl;
00102                   fxWinCondition->SetValues(X1, X2, Y1, Y2 );
00103                   fxWinCondition->SetLineColor(GetLineColor());
00104                   fxWinCondition->SetLineWidth(GetLineWidth());
00105                   fxWinCondition->SetLineStyle(GetLineStyle());
00106                   fxWinCondition->SetFillColor(GetFillColor());
00107                   fxWinCondition->SetFillStyle(GetFillStyle());
00108                   fxWinCondition->SetChanged(kTRUE);
00109                }
00110          }
00111       else
00112          {
00113             if((TMath::Abs(xmin-X1) > epsilon) ||
00114                (TMath::Abs(xmax-X2) > epsilon) )
00115                {
00116                   //cout <<"ExecuteEvent modified 1d condition with colors" << endl;
00117                   fxWinCondition->SetValues(X1, X2);
00118                   fxWinCondition->SetLineColor(GetLineColor());
00119                   fxWinCondition->SetLineWidth(GetLineWidth());
00120                   fxWinCondition->SetLineStyle(GetLineStyle());
00121                   fxWinCondition->SetFillColor(GetFillColor());
00122                   fxWinCondition->SetFillStyle(GetFillStyle());
00123                   fxWinCondition->SetChanged(kTRUE);
00124                }
00125          }// if(dim>1)
00126    } // if(event==...)
00127 }
00128 
00129 const char* TGo4WinCondView::GetName() const
00130 {
00131    if(fxWinCondition)
00132       return (fxWinCondition->GetName());
00133    else
00134       return 0;
00135 }
00136 
00137 
00138 void TGo4WinCondView::SetName(const Text_t* nam)
00139 {
00140    if(fxWinCondition) fxWinCondition->SetName(nam);
00141 }
00142 
00143 void TGo4WinCondView::SetToLimits(Double_t x1, Double_t x2, Double_t y1, Double_t y2)
00144 {
00145 if(fxWinCondition==0) return;
00146 if(fxWinCondition->GetDimension()>1)
00147    fxWinCondition->SetValues(x1,x2,y1,y2);
00148 else
00149    fxWinCondition->SetValues(x1,x2);
00150 }
00151 
00152 
00153 void TGo4WinCondView::SetLabelDraw(Bool_t on)
00154 {
00155    if(fxWinCondition) fxWinCondition->SetLabelDraw(on);
00156 }
00157 void TGo4WinCondView::SetLimitsDraw(Bool_t on)
00158 {
00159    if(fxWinCondition) fxWinCondition->SetLimitsDraw(on);
00160 }
00161 
00162 void TGo4WinCondView::SetIntDraw(Bool_t on)
00163 {
00164    if(fxWinCondition) fxWinCondition->SetIntDraw(on);
00165 }
00166 
00167 void TGo4WinCondView::SetXMeanDraw(Bool_t on)
00168 {
00169    if(fxWinCondition) fxWinCondition->SetXMeanDraw(on);
00170 }
00171 
00172 void TGo4WinCondView::SetYMeanDraw(Bool_t on)
00173 {
00174    if(fxWinCondition) fxWinCondition->SetYMeanDraw(on);
00175 }
00176 
00177 void TGo4WinCondView::SetXRMSDraw(Bool_t on)
00178 {
00179    if(fxWinCondition) fxWinCondition->SetXRMSDraw(on);
00180 }
00181 
00182 void TGo4WinCondView::SetYRMSDraw(Bool_t on)
00183 {
00184    if(fxWinCondition) fxWinCondition->SetYRMSDraw(on);
00185 }
00186 
00187 void TGo4WinCondView::SetXMaxDraw(Bool_t on)
00188 {
00189    if(fxWinCondition) fxWinCondition->SetXMaxDraw(on);
00190 }
00191 
00192 void TGo4WinCondView::SetYMaxDraw(Bool_t on)
00193 {
00194    if(fxWinCondition) fxWinCondition->SetYMaxDraw(on);
00195 }
00196 
00197 void TGo4WinCondView::SetCMaxDraw(Bool_t on)
00198 {
00199    if(fxWinCondition) fxWinCondition->SetCMaxDraw(on);
00200 }
00201 
00202 void TGo4WinCondView::DeleteRegion()
00203 {
00204    if(fxWinCondition && !fxWinCondition->IsOwnedByEditor())
00205       fxWinCondition->Delete("");
00206 }
00207 
00208 void TGo4WinCondView::SaveLabelStyle()
00209 {
00210    if(fxWinCondition) fxWinCondition->SaveLabelStyle();
00211 }
00212 
00213 void TGo4WinCondView::ResetLabel()
00214 {
00215    if(fxWinCondition) fxWinCondition->ResetLabel();
00216 }
00217 
00218 
00219 ClassImp(TGo4WinCondView)
00220 
00221 
00222 
00223 
00224 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:55:52 2005 for Go4-v2.10-5 by doxygen1.2.15