26static std::mutex &GetHeldCanvasesMutex()
28 static std::mutex sMutex;
32static std::vector<std::shared_ptr<ROOT::Experimental::RCanvas>> &GetHeldCanvases()
34 static std::vector<std::shared_ptr<ROOT::Experimental::RCanvas>> sCanvases;
46 std::lock_guard<std::mutex> grd(GetHeldCanvasesMutex());
48 return GetHeldCanvases();
57 std::vector<std::shared_ptr<ROOT::Experimental::RCanvas>> vect;
60 std::lock_guard<std::mutex> grd(GetHeldCanvasesMutex());
62 std::swap(vect, GetHeldCanvases());
71 return fPainter ? fPainter->IsCanvasModified(fModified) : fModified;
80 fPainter->CanvasUpdated(fModified, async, callback);
83class RCanvasCleanup :
public TObject {
86 static RCanvasCleanup *gInstance;
88 RCanvasCleanup() :
TObject() { gInstance =
this; }
90 virtual ~RCanvasCleanup()
97RCanvasCleanup *RCanvasCleanup::gInstance =
nullptr;
105 auto pCanvas = std::make_shared<RCanvas>();
106 pCanvas->SetTitle(title);
108 std::lock_guard<std::mutex> grd(GetHeldCanvasesMutex());
109 GetHeldCanvases().emplace_back(pCanvas);
112 if (!RCanvasCleanup::gInstance) {
113 auto cleanup =
new RCanvasCleanup();
116 gROOT->GetListOfClosedObjects()->Add(dummydir);
139 bool isany = (fPainter->NumDisplays() > 0);
142 fPainter->NewDisplay(where);
154 fPainter->NewDisplay(where);
155 fPainter->CanvasUpdated(fModified,
true,
nullptr);
165 return fPainter->GetWindowAddr();
177 delete fPainter.release();
193 auto height =
fSize[1].fVal;
195 return fPainter->ProduceBatchOutput(filename,
width > 1 ? (
int)
width : 800, height > 1 ? (
int) height : 600);
203 std::lock_guard<std::mutex> grd(GetHeldCanvasesMutex());
204 auto &held = GetHeldCanvases();
205 auto indx = held.size();
207 if (held[indx].get() ==
this)
208 held.erase(held.begin() + indx);
257 std::this_thread::sleep_for(std::chrono::milliseconds(
int(tm*1000)));
272 for (
unsigned n = 0;
n < vect.size(); ++
n) {
273 if (vect[
n]->HasShared() || !vect[
n]->GetIOPtr())
continue;
275 auto shrd_ptr = vect[
n]->MakeShared();
277 for (
auto n2 =
n+1; n2 < vect.size(); ++n2) {
278 if (vect[n2]->GetIOPtr() == vect[
n]->GetIOPtr()) {
279 if (vect[n2]->HasShared())
282 vect[n2]->SetShared(shrd_ptr);
297 if (!GetContext().IsMainConn())
301 if (!canv)
return nullptr;
303 if ((ids.size() != names.size()) || (ids.size() != values.size())) {
310 for(
int indx = 0; indx < (
int) ids.size(); indx++) {
311 if (ids[indx] ==
"canvas") {
312 if (canv->GetAttrMap().Change(names[indx], values[indx].get())) {
314 canv->SetDrawableVersion(vers);
317 auto drawable = canv->FindPrimitiveByDisplayId(ids[indx]);
318 if (drawable && drawable->GetAttrMap().Change(names[indx], values[indx].get())) {
319 if (!vers) vers = canv->IncModified();
320 drawable->SetDrawableVersion(vers);
325 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)
include TDocParser_001 C image html pict1_TDocParser_001 png width
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.
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)
static std::shared_ptr< RCanvas > Create(const std::string &title)
Create new canvas instance.
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.
Describe directory structure in memory.
virtual TList * GetList() const
virtual void Add(TObject *obj)
Mother of all ROOT objects.
std::vector< RIOSharedBase * > RIOSharedVector_t
std::function< void(bool)> CanvasCallback_t
RLogChannel & GPadLog()
Log channel for GPad diagnostics.