// $Id: TGHtml.h,v 1.1 2007/05/04 17:07:01 brun Exp $
// Author:  Valeriy Onuchin   03/05/2007

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

/**************************************************************************

    HTML widget for xclass. Based on tkhtml 1.28
    Copyright (C) 1997-2000 D. Richard Hipp <drh@acm.org>
    Copyright (C) 2002-2003 Hector Peraza.

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

**************************************************************************/

#ifndef ROOT_TGHtml
#define ROOT_TGHtml

#ifndef ROOT_TGView
#include "TGView.h"
#endif

#ifndef ROOT_TGHtmlTokens
#include "TGHtmlTokens.h"
#endif

class TGClient;
class TImage;
class TGFont;
class TGIdleHandler;
class THashTable;
class TTimer;

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

#define HTML_RELIEF_FLAT    0
#define HTML_RELIEF_SUNKEN  1
#define HTML_RELIEF_RAISED  2

//#define TABLE_TRIM_BLANK 1

// Debug must be turned on for testing to work.
//#define DEBUG

#define CANT_HAPPEN  \
  fprintf(stderr, \
          "Unplanned behavior in the HTML Widget in file %s line %d\n", \
          __FILE__, __LINE__)

#define UNTESTED  \
  fprintf(stderr, \
          "Untested code executed in the HTML Widget in file %s line %d\n", \
          __FILE__, __LINE__)

// Sanity checking macros.

#ifdef DEBUG
#define HtmlAssert(X) \
  if(!(X)){ \
    fprintf(stderr,"Assertion failed on line %d of %s\n",__LINE__,__FILE__); \
  }
#define HtmlCantHappen \
  fprintf(stderr,"Can't happen on line %d of %s\n",__LINE__,__FILE__);
#else
#define HtmlAssert(X)
#define HtmlCantHappen
#endif

// Bitmasks for the HtmlTraceMask global variable

#define HtmlTrace_Table1       0x00000001
#define HtmlTrace_Table2       0x00000002
#define HtmlTrace_Table3       0x00000004
#define HtmlTrace_Table4       0x00000008
#define HtmlTrace_Table5       0x00000010
#define HtmlTrace_Table6       0x00000020
#define HtmlTrace_GetLine      0x00000100
#define HtmlTrace_GetLine2     0x00000200
#define HtmlTrace_FixLine      0x00000400
#define HtmlTrace_BreakMarkup  0x00001000
#define HtmlTrace_Style        0x00002000
#define HtmlTrace_Input1       0x00004000

// The TRACE macro is used to print internal information about the
// HTML layout engine during testing and debugging. The amount of
// information printed is governed by a global variable named
// HtmlTraceMask. If bits in the first argument to the TRACE macro
// match any bits in HtmlTraceMask variable, then the trace message
// is printed.
//
// All of this is completely disabled, of course, if the DEBUG macro
// is not defined.

#ifdef DEBUG
extern int HtmlTraceMask;
extern int HtmlDepth;
# define TRACE_INDENT  printf("%*s",HtmlDepth-3,"")
# define TRACE(Flag, Args) \
    if( (Flag)&HtmlTraceMask ){ \
       TRACE_INDENT; printf Args; fflush(stdout); \
    }
# define TRACE_PUSH(Flag)  if( (Flag)&HtmlTraceMask ){ HtmlDepth+=3; }
# define TRACE_POP(Flag)   if( (Flag)&HtmlTraceMask ){ HtmlDepth-=3; }
#else
# define TRACE_INDENT
# define TRACE(Flag, Args)
# define TRACE_PUSH(Flag)
# define TRACE_POP(Flag)
#endif


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

// Various data types. This code is designed to run on a modern cached
// architecture where the CPU runs a lot faster than the memory bus. Hence
// we try to pack as much data into as small a space as possible so that it
// is more likely to fit in cache. The extra CPU instruction or two needed
// to unpack the data is not normally an issue since we expect the speed of
// the memory bus to be the limiting factor.

typedef unsigned char  Html_u8_t;      // 8-bit unsigned integer
typedef short          Html_16_t;      // 16-bit signed integer
typedef unsigned short Html_u16_t;     // 16-bit unsigned integer
typedef int            Html_32_t;      // 32-bit signed integer

// An instance of the following structure is used to record style
// information on each Html element.

struct SHtmlStyle_t {
  unsigned int fFont      : 6;      // Font to use for display
  unsigned int fColor     : 6;      // Foreground color
  signed int   fSubscript : 4;      // Positive for <sup>, negative for <sub>
  unsigned int fAlign     : 2;      // Horizontal alignment
  unsigned int fBgcolor   : 6;      // Background color
  unsigned int fExpbg     : 1;      // Set to 1 if bgcolor explicitly set
  unsigned int fFlags     : 7;      // the STY_ flags below
};


// We allow 8 different font families: Normal, Bold, Italic and Bold-Italic
// in either variable or constant width. Within each family there can be up
// to 7 font sizes from 1 (the smallest) up to 7 (the largest). Hence, the
// widget can use a maximum of 56 fonts. The ".font" field of the style is
// an integer between 0 and 55 which indicates which font to use.

// HP: we further subdivide the .font field into two 3-bit subfields (size
// and family). That makes easier to manipulate the family field.

#define N_FONT_FAMILY     8
#define N_FONT_SIZE       7
#define N_FONT            71
#define NormalFont(X)     (X)
#define BoldFont(X)       ((X) | 8)
#define ItalicFont(X)     ((X) | 16)
#define CWFont(X)         ((X) | 32)
#define FontSize(X)       ((X) & 007)
#define FontFamily(X)     ((X) & 070)
#define FONT_Any          -1
#define FONT_Default      3
#define FontSwitch(Size, Bold, Italic, Cw) \
                          ((Size) | ((Bold+(Italic)*2+(Cw)*4) << 3))

// Macros for manipulating the fontValid bitmap of an TGHtml object.

#define FontIsValid(I)     ((fFontValid[(I)>>3] &   (1<<((I)&3)))!=0)
#define FontSetValid(I)     (fFontValid[(I)>>3] |=  (1<<((I)&3)))
#define FontClearValid(I)   (fFontValid[(I)>>3] &= ~(1<<((I)&3)))


// Information about available colors.
//
// The widget will use at most N_COLOR colors. 4 of these colors are
// predefined. The rest are user selectable by options to various markups.
// (Ex: <font color=red>)
//
// All colors are stored in the apColor[] array of the main widget object.
// The ".color" field of the SHtmlStyle_t is an integer between 0 and
// N_COLOR-1 which indicates which of these colors to use.

#define N_COLOR             32      // Total number of colors

#define COLOR_Normal         0      // Index for normal color (black)
#define COLOR_Unvisited      1      // Index for unvisited hyperlinks
#define COLOR_Visited        2      // Color for visited hyperlinks
#define COLOR_Selection      3      // Background color for the selection
#define COLOR_Background     4      // Default background color
#define N_PREDEFINED_COLOR   5      // Number of predefined colors


