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

/Go4FitGUI/TGo4FitPanelStatus.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 "TCanvas.h"
00017 #include "THStack.h"
00018 #include "TPad.h"
00019 #include "Go4Fit/TGo4FitSlot.h"
00020 
00021 #include "Go4LockGuard/TGo4LockGuard.h"
00022 #include "Go4GUIRegistry/TGo4GUIRegistry.h"
00023 #include "Go4GUI/TGo4PreviewPanel.h"
00024 
00025 #include "TGo4FitGUIArrow.h"
00026 
00027 #include "TGo4FitPanelStatus.h"
00028 
00029 TGo4FitSlotStatus::TGo4FitSlotStatus(TGo4FitSlot* slot) :
00030   TObject(),
00031   fxDrawObjs(),
00032   fxPrimitives(),
00033   fxInfo() 
00034 {
00035    fiSource = fss_none;
00036    fxSlot = slot;
00037    fxPanel = 0;
00038    fxPad = 0;
00039    fxDrawObjs.SetOwner(kTRUE);
00040    fxPrimitives.SetOwner(kTRUE);
00041 }
00042 
00043 TGo4FitSlotStatus::~TGo4FitSlotStatus() 
00044 {
00045    ClearPrimitives();
00046    ClearDrawObjs();
00047 
00048    TPad* pad = SourcePad();
00049    if (pad) pad->Update();
00050 }
00051 
00052 void TGo4FitSlotStatus::SetSourceNone() {
00053    fiSource = fss_none;
00054    fxPanel = 0;
00055    fxPad = 0;
00056 }
00057 
00058 void TGo4FitSlotStatus::SetSourceOwned(const char* info) 
00059 {
00060    fiSource = fss_owned;
00061    fxInfo = info;
00062 }
00063 
00064 void TGo4FitSlotStatus::SetSourceReference(const char* info) 
00065 {
00066    fiSource = fss_reference;
00067    fxInfo = info;
00068 }
00069 
00070 const char* TGo4FitSlotStatus::InfoStr() 
00071 {
00072   return fxInfo.Data();
00073 }
00074 
00075 
00076 void TGo4FitSlotStatus::SetSourcePad(TGo4PreviewPanel* panel, TPad* pad) {
00077    fxPanel = panel;
00078    fxPad = pad;
00079    fiSource = fss_pad;
00080 }
00081 
00082 void TGo4FitSlotStatus::UpdatePad() 
00083 {
00084    if (SourcePad()) SourcePad()->Update();
00085 }
00086 
00087 void TGo4FitSlotStatus::AddPrimitive(TObject* obj) 
00088 {
00089   fxPrimitives.Add(obj);
00090   TGo4FitGUIArrow* arr = dynamic_cast<TGo4FitGUIArrow*> (obj);
00091   if (arr) arr->SetOwner(&fxPrimitives);
00092 }
00093 
00094 bool TGo4FitSlotStatus::ClearPrimitives() 
00095 {
00096   bool res = (fxPrimitives.GetLast()>=0);
00097   
00098   for (Int_t n=0;n<=fxPrimitives.GetLast();n++) {
00099     TObject* prim = fxPrimitives.At(n);
00100     TGo4FitGUIArrow* arr = dynamic_cast<TGo4FitGUIArrow*> (prim);
00101     if (arr) arr->SetOwner(0);
00102     if (SourcePad())
00103        SourcePad()->GetListOfPrimitives()->Remove(prim);
00104   }
00105 
00106   fxPrimitives.Clear();
00107   fxPrimitives.Compress();
00108   return res;
00109 }
00110 
00111 bool TGo4FitSlotStatus::RemovePrimitivesFor(TObject* obj) {
00112    bool res = FALSE;
00113 
00114    for (int n=0; n<=fxPrimitives.GetLast();n++) {
00115       TGo4FitGUIArrow* arr = dynamic_cast<TGo4FitGUIArrow*> (fxPrimitives[n]);
00116       if (arr==0) continue;
00117       if (arr->IsAssignTo(obj)) {
00118          fxPrimitives.Remove(arr);
00119          arr->SetOwner(0);
00120          delete arr;
00121          res = TRUE;
00122       }
00123    }
00124    if (res) fxPrimitives.Compress();
00125    return res;
00126 }
00127 
00128 bool TGo4FitSlotStatus::UpdateRestPrimitives(TObject* obj) 
00129 {
00130   bool res = FALSE;
00131 
00132   TGo4FitGUIArrow* arr = dynamic_cast<TGo4FitGUIArrow*> (obj);
00133 
00134   for (Int_t k=0;k<=fxPrimitives.GetLast();k++) {
00135       TGo4FitGUIArrow* a = dynamic_cast<TGo4FitGUIArrow*> (fxPrimitives[k]);
00136       if ((a==0) || (a==arr)) continue;
00137       if (a->Locate()) res = TRUE;
00138    }
00139 
00140   return res;
00141 }
00142 
00143 void TGo4FitSlotStatus::AddDrawObj(TObject* obj) {
00144   fxDrawObjs.Add(obj);
00145 }
00146 
00147 void TGo4FitSlotStatus::ClearDrawObjs() 
00148 {
00149   if (SourcePad())
00150     for (Int_t n=0;n<=fxDrawObjs.GetLast();n++)
00151       SourcePad()->GetListOfPrimitives()->Remove(fxDrawObjs[n]);
00152 
00153   fxDrawObjs.Clear();
00154 }
00155 
00156 
00157 // ********************************************************************
00158 
00159 
00160 TGo4FitPanelStatus::TGo4FitPanelStatus(): TGo4Status() {
00161 }
00162 
00163 TGo4FitPanelStatus::TGo4FitPanelStatus(Text_t *Name, Text_t * Title):
00164    TGo4Status(Name), fbNeedConfirmation(kFALSE), fbShowPrimitives(kTRUE),
00165    fbFreezeMode(kFALSE),
00166    fxCommonOptions(), fiSelectedWidgetID(2), fbParsWidgetShown(kFALSE),
00167    fbDrawModels(kTRUE), fbDrawComponents(kFALSE), fbDrawBackground(kFALSE),
00168    fbUseSamePanelForDraw(kTRUE), fbDrawInfoOnPad(kFALSE),
00169    fiIntegralMode(0), fbRecalculateGaussWidth(kTRUE),
00170    fiBuffersUsage(1), fbSaveWithReferences(kFALSE), fbUseCurrentRange(kTRUE) {
00171 }
00172 
00173 TGo4FitPanelStatus::~TGo4FitPanelStatus()
00174 {
00175 }
00176 
00177 //----------------------------END OF GO4 SOURCE FILE ---------------------

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