Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TWebCanvas.h
Go to the documentation of this file.
1// Author: Sergey Linev, GSI 7/12/2016
2
3/*************************************************************************
4 * Copyright (C) 1995-2023, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT_TWebCanvas
12#define ROOT_TWebCanvas
13
14#include "TCanvasImp.h"
15
16#include "TString.h"
17#include "TList.h"
18#include "TWebPadOptions.h"
19
20#include <ROOT/RWebWindow.hxx>
21
22#include <vector>
23#include <string>
24#include <queue>
25#include <functional>
26#include <map>
27
28class TPad;
29class TPadWebSnapshot;
30class TWebPS;
31class TObjLink;
32class TExec;
33class TWebCanvasTimer;
34
35class TWebCanvas : public TCanvasImp {
36
37friend class TWebCanvasTimer;
38
39public:
40 /// Function type for signals, invoked when canvas drawing or update is completed
41 using UpdatedSignal_t = std::function<void()>;
42
43 /// Function type for pad-related signals - like activate pad signal
44 using PadSignal_t = std::function<void(TPad *)>;
45
46 /// Function type for pad-click signals
47 using PadClickedSignal_t = std::function<void(TPad *, int, int)>;
48
49 /// Function type for signals, invoked when object is selected
50 using ObjectSelectSignal_t = std::function<void(TPad *, TObject *)>;
51
52protected:
53
54 /// Function called when pad painting produced
55 using PadPaintingReady_t = std::function<void(TPadWebSnapshot *)>;
56
57 struct WebConn {
58 unsigned fConnId{0}; ///<! connection id
59 Long64_t fCheckedVersion{0}; ///<! canvas version checked before sending
60 Long64_t fSendVersion{0}; ///<! canvas version send to the client
61 Long64_t fDrawVersion{0}; ///<! canvas version drawn (confirmed) by client
62 UInt_t fLastSendHash{0}; ///<! hash of last send draw message, avoid looping
63 std::map<std::string, std::string> fCtrl; ///<! different ctrl parameters which can be send at once
64 std::queue<std::string> fSend; ///<! send queue, processed after sending draw data
65
66 WebConn(unsigned id) : fConnId(id) {}
67 bool is_batch() const { return fConnId == 0; }
68 bool match(unsigned id) const { return !is_batch() && ((fConnId == id) || (id == 0)); }
69 void reset()
70 {
72 fLastSendHash = 0;
73 }
74 };
75
76 struct PadStatus {
77 Long64_t fVersion{0}; ///<! last pad version
78 bool _detected{false}; ///<! if pad was detected during last scan
79 bool _modified{false}; ///<! if pad was modified during last scan
80 bool _has_specials{false}; ///<! are there any special objects with painting
81 };
82
83 std::vector<WebConn> fWebConn; ///<! connections
84 TWebCanvasTimer *fTimer{nullptr}; ///<! timer to submit control messages
85
86 std::map<TPad*, PadStatus> fPadsStatus; ///<! map of pads in canvas and their status flags
87
88 std::shared_ptr<ROOT::RWebWindow> fWindow; ///!< configured display
89
90 Bool_t fReadOnly{kFALSE}; ///<! in read-only mode canvas cannot be changed from client side
91 Long64_t fCanvVersion{1}; ///<! actual canvas version, changed with every new Modified() call
92 UInt_t fClientBits{0}; ///<! latest status bits from client like editor visible or not
93 std::vector<TPad *> fAllPads; ///<! list of all pads recognized during streaming
94 std::map<TObject *,bool> fUsedObjs; ///<! map of used objects during streaming
95 Int_t fStyleDelivery{0}; ///<! gStyle delivery to clients: 0:never, 1:once, 2:always
96 Int_t fPaletteDelivery{1}; ///<! colors palette delivery 0:never, 1:once, 2:always, 3:per subpad
97 Int_t fPrimitivesMerge{100}; ///<! number of PS primitives, which will be merged together
98 Int_t fJsonComp{0}; ///<! compression factor for messages send to the client
99 Bool_t fCanCreateObjects{kTRUE}; ///<! indicates if canvas allowed to create extra objects for interactive painting
100 Bool_t fLongerPolling{kFALSE}; ///<! when true, make longer polling in blocking operations
101 Bool_t fProcessingData{kFALSE}; ///<! flag used to prevent blocking methods when process data is invoked
102 Bool_t fAsyncMode{kFALSE}; ///<! when true, methods like TCanvas::Update will never block
103 Long64_t fStyleVersion{0}; ///<! current gStyle object version, checked every time when new snapshot created
104 UInt_t fStyleHash{0}; ///<! last hash of gStyle
105 Long64_t fColorsVersion{0}; ///<! current colors/palette version, checked every time when new snapshot created
106 UInt_t fColorsHash{0}; ///<! last hash of colors/palette
107 Int_t fTF1UseSave{1}; ///<! use save buffer for TF1/TF2, 0:off, 1:prefer, 2:force
108 std::vector<int> fWindowGeometry; ///<! last received window geometry
109 Bool_t fFixedSize{kFALSE}; ///<! is canvas size fixed
110
111 UpdatedSignal_t fUpdatedSignal; ///<! signal emitted when canvas updated or state is changed
112 PadSignal_t fActivePadChangedSignal; ///<! signal emitted when active pad changed in the canvas
113 PadClickedSignal_t fPadClickedSignal; ///<! signal emitted when simple mouse click performed on the pad
114 PadClickedSignal_t fPadDblClickedSignal; ///<! signal emitted when simple mouse click performed on the pad
115 ObjectSelectSignal_t fObjSelectSignal; ///<! signal emitted when new object selected in the pad
116
117 std::vector<std::unique_ptr<ROOT::RWebDisplayHandle>> fHelpHandles; ///<! array of handles for help widgets
118
119 static std::string gCustomScripts; ///<! custom JavaScript code or URL on JavaScript files to load before start drawing
120 static std::vector<std::string> gCustomClasses; ///<! list of custom classes, which can be delivered as is to client
121
122 static UInt_t gBatchImageMode; ///<! configured batch size
123 static std::string gBatchMultiPdf; ///<! name of current multi-page pdf file
124 static std::vector<std::string> gBatchFiles; ///<! file names for batch job
125 static std::vector<std::string> gBatchJsons; ///<! converted jsons batch job
126 static std::vector<int> gBatchWidths; ///<! batch job widths
127 static std::vector<int> gBatchHeights; ///<! batch job heights
128
129 void Lock() override {}
130 void Unlock() override {}
131 Bool_t IsLocked() override { return kFALSE; }
132
133 Bool_t IsWeb() const override { return kTRUE; }
134 Bool_t PerformUpdate(Bool_t async) override;
136
138 void AddColorsPalette(TPadWebSnapshot &master);
139 void AddCustomFonts(TPadWebSnapshot &master);
140
141 void CreateObjectSnapshot(TPadWebSnapshot &master, TPad *pad, TObject *obj, const char *opt, TWebPS *masterps = nullptr);
142 void CreatePadSnapshot(TPadWebSnapshot &paddata, TPad *pad, Long64_t version, PadPaintingReady_t func);
143
144 void CheckPadModified(TPad *pad);
145
146 Bool_t CheckCanvasModified(bool force_modified = false);
147
148 void AddCtrlMsg(unsigned connid, const std::string &key, const std::string &value);
149
150 void AddSendQueue(unsigned connid, const std::string &msg);
151
152 Bool_t CheckDataToSend(unsigned connid = 0);
153
155
156 virtual Bool_t IsJSSupportedClass(TObject *obj, Bool_t many_primitives = kFALSE);
157
158 Bool_t IsFirstConn(unsigned connid) const { return (connid != 0) && (fWebConn.size() > 1) && (fWebConn[1].fConnId == connid); }
159
160 Bool_t IsFirstDrawn() const { return (fWebConn.size() > 1) && (fWebConn[1].fDrawVersion > 0); }
161
162 void ShowCmd(const std::string &arg, Bool_t show);
163
164 void AssignStatusBits(UInt_t bits);
165
166 virtual Bool_t ProcessData(unsigned connid, const std::string &arg);
167
168 virtual Bool_t DecodePadOptions(const std::string &, bool process_execs = false);
169
170 virtual Bool_t CanCreateObject(const std::string &) { return !IsReadOnly() && fCanCreateObjects; }
171
172 TPad *ProcessObjectOptions(TWebObjectOptions &item, TPad *pad, int idcnt = 1);
173
174 TObject *FindPrimitive(const std::string &id, int idcnt = 1, TPad *pad = nullptr, TObjLink **objlnk = nullptr, TPad **objpad = nullptr);
175
176 void ProcessExecs(TPad *pad, TExec *extra = nullptr);
177
178 void ProcessLinesForObject(TObject *obj, const std::string &lines);
179
180 void SetWindowGeometry(const std::vector<int> &arr);
181
182 static std::string ProcessCustomScripts(bool batch);
183
184 static bool FlushBatchImages();
185
186public:
187 TWebCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height, Bool_t readonly = kTRUE);
188 ~TWebCanvas() override;
189
190 void ShowWebWindow(const ROOT::RWebDisplayArgs &user_args = "");
191
192 const std::shared_ptr<ROOT::RWebWindow> &GetWebWindow() const { return fWindow; }
193
194 virtual Bool_t IsReadOnly() const { return fReadOnly; }
195
196 Int_t InitWindow() override;
197 void Close() override;
198 void Show() override;
199
201
202 void ShowMenuBar(Bool_t show = kTRUE) override { ShowCmd("Menu", show); }
203 void ShowStatusBar(Bool_t show = kTRUE) override { ShowCmd("StatusBar", show); }
204 void ShowEditor(Bool_t show = kTRUE) override { ShowCmd("Editor", show); }
205 void ShowToolBar(Bool_t show = kTRUE) override { ShowCmd("ToolBar", show); }
206 void ShowToolTips(Bool_t show = kTRUE) override { ShowCmd("ToolTips", show); }
207
208 // web-canvas specific methods
209
210 void ActivateInEditor(TPad *pad, TObject *obj);
211
212 void ForceUpdate() override;
213
214 void SetWindowPosition(Int_t x, Int_t y) override;
215 void SetWindowSize(UInt_t w, UInt_t h) override;
216 void SetWindowTitle(const char *newTitle) override;
217 void SetCanvasSize(UInt_t w, UInt_t h) override;
218 void Iconify() override;
219 void RaiseWindow() override;
220
221 /*
222 virtual void SetStatusText(const char *text = 0, Int_t partidx = 0);
223 virtual void ReallyDelete();
224 */
225
226 Bool_t HasEditor() const override;
227 Bool_t HasMenuBar() const override;
228 Bool_t HasStatusBar() const override;
229 Bool_t HasToolBar() const override { return kFALSE; }
230 Bool_t HasToolTips() const override;
231
237
240
243
246
249
252
254 Bool_t IsAsyncMode() const { return fAsyncMode; }
255
256 Bool_t IsFixedSize() const { return fFixedSize; }
257
258 static void SetCustomScripts(const std::string &src);
259 static const std::string &GetCustomScripts();
260
261 static void AddCustomClass(const std::string &clname, bool with_derived = false);
262 static bool IsCustomClass(const TClass *cl);
263
264 static Font_t AddFont(const char *name, const char *ttffile, Int_t precision = 2);
265
266 static TString CreatePadJSON(TPad *pad, Int_t json_compression = 0, Bool_t batchmode = kFALSE);
267 static TString CreateCanvasJSON(TCanvas *c, Int_t json_compression = 0, Bool_t batchmode = kFALSE);
268 static Int_t StoreCanvasJSON(TCanvas *c, const char *filename, const char *option = "");
269
270 static bool ProduceImage(TPad *pad, const char *filename, Int_t width = 0, Int_t height = 0);
271
272 static bool ProduceImages(std::vector<TPad *> pads, const char *filename, Int_t width = 0, Int_t height = 0);
273
274 static void BatchImageMode(UInt_t n = 100);
275
276 static TCanvasImp *NewCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height);
277
278 ClassDefOverride(TWebCanvas, 0) // Web-based implementation for TCanvasImp
279};
280
281#endif
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
short Font_t
Definition RtypesCore.h:81
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
long long Long64_t
Definition RtypesCore.h:69
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
char name[80]
Definition TGX11.cxx:110
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
ABC describing GUI independent main window (with menubar, scrollbars and a drawing area).
Definition TCanvasImp.h:30
The Canvas class.
Definition TCanvas.h:23
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
TExec is a utility class that can be used to execute a C++ command when some event happens in a pad.
Definition TExec.h:26
Mother of all ROOT objects.
Definition TObject.h:41
The most important graphics class in the ROOT system.
Definition TPad.h:28
Basic string class.
Definition TString.h:139
To make it possible to use GL for 2D graphic in a TPad/TCanvas.
Basic TCanvasImp ABI implementation for Web-based Graphics Provides painting of main ROOT classes in ...
Definition TWebCanvas.h:35
TVirtualPadPainter * CreatePadPainter() override
Creates web-based pad painter.
void ForceUpdate() override
Increment canvas version and force sending data to client - do not wait for reply.
Int_t GetPrimitivesMerge() const
Definition TWebCanvas.h:248
static void AddCustomClass(const std::string &clname, bool with_derived=false)
Assign custom class.
static TString CreatePadJSON(TPad *pad, Int_t json_compression=0, Bool_t batchmode=kFALSE)
Create JSON painting output for given pad Produce JSON can be used for offline drawing with JSROOT.
void SetCanvasSize(UInt_t w, UInt_t h) override
Set canvas size of web canvas.
UInt_t fColorsHash
! last hash of colors/palette
Definition TWebCanvas.h:106
const std::shared_ptr< ROOT::RWebWindow > & GetWebWindow() const
Definition TWebCanvas.h:192
Int_t fTF1UseSave
! use save buffer for TF1/TF2, 0:off, 1:prefer, 2:force
Definition TWebCanvas.h:107
void ShowCmd(const std::string &arg, Bool_t show)
Function used to send command to browser to toggle menu, toolbar, editors, ...
Bool_t fCanCreateObjects
! indicates if canvas allowed to create extra objects for interactive painting
Definition TWebCanvas.h:99
Long64_t fColorsVersion
! current colors/palette version, checked every time when new snapshot created
Definition TWebCanvas.h:105
virtual Bool_t IsReadOnly() const
Definition TWebCanvas.h:194
std::shared_ptr< ROOT::RWebWindow > fWindow
Definition TWebCanvas.h:88
virtual Bool_t IsJSSupportedClass(TObject *obj, Bool_t many_primitives=kFALSE)
Returns kTRUE when object is fully supported on JSROOT side In ROOT7 Paint function will just return ...
void AddCtrlMsg(unsigned connid, const std::string &key, const std::string &value)
Add control message for specified connection Same control message can be overwritten many time before...
static void SetCustomScripts(const std::string &src)
Configures custom script for canvas.
ObjectSelectSignal_t fObjSelectSignal
! signal emitted when new object selected in the pad
Definition TWebCanvas.h:115
PadClickedSignal_t fPadClickedSignal
! signal emitted when simple mouse click performed on the pad
Definition TWebCanvas.h:113
void SetActivePadChangedHandler(PadSignal_t func)
Definition TWebCanvas.h:233
void SetLongerPolling(Bool_t on)
Definition TWebCanvas.h:250
UInt_t fStyleHash
! last hash of gStyle
Definition TWebCanvas.h:104
virtual Bool_t CanCreateObject(const std::string &)
Definition TWebCanvas.h:170
void ShowWebWindow(const ROOT::RWebDisplayArgs &user_args="")
Show canvas in specified place.
void SetStyleDelivery(Int_t val)
Definition TWebCanvas.h:241
Int_t fPrimitivesMerge
! number of PS primitives, which will be merged together
Definition TWebCanvas.h:97
void ShowToolTips(Bool_t show=kTRUE) override
Definition TWebCanvas.h:206
void SetAsyncMode(Bool_t on=kTRUE)
Definition TWebCanvas.h:253
std::function< void()> UpdatedSignal_t
Function type for signals, invoked when canvas drawing or update is completed.
Definition TWebCanvas.h:41
void Show() override
Show canvas in browser window.
Bool_t HasToolBar() const override
Definition TWebCanvas.h:229
Bool_t WaitWhenCanvasPainted(Long64_t ver)
Wait when specified version of canvas was painted and confirmed by browser.
Bool_t IsWeb() const override
Definition TWebCanvas.h:133
void ShowMenuBar(Bool_t show=kTRUE) override
Definition TWebCanvas.h:202
static UInt_t gBatchImageMode
! configured batch size
Definition TWebCanvas.h:122
static std::string gCustomScripts
! custom JavaScript code or URL on JavaScript files to load before start drawing
Definition TWebCanvas.h:119
Bool_t IsAsyncMode() const
Definition TWebCanvas.h:254
UInt_t CalculateColorsHash()
Calculate hash function for all colors and palette.
void SetWindowGeometry(const std::vector< int > &arr)
Set window geometry as array with coordinates and dimensions.
Bool_t HasStatusBar() const override
Returns kTRUE if web canvas has status bar.
static std::vector< std::string > gCustomClasses
! list of custom classes, which can be delivered as is to client
Definition TWebCanvas.h:120
Bool_t IsFixedSize() const
Definition TWebCanvas.h:256
void Close() override
Close web canvas - not implemented.
static bool ProduceImages(std::vector< TPad * > pads, const char *filename, Int_t width=0, Int_t height=0)
Create images for several pads using batch (headless) capability of Chrome or Firefox browsers Suppor...
Bool_t HasMenuBar() const override
Returns kTRUE if web canvas has menu bar.
Int_t InitWindow() override
Initialize window for the web canvas At this place canvas is not yet register to the list of canvases...
void CheckPadModified(TPad *pad)
Returns true if any pad in the canvas were modified Reset modified flags, increment canvas version (i...
void RaiseWindow() override
Raise browser window.
static bool ProduceImage(TPad *pad, const char *filename, Int_t width=0, Int_t height=0)
Create image using batch (headless) capability of Chrome or Firefox browsers Supported png,...
void SetPadDblClickedHandler(PadClickedSignal_t func)
Definition TWebCanvas.h:235
void ActivateInEditor(TPad *pad, TObject *obj)
Activate object in editor in web browser.
std::vector< WebConn > fWebConn
! connections
Definition TWebCanvas.h:83
PadSignal_t fActivePadChangedSignal
! signal emitted when active pad changed in the canvas
Definition TWebCanvas.h:112
Bool_t GetLongerPolling() const
Definition TWebCanvas.h:251
UInt_t fClientBits
! latest status bits from client like editor visible or not
Definition TWebCanvas.h:92
std::function< void(TPadWebSnapshot *)> PadPaintingReady_t
Function called when pad painting produced.
Definition TWebCanvas.h:55
Int_t fPaletteDelivery
! colors palette delivery 0:never, 1:once, 2:always, 3:per subpad
Definition TWebCanvas.h:96
void ShowToolBar(Bool_t show=kTRUE) override
Definition TWebCanvas.h:205
Bool_t fProcessingData
! flag used to prevent blocking methods when process data is invoked
Definition TWebCanvas.h:101
Bool_t HasToolTips() const override
Returns kTRUE if tooltips are activated in web canvas.
std::vector< TPad * > fAllPads
! list of all pads recognized during streaming
Definition TWebCanvas.h:93
TWebCanvasTimer * fTimer
! timer to submit control messages
Definition TWebCanvas.h:84
static std::vector< std::string > gBatchJsons
! converted jsons batch job
Definition TWebCanvas.h:125
Long64_t fCanvVersion
! actual canvas version, changed with every new Modified() call
Definition TWebCanvas.h:91
std::vector< int > fWindowGeometry
! last received window geometry
Definition TWebCanvas.h:108
void SetPadClickedHandler(PadClickedSignal_t func)
Definition TWebCanvas.h:234
TPad * ProcessObjectOptions(TWebObjectOptions &item, TPad *pad, int idcnt=1)
Process data for single primitive Returns object pad if object was modified.
void CreateObjectSnapshot(TPadWebSnapshot &master, TPad *pad, TObject *obj, const char *opt, TWebPS *masterps=nullptr)
Creates representation of the object for painting in web browser.
std::map< TObject *, bool > fUsedObjs
! map of used objects during streaming
Definition TWebCanvas.h:94
void AddColorsPalette(TPadWebSnapshot &master)
Add special canvas objects with list of colors and color palette.
Long64_t fStyleVersion
! current gStyle object version, checked every time when new snapshot created
Definition TWebCanvas.h:103
void SetUpdatedHandler(UpdatedSignal_t func)
Definition TWebCanvas.h:232
static std::string gBatchMultiPdf
! name of current multi-page pdf file
Definition TWebCanvas.h:123
static void BatchImageMode(UInt_t n=100)
Configure batch image mode for web graphics.
std::vector< std::unique_ptr< ROOT::RWebDisplayHandle > > fHelpHandles
! array of handles for help widgets
Definition TWebCanvas.h:117
std::function< void(TPad *, int, int)> PadClickedSignal_t
Function type for pad-click signals.
Definition TWebCanvas.h:47
void AddSendQueue(unsigned connid, const std::string &msg)
Add message to send queue for specified connection If connid == 0, message will be add to all connect...
Bool_t fLongerPolling
! when true, make longer polling in blocking operations
Definition TWebCanvas.h:100
void ShowStatusBar(Bool_t show=kTRUE) override
Definition TWebCanvas.h:203
void Unlock() override
Definition TWebCanvas.h:130
void SetWindowPosition(Int_t x, Int_t y) override
Set window position of web canvas.
UpdatedSignal_t fUpdatedSignal
! signal emitted when canvas updated or state is changed
Definition TWebCanvas.h:111
Bool_t IsLocked() override
Definition TWebCanvas.h:131
Int_t fJsonComp
! compression factor for messages send to the client
Definition TWebCanvas.h:98
Bool_t IsFirstConn(unsigned connid) const
Definition TWebCanvas.h:158
static std::vector< int > gBatchWidths
! batch job widths
Definition TWebCanvas.h:126
~TWebCanvas() override
Destructor.
static std::string ProcessCustomScripts(bool batch)
For batch mode special handling of scripts are required Headless browser not able to load modules fro...
Bool_t fReadOnly
!< configured display
Definition TWebCanvas.h:90
std::map< TPad *, PadStatus > fPadsStatus
! map of pads in canvas and their status flags
Definition TWebCanvas.h:86
Bool_t fAsyncMode
! when true, methods like TCanvas::Update will never block
Definition TWebCanvas.h:102
void ShowEditor(Bool_t show=kTRUE) override
Definition TWebCanvas.h:204
static Font_t AddFont(const char *name, const char *ttffile, Int_t precision=2)
Add font to static list of fonts supported by the canvas Name specifies name of the font,...
void AddCustomFonts(TPadWebSnapshot &master)
Add special canvas objects with custom fonts.
Bool_t CheckDataToSend(unsigned connid=0)
Check if any data should be send to client If connid != 0, only selected connection will be checked.
Bool_t PerformUpdate(Bool_t async) override
if canvas or any subpad was modified, scan all primitives in the TCanvas and subpads and convert them...
void AssignStatusBits(UInt_t bits)
Assign clients bits.
virtual Bool_t ProcessData(unsigned connid, const std::string &arg)
Handle data from web browser Returns kFALSE if message was not processed.
void ProcessLinesForObject(TObject *obj, const std::string &lines)
Execute one or several methods for selected object String can be separated by ";;" to let execute sev...
std::function< void(TPad *)> PadSignal_t
Function type for pad-related signals - like activate pad signal.
Definition TWebCanvas.h:44
void SetCanCreateObjects(Bool_t on=kTRUE)
Definition TWebCanvas.h:238
static std::vector< int > gBatchHeights
! batch job heights
Definition TWebCanvas.h:127
static Int_t StoreCanvasJSON(TCanvas *c, const char *filename, const char *option="")
Create JSON painting output for given canvas and store into the file See TBufferJSON::ExportToFile() ...
void SetPrimitivesMerge(Int_t cnt)
Definition TWebCanvas.h:247
static const std::string & GetCustomScripts()
Returns configured custom script.
void Iconify() override
Iconify browser window.
void SetWindowTitle(const char *newTitle) override
Set window title of web canvas.
UInt_t GetWindowGeometry(Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) override
Returns window geometry including borders and menus.
static std::vector< std::string > gBatchFiles
! file names for batch job
Definition TWebCanvas.h:124
void SetPaletteDelivery(Int_t val)
Definition TWebCanvas.h:244
static TCanvasImp * NewCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height)
Static method to create TWebCanvas instance Used by plugin manager.
static TString CreateCanvasJSON(TCanvas *c, Int_t json_compression=0, Bool_t batchmode=kFALSE)
Create JSON painting output for given canvas Produce JSON can be used for offline drawing with JSROOT...
void SetObjSelectHandler(ObjectSelectSignal_t func)
Definition TWebCanvas.h:236
std::function< void(TPad *, TObject *)> ObjectSelectSignal_t
Function type for signals, invoked when object is selected.
Definition TWebCanvas.h:50
Bool_t HasEditor() const override
Returns kTRUE if web canvas has graphical editor.
Int_t fStyleDelivery
! gStyle delivery to clients: 0:never, 1:once, 2:always
Definition TWebCanvas.h:95
PadClickedSignal_t fPadDblClickedSignal
! signal emitted when simple mouse click performed on the pad
Definition TWebCanvas.h:114
void ProcessExecs(TPad *pad, TExec *extra=nullptr)
Process TExec objects in the pad.
void Lock() override
Definition TWebCanvas.h:129
static bool FlushBatchImages()
Flush batch images.
void CreatePadSnapshot(TPadWebSnapshot &paddata, TPad *pad, Long64_t version, PadPaintingReady_t func)
Create snapshot for pad and all primitives Callback function is used to create JSON in the middle of ...
Bool_t CheckCanvasModified(bool force_modified=false)
Check if any pad on the canvas was modified If yes, increment version of correspondent pad Returns tr...
Bool_t GetCanCreateObjects() const
Definition TWebCanvas.h:239
virtual Bool_t DecodePadOptions(const std::string &, bool process_execs=false)
Decode all pad options, which includes ranges plus objects options.
Int_t GetPaletteDelivery() const
Definition TWebCanvas.h:245
Bool_t IsFirstDrawn() const
Definition TWebCanvas.h:160
void SetWindowSize(UInt_t w, UInt_t h) override
Set window size of web canvas.
static bool IsCustomClass(const TClass *cl)
Checks if class belongs to custom.
TObject * FindPrimitive(const std::string &id, int idcnt=1, TPad *pad=nullptr, TObjLink **objlnk=nullptr, TPad **objpad=nullptr)
Search of object with given id in list of primitives One could specify pad where search could be star...
Bool_t fFixedSize
! is canvas size fixed
Definition TWebCanvas.h:109
Int_t GetStyleDelivery() const
Definition TWebCanvas.h:242
Class used to transport drawing options from the client.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
bool _has_specials
! are there any special objects with painting
Definition TWebCanvas.h:80
Long64_t fVersion
! last pad version
Definition TWebCanvas.h:77
bool _modified
! if pad was modified during last scan
Definition TWebCanvas.h:79
bool _detected
! if pad was detected during last scan
Definition TWebCanvas.h:78
std::map< std::string, std::string > fCtrl
! different ctrl parameters which can be send at once
Definition TWebCanvas.h:63
std::queue< std::string > fSend
! send queue, processed after sending draw data
Definition TWebCanvas.h:64
UInt_t fLastSendHash
! hash of last send draw message, avoid looping
Definition TWebCanvas.h:62
WebConn(unsigned id)
Definition TWebCanvas.h:66
bool is_batch() const
Definition TWebCanvas.h:67
unsigned fConnId
! connection id
Definition TWebCanvas.h:58
bool match(unsigned id) const
Definition TWebCanvas.h:68
Long64_t fSendVersion
! canvas version send to the client
Definition TWebCanvas.h:60
Long64_t fCheckedVersion
! canvas version checked before sending
Definition TWebCanvas.h:59
Long64_t fDrawVersion
! canvas version drawn (confirmed) by client
Definition TWebCanvas.h:61