// The "align" field of the style determines how text is justified
// horizontally. ALIGN_None means that the alignment is not specified.
// (It should probably default to ALIGN_Left in this case.)

#define ALIGN_Left   1
#define ALIGN_Right  2
#define ALIGN_Center 3
#define ALIGN_None   0


// Possible value of the "flags" field of SHtmlStyle_t are shown below.
//
//  STY_Preformatted       If set, the current text occurred within
//                         <pre>..</pre>
//
//  STY_StrikeThru         Draw a solid line thru the middle of this text.
//
//  STY_Underline          This text should drawn with an underline.
//
//  STY_NoBreak            This text occurs within <nobr>..</nobr>
//
//  STY_Anchor             This text occurs within <a href=X>..</a>.
//
//  STY_DT                 This text occurs within <dt>..</dt>.
//
//  STY_Invisible          This text should not appear in the main HTML
//                         window. (For example, it might be within
//                         <title>..</title> or <marquee>..</marquee>.)

#define STY_Preformatted    0x001
#define STY_StrikeThru      0x002
#define STY_Underline       0x004
#define STY_NoBreak         0x008
#define STY_Anchor          0x010
#define STY_DT              0x020
#define STY_Invisible       0x040
#define STY_FontMask        (STY_StrikeThru|STY_Underline)


//----------------------------------------------------------------------
// The first thing done with input HTML text is to parse it into
// TGHtmlElements. All sizing and layout is done using these elements.

// Every element contains at least this much information:

class TGHtmlElement : public TObject {
public:
   TGHtmlElement(int etype = 0);

   virtual int  IsMarkup() const { return (fType > Html_Block); }
   virtual const char *MarkupArg(const char * /*tag*/, const char * /*zDefault*/) { return 0; }
   virtual int  GetAlignment(int dflt) { return dflt; }
   virtual int  GetOrderedListType(int dflt) { return dflt; }
   virtual int  GetUnorderedListType(int dflt) { return dflt; }
   virtual int  GetVerticalAlignment(int dflt) { return dflt; }

public:
   TGHtmlElement *fPNext;        // Next input token in a list of them all
   TGHtmlElement *fPPrev;        // Previous token in a list of them all
   SHtmlStyle_t   fStyle;        // The rendering style for this token
   Html_u8_t      fType;         // The token type.
   Html_u8_t      fFlags;        // The HTML_ flags below
   Html_16_t      fCount;        // Various uses, depending on "type"
   int            fElId;         // Unique identifier
   int            fOffs;         // Offset within zText
};


// Bitmasks for the "flags" field of the TGHtmlElement

#define HTML_Visible   0x01   // This element produces "ink"
#define HTML_NewLine   0x02   // type == Html_Space and ends with newline
#define HTML_Selected  0x04   // Some or all of this Html_Block is selected
                              // Used by Html_Block elements only.


// Each text element holds additional information as shown here. Notice that
// extra space is allocated so that zText[] will be large enough to hold the
// complete text of the element. X and y coordinates are relative to the
// virtual canvas. The y coordinate refers to the baseline.

class TGHtmlTextElement : public TGHtmlElement {
private:
   TGHtmlTextElement(const TGHtmlTextElement&);            // Not implemented.
   TGHtmlTextElement &operator=(const TGHtmlTextElement&); // Not implemented.

public:
   TGHtmlTextElement(int size);
   virtual ~TGHtmlTextElement();

   Html_32_t    fY;                // y coordinate where text should be rendered
   Html_16_t    fX;                // x coordinate where text should be rendered
   Html_16_t    fW;                // width of this token in pixels
   Html_u8_t    fAscent;           // height above the baseline
   Html_u8_t    fDescent;          // depth below the baseline
   Html_u8_t    fSpaceWidth;       // Width of one space in the current font
   char        *fZText;            // Text for this element. Null terminated
};


// Each space element is represented like this:

class TGHtmlSpaceElement : public TGHtmlElement {
public:
   Html_16_t fW;                  // Width of a single space in current font
   Html_u8_t fAscent;             // height above the baseline
   Html_u8_t fDescent;            // depth below the baseline

public:
   TGHtmlSpaceElement() : TGHtmlElement(Html_Space), fW(0), fAscent(0), fDescent(0) {}
};

// Most markup uses this class. Some markup extends this class with
// additional information, but most use it as is, at the very least.
//
// If the markup doesn't have arguments (the "count" field of
// TGHtmlElement is 0) then the extra "argv" field of this class
// is not allocated and should not be used.

class TGHtmlMarkupElement : public TGHtmlElement {
public:
   TGHtmlMarkupElement(int type, int argc, int arglen[], char *argv[]);
   virtual ~TGHtmlMarkupElement();

   virtual const char *MarkupArg(const char *tag, const char *zDefault);
   virtual int  GetAlignment(int dflt);
   virtual int  GetOrderedListType(int dflt);
   virtual int  GetUnorderedListType(int dflt);
   virtual int  GetVerticalAlignment(int dflt);

public://protected:
   char **fArgv;
};


// The maximum number of columns allowed in a table. Any columns beyond
// this number are ignored.

#define HTML_MAX_COLUMNS 40


// This class is used for each <table> element.
//
// In the minW[] and maxW[] arrays, the [0] element is the overall
// minimum and maximum width, including cell padding, spacing and
// the "hspace". All other elements are the minimum and maximum
// width for the contents of individual cells without any spacing or
// padding.

class TGHtmlTable : public TGHtmlMarkupElement {
public:
   TGHtmlTable(int type, int argc, int arglen[], char *argv[]);
   ~TGHtmlTable();

public:
   Html_u8_t      fBorderWidth;              // Width of the border
   Html_u8_t      fNCol;                     // Number of columns
   Html_u16_t     fNRow;                     // Number of rows
   Html_32_t      fY;                        // top edge of table border
   Html_32_t      fH;                        // height of the table border
   Html_16_t      fX;                        // left edge of table border
   Html_16_t      fW;                        // width of the table border
   int            fMinW[HTML_MAX_COLUMNS+1]; // minimum width of each column
   int            fMaxW[HTML_MAX_COLUMNS+1]; // maximum width of each column
   TGHtmlElement *fPEnd;                     // Pointer to the end tag element
   TImage        *fBgImage;                  // A background for the entire table
   int            fHasbg;                    // 1 if a table above has bgImage
};


// Each <td> or <th> markup is represented by an instance of the
// following class.
//
// Drawing for a cell is a sunken 3D border with the border width given
// by the borderWidth field in the associated <table> object.

