ROOT logo
// @(#)root/graf:$Id: TBox.cxx 36489 2010-11-03 08:33:25Z brun $
// Author: Rene Brun   12/12/94

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#include <stdlib.h>

#include "Riostream.h"
#include "TROOT.h"
#include "TBox.h"
#include "TVirtualPad.h"
#include "TVirtualX.h"
#include "TClass.h"
#include "TMath.h"


ClassImp(TBox)


//______________________________________________________________________________
/* Begin_Html
<center><h2>Box class</h2></center>
A box is defined by :
<ul>
<li> Its bottom left coordinates x1,y1
<li> Its top right coordinates x2,y2
</ul>
A box has line attributes (see TAttLine) and fill area attributes
(see TAttFill).
End_Html */


//______________________________________________________________________________
TBox::TBox(): TObject(), TAttLine(), TAttFill()
{
   // Box default constructor.

   fTip = 0;
   fX1       = 0.;
   fY1       = 0.;
   fX2       = 0.;
   fY2       = 0.;
   fResizing = kTRUE;
}


//______________________________________________________________________________
TBox::TBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
     : TObject(), TAttLine(), TAttFill()
{
   // Box standard constructor.

   if (x2 >= x1) {fX1  =x1; fX2 = x2;}
   else          {fX1 = x2; fX2 = x1;}
   if (y2 >= y1) {fY1  =y1; fY2 = y2;}
   else          {fY1 = y2; fY2 = y1;}
   fResizing = kFALSE;
   fTip = 0;
}


//______________________________________________________________________________
TBox::~TBox()
{
   // Box destructor.

   if (fTip && gPad) {
      gPad->CloseToolTip(fTip);
      gPad->DeleteToolTip(fTip);
   }
}


//______________________________________________________________________________
TBox::TBox(const TBox &box) : TObject(box), TAttLine(box), TAttFill(box)
{
   // Box copy constructor.

   fX1       = 0.;
   fY1       = 0.;
   fX2       = 0.;
   fY2       = 0.;
   fResizing = kTRUE;
   ((TBox&)box).TBox::Copy(*this);
}


//______________________________________________________________________________
TBox& TBox::operator=(const TBox& b) 
{
   // Assignment operator.

   if(this!=&b) {
      TObject::operator=(b);
      TAttLine::operator=(b);
      TAttFill::operator=(b);
      fTip=b.fTip;
      fX1=b.fX1;
      fY1=b.fY1;
      fX2=b.fX2;
      fY2=b.fY2;
      fResizing=b.fResizing;
   } 
   return *this;
}


//______________________________________________________________________________
void TBox::Copy(TObject &obj) const
{
   // Copy a Box.

   TObject::Copy(obj);
   TAttLine::Copy(((TBox&)obj));
   TAttFill::Copy(((TBox&)obj));
   ((TBox&)obj).fX1 = fX1;
   ((TBox&)obj).fY1 = fY1;
   ((TBox&)obj).fX2 = fX2;
   ((TBox&)obj).fY2 = fY2;
   ((TBox&)obj).fResizing = fResizing;
   ((TBox&)obj).fTip = 0;   //FIXME
}


//______________________________________________________________________________
Int_t TBox::DistancetoPrimitive(Int_t px, Int_t py)
{
   // Compute distance from point px,py to a box.
   //
   // Compute the closest distance of approach from point px,py to the
   // edges of this box.
   // The distance is computed in pixels units.
   //
   // In case of a filled box the distance returned is 0 if the point
   // (px,py) is inside the box, and is huge if the point is outside.

   Int_t pxl, pyl, pxt, pyt;
   Int_t px1 = gPad->XtoAbsPixel(fX1);
   Int_t py1 = gPad->YtoAbsPixel(fY1);
   Int_t px2 = gPad->XtoAbsPixel(fX2);
   Int_t py2 = gPad->YtoAbsPixel(fY2);
   if (px1 < px2) {pxl = px1; pxt = px2;}
   else           {pxl = px2; pxt = px1;}
   if (py1 < py2) {pyl = py1; pyt = py2;}
   else           {pyl = py2; pyt = py1;}

   // Are we inside the box?
   if (GetFillStyle()) {
      if ( (px >= pxl && px <= pxt) && (py >= pyl && py <= pyt) ) return 0;
      else return 9999;
   }

   // Are we on the edges?
   Int_t dxl = TMath::Abs(px - pxl);
   if (py < pyl) dxl += pyl - py; if (py > pyt) dxl += py - pyt;
   Int_t dxt = TMath::Abs(px - pxt);
   if (py < pyl) dxt += pyl - py; if (py > pyt) dxt += py - pyt;
   Int_t dyl = TMath::Abs(py - pyl);
   if (px < pxl) dyl += pxl - px; if (px > pxt) dyl += px - pxt;
   Int_t dyt = TMath::Abs(py - pyt);
   if (px < pxl) dyt += pxl - px; if (px > pxt) dyt += px - pxt;

   Int_t distance = dxl;
   if (dxt < distance) distance = dxt;
   if (dyl < distance) distance = dyl;
   if (dyt < distance) distance = dyt;

   return distance - Int_t(0.5*fLineWidth);
}


//______________________________________________________________________________
void TBox::Draw(Option_t *option)
{
   // Draw this box with its current attributes.
   // if the box has no fill style (ie fill style=0), the box contour is drawn
   // if the box has a fill style, the box contour is not drawn by default.
   // to force the contour to be drawn, specify option "l"

   AppendPad(option);

}


//______________________________________________________________________________
TBox *TBox::DrawBox(Double_t x1, Double_t y1,Double_t x2, Double_t  y2)
{
   // Draw this box with new coordinates.

   TBox *newbox = new TBox(x1,y1,x2,y2);
   TAttLine::Copy(*newbox);
   TAttFill::Copy(*newbox);
   newbox->SetBit(kCanDelete);
   newbox->AppendPad();
   return newbox;
}


//______________________________________________________________________________
void TBox::ExecuteEvent(Int_t event, Int_t px, Int_t py)
{
   // Execute action corresponding to one event.
   //
   //  This member function is called when a BOX/WBOX/PAD object is clicked.
   //
   //  If the mouse is clicked in one of the 4 corners of the box (pA,pB,pC,pD)
   //  the box is resized with the rubber rectangle.
   //
   //  If the mouse is clicked inside the box, the box is moved.
   //
   //  If the mouse is clicked on the 4 edges (pL,pR,pTop,pBot), the box is 
   //  rescaled parallel to this edge (same as Motif window manager).
   //
   //    pA                 pTop                       pB
   //     +--------------------------------------------+
   //     |                                            |
   //     |                                            |
   //     |                                            |
   //   pL|                  pINSIDE                   |pR
   //     |                                            |
   //     |                                            |
   //     |                                            |
   //     |                                            |
   //     +--------------------------------------------+
   //    pD                 pBot                      pC
   //
   //  Note that this function is duplicated on purpose by TPad::ExecuteEvent.
   //  If somebody modifies this function, may be similar changes should also
   //  be applied to TPad::ExecuteEvent.

   if (!gPad) return;
   if (!gPad->IsEditable() && event != kMouseEnter) return;

   if (TestBit(kCannotMove)) return;
   
   const Int_t kMaxDiff = 5;
   const Int_t kMinSize = 20;

   static Int_t px1, px2, py1, py2, pxl, pyl, pxt, pyt, pxold, pyold;
   static Int_t px1p, px2p, py1p, py2p, pxlp, pylp, pxtp, pytp;
   static Bool_t pA, pB, pC, pD, pTop, pL, pR, pBot, pINSIDE;
   Int_t  wx, wy;
   TVirtualPad  *parent = gPad;
   Bool_t doing_again = kFALSE;
   Bool_t opaque  = gPad->OpaqueMoving();
   Bool_t ropaque = gPad->OpaqueResizing();

   HideToolTip(event);

again:

   switch (event) {

   case kMouseEnter:
      if (fTip) gPad->ResetToolTip(fTip);
      break;

   case kButton1Double:
      px1 = -1; //used by kButton1Up
      break;

   case kButton1Down:

      gVirtualX->SetLineColor(-1);
      TAttLine::Modify();  //Change line attributes only if necessary
      if (GetFillColor())
         gVirtualX->SetLineColor(GetFillColor());
      else
         gVirtualX->SetLineColor(1);
      gVirtualX->SetLineWidth(2);

      // No break !!!

   case kMouseMotion:

      px1 = gPad->XtoAbsPixel(GetX1());
      py1 = gPad->YtoAbsPixel(GetY1());
      px2 = gPad->XtoAbsPixel(GetX2());
      py2 = gPad->YtoAbsPixel(GetY2());

      if (px1 < px2) {
         pxl = px1;
         pxt = px2;
      } else {
         pxl = px2;
         pxt = px1;
      }
      if (py1 < py2) {
         pyl = py1;
         pyt = py2;
      } else {
         pyl = py2;
         pyt = py1;
      }

      px1p = parent->XtoAbsPixel(parent->GetX1()) + parent->GetBorderSize();
      py1p = parent->YtoAbsPixel(parent->GetY1()) - parent->GetBorderSize();
      px2p = parent->XtoAbsPixel(parent->GetX2()) - parent->GetBorderSize();
      py2p = parent->YtoAbsPixel(parent->GetY2()) + parent->GetBorderSize();

      if (px1p < px2p) {
         pxlp = px1p;
         pxtp = px2p;
      } else {
         pxlp = px2p;
         pxtp = px1p;
      }
      if (py1p < py2p) {
         pylp = py1p;
         pytp = py2p;
      } else {
         pylp = py2p;
         pytp = py1p;
      }

      pA = pB = pC = pD = pTop = pL = pR = pBot = pINSIDE = kFALSE;

                                                         // case pA
      if (TMath::Abs(px - pxl) <= kMaxDiff && TMath::Abs(py - pyl) <= kMaxDiff) {
         pxold = pxl; pyold = pyl; pA = kTRUE;
         gPad->SetCursor(kTopLeft);
      }
                                                         // case pB
      if (TMath::Abs(px - pxt) <= kMaxDiff && TMath::Abs(py - pyl) <= kMaxDiff) {
         pxold = pxt; pyold = pyl; pB = kTRUE;
         gPad->SetCursor(kTopRight);
      }
                                                         // case pC
      if (TMath::Abs(px - pxt) <= kMaxDiff && TMath::Abs(py - pyt) <= kMaxDiff) {
         pxold = pxt; pyold = pyt; pC = kTRUE;
         gPad->SetCursor(kBottomRight);
      }
                                                         // case pD
      if (TMath::Abs(px - pxl) <= kMaxDiff && TMath::Abs(py - pyt) <= kMaxDiff) {
         pxold = pxl; pyold = pyt; pD = kTRUE;
         gPad->SetCursor(kBottomLeft);
      }

      if ((px > pxl+kMaxDiff && px < pxt-kMaxDiff) &&
          TMath::Abs(py - pyl) < kMaxDiff) {             // top edge
         pxold = pxl; pyold = pyl; pTop = kTRUE;
         gPad->SetCursor(kTopSide);
      }

      if ((px > pxl+kMaxDiff && px < pxt-kMaxDiff) &&
          TMath::Abs(py - pyt) < kMaxDiff) {             // bottom edge
         pxold = pxt; pyold = pyt; pBot = kTRUE;
         gPad->SetCursor(kBottomSide);
      }

      if ((py > pyl+kMaxDiff && py < pyt-kMaxDiff) &&
          TMath::Abs(px - pxl) < kMaxDiff) {             // left edge
         pxold = pxl; pyold = pyl; pL = kTRUE;
         gPad->SetCursor(kLeftSide);
      }

      if ((py > pyl+kMaxDiff && py < pyt-kMaxDiff) &&
          TMath::Abs(px - pxt) < kMaxDiff) {             // right edge
         pxold = pxt; pyold = pyt; pR = kTRUE;
         gPad->SetCursor(kRightSide);
      }

      if ((px > pxl+kMaxDiff && px < pxt-kMaxDiff) &&
          (py > pyl+kMaxDiff && py < pyt-kMaxDiff)) {    // inside box
         pxold = px; pyold = py; pINSIDE = kTRUE;
         if (event == kButton1Down)
            gPad->SetCursor(kMove);
         else
            gPad->SetCursor(kCross);
      }

      fResizing = kFALSE;
      if (pA || pB || pC || pD || pTop || pL || pR || pBot)
         fResizing = kTRUE;

      if (!pA && !pB && !pC && !pD && !pTop && !pL && !pR && !pBot && !pINSIDE)
         gPad->SetCursor(kCross);

      break;

   case kButton1Motion:

      wx = wy = 0;

      if (pA) {
         if (!ropaque) gVirtualX->DrawBox(pxold, pyt, pxt, pyold, TVirtualX::kHollow);  // draw the old box
         if (px > pxt-kMinSize) { px = pxt-kMinSize; wx = px; }
         if (py > pyt-kMinSize) { py = pyt-kMinSize; wy = py; }
         if (px < pxlp) { px = pxlp; wx = px; }
         if (py < pylp) { py = pylp; wy = py; }
         if (!ropaque) gVirtualX->DrawBox(px   , pyt, pxt, py,    TVirtualX::kHollow);  // draw the new box
      }
      if (pB) {
         if (!ropaque) gVirtualX->DrawBox(pxl  , pyt, pxold, pyold, TVirtualX::kHollow);
         if (px < pxl+kMinSize) { px = pxl+kMinSize; wx = px; }
         if (py > pyt-kMinSize) { py = pyt-kMinSize; wy = py; }
         if (px > pxtp) { px = pxtp; wx = px; }
         if (py < pylp) { py = pylp; wy = py; }
         if (!ropaque) gVirtualX->DrawBox(pxl  , pyt, px ,  py,    TVirtualX::kHollow);
      }
      if (pC) {
         if (!ropaque) gVirtualX->DrawBox(pxl  , pyl, pxold, pyold, TVirtualX::kHollow);
         if (px < pxl+kMinSize) { px = pxl+kMinSize; wx = px; }
         if (py < pyl+kMinSize) { py = pyl+kMinSize; wy = py; }
         if (px > pxtp) { px = pxtp; wx = px; }
         if (py > pytp) { py = pytp; wy = py; }
         if (!ropaque) gVirtualX->DrawBox(pxl  , pyl, px ,   py,    TVirtualX::kHollow);
      }
      if (pD) {
         if (!ropaque) gVirtualX->DrawBox(pxold, pyold, pxt, pyl, TVirtualX::kHollow);
         if (px > pxt-kMinSize) { px = pxt-kMinSize; wx = px; }
         if (py < pyl+kMinSize) { py = pyl+kMinSize; wy = py; }
         if (px < pxlp) { px = pxlp; wx = px; }
         if (py > pytp) { py = pytp; wy = py; }
         if (!ropaque) gVirtualX->DrawBox(px   , py ,   pxt, pyl, TVirtualX::kHollow);
      }
      if (pTop) {
         if (!ropaque) gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
         py2 += py - pyold;
         if (py2 > py1-kMinSize) { py2 = py1-kMinSize; wy = py2; }
         if (py2 < py2p) { py2 = py2p; wy = py2; }
         if (!ropaque) gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
      }
      if (pBot) {
         if (!ropaque) gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
         py1 += py - pyold;
         if (py1 < py2+kMinSize) { py1 = py2+kMinSize; wy = py1; }
         if (py1 > py1p) { py1 = py1p; wy = py1; }
         if (!ropaque) gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
      }
      if (pL) {
         if (!ropaque) gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
         px1 += px - pxold;
         if (px1 > px2-kMinSize) { px1 = px2-kMinSize; wx = px1; }
         if (px1 < px1p) { px1 = px1p; wx = px1; }
         if (!ropaque) gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
      }
      if (pR) {
         if (!ropaque) gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
         px2 += px - pxold;
         if (px2 < px1+kMinSize) { px2 = px1+kMinSize; wx = px2; }
         if (px2 > px2p) { px2 = px2p; wx = px2; }
         if (!ropaque) gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);
      }
      if (pINSIDE) {
         if (!opaque) gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);  // draw the old box
         Int_t dx = px - pxold;
         Int_t dy = py - pyold;
         px1 += dx; py1 += dy; px2 += dx; py2 += dy;
         if (px1 < px1p) { dx = px1p - px1; px1 += dx; px2 += dx; wx = px+dx; }
         if (px2 > px2p) { dx = px2 - px2p; px1 -= dx; px2 -= dx; wx = px-dx; }
         if (py1 > py1p) { dy = py1 - py1p; py1 -= dy; py2 -= dy; wy = py-dy; }
         if (py2 < py2p) { dy = py2p - py2; py1 += dy; py2 += dy; wy = py+dy; }
         if (!opaque) gVirtualX->DrawBox(px1, py1, px2, py2, TVirtualX::kHollow);  // draw the new box
      }

      if (wx || wy) {
         if (wx) px = wx;
         if (wy) py = wy;
         gVirtualX->Warp(px, py);
      }

      pxold = px;
      pyold = py;

      if ((pINSIDE && opaque) || (fResizing && ropaque)) {
         event = kButton1Up;
         doing_again = kTRUE;
         goto again;
      }

      break;

   case kButton1Up:
      if (gROOT->IsEscaped()) {
         gROOT->SetEscape(kFALSE);
         break;
      }

      if (px1 < 0 ) break;
      if (pA) {
         fX1 = gPad->AbsPixeltoX(pxold);
         fY1 = gPad->AbsPixeltoY(pyt);
         fX2 = gPad->AbsPixeltoX(pxt);
         fY2 = gPad->AbsPixeltoY(pyold);
      }
      if (pB) {
         fX1 = gPad->AbsPixeltoX(pxl);
         fY1 = gPad->AbsPixeltoY(pyt);
         fX2 = gPad->AbsPixeltoX(pxold);
         fY2 = gPad->AbsPixeltoY(pyold);
      }
      if (pC) {
         fX1 = gPad->AbsPixeltoX(pxl);
         fY1 = gPad->AbsPixeltoY(pyold);
         fX2 = gPad->AbsPixeltoX(pxold);
         fY2 = gPad->AbsPixeltoY(pyl);
      }
      if (pD) {
         fX1 = gPad->AbsPixeltoX(pxold);
         fY1 = gPad->AbsPixeltoY(pyold);
         fX2 = gPad->AbsPixeltoX(pxt);
         fY2 = gPad->AbsPixeltoY(pyl);
      }
      if (pTop || pBot || pL || pR || pINSIDE) {
         fX1 = gPad->AbsPixeltoX(px1);
         fY1 = gPad->AbsPixeltoY(py1);
         fX2 = gPad->AbsPixeltoX(px2);
         fY2 = gPad->AbsPixeltoY(py2);
      }

      if (pINSIDE) {
         // if it was not a pad that was moved then it must have been
         // a box or something like that so we have to redraw the pad
         if (parent == gPad) gPad->Modified(kTRUE);
         if (!doing_again) gPad->SetCursor(kCross);
      }

      if (pA || pB || pC || pD || pTop || pL || pR || pBot)
         gPad->Modified(kTRUE);

      gVirtualX->SetLineColor(-1);
      gVirtualX->SetLineWidth(-1);

      break;

   case kButton1Locate:

      ExecuteEvent(kButton1Down, px, py);

      while (1) {
         px = py = 0;
         event = gVirtualX->RequestLocator(1, 1, px, py);

         ExecuteEvent(kButton1Motion, px, py);

         if (event != -1) {                     // button is released
            ExecuteEvent(kButton1Up, px, py);
            return;
         }
      }
   }
}


//______________________________________________________________________________
void TBox::HideToolTip(Int_t event)
{
   // Hide tool tip depending on the event type. Typically tool tips
   // are hidden when event is not a kMouseEnter and not a kMouseMotion
   // event.

   if (event != kMouseEnter && event != kMouseMotion && fTip && gPad)
      gPad->CloseToolTip(fTip);
}


//______________________________________________________________________________
Int_t TBox::IsInside(Double_t x, Double_t y) const
{
   // Function which returns 1 if point x,y lies inside the box, 0 otherwise.
   
   if (x < fX1 || x > fX2) return 0;
   if (y < fY1 || y > fY2) return 0;
   return 1;
}


//______________________________________________________________________________
void TBox::ls(Option_t *) const
{
   // List this box with its attributes.

   TROOT::IndentLevel();
   printf("%s  X1= %f Y1=%f X2=%f Y2=%f\n",IsA()->GetName(),fX1,fY1,fX2,fY2);
}


//______________________________________________________________________________
void TBox::Paint(Option_t *option)
{
   // Paint this box with its current attributes.

   PaintBox(gPad->XtoPad(fX1),gPad->YtoPad(fY1),gPad->XtoPad(fX2),gPad->YtoPad(fY2),option);
}


//______________________________________________________________________________
void TBox::PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option)
{
   // Draw this box with new coordinates.

   TAttLine::Modify();  //Change line attributes only if necessary
   TAttFill::Modify();  //Change fill area attributes only if necessary

   if (option) {
      TString opt = option;
      opt.ToLower();
      if (opt.Contains("l")) gPad->PaintBox(x1,y1,x2,y2,"l");
      else                   gPad->PaintBox(x1,y1,x2,y2);
   } else {
      gPad->PaintBox(x1,y1,x2,y2);
   }
}


//______________________________________________________________________________
void TBox::Print(Option_t *) const
{
   // Dump this box with its attributes.

   printf("%s  X1=%f Y1=%f X2=%f Y2=%f",IsA()->GetName(),fX1,fY1,fX2,fY2);
   if (GetLineColor() != 1) printf(" Color=%d",GetLineColor());
   if (GetLineStyle() != 1) printf(" Style=%d",GetLineStyle());
   if (GetLineWidth() != 1) printf(" Width=%d",GetLineWidth());
   if (GetFillColor() != 0) printf(" FillColor=%d",GetFillColor());
   if (GetFillStyle() != 0) printf(" FillStyle=%d",GetFillStyle());
   printf("\n");
}


//______________________________________________________________________________
void TBox::SavePrimitive(ostream &out, Option_t * /*= ""*/)
{
   // Save primitive as a C++ statement(s) on output stream out

   if (gROOT->ClassSaved(TBox::Class())) {
      out<<"   ";
   } else {
      out<<"   TBox *";
   }
   out<<"box = new TBox("<<fX1<<","<<fY1<<","<<fX2<<","<<fY2<<");"<<endl;

   SaveFillAttributes(out,"box",0,1001);
   SaveLineAttributes(out,"box",1,1,1);

   out<<"   box->Draw();"<<endl;
}


//______________________________________________________________________________
void TBox::SetToolTipText(const char *text, Long_t delayms)
{
   // Set tool tip text associated with this box. The delay is in
   // milliseconds (minimum 250). To remove tool tip call method with
   // text = 0.

   if (!gPad) {
      Warning("SetToolTipText", "a canvas must exist before setting the tool tip text");
      return;
   }

   if (fTip) {
      gPad->DeleteToolTip(fTip);
      fTip = 0;
   }

   if (text && strlen(text))
      fTip = gPad->CreateToolTip(this, text, delayms);
}


//______________________________________________________________________________
void TBox::Streamer(TBuffer &R__b)
{
   // Stream an object of class TBox.

   if (R__b.IsReading()) {
      UInt_t R__s, R__c;
      Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
      if (R__v > 1) {
         R__b.ReadClassBuffer(TBox::Class(), this, R__v, R__s, R__c);
         return;
      }
      //====process old versions before automatic schema evolution
      TObject::Streamer(R__b);
      TAttLine::Streamer(R__b);
      TAttFill::Streamer(R__b);
      Float_t x1,y1,x2,y2;
      R__b >> x1; fX1 = x1;
      R__b >> y1; fY1 = y1;
      R__b >> x2; fX2 = x2;
      R__b >> y2; fY2 = y2;
      R__b.CheckByteCount(R__s, R__c, TBox::IsA());
      //====end of old versions

   } else {
      R__b.WriteClassBuffer(TBox::Class(),this);
   }
}
 TBox.cxx:1
 TBox.cxx:2
 TBox.cxx:3
 TBox.cxx:4
 TBox.cxx:5
 TBox.cxx:6
 TBox.cxx:7
 TBox.cxx:8
 TBox.cxx:9
 TBox.cxx:10
 TBox.cxx:11
 TBox.cxx:12
 TBox.cxx:13
 TBox.cxx:14
 TBox.cxx:15
 TBox.cxx:16
 TBox.cxx:17
 TBox.cxx:18
 TBox.cxx:19
 TBox.cxx:20
 TBox.cxx:21
 TBox.cxx:22
 TBox.cxx:23
 TBox.cxx:24
 TBox.cxx:25
 TBox.cxx:26
 TBox.cxx:27
 TBox.cxx:28
 TBox.cxx:29
 TBox.cxx:30
 TBox.cxx:31
 TBox.cxx:32
 TBox.cxx:33
 TBox.cxx:34
 TBox.cxx:35
 TBox.cxx:36
 TBox.cxx:37
 TBox.cxx:38
 TBox.cxx:39
 TBox.cxx:40
 TBox.cxx:41
 TBox.cxx:42
 TBox.cxx:43
 TBox.cxx:44
 TBox.cxx:45
 TBox.cxx:46
 TBox.cxx:47
 TBox.cxx:48
 TBox.cxx:49
 TBox.cxx:50
 TBox.cxx:51
 TBox.cxx:52
 TBox.cxx:53
 TBox.cxx:54
 TBox.cxx:55
 TBox.cxx:56
 TBox.cxx:57
 TBox.cxx:58
 TBox.cxx:59
 TBox.cxx:60
 TBox.cxx:61
 TBox.cxx:62
 TBox.cxx:63
 TBox.cxx:64
 TBox.cxx:65
 TBox.cxx:66
 TBox.cxx:67
 TBox.cxx:68
 TBox.cxx:69
 TBox.cxx:70
 TBox.cxx:71
 TBox.cxx:72
 TBox.cxx:73
 TBox.cxx:74
 TBox.cxx:75
 TBox.cxx:76
 TBox.cxx:77
 TBox.cxx:78
 TBox.cxx:79
 TBox.cxx:80
 TBox.cxx:81
 TBox.cxx:82
 TBox.cxx:83
 TBox.cxx:84
 TBox.cxx:85
 TBox.cxx:86
 TBox.cxx:87
 TBox.cxx:88
 TBox.cxx:89
 TBox.cxx:90
 TBox.cxx:91
 TBox.cxx:92
 TBox.cxx:93
 TBox.cxx:94
 TBox.cxx:95
 TBox.cxx:96
 TBox.cxx:97
 TBox.cxx:98
 TBox.cxx:99
 TBox.cxx:100
 TBox.cxx:101
 TBox.cxx:102
 TBox.cxx:103
 TBox.cxx:104
 TBox.cxx:105
 TBox.cxx:106
 TBox.cxx:107
 TBox.cxx:108
 TBox.cxx:109
 TBox.cxx:110
 TBox.cxx:111
 TBox.cxx:112
 TBox.cxx:113
 TBox.cxx:114
 TBox.cxx:115
 TBox.cxx:116
 TBox.cxx:117
 TBox.cxx:118
 TBox.cxx:119
 TBox.cxx:120
 TBox.cxx:121
 TBox.cxx:122
 TBox.cxx:123
 TBox.cxx:124
 TBox.cxx:125
 TBox.cxx:126
 TBox.cxx:127
 TBox.cxx:128
 TBox.cxx:129
 TBox.cxx:130
 TBox.cxx:131
 TBox.cxx:132
 TBox.cxx:133
 TBox.cxx:134
 TBox.cxx:135
 TBox.cxx:136
 TBox.cxx:137
 TBox.cxx:138
 TBox.cxx:139
 TBox.cxx:140
 TBox.cxx:141
 TBox.cxx:142
 TBox.cxx:143
 TBox.cxx:144
 TBox.cxx:145
 TBox.cxx:146
 TBox.cxx:147
 TBox.cxx:148
 TBox.cxx:149
 TBox.cxx:150
 TBox.cxx:151
 TBox.cxx:152
 TBox.cxx:153
 TBox.cxx:154
 TBox.cxx:155
 TBox.cxx:156
 TBox.cxx:157
 TBox.cxx:158
 TBox.cxx:159
 TBox.cxx:160
 TBox.cxx:161
 TBox.cxx:162
 TBox.cxx:163
 TBox.cxx:164
 TBox.cxx:165
 TBox.cxx:166
 TBox.cxx:167
 TBox.cxx:168
 TBox.cxx:169
 TBox.cxx:170
 TBox.cxx:171
 TBox.cxx:172
 TBox.cxx:173
 TBox.cxx:174
 TBox.cxx:175
 TBox.cxx:176
 TBox.cxx:177
 TBox.cxx:178
 TBox.cxx:179
 TBox.cxx:180
 TBox.cxx:181
 TBox.cxx:182
 TBox.cxx:183
 TBox.cxx:184
 TBox.cxx:185
 TBox.cxx:186
 TBox.cxx:187
 TBox.cxx:188
 TBox.cxx:189
 TBox.cxx:190
 TBox.cxx:191
 TBox.cxx:192
 TBox.cxx:193
 TBox.cxx:194
 TBox.cxx:195
 TBox.cxx:196
 TBox.cxx:197
 TBox.cxx:198
 TBox.cxx:199
 TBox.cxx:200
 TBox.cxx:201
 TBox.cxx:202
 TBox.cxx:203
 TBox.cxx:204
 TBox.cxx:205
 TBox.cxx:206
 TBox.cxx:207
 TBox.cxx:208
 TBox.cxx:209
 TBox.cxx:210
 TBox.cxx:211
 TBox.cxx:212
 TBox.cxx:213
 TBox.cxx:214
 TBox.cxx:215
 TBox.cxx:216
 TBox.cxx:217
 TBox.cxx:218
 TBox.cxx:219
 TBox.cxx:220
 TBox.cxx:221
 TBox.cxx:222
 TBox.cxx:223
 TBox.cxx:224
 TBox.cxx:225
 TBox.cxx:226
 TBox.cxx:227
 TBox.cxx:228
 TBox.cxx:229
 TBox.cxx:230
 TBox.cxx:231
 TBox.cxx:232
 TBox.cxx:233
 TBox.cxx:234
 TBox.cxx:235
 TBox.cxx:236
 TBox.cxx:237
 TBox.cxx:238
 TBox.cxx:239
 TBox.cxx:240
 TBox.cxx:241
 TBox.cxx:242
 TBox.cxx:243
 TBox.cxx:244
 TBox.cxx:245
 TBox.cxx:246
 TBox.cxx:247
 TBox.cxx:248
 TBox.cxx:249
 TBox.cxx:250
 TBox.cxx:251
 TBox.cxx:252
 TBox.cxx:253
 TBox.cxx:254
 TBox.cxx:255
 TBox.cxx:256
 TBox.cxx:257
 TBox.cxx:258
 TBox.cxx:259
 TBox.cxx:260
 TBox.cxx:261
 TBox.cxx:262
 TBox.cxx:263
 TBox.cxx:264
 TBox.cxx:265
 TBox.cxx:266
 TBox.cxx:267
 TBox.cxx:268
 TBox.cxx:269
 TBox.cxx:270
 TBox.cxx:271
 TBox.cxx:272
 TBox.cxx:273
 TBox.cxx:274
 TBox.cxx:275
 TBox.cxx:276
 TBox.cxx:277
 TBox.cxx:278
 TBox.cxx:279
 TBox.cxx:280
 TBox.cxx:281
 TBox.cxx:282
 TBox.cxx:283
 TBox.cxx:284
 TBox.cxx:285
 TBox.cxx:286
 TBox.cxx:287
 TBox.cxx:288
 TBox.cxx:289
 TBox.cxx:290
 TBox.cxx:291
 TBox.cxx:292
 TBox.cxx:293
 TBox.cxx:294
 TBox.cxx:295
 TBox.cxx:296
 TBox.cxx:297
 TBox.cxx:298
 TBox.cxx:299
 TBox.cxx:300
 TBox.cxx:301
 TBox.cxx:302
 TBox.cxx:303
 TBox.cxx:304
 TBox.cxx:305
 TBox.cxx:306
 TBox.cxx:307
 TBox.cxx:308
 TBox.cxx:309
 TBox.cxx:310
 TBox.cxx:311
 TBox.cxx:312
 TBox.cxx:313
 TBox.cxx:314
 TBox.cxx:315
 TBox.cxx:316
 TBox.cxx:317
 TBox.cxx:318
 TBox.cxx:319
 TBox.cxx:320
 TBox.cxx:321
 TBox.cxx:322
 TBox.cxx:323
 TBox.cxx:324
 TBox.cxx:325
 TBox.cxx:326
 TBox.cxx:327
 TBox.cxx:328
 TBox.cxx:329
 TBox.cxx:330
 TBox.cxx:331
 TBox.cxx:332
 TBox.cxx:333
 TBox.cxx:334
 TBox.cxx:335
 TBox.cxx:336
 TBox.cxx:337
 TBox.cxx:338
 TBox.cxx:339
 TBox.cxx:340
 TBox.cxx:341
 TBox.cxx:342
 TBox.cxx:343
 TBox.cxx:344
 TBox.cxx:345
 TBox.cxx:346
 TBox.cxx:347
 TBox.cxx:348
 TBox.cxx:349
 TBox.cxx:350
 TBox.cxx:351
 TBox.cxx:352
 TBox.cxx:353
 TBox.cxx:354
 TBox.cxx:355
 TBox.cxx:356
 TBox.cxx:357
 TBox.cxx:358
 TBox.cxx:359
 TBox.cxx:360
 TBox.cxx:361
 TBox.cxx:362
 TBox.cxx:363
 TBox.cxx:364
 TBox.cxx:365
 TBox.cxx:366
 TBox.cxx:367
 TBox.cxx:368
 TBox.cxx:369
 TBox.cxx:370
 TBox.cxx:371
 TBox.cxx:372
 TBox.cxx:373
 TBox.cxx:374
 TBox.cxx:375
 TBox.cxx:376
 TBox.cxx:377
 TBox.cxx:378
 TBox.cxx:379
 TBox.cxx:380
 TBox.cxx:381
 TBox.cxx:382
 TBox.cxx:383
 TBox.cxx:384
 TBox.cxx:385
 TBox.cxx:386
 TBox.cxx:387
 TBox.cxx:388
 TBox.cxx:389
 TBox.cxx:390
 TBox.cxx:391
 TBox.cxx:392
 TBox.cxx:393
 TBox.cxx:394
 TBox.cxx:395
 TBox.cxx:396
 TBox.cxx:397
 TBox.cxx:398
 TBox.cxx:399
 TBox.cxx:400
 TBox.cxx:401
 TBox.cxx:402
 TBox.cxx:403
 TBox.cxx:404
 TBox.cxx:405
 TBox.cxx:406
 TBox.cxx:407
 TBox.cxx:408
 TBox.cxx:409
 TBox.cxx:410
 TBox.cxx:411
 TBox.cxx:412
 TBox.cxx:413
 TBox.cxx:414
 TBox.cxx:415
 TBox.cxx:416
 TBox.cxx:417
 TBox.cxx:418
 TBox.cxx:419
 TBox.cxx:420
 TBox.cxx:421
 TBox.cxx:422
 TBox.cxx:423
 TBox.cxx:424
 TBox.cxx:425
 TBox.cxx:426
 TBox.cxx:427
 TBox.cxx:428
 TBox.cxx:429
 TBox.cxx:430
 TBox.cxx:431
 TBox.cxx:432
 TBox.cxx:433
 TBox.cxx:434
 TBox.cxx:435
 TBox.cxx:436
 TBox.cxx:437
 TBox.cxx:438
 TBox.cxx:439
 TBox.cxx:440
 TBox.cxx:441
 TBox.cxx:442
 TBox.cxx:443
 TBox.cxx:444
 TBox.cxx:445
 TBox.cxx:446
 TBox.cxx:447
 TBox.cxx:448
 TBox.cxx:449
 TBox.cxx:450
 TBox.cxx:451
 TBox.cxx:452
 TBox.cxx:453
 TBox.cxx:454
 TBox.cxx:455
 TBox.cxx:456
 TBox.cxx:457
 TBox.cxx:458
 TBox.cxx:459
 TBox.cxx:460
 TBox.cxx:461
 TBox.cxx:462
 TBox.cxx:463
 TBox.cxx:464
 TBox.cxx:465
 TBox.cxx:466
 TBox.cxx:467
 TBox.cxx:468
 TBox.cxx:469
 TBox.cxx:470
 TBox.cxx:471
 TBox.cxx:472
 TBox.cxx:473
 TBox.cxx:474
 TBox.cxx:475
 TBox.cxx:476
 TBox.cxx:477
 TBox.cxx:478
 TBox.cxx:479
 TBox.cxx:480
 TBox.cxx:481
 TBox.cxx:482
 TBox.cxx:483
 TBox.cxx:484
 TBox.cxx:485
 TBox.cxx:486
 TBox.cxx:487
 TBox.cxx:488
 TBox.cxx:489
 TBox.cxx:490
 TBox.cxx:491
 TBox.cxx:492
 TBox.cxx:493
 TBox.cxx:494
 TBox.cxx:495
 TBox.cxx:496
 TBox.cxx:497
 TBox.cxx:498
 TBox.cxx:499
 TBox.cxx:500
 TBox.cxx:501
 TBox.cxx:502
 TBox.cxx:503
 TBox.cxx:504
 TBox.cxx:505
 TBox.cxx:506
 TBox.cxx:507
 TBox.cxx:508
 TBox.cxx:509
 TBox.cxx:510
 TBox.cxx:511
 TBox.cxx:512
 TBox.cxx:513
 TBox.cxx:514
 TBox.cxx:515
 TBox.cxx:516
 TBox.cxx:517
 TBox.cxx:518
 TBox.cxx:519
 TBox.cxx:520
 TBox.cxx:521
 TBox.cxx:522
 TBox.cxx:523
 TBox.cxx:524
 TBox.cxx:525
 TBox.cxx:526
 TBox.cxx:527
 TBox.cxx:528
 TBox.cxx:529
 TBox.cxx:530
 TBox.cxx:531
 TBox.cxx:532
 TBox.cxx:533
 TBox.cxx:534
 TBox.cxx:535
 TBox.cxx:536
 TBox.cxx:537
 TBox.cxx:538
 TBox.cxx:539
 TBox.cxx:540
 TBox.cxx:541
 TBox.cxx:542
 TBox.cxx:543
 TBox.cxx:544
 TBox.cxx:545
 TBox.cxx:546
 TBox.cxx:547
 TBox.cxx:548
 TBox.cxx:549
 TBox.cxx:550
 TBox.cxx:551
 TBox.cxx:552
 TBox.cxx:553
 TBox.cxx:554
 TBox.cxx:555
 TBox.cxx:556
 TBox.cxx:557
 TBox.cxx:558
 TBox.cxx:559
 TBox.cxx:560
 TBox.cxx:561
 TBox.cxx:562
 TBox.cxx:563
 TBox.cxx:564
 TBox.cxx:565
 TBox.cxx:566
 TBox.cxx:567
 TBox.cxx:568
 TBox.cxx:569
 TBox.cxx:570
 TBox.cxx:571
 TBox.cxx:572
 TBox.cxx:573
 TBox.cxx:574
 TBox.cxx:575
 TBox.cxx:576
 TBox.cxx:577
 TBox.cxx:578
 TBox.cxx:579
 TBox.cxx:580
 TBox.cxx:581
 TBox.cxx:582
 TBox.cxx:583
 TBox.cxx:584
 TBox.cxx:585
 TBox.cxx:586
 TBox.cxx:587
 TBox.cxx:588
 TBox.cxx:589
 TBox.cxx:590
 TBox.cxx:591
 TBox.cxx:592
 TBox.cxx:593
 TBox.cxx:594
 TBox.cxx:595
 TBox.cxx:596
 TBox.cxx:597
 TBox.cxx:598
 TBox.cxx:599
 TBox.cxx:600
 TBox.cxx:601
 TBox.cxx:602
 TBox.cxx:603
 TBox.cxx:604
 TBox.cxx:605
 TBox.cxx:606
 TBox.cxx:607
 TBox.cxx:608
 TBox.cxx:609
 TBox.cxx:610
 TBox.cxx:611
 TBox.cxx:612
 TBox.cxx:613
 TBox.cxx:614
 TBox.cxx:615
 TBox.cxx:616
 TBox.cxx:617
 TBox.cxx:618
 TBox.cxx:619
 TBox.cxx:620
 TBox.cxx:621
 TBox.cxx:622
 TBox.cxx:623
 TBox.cxx:624
 TBox.cxx:625
 TBox.cxx:626
 TBox.cxx:627
 TBox.cxx:628
 TBox.cxx:629
 TBox.cxx:630
 TBox.cxx:631
 TBox.cxx:632
 TBox.cxx:633
 TBox.cxx:634
 TBox.cxx:635
 TBox.cxx:636
 TBox.cxx:637
 TBox.cxx:638
 TBox.cxx:639
 TBox.cxx:640
 TBox.cxx:641
 TBox.cxx:642
 TBox.cxx:643
 TBox.cxx:644
 TBox.cxx:645
 TBox.cxx:646
 TBox.cxx:647
 TBox.cxx:648
 TBox.cxx:649
 TBox.cxx:650
 TBox.cxx:651
 TBox.cxx:652
 TBox.cxx:653
 TBox.cxx:654
 TBox.cxx:655
 TBox.cxx:656
 TBox.cxx:657
 TBox.cxx:658
 TBox.cxx:659
 TBox.cxx:660
 TBox.cxx:661
 TBox.cxx:662
 TBox.cxx:663
 TBox.cxx:664
 TBox.cxx:665
 TBox.cxx:666
 TBox.cxx:667
 TBox.cxx:668
 TBox.cxx:669
 TBox.cxx:670
 TBox.cxx:671
 TBox.cxx:672
 TBox.cxx:673
 TBox.cxx:674
 TBox.cxx:675
 TBox.cxx:676
 TBox.cxx:677
 TBox.cxx:678
 TBox.cxx:679
 TBox.cxx:680
 TBox.cxx:681
 TBox.cxx:682
 TBox.cxx:683
 TBox.cxx:684
 TBox.cxx:685
 TBox.cxx:686
 TBox.cxx:687
 TBox.cxx:688
 TBox.cxx:689
 TBox.cxx:690
 TBox.cxx:691
 TBox.cxx:692
 TBox.cxx:693
 TBox.cxx:694
 TBox.cxx:695
 TBox.cxx:696