// @(#)root/eve:$Id$
// Author: Matevz Tadel 2007

/*************************************************************************
 * Copyright (C) 1995-2007, 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 "TGPack.h"
#include "TGSplitter.h"
#include "TMath.h"

//______________________________________________________________________________
//
// Stack of frames in horizontal (default) or vertical stack.
// The splitters are placed between the neighbouring frames so that
// they can be resized by the user.
// When the whole pack is resized, frames are scaled proportionally to
// their previous size.
//
// When frames are left in pack at destruction time, they will be
// deleted via local-cleanup.

ClassImp(TGPack);

//______________________________________________________________________________
TGPack::TGPack(const TGWindow *p, UInt_t w, UInt_t h, UInt_t options, Pixel_t back) :
   TGCompositeFrame(p, w, h, options, back),
   fVertical     (kTRUE),
   fUseSplitters (kTRUE),
   fSplitterLen  (4),
   fDragOverflow (0),
   fWeightSum(0),
   fNVisible(0)
{
   // Constructor.

   SetCleanup(kLocalCleanup);
}

//______________________________________________________________________________
TGPack::TGPack(TGClient *c, Window_t id, const TGWindow *parent) :
   TGCompositeFrame(c, id, parent),
   fVertical     (kTRUE),
   fUseSplitters (kTRUE),
   fSplitterLen  (4),
   fDragOverflow (0),
   fWeightSum    (0.0),
   fNVisible     (0)
{
   // Constructor.

   SetCleanup(kLocalCleanup);
}

//______________________________________________________________________________
TGPack::~TGPack()
{
   // Destructor.
}

//------------------------------------------------------------------------------

//______________________________________________________________________________
Int_t TGPack::GetAvailableLength() const
{
   // Return length of entire frame without splitters.

   Int_t len = fVertical ? GetHeight() : GetWidth();
   len -= fSplitterLen * (fNVisible - 1);

   return len;
}

//______________________________________________________________________________
void TGPack::SetFrameLength(TGFrame* f, Int_t len)
{
   // Set pack-wise length of frame f.

   if (fVertical)
      f->Resize(GetWidth(), len);
   else
      f->Resize(len, GetHeight());
}

//______________________________________________________________________________
void TGPack::SetFramePosition(TGFrame* f, Int_t pos)
{
   // Set pack-wise position of frame f.

   if (fVertical)
      f->Move(0, pos);
   else
      f->Move(pos, 0);
}

//______________________________________________________________________________
void TGPack::CheckSplitterVisibility()
{
   // Check if splitter of first visible frame is hidden.
   // Check if the next following visible splitter is visible.

   TGFrameElementPack *el;
   TIter next(fList);
   Int_t rvf = 0;
   while ((el = (TGFrameElementPack*) next()))
   {
      if (el->fState && el->fSplitFE)
      {
         if (rvf)
         {
            // unmap first slider if necessary
            if ( el->fSplitFE->fState == 0 ) { 
               el->fSplitFE->fState = 1;
               el->fSplitFE->fFrame->MapWindow();
            }
         }
         else
         {
            // show slider in next visible frame
            if (el->fSplitFE->fState) {
               el->fSplitFE->fState = 0;
               el->fSplitFE->fFrame->UnmapWindow();
            }
         }
         ++rvf;
      }
   }
}

//______________________________________________________________________________
void TGPack::ResizeExistingFrames()
{
   // Resize (shrink or expand) existing frames by amount in total.

   if (fList->IsEmpty())
      return;

   // get unitsize
   Int_t nflen  = GetAvailableLength();
   Float_t unit = Float_t(nflen)/fWeightSum;

   // set frame sizes
   Int_t sumFrames = 0;
   Int_t frameLength = 0;
   {
      TGFrameElementPack *el;
      TIter next(fList);
      while ((el = (TGFrameElementPack*) next()))
      {
         if (el->fState && el->fWeight)
         {
            frameLength = TMath::Nint( unit*(el->fWeight));
            SetFrameLength(el->fFrame, frameLength);
            sumFrames += frameLength;
         }
      }
   }

   // redistribute the remain
   {
      // printf("available %d total %d \n", nflen, sumFrames);
      Int_t remain =  nflen-sumFrames;
      Int_t step = TMath::Sign(1, remain);
      TGFrameElementPack *el;
      TIter next(fList);
      while ((el = (TGFrameElementPack*) next()) && remain)
      {
         if (el->fState &&  el->fWeight)
         {
            Int_t l = GetFrameLength(el->fFrame) + step;
            if (l > 0)
            {
               SetFrameLength(el->fFrame, l);
               remain -= step;
            }
         }
      }
   }
   RefitFramesToPack();
}

//______________________________________________________________________________
void TGPack::RefitFramesToPack()
{
   // Refit existing frames to pack size.

   TGFrameElement *el;
   TIter next(fList);

   while ((el = (TGFrameElement *) next()))
   {
      if (fVertical)
         el->fFrame->Resize(GetWidth(), el->fFrame->GetHeight());
      else
         el->fFrame->Resize(el->fFrame->GetWidth(), GetHeight());
   }
}

//______________________________________________________________________________
void TGPack::FindFrames(TGFrame* splitter, TGFrameElementPack*& f0, TGFrameElementPack*& f1) const
{
   // Find frames around splitter and return them f0 (previous) and f1 (next).

   TGFrameElementPack *el;
   TIter next(fList);

   while ((el = (TGFrameElementPack *) next()))
   {
      if ( ! el->fState & kIsVisible)
         continue;

      if (el->fFrame == splitter)
         break;
      f0 = el;
   }
   f1 = (TGFrameElementPack *) next();
}


//------------------------------------------------------------------------------

//______________________________________________________________________________
void TGPack::AddFrameInternal(TGFrame* f, TGLayoutHints* l, Float_t weight)
{
   // Add frame f at the end.
   // LayoutHints are ignored in TGPack.

   // add splitter
   TGFrameElementPack *sf = 0;
   if (fUseSplitters) {
      TGSplitter* s = 0;
      if (fVertical)
         s = new TGHSplitter(this, GetWidth(), fSplitterLen, kTRUE);
      else
         s = new TGVSplitter(this, fSplitterLen, GetHeight(), kTRUE);
      s->Connect("Moved(Int_t)",  "TGPack", this, "HandleSplitterResize(Int_t)");
      s->Connect("DragStarted()", "TGPack", this, "HandleSplitterStart()");

      sf = new TGFrameElementPack(s, l ? l : fgDefaultHints, 0);
      fList->Add(sf);
      // in case of recusive cleanup, propagate cleanup setting to all
      // child composite frames
      if (fMustCleanup == kDeepCleanup)
         s->SetCleanup(kDeepCleanup);
      s->MapWindow();
   }

   // instread TGCopositeFrame::AddFrame
   TGFrameElementPack *el = new TGFrameElementPack(f, l ? l : fgDefaultHints, weight);
   el->fSplitFE = sf;
   fList->Add(el);

   // in case of recusive cleanup, propagate cleanup setting to all
   // child composite frames
   if (fMustCleanup == kDeepCleanup)
      f->SetCleanup(kDeepCleanup);
   f->MapWindow();

   fNVisible ++;
   fWeightSum += weight;

   CheckSplitterVisibility();
   ResizeExistingFrames();
}

//______________________________________________________________________________
void TGPack::AddFrameWithWeight(TGFrame* f, TGLayoutHints *l, Float_t weight)
{
   // Add frame f at the end with given weight.
   // LayoutHints are ignored in TGPack.

   AddFrameInternal(f, l, weight);
   Layout();
}

//______________________________________________________________________________
void TGPack::AddFrame(TGFrame* f, TGLayoutHints *l)
{
   // Add frame f at the end with default weight.
   // LayoutHints are ignored in TGPack.

   AddFrameInternal(f, l, 1);
   Layout();
}

//______________________________________________________________________________
void TGPack::RemoveFrameInternal(TGFrame* f)
{
   // Remove frame f.

   TGFrameElementPack *el = (TGFrameElementPack*)FindFrameElement(f);

   if (!el) return;

   if (fUseSplitters)
   {
      TGFrame* splitter = el->fSplitFE->fFrame;
      splitter->UnmapWindow();
      TGCompositeFrame::RemoveFrame(splitter);
      // This is needed so that splitter window gets destroyed on server.
      splitter->ReparentWindow(fClient->GetDefaultRoot());
      delete splitter;
   }
   if (el->fState & kIsVisible)
   {
      f->UnmapWindow();
      fWeightSum -= el->fWeight;
      --fNVisible;
   }
   TGCompositeFrame::RemoveFrame(f);

   CheckSplitterVisibility();
   ResizeExistingFrames();
}

//______________________________________________________________________________
void TGPack::DeleteFrame(TGFrame* f)
{
   // Remove frame f and refit existing frames to pack size.
   // Frame is deleted.

   RemoveFrameInternal(f);
   delete f;
   Layout();
}

//______________________________________________________________________________
void TGPack::RemoveFrame(TGFrame* f)
{
   // Remove frame f and refit existing frames to pack size.
   // Frame is not deleted.

   RemoveFrameInternal(f);
   Layout();
}

//______________________________________________________________________________
void TGPack::Dump() const
{
   // Print sub frame info.

   printf("--------------------------------------------------------------\n");
   Int_t cnt = 0;
   TGFrameElementPack *el;
   TIter next(fList);
   while ((el = (TGFrameElementPack *) next()))
   {
      printf("idx[%d] visible(%d) %s  \n",cnt, el->fState, el->fFrame->GetName());
      cnt++;
   }
   printf("--------------------------------------------------------------\n");
}

//______________________________________________________________________________
void TGPack::ShowFrame(TGFrame* f)
{
   // Show sub frame.
   // Virtual from TGCompositeFrame.

   TGFrameElementPack *el = (TGFrameElementPack*)FindFrameElement(f);
   if (el)
   {
      //show
      el->fState = 1;
      el->fFrame->MapWindow();

      // show splitter
      if (fUseSplitters)
      {
         el->fSplitFE->fFrame->MapWindow();
         el->fSplitFE->fState = 1;
      }

      // Dump();
      fNVisible++;
      fWeightSum += el->fWeight;

      CheckSplitterVisibility();
      ResizeExistingFrames();
      Layout();
   }
}

//______________________________________________________________________________
void TGPack::HideFrame(TGFrame* f)
{
   // Hide sub frame.
   // Virtual from TGCompositeFrame.

   TGFrameElementPack *el = (TGFrameElementPack*) FindFrameElement(f);
   if (el)
   {
      // hide real frame
      el->fState = 0;
      el->fFrame->UnmapWindow();

      // hide splitter
      if (fUseSplitters)
      {
         el->fSplitFE->fFrame->UnmapWindow();
         el->fSplitFE->fState = 0;
      }

      // Dump();
      fNVisible--;
      fWeightSum -= el->fWeight;

      CheckSplitterVisibility();
      ResizeExistingFrames();
      Layout();
   }
}

//------------------------------------------------------------------------------

//______________________________________________________________________________
void TGPack::MapSubwindows()
{
   // Virtual method of TGcompositeFrame.
   // Map all sub windows that are part of the composite frame.

   if (!fMapSubwindows) {
      return;
   }

   if (!fList) return;

   TGFrameElement *el;
   TIter next(fList);

   while ((el = (TGFrameElement *) next())) {
      if (el->fFrame && el->fState) {
         el->fFrame->MapWindow();
         el->fFrame->MapSubwindows();
         TGFrameElement *fe = el->fFrame->GetFrameElement();
         if (fe) fe->fState |= kIsVisible;
      }
   }
}

//______________________________________________________________________________
void TGPack::Resize(UInt_t w, UInt_t h)
{
   // Resize the pack.
   // Contents is resized proportionally.

   if (w == fWidth && h == fHeight) return;

   fWidth  = w;
   fHeight = h;
   TGWindow::Resize(fWidth, fHeight);

   ResizeExistingFrames();

   Layout();
}

//______________________________________________________________________________
void TGPack::MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h)
{
   // Move and resize the pack.

   TGCompositeFrame::Move(x, y);
   Resize(w, h);
}

//______________________________________________________________________________
void TGPack::Layout()
{
   // Reposition the frames so that they fit correctly.
   // LayoutHints are ignored.

   Int_t pos = 0;

   TGFrameElement *el;
   TIter next(fList);

   while ((el = (TGFrameElement *) next()))
   {
      if (el->fState)
      {
         SetFramePosition(el->fFrame, pos);
         pos += GetFrameLength(el->fFrame);
         el->fFrame->Layout();
      }
   }
}

//______________________________________________________________________________
void TGPack::EqualizeFrames()
{
   // Refit existing frames so that their lengths are equal.

   if (fList->IsEmpty())
      return;

   fWeightSum = 0;
   TGFrameElementPack *el;
   TIter next(fList);
   while ((el = (TGFrameElementPack *) next()))
   {
      el->fWeight = 1;
      if (el->fState)
         fWeightSum ++;
   }

   ResizeExistingFrames();
   Layout();
}

//______________________________________________________________________________
void TGPack::HandleSplitterStart()
{
   // Called when splitter drag starts.

   fDragOverflow = 0;
}

//______________________________________________________________________________
void TGPack::HandleSplitterResize(Int_t delta)
{
   // Handle resize events from splitters.

   Int_t available = GetAvailableLength();
   Int_t min_dec = - (available + fNVisible*2 -1);
   if (delta <  min_dec)
      delta = min_dec;

   TGSplitter *s = dynamic_cast<TGSplitter*>((TGFrame*) gTQSender);

   TGFrameElementPack *f0=0, *f1=0;
   FindFrames(s, f0, f1);

   if (fDragOverflow < 0)
   {
      fDragOverflow += delta;
      if (fDragOverflow > 0) {
         delta = fDragOverflow;
         fDragOverflow = 0;
      } else {
         return;
      }
   }
   else if (fDragOverflow > 0)
   {
      fDragOverflow += delta;
      if (fDragOverflow < 0) {
         delta = fDragOverflow;
         fDragOverflow = 0;
      } else {
         return;
      }
   }

   Int_t l0 = GetFrameLength(f0->fFrame);
   Int_t l1 = GetFrameLength(f1->fFrame);
   if (delta < 0)
   {
      if (l0 - 1 < -delta)
      {
         fDragOverflow += delta + l0 - 1;
         delta = -l0 + 1;
      }
   }
   else
   {
      if (l1 - 1 < delta)
      {
         fDragOverflow += delta - l1 + 1;
         delta = l1 - 1;
      }
   }
   l0 += delta;
   l1 -= delta;
   SetFrameLength(f0->fFrame, l0);
   SetFrameLength(f1->fFrame, l1);
   Float_t weightDelta = Float_t(delta)/available;
   weightDelta *= fWeightSum;
   f0->fWeight += weightDelta;
   f1->fWeight -= weightDelta;

   ResizeExistingFrames();
   Layout();
}

//------------------------------------------------------------------------------

//______________________________________________________________________________
void TGPack::SetVertical(Bool_t x)
{
   // Sets the vertical flag and reformats the back to new stacking
   // direction.

   if (x == fVertical)
      return;

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