11#ifndef ROOT_TWebCanvas
12#define ROOT_TWebCanvas
63 std::map<std::string, std::string>
fCtrl;
88 std::shared_ptr<ROOT::RWebWindow>
fWindow;
148 void AddCtrlMsg(
unsigned connid,
const std::string &key,
const std::string &
value);
150 void AddSendQueue(
unsigned connid,
const std::string &msg);
197 void Close()
override;
198 void Show()
override;
261 static void AddCustomClass(
const std::string &clname,
bool with_derived =
false);
#define ClassDefOverride(name, id)
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 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
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
ABC describing GUI independent main window (with menubar, scrollbars and a drawing area).
TClass instances represent classes, structs and namespaces in the ROOT type system.
TExec is a utility class that can be used to execute a C++ command when some event happens in a pad.
Wrapper around a TObject so it can be stored in a TList.
Mother of all ROOT objects.
The most important graphics class in the ROOT system.
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 ...
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
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
const std::shared_ptr< ROOT::RWebWindow > & GetWebWindow() const
Int_t fTF1UseSave
! use save buffer for TF1/TF2, 0:off, 1:prefer, 2:force
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
Long64_t fColorsVersion
! current colors/palette version, checked every time when new snapshot created
virtual Bool_t IsReadOnly() const
std::shared_ptr< ROOT::RWebWindow > fWindow
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
PadClickedSignal_t fPadClickedSignal
! signal emitted when simple mouse click performed on the pad
void SetActivePadChangedHandler(PadSignal_t func)
void SetLongerPolling(Bool_t on)
UInt_t fStyleHash
! last hash of gStyle
virtual Bool_t CanCreateObject(const std::string &)
void ShowWebWindow(const ROOT::RWebDisplayArgs &user_args="")
Show canvas in specified place.
void SetStyleDelivery(Int_t val)
Int_t fPrimitivesMerge
! number of PS primitives, which will be merged together
void ShowToolTips(Bool_t show=kTRUE) override
void SetAsyncMode(Bool_t on=kTRUE)
std::function< void()> UpdatedSignal_t
Function type for signals, invoked when canvas drawing or update is completed.
void Show() override
Show canvas in browser window.
Bool_t HasToolBar() const override
Bool_t WaitWhenCanvasPainted(Long64_t ver)
Wait when specified version of canvas was painted and confirmed by browser.
Bool_t IsWeb() const override
void ShowMenuBar(Bool_t show=kTRUE) override
static UInt_t gBatchImageMode
! configured batch size
static std::string gCustomScripts
! custom JavaScript code or URL on JavaScript files to load before start drawing
Bool_t IsAsyncMode() const
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
Bool_t IsFixedSize() const
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)
void ActivateInEditor(TPad *pad, TObject *obj)
Activate object in editor in web browser.
std::vector< WebConn > fWebConn
! connections
PadSignal_t fActivePadChangedSignal
! signal emitted when active pad changed in the canvas
Bool_t GetLongerPolling() const
UInt_t fClientBits
! latest status bits from client like editor visible or not
std::function< void(TPadWebSnapshot *)> PadPaintingReady_t
Function called when pad painting produced.
Int_t fPaletteDelivery
! colors palette delivery 0:never, 1:once, 2:always, 3:per subpad
void ShowToolBar(Bool_t show=kTRUE) override
Bool_t fProcessingData
! flag used to prevent blocking methods when process data is invoked
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
TWebCanvasTimer * fTimer
! timer to submit control messages
static std::vector< std::string > gBatchJsons
! converted jsons batch job
Long64_t fCanvVersion
! actual canvas version, changed with every new Modified() call
std::vector< int > fWindowGeometry
! last received window geometry
void SetPadClickedHandler(PadClickedSignal_t func)
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
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
void SetUpdatedHandler(UpdatedSignal_t func)
static std::string gBatchMultiPdf
! name of current multi-page pdf file
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
std::function< void(TPad *, int, int)> PadClickedSignal_t
Function type for pad-click signals.
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
void ShowStatusBar(Bool_t show=kTRUE) override
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
Bool_t IsLocked() override
Int_t fJsonComp
! compression factor for messages send to the client
Bool_t IsFirstConn(unsigned connid) const
static std::vector< int > gBatchWidths
! batch job widths
~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
std::map< TPad *, PadStatus > fPadsStatus
! map of pads in canvas and their status flags
Bool_t fAsyncMode
! when true, methods like TCanvas::Update will never block
void ShowEditor(Bool_t show=kTRUE) override
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.
void SetCanCreateObjects(Bool_t on=kTRUE)
static std::vector< int > gBatchHeights
! batch job heights
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)
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
void SetPaletteDelivery(Int_t val)
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)
std::function< void(TPad *, TObject *)> ObjectSelectSignal_t
Function type for signals, invoked when object is selected.
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
PadClickedSignal_t fPadDblClickedSignal
! signal emitted when simple mouse click performed on the pad
void ProcessExecs(TPad *pad, TExec *extra=nullptr)
Process TExec objects in the pad.
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
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
Bool_t IsFirstDrawn() const
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
Int_t GetStyleDelivery() const
Class used to transport drawing options from the client.
bool _has_specials
! are there any special objects with painting
Long64_t fVersion
! last pad version
bool _modified
! if pad was modified during last scan
bool _detected
! if pad was detected during last scan
std::map< std::string, std::string > fCtrl
! different ctrl parameters which can be send at once
std::queue< std::string > fSend
! send queue, processed after sending draw data
UInt_t fLastSendHash
! hash of last send draw message, avoid looping
unsigned fConnId
! connection id
bool match(unsigned id) const
Long64_t fSendVersion
! canvas version send to the client
Long64_t fCheckedVersion
! canvas version checked before sending
Long64_t fDrawVersion
! canvas version drawn (confirmed) by client