class TGHtmlCell : public TGHtmlMarkupElement {
public:
   TGHtmlCell(int type, int argc, int arglen[], char *argv[]);
   ~TGHtmlCell();

public:
   Html_16_t      fRowspan;      // Number of rows spanned by this cell
   Html_16_t      fColspan;      // Number of columns spanned by this cell
   Html_16_t      fX;            // X coordinate of left edge of border
   Html_16_t      fW;            // Width of the border
   Html_32_t      fY;            // Y coordinate of top of border indentation
   Html_32_t      fH;            // Height of the border
   TGHtmlTable   *fPTable;       // Pointer back to the <table>
   TGHtmlElement *fPRow;         // Pointer back to the <tr>
   TGHtmlElement *fPEnd;         // Element that ends this cell
   TImage        *fBgImage;      // Background for the cell
};


// This class is used for </table>, </td>, <tr>, </tr> and </th> elements.
// It points back to the <table> element that began the table. It is also
// used by </a> to point back to the original <a>. I'll probably think of
// other uses before all is said and done...

class TGHtmlRef : public TGHtmlMarkupElement {
public:
   TGHtmlRef(int type, int argc, int arglen[], char *argv[]);
   ~TGHtmlRef();

public:
   TGHtmlElement *fPOther;      // Pointer to some other Html element
   TImage        *fBgImage;     // A background for the entire row
};


// An instance of the following class is used to represent
// each <LI> markup.

class TGHtmlLi : public TGHtmlMarkupElement {
public:
   TGHtmlLi(int type, int argc, int arglen[], char *argv[]);

public:
   Html_u8_t fLtype;    // What type of list is this?
   Html_u8_t fAscent;   // height above the baseline
   Html_u8_t fDescent;  // depth below the baseline
   Html_16_t fCnt;      // Value for this element (if inside <OL>)
   Html_16_t fX;        // X coordinate of the bullet
   Html_32_t fY;        // Y coordinate of the bullet
};


// The ltype field of an TGHtmlLi or TGHtmlListStart object can take on
// any of the following values to indicate what type of bullet to draw.
// The value in TGHtmlLi will take precedence over the value in
// TGHtmlListStart if the two values differ.

#define LI_TYPE_Undefined 0     // If in TGHtmlLi, use the TGHtmlListStart value
#define LI_TYPE_Bullet1   1     // A solid circle
#define LI_TYPE_Bullet2   2     // A hollow circle
#define LI_TYPE_Bullet3   3     // A hollow square
#define LI_TYPE_Enum_1    4     // Arabic numbers
#define LI_TYPE_Enum_A    5     // A, B, C, ...
#define LI_TYPE_Enum_a    6     // a, b, c, ...
#define LI_TYPE_Enum_I    7     // Capitalized roman numerals
#define LI_TYPE_Enum_i    8     // Lower-case roman numerals


// An instance of this class is used for <UL> or <OL> markup.

class TGHtmlListStart : public TGHtmlMarkupElement {
public:
   TGHtmlListStart(int type, int argc, int arglen[], char *argv[]);

public:
   Html_u8_t         fLtype;     // One of the LI_TYPE_ defines above
   Html_u8_t         fCompact;   // True if the COMPACT flag is present
   Html_u16_t        fCnt;       // Next value for <OL>
   Html_u16_t        fWidth;     // How much space to allow for indentation
   TGHtmlListStart  *fLPrev;     // Next higher level list, or NULL
};


#define HTML_MAP_RECT    1
#define HTML_MAP_CIRCLE  2
#define HTML_MAP_POLY    3

class TGHtmlMapArea : public TGHtmlMarkupElement {
public:
   TGHtmlMapArea(int type, int argc, int arglen[], char *argv[]);

public:
   int    fMType;
   int   *fCoords;
   int    fNum;
};


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

// Structure to chain extension data onto.

struct SHtmlExtensions_t {
   void              *fExts;
   int                fTyp;
   int                fFlags;
   SHtmlExtensions_t *fNext;
};


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

// Information about each image on the HTML widget is held in an instance
// of the following class. All images are held on a list attached to the
// main widget object.
//
// This class is NOT an element. The <IMG> element is represented by an
// TGHtmlImageMarkup object below. There is one TGHtmlImageMarkup for each
// <IMG> in the source HTML. There is one of these objects for each unique
// image loaded. (If two <IMG> specify the same image, there are still two
// TGHtmlImageMarkup objects but only one TGHtmlImage object that is shared
// between them.)

class TGHtml;
class TGHtmlImageMarkup;

class TGHtmlImage : public TObject {
private:
   TGHtmlImage(const TGHtmlImage&);            // Not implemented.
   TGHtmlImage &operator=(const TGHtmlImage&); // Not implemented.

public:
   TGHtmlImage(TGHtml *htm, const char *url, const char *width,
               const char *height);
   virtual ~TGHtmlImage();

public:
   TGHtml            *fHtml;              // The owner of this image
   TImage            *fImage;             // The image token
   Html_32_t          fW;                 // Requested width of this image (0 if none)
   Html_32_t          fH;                 // Requested height of this image (0 if none)
   char              *fZUrl;              // The URL for this image.
   char              *fZWidth, *fZHeight; // Width and height in the <img> markup.
   TGHtmlImage       *fPNext;             // Next image on the list
   TGHtmlImageMarkup *fPList;             // List of all <IMG> markups that use this
                                          // same image
   TTimer            *fTimer;             // for animations
};

// Each <img> markup is represented by an instance of the following
// class.
//
// If pImage == 0, then we use the alternative text in zAlt.

class TGHtmlImageMarkup : public TGHtmlMarkupElement {
public:
   TGHtmlImageMarkup(int type, int argc, int arglen[], char *argv[]);

public:
   Html_u8_t          fAlign;          // Alignment. See IMAGE_ALIGN_ defines below
   Html_u8_t          fTextAscent;     // Ascent of text font in force at the <IMG>
   Html_u8_t          fTextDescent;    // Descent of text font in force at the <IMG>
   Html_u8_t          fRedrawNeeded;   // Need to redraw this image because the image
                                       // content changed.
   Html_16_t          fH;              // Actual height of the image
   Html_16_t          fW;              // Actual width of the image
   Html_16_t          fAscent;         // How far image extends above "y"
   Html_16_t          fDescent;        // How far image extends below "y"
   Html_16_t          fX;              // X coordinate of left edge of the image
   Html_32_t          fY;              // Y coordinate of image baseline
   const char        *fZAlt;           // Alternative text
   TGHtmlImage       *fPImage;         // Corresponding TGHtmlImage object
   TGHtmlElement     *fPMap;           // usemap
   TGHtmlImageMarkup *fINext;          // Next markup using the same TGHtmlImage object
};


// Allowed alignments for images. These represent the allowed arguments
// to the "align=" field of the <IMG> markup.

#define IMAGE_ALIGN_Bottom        0
#define IMAGE_ALIGN_Middle        1
#define IMAGE_ALIGN_Top           2
#define IMAGE_ALIGN_TextTop       3
#define IMAGE_ALIGN_AbsMiddle     4
#define IMAGE_ALIGN_AbsBottom     5
#define IMAGE_ALIGN_Left          6
#define IMAGE_ALIGN_Right         7


