Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4WinCondView.cxx

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

Generated on Fri Nov 28 12:59:07 2008 for Go4-v3.04-1 by  doxygen 1.4.2