00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "TROOT.h"
00020 #include "TVirtualPadEditor.h"
00021 #include "TPluginManager.h"
00022 #include "TEnv.h"
00023 #include "TVirtualPad.h"
00024
00025 TVirtualPadEditor *TVirtualPadEditor::fgPadEditor = 0;
00026 TString TVirtualPadEditor::fgEditorName = "";
00027
00028 ClassImp(TVirtualPadEditor)
00029
00030
00031 TVirtualPadEditor::TVirtualPadEditor()
00032 {
00033
00034
00035 }
00036
00037
00038 TVirtualPadEditor::~TVirtualPadEditor()
00039 {
00040
00041
00042 }
00043
00044
00045 TVirtualPadEditor *TVirtualPadEditor::LoadEditor()
00046 {
00047
00048
00049
00050
00051 TPluginHandler *h;
00052 if (fgEditorName.Length() == 0)
00053 fgEditorName = gEnv->GetValue("Root.PadEditor","Ged");
00054 h = gROOT->GetPluginManager()->FindHandler("TVirtualPadEditor",
00055 fgEditorName);
00056 if (h) {
00057 if (h->LoadPlugin() == -1)
00058 return 0;
00059 return (TVirtualPadEditor*) h->ExecPlugin(1, gPad ? gPad->GetCanvas() : 0);
00060 }
00061
00062 return 0;
00063 }
00064
00065
00066 const char *TVirtualPadEditor::GetEditorName()
00067 {
00068
00069
00070 return fgEditorName;
00071 }
00072
00073
00074 TVirtualPadEditor *TVirtualPadEditor::GetPadEditor(Bool_t load)
00075 {
00076
00077
00078 if (!fgPadEditor && load)
00079 fgPadEditor = LoadEditor();
00080
00081 return fgPadEditor;
00082 }
00083
00084
00085 void TVirtualPadEditor::SetPadEditorName(const char *name)
00086 {
00087
00088
00089 if (fgEditorName == name) return;
00090 delete fgPadEditor;
00091 fgPadEditor = 0;
00092 fgEditorName = name;
00093 }
00094
00095
00096 void TVirtualPadEditor::ShowEditor()
00097 {
00098
00099
00100 if (!fgPadEditor) {
00101 GetPadEditor();
00102 if (!fgPadEditor) return;
00103 fgPadEditor->SetGlobal(kTRUE);
00104 }
00105 fgPadEditor->Show();
00106 }
00107
00108
00109 void TVirtualPadEditor::HideEditor()
00110 {
00111
00112
00113 if (fgPadEditor)
00114 fgPadEditor->Hide();
00115 }
00116
00117
00118 void TVirtualPadEditor::Terminate()
00119 {
00120
00121
00122 if (!fgPadEditor) return;
00123
00124 delete fgPadEditor;
00125 fgPadEditor = 0;
00126 }
00127
00128
00129 void TVirtualPadEditor::UpdateFillAttributes(Int_t color, Int_t style)
00130 {
00131
00132
00133 ShowEditor();
00134
00135 if (fgPadEditor)
00136 fgPadEditor->FillAttributes(color, style);
00137 }
00138
00139
00140 void TVirtualPadEditor::UpdateTextAttributes(Int_t align, Float_t angle,
00141 Int_t col, Int_t font, Float_t tsize)
00142 {
00143
00144
00145 ShowEditor();
00146
00147 if (fgPadEditor)
00148 fgPadEditor->TextAttributes(align, angle, col, font, tsize);
00149 }
00150
00151
00152 void TVirtualPadEditor::UpdateLineAttributes(Int_t color, Int_t style,
00153 Int_t width)
00154 {
00155
00156
00157 ShowEditor();
00158
00159 if (fgPadEditor)
00160 fgPadEditor->LineAttributes(color, style, width);
00161 }
00162
00163
00164 void TVirtualPadEditor::UpdateMarkerAttributes(Int_t color, Int_t style,
00165 Float_t msize)
00166 {
00167
00168
00169 ShowEditor();
00170
00171 if (fgPadEditor)
00172 fgPadEditor->MarkerAttributes(color, style, msize);
00173 }