// All kinds of form markup, including <INPUT>, <TEXTAREA> and <SELECT>
// are represented by instances of the following class.
//
// (later...)  We also use this for the <APPLET> markup. That way,
// the window we create for an <APPLET> responds to the TGHtml::MapControls()
// and TGHtml::UnmapControls() function calls. For an <APPLET>, the
// pForm field is NULL. (Later still...) <EMBED> works just like
// <APPLET> so it uses this class too.

class TGHtmlForm;

class TGHtmlInput : public TGHtmlMarkupElement {
public:
   TGHtmlInput(int type, int argc, int arglen[], char *argv[]);

   void Empty();

public:
   TGHtmlForm     *fPForm;       // The <FORM> to which this belongs
   TGHtmlInput    *fINext;       // Next element in a list of all input elements
   TGFrame        *fFrame;       // The xclass window that implements this control
   TGHtml         *fHtml;        // The HTML widget this control is attached to
   TGHtmlElement  *fPEnd;        // End tag for <TEXTAREA>, etc.
   Html_u16_t      fInpId;       // Unique id for this element
   Html_u16_t      fSubId;       // For radio - an id, for select - option count
   Html_32_t       fY;           // Baseline for this input element
   Html_u16_t      fX;           // Left edge
   Html_u16_t      fW, fH;       // Width and height of this control
   Html_u8_t       fPadLeft;     // Extra padding on left side of the control
   Html_u8_t       fAlign;       // One of the IMAGE_ALIGN_xxx types
   Html_u8_t       fTextAscent;  // Ascent for the current font
   Html_u8_t       fTextDescent; // descent for the current font
   Html_u8_t       fItype;       // What type of input is this?
   Html_u8_t       fSized;       // True if this input has been sized already
   Html_u16_t      fCnt;         // Used to derive widget name. 0 if no widget
};


// An input control can be one of the following types. See the
// comment about <APPLET> on the TGHtmlInput class insight into
// INPUT_TYPE_Applet.

#define INPUT_TYPE_Unknown      0
#define INPUT_TYPE_Checkbox     1
#define INPUT_TYPE_File         2
#define INPUT_TYPE_Hidden       3
#define INPUT_TYPE_Image        4
#define INPUT_TYPE_Password     5
#define INPUT_TYPE_Radio        6
#define INPUT_TYPE_Reset        7
#define INPUT_TYPE_Select       8
#define INPUT_TYPE_Submit       9
#define INPUT_TYPE_Text        10
#define INPUT_TYPE_TextArea    11
#define INPUT_TYPE_Applet      12
#define INPUT_TYPE_Button      13


// There can be multiple <FORM> entries on a single HTML page.
// Each one must be given a unique number for identification purposes,
// and so we can generate unique state variable names for radiobuttons,
// checkbuttons, and entry boxes.

class TGHtmlForm : public TGHtmlMarkupElement {
public:
   TGHtmlForm(int type, int argc, int arglen[], char *argv[]);

public:
   Html_u16_t     fFormId;    // Unique number assigned to this form
   unsigned int   fElements;  // Number of elements
   unsigned int   fHasctl;    // Has controls
   TGHtmlElement *fPFirst;    // First form element
   TGHtmlElement *fPEnd;      // Pointer to end tag element
};


// Information used by a <HR> markup

class TGHtmlHr : public TGHtmlMarkupElement {
public:
   TGHtmlHr(int type, int argc, int arglen[], char *argv[]);

public:
   Html_32_t   fY;      // Baseline for this input element
   Html_u16_t  fX;      // Left edge
   Html_u16_t  fW, fH;  // Width and height of this control
   Html_u8_t   fIs3D;   // Is it drawn 3D?
};


// Information used by a <A> markup

class TGHtmlAnchor : public TGHtmlMarkupElement {
public:
   TGHtmlAnchor(int type, int argc, int arglen[], char *argv[]);

public:
   Html_32_t  fY;   // Top edge for this element
};


// Information about the <SCRIPT> markup. The parser treats <SCRIPT>
// specially. All text between <SCRIPT> and </SCRIPT> is captured and
// is indexed to by the nStart field of this class.
//
// The nStart field indexs to a spot in the zText field of the TGHtml object.
// The nScript field determines how long the script is.

class TGHtmlScript : public TGHtmlMarkupElement {
public:
   TGHtmlScript(int type, int argc, int arglen[], char *argv[]);

public:
   int   fNStart;    // Start of the script (index into TGHtml::zText)
   int   fNScript;   // Number of characters of text in zText holding
                     // the complete text of this script
};


// A block is a single unit of display information. This can be one or more
// text elements, or the border of table, or an image, etc.
//
// Blocks are used to improve display speed and to improve the speed of
// linear searchs through the token list. A single block will typically
// contain enough information to display a dozen or more Text and Space
// elements all with a single call to OXFont::DrawChars(). The blocks are
// linked together on their own list, so we can search them much faster than
// elements (since there are fewer of them.)
//
// Of course, you can construct pathological HTML that has as many Blocks as
// it has normal tokens. But you haven't lost anything. Using blocks just
// speeds things up in the common case.
//
// Much of the information needed for display is held in the original
// TGHtmlElement objects. "fPNext" points to the first object in the list
// which can be used to find the "style" "x" and "y".
//
// If n is zero, then "fPNext" might point to a special TGHtmlElement
// that defines some other kind of drawing, like <LI> or <IMG> or <INPUT>.

class TGHtmlBlock : public TGHtmlElement {
public:
   TGHtmlBlock();
   virtual ~TGHtmlBlock();

public:
   char        *fZ;                 // Space to hold text when n > 0
   int          fTop, fBottom;      // Extremes of y coordinates
   Html_u16_t   fLeft, fRight;      // Left and right boundry of this object
   Html_u16_t   fN;                 // Number of characters in z[]
   TGHtmlBlock *fBPrev, *fBNext;    // Linked list of all Blocks
};


// A stack of these structures is used to keep track of nested font and
// style changes. This allows us to easily revert to the previous style
// when we encounter and end-tag like </em> or </h3>.
//
// This stack is used to keep track of the current style while walking
// the list of elements. After all elements have been assigned a style,
// the information in this stack is no longer used.

struct SHtmlStyleStack_t {
   SHtmlStyleStack_t *fPNext;   // Next style on the stack
   int                fType;    // A markup that ends this style. Ex: Html_EndEM
   SHtmlStyle_t       fStyle;   // The currently active style.
};


// A stack of the following structures is used to remember the
// left and right margins within a layout context.

struct SHtmlMargin_t {
   int            fIndent;    // Size of the current margin
   int            fBottom;    // Y value at which this margin expires
   int            fTag;       // Markup that will cancel this margin
   SHtmlMargin_t *fPNext;     // Previous margin
};


