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  fCw = ww;
396  fCh = wh;
397  fCanvasID = -1;
398  TCanvas *old = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(name);
399  if (old && old->IsOnHeap()) {
400  Warning("Constructor","Deleting canvas with same name: %s",name);
401  delete old;
402  }
403  if (gROOT->IsBatch()) { //We are in Batch mode
404  fWindowTopX = fWindowTopY = 0;
405  fWindowWidth = ww;
406  fWindowHeight = wh;
407  fCw = ww;
408  fCh = wh;
410  if (!fCanvasImp) return;
411  fBatch = kTRUE;
412  } else {
414  fCanvasImp = gGuiFactory->CreateCanvasImp(this, name, UInt_t(cx*ww), UInt_t(cx*wh));
415  if (!fCanvasImp) return;
416 
417  if (!gROOT->IsBatch() && fCanvasID == -1)
419 
421  fBatch = kFALSE;
422  }
423 
424  CreatePainter();
425 
426  SetName(name);
427  SetTitle(title); // requires fCanvasImp set
428  Build();
429 
430  // Popup canvas
431  fCanvasImp->Show();
432 }
433 
434 ////////////////////////////////////////////////////////////////////////////////
435 /// Create a new canvas.
436 ///
437 /// \param[in] name canvas name
438 /// \param[in] title canvas title
439 /// \param[in] wtopx,wtopy are the pixel coordinates of the top left corner of
440 /// the canvas (if wtopx < 0) the menubar is not shown)
441 /// \param[in] ww is the canvas size in pixels along X
442 /// \param[in] wh is the canvas size in pixels along Y
443 ///
444 /// If "name" starts with "gl" the canvas is ready to receive GL output.
445 
446 TCanvas::TCanvas(const char *name, const char *title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh)
447  : TPad(), fDoubleBuffer(0)
448 {
449  fPainter = 0;
451 
452  Constructor(name, title, wtopx, wtopy, ww, wh);
453 }
454 
455 ////////////////////////////////////////////////////////////////////////////////
456 /// Create a new canvas.
457 ///
458 /// \param[in] name canvas name
459 /// \param[in] title canvas title
460 /// \param[in] wtopx,wtopy are the pixel coordinates of the top left corner of
461 /// the canvas (if wtopx < 0) the menubar is not shown)
462 /// \param[in] ww is the canvas size in pixels along X
463 /// \param[in] wh is the canvas size in pixels along Y
464 
465 void TCanvas::Constructor(const char *name, const char *title, Int_t wtopx,
466  Int_t wtopy, Int_t ww, Int_t wh)
467 {
468  if (gThreadXAR) {
469  void *arr[8];
470  arr[1] = this; arr[2] = (void*)name; arr[3] = (void*)title;
471  arr[4] = &wtopx; arr[5] = &wtopy; arr[6] = &ww; arr[7] = &wh;
472  if ((*gThreadXAR)("CANV", 8, arr, 0)) return;
473  }
474 
475  Init();
476  SetBit(kMenuBar,1);
477  if (wtopx < 0) {
478  wtopx = -wtopx;
479  SetBit(kMenuBar,0);
480  }
481  fCw = ww;
482  fCh = wh;
483  fCanvasID = -1;
484  TCanvas *old = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(name);
485  if (old && old->IsOnHeap()) {
486  Warning("Constructor","Deleting canvas with same name: %s",name);
487  delete old;
488  }
489  if (gROOT->IsBatch()) { //We are in Batch mode
490  fWindowTopX = fWindowTopY = 0;
491  fWindowWidth = ww;
492  fWindowHeight = wh;
493  fCw = ww;
494  fCh = wh;
496  if (!fCanvasImp) return;
497  fBatch = kTRUE;
498  } else { //normal mode with a screen window
500  fCanvasImp = gGuiFactory->CreateCanvasImp(this, name, Int_t(cx*wtopx), Int_t(cx*wtopy), UInt_t(cx*ww), UInt_t(cx*wh));
501  if (!fCanvasImp) return;
502 
503  if (!gROOT->IsBatch() && fCanvasID == -1)
505 
507  fBatch = kFALSE;
508  }
509 
510  CreatePainter();
511 
512  SetName(name);
513  SetTitle(title); // requires fCanvasImp set
514  Build();
515 
516  // Popup canvas
517  fCanvasImp->Show();
518 }
519 
520 ////////////////////////////////////////////////////////////////////////////////
521 /// Initialize the TCanvas members. Called by all constructors.
522 
524 {
525  // Make sure the application environment exists. It is need for graphics
526  // (colors are initialized in the TApplication ctor).
527  if (!gApplication)
529 
530  // Load and initialize graphics libraries if
531  // TApplication::NeedGraphicsLibs() has been called by a
532  // library static initializer.
533  if (gApplication)
535 
536  // Get some default from .rootrc. Used in fCanvasImp->InitWindow().
537  fHighLightColor = gEnv->GetValue("Canvas.HighLightColor", kRed);
538  SetBit(kMoveOpaque, gEnv->GetValue("Canvas.MoveOpaque", 0));
539  SetBit(kResizeOpaque, gEnv->GetValue("Canvas.ResizeOpaque", 0));
540  if (gEnv->GetValue("Canvas.ShowEventStatus", kFALSE)) SetBit(kShowEventStatus);
541  if (gEnv->GetValue("Canvas.ShowToolTips", kFALSE)) SetBit(kShowToolTips);
542  if (gEnv->GetValue("Canvas.ShowToolBar", kFALSE)) SetBit(kShowToolBar);
543  if (gEnv->GetValue("Canvas.ShowEditor", kFALSE)) SetBit(kShowEditor);
544  if (gEnv->GetValue("Canvas.AutoExec", kTRUE)) SetBit(kAutoExec);
545 
546  // Fill canvas ROOT data structure
547  fXsizeUser = 0;
548  fYsizeUser = 0;
551 
552  fDISPLAY = "$DISPLAY";
553  fUpdating = kFALSE;
554  fRetained = kTRUE;
555  fSelected = 0;
556  fClickSelected = 0;
557  fSelectedX = 0;
558  fSelectedY = 0;
559  fSelectedPad = 0;
561  fPadSave = 0;
562  fEvent = -1;
563  fEventX = -1;
564  fEventY = -1;
565  fContextMenu = 0;
566  fDrawn = kFALSE;
567 }
568 
569 ////////////////////////////////////////////////////////////////////////////////
570 /// Build a canvas. Called by all constructors.
571 
573 {
574  // Get window identifier
575  if (fCanvasID == -1 && fCanvasImp)
577  if (fCanvasID == -1) return;
578 
579  if (fCw !=0 && fCh !=0) {
582  }
583 
584  // Set Pad parameters
585  gPad = this;
586  fCanvas = this;
587  fMother = (TPad*)gPad;
588 
589  if (IsBatch()) {
590  // Make sure that batch interactive canvas sizes are the same
591  fCw -= 4;
592  fCh -= 28;
593  } else if (IsWeb()) {
594  // mark canvas as batch - avoid virtualx in many places
595  SetBatch(kTRUE);
596  } else {
597  //normal mode with a screen window
598  // Set default physical canvas attributes
599  //Should be done via gVirtualX, not via fPainter (at least now). No changes here.
600  gVirtualX->SelectWindow(fCanvasID);
601  gVirtualX->SetFillColor(1); //Set color index for fill area
602  gVirtualX->SetLineColor(1); //Set color index for lines
603  gVirtualX->SetMarkerColor(1); //Set color index for markers
604  gVirtualX->SetTextColor(1); //Set color index for text
605  // Clear workstation
606  gVirtualX->ClearWindow();
607 
608  // Set Double Buffer on by default
609  SetDoubleBuffer(1);
610 
611  // Get effective window parameters (with borders and menubar)
614 
615  // Get effective canvas parameters without borders
616  Int_t dum1, dum2;
617  gVirtualX->GetGeometry(fCanvasID, dum1, dum2, fCw, fCh);
618 
619  fContextMenu = new TContextMenu("ContextMenu");
620  }
621 
622  gROOT->GetListOfCanvases()->Add(this);
623 
624  if (!fPrimitives) {
625  fPrimitives = new TList;
627  SetFillStyle(1001);
639  fBorderMode=gStyle->GetCanvasBorderMode(); // do not call SetBorderMode (function redefined in TCanvas)
640  SetPad(0, 0, 1, 1);
641  Range(0, 0, 1, 1); //pad range is set by default to [0,1] in x and y
642 
644  if (vpp) vpp->SelectDrawable(fPixmapID);//gVirtualX->SelectPixmap(fPixmapID); //pixmap must be selected
645  PaintBorder(GetFillColor(), kTRUE); //paint background
646  }
647 
648  // transient canvases have typically no menubar and should not get
649  // by default the event status bar (if set by default)
650  if (TestBit(kMenuBar) && fCanvasImp) {
652  // ... and toolbar + editor
656  }
657 }
658 
659 ////////////////////////////////////////////////////////////////////////////////
660 /// Canvas destructor
661 
663 {
664  Destructor();
665 }
666 
667 ////////////////////////////////////////////////////////////////////////////////
668 /// Browse.
669 
671 {
672  Draw();
673  cd();
675 }
676 
677 ////////////////////////////////////////////////////////////////////////////////
678 /// Actual canvas destructor.
679 
681 {
682  if (gThreadXAR) {
683  void *arr[2];
684  arr[1] = this;
685  if ((*gThreadXAR)("CDEL", 2, arr, 0)) return;
686  }
687 
688  if (!TestBit(kNotDeleted)) return;
689 
690  if (fContextMenu) { delete fContextMenu; fContextMenu = 0; }
691  if (!gPad) return;
692 
693  Close();
694 
695  //If not yet (batch mode?).
696  delete fPainter;
697 }
698 
699 ////////////////////////////////////////////////////////////////////////////////
700 /// Set current canvas & pad. Returns the new current pad,
701 /// or 0 in case of failure.
702 /// See TPad::cd() for an explanation of the parameter.
703 
705 {
706  if (fCanvasID == -1) return 0;
707 
708  TPad::cd(subpadnumber);
709 
710  // in case doublebuffer is off, draw directly onto display window
711  if (!IsBatch()) {
712  if (!fDoubleBuffer)
713  gVirtualX->SelectWindow(fCanvasID);//Ok, does not matter for glpad.
714  }
715  return gPad;
716 }
717 
718 ////////////////////////////////////////////////////////////////////////////////
719 /// Remove all primitives from the canvas.
720 /// If option "D" is specified, direct sub-pads are cleared but not deleted.
721 /// This option is not recursive, i.e. pads in direct sub-pads are deleted.
722 
724 {
725  if (fCanvasID == -1) return;
726 
728 
729  TString opt = option;
730  opt.ToLower();
731  if (opt.Contains("d")) {
732  // clear subpads, but do not delete pads in case the canvas
733  // has been divided (note: option "D" is propagated so could cause
734  // conflicts for primitives using option "D" for something else)
735  if (fPrimitives) {
736  TIter next(fPrimitives);
737  TObject *obj;
738  while ((obj=next())) {
739  obj->Clear(option);
740  }
741  }
742  } else {
743  //default, clear everything in the canvas. Subpads are deleted
744  TPad::Clear(option); //Remove primitives from pad
745  }
746 
747  fSelected = 0;
748  fClickSelected = 0;
749  fSelectedPad = 0;
750  fClickSelectedPad = 0;
751 }
752 
753 ////////////////////////////////////////////////////////////////////////////////
754 /// Emit pad Cleared signal.
755 
757 {
758  Emit("Cleared(TVirtualPad*)", (Long_t)pad);
759 }
760 
761 ////////////////////////////////////////////////////////////////////////////////
762 /// Emit Closed signal.
763 
765 {
766  Emit("Closed()");
767 }
768 
769 ////////////////////////////////////////////////////////////////////////////////
770 /// Close canvas.
771 ///
772 /// Delete window/pads data structure
773 
775 {
776  TPad *padsave = (TPad*)gPad;
777  TCanvas *cansave = 0;
778  if (padsave) cansave = (TCanvas*)gPad->GetCanvas();
779 
780  if (fCanvasID != -1) {
781 
782  if ((!gROOT->IsLineProcessing()) && (!gVirtualX->IsCmdThread())) {
783  gInterpreter->Execute(this, IsA(), "Close", option);
784  return;
785  }
786 
788 
790 
791  cd();
792  TPad::Close(option);
793 
794  if (!IsBatch()) {
795  gVirtualX->SelectWindow(fCanvasID); //select current canvas
796 
798 
799  if (fCanvasImp)
800  fCanvasImp->Close();
801  }
802  fCanvasID = -1;
803  fBatch = kTRUE;
804 
805  gROOT->GetListOfCanvases()->Remove(this);
806 
807  // Close actual window on screen
809  }
810 
811  if (cansave == this) {
812  gPad = (TCanvas *) gROOT->GetListOfCanvases()->First();
813  } else {
814  gPad = padsave;
815  }
816 
817  Closed();
818 }
819 
820 ////////////////////////////////////////////////////////////////////////////////
821 /// Copy the canvas pixmap of the pad to the canvas.
822 
824 {
825  if (!IsBatch()) {
826  CopyPixmap();
828  }
829 }
830 
831 ////////////////////////////////////////////////////////////////////////////////
832 /// Draw a canvas.
833 /// If a canvas with the name is already on the screen, the canvas is repainted.
834 /// This function is useful when a canvas object has been saved in a Root file.
835 /// One can then do:
836 /// ~~~ {.cpp}
837 /// Root > Tfile f("file.root");
838 /// Root > canvas.Draw();
839 /// ~~~
840 
842 {
843  // Load and initialize graphics libraries if
844  // TApplication::NeedGraphicsLibs() has been called by a
845  // library static initializer.
846  if (gApplication)
848 
849  fDrawn = kTRUE;
850 
851  TCanvas *old = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(GetName());
852  if (old == this) {
853  Paint();
854  return;
855  }
856  if (old) { gROOT->GetListOfCanvases()->Remove(old); delete old;}
857 
858  if (fWindowWidth == 0) {
859  if (fCw !=0) fWindowWidth = fCw+4;
860  else fWindowWidth = 800;
861  }
862  if (fWindowHeight == 0) {
863  if (fCh !=0) fWindowHeight = fCh+28;
864  else fWindowHeight = 600;
865  }
866  if (gROOT->IsBatch()) { //We are in Batch mode
868  if (!fCanvasImp) return;
869  fBatch = kTRUE;
870 
871  } else { //normal mode with a screen window
874  if (!fCanvasImp) return;
876  }
877  Build();
878  ResizePad();
880  fCanvasImp->Show();
881  Modified();
882 }
883 
884 ////////////////////////////////////////////////////////////////////////////////
885 /// Draw a clone of this canvas
886 /// A new canvas is created that is a clone of this canvas
887 
889 {
890  TCanvas *newCanvas = (TCanvas*)Clone();
891  newCanvas->SetName();
892 
893  newCanvas->Draw(option);
894  newCanvas->Update();
895  return newCanvas;
896 }
897 
898 ////////////////////////////////////////////////////////////////////////////////
899 /// Draw a clone of this canvas into the current pad
900 /// In an interactive session, select the destination/current pad
901 /// with the middle mouse button, then point to the canvas area to select
902 /// the canvas context menu item DrawClonePad.
903 /// Note that the original canvas may have subpads.
904 
906 {
907  TPad *padsav = (TPad*)gPad;
908  TPad *selpad = (TPad*)gROOT->GetSelectedPad();
909  TPad *pad = padsav;
910  if (pad == this) pad = selpad;
911  if (padsav == 0 || pad == 0 || pad == this) {
912  TCanvas *newCanvas = (TCanvas*)DrawClone();
914  return newCanvas;
915  }
916  if (fCanvasID == -1) {
919  if (!fCanvasImp) return 0;
922  }
923  this->cd();
924  TObject *obj, *clone;
925  //copy pad attributes
926  pad->Range(fX1,fY1,fX2,fY2);
927  pad->SetTickx(GetTickx());
928  pad->SetTicky(GetTicky());
929  pad->SetGridx(GetGridx());
930  pad->SetGridy(GetGridy());
931  pad->SetLogx(GetLogx());
932  pad->SetLogy(GetLogy());
933  pad->SetLogz(GetLogz());
936  TAttLine::Copy((TAttLine&)*pad);
937  TAttFill::Copy((TAttFill&)*pad);
938  TAttPad::Copy((TAttPad&)*pad);
939 
940  //copy primitives
941  TIter next(GetListOfPrimitives());
942  while ((obj=next())) {
943  pad->cd();
944  clone = obj->Clone();
945  pad->GetListOfPrimitives()->Add(clone,next.GetOption());
946  }
947  pad->ResizePad();
948  pad->Modified();
949  pad->Update();
950  if (padsav) padsav->cd();
951  return 0;
952 }
953 
954 ////////////////////////////////////////////////////////////////////////////////
955 /// Report name and title of primitive below the cursor.
956 ///
957 /// This function is called when the option "Event Status"
958 /// in the canvas menu "Options" is selected.
959 
960 void TCanvas::DrawEventStatus(Int_t event, Int_t px, Int_t py, TObject *selected)
961 {
962  const Int_t kTMAX=256;
963  static char atext[kTMAX];
964 
965  if (!TestBit(kShowEventStatus) || !selected) return;
966 
967  if (!fCanvasImp) return; //this may happen when closing a TAttCanvas
968 
969  TVirtualPad* savepad;
970  savepad = gPad;
971  gPad = GetSelectedPad();
972 
973  fCanvasImp->SetStatusText(selected->GetTitle(),0);
974  fCanvasImp->SetStatusText(selected->GetName(),1);
975  if (event == kKeyPress)
976  snprintf(atext, kTMAX, "%c", (char) px);
977  else
978  snprintf(atext, kTMAX, "%d,%d", px, py);
979  fCanvasImp->SetStatusText(atext,2);
980 
981  // Show date/time if TimeDisplay is selected
982  TAxis *xaxis = NULL;
983  if ( selected->InheritsFrom("TH1") )
984  xaxis = ((TH1*)selected)->GetXaxis();
985  else if ( selected->InheritsFrom("TGraph") )
986  xaxis = ((TGraph*)selected)->GetXaxis();
987  else if ( selected->InheritsFrom("TAxis") )
988  xaxis = (TAxis*)selected;
989  if ( xaxis != NULL && xaxis->GetTimeDisplay()) {
990  TString objinfo = selected->GetObjectInfo(px,py);
991  // check if user has overwritten GetObjectInfo and altered
992  // the default text from TObject::GetObjectInfo "x=.. y=.."
993  if (objinfo.Contains("x=") && objinfo.Contains("y=") ) {
994  UInt_t toff = 0;
995  TString time_format(xaxis->GetTimeFormat());
996  // TimeFormat may contain offset: %F2000-01-01 00:00:00
997  Int_t idF = time_format.Index("%F");
998  if (idF>=0) {
999  Int_t lnF = time_format.Length();
1000  // minimal check for correct format
1001  if (lnF - idF == 21) {
1002  time_format = time_format(idF+2, lnF);
1003  TDatime dtoff(time_format);
1004  toff = dtoff.Convert();
1005  }
1006  } else {
1007  toff = (UInt_t)gStyle->GetTimeOffset();
1008  }
1009  TDatime dt((UInt_t)gPad->AbsPixeltoX(px) + toff);
1010  snprintf(atext, kTMAX, "%s, y=%g",
1011  dt.AsSQLString(),gPad->AbsPixeltoY(py));
1012  fCanvasImp->SetStatusText(atext,3);
1013  gPad = savepad;
1014  return;
1015  }
1016  }
1017  // default
1018  fCanvasImp->SetStatusText(selected->GetObjectInfo(px,py),3);
1019 
1020  gPad = savepad;
1021 }
1022 
1023 ////////////////////////////////////////////////////////////////////////////////
1024 /// Get editor bar.
1025 
1027 {
1029 }
1030 
1031 ////////////////////////////////////////////////////////////////////////////////
1032 /// Embedded a canvas into a TRootEmbeddedCanvas. This method is only called
1033 /// via TRootEmbeddedCanvas::AdoptCanvas.
1034 
1036 {
1037  // If fCanvasImp already exists, no need to go further.
1038  if(fCanvasImp) return;
1039 
1040  fCanvasID = winid;
1041  fWindowTopX = 0;
1042  fWindowTopY = 0;
1043  fWindowWidth = ww;
1044  fWindowHeight = wh;
1045  fCw = ww;
1046  fCh = wh;
1047  fBatch = kFALSE;
1048  fUpdating = kFALSE;
1049 
1051  if (!fCanvasImp) return;
1052  Build();
1053  Resize();
1054 }
1055 
1056 ////////////////////////////////////////////////////////////////////////////////
1057 /// Generate kMouseEnter and kMouseLeave events depending on the previously
1058 /// selected object and the currently selected object. Does nothing if the
1059 /// selected object does not change.
1060 
1061 void TCanvas::EnterLeave(TPad *prevSelPad, TObject *prevSelObj)
1062 {
1063  if (prevSelObj == fSelected) return;
1064 
1065  TPad *padsav = (TPad *)gPad;
1066  Int_t sevent = fEvent;
1067 
1068  if (prevSelObj) {
1069  gPad = prevSelPad;
1070  prevSelObj->ExecuteEvent(kMouseLeave, fEventX, fEventY);
1071  fEvent = kMouseLeave;
1072  RunAutoExec();
1073  ProcessedEvent(kMouseLeave, fEventX, fEventY, prevSelObj); // emit signal
1074  }
1075 
1076  gPad = fSelectedPad;
1077 
1078  if (fSelected) {
1080  fEvent = kMouseEnter;
1081  RunAutoExec();
1082  ProcessedEvent(kMouseEnter, fEventX, fEventY, fSelected); // emit signal
1083  }
1084 
1085  fEvent = sevent;
1086  gPad = padsav;
1087 }
1088 
1089 ////////////////////////////////////////////////////////////////////////////////
1090 /// Execute action corresponding to one event.
1091 ///
1092 /// This member function must be implemented to realize the action
1093 /// corresponding to the mouse click on the object in the canvas
1094 ///
1095 /// Only handle mouse motion events in TCanvas, all other events are
1096 /// ignored for the time being
1097 
1099 {
1100  if (gROOT->GetEditorMode()) {
1101  TPad::ExecuteEvent(event,px,py);
1102  return;
1103  }
1104 
1105  switch (event) {
1106 
1107  case kMouseMotion:
1108  SetCursor(kCross);
1109  break;
1110  }
1111 }
1112 
1113 ////////////////////////////////////////////////////////////////////////////////
1114 /// Turn rubberband feedback mode on or off.
1115 
1117 {
1118  if (set) {
1119  SetDoubleBuffer(0); // turn off double buffer mode
1120  gVirtualX->SetDrawMode(TVirtualX::kInvert); // set the drawing mode to XOR mode
1121  } else {
1122  SetDoubleBuffer(1); // turn on double buffer mode
1123  gVirtualX->SetDrawMode(TVirtualX::kCopy); // set drawing mode back to normal (copy) mode
1124  }
1125 }
1126 
1127 ////////////////////////////////////////////////////////////////////////////////
1128 /// Flush canvas buffers.
1129 
1131 {
1132  if ((fCanvasID == -1) || IsWeb()) return;
1133 
1134  TPad *padsav = (TPad*)gPad;
1135  cd();
1136  if (!IsBatch()) {
1137  if (!UseGL()) {
1138  gVirtualX->SelectWindow(fCanvasID);
1139  gPad = padsav; //don't do cd() because than also the pixmap is changed
1140  CopyPixmaps();
1141  gVirtualX->UpdateWindow(1);
1142  } else {
1143  TVirtualPS *tvps = gVirtualPS;
1144  gVirtualPS = 0;
1145  gGLManager->MakeCurrent(fGLDevice);
1146  fPainter->InitPainter();
1147  Paint();
1148  if (padsav && padsav->GetCanvas() == this) {
1149  padsav->cd();
1150  padsav->HighLight(padsav->GetHighLightColor());
1151  //cd();
1152  }
1153  fPainter->LockPainter();
1154  gGLManager->Flush(fGLDevice);
1155  gVirtualPS = tvps;
1156  }
1157  }
1158  if (padsav) padsav->cd();
1159 }
1160 
1161 ////////////////////////////////////////////////////////////////////////////////
1162 /// Force canvas update
1163 
1165 {
1167 }
1168 
1169 ////////////////////////////////////////////////////////////////////////////////
1170 /// Force a copy of current style for all objects in canvas.
1171 
1173 {
1174  if ((!gROOT->IsLineProcessing()) && (!gVirtualX->IsCmdThread())) {
1175  gInterpreter->Execute(this, IsA(), "UseCurrentStyle", "");
1176  return;
1177  }
1178 
1180 
1182 
1183  if (gStyle->IsReading()) {
1187  } else {
1188  gStyle->SetCanvasColor(GetFillColor());
1191  }
1192 }
1193 
1194 ////////////////////////////////////////////////////////////////////////////////
1195 /// Returns current top x position of window on screen.
1196 
1198 {
1201 
1202  return fWindowTopX;
1203 }
1204 
1205 ////////////////////////////////////////////////////////////////////////////////
1206 /// Returns current top y position of window on screen.
1207 
1209 {
1212 
1213  return fWindowTopY;
1214 }
1215 
1216 ////////////////////////////////////////////////////////////////////////////////
1217 /// Handle Input Events.
1218 ///
1219 /// Handle input events, like button up/down in current canvas.
1220 
1222 {
1223  TPad *pad;
1224  TPad *prevSelPad = (TPad*) fSelectedPad;
1225  TObject *prevSelObj = fSelected;
1226 
1227  fPadSave = (TPad*)gPad;
1228  cd(); // make sure this canvas is the current canvas
1229 
1230  fEvent = event;
1231  fEventX = px;
1232  fEventY = py;
1233 
1234  switch (event) {
1235 
1236  case kMouseMotion:
1237  // highlight object tracked over
1238  pad = Pick(px, py, prevSelObj);
1239  if (!pad) return;
1240 
1241  EnterLeave(prevSelPad, prevSelObj);
1242 
1243  gPad = pad; // don't use cd() we will use the current
1244  // canvas via the GetCanvas member and not via
1245  // gPad->GetCanvas
1246 
1247  if (fSelected) {
1248  fSelected->ExecuteEvent(event, px, py);
1249  RunAutoExec();
1250  }
1251 
1252  break;
1253 
1254  case kMouseEnter:
1255  // mouse enters canvas
1257  break;
1258 
1259  case kMouseLeave:
1260  // mouse leaves canvas
1261  {
1262  // force popdown of tooltips
1263  TObject *sobj = fSelected;
1264  TPad *spad = fSelectedPad;
1265  fSelected = 0;
1266  fSelectedPad = 0;
1267  EnterLeave(prevSelPad, prevSelObj);
1268  fSelected = sobj;
1269  fSelectedPad = spad;
1271  }
1272  break;
1273 
1274  case kButton1Double:
1275  // triggered on the second button down within 350ms and within
1276  // 3x3 pixels of the first button down, button up finishes action
1277 
1278  case kButton1Down:
1279  // find pad in which input occurred
1280  pad = Pick(px, py, prevSelObj);
1281  if (!pad) return;
1282 
1283  gPad = pad; // don't use cd() because we won't draw in pad
1284  // we will only use its coordinate system
1285 
1286  if (fSelected) {
1287  FeedbackMode(kTRUE); // to draw in rubberband mode
1288  fSelected->ExecuteEvent(event, px, py);
1289 
1290  RunAutoExec();
1291  }
1292 
1293  break;
1294 
1295  case kArrowKeyPress:
1296  case kArrowKeyRelease:
1297  case kButton1Motion:
1298  case kButton1ShiftMotion: //8 == kButton1Motion + shift modifier
1299  if (fSelected) {
1300  gPad = fSelectedPad;
1301 
1302  fSelected->ExecuteEvent(event, px, py);
1303  gVirtualX->Update();
1305  Bool_t resize = kFALSE;
1307  resize = ((TBox*)fSelected)->IsBeingResized();
1309  resize = ((TVirtualPad*)fSelected)->IsBeingResized();
1310 
1311  if ((!resize && TestBit(kMoveOpaque)) || (resize && TestBit(kResizeOpaque))) {
1312  gPad = fPadSave;
1313  Update();
1315  }
1316  }
1317 
1318  RunAutoExec();
1319  }
1320 
1321  break;
1322 
1323  case kButton1Up:
1324 
1325  if (fSelected) {
1326  gPad = fSelectedPad;
1327 
1328  fSelected->ExecuteEvent(event, px, py);
1329 
1330  RunAutoExec();
1331 
1332  if (fPadSave)
1333  gPad = fPadSave;
1334  else {
1335  gPad = this;
1336  fPadSave = this;
1337  }
1338 
1339  Update(); // before calling update make sure gPad is reset
1340  }
1341  break;
1342 
1343 //*-*----------------------------------------------------------------------
1344 
1345  case kButton2Down:
1346  // find pad in which input occurred
1347  pad = Pick(px, py, prevSelObj);
1348  if (!pad) return;
1349 
1350  gPad = pad; // don't use cd() because we won't draw in pad
1351  // we will only use its coordinate system
1352 
1354 
1355  if (fSelected) fSelected->Pop(); // pop object to foreground
1356  pad->cd(); // and make its pad the current pad
1357  if (gDebug)
1358  printf("Current Pad: %s / %s\n", pad->GetName(), pad->GetTitle());
1359 
1360  // loop over all canvases to make sure that only one pad is highlighted
1361  {
1362  TIter next(gROOT->GetListOfCanvases());
1363  TCanvas *tc;
1364  while ((tc = (TCanvas *)next()))
1365  tc->Update();
1366  }
1367 
1368  //if (pad->GetGLDevice() != -1 && fSelected)
1369  // fSelected->ExecuteEvent(event, px, py);
1370 
1371  break; // don't want fPadSave->cd() to be executed at the end
1372 
1373  case kButton2Motion:
1374  //was empty!
1375  case kButton2Up:
1376  if (fSelected) {
1377  gPad = fSelectedPad;
1378 
1379  fSelected->ExecuteEvent(event, px, py);
1380  RunAutoExec();
1381  }
1382  break;
1383 
1384  case kButton2Double:
1385  break;
1386 
1387 //*-*----------------------------------------------------------------------
1388 
1389  case kButton3Down:
1390  // popup context menu
1391  pad = Pick(px, py, prevSelObj);
1392  if (!pad) return;
1393 
1395 
1398  fContextMenu->Popup(px, py, fSelected, this, pad);
1399 
1400  break;
1401 
1402  case kButton3Motion:
1403  break;
1404 
1405  case kButton3Up:
1407  break;
1408 
1409  case kButton3Double:
1410  break;
1411 
1412  case kKeyPress:
1413  if (!fSelectedPad || !fSelected) return;
1414  gPad = fSelectedPad; // don't use cd() because we won't draw in pad
1415  // we will only use its coordinate system
1416  fSelected->ExecuteEvent(event, px, py);
1417 
1418  RunAutoExec();
1419 
1420  break;
1421 
1422  case kButton1Shift:
1423  // Try to select
1424  pad = Pick(px, py, prevSelObj);
1425 
1426  if (!pad) return;
1427 
1428  EnterLeave(prevSelPad, prevSelObj);
1429 
1430  gPad = pad; // don't use cd() we will use the current
1431  // canvas via the GetCanvas member and not via
1432  // gPad->GetCanvas
1433  if (fSelected) {
1434  fSelected->ExecuteEvent(event, px, py);
1435  RunAutoExec();
1436  }
1437  break;
1438 
1439  case kWheelUp:
1440  case kWheelDown:
1441  pad = Pick(px, py, prevSelObj);
1442  if (!pad) return;
1443 
1444  gPad = pad;
1445  if (fSelected)
1446  fSelected->ExecuteEvent(event, px, py);
1447  break;
1448 
1449  default:
1450  break;
1451  }
1452 
1453  if (fPadSave && event != kButton2Down)
1454  fPadSave->cd();
1455 
1456  if (event != kMouseLeave) { // signal was already emitted for this event
1457  ProcessedEvent(event, px, py, fSelected); // emit signal
1458  DrawEventStatus(event, px, py, fSelected);
1459  }
1460 }
1461 
1462 ////////////////////////////////////////////////////////////////////////////////
1463 /// Iconify canvas
1464 
1466 {
1467  if (fCanvasImp)
1468  fCanvasImp->Iconify();
1469 }
1470 
1471 ////////////////////////////////////////////////////////////////////////////////
1472 /// Is folder ?
1473 
1475 {
1476  return fgIsFolder;
1477 }
1478 
1479 ////////////////////////////////////////////////////////////////////////////////
1480 /// Is web canvas
1481 
1483 {
1484  return fCanvasImp ? fCanvasImp->IsWeb() : kFALSE;
1485 }
1486 
1487 ////////////////////////////////////////////////////////////////////////////////
1488 /// List all pads.
1489 
1490 void TCanvas::ls(Option_t *option) const
1491 {
1493  std::cout <<"Canvas Name=" <<GetName()<<" Title="<<GetTitle()<<" Option="<<option<<std::endl;
1495  TPad::ls(option);
1497 }
1498 
1499 ////////////////////////////////////////////////////////////////////////////////
1500 /// Static function to build a default canvas.
1501 
1503 {
1504  const char *defcanvas = gROOT->GetDefCanvasName();
1505  char *cdef;
1506 
1507  auto lc = (TList*)gROOT->GetListOfCanvases();
1508  if (lc->FindObject(defcanvas)) {
1509  Int_t n = lc->GetSize() + 1;
1510  cdef = new char[strlen(defcanvas)+15];
1511  do {
1512  strlcpy(cdef,Form("%s_n%d", defcanvas, n++),strlen(defcanvas)+15);
1513  } while (lc->FindObject(cdef));
1514  } else
1515  cdef = StrDup(Form("%s",defcanvas));
1516 
1517  TCanvas *c = new TCanvas(cdef, cdef, 1);
1518 
1519  ::Info("TCanvas::MakeDefCanvas"," created default TCanvas with name %s",cdef);
1520  delete [] cdef;
1521  return c;
1522 }
1523 
1524 ////////////////////////////////////////////////////////////////////////////////
1525 /// Set option to move objects/pads in a canvas.
1526 ///
1527 /// - set = 1 (default) graphics objects are moved in opaque mode
1528 /// - set = 0 only the outline of objects is drawn when moving them
1529 ///
1530 /// The option opaque produces the best effect. It requires however a
1531 /// a reasonably fast workstation or response time.
1532 
1534 {
1535  SetBit(kMoveOpaque,set);
1536 }
1537 
1538 ////////////////////////////////////////////////////////////////////////////////
1539 /// Paint canvas.
1540 
1542 {
1543  if (fCanvas)
1544  TPad::Paint(option);
1545 }
1546 
1547 ////////////////////////////////////////////////////////////////////////////////
1548 /// Prepare for pick, call TPad::Pick() and when selected object
1549 /// is different from previous then emit Picked() signal.
1550 
1551 TPad *TCanvas::Pick(Int_t px, Int_t py, TObject *prevSelObj)
1552 {
1553  TObjLink *pickobj = 0;
1554 
1555  fSelected = 0;
1556  fSelectedOpt = "";
1557  fSelectedPad = 0;
1558 
1559  TPad *pad = Pick(px, py, pickobj);
1560  if (!pad) return 0;
1561 
1562  if (!pickobj) {
1563  fSelected = pad;
1564  fSelectedOpt = "";
1565  } else {
1566  if (!fSelected) { // can be set via TCanvas::SetSelected()
1567  fSelected = pickobj->GetObject();
1568  fSelectedOpt = pickobj->GetOption();
1569  }
1570  }
1571  fSelectedPad = pad;
1572 
1573  if (fSelected != prevSelObj)
1574  Picked(fSelectedPad, fSelected, fEvent); // emit signal
1575 
1576  if ((fEvent == kButton1Down) || (fEvent == kButton2Down) || (fEvent == kButton3Down)) {
1580  Selected(fSelectedPad, fSelected, fEvent); // emit signal
1581  fSelectedX = px;
1582  fSelectedY = py;
1583  }
1584  }
1585  return pad;
1586 }
1587 
1588 ////////////////////////////////////////////////////////////////////////////////
1589 /// Emit Picked() signal.
1590 
1591 void TCanvas::Picked(TPad *pad, TObject *obj, Int_t event)
1592 {
1593  Long_t args[3];
1594 
1595  args[0] = (Long_t) pad;
1596  args[1] = (Long_t) obj;
1597  args[2] = event;
1598 
1599  Emit("Picked(TPad*,TObject*,Int_t)", args);
1600 }
1601 
1602 ////////////////////////////////////////////////////////////////////////////////
1603 /// Emit Highlighted() signal.
1604 ///
1605 /// - pad is pointer to pad with highlighted histogram or graph
1606 /// - obj is pointer to highlighted histogram or graph
1607 /// - x is highlighted x bin for 1D histogram or highlighted x-th point for graph
1608 /// - y is highlighted y bin for 2D histogram (for 1D histogram or graph not in use)
1609 
1611 {
1612  Long_t args[4];
1613 
1614  args[0] = (Long_t) pad;
1615  args[1] = (Long_t) obj;
1616  args[2] = x;
1617  args[3] = y;
1618 
1619  Emit("Highlighted(TVirtualPad*,TObject*,Int_t,Int_t)", args);
1620 }
1621 
1622 ////////////////////////////////////////////////////////////////////////////////
1623 /// This is "simplification" for function TCanvas::Connect with Highlighted
1624 /// signal for specific slot.
1625 ///
1626 /// Slot has to be defined "UserFunction(TVirtualPad *pad, TObject *obj, Int_t x, Int_t y)"
1627 /// all parameters of UserFunction are taken from TCanvas::Highlighted
1628 
1629 void TCanvas::HighlightConnect(const char *slot)
1630 {
1631  Connect("Highlighted(TVirtualPad*,TObject*,Int_t,Int_t)", 0, 0, slot);
1632 }
1633 
1634 ////////////////////////////////////////////////////////////////////////////////
1635 /// Emit Selected() signal.
1636 
1638 {
1639  Long_t args[3];
1640 
1641  args[0] = (Long_t) pad;
1642  args[1] = (Long_t) obj;
1643  args[2] = event;
1644 
1645  Emit("Selected(TVirtualPad*,TObject*,Int_t)", args);
1646 }
1647 
1648 ////////////////////////////////////////////////////////////////////////////////
1649 /// Emit ProcessedEvent() signal.
1650 
1652 {
1653  Long_t args[4];
1654 
1655  args[0] = event;
1656  args[1] = x;
1657  args[2] = y;
1658  args[3] = (Long_t) obj;
1659 
1660  Emit("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)", args);
1661 }
1662 
1663 ////////////////////////////////////////////////////////////////////////////////
1664 /// Recompute canvas parameters following a X11 Resize.
1665 
1667 {
1668  if (fCanvasID == -1) return;
1669 
1670  if ((!gROOT->IsLineProcessing()) && (!gVirtualX->IsCmdThread())) {
1671  gInterpreter->Execute(this, IsA(), "Resize", "");
1672  return;
1673  }
1674 
1676 
1677  TPad *padsav = (TPad*)gPad;
1678  cd();
1679 
1680  if (!IsBatch()) {
1681  gVirtualX->SelectWindow(fCanvasID); //select current canvas
1682  gVirtualX->ResizeWindow(fCanvasID); //resize canvas and off-screen buffer
1683 
1684  // Get effective window parameters including menubar and borders
1687 
1688  // Get effective canvas parameters without borders
1689  Int_t dum1, dum2;
1690  gVirtualX->GetGeometry(fCanvasID, dum1, dum2, fCw, fCh);
1691  }
1692 
1693  if (fXsizeUser && fYsizeUser) {
1694  UInt_t nwh = fCh;
1695  UInt_t nww = fCw;
1697  if (rxy < 1) {
1698  UInt_t twh = UInt_t(Double_t(fCw)/rxy);
1699  if (twh > fCh)
1700  nww = UInt_t(Double_t(fCh)*rxy);
1701  else
1702  nwh = twh;
1703  if (nww > fCw) {
1704  nww = fCw; nwh = twh;
1705  }
1706  if (nwh > fCh) {
1707  nwh = fCh; nww = UInt_t(Double_t(fCh)/rxy);
1708  }
1709  } else {
1710  UInt_t twh = UInt_t(Double_t(fCw)*rxy);
1711  if (twh > fCh)
1712  nwh = UInt_t(Double_t(fCw)/rxy);
1713  else
1714  nww = twh;
1715  if (nww > fCw) {
1716  nww = fCw; nwh = twh;
1717  }
1718  if (nwh > fCh) {
1719  nwh = fCh; nww = UInt_t(Double_t(fCh)*rxy);
1720  }
1721  }
1722  fCw = nww;
1723  fCh = nwh;
1724  }
1725 
1726  if (fCw < fCh) {
1729  }
1730  else {
1733  }
1734 
1735 //*-*- Loop on all pads to recompute conversion coefficients
1736  TPad::ResizePad();
1737 
1738  if (padsav) padsav->cd();
1739 }
1740 
1741 
1742 ////////////////////////////////////////////////////////////////////////////////
1743 /// Raise canvas window
1744 
1746 {
1747  if (fCanvasImp)
1749 }
1750 
1751 ////////////////////////////////////////////////////////////////////////////////
1752 /// Set option to resize objects/pads in a canvas.
1753 ///
1754 /// - set = 1 (default) graphics objects are resized in opaque mode
1755 /// - set = 0 only the outline of objects is drawn when resizing them
1756 ///
1757 /// The option opaque produces the best effect. It requires however a
1758 /// a reasonably fast workstation or response time.
1759 
1761 {
1762  SetBit(kResizeOpaque,set);
1763 }
1764 
1765 ////////////////////////////////////////////////////////////////////////////////
1766 /// Execute the list of TExecs in the current pad.
1767 
1769 {
1770  if (!TestBit(kAutoExec)) return;
1771  if (!gPad) return;
1772  ((TPad*)gPad)->AutoExec();
1773 }
1774 
1775 
1776 ////////////////////////////////////////////////////////////////////////////////
1777 /// Save primitives in this canvas in C++ macro file with GUI.
1778 
1779 void TCanvas::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
1780 {
1781  // Write canvas options (in $TROOT or $TStyle)
1782  if (gStyle->GetOptFit()) {
1783  out<<" gStyle->SetOptFit(1);"<<std::endl;
1784  }
1785  if (!gStyle->GetOptStat()) {
1786  out<<" gStyle->SetOptStat(0);"<<std::endl;
1787  }
1788  if (!gStyle->GetOptTitle()) {
1789  out<<" gStyle->SetOptTitle(0);"<<std::endl;
1790  }
1791  if (gROOT->GetEditHistograms()) {
1792  out<<" gROOT->SetEditHistograms();"<<std::endl;
1793  }
1794  if (GetShowEventStatus()) {
1795  out<<" "<<GetName()<<"->ToggleEventStatus();"<<std::endl;
1796  }
1797  if (GetShowToolTips()) {
1798  out<<" "<<GetName()<<"->ToggleToolTips();"<<std::endl;
1799  }
1800  if (GetShowToolBar()) {
1801  out<<" "<<GetName()<<"->ToggleToolBar();"<<std::endl;
1802  }
1803  if (GetHighLightColor() != 5) {
1804  if (GetHighLightColor() > 228) {
1806  out<<" "<<GetName()<<"->SetHighLightColor(ci);" << std::endl;
1807  } else
1808  out<<" "<<GetName()<<"->SetHighLightColor("<<GetHighLightColor()<<");"<<std::endl;
1809  }
1810 
1811  // Now recursively scan all pads of this canvas
1812  cd();
1813  TPad::SavePrimitive(out,option);
1814 }
1815 
1816 ////////////////////////////////////////////////////////////////////////////////
1817 /// Save primitives in this canvas as a C++ macro file.
1818 /// This function loops on all the canvas primitives and for each primitive
1819 /// calls the object SavePrimitive function.
1820 /// When outputting floating point numbers, the default precision is 7 digits.
1821 /// The precision can be changed (via system.rootrc) by changing the value
1822 /// of the environment variable "Canvas.SavePrecision"
1823 
1824 void TCanvas::SaveSource(const char *filename, Option_t *option)
1825 {
1826  // reset bit TClass::kClassSaved for all classes
1827  TIter next(gROOT->GetListOfClasses());
1828  TClass *cl;
1829  while((cl = (TClass*)next())) {
1831  }
1832 
1833  char quote = '"';
1834  std::ofstream out;
1835  Int_t lenfile = strlen(filename);
1836  char * fname;
1837  char lcname[10];
1838  const char *cname = GetName();
1839  Bool_t invalid = kFALSE;
1840  // if filename is given, open this file, otherwise create a file
1841  // with a name equal to the canvasname.C
1842  if (lenfile) {
1843  fname = (char*)filename;
1844  out.open(fname, std::ios::out);
1845  } else {
1846  Int_t nch = strlen(cname);
1847  if (nch < 10) {
1848  strlcpy(lcname,cname,10);
1849  for (Int_t k=1;k<=nch;k++) {if (lcname[nch-k] == ' ') lcname[nch-k] = 0;}
1850  if (lcname[0] == 0) {invalid = kTRUE; strlcpy(lcname,"c1",10); nch = 2;}
1851  cname = lcname;
1852  }
1853  fname = new char[nch+3];
1854  strlcpy(fname,cname,nch+3);
1855  strncat(fname,".C",3);
1856  out.open(fname, std::ios::out);
1857  }
1858  if (!out.good ()) {
1859  Error("SaveSource", "Cannot open file: %s",fname);
1860  if (!lenfile) delete [] fname;
1861  return;
1862  }
1863 
1864  //set precision
1865  Int_t precision = gEnv->GetValue("Canvas.SavePrecision",7);
1866  out.precision(precision);
1867 
1868  // Write macro header and date/time stamp
1869  TDatime t;
1870  Float_t cx = gStyle->GetScreenFactor();
1871  Int_t topx,topy;
1872  UInt_t w, h;
1873  if (!fCanvasImp) {
1874  Error("SaveSource", "Cannot open TCanvas");
1875  return;
1876  }
1877  UInt_t editorWidth = fCanvasImp->GetWindowGeometry(topx,topy,w,h);
1878  w = UInt_t((fWindowWidth - editorWidth)/cx);
1879  h = UInt_t((fWindowHeight)/cx);
1880  topx = GetWindowTopX();
1881  topy = GetWindowTopY();
1882 
1883  if (w == 0) {
1884  w = GetWw()+4; h = GetWh()+4;
1885  topx = 1; topy = 1;
1886  }
1887 
1888  TString mname(fname);
1889 // out <<"#ifdef __CLING__"<<std::endl;
1890 // out <<"#pragma cling optimize(0)"<<std::endl;
1891 // out <<"#endif"<<std::endl;
1892 // out <<""<<std::endl;
1893  Int_t p = mname.Last('.');
1894  Int_t s = mname.Last('/')+1;
1895 
1896  // A named macro is generated only if the function name is valid. If not, the
1897  // macro is unnamed.
1898  TString first(mname(s,s+1));
1899  if (!first.IsDigit()) out <<"void " << mname(s,p-s) << "()" << std::endl;
1900 
1901  out <<"{"<<std::endl;
1902  out <<"//=========Macro generated from canvas: "<<GetName()<<"/"<<GetTitle()<<std::endl;
1903  out <<"//========= ("<<t.AsString()<<") by ROOT version "<<gROOT->GetVersion()<<std::endl;
1904 
1905  if (gStyle->GetCanvasPreferGL())
1906  out <<std::endl<<" gStyle->SetCanvasPreferGL(kTRUE);"<<std::endl<<std::endl;
1907 
1908  // Write canvas parameters (TDialogCanvas case)
1910  out<<" "<<ClassName()<<" *"<<cname<<" = new "<<ClassName()<<"("<<quote<<GetName()
1911  <<quote<<", "<<quote<<GetTitle()<<quote<<","<<w<<","<<h<<");"<<std::endl;
1912  } else {
1913  // Write canvas parameters (TCanvas case)
1914  out<<" TCanvas *"<<cname<<" = new TCanvas("<<quote<<GetName()<<quote<<", "<<quote<<GetTitle()
1915  <<quote;
1916  if (!HasMenuBar())
1917  out<<",-"<<topx<<","<<topy<<","<<w<<","<<h<<");"<<std::endl;
1918  else
1919  out<<","<<topx<<","<<topy<<","<<w<<","<<h<<");"<<std::endl;
1920  }
1921  // Write canvas options (in $TROOT or $TStyle)
1922  if (gStyle->GetOptFit()) {
1923  out<<" gStyle->SetOptFit(1);"<<std::endl;
1924  }
1925  if (!gStyle->GetOptStat()) {
1926  out<<" gStyle->SetOptStat(0);"<<std::endl;
1927  }
1928  if (!gStyle->GetOptTitle()) {
1929  out<<" gStyle->SetOptTitle(0);"<<std::endl;
1930  }
1931  if (gROOT->GetEditHistograms()) {
1932  out<<" gROOT->SetEditHistograms();"<<std::endl;
1933  }
1934  if (GetShowEventStatus()) {
1935  out<<" "<<GetName()<<"->ToggleEventStatus();"<<std::endl;
1936  }
1937  if (GetShowToolTips()) {
1938  out<<" "<<GetName()<<"->ToggleToolTips();"<<std::endl;
1939  }
1940  if (GetHighLightColor() != 5) {
1941  if (GetHighLightColor() > 228) {
1943  out<<" "<<GetName()<<"->SetHighLightColor(ci);" << std::endl;
1944  } else
1945  out<<" "<<GetName()<<"->SetHighLightColor("<<GetHighLightColor()<<");"<<std::endl;
1946  }
1947 
1948  // Now recursively scan all pads of this canvas
1949  cd();
1950  if (invalid) SetName("c1");
1951  TPad::SavePrimitive(out,option);
1952  // Write canvas options related to pad editor
1953  out<<" "<<GetName()<<"->SetSelected("<<GetName()<<");"<<std::endl;
1954  if (GetShowToolBar()) {
1955  out<<" "<<GetName()<<"->ToggleToolBar();"<<std::endl;
1956  }
1957  if (invalid) SetName(" ");
1958 
1959  out <<"}"<<std::endl;
1960  out.close();
1961  Info("SaveSource","C++ Macro file: %s has been generated", fname);
1962 
1963  // reset bit TClass::kClassSaved for all classes
1964  next.Reset();
1965  while((cl = (TClass*)next())) {
1967  }
1968  if (!lenfile) delete [] fname;
1969 }
1970 
1971 ////////////////////////////////////////////////////////////////////////////////
1972 /// Toggle batch mode. However, if the canvas is created without a window
1973 /// then batch mode always stays set.
1974 
1976 {
1977  if (gROOT->IsBatch() || IsWeb())
1978  fBatch = kTRUE;
1979  else
1980  fBatch = batch;
1981 }
1982 
1983 ////////////////////////////////////////////////////////////////////////////////
1984 /// Set Width and Height of canvas to ww and wh respectively. If ww and/or wh
1985 /// are greater than the current canvas window a scroll bar is automatically
1986 /// generated. Use this function to zoom in a canvas and navigate via
1987 /// the scroll bars. The Width and Height in this method are different from those
1988 /// given in the TCanvas constructors where these two dimension include the size
1989 /// of the window decoration whereas they do not in this method.
1990 
1992 {
1993  if (fCanvasImp) {
1994  fCanvasImp->SetCanvasSize(ww, wh);
1995  fCw = ww;
1996  fCh = wh;
1997  ResizePad();
1998  }
1999 }
2000 
2001 ////////////////////////////////////////////////////////////////////////////////
2002 /// Set cursor.
2003 
2005 {
2006  if (IsBatch()) return;
2007  gVirtualX->SetCursor(fCanvasID, cursor);
2008 }
2009 
2010 ////////////////////////////////////////////////////////////////////////////////
2011 /// Set Double Buffer On/Off.
2012 
2014 {
2015  if (IsBatch()) return;
2016  fDoubleBuffer = mode;
2017  gVirtualX->SetDoubleBuffer(fCanvasID, mode);
2018 
2019  // depending of the buffer mode set the drawing window to either
2020  // the canvas pixmap or to the canvas on-screen window
2021  if (fDoubleBuffer) {
2023  } else
2025 }
2026 
2027 ////////////////////////////////////////////////////////////////////////////////
2028 /// Fix canvas aspect ratio to current value if fixed is true.
2029 
2031 {
2032  if (fixed) {
2033  if (!fFixedAspectRatio) {
2034  if (fCh != 0)
2036  else {
2037  Error("SetAspectRatio", "cannot fix aspect ratio, height of canvas is 0");
2038  return;
2039  }
2041  }
2042  } else {
2044  fAspectRatio = 0;
2045  }
2046 }
2047 
2048 ////////////////////////////////////////////////////////////////////////////////
2049 /// If isfolder=kTRUE, the canvas can be browsed like a folder
2050 /// by default a canvas is not browsable.
2051 
2053 {
2054  fgIsFolder = isfolder;
2055 }
2056 
2057 ////////////////////////////////////////////////////////////////////////////////
2058 /// Set canvas name. In case `name` is an empty string, a default name is set.
2059 
2060 void TCanvas::SetName(const char *name)
2061 {
2062  if (!name || !name[0]) {
2063  const char *defcanvas = gROOT->GetDefCanvasName();
2064  char *cdef;
2065  auto lc = (TList*)gROOT->GetListOfCanvases();
2066  if (lc->FindObject(defcanvas)) {
2067  cdef = Form("%s_n%d",defcanvas,lc->GetSize()+1);
2068  } else {
2069  cdef = Form("%s",defcanvas);
2070  }
2071  fName = cdef;
2072  } else {
2073  fName = name;
2074  }
2075  if (gPad && TestBit(kMustCleanup)) gPad->Modified();
2076 }
2077 
2078 
2079 ////////////////////////////////////////////////////////////////////////////////
2080 /// Function to resize a canvas so that the plot inside is shown in real aspect
2081 /// ratio
2082 ///
2083 /// \param[in] axis 1 for resizing horizontally (x-axis) in order to get real
2084 /// aspect ratio, 2 for the resizing vertically (y-axis)
2085 /// \return false if error is encountered, true otherwise
2086 ///
2087 /// ~~~ {.cpp}
2088 /// hpxpy->Draw();
2089 /// c1->SetRealAspectRatio();
2090 /// ~~~
2091 ///
2092 /// - For defining the concept of real aspect ratio, it is assumed that x and y
2093 /// axes are in same units, e.g. both in MeV or both in ns.
2094 /// - You can resize either the width of the canvas or the height, but not both
2095 /// at the same time
2096 /// - Call this function AFTER drawing AND zooming (SetUserRange) your TGraph or
2097 /// Histogram, otherwise it cannot infer your actual axes lengths
2098 /// - This function ensures that the TFrame has a real aspect ratio, this does not
2099 /// mean that the full pad (i.e. the canvas or png output) including margins has
2100 /// exactly the same ratio
2101 /// - This function does not work if the canvas is divided in several subpads
2102 
2104 {
2105  Update();
2106 
2107  //Get how many pixels are occupied by the canvas
2108  Int_t npx = GetWw();
2109  Int_t npy = GetWh();
2110 
2111  //Get x-y coordinates at the edges of the canvas (extrapolating outside the axes, NOT at the edges of the histogram)
2112  Double_t x1 = GetX1();
2113  Double_t y1 = GetY1();
2114  Double_t x2 = GetX2();
2115  Double_t y2 = GetY2();
2116 
2117  //Get the length of extrapolated x and y axes
2118  Double_t xlength2 = x2 - x1;
2119  Double_t ylength2 = y2 - y1;
2120  Double_t ratio2 = xlength2/ylength2;
2121 
2122  //Now get the number of pixels including the canvas borders
2123  Int_t bnpx = GetWindowWidth();
2124  Int_t bnpy = GetWindowHeight();
2125 
2126  if (axis==1) {
2127  SetCanvasSize(TMath::Nint(npy*ratio2), npy);
2128  SetWindowSize((bnpx-npx)+TMath::Nint(npy*ratio2), bnpy);
2129  } else if (axis==2) {
2130  SetCanvasSize(npx, TMath::Nint(npx/ratio2));
2131  SetWindowSize(bnpx, (bnpy-npy)+TMath::Nint(npx/ratio2));
2132  } else {
2133  Error("SetRealAspectRatio", "axis value %d is neither 1 (resize along x-axis) nor 2 (resize along y-axis).",axis);
2134  return false;
2135  }
2136 
2137  //Check now that resizing has worked
2138 
2139  Update();
2140 
2141  //Get how many pixels are occupied by the canvas
2142  npx = GetWw();
2143  npy = GetWh();
2144 
2145  //Get x-y coordinates at the edges of the canvas (extrapolating outside the axes,
2146  //NOT at the edges of the histogram)
2147  x1 = GetX1();
2148  y1 = GetY1();
2149  x2 = GetX2();
2150  y2 = GetY2();
2151 
2152  //Get the length of extrapolated x and y axes
2153  xlength2 = x2 - x1;
2154  ylength2 = y2 - y1;
2155  ratio2 = xlength2/ylength2;
2156 
2157  //Check accuracy +/-1 pixel due to rounding
2158  if (abs(TMath::Nint(npy*ratio2) - npx)<2) {
2159  return true;
2160  } else {
2161  Error("SetRealAspectRatio", "Resizing failed.");
2162  return false;
2163  }
2164 }
2165 
2166 
2167 ////////////////////////////////////////////////////////////////////////////////
2168 /// Set selected canvas.
2169 
2171 {
2172  fSelected = obj;
2173  if (obj) obj->SetBit(kMustCleanup);
2174 }
2175 
2176 ////////////////////////////////////////////////////////////////////////////////
2177 /// Set canvas title.
2178 
2179 void TCanvas::SetTitle(const char *title)
2180 {
2181  fTitle = title;
2182  if (fCanvasImp) fCanvasImp->SetWindowTitle(title);
2183 }
2184 
2185 ////////////////////////////////////////////////////////////////////////////////
2186 /// Set canvas window position
2187 
2189 {
2190  if (fCanvasImp)
2192 }
2193 
2194 ////////////////////////////////////////////////////////////////////////////////
2195 /// Set canvas window size
2196 
2198 {
2199  if (fBatch)
2200  SetCanvasSize((ww + fCw) / 2, (wh + fCh) / 2);
2201  else if (fCanvasImp)
2202  fCanvasImp->SetWindowSize(ww, wh);
2203 }
2204 
2205 ////////////////////////////////////////////////////////////////////////////////
2206 /// Set the canvas scale in centimeters.
2207 ///
2208 /// This information is used by PostScript to set the page size.
2209 ///
2210 /// \param[in] xsize size of the canvas in centimeters along X
2211 /// \param[in] ysize size of the canvas in centimeters along Y
2212 ///
2213 /// if xsize and ysize are not equal to 0, then the scale factors will
2214 /// be computed to keep the ratio ysize/xsize independently of the canvas
2215 /// size (parts of the physical canvas will be unused).
2216 ///
2217 /// if xsize = 0 and ysize is not zero, then xsize will be computed
2218 /// to fit to the current canvas scale. If the canvas is resized,
2219 /// a new value for xsize will be recomputed. In this case the aspect
2220 /// ratio is not preserved.
2221 ///
2222 /// if both xsize = 0 and ysize = 0, then the scaling is automatic.
2223 /// the largest dimension will be allocated a size of 20 centimeters.
2224 
2225 void TCanvas::Size(Float_t xsize, Float_t ysize)
2226 {
2227  fXsizeUser = xsize;
2228  fYsizeUser = ysize;
2229 
2230  Resize();
2231 }
2232 
2233 ////////////////////////////////////////////////////////////////////////////////
2234 /// Show canvas
2235 
2237 {
2238  if (fCanvasImp)
2239  fCanvasImp->Show();
2240 }
2241 
2242 ////////////////////////////////////////////////////////////////////////////////
2243 /// Stream a class object.
2244 
2245 void TCanvas::Streamer(TBuffer &b)
2246 {
2247  UInt_t R__s, R__c;
2248  if (b.IsReading()) {
2249  Version_t v = b.ReadVersion(&R__s, &R__c);
2250  gPad = this;
2251  fCanvas = this;
2252  if (v>7) b.ClassBegin(TCanvas::IsA());
2253  if (v>7) b.ClassMember("TPad");
2254  TPad::Streamer(b);
2255  gPad = this;
2256  //restore the colors
2257  TObjArray *colors = (TObjArray*)fPrimitives->FindObject("ListOfColors");
2258  if (colors) {
2259  TIter next(colors);
2260  TColor *colold;
2261  while ((colold = (TColor*)next())) {
2262  if (colold) {
2263  Int_t cn = 0;
2264  if (colold) cn = colold->GetNumber();
2265  TColor *colcur = gROOT->GetColor(cn);
2266  if (colcur) {
2267  colcur->SetRGB(colold->GetRed(),colold->GetGreen(),colold->GetBlue());
2268  } else {
2269  colcur = new TColor(cn,colold->GetRed(),
2270  colold->GetGreen(),
2271  colold->GetBlue(),
2272  colold->GetName());
2273  if (!colcur) return;
2274  }
2275  }
2276  }
2277  //restore the palette if needed
2278  TObjArray *currentpalette = (TObjArray*)fPrimitives->FindObject("CurrentColorPalette");
2279  if (currentpalette) {
2280  TIter nextpal(currentpalette);
2281  Int_t n = currentpalette->GetEntries();
2282  TArrayI palcolors(n);
2283  TColor *col = 0;
2284  Int_t i = 0;
2285  while ((col = (TColor*)nextpal())) palcolors[i++] = col->GetNumber();
2286  gStyle->SetPalette(n,palcolors.GetArray());
2287  fPrimitives->Remove(currentpalette);
2288  delete currentpalette;
2289  }
2291  colors->Delete();
2292  delete colors;
2293  }
2294 
2295  if (v>7) b.ClassMember("fDISPLAY","TString");
2296  fDISPLAY.Streamer(b);
2297  if (v>7) b.ClassMember("fDoubleBuffer", "Int_t");
2298  b >> fDoubleBuffer;
2299  if (v>7) b.ClassMember("fRetained", "Bool_t");
2300  b >> fRetained;
2301  if (v>7) b.ClassMember("fXsizeUser", "Size_t");
2302  b >> fXsizeUser;
2303  if (v>7) b.ClassMember("fYsizeUser", "Size_t");
2304  b >> fYsizeUser;
2305  if (v>7) b.ClassMember("fXsizeReal", "Size_t");
2306  b >> fXsizeReal;
2307  if (v>7) b.ClassMember("fYsizeReal", "Size_t");
2308  b >> fYsizeReal;
2309  fCanvasID = -1;
2310  if (v>7) b.ClassMember("fWindowTopX", "Int_t");
2311  b >> fWindowTopX;
2312  if (v>7) b.ClassMember("fWindowTopY", "Int_t");
2313  b >> fWindowTopY;
2314  if (v > 2) {
2315  if (v>7) b.ClassMember("fWindowWidth", "UInt_t");
2316  b >> fWindowWidth;
2317  if (v>7) b.ClassMember("fWindowHeight", "UInt_t");
2318  b >> fWindowHeight;
2319  }
2320  if (v>7) b.ClassMember("fCw", "UInt_t");
2321  b >> fCw;
2322  if (v>7) b.ClassMember("fCh", "UInt_t");
2323  b >> fCh;
2324  if (v <= 2) {
2325  fWindowWidth = fCw;
2326  fWindowHeight = fCh;
2327  }
2328  if (v>7) b.ClassMember("fCatt", "TAttCanvas");
2329  fCatt.Streamer(b);
2330  Bool_t dummy;
2331  if (v>7) b.ClassMember("kMoveOpaque", "Bool_t");
2332  b >> dummy; if (dummy) MoveOpaque(1);
2333  if (v>7) b.ClassMember("kResizeOpaque", "Bool_t");
2334  b >> dummy; if (dummy) ResizeOpaque(1);
2335  if (v>7) b.ClassMember("fHighLightColor", "Color_t");
2336  b >> fHighLightColor;
2337  if (v>7) b.ClassMember("fBatch", "Bool_t");
2338  b >> dummy; //was fBatch
2339  if (v < 2) return;
2340  if (v>7) b.ClassMember("kShowEventStatus", "Bool_t");
2341  b >> dummy; if (dummy) SetBit(kShowEventStatus);
2342 
2343  if (v > 3) {
2344  if (v>7) b.ClassMember("kAutoExec", "Bool_t");
2345  b >> dummy; if (dummy) SetBit(kAutoExec);
2346  }
2347  if (v>7) b.ClassMember("kMenuBar", "Bool_t");
2348  b >> dummy; if (dummy) SetBit(kMenuBar);
2349  fBatch = gROOT->IsBatch();
2350  if (v>7) b.ClassEnd(TCanvas::IsA());
2351  b.CheckByteCount(R__s, R__c, TCanvas::IsA());
2352  } else {
2353  //save list of colors
2354  //we must protect the case when two or more canvases are saved
2355  //in the same buffer. If the list of colors has already been saved
2356  //in the buffer, do not add the list of colors to the list of primitives.
2357  TObjArray *colors = 0;
2358  TObjArray *CurrentColorPalette = 0;
2359  if (TColor::DefinedColors()) {
2360  if (!b.CheckObject(gROOT->GetListOfColors(),TObjArray::Class())) {
2361  colors = (TObjArray*)gROOT->GetListOfColors();
2363  }
2364  //save the current palette
2365  TArrayI pal = TColor::GetPalette();
2366  Int_t palsize = pal.GetSize();
2367  CurrentColorPalette = new TObjArray();
2368  CurrentColorPalette->SetName("CurrentColorPalette");
2369  for (Int_t i=0; i<palsize; i++) CurrentColorPalette->Add(gROOT->GetColor(pal[i]));
2370  fPrimitives->Add(CurrentColorPalette);
2371  }
2372 
2373  R__c = b.WriteVersion(TCanvas::IsA(), kTRUE);
2374  b.ClassBegin(TCanvas::IsA());
2375  b.ClassMember("TPad");
2376  TPad::Streamer(b);
2378  if (CurrentColorPalette) { fPrimitives->Remove(CurrentColorPalette); delete CurrentColorPalette; }
2379  b.ClassMember("fDISPLAY","TString");
2380  fDISPLAY.Streamer(b);
2381  b.ClassMember("fDoubleBuffer", "Int_t");
2382  b << fDoubleBuffer;
2383  b.ClassMember("fRetained", "Bool_t");
2384  b << fRetained;
2385  b.ClassMember("fXsizeUser", "Size_t");
2386  b << fXsizeUser;
2387  b.ClassMember("fYsizeUser", "Size_t");
2388  b << fYsizeUser;
2389  b.ClassMember("fXsizeReal", "Size_t");
2390  b << fXsizeReal;
2391  b.ClassMember("fYsizeReal", "Size_t");
2392  b << fYsizeReal;
2394  Int_t topx = fWindowTopX, topy = fWindowTopY;
2395  UInt_t editorWidth = 0;
2396  if(fCanvasImp) editorWidth = fCanvasImp->GetWindowGeometry(topx,topy,w,h);
2397  b.ClassMember("fWindowTopX", "Int_t");
2398  b << topx;
2399  b.ClassMember("fWindowTopY", "Int_t");
2400  b << topy;
2401  b.ClassMember("fWindowWidth", "UInt_t");
2402  b << (UInt_t)(w-editorWidth);
2403  b.ClassMember("fWindowHeight", "UInt_t");
2404  b << h;
2405  b.ClassMember("fCw", "UInt_t");
2406  b << fCw;
2407  b.ClassMember("fCh", "UInt_t");
2408  b << fCh;
2409  b.ClassMember("fCatt", "TAttCanvas");
2410  fCatt.Streamer(b);
2411  b.ClassMember("kMoveOpaque", "Bool_t");
2412  b << TestBit(kMoveOpaque); //please remove in ROOT version 6
2413  b.ClassMember("kResizeOpaque", "Bool_t");
2414  b << TestBit(kResizeOpaque); //please remove in ROOT version 6
2415  b.ClassMember("fHighLightColor", "Color_t");
2416  b << fHighLightColor;
2417  b.ClassMember("fBatch", "Bool_t");
2418  b << fBatch; //please remove in ROOT version 6
2419  b.ClassMember("kShowEventStatus", "Bool_t");
2420  b << TestBit(kShowEventStatus); //please remove in ROOT version 6
2421  b.ClassMember("kAutoExec", "Bool_t");
2422  b << TestBit(kAutoExec); //please remove in ROOT version 6
2423  b.ClassMember("kMenuBar", "Bool_t");
2424  b << TestBit(kMenuBar); //please remove in ROOT version 6
2425  b.ClassEnd(TCanvas::IsA());
2426  b.SetByteCount(R__c, kTRUE);
2427  }
2428 }
2429 
2430 ////////////////////////////////////////////////////////////////////////////////
2431 /// Toggle pad auto execution of list of TExecs.
2432 
2434 {
2435  Bool_t autoExec = TestBit(kAutoExec);
2436  SetBit(kAutoExec,!autoExec);
2437 }
2438 
2439 ////////////////////////////////////////////////////////////////////////////////
2440 /// Toggle event statusbar.
2441 
2443 {
2444  Bool_t showEventStatus = !TestBit(kShowEventStatus);
2445  SetBit(kShowEventStatus,showEventStatus);
2446 
2447  if (fCanvasImp) fCanvasImp->ShowStatusBar(showEventStatus);
2448 }
2449 
2450 ////////////////////////////////////////////////////////////////////////////////
2451 /// Toggle toolbar.
2452 
2454 {
2455  Bool_t showToolBar = !TestBit(kShowToolBar);
2456  SetBit(kShowToolBar,showToolBar);
2457 
2458  if (fCanvasImp) fCanvasImp->ShowToolBar(showToolBar);
2459 }
2460 
2461 ////////////////////////////////////////////////////////////////////////////////
2462 /// Toggle editor.
2463 
2465 {
2466  Bool_t showEditor = !TestBit(kShowEditor);
2467  SetBit(kShowEditor,showEditor);
2468 
2469  if (fCanvasImp) fCanvasImp->ShowEditor(showEditor);
2470 }
2471 
2472 ////////////////////////////////////////////////////////////////////////////////
2473 /// Toggle tooltip display.
2474 
2476 {
2477  Bool_t showToolTips = !TestBit(kShowToolTips);
2478  SetBit(kShowToolTips, showToolTips);
2479 
2480  if (fCanvasImp) fCanvasImp->ShowToolTips(showToolTips);
2481 }
2482 
2483 
2484 ////////////////////////////////////////////////////////////////////////////////
2485 /// Static function returning "true" if transparency is supported.
2486 
2488 {
2489  return gPad && (gVirtualX->InheritsFrom("TGQuartz") ||
2490  gPad->GetGLDevice() != -1);
2491 }
2492 
2493 extern "C" void ROOT_TCanvas_Update(void* TheCanvas) {
2494  static_cast<TCanvas*>(TheCanvas)->Update();
2495 }
2496 
2497 ////////////////////////////////////////////////////////////////////////////////
2498 /// Update canvas pad buffers.
2499 
2501 {
2502  if (fUpdating) return;
2503 
2504  if (fPixmapID == -1) return;
2505 
2506  static const union CastFromFuncToVoidPtr_t {
2507  CastFromFuncToVoidPtr_t(): fFuncPtr(ROOT_TCanvas_Update) {}
2508  void (*fFuncPtr)(void*);
2509  void* fVoidPtr;
2510  } castFromFuncToVoidPtr;
2511 
2512  if (gThreadXAR) {
2513  void *arr[3];
2514  arr[1] = this;
2515  arr[2] = castFromFuncToVoidPtr.fVoidPtr;
2516  if ((*gThreadXAR)("CUPD", 3, arr, 0)) return;
2517  }
2518 
2519  if (!fCanvasImp) return;
2520 
2521  if (!gVirtualX->IsCmdThread()) {
2522  // Why do we have this (which uses the interpreter to funnel the Update()
2523  // through the main thread) when the gThreadXAR mechanism does seemingly
2524  // the same?
2525  gInterpreter->Execute(this, IsA(), "Update", "");
2526  return;
2527  }
2528 
2530 
2531  fUpdating = kTRUE;
2532 
2533  if (!fCanvasImp->PerformUpdate()) {
2534 
2535  if (!IsBatch()) FeedbackMode(kFALSE); // Goto double buffer mode
2536 
2537  if (!UseGL()) PaintModified(); // Repaint all modified pad's
2538 
2539  Flush(); // Copy all pad pixmaps to the screen
2540 
2541  SetCursor(kCross);
2542  }
2543 
2544  fUpdating = kFALSE;
2545 }
2546 
2547 ////////////////////////////////////////////////////////////////////////////////
2548 /// Used by friend class TCanvasImp.
2549 
2551 {
2552  fCanvasID = 0;
2553  fContextMenu = 0;
2554 }
2555 
2556 ////////////////////////////////////////////////////////////////////////////////
2557 /// Check whether this canvas is to be drawn in grayscale mode.
2558 
2560 {
2561  return TestBit(kIsGrayscale);
2562 }
2563 
2564 ////////////////////////////////////////////////////////////////////////////////
2565 /// Set whether this canvas should be painted in grayscale, and re-paint
2566 /// it if necessary.
2567 
2568 void TCanvas::SetGrayscale(Bool_t set /*= kTRUE*/)
2569 {
2570  if (IsGrayscale() == set) return;
2571  SetBit(kIsGrayscale, set);
2572  Paint(); // update canvas and all sub-pads, unconditionally!
2573 }
2574 
2575 ////////////////////////////////////////////////////////////////////////////////
2576 /// Probably, TPadPainter must be placed in a separate ROOT module -
2577 /// "padpainter" (the same as "histpainter"). But now, it's directly in a
2578 /// gpad dir, so, in case of default painter, no *.so should be loaded,
2579 /// no need in plugin managers.
2580 /// May change in future.
2581 
2583 {
2584  //Even for batch mode painter is still required, just to delegate
2585  //some calls to batch "virtual X".
2586  if (!UseGL() || fBatch) {
2587  fPainter = 0;
2589  if (!fPainter) fPainter = new TPadPainter; // Do not need plugin manager for this!
2590  } else {
2592  if (!fPainter) {
2593  Error("CreatePainter", "GL Painter creation failed! Will use default!");
2594  fPainter = new TPadPainter;
2595  fUseGL = kFALSE;
2596  }
2597  }
2598 }
2599 
2600 ////////////////////////////////////////////////////////////////////////////////
2601 /// Access and (probably) creation of pad painter.
2602 
2604 {
2605  if (!fPainter) CreatePainter();
2606  return fPainter;
2607 }
2608 
2609 
2610 ////////////////////////////////////////////////////////////////////////////////
2611 ///assert on IsBatch() == false?
2612 
2614 {
2615  if (fGLDevice != -1) {
2616  //fPainter has a font manager.
2617  //Font manager will delete textures.
2618  //If context is wrong (we can have several canvases) -
2619  //wrong texture will be deleted, damaging some of our fonts.
2620  gGLManager->MakeCurrent(fGLDevice);
2621  }
2622 
2623  delete fPainter;
2624  fPainter = 0;
2625 
2626  if (fGLDevice != -1) {
2627  gGLManager->DeleteGLContext(fGLDevice);//?
2628  fGLDevice = -1;
2629  }
2630 }
TCanvas::fgIsFolder
static Bool_t fgIsFolder
Indicates if canvas can be browsed as a folder.
Definition: TCanvas.h:66
TVirtualPS
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:119
kMouseLeave
@ kMouseLeave
Definition: Buttons.h:29
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:2568
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:30
TCanvas::SavePrimitive
void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitives in this canvas in C++ macro file with GUI.
Definition: TCanvas.cxx:1779
TPad::fX2
Double_t fX2
X of upper X coordinate.
Definition: TPad.h:34
kWheelUp
@ kWheelUp
Definition: Buttons.h:24
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:6709
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:1059
TClass::kClassSaved
@ kClassSaved
Definition: TClass.h:93
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
Definition: TBrowser.h:37
TAttPad
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:5656
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
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:2433
TROOT::DecreaseDirLevel
static Int_t DecreaseDirLevel()
Decrease the indentation level for ls().
Definition: TROOT.cxx:2696
kButton2Double
@ kButton2Double
Definition: Buttons.h:30
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:5174
TCanvas::SetTitle
void SetTitle(const char *title="")
Set canvas title.
Definition: TCanvas.cxx:2179
TPad
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:26
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:2550
TList::FindObject
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:577
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:1637
Form
char * Form(const char *fmt,...)
TCanvas::ls
virtual void ls(Option_t *option="") const
List all pads.
Definition: TCanvas.cxx:1490
TCanvas::IsWeb
Bool_t IsWeb() const
Is web canvas.
Definition: TCanvas.cxx:1482
TDatime.h
TCanvas::ResizeOpaque
void ResizeOpaque(Int_t set=1)
Set option to resize objects/pads in a canvas.
Definition: TCanvas.cxx:1760
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:25
TStyle::GetCanvasDefH
Int_t GetCanvasDefH() const
Definition: TStyle.h:183
TCanvas::EditorBar
virtual void EditorBar()
Get editor bar.
Definition: TCanvas.cxx:1026
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:1474
gInterpreter
#define gInterpreter
Definition: TInterpreter.h:558
TCanvas::CreatePainter
void CreatePainter()
Probably, TPadPainter must be placed in a separate ROOT module - "padpainter" (the same as "histpaint...
Definition: TCanvas.cxx:2582
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:1061
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:168
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:1116
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:623
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:2052
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:5879
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:24
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:2559
TColor.h
TCanvas::Clear
void Clear(Option_t *option="")
Remove all primitives from the canvas.
Definition: TCanvas.cxx:723
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:1768
TCanvas::UseGL
Bool_t UseGL() const
Definition: TCanvas.h:223
TBuffer
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:2170
kMouseMotion
@ kMouseMotion
Definition: Buttons.h:29
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:2225
TCanvas::fCanvasID
Int_t fCanvasID
! Canvas identifier
Definition: TCanvas.h:47
TString
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:1824
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:118
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:823
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:5916
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:1221
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:680
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:1172
TCanvasImp::ForceUpdate
virtual void ForceUpdate()
Definition: TCanvasImp.h:57
TCanvas::Draw
virtual void Draw(Option_t *option="")
Draw a canvas.
Definition: TCanvas.cxx:841
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
Definition: TContextMenu.h:44
TObject::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:359
kWheelDown
@ kWheelDown
Definition: Buttons.h:24
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:1098
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:5905
TCanvas::SupportAlpha
static Bool_t SupportAlpha()
Static function returning "true" if transparency is supported.
Definition: TCanvas.cxx:2487
TStyle::GetCanvasDefY
Int_t GetCanvasDefY() const
Definition: TStyle.h:186
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
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:905
TCanvas::Highlighted
virtual void Highlighted(TVirtualPad *pad, TObject *obj, Int_t x, Int_t y)
Emit Highlighted() signal.
Definition: TCanvas.cxx:1610
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:774
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:2603
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
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:1533
TCanvas::ProcessedEvent
virtual void ProcessedEvent(Int_t event, Int_t x, Int_t y, TObject *selected)
Emit ProcessedEvent() signal.
Definition: TCanvas.cxx:1651
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:2188
SetFillColor
h1 SetFillColor(kGreen)
kButton1Double
@ kButton1Double
Definition: Buttons.h:30
TCanvas::Closed
virtual void Closed()
Emit Closed signal.
Definition: TCanvas.cxx:764
TBox.h
TColor
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:124
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:704
TCanvas::ToggleToolBar
virtual void ToggleToolBar()
Toggle toolbar.
Definition: TCanvas.cxx:2453
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:960
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:1991
TPad::GetTickx
Int_t GetTickx() const
Definition: TPad.h:232
gDebug
R__EXTERN Int_t gDebug
Definition: RtypesCore.h:119
Long_t
long Long_t
Definition: RtypesCore.h:54
TStyle::GetTimeOffset
Double_t GetTimeOffset() const
Definition: TStyle.h:260
TPadPainter
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:2236
gGuiFactory
R__EXTERN TGuiFactory * gGuiFactory
Definition: TGuiFactory.h:66
TCanvas::~TCanvas
virtual ~TCanvas()
Canvas destructor.
Definition: TCanvas.cxx:662
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:5958
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
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:5453
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:1035
gCanvasInit
static TCanvasInit gCanvasInit
Definition: TCanvas.cxx:56
kButton2Motion
@ kButton2Motion
Definition: Buttons.h:26
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:523
kButton3Down
@ kButton3Down
Definition: Buttons.h:23
TCanvas::ToggleToolTips
virtual void ToggleToolTips()
Toggle tooltip display.
Definition: TCanvas.cxx:2475
TPad::CopyPixmap
virtual void CopyPixmap()
Copy the pixmap of the pad to the canvas.
Definition: TPad.cxx:1045
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:1465
TCanvas::SetBatch
void SetBatch(Bool_t batch=kTRUE)
Toggle batch mode.
Definition: TCanvas.cxx:1975
TVirtualMutex.h
TCanvas::ToggleEventStatus
virtual void ToggleEventStatus()
Toggle event statusbar.
Definition: TCanvas.cxx:2442
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:2792
TPad::PaintBorder
void PaintBorder(Color_t color, Bool_t tops)
Paint the pad border.
Definition: TPad.cxx:3489
void
typedef void((*Func_t)())
TCanvas::Build
void Build()
Build a canvas. Called by all constructors.
Definition: TCanvas.cxx:572
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:2060
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:3644
TROOT::IndentLevel
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Definition: TROOT.cxx:2800
TPad::Paint
virtual void Paint(Option_t *option="")
Paint all primitives in pad.
Definition: TPad.cxx:3427
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:27
kButton1ShiftMotion
@ kButton1ShiftMotion
Definition: Buttons.h:24
TCanvas::MakeDefCanvas
static TCanvas * MakeDefCanvas()
Static function to build a default canvas.
Definition: TCanvas.cxx:1502
TCanvas::SetDoubleBuffer
virtual void SetDoubleBuffer(Int_t mode=1)
Set Double Buffer On/Off.
Definition: TCanvas.cxx:2013
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
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:1591
gVirtualPS
R__EXTERN TVirtualPS * gVirtualPS
Definition: TVirtualPS.h:81
TPad::GetHighLightColor
virtual Color_t GetHighLightColor() const
Get highlight color.
Definition: TPad.cxx:2697
TCanvas::SetFixedAspectRatio
virtual void SetFixedAspectRatio(Bool_t fixed=kTRUE)
Fix canvas aspect ratio to current value if fixed is true.
Definition: TCanvas.cxx:2030
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:23
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:864
TGraph
Definition: TGraph.h:41
TApplication::NeedGraphicsLibs
static void NeedGraphicsLibs()
Static method.
Definition: TApplication.cxx:252
TVirtualPad
Definition: TVirtualPad.h:50
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:1745
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:1785
TObjArray.h
TCanvas
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:821
ROOT_TCanvas_Update
void ROOT_TCanvas_Update(void *TheCanvas)
Definition: TCanvas.cxx:2493
dummy
static RooMathCoreReg dummy
Definition: RooMathCoreReg.cxx:27
TInterpreter.h
TClass
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:594
TCanvas::Resize
virtual void Resize(Option_t *option="")
Recompute canvas parameters following a X11 Resize.
Definition: TCanvas.cxx:1666
TCanvas::SetWindowSize
void SetWindowSize(UInt_t ww, UInt_t wh)
Set canvas window size.
Definition: TCanvas.cxx:2197
TCollection::SetName
void SetName(const char *name)
Definition: TCollection.h:204
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:1541
TObject
Definition: TObject.h:37
kButton3Motion
@ kButton3Motion
Definition: Buttons.h:26
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:988
TH1
Definition: TH1.h:57
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:2500
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:1164
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:756
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:2943
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:888
gPad
#define gPad
Definition: TVirtualPad.h:287
TIter
Definition: TCollection.h:233
TDatime
Definition: TDatime.h:37
TCanvas::GetSelectedPad
TVirtualPad * GetSelectedPad() const
Definition: TCanvas.h:144
kButton2Up
@ kButton2Up
Definition: Buttons.h:25
TClass::IsCallingNew
static ENewType IsCallingNew()
Static method returning the defConstructor flag passed to TClass::New().
Definition: TClass.cxx:5721
kKeyPress
@ kKeyPress
Definition: Buttons.h:26
TCanvas::GetWindowTopX
Int_t GetWindowTopX()
Returns current top x position of window on screen.
Definition: TCanvas.cxx:1197
kMouseEnter
@ kMouseEnter
Definition: Buttons.h:29
TStyle::GetOptStat
Int_t GetOptStat() const
Definition: TStyle.h:236
TAttFill
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:2103
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:53
kButton2Down
@ kButton2Down
Definition: Buttons.h:23
TVirtualPadPainter
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:2004
TPad::SetLogx
virtual void SetLogx(Int_t value=1)
Set Lin/Log scale for X.
Definition: TPad.cxx:5891
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:27
TCanvasImp::ShowStatusBar
virtual void ShowStatusBar(Bool_t show=kTRUE)
Definition: TCanvasImp.h:95
TCanvas::DeleteCanvasPainter
void DeleteCanvasPainter()
assert on IsBatch() == false?
Definition: TCanvas.cxx:2613
TCanvas::Flush
void Flush()
Flush canvas buffers.
Definition: TCanvas.cxx:1130
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:106
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:2978
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:1698
TCanvas::Browse
virtual void Browse(TBrowser *b)
Browse.
Definition: TCanvas.cxx:670
TCanvas::HighlightConnect
virtual void HighlightConnect(const char *slot)
This is "simplification" for function TCanvas::Connect with Highlighted signal for specific slot.
Definition: TCanvas.cxx:1629
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
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
Definition: TArrayI.h:27
kButton3Up
@ kButton3Up
Definition: Buttons.h:25
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:1208
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:2464
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