ROOT logo
// @(#)root/base:$Id: TVirtualPadEditor.cxx,v 1.0 2003/11/25
// Author: Ilka Antcheva   25/11/03
/*************************************************************************
 * 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.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TVirtualPadEditor                                                    //
//                                                                      //
// Abstract base class used by ROOT graphics editor                     //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TROOT.h"
#include "TVirtualPadEditor.h"
#include "TPluginManager.h"
#include "TEnv.h"
#include "TVirtualPad.h"

TVirtualPadEditor *TVirtualPadEditor::fgPadEditor  = 0;
TString            TVirtualPadEditor::fgEditorName = "";

ClassImp(TVirtualPadEditor)

//______________________________________________________________________________
TVirtualPadEditor::TVirtualPadEditor()
{
   // Virtual editor ctor.

}

//______________________________________________________________________________
TVirtualPadEditor::~TVirtualPadEditor()
{
   // Virtual editor dtor.

}

//______________________________________________________________________________
TVirtualPadEditor *TVirtualPadEditor::LoadEditor()
{
   // Static function returning a pointer to a new pad editor.
   // This pointer can be adopted by a TCanvas (i.e. TRootCanvas)
   // when it embeds the editor.

   TPluginHandler *h;
   if (fgEditorName.Length() == 0)
      fgEditorName = gEnv->GetValue("Root.PadEditor","Ged");
   h = gROOT->GetPluginManager()->FindHandler("TVirtualPadEditor",
                                              fgEditorName);
   if (h) {
      if (h->LoadPlugin() == -1)
         return 0;
      return (TVirtualPadEditor*) h->ExecPlugin(1, gPad->GetCanvas());
   }

   return 0;
}

//______________________________________________________________________________
const char *TVirtualPadEditor::GetEditorName()
{
   // Returns the type of the default pad editor. Static method.

   return fgEditorName;
}

//______________________________________________________________________________
TVirtualPadEditor *TVirtualPadEditor::GetPadEditor(Bool_t load)
{
   // Returns the pad editor dialog. Static method.

   if (!fgPadEditor && load)
      fgPadEditor = LoadEditor();

   return fgPadEditor;
}

//______________________________________________________________________________
void TVirtualPadEditor::SetPadEditorName(const char *name)
{
   // Set type of default pad editor. Static method.

   if (fgEditorName == name) return;
   delete fgPadEditor;
   fgPadEditor = 0;
   fgEditorName = name;
}

//______________________________________________________________________________
void TVirtualPadEditor::ShowEditor()
{
   // Show the global pad editor. Static method.

   if (!fgPadEditor) {
      GetPadEditor();
      fgPadEditor->SetGlobal(kTRUE);
   }
   fgPadEditor->Show();
}

//______________________________________________________________________________
void TVirtualPadEditor::HideEditor()
{
   //  Hide the pad editor. Static method.

   if (fgPadEditor)
      fgPadEditor->Hide();
}

//______________________________________________________________________________
void TVirtualPadEditor::Terminate()
{
   // Close the global pad editor. Static method.

   if (!fgPadEditor) return;

   delete fgPadEditor;
   fgPadEditor = 0;
}

//______________________________________________________________________________
void TVirtualPadEditor::UpdateFillAttributes(Int_t color, Int_t style)
{
   // Update fill attributes via the pad editor

   ShowEditor();

   fgPadEditor->FillAttributes(color, style);
}

//______________________________________________________________________________
void TVirtualPadEditor::UpdateTextAttributes(Int_t align, Float_t angle,
                                             Int_t col, Int_t font, Float_t tsize)
{
   // Update text attributes via the pad editor

   ShowEditor();

   fgPadEditor->TextAttributes(align, angle, col, font, tsize);
}

//______________________________________________________________________________
void TVirtualPadEditor::UpdateLineAttributes(Int_t color, Int_t style,
                                             Int_t width)
{
   // Update line attributes via the pad editor

   ShowEditor();

   fgPadEditor->LineAttributes(color, style, width);
}

//______________________________________________________________________________
void TVirtualPadEditor::UpdateMarkerAttributes(Int_t color, Int_t style,
                                               Float_t msize)
{
   // Update marker attributes via the pad editor

   ShowEditor();

   fgPadEditor->MarkerAttributes(color, style, msize);
}
 TVirtualPadEditor.cxx:1
 TVirtualPadEditor.cxx:2
 TVirtualPadEditor.cxx:3
 TVirtualPadEditor.cxx:4
 TVirtualPadEditor.cxx:5
 TVirtualPadEditor.cxx:6
 TVirtualPadEditor.cxx:7
 TVirtualPadEditor.cxx:8
 TVirtualPadEditor.cxx:9
 TVirtualPadEditor.cxx:10
 TVirtualPadEditor.cxx:11
 TVirtualPadEditor.cxx:12
 TVirtualPadEditor.cxx:13
 TVirtualPadEditor.cxx:14
 TVirtualPadEditor.cxx:15
 TVirtualPadEditor.cxx:16
 TVirtualPadEditor.cxx:17
 TVirtualPadEditor.cxx:18
 TVirtualPadEditor.cxx:19
 TVirtualPadEditor.cxx:20
 TVirtualPadEditor.cxx:21
 TVirtualPadEditor.cxx:22
 TVirtualPadEditor.cxx:23
 TVirtualPadEditor.cxx:24
 TVirtualPadEditor.cxx:25
 TVirtualPadEditor.cxx:26
 TVirtualPadEditor.cxx:27
 TVirtualPadEditor.cxx:28
 TVirtualPadEditor.cxx:29
 TVirtualPadEditor.cxx:30
 TVirtualPadEditor.cxx:31
 TVirtualPadEditor.cxx:32
 TVirtualPadEditor.cxx:33
 TVirtualPadEditor.cxx:34
 TVirtualPadEditor.cxx:35
 TVirtualPadEditor.cxx:36
 TVirtualPadEditor.cxx:37
 TVirtualPadEditor.cxx:38
 TVirtualPadEditor.cxx:39
 TVirtualPadEditor.cxx:40
 TVirtualPadEditor.cxx:41
 TVirtualPadEditor.cxx:42
 TVirtualPadEditor.cxx:43
 TVirtualPadEditor.cxx:44
 TVirtualPadEditor.cxx:45
 TVirtualPadEditor.cxx:46
 TVirtualPadEditor.cxx:47
 TVirtualPadEditor.cxx:48
 TVirtualPadEditor.cxx:49
 TVirtualPadEditor.cxx:50
 TVirtualPadEditor.cxx:51
 TVirtualPadEditor.cxx:52
 TVirtualPadEditor.cxx:53
 TVirtualPadEditor.cxx:54
 TVirtualPadEditor.cxx:55
 TVirtualPadEditor.cxx:56
 TVirtualPadEditor.cxx:57
 TVirtualPadEditor.cxx:58
 TVirtualPadEditor.cxx:59
 TVirtualPadEditor.cxx:60
 TVirtualPadEditor.cxx:61
 TVirtualPadEditor.cxx:62
 TVirtualPadEditor.cxx:63
 TVirtualPadEditor.cxx:64
 TVirtualPadEditor.cxx:65
 TVirtualPadEditor.cxx:66
 TVirtualPadEditor.cxx:67
 TVirtualPadEditor.cxx:68
 TVirtualPadEditor.cxx:69
 TVirtualPadEditor.cxx:70
 TVirtualPadEditor.cxx:71
 TVirtualPadEditor.cxx:72
 TVirtualPadEditor.cxx:73
 TVirtualPadEditor.cxx:74
 TVirtualPadEditor.cxx:75
 TVirtualPadEditor.cxx:76
 TVirtualPadEditor.cxx:77
 TVirtualPadEditor.cxx:78
 TVirtualPadEditor.cxx:79
 TVirtualPadEditor.cxx:80
 TVirtualPadEditor.cxx:81
 TVirtualPadEditor.cxx:82
 TVirtualPadEditor.cxx:83
 TVirtualPadEditor.cxx:84
 TVirtualPadEditor.cxx:85
 TVirtualPadEditor.cxx:86
 TVirtualPadEditor.cxx:87
 TVirtualPadEditor.cxx:88
 TVirtualPadEditor.cxx:89
 TVirtualPadEditor.cxx:90
 TVirtualPadEditor.cxx:91
 TVirtualPadEditor.cxx:92
 TVirtualPadEditor.cxx:93
 TVirtualPadEditor.cxx:94
 TVirtualPadEditor.cxx:95
 TVirtualPadEditor.cxx:96
 TVirtualPadEditor.cxx:97
 TVirtualPadEditor.cxx:98
 TVirtualPadEditor.cxx:99
 TVirtualPadEditor.cxx:100
 TVirtualPadEditor.cxx:101
 TVirtualPadEditor.cxx:102
 TVirtualPadEditor.cxx:103
 TVirtualPadEditor.cxx:104
 TVirtualPadEditor.cxx:105
 TVirtualPadEditor.cxx:106
 TVirtualPadEditor.cxx:107
 TVirtualPadEditor.cxx:108
 TVirtualPadEditor.cxx:109
 TVirtualPadEditor.cxx:110
 TVirtualPadEditor.cxx:111
 TVirtualPadEditor.cxx:112
 TVirtualPadEditor.cxx:113
 TVirtualPadEditor.cxx:114
 TVirtualPadEditor.cxx:115
 TVirtualPadEditor.cxx:116
 TVirtualPadEditor.cxx:117
 TVirtualPadEditor.cxx:118
 TVirtualPadEditor.cxx:119
 TVirtualPadEditor.cxx:120
 TVirtualPadEditor.cxx:121
 TVirtualPadEditor.cxx:122
 TVirtualPadEditor.cxx:123
 TVirtualPadEditor.cxx:124
 TVirtualPadEditor.cxx:125
 TVirtualPadEditor.cxx:126
 TVirtualPadEditor.cxx:127
 TVirtualPadEditor.cxx:128
 TVirtualPadEditor.cxx:129
 TVirtualPadEditor.cxx:130
 TVirtualPadEditor.cxx:131
 TVirtualPadEditor.cxx:132
 TVirtualPadEditor.cxx:133
 TVirtualPadEditor.cxx:134
 TVirtualPadEditor.cxx:135
 TVirtualPadEditor.cxx:136
 TVirtualPadEditor.cxx:137
 TVirtualPadEditor.cxx:138
 TVirtualPadEditor.cxx:139
 TVirtualPadEditor.cxx:140
 TVirtualPadEditor.cxx:141
 TVirtualPadEditor.cxx:142
 TVirtualPadEditor.cxx:143
 TVirtualPadEditor.cxx:144
 TVirtualPadEditor.cxx:145
 TVirtualPadEditor.cxx:146
 TVirtualPadEditor.cxx:147
 TVirtualPadEditor.cxx:148
 TVirtualPadEditor.cxx:149
 TVirtualPadEditor.cxx:150
 TVirtualPadEditor.cxx:151
 TVirtualPadEditor.cxx:152
 TVirtualPadEditor.cxx:153
 TVirtualPadEditor.cxx:154
 TVirtualPadEditor.cxx:155
 TVirtualPadEditor.cxx:156
 TVirtualPadEditor.cxx:157
 TVirtualPadEditor.cxx:158
 TVirtualPadEditor.cxx:159
 TVirtualPadEditor.cxx:160
 TVirtualPadEditor.cxx:161
 TVirtualPadEditor.cxx:162
 TVirtualPadEditor.cxx:163
 TVirtualPadEditor.cxx:164
 TVirtualPadEditor.cxx:165
 TVirtualPadEditor.cxx:166
 TVirtualPadEditor.cxx:167
 TVirtualPadEditor.cxx:168