// How much space (in pixels) used for a single level of indentation due
// to a <UL> or <DL> or <BLOCKQUOTE>, etc.

#define HTML_INDENT 36


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

// A layout context holds all state information used by the layout engine.

class TGHtmlLayoutContext : public TObject {
public:
   TGHtmlLayoutContext();

   void LayoutBlock();
   void Reset();

   void PopIndent();
   void PushIndent();

protected:
   void PushMargin(SHtmlMargin_t **ppMargin, int indent, int bottom, int tag);
   void PopOneMargin(SHtmlMargin_t **ppMargin);
   void PopMargin(SHtmlMargin_t **ppMargin, int tag);
   void PopExpiredMargins(SHtmlMargin_t **ppMarginStack, int y);
   void ClearMarginStack(SHtmlMargin_t **ppMargin);

   TGHtmlElement *GetLine(TGHtmlElement *pStart, TGHtmlElement *pEnd,
                          int width, int minX, int *actualWidth);

   void FixAnchors(TGHtmlElement *p, TGHtmlElement *pEnd, int y);
   int  FixLine(TGHtmlElement *pStart, TGHtmlElement *pEnd,
                int bottom, int width, int actualWidth, int leftMargin,
                int *maxX);
   void Paragraph(TGHtmlElement *p);
   void ComputeMargins(int *pX, int *pY, int *pW);
   void ClearObstacle(int mode);
   TGHtmlElement *DoBreakMarkup(TGHtmlElement *p);
   int  InWrapAround();
   void WidenLine(int reqWidth, int *pX, int *pY, int *pW);

   TGHtmlElement *TableLayout(TGHtmlTable *p);

public:
   TGHtml           *fHtml;            // The html widget undergoing layout
   TGHtmlElement    *fPStart;          // Start of elements to layout
   TGHtmlElement    *fPEnd;            // Stop when reaching this element
   int               fHeadRoom;        // Extra space wanted above this line
   int               fTop;             // Absolute top of drawing area
   int               fBottom;          // Bottom of previous line
   int               fLeft, fRight;    // Left and right extremes of drawing area
   int               fPageWidth;       // Width of the layout field, including
                                       // the margins
   int               fMaxX, fMaxY;     // Maximum X and Y values of paint
   SHtmlMargin_t    *fLeftMargin;      // Stack of left margins
   SHtmlMargin_t    *fRightMargin;     // Stack of right margins
};


// With 28 different fonts and 16 colors, we could in principle have
// as many as 448 different GCs. But in practice, a single page of
// HTML will typically have much less than this. So we won't try to
// keep all GCs on hand. Instead, we'll keep around the most recently
// used GCs and allocate new ones as necessary.
//
// The following structure is used to build a cache of GCs in the
// main widget object.

#define N_CACHE_GC 32

struct GcCache_t {
   GContext_t  fGc;        // The graphics context
   Html_u8_t   fFont;      // Font used for this context
   Html_u8_t   fColor;     // Color used for this context
   Html_u8_t   fIndex;     // Index used for LRU replacement
};


// An SHtmlIndex_t is a reference to a particular character within a
// particular Text or Space token.

struct SHtmlIndex_t {
   TGHtmlElement *fP;     // The token containing the character
   int            fI;     // Index of the character
};


// Used by the tokenizer

struct SHtmlTokenMap_t {
   const char       *fZName;        // Name of a markup
   Html_16_t         fType;         // Markup type code
   Html_16_t         fObjType;      // Which kind of TGHtml... object to alocate
   SHtmlTokenMap_t  *fPCollide;     // Hash table collision chain
};


// Markup element types to be allocated by the tokenizer.
// Do not confuse with .type field in TGHtmlElement

#define O_HtmlMarkupElement   0
#define O_HtmlCell            1
#define O_HtmlTable           2
#define O_HtmlRef             3
#define O_HtmlLi              4
#define O_HtmlListStart       5
#define O_HtmlImageMarkup     6
#define O_HtmlInput           7
#define O_HtmlForm            8
#define O_HtmlHr              9
#define O_HtmlAnchor          10
#define O_HtmlScript          11
#define O_HtmlMapArea         12


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

// The HTML widget. A derivate of TGView.

class TGListBox;
class THashTable;

class TGHtml : public TGView {
public:
   TGHtml(const TGWindow *p, int w, int h, int id = -1);
   virtual ~TGHtml();

   virtual Bool_t HandleFocusChange(Event_t *event);
   virtual Bool_t HandleButton(Event_t *event);
   virtual Bool_t HandleMotion(Event_t *event);

   virtual Bool_t HandleIdleEvent(TGIdleHandler *i);
   virtual Bool_t HandleTimer(TTimer *timer);

   virtual Bool_t ProcessMessage(Long_t, Long_t, Long_t);

   virtual void   DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h);
   virtual Bool_t ItemLayout();

   Bool_t         HandleHtmlInput(TGHtmlInput *pr, Event_t *event);
   Bool_t         HandleRadioButton(TGHtmlInput *p);

public:   // user commands

   int  ParseText(char *text, const char *index = 0);

   void SetTableRelief(int relief);
   int  GetTableRelief() const { return fTableRelief; }

   void SetRuleRelief(int relief);
   int  GetRuleRelief() const { return fRuleRelief; }
   int  GetRulePadding() const { return fRulePadding; }

   void UnderlineLinks(int onoff);

   void SetBaseUri(const char *uri);
   const char *GetBaseUri() const { return fZBase; }

   int GotoAnchor(const char *name);

public:   // reloadable methods

   // called when the widget is cleared
   virtual void Clear(Option_t * = "");

   // User function to resolve URIs
   virtual char *ResolveUri(const char *uri);

   // User function to get an image from a URL
   virtual TImage *LoadImage(const char *uri, int w = 0, int h = 0) ;//
   //    { return 0; }

   // User function to tell if a hyperlink has already been visited
   virtual int IsVisited(const char * /*url*/)
      { return kFALSE; }

   // User function to process tokens of the given type
   virtual int ProcessToken(TGHtmlElement * /*pElem*/, const char * /*name*/, int /*type*/)
      { return kFALSE; }

   virtual TGFont *GetFont(int iFont);

   // The HTML parser will invoke the following methods from time
   // to time to find out information it needs to complete formatting of
   // the document.

   // Method for handling <frameset> markup
   virtual int ProcessFrame()
      { return kFALSE; }

   // Method to process applets
   virtual TGFrame *ProcessApplet(TGHtmlInput * /*input*/)
      { return 0; }

   // Called when parsing forms
   virtual int FormCreate(TGHtmlForm * /*form*/, const char * /*zUrl*/, const char * /*args*/)
      { return kFALSE; }

   // Called when user presses Submit
   virtual int FormAction(TGHtmlForm * /*form*/, int /*id*/)
      { return kFALSE; }

   // Invoked to find font names
   virtual char *GetFontName()
      { return 0; }

   // Invoked for each <SCRIPT> markup
   virtual char *ProcessScript(TGHtmlScript * /*script*/)
      { return 0; }

