Skip to content
Snippets Groups Projects
Commit 3ac1d584 authored by Sergey Linev's avatar Sergey Linev
Browse files

Introduce plugin handler for TWebCanvas

Allows to create web-based canvas from regular TGuiFactory
So also in batch mode one should be able to start web-based widgets
parent 865191ad
No related branches found
No related tags found
No related merge requests found
...@@ -57,6 +57,15 @@ TApplicationImp *TGuiFactory::CreateApplicationImp(const char *classname, int *a ...@@ -57,6 +57,15 @@ TApplicationImp *TGuiFactory::CreateApplicationImp(const char *classname, int *a
TCanvasImp *TGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, UInt_t width, UInt_t height) TCanvasImp *TGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, UInt_t width, UInt_t height)
{ {
if (gROOT->IsWebDisplay()) {
auto ph = gROOT->GetPluginManager()->FindHandler("TCanvasImp", "TWebCanvas");
if (ph && ph->LoadPlugin() != -1) {
auto imp = (TCanvasImp *) ph->ExecPlugin(6, c, title, 0, 0, width, height);
if (imp) return imp;
}
}
return new TCanvasImp(c, title, width, height); return new TCanvasImp(c, title, width, height);
} }
...@@ -65,6 +74,15 @@ TCanvasImp *TGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, UInt_t w ...@@ -65,6 +74,15 @@ TCanvasImp *TGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, UInt_t w
TCanvasImp *TGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height) TCanvasImp *TGuiFactory::CreateCanvasImp(TCanvas *c, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height)
{ {
if (gROOT->IsWebDisplay()) {
auto ph = gROOT->GetPluginManager()->FindHandler("TCanvasImp", "TWebCanvas");
if (ph && ph->LoadPlugin() != -1) {
auto imp = (TCanvasImp *) ph->ExecPlugin(6, c, title, x, y, width, height);
if (imp) return imp;
}
}
return new TCanvasImp(c, title, x, y, width, height); return new TCanvasImp(c, title, x, y, width, height);
} }
......
void P010_TWebCanvas()
{
gPluginMgr->AddHandler("TCanvasImp", "TWebCanvas", "TWebCanvas",
"WebGui6", "NewCanvas(TCanvas *, const char *, Int_t, Int_t, UInt_t, UInt_t)");
}
...@@ -229,6 +229,8 @@ public: ...@@ -229,6 +229,8 @@ public:
static bool ProduceImage(TCanvas *c, const char *filename, Int_t width = 0, Int_t height = 0); static bool ProduceImage(TCanvas *c, const char *filename, Int_t width = 0, Int_t height = 0);
static TCanvasImp *NewCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height);
ClassDefOverride(TWebCanvas, 0) // Web-based implementation for TCanvasImp, read-only mode ClassDefOverride(TWebCanvas, 0) // Web-based implementation for TCanvasImp, read-only mode
}; };
......
...@@ -1876,4 +1876,14 @@ TObject *TWebCanvas::FindPrimitive(const std::string &sid, int idcnt, TPad *pad, ...@@ -1876,4 +1876,14 @@ TObject *TWebCanvas::FindPrimitive(const std::string &sid, int idcnt, TPad *pad,
return nullptr; return nullptr;
} }
//////////////////////////////////////////////////////////////////////////////////////////////////
/// Static method to create TWebCanvas instance
/// Used by plugin manager
TCanvasImp *TWebCanvas::NewCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height)
{
Bool_t readonly = gEnv->GetValue("WebGui.FullCanvas", (Int_t) 1) == 0;
return new TWebCanvas(c, name, x, y, width, height, readonly);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment