27std::mutex &GetHeldCanvasesMutex()
29 static std::mutex sMutex;
33std::vector<std::shared_ptr<ROOT::Experimental::RCanvas>> &GetHeldCanvases()
35 static std::vector<std::shared_ptr<ROOT::Experimental::RCanvas>> sCanvases;
47 std::lock_guard<std::mutex> grd(GetHeldCanvasesMutex());
49 return GetHeldCanvases();
58 std::vector<std::shared_ptr<ROOT::Experimental::RCanvas>> vect;
61 std::lock_guard<std::mutex> grd(GetHeldCanvasesMutex());
63 std::swap(vect, GetHeldCanvases());
72 return fPainter ? fPainter->IsCanvasModified(fModified) : fModified;
83 fPainter->CanvasUpdated(fModified, async, callback);
91 auto pCanvas = std::make_shared<RCanvas>();
92 pCanvas->SetTitle(title);
94 std::lock_guard<std::mutex> grd(GetHeldCanvasesMutex());
95 GetHeldCanvases().emplace_back(pCanvas);
120 if (
gROOT->IsWebDisplayBatch())
124 bool isany = (fPainter->NumDisplays() > 0);
127 fPainter->NewDisplay(where);
139 fPainter->NewDisplay(where);
140 fPainter->CanvasUpdated(fModified,
true,
nullptr);
150 return fPainter->GetWindowAddr();
162 return fPainter->GetWindowUrl(remote);
189 int width = GetWidth();
201 const void *ptr =
this;
219 return fPainter->ProduceJSON();
227 std::lock_guard<std::mutex> grd(GetHeldCanvasesMutex());
228 auto &held = GetHeldCanvases();
229 auto indx = held.size();
231 if (held[indx].get() ==
this)
232 held.erase(held.begin() + indx);
242 fPainter->SetClearOnClose(handle);
290 std::this_thread::sleep_for(std::chrono::milliseconds(
int(tm*1000)));
305 for (
unsigned n = 0;
n < vect.size(); ++
n) {
306 if (vect[
n]->HasShared() || !vect[
n]->GetIOPtr())
continue;
308 auto shrd_ptr = vect[
n]->MakeShared();
310 for (
auto n2 =
n+1; n2 < vect.size(); ++n2) {
311 if (vect[n2]->GetIOPtr() == vect[
n]->GetIOPtr()) {
312 if (vect[n2]->HasShared())
315 vect[n2]->SetShared(shrd_ptr);
330 if (!GetContext().IsMainConn())
334 if (!canv)
return nullptr;
336 if ((ids.size() != names.size()) || (ids.size() != values.size())) {
343 for(
int indx = 0; indx < (
int) ids.size(); indx++) {
344 if (ids[indx] ==
"canvas") {
345 if (canv->GetAttrMap().Change(names[indx], values[indx].get())) {
347 canv->SetDrawableVersion(vers);
350 auto drawable = canv->FindPrimitiveByDisplayId(ids[indx]);
351 if (drawable && drawable->GetAttrMap().Change(names[indx], values[indx].get())) {
352 if (!vers) vers = canv->IncModified();
353 drawable->SetDrawableVersion(vers);
358 fNeedUpdate = (vers > 0) &&
update;
#define R__LOG_ERROR(...)
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
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 void char Point_t Rectangle_t height
static std::unique_ptr< RVirtualCanvasPainter > Create(RCanvas &canv)
Loads the plugin that implements this class.
static const std::vector< std::shared_ptr< RCanvas > > GetCanvases()
Returns list of created canvases.
static void ReleaseHeldCanvases()
Release list of held canvases pointers If no other shared pointers exists on the canvas,...
bool SaveAs(const std::string &filename)
Save canvas in image file.
std::string GetWindowUrl(bool remote)
Returns window URL which can be used for connection.
bool IsModified() const
Returns true is canvas was modified since last painting.
void Show(const std::string &where="")
Display the canvas.
std::string GetWindowAddr() const
Returns window name used to display canvas.
void Remove()
Remove canvas from global canvas lists, will be destroyed when shared_ptr will be removed.
void ResolveSharedPtrs()
To resolve problem with storing of shared pointers Call this method when reading canvas from the file...
void Run(double tm=0.)
Run canvas functionality for given time (in seconds)
std::string GetUID() const
Return unique identifier for the canvas Used in iPython display.
std::string CreateJSON()
Provide JSON which can be used for offline display.
static std::shared_ptr< RCanvas > Create(const std::string &title)
Create new canvas instance.
void ClearOnClose(const std::shared_ptr< void > &handle)
Set handle which will be cleared when connection is closed.
void Update(bool async=false, CanvasCallback_t callback=nullptr)
update drawing
void Hide()
Hide all canvas displays.
std::unique_ptr< RDrawableReply > Process() override
Apply attributes changes to the drawable Return mask with actions which were really applied.
const char * Data() const
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
std::vector< RIOSharedBase * > RIOSharedVector_t
std::function< void(bool)> CanvasCallback_t
RLogChannel & GPadLog()
Log channel for GPad diagnostics.