Skip to content
Snippets Groups Projects
Commit c518d444 authored by Rene Brun's avatar Rene Brun
Browse files

Remove classes TUtilPad and TVirtualUtilPad

git-svn-id: http://root.cern.ch/svn/root/trunk@16932 27541ba8-7e3a-0410-8455-c3a389f83636
parent 284df846
No related branches found
No related tags found
No related merge requests found
/* @(#)root/base:$Name: $:$Id: LinkDef1.h,v 1.38 2006/06/27 14:36:27 brun Exp $ */ /* @(#)root/base:$Name: $:$Id: LinkDef1.h,v 1.39 2006/10/18 09:26:58 rdm Exp $ */
/************************************************************************* /*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
...@@ -163,7 +163,6 @@ ...@@ -163,7 +163,6 @@
#pragma link C++ class TVirtualPS; #pragma link C++ class TVirtualPS;
#pragma link C++ class TVirtualUtil3D; #pragma link C++ class TVirtualUtil3D;
#pragma link C++ class TVirtualUtilHist; #pragma link C++ class TVirtualUtilHist;
#pragma link C++ class TVirtualUtilPad;
#pragma link C++ class TVirtualPadEditor; #pragma link C++ class TVirtualPadEditor;
......
// @(#)root/base:$Name: $:$Id: TVirtualUtilPad.h,v 1.1 2002/09/15 19:41:51 brun Exp $
// Author: Rene Brun 14/09/2002
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TVirtualUtilPad
#define ROOT_TVirtualUtilPad
//////////////////////////////////////////////////////////////////////////
// //
// TVirtualUtilPad //
// //
// Abstract interface to the pad/canvas utilities //
// //
// This class is called via the TPluginManager from classes that //
// do not require linking with libGpad except in some rare cases like //
// the invokation of the DrawPanel or FitPanel. //
// The concrete implementation TUtilPad is defined in system.rootrc //
// and can be overridden by a user to extend the functionality. //
// This abstract interface has three main goals: //
// - it decouples libGpad from the calling classes //
// - it does not require the use of magic strings like when using //
// gROOT->ProcessLine to instantiate classes in libGpad. //
// - it allows advanced users to redefine or extend some functions. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
class TVirtualPad;
class TVirtualUtilPad : public TNamed {
public:
TVirtualUtilPad();
virtual ~TVirtualUtilPad();
virtual void DrawPanel(const TVirtualPad *pad, const TObject *obj) = 0;
virtual void FitPanel(const TVirtualPad *pad, const TObject *obj) = 0;
virtual void FitPanelGraph(const TVirtualPad *pad, const TObject *obj) = 0;
virtual void InspectCanvas(const TObject *obj) = 0;
virtual void MakeCanvas(const char *name, const char *title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh) = 0;
virtual void RemoveObject(TObject *parent, const TObject *obj) = 0;
ClassDef(TVirtualUtilPad,0) //Abstract interface to the pad/canvas utilities
};
#endif
// @(#)root/base:$Name: $:$Id: TVirtualUtilPad.cxx,v 1.1 2002/09/15 19:41:52 brun Exp $
// Author: Rene Brun 14/09/2002
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
//////////////////////////////////////////////////////////////////////////
// //
// Abstract interface to the pad/canvas utilities //
// //
//////////////////////////////////////////////////////////////////////////
#include "TVirtualUtilPad.h"
#include "TROOT.h"
ClassImp(TVirtualUtilPad)
//______________________________________________________________________________
TVirtualUtilPad::TVirtualUtilPad()
{
// Constructor.
SetName("R__TVirtualUtilPad");
TVirtualUtilPad *u = (TVirtualUtilPad*)gROOT->GetListOfSpecials()->FindObject("R__TVirtualUtilPad");
if (!u) gROOT->GetListOfSpecials()->Add(this);
}
//______________________________________________________________________________
TVirtualUtilPad::~TVirtualUtilPad()
{
// Destructor.
}
/* @(#)root/gpad:$Name: $:$Id: LinkDef.h,v 1.5 2002/09/15 19:49:09 brun Exp $ */ /* @(#)root/gpad:$Name: $:$Id: LinkDef.h,v 1.6 2005/04/11 08:40:59 brun Exp $ */
/************************************************************************* /*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#pragma link C++ class TPaveClass+; #pragma link C++ class TPaveClass+;
#pragma link C++ class TSlider+; #pragma link C++ class TSlider+;
#pragma link C++ class TSliderBox+; #pragma link C++ class TSliderBox+;
#pragma link C++ class TUtilPad;
#pragma link C++ class TViewer3DPad; #pragma link C++ class TViewer3DPad;
#endif #endif
// @(#)root/gpad:$Name: $:$Id: TUtilPad.h,v 1.5 2004/07/20 20:55:42 rdm Exp $
// Author: Rene Brun 14/09/2002
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TUtilPad
#define ROOT_TUtilPad
//////////////////////////////////////////////////////////////////////////
// //
// TUtilPad //
// //
// misc. pad/canvas utilities //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TVirtualUtilPad
#include "TVirtualUtilPad.h"
#endif
class TUtilPad : public TVirtualUtilPad {
private:
static Int_t fgPanelVersion; //Draw/FitPanel version (0=new, 1=old)
public:
TUtilPad();
virtual ~TUtilPad();
virtual void DrawPanel(const TVirtualPad *pad, const TObject *obj);
virtual void FitPanel(const TVirtualPad *pad, const TObject *obj);
virtual void FitPanelGraph(const TVirtualPad *pad, const TObject *obj);
virtual void InspectCanvas(const TObject *obj);
virtual void MakeCanvas(const char *name, const char *title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh);
virtual void RemoveObject(TObject *parent, const TObject *obj);
static void SetPanelVersion(Int_t version=0);
ClassDef(TUtilPad,0) //misc. pad/canvas utilities
};
#endif
// @(#)root/gpad:$Name: $:$Id: TUtilPad.cxx,v 1.7 2006/10/06 12:00:21 brun Exp $
// Author: Rene Brun 14/09/2002
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
//////////////////////////////////////////////////////////////////////////
// //
// misc. pad/canvas utilities //
// //
// The functions in this class are called via the TPluginManager. //
// see TVirtualUtilPad.h for more information . //
// //
//////////////////////////////////////////////////////////////////////////
#include "TUtilPad.h"
#include "TROOT.h"
#include "TEnv.h"
#include "TCanvas.h"
#include "TGraph.h"
#include "TFitPanelGraph.h"
#include "TDrawPanelHist.h"
#include "TInspectCanvas.h"
#include "TVirtualPadEditor.h"
#include "TSystem.h"
Int_t TUtilPad::fgPanelVersion = 0;
ClassImp(TUtilPad)
//______________________________________________________________________________
TUtilPad::TUtilPad() : TVirtualUtilPad()
{
// note that this object is automatically added to the gROOT list of specials
// in the TVirtualUtilPad constructor.
}
//______________________________________________________________________________
TUtilPad::~TUtilPad()
{
}
//______________________________________________________________________________
void TUtilPad::DrawPanel(const TVirtualPad *pad, const TObject *obj)
{
// interface to the TDrawPanelHist
const char *editor = gEnv->GetValue("Plugin.TVirtualPadEditor","");
if (fgPanelVersion == 0 && strstr(editor,"TGedEditor")) {
//new interface by Carsten Hof
//gROOT->ProcessLine(Form("TVirtualPadEditor::ShowEditor();"));
TVirtualPadEditor *editor = TVirtualPadEditor::GetPadEditor();
editor->Show();
gROOT->ProcessLine(Form("((TCanvas*)0x%x)->Selected((TVirtualPad*)0x%x,(TObject*)0x%x,1)",pad->GetCanvas(),pad,obj));
return;
}
// old Drawpanel (default)
TList *lc = (TList*)gROOT->GetListOfCanvases();
TDrawPanelHist *R__drawpanelhist = (TDrawPanelHist*)lc->FindObject("R__drawpanelhist");
if (!R__drawpanelhist) {
new TDrawPanelHist("R__drawpanelhist","Hist Draw Panel",330,450,pad,obj);
return;
}
R__drawpanelhist->SetDefaults();
R__drawpanelhist->Show();
}
//______________________________________________________________________________
void TUtilPad::FitPanel(const TVirtualPad *pad, const TObject *obj)
{
// interface to the TFitPanel
if (fgPanelVersion == 0) {
// new interface (default)
if (!gROOT->GetClass("TFitEditor"))
gSystem->Load("libFitPanel");
gROOT->ProcessLine(Form("TFitEditor::Open((TVirtualPad*)0x%x,(TObject*)0x%x)",pad,obj));
} else {
// old FitPanel - use TUtilPad::SetPanelVersion(1)
TList *lc = (TList*)gROOT->GetListOfCanvases();
TFitPanel *R__fitpanel = (TFitPanel*)lc->FindObject("R__fitpanel");
if (!R__fitpanel) {
new TFitPanel("R__fitpanel","Fit Panel",300,400,pad,obj);
return;
}
R__fitpanel->SetDefaults();
R__fitpanel->Show();
}
}
//______________________________________________________________________________
void TUtilPad::FitPanelGraph(const TVirtualPad *pad, const TObject *obj)
{
// interface to the TFitPanelGraph
if (fgPanelVersion == 0) {
// new interface (default)
if (!gROOT->GetClass("TFitEditor"))
gSystem->Load("libFitPanel");
gROOT->ProcessLine(Form("TFitEditor::Open((TVirtualPad*)0x%x,(TObject*)0x%x)",pad,obj));
} else {
// old FitPanel - use TUtilPad::SetPanelVersion(1)
TList *lc = (TList*)gROOT->GetListOfCanvases();
TFitPanelGraph *R__fitpanel = (TFitPanelGraph*)lc->FindObject("R__fitpanelgraph");
if (!R__fitpanel) {
new TFitPanelGraph("R__fitpanelgraph","Fit Panel",300,400,pad,obj);
return;
}
R__fitpanel->SetDefaults();
R__fitpanel->Show();
}
}
//______________________________________________________________________________
void TUtilPad::InspectCanvas(const TObject *obj)
{
// interface to the object inspector
TInspectCanvas::Inspector((TObject*)obj);
}
//______________________________________________________________________________
void TUtilPad::MakeCanvas(const char *name, const char *title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh)
{
// to create a general canvas with position and size
new TCanvas(name,title,wtopx,wtopy,ww,wh);
}
//______________________________________________________________________________
void TUtilPad::RemoveObject(TObject *parent, const TObject *obj)
{
// to remove an object (eg a TF1) from the list of functions of parent.
if (!parent->InheritsFrom(TGraph::Class())) return;
TGraph *gr = (TGraph*)parent;
gr->GetListOfFunctions()->Remove((TObject*)obj);
}
//______________________________________________________________________________
void TUtilPad::SetPanelVersion(Int_t version)
{
// static function to set teh DrawPanel version
// version = 0 (default) old DrawPanel
// version = 1 new prototype from Marek Biskup
fgPanelVersion = version;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment