ROOT logo
// @(#)root/gui:$Id: TGGC.cxx 23115 2008-04-10 13:35:37Z rdm $
// Author: Fons Rademakers   20/9/2000

/*************************************************************************
 * 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.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGGC and TGGCPool                                                    //
//                                                                      //
// Encapsulate a graphics context used in the low level graphics.       //
// TGGCPool provides a pool of graphics contexts.                       //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TGClient.h"
#include "TGGC.h"
#include "TVirtualX.h"
#include "THashTable.h"
#include "TColor.h"
#include "TROOT.h"
#include "Riostream.h"
#include <string.h>


ClassImp(TGGC)

//______________________________________________________________________________
TGGC::TGGC(GCValues_t *values, Bool_t)
{
   // Create a graphics context (only called via TGGCPool::GetGC()).

   if (values) {
      fValues = *values;
      fContext = gVirtualX->CreateGC(gVirtualX->GetDefaultRootWindow(), values);
      if (values->fMask & kGCDashList) {
         if (values->fDashLen > (Int_t)sizeof(fValues.fDashes))
            Warning("TGGC", "dash list can have only up to %d elements",
                    sizeof(fValues.fDashes));
         fValues.fDashLen = TMath::Min(values->fDashLen, (Int_t)sizeof(fValues.fDashes));
         gVirtualX->SetDashes(fContext, fValues.fDashOffset, fValues.fDashes,
                              fValues.fDashLen);
      }
   } else {
      memset(&fValues, 0, sizeof(GCValues_t));
      fContext = 0;
   }
   SetRefCount(1);
}

//______________________________________________________________________________
TGGC::TGGC(GCValues_t *values)
{
   // Create a graphics context, registers GC in GCPool.

   // case of default ctor at program startup before gClient exists
   if (!values) {
      memset(&fValues, 0, sizeof(GCValues_t));
      fContext = 0;
      SetRefCount(1);
      return;
   }

   if (gClient)
      gClient->GetGC(values, kTRUE);
   else {
      fContext = 0;
      Error("TGGC", "TGClient not yet initialized, should never happen");
   }
}

//______________________________________________________________________________
TGGC::TGGC(const TGGC &g) : TObject(g), TRefCnt()
{
   // Copy a graphics context.

   fValues = g.fValues;
   if (g.fContext) {
      fContext = gVirtualX->CreateGC(gVirtualX->GetDefaultRootWindow(), &fValues);
      if (fValues.fMask & kGCDashList)
         gVirtualX->SetDashes(fContext, fValues.fDashOffset, fValues.fDashes,
                              fValues.fDashLen);
   } else
      fContext = 0;
   SetRefCount(1);

   if (gClient)
      gClient->GetGCPool()->fList->Add(this);
}

//______________________________________________________________________________
TGGC::~TGGC()
{
   // Delete graphics context.

   if (gClient)
      gClient->GetGCPool()->ForceFreeGC(this);

   if (fContext)
      gVirtualX->DeleteGC(fContext);
}

//______________________________________________________________________________
TGGC &TGGC::operator=(const TGGC &rhs)
{
   // Graphics context assignment operator.

   if (this != &rhs) {
      if (!fContext && gClient) {
         TGGC *gc = gClient->GetGCPool()->FindGC(this);
         if (!gc)
            gClient->GetGCPool()->fList->Add(this);
      }
      if (fContext)
         gVirtualX->DeleteGC(fContext);
      TObject::operator=(rhs);
      fValues  = rhs.fValues;
      fContext = gVirtualX->CreateGC(gVirtualX->GetDefaultRootWindow(), &fValues);
      if (fValues.fMask & kGCDashList)
         gVirtualX->SetDashes(fContext, fValues.fDashOffset, fValues.fDashes,
                              fValues.fDashLen);
   }
   return *this;
}

//______________________________________________________________________________
GContext_t TGGC::operator()() const
{
   // Not inline due to a bug in g++ 2.96 20000731 (Red Hat Linux 7.0).

   return fContext;
}

//______________________________________________________________________________
void TGGC::UpdateValues(GCValues_t *values)
{
   // Update values + mask.

   fValues.fMask |= values->fMask;

   for (Mask_t bit = 1; bit <= fValues.fMask; bit <<= 1) {
      switch (bit & values->fMask) {
         default:
         case 0:
            continue;
         case kGCFunction:
            fValues.fFunction = values->fFunction;
            break;
         case kGCPlaneMask:
            fValues.fPlaneMask = values->fPlaneMask;
            break;
         case kGCForeground:
            fValues.fForeground = values->fForeground;
            break;
         case kGCBackground:
            fValues.fBackground = values->fBackground;
            break;
         case kGCLineWidth:
            fValues.fLineWidth = values->fLineWidth;
            break;
         case kGCLineStyle:
            fValues.fLineStyle = values->fLineStyle;
            break;
         case kGCCapStyle:
            fValues.fCapStyle = values->fCapStyle;
            break;
         case kGCJoinStyle:
            fValues.fJoinStyle = values->fJoinStyle;
            break;
         case kGCFillStyle:
            fValues.fFillStyle = values->fFillStyle;
            break;
         case kGCFillRule:
            fValues.fFillRule = values->fFillRule;
            break;
         case kGCTile:
            fValues.fTile = values->fTile;
            break;
         case kGCStipple:
            fValues.fStipple = values->fStipple;
            break;
         case kGCTileStipXOrigin:
            fValues.fTsXOrigin = values->fTsXOrigin;
            break;
         case kGCTileStipYOrigin:
            fValues.fTsYOrigin = values->fTsYOrigin;
            break;
         case kGCFont:
            fValues.fFont = values->fFont;
            break;
         case kGCSubwindowMode:
            fValues.fSubwindowMode = values->fSubwindowMode;
            break;
         case kGCGraphicsExposures:
            fValues.fGraphicsExposures = values->fGraphicsExposures;
            break;
         case kGCClipXOrigin:
            fValues.fClipXOrigin = values->fClipXOrigin;
            break;
         case kGCClipYOrigin:
            fValues.fClipYOrigin = values->fClipYOrigin;
            break;
         case kGCClipMask:
            fValues.fClipMask = values->fClipMask;
            break;
         case kGCDashOffset:
            fValues.fDashOffset = values->fDashOffset;
            break;
         case kGCDashList:
            if (values->fDashLen > (Int_t)sizeof(fValues.fDashes))
               Warning("UpdateValues", "dash list can have only up to %d elements",
                       sizeof(fValues.fDashes));
            fValues.fDashLen = TMath::Min(values->fDashLen, (Int_t)sizeof(fValues.fDashes));
            memcpy(fValues.fDashes, values->fDashes, fValues.fDashLen);
            break;
         case kGCArcMode:
            fValues.fArcMode = values->fArcMode;
            break;
      }
   }
}

//______________________________________________________________________________
void TGGC::SetAttributes(GCValues_t *values)
{
   // Set attributes as specified in the values structure.

   if (!fContext && gClient) {
      TGGC *gc = gClient->GetGCPool()->FindGC(this);
      if (!gc)
         gClient->GetGCPool()->fList->Add(this);
   }

   if (fContext)
      gVirtualX->ChangeGC(fContext, values);
   else
      fContext = gVirtualX->CreateGC(gVirtualX->GetDefaultRootWindow(), values);
   UpdateValues(values);
   if (values->fMask & kGCDashList)
      gVirtualX->SetDashes(fContext, fValues.fDashOffset, fValues.fDashes,
                           fValues.fDashLen);
}

//______________________________________________________________________________
void TGGC::SetFunction(EGraphicsFunction v)
{
   // Set graphics context drawing function.

   GCValues_t values;
   values.fFunction = v;
   values.fMask     = kGCFunction;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetPlaneMask(ULong_t v)
{
   // Set plane mask.

   GCValues_t values;
   values.fPlaneMask = v;
   values.fMask      = kGCPlaneMask;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetForeground(ULong_t v)
{
   // Set foreground color.

   GCValues_t values;
   values.fForeground = v;
   values.fMask       = kGCForeground;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetBackground(ULong_t v)
{
   // Set background color.

   GCValues_t values;
   values.fBackground = v;
   values.fMask       = kGCBackground;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetLineWidth(Int_t v)
{
   // Set line width.

   GCValues_t values;
   values.fLineWidth = v;
   values.fMask      = kGCLineWidth;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetLineStyle(Int_t v)
{
   // Set line style (kLineSolid, kLineOnOffDash, kLineDoubleDash).

   GCValues_t values;
   values.fLineStyle = v;
   values.fMask      = kGCLineStyle;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetCapStyle(Int_t v)
{
   // Set cap style (kCapNotLast, kCapButt, kCapRound, kCapProjecting).

   GCValues_t values;
   values.fCapStyle = v;
   values.fMask     = kGCCapStyle;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetJoinStyle(Int_t v)
{
   // Set line join style (kJoinMiter, kJoinRound, kJoinBevel).

   GCValues_t values;
   values.fJoinStyle = v;
   values.fMask      = kGCJoinStyle;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetFillStyle(Int_t v)
{
   // Set fill style (kFillSolid, kFillTiled, kFillStippled,
   // kFillOpaeueStippled).

   GCValues_t values;
   values.fFillStyle = v;
   values.fMask      = kGCFillStyle;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetFillRule(Int_t v)
{
   // Set fill rule (kEvenOddRule, kWindingRule).

   GCValues_t values;
   values.fFillRule = v;
   values.fMask     = kGCFillRule;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetTile(Pixmap_t v)
{
   // Set tile pixmap for tiling operations.

   GCValues_t values;
   values.fTile = v;
   values.fMask = kGCTile;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetStipple(Pixmap_t v)
{
   // Set 1 plane pixmap for stippling.

   GCValues_t values;
   values.fStipple = v;
   values.fMask    = kGCStipple;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetTileStipXOrigin(Int_t v)
{
   // X offset for tile or stipple operations.

   GCValues_t values;
   values.fTsXOrigin = v;
   values.fMask      = kGCTileStipXOrigin;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetTileStipYOrigin(Int_t v)
{
   // Y offset for tile or stipple operations.

   GCValues_t values;
   values.fTsYOrigin = v;
   values.fMask      = kGCTileStipYOrigin;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetFont(FontH_t v)
{
   // Set font.

   GCValues_t values;
   values.fFont = v;
   values.fMask = kGCFont;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetSubwindowMode(Int_t v)
{
   // Set sub window mode (kClipByChildren, kIncludeInferiors).

   GCValues_t values;
   values.fSubwindowMode = v;
   values.fMask          = kGCSubwindowMode;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetGraphicsExposures(Bool_t v)
{
   // True if graphics exposure should be generated.

   GCValues_t values;
   values.fGraphicsExposures = v;
   values.fMask              = kGCGraphicsExposures;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetClipXOrigin(Int_t v)
{
   // X origin for clipping.

   GCValues_t values;
   values.fClipXOrigin = v;
   values.fMask        = kGCClipXOrigin;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetClipYOrigin(Int_t v)
{
   // Y origin for clipping.

   GCValues_t values;
   values.fClipYOrigin = v;
   values.fMask        = kGCClipYOrigin;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetClipMask(Pixmap_t v)
{
   // Bitmap for clipping.

   GCValues_t values;
   values.fClipMask = v;
   values.fMask     = kGCClipMask;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetDashOffset(Int_t v)
{
   // Patterned/dashed line offset.

   GCValues_t values;
   values.fDashOffset = v;
   values.fMask       = kGCDashOffset;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetDashList(const char v[], Int_t len)
{
   // Set dash pattern. First use SetDashOffset() if not 0.

   GCValues_t values;
   if (len > (Int_t)sizeof(values.fDashes))
      Warning("SetDashList", "dash list can have only up to %d elements",
              sizeof(values.fDashes));
   values.fDashLen = TMath::Min(len, (Int_t)sizeof(values.fDashes));
   memcpy(values.fDashes, v, values.fDashLen);
   values.fMask    = kGCDashList;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::SetArcMode(Int_t v)
{
   // Set arc mode (kArcChord, kArcPieSlice).

   GCValues_t values;
   values.fArcMode = v;
   values.fMask    = kGCArcMode;
   SetAttributes(&values);
}

//______________________________________________________________________________
void TGGC::Print(Option_t *) const
{
   // Print graphics contexts info.

   Printf("TGGC: mask = %lx, handle = %lx, ref cnt = %u", fValues.fMask,
          fContext, References());
}

//______________________________________________________________________________
TString TGGC::GetMaskString() const
{
   // Returns GC mask as a string - used in SavePrimitive().

   TString mask;

   Mask_t fmask = GetMask();

   if (fmask & kGCFunction) {
      if (mask.Length() == 0) mask  = "kGCFunction";
      else                    mask += " | kGCFunction";
   }
   if (fmask & kGCPlaneMask) {
      if (mask.Length() == 0) mask  = "kGCPlaneMask";
      else                    mask += " | kGCPlaneMask";
   }
   if (fmask & kGCForeground) {
      if (mask.Length() == 0) mask  = "kGCForeground";
      else                    mask += " | kGCForeground";
   }
   if (fmask & kGCBackground) {
      if (mask.Length() == 0) mask  = "kGCBackground";
      else                    mask += " | kGCBackground";
   }
   if (fmask & kGCLineWidth) {
      if (mask.Length() == 0) mask  = "kGCLineWidth";
      else                    mask += " | kGCLineWidth";
   }
   if (fmask & kGCLineStyle) {
      if (mask.Length() == 0) mask  = "kGCLineStyle";
      else                    mask += " | kGCLineStyle";
   }
   if (fmask & kGCCapStyle) {
      if (mask.Length() == 0) mask  = "kGCCapStyle";
      else                    mask += " | kGCCapStyle";
   }
   if (fmask & kGCJoinStyle) {
      if (mask.Length() == 0) mask  = "kGCJoinStyle";
      else                    mask += " | kGCJoinStyle";
   }
   if (fmask & kGCFillStyle) {
      if (mask.Length() == 0) mask  = "kGCFillStyle";
      else                    mask += " | kGCFillStyle";
   }
   if (fmask & kGCFillRule) {
      if (mask.Length() == 0) mask  = "kGCFillRule";
      else                    mask += " | kGCFillRule";
   }
   if (fmask & kGCTile) {
      if (mask.Length() == 0) mask  = "kGCTile";
      else                    mask += " | kGCTile";
   }
   if (fmask & kGCStipple) {
      if (mask.Length() == 0) mask  = "kGCStipple";
      else                    mask += " | kGCStipple";
   }
   if (fmask & kGCTileStipXOrigin) {
      if (mask.Length() == 0) mask  = "kGCTileStipXOrigin";
      else                    mask += " | kGCTileStipXOrigin";
   }
   if (fmask & kGCTileStipYOrigin) {
      if (mask.Length() == 0) mask  = "kGCTileStipYOrigin";
      else                    mask += " | kGCTileStipYOrigin";
   }
   if (fmask & kGCFont) {
      if (mask.Length() == 0) mask  = "kGCFont";
      else                    mask += " | kGCFont";
   }
   if (fmask & kGCSubwindowMode) {
      if (mask.Length() == 0) mask  = "kGCSubwindowMode";
      else                    mask += " | kGCSubwindowMode";
   }
   if (fmask & kGCGraphicsExposures) {
      if (mask.Length() == 0) mask  = "kGCGraphicsExposures";
      else                    mask += " | kGCGraphicsExposures";
   }
   if (fmask & kGCClipXOrigin) {
      if (mask.Length() == 0) mask  = "kGCClipXOrigin";
      else                    mask += " | kGCClipXOrigin";
   }
   if (fmask & kGCClipYOrigin) {
      if (mask.Length() == 0) mask  = "kGCClipYOrigin";
      else                    mask += " | kGCClipYOrigin";
   }
   if (fmask & kGCClipMask) {
      if (mask.Length() == 0) mask  = "kGCClipMask";
      else                    mask += " | kGCClipMask";
   }
   if (fmask & kGCDashOffset) {
      if (mask.Length() == 0) mask  = "kGCDashOffset";
      else                    mask += " | kGCDashOffset";
   }
   if (fmask & kGCDashList) {
      if (mask.Length() == 0) mask  = "kGCDashList";
      else                    mask += " | kGCDashList";
   }
   if (fmask & kGCArcMode) {
      if (mask.Length() == 0) mask  = "kGCArcMode";
      else                    mask += " | kGCArcMode";
   }
   return mask;
}

//______________________________________________________________________________
void TGGC::SavePrimitive(ostream &out, Option_t *option /*= ""*/)
{
   // Save graphics context info as a C++ statement(s) on output stream out

   if (gROOT->ClassSaved(TGGC::Class())) {
      out << endl;
   } else {
      //  declare graphics context object to reflect required user changes
      out << endl;
      out << "   TGGC   *uGC;           // will reflect user GC changes" << endl;
   }

   Mask_t fmask = GetMask();

   const char *colorname;
   char valname[50];
   char quote ='"';
   ULong_t color;

   sprintf(valname,"val%s",option);

   out << "   // graphics context changes" << endl;
   //out << "   TGGC *uGC" << option << ";" << endl;
   out << "   GCValues_t " << valname << ";" << endl;
   out << "   " << valname << ".fMask = " << GetMaskString() << ";" << endl;

   for (Mask_t bit = 1; bit <= fmask; bit <<= 1) {
      switch (bit & fmask) {
         default:
         case 0:
            continue;
         case kGCFunction:
            out << "   " << valname << ".fFunction = ";
            switch (GetFunction()) {
               case kGXclear:
                  out << "kGXclear";
                  break;
               case kGXand:
                  out << "kGXand";
                  break;
               case kGXandReverse:
                  out << "kGXandReverse";
                  break;
               case kGXcopy:
                  out << "kGXcopy";
                  break;
               case kGXandInverted:
                  out << "kGXandInverted";
                  break;
               case kGXnoop:
                  out << "kGXnoop";
                  break;
               case kGXxor:
                  out << "kGXxor";
                  break;
               case kGXor:
                  out << "kGXor";
                  break;
               case kGXnor:
                  out << "kGXnor";
                  break;
               case kGXequiv:
                  out << "kGXequiv";
                  break;
               case kGXinvert:
                  out << "kGXinvert";
                  break;
               case kGXorReverse:
                  out << "kGXorReverse";
                  break;
               case kGXcopyInverted:
                  out << "kGXcopyInverted";
                  break;
               case kGXorInverted:
                  out << "kGXorInverted";
                  break;
               case kGXnand:
                  out << "kGXnand";
                  break;
               case kGXset:
                  out << "kGXset";
                  break;
            }
            out << ";" << endl;
            break;
         case kGCPlaneMask:
            out << "   " << valname << ".fPlaneMask = " << GetPlaneMask() << ";" << endl;
            break;
         case kGCForeground:
            color = GetForeground();
            colorname = TColor::PixelAsHexString(color);
            out << "   gClient->GetColorByName(" << quote << colorname << quote
                << "," << valname << ".fForeground);" << endl;
            break;
         case kGCBackground:
            color = GetBackground();
            colorname = TColor::PixelAsHexString(color);
            out << "   gClient->GetColorByName(" << quote << colorname << quote
                << "," << valname << ".fBackground);" << endl;
            break;
         case kGCLineWidth:
            out << "   " << valname << ".fLineWidth = " << GetLineWidth() << ";" << endl;
            break;
         case kGCLineStyle:
            out << "   " << valname << ".fLineStyle = ";
            switch (GetLineStyle()) {
               case kLineSolid:
                  out << "kLineSolid";
                  break;
               case kLineOnOffDash:
                  out << "kLineOnOffDash";
                  break;
               case kLineDoubleDash:
                  out << "kLineDoubleDash";
                  break;
            }
            out << ";" << endl;
            break;
         case kGCCapStyle:
            out << "   " << valname << ".fCapStyle = ";
            switch (GetCapStyle()) {
               case kCapNotLast:
                  out << "kCapNotLast";
                  break;
               case kCapButt:
                  out << "kCapButt";
                  break;
               case kCapRound:
                  out << "kCapRound";
                  break;
               case kCapProjecting:
                  out << "kCapProjecting";
                  break;
            }
            out << ";" << endl;
            break;
         case kGCJoinStyle:
            out << "   " << valname << ".fJoinStyle = ";
            switch (GetJoinStyle()) {
               case kJoinMiter:
                  out << "kJoinMiter";
                  break;
               case kJoinRound:
                  out << "kJoinRound";
                  break;
               case kJoinBevel:
                  out << "kJoinBevel";
                  break;
            }
            out << ";" << endl;
            break;
         case kGCFillStyle:
            out << "   " << valname << ".fFillStyle = ";
            switch (GetFillStyle()) {
               case kFillSolid:
                  out << "kFillSolid";
                  break;
               case kFillTiled:
                  out << "kFillTiled";
                  break;
               case kFillStippled:
                  out << "kFillStippled";
                  break;
               case kFillOpaqueStippled:
                  out << "kFillOpaqueStippled";
                  break;
            }
            out << ";" << endl;
            break;
         case kGCFillRule:
            out << "   " << valname << ".fFillRule = ";
            switch (GetFillRule()) {
               case kEvenOddRule:
                  out << "kEvenOddRule";
                  break;
               case kWindingRule:
                  out << "kWindingRule";
                  break;
            }
            out << ";" << endl;
            break;
         case kGCTile:
            out << "   " << valname << ".fTile = " << GetTile() << ";" << endl;
            break;
         case kGCStipple:
            out << "   " << valname << ".fStipple = " << GetStipple() << ";" << endl;
            break;
         case kGCTileStipXOrigin:
            out << "   " << valname << ".fTsXOrigin = " << GetTileStipXOrigin() << ";" << endl;
            break;
         case kGCTileStipYOrigin:
            out << "   " << valname << ".fTsYOrigin = " << GetTileStipYOrigin() << ";" << endl;
            break;
         case kGCFont:
            out << "   " << valname << ".fFont = ufont->GetFontHandle();" << endl;
            break;
         case kGCSubwindowMode:
            out << "   " << valname << ".fSubwindowMode = ";
            switch (GetSubwindowMode()) {
               case kClipByChildren:
                  out << "kClipByChildren";
                  break;
               case kIncludeInferiors:
                  out << "kIncludeInferiors";
                  break;
            }
            out << ";" << endl;
            break;
         case kGCGraphicsExposures:
            out << "   " << valname << ".fGraphicsExposures = ";
            switch (GetGraphicsExposures()) {
               case kTRUE:
                  out << "kTRUE";
                  break;
               case kFALSE:
                  out << "kFALSE";
                  break;
            }
            out << ";" << endl;
            break;
         case kGCClipXOrigin:
            out << "   " << valname << ".fClipXOrigin = " << GetClipXOrigin() << ";" << endl;
            break;
         case kGCClipYOrigin:
            out << "   " << valname << ".fClipYOrigin = " << GetClipYOrigin() << ";" << endl;
            break;
         case kGCClipMask:
            out << "   " << valname << ".fClipMask = " << GetClipMask() << ";" << endl;
            break;
         case kGCDashOffset:
            out << "   " << valname << ".fDashOffset = " << GetDashOffset() << ";" << endl;
            break;
         case kGCDashList:
            if (GetDashLen() > (Int_t)sizeof(GetDashes()))
               Warning("TGGC::SavePrimitive", "dash list can have only up to %d elements",
                       sizeof(GetDashes()));
            out << "   " << valname << ".fDashLen = "
                << TMath::Min(GetDashLen(),(Int_t)sizeof(GetDashes())) << ";" << endl;
            out << "   memcpy(GetDashes()," << valname << ".fDashes,"
                                            << valname << ".fDashLen);" << endl;
            break;
         case kGCArcMode:
            out << "   " << valname << ".fArcMode = ";
            switch (GetArcMode()) {
               case kArcChord:
                  out << "kArcChord";
                  break;
               case kArcPieSlice:
                  out << "kArcPieSlice";
                  break;
            }
            out << ";" << endl;
            break;
      }
   }
   out << "   uGC = gClient->GetGC(&" << valname << ", kTRUE);" << endl;
}


ClassImp(TGGCPool)

//______________________________________________________________________________
TGGCPool::TGGCPool(TGClient *client)
{
   // Create graphics context pool.

   fClient = client;
   fList   = new THashTable;
   fList->SetOwner();
}

//______________________________________________________________________________
TGGCPool::~TGGCPool()
{
   // Delete graphics context pool.

   delete fList;
}

//______________________________________________________________________________
void TGGCPool::ForceFreeGC(const TGGC *gct)
{
   // Force remove graphics context from list. Is only called via ~TGGC().

   TGGC *gc = (TGGC *) fList->FindObject(gct);

   if (gc) {
      if (gc->References() > 1)
         Error("ForceFreeGC", "removed a shared graphics context\n",
               "best to use graphics contexts via the TGGCPool()");
      fList->Remove(gc);
   }
}

//______________________________________________________________________________
void TGGCPool::FreeGC(const TGGC *gct)
{
   // Delete graphics context if it is not used anymore.

   TGGC *gc = (TGGC *) fList->FindObject(gct);

   if (gc) {
      if (gc->RemoveReference() == 0) {
         fList->Remove(gc);
         delete gc;
      }
   }
}

//______________________________________________________________________________
void TGGCPool::FreeGC(GContext_t gct)
{
   // Delete graphics context if it is not used anymore.

   TIter next(fList);

   while (TGGC *gc = (TGGC *) next()) {
      if (gc->fContext == gct) {
         if (gc->RemoveReference() == 0) {
            fList->Remove(gc);
            delete gc;
            return;
         }
      }
   }
}

//______________________________________________________________________________
TGGC *TGGCPool::FindGC(const TGGC *gct)
{
   // Find graphics context. Returns 0 in case gc is not found.

   return (TGGC*) fList->FindObject(gct);
}

//______________________________________________________________________________
TGGC *TGGCPool::FindGC(GContext_t gct)
{
   // Find graphics context based on its GContext_t handle. Returns 0
   // in case gc is not found.

   TIter next(fList);

   while (TGGC *gc = (TGGC *) next()) {
      if (gc->fContext == gct)
         return gc;
   }
   return 0;
}

//______________________________________________________________________________
TGGC *TGGCPool::GetGC(GContext_t gct)
{
   // returns graphics context based on its GContext_t handle.

   GCValues_t gval;
   gVirtualX->GetGCValues(gct, gval);
   return GetGC(&gval, kTRUE);
}

//______________________________________________________________________________
TGGC *TGGCPool::GetGC(GCValues_t *values, Bool_t rw)
{
   // Get the best matching graphics context depending on values.
   // If rw is false only a readonly, not modifiable graphics context
   // is returned. If rw is true a new modifiable graphics context is
   // returned.

   TGGC *gc, *best_match = 0;
   Int_t matching_bits, best_matching_bits = -1;
   Bool_t exact = kFALSE;

   if (!values)
      rw = kTRUE;

   if (!rw) {

      // First, try to find an exact matching GC.
      // If no one found, then use the closest one.

      TIter next(fList);

      while ((gc = (TGGC *) next())) {
         matching_bits = MatchGC(gc, values);
         if (matching_bits > best_matching_bits) {
            best_matching_bits = matching_bits;
            best_match = gc;
            if ((gc->fValues.fMask & values->fMask) == values->fMask) {
               exact = kTRUE;
               break;
            }
         }
      }

      if (best_match) {
         if (gDebug > 0)
            Printf("<TGGCPool::GetGC>: %smatching GC found\n", exact ? "exact " : "");
         best_match->AddReference();
         if (!exact) {
            // add missing values to the best_match'ing GC...
            UpdateGC(best_match, values);
         }
         return best_match;
      }
   }

   gc = new TGGC(values, kTRUE);

   fList->Add(gc);

   return gc;
}

//______________________________________________________________________________
Int_t TGGCPool::MatchGC(const TGGC *gc, GCValues_t *values)
{
   // Try to find matching graphics context. On success returns the amount
   // of matching bits (which may be zero if masks have no common bits),
   // -1 on failure (when there are common bits but not a single match).

   Mask_t bit, common_bits;
   Int_t  matching_bits = -1;
   Bool_t match = kFALSE;
   const GCValues_t *gcv = &gc->fValues;

   common_bits = values->fMask & gcv->fMask;

   if (common_bits == 0) return 0;  // no common bits, a possible
                                    // candidate anyway.

   // Careful, check first the tile and stipple mask bits, as these
   // influence nearly all other GC functions... (do the same for
   // some other such bits as GCFunction, etc...). Perhaps we should
   // allow only exact GC matches.

   if (gcv->fMask & kGCTile)
      if ((gcv->fTile != kNone) && !(values->fMask & kGCTile)) return -1;
   if (values->fMask & kGCTile)
      if ((values->fTile != kNone) && !(gcv->fMask & kGCTile)) return -1;
   if (gcv->fMask & kGCStipple)
      if ((gcv->fStipple != kNone) && !(values->fMask & kGCStipple)) return -1;
   if (values->fMask & kGCStipple)
      if ((values->fStipple != kNone) && !(gcv->fMask & kGCStipple)) return -1;

   for (bit = 1; bit <= common_bits; bit <<= 1) {
      switch (bit & common_bits) {
         default:
         case 0:
            continue;
         case kGCFunction:
            match = (values->fFunction == gcv->fFunction);
            break;
         case kGCPlaneMask:
            match = (values->fPlaneMask == gcv->fPlaneMask);
            break;
         case kGCForeground:
            match = (values->fForeground == gcv->fForeground);
            break;
         case kGCBackground:
            match = (values->fBackground == gcv->fBackground);
            break;
         case kGCLineWidth:
            match = (values->fLineWidth == gcv->fLineWidth);
            break;
         case kGCLineStyle:
            match = (values->fLineStyle == gcv->fLineStyle);
            break;
         case kGCCapStyle:
            match = (values->fCapStyle == gcv->fCapStyle);
            break;
         case kGCJoinStyle:
            match = (values->fJoinStyle == gcv->fJoinStyle);
            break;
         case kGCFillStyle:
            match = (values->fFillStyle == gcv->fFillStyle);
            break;
         case kGCFillRule:
            match = (values->fFillRule == gcv->fFillRule);
            break;
         case kGCTile:
            match = (values->fTile == gcv->fTile);
            break;
         case kGCStipple:
            match = (values->fStipple == gcv->fStipple);
            break;
         case kGCTileStipXOrigin:
            match = (values->fTsXOrigin == gcv->fTsXOrigin);
            break;
         case kGCTileStipYOrigin:
            match = (values->fTsYOrigin == gcv->fTsYOrigin);
            break;
         case kGCFont:
            match = (values->fFont == gcv->fFont);
            break;
         case kGCSubwindowMode:
            match = (values->fSubwindowMode == gcv->fSubwindowMode);
            break;
         case kGCGraphicsExposures:
            match = (values->fGraphicsExposures == gcv->fGraphicsExposures);
            break;
         case kGCClipXOrigin:
            match = (values->fClipXOrigin == gcv->fClipXOrigin);
            break;
         case kGCClipYOrigin:
            match = (values->fClipYOrigin == gcv->fClipYOrigin);
            break;
         case kGCClipMask:
            match = (values->fClipMask == gcv->fClipMask);
            break;
         case kGCDashOffset:
            match = (values->fDashOffset == gcv->fDashOffset);
            break;
         case kGCDashList:
            if (values->fDashLen == gcv->fDashLen)
               match = (strncmp(values->fDashes, gcv->fDashes, gcv->fDashLen) == 0);
            break;
         case kGCArcMode:
            match = (values->fArcMode == gcv->fArcMode);
            break;
      }
      if (!match)
         return -1;
      matching_bits++;
      match = kFALSE;
   }

   return matching_bits;
}

//______________________________________________________________________________
void TGGCPool::UpdateGC(TGGC *gc, GCValues_t *values)
{
   // Update graphics context with the values spcified in values->fMask.

   gc->SetAttributes(values);
}

//______________________________________________________________________________
void TGGCPool::Print(Option_t *) const
{
   // List all graphics contexts in the pool.

   fList->Print();
}

 TGGC.cxx:1
 TGGC.cxx:2
 TGGC.cxx:3
 TGGC.cxx:4
 TGGC.cxx:5
 TGGC.cxx:6
 TGGC.cxx:7
 TGGC.cxx:8
 TGGC.cxx:9
 TGGC.cxx:10
 TGGC.cxx:11
 TGGC.cxx:12
 TGGC.cxx:13
 TGGC.cxx:14
 TGGC.cxx:15
 TGGC.cxx:16
 TGGC.cxx:17
 TGGC.cxx:18
 TGGC.cxx:19
 TGGC.cxx:20
 TGGC.cxx:21
 TGGC.cxx:22
 TGGC.cxx:23
 TGGC.cxx:24
 TGGC.cxx:25
 TGGC.cxx:26
 TGGC.cxx:27
 TGGC.cxx:28
 TGGC.cxx:29
 TGGC.cxx:30
 TGGC.cxx:31
 TGGC.cxx:32
 TGGC.cxx:33
 TGGC.cxx:34
 TGGC.cxx:35
 TGGC.cxx:36
 TGGC.cxx:37
 TGGC.cxx:38
 TGGC.cxx:39
 TGGC.cxx:40
 TGGC.cxx:41
 TGGC.cxx:42
 TGGC.cxx:43
 TGGC.cxx:44
 TGGC.cxx:45
 TGGC.cxx:46
 TGGC.cxx:47
 TGGC.cxx:48
 TGGC.cxx:49
 TGGC.cxx:50
 TGGC.cxx:51
 TGGC.cxx:52
 TGGC.cxx:53
 TGGC.cxx:54
 TGGC.cxx:55
 TGGC.cxx:56
 TGGC.cxx:57
 TGGC.cxx:58
 TGGC.cxx:59
 TGGC.cxx:60
 TGGC.cxx:61
 TGGC.cxx:62
 TGGC.cxx:63
 TGGC.cxx:64
 TGGC.cxx:65
 TGGC.cxx:66
 TGGC.cxx:67
 TGGC.cxx:68
 TGGC.cxx:69
 TGGC.cxx:70
 TGGC.cxx:71
 TGGC.cxx:72
 TGGC.cxx:73
 TGGC.cxx:74
 TGGC.cxx:75
 TGGC.cxx:76
 TGGC.cxx:77
 TGGC.cxx:78
 TGGC.cxx:79
 TGGC.cxx:80
 TGGC.cxx:81
 TGGC.cxx:82
 TGGC.cxx:83
 TGGC.cxx:84
 TGGC.cxx:85
 TGGC.cxx:86
 TGGC.cxx:87
 TGGC.cxx:88
 TGGC.cxx:89
 TGGC.cxx:90
 TGGC.cxx:91
 TGGC.cxx:92
 TGGC.cxx:93
 TGGC.cxx:94
 TGGC.cxx:95
 TGGC.cxx:96
 TGGC.cxx:97
 TGGC.cxx:98
 TGGC.cxx:99
 TGGC.cxx:100
 TGGC.cxx:101
 TGGC.cxx:102
 TGGC.cxx:103
 TGGC.cxx:104
 TGGC.cxx:105
 TGGC.cxx:106
 TGGC.cxx:107
 TGGC.cxx:108
 TGGC.cxx:109
 TGGC.cxx:110
 TGGC.cxx:111
 TGGC.cxx:112
 TGGC.cxx:113
 TGGC.cxx:114
 TGGC.cxx:115
 TGGC.cxx:116
 TGGC.cxx:117
 TGGC.cxx:118
 TGGC.cxx:119
 TGGC.cxx:120
 TGGC.cxx:121
 TGGC.cxx:122
 TGGC.cxx:123
 TGGC.cxx:124
 TGGC.cxx:125
 TGGC.cxx:126
 TGGC.cxx:127
 TGGC.cxx:128
 TGGC.cxx:129
 TGGC.cxx:130
 TGGC.cxx:131
 TGGC.cxx:132
 TGGC.cxx:133
 TGGC.cxx:134
 TGGC.cxx:135
 TGGC.cxx:136
 TGGC.cxx:137
 TGGC.cxx:138
 TGGC.cxx:139
 TGGC.cxx:140
 TGGC.cxx:141
 TGGC.cxx:142
 TGGC.cxx:143
 TGGC.cxx:144
 TGGC.cxx:145
 TGGC.cxx:146
 TGGC.cxx:147
 TGGC.cxx:148
 TGGC.cxx:149
 TGGC.cxx:150
 TGGC.cxx:151
 TGGC.cxx:152
 TGGC.cxx:153
 TGGC.cxx:154
 TGGC.cxx:155
 TGGC.cxx:156
 TGGC.cxx:157
 TGGC.cxx:158
 TGGC.cxx:159
 TGGC.cxx:160
 TGGC.cxx:161
 TGGC.cxx:162
 TGGC.cxx:163
 TGGC.cxx:164
 TGGC.cxx:165
 TGGC.cxx:166
 TGGC.cxx:167
 TGGC.cxx:168
 TGGC.cxx:169
 TGGC.cxx:170
 TGGC.cxx:171
 TGGC.cxx:172
 TGGC.cxx:173
 TGGC.cxx:174
 TGGC.cxx:175
 TGGC.cxx:176
 TGGC.cxx:177
 TGGC.cxx:178
 TGGC.cxx:179
 TGGC.cxx:180
 TGGC.cxx:181
 TGGC.cxx:182
 TGGC.cxx:183
 TGGC.cxx:184
 TGGC.cxx:185
 TGGC.cxx:186
 TGGC.cxx:187
 TGGC.cxx:188
 TGGC.cxx:189
 TGGC.cxx:190
 TGGC.cxx:191
 TGGC.cxx:192
 TGGC.cxx:193
 TGGC.cxx:194
 TGGC.cxx:195
 TGGC.cxx:196
 TGGC.cxx:197
 TGGC.cxx:198
 TGGC.cxx:199
 TGGC.cxx:200
 TGGC.cxx:201
 TGGC.cxx:202
 TGGC.cxx:203
 TGGC.cxx:204
 TGGC.cxx:205
 TGGC.cxx:206
 TGGC.cxx:207
 TGGC.cxx:208
 TGGC.cxx:209
 TGGC.cxx:210
 TGGC.cxx:211
 TGGC.cxx:212
 TGGC.cxx:213
 TGGC.cxx:214
 TGGC.cxx:215
 TGGC.cxx:216
 TGGC.cxx:217
 TGGC.cxx:218
 TGGC.cxx:219
 TGGC.cxx:220
 TGGC.cxx:221
 TGGC.cxx:222
 TGGC.cxx:223
 TGGC.cxx:224
 TGGC.cxx:225
 TGGC.cxx:226
 TGGC.cxx:227
 TGGC.cxx:228
 TGGC.cxx:229
 TGGC.cxx:230
 TGGC.cxx:231
 TGGC.cxx:232
 TGGC.cxx:233
 TGGC.cxx:234
 TGGC.cxx:235
 TGGC.cxx:236
 TGGC.cxx:237
 TGGC.cxx:238
 TGGC.cxx:239
 TGGC.cxx:240
 TGGC.cxx:241
 TGGC.cxx:242
 TGGC.cxx:243
 TGGC.cxx:244
 TGGC.cxx:245
 TGGC.cxx:246
 TGGC.cxx:247
 TGGC.cxx:248
 TGGC.cxx:249
 TGGC.cxx:250
 TGGC.cxx:251
 TGGC.cxx:252
 TGGC.cxx:253
 TGGC.cxx:254
 TGGC.cxx:255
 TGGC.cxx:256
 TGGC.cxx:257
 TGGC.cxx:258
 TGGC.cxx:259
 TGGC.cxx:260
 TGGC.cxx:261
 TGGC.cxx:262
 TGGC.cxx:263
 TGGC.cxx:264
 TGGC.cxx:265
 TGGC.cxx:266
 TGGC.cxx:267
 TGGC.cxx:268
 TGGC.cxx:269
 TGGC.cxx:270
 TGGC.cxx:271
 TGGC.cxx:272
 TGGC.cxx:273
 TGGC.cxx:274
 TGGC.cxx:275
 TGGC.cxx:276
 TGGC.cxx:277
 TGGC.cxx:278
 TGGC.cxx:279
 TGGC.cxx:280
 TGGC.cxx:281
 TGGC.cxx:282
 TGGC.cxx:283
 TGGC.cxx:284
 TGGC.cxx:285
 TGGC.cxx:286
 TGGC.cxx:287
 TGGC.cxx:288
 TGGC.cxx:289
 TGGC.cxx:290
 TGGC.cxx:291
 TGGC.cxx:292
 TGGC.cxx:293
 TGGC.cxx:294
 TGGC.cxx:295
 TGGC.cxx:296
 TGGC.cxx:297
 TGGC.cxx:298
 TGGC.cxx:299
 TGGC.cxx:300
 TGGC.cxx:301
 TGGC.cxx:302
 TGGC.cxx:303
 TGGC.cxx:304
 TGGC.cxx:305
 TGGC.cxx:306
 TGGC.cxx:307
 TGGC.cxx:308
 TGGC.cxx:309
 TGGC.cxx:310
 TGGC.cxx:311
 TGGC.cxx:312
 TGGC.cxx:313
 TGGC.cxx:314
 TGGC.cxx:315
 TGGC.cxx:316
 TGGC.cxx:317
 TGGC.cxx:318
 TGGC.cxx:319
 TGGC.cxx:320
 TGGC.cxx:321
 TGGC.cxx:322
 TGGC.cxx:323
 TGGC.cxx:324
 TGGC.cxx:325
 TGGC.cxx:326
 TGGC.cxx:327
 TGGC.cxx:328
 TGGC.cxx:329
 TGGC.cxx:330
 TGGC.cxx:331
 TGGC.cxx:332
 TGGC.cxx:333
 TGGC.cxx:334
 TGGC.cxx:335
 TGGC.cxx:336
 TGGC.cxx:337
 TGGC.cxx:338
 TGGC.cxx:339
 TGGC.cxx:340
 TGGC.cxx:341
 TGGC.cxx:342
 TGGC.cxx:343
 TGGC.cxx:344
 TGGC.cxx:345
 TGGC.cxx:346
 TGGC.cxx:347
 TGGC.cxx:348
 TGGC.cxx:349
 TGGC.cxx:350
 TGGC.cxx:351
 TGGC.cxx:352
 TGGC.cxx:353
 TGGC.cxx:354
 TGGC.cxx:355
 TGGC.cxx:356
 TGGC.cxx:357
 TGGC.cxx:358
 TGGC.cxx:359
 TGGC.cxx:360
 TGGC.cxx:361
 TGGC.cxx:362
 TGGC.cxx:363
 TGGC.cxx:364
 TGGC.cxx:365
 TGGC.cxx:366
 TGGC.cxx:367
 TGGC.cxx:368
 TGGC.cxx:369
 TGGC.cxx:370
 TGGC.cxx:371
 TGGC.cxx:372
 TGGC.cxx:373
 TGGC.cxx:374
 TGGC.cxx:375
 TGGC.cxx:376
 TGGC.cxx:377
 TGGC.cxx:378
 TGGC.cxx:379
 TGGC.cxx:380
 TGGC.cxx:381
 TGGC.cxx:382
 TGGC.cxx:383
 TGGC.cxx:384
 TGGC.cxx:385
 TGGC.cxx:386
 TGGC.cxx:387
 TGGC.cxx:388
 TGGC.cxx:389
 TGGC.cxx:390
 TGGC.cxx:391
 TGGC.cxx:392
 TGGC.cxx:393
 TGGC.cxx:394
 TGGC.cxx:395
 TGGC.cxx:396
 TGGC.cxx:397
 TGGC.cxx:398
 TGGC.cxx:399
 TGGC.cxx:400
 TGGC.cxx:401
 TGGC.cxx:402
 TGGC.cxx:403
 TGGC.cxx:404
 TGGC.cxx:405
 TGGC.cxx:406
 TGGC.cxx:407
 TGGC.cxx:408
 TGGC.cxx:409
 TGGC.cxx:410
 TGGC.cxx:411
 TGGC.cxx:412
 TGGC.cxx:413
 TGGC.cxx:414
 TGGC.cxx:415
 TGGC.cxx:416
 TGGC.cxx:417
 TGGC.cxx:418
 TGGC.cxx:419
 TGGC.cxx:420
 TGGC.cxx:421
 TGGC.cxx:422
 TGGC.cxx:423
 TGGC.cxx:424
 TGGC.cxx:425
 TGGC.cxx:426
 TGGC.cxx:427
 TGGC.cxx:428
 TGGC.cxx:429
 TGGC.cxx:430
 TGGC.cxx:431
 TGGC.cxx:432
 TGGC.cxx:433
 TGGC.cxx:434
 TGGC.cxx:435
 TGGC.cxx:436
 TGGC.cxx:437
 TGGC.cxx:438
 TGGC.cxx:439
 TGGC.cxx:440
 TGGC.cxx:441
 TGGC.cxx:442
 TGGC.cxx:443
 TGGC.cxx:444
 TGGC.cxx:445
 TGGC.cxx:446
 TGGC.cxx:447
 TGGC.cxx:448
 TGGC.cxx:449
 TGGC.cxx:450
 TGGC.cxx:451
 TGGC.cxx:452
 TGGC.cxx:453
 TGGC.cxx:454
 TGGC.cxx:455
 TGGC.cxx:456
 TGGC.cxx:457
 TGGC.cxx:458
 TGGC.cxx:459
 TGGC.cxx:460
 TGGC.cxx:461
 TGGC.cxx:462
 TGGC.cxx:463
 TGGC.cxx:464
 TGGC.cxx:465
 TGGC.cxx:466
 TGGC.cxx:467
 TGGC.cxx:468
 TGGC.cxx:469
 TGGC.cxx:470
 TGGC.cxx:471
 TGGC.cxx:472
 TGGC.cxx:473
 TGGC.cxx:474
 TGGC.cxx:475
 TGGC.cxx:476
 TGGC.cxx:477
 TGGC.cxx:478
 TGGC.cxx:479
 TGGC.cxx:480
 TGGC.cxx:481
 TGGC.cxx:482
 TGGC.cxx:483
 TGGC.cxx:484
 TGGC.cxx:485
 TGGC.cxx:486
 TGGC.cxx:487
 TGGC.cxx:488
 TGGC.cxx:489
 TGGC.cxx:490
 TGGC.cxx:491
 TGGC.cxx:492
 TGGC.cxx:493
 TGGC.cxx:494
 TGGC.cxx:495
 TGGC.cxx:496
 TGGC.cxx:497
 TGGC.cxx:498
 TGGC.cxx:499
 TGGC.cxx:500
 TGGC.cxx:501
 TGGC.cxx:502
 TGGC.cxx:503
 TGGC.cxx:504
 TGGC.cxx:505
 TGGC.cxx:506
 TGGC.cxx:507
 TGGC.cxx:508
 TGGC.cxx:509
 TGGC.cxx:510
 TGGC.cxx:511
 TGGC.cxx:512
 TGGC.cxx:513
 TGGC.cxx:514
 TGGC.cxx:515
 TGGC.cxx:516
 TGGC.cxx:517
 TGGC.cxx:518
 TGGC.cxx:519
 TGGC.cxx:520
 TGGC.cxx:521
 TGGC.cxx:522
 TGGC.cxx:523
 TGGC.cxx:524
 TGGC.cxx:525
 TGGC.cxx:526
 TGGC.cxx:527
 TGGC.cxx:528
 TGGC.cxx:529
 TGGC.cxx:530
 TGGC.cxx:531
 TGGC.cxx:532
 TGGC.cxx:533
 TGGC.cxx:534
 TGGC.cxx:535
 TGGC.cxx:536
 TGGC.cxx:537
 TGGC.cxx:538
 TGGC.cxx:539
 TGGC.cxx:540
 TGGC.cxx:541
 TGGC.cxx:542
 TGGC.cxx:543
 TGGC.cxx:544
 TGGC.cxx:545
 TGGC.cxx:546
 TGGC.cxx:547
 TGGC.cxx:548
 TGGC.cxx:549
 TGGC.cxx:550
 TGGC.cxx:551
 TGGC.cxx:552
 TGGC.cxx:553
 TGGC.cxx:554
 TGGC.cxx:555
 TGGC.cxx:556
 TGGC.cxx:557
 TGGC.cxx:558
 TGGC.cxx:559
 TGGC.cxx:560
 TGGC.cxx:561
 TGGC.cxx:562
 TGGC.cxx:563
 TGGC.cxx:564
 TGGC.cxx:565
 TGGC.cxx:566
 TGGC.cxx:567
 TGGC.cxx:568
 TGGC.cxx:569
 TGGC.cxx:570
 TGGC.cxx:571
 TGGC.cxx:572
 TGGC.cxx:573
 TGGC.cxx:574
 TGGC.cxx:575
 TGGC.cxx:576
 TGGC.cxx:577
 TGGC.cxx:578
 TGGC.cxx:579
 TGGC.cxx:580
 TGGC.cxx:581
 TGGC.cxx:582
 TGGC.cxx:583
 TGGC.cxx:584
 TGGC.cxx:585
 TGGC.cxx:586
 TGGC.cxx:587
 TGGC.cxx:588
 TGGC.cxx:589
 TGGC.cxx:590
 TGGC.cxx:591
 TGGC.cxx:592
 TGGC.cxx:593
 TGGC.cxx:594
 TGGC.cxx:595
 TGGC.cxx:596
 TGGC.cxx:597
 TGGC.cxx:598
 TGGC.cxx:599
 TGGC.cxx:600
 TGGC.cxx:601
 TGGC.cxx:602
 TGGC.cxx:603
 TGGC.cxx:604
 TGGC.cxx:605
 TGGC.cxx:606
 TGGC.cxx:607
 TGGC.cxx:608
 TGGC.cxx:609
 TGGC.cxx:610
 TGGC.cxx:611
 TGGC.cxx:612
 TGGC.cxx:613
 TGGC.cxx:614
 TGGC.cxx:615
 TGGC.cxx:616
 TGGC.cxx:617
 TGGC.cxx:618
 TGGC.cxx:619
 TGGC.cxx:620
 TGGC.cxx:621
 TGGC.cxx:622
 TGGC.cxx:623
 TGGC.cxx:624
 TGGC.cxx:625
 TGGC.cxx:626
 TGGC.cxx:627
 TGGC.cxx:628
 TGGC.cxx:629
 TGGC.cxx:630
 TGGC.cxx:631
 TGGC.cxx:632
 TGGC.cxx:633
 TGGC.cxx:634
 TGGC.cxx:635
 TGGC.cxx:636
 TGGC.cxx:637
 TGGC.cxx:638
 TGGC.cxx:639
 TGGC.cxx:640
 TGGC.cxx:641
 TGGC.cxx:642
 TGGC.cxx:643
 TGGC.cxx:644
 TGGC.cxx:645
 TGGC.cxx:646
 TGGC.cxx:647
 TGGC.cxx:648
 TGGC.cxx:649
 TGGC.cxx:650
 TGGC.cxx:651
 TGGC.cxx:652
 TGGC.cxx:653
 TGGC.cxx:654
 TGGC.cxx:655
 TGGC.cxx:656
 TGGC.cxx:657
 TGGC.cxx:658
 TGGC.cxx:659
 TGGC.cxx:660
 TGGC.cxx:661
 TGGC.cxx:662
 TGGC.cxx:663
 TGGC.cxx:664
 TGGC.cxx:665
 TGGC.cxx:666
 TGGC.cxx:667
 TGGC.cxx:668
 TGGC.cxx:669
 TGGC.cxx:670
 TGGC.cxx:671
 TGGC.cxx:672
 TGGC.cxx:673
 TGGC.cxx:674
 TGGC.cxx:675
 TGGC.cxx:676
 TGGC.cxx:677
 TGGC.cxx:678
 TGGC.cxx:679
 TGGC.cxx:680
 TGGC.cxx:681
 TGGC.cxx:682
 TGGC.cxx:683
 TGGC.cxx:684
 TGGC.cxx:685
 TGGC.cxx:686
 TGGC.cxx:687
 TGGC.cxx:688
 TGGC.cxx:689
 TGGC.cxx:690
 TGGC.cxx:691
 TGGC.cxx:692
 TGGC.cxx:693
 TGGC.cxx:694
 TGGC.cxx:695
 TGGC.cxx:696
 TGGC.cxx:697
 TGGC.cxx:698
 TGGC.cxx:699
 TGGC.cxx:700
 TGGC.cxx:701
 TGGC.cxx:702
 TGGC.cxx:703
 TGGC.cxx:704
 TGGC.cxx:705
 TGGC.cxx:706
 TGGC.cxx:707
 TGGC.cxx:708
 TGGC.cxx:709
 TGGC.cxx:710
 TGGC.cxx:711
 TGGC.cxx:712
 TGGC.cxx:713
 TGGC.cxx:714
 TGGC.cxx:715
 TGGC.cxx:716
 TGGC.cxx:717
 TGGC.cxx:718
 TGGC.cxx:719
 TGGC.cxx:720
 TGGC.cxx:721
 TGGC.cxx:722
 TGGC.cxx:723
 TGGC.cxx:724
 TGGC.cxx:725
 TGGC.cxx:726
 TGGC.cxx:727
 TGGC.cxx:728
 TGGC.cxx:729
 TGGC.cxx:730
 TGGC.cxx:731
 TGGC.cxx:732
 TGGC.cxx:733
 TGGC.cxx:734
 TGGC.cxx:735
 TGGC.cxx:736
 TGGC.cxx:737
 TGGC.cxx:738
 TGGC.cxx:739
 TGGC.cxx:740
 TGGC.cxx:741
 TGGC.cxx:742
 TGGC.cxx:743
 TGGC.cxx:744
 TGGC.cxx:745
 TGGC.cxx:746
 TGGC.cxx:747
 TGGC.cxx:748
 TGGC.cxx:749
 TGGC.cxx:750
 TGGC.cxx:751
 TGGC.cxx:752
 TGGC.cxx:753
 TGGC.cxx:754
 TGGC.cxx:755
 TGGC.cxx:756
 TGGC.cxx:757
 TGGC.cxx:758
 TGGC.cxx:759
 TGGC.cxx:760
 TGGC.cxx:761
 TGGC.cxx:762
 TGGC.cxx:763
 TGGC.cxx:764
 TGGC.cxx:765
 TGGC.cxx:766
 TGGC.cxx:767
 TGGC.cxx:768
 TGGC.cxx:769
 TGGC.cxx:770
 TGGC.cxx:771
 TGGC.cxx:772
 TGGC.cxx:773
 TGGC.cxx:774
 TGGC.cxx:775
 TGGC.cxx:776
 TGGC.cxx:777
 TGGC.cxx:778
 TGGC.cxx:779
 TGGC.cxx:780
 TGGC.cxx:781
 TGGC.cxx:782
 TGGC.cxx:783
 TGGC.cxx:784
 TGGC.cxx:785
 TGGC.cxx:786
 TGGC.cxx:787
 TGGC.cxx:788
 TGGC.cxx:789
 TGGC.cxx:790
 TGGC.cxx:791
 TGGC.cxx:792
 TGGC.cxx:793
 TGGC.cxx:794
 TGGC.cxx:795
 TGGC.cxx:796
 TGGC.cxx:797
 TGGC.cxx:798
 TGGC.cxx:799
 TGGC.cxx:800
 TGGC.cxx:801
 TGGC.cxx:802
 TGGC.cxx:803
 TGGC.cxx:804
 TGGC.cxx:805
 TGGC.cxx:806
 TGGC.cxx:807
 TGGC.cxx:808
 TGGC.cxx:809
 TGGC.cxx:810
 TGGC.cxx:811
 TGGC.cxx:812
 TGGC.cxx:813
 TGGC.cxx:814
 TGGC.cxx:815
 TGGC.cxx:816
 TGGC.cxx:817
 TGGC.cxx:818
 TGGC.cxx:819
 TGGC.cxx:820
 TGGC.cxx:821
 TGGC.cxx:822
 TGGC.cxx:823
 TGGC.cxx:824
 TGGC.cxx:825
 TGGC.cxx:826
 TGGC.cxx:827
 TGGC.cxx:828
 TGGC.cxx:829
 TGGC.cxx:830
 TGGC.cxx:831
 TGGC.cxx:832
 TGGC.cxx:833
 TGGC.cxx:834
 TGGC.cxx:835
 TGGC.cxx:836
 TGGC.cxx:837
 TGGC.cxx:838
 TGGC.cxx:839
 TGGC.cxx:840
 TGGC.cxx:841
 TGGC.cxx:842
 TGGC.cxx:843
 TGGC.cxx:844
 TGGC.cxx:845
 TGGC.cxx:846
 TGGC.cxx:847
 TGGC.cxx:848
 TGGC.cxx:849
 TGGC.cxx:850
 TGGC.cxx:851
 TGGC.cxx:852
 TGGC.cxx:853
 TGGC.cxx:854
 TGGC.cxx:855
 TGGC.cxx:856
 TGGC.cxx:857
 TGGC.cxx:858
 TGGC.cxx:859
 TGGC.cxx:860
 TGGC.cxx:861
 TGGC.cxx:862
 TGGC.cxx:863
 TGGC.cxx:864
 TGGC.cxx:865
 TGGC.cxx:866
 TGGC.cxx:867
 TGGC.cxx:868
 TGGC.cxx:869
 TGGC.cxx:870
 TGGC.cxx:871
 TGGC.cxx:872
 TGGC.cxx:873
 TGGC.cxx:874
 TGGC.cxx:875
 TGGC.cxx:876
 TGGC.cxx:877
 TGGC.cxx:878
 TGGC.cxx:879
 TGGC.cxx:880
 TGGC.cxx:881
 TGGC.cxx:882
 TGGC.cxx:883
 TGGC.cxx:884
 TGGC.cxx:885
 TGGC.cxx:886
 TGGC.cxx:887
 TGGC.cxx:888
 TGGC.cxx:889
 TGGC.cxx:890
 TGGC.cxx:891
 TGGC.cxx:892
 TGGC.cxx:893
 TGGC.cxx:894
 TGGC.cxx:895
 TGGC.cxx:896
 TGGC.cxx:897
 TGGC.cxx:898
 TGGC.cxx:899
 TGGC.cxx:900
 TGGC.cxx:901
 TGGC.cxx:902
 TGGC.cxx:903
 TGGC.cxx:904
 TGGC.cxx:905
 TGGC.cxx:906
 TGGC.cxx:907
 TGGC.cxx:908
 TGGC.cxx:909
 TGGC.cxx:910
 TGGC.cxx:911
 TGGC.cxx:912
 TGGC.cxx:913
 TGGC.cxx:914
 TGGC.cxx:915
 TGGC.cxx:916
 TGGC.cxx:917
 TGGC.cxx:918
 TGGC.cxx:919
 TGGC.cxx:920
 TGGC.cxx:921
 TGGC.cxx:922
 TGGC.cxx:923
 TGGC.cxx:924
 TGGC.cxx:925
 TGGC.cxx:926
 TGGC.cxx:927
 TGGC.cxx:928
 TGGC.cxx:929
 TGGC.cxx:930
 TGGC.cxx:931
 TGGC.cxx:932
 TGGC.cxx:933
 TGGC.cxx:934
 TGGC.cxx:935
 TGGC.cxx:936
 TGGC.cxx:937
 TGGC.cxx:938
 TGGC.cxx:939
 TGGC.cxx:940
 TGGC.cxx:941
 TGGC.cxx:942
 TGGC.cxx:943
 TGGC.cxx:944
 TGGC.cxx:945
 TGGC.cxx:946
 TGGC.cxx:947
 TGGC.cxx:948
 TGGC.cxx:949
 TGGC.cxx:950
 TGGC.cxx:951
 TGGC.cxx:952
 TGGC.cxx:953
 TGGC.cxx:954
 TGGC.cxx:955
 TGGC.cxx:956
 TGGC.cxx:957
 TGGC.cxx:958
 TGGC.cxx:959
 TGGC.cxx:960
 TGGC.cxx:961
 TGGC.cxx:962
 TGGC.cxx:963
 TGGC.cxx:964
 TGGC.cxx:965
 TGGC.cxx:966
 TGGC.cxx:967
 TGGC.cxx:968
 TGGC.cxx:969
 TGGC.cxx:970
 TGGC.cxx:971
 TGGC.cxx:972
 TGGC.cxx:973
 TGGC.cxx:974
 TGGC.cxx:975
 TGGC.cxx:976
 TGGC.cxx:977
 TGGC.cxx:978
 TGGC.cxx:979
 TGGC.cxx:980
 TGGC.cxx:981
 TGGC.cxx:982
 TGGC.cxx:983
 TGGC.cxx:984
 TGGC.cxx:985
 TGGC.cxx:986
 TGGC.cxx:987
 TGGC.cxx:988
 TGGC.cxx:989
 TGGC.cxx:990
 TGGC.cxx:991
 TGGC.cxx:992
 TGGC.cxx:993
 TGGC.cxx:994
 TGGC.cxx:995
 TGGC.cxx:996
 TGGC.cxx:997
 TGGC.cxx:998
 TGGC.cxx:999
 TGGC.cxx:1000
 TGGC.cxx:1001
 TGGC.cxx:1002
 TGGC.cxx:1003
 TGGC.cxx:1004
 TGGC.cxx:1005
 TGGC.cxx:1006
 TGGC.cxx:1007
 TGGC.cxx:1008
 TGGC.cxx:1009
 TGGC.cxx:1010
 TGGC.cxx:1011
 TGGC.cxx:1012
 TGGC.cxx:1013
 TGGC.cxx:1014
 TGGC.cxx:1015
 TGGC.cxx:1016
 TGGC.cxx:1017
 TGGC.cxx:1018
 TGGC.cxx:1019
 TGGC.cxx:1020
 TGGC.cxx:1021
 TGGC.cxx:1022
 TGGC.cxx:1023
 TGGC.cxx:1024
 TGGC.cxx:1025
 TGGC.cxx:1026
 TGGC.cxx:1027
 TGGC.cxx:1028
 TGGC.cxx:1029
 TGGC.cxx:1030
 TGGC.cxx:1031
 TGGC.cxx:1032
 TGGC.cxx:1033
 TGGC.cxx:1034
 TGGC.cxx:1035
 TGGC.cxx:1036
 TGGC.cxx:1037
 TGGC.cxx:1038
 TGGC.cxx:1039
 TGGC.cxx:1040
 TGGC.cxx:1041
 TGGC.cxx:1042
 TGGC.cxx:1043
 TGGC.cxx:1044
 TGGC.cxx:1045
 TGGC.cxx:1046
 TGGC.cxx:1047
 TGGC.cxx:1048
 TGGC.cxx:1049
 TGGC.cxx:1050
 TGGC.cxx:1051
 TGGC.cxx:1052
 TGGC.cxx:1053
 TGGC.cxx:1054
 TGGC.cxx:1055
 TGGC.cxx:1056
 TGGC.cxx:1057
 TGGC.cxx:1058
 TGGC.cxx:1059
 TGGC.cxx:1060
 TGGC.cxx:1061
 TGGC.cxx:1062
 TGGC.cxx:1063
 TGGC.cxx:1064
 TGGC.cxx:1065
 TGGC.cxx:1066
 TGGC.cxx:1067
 TGGC.cxx:1068
 TGGC.cxx:1069
 TGGC.cxx:1070
 TGGC.cxx:1071
 TGGC.cxx:1072
 TGGC.cxx:1073
 TGGC.cxx:1074
 TGGC.cxx:1075
 TGGC.cxx:1076
 TGGC.cxx:1077
 TGGC.cxx:1078
 TGGC.cxx:1079
 TGGC.cxx:1080
 TGGC.cxx:1081
 TGGC.cxx:1082
 TGGC.cxx:1083
 TGGC.cxx:1084
 TGGC.cxx:1085
 TGGC.cxx:1086
 TGGC.cxx:1087
 TGGC.cxx:1088
 TGGC.cxx:1089
 TGGC.cxx:1090
 TGGC.cxx:1091
 TGGC.cxx:1092
 TGGC.cxx:1093
 TGGC.cxx:1094
 TGGC.cxx:1095
 TGGC.cxx:1096
 TGGC.cxx:1097
 TGGC.cxx:1098
 TGGC.cxx:1099
 TGGC.cxx:1100
 TGGC.cxx:1101
 TGGC.cxx:1102
 TGGC.cxx:1103
 TGGC.cxx:1104
 TGGC.cxx:1105
 TGGC.cxx:1106
 TGGC.cxx:1107
 TGGC.cxx:1108
 TGGC.cxx:1109
 TGGC.cxx:1110
 TGGC.cxx:1111
 TGGC.cxx:1112
 TGGC.cxx:1113
 TGGC.cxx:1114
 TGGC.cxx:1115
 TGGC.cxx:1116
 TGGC.cxx:1117
 TGGC.cxx:1118
 TGGC.cxx:1119
 TGGC.cxx:1120
 TGGC.cxx:1121
 TGGC.cxx:1122
 TGGC.cxx:1123
 TGGC.cxx:1124
 TGGC.cxx:1125
 TGGC.cxx:1126
 TGGC.cxx:1127
 TGGC.cxx:1128
 TGGC.cxx:1129
 TGGC.cxx:1130
 TGGC.cxx:1131
 TGGC.cxx:1132
 TGGC.cxx:1133
 TGGC.cxx:1134
 TGGC.cxx:1135
 TGGC.cxx:1136
 TGGC.cxx:1137
 TGGC.cxx:1138
 TGGC.cxx:1139
 TGGC.cxx:1140
 TGGC.cxx:1141
 TGGC.cxx:1142
 TGGC.cxx:1143
 TGGC.cxx:1144
 TGGC.cxx:1145
 TGGC.cxx:1146
 TGGC.cxx:1147
 TGGC.cxx:1148
 TGGC.cxx:1149
 TGGC.cxx:1150
 TGGC.cxx:1151
 TGGC.cxx:1152
 TGGC.cxx:1153
 TGGC.cxx:1154
 TGGC.cxx:1155
 TGGC.cxx:1156
 TGGC.cxx:1157
 TGGC.cxx:1158
 TGGC.cxx:1159
 TGGC.cxx:1160
 TGGC.cxx:1161
 TGGC.cxx:1162
 TGGC.cxx:1163
 TGGC.cxx:1164
 TGGC.cxx:1165