150 fMother = (TPad*)
gPad;
179 fFixedAspectRatio =
kFALSE;
192 fUxmin = fUymin = fUxmax = fUymax = 0;
241 :
TVirtualPad(name,title,xlow,ylow,xup,yup,color,bordersize,bordermode)
285 Error(
"TPad",
"You must create a TCanvas before creating a TPad");
292 if ((xlow < 0) || (xlow > 1) || (ylow < 0) || (ylow > 1)) {
293 Error(
"TPad",
"illegal bottom left position: x=%f, y=%f", xlow, ylow);
296 if ((xup < 0) || (xup > 1) || (yup < 0) || (yup > 1)) {
297 Error(
"TPad",
"illegal top right position: x=%f, y=%f", xup, yup);
308 SetPad(name, title, xlow, ylow, xup, yup, color, bordersize, bordermode);
395 while ((exec = (
TExec*)next())) {
427 const char* title,
Option_t *option)
436 while( (o=next()) ) {
440 if (!leg) leg =
new TLegend(x1, y1, x2, y2, title);
447 if (strlen(option)) {
456 if (!leg) leg =
new TLegend(x1, y1, x2, y2, title);
458 TIter nextgraph(grlist);
461 while ((obj = nextgraph())) {
466 if (strlen(option)) opt = option;
471 if (!leg) leg =
new TLegend(x1, y1, x2, y2, title);
473 TIter nexthist(hlist);
476 while ((obj = nexthist())) {
481 if (strlen(option)) opt = option;
494 Info(
"BuildLegend(void)",
"No object to build a TLegend.");
537 while ((obj = next())) {
540 if (n == subpadnumber) {
541 return ((
TPad*)obj)->cd();
603 for (
Int_t i=0;i<2;i++) {
616 while(code1 + code2) {
627 if (ic == 0) ic = code2;
629 yt = y[0] + (y[1]-y[0])*(xclipl-x[0])/(x[1]-x[0]);
633 yt = y[0] + (y[1]-y[0])*(xclipr-x[0])/(x[1]-x[0]);
637 xt = x[0] + (x[1]-x[0])*(yclipb-y[0])/(y[1]-y[0]);
641 xt = x[0] + (x[1]-x[0])*(yclipt-y[0])/(y[1]-y[0]);
647 code1 =
ClippingCode(xt,yt,xclipl,yclipb,xclipr,yclipt);
651 code2 =
ClippingCode(xt,yt,xclipl,yclipb,xclipr,yclipt);
674 for (
Int_t i=0;i<2;i++) {
683 if (x[0] < xclipl) code1 = code1 | 0x1;
684 if (x[0] > xclipr) code1 = code1 | 0x2;
685 if (y[0] < yclipb) code1 = code1 | 0x4;
686 if (y[0] > yclipt) code1 = code1 | 0x8;
688 if (x[1] < xclipl) code2 = code2 | 0x1;
689 if (x[1] > xclipr) code2 = code2 | 0x2;
690 if (y[1] < yclipb) code2 = code2 | 0x4;
691 if (y[1] > yclipt) code2 = code2 | 0x8;
695 while(code1 + code2) {
706 if (ic == 0) ic = code2;
708 yt = y[0] + (y[1]-y[0])*(xclipl-x[0])/(x[1]-x[0]);
712 yt = y[0] + (y[1]-y[0])*(xclipr-x[0])/(x[1]-x[0]);
716 xt = x[0] + (x[1]-x[0])*(yclipb-y[0])/(y[1]-y[0]);
720 xt = x[0] + (x[1]-x[0])*(yclipt-y[0])/(y[1]-y[0]);
726 code1 =
ClippingCode(xt,yt,xclipl,yclipb,xclipr,yclipt);
730 code2 =
ClippingCode(xt,yt,xclipl,yclipb,xclipr,yclipt);
743 if (x < xcl1) code = code | 0x1;
744 if (x > xcl2) code = code | 0x2;
745 if (y < ycl1) code = code | 0x4;
746 if (y > ycl2) code = code | 0x8;
798 x1 = x[n-1]; y1 = y[n-1];
801 for (i=0; i<
n; i++) {
802 x2 = x[i]; y2 = y[i];
806 slope = (y2-y1)/(x2-x1);
810 xc2[nc2] = xclipl; yc2[nc2++] = slope*(xclipl-
x1)+y1;
812 xc2[nc2] =
x2; yc2[nc2++] = y2;
816 xc2[nc2] = xclipl; yc2[nc2++] = slope*(xclipl-
x1)+y1;
817 xc2[nc2] =
x2; yc2[nc2++] = y2;
824 x1 = xc2[nc2-1]; y1 = yc2[nc2-1];
826 for (i=0; i<nc2; i++) {
827 x2 = xc2[i]; y2 = yc2[i];
831 slope = (x2-
x1)/(y2-y1);
835 xc[nc] = x1+(yclipt-y1)*slope; yc[nc++] = yclipt;
837 xc[nc] =
x2; yc[nc++] = y2;
841 xc[nc] = x1+(yclipt-y1)*slope; yc[nc++] = yclipt;
842 xc[nc] =
x2; yc[nc++] = y2;
849 x1 = xc[nc-1]; y1 = yc[nc-1];
851 for (i=0; i<nc; i++) {
852 x2 = xc[i]; y2 = yc[i];
856 slope = (y2-y1)/(x2-x1);
860 xc2[nc2] = xclipr; yc2[nc2++] = slope*(xclipr-
x1)+y1;
862 xc2[nc2] =
x2; yc2[nc2++] = y2;
866 xc2[nc2] = xclipr; yc2[nc2++] = slope*(xclipr-
x1)+y1;
867 xc2[nc2] =
x2; yc2[nc2++] = y2;
874 x1 = xc2[nc2-1]; y1 = yc2[nc2-1];
876 for (i=0; i<nc2; i++) {
877 x2 = xc2[i]; y2 = yc2[i];
881 slope = (x2-
x1)/(y2-y1);
885 xc[nc] = x1+(yclipb-y1)*slope; yc[nc++] = yclipb;
887 xc[nc] =
x2; yc[nc++] = y2;
891 xc[nc] = x1+(yclipb-y1)*slope; yc[nc++] = yclipb;
892 xc[nc] =
x2; yc[nc++] = y2;
932 if (!
gPad->IsBatch()) {
939 if (!
gROOT->GetListOfCanvases())
return;
941 gROOT->GetListOfCanvases()->Remove(
this);
962 if (
gROOT->GetSelectedPad() ==
this)
gROOT->SetSelectedPad(0);
987 while ((obj = next())) {
989 ((
TPad*)obj)->CopyPixmap();
990 ((
TPad*)obj)->CopyPixmaps();
1016 Int_t pxl, pyl, pxt, pyt;
1021 if (px1 < px2) {pxl = px1; pxt = px2;}
1022 else {pxl = px2; pxt = px1;}
1023 if (py1 < py2) {pyl = py1; pyt = py2;}
1024 else {pyl = py2; pyt = py1;}
1028 if ( (px > pxl && px < pxt) && (py > pyl && py < pyt) ) {
1035 if (py < pyl) dxl += pyl - py;
1036 if (py > pyt) dxl += py - pyt;
1038 if (py < pyl) dxt += pyl - py;
1039 if (py > pyt) dxt += py - pyt;
1041 if (px < pxl) dyl += pxl - px;
1042 if (px > pxt) dyl += px - pxt;
1044 if (px < pxl) dyt += pxl - px;
1045 if (px > pxt) dyt += px - pxt;
1047 Int_t distance = dxl;
1048 if (dxt < distance) distance = dxt;
1049 if (dyl < distance) distance = dyl;
1050 if (dyt < distance) distance = dyt;
1096 arr[1] =
this; arr[2] = (
void*)&nx;arr[3] = (
void*)& ny;
1097 arr[4] = (
void*)&xmargin; arr[5] = (
void *)& ymargin; arr[6] = (
void *)&color;
1098 if ((*
gThreadXAR)(
"PDCD", 7, arr, 0))
return;
1103 if (nx <= 0) nx = 1;
1104 if (ny <= 0) ny = 1;
1111 char *
name =
new char [nchname];
1112 char *title =
new char [nchtitle];
1115 if (xmargin > 0 && ymargin > 0) {
1119 for (iy=0;iy<
ny;iy++) {
1120 y2 = 1 - iy*dy - ymargin;
1121 y1 = y2 - dy + 2*ymargin;
1123 if (y1 > y2)
continue;
1124 for (ix=0;ix<
nx;ix++) {
1125 x1 = ix*dx + xmargin;
1126 x2 = x1 +dx -2*xmargin;
1127 if (x1 > x2)
continue;
1130 pad =
new TPad(name,name,x1,y1,x2,y2,color);
1156 if (i == nx-1) x2 = 1-xr;
1158 number = j*nx + i +1;
1161 if (j == 0) y2 = 1-yt;
1162 if (j == ny-1) y1 = 0;
1165 pad =
new TPad(name,title,x1,y1,x2,y2);
1181 if (padsav) padsav->
cd();
1202 Divide( w,
h, xmargin, ymargin, color);
1212 gROOT->MakeDefCanvas();
1250 Int_t nd,nf,nc,nkd,nkf,i,j;
1263 Range(0,0,xpad,ypad);
1268 clevel[nlevel] = obj;
1277 if (nlevel >= maxlev-1)
break;
1281 Int_t ilevel, nelem;
1282 for (ilevel=nlevel;ilevel>=0;ilevel--) {
1283 cl = clevel[ilevel];
1285 if (nelem > maxelem) maxelem = nelem;
1286 nc = (nelem/50) + 1;
1296 if (dx < 1.3) dx = 1.3;
1297 tsizcm = tsizcm - 0.03*
Double_t(ncdraw-5);
1298 if (tsizcm < 0.27) tsizcm = 0.27;
1303 for (ilevel=nlevel;ilevel>=0;ilevel--) {
1304 cl = clevel[ilevel];
1306 if (nelem > maxelem) maxelem = nelem;
1307 nc = (nelem/50) + 1;
1309 if (ilevel < nlevel) x1 = x2 + 0.5;
1327 v1 = y1 -
Double_t(nkf+nkd+nc-1)*dy;
1339 TBox *
box = pt->
AddBox(0,(y1+0.01-v1)/dv,0,(v2-0.01-v1)/dv);
1341 pt->
AddLine(0,(y1-v1)/dv,0,(y1-v1)/dv);
1353 if (i >= nkd) { i = 1; y = y1 - 0.5*dy; x += 1/
Double_t(nc); }
1354 else { i++; y -= dy; }
1362 while (indx < dim ){
1363 ldname = strlen(dname);
1367 pt->
AddText(x,(y-v1)/dv,dname);
1374 pt->
AddLine(0,(ysep-v1)/dv,0,(ysep-v1)/dv);
1385 while ((m = (
TMethod *) nextm())) {
1387 !strcmp( m->
GetName(),
"Dictionary" ) ||
1388 !strcmp( m->
GetName(),
"Class_Version" ) ||
1389 !strcmp( m->
GetName(),
"DeclFileName" ) ||
1390 !strcmp( m->
GetName(),
"DeclFileLine" ) ||
1391 !strcmp( m->
GetName(),
"ImplFileName" ) ||
1392 !strcmp( m->
GetName(),
"ImplFileLine" )
1395 if (fcount > nf)
break;
1396 if (i >= nkf) { i = 1; y = ysep - 0.5*dy; x += 1/
Double_t(nc); }
1397 else { i++; y -= dy; }
1402 for (j=ilevel-1;j>=0;j--) {
1403 if (cl == clevel[ilevel]) {
1404 if (clevel[j]->GetMethodAny((
char*)m->
GetName())) {
1451 Int_t pxmin,pxmax,pymin,pymax,pxold,pyold,px,py;
1463 pxmax = canvas->
GetWw();
1465 pymax = cpad->
GetWh();
1467 if(pxold)
gVirtualX->DrawLine(pxold,pymin,pxold,pymax);
1468 if(pyold)
gVirtualX->DrawLine(pxmin,pyold,pxmax,pyold);
1495 if (
this != padsav) {
1496 Warning(
"DrawFrame",
"Must be called for the current pad only");
1497 return padsav->
DrawFrame(xmin,ymin,xmax,ymax,title);
1503 if (hframe)
delete hframe;
1507 if (
fLogx && xmin > 0 && xmax > xmin) {
1516 hframe =
new TH1F(
"hframe",title,nbins,xbins);
1519 hframe =
new TH1F(
"hframe",title,nbins,xmin,xmax);
1529 if (padsav) padsav->
cd();
1540 Double_t xlow, ylow, xup, yup, hs, ws;
1545 gPad->SetFillColor(0);
1547 gPad->Range(x1,y1,x2,y2);
1559 for (i=0;i<10;i++) {
1568 box->
DrawBox(xlow, ylow, xup, yup);
1571 box->
DrawBox(xlow, ylow, xup, yup);
1574 text->
DrawText(0.5*(xlow+xup), 0.5*(ylow+yup),
Form(
"%d",color));
1601 const Int_t kMaxDiff = 5;
1602 const Int_t kMinSize = 20;
1603 static Int_t pxorg, pyorg;
1604 static Int_t px1, px2, py1, py2, pxl, pyl, pxt, pyt, pxold, pyold;
1605 static Int_t px1p, px2p, py1p, py2p, pxlp, pylp, pxtp, pytp;
1606 static Bool_t pA, pB, pC, pD, pTop, pL, pR, pBot, pINSIDE;
1629 pA = pB = pC = pD = pTop = pL = pR = pBot = pINSIDE =
kFALSE;
1673 if (newcode)
return;
1740 pA = pB = pC = pD = pTop = pL = pR = pBot = pINSIDE =
kFALSE;
1744 pxold = pxl; pyold = pyl; pA =
kTRUE;
1749 pxold = pxt; pyold = pyl; pB =
kTRUE;
1754 pxold = pxt; pyold = pyt; pC =
kTRUE;
1759 pxold = pxl; pyold = pyt; pD =
kTRUE;
1763 if ((px > pxl+kMaxDiff && px < pxt-kMaxDiff) &&
1765 pxold = pxl; pyold = pyl; pTop =
kTRUE;
1769 if ((px > pxl+kMaxDiff && px < pxt-kMaxDiff) &&
1771 pxold = pxt; pyold = pyt; pBot =
kTRUE;
1775 if ((py > pyl+kMaxDiff && py < pyt-kMaxDiff) &&
1777 pxold = pxl; pyold = pyl; pL =
kTRUE;
1781 if ((py > pyl+kMaxDiff && py < pyt-kMaxDiff) &&
1783 pxold = pxt; pyold = pyt; pR =
kTRUE;
1787 if ((px > pxl+kMaxDiff && px < pxt-kMaxDiff) &&
1788 (py > pyl+kMaxDiff && py < pyt-kMaxDiff)) {
1789 pxold = px; pyold = py; pINSIDE =
kTRUE;
1797 if (pA || pB || pC || pD || pTop || pL || pR || pBot)
1800 if (!pA && !pB && !pC && !pD && !pTop && !pL && !pR && !pBot && !pINSIDE)
1813 if (px > pxt-kMinSize) { px = pxt-kMinSize; wx = px; }
1814 if (py > pyt-kMinSize) { py = pyt-kMinSize; wy = py; }
1815 if (px < pxlp) { px = pxlp; wx = px; }
1816 if (py < pylp) { py = pylp; wy = py; }
1834 if (px < pxl+kMinSize) { px = pxl+kMinSize; wx = px; }
1835 if (py > pyt-kMinSize) { py = pyt-kMinSize; wy = py; }
1836 if (px > pxtp) { px = pxtp; wx = px; }
1837 if (py < pylp) { py = pylp; wy = py; }
1855 if (px < pxl+kMinSize) { px = pxl+kMinSize; wx = px; }
1856 if (py < pyl+kMinSize) { py = pyl+kMinSize; wy = py; }
1857 if (px > pxtp) { px = pxtp; wx = px; }
1858 if (py > pytp) { py = pytp; wy = py; }
1876 if (px > pxt-kMinSize) { px = pxt-kMinSize; wx = px; }
1877 if (py < pyl+kMinSize) { py = pyl+kMinSize; wy = py; }
1878 if (px < pxlp) { px = pxlp; wx = px; }
1879 if (py > pytp) { py = pytp; wy = py; }
1898 if (py2 > py1-kMinSize) { py2 = py1-kMinSize; wy = py2; }
1899 if (py2 < py2p) { py2 = py2p; wy = py2; }
1914 if (py1 < py2+kMinSize) { py1 = py2+kMinSize; wy = py1; }
1915 if (py1 > py1p) { py1 = py1p; wy = py1; }
1930 if (px1 > px2-kMinSize) { px1 = px2-kMinSize; wx = px1; }
1931 if (px1 < px1p) { px1 = px1p; wx = px1; }
1947 if (px2 < px1+kMinSize) { px2 = px1+kMinSize; wx = px2; }
1948 if (px2 > px2p) { px2 = px2p; wx = px2; }
1963 Int_t dx = px - pxold;
1964 Int_t dy = py - pyold;
1965 px1 += dx; py1 += dy; px2 += dx; py2 += dy;
1966 if (px1 < px1p) { dx = px1p - px1; px1 += dx; px2 += dx; wx = px+dx; }
1967 if (px2 > px2p) { dx = px2 - px2p; px1 -= dx; px2 -= dx; wx = px-dx; }
1968 if (py1 > py1p) { dy = py1 - py1p; py1 -= dy; py2 -= dy; wy = py-dy; }
1969 if (py2 < py2p) { dy = py2p - py2; py1 += dy; py2 += dy; wy = py+dy; }
1983 x1 = x2 = y1 = y2 = 0;
2010 if (pTop || pBot || pL || pR || pINSIDE) {
2017 if (px != pxorg || py != pyorg) {
2041 if (pINSIDE)
gPad->ShowGuidelines(
this, event);
2042 if (pTop)
gPad->ShowGuidelines(
this, event,
't',
true);
2043 if (pBot)
gPad->ShowGuidelines(
this, event,
'b',
true);
2044 if (pL)
gPad->ShowGuidelines(
this, event,
'l',
true);
2045 if (pR)
gPad->ShowGuidelines(
this, event,
'r',
true);
2046 if (pA)
gPad->ShowGuidelines(
this, event,
'1',
true);
2047 if (pB)
gPad->ShowGuidelines(
this, event,
'2',
true);
2048 if (pC)
gPad->ShowGuidelines(
this, event,
'3',
true);
2049 if (pD)
gPad->ShowGuidelines(
this, event,
'4',
true);
2058 if (
gROOT->IsEscaped()) {
2063 if (opaque||ropaque) {
2066 x1 = x2 = y1 = y2 = 0;
2092 if (pTop || pBot || pL || pR || pINSIDE) {
2099 if (pA || pB || pC || pD || pTop || pL || pR || pBot)
2105 if (px != pxorg || py != pyorg) {
2142 event =
gVirtualX->RequestLocator(1, 1, px, py);
2181 static Int_t axisNumber;
2183 static Int_t px1old, py1old, px2old, py2old;
2187 static TBox *zoombox;
2188 Double_t zbx1=0,zbx2=0,zby1=0,zby2=0;
2195 if (strstr(opt,
"cont4")) {
2204 if (!strcmp(axis->
GetName(),
"xaxis")) {
2208 if (!strcmp(axis->
GetName(),
"yaxis")) {
2212 if (!strcmp(axis->
GetName(),
"zaxis")) {
2218 if (axisNumber == 1) {
2224 }
else if (axisNumber == 2) {
2240 if (axisNumber == 1) {
2245 }
else if (axisNumber == 2) {
2259 zoombox =
new TBox(zbx1, zby1, zbx2, zby2);
2270 if (!opaque)
gVirtualX->SetLineColor(-1);
2278 if (axisNumber == 1) {
2288 if (axisNumber == 1) {
2293 }
else if (axisNumber == 2) {
2307 zoombox->
SetX1(zbx1);
2308 zoombox->
SetY1(zby1);
2309 zoombox->
SetX2(zbx2);
2310 zoombox->
SetY2(zby2);
2342 if (
gROOT->IsEscaped()) {
2344 if (opaque && zoombox) {
2353 if (ratio1 > ratio2) {
2358 if (ratio2 - ratio1 > 0.05) {
2360 if (axisNumber == 3 && hobj && hobj->
GetDimension() != 3) {
2369 Float_t newmin = zmin + (zmax-zmin)*ratio1;
2370 Float_t newmax = zmin + (zmax-zmin)*ratio2;
2383 bin1 = first +
Int_t((last-first+1)*ratio1);
2384 bin2 = first +
Int_t((last-first+1)*ratio2);
2394 if (axisNumber == 1) {
2402 }
else if (axisNumber == 2) {
2430 xmin = ((xmin-xmi)/(xma-xmi))*(up-low)+low;
2431 xmax = ((xmax-xmi)/(xma-xmi))*(up-low)+low;
2434 if (!strcmp(axis->
GetName(),
"xaxis")) axisNumber = 1;
2435 if (!strcmp(axis->
GetName(),
"yaxis")) axisNumber = 2;
2436 if (ratio2 - ratio1 > 0.05) {
2443 if (axisNumber == 1) axis->
SetRange(bin1,bin2);
2444 if (axisNumber == 2 && hobj1) {
2461 while ((obj= next())) {
2464 if (hobj == hobj1)
continue;
2467 if (axisNumber == 1) {
2469 }
else if (axisNumber == 2) {
2512 if (found)
return found;
2515 while ((cur = next())) {
2518 if (found)
return found;
2533 if (found)
return found;
2536 while ((cur = next())) {
2539 if (found)
return found;
2614 if (
fCanvas ==
this)
return 0;
2623 if (
fCanvas ==
this)
return 0;
2632 if (
fCanvas ==
this)
return 0;
2775 while ((obj=next())) {
2776 if (!strcmp(name, obj->
GetName()))
return obj;
2779 if (found)
return found;
2789 if (!subpadnumber) {
2796 while ((obj = next())) {
2799 if (pad->
GetNumber() == subpadnumber)
return pad;
2846 if (color <= 0)
return;
2864 gROOT->SetSelectedPad(
this);
2881 <<
" Name= "<<
GetName()<<
" Title= "<<
GetTitle()<<
" Option="<<option<<std::endl;
2973 began3DScene =
kTRUE;
2980 if (padsav) padsav->cd();
3009 if (color < 0) color = -color;
3016 if (bordersize <= 0) bordersize = 2;
3037 if (px1 < px2) {xl =
fX1; xt =
fX2; }
3038 else {xl =
fX2; xt =
fX1;}
3039 if (py1 > py2) {yl =
fY1; yt =
fY2;}
3040 else {yl =
fY2; yt =
fY1;}
3042 Double_t frameXs[7] = {}, frameYs[7] = {};
3046 frameXs[0] = xl; frameYs[0] = yl;
3047 frameXs[1] = xl + realBsX; frameYs[1] = yl + realBsY;
3048 frameXs[2] = frameXs[1]; frameYs[2] = yt - realBsY;
3049 frameXs[3] = xt - realBsX; frameYs[3] = frameYs[2];
3050 frameXs[4] = xt; frameYs[4] = yt;
3051 frameXs[5] = xl; frameYs[5] = yt;
3052 frameXs[6] = xl; frameYs[6] = yl;
3059 frameXs[0] = xl; frameYs[0] = yl;
3060 frameXs[1] = xl + realBsX; frameYs[1] = yl + realBsY;
3061 frameXs[2] = xt - realBsX; frameYs[2] = frameYs[1];
3062 frameXs[3] = frameXs[2]; frameYs[3] = yt - realBsY;
3063 frameXs[4] = xt; frameYs[4] = yt;
3064 frameXs[5] = xt; frameYs[5] = yl;
3065 frameXs[6] = xl; frameYs[6] = yl;
3198 ((
TPad*)obj)->PaintModified();
3210 began3DScene =
kTRUE;
3218 if (padsav) padsav->cd();
3239 if (!
gPad->IsBatch()) {
3242 if (option[0] ==
's') {
3247 if (style > 3000 && style < 4000) {
3253 if (style >= 3100 && style < 4000) {
3255 xb[0] =
x1; xb[1] =
x1; xb[2] =
x2; xb[3] =
x2;
3256 yb[0] = y1; yb[1] = y2; yb[2] = y2; yb[3] = y1;
3266 }
else if (style >= 4000 && style <= 4100) {
3291 }
else if (style >= 1000 && style <= 1999) {
3305 if (option[0] ==
's') {
3308 if (style0 >= 3100 && style0 < 4000) {
3310 xb[0] =
x1; xb[1] =
x1; xb[2] =
x2; xb[3] =
x2;
3311 yb[0] = y1; yb[1] = y2; yb[2] = y2; yb[3] = y1;
3317 if (option[0] ==
'l') {
3336 while ((obj = next())) {
3338 if (obj == stop)
break;
3339 ((
TPad*)obj)->CopyBackgroundPixmap(x, y);
3340 ((
TPad*)obj)->CopyBackgroundPixmaps((
TPad*)obj, stop, x, y);
3359 Warning(
"TPad::PaintFillArea",
"Float_t signature is obsolete. Use Double_t signature.");
3382 n =
ClipPolygon(nn, xx, yy, nc, x, y,xmin,ymin,xmax,ymax);
3392 if (fillstyle >= 3100 && fillstyle < 4000) {
3399 if (!
gPad->IsBatch())
3446 static Double_t ang1[10] = {0., 10., 20., 30., 45.,5., 60., 70., 80., 90.};
3447 static Double_t ang2[10] = {180.,170.,160.,150.,135.,5.,120.,110.,100., 90.};
3449 Int_t fasi = FillStyle%1000;
3452 Int_t iAng1 = fasi%10;
3460 if (!
gPad->IsBatch()) {
3473 if (!
gPad->IsBatch()) {
3485 if (ang1[iAng1] != 5.)
PaintHatches(dy, ang1[iAng1], nn, xx, yy);
3486 if (ang2[iAng2] != 5.)
PaintHatches(dy, ang2[iAng2], nn, xx, yy);
3489 if (!
gPad->IsBatch()) {
3513 const Int_t maxnbi = 100;
3514 Double_t xli[maxnbi], xlh[2], ylh[2], xt1, xt2, yt1, yt2;
3515 Double_t ll,
x,
y,
x1,
x2, y1, y2,
a,
b, xi, xip, xin, yi, yip;
3521 ratiox = 1/(rwxmax-rwxmin);
3522 ratioy = 1/(rwymax-rwymin);
3535 gPad->GetPadPar(x1p,y1p,x2p,y2p);
3544 for (i=1; i<=
nn; i++) {
3545 x = wndc*ratiox*(xx[i-1]-rwxmin);
3546 y = hndc*ratioy*(yy[i-1]-rwymin);
3547 yrot = sina*x+cosa*
y;
3548 if (yrot > ymax) ymax = yrot;
3549 if (yrot < ymin) ymin = yrot;
3553 for (ycur=ymax; ycur>=
ymin; ycur=ycur-dy) {
3555 for (i=2; i<=nn+1; i++) {
3558 if (i == nn+1) i2=1;
3559 x1 = wndc*ratiox*(xx[i1-1]-rwxmin);
3560 y1 = hndc*ratioy*(yy[i1-1]-rwymin);
3561 x2 = wndc*ratiox*(xx[i2-1]-rwxmin);
3562 y2 = hndc*ratioy*(yy[i2-1]-rwymin);
3563 xt1 = cosa*x1-sina*y1;
3564 yt1 = sina*x1+cosa*y1;
3565 xt2 = cosa*x2-sina*y2;
3566 yt2 = sina*x2+cosa*y2;
3577 if ((yi <= ycur) && (ycur < yip)) {
3579 if (nbi >= maxnbi)
return;
3589 if (nbi >= maxnbi)
return;
3592 if (nbi >= maxnbi)
return;
3599 a = (yt1-yt2)/(xt1-xt2);
3600 b = (yt2*xt1-xt2*yt1)/(xt1-xt2);
3609 if ((xi <= xin) && (xin < xip) &&
3613 if (nbi >= maxnbi)
return;
3622 for (i=1; i<=
m; i++) {
3623 if (xli[i] < xli[i-1]) {
3631 if (inv == 0)
goto L50;
3637 if (nbi%2 != 0)
continue;
3639 for (i=1; i<=nbi; i=i+2) {
3641 xlh[0] = cosb*xli[i-1]-sinb*ycur;
3642 ylh[0] = sinb*xli[i-1]+cosb*ycur;
3643 xlh[1] = cosb*xli[i] -sinb*ycur;
3644 ylh[1] = sinb*xli[i] +cosb*ycur;
3646 xlh[0] = (xlh[0]/wndc)*(rwxmax-rwxmin)+rwxmin;
3647 ylh[0] = (ylh[0]/hndc)*(rwymax-rwymin)+rwymin;
3648 xlh[1] = (xlh[1]/wndc)*(rwxmax-rwxmin)+rwxmin;
3649 ylh[1] = (ylh[1]/hndc)*(rwymax-rwymin)+rwymin;
3650 gPad->PaintLine(xlh[0], ylh[0], xlh[1], ylh[1]);
3661 x[0] =
x1; x[1] =
x2; y[0] = y1; y[1] = y2;
3670 if (!
gPad->IsBatch())
3686 if (!
gPad->IsBatch())
3711 for (i=0;i<3;i++) temp[i] = p1[i];
3713 for (i=0;i<3;i++) temp[i] = p2[i];
3715 PaintLine(xpad[0],xpad[1],xpad[3],xpad[4]);
3729 for (i=0;i<3;i++) temp[i] = p1[i];
3731 for (i=0;i<3;i++) temp[i] = p2[i];
3733 PaintLine(xpad[0],xpad[1],xpad[3],xpad[4]);
3749 Int_t i, i1=-1,np=1;
3750 for (i=0; i<n-1; i++) {
3755 Int_t iclip =
Clip(&x[i],&y[i],xmin,ymin,xmax,ymax);
3762 if (iclip == 0 && i < n-2)
continue;
3763 if (!
gPad->IsBatch())
3796 if (option && (option[0] ==
'C')) mustClip =
kFALSE;
3799 Int_t i, i1=-1, np=1, iclip=0;
3801 for (i=0; i < n-1; i++) {
3807 iclip =
Clip(&x[i],&y[i],xmin,ymin,xmax,ymax);
3815 if (iclip == 0 && i < n-2)
continue;
3816 if (!
gPad->IsBatch())
3841 if (!
gPad->IsBatch())
3847 for (
Int_t i=0; i<
n; i++) {
3866 for (
Int_t i = 1; i <
n; i++)
3885 for (i=0; i<
n; i++) {
3886 if (x[i] >= xmin && x[i] <= xmax && y[i] >= ymin && y[i] <= ymax) {
3889 if (i < n-1)
continue;
3891 if (np == 0)
continue;
3892 if (!
gPad->IsBatch())
3916 for (i=0; i<
n; i++) {
3917 if (x[i] >= xmin && x[i] <= xmax && y[i] >= ymin && y[i] <= ymax) {
3920 if (i < n-1)
continue;
3922 if (np == 0)
continue;
3923 if (!
gPad->IsBatch())
3941 if (!
gPad->IsBatch())
3954 if (!
gPad->IsBatch())
3967 if (!
gPad->IsBatch())
3984 if (!
gPad->IsBatch())
4012 if (
gPad == 0)
return 0;
4019 if (
this !=
gPad->GetCanvas()) {
4020 if (!((x >=
fX1 && x <=
fX2) && (y >=
fY1 && y <=
fY2)))
return 0;
4028 TPad *picked =
this;
4032 pickobj = &dummyLink;
4061 pick = ((
TPad*)obj)->
Pick(px, py, pickobj);
4066 }
else if (!
gROOT->GetEditorMode()) {
4073 if (dist == 0)
break;
4088 if (
fView && !gotPrim) {
4112 if (picked ==
this) {
4134 while ((obj = next()))
4136 char *opt =
StrDup(next.GetOption());
4162 ((
TPad*)
this)->SaveAs(filename);
4174 while ((obj = next())) {
4318 const char *filename;
4336 filename = fs2.
Data();
4339 const char *opt_default=
"ps";
4341 Int_t lenfil = filename ? strlen(filename) : 0;
4342 TString opt = (!option) ? opt_default : option;
4364 if (strstr(opt,
"gif+")) {
4367 }
else if (strstr(opt,
"gif")) {
4370 }
else if (strstr(opt,
"png")) {
4373 }
else if (strstr(opt,
"jpg")) {
4376 }
else if (strstr(opt,
"tiff")) {
4379 }
else if (strstr(opt,
"xpm")) {
4382 }
else if (strstr(opt,
"bmp")) {
4389 if (!
gROOT->IsBatch() && image) {
4392 Color_t hc =
gPad->GetCanvas()->GetHighLightColor();
4393 gPad->GetCanvas()->SetHighLightColor(-1);
4399 Info(
"Print",
"GIF file %s has been created", psname.
Data());
4401 gPad->GetCanvas()->SetHighLightColor(hc);
4405 Color_t hc =
gPad->GetCanvas()->GetHighLightColor();
4406 gPad->GetCanvas()->SetHighLightColor(-1);
4421 Info(
"Print",
"file %s has been created", psname.
Data());
4423 gPad->GetCanvas()->SetHighLightColor(hc);
4425 Warning(
"Print",
"Unsupported image format %s", psname.
Data());
4431 if (strstr(opt,
"cxx")) {
4437 if (strstr(opt,
"root")) {
4443 if (strstr(opt,
"xml")) {
4450 if (strstr(opt,
"svg")) {
4465 if ((h =
gROOT->GetPluginManager()->FindHandler(
"TVirtualPS",
"svg"))) {
4490 if (strstr(opt,
"tex")) {
4505 if ((h =
gROOT->GetPluginManager()->FindHandler(
"TVirtualPS",
"tex"))) {
4540 copen = psname.
EndsWith(
"(");
if (copen) psname[psname.
Length()-1] = 0;
4541 cclose = psname.
EndsWith(
")");
if (cclose) psname[psname.
Length()-1] = 0;
4542 copenb = psname.
EndsWith(
"[");
if (copenb) psname[psname.
Length()-1] = 0;
4543 ccloseb = psname.
EndsWith(
"]");
if (ccloseb) psname[psname.
Length()-1] = 0;
4547 if (copen || copenb) mustClose =
kFALSE;
4548 if (cclose || ccloseb) mustClose =
kTRUE;
4559 if (ratio < 1) pstype = 112;
4560 if (strstr(opt,
"Portrait")) pstype = 111;
4561 if (strstr(opt,
"Landscape")) pstype = 112;
4562 if (strstr(opt,
"eps")) pstype = 113;
4563 if (strstr(opt,
"Preview")) pstype = 113;
4571 if (strstr(opt,
"pdf") || strstr(opt,
"Title:")) {
4572 if ((h =
gROOT->GetPluginManager()->FindHandler(
"TVirtualPS",
"pdf"))) {
4578 if ((h =
gROOT->GetPluginManager()->FindHandler(
"TVirtualPS",
"image"))) {
4583 if ((h =
gROOT->GetPluginManager()->FindHandler(
"TVirtualPS",
"ps"))) {
4592 if (titlePos !=
kNPOS) {
4599 if (!strstr(opt,
"pdf") || image) {
4616 if (!copen)
Info(
"Print",
"%s file %s has been created", opt.
Data(), psname.
Data());
4617 else Info(
"Print",
"%s file %s has been created using the current canvas", opt.
Data(), psname.
Data());
4626 if (titlePos !=
kNPOS) {
4633 if (cclose)
Info(
"Print",
"Current canvas added to %s file %s and file closed", opt.
Data(), psname.
Data());
4634 else Info(
"Print",
"%s file %s has been closed", opt.
Data(), psname.
Data());
4639 Info(
"Print",
"Current canvas added to %s file %s", opt.
Data(), psname.
Data());
4656 if ((x1 >= x2) || (y1 >= y2)) {
4657 Error(
"Range",
"illegal world coordinates range: x1=%f, y1=%f, x2=%f, y2=%f",x1,y1,x2,y2);
4666 if (
fX1 == x1 &&
fY1 == y1 &&
fX2 == x2 &&
fY2 == y2)
return;
4694 if ((xmin >= xmax) || (ymin >= ymax)) {
4695 Error(
"RangeAxis",
"illegal axis coordinates range: xmin=%f, ymin=%f, xmax=%f, ymax=%f",
4696 xmin, ymin, xmax, ymax);
4748 while ((obj = next())) {
4759 if (h1f) h1f->
DrawCopy(
"sameaxis");
4778 if (padsav) padsav->
cd();
4908 if (
this ==
gPad->GetCanvas()) {
4940 fYtoPixelk = rounding + -pyrange - pyrange*fY1/yrange;
4961 while ((obj = next())) {
4967 if (
gPad->IsBatch())
4985 Warning(
"ResizePad",
"Inf/NaN propagated to the pad. Check drawn objects.");
4986 if (w <= 0 || w > 10000) {
4987 Warning(
"ResizePad",
"%s width changed from %d to %d\n",
GetName(),w,10);
4990 if (h <= 0 || h > 10000) {
4991 Warning(
"ResizePad",
"%s height changed from %d to %d\n",
GetName(),h,10);
5006 if (padsav ==
this) {
5040 Int_t lenfil = filename ? strlen(filename) : 0;
5043 else psname = filename;
5104 const char *cname =
GetName();
5105 Int_t nch = strlen(cname);
5107 strlcpy(lcname,cname,10);
5108 for (
Int_t k=1;k<=nch;k++) {
if (lcname[nch-k] ==
' ') lcname[nch-k] = 0;}
5109 if (lcname[0] == 0) {
5110 if (
this ==
gPad->GetCanvas()) {strlcpy(lcname,
"c1",10); nch = 2;}
5111 else {strlcpy(lcname,
"pad",10); nch = 3;}
5117 if (
this !=
gPad->GetCanvas()) {
5118 out <<
" "<<std::endl;
5119 out <<
"// ------------>Primitives in pad: "<<
GetName()<<std::endl;
5121 out<<
" TPad *"<<cname<<
" = new TPad("<<quote<<
GetName()<<quote<<
", "<<quote<<
GetTitle()
5128 out<<
" "<<cname<<
"->Draw();"<<std::endl;
5129 out<<
" "<<cname<<
"->cd();"<<std::endl;
5131 out<<
" "<<cname<<
"->Range("<<
fX1<<
","<<
fY1<<
","<<
fX2<<
","<<
fY2<<
");"<<std::endl;
5136 static Int_t viewNumber = 0;
5137 out<<
" TView *view"<<++viewNumber<<
" = TView::CreateView(1);"<<std::endl;
5138 out<<
" view"<<viewNumber<<
"->SetRange("<<rmin[0]<<
","<<rmin[1]<<
","<<rmin[2]<<
"," 5139 <<rmax[0]<<
","<<rmax[1]<<
","<<rmax[2]<<
");"<<std::endl;
5144 out<<
" "<<cname<<
"->SetFillColor(ci);" << std::endl;
5146 out<<
" "<<cname<<
"->SetFillColor("<<
GetFillColor()<<
");"<<std::endl;
5149 out<<
" "<<cname<<
"->SetFillStyle("<<
GetFillStyle()<<
");"<<std::endl;
5152 out<<
" "<<cname<<
"->SetBorderMode("<<
GetBorderMode()<<
");"<<std::endl;
5155 out<<
" "<<cname<<
"->SetBorderSize("<<
GetBorderSize()<<
");"<<std::endl;
5158 out<<
" "<<cname<<
"->SetLogx();"<<std::endl;
5161 out<<
" "<<cname<<
"->SetLogy();"<<std::endl;
5164 out<<
" "<<cname<<
"->SetLogz();"<<std::endl;
5167 out<<
" "<<cname<<
"->SetGridx();"<<std::endl;
5170 out<<
" "<<cname<<
"->SetGridy();"<<std::endl;
5173 out<<
" "<<cname<<
"->SetTickx("<<
GetTickx()<<
");"<<std::endl;
5176 out<<
" "<<cname<<
"->SetTicky("<<
GetTicky()<<
");"<<std::endl;
5179 out<<
" "<<cname<<
"->SetTheta("<<
GetTheta()<<
");"<<std::endl;
5182 out<<
" "<<cname<<
"->SetPhi("<<
GetPhi()<<
");"<<std::endl;
5185 out<<
" "<<cname<<
"->SetLeftMargin("<<
GetLeftMargin()<<
");"<<std::endl;
5188 out<<
" "<<cname<<
"->SetRightMargin("<<
GetRightMargin()<<
");"<<std::endl;
5191 out<<
" "<<cname<<
"->SetTopMargin("<<
GetTopMargin()<<
");"<<std::endl;
5194 out<<
" "<<cname<<
"->SetBottomMargin("<<
GetBottomMargin()<<
");"<<std::endl;
5200 out<<
" "<<cname<<
"->SetFrameFillColor(ci);" << std::endl;
5213 out<<
" "<<cname<<
"->SetFrameLineColor(ci);" << std::endl;
5233 out<<
" "<<cname<<
"->SetFrameFillColor(ci);" << std::endl;
5235 out<<
" "<<cname<<
"->SetFrameFillColor("<<frame->
GetFillColor()<<
");"<<std::endl;
5238 out<<
" "<<cname<<
"->SetFrameFillStyle("<<frame->
GetFillStyle()<<
");"<<std::endl;
5241 out<<
" "<<cname<<
"->SetFrameLineStyle("<<frame->
GetLineStyle()<<
");"<<std::endl;
5246 out<<
" "<<cname<<
"->SetFrameLineColor(ci);" << std::endl;
5248 out<<
" "<<cname<<
"->SetFrameLineColor("<<frame->
GetLineColor()<<
");"<<std::endl;
5251 out<<
" "<<cname<<
"->SetFrameLineWidth("<<frame->
GetLineWidth()<<
");"<<std::endl;
5254 out<<
" "<<cname<<
"->SetFrameBorderMode("<<frame->
GetBorderMode()<<
");"<<std::endl;
5257 out<<
" "<<cname<<
"->SetFrameBorderSize("<<frame->
GetBorderSize()<<
");"<<std::endl;
5265 while ((obj = next())) {
5267 if (!strcmp(obj->
GetName(),
"Graph")) ((
TGraph*)obj)->SetName(
Form(
"Graph%d",grnum++));
5270 out<<
" "<<cname<<
"->Modified();"<<std::endl;
5272 if (padsav) padsav->
cd();
5285 Error(
"SetAspectRatio",
"cannot fix aspect ratio, height of pad is 0");
5309 while ((obj = next())) {
5323 if (fstyle == 0) fstyle = 4000;