public:
   const char *GetText() const { return fZText; }

   int GetMarginWidth() { return fMargins.fL + fMargins.fR; }
   int GetMarginHeight() { return fMargins.fT + fMargins.fB; }

   TGHtmlInput *GetInputElement(int x, int y);
   const char *GetHref(int x, int y, const char **target = 0);

   TGHtmlImage *GetImage(TGHtmlImageMarkup *p);

   int  InArea(TGHtmlMapArea *p, int left, int top, int x, int y);
   TGHtmlElement *GetMap(const char *name);

   void ResetBlocks() { fFirstBlock = fLastBlock = 0; }
   int  ElementCoords(TGHtmlElement *p, int i, int pct, int *coords);

   TGHtmlElement *TableDimensions(TGHtmlTable *pStart, int lineWidth);
   int  CellSpacing(TGHtmlElement *pTable);
   void MoveVertically(TGHtmlElement *p, TGHtmlElement *pLast, int dy);

   void PrintList(TGHtmlElement *first, TGHtmlElement *last);

   char *GetTokenName(TGHtmlElement *p);
   char *DumpToken(TGHtmlElement *p);

   void EncodeText(TGString *str, const char *z);

protected:
   void HClear();
   void ClearGcCache();
   void ResetLayoutContext();
   void Redraw();
   void ComputeVirtualSize();

   void ScheduleRedraw();

   void RedrawArea(int left, int top, int right, int bottom);
   void RedrawBlock(TGHtmlBlock *p);
   void RedrawEverything();
   void RedrawText(int y);

   float ColorDistance(ColorStruct_t *pA, ColorStruct_t *pB);
   int IsDarkColor(ColorStruct_t *p);
   int IsLightColor(ColorStruct_t *p);
   int GetColorByName(const char *zColor);
   int GetDarkShadowColor(int iBgColor);
   int GetLightShadowColor(int iBgColor);
   int GetColorByValue(ColorStruct_t *pRef);

   void FlashCursor();

   GContext_t GetGC(int color, int font);
   GContext_t GetAnyGC();

   void AnimateImage(TGHtmlImage *image);
   void ImageChanged(TGHtmlImage *image, int newWidth, int newHeight);
   int  GetImageAlignment(TGHtmlElement *p);
   int  GetImageAt(int x, int y);
   const char *GetPctWidth(TGHtmlElement *p, char *opt, char *ret);
   void TableBgndImage(TGHtmlElement *p);

   TGHtmlElement *FillOutBlock(TGHtmlBlock *p);
   void UnlinkAndFreeBlock(TGHtmlBlock *pBlock);
   void AppendBlock(TGHtmlElement *pToken, TGHtmlBlock *pBlock);

   void StringHW(const char *str, int *h, int *w);
   TGHtmlElement *MinMax(TGHtmlElement *p, int *pMin, int *pMax,
                         int lineWidth, int hasbg);

   void DrawSelectionBackground(TGHtmlBlock *pBlock, Drawable_t Drawable_t,
                                int x, int y);
   void DrawRect(Drawable_t drawable, TGHtmlElement *src,
                 int x, int y, int w, int h, int depth, int relief);
   void BlockDraw(TGHtmlBlock *pBlock, Drawable_t wid,
                  int left, int top,
                  int width, int height, Pixmap_t pixmap);
   void DrawImage(TGHtmlImageMarkup *image, Drawable_t wid,
                  int left, int top,
                  int right, int bottom);
   void DrawTableBgnd(int x, int y, int w, int h, Drawable_t d, TImage *image);

   TGHtmlElement *FindStartOfNextBlock(TGHtmlElement *p, int *pCnt);
   void FormBlocks();

   void AppendElement(TGHtmlElement *pElem);
   int  Tokenize();
   void AppToken(TGHtmlElement *pNew, TGHtmlElement *p, int offs);
   TGHtmlMarkupElement *MakeMarkupEntry(int objType, int type, int argc,
                                        int arglen[], char *argv[]);
   void TokenizerAppend(const char *text);
   TGHtmlElement *InsertToken(TGHtmlElement *pToken,
                              char *zType, char *zArgs, int offs);
   SHtmlTokenMap_t *NameToPmap(char *zType);
   int  NameToType(char *zType);
   const char *TypeToName(int type);
   int  TextInsertCmd(int argc, char **argv);
   SHtmlTokenMap_t* GetMarkupMap(int n);

   TGHtmlElement *TokenByIndex(int N, int flag);
   int  TokenNumber(TGHtmlElement *p);

   void MaxIndex(TGHtmlElement *p, int *pIndex, int isLast);
   int  IndexMod(TGHtmlElement **pp, int *ip, char *cp);
   void FindIndexInBlock(TGHtmlBlock *pBlock, int x,
                         TGHtmlElement **ppToken, int *pIndex);
   void IndexToBlockIndex(SHtmlIndex_t sIndex,
                          TGHtmlBlock **ppBlock, int *piIndex);
   int  DecodeBaseIndex(const char *zBase,
                        TGHtmlElement **ppToken, int *pIndex);
   int  GetIndex(const char *zIndex, TGHtmlElement **ppToken, int *pIndex);

   void LayoutDoc();

   int  MapControls();
   void UnmapControls();
   void DeleteControls();
   int  ControlSize(TGHtmlInput *p);
   void SizeAndLink(TGFrame *frame, TGHtmlInput *pElem);
   int  FormCount(TGHtmlInput *p, int radio);
   void AddFormInfo(TGHtmlElement *p);
   void AddSelectOptions(TGListBox *lb, TGHtmlElement *p, TGHtmlElement *pEnd);
   void AppendText(TGString *str, TGHtmlElement *pFirst, TGHtmlElement *pEnd);

   void UpdateSelection(int forceUpdate);
   void UpdateSelectionDisplay();
   void LostSelection();
   int  SelectionSet(const char *startIx, const char *endIx);
   void UpdateInsert();
   int  SetInsert(const char *insIx);

   const char *GetUid(const char *string);
   ColorStruct_t *AllocColor(const char *name);
   ColorStruct_t *AllocColorByValue(ColorStruct_t *color);
   void FreeColor(ColorStruct_t *color);

   SHtmlStyle_t GetCurrentStyle();
   void PushStyleStack(int tag, SHtmlStyle_t style);
   SHtmlStyle_t PopStyleStack(int tag);

   void MakeInvisible(TGHtmlElement *p_first, TGHtmlElement *p_last);
   int  GetLinkColor(const char *zURL);
   void AddStyle(TGHtmlElement *p);
   void Sizer();

   int  NextMarkupType(TGHtmlElement *p);

   TGHtmlElement *AttrElem(const char *name, char *value);

