Logo ROOT  
Reference Guide
TCanvas.cxx
Go to the documentation of this file.
1 // @(#)root/gpad:$Id$
2 // Author: Rene Brun 12/12/94
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include <cstring>
13 #include <cstdlib>
14 #include <iostream>
15 #include <fstream>
16 
17 #include "TROOT.h"
18 #include "TBuffer.h"
19 #include "TCanvas.h"
20 #include "TCanvasImp.h"
21 #include "TDatime.h"
22 #include "TClass.h"
23 #include "TStyle.h"
24 #include "TBox.h"
25 #include "TCanvasImp.h"
26 #include "TDialogCanvas.h"
27 #include "TGuiFactory.h"
28 #include "TEnv.h"
29 #include "TError.h"
30 #include "TContextMenu.h"
31 #include "TControlBar.h"
32 #include "TInterpreter.h"
33 #include "TApplication.h"
34 #include "TColor.h"
35 #include "TObjArray.h"
36 #include "TVirtualPadEditor.h"
37 #include "TVirtualViewer3D.h"
38 #include "TPadPainter.h"
39 #include "TVirtualGL.h"
40 #include "TVirtualPS.h"
41 #include "TVirtualX.h"
42 #include "TAxis.h"
43 #include "TH1.h"
44 #include "TGraph.h"
45 #include "TMath.h"
46 #include "TView.h"
47 #include "strlcpy.h"
48 #include "snprintf.h"
49 
50 #include "TVirtualMutex.h"
51 
52 class TCanvasInit {
53 public:
54  TCanvasInit() { TApplication::NeedGraphicsLibs(); }
55 };
56 static TCanvasInit gCanvasInit;
57 
58 
59 //*-*x16 macros/layout_canvas
60 
62 
64 
66 
67 
68 /** \class TCanvas
69 \ingroup gpad
70 
71 The Canvas class.
72 
73 A Canvas is an area mapped to a window directly under the control of the display
74 manager. A ROOT session may have several canvases open at any given time.
75 
76 A Canvas may be subdivided into independent graphical areas: the __Pads__.
77 A canvas has a default pad which has the name of the canvas itself.
78 An example of a Canvas layout is sketched in the picture below.
79 
80 \image html gpad_canvas.png
81 
82 This canvas contains two pads named P1 and P2. Both Canvas, P1 and P2 can be
83 moved, grown, shrunk using the normal rules of the Display manager.
84 
85 Once objects have been drawn in a canvas, they can be edited/moved by pointing
86 directly to them. The cursor shape is changed to suggest the type of action that
87 one can do on this object. Clicking with the right mouse button on an object
88 pops-up a contextmenu with a complete list of actions possible on this object.
89 
90 A graphical editor may be started from the canvas "View" menu under the menu
91 entry "Toolbar".
92 
93 An interactive HELP is available by clicking on the HELP button at the top right
94 of the canvas. It gives a short explanation about the canvas' menus.
95 
96 A canvas may be automatically divided into pads via `TPad::Divide`.
97 
98 At creation time, no matter if in interactive or batch mode, the canvas size
99 defines the size of the canvas window (including the size of the window
100 manager's decoration). To define precisely the graphics area size of a canvas in
101 the interactive mode, the following four lines of code should be used:
102 ~~~ {.cpp}
103  {
104  Double_t w = 600;
105  Double_t h = 600;
106  auto c = new TCanvas("c", "c", w, h);
107  c->SetWindowSize(w + (w - c->GetWw()), h + (h - c->GetWh()));
108  }
109 ~~~
110 and in the batch mode simply do:
111 ~~~ {.cpp}
112  c->SetCanvasSize(w,h);
113 ~~~
114 
115 If the canvas size this exceed the window size, scroll bars will be added to the canvas
116 This allows to display very large canvases (even bigger than the screen size). The
117 Following example shows how to proceed.
118 ~~~ {.cpp}
119  {
120  auto c = new TCanvas("c","c");
121  c->SetCanvasSize(1500, 1500);
122  c->SetWindowSize(500, 500);
123  }
124 ~~~
125 */
126 
127 ////////////////////////////////////////////////////////////////////////////////
128 /// Canvas default constructor.
129 
130 TCanvas::TCanvas(Bool_t build) : TPad(), fDoubleBuffer(0)
131 {
132  fPainter = 0;
133  fWindowTopX = 0;
134  fWindowTopY = 0;
135  fWindowWidth = 0;
136  fWindowHeight = 0;
137  fCw = 0;
138  fCh = 0;
139  fXsizeUser = 0;
140  fYsizeUser = 0;
141  fXsizeReal = kDefaultCanvasSize;
142  fYsizeReal = kDefaultCanvasSize;
143  fHighLightColor = gEnv->GetValue("Canvas.HighLightColor", kRed);
144  fEvent = -1;
145  fEventX = -1;
146  fEventY = -1;
147  fSelectedX = 0;
148  fSelectedY = 0;
149  fRetained = kTRUE;
150  fDrawn = kFALSE;
151  fSelected = 0;
152  fClickSelected = 0;
153  fSelectedPad = 0;
154  fClickSelectedPad = 0;
155  fPadSave = 0;
156  fCanvasImp = 0;
157  fContextMenu = 0;
158 
159  fUseGL = gStyle->GetCanvasPreferGL();
160 
161  if (!build || TClass::IsCallingNew() != TClass::kRealNew) {
162  Constructor();
163  } else {
164  const char *defcanvas = gROOT->GetDefCanvasName();
165  char *cdef;
166 
167  auto lc = (TList*)gROOT->GetListOfCanvases();
168  if (lc->FindObject(defcanvas)) {
169  Int_t n = lc->GetSize()+1;
170  while (lc->FindObject(Form("%s_n%d",defcanvas,n))) n++;
171  cdef = StrDup(Form("%s_n%d",defcanvas,n));
172  } else {
173  cdef = StrDup(Form("%s",defcanvas));
174  }
175  Constructor(cdef, cdef, 1);
176  delete [] cdef;
177  }
178 }
179 
180 ////////////////////////////////////////////////////////////////////////////////
181 /// Canvas default constructor
182 
184 {
185  if (gThreadXAR) {
186  void *arr[2];
187  arr[1] = this;
188  if ((*gThreadXAR)("CANV", 2, arr, 0)) return;
189  }
190 
191  fCanvas = 0;
192  fCanvasID = -1;
193  fCanvasImp = 0;
194  fBatch = kTRUE;
195  fUpdating = kFALSE;
196 
197  fContextMenu = 0;
198  fSelected = 0;
199  fClickSelected = 0;
200  fSelectedPad = 0;
201  fClickSelectedPad = 0;
202  fPadSave = 0;
203  SetBit(kAutoExec);
206 }
207 
208 ////////////////////////////////////////////////////////////////////////////////
209 /// Create an embedded canvas, i.e. a canvas that is in a TGCanvas widget
210 /// which is placed in a TGFrame. This ctor is only called via the
211 /// TRootEmbeddedCanvas class.
212 ///
213 /// If "name" starts with "gl" the canvas is ready to receive GL output.
214 
215 TCanvas::TCanvas(const char *name, Int_t ww, Int_t wh, Int_t winid) : TPad(), fDoubleBuffer(0)
216 {
217  fCanvasImp = 0;
218  fPainter = 0;
219  Init();
220 
221  fCanvasID = winid;
222  fWindowTopX = 0;
223  fWindowTopY = 0;
224  fWindowWidth = ww;
225  fWindowHeight = wh;
226  fCw = ww + 4;
227  fCh = wh +28;
228  fBatch = kFALSE;
229  fUpdating = kFALSE;
230 
231  //This is a very special ctor. A window exists already!
232  //Can create painter now.
234 
235  if (fUseGL) {
236  fGLDevice = gGLManager->CreateGLContext(winid);
237  if (fGLDevice == -1)
238  fUseGL = kFALSE;
239  }
240 
242  if (!fCanvasImp) return;
243 
244  CreatePainter();
245  SetName(name);
246  Build();
247 }
248 
249 ////////////////////////////////////////////////////////////////////////////////
250 /// Create a new canvas with a predefined size form.
251 /// If form < 0 the menubar is not shown.
252 ///
253 /// - form = 1 700x500 at 10,10 (set by TStyle::SetCanvasDefH,W,X,Y)
254 /// - form = 2 500x500 at 20,20
255 /// - form = 3 500x500 at 30,30
256 /// - form = 4 500x500 at 40,40
257 /// - form = 5 500x500 at 50,50
258 ///
259 /// If "name" starts with "gl" the canvas is ready to receive GL output.
260 
261 TCanvas::TCanvas(const char *name, const char *title, Int_t form) : TPad(), fDoubleBuffer(0)
262 {
263  fPainter = 0;
265 
266  Constructor(name, title, form);
267 }
268 
269 ////////////////////////////////////////////////////////////////////////////////
270 /// Create a new canvas with a predefined size form.
271 /// If form < 0 the menubar is not shown.
272 ///
273 /// - form = 1 700x500 at 10,10 (set by TStyle::SetCanvasDefH,W,X,Y)
274 /// - form = 2 500x500 at 20,20
275 /// - form = 3 500x500 at 30,30
276 /// - form = 4 500x500 at 40,40
277 /// - form = 5 500x500 at 50,50
278 
279 void TCanvas::Constructor(const char *name, const char *title, Int_t form)
280 {
281  if (gThreadXAR) {
282  void *arr[6];
283  static Int_t ww = 500;
284  static Int_t wh = 500;
285  arr[1] = this; arr[2] = (void*)name; arr[3] = (void*)title; arr[4] =&ww; arr[5] = &wh;
286  if ((*gThreadXAR)("CANV", 6, arr, 0)) return;
287  }
288 
289  Init();
290  SetBit(kMenuBar,1);
291  if (form < 0) {
292  form = -form;
293  SetBit(kMenuBar,0);
294  }
295 
296  fCanvas = this;
297 
298  fCanvasID = -1;
299  TCanvas *old = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(name);
300  if (old && old->IsOnHeap()) {
301  Warning("Constructor","Deleting canvas with same name: %s",name);
302  delete old;
303  }
304  if (gROOT->IsBatch()) { //We are in Batch mode
305  fWindowTopX = fWindowTopY = 0;
306  if (form == 1) {
309  } else {
310  fWindowWidth = 500;
311  fWindowHeight = 500;
312  }
313  fCw = fWindowWidth;
314  fCh = fWindowHeight;
316  if (!fCanvasImp) return;
317  fBatch = kTRUE;
318  } else { //normal mode with a screen window
320  if (form < 1 || form > 5) form = 1;
321  if (form == 1) {
322  UInt_t uh = UInt_t(cx*gStyle->GetCanvasDefH());
323  UInt_t uw = UInt_t(cx*gStyle->GetCanvasDefW());
324  Int_t ux = Int_t(cx*gStyle->GetCanvasDefX());
325  Int_t uy = Int_t(cx*gStyle->GetCanvasDefY());
326  fCanvasImp = gGuiFactory->CreateCanvasImp(this, name, ux, uy, uw, uh);
327  }
328  fCw = 500;
329  fCh = 500;
330  if (form == 2) fCanvasImp = gGuiFactory->CreateCanvasImp(this, name, 20, 20, UInt_t(cx*500), UInt_t(cx*500));
331  if (form == 3) fCanvasImp = gGuiFactory->CreateCanvasImp(this, name, 30, 30, UInt_t(cx*500), UInt_t(cx*500));
332  if (form == 4) fCanvasImp = gGuiFactory->CreateCanvasImp(this, name, 40, 40, UInt_t(cx*500), UInt_t(cx*500));
333  if (form == 5) fCanvasImp = gGuiFactory->CreateCanvasImp(this, name, 50, 50, UInt_t(cx*500), UInt_t(cx*500));
334  if (!fCanvasImp) return;
335 
336  if (!gROOT->IsBatch() && fCanvasID == -1)
338 
340  fBatch = kFALSE;
341  }
342 
343  CreatePainter();
344 
345  SetName(name);
346  SetTitle(title); // requires fCanvasImp set
347  Build();
348 
349  // Popup canvas
350  fCanvasImp->Show();
351 }
352 
353 ////////////////////////////////////////////////////////////////////////////////
354 /// Create a new canvas at a random position.
355 ///
356 /// \param[in] name canvas name
357 /// \param[in] title canvas title
358 /// \param[in] ww is the canvas size in pixels along X
359 /// (if ww < 0 the menubar is not shown)
360 /// \param[in] wh is the canvas size in pixels along Y
361 ///
362 /// If "name" starts with "gl" the canvas is ready to receive GL output.
363 
364 TCanvas::TCanvas(const char *name, const char *title, Int_t ww, Int_t wh) : TPad(), fDoubleBuffer(0)
365 {
366  fPainter = 0;
368 
369  Constructor(name, title, ww, wh);
370 }
371 
372 ////////////////////////////////////////////////////////////////////////////////
373 /// Create a new canvas at a random position.
374 ///
375 /// \param[in] name canvas name
376 /// \param[in] title canvas title
377 /// \param[in] ww is the canvas size in pixels along X
378 /// (if ww < 0 the menubar is not shown)
379 /// \param[in] wh is the canvas size in pixels along Y
380 
381 void TCanvas::Constructor(const char *name, const char *title, Int_t ww, Int_t wh)
382 {
383  if (gThreadXAR) {
384  void *arr[6];
385  arr[1] = this; arr[2] = (void*)name; arr[3] = (void*)title; arr[4] =&ww; arr[5] = &wh;
386  if ((*gThreadXAR)("CANV", 6, arr, 0)) return;
387  }
388 
389  Init();
390  SetBit(kMenuBar,1);
391  if (ww < 0) {
392  ww = -ww;
393  SetBit(kMenuBar,0);
394  }
395  if (wh <= 0) {
396  Error("Constructor", "Invalid canvas height: %d",wh);
397  return;
398  }
399  fCw = ww;
400  fCh = wh;
401  fCanvasID = -1;
402  TCanvas *old = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(name);
403  if (old && old->IsOnHeap()) {
404  Warning("Constructor","Deleting canvas with same name: %s",name);
405  delete old;
406  }
407  if (gROOT->IsBatch()) { //We are in Batch mode
408  fWindowTopX = fWindowTopY = 0;
409  fWindowWidth = ww;
410  fWindowHeight = wh;
411  fCw = ww;
412  fCh = wh;
414  if (!fCanvasImp) return;
415  fBatch = kTRUE;
416  } else {
418  fCanvasImp = gGuiFactory->CreateCanvasImp(this, name, UInt_t(cx*ww), UInt_t(cx*wh));
419  if (!fCanvasImp) return;
420 
421  if (!gROOT->IsBatch() && fCanvasID == -1)
423 
425  fBatch = kFALSE;
426  }
427 
428  CreatePainter();
429 
430  SetName(name);
431  SetTitle(title); // requires fCanvasImp set
432  Build();
433 
434  // Popup canvas
435  fCanvasImp->Show();
436 }
437 
438 ////////////////////////////////////////////////////////////////////////////////
439 /// Create a new canvas.
440 ///
441 /// \param[in] name canvas name
442 /// \param[in] title canvas title
443 /// \param[in] wtopx,wtopy are the pixel coordinates of the top left corner of
444 /// the canvas (if wtopx < 0) the menubar is not shown)
445 /// \param[in] ww is the canvas size in pixels along X
446 /// \param[in] wh is the canvas size in pixels along Y
447 ///
448 /// If "name" starts with "gl" the canvas is ready to receive GL output.
449 
450 TCanvas::TCanvas(const char *name, const char *title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh)
451  : TPad(), fDoubleBuffer(0)
452 {
453  fPainter = 0;
455 
456  Constructor(name, title, wtopx, wtopy, ww, wh);
457 }
458 
459 ////////////////////////////////////////////////////////////////////////////////
460 /// Create a new canvas.
461 ///
462 /// \param[in] name canvas name
463 /// \param[in] title canvas title
464 /// \param[in] wtopx,wtopy are the pixel coordinates of the top left corner of
465 /// the canvas (if wtopx < 0) the menubar is not shown)
466 /// \param[in] ww is the canvas size in pixels along X
467 /// \param[in] wh is the canvas size in pixels along Y
468 
469 void TCanvas::Constructor(const char *name, const char *title, Int_t wtopx,
470  Int_t wtopy, Int_t ww, Int_t wh)
471 {
472  if (gThreadXAR) {
473  void *arr[8];
474  arr[1] = this; arr[2] = (void*)name; arr[3] = (void*)title;
475  arr[4] = &wtopx; arr[5] = &wtopy; arr[6] = &ww; arr[7] = &wh;
476  if ((*gThreadXAR)("CANV", 8, arr, 0)) return;
477  }
478 
479  Init();
480  SetBit(kMenuBar,1);
481  if (wtopx < 0) {
482  wtopx = -wtopx;
483  SetBit(kMenuBar,0);
484  }
485  fCw = ww;
486  fCh = wh;
487  fCanvasID = -1;
488  TCanvas *old = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(name);
489  if (old && old->IsOnHeap()) {
490  Warning("Constructor","Deleting canvas with same name: %s",name);
491  delete old;
492  }
493  if (gROOT->IsBatch()) { //We are in Batch mode
494  fWindowTopX = fWindowTopY = 0;
495  fWindowWidth = ww;
496  fWindowHeight = wh;
497  fCw = ww;
498  fCh = wh;
500  if (!fCanvasImp) return;
501  fBatch = kTRUE;
502  } else { //normal mode with a screen window
504  fCanvasImp = gGuiFactory->CreateCanvasImp(this, name, Int_t(cx*wtopx), Int_t(cx*wtopy), UInt_t(cx*ww), UInt_t(cx*wh));
505  if (!fCanvasImp) return;
506 
507  if (!gROOT->IsBatch() && fCanvasID == -1)
509 
511  fBatch = kFALSE;
512  }
513 
514  CreatePainter();
515 
516  SetName(name);
517  SetTitle(title); // requires fCanvasImp set
518  Build();
519 
520  // Popup canvas
521  fCanvasImp->Show();
522 }
523 
524 ////////////////////////////////////////////////////////////////////////////////
525 /// Initialize the TCanvas members. Called by all constructors.
526 
528 {
529  // Make sure the application environment exists. It is need for graphics
530  // (colors are initialized in the TApplication ctor).
531  if (!gApplication)
533 
534  // Load and initialize graphics libraries if
535  // TApplication::NeedGraphicsLibs() has been called by a
536  // library static initializer.
537  if (gApplication)
539 
540  // Get some default from .rootrc. Used in fCanvasImp->InitWindow().
541  fHighLightColor = gEnv->GetValue("Canvas.HighLightColor", kRed);
542  SetBit(kMoveOpaque, gEnv->GetValue("Canvas.MoveOpaque", 0));
543  SetBit(kResizeOpaque, gEnv->GetValue("Canvas.ResizeOpaque", 0));
544  if (gEnv->GetValue("Canvas.ShowEventStatus", kFALSE)) SetBit(kShowEventStatus);
545  if (gEnv->GetValue("Canvas.ShowToolTips", kFALSE)) SetBit(kShowToolTips);
546  if (gEnv->GetValue("Canvas.ShowToolBar", kFALSE)) SetBit(kShowToolBar);
547  if (gEnv->GetValue("Canvas.ShowEditor", kFALSE)) SetBit(kShowEditor);
548  if (gEnv->GetValue("Canvas.AutoExec", kTRUE)) SetBit(kAutoExec);
549 
550  // Fill canvas ROOT data structure
551  fXsizeUser = 0;
552  fYsizeUser = 0;
555 
556  fDISPLAY = "$DISPLAY";
557  fUpdating = kFALSE;
558  fRetained = kTRUE;
559  fSelected = 0;
560  fClickSelected = 0;
561  fSelectedX = 0;
562  fSelectedY = 0;
563  fSelectedPad = 0;
565  fPadSave = 0;
566  fEvent = -1;
567  fEventX = -1;
568  fEventY = -1;
569  fContextMenu = 0;
570  fDrawn = kFALSE;
571 }
572 
573 ////////////////////////////////////////////////////////////////////////////////
574 /// Build a canvas. Called by all constructors.
575 
577 {
578  // Get window identifier
579  if (fCanvasID == -1 && fCanvasImp)
581  if (fCanvasID == -1) return;
582 
583  if (fCw !=0 && fCh !=0) {
586  }
587 
588  // Set Pad parameters
589  gPad = this;
590  fCanvas = this;
591  fMother = (TPad*)gPad;
592 
593  if (IsBatch()) {
594  // Make sure that batch interactive canvas sizes are the same
595  fCw -= 4;
596  fCh -= 28;
597  } else if (IsWeb()) {
598  // mark canvas as batch - avoid virtualx in many places
599  SetBatch(kTRUE);
600  } else {
601  //normal mode with a screen window
602  // Set default physical canvas attributes
603  //Should be done via gVirtualX, not via fPainter (at least now). No changes here.
604  gVirtualX->SelectWindow(fCanvasID);
605  gVirtualX->SetFillColor(1); //Set color index for fill area
606  gVirtualX->SetLineColor(1); //Set color index for lines
607  gVirtualX->SetMarkerColor(1); //Set color index for markers
608  gVirtualX->SetTextColor(1); //Set color index for text
609  // Clear workstation
610  gVirtualX->ClearWindow();
611 
612  // Set Double Buffer on by default
613  SetDoubleBuffer(1);
614 
615  // Get effective window parameters (with borders and menubar)
618 
619  // Get effective canvas parameters without borders
620  Int_t dum1, dum2;
621  gVirtualX->GetGeometry(fCanvasID, dum1, dum2, fCw, fCh);
622 
623  fContextMenu = new TContextMenu("ContextMenu");
624  }
625 
626  gROOT->GetListOfCanvases()->Add(this);
627 
628  if (!fPrimitives) {
629  fPrimitives = new TList;
631  SetFillStyle(1001);
643  fBorderMode=gStyle->GetCanvasBorderMode(); // do not call SetBorderMode (function redefined in TCanvas)
644  SetPad(0, 0, 1, 1);
645  Range(0, 0, 1, 1); //pad range is set by default to [0,1] in x and y
646 
648  if (vpp) vpp->SelectDrawable(fPixmapID);//gVirtualX->SelectPixmap(fPixmapID); //pixmap must be selected
649  PaintBorder(GetFillColor(), kTRUE); //paint background
650  }
651 
652  // transient canvases have typically no menubar and should not get
653  // by default the event status bar (if set by default)
654  if (TestBit(kMenuBar) && fCanvasImp) {
656  // ... and toolbar + editor
660  }
661 }
662 
663 ////////////////////////////////////////////////////////////////////////////////
664 /// Canvas destructor
665 
667 {
668  Destructor();
669 }
670 
671 ////////////////////////////////////////////////////////////////////////////////
672 /// Browse.
673 
675 {
676  Draw();
677  cd();
679 }
680 
681 ////////////////////////////////////////////////////////////////////////////////
682 /// Actual canvas destructor.
683 
685 {
686  if (gThreadXAR) {
687  void *arr[2];
688  arr[1] = this;
689  if ((*gThreadXAR)("CDEL", 2, arr, 0)) return;
690  }
691 
692  if (!TestBit(kNotDeleted)) return;
693 
694  if (fContextMenu) { delete fContextMenu; fContextMenu = 0; }
695  if (!gPad) return;
696 
697  Close();
698 
699  //If not yet (batch mode?).
700  delete fPainter;
701 }
702 
703 ////////////////////////////////////////////////////////////////////////////////
704 /// Set current canvas & pad. Returns the new current pad,
705 /// or 0 in case of failure.
706 /// See TPad::cd() for an explanation of the parameter.
707 
709 {
710  if (fCanvasID == -1) return 0;
711 
712  TPad::cd(subpadnumber);
713 
714  // in case doublebuffer is off, draw directly onto display window
715  if (!IsBatch()) {
716  if (!fDoubleBuffer)
717  gVirtualX->SelectWindow(fCanvasID);//Ok, does not matter for glpad.
718  }
719  return gPad;
720 }
721 
722 ////////////////////////////////////////////////////////////////////////////////
723 /// Remove all primitives from the canvas.
724 /// If option "D" is specified, direct sub-pads are cleared but not deleted.
725 /// This option is not recursive, i.e. pads in direct sub-pads are deleted.
726 
728 {
729  if (fCanvasID == -1) return;
730 
732 
733  TString opt = option;
734  opt.ToLower();
735  if (opt.Contains("d")) {
736  // clear subpads, but do not delete pads in case the canvas
737  // has been divided (note: option "D" is propagated so could cause
738  // conflicts for primitives using option "D" for something else)
739  if (fPrimitives) {
740  TIter next(fPrimitives);
741  TObject *obj;
742  while ((obj=next())) {
743  obj->Clear(option);
744  }
745  }
746  } else {
747  //default, clear everything in the canvas. Subpads are deleted
748  TPad::Clear(option); //Remove primitives from pad
749  }
750 
751  fSelected = 0;
752  fClickSelected = 0;
753  fSelectedPad = 0;
754  fClickSelectedPad = 0;
755 }
756 
757 ////////////////////////////////////////////////////////////////////////////////
758 /// Emit pad Cleared signal.
759 
761 {
762  Emit("Cleared(TVirtualPad*)", (Long_t)pad);
763 }
764 
765 ////////////////////////////////////////////////////////////////////////////////
766 /// Emit Closed signal.
767 
769 {
770  Emit("Closed()");
771 }
772 
773 ////////////////////////////////////////////////////////////////////////////////
774 /// Close canvas.
775 ///
776 /// Delete window/pads data structure
777 
779 {
780  TPad *padsave = (TPad*)gPad;
781  TCanvas *cansave = 0;
782  if (padsave) cansave = (TCanvas*)gPad->GetCanvas();
783 
784  if (fCanvasID != -1) {
785 
786  if ((!gROOT->IsLineProcessing()) && (!gVirtualX->IsCmdThread())) {
787  gInterpreter->Execute(this, IsA(), "Close", option);
788  return;
789  }
790 
792 
794 
795  cd();
796  TPad::Close(option);
797 
798  if (!IsBatch()) {
799  gVirtualX->SelectWindow(fCanvasID); //select current canvas
800 
802 
803  if (fCanvasImp)
804  fCanvasImp->Close();
805  }
806  fCanvasID = -1;
807  fBatch = kTRUE;
808 
809  gROOT->GetListOfCanvases()->Remove(this);
810 
811  // Close actual window on screen
813  }
814 
815  if (cansave == this) {
816  gPad = (TCanvas *) gROOT->GetListOfCanvases()->First();
817  } else {
818  gPad = padsave;
819  }
820 
821  Closed();
822 }
823 
824 ////////////////////////////////////////////////////////////////////////////////
825 /// Copy the canvas pixmap of the pad to the canvas.
826 
828 {
829  if (!IsBatch()) {
830  CopyPixmap();
832  }
833 }
834 
835 ////////////////////////////////////////////////////////////////////////////////
836 /// Draw a canvas.
837 /// If a canvas with the name is already on the screen, the canvas is repainted.
838 /// This function is useful when a canvas object has been saved in a Root file.
839 /// One can then do:
840 /// ~~~ {.cpp}
841 /// Root > Tfile f("file.root");
842 /// Root > canvas.Draw();
843 /// ~~~
844 
846 {
847  // Load and initialize graphics libraries if
848  // TApplication::NeedGraphicsLibs() has been called by a
849  // library static initializer.
850  if (gApplication)
852 
853  fDrawn = kTRUE;
854 
855  TCanvas *old = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(GetName());
856  if (old == this) {
857  Paint();
858  return;
859  }
860  if (old) { gROOT->GetListOfCanvases()->Remove(old); delete old;}
861 
862  if (fWindowWidth == 0) {
863  if (fCw !=0) fWindowWidth = fCw+4;
864  else fWindowWidth = 800;
865  }
866  if (fWindowHeight == 0) {
867  if (fCh !=0) fWindowHeight = fCh+28;
868  else fWindowHeight = 600;
869  }
870  if (gROOT->IsBatch()) { //We are in Batch mode
872  if (!fCanvasImp) return;
873  fBatch = kTRUE;
874 
875  } else { //normal mode with a screen window
878  if (!fCanvasImp) return;
880  }
881  Build();
882  ResizePad();
884  fCanvasImp->Show();
885  Modified();
886 }
887 
888 ////////////////////////////////////////////////////////////////////////////////
889 /// Draw a clone of this canvas
890 /// A new canvas is created that is a clone of this canvas
891 
893 {
894  TCanvas *newCanvas = (TCanvas*)Clone();
895  newCanvas->SetName();
896 
897  newCanvas->Draw(option);
898  newCanvas->Update();
899  return newCanvas;
900 }
901 
902 ////////////////////////////////////////////////////////////////////////////////
903 /// Draw a clone of this canvas into the current pad
904 /// In an interactive session, select the destination/current pad
905 /// with the middle mouse button, then point to the canvas area to select
906 /// the canvas context menu item DrawClonePad.
907 /// Note that the original canvas may have subpads.
908 
910 {
911  TPad *padsav = (TPad*)gPad;
912  TPad *selpad = (TPad*)gROOT->GetSelectedPad();
913  TPad *pad = padsav;
914  if (pad == this) pad = selpad;
915  if (padsav == 0 || pad == 0 || pad == this) {
916  TCanvas *newCanvas = (TCanvas*)DrawClone();
918  return newCanvas;
919  }
920  if (fCanvasID == -1) {
923  if (!fCanvasImp) return 0;
926  }
927  this->cd();
928  TObject *obj, *clone;
929  //copy pad attributes
930  pad->Range(fX1,fY1,fX2,fY2);
931  pad->SetTickx(GetTickx());
932  pad->SetTicky(GetTicky());
933  pad->SetGridx(GetGridx());
934  pad->SetGridy(GetGridy());
935  pad->SetLogx(GetLogx());
936  pad->SetLogy(GetLogy());
937  pad->SetLogz(GetLogz());
940  TAttLine::Copy((TAttLine&)*pad);
941  TAttFill::Copy((TAttFill&)*pad);
942  TAttPad::Copy((TAttPad&)*pad);
943 
944  //copy primitives
945  TIter next(GetListOfPrimitives());
946  while ((obj=next())) {
947  pad->cd();
948  clone = obj->Clone();
949  pad->GetListOfPrimitives()->Add(clone,next.GetOption());
950  }
951  pad->ResizePad();
952  pad->Modified();
953  pad->Update();
954  if (padsav) padsav->cd();
955  return 0;
956 }
957 
958 ////////////////////////////////////////////////////////////////////////////////
959 /// Report name and title of primitive below the cursor.
960 ///
961 /// This function is called when the option "Event Status"
962 /// in the canvas menu "Options" is selected.
963 
964 void TCanvas::DrawEventStatus(Int_t event, Int_t px, Int_t py, TObject *selected)
965 {
966  const Int_t kTMAX=256;
967  static char atext[kTMAX];
968 
969  if (!TestBit(kShowEventStatus) || !selected) return;
970 
971  if (!fCanvasImp) return; //this may happen when closing a TAttCanvas
972 
973  TVirtualPad* savepad;
974  savepad = gPad;
975  gPad = GetSelectedPad();
976 
977  fCanvasImp->SetStatusText(selected->GetTitle(),0);
978  fCanvasImp->SetStatusText(selected->GetName(),1);
979  if (event == kKeyPress)
980  snprintf(atext, kTMAX, "%c", (char) px);
981  else
982  snprintf(atext, kTMAX, "%d,%d", px, py);
983  fCanvasImp->SetStatusText(atext,2);
984 
985  // Show date/time if TimeDisplay is selected
986  TAxis *xaxis = NULL;
987  if ( selected->InheritsFrom("TH1") )
988  xaxis = ((TH1*)selected)->GetXaxis();
989  else if ( selected->InheritsFrom("TGraph") )
990  xaxis = ((TGraph*)selected)->GetXaxis();
991  else if ( selected->InheritsFrom("TAxis") )
992  xaxis = (TAxis*)selected;
993  if ( xaxis != NULL && xaxis->GetTimeDisplay()) {
994  TString objinfo = selected->GetObjectInfo(px,py);
995  // check if user has overwritten GetObjectInfo and altered
996  // the default text from TObject::GetObjectInfo "x=.. y=.."
997  if (objinfo.Contains("x=") && objinfo.Contains("y=") ) {
998  UInt_t toff = 0;
999  TString time_format(xaxis->GetTimeFormat());
1000  // TimeFormat may contain offset: %F2000-01-01 00:00:00
1001  Int_t idF = time_format.Index("%F");
1002  if (idF>=0) {
1003  Int_t lnF = time_format.Length();
1004  // minimal check for correct format
1005  if (lnF - idF == 21) {
1006  time_format = time_format(idF+2, lnF);
1007  TDatime dtoff(time_format);
1008  toff = dtoff.Convert();
1009  }
1010  } else {
1011  toff = (UInt_t)gStyle->GetTimeOffset();
1012  }
1013  TDatime dt((UInt_t)gPad->AbsPixeltoX(px) + toff);
1014  snprintf(atext, kTMAX, "%s, y=%g",
1015  dt.AsSQLString(),gPad->AbsPixeltoY(py));
1016  fCanvasImp->SetStatusText(atext,3);
1017  gPad = savepad;
1018  return;
1019  }
1020  }
1021  // default
1022  fCanvasImp->SetStatusText(selected->GetObjectInfo(px,py),3);
1023 
1024  gPad = savepad;
1025 }
1026 
1027 ////////////////////////////////////////////////////////////////////////////////
1028 /// Get editor bar.
1029 
1031 {
1033 }
1034 
1035 ////////////////////////////////////////////////////////////////////////////////
1036 /// Embedded a canvas into a TRootEmbeddedCanvas. This method is only called
1037 /// via TRootEmbeddedCanvas::AdoptCanvas.
1038 
1040 {
1041  // If fCanvasImp already exists, no need to go further.
1042  if(fCanvasImp) return;
1043 
1044  fCanvasID = winid;
1045  fWindowTopX = 0;
1046  fWindowTopY = 0;
1047  fWindowWidth = ww;
1048  fWindowHeight = wh;
1049  fCw = ww;
1050  fCh = wh;
1051  fBatch = kFALSE;
1052  fUpdating = kFALSE;
1053 
1055  if (!fCanvasImp) return;
1056  Build();
1057  Resize();
1058 }
1059 
1060 ////////////////////////////////////////////////////////////////////////////////
1061 /// Generate kMouseEnter and kMouseLeave events depending on the previously
1062 /// selected object and the currently selected object. Does nothing if the
1063 /// selected object does not change.
1064 
1065 void TCanvas::EnterLeave(TPad *prevSelPad, TObject *prevSelObj)
1066 {
1067  if (prevSelObj == fSelected) return;
1068 
1069  TPad *padsav = (TPad *)gPad;
1070  Int_t sevent = fEvent;
1071 
1072  if (prevSelObj) {
1073  gPad = prevSelPad;
1074  prevSelObj->ExecuteEvent(kMouseLeave, fEventX, fEventY);
1075  fEvent = kMouseLeave;
1076  RunAutoExec();
1077  ProcessedEvent(kMouseLeave, fEventX, fEventY, prevSelObj); // emit signal
1078  }
1079 
1080  gPad = fSelectedPad;
1081 
1082  if (fSelected) {
1084  fEvent = kMouseEnter;
1085  RunAutoExec();
1086  ProcessedEvent(kMouseEnter, fEventX, fEventY, fSelected); // emit signal
1087  }
1088 
1089  fEvent = sevent;
1090  gPad = padsav;
1091 }
1092 
1093 ////////////////////////////////////////////////////////////////////////////////
1094 /// Execute action corresponding to one event.
1095 ///
1096 /// This member function must be implemented to realize the action
1097 /// corresponding to the mouse click on the object in the canvas
1098 ///
1099 /// Only handle mouse motion events in TCanvas, all other events are
1100 /// ignored for the time being
1101 
1103 {
1104  if (gROOT->GetEditorMode()) {
1105  TPad::ExecuteEvent(event,px,py);
1106  return;
1107  }
1108 
1109  switch (event) {
1110 
1111  case kMouseMotion:
1112  SetCursor(kCross);
1113  break;
1114  }
1115 }
1116 
1117 ////////////////////////////////////////////////////////////////////////////////
1118 /// Turn rubberband feedback mode on or off.
1119 
1121 {
1122  if (set) {
1123  SetDoubleBuffer(0); // turn off double buffer mode
1124  gVirtualX->SetDrawMode(TVirtualX::kInvert); // set the drawing mode to XOR mode
1125  } else {
1126  SetDoubleBuffer(1); // turn on double buffer mode
1127  gVirtualX->SetDrawMode(TVirtualX::kCopy); // set drawing mode back to normal (copy) mode
1128  }
1129 }
1130 
1131 ////////////////////////////////////////////////////////////////////////////////
1132 /// Flush canvas buffers.
1133 
1135 {
1136  if ((fCanvasID == -1) || IsWeb()) return;
1137 
1138  TPad *padsav = (TPad*)gPad;
1139  cd();
1140  if (!IsBatch()) {
1141  if (!UseGL()) {
1142  gVirtualX->SelectWindow(fCanvasID);
1143  gPad = padsav; //don't do cd() because than also the pixmap is changed
1144  CopyPixmaps();
1145  gVirtualX->UpdateWindow(1);
1146  } else {
1147  TVirtualPS *tvps = gVirtualPS;
1148  gVirtualPS = 0;
1149  gGLManager->MakeCurrent(fGLDevice);
1150  fPainter->InitPainter();
1151  Paint();
1152  if (padsav && padsav->GetCanvas() == this) {
1153  padsav->cd();
1154  padsav->HighLight(padsav->GetHighLightColor());
1155  //cd();
1156  }
1157  fPainter->LockPainter();
1158  gGLManager->Flush(fGLDevice);
1159  gVirtualPS = tvps;
1160  }
1161  }
1162  if (padsav) padsav->cd();
1163 }
1164 
1165 ////////////////////////////////////////////////////////////////////////////////
1166 /// Force canvas update
1167 
1169 {
1171 }
1172 
1173 ////////////////////////////////////////////////////////////////////////////////
1174 /// Force a copy of current style for all objects in canvas.
1175 
1177 {
1178  if ((!gROOT->IsLineProcessing()) && (!gVirtualX->IsCmdThread())) {
1179  gInterpreter->Execute(this, IsA(), "UseCurrentStyle", "");
1180  return;
1181  }
1182 
1184 
1186 
1187  if (gStyle->IsReading()) {
1191  } else {
1195  }
1196 }
1197 
1198 ////////////////////////////////////////////////////////////////////////////////
1199 /// Returns current top x position of window on screen.
1200 
1202 {
1205 
1206  return fWindowTopX;
1207 }
1208 
1209 ////////////////////////////////////////////////////////////////////////////////
1210 /// Returns current top y position of window on screen.
1211 
1213 {
1216 
1217  return fWindowTopY;
1218 }
1219 
1220 ////////////////////////////////////////////////////////////////////////////////
1221 /// Handle Input Events.
1222 ///
1223 /// Handle input events, like button up/down in current canvas.
1224 
1226 {
1227  TPad *pad;
1228  TPad *prevSelPad = (TPad*) fSelectedPad;
1229  TObject *prevSelObj = fSelected;
1230 
1231  fPadSave = (TPad*)gPad;
1232  cd(); // make sure this canvas is the current canvas
1233 
1234  fEvent = event;
1235  fEventX = px;
1236  fEventY = py;
1237 
1238  switch (event) {
1239 
1240  case kMouseMotion:
1241  // highlight object tracked over
1242  pad = Pick(px, py, prevSelObj);
1243  if (!pad) return;
1244 
1245  EnterLeave(prevSelPad, prevSelObj);
1246 
1247  gPad = pad; // don't use cd() we will use the current
1248  // canvas via the GetCanvas member and not via
1249  // gPad->GetCanvas
1250 
1251  if (fSelected) {
1252  fSelected->ExecuteEvent(event, px, py);
1253  RunAutoExec();
1254  }
1255 
1256  break;
1257 
1258  case kMouseEnter:
1259  // mouse enters canvas
1261  break;
1262 
1263  case kMouseLeave:
1264  // mouse leaves canvas
1265  {
1266  // force popdown of tooltips
1267  TObject *sobj = fSelected;
1268  TPad *spad = fSelectedPad;
1269  fSelected = 0;
1270  fSelectedPad = 0;
1271  EnterLeave(prevSelPad, prevSelObj);
1272  fSelected = sobj;
1273  fSelectedPad = spad;
1275  }
1276  break;
1277 
1278  case kButton1Double:
1279  // triggered on the second button down within 350ms and within
1280  // 3x3 pixels of the first button down, button up finishes action
1281 
1282  case kButton1Down:
1283  // find pad in which input occurred
1284  pad = Pick(px, py, prevSelObj);
1285  if (!pad) return;
1286 
1287  gPad = pad; // don't use cd() because we won't draw in pad
1288  // we will only use its coordinate system
1289 
1290  if (fSelected) {
1291  FeedbackMode(kTRUE); // to draw in rubberband mode
1292  fSelected->ExecuteEvent(event, px, py);
1293 
1294  RunAutoExec();
1295  }
1296 
1297  break;
1298 
1299  case kArrowKeyPress:
1300  case kArrowKeyRelease:
1301  case kButton1Motion:
1302  case kButton1ShiftMotion: //8 == kButton1Motion + shift modifier
1303  if (fSelected) {
1304  gPad = fSelectedPad;
1305 
1306  fSelected->ExecuteEvent(event, px, py);
1307  gVirtualX->Update();
1309  Bool_t resize = kFALSE;
1311  resize = ((TBox*)fSelected)->IsBeingResized();
1313  resize = ((TVirtualPad*)fSelected)->IsBeingResized();
1314 
1315  if ((!resize && TestBit(kMoveOpaque)) || (resize && TestBit(kResizeOpaque))) {
1316  gPad = fPadSave;
1317  Update();
1319  }
1320  }
1321 
1322  RunAutoExec();
1323  }
1324 
1325  break;
1326 
1327  case kButton1Up:
1328 
1329  if (fSelected) {
1330  gPad = fSelectedPad;
1331 
1332  fSelected->ExecuteEvent(event, px, py);
1333 
1334  RunAutoExec();
1335 
1336  if (fPadSave)
1337  gPad = fPadSave;
1338  else {
1339  gPad = this;
1340  fPadSave = this;
1341  }
1342 
1343  Update(); // before calling update make sure gPad is reset
1344  }
1345  break;
1346 
1347 //*-*----------------------------------------------------------------------
1348 
1349  case kButton2Down:
1350  // find pad in which input occurred
1351  pad = Pick(px, py, prevSelObj);
1352  if (!pad) return;
1353 
1354  gPad = pad; // don't use cd() because we won't draw in pad
1355  // we will only use its coordinate system
1356 
1358 
1359  if (fSelected) fSelected->Pop(); // pop object to foreground
1360  pad->cd(); // and make its pad the current pad
1361  if (gDebug)
1362  printf("Current Pad: %s / %s\n", pad->GetName(), pad->GetTitle());
1363 
1364  // loop over all canvases to make sure that only one pad is highlighted
1365  {
1366  TIter next(gROOT->GetListOfCanvases());
1367  TCanvas *tc;
1368  while ((tc = (TCanvas *)next()))
1369  tc->Update();
1370  }
1371 
1372  //if (pad->GetGLDevice() != -1 && fSelected)
1373  // fSelected->ExecuteEvent(event, px, py);
1374 
1375  break; // don't want fPadSave->cd() to be executed at the end
1376 
1377  case kButton2Motion:
1378  //was empty!
1379  case kButton2Up:
1380  if (fSelected) {
1381  gPad = fSelectedPad;
1382 
1383  fSelected->ExecuteEvent(event, px, py);
1384  RunAutoExec();
1385  }
1386  break;
1387 
1388  case kButton2Double:
1389  break;
1390 
1391 //*-*----------------------------------------------------------------------
1392 
1393  case kButton3Down:
1394  // popup context menu
1395  pad = Pick(px, py, prevSelObj);
1396  if (!pad) return;
1397 
1399 
1402  fContextMenu->Popup(px, py, fSelected, this, pad);
1403 
1404  break;
1405 
1406  case kButton3Motion:
1407  break;
1408 
1409  case kButton3Up:
1411  break;
1412 
1413  case kButton3Double:
1414  break;
1415 
1416  case kKeyPress:
1417  if (!fSelectedPad || !fSelected) return;
1418  gPad = fSelectedPad; // don't use cd() because we won't draw in pad
1419  // we will only use its coordinate system
1420  fSelected->ExecuteEvent(event, px, py);
1421 
1422  RunAutoExec();
1423 
1424  break;
1425 
1426  case kButton1Shift:
1427  // Try to select
1428  pad = Pick(px, py, prevSelObj);
1429 
1430  if (!pad) return;
1431 
1432  EnterLeave(prevSelPad, prevSelObj);
1433 
1434  gPad = pad; // don't use cd() we will use the current
1435  // canvas via the GetCanvas member and not via
1436  // gPad->GetCanvas
1437  if (fSelected) {
1438  fSelected->ExecuteEvent(event, px, py);
1439  RunAutoExec();
1440  }
1441  break;
1442 
1443  case kWheelUp:
1444  case kWheelDown:
1445  pad = Pick(px, py, prevSelObj);
1446  if (!pad) return;
1447 
1448  gPad = pad;
1449  if (fSelected)
1450  fSelected->ExecuteEvent(event, px, py);
1451  break;
1452 
1453  default:
1454  break;
1455  }
1456 
1457  if (fPadSave && event != kButton2Down)
1458  fPadSave->cd();
1459 
1460  if (event != kMouseLeave) { // signal was already emitted for this event
1461  ProcessedEvent(event, px, py, fSelected); // emit signal
1462  DrawEventStatus(event, px, py, fSelected);
1463  }
1464 }
1465 
1466 ////////////////////////////////////////////////////////////////////////////////
1467 /// Iconify canvas
1468 
1470 {
1471  if (fCanvasImp)
1472  fCanvasImp->Iconify();
1473 }
1474 
1475 ////////////////////////////////////////////////////////////////////////////////
1476 /// Is folder ?
1477 
1479 {
1480  return fgIsFolder;
1481 }
1482 
1483 ////////////////////////////////////////////////////////////////////////////////
1484 /// Is web canvas
1485 
1487 {
1488  return fCanvasImp ? fCanvasImp->IsWeb() : kFALSE;
1489 }
1490 
1491 ////////////////////////////////////////////////////////////////////////////////
1492 /// List all pads.
1493 
1494 void TCanvas::ls(Option_t *option) const
1495 {
1497  std::cout <<"Canvas Name=" <<GetName()<<" Title="<<GetTitle()<<" Option="<<option<<std::endl;
1499  TPad::ls(option);
1501 }
1502 
1503 ////////////////////////////////////////////////////////////////////////////////
1504 /// Static function to build a default canvas.
1505 
1507 {
1508  const char *defcanvas = gROOT->GetDefCanvasName();
1509  char *cdef;
1510 
1511  auto lc = (TList*)gROOT->GetListOfCanvases();
1512  if (lc->FindObject(defcanvas)) {
1513  Int_t n = lc->GetSize() + 1;
1514  cdef = new char[strlen(defcanvas)+15];
1515  do {
1516  strlcpy(cdef,Form("%s_n%d", defcanvas, n++),strlen(defcanvas)+15);
1517  } while (lc->FindObject(cdef));
1518  } else
1519  cdef = StrDup(Form("%s",defcanvas));
1520 
1521  TCanvas *c = new TCanvas(cdef, cdef, 1);
1522 
1523  ::Info("TCanvas::MakeDefCanvas"," created default TCanvas with name %s",cdef);
1524  delete [] cdef;
1525  return c;
1526 }
1527 
1528 ////////////////////////////////////////////////////////////////////////////////
1529 /// Set option to move objects/pads in a canvas.
1530 ///
1531 /// - set = 1 (default) graphics objects are moved in opaque mode
1532 /// - set = 0 only the outline of objects is drawn when moving them
1533 ///
1534 /// The option opaque produces the best effect. It requires however a
1535 /// a reasonably fast workstation or response time.
1536 
1538 {
1539  SetBit(kMoveOpaque,set);
1540 }
1541 
1542 ////////////////////////////////////////////////////////////////////////////////
1543 /// Paint canvas.
1544 
1546 {
1547  if (fCanvas)
1548  TPad::Paint(option);
1549 }
1550 
1551 ////////////////////////////////////////////////////////////////////////////////
1552 /// Prepare for pick, call TPad::Pick() and when selected object
1553 /// is different from previous then emit Picked() signal.
1554 
1555 TPad *TCanvas::Pick(Int_t px, Int_t py, TObject *prevSelObj)
1556 {
1557  TObjLink *pickobj = 0;
1558 
1559  fSelected = 0;
1560  fSelectedOpt = "";
1561  fSelectedPad = 0;
1562 
1563  TPad *pad = Pick(px, py, pickobj);
1564  if (!pad) return 0;
1565 
1566  if (!pickobj) {
1567  fSelected = pad;
1568  fSelectedOpt = "";
1569  } else {
1570  if (!fSelected) { // can be set via TCanvas::SetSelected()
1571  fSelected = pickobj->GetObject();
1572  fSelectedOpt = pickobj->GetOption();
1573  }
1574  }
1575  fSelectedPad = pad;
1576 
1577  if (fSelected != prevSelObj)
1578  Picked(fSelectedPad, fSelected, fEvent); // emit signal
1579 
1580  if ((fEvent == kButton1Down) || (fEvent == kButton2Down) || (fEvent == kButton3Down)) {
1584  Selected(fSelectedPad, fSelected, fEvent); // emit signal
1585  fSelectedX = px;
1586  fSelectedY = py;
1587  }
1588  }
1589  return pad;
1590 }
1591 
1592 ////////////////////////////////////////////////////////////////////////////////
1593 /// Emit Picked() signal.
1594 
1595 void TCanvas::Picked(TPad *pad, TObject *obj, Int_t event)
1596 {
1597  Long_t args[3];
1598 
1599  args[0] = (Long_t) pad;
1600  args[1] = (Long_t) obj;
1601  args[2] = event;
1602 
1603  Emit("Picked(TPad*,TObject*,Int_t)", args);
1604 }
1605 
1606 ////////////////////////////////////////////////////////////////////////////////
1607 /// Emit Highlighted() signal.
1608 ///
1609 /// - pad is pointer to pad with highlighted histogram or graph
1610 /// - obj is pointer to highlighted histogram or graph
1611 /// - x is highlighted x bin for 1D histogram or highlighted x-th point for graph
1612 /// - y is highlighted y bin for 2D histogram (for 1D histogram or graph not in use)
1613 
1615 {
1616  Long_t args[4];
1617 
1618  args[0] = (Long_t) pad;
1619  args[1] = (Long_t) obj;
1620  args[2] = x;
1621  args[3] = y;
1622 
1623  Emit("Highlighted(TVirtualPad*,TObject*,Int_t,Int_t)", args);
1624 }
1625 
1626 ////////////////////////////////////////////////////////////////////////////////
1627 /// This is "simplification" for function TCanvas::Connect with Highlighted
1628 /// signal for specific slot.
1629 ///
1630 /// Slot has to be defined "UserFunction(TVirtualPad *pad, TObject *obj, Int_t x, Int_t y)"
1631 /// all parameters of UserFunction are taken from TCanvas::Highlighted
1632 
1633 void TCanvas::HighlightConnect(const char *slot)
1634 {
1635  Connect("Highlighted(TVirtualPad*,TObject*,Int_t,Int_t)", 0, 0, slot);
1636 }
1637 
1638 ////////////////////////////////////////////////////////////////////////////////
1639 /// Emit Selected() signal.
1640 
1642 {
1643  Long_t args[3];
1644 
1645  args[0] = (Long_t) pad;
1646  args[1] = (Long_t) obj;
1647  args[2] = event;
1648 
1649  Emit("Selected(TVirtualPad*,TObject*,Int_t)", args);
1650 }
1651 
1652 ////////////////////////////////////////////////////////////////////////////////
1653 /// Emit ProcessedEvent() signal.
1654 
1656 {
1657  Long_t args[4];
1658 
1659  args[0] = event;
1660  args[1] = x;
1661  args[2] = y;
1662  args[3] = (Long_t) obj;
1663 
1664  Emit("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)", args);
1665 }
1666 
1667 ////////////////////////////////////////////////////////////////////////////////
1668 /// Recompute canvas parameters following a X11 Resize.
1669 
1671 {
1672  if (fCanvasID == -1) return;
1673 
1674  if ((!gROOT->IsLineProcessing()) && (!gVirtualX->IsCmdThread())) {
1675  gInterpreter->Execute(this, IsA(), "Resize", "");
1676  return;
1677  }
1678 
1680 
1681  TPad *padsav = (TPad*)gPad;
1682  cd();
1683 
1684  if (!IsBatch()) {
1685  gVirtualX->SelectWindow(fCanvasID); //select current canvas
1686  gVirtualX->ResizeWindow(fCanvasID); //resize canvas and off-screen buffer
1687 
1688  // Get effective window parameters including menubar and borders
1691 
1692  // Get effective canvas parameters without borders
1693  Int_t dum1, dum2;
1694  gVirtualX->GetGeometry(fCanvasID, dum1, dum2, fCw, fCh);
1695  }
1696 
1697  if (fXsizeUser && fYsizeUser) {
1698  UInt_t nwh = fCh;
1699  UInt_t nww = fCw;
1701  if (rxy < 1) {
1702  UInt_t twh = UInt_t(Double_t(fCw)/rxy);
1703  if (twh > fCh)
1704  nww = UInt_t(Double_t(fCh)*rxy);
1705  else
1706  nwh = twh;
1707  if (nww > fCw) {
1708  nww = fCw; nwh = twh;
1709  }
1710  if (nwh > fCh) {
1711  nwh = fCh; nww = UInt_t(Double_t(fCh)/rxy);
1712  }
1713  } else {
1714  UInt_t twh = UInt_t(Double_t(fCw)*rxy);
1715  if (twh > fCh)
1716  nwh = UInt_t(Double_t(fCw)/rxy);
1717  else
1718  nww = twh;
1719  if (nww > fCw) {
1720  nww = fCw; nwh = twh;
1721  }
1722  if (nwh > fCh) {
1723  nwh = fCh; nww = UInt_t(Double_t(fCh)*rxy);
1724  }
1725  }
1726  fCw = nww;
1727  fCh = nwh;
1728  }
1729 
1730  if (fCw < fCh) {
1733  }
1734  else {
1737  }
1738 
1739 //*-*- Loop on all pads to recompute conversion coefficients
1740  TPad::ResizePad();
1741 
1742  if (padsav) padsav->cd();
1743 }
1744 
1745 
1746 ////////////////////////////////////////////////////////////////////////////////
1747 /// Raise canvas window
1748 
1750 {
1751  if (fCanvasImp)
1753 }
1754 
1755 ////////////////////////////////////////////////////////////////////////////////
1756 /// Set option to resize objects/pads in a canvas.
1757 ///
1758 /// - set = 1 (default) graphics objects are resized in opaque mode
1759 /// - set = 0 only the outline of objects is drawn when resizing them
1760 ///
1761 /// The option opaque produces the best effect. It requires however a
1762 /// a reasonably fast workstation or response time.
1763 
1765 {
1766  SetBit(kResizeOpaque,set);
1767 }
1768 
1769 ////////////////////////////////////////////////////////////////////////////////
1770 /// Execute the list of TExecs in the current pad.
1771 
1773 {
1774  if (!TestBit(kAutoExec)) return;
1775  if (!gPad) return;
1776  ((TPad*)gPad)->AutoExec();
1777 }
1778 
1779 
1780 ////////////////////////////////////////////////////////////////////////////////
1781 /// Save primitives in this canvas in C++ macro file with GUI.
1782 
1783 void TCanvas::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
1784 {
1785  // Write canvas options (in $TROOT or $TStyle)
1786  if (gStyle->GetOptFit()) {
1787  out<<" gStyle->SetOptFit(1);"<<std::endl;
1788  }
1789  if (!gStyle->GetOptStat()) {
1790  out<<" gStyle->SetOptStat(0);"<<std::endl;
1791  }
1792  if (!gStyle->GetOptTitle()) {
1793  out<<" gStyle->SetOptTitle(0);"<<std::endl;
1794  }
1795  if (gROOT->GetEditHistograms()) {
1796  out<<" gROOT->SetEditHistograms();"<<std::endl;
1797  }
1798  if (GetShowEventStatus()) {
1799  out<<" "<<GetName()<<"->ToggleEventStatus();"<<std::endl;
1800  }
1801  if (GetShowToolTips()) {
1802  out<<" "<<GetName()<<"->ToggleToolTips();"<<std::endl;
1803  }
1804  if (GetShowToolBar()) {
1805  out<<" "<<GetName()<<"->ToggleToolBar();"<<std::endl;
1806  }
1807  if (GetHighLightColor() != 5) {
1808  if (GetHighLightColor() > 228) {
1810  out<<" "<<GetName()<<"->SetHighLightColor(ci);" << std::endl;
1811  } else
1812  out<<" "<<GetName()<<"->SetHighLightColor("<<GetHighLightColor()<<");"<<std::endl;
1813  }
1814 
1815  // Now recursively scan all pads of this canvas
1816  cd();
1817  TPad::SavePrimitive(out,option);
1818 }
1819 
1820 ////////////////////////////////////////////////////////////////////////////////
1821 /// Save primitives in this canvas as a C++ macro file.
1822 /// This function loops on all the canvas primitives and for each primitive
1823 /// calls the object SavePrimitive function.
1824 /// When outputting floating point numbers, the default precision is 7 digits.
1825 /// The precision can be changed (via system.rootrc) by changing the value
1826 /// of the environment variable "Canvas.SavePrecision"
1827 
1828 void TCanvas::SaveSource(const char *filename, Option_t *option)
1829 {
1830  // reset bit TClass::kClassSaved for all classes
1831  TIter next(gROOT->GetListOfClasses());
1832  TClass *cl;
1833  while((cl = (TClass*)next())) {
1835  }
1836 
1837  char quote = '"';
1838  std::ofstream out;
1839  Int_t lenfile = strlen(filename);
1840  char * fname;
1841  char lcname[10];
1842  const char *cname = GetName();
1843  Bool_t invalid = kFALSE;
1844  // if filename is given, open this file, otherwise create a file
1845  // with a name equal to the canvasname.C
1846  if (lenfile) {
1847  fname = (char*)filename;
1848  out.open(fname, std::ios::out);
1849  } else {
1850  Int_t nch = strlen(cname);
1851  if (nch < 10) {
1852  strlcpy(lcname,cname,10);
1853  for (Int_t k=1;k<=nch;k++) {if (lcname[nch-k] == ' ') lcname[nch-k] = 0;}
1854  if (lcname[0] == 0) {invalid = kTRUE; strlcpy(lcname,"c1",10); nch = 2;}
1855  cname = lcname;
1856  }
1857  fname = new char[nch+3];
1858  strlcpy(fname,cname,nch+3);
1859  strncat(fname,".C",3);
1860  out.open(fname, std::ios::out);
1861  }
1862  if (!out.good ()) {
1863  Error("SaveSource", "Cannot open file: %s",fname);
1864  if (!lenfile) delete [] fname;
1865  return;
1866  }
1867 
1868  //set precision
1869  Int_t precision = gEnv->GetValue("Canvas.SavePrecision",7);
1870  out.precision(precision);
1871 
1872  // Write macro header and date/time stamp
1873  TDatime t;
1874  Float_t cx = gStyle->GetScreenFactor();
1875  Int_t topx,topy;
1876  UInt_t w, h;
1877  if (!fCanvasImp) {
1878  Error("SaveSource", "Cannot open TCanvas");
1879  return;
1880  }
1881  UInt_t editorWidth = fCanvasImp->GetWindowGeometry(topx,topy,w,h);
1882  w = UInt_t((fWindowWidth - editorWidth)/cx);
1883  h = UInt_t((fWindowHeight)/cx);
1884  topx = GetWindowTopX();
1885  topy = GetWindowTopY();
1886 
1887  if (w == 0) {
1888  w = GetWw()+4; h = GetWh()+4;
1889  topx = 1; topy = 1;
1890  }
1891 
1892  TString mname(fname);
1893 // out <<"#ifdef __CLING__"<<std::endl;
1894 // out <<"#pragma cling optimize(0)"<<std::endl;
1895 // out <<"#endif"<<std::endl;
1896 // out <<""<<std::endl;
1897  Int_t p = mname.Last('.');
1898  Int_t s = mname.Last('/')+1;
1899 
1900  // A named macro is generated only if the function name is valid. If not, the
1901  // macro is unnamed.
1902  TString first(mname(s,s+1));
1903  if (!first.IsDigit()) out <<"void " << mname(s,p-s) << "()" << std::endl;
1904 
1905  out <<"{"<<std::endl;
1906  out <<"//=========Macro generated from canvas: "<<GetName()<<"/"<<GetTitle()<<std::endl;
1907  out <<"//========= ("<<t.AsString()<<") by ROOT version "<<gROOT->GetVersion()<<std::endl;
1908 
1909  if (gStyle->GetCanvasPreferGL())
1910  out <<std::endl<<" gStyle->SetCanvasPreferGL(kTRUE);"<<std::endl<<std::endl;
1911 
1912  // Write canvas parameters (TDialogCanvas case)
1914  out<<" "<<ClassName()<<" *"<<cname<<" = new "<<ClassName()<<"("<<quote<<GetName()
1915  <<quote<<", "<<quote<<GetTitle()<<quote<<","<<w<<","<<h<<");"<<std::endl;
1916  } else {
1917  // Write canvas parameters (TCanvas case)
1918  out<<" TCanvas *"<<cname<<" = new TCanvas("<<quote<<GetName()<<quote<<", "<<quote<<GetTitle()
1919  <<quote;
1920  if (!HasMenuBar())
1921  out<<",-"<<topx<<","<<topy<<","<<w<<","<<h<<");"<<std::endl;
1922  else
1923  out<<","<<topx<<","<<topy<<","<<w<<","<<h<<");"<<std::endl;
1924  }
1925  // Write canvas options (in $TROOT or $TStyle)
1926  if (gStyle->GetOptFit()) {
1927  out<<" gStyle->SetOptFit(1);"<<std::endl;
1928  }
1929  if (!gStyle->GetOptStat()) {
1930  out<<" gStyle->SetOptStat(0);"<<std::endl;
1931  }
1932  if (!gStyle->GetOptTitle()) {
1933  out<<" gStyle->SetOptTitle(0);"<<std::endl;
1934  }
1935  if (gROOT->GetEditHistograms()) {
1936  out<<" gROOT->SetEditHistograms();"<<std::endl;
1937  }
1938  if (GetShowEventStatus()) {
1939  out<<" "<<GetName()<<"->ToggleEventStatus();"<<std::endl;
1940  }
1941  if (GetShowToolTips()) {
1942  out<<" "<<GetName()<<"->ToggleToolTips();"<<std::endl;
1943  }
1944  if (GetHighLightColor() != 5) {
1945  if (GetHighLightColor() > 228) {
1947  out<<" "<<GetName()<<"->SetHighLightColor(ci);" << std::endl;
1948  } else
1949  out<<" "<<GetName()<<"->SetHighLightColor("<<GetHighLightColor()<<");"<<std::endl;
1950  }
1951 
1952  // Now recursively scan all pads of this canvas
1953  cd();
1954  if (invalid) SetName("c1");
1955  TPad::SavePrimitive(out,option);
1956  // Write canvas options related to pad editor
1957  out<<" "<<GetName()<<"->SetSelected("<<GetName()<<");"<<std::endl;
1958  if (GetShowToolBar()) {
1959  out<<" "<<GetName()<<"->ToggleToolBar();"<<std::endl;
1960  }
1961  if (invalid) SetName(" ");
1962 
1963  out <<"}"<<std::endl;
1964  out.close();
1965  Info("SaveSource","C++ Macro file: %s has been generated", fname);
1966 
1967  // reset bit TClass::kClassSaved for all classes
1968  next.Reset();
1969  while((cl = (TClass*)next())) {
1971  }
1972  if (!lenfile) delete [] fname;
1973 }
1974 
1975 ////////////////////////////////////////////////////////////////////////////////
1976 /// Toggle batch mode. However, if the canvas is created without a window
1977 /// then batch mode always stays set.
1978 
1980 {
1981  if (gROOT->IsBatch() || IsWeb())
1982  fBatch = kTRUE;
1983  else
1984  fBatch = batch;
1985 }
1986 
1987 ////////////////////////////////////////////////////////////////////////////////
1988 /// Set Width and Height of canvas to ww and wh respectively. If ww and/or wh
1989 /// are greater than the current canvas window a scroll bar is automatically
1990 /// generated. Use this function to zoom in a canvas and navigate via
1991 /// the scroll bars. The Width and Height in this method are different from those
1992 /// given in the TCanvas constructors where these two dimension include the size
1993 /// of the window decoration whereas they do not in this method.
1994 
1996 {
1997  if (fCanvasImp) {
1998  fCanvasImp->SetCanvasSize(ww, wh);
1999  fCw = ww;
2000  fCh = wh;
2001  ResizePad();
2002  }
2003 }
2004 
2005 ////////////////////////////////////////////////////////////////////////////////
2006 /// Set cursor.
2007 
2009 {
2010  if (IsBatch()) return;
2011  gVirtualX->SetCursor(fCanvasID, cursor);
2012 }
2013 
2014 ////////////////////////////////////////////////////////////////////////////////
2015 /// Set Double Buffer On/Off.
2016 
2018 {
2019  if (IsBatch()) return;
2020  fDoubleBuffer = mode;
2021  gVirtualX->SetDoubleBuffer(fCanvasID, mode);
2022 
2023  // depending of the buffer mode set the drawing window to either
2024  // the canvas pixmap or to the canvas on-screen window
2025  if (fDoubleBuffer) {
2027  } else
2029 }
2030 
2031 ////////////////////////////////////////////////////////////////////////////////
2032 /// Fix canvas aspect ratio to current value if fixed is true.
2033 
2035 {
2036  if (fixed) {
2037  if (!fFixedAspectRatio) {
2038  if (fCh != 0)
2040  else {
2041  Error("SetAspectRatio", "cannot fix aspect ratio, height of canvas is 0");
2042  return;
2043  }
2045  }
2046  } else {
2048  fAspectRatio = 0;
2049  }
2050 }
2051 
2052 ////////////////////////////////////////////////////////////////////////////////
2053 /// If isfolder=kTRUE, the canvas can be browsed like a folder
2054 /// by default a canvas is not browsable.
2055 
2057 {
2058  fgIsFolder = isfolder;
2059 }
2060 
2061 ////////////////////////////////////////////////////////////////////////////////
2062 /// Set canvas name. In case `name` is an empty string, a default name is set.
2063 
2064 void TCanvas::SetName(const char *name)
2065 {
2066  if (!name || !name[0]) {
2067  const char *defcanvas = gROOT->GetDefCanvasName();
2068  char *cdef;
2069  auto lc = (TList*)gROOT->GetListOfCanvases();
2070  if (lc->FindObject(defcanvas)) {
2071  cdef = Form("%s_n%d",defcanvas,lc->GetSize()+1);
2072  } else {
2073  cdef = Form("%s",defcanvas);
2074  }
2075  fName = cdef;
2076  } else {
2077  fName = name;
2078  }
2079  if (gPad && TestBit(kMustCleanup)) gPad->Modified();
2080 }
2081 
2082 
2083 ////////////////////////////////////////////////////////////////////////////////
2084 /// Function to resize a canvas so that the plot inside is shown in real aspect
2085 /// ratio
2086 ///
2087 /// \param[in] axis 1 for resizing horizontally (x-axis) in order to get real
2088 /// aspect ratio, 2 for the resizing vertically (y-axis)
2089 /// \return false if error is encountered, true otherwise
2090 ///
2091 /// ~~~ {.cpp}
2092 /// hpxpy->Draw();
2093 /// c1->SetRealAspectRatio();
2094 /// ~~~
2095 ///
2096 /// - For defining the concept of real aspect ratio, it is assumed that x and y
2097 /// axes are in same units, e.g. both in MeV or both in ns.
2098 /// - You can resize either the width of the canvas or the height, but not both
2099 /// at the same time
2100 /// - Call this function AFTER drawing AND zooming (SetUserRange) your TGraph or
2101 /// Histogram, otherwise it cannot infer your actual axes lengths
2102 /// - This function ensures that the TFrame has a real aspect ratio, this does not
2103 /// mean that the full pad (i.e. the canvas or png output) including margins has
2104 /// exactly the same ratio
2105 /// - This function does not work if the canvas is divided in several subpads
2106 
2108 {
2109  Update();
2110 
2111  //Get how many pixels are occupied by the canvas
2112  Int_t npx = GetWw();
2113  Int_t npy = GetWh();
2114 
2115  //Get x-y coordinates at the edges of the canvas (extrapolating outside the axes, NOT at the edges of the histogram)
2116  Double_t x1 = GetX1();
2117  Double_t y1 = GetY1();
2118  Double_t x2 = GetX2();
2119  Double_t y2 = GetY2();
2120 
2121  //Get the length of extrapolated x and y axes
2122  Double_t xlength2 = x2 - x1;
2123  Double_t ylength2 = y2 - y1;
2124  Double_t ratio2 = xlength2/ylength2;
2125 
2126  //Now get the number of pixels including the canvas borders
2127  Int_t bnpx = GetWindowWidth();
2128  Int_t bnpy = GetWindowHeight();
2129 
2130  if (axis==1) {
2131  SetCanvasSize(TMath::Nint(npy*ratio2), npy);
2132  SetWindowSize((bnpx-npx)+TMath::Nint(npy*ratio2), bnpy);
2133  } else if (axis==2) {
2134  SetCanvasSize(npx, TMath::Nint(npx/ratio2));
2135  SetWindowSize(bnpx, (bnpy-npy)+TMath::Nint(npx/ratio2));
2136  } else {
2137  Error("SetRealAspectRatio", "axis value %d is neither 1 (resize along x-axis) nor 2 (resize along y-axis).",axis);
2138  return false;
2139  }
2140 
2141  //Check now that resizing has worked
2142 
2143  Update();
2144 
2145  //Get how many pixels are occupied by the canvas
2146  npx = GetWw();
2147  npy = GetWh();
2148 
2149  //Get x-y coordinates at the edges of the canvas (extrapolating outside the axes,
2150  //NOT at the edges of the histogram)
2151  x1 = GetX1();
2152  y1 = GetY1();
2153  x2 = GetX2();
2154  y2 = GetY2();
2155 
2156  //Get the length of extrapolated x and y axes
2157  xlength2 = x2 - x1;
2158  ylength2 = y2 - y1;
2159  ratio2 = xlength2/ylength2;
2160 
2161  //Check accuracy +/-1 pixel due to rounding
2162  if (abs(TMath::Nint(npy*ratio2) - npx)<2) {
2163  return true;
2164  } else {
2165  Error("SetRealAspectRatio", "Resizing failed.");
2166  return false;
2167  }
2168 }
2169 
2170 
2171 ////////////////////////////////////////////////////////////////////////////////
2172 /// Set selected canvas.
2173 
2175 {
2176  fSelected = obj;
2177  if (obj) obj->SetBit(kMustCleanup);
2178 }
2179 
2180 ////////////////////////////////////////////////////////////////////////////////
2181 /// Set canvas title.
2182 
2183 void TCanvas::SetTitle(const char *title)
2184 {
2185  fTitle = title;
2186  if (fCanvasImp) fCanvasImp->SetWindowTitle(title);
2187 }
2188 
2189 ////////////////////////////////////////////////////////////////////////////////
2190 /// Set canvas window position
2191 
2193 {
2194  if (fCanvasImp)
2196 }
2197 
2198 ////////////////////////////////////////////////////////////////////////////////
2199 /// Set canvas window size
2200 
2202 {
2203  if (fBatch)
2204  SetCanvasSize((ww + fCw) / 2, (wh + fCh) / 2);
2205  else if (fCanvasImp)
2206  fCanvasImp->SetWindowSize(ww, wh);
2207 }
2208 
2209 ////////////////////////////////////////////////////////////////////////////////
2210 /// Set the canvas scale in centimeters.
2211 ///
2212 /// This information is used by PostScript to set the page size.
2213 ///
2214 /// \param[in] xsize size of the canvas in centimeters along X
2215 /// \param[in] ysize size of the canvas in centimeters along Y
2216 ///
2217 /// if xsize and ysize are not equal to 0, then the scale factors will
2218 /// be computed to keep the ratio ysize/xsize independently of the canvas
2219 /// size (parts of the physical canvas will be unused).
2220 ///
2221 /// if xsize = 0 and ysize is not zero, then xsize will be computed
2222 /// to fit to the current canvas scale. If the canvas is resized,
2223 /// a new value for xsize will be recomputed. In this case the aspect
2224 /// ratio is not preserved.
2225 ///
2226 /// if both xsize = 0 and ysize = 0, then the scaling is automatic.
2227 /// the largest dimension will be allocated a size of 20 centimeters.
2228 
2229 void TCanvas::Size(Float_t xsize, Float_t ysize)
2230 {
2231  fXsizeUser = xsize;
2232  fYsizeUser = ysize;
2233 
2234  Resize();
2235 }
2236 
2237 ////////////////////////////////////////////////////////////////////////////////
2238 /// Show canvas
2239 
2241 {
2242  if (fCanvasImp)
2243  fCanvasImp->Show();
2244 }
2245 
2246 ////////////////////////////////////////////////////////////////////////////////
2247 /// Stream a class object.
2248 
2249 void TCanvas::Streamer(TBuffer &b)
2250 {
2251  UInt_t R__s, R__c;
2252  if (b.IsReading()) {
2253  Version_t v = b.ReadVersion(&R__s, &R__c);
2254  gPad = this;
2255  fCanvas = this;
2256  if (v>7) b.ClassBegin(TCanvas::IsA());
2257  if (v>7) b.ClassMember("TPad");
2258  TPad::Streamer(b);
2259  gPad = this;
2260  //restore the colors
2261  TObjArray *colors = (TObjArray*)fPrimitives->FindObject("ListOfColors");
2262  if (colors) {
2263  TIter next(colors);
2264  TColor *colold;
2265  while ((colold = (TColor*)next())) {
2266  if (colold) {
2267  Int_t cn = 0;
2268  if (colold) cn = colold->GetNumber();
2269  TColor *colcur = gROOT->GetColor(cn);
2270  if (colcur) {
2271  colcur->SetRGB(colold->GetRed(),colold->GetGreen(),colold->GetBlue());
2272  } else {
2273  colcur = new TColor(cn,colold->GetRed(),
2274  colold->GetGreen(),
2275  colold->GetBlue(),
2276  colold->GetName());
2277  if (!colcur) return;
2278  }
2279  }
2280  }
2281  //restore the palette if needed
2282  TObjArray *currentpalette = (TObjArray*)fPrimitives->FindObject("CurrentColorPalette");
2283  if (currentpalette) {
2284  TIter nextpal(currentpalette);
2285  Int_t n = currentpalette->GetEntries();
2286  TArrayI palcolors(n);
2287  TColor *col = 0;
2288  Int_t i = 0;
2289  while ((col = (TColor*)nextpal())) palcolors[i++] = col->GetNumber();
2290  gStyle->SetPalette(n,palcolors.GetArray());
2291  fPrimitives->Remove(currentpalette);
2292  delete currentpalette;
2293  }
2295  colors->Delete();
2296  delete colors;
2297  }
2298 
2299  if (v>7) b.ClassMember("fDISPLAY","TString");
2300  fDISPLAY.Streamer(b);
2301  if (v>7) b.ClassMember("fDoubleBuffer", "Int_t");
2302  b >> fDoubleBuffer;
2303  if (v>7) b.ClassMember("fRetained", "Bool_t");
2304  b >> fRetained;
2305  if (v>7) b.ClassMember("fXsizeUser", "Size_t");
2306  b >> fXsizeUser;
2307  if (v>7) b.ClassMember("fYsizeUser", "Size_t");
2308  b >> fYsizeUser;
2309  if (v>7) b.ClassMember("fXsizeReal", "Size_t");
2310  b >> fXsizeReal;
2311  if (v>7) b.ClassMember("fYsizeReal", "Size_t");
2312  b >> fYsizeReal;
2313  fCanvasID = -1;
2314  if (v>7) b.ClassMember("fWindowTopX", "Int_t");
2315  b >> fWindowTopX;
2316  if (v>7) b.ClassMember("fWindowTopY", "Int_t");
2317  b >> fWindowTopY;
2318  if (v > 2) {
2319  if (v>7) b.ClassMember("fWindowWidth", "UInt_t");
2320  b >> fWindowWidth;
2321  if (v>7) b.ClassMember("fWindowHeight", "UInt_t");
2322  b >> fWindowHeight;
2323  }
2324  if (v>7) b.ClassMember("fCw", "UInt_t");
2325  b >> fCw;
2326  if (v>7) b.ClassMember("fCh", "UInt_t");
2327  b >> fCh;
2328  if (v <= 2) {
2329  fWindowWidth = fCw;
2330  fWindowHeight = fCh;
2331  }
2332  if (v>7) b.ClassMember("fCatt", "TAttCanvas");
2333  fCatt.Streamer(b);
2334  Bool_t dummy;
2335  if (v>7) b.ClassMember("kMoveOpaque", "Bool_t");
2336  b >> dummy; if (dummy) MoveOpaque(1);
2337  if (v>7) b.ClassMember("kResizeOpaque", "Bool_t");
2338  b >> dummy; if (dummy) ResizeOpaque(1);
2339  if (v>7) b.ClassMember("fHighLightColor", "Color_t");
2340  b >> fHighLightColor;
2341  if (v>7) b.ClassMember("fBatch", "Bool_t");
2342  b >> dummy; //was fBatch
2343  if (v < 2) return;
2344  if (v>7) b.ClassMember("kShowEventStatus", "Bool_t");
2345  b >> dummy; if (dummy) SetBit(kShowEventStatus);
2346 
2347  if (v > 3) {
2348  if (v>7) b.ClassMember("kAutoExec", "Bool_t");
2349  b >> dummy; if (dummy) SetBit(kAutoExec);
2350  }
2351  if (v>7) b.ClassMember("kMenuBar", "Bool_t");
2352  b >> dummy; if (dummy) SetBit(kMenuBar);
2353  fBatch = gROOT->IsBatch();
2354  if (v>7) b.ClassEnd(TCanvas::IsA());
2355  b.CheckByteCount(R__s, R__c, TCanvas::IsA());
2356  } else {
2357  //save list of colors
2358  //we must protect the case when two or more canvases are saved
2359  //in the same buffer. If the list of colors has already been saved
2360  //in the buffer, do not add the list of colors to the list of primitives.
2361  TObjArray *colors = 0;
2362  TObjArray *CurrentColorPalette = 0;
2363  if (TColor::DefinedColors()) {
2364  if (!b.CheckObject(gROOT->GetListOfColors(),TObjArray::Class())) {
2365  colors = (TObjArray*)gROOT->GetListOfColors();
2367  }
2368  //save the current palette
2369  TArrayI pal = TColor::GetPalette();
2370  Int_t palsize = pal.GetSize();
2371  CurrentColorPalette = new TObjArray();
2372  CurrentColorPalette->SetName("CurrentColorPalette");
2373  for (Int_t i=0; i<palsize; i++) CurrentColorPalette->Add(gROOT->GetColor(pal[i]));
2374  fPrimitives->Add(CurrentColorPalette);
2375  }
2376 
2377  R__c = b.WriteVersion(TCanvas::IsA(), kTRUE);
2378  b.ClassBegin(TCanvas::IsA());
2379  b.ClassMember("TPad");
2380  TPad::Streamer(b);
2382  if (CurrentColorPalette) { fPrimitives->Remove(CurrentColorPalette); delete CurrentColorPalette; }
2383  b.ClassMember("fDISPLAY","TString");
2384  fDISPLAY.Streamer(b);
2385  b.ClassMember("fDoubleBuffer", "Int_t");
2386  b << fDoubleBuffer;
2387  b.ClassMember("fRetained", "Bool_t");
2388  b << fRetained;
2389  b.ClassMember("fXsizeUser", "Size_t");
2390  b << fXsizeUser;
2391  b.ClassMember("fYsizeUser", "Size_t");
2392  b << fYsizeUser;
2393  b.ClassMember("fXsizeReal", "Size_t");
2394  b << fXsizeReal;
2395  b.ClassMember("fYsizeReal", "Size_t");
2396  b << fYsizeReal;
2398  Int_t topx = fWindowTopX, topy = fWindowTopY;
2399  UInt_t editorWidth = 0;
2400  if(fCanvasImp) editorWidth = fCanvasImp->GetWindowGeometry(topx,topy,w,h);
2401  b.ClassMember("fWindowTopX", "Int_t");
2402  b << topx;
2403  b.ClassMember("fWindowTopY", "Int_t");
2404  b << topy;
2405  b.ClassMember("fWindowWidth", "UInt_t");
2406  b << (UInt_t)(w-editorWidth);
2407  b.ClassMember("fWindowHeight", "UInt_t");
2408  b << h;
2409  b.ClassMember("fCw", "UInt_t");
2410  b << fCw;
2411  b.ClassMember("fCh", "UInt_t");
2412  b << fCh;
2413  b.ClassMember("fCatt", "TAttCanvas");
2414  fCatt.Streamer(b);
2415  b.ClassMember("kMoveOpaque", "Bool_t");
2416  b << TestBit(kMoveOpaque); //please remove in ROOT version 6
2417  b.ClassMember("kResizeOpaque", "Bool_t");
2418  b << TestBit(kResizeOpaque); //please remove in ROOT version 6
2419  b.ClassMember("fHighLightColor", "Color_t");
2420  b << fHighLightColor;
2421  b.ClassMember("fBatch", "Bool_t");
2422  b << fBatch; //please remove in ROOT version 6
2423  b.ClassMember("kShowEventStatus", "Bool_t");
2424  b << TestBit(kShowEventStatus); //please remove in ROOT version 6
2425  b.ClassMember("kAutoExec", "Bool_t");
2426  b << TestBit(kAutoExec); //please remove in ROOT version 6
2427  b.ClassMember("kMenuBar", "Bool_t");
2428  b << TestBit(kMenuBar); //please remove in ROOT version 6
2429  b.ClassEnd(TCanvas::IsA());
2430  b.SetByteCount(R__c, kTRUE);
2431  }
2432 }
2433 
2434 ////////////////////////////////////////////////////////////////////////////////
2435 /// Toggle pad auto execution of list of TExecs.
2436 
2438 {
2439  Bool_t autoExec = TestBit(kAutoExec);
2440  SetBit(kAutoExec,!autoExec);
2441 }
2442 
2443 ////////////////////////////////////////////////////////////////////////////////
2444 /// Toggle event statusbar.
2445 
2447 {
2448  Bool_t showEventStatus = !TestBit(kShowEventStatus);
2449  SetBit(kShowEventStatus,showEventStatus);
2450 
2451  if (fCanvasImp) fCanvasImp->ShowStatusBar(showEventStatus);
2452 }
2453 
2454 ////////////////////////////////////////////////////////////////////////////////
2455 /// Toggle toolbar.
2456 
2458 {
2459  Bool_t showToolBar = !TestBit(kShowToolBar);
2460  SetBit(kShowToolBar,showToolBar);
2461 
2462  if (fCanvasImp) fCanvasImp->ShowToolBar(showToolBar);
2463 }
2464 
2465 ////////////////////////////////////////////////////////////////////////////////
2466 /// Toggle editor.
2467 
2469 {
2470  Bool_t showEditor = !TestBit(kShowEditor);
2471  SetBit(kShowEditor,showEditor);
2472 
2473  if (fCanvasImp) fCanvasImp->ShowEditor(showEditor);
2474 }
2475 
2476 ////////////////////////////////////////////////////////////////////////////////
2477 /// Toggle tooltip display.
2478 
2480 {
2481  Bool_t showToolTips = !TestBit(kShowToolTips);
2482  SetBit(kShowToolTips, showToolTips);
2483 
2484  if (fCanvasImp) fCanvasImp->ShowToolTips(showToolTips);
2485 }
2486 
2487 
2488 ////////////////////////////////////////////////////////////////////////////////
2489 /// Static function returning "true" if transparency is supported.
2490 
2492 {
2493  return gPad && (gVirtualX->InheritsFrom("TGQuartz") ||
2494  gPad->GetGLDevice() != -1);
2495 }
2496 
2497 extern "C" void ROOT_TCanvas_Update(void* TheCanvas) {
2498  static_cast<TCanvas*>(TheCanvas)->Update();
2499 }
2500 
2501 ////////////////////////////////////////////////////////////////////////////////
2502 /// Update canvas pad buffers.
2503 
2505 {
2506  if (fUpdating) return;
2507 
2508  if (fPixmapID == -1) return;
2509 
2510  static const union CastFromFuncToVoidPtr_t {
2511  CastFromFuncToVoidPtr_t(): fFuncPtr(ROOT_TCanvas_Update) {}
2512  void (*fFuncPtr)(void*);
2513  void* fVoidPtr;
2514  } castFromFuncToVoidPtr;
2515 
2516  if (gThreadXAR) {
2517  void *arr[3];
2518  arr[1] = this;
2519  arr[2] = castFromFuncToVoidPtr.fVoidPtr;
2520  if ((*gThreadXAR)("CUPD", 3, arr, 0)) return;
2521  }
2522 
2523  if (!fCanvasImp) return;
2524 
2525  if (!gVirtualX->IsCmdThread()) {
2526  // Why do we have this (which uses the interpreter to funnel the Update()
2527  // through the main thread) when the gThreadXAR mechanism does seemingly
2528  // the same?
2529  gInterpreter->Execute(this, IsA(), "Update", "");
2530  return;
2531  }
2532 
2534 
2535  fUpdating = kTRUE;
2536 
2537  if (!fCanvasImp->PerformUpdate()) {
2538 
2539  if (!IsBatch()) FeedbackMode(kFALSE); // Goto double buffer mode
2540 
2541  if (!UseGL()) PaintModified(); // Repaint all modified pad's
2542 
2543  Flush(); // Copy all pad pixmaps to the screen
2544 
2545  SetCursor(kCross);
2546  }
2547 
2548  fUpdating = kFALSE;
2549 }
2550 
2551 ////////////////////////////////////////////////////////////////////////////////
2552 /// Used by friend class TCanvasImp.
2553 
2555 {
2556  fCanvasID = 0;
2557  fContextMenu = 0;
2558 }
2559 
2560 ////////////////////////////////////////////////////////////////////////////////
2561 /// Check whether this canvas is to be drawn in grayscale mode.
2562 
2564 {
2565  return TestBit(kIsGrayscale);
2566 }
2567 
2568 ////////////////////////////////////////////////////////////////////////////////
2569 /// Set whether this canvas should be painted in grayscale, and re-paint
2570 /// it if necessary.
2571 
2572 void TCanvas::SetGrayscale(Bool_t set /*= kTRUE*/)
2573 {
2574  if (IsGrayscale() == set) return;
2575  SetBit(kIsGrayscale, set);
2576  Paint(); // update canvas and all sub-pads, unconditionally!
2577 }
2578 
2579 ////////////////////////////////////////////////////////////////////////////////
2580 /// Probably, TPadPainter must be placed in a separate ROOT module -
2581 /// "padpainter" (the same as "histpainter"). But now, it's directly in a
2582 /// gpad dir, so, in case of default painter, no *.so should be loaded,
2583 /// no need in plugin managers.
2584 /// May change in future.
2585 
2587 {
2588  //Even for batch mode painter is still required, just to delegate
2589  //some calls to batch "virtual X".
2590  if (!UseGL() || fBatch) {
2591  fPainter = 0;
2593  if (!fPainter) fPainter = new TPadPainter; // Do not need plugin manager for this!
2594  } else {
2596  if (!fPainter) {
2597  Error("CreatePainter", "GL Painter creation failed! Will use default!");
2598  fPainter = new TPadPainter;
2599  fUseGL = kFALSE;
2600  }
2601  }
2602 }
2603 
2604 ////////////////////////////////////////////////////////////////////////////////
2605 /// Access and (probably) creation of pad painter.
2606 
2608 {
2609  if (!fPainter) CreatePainter();
2610  return fPainter;
2611 }
2612 
2613 
2614 ////////////////////////////////////////////////////////////////////////////////
2615 ///assert on IsBatch() == false?
2616 
2618 {
2619  if (fGLDevice != -1) {
2620  //fPainter has a font manager.
2621  //Font manager will delete textures.
2622  //If context is wrong (we can have several canvases) -
2623  //wrong texture will be deleted, damaging some of our fonts.
2624  gGLManager->MakeCurrent(fGLDevice);
2625  }
2626 
2627  delete fPainter;
2628  fPainter = 0;
2629 
2630  if (fGLDevice != -1) {
2631  gGLManager->DeleteGLContext(fGLDevice);//?
2632  fGLDevice = -1;
2633  }
2634 }
TCanvas::fgIsFolder
static Bool_t fgIsFolder
Indicates if canvas can be browsed as a folder.
Definition: TCanvas.h:66
TVirtualPS
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
Definition: TVirtualPS.h:30
TObject::kMustCleanup
@ kMustCleanup
if object destructor must call RecursiveRemove()
Definition: TObject.h:60
TCanvasImp.h
c
#define c(i)
Definition: RSha256.hxx:101
kMouseLeave
@ kMouseLeave
Definition: Buttons.h:23
TCanvas::fCatt
TAttCanvas fCatt
Canvas attributes.
Definition: TCanvas.h:30
TCanvas::SetGrayscale
void SetGrayscale(Bool_t set=kTRUE)
Set whether this canvas should be painted in grayscale, and re-paint it if necessary.
Definition: TCanvas.cxx:2572
TCanvas::kShowEditor
@ kShowEditor
Definition: TCanvas.h:91
TCanvas::fDrawn
Bool_t fDrawn
! Set to True when the Draw method is called
Definition: TCanvas.h:62
TPad::SetTicky
virtual void SetTicky(Int_t value=1)
Definition: TPad.h:349
kButton3Double
@ kButton3Double
Definition: Buttons.h:24
TCanvas::SavePrimitive
void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitives in this canvas in C++ macro file with GUI.
Definition: TCanvas.cxx:1783
TPad::fX2
Double_t fX2
X of upper X coordinate.
Definition: TPad.h:34
kWheelUp
@ kWheelUp
Definition: Buttons.h:18
n
const Int_t n
Definition: legend1.C:16
TPad::UseCurrentStyle
virtual void UseCurrentStyle()
Force a copy of current style for all objects in pad.
Definition: TPad.cxx:6767
TDialogCanvas.h
TAxis
Class to manage histogram axis.
Definition: TAxis.h:30
TPad::CopyPixmaps
virtual void CopyPixmaps()
Copy the sub-pixmaps of the pad to the canvas.
Definition: TPad.cxx:1070
TClass::kClassSaved
@ kClassSaved
Definition: TClass.h:94
first
Definition: first.py:1
TCanvas::fEventX
Int_t fEventX
! Last X mouse position in canvas
Definition: TCanvas.h:45
TCanvasImp::ShowToolBar
virtual void ShowToolBar(Bool_t show=kTRUE)
Definition: TCanvasImp.h:100
TCanvasImp::Close
virtual void Close()
Definition: TCanvasImp.h:56
TAttPad::SetTopMargin
virtual void SetTopMargin(Float_t topmargin)
Set Pad top margin in fraction of the pad height.
Definition: TAttPad.cxx:129
TBrowser
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
TAttPad
Manages default Pad attributes.
Definition: TAttPad.h:19
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TPad::GetGridy
Bool_t GetGridy() const
Definition: TPad.h:230
TObject::TestBit
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
TPad::GetX1
Double_t GetX1() const
Definition: TPad.h:234
TPad::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitives in this pad on the C++ source file out.
Definition: TPad.cxx:5694
TCanvas::fXsizeReal
Size_t fXsizeReal
Current size of canvas along X in CM.
Definition: TCanvas.h:34
Version_t
short Version_t
Definition: RtypesCore.h:65
TStyle::GetOptLogy
Int_t GetOptLogy() const
Definition: TStyle.h:239
snprintf
#define snprintf
Definition: civetweb.c:1540
TPad::GetCanvas
virtual TCanvas * GetCanvas() const
Definition: TPad.h:256
TObjArray
An array of TObjects.
Definition: TObjArray.h:37
TCanvas::fBatch
Bool_t fBatch
! True when in batchmode
Definition: TCanvas.h:58
TCanvas::ToggleAutoExec
virtual void ToggleAutoExec()
Toggle pad auto execution of list of TExecs.
Definition: TCanvas.cxx:2437
TROOT::DecreaseDirLevel
static Int_t DecreaseDirLevel()
Decrease the indentation level for ls().
Definition: TROOT.cxx:2702
Option_t
const char Option_t
Definition: RtypesCore.h:66
kButton2Double
@ kButton2Double
Definition: Buttons.h:24
TPad::Range
virtual void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Set world coordinate system for the pad.
Definition: TPad.cxx:5196
TCanvas::SetTitle
void SetTitle(const char *title="")
Set canvas title.
Definition: TCanvas.cxx:2183
TPad
The most important graphics class in the ROOT system.
Definition: TPad.h:26
TCanvas::HasMenuBar
Bool_t HasMenuBar() const
Definition: TCanvas.h:166
TCanvas::Pick
virtual TPad * Pick(Int_t px, Int_t py, TObjLink *&pickobj)
Search for an object at pixel position px,py.
Definition: TCanvas.h:180
TCanvasImp::SetWindowSize
virtual void SetWindowSize(UInt_t w, UInt_t h)
Definition: TCanvasImp.h:91
kButton1Motion
@ kButton1Motion
Definition: Buttons.h:20
ECursor
ECursor
Definition: GuiTypes.h:371
gEnv
R__EXTERN TEnv * gEnv
Definition: TEnv.h:171
gVirtualX
#define gVirtualX
Definition: TVirtualX.h:338
TCanvas::DisconnectWidget
void DisconnectWidget()
Used by friend class TCanvasImp.
Definition: TCanvas.cxx:2554
TList::FindObject
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:578
TCanvas::GetWw
UInt_t GetWw() const
Get Ww.
Definition: TCanvas.h:161
TStyle::GetCanvasBorderMode
Int_t GetCanvasBorderMode() const
Definition: TStyle.h:182
TCanvas::Selected
virtual void Selected(TVirtualPad *pad, TObject *obj, Int_t event)
Emit Selected() signal.
Definition: TCanvas.cxx:1641
Form
char * Form(const char *fmt,...)
TCanvas::ls
virtual void ls(Option_t *option="") const
List all pads.
Definition: TCanvas.cxx:1494
TCanvas::IsWeb
Bool_t IsWeb() const
Is web canvas.
Definition: TCanvas.cxx:1486
TDatime.h
TCanvas::ResizeOpaque
void ResizeOpaque(Int_t set=1)
Set option to resize objects/pads in a canvas.
Definition: TCanvas.cxx:1764
TGraph.h
TObject::Info
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:864
TView.h
TObject::Error
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:890
colors
Color * colors
Definition: X3DBuffer.c:21
TContextMenu::Popup
virtual void Popup(Int_t x, Int_t y, TObject *obj, TVirtualPad *c=nullptr, TVirtualPad *p=nullptr)
Popup context menu at given location in canvas c and pad p for selected object.
Definition: TContextMenu.cxx:411
TCanvas::kShowEventStatus
@ kShowEventStatus
Definition: TCanvas.h:87
TApplication::InitializeGraphics
void InitializeGraphics()
Initialize the graphics environment.
Definition: TApplication.cxx:260
kButton1Up
@ kButton1Up
Definition: Buttons.h:19
TStyle::GetCanvasDefH
Int_t GetCanvasDefH() const
Definition: TStyle.h:183
TCanvas::EditorBar
virtual void EditorBar()
Get editor bar.
Definition: TCanvas.cxx:1030
TPad::fAspectRatio
Double_t fAspectRatio
ratio of w/h in case of fixed ratio
Definition: TPad.h:78
TCanvas::fYsizeReal
Size_t fYsizeReal
Current size of canvas along Y in CM.
Definition: TCanvas.h:35
TControlBar.h
TColor::DefinedColors
static Bool_t DefinedColors()
Static function returning kTRUE if some new colors have been defined after initialisation or since th...
Definition: TColor.cxx:1420
TPad::fY2
Double_t fY2
Y of upper Y coordinate.
Definition: TPad.h:35
TCanvas::IsFolder
Bool_t IsFolder() const
Is folder ?
Definition: TCanvas.cxx:1478
gInterpreter
#define gInterpreter
Definition: TInterpreter.h:560
TCanvas::CreatePainter
void CreatePainter()
Probably, TPadPainter must be placed in a separate ROOT module - "padpainter" (the same as "histpaint...
Definition: TCanvas.cxx:2586
TPad::GetGridx
Bool_t GetGridx() const
Definition: TPad.h:229
TColor::SetRGB
virtual void SetRGB(Float_t r, Float_t g, Float_t b)
Initialize this color and its associated colors.
Definition: TColor.cxx:1702
TCanvas::EnterLeave
void EnterLeave(TPad *prevSelPad, TObject *prevSelObj)
Generate kMouseEnter and kMouseLeave events depending on the previously selected object and the curre...
Definition: TCanvas.cxx:1065
TObject::GetObjectInfo
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
Definition: TObject.cxx:388
Float_t
float Float_t
Definition: RtypesCore.h:57
TCanvas::fPainter
TVirtualPadPainter * fPainter
! Canvas (pad) painter.
Definition: TCanvas.h:64
TStyle::GetOptFit
Int_t GetOptFit() const
Definition: TStyle.h:235
TCanvas::kResizeOpaque
@ kResizeOpaque
Definition: TCanvas.h:93
TStyle.h
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:162
TCanvas::fSelectedY
Int_t fSelectedY
! Y of selected object
Definition: TCanvas.h:51
TDatime::AsString
const char * AsString() const
Return the date & time as a string (ctime() format).
Definition: TDatime.cxx:102
TStyle::SetCanvasBorderSize
void SetCanvasBorderSize(Width_t size=1)
Definition: TStyle.h:328
EEventType
EEventType
Definition: Buttons.h:15
Int_t
int Int_t
Definition: RtypesCore.h:45
TCanvas::FeedbackMode
void FeedbackMode(Bool_t set)
Turn rubberband feedback mode on or off.
Definition: TCanvas.cxx:1120
TPad::fFixedAspectRatio
Bool_t fFixedAspectRatio
True if fixed aspect ratio.
Definition: TPad.h:100
TCanvas::fSelectedPad
TPad * fSelectedPad
! Pad containing currently selected object
Definition: TCanvas.h:53
TPad::Clear
void Clear(Option_t *option="")
Delete all pad primitives.
Definition: TPad.cxx:633
TCanvas::kShowToolTips
@ kShowToolTips
Definition: TCanvas.h:95
TStyle::GetPadTopMargin
Float_t GetPadTopMargin() const
Definition: TStyle.h:203
TString::Contains
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:624
SafeDelete
#define SafeDelete(p)
Definition: RConfig.hxx:543
TPadPainter.h
TObjArray::GetEntries
Int_t GetEntries() const
Return the number of objects in array (i.e.
Definition: TObjArray.cxx:523
x
Double_t x[n]
Definition: legend1.C:17
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
TCanvas::SetFolder
static void SetFolder(Bool_t isfolder=kTRUE)
If isfolder=kTRUE, the canvas can be browsed like a folder by default a canvas is not browsable.
Definition: TCanvas.cxx:2056
TCanvas::fEventY
Int_t fEventY
! Last Y mouse position in canvas
Definition: TCanvas.h:46
TCanvas::kAutoExec
@ kAutoExec
Definition: TCanvas.h:88
TPad::SetFillStyle
virtual void SetFillStyle(Style_t fstyle)
Override TAttFill::FillStyle for TPad because we want to handle style=0 as style 4000.
Definition: TPad.cxx:5917
TPad::SetGridy
virtual void SetGridy(Int_t value=1)
Definition: TPad.h:329
TClass.h
TCanvas::GetHighLightColor
Color_t GetHighLightColor() const
Get highlight color.
Definition: TCanvas.h:136
kButton1Shift
@ kButton1Shift
Definition: Buttons.h:18
TPad::GetName
const char * GetName() const
Returns name of object.
Definition: TPad.h:254
TEnv::GetValue
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:491
TVirtualPS.h
TCanvas::IsGrayscale
Bool_t IsGrayscale()
Check whether this canvas is to be drawn in grayscale mode.
Definition: TCanvas.cxx:2563
TColor.h
TCanvas::Clear
void Clear(Option_t *option="")
Remove all primitives from the canvas.
Definition: TCanvas.cxx:727
TCanvas::GetWh
UInt_t GetWh() const
Get Wh.
Definition: TCanvas.h:162
TIter::Reset
void Reset()
Definition: TCollection.h:252
TVirtualX.h
TCanvas::RunAutoExec
void RunAutoExec()
Execute the list of TExecs in the current pad.
Definition: TCanvas.cxx:1772
TCanvas::UseGL
Bool_t UseGL() const
Definition: TCanvas.h:223
TBuffer
Buffer base class used for serializing objects.
Definition: TBuffer.h:43
TAxis::GetTimeDisplay
virtual Bool_t GetTimeDisplay() const
Definition: TAxis.h:126
TCanvas::SetSelected
void SetSelected(TObject *obj)
Set selected canvas.
Definition: TCanvas.cxx:2174
kMouseMotion
@ kMouseMotion
Definition: Buttons.h:23
TObject::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:403
TCanvas.h
TEnv.h
TColor::SaveColor
static void SaveColor(std::ostream &out, Int_t ci)
Save a color with index > 228 as a C++ statement(s) on output stream out.
Definition: TColor.cxx:2118
TCanvas::Size
virtual void Size(Float_t xsizeuser=0, Float_t ysizeuser=0)
Set the canvas scale in centimeters.
Definition: TCanvas.cxx:2229
TCanvas::fCanvasID
Int_t fCanvasID
! Canvas identifier
Definition: TCanvas.h:47
TString
Basic string class.
Definition: TString.h:136
TCanvasImp::Iconify
virtual void Iconify()
Definition: TCanvasImp.h:59
TPad::GetX2
Double_t GetX2() const
Definition: TPad.h:235
TCanvas::fCh
UInt_t fCh
Height of the canvas along Y (pixels)
Definition: TCanvas.h:43
TPad::SetTicks
virtual void SetTicks(Int_t valuex=1, Int_t valuey=1)
Definition: TPad.h:347
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TCanvasImp::GetWindowGeometry
virtual UInt_t GetWindowGeometry(Int_t &x, Int_t &y, UInt_t &w, UInt_t &h)
Definition: TCanvasImp.h:87
TIter::GetOption
Option_t * GetOption() const
Definition: TCollection.h:251
TCanvas::fCw
UInt_t fCw
Width of the canvas along X (pixels)
Definition: TCanvas.h:42
TCanvas::SaveSource
void SaveSource(const char *filename="", Option_t *option="")
Save primitives in this canvas as a C++ macro file.
Definition: TCanvas.cxx:1828
TColor::GetBlue
Float_t GetBlue() const
Definition: TColor.h:59
TObject::InheritsFrom
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:445
v
@ v
Definition: rootcling_impl.cxx:3635
TStyle::GetPadTickY
Int_t GetPadTickY() const
Definition: TStyle.h:209
b
#define b(i)
Definition: RSha256.hxx:100
TCanvasImp::IsWeb
virtual Bool_t IsWeb() const
Definition: TCanvasImp.h:45
TVirtualX::kInvert
@ kInvert
Definition: TVirtualX.h:49
TCanvas::kMoveOpaque
@ kMoveOpaque
Definition: TCanvas.h:92
TCanvas::fPadSave
TPad * fPadSave
! Pointer to saved pad in HandleInput
Definition: TCanvas.h:55
TCanvas::fSelected
TObject * fSelected
! Currently selected object
Definition: TCanvas.h:48
TCanvas::CopyPixmaps
void CopyPixmaps()
Copy the canvas pixmap of the pad to the canvas.
Definition: TCanvas.cxx:827
TPad::fGLDevice
Int_t fGLDevice
! OpenGL off-screen pixmap identifier
Definition: TPad.h:81
TCanvas::Constructor
void Constructor()
Canvas default constructor.
Definition: TCanvas.cxx:183
bool
TVirtualPadPainter::LockPainter
virtual void LockPainter()
Empty definition.
Definition: TVirtualPadPainter.cxx:51
TPad::SetLogz
virtual void SetLogz(Int_t value=1)
Set Lin/Log scale for Z.
Definition: TPad.cxx:5954
TObjArray::Add
void Add(TObject *obj)
Definition: TObjArray.h:74
TCanvas::fDoubleBuffer
Int_t fDoubleBuffer
Double buffer flag (0=off, 1=on)
Definition: TCanvas.h:37
TCanvas::HandleInput
virtual void HandleInput(EEventType button, Int_t x, Int_t y)
Handle Input Events.
Definition: TCanvas.cxx:1225
TPad::fName
TString fName
Pad name.
Definition: TPad.h:105
x1
static const double x1[5]
Definition: RooGaussKronrodIntegrator1D.cxx:346
TString::Last
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition: TString.cxx:892
TVirtualPadEditor::GetPadEditor
static TVirtualPadEditor * GetPadEditor(Bool_t load=kTRUE)
Returns the pad editor dialog. Static method.
Definition: TVirtualPadEditor.cxx:74
TCanvas::Destructor
void Destructor()
Actual canvas destructor.
Definition: TCanvas.cxx:684
TStyle::GetCanvasPreferGL
Bool_t GetCanvasPreferGL() const
Definition: TStyle.h:179
TStyle::GetCanvasColor
Color_t GetCanvasColor() const
Definition: TStyle.h:180
TROOT.h
TPad::GetBorderMode
virtual Short_t GetBorderMode() const
Definition: TPad.h:193
TPad::Modified
void Modified(Bool_t flag=1)
Definition: TPad.h:414
TCanvas::kShowToolBar
@ kShowToolBar
Definition: TCanvas.h:90
TCanvas::UseCurrentStyle
void UseCurrentStyle()
Force a copy of current style for all objects in canvas.
Definition: TCanvas.cxx:1176
TCanvasImp::ForceUpdate
virtual void ForceUpdate()
Definition: TCanvasImp.h:57
TCanvas::Draw
virtual void Draw(Option_t *option="")
Draw a canvas.
Definition: TCanvas.cxx:845
TCanvas::fDISPLAY
TString fDISPLAY
Name of destination screen.
Definition: TCanvas.h:31
TObject::kNoContextMenu
@ kNoContextMenu
if object does not want context menu
Definition: TObject.h:65
TApplication.h
TContextMenu
This class provides an interface to context sensitive popup menus.
Definition: TContextMenu.h:44
TObject::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:359
kWheelDown
@ kWheelDown
Definition: Buttons.h:18
TAttLine::Copy
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
Definition: TAttLine.cxx:172
TCanvas::ExecuteEvent
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TCanvas.cxx:1102
TContextMenu.h
TCanvas::fYsizeUser
Size_t fYsizeUser
User specified size of canvas along Y in CM.
Definition: TCanvas.h:33
TStyle::GetCanvasDefX
Int_t GetCanvasDefX() const
Definition: TStyle.h:185
TPad::fY1
Double_t fY1
Y of lower Y coordinate.
Definition: TPad.h:33
TStyle::GetScreenFactor
Float_t GetScreenFactor() const
Definition: TStyle.h:247
TPad::SetBorderSize
virtual void SetBorderSize(Short_t bordersize)
Definition: TPad.h:318
TPad::SetLogy
virtual void SetLogy(Int_t value=1)
Set Lin/Log scale for Y.
Definition: TPad.cxx:5943
TCanvas::SupportAlpha
static Bool_t SupportAlpha()
Static function returning "true" if transparency is supported.
Definition: TCanvas.cxx:2491
TStyle::GetCanvasDefY
Int_t GetCanvasDefY() const
Definition: TStyle.h:186
TCanvas::DrawClonePad
virtual TObject * DrawClonePad()
Draw a clone of this canvas into the current pad In an interactive session, select the destination/cu...
Definition: TCanvas.cxx:909
TCanvas::Highlighted
virtual void Highlighted(TVirtualPad *pad, TObject *obj, Int_t x, Int_t y)
Emit Highlighted() signal.
Definition: TCanvas.cxx:1614
TMath::Nint
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Definition: TMath.h:713
TCanvas::Close
void Close(Option_t *option="")
Close canvas.
Definition: TCanvas.cxx:778
TPad::SetGridx
virtual void SetGridx(Int_t value=1)
Definition: TPad.h:328
TCanvas::GetCanvasPainter
TVirtualPadPainter * GetCanvasPainter()
Access and (probably) creation of pad painter.
Definition: TCanvas.cxx:2607
gBatchGuiFactory
R__EXTERN TGuiFactory * gBatchGuiFactory
Definition: TGuiFactory.h:67
TAttFill::Copy
void Copy(TAttFill &attfill) const
Copy this fill attributes to a new TAttFill.
Definition: TAttFill.cxx:202
TBuffer.h
TVirtualPadEditor.h
TAttLine
Line Attributes class.
Definition: TAttLine.h:18
TPad::fX1
Double_t fX1
X of lower X coordinate.
Definition: TPad.h:32
TCanvas::MoveOpaque
void MoveOpaque(Int_t set=1)
Set option to move objects/pads in a canvas.
Definition: TCanvas.cxx:1537
TCanvas::ProcessedEvent
virtual void ProcessedEvent(Int_t event, Int_t x, Int_t y, TObject *selected)
Emit ProcessedEvent() signal.
Definition: TCanvas.cxx:1655
TCanvas::GetShowToolTips
Bool_t GetShowToolTips() const
Definition: TCanvas.h:149
TCanvas::GetShowToolBar
Bool_t GetShowToolBar() const
Definition: TCanvas.h:147
gStyle
R__EXTERN TStyle * gStyle
Definition: TStyle.h:412
TObject::ResetBit
void ResetBit(UInt_t f)
Definition: TObject.h:171
TAttPad::SetBottomMargin
virtual void SetBottomMargin(Float_t bottommargin)
Set Pad bottom margin in fraction of the pad height.
Definition: TAttPad.cxx:99
TCanvas::SetWindowPosition
void SetWindowPosition(Int_t x, Int_t y)
Set canvas window position.
Definition: TCanvas.cxx:2192
kButton1Double
@ kButton1Double
Definition: Buttons.h:24
TCanvas::Closed
virtual void Closed()
Emit Closed signal.
Definition: TCanvas.cxx:768
TBox.h
TColor
The color creation and management class.
Definition: TColor.h:19
gROOTMutex
R__EXTERN TVirtualMutex * gROOTMutex
Definition: TROOT.h:61
TStyle::GetOptTitle
Int_t GetOptTitle() const
Definition: TStyle.h:237
h
#define h(i)
Definition: RSha256.hxx:106
TPad::fPrimitives
TList * fPrimitives
->List of primitives (subpads)
Definition: TPad.h:103
TCanvas::GetShowEventStatus
Bool_t GetShowEventStatus() const
Definition: TCanvas.h:146
TObject::SetBit
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:696
TDatime::AsSQLString
const char * AsSQLString() const
Return the date & time in SQL compatible string format, like: 1997-01-15 20:16:28.
Definition: TDatime.cxx:152
TStyle::GetPadTickX
Int_t GetPadTickX() const
Definition: TStyle.h:208
TPad::fBorderMode
Short_t fBorderMode
Bordermode (-1=down, 0 = no border, 1=up)
Definition: TPad.h:94
TCanvas::cd
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
Definition: TCanvas.cxx:708
TCanvas::ToggleToolBar
virtual void ToggleToolBar()
Toggle toolbar.
Definition: TCanvas.cxx:2457
TCanvas::fClickSelected
TObject * fClickSelected
! Currently click-selected object
Definition: TCanvas.h:49
TVirtualViewer3D.h
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TCanvas::fWindowWidth
UInt_t fWindowWidth
Width of window (including borders, etc.)
Definition: TCanvas.h:40
kCross
@ kCross
Definition: GuiTypes.h:373
TCanvas::DrawEventStatus
void DrawEventStatus(Int_t event, Int_t x, Int_t y, TObject *selected)
Report name and title of primitive below the cursor.
Definition: TCanvas.cxx:964
TPad::GetY2
Double_t GetY2() const
Definition: TPad.h:237
TCanvas::SetCanvasSize
void SetCanvasSize(UInt_t ww, UInt_t wh)
Set Width and Height of canvas to ww and wh respectively.
Definition: TCanvas.cxx:1995
TPad::GetTickx
Int_t GetTickx() const
Definition: TPad.h:232
Long_t
long Long_t
Definition: RtypesCore.h:54
TStyle::GetTimeOffset
Double_t GetTimeOffset() const
Definition: TStyle.h:260
TPadPainter
Implement TVirtualPadPainter which abstracts painting operations.
Definition: TPadPainter.h:26
TCanvasImp::ShowToolTips
virtual void ShowToolTips(Bool_t show=kTRUE)
Definition: TCanvasImp.h:101
ClassImpQ
#define ClassImpQ(name)
Definition: TQObject.h:282
TObject::Clone
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Definition: TObject.cxx:146
kDefaultCanvasSize
const Size_t kDefaultCanvasSize
Definition: TCanvas.cxx:63
TPad::GetY1
Double_t GetY1() const
Definition: TPad.h:236
TCanvas::Show
void Show()
Show canvas.
Definition: TCanvas.cxx:2240
gGuiFactory
R__EXTERN TGuiFactory * gGuiFactory
Definition: TGuiFactory.h:66
TCanvas::~TCanvas
virtual ~TCanvas()
Canvas destructor.
Definition: TCanvas.cxx:666
TCanvas::fSelectedX
Int_t fSelectedX
! X of selected object
Definition: TCanvas.h:50
gApplication
R__EXTERN TApplication * gApplication
Definition: TApplication.h:166
StrDup
char * StrDup(const char *str)
Duplicate the string str.
Definition: TString.cxx:2490
TPad::SetPad
virtual void SetPad(const char *name, const char *title, Double_t xlow, Double_t ylow, Double_t xup, Double_t yup, Color_t color=35, Short_t bordersize=5, Short_t bordermode=-1)
Set all pad parameters.
Definition: TPad.cxx:6014
gGLManager
#define gGLManager
Definition: TVirtualGL.h:162
TPad::SetTickx
virtual void SetTickx(Int_t value=1)
Definition: TPad.h:348
TColor::GetRed
Float_t GetRed() const
Definition: TColor.h:57
gDebug
Int_t gDebug
Definition: TROOT.cxx:590
R__LOCKGUARD
#define R__LOCKGUARD(mutex)
Definition: TVirtualMutex.h:104
TPad::fBorderSize
Short_t fBorderSize
pad bordersize in pixels
Definition: TPad.h:93
TCollection::Browse
void Browse(TBrowser *b)
Browse this collection (called by TBrowser).
Definition: TCollection.cxx:248
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TAxis::GetTimeFormat
virtual const char * GetTimeFormat() const
Definition: TAxis.h:127
TPad::ResizePad
virtual void ResizePad(Option_t *option="")
Compute pad conversion coefficients.
Definition: TPad.cxx:5477
TCanvas::GetWindowWidth
UInt_t GetWindowWidth() const
Definition: TCanvas.h:159
TPad::GetTicky
Int_t GetTicky() const
Definition: TPad.h:233
y
Double_t y[n]
Definition: legend1.C:17
TCanvas::GetWindowHeight
UInt_t GetWindowHeight() const
Definition: TCanvas.h:160
TPad::SetBorderMode
virtual void SetBorderMode(Short_t bordermode)
Definition: TPad.h:317
TPad::GetBorderSize
virtual Short_t GetBorderSize() const
Definition: TPad.h:194
TCanvas::fWindowTopY
Int_t fWindowTopY
Top Y position of window (in pixels)
Definition: TCanvas.h:39
TPad::GetListOfPrimitives
TList * GetListOfPrimitives() const
Definition: TPad.h:239
TCanvas::EmbedInto
void EmbedInto(Int_t winid, Int_t ww, Int_t wh)
Embedded a canvas into a TRootEmbeddedCanvas.
Definition: TCanvas.cxx:1039
gCanvasInit
static TCanvasInit gCanvasInit
Definition: TCanvas.cxx:56
kButton2Motion
@ kButton2Motion
Definition: Buttons.h:20
TCanvasImp::ShowEditor
virtual void ShowEditor(Bool_t show=kTRUE)
Definition: TCanvasImp.h:99
TCanvas::Init
void Init()
Initialize the TCanvas members. Called by all constructors.
Definition: TCanvas.cxx:527
kButton3Down
@ kButton3Down
Definition: Buttons.h:17
TCanvas::ToggleToolTips
virtual void ToggleToolTips()
Toggle tooltip display.
Definition: TCanvas.cxx:2479
TPad::CopyPixmap
virtual void CopyPixmap()
Copy the pixmap of the pad to the canvas.
Definition: TPad.cxx:1056
TStyle::GetPadLeftMargin
Float_t GetPadLeftMargin() const
Definition: TStyle.h:204
TPad::fTitle
TString fTitle
Pad title.
Definition: TPad.h:106
TCanvas::fWindowTopX
Int_t fWindowTopX
Top X position of window (in pixels)
Definition: TCanvas.h:38
TStyle::GetPadGridY
Bool_t GetPadGridY() const
Definition: TStyle.h:207
kRed
@ kRed
Definition: Rtypes.h:66
TStyle::IsReading
Bool_t IsReading() const
Definition: TStyle.h:282
TCanvas::Iconify
void Iconify()
Iconify canvas.
Definition: TCanvas.cxx:1469
TCanvas::SetBatch
void SetBatch(Bool_t batch=kTRUE)
Toggle batch mode.
Definition: TCanvas.cxx:1979
TVirtualMutex.h
TCanvas::ToggleEventStatus
virtual void ToggleEventStatus()
Toggle event statusbar.
Definition: TCanvas.cxx:2446
TObject::Warning
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:876
TCanvasImp::SetStatusText
virtual void SetStatusText(const char *text=0, Int_t partidx=0)
Definition: TCanvasImp.h:89
TCanvas::fXsizeUser
Size_t fXsizeUser
User specified size of canvas along X in CM.
Definition: TCanvas.h:32
TROOT::IncreaseDirLevel
static Int_t IncreaseDirLevel()
Increase the indentation level for ls().
Definition: TROOT.cxx:2798
TPad::PaintBorder
void PaintBorder(Color_t color, Bool_t tops)
Paint the pad border.
Definition: TPad.cxx:3508
void
typedef void((*Func_t)())
TCanvas::Build
void Build()
Build a canvas. Called by all constructors.
Definition: TCanvas.cxx:576
TCanvas::SetName
virtual void SetName(const char *name="")
Set canvas name. In case name is an empty string, a default name is set.
Definition: TCanvas.cxx:2064
TCanvasImp::SetWindowPosition
virtual void SetWindowPosition(Int_t x, Int_t y)
Definition: TCanvasImp.h:90
TPad::PaintModified
virtual void PaintModified()
Traverse pad hierarchy and (re)paint only modified pads.
Definition: TPad.cxx:3663
TROOT::IndentLevel
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Definition: TROOT.cxx:2806
TPad::Paint
virtual void Paint(Option_t *option="")
Paint all primitives in pad.
Definition: TPad.cxx:3446
TCanvas::fCanvasImp
TCanvasImp * fCanvasImp
! Window system specific canvas implementation
Definition: TCanvas.h:56
TCanvasImp::SetCanvasSize
virtual void SetCanvasSize(UInt_t w, UInt_t h)
Definition: TCanvasImp.h:93
unsigned int
TCanvas::kIsGrayscale
@ kIsGrayscale
Definition: TCanvas.h:94
TCanvas::fContextMenu
TContextMenu * fContextMenu
! Context menu pointer
Definition: TCanvas.h:57
TCanvasImp::PerformUpdate
virtual Bool_t PerformUpdate()
Definition: TCanvasImp.h:46
TString::Index
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:639
kArrowKeyPress
@ kArrowKeyPress
Definition: Buttons.h:21
kButton1ShiftMotion
@ kButton1ShiftMotion
Definition: Buttons.h:18
TCanvas::MakeDefCanvas
static TCanvas * MakeDefCanvas()
Static function to build a default canvas.
Definition: TCanvas.cxx:1506
TCanvas::SetDoubleBuffer
virtual void SetDoubleBuffer(Int_t mode=1)
Set Double Buffer On/Off.
Definition: TCanvas.cxx:2017
TAttPad::SetLeftMargin
virtual void SetLeftMargin(Float_t leftmargin)
Set Pad left margin in fraction of the pad width.
Definition: TAttPad.cxx:109
TGuiFactory::CreateCanvasImp
virtual TCanvasImp * CreateCanvasImp(TCanvas *c, const char *title, UInt_t width, UInt_t height)
Create a batch version of TCanvasImp.
Definition: TGuiFactory.cxx:56
TBox
Create a Box.
Definition: TBox.h:22
TCanvasImp::InitWindow
virtual Int_t InitWindow()
Definition: TCanvasImp.h:60
TVirtualPadPainter::PadPainter
static TVirtualPadPainter * PadPainter(Option_t *opt="")
Create a pad painter of specified type.
Definition: TVirtualPadPainter.cxx:58
TCanvas::Picked
virtual void Picked(TPad *selpad, TObject *selected, Int_t event)
Emit Picked() signal.
Definition: TCanvas.cxx:1595
gVirtualPS
R__EXTERN TVirtualPS * gVirtualPS
Definition: TVirtualPS.h:81
TPad::GetHighLightColor
virtual Color_t GetHighLightColor() const
Get highlight color.
Definition: TPad.cxx:2713
TCanvas::SetFixedAspectRatio
virtual void SetFixedAspectRatio(Bool_t fixed=kTRUE)
Fix canvas aspect ratio to current value if fixed is true.
Definition: TCanvas.cxx:2034
TCanvas::fClickSelectedPad
TPad * fClickSelectedPad
! Pad containing currently click-selected object
Definition: TCanvas.h:54
TStyle::GetPadRightMargin
Float_t GetPadRightMargin() const
Definition: TStyle.h:205
kButton1Down
@ kButton1Down
Definition: Buttons.h:17
TStyle::SetCanvasColor
void SetCanvasColor(Color_t color=19)
Definition: TStyle.h:327
TCanvasImp::Show
virtual void Show()
Definition: TCanvasImp.h:66
Double_t
double Double_t
Definition: RtypesCore.h:59
TStyle::SetCanvasBorderMode
void SetCanvasBorderMode(Int_t mode=1)
Definition: TStyle.h:329
TQObject::Connect
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition: TQObject.cxx:866
TGraph
A TGraph is an object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
TApplication::NeedGraphicsLibs
static void NeedGraphicsLibs()
Static method.
Definition: TApplication.cxx:252
TVirtualPad
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:51
TAttPad::SetRightMargin
virtual void SetRightMargin(Float_t rightmargin)
Set Pad right margin in fraction of the pad width.
Definition: TAttPad.cxx:119
TPad::GetLogz
Int_t GetLogz() const
Definition: TPad.h:252
TVirtualGL.h
TCanvas::RaiseWindow
void RaiseWindow()
Raise canvas window.
Definition: TCanvas.cxx:1749
TVirtualPadPainter::InitPainter
virtual void InitPainter()
Empty definition.
Definition: TVirtualPadPainter.cxx:37
TObject::kNotDeleted
@ kNotDeleted
object has not been deleted
Definition: TObject.h:78
TStyle::SetPalette
void SetPalette(Int_t ncolors=kBird, Int_t *colors=0, Float_t alpha=1.)
See TColor::SetPalette.
Definition: TStyle.cxx:1782
TObjArray.h
TCanvas
The Canvas class.
Definition: TCanvas.h:23
TAttPad::Copy
virtual void Copy(TAttPad &attpad) const
copy function
Definition: TAttPad.cxx:44
TList::Remove
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:822
ROOT_TCanvas_Update
void ROOT_TCanvas_Update(void *TheCanvas)
Definition: TCanvas.cxx:2497
TInterpreter.h
TClass
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
TStyle::GetCanvasBorderSize
Width_t GetCanvasBorderSize() const
Definition: TStyle.h:181
TPad::cd
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
Definition: TPad.cxx:603
TCanvas::Resize
virtual void Resize(Option_t *option="")
Recompute canvas parameters following a X11 Resize.
Definition: TCanvas.cxx:1670
TCanvas::SetWindowSize
void SetWindowSize(UInt_t ww, UInt_t wh)
Set canvas window size.
Definition: TCanvas.cxx:2201
TCollection::SetName
void SetName(const char *name)
Definition: TCollection.h:204
TAttFill::SetFillColor
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:37
TList::Add
virtual void Add(TObject *obj)
Definition: TList.h:87
TAxis.h
TStyle::GetOptLogz
Int_t GetOptLogz() const
Definition: TStyle.h:240
TCanvas::Paint
virtual void Paint(Option_t *option="")
Paint canvas.
Definition: TCanvas.cxx:1545
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
kButton3Motion
@ kButton3Motion
Definition: Buttons.h:20
TStyle::GetCanvasDefW
Int_t GetCanvasDefW() const
Definition: TStyle.h:184
TPad::Close
virtual void Close(Option_t *option="")
Delete all primitives in pad and pad itself.
Definition: TPad.cxx:998
TH1
TH1 is the base class of all histogramm classes in ROOT.
Definition: TH1.h:58
TStyle::GetOptLogx
Int_t GetOptLogx() const
Definition: TStyle.h:238
TObject::IsOnHeap
R__ALWAYS_INLINE Bool_t IsOnHeap() const
Definition: TObject.h:133
TCanvas::Update
virtual void Update()
Update canvas pad buffers.
Definition: TCanvas.cxx:2504
name
char name[80]
Definition: TGX11.cxx:110
TCanvasImp::SetWindowTitle
virtual void SetWindowTitle(const char *newTitle)
Definition: TCanvasImp.h:92
TCanvas::ForceUpdate
void ForceUpdate()
Force canvas update.
Definition: TCanvas.cxx:1168
TPad::fCanvas
TCanvas * fCanvas
! Pointer to mother canvas
Definition: TPad.h:102
TCanvas::fRetained
Bool_t fRetained
Retain structure flag.
Definition: TCanvas.h:60
TCanvas::Cleared
virtual void Cleared(TVirtualPad *pad)
Emit pad Cleared signal.
Definition: TCanvas.cxx:760
TPad::SetGrid
virtual void SetGrid(Int_t valuex=1, Int_t valuey=1)
Definition: TPad.h:327
TPad::HighLight
void HighLight(Color_t col=kRed, Bool_t set=kTRUE)
Highlight pad.
Definition: TPad.cxx:2959
TApplication::CreateApplication
static void CreateApplication()
TCanvas::fWindowHeight
UInt_t fWindowHeight
Height of window (including menubar, borders, etc.)
Definition: TCanvas.h:41
TStyle::GetPadGridX
Bool_t GetPadGridX() const
Definition: TStyle.h:206
x2
static const double x2[5]
Definition: RooGaussKronrodIntegrator1D.cxx:364
TCanvas::DrawClone
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this canvas A new canvas is created that is a clone of this canvas.
Definition: TCanvas.cxx:892
gPad
#define gPad
Definition: TVirtualPad.h:287
TAttFill::GetFillColor
virtual Color_t GetFillColor() const
Return the fill area color.
Definition: TAttFill.h:30
TIter
Definition: TCollection.h:233
TDatime
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition: TDatime.h:37
TCanvas::GetSelectedPad
TVirtualPad * GetSelectedPad() const
Definition: TCanvas.h:144
kButton2Up
@ kButton2Up
Definition: Buttons.h:19
TClass::IsCallingNew
static ENewType IsCallingNew()
Static method returning the defConstructor flag passed to TClass::New().
Definition: TClass.cxx:5795
kKeyPress
@ kKeyPress
Definition: Buttons.h:20
TCanvas::GetWindowTopX
Int_t GetWindowTopX()
Returns current top x position of window on screen.
Definition: TCanvas.cxx:1201
kMouseEnter
@ kMouseEnter
Definition: Buttons.h:23
TStyle::GetOptStat
Int_t GetOptStat() const
Definition: TStyle.h:236
TAttFill
Fill Area Attributes class.
Definition: TAttFill.h:19
TDatime::Convert
UInt_t Convert(Bool_t toGMT=kFALSE) const
Convert fDatime from TDatime format to the standard time_t format.
Definition: TDatime.cxx:182
TCanvas::SetRealAspectRatio
bool SetRealAspectRatio(const Int_t axis=1)
Function to resize a canvas so that the plot inside is shown in real aspect ratio.
Definition: TCanvas.cxx:2107
TCanvas::kMenuBar
@ kMenuBar
Definition: TCanvas.h:89
TPad::GetLogx
Int_t GetLogx() const
Definition: TPad.h:250
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
kButton2Down
@ kButton2Down
Definition: Buttons.h:17
TVirtualPadPainter
To make it possible to use GL for 2D graphic in a TPad/TCanvas.
Definition: TVirtualPadPainter.h:19
gThreadXAR
R__EXTERN Int_t(* gThreadXAR)(const char *xact, Int_t nb, void **ar, Int_t *iret)
Definition: TVirtualPad.h:289
TCanvas::fUseGL
Bool_t fUseGL
! True when rendering is with GL
Definition: TCanvas.h:61
TPad::GetLogy
Int_t GetLogy() const
Definition: TPad.h:251
TCanvas::IsBatch
Bool_t IsBatch() const
Is pad in batch mode ?
Definition: TCanvas.h:169
TCanvas::TCanvas
TCanvas(const TCanvas &canvas)
TCanvas::SetCursor
virtual void SetCursor(ECursor cursor)
Set cursor.
Definition: TCanvas.cxx:2008
TPad::SetLogx
virtual void SetLogx(Int_t value=1)
Set Lin/Log scale for X.
Definition: TPad.cxx:5929
Class
void Class()
Definition: Class.C:29
TString::ToLower
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1125
TObject::Pop
virtual void Pop()
Pop on object drawn in a pad to the top of the display list.
Definition: TObject.cxx:530
TVirtualX::kCopy
@ kCopy
Definition: TVirtualX.h:49
kArrowKeyRelease
@ kArrowKeyRelease
Definition: Buttons.h:21
TCanvasImp::ShowStatusBar
virtual void ShowStatusBar(Bool_t show=kTRUE)
Definition: TCanvasImp.h:95
TCanvas::DeleteCanvasPainter
void DeleteCanvasPainter()
assert on IsBatch() == false?
Definition: TCanvas.cxx:2617
TCanvas::Flush
void Flush()
Flush canvas buffers.
Definition: TCanvas.cxx:1134
TVirtualPadPainter::SelectDrawable
virtual void SelectDrawable(Int_t device)=0
TCanvas::fHighLightColor
Color_t fHighLightColor
Highlight color of active pad.
Definition: TCanvas.h:36
TClass::kRealNew
@ kRealNew
Definition: TClass.h:107
TColor::GetGreen
Float_t GetGreen() const
Definition: TColor.h:58
TH1.h
TObject::ClassName
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:130
TObject::ExecuteEvent
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to an event at (px,py).
Definition: TObject.cxx:313
TPad::GetTitle
const char * GetTitle() const
Returns title of object.
Definition: TPad.h:255
TGuiFactory.h
TCanvasImp::CreatePadPainter
virtual TVirtualPadPainter * CreatePadPainter()
Definition: TCanvasImp.h:47
TPad::ls
virtual void ls(Option_t *option="") const
List all primitives in pad.
Definition: TPad.cxx:2994
TObject::Clear
virtual void Clear(Option_t *="")
Definition: TObject.h:100
TPad::ExecuteEvent
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TPad.cxx:1714
TCanvas::Browse
virtual void Browse(TBrowser *b)
Browse.
Definition: TCanvas.cxx:674
TCanvas::HighlightConnect
virtual void HighlightConnect(const char *slot)
This is "simplification" for function TCanvas::Connect with Highlighted signal for specific slot.
Definition: TCanvas.cxx:1633
TCanvas::fUpdating
Bool_t fUpdating
! True when Updating the canvas
Definition: TCanvas.h:59
TPad::fMother
TPad * fMother
! pointer to mother of the list
Definition: TPad.h:101
TList
A doubly linked list.
Definition: TList.h:44
TCanvas::fEvent
Int_t fEvent
! Type of current or last handled event
Definition: TCanvas.h:44
TCanvasImp::RaiseWindow
virtual void RaiseWindow()
Definition: TCanvasImp.h:96
TQObject::Emit
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
TArray::GetSize
Int_t GetSize() const
Definition: TArray.h:47
TMath.h
TArrayI
Array of integers (32 bits per element).
Definition: TArrayI.h:27
kButton3Up
@ kButton3Up
Definition: Buttons.h:19
gROOT
#define gROOT
Definition: TROOT.h:406
int
TPad::fPixmapID
Int_t fPixmapID
! Off-screen pixmap identifier
Definition: TPad.h:80
TCanvas::GetWindowTopY
Int_t GetWindowTopY()
Returns current top y position of window on screen.
Definition: TCanvas.cxx:1212
TCanvasImp::ShowMenuBar
virtual void ShowMenuBar(Bool_t show=kTRUE)
Definition: TCanvasImp.h:94
Size_t
float Size_t
Definition: RtypesCore.h:87
TError.h
TCanvas::ToggleEditor
virtual void ToggleEditor()
Toggle editor.
Definition: TCanvas.cxx:2468
TStyle::GetPadBottomMargin
Float_t GetPadBottomMargin() const
Definition: TStyle.h:202
TColor::GetPalette
static const TArrayI & GetPalette()
Static function returning the current active palette.
Definition: TColor.cxx:1402
TColor::GetNumber
Int_t GetNumber() const
Definition: TColor.h:55
TCanvas::fSelectedOpt
TString fSelectedOpt
! Drawing option of selected object
Definition: TCanvas.h:52