public:
   void AppendArglist(TGString *str, TGHtmlMarkupElement *pElem);
   TGHtmlElement *FindEndNest(TGHtmlElement *sp, int en, TGHtmlElement *lp);
   TGString *ListTokens(TGHtmlElement *p, TGHtmlElement *pEnd);
   TGString *TableText(TGHtmlTable *pTable, int flags);

   virtual void MouseOver(const char *uri) { Emit("MouseOver(const char *)",uri); } // *SIGNAL*
   virtual void MouseDown(const char *uri)  { Emit("MouseDown(const char *)",uri); } // *SIGNAL*
   virtual void ButtonClicked(const char *name, const char *val); // *SIGNAL*
   virtual void SubmitClicked(const char *val); // *SIGNAL*
   virtual void CheckToggled(const char *name, Bool_t on, const char *val); // *SIGNAL*
   virtual void RadioChanged(const char *name, const char *val); // *SIGNAL*
   virtual void InputSelected(const char *name, const char *val);   //*SIGNAL*
   virtual void SavePrimitive(std::ostream &out, Option_t * = "");

protected:
   virtual void UpdateBackgroundStart();

protected:
   TGHtmlElement *fPFirst;          // First HTML token on a list of them all
   TGHtmlElement *fPLast;           // Last HTML token on the list
   int            fNToken;          // Number of HTML tokens on the list.
                                    // Html_Block tokens don't count.
   TGHtmlElement *fLastSized;       // Last HTML element that has been sized
   TGHtmlElement *fNextPlaced;      // Next HTML element that needs to be
                                    // positioned on canvas.
   TGHtmlBlock   *fFirstBlock;      // List of all TGHtmlBlock tokens
   TGHtmlBlock   *fLastBlock;       // Last TGHtmlBlock in the list
   TGHtmlInput   *fFirstInput;      // First <INPUT> element
   TGHtmlInput   *fLastInput;       // Last <INPUT> element
   int            fNInput;          // The number of <INPUT> elements
   int            fNForm;           // The number of <FORM> elements
   int            fVarId;           // Used to construct a unique name for a
                                    // global array used by <INPUT> elements
   int            fInputIdx;        // Unique input index
   int            fRadioIdx;        // Unique radio index

   // Information about the selected region of text

   SHtmlIndex_t   fSelBegin;        // Start of the selection
   SHtmlIndex_t   fSelEnd;          // End of the selection
   TGHtmlBlock   *fPSelStartBlock;  // Block in which selection starts
   Html_16_t      fSelStartIndex;   // Index in pSelStartBlock of first selected
                                    // character
   Html_16_t      fSelEndIndex;     // Index of last selecte char in pSelEndBlock
   TGHtmlBlock   *fPSelEndBlock;    // Block in which selection ends

   // Information about the insertion cursor

   int            fInsOnTime;       // How long the cursor states one (millisec)
   int            fInsOffTime;      // How long it is off (milliseconds)
   int            fInsStatus;       // Is it visible?
   TTimer        *fInsTimer;        // Timer used to flash the insertion cursor
   SHtmlIndex_t   fIns;             // The insertion cursor position
   TGHtmlBlock   *fPInsBlock;       // The TGHtmlBlock containing the cursor
   int            fInsIndex;        // Index in pInsBlock of the cursor

   // The following fields hold state information used by the tokenizer.

   char          *fZText;           // Complete text of the unparsed HTML
   int            fNText;           // Number of characters in zText
   int            fNAlloc;          // Space allocated for zText
   int            fNComplete;       // How much of zText has actually been
                                    // converted into tokens
   int            fICol;            // The column in which zText[nComplete]
                                    // occurs. Used to resolve tabs in input
   int            fIPlaintext;      // If not zero, this is the token type that
                                    // caused us to go into plaintext mode. One
                                    // of Html_PLAINTEXT, Html_LISTING or
                                    // Html_XMP
   TGHtmlScript  *fPScript;         // <SCRIPT> currently being parsed

   TGIdleHandler *fIdle;

   // These fields hold state information used by the HtmlAddStyle routine.
   // We have to store this state information here since HtmlAddStyle
   // operates incrementally. This information must be carried from
   // one incremental execution to the next.

   SHtmlStyleStack_t *fStyleStack;     // The style stack
   int               fParaAlignment;   // Justification associated with <p>
   int               fRowAlignment;    // Justification associated with <tr>
   int               fAnchorFlags;     // Style flags associated with <A>...</A>
   int               fInDt;            // Style flags associated with <DT>...</DT>
   int               fInTr;            // True if within <tr>..</tr>
   int               fInTd;            // True if within <td>..</td> or <th>..</th>
   TGHtmlAnchor     *fAnchorStart;     // Most recent <a href=...>
   TGHtmlForm       *fFormStart;       // Most recent <form>
   TGHtmlInput      *fFormElemStart;   // Most recent <textarea> or <select>
   TGHtmlInput      *fFormElemLast;    // Most recent <input>, <textarea> or <select>
   TGHtmlListStart  *fInnerList;       // The inner most <OL> or <UL>
   TGHtmlElement    *fLoEndPtr;        // How far AddStyle has gone to
   TGHtmlForm       *fLoFormStart;     // For AddStyle

   // These fields are used to hold the state of the layout engine.
   // Because the layout is incremental, this state must be held for
   // the life of the widget.

   TGHtmlLayoutContext fLayoutContext;

   // Information used when displaying the widget:

   int               fHighlightWidth;        // Width in pixels of highlight to draw
                                             // around widget when it has the focus.
                                             // <= 0 means don't draw a highlight.
   TGInsets          fMargins;               // document margins (separation between the
                                             // edge of the clip window and rendered HTML).
   ColorStruct_t    *fHighlightBgColorPtr;   // Color for drawing traversal highlight
                                             // area when highlight is off.
   ColorStruct_t    *fHighlightColorPtr;     // Color for drawing traversal highlight.
   TGFont           *fAFont[N_FONT];         // Information about all screen fonts
   char              fFontValid[(N_FONT+7)/8]; // If bit N%8 of work N/8 of this field is 0
                                             // if aFont[N] needs to be reallocated before
                                             // being used.
   ColorStruct_t    *fApColor[N_COLOR];      // Information about all colors
   Long_t            fColorUsed;             // bit N is 1 if color N is in use. Only
                                             // applies to colors that aren't predefined
   int               fIDark[N_COLOR];        // Dark 3D shadow of color K is iDark[K]
   int               fILight[N_COLOR];       // Light 3D shadow of color K is iLight[K]
   ColorStruct_t    *fBgColor;               // Background color of the HTML document
   ColorStruct_t    *fFgColor;               // Color of normal text. apColor[0]
   ColorStruct_t    *fNewLinkColor;          // Color of unvisitied links. apColor[1]
   ColorStruct_t    *fOldLinkColor;          // Color of visitied links. apColor[2]
   ColorStruct_t    *fSelectionColor;        // Background color for selections
   GcCache_t         fAGcCache[N_CACHE_GC];  // A cache of GCs for general use
   int               fGcNextToFree;
   int               fLastGC;                // Index of recently used GC
   TGHtmlImage      *fImageList;             // A list of all images
   TImage           *fBgImage;               // Background image

   int               fFormPadding;           // Amount to pad form elements by
   int               fOverrideFonts;         // TRUE if we should override fonts
   int               fOverrideColors;        // TRUE if we should override colors
   int               fUnderlineLinks;        // TRUE if we should underline hyperlinks
   int               fHasScript;             // TRUE if we can do scripts for this page
   int               fHasFrames;             // TRUE if we can do frames for this page
   int               fAddEndTags;            // TRUE if we add /LI etc.
   int               fTableBorderMin;        // Force tables to have min border size
   int               fVarind;                // Index suffix for unique global var name

   // Information about the selection

   int               fExportSelection;       // True if the selection is automatically
                                             // exported to the clipboard

   // Miscellaneous information:

   int               fTableRelief;           // 3d effects on <TABLE>
   int               fRuleRelief;            // 3d effects on <HR>
   int               fRulePadding;           // extra pixels above and below <HR>
   const char       *fZBase;                 // The base URI
   char             *fZBaseHref;             // zBase as modified by <BASE HREF=..> markup
   Cursor_t          fCursor;                // Current cursor for window, or None.
   int               fMaxX, fMaxY;           // Maximum extent of any "paint" that appears
                                             // on the virtual canvas. Used to compute
                                             // scrollbar positions.
   int               fDirtyLeft, fDirtyTop;  // Top left corner of region to redraw. These
                                             // are physical screen coordinates relative to
                                             // the clip win, not main window.
   int               fDirtyRight, fDirtyBottom;  // Bottom right corner of region to redraw
   int               fFlags;                 // Various flags; see below for definitions.
   int               fIdind;
   int               fInParse;               // Prevent update if parsing
   char             *fZGoto;                 // Label to goto right after layout

   SHtmlExtensions_t *fExts;                 // Pointer to user extension data

   THashTable       *fUidTable;              // Hash table for some used string values
                                             // like color names, etc.
   const char       *fLastUri;               // Used in HandleMotion
   int               fExiting;               // True if the widget is being destroyed

   ClassDef(TGHtml, 0); // HTML widget
};


// Flag bits "flags" field of the Html widget:
//
// REDRAW_PENDING         An idle handler has already been queued to
//                        call the TGHtml::Redraw() method.
//
// GOT_FOCUS              This widget currently has input focus.
//
// HSCROLL                Horizontal scrollbar position needs to be
//                        recomputed.
//
// VSCROLL                Vertical scrollbar position needs to be
//                        recomputed.
//
// RELAYOUT               We need to reposition every element on the
//                        virtual canvas. (This happens, for example,
//                        when the size of the widget changes and we
//                        need to recompute the line breaks.)
//
// RESIZE_ELEMENTS        We need to recompute the size of every element.
//                        This happens, for example, when the fonts
//                        change.
//
// REDRAW_FOCUS           We need to repaint the focus highlight border.
//
// REDRAW_TEXT            Everything in the clipping window needs to be redrawn.
//
// STYLER_RUNNING         There is a call to HtmlAddStyle() in process.
//                        Used to prevent a recursive call to HtmlAddStyle().
//
// INSERT_FLASHING        True if there is a timer scheduled that will toggle
//                        the state of the insertion cursor.
//
// REDRAW_IMAGES          One or more TGHtmlImageMarkup objects have their
//                        redrawNeeded flag set.

#define REDRAW_PENDING       0x000001
#define GOT_FOCUS            0x000002
#define HSCROLL              0x000004
#define VSCROLL              0x000008
#define RELAYOUT             0x000010
#define RESIZE_ELEMENTS      0x000020
#define REDRAW_FOCUS         0x000040
#define REDRAW_TEXT          0x000080
#define EXTEND_LAYOUT        0x000100
#define STYLER_RUNNING       0x000200
#define INSERT_FLASHING      0x000400
#define REDRAW_IMAGES        0x000800
#define ANIMATE_IMAGES       0x001000


// Macros to set, clear or test bits of the "flags" field.

#define HtmlHasFlag(A,F)      (((A)->flags&(F))==(F))
#define HtmlHasAnyFlag(A,F)   (((A)->flags&(F))!=0)
#define HtmlSetFlag(A,F)      ((A)->flags|=(F))
#define HtmlClearFlag(A,F)    ((A)->flags&=~(F))


// No coordinate is ever as big as this number

#define LARGE_NUMBER 100000000


// Default values for configuration options

#define DEF_HTML_BG_COLOR             DEF_FRAME_BG_COLOR
#define DEF_HTML_BG_MONO              DEF_FRAME_BG_MONO
#define DEF_HTML_EXPORT_SEL           1
#define DEF_HTML_FG                   DEF_BUTTON_FG
#define DEF_HTML_HIGHLIGHT_BG         DEF_BUTTON_HIGHLIGHT_BG
#define DEF_HTML_HIGHLIGHT            DEF_BUTTON_HIGHLIGHT
#define DEF_HTML_HIGHLIGHT_WIDTH      "0"
#define DEF_HTML_INSERT_OFF_TIME      300
#define DEF_HTML_INSERT_ON_TIME       600
#define DEF_HTML_PADX                 (HTML_INDENT / 4)
#define DEF_HTML_PADY                 (HTML_INDENT / 4)
#define DEF_HTML_RELIEF               "raised"
#define DEF_HTML_SELECTION_COLOR      "skyblue"
#define DEF_HTML_TAKE_FOCUS           "0"
#define DEF_HTML_UNVISITED            "blue2"
#define DEF_HTML_VISITED              "purple4"

#ifdef NAVIGATOR_TABLES

#define DEF_HTML_TABLE_BORDER             "0"
#define DEF_HTML_TABLE_CELLPADDING        "2"
#define DEF_HTML_TABLE_CELLSPACING        "5"
#define DEF_HTML_TABLE_BORDER_LIGHT_COLOR "gray80"
#define DEF_HTML_TABLE_BORDER_DARK_COLOR  "gray40"

#endif  // NAVIGATOR_TABLES


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

// Messages generated by the HTML widget
/*
class TGHtmlMessage : public OWidgetMessage {
public:
  TGHtmlMessage(int t, int a, int i, const char *u, int rx, int ry) :
    OWidgetMessage(t, a, i) {
      uri = u;
      x_root = rx;
      y_root = ry;
    }

public:
  const char *uri;
  //ORectangle bbox;
  int x_root, y_root;
};
*/

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