dslinux/user/pixil/packages/viewml/viewml/src CHANGES ChangeLog DESIGN Makefile Makefile.new README.HTMLWidget bookmark.cpp bookmark.h bookmark.xpm build_depends.mk debug.cpp demo.html html.cpp html.h html.moc htmlchain.cpp htmlchain.h htmlclue.cpp htmlclue.h htmldata.cpp htmldata.h htmlfont.cpp htmlfont.h htmlform.cpp htmlform.h htmlform.moc htmlframe.cpp htmlframe.h htmlframe.moc htmliter.cpp htmliter.h htmlobj.cpp htmlobj.h htmlobj.moc htmltable.cpp htmltable.h htmltoken.cpp htmltoken.h htmlview.cpp htmlview.h htmlview.moc http.cpp http.h http.moc http_.cpp jscript.cpp jscript.h khtmlw_dnd.xpm main.cpp main.moc pixmaps.h viewml.xpm vmlapp.cpp vmlapp.h

amadeus dslinux_amadeus at user.in-berlin.de
Tue Oct 3 13:26:43 CEST 2006


Update of /cvsroot/dslinux/dslinux/user/pixil/packages/viewml/viewml/src
In directory antilope:/tmp/cvs-serv11916/packages/viewml/viewml/src

Added Files:
	CHANGES ChangeLog DESIGN Makefile Makefile.new 
	README.HTMLWidget bookmark.cpp bookmark.h bookmark.xpm 
	build_depends.mk debug.cpp demo.html html.cpp html.h html.moc 
	htmlchain.cpp htmlchain.h htmlclue.cpp htmlclue.h htmldata.cpp 
	htmldata.h htmlfont.cpp htmlfont.h htmlform.cpp htmlform.h 
	htmlform.moc htmlframe.cpp htmlframe.h htmlframe.moc 
	htmliter.cpp htmliter.h htmlobj.cpp htmlobj.h htmlobj.moc 
	htmltable.cpp htmltable.h htmltoken.cpp htmltoken.h 
	htmlview.cpp htmlview.h htmlview.moc http.cpp http.h http.moc 
	http_.cpp jscript.cpp jscript.h khtmlw_dnd.xpm main.cpp 
	main.moc pixmaps.h viewml.xpm vmlapp.cpp vmlapp.h 
Log Message:
adding pristine copy of pixil to HEAD so I can branch from it

--- NEW FILE: htmlview.h ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
[...963 lines suppressed...]
     * if there are no frames at all then this pointer is 0L.
     */
    KHTMLView *parentView;

    /*
     * This string holds some temporary data. It is used by @ref KHTMLWidget
     *
     * @see #setCookie
     * @see #getCookie
     */
    QString cookie;              

    int scrollToX;
    int scrollToY;
};

#endif




--- NEW FILE: main.cpp ---
#include <kapp.h>
#include "html.h"
#include <Fl.H>
#ifdef _NANOX
#include <n_x.h>
#else
#include <x.H>
#endif
#include <fl_draw.H>
#include <Fl_Window.H>
#include <Fl_Button.H>
#include <Fl_Pixmap.H>
#include <Fl_Input.H>
#ifdef USING_FLEK_LIB
#include <Fl_Animator.H>
#include <Flve_Combo.H>
#endif
#include <Fl_Pack.H>
//#include <Fl_Scroll.H>

#include "fltk/nxscroll.h"

#include <Fl_Image.H>
#include "http.h"
#include "vmlapp.h"
#include "history.h"
#include "fltk/qconst.h"
#include "fltk/qlist.h"
#include "pixmaps.h"
#include "bookmark.h"
#include "bookmark.xpm"
#include "viewml.xpm"

static Fl_Pixmap	pixmap_bm(bookmark_xpm);

// CRH
#include <unistd.h>
#include <sys/stat.h>

// Define which box type you wish for the buttons at the top
// #define VIEWML_BUTTON_STYLE FL_UP_BOX
#define VIEWML_BUTTON_STYLE FL_FLAT_BOX
#define VIEWML_MAX_HISTORY		10
#define	VIEWML_MAX_BOOKMARKS	10


// Internal forward/back history list
QList<QString> g_History;
int g_HistoryIndex=-1;

// Initial x/y postion on screen
int g_AppX = 0;
int g_AppY = 0;

char g_StartURL[256];

// Initial app width/height
// CRH int g_AppWidth = 600;
// CRH int g_AppHeight = 400;
int g_AppWidth = 640;
int g_AppHeight = 480;

#ifdef USING_FLEK_LIB
Flve_Combo	*g_URL;
Fl_Animator	*g_Logo = 0;
#else
Fl_Input * g_URL;
Fl_Button * g_Logo;
#endif

static char				*g_BMFile = NULL;							// Class default, unless specified

extern Fl_Button *Forward;
extern Fl_Button *Backward;
extern Fl_Button *Stop;
extern Fl_Button *Reload;

static char oldstr[256] = "";
static int hindex = 0;

int g_Vert = 0;
#ifdef USING_FLEK_LIB
Flve_Combo	*g_Input;
#else
Fl_Input * g_Input;
#endif

Fl_Window * g_HTMLWindow;
VMLAppWindow * g_AppWindow = 0;

void LoadPage(const char * URL);
VMLAppWindow * make_window();

KApplication g_KApp;

#define HTML_WIDGET KHTMLView
#define xHTML_WIDGET KHTMLWidget

void LoadDoc(const char * URL, int w, int h);
#ifdef USING_FLEK_LIB
void UpdateHistoryBox(const char *URL);
#endif

HTML_WIDGET * g_HTML;
HTTPConnection * g_Conn;

BookMark		*g_BookMark;										// Global bookmark entity

#ifdef _NANOX

// the below is needed to fix some X compilation problems with Nano-X
unsigned long KeyPress;
bool XCheckTypedEvent( Display *, unsigned long , 
		       XEvent * )
{
	return false;
}
#endif


int main(int argc, char ** argv)
{
  // CRH  int index,loop;
  int c;
  extern int  optind;
  extern char *optarg;
  // end CRH
  
  VMLAppWindow * mw;
  
  // recover any command-line parameters
  g_StartURL[0] = 0x00;
  
  // CRH (with a minor addition by jsk for -u backward-compatibility)
  while ((c = getopt(argc, argv, "b:h:u:w:x:y:?")) != EOF)
    {
      switch (c)
	{
	case 'b':
		if (optarg)
			g_BMFile = optarg;
		break;
	case 'h':
	  g_AppHeight = atoi(optarg);
	  break;
	case 'u':
	  strcpy(g_StartURL, optarg);
	  break;
	case 'w':
	  g_AppWidth = atoi(optarg);
	  break;
	case 'x':
	  g_AppX = atoi(optarg);
	  break;
	case 'y':
	  g_AppY = atoi(optarg);
	  break;
	default:
	  printf("%s [opts] [URL or filename]\n", argv[0]);
	  printf("\t -u URL (deprecated)\n");
	  printf("\t -h window height\n");
	  printf("\t -w window width\n");
	  printf("\t -x window X co-ord\n");
	  printf("\t -y window Y co-ord\n");
	  exit(1);
	}
    }
  if (optind < argc)
    strcpy(g_StartURL, argv[optind]);
  // end CRH
  
  // fake out the widget - "remove" all parms
  argc = 1;
  
  g_Conn = new HTTPConnection();
  g_Conn->setDocCallback(LoadDoc);

  if (g_BMFile == NULL)
  	g_BookMark = new BookMark(VIEWML_MAX_BOOKMARKS);
  else
	  g_BookMark = new BookMark(VIEWML_MAX_BOOKMARKS, g_BMFile);

  mw = make_window();

  g_Conn->setHTML(g_HTML);

  mw->show(argc,argv);

  g_HTML->setGeometry(SCROLLPAD,TITLEHEIGHT ,WIDTH,HEIGHT);
  g_HTML->Fl_Window::begin();

  g_History.setAutoDelete(1);

// CRH cerr << "Main window is " << g_AppWindow << "(" << fl_xid(g_AppWindow) << ")\n";
// CRH cerr << "HTML Widget is " << g_HTML << "(" << fl_xid(g_HTML) << ")\n";

#ifdef _NANOX

  GrReparentWindow(fl_xid(g_HTML),fl_xid(g_AppWindow),SCROLLPAD,TITLEHEIGHT);

  GR_WINDOW_INFO info;
  GrGetWindowInfo(fl_xid(g_HTML),&info);

#endif

  if(g_StartURL[0] != 0x00)
    LoadPage(g_StartURL);
  
  while(Fl::wait()) {}

  return 0;
}

Fl_Button *Forward=(Fl_Button *)0;

//davet
#define MAX_PROTO_STRLEN 7 // must be set to length of longest protocol
static char *protocols[] = 
{
  "http://",
  "file://",
#ifdef OPTIONAL_URI_PROTOCOLS
  "ftp://",
  "afs://",
  "news:",
  "nntp:",
  "mid:",
  "cid:",
  "mailto:",
  "wais://",
  "prospero://",
  "telnet://"
  "gopher://",
#endif
  NULL
};

void SetInput(const char * URL)
{
	g_Input->value(URL);
//  g_Input->input->value(URL);
//  g_Input->input->set_changed();
//  g_Input->input->mark(256);
}

void _LoadPage(const char * URL)
{
// CRH
struct stat status;
  char buf[1024];
  int pindex;

  // get URL protocol
  strncpy(buf,URL,MAX_PROTO_STRLEN);
  buf[MAX_PROTO_STRLEN] = 0x00;

  // check for protocol in list
  pindex = 0;
  while(protocols[pindex] != NULL)
  {
    if(strncmp(buf,protocols[pindex],strlen(protocols[pindex])) == 0)
      break;
    ++pindex;
  }

  // check for missing protocol
  if(protocols[pindex] == NULL)
// CRH
    if(!stat(URL, &status)
       && (S_ISREG(status.st_mode) || S_ISDIR(status.st_mode)))
      if(URL[0] == '/')
	sprintf(buf,"file://%s",URL);
      else
	sprintf(buf,"file://%s/%s", getenv("PWD"), URL);
    else
// end
      sprintf(buf,"http://%s",URL);
  else
    strcpy(buf,URL);

#ifdef USING_FLEK_LIB
  UpdateHistoryBox(buf);
#endif
  SetInput(buf);

  g_Conn->loadPage(g_HTML,buf);
}

void AddHistory(const char * URL)
{
  if(g_HistoryIndex != -1 && g_HistoryIndex != (int)g_History.count()-1) {
    while(g_HistoryIndex != (int)g_History.count()-1)
      g_History.removeLast();
  }

  g_History.append(new QString(URL));
  g_HistoryIndex = g_History.count() - 1;
}

void LoadPage(const char * URL)
{
  AddHistory(URL);
  _LoadPage(URL);

}

void LoadDoc(const char * URL, int w, int h) 
{
  if(URL) {
    AddHistory(URL);
    SetInput(URL);
  }
  return;
}

void AddBookmark_cb(Fl_Widget *w, void *data)
{
	char					*cpTitle,								// Title
							*cpURL;									// URL

	cpTitle = (char *)g_HTML->getKHTMLWidget()->getTitle()->c_str();
	cpURL = (char *)g_HTML->getCurURL()->c_str();
	g_BookMark->AddBookmark(cpTitle, cpURL);
	return;
} // end of AddBookmark_cb

void DelBookmark_cb(Fl_Widget *w, void *data)
{
	int					idx = (int) data;							// Index of selected menu item

	g_BookMark->DelBookmark(idx);
	return;
} // end of DelBookmark_cb

void SelBookmark_cb(Fl_Widget *w, void *data)
{
	int					idx = (int)data;							// Index of selected menu item

	LoadPage(g_BookMark->GetURL(idx));
	return;
} // end of SelBookmark_cb

void Reload_Callback(Fl_Widget * w, void * data)
{
  _LoadPage(g_Input->value());
}

void Forward_Callback(Fl_Widget * w, void * data)
{
  if(g_HistoryIndex == -1 || g_HistoryIndex+1 > (int)g_History.count()-1)
    return;

  _LoadPage(*g_History.at(++g_HistoryIndex));
}

void Backward_Callback(Fl_Widget * w, void * data)
{
  if(g_HistoryIndex == -1 || g_HistoryIndex == 0)
    return;

  _LoadPage(*g_History.at(--g_HistoryIndex));
}

#ifdef USING_FLEK_LIB
void Combo_Callback(Fl_Widget *w, void *data)
{
	const char					*newURL;
	Flve_Combo					*o = (Flve_Combo *)w;

	// Get the text from the input widget
	newURL = o->input->value();
	LoadPage(newURL);
	
	return;
} // end of Combo_Callback()
#endif

void Input_Callback(Fl_Widget * w, void * data)
{
  Fl_Input * i = (Fl_Input*)w;
  QString str  =  i->value();
  History hobj;

  // if old and new strings match, must have been a CR
  if(strcmp((char *)str,oldstr) == 0)
  {
    oldstr[0] = 0x00;
    hobj.AddToHistoryList(str);
    hindex = 1;

    LoadPage(str);
  }

  // if there's a space in str, set a history entry
  else if(strstr((char *)str," "))
  {
    i->value(hobj.GetHistoryEntry(hindex));
    i->set_changed();
    i->mark(256);
    strcpy(oldstr,hobj.GetHistoryEntry(hindex));
    if(hobj.GetHistoryEntry(++hindex) == NULL)
      hindex = 0;
  }

  // must be an updated string - save it
  else
  {
    strcpy(oldstr,(char *)str);
  }
}


#ifdef USING_FLEK_LIB
void
UpdateHistoryBox(const char *str)
{
	int					rc;											// Return code
	if (!(g_Input->item.count()))
	{
		g_Input->item.insert(0, str);
	} // end of if
	else if ( (rc = g_Input->item.find(str)) != -1)
	{
		// This is already in the list, save it, remove it from the list,
		// and re-insert it at the top
		g_Input->item.remove(rc);
		g_Input->item.insert(0, str);
	} // end of else-if
	else
	{
		// This is a new one, remove the VIEWML_MAX_HISTORY'th item
		// and insert this one at the top
		if (g_Input->item.count() == VIEWML_MAX_HISTORY)
		{
			g_Input->item.remove(VIEWML_MAX_HISTORY ? VIEWML_MAX_HISTORY - 1 : 0);
		} // end of if 
		g_Input->item.insert(0, str);
	} // end of else

	return;
} // end of UpdateHistoryBox()
#endif


VMLAppWindow * make_window() 
{
  VMLAppWindow * w;
  { 
    VMLAppWindow * o = new VMLAppWindow(g_AppX,
					g_AppY,
					APPWIDTH,
					APPHEIGHT);
    g_AppWindow = o;
	o->label("ViewML");

    w = o;
    { 
      Fl_Button* o = Forward = new Fl_Button(42, 3, 25, 25);
      o->box(VIEWML_BUTTON_STYLE);
#ifdef _NANOX
      o->down_box(FL_WHITE_BOX);
#endif
      o->callback(Forward_Callback,0);
      o->when(FL_WHEN_RELEASE);
      pixmap_forward.label(o);
    }
    { 
      Fl_Button* o = Backward = new Fl_Button(22, 3, 25, 25);
      o->box(VIEWML_BUTTON_STYLE);
#ifdef _NANOX
      o->down_box(FL_WHITE_BOX);
#endif
      o->callback(Backward_Callback,0);
      o->when(FL_WHEN_RELEASE);
      pixmap_back.label(o);
    }

    { 
      Fl_Button* o = Reload = new Fl_Button(62, 3, 25, 25);
      o->box(VIEWML_BUTTON_STYLE);
#ifdef _NANOX
      o->down_box(FL_WHITE_BOX);
#endif
      o->callback(Reload_Callback,0);
      o->when(FL_WHEN_RELEASE);
      pixmap_reload.label(o);
    }
	{
		Fl_Menu_Button *o = new Fl_Menu_Button(2, 3, 25, 25);
		o->box(VIEWML_BUTTON_STYLE);
#ifdef _NANOX
		o->down_box(FL_WHITE_BOX);
#endif
//		o->textsize(8);
		pixmap_bm.label(o);

		// Save this into the bookmark class
		g_BookMark->SetMenuWidget(o);
	}
    
    {
#ifdef USING_FLEK_LIB
		g_Logo = new Fl_Animator(viewml_xpm, APPWIDTH - 24, 5, 10, 
									20, 20, 500, "Foobar");
#else
		Fl_Button* o = g_Logo = new Fl_Button(APPWIDTH -24 ,5,20,20);
		o->box(FL_OFLAT_BOX);
		o->down_box(FL_OFLAT_BOX);
		pixmap_vml.label(o);
#endif // USING_FLEK_LIB
    }
    { 
#ifdef USING_FLEK_LIB
		Flve_Combo	*o;
		o = g_URL = new Flve_Combo(92, 5, APPWIDTH - 135, 20, "");
		g_URL->input->callback(Input_Callback, 0);
		g_URL->input->when(FL_WHEN_ENTER_KEY_CHANGED);
		g_URL->callback(Combo_Callback, 0);
		g_URL->when(FL_WHEN_CHANGED);
		g_URL->list_only(false);
		g_URL->display_rows(VIEWML_MAX_HISTORY);
		g_URL->incremental_search(false);
		g_URL->input->parent(g_URL);
#else
      Fl_Input * o = g_URL = new Fl_Input(92, 5, APPWIDTH - 135 , 20, "");
      o->callback(Input_Callback,0);
      o->when(FL_WHEN_ENTER_KEY_CHANGED);
#endif
      g_Input = o;

#ifdef USING_FLEK_LIB
	  // Open the file and add history items
	  {
		  int			ii,
		  				HCnt;
			for (HCnt = ii = 0; ii < 20 && HCnt < VIEWML_MAX_HISTORY; ii++)
			{
				const char *cp;
				History		hobj;
				cp = hobj.GetHistoryEntry(ii);
				if (cp)
				{
					g_Input->item.add(cp);
					++HCnt;
				} // end of if
			}
	  } // end of memory
#endif

    }

    { 

      HTML_WIDGET * v;

      o->begin();
      o->show();

      // This is an ugly ugly hack .. because of broken parenting
      // in FLNX, we need to make sure the HTML Widget is added to
      // it's parent before it is mapped so the window manager
      // doesn't get ahold of it and do something evil. We do this
      // by passing in our top-level widget in the flags field
      // see htmlview.cpp for the other side of the disgusting piece
      // of code.

      v = new HTML_WIDGET(0,0,(int)o);
      v->setGeometry(SCROLLPAD,TITLEHEIGHT,WIDTH,HEIGHT);
      o->add(v);
      
      g_Conn->Connect(v);
      g_HTML = v;
    }
    g_AppWindow = o;
    o->end();
  }


  // recover last entry from history and display the page
  History hobj;

  cerr << "Main window: " << w << endl;
  return w;
}


--- NEW FILE: htmlfont.h ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
//-----------------------------------------------------------------------------
//
// KDE HTML Widget
//

#ifndef __HTMLFONT_H__
#define __HTMLFONT_H__

#include <qlist.h>
#include <qcolor.h>
#include <qfont.h>
#include <kcharsets.h>

#define MAXFONTSIZES 7

class HTMLFont
{
public:
	HTMLFont( const char *_family, int _size, const int *fontSizes, int _weight=QFont::Normal, bool _italic=FALSE, const char *charset=0 );
	HTMLFont( const HTMLFont &f );

	void setWeight( int w )
		{	font.setWeight( w ); }
	void setItalic( bool u )
		{	font.setItalic( u ); }
	void setUnderline( bool u )
		{	font.setUnderline( u ); }
	void setStrikeOut( bool s )
		{	font.setStrikeOut( s ); }
	void setTextColor( const QColor &col )
		{	textCol = col; }
	void setCharset( KCharset ch )
		{	 chset=ch; chset.setQFont(font);}

	const char *family() const
		{	return font.family(); }
	const int  weight() const
		{	return font.weight(); }
	const bool italic() const
		{	return font.italic(); }
	const bool underline() const
		{	return font.underline(); }
	const bool strikeOut() const
		{	return font.strikeOut(); }
	const int  pointSize() const
		{	return pointsize; }
	const QColor &textColor() const
		{	return textCol; }
	int size() const
		{	return fsize; }
	const KCharset charset () const
	        {	return chset; }

	const HTMLFont &operator=( const HTMLFont &f );
	bool operator==( const HTMLFont &f );
	operator QFont() const
		{	return font; }

private:
	QFont  font;
	QColor textCol;
	KCharset chset;
	int    fsize;
	int    pointsize;
};

inline HTMLFont::HTMLFont( const HTMLFont &f ) : font( f.font )
{
	textCol = f.textCol;
	fsize = f.fsize;
	chset = f.chset;
	pointsize = f.pointsize;
}

inline const HTMLFont &HTMLFont::operator=( const HTMLFont &f )
{
	font = f.font;
	textCol = f.textCol;
	fsize = f.fsize;
	chset = f.chset;
	pointsize = f.pointsize;

	return *this;
}

inline bool HTMLFont::operator==( const HTMLFont &f )
{
	return ( !strcmp( font.family(), f.font.family() ) &&
		font.weight() == f.font.weight() &&
		font.italic() == f.font.italic() &&
		font.underline() == f.font.underline() &&
		font.strikeOut() == f.font.strikeOut() &&
		textCol.red() == f.textCol.red() &&
		textCol.green() == f.textCol.green() &&
		textCol.blue() == f.textCol.blue() &&
		fsize == f.fsize &&
		pointsize == f.pointsize &&
		chset == f.chset );
}

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

class HTMLFontManager
{
public:
	HTMLFontManager();

	const HTMLFont *getFont( const HTMLFont &f );

private:
	QList<HTMLFont> list;
};

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

#endif	// __HTMLFONT_H__


--- NEW FILE: html.moc ---
/****************************************************************************
** Khtmlwidget meta object code from reading C++ file 'html.h'
**
** Created: Thu Jul 6 09:38:02 2000
**      by: The Qt Meta Object Compiler ($Revision: 1.1 $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#if !defined(Q_MOC_OUTPUT_REVISION)
#define Q_MOC_OUTPUT_REVISION 2
#elif Q_MOC_OUTPUT_REVISION != 2
#error "Moc format conflict - please regenerate all moc files"
#endif

#include <unistd.h>
#include <signal.h>
#include <qmetaobject.h>


const char *KHTMLWidget::className() const
{
    return "KHTMLWidget";
}

QMetaObject *KHTMLWidget::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_KHTMLWidget(&KHTMLWidget::staticMetaObject);

#endif

void KHTMLWidget::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(KDNDWidget::className(), "KDNDWidget") != 0 )
	badSuperclassWarning("KHTMLWidget","KDNDWidget");

#if QT_VERSION >= 200
    staticMetaObject();
}

void KHTMLWidget::staticMetaObject()
{
    if ( metaObj )
	return;
    KDNDWidget::staticMetaObject();
#else

    KDNDWidget::initMetaObject();
#endif

    typedef void(KHTMLWidget::*m1_t0)(int);
    typedef void(KHTMLWidget::*m1_t1)(int);
    typedef void(KHTMLWidget::*m1_t2)(const char*,const char*);
    typedef void(KHTMLWidget::*m1_t3)();
    typedef void(KHTMLWidget::*m1_t4)();
    typedef void(KHTMLWidget::*m1_t5)();
    typedef void(KHTMLWidget::*m1_t6)(int);
    typedef void(KHTMLWidget::*m1_t7)(const char*,const char*,const char*);
    typedef void(KHTMLWidget::*m1_t8)(KHTMLView*);
    m1_t0 v1_0 = &KHTMLWidget::slotScrollVert;
    m1_t1 v1_1 = &KHTMLWidget::slotScrollHorz;
    m1_t2 v1_2 = &KHTMLWidget::slotFileLoaded;
    m1_t3 v1_3 = &KHTMLWidget::scrollBlobTimeout;
    m1_t4 v1_4 = &KHTMLWidget::slotUpdate;
    m1_t5 v1_5 = &KHTMLWidget::slotAutoScrollY;
    m1_t6 v1_6 = &KHTMLWidget::slotUpdateSelectText;
    m1_t7 v1_7 = &KHTMLWidget::slotFormSubmitted;
    m1_t8 v1_8 = &KHTMLWidget::slotFrameSelected;
    QMetaData *slot_tbl = new QMetaData[9];
    slot_tbl[0].name = "slotScrollVert(int)";
    slot_tbl[1].name = "slotScrollHorz(int)";
    slot_tbl[2].name = "slotFileLoaded(const char*,const char*)";
    slot_tbl[3].name = "scrollBlobTimeout()";
    slot_tbl[4].name = "slotUpdate()";
    slot_tbl[5].name = "slotAutoScrollY()";
    slot_tbl[6].name = "slotUpdateSelectText(int)";
    slot_tbl[7].name = "slotFormSubmitted(const char*,const char*,const char*)";
    slot_tbl[8].name = "slotFrameSelected(KHTMLView*)";
    slot_tbl[0].ptr = *((QMember*)&v1_0);
    slot_tbl[1].ptr = *((QMember*)&v1_1);
    slot_tbl[2].ptr = *((QMember*)&v1_2);
    slot_tbl[3].ptr = *((QMember*)&v1_3);
    slot_tbl[4].ptr = *((QMember*)&v1_4);
    slot_tbl[5].ptr = *((QMember*)&v1_5);
    slot_tbl[6].ptr = *((QMember*)&v1_6);
    slot_tbl[7].ptr = *((QMember*)&v1_7);
    slot_tbl[8].ptr = *((QMember*)&v1_8);
    typedef void(KHTMLWidget::*m2_t0)(const char*);
    typedef void(KHTMLWidget::*m2_t1)();
    typedef void(KHTMLWidget::*m2_t2)();
    typedef void(KHTMLWidget::*m2_t3)();
    typedef void(KHTMLWidget::*m2_t4)(const char*,int);
    typedef void(KHTMLWidget::*m2_t5)(int);
    typedef void(KHTMLWidget::*m2_t6)(int);
    typedef void(KHTMLWidget::*m2_t7)(const char*,int);
    typedef void(KHTMLWidget::*m2_t8)(const char*,int,const char*);
    typedef void(KHTMLWidget::*m2_t9)(const char*);
    typedef void(KHTMLWidget::*m2_t10)(bool);
    typedef void(KHTMLWidget::*m2_t11)();
    typedef void(KHTMLWidget::*m2_t12)();
    typedef void(KHTMLWidget::*m2_t13)();
    typedef void(KHTMLWidget::*m2_t14)(const char*,const QPoint&);
    typedef void(KHTMLWidget::*m2_t15)(const char*,const char*,QMouseEvent*);
    typedef void(KHTMLWidget::*m2_t16)(const char*);
    typedef void(KHTMLWidget::*m2_t17)(const char*);
    typedef void(KHTMLWidget::*m2_t18)(const char*,const char*,const char*);
    typedef void(KHTMLWidget::*m2_t19)(const QSize&);
    typedef void(KHTMLWidget::*m2_t20)(int,const char*);
#ifdef EXEC_EXTENSIONS
    typedef void(KHTMLWidget::*m2_t21)(const char *);
#endif
    m2_t0 v2_0 = &KHTMLWidget::setTitle;
    m2_t1 v2_1 = &KHTMLWidget::goUp;
    m2_t2 v2_2 = &KHTMLWidget::goLeft;
    m2_t3 v2_3 = &KHTMLWidget::goRight;
    m2_t4 v2_4 = &KHTMLWidget::doubleClick;
    m2_t5 v2_5 = &KHTMLWidget::scrollVert;
    m2_t6 v2_6 = &KHTMLWidget::scrollHorz;
    m2_t7 v2_7 = &KHTMLWidget::URLSelected;
    m2_t8 v2_8 = &KHTMLWidget::URLSelected;
    m2_t9 v2_9 = &KHTMLWidget::onURL;
    m2_t10 v2_10 = &KHTMLWidget::textSelected;
    m2_t11 v2_11 = &KHTMLWidget::documentChanged;
    m2_t12 v2_12 = &KHTMLWidget::documentStarted;
    m2_t13 v2_13 = &KHTMLWidget::documentDone;
    m2_t14 v2_14 = &KHTMLWidget::popupMenu;
    m2_t15 v2_15 = &KHTMLWidget::mousePressed;
    m2_t16 v2_16 = &KHTMLWidget::fileRequest;
    m2_t17 v2_17 = &KHTMLWidget::cancelFileRequest;
    m2_t18 v2_18 = &KHTMLWidget::formSubmitted;
    m2_t19 v2_19 = &KHTMLWidget::resized;
    m2_t20 v2_20 = &KHTMLWidget::redirect;
#ifdef EXEC_EXTENSIONS
    m2_t21 v2_21 = &KHTMLWidget::execfunc;
    QMetaData *signal_tbl = new QMetaData[22];
#else
    QMetaData *signal_tbl = new QMetaData[21];
#endif
    signal_tbl[0].name = "setTitle(const char*)";
    signal_tbl[1].name = "goUp()";
    signal_tbl[2].name = "goLeft()";
    signal_tbl[3].name = "goRight()";
    signal_tbl[4].name = "doubleClick(const char*,int)";
    signal_tbl[5].name = "scrollVert(int)";
    signal_tbl[6].name = "scrollHorz(int)";
    signal_tbl[7].name = "URLSelected(const char*,int)";
    signal_tbl[8].name = "URLSelected(const char*,int,const char*)";
    signal_tbl[9].name = "onURL(const char*)";
    signal_tbl[10].name = "textSelected(bool)";
    signal_tbl[11].name = "documentChanged()";
    signal_tbl[12].name = "documentStarted()";
    signal_tbl[13].name = "documentDone()";
    signal_tbl[14].name = "popupMenu(const char*,const QPoint&)";
    signal_tbl[15].name = "mousePressed(const char*,const char*,QMouseEvent*)";
    signal_tbl[16].name = "fileRequest(const char*)";
    signal_tbl[17].name = "cancelFileRequest(const char*)";
    signal_tbl[18].name = "formSubmitted(const char*,const char*,const char*)";
    signal_tbl[19].name = "resized(const QSize&)";
    signal_tbl[20].name = "redirect(int,const char*)";
#ifdef EXEC_EXTENSIONS
    signal_tbl[21].name = "execfunc(const char *)";
#endif
    signal_tbl[0].ptr = *((QMember*)&v2_0);
    signal_tbl[1].ptr = *((QMember*)&v2_1);
    signal_tbl[2].ptr = *((QMember*)&v2_2);
    signal_tbl[3].ptr = *((QMember*)&v2_3);
    signal_tbl[4].ptr = *((QMember*)&v2_4);
    signal_tbl[5].ptr = *((QMember*)&v2_5);
    signal_tbl[6].ptr = *((QMember*)&v2_6);
    signal_tbl[7].ptr = *((QMember*)&v2_7);
    signal_tbl[8].ptr = *((QMember*)&v2_8);
    signal_tbl[9].ptr = *((QMember*)&v2_9);
    signal_tbl[10].ptr = *((QMember*)&v2_10);
    signal_tbl[11].ptr = *((QMember*)&v2_11);
    signal_tbl[12].ptr = *((QMember*)&v2_12);
    signal_tbl[13].ptr = *((QMember*)&v2_13);
    signal_tbl[14].ptr = *((QMember*)&v2_14);
    signal_tbl[15].ptr = *((QMember*)&v2_15);
    signal_tbl[16].ptr = *((QMember*)&v2_16);
    signal_tbl[17].ptr = *((QMember*)&v2_17);
    signal_tbl[18].ptr = *((QMember*)&v2_18);
    signal_tbl[19].ptr = *((QMember*)&v2_19);
    signal_tbl[20].ptr = *((QMember*)&v2_20);
#ifdef EXEC_EXTENSIONS
    signal_tbl[21].ptr = *((QMember*)&v2_21);
    metaObj = new QMetaObject("KHTMLWidget","KDNDWidget",slot_tbl,9,signal_tbl,22);
#else
    metaObj = new QMetaObject("KHTMLWidget","KDNDWidget",slot_tbl,9,signal_tbl,21);
#endif
}

// SIGNAL setTitle
void KHTMLWidget::setTitle( const char* t0 )
{
    activate_signal( "setTitle(const char*)", t0 );
}

// SIGNAL goUp
void KHTMLWidget::goUp()
{
    activate_signal( "goUp()" );
}

// SIGNAL goLeft
void KHTMLWidget::goLeft()
{
    activate_signal( "goLeft()" );
}

// SIGNAL goRight
void KHTMLWidget::goRight()
{
    activate_signal( "goRight()" );
}

#include <qobjectdefs.h>
#if QT_VERSION >= 141
// newer implementation
#include <qsignalslotimp.h>
#else
// for late-model 1.x header files
#if !defined(Q_MOC_CONNECTIONLIST_DECLARED)
#define Q_MOC_CONNECTIONLIST_DECLARED
#include <qlist.h>
Q_DECLARE(QListM,QConnection);
Q_DECLARE(QListIteratorM,QConnection);
#endif
#endif

// SIGNAL doubleClick
void KHTMLWidget::doubleClick( const char* t0, int t1 )
{
    QConnectionList *clist = receivers("doubleClick(const char*,int)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(const char*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(const char*,int);
    typedef RT2 *PRT2;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	}
    }
}

// SIGNAL scrollVert
void KHTMLWidget::scrollVert( int t0 )
{
    activate_signal( "scrollVert(int)", t0 );
}

// SIGNAL scrollHorz
void KHTMLWidget::scrollHorz( int t0 )
{
    activate_signal( "scrollHorz(int)", t0 );
}

// SIGNAL URLSelected
void KHTMLWidget::URLSelected( const char* t0, int t1 )
{
    QConnectionList *clist = receivers("URLSelected(const char*,int)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(const char*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(const char*,int);
    typedef RT2 *PRT2;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	}
    }
}

// SIGNAL URLSelected
void KHTMLWidget::URLSelected( const char* t0, int t1, const char* t2 )
{
    QConnectionList *clist = receivers("URLSelected(const char*,int,const char*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(const char*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(const char*,int);
    typedef RT2 *PRT2;
    typedef void (QObject::*RT3)(const char*,int,const char*);
    typedef RT3 *PRT3;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    RT3 r3;

    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
	
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	    case 3:
		r3 = *((PRT3)(c->member()));
		(object->*r3)(t0, t1, t2);
		break;
	}
    }
}

// SIGNAL onURL
void KHTMLWidget::onURL( const char* t0 )
{
    activate_signal( "onURL(const char*)", t0 );
}

// SIGNAL textSelected
void KHTMLWidget::textSelected( bool t0 )
{
    QConnectionList *clist = receivers("textSelected(bool)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(bool);
    typedef RT1 *PRT1;
    RT0 r0;
    RT1 r1;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	}
    }
}

// SIGNAL documentChanged
void KHTMLWidget::documentChanged()
{
    activate_signal( "documentChanged()" );
}

// SIGNAL documentStarted
void KHTMLWidget::documentStarted()
{
    activate_signal( "documentStarted()" );
}

// SIGNAL documentDone
void KHTMLWidget::documentDone()
{
//	cerr << "html.moc: signalling document done!\n";
    activate_signal( "documentDone()" );
}

// SIGNAL popupMenu
void KHTMLWidget::popupMenu( const char* t0, const QPoint& t1 )
{
    QConnectionList *clist = receivers("popupMenu(const char*,const QPoint&)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(const char*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(const char*,const QPoint&);
    typedef RT2 *PRT2;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	}
    }
}

// SIGNAL mousePressed
void KHTMLWidget::mousePressed( const char* t0, const char* t1, QMouseEvent* t2 )
{
    QConnectionList *clist = receivers("mousePressed(const char*,const char*,QMouseEvent*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(const char*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(const char*,const char*);
    typedef RT2 *PRT2;
    typedef void (QObject::*RT3)(const char*,const char*,QMouseEvent*);
    typedef RT3 *PRT3;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    RT3 r3;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	    case 3:
		r3 = *((PRT3)(c->member()));
		(object->*r3)(t0, t1, t2);
		break;
	}
    }
}

// SIGNAL fileRequest
void KHTMLWidget::fileRequest( const char* t0 )
{
    activate_signal( "fileRequest(const char*)", t0 );
}

// SIGNAL cancelFileRequest
void KHTMLWidget::cancelFileRequest( const char* t0 )
{
    activate_signal( "cancelFileRequest(const char*)", t0 );
}

// SIGNAL formSubmitted
void KHTMLWidget::formSubmitted( const char* t0, const char* t1, const char* t2 )
{
    QConnectionList *clist = receivers("formSubmitted(const char*,const char*,const char*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(const char*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(const char*,const char*);
    typedef RT2 *PRT2;
    typedef void (QObject::*RT3)(const char*,const char*,const char*);
    typedef RT3 *PRT3;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    RT3 r3;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	    case 3:
		r3 = *((PRT3)(c->member()));
		(object->*r3)(t0, t1, t2);
		break;
	}
    }
}

// SIGNAL resized
void KHTMLWidget::resized( const QSize& t0 )
{
    QConnectionList *clist = receivers("resized(const QSize&)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(const QSize&);
    typedef RT1 *PRT1;
    RT0 r0;
    RT1 r1;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	}
    }
}

// SIGNAL redirect
void KHTMLWidget::redirect( int t0, const char* t1 )
{
    QConnectionList *clist = receivers("redirect(int,const char*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(int);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(int,const char*);
    typedef RT2 *PRT2;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	}
    }
}



#ifdef EXEC_EXTENSIONS
#define MAX_PARMS 16
#define MAX_PARM_LEN 256
static int sigflag = 0;
// SIGNAL execfunc
void KHTMLWidget::execfunc(const char *cmd)
{
  char parms[MAX_PARMS * (MAX_PARM_LEN + 1)];
  char buf[256],chr,*plist[MAX_PARMS],*str;
  int count,index,pid;
  struct sigaction schild,soldchild;

  // only exec programs from local HTML pages
  KURL kurl = getDocumentURL();
  strcpy(buf,kurl.url());
  if(strncmp(buf,"file:",5) != 0)
    return;

  // initialize the parmlist
  count = 0;
  do
  {
    plist[count] = parms + (count * (MAX_PARM_LEN + 1));
    *plist[count] = 0x00;
  }while(++count < MAX_PARMS);

  // extract the executable and parms from the command string
  count = index = 0;
  while(1)
  {
    // get next char and check for end of parms
    chr = *cmd++;
    if(chr == 0x00)
    {
      *(plist[index] + count) = 0x00;
      break;
    }

    // check for delimeter
    if(chr == ',')
    {
      *(plist[index++] + count) = 0x00;
      count = 0;
      continue;
    }

    // add chr to current string
    *(plist[index] + count++) = chr;
  }

  // null empty pointers
  count = 0;
  do
  {
    if(*plist[count] == 0x00)
      plist[count] = NULL;
  }while(++count < MAX_PARMS);
  
#ifdef NEVER
  printf("*** About to spawn the following executable in the MOC:\n");
  printf("Executable: \"%s\"\n",plist[0]);
  count = 1;
  do
  {
    if(plist[count] != NULL)
      printf("Parm%02d:     \"%s\"\n",count,plist[count]);
  }while(++count < MAX_PARMS);
#endif

  // install the signal handler to avoid zombie processes
  if(sigflag == 0)
  {
    sigflag = 1;
    memset(&schild,0,sizeof(schild));
    schild.sa_handler = SIG_IGN;
    sigaction(SIGCHLD,&schild,&soldchild);    
  }

  // spawn the new process
  pid = fork();
  if(pid != 0)
  {
    return;
  }

  // this code is only executed in the child process
  execvp(plist[0],plist);
  exit(0);
}
#endif


--- NEW FILE: Makefile ---
# uncomment the line below for Nano-X
#_NANOX = 1

ifndef _NANOX
  # your version of FLTK (1.0.7, please!)
  FLTK = /home/davet/src/fltk/flmwin
else
  # your version of Nano-X FLTK (0.88, please!)
  FLTK = /home/jasonk/projects/flnx
endif

# Where your Xlibs are (not needed for Nano-X/Mwin builds)
XLIBS = -L/usr/X11R6/lib -lX11

# Where Nano-X is (not needed if building for X only)
NANOX = /home/jasonk/projects/microwin

# Various support libraries
IMLIBS = `imlib-config --libs`
[...1065 lines suppressed...]
fltk/qscrollbar.o: ./fltk/qevent.h ./fltk/qpoint.h ./fltk/qrect.h
fltk/qscrollbar.o: ./fltk/qsize.h ./fltk/qkeycode.h ./fltk/qlist.h
fltk/qscrollbar.o: ./fltk/qbuffer.h ./fltk/qiodevice.h ./fltk/qregion.h
fltk/qscrollbar.o: ./fltk/qcolor.h ./fltk/qobjectdefs.h ./fltk/qobject.h
fltk/qscrollbar.o: ./fltk/qmetaobject.h ./fltk/qconnection.h ./fltk/qdict.h
fltk/qscrollbar.o: /usr/include/signal.h /usr/include/bits/sigset.h
fltk/qscrollbar.o: /usr/include/bits/signum.h /usr/include/time.h
fltk/qscrollbar.o: /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h
fltk/qscrollbar.o: /usr/include/bits/sigcontext.h
fltk/qscrollbar.o: /usr/include/asm/sigcontext.h /usr/include/bits/sigstack.h
fltk/qscrollbar.o: /usr/include/pthread.h /usr/include/sched.h
fltk/qscrollbar.o: /usr/include/bits/sched.h /usr/include/bits/pthreadtypes.h
fltk/qscrollbar.o: /usr/include/bits/sigthread.h /usr/include/X11/X.h
fltk/qscrollbar.o: /usr/include/X11/Xlib.h /usr/include/sys/types.h
fltk/qscrollbar.o: /usr/include/endian.h /usr/include/bits/endian.h
fltk/qscrollbar.o: /usr/include/sys/select.h /usr/include/bits/select.h
fltk/qscrollbar.o: /usr/include/sys/sysmacros.h /usr/include/X11/Xfuncproto.h
fltk/qscrollbar.o: /usr/include/X11/Xosdefs.h ./fltk/qpaintdevice.h
fltk/qscrollbar.o: ./fltk/qcursor.h ./fltk/qbitmap.h ./fltk/qpalette.h
fltk/qscrollbar.o: ./fltk/qfontmetrics.h ./fltk/qfont.h ./fltk/qfontinfo.h

--- NEW FILE: htmltable.h ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
//-----------------------------------------------------------------------------
//
// KDE HTML Widget
//

#ifndef HTMLTABLE_H
#define HTMLTABLE_H

#include <qpainter.h>
#include <qlist.h>
#include <qstrlist.h>
#include <qarray.h>
#include <qpixmap.h>
#include <qstack.h>
#include <qfont.h>
#include <qtimer.h>

#include <kurl.h>

class HTMLClueV;
class HTMLImage;
class HTMLClue;
class HTMLClueFlow;
class HTMLClueAligned;
class KHTMLWidget;

#include "htmlfont.h"
#include "htmlobj.h"
#include "htmlclue.h"

//-----------------------------------------------------------------------------
// really only useful for tables.
//
class HTMLTableCell : public HTMLClueV
{
public:
    HTMLTableCell( int _x, int _y, int _max_width, int _percent,
	    int rs, int cs, int pad );
    virtual ~HTMLTableCell() { } 

    int rowSpan() const
	    {	return rspan; }
    int colSpan() const
	    {	return cspan; }
    const QColor &bgColor() const
	    {	return bg; }

    void setBGColor( const QColor &c )
	    {	bg = c; }

    virtual void setMaxWidth( int );
    virtual int  calcMinWidth();
    void setWidth(int _width);
    virtual bool print( QPainter *_painter, int _x, int _y, int _width,
		int _height, int _tx, int _ty, bool toPrinter );
    virtual void print( QPainter *_painter, HTMLChain *_chain, int _x,
	int _y, int _width, int _height, int _tx, int _ty );
    virtual void print( QPainter *_painter, HTMLObject *_obj, int _x, int _y,
		int _width, int _height, int _tx, int _ty )
	{ HTMLClueV::print(_painter,_obj,_x,_y,_width,_height,_tx,_ty); }

    void link() { refcount++; }
    void unlink() { if (--refcount == 0) delete this; }

protected:
    int rspan;
    int cspan;
    int padding;
    QColor bg;
    int refcount;
};

//-----------------------------------------------------------------------------
//
class HTMLTable : public HTMLObject
{
public:
    HTMLTable( int _x, int _y, int _max_width, int _width, int _percent,
		int _padding = 1, int _spacing = 2, int _border = 0 );
    virtual ~HTMLTable();

    void startRow();
    void addCell( HTMLTableCell *cell );
    void endRow();
    void endTable();

    void setCaption( HTMLClueV *cap, HTMLClue::VAlign al )
	    {	caption = cap; capAlign = al; }

    virtual void reset();
    virtual void calcSize( HTMLClue *parent = 0L );
    virtual int  calcMinWidth();
    virtual int  calcPreferredWidth();
    virtual void setMaxWidth( int _max_width );
    virtual void setMaxAscent( int );
    virtual HTMLObject *checkPoint( int, int );
    virtual HTMLObject *mouseEvent( int, int, int, int );
    virtual void selectByURL( KHTMLWidget *, HTMLChain *, const char *, bool, int _tx, int _ty );
    virtual void select( KHTMLWidget *, HTMLChain *, QRegExp& _pattern, bool _select,
	    int _tx, int _ty );
    virtual void select( KHTMLWidget *, HTMLChain *,  bool, int _tx, int _ty );
    /**
     * Selects every object in this table if it is inside the rectangle
     * and deselects it otherwise.
     */
    virtual void select( KHTMLWidget *, HTMLChain *,  QRect &_rect, int _tx, int _ty );
    virtual void select( bool );
    virtual bool selectText( KHTMLWidget *_htmlw, HTMLChain *_chain, int _x1,
	int _y1, int _x2, int _y2, int _tx, int _ty );
    virtual void getSelected( QStrList & );
    virtual void getSelectedText( QString & );

    virtual void calcAbsolutePos( int _x, int _y );
    virtual bool getObjectPosition( const HTMLObject *objp, int &xp, int &yp );

    virtual ObjectType getObjectType() const
	    {	return Clue; }

    virtual HTMLAnchor *findAnchor( const char *_name, QPoint *_p );

    virtual int  findPageBreak( int _y );
    virtual bool print( QPainter *_painter, int _x, int _y, int _width,
    	    int _height, int _tx, int _ty, bool toPrinter );
    virtual void print( QPainter *_painter, HTMLChain *_chain, int _x,
	    int _y, int _width, int _height, int _tx, int _ty );
    virtual void print( QPainter *_painter, HTMLObject *_obj, int _x, int _y,
	    int _width, int _height, int _tx, int _ty );
    virtual void print( QPainter *, int _tx, int _ty );

    virtual void findCells( int _tx, int _ty, QList<HTMLCellInfo> &_list );

    int rows() const { return totalRows; }
    int cols() const { return totalCols; }
    HTMLTableCell *cell( int r, int c )
	{ return cells[r][c]; }

    /*
     * Create an iterator.
     * The returned iterator must be deleted by the caller.
     */
    virtual HTMLIterator *getIterator()
       { return totalRows ? new HTMLTableIterator( this ) : 0; }
  
    enum ColType { Fixed, Percent, Variable };

protected:
    void setCells( unsigned int r, unsigned int c, HTMLTableCell *cell );
    void calcColumnWidths();
    void calcColInfo();
    int  addColInfo(int _startCol, int _colSpan, int _minSize,
                    int _prefSize, int _maxSize, ColType _colType);
    void addRowInfo(int _row, int _colInfoIndex);
    void optimiseCellWidth();
    void scaleColumns(unsigned int c_start, unsigned int c_end, int tooAdd);
    int scaleSelectedColumns(int c_start, int c_end, int tooAdd, 
			     bool *selected);
    void calcRowHeights();
    void addRows( int );
    void addColumns( int );

protected:
    /*
     * For each table element with a different width a ColInfo struct is
     * maintained. Consider for example the following table:
     * +---+---+---+
     * | A | B | C |
     * +---+---+---+
     * |   D   | E |
     * +-------+---+
     *
     * This table would result in 4 ColInfo structs being allocated.
     * 1 for A, 1 for B, 1 for C & E, and 1 for D.
     *
     * Note that C and E share the same ColInfo.
     *
     * Note that D has a seperate ColInfo entry.
     *
     * There is always 1 default ColInfo entry which stretches across the
     * entire table.  
     */
    typedef struct ColInfo_struct
    {
       int     startCol;
       int     colSpan;
       int     minSize;
       int     prefSize;
       int     maxSize;
       ColType colType;
    } ColInfo_t;
    /*
     * The RowInfo structs maintains relations between the various ColInfo
     * structs. Given the example-table given above we would have the 
     * following ColInfo's:
     *
     * ColInfo[0] : default (startCol = 0, colSpan = 3)
     * ColInfo[1] : A       (startCol = 0, colSpan = 1)
     * ColInfo[2] : B       (startCol = 1, colSpan = 1)
     * ColInfo[3] : C,E     (startCol = 2, colSpan = 1)
     * ColInfo[4] : D       (startCol = 1, colSpan = 2)
     *
     * The relation would be made using RowInfo structs:
     *
     * RowInfo[0] : entry[] = { 1,2,3 },  
     * RowInfo[1] : entry[] = { 4, 3 },
     *
     * { 1,2,3 } refers to ColInfo[1], ColInfo[2] and ColInfo[3]
     */
    typedef struct RowInfo_struct
    {
       int *entry;
       int  nrEntries;
       int  minSize;
       int  prefSize;
    } RowInfo_t;
    
    HTMLTableCell ***cells;
    QArray<ColInfo_t> colInfo;
    RowInfo_t   *rowInfo;
    int          _minWidth;
    int          _prefWidth;

    QArray<int> columnPos;
    QArray<int> columnPrefPos;
    QArray<int> columnOpt;
    QArray<int> colSpan;
    QArray<int> rowHeights;
    QArray<ColType> colType;

    unsigned int totalColInfos;
    unsigned int col, totalCols;
    unsigned int row, totalRows, allocRows;
    int spacing;
    int padding;
    int border;
    HTMLClueV *caption;
    HTMLClue::VAlign capAlign;
};

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

#endif // HTMLTABLE_H


--- NEW FILE: main.moc ---
/****************************************************************************
** CURL meta object code from reading C++ file 'main.cpp'
**
** Created: Sat Jul 15 12:46:45 2000
**      by: The Qt Meta Object Compiler ($Revision: 1.1 $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#if !defined(Q_MOC_OUTPUT_REVISION)
#define Q_MOC_OUTPUT_REVISION 2
#elif Q_MOC_OUTPUT_REVISION != 2
#error "Moc format conflict - please regenerate all moc files"
#endif

#include <qmetaobject.h>


const char *CURL::className() const
{
    return "CURL";
}

QMetaObject *CURL::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_CURL(&CURL::staticMetaObject);

#endif

void CURL::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(QObject::className(), "QObject") != 0 )
	badSuperclassWarning("CURL","QObject");

#if QT_VERSION >= 200
    staticMetaObject();
}

void CURL::staticMetaObject()
{
    if ( metaObj )
	return;
    QObject::staticMetaObject();
#else

    QObject::initMetaObject();
#endif

    typedef void(CURL::*m1_t0)(const char*);
    m1_t0 v1_0 = &CURL::slotOpenURL;
    QMetaData *slot_tbl = new QMetaData[1];
    slot_tbl[0].name = "slotOpenURL(const char*)";
    slot_tbl[0].ptr = *((QMember*)&v1_0);
    metaObj = new QMetaObject( "CURL", "QObject",
	slot_tbl, 1,
	0, 0 );
}

--- NEW FILE: htmlform.cpp ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
//----------------------------------------------------------------------------
// khtml widget - forms
//
//

#include <qobject.h>
#include <qlistbox.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qradiobutton.h>
#include <qpushbutton.h>
#include <qlineedit.h>
#include <qmultilinedit.h>
#include <qfontmetrics.h>
#include <qapp.h>
#include "htmlform.h"
#include <strings.h>
#include "htmlform.h"
#include "htmlfont.h"

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


QString HTMLElement::encodeString( const QString &e )
{
	static char *safe = "$-._!*(),"; /* RFC 1738 */
	unsigned pos = 0;
	QString encoded;
	char buffer[5];

	while ( pos < e.length() )
	{
		unsigned char c = (unsigned char) e[pos];

		if ( (( c >= 'A') && ( c <= 'Z')) ||
		     (( c >= 'a') && ( c <= 'z')) ||
		     (( c >= '0') && ( c <= '9')) ||
		     (strchr(safe, c))
		   )
		{
			encoded += c;
		}
		else if ( c == ' ' )
		{
			encoded += '+';
		}
		else if ( c == '\n' )
		{
			encoded += "%0D%0A";
		}
		else if ( c != '\r' )
		{
			sprintf( buffer, "%%%02X", (int)c );
			encoded += buffer;
		}
		pos++;
	}

	return encoded;
}

HTMLElement::~HTMLElement()
{
    if ( form )
	form->removeElement( this );
}

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

HTMLWidgetElement::~HTMLWidgetElement()
{
    if ( widget )
	delete widget;
}

void HTMLWidgetElement::position( int _x, int _y, int , int _height )
{
	if ( widget == 0L ) // CC: HTMLHidden does not have a widget...
		return;

	if ( _y > absY() + ascent + descent || _y + _height < absY() )
	{
		widget->hide();
	}
	else
	{
		widget->move( absX() - _x, absY() - _y );
		widget->show();
	}
}

bool HTMLWidgetElement::positionChanged( int _x, int _y, int , int _height )
{
	if ( widget == 0L ) // CC: HTMLHidden does not have a widget...
		return false;

  int x = absX() - _x;
  int y = absY() - _y;

  if (x != widget->x() || y != widget->y())
  {
    return true;
  }

  return false;
}

void HTMLWidgetElement::calcAbsolutePos( int _x, int _y )
{
	_absX = _x + x;
	_absY = _y + y - ascent;
}

void HTMLWidgetElement::hideElement()
{
    if ( widget )
    {
        widget->hide();
    }
}

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

HTMLSelect::HTMLSelect( QWidget *parent, const char *n, int s, bool m,
			const HTMLFont *f )
	: HTMLWidgetElement( n, f )
{
	_size = s;
	_defSelected = 0;
	_item = 0;

	_values.setAutoDelete( TRUE );

	QSize size;

	if ( _size > 1 )
	{
		widget = new QListBox( parent );
		size.setWidth( 150 );
		size.setHeight( 20 * _size );
		ascent = 25;
		descent = size.height() - ascent;
		((QListBox *)widget)->setMultiSelection( m );
	}
	else
	{
		widget = new QComboBox( FALSE, parent );
		size.setWidth( 150 );
		size.setHeight( 25 );
		descent = 5;
		ascent = size.height() - descent;
	}
	if( font )
	    widget->setFont( *font );


	connect( widget, SIGNAL( highlighted( int ) ),
			SLOT( slotHighlighted( int ) ) );

	widget->resize( size );

	width = size.width();
}

void HTMLSelect::addOption( const char *v, bool sel )
{
	if ( _size > 1 )
	{
		QListBox *lb = (QListBox *)widget;
		lb->insertItem( "" );
		if ( sel || lb->count() == 1 )
		{
			_defSelected = lb->count() - 1;
			lb->setSelected( _defSelected, true );
		}
// CRH		width = lb->maxItemWidth()+20;
		width = lb->maxItemWidth()+30;
// CRH		widget->resize( width, widget->height() );
		QFontMetrics fm(widget->font());

		widget->resize(width, (fm.height() + 1) * _size);
		ascent = 25;
		descent = fm.height() * _size - ascent;
// end CRH
	}
	else
	{
		QComboBox *cb = (QComboBox *)widget;
		cb->insertItem( "" );
		if ( sel || cb->count() == 1 )
		{
			_defSelected = cb->count() - 1;
			cb->setCurrentItem( _defSelected );
			_item = _defSelected;
		}
		QSize size = widget->sizeHint();
		widget->resize( size );
		ascent = size.height() - descent;
		width = size.width();
	}

	if ( v )
		_values.append( new QString( v ) );
	else
		_values.append( new QString( (char *)0L) );
}

const QString &HTMLSelect::value( int item )
{
  return *_values.at( item );
}

void HTMLSelect::setValue( const char *v, int indx )
{
  *_values.at( indx ) = v;
}

void HTMLSelect::setText( const char *text )
{
	int item;
	QString t = text;
	t = t.stripWhiteSpace();

	if ( _size > 1 )
	{
		QListBox *lb = (QListBox *)widget;
		lb->changeItem( t, lb->count() - 1 );
		item = lb->count() - 1;
// CRH		width = lb->maxItemWidth()+20;
		width = lb->maxItemWidth()+30;

		widget->resize( width, widget->height() );
	}
	else
	{
		QComboBox *cb = (QComboBox *)widget;
		cb->changeItem( t, cb->count() - 1 );
		item = cb->count() - 1;
		QSize size = widget->sizeHint();
		widget->resize( size );
		ascent = size.height() - descent;
		width = size.width();
	}

	if ( value( item ).isNull() )
		setValue( t, item );
}

QString HTMLSelect::encoding()
{
    QString _encoding = "";

    if ( elementName().length() )
    {
	if ( _size > 1)
	{ // multiple
	    QListBox* lb = (QListBox *) widget;

	    for ( unsigned i = 0; i < lb->count(); i++ )
	    {
		if ( lb->isSelected( i ) )
		{
		    if ( !_encoding.isEmpty() )
			_encoding += '&';
		    _encoding += encodeString( elementName() );
		    _encoding += '=';
		    _encoding += encodeString( value( i ) );
		}
	    }
	}
	else
	{
	  int i = ((QComboBox *) widget)->getCurrentItem();
	  
	  _encoding = encodeString( elementName() );
	  _encoding += '=';
	  _encoding += encodeString( value(i) );
	}
    }
    
    return _encoding;
}

void HTMLSelect::resetElement()
{
	if ( _size > 1 )
		((QListBox *)widget)->setCurrentItem( _defSelected );
	else
		((QComboBox *)widget)->setCurrentItem( _defSelected );
}

void HTMLSelect::slotHighlighted( int indx )
{
	_item = indx;
}

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

HTMLTextArea::HTMLTextArea( QWidget *parent, const char *n, int r, int c,
			    const HTMLFont *f )
	: HTMLWidgetElement( n, f )
{
	_defText = "";

	widget = new QMultiLineEdit( parent );
	if( font )
	    widget->setFont( *font );

	QFontMetrics fm( widget->font() );

	// this is a bit better if using proportional fonts and
	// small inputs fields
	QSize size( c * fm.width('a') + 4, r * (fm.height()+1) );
	if( c < 5 )
	    size.setWidth( c * fm.width('M') + 4 );

	widget->resize( size );

	descent = size.height() - 14;
	ascent = 14;
	width = size.width();
}

QString HTMLTextArea::value()
{
	return ((QMultiLineEdit *)widget)->text();
}

void HTMLTextArea::setText( const char *t )
{
	_defText = t;
	((QMultiLineEdit *)widget)->setText( t );
}

QString HTMLTextArea::encoding()
{
	QString _encoding = "";

	if ( elementName().length() )
	{
		_encoding = encodeString( elementName() );
		_encoding += '=';
		_encoding += encodeString( value() );
	}
	
	return _encoding;
}

void HTMLTextArea::resetElement()
{
	((QMultiLineEdit *)widget)->setText( _defText );
}

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

HTMLInput::HTMLInput( const char *n, const char *v, const HTMLFont *f )
	: HTMLWidgetElement( n, f )
{
	_value = v;
}

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

HTMLButton::HTMLButton( KHTMLWidget *_parent, const char *_name, const char *v, QList<JSEventHandler> *_events, const HTMLFont *f )
	: HTMLInput( "", v, f )
{
    view = _parent;
    widget = new QPushButton( _parent );
    if( font )
	widget->setFont( *font );

    if ( strlen( value() ) != 0 )
	((QPushButton *)widget)->setText( value() );
    else if ( strlen( _name ) != 0 )
	((QPushButton *)widget)->setText( _name );
    else
	((QPushButton *)widget)->setText( "" );

    QSize size = widget->sizeHint();
    widget->resize( size );

    descent = 5;
    ascent = size.height() - descent;
    width = size.width();
    
    connect( widget, SIGNAL( clicked() ), SLOT( slotClicked() ) );
    
    eventHandlers = _events;
}

void HTMLButton::slotClicked()
{
    if ( eventHandlers == 0L )
	return;
    
    JSEventHandler* ev;
    for ( ev = eventHandlers->first(); ev != 0L; ev = eventHandlers->next() )
    {
	if ( strcmp( ev->getName(), "onClick" ) == 0L )
	{
	    ev->exec( 0L );
	    return;
	}
    }
}

HTMLButton::~HTMLButton()
{
    if ( eventHandlers )
	delete eventHandlers;
}

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

HTMLCheckBox::HTMLCheckBox( QWidget *parent, const char *n, const char *v,
			    bool ch, const HTMLFont *f )
	: HTMLInput( n, v, f )
{
	_defCheck = ch;

	widget = new QCheckBox( parent );
	if( font )
	    widget->setFont( *font );

	((QCheckBox *)widget)->setChecked( ch );

// CRH QSize size( 14, 14 );
	QFontMetrics fm(widget->font());
	QSize size(fm.height(), fm.height());

	widget->resize( size );

	descent = 1;
	ascent = size.height() - descent;
	width = size.width() + 6;
}

QString HTMLCheckBox::encoding()
{
	QString _encoding = "";

	if ( ((QCheckBox *)widget)->isChecked() )
	{
		_encoding = encodeString( elementName() );
		_encoding += '=';
		_encoding += encodeString( value() );
	}

	return _encoding;
}

void HTMLCheckBox::resetElement()
{
	((QCheckBox *)widget)->setChecked( _defCheck );
}

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

HTMLHidden::HTMLHidden( const char *n, const char *v )
	: HTMLInput( n, v )
{
}

QString HTMLHidden::encoding()
{
	QString _encoding;

	if ( elementName().length() )
	{
		_encoding = encodeString( elementName() );
		_encoding += '=';
		_encoding += encodeString( value() );
	}
	
	return _encoding;
}

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

HTMLRadio::HTMLRadio( QWidget *parent, const char *n, const char *v,
		      bool ch, const HTMLFont *f )
	: HTMLInput( n, v, f )
{
	_defCheck = ch;

	widget = new QRadioButton( parent );
	if( font )
	    widget->setFont( *font );

	((QRadioButton *)widget)->setChecked( ch );

// CRH	QSize size( 14, 14 );
	QFontMetrics fm(widget->font());
	QSize size(fm.height(), fm.height());

	widget->resize( size );

	descent = 1;
	ascent = size.height() - descent;
	width = size.width() + 6;

	connect( widget, SIGNAL( clicked() ), SLOT( slotClicked() ) );
}

QString HTMLRadio::encoding()
{
	QString _encoding = "";

	if ( ((QRadioButton *)widget)->isChecked() )
	{
		_encoding = encodeString( elementName() );
		_encoding += '=';
		_encoding += encodeString( value() );
	}

	return _encoding;
}

void HTMLRadio::resetElement()
{
	((QRadioButton *)widget)->setChecked( _defCheck );
}

void HTMLRadio::slotClicked()
{
	emit radioSelected( elementName(), value() );
}

void HTMLRadio::slotRadioSelected( const char *n, const char *v )
{
	if ( strcasecmp( n, elementName().data() ) != 0 )
		return;

	if ( strcasecmp( v, value().data() ) != 0 )
		((QRadioButton *)widget)->setChecked( false );
}

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

HTMLReset::HTMLReset( QWidget *parent, const char *v, const HTMLFont *f )
	: HTMLInput( "", v, f )
{
	widget = new QPushButton( parent );
	if( font )
	    widget->setFont( *font );

	if ( strlen( value() ) != 0 )
		((QPushButton *)widget)->setText( value() );
	else
		((QPushButton *)widget)->setText( "Reset" );

	QSize size = widget->sizeHint();
	widget->resize( size );

	descent = 5;
	ascent = size.height() - descent;
	width = size.width();

	connect( widget, SIGNAL( clicked() ), SLOT( slotClicked() ) );
}

void HTMLReset::slotClicked()
{
	emit resetForm();
}

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

HTMLSubmit::HTMLSubmit( QWidget *parent, const char *n, const char *v,
			const HTMLFont *f)
	: HTMLInput( n, v, f )
{
	widget = new QPushButton( parent );
	if( font )
	    widget->setFont( *font );

	if ( strlen( value() ) != 0 )
		((QPushButton *)widget)->setText( value() );
	else
		((QPushButton *)widget)->setText( "Submit Query" );

	QSize size = widget->sizeHint();

	widget->resize( size );

	descent = 5;
	ascent = size.height() - descent;
	width = size.width();

	connect( widget, SIGNAL( clicked() ), SLOT( slotClicked() ) );

	activated = false;
}

QString HTMLSubmit::encoding()
{
	QString _encoding = "";

	if ( elementName().length() && activated )
	{
		_encoding = encodeString( elementName() );
		_encoding += '=';
		_encoding += encodeString( value() );
	}

	return _encoding;
}

void HTMLSubmit::slotClicked()
{
	activated = true;
	emit submitForm();
}

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

HTMLTextInput::HTMLTextInput( QWidget *parent, const char *n, const char *v,
			      int s, int ml, bool password, const HTMLFont *f )
	: HTMLInput( n, v, f )
{
	_defText = v;

	widget = new QLineEdit( parent );
	if( font )
	    widget->setFont( *font );

	if ( strlen( value() ) != 0 )
		((QLineEdit *)widget)->setText( value() );
	if ( password )
	    ((QLineEdit *)widget)->setEchoMode ( QLineEdit::Password );

	if ( ml > 0 )
	    ((QLineEdit *)widget)->setMaxLength( ml );

	QFontMetrics m = widget->fontMetrics();
	// this is a bit better if using proportional fonts and
	// small inputs fields
	QSize size( s * m.width('a') + 4, m.height() + 6);
	if(s<5)
	    size.setWidth( s * m.width('M') + 4);
	
	widget->resize( size );

	descent = 5;
	ascent = size.height() - descent;
	width = size.width();

	connect( widget, SIGNAL( textChanged( const char * ) ),
			SLOT( slotTextChanged( const char * ) ) );
	connect( widget, SIGNAL( returnPressed() ),
			SLOT( slotReturnPressed() ) );
}

QString HTMLTextInput::encoding()
{
	QString _encoding = "";

	if ( elementName().length() )
	{
		_encoding = encodeString( elementName() );
		_encoding += '=';
		_encoding += encodeString( value() );
	}

	return _encoding;
}

void HTMLTextInput::resetElement()
{
	((QLineEdit *)widget)->setText( _defText );
}

void HTMLTextInput::slotTextChanged( const char *t )
{
  setValue( t );
}

void HTMLTextInput::slotReturnPressed()
{
	emit submitForm();
}

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

#ifdef EXEC_EXTENSIONS
HTMLImageInput::HTMLImageInput( KHTMLWidget *widget, const char *f, int mw,
	const char *n )
    : HTMLImage( widget, f, 0, 0, 0, mw ), HTMLElement( n )
#else
HTMLImageInput::HTMLImageInput( KHTMLWidget *widget, const char *f, int mw,
	const char *n )
    : HTMLImage( widget, f, 0, 0, mw ), HTMLElement( n )
#endif
{
    _xp = _yp = 0;
    pressed = false;
    activated = false;
}

QString HTMLImageInput::encoding()
{
    QString _encoding = "";

    if ( elementName().length() && activated )
    {
	QString num;

	num.setNum( _xp );
	_encoding = encodeString( elementName() );
	_encoding += ".x=";
	_encoding += num;

	_encoding += "&";

	num.setNum( _yp );
	_encoding += encodeString( elementName() );
	_encoding += ".y=";
	_encoding += num;
    }

    return _encoding;
}

HTMLObject *HTMLImageInput::mouseEvent( int _x, int _y, int button, int state )
{
    if ( _x < x || _x > x + width )
	return 0;

    if ( _y <= y - ascent || _y > y + descent )
	return 0;

    if ( button == LeftButton )
    {
	if ( ! ( state & LeftButton ) )
	{
	    pressed = true;
	}
	else if ( pressed )
	{
	    _xp = _x - x;
	    _yp = _y - ( y - ascent );
	    activated = true;
	    emit submitForm();
	    pressed = false;
	}

	return this;
    }

    return 0;
}

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

HTMLForm::HTMLForm( const char *a, const char *m )
{
    _action = a;
    _method = m;

    elements.setAutoDelete( false );
    hidden.setAutoDelete( true );

    timer = new QTimer( this );
    connect( timer, SIGNAL(timeout()), SLOT(slotTimeout()) );
}

void HTMLForm::addElement( HTMLElement *e )
{
    elements.append( e );
}

void HTMLForm::addHidden( HTMLHidden *e )
{
    elements.append( e );
    hidden.append( e );
}

void HTMLForm::removeElement( HTMLElement *e )
{
    elements.removeRef( e );
}

void HTMLForm::position( int _x, int _y, int _width, int _height )
{
  if ( !timer->isActive() )
    {
      // Repositioning has started.  We first hide the elements, then
      // start a timer to perform the actual positioning once moving has
      // finished.  This makes scrolling a document with form controls
      // smoother.
      for ( HTMLElement *e = elements.first(); e != 0; e = elements.next() )
	{
	  if (e->positionChanged(_x, _y, _width, _height))
	    e->hideElement();
	}
    }
  else
    {
      timer->stop();
    }
  
  dx = _x;
  dy = _y;
  width = _width;
  height = _height;
  
    timer->start( 200, true );
}

void HTMLForm::slotReset()
{
    HTMLElement *e;

    for ( e = elements.first(); e != 0; e = elements.next() )
    {
	e->resetElement();
    }
}

void HTMLForm::slotSubmit()
{
	HTMLElement *e;
	QString encoding = "";
	bool first = true;

	for ( e = elements.first(); e != 0; e = elements.next() )
	{
		QString enc = e->encoding();
		
		if ( enc.length() )
		{
			if ( !first )
				encoding += '&';
			encoding += enc;
			first = false;
		}
	}

	QString url = action();
	       
	emit submitted( method(), url, (const char *)encoding );
}

void HTMLForm::slotRadioSelected( const char *n, const char *v )
{
    emit radioSelected( n, v );
}

void HTMLForm::slotTimeout()
{
    for ( HTMLElement *e = elements.first(); e != 0; e = elements.next() )
    {
        e->position( dx, dy, width, height );
    }
}

HTMLForm::~HTMLForm()
{
    HTMLElement *e;

    for ( e = elements.first(); e != 0; e = elements.next() )
    {
	e->setForm( 0 );
    }

    delete timer;
}
#include "htmlform.moc"

--- NEW FILE: pixmaps.h ---
#ifndef __PIXMAPS_H
#define __PIXMAPS_H

/* XPM */
static char * vml_xpm[] = {
"20 20 199 2",
"  	c None",
". 	c #C12E52",
"+ 	c #7D183B",
"@ 	c #D5116E",
"# 	c #DC0070",
"$ 	c #DA0070",
"% 	c #1F1D1E",
"& 	c #D70070",
"* 	c #D40071",
"= 	c #CF006F",
"- 	c #C9006C",
"; 	c #460025",
"> 	c #CF0072",
", 	c #CD006F",
"' 	c #CD0071",
") 	c #B70063",
"! 	c #5E183F",
"~ 	c #4C1935",
"{ 	c #3F1A2E",
"] 	c #85004B",
"^ 	c #0C0007",
"/ 	c #C30270",
"( 	c #281C23",
"_ 	c #311B28",
": 	c #9E2380",
"< 	c #843788",
"[ 	c #7C3B8A",
"} 	c #68347A",
"| 	c #2C709B",
"1 	c #000203",
"2 	c #0C2D3D",
"3 	c #000304",
"4 	c #0081A4",
"5 	c #004558",
"6 	c #000B0E",
"7 	c #02303E",
"8 	c #008EB3",
"9 	c #008EB1",
"0 	c #00576C",
"a 	c #003947",
"b 	c #001014",
"c 	c #000C0F",
"d 	c #00080A",
"e 	c #008FB0",
"f 	c #0091AE",
"g 	c #0089A5",
"h 	c #00697E",
"i 	c #003E4B",
"j 	c #003844",
"k 	c #003742",
"l 	c #00181D",
"m 	c #001216",
"n 	c #000E11",
"o 	c #0091AD",
"p 	c #0092AD",
"q 	c #0092AC",
"r 	c #0090AA",
"s 	c #008FA9",
"t 	c #008EA7",
"u 	c #008BA6",
"v 	c #008CA5",
"w 	c #0088A1",
"x 	c #0089A1",
"y 	c #00849C",
"z 	c #00859C",
"A 	c #00849B",
"B 	c #00839A",
"C 	c #007F96",
"D 	c #00798F",
"E 	c #00788E",
"F 	c #00778C",
"G 	c #007488",
"H 	c #006A7D",
"I 	c #006476",
"J 	c #006273",
"K 	c #005F70",
"L 	c #00596A",
"M 	c #004A58",
"N 	c #004854",
"O 	c #004552",
"P 	c #00414D",
"Q 	c #003A45",
"R 	c #003A44",
"S 	c #00343D",
"T 	c #002E36",
"U 	c #002D35",
"V 	c #002A31",
"W 	c #002930",
"X 	c #00262D",
"Y 	c #002026",
"Z 	c #001215",
"` 	c #0098AF",
" .	c #0096AE",
"..	c #0098AE",
"+.	c #001316",
"@.	c #000E10",
"#.	c #000708",
"$.	c #0A8191",
"%.	c #009DB0",
"&.	c #0B7A88",
"*.	c #10828E",
"=.	c #084045",
"-.	c #16909B",
";.	c #041111",
">.	c #2D7B70",
",.	c #1F4F48",
"'.	c #060F0D",
").	c #19352C",
"!.	c #3C7D67",
"~.	c #010201",
"{.	c #050705",
"].	c #040502",
"^.	c #5E642F",
"/.	c #6C6F32",
"(.	c #5B5C26",
"_.	c #020200",
":.	c #010100",
"<.	c #030301",
"[.	c #0D0D05",
"}.	c #2C280B",
"|.	c #433D15",
"1.	c #706624",
"2.	c #83792C",
"3.	c #27261F",
"4.	c #282720",
"5.	c #847623",
"6.	c #463F15",
"7.	c #4D461A",
"8.	c #5A532C",
"9.	c #39320E",
"0.	c #453C12",
"a.	c #2A250B",
"b.	c #8A7A25",
"c.	c #A18C2C",
"d.	c #CBB138",
"e.	c #948129",
"f.	c #8E7C27",
"g.	c #827324",
"h.	c #776821",
"i.	c #65581C",
"j.	c #504616",
"k.	c #3E3611",
"l.	c #28230B",
"m.	c #97842A",
"n.	c #524817",
"o.	c #4B4215",
"p.	c #322C0E",
"q.	c #C1A937",
"r.	c #BAA335",
"s.	c #473E14",
"t.	c #E5C842",
"u.	c #BDA536",
"v.	c #B8A135",
"w.	c #A89330",
"x.	c #544A18",
"y.	c #3F3712",
"z.	c #110F05",
"A.	c #675E2F",
"B.	c #4F4825",
"C.	c #312A0C",
"D.	c #574B16",
"E.	c #6A5B1B",
"F.	c #827022",
"G.	c #605219",
"H.	c #AE962E",
"I.	c #534716",
"J.	c #9C872A",
"K.	c #877324",
"L.	c #554917",
"M.	c #161306",
"N.	c #C7AD37",
"O.	c #B8A033",
"P.	c #413812",
"Q.	c #1D1908",
"R.	c #AC9530",
"S.	c #5A4E19",
"T.	c #2B250C",
"U.	c #584C19",
"V.	c #070602",
"W.	c #26210B",
"X.	c #2C260D",
"Y.	c #1E1A09",
"Z.	c #665B2D",
"`.	c #6C6130",
" +	c #554D2B",
".+	c #3A3624",
"++	c #131005",
"@+	c #6B5B1D",
"#+	c #4A4328",
"$+	c #28261F",
"%+	c #050401",
"&+	c #060502",
"*+	c #0A0803",
"=+	c #834830",
"-+	c #230F0E",
";+	c #383838",
">+	c #1D1D1D",
",+	c #161616",
"'+	c #000000",
";+,+>+>+>+>+>+>+>+>+>+>+>+>+>+% _ ( ,+;+",
">+'+'+'+'+'+'+'+'+'+'+z.a.}.-+] , ) ; >+",
">+'+'+'+'+'+'+'+<.T.s.E.(.B.. # & > - { ",
">+'+'++.Q R a ).I.S.++'+;.7 } [ : * = ! ",
">+'+'+X q q e >.[.'+'+'+0 p ` %.< $ ' ~ ",
">+'+'+b u q q h '+'+'+ at .A q ..| / @ + >+",
">+'+'+{.*.o q F 3 '+'+N q q  .2 ^ =+5.>+",
">+'+'+9.!.9 q B #.'+1 G q q E d '+K.b.>+",
">+'+l.7.=.f q v Z '+U q q q j '+'+c.h.>+",
">+&+G.].W o q q V '+I q q D 6 '+V.q.P.>+",
">+k.D.'+l t q q P #.x q q k '+'+L.r.<.>+",
">+i.M.'+d y q q M T q q C c '+_.v.x.'+>+",
".+e.:.'+'+J q q K H q q i '+'+ at +w.'+'+>+",
"8.f.'+'+'+O q q w s q z m '+C.u.W.'+'+>+",
"A.m.'+'+'+S q q q q q 5 '+Y.R.y.'+'+'+>+",
" +O.%+'+'+Y r q q q 4 '.p.J.X.'+'+'+'+>+",
"$+d.U.'+'+n g f f 8 ,.|.F.Q.'+'+'+'+'+>+",
">+j.t.o.'+~.L &.$.-./.0.*+'+'+'+'+'+'+>+",
">+'+n.N.H.g.^.2.1.6.++'+'+'+'+'+'+'+'+>+",
";+,+>+4. +`.Z.#+3.>+>+>+>+>+>+>+>+>+,+;+"};

static Fl_Pixmap pixmap_vml(vml_xpm);

/* XPM */
static char * image_forward[] = {
"20 20 3 1",
" 	c None",
".	c #000000",
"+	c #16E2D8",
"                    ",
"                    ",
"                    ",
"                    ",
"          .         ",
"          ..        ",
"    .......+.       ",
"    .++++++++.      ",
"    .+++++++++.     ",
"    .++++++++++.    ",
"    .++++++++++.    ",
"    .+++++++++.     ",
"    .++++++++.      ",
"    .......+.       ",
"          ..        ",
"          .         ",
"                    ",
"                    ",
"                    ",
"                    "};

static Fl_Pixmap pixmap_forward(image_forward);

Fl_Button *Backward=(Fl_Button *)0;

static char * image_back[] = {
"20 20 3 1",
" 	c None",
".	c #000000",
"+	c #16E2D8",
"                    ",
"                    ",
"                    ",
"                    ",
"         .          ",
"        ..          ",
"       .+.......    ",
"      .++++++++.    ",
"     .+++++++++.    ",
"    .++++++++++.    ",
"    .++++++++++.    ",
"     .+++++++++.    ",
"      .++++++++.    ",
"       .+.......    ",
"        ..          ",
"         .          ",
"                    ",
"                    ",
"                    ",
"                    "};
static Fl_Pixmap pixmap_back(image_back);

Fl_Button *Stop=(Fl_Button *)0;

static unsigned char *image_stop[] = {
(unsigned char*)
"21 21 10 1",
(unsigned char*)
" \tc None",
(unsigned char*)
".\tc #C5C2C5",
(unsigned char*)
"+\tc #6265CD",
(unsigned char*)
"@\tc #838183",
(unsigned char*)
"#\tc #9C99FF",
(unsigned char*)
"$\tc #313062",
(unsigned char*)
"%\tc #000000",
(unsigned char*)
"&\tc #830000",
(unsigned char*)
"*\tc #FF0000",
(unsigned char*)
"=\tc #202020",
(unsigned char*)
".....................",
(unsigned char*)
"....+++++++++++ at .....",
(unsigned char*)
"...#@@#@#@#@#@+$.....",
(unsigned char*)
".$#+##@$%$@. at .@%%%$..",
(unsigned char*)
".$.+.@&&&&%@#.$@+%$..",
(unsigned char*)
"..$+.&&*&&$%@. at +%&%..",
(unsigned char*)
"..$+..***&$%#.+.&&...",
(unsigned char*)
"...+...**&$%@.@$&&...",
(unsigned char*)
"...+.#.*&=%=#.+$.&...",
(unsigned char*)
".$@+.##====+ at .$$$$$..",
(unsigned char*)
".$#+.#%%%%+$#.+ at +%$..",
(unsigned char*)
"..$+.@$$++$$@. at +%$$..",
(unsigned char*)
"...+.%@@$$$$#.+.$$...",
(unsigned char*)
"...+.%@@$$=@@.@$$$...",
(unsigned char*)
".$#+.#@$$$$#@.@$$$%..",
(unsigned char*)
".$#+.@%%%%=@#.$@+%$..",
(unsigned char*)
".@$+.%====%$@.++%$$..",
(unsigned char*)
"..$+.%$$$=$%#.+@$$...",
(unsigned char*)
"...+..$$=$=%@.+$$$@@.",
(unsigned char*)
"...+###===$@#@+=@@@@.",
(unsigned char*)
".....$$$+++++$+%@@@.."
};
static Fl_Pixmap pixmap_stop(image_stop);

Fl_Button *Reload=(Fl_Button *)0;

/* XPM */
static char * image_reload[] = {
"20 20 3 1",
" 	c None",
".	c #000000",
"+	c #0CF42F",
"                    ",
"      .             ",
"     ..             ",
"    .+.......       ",
"   .++++++++.       ",
"  .+++++++++.       ",
" .++++++++++.       ",
" .++++++++++.       ",
"  .+++++++++..      ",
"   .++++++++...     ",
"    .+........+.    ",
"     ...++++++++.   ",
"      ..+++++++++.  ",
"       .++++++++++. ",
"       .++++++++++. ",
"       .+++++++++.  ",
"       .++++++++.   ",
"       .......+.    ",
"             ..     ",
"             .      "};


static Fl_Pixmap pixmap_reload(image_reload);

#endif

--- NEW FILE: http.cpp ---
#include "http.h"

//#ifndef HTPROXY_H
//#define HTPROXY_H
//#endif


#define ERRNO_DONE
#include "WWWLib.h"
#include "WWWHTTP.h"
#include "WWWInit.h"
#include "HTProxy.h" 
#include "vmlapp.h"

#ifdef USING_FLEK_LIB
#include <Fl_Animator.H>
extern Fl_Animator *g_Logo;
#endif


int printer (const char * fmt, va_list pArgs)
{
  return(0);
    return (vfprintf(stdout, fmt, pArgs));
}

int tracer (const char * fmt, va_list pArgs)
{
  return(0);
    return (vfprintf(stderr, fmt, pArgs));
}

void HTTPConnection::setHTML(HTML_WIDGET * p)
{
  m_pHTML = p;
}

HTTPConnection::HTTPRequest::~HTTPRequest()
{
  delete [] m_Buffer;
}

HTTPConnection::HTTPRequest::HTTPRequest(HTML_WIDGET * p, 
					 const QString & url, 
					 Method m, bool bNewPage, const char * data) 
{
  _request = 0;
  m_bToss = false;
  m_strURL = url; 
  m_bNewPage = bNewPage; 
  m_nSize = 0; 
  m_Buffer = 0; 
  m_Method = m;
  m_View = p;

  if(data)
    m_strData = data;

}


void HTTPConnection::HTTPRequest::addBuffer(unsigned char * buf, int len)
{
  if(!m_Buffer)
    m_Buffer = (unsigned char *)malloc(len + 1);
  else
  {
    unsigned char *p = (unsigned char *)realloc(m_Buffer,m_nSize + len + 1);
    m_Buffer = p;
  }
  memcpy(m_Buffer + m_nSize,buf,len);
  *(m_Buffer + m_nSize + len) = 0;
  m_nSize += len;

#ifdef NEVER
  if(!m_Buffer) {
    m_Buffer = new unsigned char[len];
  } else {
    unsigned char * p  = new unsigned char[m_nSize + len];
    memcpy(p,m_Buffer,m_nSize);
    delete [] m_Buffer;
    m_Buffer = p;
  }
  memcpy(m_Buffer + m_nSize,buf,len);
  m_nSize += len;
#endif
}

HTTPConnection::HTTPConnection() 
{ 
  pthread_mutex_init(&m_ListLock, 0);

  m_bThreadRunning = false;
  m_pDocCallback = 0;

  HTProfile_newPreemptiveClient("ViewML", "0.14");
  
  HTPrint_setCallback(printer);
  HTTrace_setCallback(tracer);

#if 0  
  HTSetTraceMessageMask("*");
#endif

  char * pProxy = getenv("VIEWML_PROXY");

  if(pProxy && pProxy[0])
    HTProxy_add("http",pProxy);
  
  /* Register the default set of MIME header parsers */
  HTMIMEInit();
  
}

HTTPConnection::~HTTPConnection()
{
  HTFormat_deleteAll();
  HTLibTerminate();  
  pthread_mutex_destroy(&m_ListLock);
}

int HTTPConnection::Connect(QObject * p)
{
  connect(p,SIGNAL(documentStarted(KHTMLView *)),
	  SLOT(slotDocumentStarted(KHTMLView *)));
  connect(p,SIGNAL(documentRequest(KHTMLView *, const char*)),
	  SLOT(slotDocumentRequest(KHTMLView *, const char*)));
  connect(p,SIGNAL(imageRequest(KHTMLView *, const char*)),
	  SLOT(slotOpenURL(KHTMLView *, const char*)));
  connect(p,SIGNAL(URLSelected(KHTMLView*,const char*,int,const char*)), 
	  SLOT(slotClick(KHTMLView*,const char*,int,const char*)));
  // Changed documentDone() to be documentDone(KHTMLView *) --- jmw
  connect(p,SIGNAL(documentDone(KHTMLView *)), SLOT(slotDocDone()));
  connect(p,SIGNAL(documentDone()), SLOT(slotDocDone()));
  connect(p,SIGNAL(formSubmitted(KHTMLView *,const char *, const char *, const char*)),
	  SLOT(slotForm(KHTMLView *,const char *, const char *, const char*)));

  return 0;
}

void HTTPConnection::slotDocumentStarted(KHTMLView * v)
{
  //Connect((QObject*)v);
}

void HTTPConnection::slotDocumentRequest(KHTMLView * v, const char * url)
{
  m_bDocDone = false;

#ifdef USING_FLEK_LIB
  if (g_Logo)
	  g_Logo->start_animation();
#endif

  AddReq(v,url,HTTPRequest::GET,true);
  StartThread();
}

void HTTPConnection::slotForm(KHTMLView * v,const char * url, 
			      const char * method, const char * data)
{
  QString tmp;
  tmp = url;

  if(!strcmp(method,"GET")) {
    tmp += '?';
    tmp += data;
    loadPage(v,tmp,HTTPRequest::GET,data);
  }
 else {
    loadPage(v,tmp,HTTPRequest::POST,data);
  }

  if(m_pDocCallback)
    m_pDocCallback(tmp,0,0);

  m_bDocDone = false;
  StartThread();
}



void HTTPConnection::slotDocDone()
{
  m_bDocDone = true;

#ifdef USING_FLEK_LIB
  if (g_Logo)
  {
	  g_Logo->stop_animation();
	  g_Logo->frame(0);
	  g_Logo->redraw();
  } // end of if
#endif

  do_size();

}

void HTTPConnection::slotOpenURL(KHTMLView * v, const char * URL)
{
  m_bDocDone = false;

  AddReq(v,URL);
  StartThread();
}

void HTTPConnection::StartThread()
{
  if(m_bThreadRunning)
    return;
  
  m_bThreadRunning = true;
  pthread_create(&m_Thread,NULL,runthread,this);

  BeginDataTimer();
}

void HTTPConnection::loadPage(HTML_WIDGET * p, const char * URL,
			      HTTPRequest::Method method, const char * data)
{
  m_bDocDone = false;

  EmptyQueues(p);

#ifdef USING_FLEK_LIB
  if (g_Logo)
	  g_Logo->start_animation();
#endif

  AddReq(p,URL,method,true,data);
  StartThread();
}

void HTTPConnection::setCurrent(HTTPRequest * p)
{
  pthread_mutex_lock(&m_ListLock);
  m_pCurrentRequest = p;
  pthread_mutex_unlock(&m_ListLock);
}  

void HTTPConnection::tossCurrent(HTML_WIDGET * p)
{
  pthread_mutex_lock(&m_ListLock);
  if(m_pCurrentRequest) {
    if(m_pCurrentRequest->HTML() == p)
      m_pCurrentRequest->toss(true);
    //    if(m_pCurrentRequest->_request)
    //      HTHost_killPipe(HTNet_host(HTRequest_net(m_pCurrentRequest->_request)));
  }
  pthread_mutex_unlock(&m_ListLock);
}  

void * HTTPConnection::runthread(void * p)
{
  HTTPConnection * pThis = (HTTPConnection*)p;
  HTTPRequest * r = 0;

  r = pThis->GetReq();
  pThis->setCurrent(r);
  while(r) {
    pThis->getURL(r);
    pThis->AddFinished(r);
    r = pThis->GetReq();
    pThis->setCurrent(r);
  }

  pThis->setCurrent(0);

  pthread_detach(pThis->m_Thread);
  pThis->m_bThreadRunning = false;

  return 0;
}

void HTTPConnection::StopThread()
{

}

int HTTPConnection::postURL(HTTPRequest * r)
{
  char * c = (char*)alloca(strlen(r->getData())+1);
  char * c_ptr = c;
  HTChunk * chunk = NULL;
  HTAnchor * anchor = NULL;  
  HTAssocList * formfields = NULL;

  strcpy(c,r->getData());

  while(*c && (c_ptr = strchr(c,'&'))) {

    *c_ptr = 0;
    /* Create a list to hold the form arguments */
    if (!formfields) formfields = HTAssocList_new();

    /* Parse the content and add it to the association list */
    HTParseFormInput(formfields, c);
    
    c = c_ptr+1;
  }

  /* Add the last field */
  if (c) { 
    if (!formfields) formfields = HTAssocList_new();
    HTParseFormInput(formfields, c);
  }

  /* Create a request */
  request = HTRequest_new();
  
  /* Set the default output to "asis" */
  HTRequest_setOutputFormat(request, WWW_SOURCE);
  HTRequest_setPreemptive(request, YES);
  
  /* Get an anchor object for the URI */
  anchor = HTAnchor_findAddress(r->getURL());

  r->_request = request;

  /* Post the data and get the result in a chunk */
  chunk = HTPostFormAnchorToChunk(formfields, anchor, request);

  /* If chunk != NULL then we have the data */
  if (chunk) {
    int sz = HTChunk_size(chunk);
    r->addBuffer((unsigned char*)HTChunk_data(chunk),sz);
    HTChunk_delete(chunk);
  }

  /* Clean up the form fields */
  HTAssocList_delete(formfields);
  HTRequest_delete(request);

  return 0;
}

int  HTTPConnection::getURL(HTTPRequest * r)
{
  const char * URL = r->getURL();

  if(r->getMethod() == HTTPRequest::POST)
    return postURL(r);

  /* Moved these below the above line to avoid creating a */
  /* new request that never gets used */
  
  request = HTRequest_new();
  HTChunk * chunk;

  HTRequest_setOutputFormat(request, WWW_SOURCE);
  HTRequest_setPreemptive(request, YES);

  if (URL) {
    char * cwd = HTGetCurrentDirectoryURL();
    char * absolute_url = HTParse(URL, cwd, PARSE_ALL);

    r->_request = request;

    chunk = HTLoadToChunk(absolute_url, request);

    HT_FREE(absolute_url);
    HT_FREE(cwd);

    /* If chunk != NULL then we have the data */
    if (chunk) {
      int sz = HTChunk_size(chunk);
      r->addBuffer((unsigned char*)HTChunk_data(chunk),sz);
      HTChunk_delete(chunk);
    }
 } 
  
  HTRequest_delete(request);
  
  return 0;
}

void HTTPConnection::AddReq(HTTPRequest * r)
{
  pthread_mutex_lock(&m_ListLock);
  m_Reqs.push(r);
  pthread_mutex_unlock(&m_ListLock);  
}


void HTTPConnection::AddReq(HTML_WIDGET * p, const char * url, 
			    HTTPRequest::Method method, bool bNewPage,
			    const char * data)
{

  HTTPRequest * r = new HTTPRequest(p,url,method,bNewPage,data);
  pthread_mutex_lock(&m_ListLock);

  m_Reqs.push(r);
  pthread_mutex_unlock(&m_ListLock);
}

void _HaveData(HTTPConnection::HTTPRequest * p);


void HTTPConnection::EmptyQueues(HTML_WIDGET * p)
{
  HTTPRequest * r,* pAddFirst=0, *pFinishFirst=0;

  tossCurrent(p);

  while((r = GetReq()) && r != pAddFirst) 
    { 
      if(r->HTML() != p) {
	AddReq(r); 
	if(!pAddFirst)
	  pAddFirst = r;
      } else {
	_HaveData(r);
	delete r;
      }
    }
  
  while((r = GetFinished()) && r != pFinishFirst) 
    { 
      if(r->HTML() != p) { 
	AddFinished(r);       
	if(!pFinishFirst)
	  pFinishFirst = r;
      } else {
	_HaveData(r);
	delete r;
      }
    }
}

HTTPConnection::HTTPRequest * HTTPConnection::GetReq()
{
  HTTPRequest * r = 0;
  pthread_mutex_lock(&m_ListLock);
  if(m_Reqs.size()) {
    r = m_Reqs.front();

    m_Reqs.pop();

  }

  if(m_Reqs.size()) {
    StopThread();
  }

  pthread_mutex_unlock(&m_ListLock);
  return r;
}

int HTTPConnection::ReqSize()
{
 pthread_mutex_lock(&m_ListLock);
 int r = m_Reqs.size();
 pthread_mutex_unlock(&m_ListLock);
 return r;

}

void HTTPConnection::AddFinished(HTTPRequest * r)
{
  pthread_mutex_lock(&m_ListLock);
  m_Finished.push(r);
  pthread_mutex_unlock(&m_ListLock);
}

HTTPConnection::HTTPRequest * HTTPConnection::GetFinished()
{
  HTTPRequest * r = 0;
  pthread_mutex_lock(&m_ListLock);
  if(m_Finished.size()) {
    r = m_Finished.front();
    m_Finished.pop();
  }
  pthread_mutex_unlock(&m_ListLock);
  return r;
}

int HTTPConnection::FinishedSize()
{
 pthread_mutex_lock(&m_ListLock);
 int r = m_Finished.size();
 pthread_mutex_unlock(&m_ListLock);
 return r;

}

#include "http.moc"



--- NEW FILE: htmlobj.cpp ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
[...2087 lines suppressed...]
HTMLAnchor* HTMLAnchor::findAnchor( const char *_name, QPoint *_p )
{
    if ( strcmp( _name, name ) == 0 )
    {
	_p->setX( _p->x() + x );
	_p->setY( _p->y() + y );
	return this;
    }
    
    return 0L;
}

void HTMLAnchor::setMaxAscent( int _a )
{
    y -= _a;
}

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

#include "htmlobj.moc"

--- NEW FILE: debug.cpp ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
#include <stdio.h>  
#include <stdarg.h>      
#include "html.h"

#ifdef MARTINSDEBUG
void debugM( const char *msg, ...)
{
    va_list ap;
    va_start( ap, msg );                // use variable arg list
    vfprintf( stdout, msg, ap );
    va_end( ap );
#else
void debugM(const char *, ... )
{
#endif
}       


--- NEW FILE: http.h ---
#ifndef __HTTP_H
#define __HTTP_H

#include "qobject.h"
#include "qstring.h"
#include <queue>
#include <pthread.h>

struct _HTRequest;
struct _HTList;
struct _HTChunk;

typedef _HTRequest HTRequest;
typedef _HTList HTList;
typedef _HTChunk HTChunk;

#define HTML_WIDGET KHTMLView
#define xHTML_WIDGET KHTMLWidget

class HTML_WIDGET;

class HTTPConnection : public QObject
{
  Q_OBJECT;
protected:
  HTRequest * request;
  HTList * converters;
  HTList * encodings;

  bool m_bTossCurrent;

  pthread_mutex_t m_ListLock;
public:

  bool m_bDocDone;

  class HTTPRequest
    {
    public:
      enum Method { GET,POST };
    protected:
      QString m_strURL;
      QString m_strData;
      unsigned char * m_Buffer;
      int m_nSize;
      bool m_bNewPage;
      bool m_bToss;
      Method m_Method;
      HTML_WIDGET * m_View;
      
    public:

      void * _request;

      HTTPRequest(HTML_WIDGET * p, const QString & url, Method m = GET, 
		  bool bNewPage=false, const char * data=0);
      ~HTTPRequest();

      Method getMethod() { return m_Method; }

      HTML_WIDGET * HTML() { return m_View; }
      const char * getData() const { return m_strData; }
      const char * getURL() const { return m_strURL; }
      unsigned char * getBuffer() { return m_Buffer; }
      bool newPage() { return m_bNewPage; }
      int getSize() { return m_nSize; }
      void addBuffer(unsigned char * buf, int len);
      int toss() { return m_bToss; }
      void toss(bool bToss) { m_bToss = bToss; }
    };

  HTTPRequest * m_pCurrentRequest;

  void setCurrent(HTTPRequest * p);
  void tossCurrent(HTML_WIDGET * p);

  HTTPConnection();
  ~HTTPConnection();
  int Connect(QObject * p);

  void loadPage(HTML_WIDGET * p, const char * URL,
		HTTPRequest::Method method=HTTPRequest::GET, const char * data=0);
  void setHTML(HTML_WIDGET * p);
  HTML_WIDGET * HTML() const { return m_pHTML; }

 protected:
  queue<HTTPRequest *> m_Reqs;
  queue<HTTPRequest *> m_Finished;
  pthread_t m_Thread;
  bool m_bThreadRunning;
  HTML_WIDGET * m_pHTML;

  void StartThread();
  void StopThread();
  void BeginDataTimer();
  static void * runthread(void* p);

  void (*m_pDocCallback)(const char *,int,int);

 public:

  void do_size();

  void EmptyQueues(HTML_WIDGET * p);

  void AddReq(HTTPRequest * r);
  void AddReq(HTML_WIDGET * p, const char * url, 
	      HTTPRequest::Method method = HTTPRequest::GET, 
	      bool bNewPage=false, const char * data=0);

  HTTPRequest * GetReq();
  int ReqSize();

  void AddFinished(HTTPRequest * p);
  HTTPRequest * GetFinished();
  int FinishedSize();

  int getURL(HTTPRequest * r);
  int postURL(HTTPRequest * r);

  void setDocCallback(void(*p)(const char *,int,int)) { m_pDocCallback = p; }
  
 protected slots:
  void slotDocumentRequest(KHTMLView * v, const char * url);
  void slotDocumentStarted(KHTMLView * v);
  void slotOpenURL(KHTMLView * v,const char * URL);
  void slotDocDone();
  void slotClick(KHTMLView * p, const char * d1, int b, const char * p);
  void slotForm(KHTMLView *,const char *,const char *, const char *);
    
};

#endif

--- NEW FILE: htmlview.cpp ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
//----------------------------------------------------------------------------
//
// KDE HTML Widget
//
// Copyright (c) 1997 The KDE Project
//

#include "htmlview.h"

#include <kcursor.h>

#define SCROLLBAR_WH 12

QList<KHTMLView> *KHTMLView::viewList = 0L;

KHTMLView::KHTMLView( QWidget *_parent, const char *_name, int _flags, KHTMLView *_parent_view ) 
    : QWidget( _parent, _name, _flags )
{    

    parentView = _parent_view;
    
    // Allow resizing of frame
    bAllowResize = TRUE;

    // Set scrolling to auto
    scrolling = -1;

    // border on
    frameBorder = 1;
    
    // debugT("Constructed KHTML View\n");
    
    if ( viewList == 0L )
	viewList = new QList<KHTMLView>;
    viewList->setAutoDelete( FALSE );
    viewList->append( this );
    
    frameName = _name;
    
    displayVScroll = FALSE;
    displayHScroll = FALSE;

    // This is the second part of the ugly hack in main.cpp
    // we need to make sure that we have a real parent before
    // we map our window so that the window manager doesn't
    // grab this. ... jsk

    if(_flags) { ((Fl_Window *)_flags)->add(this); }

    // These are needed to make sure the parents are shown
    // before we are .. jsk
    if(_parent) { _parent->add(this); _parent->raise(); }
    if(_parent_view) { _parent_view->raise();}
    raise();

    initGUI();
}

KHTMLView::~KHTMLView()
{
  viewList->removeRef( this );
    
    // debugT("Deleted View\n");
}

KHTMLView* KHTMLView::newView( QWidget *_parent, const char *_name, int _flags )
{
    return new KHTMLView( _parent, _name, _flags, this );

    /*
    connect( view, SIGNAL( documentStarted( KHTMLView * ) ),
	     this, SLOT( slotDocumentStarted( KHTMLView * ) ) );
    connect( view, SIGNAL( documentDone( KHTMLView * ) ),
	     this, SLOT( slotDocumentDone( KHTMLView * ) ) );
    connect( view, SIGNAL( imageRequest( KHTMLView *, const char * ) ),
	     this, SLOT( slotImageRequest( KHTMLView *, const char * ) ) );
    connect( view, SIGNAL( URLSelected( KHTMLView *, const char*, int, const char* ) ),
	     this, SLOT( slotURLSelected( KHTMLView *, const char *, int, const char* ) ) );    
    connect( view, SIGNAL( onURL( KHTMLView *, const char* ) ),
	     this, SLOT( slotOnURL( KHTMLView *, const char * ) ) );
    connect( view, SIGNAL( popupMenu( KHTMLView *, const char*, const QPoint & ) ),
	     this, SLOT( slotPopupMenu( KHTMLView *, const char *, const QPoint & ) ) );
    connect( view, SIGNAL( cancelImageRequest( KHTMLView *, const char* ) ),
	     this, SLOT( slotCancelImageRequest( KHTMLView *, const char * ) ) );
    connect( view, SIGNAL( formSubmitted( KHTMLView *, const char *, const char*, const char* ) ),
	     this, SLOT( slotFormSubmitted( KHTMLView *, const char *, const char*, const char* ) ) ); */
}

KHTMLView* KHTMLView::findView( const char *_name )
{
    KHTMLView *v;
 
    if ( strcmp( _name, "_top" ) == 0 )
    {
	v = this;

	while ( v->getParentView() )
	    v = v->getParentView();
	
	return v;
    }
    else if ( strcmp( _name, "_self" ) == 0 )
    {
	return this;
    }
    else if ( strcmp( _name, "_parent" ) == 0 )
    {
	if ( getParentView() )
	    return getParentView();
    }
    else if ( strcmp( _name, "_blank" ) == 0 )
    {
	return 0;
    }

    for ( v = viewList->first(); v != 0; v = viewList->next() )
    {
	if ( v->getFrameName() )
	{
	    // debugT("Comparing '%s' '%s'\n", _name, v->getFrameName() );
	    if ( strcmp( v->getFrameName(), _name ) == 0 )
		return v;
	}
    }
    
    return 0;
}

void KHTMLView::begin( const char *_url, int _dx, int _dy )
{
    if ( displayHScroll )
	view->setGeometry( 0, 0, width(), height() );
    displayVScroll = FALSE;
    displayHScroll = FALSE;
    vert->hide();
    horz->hide();
    vert->setSteps( 12, view->height() );
    horz->setSteps( 12, view->width() );

    if ( _url )
	url = _url;
    
    scrollToX = _dx;
    scrollToY = _dy;
    
//    view->begin( _url, _dx, _dy );
    view->begin( _url, 0, 0 );
}

void KHTMLView::write( const char *_text )
{
    view->write( _text );
}

void KHTMLView::end()
{
    view->end();
}

void KHTMLView::parse()
{
    view->parse();
}

void KHTMLView::print()
{
    view->print();
}

void KHTMLView::initGUI()
{
    horz = new QScrollBar( 0, 0, 12, width(), 0, QScrollBar::Horizontal,
	    this, "horz" );
    horz->hide();
    vert = new QScrollBar( 0, 0, 12, height(), 0, QScrollBar::Vertical,
	    this, "vert" );
    vert->hide();
    
    horz->setMinimumSize( SCROLLBAR_WH, SCROLLBAR_WH );
    vert->setMinimumSize( SCROLLBAR_WH, SCROLLBAR_WH );

    view = new KHTMLWidget( this, "" );

    CHECK_PTR( view );
    view->setView( this );
    setFocusProxy( view );

    connect( view, SIGNAL( scrollVert( int ) ), SLOT( slotInternScrollVert( int ) ) );
    connect( view, SIGNAL( scrollHorz( int ) ), SLOT( slotInternScrollHorz( int ) ) );

    connect( vert, SIGNAL(valueChanged(int)), view, SLOT(slotScrollVert(int)) );
    connect( horz, SIGNAL(valueChanged(int)), view, SLOT(slotScrollHorz(int)) );

    connect( view, SIGNAL( documentChanged() ), SLOT( slotDocumentChanged() ) );
    connect( view, SIGNAL( setTitle( const char* ) ),
	     this, SLOT( slotSetTitle( const char * ) ) );
    connect( view, SIGNAL( URLSelected( const char*, int, const char* ) ),
	     this, SLOT( slotURLSelected( const char *, int, const char* ) ) );    
    connect( view, SIGNAL( onURL( const char* ) ),
	     this, SLOT( slotOnURL( const char * ) ) );
    connect( view, SIGNAL( textSelected( bool ) ),
	     this, SLOT( slotTextSelected( bool ) ) );
    connect( view, SIGNAL( popupMenu( const char*, const QPoint & ) ),
	     this, SLOT( slotPopupMenu( const char *, const QPoint & ) ) );
    connect( view, SIGNAL( fileRequest( const char* ) ),
	     this, SLOT( slotImageRequest( const char * ) ) );
    connect( view, SIGNAL( cancelFileRequest( const char* ) ),
    	     this, SLOT( slotCancelImageRequest( const char * ) ) );
    connect( view, SIGNAL( formSubmitted( const char *, const char*, const char* ) ),
	     this, SLOT( slotFormSubmitted( const char *, const char*, const char* ) ) );
    connect( view, SIGNAL( documentStarted() ),
	     this, SLOT( slotDocumentStarted() ) );
    connect( view, SIGNAL( documentDone() ),
	     this, SLOT( slotDocumentDone() ) );
    connect( view, SIGNAL( goUp() ), this, SLOT( slotGoUp() ) );
    connect( view, SIGNAL( goLeft() ), this, SLOT( slotGoLeft() ) );
    connect( view, SIGNAL( goRight() ), this, SLOT( slotGoRight() ) );

    view->setURLCursor( KCursor::upArrowCursor() );
    view->raise();
}

void KHTMLView::resizeEvent( QResizeEvent * )
{
    // resize the view - it will handle object size/pos calc
    view->setGeometry( 0, 0, width(), height() );

    if ( url.isEmpty() )
	return;

    // place/hide scrollbars
    calcScrollBars();

    // if we need a horzontal scrollbar then resize view again.
    // This does not cause object size/pos to be recalculated as
    // the width is not changed.
    if ( displayHScroll )
    {
	view->setGeometry( 0, 0, width(), height() - SCROLLBAR_WH );
    }

    vert->setSteps( 12, view->height() );
    horz->setSteps( 12, view->width() );
}
    
void KHTMLView::closeEvent( QCloseEvent *e )
{
    // debugT("Closing\n");
    e->accept();

    delete this;
}
    
void KHTMLView::slotScrollVert( int _y )
{
  if ( !view )
    return;
      
  view->slotScrollVert( _y );
  vert->setValue( view->yOffset() );
}

void KHTMLView::slotScrollHorz( int _x )
{
  if ( !view )
    return;
      
  view->slotScrollHorz( _x );
  horz->setValue( view->xOffset() );
}

void KHTMLView::slotInternScrollVert( int _y )
{
  // Update the scrollbar only
  vert->setValue( _y );
}

void KHTMLView::slotInternScrollHorz( int _x )
{
  // Update the scrollbar only
  horz->setValue( _x );
}

void KHTMLView::slotDocumentChanged()
{    
    if ( url.isNull() )
	return;

    bool oldh = displayHScroll;

    calcScrollBars();    

    if ( displayHScroll && !oldh )
	view->setGeometry( 0, 0, width(), height() - SCROLLBAR_WH );
    else if ( !displayHScroll && oldh )
	view->setGeometry( 0, 0, width(), height() );
}

void KHTMLView::calcScrollBars()
{
    if ( view->docWidth() > view->width() && !isFrameSet() && scrolling )
	displayHScroll = TRUE;
    else
        displayHScroll = FALSE;
    
    if ( view->docHeight() > view->height() && !isFrameSet() && scrolling )
	displayVScroll = TRUE;
    else
        displayVScroll = FALSE;

    if ( displayVScroll && displayHScroll )
    {
	horz->setRange( 0, view->docWidth() + SCROLLBAR_WH - view->width() );
	if(horz->value() != view->xOffset())
	    horz->setValue( view->xOffset() );

	vert->setRange( 0, view->docHeight() - height() + SCROLLBAR_WH );
	if(vert->value() != view->yOffset())
	    vert->setValue( view->yOffset() );
    }
    else if ( displayHScroll )
    {
	horz->setRange( 0, view->docWidth() - view->width() );
	if(horz->value() != view->xOffset())
	    horz->setValue( view->xOffset() );
    }
    else if ( displayVScroll )
    {
	vert->setRange( 0, view->docHeight() - height() );
	if(vert->value() != view->yOffset())
	    vert->setValue( view->yOffset() );
    }    

    int right = 0;
    if ( displayVScroll )
	right = SCROLLBAR_WH;
  
    int bottom = 0;
    if ( !displayHScroll )
    {
	horz->hide();
	view->slotScrollHorz( 0 );
    }	
    else
    {
	bottom = SCROLLBAR_WH;
	// debugT("Showing HScrollBar\n");
	horz->setGeometry( 0, height() - SCROLLBAR_WH, width() - right, SCROLLBAR_WH );
	horz->show();
	horz->raise();
    }

    if ( !displayVScroll )
    {
	vert->hide();
	view->slotScrollVert( 0 );
    }
    else
    {
	// debugT("Showing VScrollBar\n");
	vert->setGeometry( width() - SCROLLBAR_WH, 0, SCROLLBAR_WH, height() - bottom );
	vert->show();
	vert->raise();
    }
}

void KHTMLView::cancelAllRequests()
{
    if ( view )
	view->cancelAllRequests();
}

void KHTMLView::slotDocumentStarted( KHTMLView *_view )
{
    // debug( "emit documentStarted( _view );" );
    emit documentStarted( _view );
}

void KHTMLView::slotDocumentStarted()
{
    // debug( "emit documentStarted( this );" );
    emit documentStarted( this );
}

void KHTMLView::slotDocumentDone( KHTMLView *_view )
{
    // debug( "emit documentDone( _view );" );
    emit documentDone( _view );
}

void KHTMLView::slotDocumentDone()
{
  // Scroll to where we want to go
  if ( scrollToX )
  {    
    if ( displayHScroll )
	slotScrollHorz( scrollToX );
    scrollToX = 0;
  }
  if ( scrollToY )
  {    
    if ( displayVScroll )
        slotScrollVert( scrollToY );
    scrollToY = 0;
  }
  
  // debug( "emit documentDone( this );" );
  emit documentDone( this );
}

void KHTMLView::slotDocumentRequest( KHTMLView *_view, const char *_url )
{
    emit documentRequest( _view, _url );
}

void KHTMLView::slotCancelDocumentRequest( KHTMLView *_view, const char *_url )
{
    emit cancelDocumentRequest( _view, _url );
}

void KHTMLView::slotSetTitle( const char *_text )
{
    emit setTitle( _text );
}

void KHTMLView::slotURLSelected( KHTMLView *_view, const char *_url,
    int _button, const char *_target )
{
    // debugT("URL selected '%s'\n",_url );
    emit URLSelected( _view, _url, _button, _target );
}

void KHTMLView::slotURLSelected( const char *_url, int _button,
    const char *_target )
{
    // debugT("URL 2 selected '%s'\n",_url );
    emit URLSelected( this, _url, _button, _target );
}

void KHTMLView::slotOnURL( KHTMLView *_view, const char *_url )
{
    // debugT("On URL '%s'\n",_url );
    emit onURL( _view, _url );
}

void KHTMLView::slotOnURL( const char *_url )
{
    // debugT("On URL 2 '%s'\n",_url);
    emit onURL( this, _url );
}

void KHTMLView::slotTextSelected( bool _selected )
{
    emit textSelected( this, _selected );
}

void KHTMLView::slotPopupMenu( KHTMLView *_view, const char *_url,
    const QPoint &_point )
{
    emit popupMenu( _view, _url, _point );
}

void KHTMLView::slotPopupMenu( const char *_url, const QPoint &_point )
{
    emit popupMenu( this, _url, _point );
}

void KHTMLView::slotImageRequest( KHTMLView *_view, const char *_url )
{
    emit imageRequest( _view, _url );
}

void KHTMLView::slotImageRequest( const char *_url )
{
    emit imageRequest( this, _url );
    emit imageRequest( _url );
}

void KHTMLView::slotCancelImageRequest( KHTMLView *_view, const char *_url )
{
    emit cancelImageRequest( _view, _url );
}


void KHTMLView::slotCancelImageRequest( const char *_url )
{
  emit cancelImageRequest( this, _url );
    emit cancelImageRequest( _url );
}

void KHTMLView::slotImageLoaded( const char *_url, const char *_filename )
{
    if ( view )
	view->slotFileLoaded( _url, _filename );
}

void KHTMLView::slotFormSubmitted( KHTMLView *_view, const char *_method, const char *_url, const char *_data )
{
    emit formSubmitted( _view, _url, _method, _data );
}

void KHTMLView::slotFormSubmitted( const char *_method, const char *_url, const char *_data )
{
    // debugT("Form submitted '%s'\n",_url);
    
    emit formSubmitted( this, _url, _method, _data );
}

void KHTMLView::slotGoUp()
{
  emit goUp( this );
  emit goUp();
}

void KHTMLView::slotGoRight()
{
  emit goRight( this );
  emit goRight();
}

void KHTMLView::slotGoLeft()
{
  emit goLeft( this );
  emit goLeft();
}

int KHTMLView::xOffset()
{
    return view->xOffset();
}

int KHTMLView::yOffset()
{
    return view->yOffset();
}

const char* KHTMLView::getURL( QPoint & p )
{
    return view->getURL( p );
}

void KHTMLView::select( QRegExp& _pattern, bool _select )
{
    view->select( 0L, _pattern, _select );
}

void KHTMLView::openURL( const char *_url )
{
    // debug( "openURL : %s", _url );
    emit documentRequest( this, _url );
}

bool KHTMLView::isFrameSet()
{
    return view->isFrameSet();
}

void KHTMLView::setIsFrameSet( bool _frameset )
{
    /*  if ( _frameset )
    {
	displayVScroll = FALSE;
	displayHScroll = FALSE;
    } */

    view->setIsFrameSet( _frameset ); 
}

bool KHTMLView::isFrame()
{
    return view->isFrame();
}

void KHTMLView::setIsFrame( bool _frame )
{
    // debugT(">>>>>>>>>>>>>>>> I am a frame %x <<<<<<<<<<<<<<<<<<\n",(int)this);
  
    /*  if ( _frame )
    {
	displayVScroll = FALSE;
	displayHScroll = FALSE;
    } */

    view->setIsFrame( _frame ); 
}

void KHTMLView::setSelected( bool _selected )
{
    view->setSelected( _selected ); 
    if ( _selected )
	emit frameSelected( this );
}

bool KHTMLView::isSelected()
{
    return view->isSelected();
}

KHTMLView* KHTMLView::getSelectedView()
{
    // debugT(">>>>>>>>>>>>>>>>>>>>>>>>>> HTMLView 1 <<<<<<<<<<<<<<<<<<<<<<<<\n");
    if ( isFrame() && isSelected() )
	return this;

    // debugT(">>>>>>>>>>>>>>>>>>>>>>>>>> HTMLView 2 <<<<<<<<<<<<<<<<<<<<<<<<\n");
    if ( isFrameSet() )
	return view->getSelectedFrame();

    // debugT(">>>>>>>>>>>>>>>>>>>>>>>>>> HTMLView 3 <<<<<<<<<<<<<<<<<<<<<<<<\n");
    return 0L;
}

void KHTMLView::slotVertSubtractLine()
{
    if ( vert->isVisible() )
	vert->subtractLine ();
}

void KHTMLView::slotVertAddLine()
{
    if ( vert->isVisible() )
	vert->addLine ();
}

void KHTMLView::slotVertSubtractPage()
{
    if ( vert->isVisible() )
	vert->subtractPage ();
}

void KHTMLView::slotVertAddPage()
{
    if ( vert->isVisible() )
	vert->addPage ();
}                       

bool KHTMLView::mouseMoveHook( QMouseEvent * )
{
    return FALSE;
}

bool KHTMLView::mouseReleaseHook( QMouseEvent * )
{
    return FALSE;
}

bool KHTMLView::mousePressedHook( const char*, const char*, QMouseEvent*, bool )
{
    return FALSE;
}

bool KHTMLView::dndHook( const char *, QPoint & )
{
    return FALSE;
}

void KHTMLView::select( QPainter * _painter, QRect &_rect )
{
    view->select( _painter, _rect );
}

void KHTMLView::select( QPainter * _painter, bool _select )
{
    view->select( _painter, _select );
}

void KHTMLView::selectByURL( QPainter *_painter,const char *_url,bool _select )
{
    view->selectByURL( _painter, _url, _select );
}

void KHTMLView::getSelected( QStrList &_list )
{
    view->getSelected( _list );
}

void KHTMLView::getSelectedText( QString &_str )
{
    view->getSelectedText( _str );
}

bool KHTMLView::isTextSelected() const
{
    return view->isTextSelected();
}

void KHTMLView::findTextBegin()
{
    view->findTextBegin();
}

bool KHTMLView::findTextNext( const QRegExp &exp )
{
    return view->findTextNext( exp );
}

void KHTMLView::findTextEnd()
{
    view->findTextEnd();
}

void KHTMLView::setMarginWidth( int _w )
{
    view->setMarginWidth( _w );
}

void KHTMLView::setMarginHeight( int _h )
{
    view->setMarginHeight( _h );
}

bool KHTMLView::gotoAnchor(const char* anchor)
{
    return view->gotoAnchor(anchor);
}

bool KHTMLView::gotoXY(int _x, int _y)
{
    if ( !displayVScroll )
    	_y = 0;
    if ( !displayHScroll )
    	_x = 0;
    	
    return view->gotoXY(_x, _y);
}

void KHTMLView::setCharset( const char *_c)
{
    view->setCharset(_c);
}

void 
KHTMLView::setOverrideCharset(const char *name)
{
    view->setOverrideCharset(name);
}

KHTMLView* KHTMLView::topView()
{
  KHTMLView *v = this;
  
  while( v->getParentView() )
    v = v->getParentView();
  
  return v;
}

void KHTMLView::data( const char *_url, const char *_data, int _len, bool _eof )
{
  view->data( _url, _data, _len, _eof );
}

SavedPage * KHTMLView::saveYourself()
{
    SavedPage *p = new SavedPage();
    p->isFrame = isFrame();
    p->frameName = frameName;
    p = view->saveYourself(p);
    KURL url(p->url);
    if(url.isMalformed()) return 0;
    return p;
}

void KHTMLView::restore(SavedPage *p)
{
    KHTMLView *v;
    KHTMLView *top = findView( "_top" );
    for ( v = viewList->first(); v != 0; v = viewList->next() )
    {
	if ( v->getFrameName() )
	{
	    if ( strcmp( v->getFrameName(), p->frameName ) == 0 ) 
		if( top != v->findView( "_top" ) )
		    continue;
		else
		    break;
	}
    }

    if(v)
	v->view->restore( p );
    else
	view->restore( p );
}

void KHTMLView::restorePosition( int x, int y )
{
    view->restorePosition( x, y );
}

#include "htmlview.moc"


--- NEW FILE: build_depends.mk ---
include ../makeinclude

CPPFILES = html.cpp htmlchain.cpp htmlclue.cpp htmldata.cpp htmlfont.cpp \
	htmliter.cpp htmltable.cpp htmltoken.cpp jscript.cpp htmlview.cpp \
	htmlframe.cpp htmlobj.cpp debug.cpp htmlform.cpp main.cpp http.cpp \
	http_.cpp

OTHERCPP = ../kdecore/kurl.cpp ../kdeui/kcursor.cpp fltk/qtimer.cpp \
	fltk/qobject.cpp fltk/qpainter.cpp fltk/qdrawutil.cpp \
	fltk/qfont.cpp fltk/qrect.cpp fltk/qregexp.cpp fltk/qstring.cpp \
	fltk/kcharsets.cpp fltk/qcolor.cpp fltk/qpixmap.cpp \
	fltk/qfontinfo.cpp fltk/qwidget.cpp fltk/history.cpp fltk/qscrollbar.cpp \
	fltk/nxslider.cpp fltk/nxscrollbar.cpp fltk/nxscroll.cpp

check-depends: 
	if [ ! -s .build_depends ]; then $(MAKE) -f build_depends.mk force-depends; fi

force-depends:
	@ echo "Generating dependancies for `pwd`..."
	@ echo "# Dependancy file for `pwd`" > .build_depends
	@ echo "# Automatically generated.  Do not edit." >> .build_depends
	$(CXX) -M $(INCLUDES) $(CXXFLAGS) $(CPPFILES) $(OTHERCPP) >> .build_depends

# End of file

--- NEW FILE: CHANGES ---
KHTMLW CHANGES
==============

Version 0.13.3  - 4 Jan 1999 (Martin Jones)
--------------

Added void KHTMLWidget::setForceDefault( bool force ) to allow a user
to force the use of their colours.


Version 0.13.3  - 17 Nov 1998 (Lars Knoll <knoll at mpi-hd.mpg.de>)
--------------

Fixed charset support for forms
Added methods for a better charset support in kfm
Changes are BINARY INCOMPATIBLE


Version 0.13.3  - 29 Oct 1998 (Lars Knoll <knoll at mpi-hd.mpg.de>)
--------------

khtmlw now uses kimgio. This gives the html widget automatic access
to all image formats kimgio can use.
Attention: all apps using the html widget will now also have to link
           against kimgio.

Version 0.13.3  - 26 Oct 1998 (Waldo Bastian)
-------------- 

Fixed bugs introduced in previous version. 
Fixed handling of non-breaking spaces.
Ready for KDE 1.1

Version 0.13.2  - 14 Oct 1998 (Waldo Bastian)
--------------

Efficiency improvement for text handling:
A paragraph of text is now put in a single HTMLTextMaster object which
spawns off HTMLTextSlave objects during layout for each line in the paragraph.
Text selection is now reasonable fast. 

Version 0.13.2  - 1 Oct 1998 (Waldo Bastian)
--------------

Automatically close dangling tag's. 

Version 0.13.1  - 26 Sep 1998 (Martin Jones)
--------------

Fixed redraw of background during selection.


Version 0.13.0  - 20 Sep 1998 (Martin Jones)
--------------

Added findText*() function.

Version 0.12.16 - 15 Jun 1998 (Torben Weis)
---------------

Fixed GIF detection code. If it is a give and only then we use
QMovie. We dont look at the filename any longer to figure this out.
This means that KFMs visual schnauzer can finally handle gif images.

Version 0.12.16 - 12 Jun 1998 (Torben Weis)
---------------

Added ALT + Left/Right/Up to the keyboard shortcuts.

Version 0.12.16 - 26 Apr 1998 (Lars Hoss)
---------------

Fixed QMovie bug in htmlobj.cpp. Now Visual Schnauzer
works fine.

Version 0.12.16 - 29 Mar 1998 (Martin)
---------------

Display and calc size of framesets when all frames have been defined.

Connect documentStarted & documentDone signals to toplevel view so that
  KFM knows when all frames are done.

Version 0.12.16 - 28 Mar 1998 (Martin)
---------------

Fixes for <textarea>

Version 0.12.16 - 26 Mar 1998 (Torben)
---------------

Middle mouse button can now do what the left one can. 
  This is needed for KFM.

Version 0.12.16 - 23 Mar 1998 (Jacek)
---------------

Fixed charset support bug, which made kmail crash when external reader
  window was to be open
  
Version 0.12.15 - 21 Mar 1998 (Torben)
---------------

KHTMLView now handles the x/y offsets in KHTMLView::begin(...) correct.
  Once the document is completely displayed it scrolls to the demanded
  position.
Added "slotScrollVert" and "slotScrollHorz" and renamed the protected
  slots of the same name to "slotInternScrollVert" and "slotInternScrollHorz"
  in KHTMLView.

Version 0.12.14 - 21 Mar 1998 (Martin)
---------------

Added <img oversrc=...> so that images could be overlaid on the icons in KFM.


Version 0.12.13 - 6 Mar 1998 (Martin)
---------------

Change rectangluar selection to support autoscrolling in kfm.
AutoScrolling fixes.


Version 0.12.12 - 1 Mar 1998 (Martin)
---------------

Change HTMLCell rectangle selection so that the cells are selected as
  a whole, i.e. in kfm text and icon are always selected together.
Use a less colour hungry way to show selected images.


Version 0.12.11 - 28 Feb. 1998 ( Jacek )
---------------

Fixed charset switching.
charsetConverter wasn't destroyed even when it wasn't needed any more.
It caused problems with kmail.

Version 0.12.11 - 19 Feb. 1998 ( Torben )
---------------

Allows navigation between cell with cursor keys.
This feature is used by KFM and depends on the <cell> tag.

Version 0.12.10 - 15 February 1998
---------------

Fixed crashes with images using USEMAP   (kb119)
Implemented MULTIPLE in <SELECT ...>     (kb140)
Implemented <INPUT TYPE=IMAGE ...>       (kb124)
Other fixes in form stuff.


Version 0.12.09 - 04 February 1998
---------------

Fix getTextSelection
encode \n in textarea


Version 0.12.08 - 16 January  1998
---------------

support <BASE ...>
tokenizer fixes


Version 0.12.07 - 29 December 1997
---------------

removed gif.*
misc fixes.


Version 0.12.06
---------------

Added cancelAllRequests()


Version 0.12.05
---------------

Fix <meta
Make HTMLClueFlow::calcSize() call setMaxWidth for each object in case aligned
 objects have changed the margins.
 

Version 0.12.04
---------------

Fix '
Support for other charsets from Jacek Konieczny <jajcus at zeus.polsl.gliwice.pl>


Version 0.12.03
---------------

Various fixes


Version 0.12.02
---------------

Fix bug with form elements in malformed tables.
Allow ' in tags, e.g. <img src='a.gif'>
Set scrollbar steps when begin() is called so that the scrollbar is correctly
 proportioned when the widget is first mapped.
Another review of where vspaces are inserted.
Allow HTMLClueFlow to break on object boundaries if a run of objects do
 not fit within the margins.
Number of columns in table is now set ONLY by the first line.
Tip from Arnt: use QPaintClever widget flag for KHTMLWidgets because it is
 a clever widget (it paints only in the update rect).  This reduces flicker
 when scrolling forms.
In <select>...</select> ignore \n when in <pre>...</pre>


Version 0.12.01 - Martin
------------------------

Bug fixes and optimisations from Norman Markgraf.
Allow spaces around an '=' in tags, e.g. <img src = "a.gif">


Version 0.12.00 - Martin
------------------------

Finally found the source of the slow-down.  Comparing QColor of fonts
 was not working, so new fonts were always created.  This also fixes
 one of the memory leaks.
Change tokenizer to use custom link list instead of QList, plus lots
 of other tokeniser fixes.
totalRows calculation in tables corrected and better handling of illegal
 html.
Allow empty <frame>.  Some people use this to space out the page.
Implement frameborder=0
Reimplement HTMLClueFlow to handle layout properly, i.e. don't break after
 tags ONLY on whitespace.
Implement <br clear=...
Tokeniser optimisations from Norman Markgraf and some more from me.
Added setUnderlineLinks( bool ).
Allow <table> ... </table> without any <td>, <tr>, <th>.
Delayed updates to prevent multiple updates causing flickering.
Added password form element from Henner Zeller <zeller at stud.fh-heilbronn.de>.
Discard repeated keys to prevent overrun when scrolling (from Alessandro
 Russo <alessandro.russo at ntt.it>).
Enabled QMovies and improved paintSingleObject for objects which need to be
 frequently updated (like HTMLImage).
Support for target=_top/_parent/_self/_blank
Allow <img src="a.gif"align=left>  i.e. don't mind if there is no space
 after a " in tags.
Killed some memory leaks - probably introduced new ones.
And LOTS of bug fixes.


Version 0.11.01 - Martin
-----------------------

More ampseqs including Greek characters, plus binary searching for ampseqs
 from Norman Markgraf <markgraf at hydra2.geol3.ruhr-uni-bochum.de>.
Implemented <font face=...>.
Ooops.  Even if you have setAutoDelete(true) for a stack, pop() does not
 delete the item. Must use remove().
Ignore additional </ul>, </ol>, </dir>, etc.
</a was being matched for </address.
Fixes for aligned clues.
Send documentChanged in KHTMLWidget::calcSize()
Initialize KHTMLWidget::url and KHTMLWidget::target to 0


Version 0.11.0 - Martin
-----------------------

Fixes for <blockquote>.
Fixes for <pre>.
More care with placement of vspaces.
Optimisations.


Version 0.10.1 - Martin
-----------------------

Changed <blockquote> so that it does not block and doesn't crash if a
</blockquote> is not supplied.
Improvements for forms.
More ampseq's from Norman Markgraf.
Fix scrolling with sb arrows.

Version 0.10.0 - Martin
-----------------------

Change the way <dl> <dt> <dd> is handled to be more like Netscape, and
less dependant on correct HTML.
Tokenizer fixes.


Version 0.9.1 - Martin
----------------------

Bug fixes


Version 0.8.12 - Martin  (actually 0.9.0)
-----------------------

Many changes to data structures to reduce memory usage.
More fixes for scrolling.


Version 0.8.11 - Martin
-----------------------

Recalc sizes and update when an image with unknown size is loaded.
Cleaner progressive updates.
Animated gifs with Qt 1.3
Top and Bottom borders.
Post paint events when scrolling instead of repaint() to make scrolling faster.
Fix scrollbars in HTMLView.


Version 0.8.10 - Martin
-----------------------

 Fix drawing of remotely loaded images.
 emit documentDone() fixed.


Version 0.8.9 - Martin
----------------------

 Add support for vlink color
  - overload: virtual bool URLVisited( const char *_url );
  and return true if the _url has been visited previously.
 Underline URLs.
 Image borders.
 Remove dependancy on '>' being found in tags so that ignored attributes are
  accepted, e.g. find "<dl", not "<dl>".


Version 0.8.8 - Martin
----------------------

 Added setDefaultBGColor( const QColor &col );
 Added setDefaultTextColors( const QColor &text, const QColor &link,
                             const QColor &vlink );


Version 0.8.7 - Martin
----------------------

 Fix font selection.
 Change requestImage to requestFile to be more general.
 Fix bug in tokeniser - segv with tokens > 1000 chars.
 Disallow slotAddLine etc. if scrollbars are not visible.
 Add type="i"|"I"|"a"|"A" to <ol type=...>.
 Support server side image maps.
 Add support to client side image maps for separate (remote) map files.
 Fix black frames bug.
 Add text selection support to KHTMLView.
 Improve text selection in <pre>...</pre> mode.


Version 0.8.6 - Martin
----------------------

 Client side image maps.  Only works for maps defined within the HTML, not
 separate files.  Haven't tested shape=poly or shape=circle yet.
 Separated Clues from Objects.  Clues now in htmlclue.[h|cpp]


Version 0.8.5 - Martin
----------------------

 Discard empty rows, e.g. <TR><TR>
 Do not require </td>, </th>, </tr>

 Do text selection in tables properly.


Version 0.8.4 - Martin
----------------------

 Tables of course.

 Fixed <hr>

 Added and improved documentation for KHTMLWidget.

 First work on text selection.  Works Ok, but still much work left.
   Connect to textSelected( bool ) to be notified when text has been
   (de)selected.
   Use getSelectedText( QString &_str ) to get the selected text.


Version 0.8.3 - Martin
----------------------

 Yet more work on tables.

 Bugfix from Stephan Kulow - another static object crept in
 (static QList<KHTMLView> viewList).  Changed to pointer and
 constructed on first occurrence.

 fixed <br> and <p align=...>


Version 0.8.2 - Martin
----------------------

 More work on tables - they seem to be working much better now.

 Changed the way lists are parsed so that <ul></ul> can indent text like
 Netscape.  Added indent property to HTMLClueFlow.

 Fixed tokenising of tags so that they can be broken by CR, e.g. this
 works now:
     <a
     href="http://www.kde.org">KDE</a>


Version 0.8.2a - Martin
-----------------------

 Minor changes to make this version compatable with the version in the
 stable libraries.

 Added #define KHTMLW_VERSION 820 in html.h


Version 0.8.1 - Martin
----------------------

 Fixed bug introduced in 0.7.9 affecting lists and glossarys.

 More fixes to tables.


Version 0.8.0 - Torben
----------------------

 Introduced JavaScript. Most code resides in the HTML Tokenizer
 You have to compile and install libjscript now before you
 can compile and use this library. No JavaScript code is executed
 until used for the first time.

 Introduced some few JavaScript event handlers in htmlform.cpp

 You need libjscript to use the widget

 Fixed frame layout problem. The frames are resized and shown only
 if we have scanned the complete frame set. All resize events before
 are ignored.


Version 0.7.9 - Martin
----------------------

 Added printing capability - just call HTMLView::print()
 There are still some unresolved printing issues:
  * should the background be printed?
  * should all text be printed black?
  * should highlighted text be printed highlighted?
  * some objects don't print properly - <hr>, table borders.
  * form controls don't print.
  * aligned images not handled by paginator.
  * printing does not release control to the event loop.
  * no way of cancelling printing.
  * do we want to print headers/footers?
  * Qt-1.2 has some printing problems which do not have work-arounds
    - who cares... wait for 1.3.
 A long list, but in general I think you should find printer output quite
 good.

 Modified table cell width calculation slightly to match Netscape more closely.

 Fix left/right alignment.

 Support for left/right alignment and centering of tables.

 Merge <td> and <th> parsing.

 Support table captions


Version 0.7.8 - Torben
----------------------

 Changed the <cell> tag, deleted the <grid> tag ( html.cpp )

 Fixed bug in selecting by rectangle ( html.cpp )


Version 0.7.7 - Martin
----------------------

 Fixes for tables and independant parsing/position stuff.


Version 0.7.6 - Martin
----------------------

 Separate parsing and size/position calculations.  Document should now be
 parsed only once.  HTMLWidget handles resizing without reparsing.

 General fix-ups in HTMLView scrollbars.


Version 0.7.4 - Torben
----------------------
 
 Moving the panner in a framed HTML page works now ( again )

 No black frames any more

 Loading of background pixmaps from the net works now.


Version 0.7.3 - Torben
----------------------

 <frame noresize frameborder=... marginwidth=...> works now
 
 <frameset noresize frameborder=... >, too.
 
 <frame marginheight=... scrolling=...> is recongnized but does not have
 any effect right now.

 Other bug fixes related to frames.

 You can select a KHTMLView by clicking on it. It will show a black border
 to indicate its state. 


Version 0.7.1 - Torben
----------------------

 Some bug fixes, more frame support.

 Applied patch from Stephan.


Version 0.7 - Torben
--------------------

 This version supports FRAMES! It is not perfect yet, but it seems
 to work. I did not change much in the rendering engine, but added
 some new classes. The most interesting one is KHTMLView.
 I recommend not to use KHTMLWidget directly any more since you
 dont get frames this way. KHTMLWidget cares about frames and comes
 with integrated scrollbars. The scrollbars appear/disappera as needed.
 This causes an ugly hack. I set the right border to 20 pixels. If we
 need a vertical scrollbar, then the scrollbar is just put on top
 op the KHTMLWidget. The horizontal scrollbar does not need this track.
 As a result the scrollbars can appear/disappear very fast. Changing
 the width of the HTML Widget would cause a new parsing session!!!!

 KHTMLView is a layer on KHTMLWidget. It has many comments in his
 header files. So using it is not too hard, I hope.
 It is perhaps a good Idea to subclass KHTMLView. KFM does it.

 New classes are HTMLFrameSet and HTMLFramePanner.

 You can select all URLs in a given rectangle now.

 The select( QPainter *_painter, ...) Functions accept a 0L
 as argument to _painter now.

 KHTMLView has duplicate signals. One tells that the widget itself
 ( not one of its frames ) wants to tell you something. Use these ones
 if you subclasses KHTMLView.
 The other signals tell you which widget emitted the signal. This
 way you dont have to care about the children of your widget.
 The parent widget informs you about its children and their demands.
 Use this way if you did not subclass KHTMLView.

 Design:
 -------
 For every <frameset> a HTMLFrameSet object is created. A HTMLFrameSet
 may contain other frame sets, a HTMLView ( or subclass ) or
 a HTMLFramePanner. On resize events the HTMLFrameSet recalculates
 the size of its children and resizes them.
 A bug right now is this one:
  The user moves the HTMLFramePanner arround and resizes now
  the window. The widget wont remember that the user changed the
  panner. I will fix this later on.
 Every <frame> tag becomes a KHTMLView instance. If you subclass
 KHTMLView, subclass the function:
  KHTMLView* newView(...)
 This function is asked to create a new frame. This way all children
 of KHTMLWidget are of your subclassed class, not only KHTMLView.

 This works like this:

 KHTMLView* MyKHTMLView::newView(...)
 {
   return new MyKHTMLView(...)
 }

 The user may select a frame by clicking on it. The active frame
 is highlighted with a black border.

 This version is for developers only. My changes seem to not affect
 the stability, but I did not test it too hard yet.

 DND
 ---

 Make shure that a picture called
 khtmlw_dnd.xpm is in $KDEDIR/lib/pics. This is the default pixmap used for DND.
 The widget can Drag and Drop every link.


Version 0.6 - Martin
--------------------

 Moved tokenizers to htmltoken.[h|cpp]
 Many changes to support progressive loading of the page. You can now do
  something like:
     begin();
	 parse();    // doing this here will make the widget parse and display as
	             // more html is added using write() (provided control is
				 // released to the event loop).
	 write();
	   :
	   :
	 write();
	 end();
 Added support for <li> without <ul></ul> because Netscape supports it.
 Change HTMLImage::pCache and pFontManager to be dynamically constructed
  so that khtmlw can be created as a shared lib on brain dead systems.
 Applied patches from Christian Czezatke to make more robust when poor
  (illegal) HTML is processed.
 General cleanups.
 Suppress space at the start of a paragraph (HTMLClueFlow)


Version 0.5.4 - Martin
----------------------

 Added align=left|right for images.
 Use gif.cpp with transparency (from Richard J. Moore).
 Fixed <center> and added <div>.
 More general HTML stuff implemented.
 Found bug painting most objects - were testing _y+height() < y-getHeight()
  and _y > y when should be < y-getAscent() and > y+getDescent().
 Added keyboard control - you must call setFocusPolicy() to enable focus.
 Another profiler session and some speedups.
 bgcolor for table cells.
 Fix <font size=?> stuff
 Accept bgcolor="XXXXXX" when it should be bgcolor="#XXXXXX"
 Implement align and valign in <tr>


Version 0.5.3 - Martin
----------------------

 Fixed horizontal scrolling while partially covered bug.
 Catch setPalette() so that global color changes don't screw up html page.
 Modified HTMLTokenizer so that it keeps space appended to the word
  preceding it.  This means that there are considerably (~35%) less objects
  in the parsed HTML - thats a lot less memory and processing in a large
  document.  I have yet to see a situation where this has caused poor
  formatting.
 Fixed <pre> so that inline markups don't cause lines to be broken.


Version 0.5.2 - Martin
----------------------

 Spent some quality time with the profiler - now at least twice as fast
  for large HTML documents (qwidget.html is a good test).
 setStandardFont() and setFixedFont() added.


Version 0.5.1 - Martin
----------------------

 Forms implemented, though not complete.
 Fixed bug which caused segv when </ul>, </dl>, etc. was omitted
 

Version 0.5.0 - Torben
----------------------

 Changes to the handling of baseURL and changes in the <grid> tag


Version 0.4.9 - Martin
----------------------

 Changes to background parsing stuff
 minor bug fixes


Version 0.4.7 - Torben
----------------------

 Added supportz for delayed loading of images. The widget emits the signal
 'imageRequest' to tell its owner that it needs data from the net. The widget
 does NOT load the stuff.
 The owner must signal the widget if the images arrived. The widget will
 display the image if the <img width=.. height=... > was given. If width or
 height is missing the widget weits until all images arrived and parses the
 HTML code again. There are several new functions/slots/signals dealing with
 this. 

 KFM implements a cache class that caches images and HTML pages. The widget
 may expect that images arrive before the 'emit imageRequest' call returns.
 In this case the image was already in the cache. This is the best case since
 parsing continous like usual in this case. This means you can call the slot
 'slotImageLoaded' of the widget if you get the signal 'imageRequest'. Wait
 for kfm-0.5.3 to see how this works.

 Added 2 parameters to begin. They allow the owner to tell the widget about the
 position of the upper left corner. If KFM deletes files I don't want to see
 the top of the HTML page after updating the display. Thats what this is for.


Version 0.4.5 - Martin
----------------------

 Bug (see above) fixed and printfs removed

 Tables (how much fun do you think this was?)

 minor bug fixes, and more mark-ups implemented.

 Added onURL() signal which is emitted as links are passed over.
 Added setURLCursor() to set the cursor to use when cursor in on a URL.


Version 0.41 - Torben
---------------------

 Inserted some debug code. Left it there to find bug in kdehelp. Sometimes Qt
 complains about painter.begin() and painter.end() problems. Delete the printf
 stuff if the debug thing is no longer needed.

 Changed the 'getSelected' function. It uses QStrList to transmit multiple
 URLs instead of space separated solution.

 Some minor bug fixes.


Version 0.4 - Martin
--------------------

 HTML is now parsed in the background.  You should connect documentChanged()
 to a function that updates scroll bars.  THERE IS NO NEED TO CALL REPAINT()
 ANYMORE unless you explicitly wish to force a repaint.

 The default background color is now lightGray.  Use <body bgcolor=#XXXXXX>
 to set the background color.  Background pixmap implemented.

 setDefaultFontBase() sets the default font size.

 Reorganised parser and split into more files.  Compiles as a library.

 Added basic support for lists, glossaries, <hr> and lots more.

 Horizontal Scrolling.


Version 0.3a - Torben
---------------------

 The event handling changed a little bit.
 
 Support for drag and drop.

 Some bugs fixed

 Needs libkde-0.52 or greater right now. Uses KURL.

 For an example of how to use the widget see kfm-0.42 or greater 
 or kdehelp ( a version greate than 0.3 ).

 You may ( but you must not ) set -DHAVE_LIBGIF and -DHAVE_JPEG to include
 support for such images formats.


Version 0.2a - Torben
---------------------

 I implemented <a name="#anchor">. Since the widget may scroll automatically
 if the user selects an anchor, you must connect the signals

  scrollVert();
  scrollHorz();

  Example implementation:
	void MyHTMLParentWidget::slotScrollVert( int _y )
	{
	    vert->setValue( _y );
	}


 When the user presses the mouse button over an URL, the signal
 URLSelected is emitted. See the header files for details and
 documentation. When the URL transmitted by this signal is only
 an anchor in the actual document, use only 'gotoAnchor' to
 view the anchor ( anchor <=> <a name="Intro"> ).
 MARTIN: Some of your code has made its way in the widget, for
 example the URLSelected signal. You dont need your own HTML
 class any more I think.

 When loading a new HTML URL with a ref., you must use
 gotoAnchor( ref ), to display the referenced section.
 For example for the URL file:/home/html/test.html#myref
 should cause a call like
 
	gotoAnchor( "myref" );

 To avoid flickering between loading a new file and scrolling
 to the anchor, you can use code like this:

	QString ref="";

	... set 'ref' to whatever ...

	view->parse();
	if ( view->docHeight() > view->height() )
		vert->setRange( 0, view->docHeight() - view->height() );
	else
		vert->setRange( 0, 0 );
	
	if ( ref.data()[0] != 0 )
	{
	    if ( !view->gotoAnchor( ref.data() ) )
		vert->setValue( 0 );
	}
	else
	    vert->setValue( 0 );
	view->repaint();

 The above is interesting for "file:/usr/local/doc/text.html#Intro" for
 example.

 Support for JPEG/Gif has been added by Josip.

 Works with quoted hrefs now.

 The widgets supports drags. Every <a href...> can be dragged. To override
 this behavior, you must overload
	
	dndMouseMoveEvent( QMouseEvent * );

 Dont forget to change the definition of KHTMLW_PICS_PATH in html.h. This path
 references an icon that is used for drags.
 Only complete URLs can be dragged. For example <a href="classes.html"> will
 lead into problems because the data of the drag is "classes.html" which does
 not mean very much. When KURL is completed, the HTMLWidget will complete the
 URL itself.  Until then you must live with this bug, sorry :-(


--- NEW FILE: README.HTMLWidget ---
KDE HTML Widget
===============

Developers
----------

The first version was written by

Torben Weis <weis at stud.uni-frankfurt.de>

It was extended by

Josip A. Gracin <grac at fly.cc.fer.hr>

and

Martin Jones <mjones at kde.org>


It is currently primarily maintained and developed by Martin Jones.


Libraries Required
------------------

libkde-devel


Starting Point
--------------

You can add the widget to your program by doing something like:

#include <html.h>

   .
   .
   .

    KHTMLWidget *view = new KHTMLWidget( parent, "Name" );
	view->show();

	view->begin( "file:/tmp/test.html" );
	view->parse();
	view->write( "<HTML><TITLE>...." );
	view->write( "..." );
	    .
		.
		.
	view->write( "</HTML>" );
	view->end();


After doing this, control must be returned to the event loop as the HTML
is parsed in the background using a Qt timer.

For more information see the full documentation in JavaDoc format included
in the header files.



--- NEW FILE: bookmark.cpp ---
/*******************************************************************************\
**
**	File:	bookmark.cpp
**	Desc:	Adds definition to the methods within the bookmark class object
**	
\*******************************************************************************/

// System header files
#include <cstdio>


// Local header files
#include <FL/Fl_Menu_Item.H>
#include "bookmark.h"


////////////////////////////////////////////////////////////////////////////////
//
//	Public member functions
//
////////////////////////////////////////////////////////////////////////////////

/*******************************************************************************\
**
**	Function:	BookMark()
**	Desc:		Default constructor for the BookMark class.  Handles the initialization
**				of class members.
**	Accepts:	int mxelem = Maximum number of elements to allow (0 = no limit).
**				char *tpath = The path to the bookmark file
**
\*******************************************************************************/
BookMark::BookMark(int mxelem, char *tpath) :
	m_nelem(0),													// Initialize to 0
	m_maxelem(mxelem),											// Initialize to mxelem
	m_txtfile(tpath)											// Set the text path file
{
	// Default initialization for class BookMark
	m_mb = NULL;

	// Initialize the vector
	ReadDataFile();

} // end of BookMark() -- constructor

/*******************************************************************************\
**
**	Function:	~BookMark()
**	Desc:		Destructor for the BookMark class.  Updates any file with current
**				bookmark data, and handles proper clean up
**	
\*******************************************************************************/
BookMark::~BookMark()
{
	// Update the bookmark file with current contents of vector
	UpdateTxtFile();

	// Clear out the vector
	m_bmv_srt.clear();
	
	// Delete any dynamically allocated memory
	delete m_mb;
} // end of ~BookMark() -- destructor

/*******************************************************************************\
**
**	Function:	int BookMark::AddBookmark()
**	Desc:		Adds a Name/URL pair to the vector (if there is room)
**	Accepts:	char *name = Name of the URL page
**				char *URL = URL of the page
**	Returns:	int; 0 on success, -1 on error
**
\*******************************************************************************/
int
BookMark::AddBookmark(char *name, char *URL)
{
	int					idx,										// Index to insert
						namedup = 0;								// Set if name was dup'd
	bookmark_t			bmData;										// Bookmark data

	
	// Only add if there we haven't reached any imposed limit
	if (m_maxelem > 0 && m_nelem + 1 > m_maxelem)
		return (-1);

	// Validate incoming data
	if (URL == NULL || *URL == 0)
		return (-1);
	if (name == NULL || *name == 0)
	{
		name = strdup(URL);
		namedup = 1;
	} // end of if 

	// Strip out all invalid name character (as defined by fltk's menu rules)
	bmData.pgName = fltkmStrParse(name);					// Possible memory leak???
	bmData.pgURL = URL;

	if (namedup)
		free(name);

	// Find where to insert it
	if ( (idx = findVElem(&bmData)) >= 0)
	{
		// Already in the list
		return (-1);
	} // end of if 

	idx *= -1;
	idx--;
	m_bmv_srt.insert(&m_bmv_srt[idx], bmData);
	m_nelem = m_bmv_srt.size();

	// Decide if updates are to be set...
	if (m_mb)
	{
		UpdateMenus();
		UpdateTxtFile();
	} // end of m_mb

	return (0);
} // end of AddBookmark()

/*******************************************************************************\
**
**	Function:	void BookMark::DelBookmark()
**	Desc:		Deletes the bookmark entry at the specified index
**	Accepts:	int idx = The index of the bookmark to delete
**	Returns:	Nothing (void)
**
\*******************************************************************************/
void
BookMark::DelBookmark(int idx)
{
	// Validate the request
	if (!m_nelem)
		return;

	if (idx < 0 || idx >= m_nelem)
		return;

	m_bmv_srt.erase(&m_bmv_srt[idx]);
	m_nelem = m_bmv_srt.size();

	if (m_mb)
	{
		UpdateMenus();
		UpdateTxtFile();
	} // end of if

	return;
} // end of DelBookmark

/*******************************************************************************\
**
**	Function:	char *BookMark::GetURL()
**	Desc:		Returns the URL of the bookmark stored at index idx
**	Accepts:	int idx = The index of the bookmark to return
**	Returns:	char *; The URL value of the bookmark_t bookmark entry
**
\*******************************************************************************/
char *
BookMark::GetURL(int idx)
{
	if (idx >= 0 && idx < m_nelem)
		return ((char *)m_bmv_srt[idx].pgURL.c_str());
	else
		return ((char *)0);
} // end of BookMark::GetURL()

////////////////////////////////////////////////////////////////////////////////
//
//	Private/Protected memober functions
//
////////////////////////////////////////////////////////////////////////////////

/*******************************************************************************\
**
**	Function:	int BookMark::findVElem()
**	Desc:		Does a binary search on the elements in the vector looking for
**				the name (to see if it already exists) and returns the index into
**				the vector, otherwise it returns the location of where it should
**				be inserted (see below)
**	Accepts:	bookmark_t *ptr = Ptr to the bookmark_t elem to find
**	Returns:	>= 0 the index of the found item, < 0 the index of where it should
**				be inserted, using the following algorithm:
**					abs(idx) - 1;
**
\*******************************************************************************/
int
BookMark::findVElem(bookmark_t *bmptr)
{
	int					found = -1,									// Flag to indicate a found status
						hi,											// Hi limit
						lo,											// Lo limit
						mid,										// Middle ground
						rc;											// Result code

	// Set the initial limit values
	lo = 0;
	hi = m_nelem - 1;

	// See if something is in the vector
	if (m_nelem <= 0)
		return ( (lo + 1) * -1);

	// Check the initial lo point
	if ( (rc = m_bmv_srt[lo].pgName.compare(bmptr->pgName)) == 0)
		return (lo);
	else if (rc > 0)
		return ((lo + 1) * -1);

	// Check the initial hi point
	if ( (rc = m_bmv_srt[hi].pgName.compare(bmptr->pgName)) == 0)
		return (hi);
	else if (rc < 0)
		return ( (hi + 1 + 1) * -1);

	// Do the binary search.
	while (found < 0 && lo <= hi)
	{
		mid = ((lo + hi) / 2);
		if ( (rc = m_bmv_srt[mid].pgName.compare(bmptr->pgName)) == 0)
			found = mid;
		else if (rc > 0)
			hi = mid - 1;
		else
			lo = mid + 1;
	} // end of while

	if (found >= 0)
		return (found);
	else
		return ( (lo + 1) * -1);

} // end of BookMark::findVElem() 

/*******************************************************************************\
**
**	Function:	char *BookMark::fltkmStrParse()
**	Desc:		Scans through the string and converts the following special
**				characters to spaces:
**				',' == Field delimiter within the bookmark text file
**				'|' == Fltk menu char
**				'\' == Fltk menu char
**				'/' == Fltk menu char
**	Accepts:	char *str = string to parse
**	Returns:	char *ptr to the converted string
**
\*******************************************************************************/
char *
BookMark::fltkmStrParse(char *str)
{
	char 					*cp;									// Character pointer

	for (cp = str; *cp; cp++)
	{
		if (*cp == ',' || *cp == '/' || 
			*cp == '|' || *cp == '\\')
		{
			*cp = ' ';
		} // end of if
	} // end of for 

	return (str);
} // end of BookMark::fltkmStrParse()

/*******************************************************************************\
**
**	Function:	void BookMark::ReadDataFile()
**	Desc:		Reads the data stored in m_txtfile and populates the vector with
**				the dat from the text file
**				Text File layout is:
**				Page Name,Page URL
**	Accepts:	Nothing (void)
**	Returns:	Nothing (void)
**
\*******************************************************************************/
void
BookMark::ReadDataFile(void)
{
	char				*cpName,									// Ptr to the name field
						*cpURL,										// Ptr to the URL
						txtbuf[256];								// Should I use a string???
	int					addcnt = 0;									// Number added successfully
	FILE				*fpBm;										// File pointer to bookmark data

	// open the file for reading
	if ( (fpBm = fopen(m_txtfile.c_str(), "r")) == NULL)
		return;

	// Clear out the vector (since its going to be repopulated)
	m_bmv_srt.clear();

	while (fgets(txtbuf, sizeof(txtbuf), fpBm))
	{
		if (m_maxelem && addcnt + 1 >= m_maxelem)
			break;

		if ( (cpURL = strchr(txtbuf, ',')) == NULL)
		{
			fprintf(stderr, "Invalid bookmark entry %s\n", txtbuf);
			continue;
		} // end of if
		*cpURL = '\0';
		cpURL++;
		if (cpURL[strlen(cpURL) - 1] == '\n')
			cpURL[strlen(cpURL) - 1] = '\0';
		cpName = txtbuf;

		if (AddBookmark(cpName, cpURL))
			++addcnt;
	} // end of while

	fclose(fpBm);
	return;
} // end of BookMark::ReadDataFile()

/*******************************************************************************\
**
**	Function:	void BookMark::UpdateMenus()
**	Desc:		Dynamically updates the Fl_Menu_Button menu list with the data
**				that is in the bookmark vector
**	Accepts:	Nothing (void)
**	Returns:	Nothing (void)
**
\*******************************************************************************/
void
BookMark::UpdateMenus(void)
{
	char				menuTitleBuf[64] = {0};						// Buffer for the title
	int					ii;											// Loop iterator
	const int			MAX_MENU_LEN = 32;							// Maximum menu length
	Fl_Menu_Item		baseMenus[] = 
		{
			{"&Add Bookmark", FL_ALT + 'a', AddBookmark_cb},
			{"&Delete Bookmark", FL_ALT + 'd', 0, 0, FL_SUBMENU | (m_nelem ? 0 : FL_MENU_INACTIVE)},
				{0},
			{"&Select Bookmark", FL_ALT + 's', 0, 0, FL_SUBMENU | (m_nelem ? 0 : FL_MENU_INACTIVE)},
				{0},
			{0}
		},															// Default menu list
						*curMenuList;								// Current Menu list

	// Replace the menu....(as a private copy)
	m_mb->copy(baseMenus);
//	curMenuList = m_mb->menu();
	for (ii = 0; ii < m_nelem; ii++)
	{
		int len = sprintf(menuTitleBuf, "&Delete Bookmark/");
		strncpy(menuTitleBuf + len, m_bmv_srt[ii].pgName.c_str(), MAX_MENU_LEN);
		m_mb->add(menuTitleBuf,0, DelBookmark_cb, (void *)ii);
		len = sprintf(menuTitleBuf, "&Select Bookmark/");
		strncpy(menuTitleBuf + len, m_bmv_srt[ii].pgName.c_str(), MAX_MENU_LEN);
		m_mb->add(menuTitleBuf, 0, SelBookmark_cb, (void *)ii);
	} // end of for

	return;
} // end of UpdateMenus()

/*******************************************************************************\
**
**	Function:	void BookMark::UpdateTxtFile()
**	Desc:		Updates the bookmark textfile with the data that is in the bookmark
**				vector
**	Accepts:	Nothing (void)
**	Returns:	Nothing (void)
**
\*******************************************************************************/
void
BookMark::UpdateTxtFile(void)
{
	FILE				*fpBm;										// Bookmark file pointer

	if ( (fpBm = fopen(m_txtfile.c_str(), "w")) == NULL)
		return;

	for (int ii = 0; ii < m_nelem; ii++)
		fprintf(fpBm, "%s,%s\n", m_bmv_srt[ii].pgName.c_str(),
				m_bmv_srt[ii].pgURL.c_str());

	fclose(fpBm);

	return;
} // end of BookMark::UpdateTxtFile()


--- NEW FILE: vmlapp.h ---
#ifndef __VMLAPP_H
#define __VMLAPP_H

#include <Fl_Input.H>
#ifdef USING_FLEK_LIB
#include <Flve_Combo.H>
#include <Fl_Animator.H>
#endif
#include <Fl_Button.H>
#include "http.h"
#include "html.h"

class VMLAppWindow;

extern VMLAppWindow * g_AppWindow;

extern int g_AppWidth;
extern int g_AppHeight;
#ifdef USING_FLEK_LIB
extern Fl_Animator *g_Logo;
extern Flve_Combo	*g_URL;
#else
extern Fl_Button * g_Logo;
extern Fl_Input * g_URL;
#endif
extern HTML_WIDGET * g_HTML;

// some defines for width/height calculations

#define APPWIDTH (g_AppWidth)
#define APPHEIGHT (g_AppHeight)

#define TITLEHEIGHT 30

#define SCROLLWIDTH 0
#define SCROLLHEIGHT 0
#define SCROLLPAD 0

#define WIDTH (APPWIDTH - SCROLLWIDTH - SCROLLPAD - SCROLLPAD - SCROLLPAD)
#define HEIGHT (APPHEIGHT - TITLEHEIGHT - SCROLLHEIGHT - SCROLLPAD - SCROLLPAD)

// The following define is necessary because we are missing the current copy
// of FLNX from CVS. The Fl_Window_Resize has special callbacks from flnx
// to handle external window resizes and then provide those to the application.
// Undefine the following to use just the standard Fl_Window


#define HAVE_RESIZE_WINDOW 0

//#ifdef HAVE_RESIZE_WINDOW
#if 0
  #include <Fl_Window_Resize.H>
  #define PARENT_WINDOW Fl_Window_Resize
#else
  #include <Fl_Window.H>
  #define PARENT_WINDOW Fl_Window
#endif

class VMLAppWindow : public PARENT_WINDOW
{
public:
  VMLAppWindow(int x, int y, int w, int h) : PARENT_WINDOW(x,y,w,h,"ViewML Browser") { }
#ifdef HAVE_RESIZE_WINDOW
  virtual void resize_notify(int x, int y, int w, int h);
#endif
  virtual int handle(int event);
};

#endif


--- NEW FILE: bookmark.xpm ---
/* XPM */
static char * bookmark_xpm[] = {
"20 20 40 1",
".	c None",
"+	c #333333",
"@	c #DDDDDD",
"#	c #EAF2FB",
"$	c #F5F9FD",
"%	c #E5EFFA",
"&	c #D5E6F7",
"*	c #C6DDF4",
"=	c #CBE0F5",
"-	c #BAD6F1",
";	c #AFCFEF",
">	c #A2A2A2",
",	c #DBE9F8",
"'	c #A5C9ED",
")	c #9CC4EB",
"!	c #B5D3F0",
"~	c #95BFEA",
"{	c #85B6E7",
"]	c #F0F6FC",
"^	c #E0ECF9",
"/	c #8CBAE8",
"(	c #6BA6E1",
"_	c #5A9CDE",
":	c #75ACE3",
"<	c #5599DD",
"[	c #428CDE",
"}	c #B1D0EF",
"|	c #5096DC",
"1	c #408CD9",
"2	c #3083D6",
"3	c #4B93DB",
"4	c #2B80D5",
"5	c #1673D0",
"6	c #3787D7",
"7	c #076ACD",
"8	c #61A0DF",
"9	c #0066CC",
"0	c #3C8AD8",
"a	c #1973D6",
"b	c #277DD4",
"......++++++........",
".....+@@@@@@++++ at ...",
"..+++++++....+ at .+@..",
".+......#+...+ at .+@..",
"+....+$%&*+...+..+ at .",
"+...+++=-;+>..+..+ at .",
"+...#,=-')+>@..+ at .+@",
"+.$%&*!'~{+>@..+ at .+@",
"+]^++++/{(+>@..+ at .+@",
"+,=+;)/+(_+>@..+ at .+@",
"+*!+~{:+<[+>@.++ at +@@",
"+}'++++|12+>@.+@@+..",
"+)/+(_3+45+>@.+..+..",
"+{:+<36+57+>@....+..",
"+:8+++++99+>@.......",
"+_304a7999+>@.......",
"+36b579999+>@.......",
"+++++++++++>@.......",
".>>>>>>>>>>>@.......",
"..@@@@@@@@@@@......."};

--- NEW FILE: htmliter.cpp ---
/* This file is part of the KDE libraries
    Copyright (C) 1998 Martin Jones (mjones at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include "htmlobj.h"
#include "htmlclue.h"
#include "htmltable.h"
#include "htmliter.h"

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

HTMLListIterator::HTMLListIterator( HTMLClue *c )
{
    clue = c;
    curr = clue->children();
    iter = 0;

    if ( curr )
	iter = curr->getIterator();
}

HTMLObject *HTMLListIterator::current()
{
    // if we have a child iterator then returns its current object
    if ( iter )
	return iter->current();

    return curr;
}

bool HTMLListIterator::next()
{
    if ( !curr )
	return false;

    if ( iter )
    {
	// tell the child iterator to move to the next object
	if ( iter->next() == false )
	{
	    delete iter;
	    iter = 0;
	}
	else
	{
	    return true;
	}
    }

    // move to the next object, skipping over empty child iterators.
    do
    {
	curr = curr->next();
	if ( curr )
	    iter = curr->getIterator();
    }
    while ( curr && iter && iter->current() == 0 );

    return ( curr != 0 );
}

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

HTMLTableIterator::HTMLTableIterator( HTMLTable *t )
{
    row = 0;
    col = 0;
    curr = 0;
    table = t;
    iter = 0;

    // move to the next object, skipping over empty child iterators.
    do
    {
	curr = nextCell();
	if ( curr )
	    iter = curr->getIterator();
    }
    while ( curr && iter && iter->current() == 0 );
}

HTMLObject *HTMLTableIterator::current()
{
    if ( iter )
	return iter->current();

    return curr;
}

bool HTMLTableIterator::next()
{
    if ( !curr )
	return false;

    if ( iter )
    {
	if ( iter->next() == false )
	{
	    delete iter;
	    iter = 0;
	}
	else
	{
	    return true;
	}
    }

    do
    {
	curr = nextCell();
	if ( curr )
	    iter = curr->getIterator();
    }
    while ( curr && iter && iter->current() == 0 );

    return ( curr != 0 );
}

HTMLObject *HTMLTableIterator::nextCell()
{
    // If this is not the first time that nextCell has been called then
    // increment the column.
    if ( row != 0 || col != 0 || curr != 0 )
    {
	col++;
    }

    // find the next non-null cell
    while ( row < table->rows() )
    {
	for ( ; col < table->cols(); col++ )
	{
	    if ( ( curr = table->cell( row, col ) ) == 0 )
		continue;
	    if ( col < table->cols() - 1 && curr == table->cell( row, col+1 ) )
		continue;
	    if ( row < table->rows() - 1 && curr == table->cell( row+1, col ) )
		continue;
	    if ( curr )
		return curr;
	}
	row++;
	col = 0;
    }

    return 0;
}



--- NEW FILE: htmlobj.h ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
//-----------------------------------------------------------------------------
//
// KDE HTML Widget

#ifndef HTMLOBJ_H
#define HTMLOBJ_H

#include <stdio.h>

#include <qpainter.h>
#include <qlist.h>
#include <qdict.h>
#include <qstrlist.h>
#include <qarray.h>
#include <qpixmap.h>
#include <qstack.h>
#include <qfont.h>
#include <qtimer.h>

class QMovie;

#define USE_QMOVIE

#include <kurl.h>

class HTMLClueV;
class HTMLImage;
class HTMLClue;
class HTMLClueFlow;
class HTMLClueAligned;
class HTMLChain;
class HTMLIterator;
class KHTMLWidget;

#include "htmlfont.h"

class HTMLCell;

/**
 * Used by @ref HTMLObject::findCells
 */
struct HTMLCellInfo
{
public:
  HTMLCell *pCell;
  int xAbs;
  int baseAbs;
  int tx;
  int ty;
};

class HTMLAnchor;

typedef enum { HTMLNoFit, HTMLPartialFit, HTMLCompleteFit } HTMLFitType;

//-----------------------------------------------------------------------------
// HTMLObject is the base class for all HTML objects.
//
class HTMLObject
{
public:
    HTMLObject();
    virtual ~HTMLObject() { objCount--; }

    enum VAlign { Top, Bottom, VCenter, VNone };
    enum HAlign { Left, HCenter, Right, HNone };

    /*
     * This function should cause the HTMLObject to calculate its
     * width and height.
     */
    virtual void calcSize( HTMLClue * = 0L ) { }

    /*
     * This function should cause the HTMLObject to break itself up so 
     * that it will fit within the given length. Only usefull for text.
     * If 'startOfLine' is 'false', this function may return 'HTMLNoFit' to 
     * indicate it is not possible to use the specified 'widthLeft'.
     */
    virtual HTMLFitType fitLine( bool startOfLine, 
    							 bool firstRun, 
    							 int widthLeft ) 
    { return HTMLCompleteFit; }
    
    /*
     * This function forces a size calculation for objects which
     * calculate their size at construction.  This is useful if
     * the metrics of the painter change, e.g. if the html is to
     * be printed on a printer instead of the display.
     */
    virtual void recalcBaseSize( QPainter * ) { }

    /*
     * This function calculates the minimum width that the object
     * can be set to. (added for table support)
     */
    virtual int  calcMinWidth() { return width; }

    /*
     * This function calculates the width that the object would like
     * to be. (added for table support)
     */
    virtual int  calcPreferredWidth() { return width; }

    virtual void setMaxAscent( int ) { }
    virtual void setMaxDescent( int ) { }
    virtual void setMaxWidth( int _w ) { max_width = _w; }
    virtual int  findPageBreak( int _y );

    /*
     * Print the object but only if it fits in the rectangle given
     * by _x,_y,_width,_ascender. (_x|_y) is the lower left corner relative
     * to the parent of this object ( usually HTMLClue ).
     */
    virtual bool print( QPainter *, int, int, int, int, int, int, bool )
	{ return false; }

    virtual void print( QPainter *, HTMLObject *, int, int, int, int, int, int )
	{}

    virtual void print( QPainter *_p, HTMLChain *, int _x, int _y, int _w,
	    int _h, int _tx, int _ty)
	{ print( _p, _x, _y, _w, _h, _tx, _ty, false ); }
    /*
     * Print the object.
     */
    virtual void print( QPainter *, int, int ) { }

    virtual HTMLObject *checkPoint( int, int );
    virtual HTMLObject *mouseEvent( int, int, int, int ) { return 0; }
    virtual void selectByURL(KHTMLWidget *, HTMLChain *, const char *, bool,
	int _tx, int _ty);
    virtual void select( KHTMLWidget *, HTMLChain *, bool, int _tx, int _ty );

    /*
     * Selects the object if it is inside the rectangle and deselects it
     * otherwise.
     */
    virtual void select( KHTMLWidget *, HTMLChain *, QRect &_rect, int _tx,
	int _ty );

    // Select all objects matching the regular expression.
    virtual void select( KHTMLWidget *, HTMLChain *, QRegExp& _pattern,
	bool _select, int _tx, int _ty );

    virtual void select( bool _s ) { setSelected( _s ); }

    // select text.  returns whether any text was selected.
    virtual bool selectText( KHTMLWidget *_htmlw, HTMLChain *_chain, int _x1,
	int _y1, int _x2, int _y2, int _tx, int _ty );

    virtual void getSelected( QStrList & );
    virtual void getSelectedText( QString & ) {}

    /*
     * Some objects may need to know their absolute position on the page.
     */
    virtual void calcAbsolutePos( int, int ) { }

    virtual int  getAbsX() { return -1; }
    virtual int  getAbsY() { return -1; }

    /*
     * returns the postion on the page of the specified object
     */
    virtual bool getObjectPosition( const HTMLObject *obj, int &x, int &y );

    virtual void reset() { setPrinted( false ); }

    /********************************
     * These two functions are overloaded by objects that need to have a remote
     * file downloaded, e.g. HTMLImage.
     *
     * fileLoaded is called when the requested file has arrived.
     */
    virtual void fileLoaded( const char * /* _filename */ ) { }
    virtual bool fileLoaded( const char* /* _url */, QBuffer& /* _buffer */ ) { return false; }

    /*
     * returns the url of the file that has been requested.
     */
    virtual const char *requestedFile() { return 0; }

    enum ObjectType { Object, Clue };

    /*
     * sometimes a clue would like to know if an object is a 
     * clue or a basic object.
     */
    virtual ObjectType getObjectType() const
	    {	return Object; }

    /*
     * Get X-Position of this object relative to its parent
     */
    int getXPos() const { return x; }

    /*
     * Get Y-Position of this object relative to its parent
     */
    int getYPos() const { return y; }

    int getWidth() const { return width; }
    int getHeight() const { return ascent+descent; }
    int getAscent() const { return ascent; }
    int getDescent() const { return descent; }
    int getMaxWidth() const { return max_width; }
    int getPercent() const { return percent; }

    /*
     * return the URL associated with this object if available, else 0.
     */
    virtual const char* getURL() const { return 0; }
    virtual const char* getTarget() const { return 0; }
#ifdef EXEC_EXTENSIONS
    virtual const char* getExec() const { return 0; }
#endif

    void setPos( int _x, int _y ) { y=_y; x=_x; }
    void setXPos( int _x ) { x=_x; }
    void setYPos( int _y ) { y=_y; }

    enum ObjectFlags { Separator = 0x01, NewLine = 0x02, Selected = 0x04,
			AllSelected = 0x08, FixedWidth = 0x10, Aligned = 0x20,
			Printed = 0x40, Hidden = 0x80};

    bool isSeparator() const { return flags & Separator; }
    bool isNewline() const { return flags & NewLine; }
    bool isSelected() const { return flags & Selected; }
    bool isAllSelected() const { return flags & AllSelected; }
    bool isFixedWidth() const { return flags & FixedWidth; }
    bool isAligned() const { return flags & Aligned; }
    bool isPrinted() const { return flags & Printed; }
    bool isHidden() const { return flags & Hidden; }
    virtual bool isSlave() const { return 0; }
    
    void setSeparator( bool s ) { s ? flags|=Separator : flags&=~Separator; }
    void setNewline( bool n ) { n ? flags|=NewLine : flags&=~NewLine; }
    void setSelected( bool s ) { s ? flags|=Selected : flags&=~Selected; }
    void setAllSelected( bool s ) { s ? flags|=AllSelected : flags&=~AllSelected; }
    void setFixedWidth( bool f ) { f ? flags|=FixedWidth : flags&=~FixedWidth; }
    void setAligned( bool a ) { a ? flags|=Aligned : flags&=~Aligned; }
    void setPrinted( bool p ) { p ? flags|=Printed : flags&=~Printed; }
    void setHidden( bool p ) { p ? flags|=Hidden : flags&=~Hidden; }
    
    /*
     * Searches in all children ( and tests itself ) for an HTMLAnchor object
     * with the name '_name'. Returns 0L if the anchor could not be found.
     * '_point' is modified so that it holds the position of the anchor relative
     * to the parent.
     */
    virtual HTMLAnchor* findAnchor( const char */*_name*/, QPoint */*_point*/ )
			{ return 0L; }

    /*
     * All objects can be an element in a list and maintain a pointer to
     * the next object.
     */
    void setNext( HTMLObject *n ) { nextObj = n; }
    HTMLObject *next() const { return nextObj; }

    void printCount() { printf( "Object count: %d\n", objCount ); }

    virtual void findCells( int, int, QList<HTMLCellInfo> & ) { }

    /*
     * Create an iterator.
     * The returned iterator must be deleted by the caller.
     */
    virtual HTMLIterator *getIterator() { return 0; }

    /*
     * Select this object's text if it matches.
     * returns true if a match was found.
     */
    virtual bool selectText( const QRegExp & ) { return false; }

    /*
     * used by HTMLImage
     */
    virtual void setBgColor( QColor ) { };

protected:
    int x;
    int y;
    int ascent;
    int descent;
    short width;
    short max_width;
    // percent stuff added for table support
    short percent;	// width = max_width * percent / 100
    unsigned char flags;
    HTMLObject *nextObj;
    static int objCount;
};

//-----------------------------------------------------------------------------
// There are several text-related objects:
//
// HTMLHSpace: A horizontal space
// HTMLVSpace: A vertical space, e.g. linefeed
// HTMLText: A non-breakable text object
// HTMLTextMaster: A breakable text-object
// HTMLLinkText: A non-breakable hyperlinked text object
// HTMLLinkTextMaster: A breakable hyperlinked text object
//
// Use:
//    HTMLHSpace is equivalent to HTMLText(" ", ...) but slightly smaller
//               in memory usage
//    HTMLVSpace is used for a forced line-break (e.g. linefeed)
//    HTMLText is used for text which shouldn't be broken. 
//    HTMLTextMaster is used for text which may be broken on spaces,
//               it should only be used inside HTMLClueFlow.
//               For text without spaces HTMLTextMaster is equivalent
//               to HTMLText. In such cases HTMLText is more efficient.
//    HTMLLinkText is like HTMLText but can be hyperlinked.
//    HTMLLinkTextMaster is like HTMLTextMaster but can be hyperlinked.
//
// Rationale:
//    Basically all functionality is provided by HTMLVSpace and HTMLText.
//    The additional functionality of HTMLLLinkText is not put in HTMLText
//    to keep the memory usage of the frequently used HTMLText object low.
//    Since often single spaces are used in HTML, they got their own, even 
//    smaller object. 
//    Another often encountered pattern is a paragraph of text. The 
//    HTMLTextMaster is designed for this purpose. It splits the paraagraph
//    in lines during layout and allocates a HTMLTextSlave object for each 
//    line. The actual text itself is maintained by the HTMLTextMaster
//    object making efficient memory usage possible.

class HTMLHSpace : public HTMLObject
{
public:

    HTMLHSpace( const HTMLFont *, QPainter *, bool hidden=false );
    virtual ~HTMLHSpace() { }
    virtual bool print( QPainter *_painter, int _x, int _y, int _width,
	    int _height, int _tx, int _ty, bool toPrinter );
    virtual void print( QPainter *, int _tx, int _ty );

    virtual void recalcBaseSize( QPainter *_painter );
    virtual void getSelectedText( QString & );
protected:
    const HTMLFont *font;
};
//-----------------------------------------------------------------------------

class HTMLTextSlave;
class HTMLText : public HTMLObject
{
	friend HTMLTextSlave;
public:
    HTMLText( const char*, const HTMLFont *, QPainter *);
    HTMLText( const HTMLFont *, QPainter * );
    virtual ~HTMLText();

    virtual bool selectText( KHTMLWidget *_htmlw, HTMLChain *_chain, int _x1,
	int _y1, int _x2, int _y2, int _tx, int _ty );
    virtual void getSelectedText( QString & );
    virtual void select( KHTMLWidget *_htmlw, HTMLChain *_chain,
        bool _select, int _tx, int _ty );
    virtual void recalcBaseSize( QPainter *_painter );
    virtual bool print( QPainter *_painter, int _x, int _y, int _width,
	    int _height, int _tx, int _ty, bool toPrinter );
    virtual void print( QPainter *, int _tx, int _ty );

    virtual bool selectText( const QRegExp &exp );

protected:
    int getCharIndex( int _xpos );

protected:
    const char* text;
    const HTMLFont *font;
    short selStart;
    short selEnd;
};

class HTMLTextMaster : public HTMLText
{
	friend HTMLTextSlave;
public:
    HTMLTextMaster( const char* _text, const HTMLFont *_font, 
    				QPainter *_painter);
    	             
    virtual int  calcMinWidth() { return minWidth; }
    virtual int  calcPreferredWidth() { return prefWidth; }
    virtual HTMLFitType fitLine( bool startOfLine, bool firstRun, int widthLeft );
    virtual bool print( QPainter *_painter, int _x, int _y, int _width,
					    int _height, int _tx, int _ty, bool toPrinter )
	    { return false; } // Dummy
    virtual void print( QPainter *, int _tx, int _ty )
    	{ } // Dummy
    virtual void recalcBaseSize( QPainter * ) 
    	{ } // Dummy
    virtual bool selectText( KHTMLWidget *_htmlw, HTMLChain *_chain, int _x1,
							 int _y1, int _x2, int _y2, int _tx, int _ty )
		{ return false; } // Dummy
    virtual bool selectText( const QRegExp & ) { return false; }
protected:
	int minWidth;
	int prefWidth;  
	int strLen;  
};

class HTMLTextSlave : public HTMLObject
{
public:
    HTMLTextSlave( HTMLTextMaster *_owner, short _posStart, short _posLen);
    virtual HTMLFitType fitLine( bool startOfLine, bool firstRun, int widthLeft );
    virtual bool selectText( KHTMLWidget *_htmlw, HTMLChain *_chain, int _x1,
	int _y1, int _x2, int _y2, int _tx, int _ty );
    virtual void getSelectedText( QString & ) { }; // Handled by master
    virtual bool print( QPainter *_painter, int _x, int _y, int _width,
	    int _height, int _tx, int _ty, bool toPrinter );
    virtual void print( QPainter *, int _tx, int _ty );
    virtual int  calcMinWidth() { return 0; }
    virtual int  calcPreferredWidth() { return 0; }

    virtual bool selectText( const QRegExp &exp );
    virtual bool isSlave() const { return 1; }

    virtual const char* getURL() const { return owner->getURL(); }
    virtual const char* getTarget() const { return owner->getTarget(); }
#ifdef EXEC_EXTENSIONS
    virtual const char* getExec() const { return owner->getExec(); }
#endif

protected:
    int getCharIndex( int _xpos );

protected:
	HTMLTextMaster *owner;
    short posStart;
    short posLen;
};

//-----------------------------------------------------------------------------
//
// This object is text which also has an associated link.  This data is
// not maintained in HTMLText to conserve memory.
//
class HTMLLinkText : public HTMLText
{
public:
#ifdef EXEC_EXTENSIONS
  HTMLLinkText(const char*_str,const HTMLFont *_font,QPainter *_painter,char *_url,const char *_target,char *_exec)
    : HTMLText( _str, _font, _painter)
    { url = _url; target = _target; exec = _exec;}
#else
  HTMLLinkText(const char*_str,const HTMLFont *_font,QPainter *_painter,char *_url,const char *_target)
    : HTMLText( _str, _font, _painter)
    { url = _url; target = _target;}
#endif
    virtual ~HTMLLinkText() { }

    virtual const char* getURL() const { return url; }
    virtual const char* getTarget() const { return target; }
#ifdef EXEC_EXTENSIONS
    virtual const char* getExec() const { return exec; }
#endif

protected:
    char *url;
    const char *target;
#ifdef EXEC_EXTENSIONS
    char *exec;
#endif
};

//-----------------------------------------------------------------------------
//
// This object is text which also has an associated link.  This data is
// not maintained in HTMLTextMaster to conserve memory.
//
class HTMLLinkTextMaster : public HTMLTextMaster
{
public:
#ifdef EXEC_EXTENSIONS
  HTMLLinkTextMaster(const char*_str,const HTMLFont *_font,QPainter *_painter,char *_url,const char *_target,char *_exec)
	: HTMLTextMaster( _str, _font, _painter)
	    { url = _url; target = _target; exec = _exec;}
#else
  HTMLLinkTextMaster(const char*_str,const HTMLFont *_font,QPainter *_painter,char *_url,const char *_target)
	: HTMLTextMaster( _str, _font, _painter)
	    { url = _url; target = _target;}
#endif
    virtual ~HTMLLinkTextMaster() { }

    virtual const char* getURL() const { return url; }
    virtual const char* getTarget() const { return target; }
#ifdef EXEC_EXTENSIONS
    virtual const char* getExec() const { return exec; }
#endif

protected:
    char *url;
    const char *target;
#ifdef EXEC_EXTENSIONS
    char *exec;
#endif
};

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

class HTMLRule : public HTMLObject
{
public:
    HTMLRule( int _max_width, int _percent, int _size=1, bool _shade=TRUE );

    virtual int  calcMinWidth();
    virtual int  calcPreferredWidth() { return calcMinWidth(); }
    virtual void setMaxWidth( int );
    virtual bool print( QPainter *_painter, int _x, int _y, int _width,
	int _height, int _tx, int _ty, bool toPrinter );
    virtual void print( QPainter *, int _tx, int _ty );

protected:
    bool shade;
};

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

class HTMLBullet : public HTMLObject
{
public:
    HTMLBullet( int _height, int _level, const QColor &col );
    virtual ~HTMLBullet() { }

    virtual bool print( QPainter *_painter, int _x, int _y, int _width,
	int _height, int _tx, int _ty, bool toPrinter );
    virtual void print( QPainter *, int _tx, int _ty );

protected:
    char level;
    QColor color;
};

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

class HTMLVSpace : public HTMLObject
{
public:
    enum Clear { CNone, Left, Right, All };

    HTMLVSpace( int _vspace, Clear c = CNone );
    virtual ~HTMLVSpace() { }

    virtual void getSelectedText( QString & );

    Clear clear()
	{ return cl; }

private:
    Clear cl;
};

//-----------------------------------------------------------------------------
// This class is inserted everywhere where a <a name="anchor">
// appears.
//
class HTMLAnchor : public HTMLObject
{
public:
    HTMLAnchor( const char *_name ) : name( _name ) {}
    virtual ~HTMLAnchor() { }

    const char* getName() { return name; }

    virtual void setMaxAscent( int _a );
    virtual HTMLAnchor* findAnchor( const char *_name, QPoint *_p );

protected:
    QString name;
};

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

class HTMLCachedImage
{
public:
    HTMLCachedImage( const char * );
    virtual ~HTMLCachedImage() { }

    QPixmap* getPixmap();
    const char *getFileName() { return filename.data(); }

protected:
    QPixmap *pixmap;
    QString filename;
};

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

class HTMLImage : public QObject, public HTMLObject
{
    Q_OBJECT
public:
#ifdef EXEC_EXTENSIONS
    HTMLImage(KHTMLWidget *widget,const char *,char *_url,char *_target,char *exec,int _max_width,int _width = -1,int _height = -1,int _percent = 0,int bdr = 0);
#else
    HTMLImage(KHTMLWidget *widget,const char *,char *_url,char *_target,int _max_width,int _width = -1,int _height = -1,int _percent = 0,int bdr = 0);
#endif
    virtual ~HTMLImage();

    virtual int  calcMinWidth();
    virtual int  calcPreferredWidth();
    virtual void setMaxWidth( int );
    virtual bool print( QPainter *_painter, int _x, int _y, int _width,
	int _height, int _tx, int _ty, bool toPrinter );
    virtual void print( QPainter *, int _tx, int _ty );

    virtual void calcAbsolutePos( int _x, int _y );
    virtual int  getAbsX();
    virtual int  getAbsY();

    virtual void changeImage( const char *_url );
  
    void setOverlay( const char *ol );

    static void cacheImage( const char * );
    static QPixmap* findImage( const char * );

    /* Tells the object the the requested image is available
     *
     * The image is on the local disk in the file named '_filename.'
     */
    virtual void fileLoaded( const char *_filename );
    virtual bool fileLoaded( const char* _url, QBuffer& _buffer );

    virtual const char *requestedFile()
       	{	return imageURL.data(); }

    virtual const char* getURL() const { return url; }
    virtual const char* getTarget() const { return target; }
#ifdef EXEC_EXTENSIONS
    virtual const char* getExec() const { return exec; }
#endif

    void setBorderColor( const QColor &color )
	{   borderColor = color; }
    virtual void setBgColor( QColor c );

protected slots:
    void movieUpdated( const QRect &rect );
    void statusChanged( int );

protected:

    /*
     * Calculates the size of the loaded image.
     * This function is usually called from the constructor or from
     * 'imageLoaded'.
     */
    void init();
    
    /*
     * Pointer to the image
     * If this pointer is 0L, that means that the picture could not be loaded
     * for some strange reason or that the image is waiting to be downloaded
     * from the internet for example.
     */
    QPixmap *pixmap;
    QPixmap *movieCache;
    QRect oldRect;
    QColor bgColor;

#ifdef USE_QMOVIE
    QMovie *movie;
#else
    void *movie;
#endif

    // this image is overlaid on top of the image.
    // Used by HTML widget to show links/read only files, etc.
    QPixmap *overlay;

    /*
     * The URL of this image.
     * This variable is only used if we have to wait for the image.
     * Otherwise this string will be empty.
     */
    QString imageURL;
    
    KHTMLWidget *htmlWidget;
    
    static QDict<HTMLCachedImage>* pCache;

    /*
     * Flag telling wether this image was found in the cache
     * If this flag is set, you may not delete the pixmap since the pixmap
     * belongs to the HTMLCachedImage.
     */
    bool cached;

    /*
     * If we knew the size of the image from the <img width=...> tag then this
     * flag is TRUE.
     * We need this flag if the image has to be loaded from the web. In this
     * case we may have to reparse the HTML code if we did not know the size
     * during the first parsing.
     */
    bool predefinedWidth;

    /*
     * If we knew the size of the image from the <img height=...> tag then
     * this flag is TRUE.
     * We need this flag if the image has to be loaded from the web. In this
     * case we may have to reparse the HTML code if we did not know the size
     * during the first parsing.
     */
    bool predefinedHeight;

    /*
     * Tells the function 'imageLoaded' wether it runs synchronized with the
     * constructor
     * If an image has to be loaded from the net, it may happen that the image
     * is cached.  This means the the function 'imageLoaded' is called before
     * the control returns to the constructor, since the constructor requested
     * the image and this caused in turn 'imageLoaded' to be called. In this
     * case the images arrived just in time and no repaint or recalculate
     * action must take place. If 'imageLoaded' works synchron with
     * the constructor then this flag is set to TRUE.
     */
    bool synchron;

    // border width
    int border;

    QColor borderColor;

    char *url;
    char *target;
#ifdef EXEC_EXTENSIONS
    char *exec;
#endif

    // The absolute position of this object on the page
    int absX;
    int absY;

    bool bComplete;
};

//----------------------------------------------------------------------------
/*
 * HTMLArea holds an area as specified by the <AREA > tag.
 */
class HTMLArea
{
public:
    HTMLArea( const QPointArray &_points, const char *_url,
	    const char *_target = 0 );
    HTMLArea( const QRect &_rect, const char *_url, const char *_target = 0 );
    HTMLArea( int _x, int _y, int _r, const char *_url,
	    const char *_target = 0 );

    enum Shape { Poly, Rect, Circle };

    bool contains( const QPoint &_point ) const
	    {	return region.contains( _point ); }

    const QString &getURL() const
	    {	return url; }
    const char *getTarget() const
	    {	return target; }

protected:
    QRegion region;
    QString url;
    QString target;
};

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

/*
 * HTMLMap contains a list of areas in the image map.
 * i.e. all areas between <MAP > </MAP>
 * This object is derived from HTMLObject so that it can make use of
 * URLLoaded().
 */
class HTMLMap : public HTMLObject
{
public:
    HTMLMap( KHTMLWidget *w, const char *_url );
    virtual ~HTMLMap();

    virtual void fileLoaded( const char *_filename );
    virtual bool fileLoaded( const char* _url, QBuffer& _buffer );

    virtual const char *requestedFile()
	    {	return mapurl; }

    void addArea( HTMLArea *_area )
	    {	areas.append( _area ); }
    const HTMLArea *containsPoint( int, int );

    const char *mapURL() const
	    {	return mapurl; }

protected:
    bool fileLoaded( QIODevice& file );
  
    QList<HTMLArea> areas;
    KHTMLWidget *htmlWidget;
    QString mapurl;
};

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

class HTMLImageMap : public HTMLImage
{
public:
#ifdef EXEC_EXTENSIONS
  HTMLImageMap(KHTMLWidget *widget,const char*,char *_url,char *_target,char *_exec,int _max_width,int _width = -1,int _height = -1,int _percent = 0,int brd = 0);
#else
  HTMLImageMap(KHTMLWidget *widget,const char*,char *_url,char *_target,int _max_width,int _width = -1,int _height = -1,int _percent = 0,int brd = 0);
#endif
    virtual ~HTMLImageMap() {}

    virtual HTMLObject* checkPoint( int, int );

    void setMapURL( const char *_url )
	    {	mapurl = _url; }
    const QString& mapURL() const
	    {	return mapurl; }

    enum Type { ClientSide, ServerSide };

    void setMapType( Type t )
	    {	type = t; }
    bool mapType() const
	    {	return type; }

protected:
    /*
     * The URL set by <a href=...><img ... ISMAP></a> for server side maps
     */
    QString serverurl;

    /*
     * The URL set by <img ... USEMAP=mapurl> for client side maps
     */
    QString mapurl;

    /*
     * ClientSide or ServerSide
     */
    Type type;
};

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

#endif // HTMLOBJ


--- NEW FILE: htmlfont.cpp ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include "htmlfont.h"
#include <string.h>
#include <qstring.h>
#include <kapp.h>
#include <klocale.h>

HTMLFont::HTMLFont( const char *_family, int _size, const int *fontSizes, int _weight, bool _italic,
                    const char *_charset)
    : font( _family, fontSizes[ _size ], _weight, _italic )
{
    textCol = black;
    fsize = _size;
    if (_charset) setCharset(_charset);
    else setCharset(klocale->charset());
    pointsize = fontSizes[ _size ];
}

HTMLFontManager::HTMLFontManager()
{
    list.setAutoDelete( TRUE );
}

const HTMLFont *HTMLFontManager::getFont( const HTMLFont &f )
{
    HTMLFont *cf;

    for ( cf = list.first(); cf; cf = list.next() )
    {
	if ( *cf == f )
	    return cf;
    }

    cf = new HTMLFont( f );

    list.append( cf );

    return cf;
}

--- NEW FILE: htmlclue.h ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
//-----------------------------------------------------------------------------
//
// KDE HTML Widget
//

#ifndef HTMLCLUE_H
#define HTMLCLUE_H

#include <qpainter.h>
#include <qlist.h>
#include <qstrlist.h>
#include <qarray.h>
#include <qpixmap.h>
#include <qstack.h>
#include <qfont.h>
#include <qtimer.h>

#include <kurl.h>

class HTMLClueV;
class HTMLImage;
class HTMLClue;
class HTMLClueFlow;
class HTMLClueAligned;
class KHTMLWidget;

#include "htmlfont.h"
#include "htmlobj.h"
#include "htmliter.h"

// The border around an aligned object
#define ALIGN_BORDER 0

class HTMLAnchor;

//-----------------------------------------------------------------------------
// Clues are used to contain and format objects (or other clues).
// This is the base of all clues - it should be considered abstract.
//
class HTMLClue : public HTMLObject
{
public:
    /************************************************************
     * This class is abstract. Do not instantiate it. The _y argument
     * is always 0 yet. _max_width defines the width you allow this Box
     * to have. If you do not use HCenter or Right and if this Box
     * becomes a child of a VBox you may set _x to give this Box
     * a shift to the right.
     *
     * if:
     *     _percent == -ve     width = best fit
     *     _percent == 0       width = _max_width (fixed)
     *     _percent == +ve     width = _percent * 100 / _max_width
     */
    HTMLClue( int _x, int _y, int _max_width, int _percent = 100);
    virtual ~HTMLClue();

    virtual int  findPageBreak( int _y );
    virtual bool print( QPainter *_painter, int _x, int _y, int _width,
	    int _height, int _tx, int _ty, bool toPrinter );
    virtual void print( QPainter *_p, HTMLChain *, int _x, int _h, int _w,
	    int _h2, int _tx, int _ty);
    /// Prints a special object only
    /**
     * This function is for example used to redraw an image that had to be
     * loaded from the world wide wait.
     */
    virtual void print( QPainter *_painter, HTMLObject *_obj, int _x, int _y,
	    int _width, int _height, int _tx, int _ty );
    virtual void print( QPainter *, int _tx, int _ty );
    /************************************************************
     * Calls all children and tells them to calculate their size.
     */
    virtual void calcSize( HTMLClue *parent = 0L );
    virtual void recalcBaseSize( QPainter * );
    virtual int  calcMinWidth();
    virtual int  calcPreferredWidth();
    virtual void setMaxAscent( int );
    virtual void setMaxDescent( int );
    virtual HTMLObject *checkPoint( int, int );
    virtual HTMLObject *mouseEvent( int, int, int, int );
    virtual void selectByURL( KHTMLWidget *, HTMLChain *,const char *,bool, int _tx, int _ty );
    virtual void select( KHTMLWidget *, HTMLChain *, QRegExp& _pattern, bool _select,
	    int _tx, int _ty );
    virtual void select( KHTMLWidget *, HTMLChain *, bool, int _tx, int _ty );
    /*
     * Selects every objectsin this clue if it is inside the rectangle
     * and deselects it otherwise.
     */
    virtual void select( KHTMLWidget *, HTMLChain *, QRect &_rect, int _tx, int _ty );
    virtual void select( bool );
    virtual void getSelected( QStrList & );
    virtual bool selectText( KHTMLWidget *_htmlw, HTMLChain *_chain, int _x1,
	int _y1, int _x2, int _y2, int _tx, int _ty );
    virtual void getSelectedText( QString & );

    virtual void calcAbsolutePos( int _x, int _y );
    virtual bool getObjectPosition( const HTMLObject *objp, int &xp, int &yp );
    virtual void setIndent( int ) { }
    virtual void reset();

    virtual ObjectType getObjectType() const
	    {	return Clue; }
    bool hasChildren() const
	    {	return (head != 0L); }
    HTMLObject *children() { return head; }
	HTMLObject *lastChild() { return tail; }
    /************************************************************
     * Make an object a child of this Box.
     */
    void append( HTMLObject *_object )
	{
	    if ( !head )
	    {
		head = tail = _object;
	    }
	    else
	    {
		tail->setNext( _object );
		tail = _object;
	    }
	}
	
    virtual void findFreeArea( int _y, int, int, int,
                               int *_y_pos, int *_lmargin, int *_rmargin)
        { *_y_pos = _y; *_lmargin = 0; *_rmargin = max_width; }
    // This method tries to find a free rectangular area of _width x _height
    // from position _y on. The start of this area is written in *y_pos.
    // The actual left and right margins of the area are returned in
    // *lmargin and *rmargin.
    virtual void appendLeftAligned( HTMLClueAligned * ) { }
    virtual void appendRightAligned( HTMLClueAligned * ) { }
    virtual int  appended(HTMLClueAligned * ) { return 0;}
    virtual void removeAlignedByParent( HTMLObject * ) { }
    virtual int  getLeftMargin( int )
        { return 0; }
    virtual int  getRightMargin( int )
	{ return max_width; }
    virtual int  getLeftClear( int _y )
	{ return _y; }
    virtual int  getRightClear( int _y )
	{ return _y; }
    
    void setVAlign( VAlign _v ) { valign = _v; }
    void setHAlign( HAlign _h ) { halign = _h; }
    VAlign getVAlign() { return valign; }
    HAlign getHAlign() { return halign; }

    virtual HTMLAnchor* findAnchor( const char *_name, QPoint *_p );

    virtual void findCells( int _tx, int _ty, QList<HTMLCellInfo> &_list );

    /*
     * Create an iterator.
     * The returned iterator must be deleted by the caller.
     */
    virtual HTMLIterator *getIterator()
       { return head ? new HTMLListIterator( this ) : 0; }

    virtual void setBgColor( QColor c );
  
protected:
    HTMLObject *head;
    HTMLObject *tail;
    HTMLObject *curr;

    VAlign valign;
    HAlign halign;
};

//-----------------------------------------------------------------------------
// Used for aligning images etc. to the left or right of the page.
//
class HTMLClueAligned : public HTMLClue
{
public:
    HTMLClueAligned( HTMLClue *_parent, int _x, int _y, int _max_width,
		     int _percent = 100 )
	: HTMLClue( _x, _y, _max_width, _percent )
    { prnt = _parent; nextAligned = 0; setAligned( true ); }
    virtual ~HTMLClueAligned() { }
    
    virtual void setMaxWidth( int );
    virtual void setMaxAscent( int ) { }
    virtual void calcSize( HTMLClue *_parent = 0L );
    
    HTMLClue *parent()
	{ return prnt; }
    HTMLClueAligned *nextClue() const
	{ return nextAligned; }
    void setNextClue( HTMLClueAligned *n )
	{ nextAligned = n; }
    
private:
    HTMLClue *prnt;
    HTMLClueAligned *nextAligned;
};

//-----------------------------------------------------------------------------
// Align objects across the page, wrapping at the end of a line
//
class HTMLClueFlow : public HTMLClue
{
public:
    HTMLClueFlow( int _x, int _y, int _max_width, int _percent=100)
		: HTMLClue( _x, _y, _max_width, _percent ) { indent = 0; }
    virtual ~HTMLClueFlow() { }
    
    virtual bool selectText( KHTMLWidget *_htmlw, HTMLChain *_chain, int _x1,
	int _y1, int _x2, int _y2, int _tx, int _ty );
    virtual void getSelectedText( QString & );
    virtual void calcSize( HTMLClue *parent = 0L );
	virtual int  findPageBreak( int _y );
    virtual int  calcMinWidth();
    virtual int  calcPreferredWidth();
    virtual void setMaxWidth( int );

    virtual void setIndent( int i )
	    {	indent = i; }

protected:
    short indent;
};

//-----------------------------------------------------------------------------
// Align objects vertically
//
class HTMLClueV : public HTMLClue
{
public:
    HTMLClueV( int _x, int _y, int _max_width, int _percent = 100 );
    virtual ~HTMLClueV() { }

    virtual void reset();

    virtual void setMaxWidth( int );
    virtual HTMLObject *checkPoint( int, int );
    virtual HTMLObject *mouseEvent( int, int, int, int );
    virtual void calcSize( HTMLClue *parent = 0L );
    virtual bool print( QPainter *_painter, int _x, int _y, int _width,
		int _height, int _tx, int _ty, bool toPrinter );
    virtual void print( QPainter *_painter, HTMLObject *_obj, int _x, int _y,
		int _width, int _height, int _tx, int _ty )
	{ HTMLClue::print(_painter,_obj,_x,_y,_width,_height,_tx,_ty); }

    virtual void findFreeArea( int _y, int _width, int _height, int _indent,
                               int *_y_pos, int *_lmargin, int *_rmargin);
    // This method tries to find a free rectangular area of _width x _height
    // from position _y on. The start of this area is written in *y_pos.
    // The actual left and right margins of the area are returned in
    // *lmargin and *rmargin.
                   
    virtual void appendLeftAligned( HTMLClueAligned *_clue );
    virtual void appendRightAligned( HTMLClueAligned *_clue );
    virtual int  appended(HTMLClueAligned * );
    virtual int  getLeftMargin( int _y );
    virtual int  getRightMargin( int _y );
    virtual int  getLeftClear( int _y );
    virtual int  getRightClear( int _y );
  
protected:
    void removeAlignedByParent( HTMLObject *p );

protected:
    // These are the objects which are left or right aligned within this
    // clue.  Child objects must wrap their contents around these.
    HTMLClueAligned *alignLeftList;
    HTMLClueAligned *alignRightList;
    unsigned short padding;
};

/**
 * Used for KFMs HTML extension
 */
class HTMLCell : public HTMLClueV
{
public:
  HTMLCell( int _x, int _y, int _max_width, int _percent = 100, const char *_url = 0L, const char *_target = 0L );
  virtual ~HTMLCell() { }
  
  virtual const char* getURL() const { return url; }
  virtual const char* getTarget() const { return target; }
#ifdef EXEC_EXTENSIONS
  virtual const char* getExec() const { return exec; }
#endif

  virtual void select( KHTMLWidget *, HTMLChain *, QRect &_rect, int _tx, int _ty );

  virtual bool print( QPainter *_painter, int _x, int _y, int _width,
		      int _height, int _tx, int _ty, bool toPrinter );

  virtual bool isMarked() const { return bIsMarked; }
  virtual void setMarker( bool _mode ) { bIsMarked = _mode; }
  virtual void findCells( int _tx, int _ty, QList<HTMLCellInfo> &_list );

protected:
  const char *url;
  const char *target;
#ifdef EXEC_EXTENSIONS
  const char *exec;
#endif

  bool bIsMarked;
};

//-----------------------------------------------------------------------------
// Align objects across the page, without wrapping.
// This clue is required for lists, etc. so that tables can dynamically
// change max_width and have the contents' max_widths changed appropriately.
// Also used by <pre> lines
//
class HTMLClueH : public HTMLClue
{
public:
    HTMLClueH( int _x, int _y, int _max_width, int _percent = 100 )
	    : HTMLClue( _x, _y, _max_width, _percent ) { indent = 0; }
    virtual ~HTMLClueH() { }
	
    virtual bool selectText( KHTMLWidget *_htmlw, HTMLChain *_chain, int _x1,
	int _y1, int _x2, int _y2, int _tx, int _ty );
    virtual void getSelectedText( QString & );
    virtual void setMaxWidth( int );
    virtual void calcSize( HTMLClue *parent = 0L );
    virtual int  calcMinWidth();
    virtual int  calcPreferredWidth();

    virtual void setIndent( int i )
	    {	indent = i; }

private:
    short indent;
};

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

#endif // HTMLCLUE_H


--- NEW FILE: htmltoken.cpp ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)
              (C) 1998 Waldo Bastian (bastian at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
[...1002 lines suppressed...]
}

const char* StringTokenizer::nextToken()
{
    if ( pos == 0 )
	return 0;

    char *ret = pos;
    pos += strlen( ret ) + 1;
    if ( pos >= end )
	pos = 0;

    return ret;
}

StringTokenizer::~StringTokenizer()
{
    if ( buffer != 0 )
	delete [] buffer;
}

--- NEW FILE: DESIGN ---
README.parser
=============

This document gives a short explanation about the verious parsing stages
within the KHTMLW component.

When HTML is fed into KHTMLW it takes 3 stages before it is put onto the
screen:

Stage 1.: The Tokenizer.
Stage 2.: The HTML-Parser
Stage 3.: The HTML-Layout  

The Tokenizer
=============

The tokenizer is located in htmltoken.cpp. The tokenizer uses the contents
of a HTML-file as input and breaks this contents up in a linked list of 
tokens. The tokenizer recognizes HTML-entities and HTML-tags. Text between
begin- and end-tags is handled distinctly for several tags. The distinctions
are in the way how spaces, linefeeds, HTLM-entities and other tags are
handled. 

Example I: 
Normally linefeeds are treated like spaces. However, inside a <pre> tag
linefeeds are preserved.

Example II:
Normally all text is translated into tokens and added to the linked list to
be fed into the HTML-Parser. However, text within the <script> tag is fed
into a script-interpreter. (Not that any is available at the moment).

The tokenizer is completly state-driven on a character by character base.
All text passed over to the tokenizer is directly tokenized. A complete
HTML-file can be passed to the tokenizer as a whole, character by character
(not very efficient) or in blocks of any (variable) size.


The HTML-Parser
===============

The HTML-parser interprets the stream of tokens provided by the tokenizer
and constructs a structure of renderable elements. Two types of renderable
elements can be distinguished: HTML-objects and HTML-clues.

* HTML-objects

A HTML-object is a object which can be drawn on the screen. Examples of it
are text, links, images and lines.

* HTML-clues

A HTML-clue is a container which can contain HTML-objects and/or other
HTML-clues. A HTML-clue determines how the elements which it contains are
positioned with respect to each other.

Example I:
The HTMLClueFlow positions its elements in a 'flow' like the text in a book: 
It starts from the left and moves to the right. When it hits the
right-margin it moves down and continues from the left-margin.  

The HTML-Layout
===============

When the ccomplete structure of HTML-clues and HTML-objects is build. The
HTML-layout starts: each HTML-object is positioned. The positioning depends
on the available screen-width.

The positioning starts with the calculation of the minimum screen-width
required to display the complete HTML page. The calcMinSize method in
HTML-clues and HTML-objects is used for this. The minimum size is calculated
recursively through all HTML-clues.

When the minimum size is known it compared against the actuaal available
screen-size. If the minimum size is less than the available
screen-size the available screen size will be used as the maximum screen
size. If the minimum size is greater than the available size the minimum
size is used as the maximum screen size. In taht case, if configured, a 
horizontal scrollbar will be added to be able to scroll.

-----------------------------------------------------------------------------
Advanced Topics
-----------------------------------------------------------------------------

The HTMLText objects
====================

There are several text-related objects:

   HTMLHSpace: A horizontal space
   HTMLVSpace: A vertical space, e.g. linefeed
   HTMLText: A non-breakable text object
   HTMLTextMaster: A breakable text-object
   HTMLLinkText: A non-breakable hyperlinked text object
   HTMLLinkTextMaster: A breakable hyperlinked text object
 
   Use:
      HTMLHSpace is equivalent to HTMLText(" ", ...) but slightly smaller
                 in memory usage
      HTMLVSpace is used for a forced line-break (e.g. linefeed)
      HTMLText is used for text which shouldn't be broken.
      HTMLTextMaster is used for text which may be broken on spaces,
                 it should only be used inside HTMLClueFlow.
                 For text without spaces HTMLTextMaster is equivalent
                 to HTMLText. In such cases HTMLText is more efficient.
      HTMLLinkText is like HTMLText but can be hyperlinked.
      HTMLLinkTextMaster is like HTMLTextMaster but can be hyperlinked.
  
   Rationale:
      Basically all functionality is provided by HTMLVSpace and HTMLText.
      The additional functionality of HTMLLLinkText is not put in HTMLText
      to keep the memory usage of the frequently used HTMLText object low.
      Since often single spaces are used in HTML, they got their own, even
      smaller object.
      Another often encountered pattern is a paragraph of text. The
      HTMLTextMaster is designed for this purpose. It splits the paragraph
      in lines during layout and allocates a HTMLTextSlave object for each
      line. The actual text itself is maintained by the HTMLTextMaster
      object making efficient memory usage possible.


The HTMLTextMaster/HTMLTextSlave objects
========================================

Text sequences rendered with the same font-settings are kept in one single 
string as much as possible. If such a string contains normal (breaking) 
spaces, this string is converted into a HTMLTextMaster object. If such a 
string contains non-breaking spaces it is converted into a HTMLText object.
The non-breaking spaces are passed as normal spaces to the HTMLText object, 
since the HTMLText object does never break up any text, the spaces act as 
non-breaking spaces.

If a string contains both breaking and non-breaking spaces the string is 
split up across a HTMLText, HTMLSpace and HTMLTextMaster object. The reason
for this is that we can't pass non-breaking spaces to the HTMLTextMaster
object due to problems with fonts. Not all fonts print the character
0xA0. A workaround in Qt is announced. Until that workaround is mainstream,
we can't use non-breaking spaces in our HTMLTextMaster object.

The actual line-breaking is done in the HTMLTextSlave::fitLine() method. This 
method is called from HTMLClueFlow::calcSize().
The parent of the HTMLTextSlave should be the HTMLClueFlow object. 

In HTMLClue is also a call to fitLine(). This call has its arguments setup to 
instruct the HTMLTextSlave not to do any breaking at all. HTMLClue is used
for the contents of <pre>..</pre> tags. It is rather strange if HTMLClue 
contains any HTMLTextSlave objects though. Text within <pre>..</pre> tags 
should all end up as HTMLText objects.

The line breaking is pretty tricky. This is how it is done without any 
HTMLTextMaster objects (e.g. without fitLine functionality)

The HTMLTextMaster object contains the text string. During lay-out the 
HTMLTextMaster spawns off a HTMLTextSlave which prints (a part of) the 
text string. All layout issues are further handled by HTMLTextSlave.

Basic Text lay-out
==================

Basically the line-breaking is done by
HTMLClueFlow::calcSize(). It lays out the text line by line. It collects 
"run"'s of objects. A "run" is a sequence of objects with no white-space 
inbetween them. If a run is complete it is checked whether the width of the 
run fits the current line. If it fits another run is made until no more run 
can be added: the line is full. The last run which didn't fit anymore on 
the line is rejected.

If we have line consisting og a set of run's which fit the current width 
of the HTMLClueFlow we have to check whether the total available space at 
the point where we are expecting the text is indeed enough for our line.

This seems redundant but although the width of the Clue is big enough to 
hold the line it can be that a floating images is right beneath us and that 
we therefor have not enough space for the height of the line. If this is the 
case we ask for a new position (further down in the Clue) which provides 
enough height for our line. Since this position may have a different width, we 
throw away our line and start making a new line given the new width.

This isn't very efficient but it shouldn't occur too often.


Text layout using fitLine().
============================

The text-layout algorithm mentioned above assumes that all objects (making 
up the runs) have a fixed width wich can't be changed. The HTMLTextSlave
objects however, can break themselve up in multiple HTMLTextSlave objects.

The fitLine() call is a hint to the HTMLTextSlave object to break itself up
if necassery. After it has done so (or if it chooses not to do so) the 
HTMLTextSlave is further treated by the text-layout algorithm as a normal 
fixed size object. 

For efficiency the fitLine() function returns some information to the 
text-layout algorithm. If HTMLTextSlave has broken itself up it makes no 
sense to try to add more objects to that line. The next object will be the 
remaining part of the HTMLTextSlave, if it would have fitted, the original 
HTMLTextSlave would had splitted in the first place. So if HTMLPartialFit 
is returned, this is a hint to the layout-algorithm that with thi HTMLTextSlave 
the line is full and that it doesn't need to try to add more objects to that 
line.
 
Another possibily is that the HTMLTextSlave sees no way to break itself so 
that it fits the available space. In that case it does no further attempt
and returns HTMLNoFit to the layout algorithm. This is an indication that the
run the HTMLTextSlave is part of, will not fit the available space and that it
is useless to try any further.

An exception to this rule is the case where this run is the first run of the 
line. In that case the HTMLTextSlave should make itself as small as possible. 
The resulting run will then not fit within the width of the current line. 
However, another position for the text is searched where the line does fit. 

If such a position is not found the widest available position is choosen. 
In this case the text will overflow the Clue borders. This should only be 
possible to happen if the width of the Clue didn't take (for some reason 
or the other) the minimumWidth of its contents into account.


--- NEW FILE: jscript.h ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
#ifndef JSBUILTIN_H
#define JSBUILTIN_H

#include <qstring.h>
#include <jsexec.h>

class KHTMLView;
class JSEnvironment;
class JSDocumentObject;
class JSDocumentWriteFunction;
class JSWindowObject;
class JSWindowVarObject;
class JSInstanceScope;
class JSWindowArrayObject;

class JSEventHandler
{
public:
    JSEventHandler( JSEnvironment *_env, const char *_name, const char *_code );
    ~JSEventHandler();
    
    JSEnvironment *getJSEnvironment() { return jsEnvironment; }
    const char* getName() { return name.data(); }
    int exec( JSInstanceScope *_scope );
    
protected:
    JSCode *code;
    QString name;
    JSEnvironment *jsEnvironment;
};


#include "html.h"

#define TYPE_JSDocumentObject 1000
#define TYPE_JSWindowObject 1001
#define TYPE_JSWindowVarObject 1002

#define KIND_JSWindowStatus 1
#define KIND_JSWindowParent 2
#define KIND_JSWindowTop 3
#define KIND_JSWindowName 4
#define KIND_JSWindowFrames 5

class JSWindowObject : public JSUserDefinedObject
{
public:
    JSWindowObject( JSEnvironment *_jsenv );
    virtual ~JSWindowObject();

    virtual int isA() { return TYPE_JSWindowObject; }    
    virtual bool inherits( int _type )
    { if ( _type == TYPE_JSWindowObject ) return TRUE;
    else return JSUserDefinedObject::inherits( _type ); }

    /**
     * Never delete this instance.
     */
    virtual void release() { if ( lock > 1 ) lock--;  }

    JSEnvironment* getJSEnvironment() { return jsEnvironment; }
    
protected:
    /**
     * The variable 'status' of the window object.
     */
    JSWindowVarObject *varStatus;
    JSWindowVarObject *varParent;
    JSWindowVarObject *varTop;    
    JSWindowVarObject *varName;

    /**
     * Pointer to the environment this window object belongs to.
     */
    JSEnvironment *jsEnvironment;

    /**
     * The object 'document'
     */
    JSDocumentObject *jsDocumentObject;
    /**
     * The variable that holds the object 'document'.
     */
    JSVariableObject *jsDocumentVar;
    /**
     * The object 'frames'
     */
    JSWindowArrayObject *jsFramesObject;
    /**
     * The variable that holds the array 'frames'.
     */
    JSVariableObject *jsFramesVar;

};

class JSWindowArrayObject : public JSAbstractArrayObject
{
public:
    JSWindowArrayObject( JSWindowObject *_win, int _kind );
    virtual ~JSWindowArrayObject();

    virtual int rightValue( JSObject *_index, JSValue *_rv );

protected:
    int kind;
    JSWindowObject *object;
};

class JSWindowVarObject : public JSVariableObject
{
public:
    JSWindowVarObject( JSWindowObject *_win, int _kind );
    virtual ~JSWindowVarObject();

    virtual JSObject *getValue();
    virtual void setValue( JSObject* _val );
    virtual void clear();

protected:
    int kind;
    JSWindowObject *object;
};

class JSDocumentObject : public JSUserDefinedObject
{
public:
    JSDocumentObject( JSWindowObject *_window );
    virtual ~JSDocumentObject();

    virtual int isA() { return TYPE_JSDocumentObject; }    
    virtual bool inherits( int _type )
    { if ( _type == TYPE_JSDocumentObject ) return TRUE;
    else return JSUserDefinedObject::inherits( _type ); }

    /**
     * Never delete this instance.
     */
    virtual void release() { if ( lock > 1 ) lock--;  }

    JSWindowObject* getJSWindowObject() { return window; }
    
protected:
    JSDocumentWriteFunction *jsDocumentWrite;
    JSWindowObject *window;
};

class JSDocumentWriteFunction : public JSFunction
{
public:
    JSDocumentWriteFunction( JSDocumentObject *_obj );
    virtual ~JSDocumentWriteFunction();
    
    virtual int rightValue( JSScopeStack* _s, JSValue *rv, JSParameterListObject *_param );

protected:
    JSDocumentObject *object;
};

class JSEnvironment
{
public:
    JSEnvironment( KHTMLWidget *_view );
    ~JSEnvironment();
    
    JSCode* parse( const char *_script );
    int exec( JSCode *_code, JSInstanceScope *_scope = 0L );
    
    const char* readOutput() { return output.data(); }
    void writeOutput( const char *_str ) { output += _str; }

    JSWindowObject* getJSWindowObject() { return jsWindowObject; }
    KHTMLWidget* getKHTMLWidget() { return view; }
    KHTMLView* getKHTMLView();
    
protected:
    KHTMLWidget *view;
    JSScope *globalScope;
    
    JSWindowObject *jsWindowObject;

    QString output;
};

#endif

--- NEW FILE: vmlapp.cpp ---
#include "vmlapp.h"
#include <Fl.H>


#ifdef HAVE_RESIZE_WINDOW

void VMLAppWindow::resize_notify(int x, int y, int w, int h) 
{
  cerr << "resize_notify of " << x << " " << y << " " << w << " " << h << "\n";
  if ( g_AppWindow ) {
    g_AppWidth = w;
    g_AppHeight = h;
    
    g_AppWindow->w(w);
    g_AppWindow->h(h);
    if(g_URL)
      g_URL->resize(81, 5, APPWIDTH - 110, 20);
    if(g_Logo)
      g_Logo->resize(APPWIDTH-24, 5, 20, 20);
    g_HTML->setGeometry(SCROLLPAD,TITLEHEIGHT,WIDTH,HEIGHT);
    g_AppWindow->redraw();
  }

}
#endif

static int send(Fl_Widget* o, int event) {
  if (o->type() < FL_WINDOW) return o->handle(event);
  int save_x = Fl::e_x; Fl::e_x -= o->x();
  int save_y = Fl::e_y; Fl::e_y -= o->y();
  int ret = o->handle(event);
  Fl::e_y = save_y;
  Fl::e_x = save_x;
  return ret;
}

int VMLAppWindow::handle(int event)
{
  Fl_Widget*const* a = array();
  int i;
  Fl_Widget * o;
  if(event == FL_RELEASE) {
    for (i = children(); i--;) {
      o = a[i];
      if (o->takesevents() && Fl::event_inside(o)) {
	if (send(o,FL_RELEASE)) {
	  return 1;
	}
      }
    }
  } else {
    return PARENT_WINDOW::handle(event);
  }
}



--- NEW FILE: htmlframe.h ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
#ifndef HTMLFRAME_H
#define HTMLFRAME_H

#include <qwidget.h>
#include <qlist.h>
#include <qframe.h>

class HTMLFramePanner;
class HTMLFrameSet;
class KHTMLView;
class KHTMLWidget;

class HTMLFramePanner : public QFrame
{
    Q_OBJECT
public:
    enum Orientation { HORIZONTAL = 1, VERTICAL = 2 };
    
    HTMLFramePanner( HTMLFramePanner::Orientation _orientation, QWidget *_parent = 0L, const char *_name = 0L );
    ~HTMLFramePanner();
    
    void setChild1( QWidget *_child ) { child1 = _child; }
    void setChild2( QWidget *_child ) { child2 = _child; }    

    void setIsMoveable( bool _move );

protected:
    virtual void mousePressEvent( QMouseEvent *_ev );
    virtual void mouseMoveEvent( QMouseEvent *_ev );
    virtual void mouseReleaseEvent( QMouseEvent *_ev );
    
    QWidget *child1;
    QWidget *child2;

    int initialX;
    int initialY;
    QPoint initialGlobal;
    
    HTMLFramePanner::Orientation orientation;

    bool moveable;
};

/**
 * HTML Frame Set
 * @internal
 */
class HTMLFrameSet : public QWidget
{
    Q_OBJECT
public:
    friend class KHTMLWidget;

    HTMLFrameSet( QWidget *_parent, const char *_src );
    ~HTMLFrameSet();
    
    void append( QWidget *_w );

    virtual void parse();
  
    virtual int calcSize( const char *s, int *size, int _max );

    KHTMLView* getSelectedFrame();

    /**
     * @return TRUE if the user is allowed to resize the frame set.
     *
     * @see #bAllowResize
     */
    bool getAllowResize() { return bAllowResize; }
    /**
     * @return the width of the frames border ( read: @ref HTMLFramePanner ) in pixels
     *         or -1 for the default width.
     */
    int getFrameBorder() { return frameBorder; }
  
protected:
    virtual void resizeEvent( QResizeEvent* _ev );
    
    QList<QWidget> widgetList;

    HTMLFramePanner::Orientation orientation;

    QString cols;
    QString rows;
    
    /**
     * Array that holds the layout information for all embedded frames.
     */
    int *size;
    /**
     * Amount of frames as mentioned in the COLS or ROWS tag.
     */
    int elements;

    /**
     * The amount of frames we parsed until now.
     */
    int cFrames;

    /**
     * The amount of pixels used for the frames border ( read @ref HTMLFramePanner ).
     * A value of -1 indicates the default.
     */
    int frameBorder;
  
    /**
     * This flags is usually TRUE. But if we have the &lt;frame noresize&gt; tag, 
     * this flag is set to FALSE to indicate that the user may not resize this frame set.
     */
    bool bAllowResize;

    /**
     * This is the last panner added to the widgetList. This variable is used
     * during parsing only.
     */
    HTMLFramePanner *lastPanner;
};



#endif




















--- NEW FILE: Makefile.new ---
# Makefile.config
# This is a newer style makefile for the ViewML
# project.  It is my hope that some day
# this will be the offical makefile for the project,
# but for now, we are happy to stay in the background

# See README-CONFIG at the top level for more information
# and instructions

# Jordan Crouse, Century Software, September 2000

include ../makeinclude
include ./.build_depends

VIEWML_BINARY=viewml

OBJS = html.o htmlchain.o htmlclue.o htmldata.o htmlfont.o htmliter.o \
	htmltable.o htmltoken.o jscript.o htmlview.o htmlframe.o htmlobj.o \
	debug.o htmlform.o main.o http.o http_.o vmlapp.o bookmark.o

OTHEROBJS = ../kdecore/kurl.o ../jscript/builtin.o ../jscript/cpp2bison.o \
	../jscript/jsexec.o ../jscript/jstree.o ../jscript/t2.o \
	../jscript/t1.o ../kdeui/kcursor.o fltk/qtimer.o fltk/qobject.o \
	fltk/qpainter.o fltk/qdrawutil.o fltk/qfont.o fltk/qrect.o \
	fltk/qregexp.o fltk/qstring.o fltk/kcharsets.o fltk/qcolor.o \
	fltk/qpixmap.o fltk/qfontinfo.o fltk/qwidget.o fltk/history.o \
	fltk/qscrollbar.o fltk/qpushbutton.o fltk/drag.o fltk/qlineedit.o \
	fltk/nxslider.o fltk/nxscrollbar.o fltk/nxscroll.o

all: $(OBJS) $(OTHEROBJS)
	$(CXX) $(OBJS) $(OTHEROBJS) $(LDFLAGS) -o $(VIEWML_BINARY) $(LIBS)

.build_depends:
	@echo "       ===== Alert =====" 
	@echo "No dependancy file was found for this build"
	@echo "This is OK, but it is not recommended."
	@echo "run make depend at the top level to build"
	@echo "a dependancy file."

.SUFFIXES:	.cpp .h .o

.cpp.o :
	$(CXX) $(INCLUDES) $(CXXFLAGS) -I.. -c -o $@ $<
.c.o :
	$(CC) $(INCLUDES) $(CFLAGS) -I.. -c -o $@ $<

install: all
	if [ ! -d $(INSTALLDIR) ]; then mkdir $(INSTALLDIR); fi
	cp $(VIEWML_BINARY) $(INSTALLDIR)/$(VIEWML_BINARY)

uninstall:
	if [ -f $(INSTALLDIR)/$(VIEWML_BINARY) ]; then \
		rm -rf $(INSTALLDIR)/$(VIEWML_BINARY); \
	fi
 
clean :
	-@ rm -f *.o *.do $(VIEWML_BINARY) $(LIBRARY) 
	-@ rm -f $(CLEAN) core *~ ../include/*~cmap .build_depends
	@ rm -f fltk/*.o
	@ rm -f ../kdecore/*.o	
	@ rm -f ../kdeui/*.o

strip:
	@($(STRIP) $(VIEWML_BINARY))

--- NEW FILE: viewml.xpm ---
/* XPM */
static char * viewml_xpm[] = {
"200 20 92 2",
"  	c None",
". 	c #FFFFFF",
"+ 	c #EC70B7",
"@ 	c #DD007F",
"# 	c #DF1087",
"$ 	c #F29FCF",
"% 	c #FBDFEF",
"& 	c #E850A7",
"* 	c #E6409F",
"= 	c #EA60AF",
"- 	c #FDEFF7",
"; 	c #FBEBBE",
"> 	c #FAE7B1",
", 	c #FCEFCB",
"' 	c #E32C8A",
") 	c #E33097",
"! 	c #F9CFE7",
"~ 	c #EE80BF",
"{ 	c #F2AB9E",
"] 	c #BFE7ED",
"^ 	c #80D0DC",
"/ 	c #ECE9C7",
"( 	c #FEFBF2",
"_ 	c #DFF3F6",
": 	c #6F509C",
"< 	c #A6288D",
"[ 	c #7FCBCF",
"} 	c #B9C786",
"| 	c #79A0C4",
"1 	c #CF0A83",
"2 	c #DE0C7A",
"3 	c #F093A8",
"4 	c #C11486",
"5 	c #7BB0CC",
"6 	c #9FDBE4",
"7 	c #00A0B8",
"8 	c #BEE3E0",
"9 	c #60C4D3",
"0 	c #DEEBDC",
"a 	c #F9DF98",
"b 	c #F7BFDF",
"c 	c #E1208F",
"d 	c #5364A3",
"e 	c #AFE1E9",
"f 	c #EFF9FB",
"g 	c #E2306B",
"h 	c #EE975E",
"i 	c #F4CA57",
"j 	c #AC58A5",
"k 	c #983291",
"l 	c #8FD5E0",
"m 	c #CFEDF2",
"n 	c #F5CE64",
"o 	c #C59ECA",
"p 	c #7370AC",
"q 	c #30B2C5",
"r 	c #70CAD7",
"s 	c #20ACC1",
"t 	c #40B8CA",
"u 	c #F4C64A",
"v 	c #2982AD",
"w 	c #50BECE",
"x 	c #456EA6",
"y 	c #F8DA8B",
"z 	c #F3AFAB",
"A 	c #FDF3D8",
"B 	c #FDF7E5",
"C 	c #EB7B5B",
"D 	c #A9B2D1",
"E 	c #E01875",
"F 	c #F7C7CD",
"G 	c #FAE3D0",
"H 	c #F6D271",
"I 	c #8A3C94",
"J 	c #F4ABCA",
"K 	c #F5C676",
"L 	c #0E96B4",
"M 	c #F3A7BD",
"N 	c #E86364",
"O 	c #10A6BC",
"P 	c #EDEDD4",
"Q 	c #3778AA",
"R 	c #B598C5",
"S 	c #3EB0B0",
"T 	c #8BC19F",
"U 	c #6892A5",
"V 	c #F08FC7",
"W 	c #98ABA1",
"X 	c #F7D67E",
"Y 	c #F9E3A4",
"Z 	c #E96771",
"` 	c #E64B6E",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + @ # $ . . . . . . ",
". . . . . . . . . . . . . . % & * = - . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . $ @ @ @ @ % . . . . . ",
". . . . . . . . . . ; > , , ' @ @ @ = . . . . . . . . . . . ; > , , > ; . . . . . . . . . . . . . . ; > , , > ; . . . . . . . . . . . . . . ; > , , > ; . . . . . . . . . . . . . . ; > , , > ; . . . . . . . . . . . . . . ; > , , > ; . . . . . . . . . . . . . . ; > , , > ; . . . . . . . . . . . . . . ; > , , > ; . . . . . . . . . - = @ ) ! ; > , , > ; . . . . . . . . . . . . . ~ @ @ @ @ { ; . . . . ",
". . . . ] ^ ^ ^ / > ( . _ ^ : : < @ * . . . . . ] ^ ^ ^ / > ( . _ ^ ^ [ } . . . . . . . ] ^ ^ ^ / > ( . _ ^ ^ [ } . . . . . . . ] ^ ^ ^ / > ( . _ ^ ^ [ } . . . . . . . ] ^ ^ ^ / > ( . _ ^ ^ [ } . . . . . . . ] ^ ^ ^ / > ( . _ ^ ^ [ } . . . . . . . ] ^ ^ ^ / > ( . _ ^ ^ [ } . . . . . . . ] ^ ^ ^ / > ( . _ ^ ^ [ } . . . . . . . ] | : : 1 2 ( . _ ^ ^ [ } . . . . . . . ] ^ ^ ^ / 3 @ @ 4 : 5 [ } . . . ",
". . . . 6 7 7 7 8 . . . 9 7 7 7 4 @ & . . . . . 6 7 7 7 8 . . . 9 7 7 7 0 a . . . . . . 6 7 7 7 8 . . . 9 7 7 7 0 a . . . . . . 6 7 7 7 8 . . . 9 7 7 7 0 a . . . . . . 6 7 7 7 8 . . . 9 7 7 7 0 a . . . . . . 6 7 7 7 8 . . . 9 7 7 7 0 a . . . . . . 6 7 7 7 8 . . . 9 7 7 7 0 a . . . . . . 6 7 7 7 8 . . . 9 7 7 7 0 a . . . . . . 6 7 7 7 < @ b . 9 7 7 7 0 a . . . . . . 6 7 7 7 8 . ~ c d 7 7 7 0 a . . ",
". . . . ] 7 7 7 e . . f 7 7 7 d @ g % . . . . . ] 7 7 7 e . . f 7 7 7 9 % h % . . . . . ] 7 7 7 e . . f 7 7 7 9 . i . . . . . . ] 7 7 7 e . . f 7 7 7 9 . i . . . . . . ] 7 7 7 e . . f 7 7 7 9 . i . . . . . . ] 7 7 7 e . . f 7 7 7 9 . i . . . . . . ] 7 7 7 e . . f 7 7 7 9 . i . . . . - ~ j 7 7 7 e . . f 7 7 7 9 . i . . . . . . ] 7 7 7 k # . f 7 7 7 9 . i . . . . . . ] 7 7 7 e . . f 7 7 7 9 . i . . ",
". . . . ( 7 7 7 ^ . . l 7 7 7 m . n . . . . . . ( 7 7 7 ^ . . l 7 7 7 o @ @ @ $ . . . . ( 7 7 7 ^ . . l 7 7 7 m . n . . . . . . ( 7 7 7 ^ . . l 7 7 7 m . n . . . . . . ( 7 7 7 ^ . . l 7 7 7 m . n . . . . . . ( 7 7 7 ^ . . l 7 7 7 m . n . . . . . . ( 7 7 7 ^ . . l 7 7 7 m . n . . . . * @ @ 7 7 7 ^ . . l 7 7 7 m . n . . . . . . ( 7 7 7 p ! . l 7 7 7 m . n . . . . . . ( 7 7 7 ^ . . l 7 7 7 m . n . . ",
". . . . > q 7 7 r . . s 7 7 t . . u . . . . . . > q 7 7 r . . s 7 7 t c @ @ @ # . . . . > q 7 7 r . . s 7 7 t . . u . . . . . . > q 7 7 r . . s 7 7 t . . u . . . . . . > q 7 7 r . . s 7 7 t . . u . . . . . . > q 7 7 r . . s 7 7 t . . u . . . . . . > q 7 7 r . . s 7 7 t . . u . . . . @ @ @ v 7 7 r . . s 7 7 t . . u . . . . . . > q 7 7 r . . s 7 7 t . . u . . . . . . > q 7 7 r . . s 7 7 t . . u . . ",
". . . , , w 7 7 t . ] 7 7 7 ] . ( i . . . . . , , w 7 7 t . ] 7 7 7 ] # @ @ @ # . . . , , w 7 7 t . ] 7 7 7 ] . ( i . . . . . , , w 7 7 t . ] 7 7 7 ] . ( i . . . . . , , w 7 7 t . ] 7 7 7 ] . ( i . . . . . , , w 7 7 t . ] 7 7 7 ] . ( i . . . . . , , w 7 7 t . ] 7 7 7 ] . ( i . . . . # @ @ x 7 7 t . ] 7 7 7 ] . ( i . . . . . , , w 7 7 t . ] 7 7 7 ] . ( i . . . . . , , w 7 7 t . ] 7 7 7 ] . ( i . . ",
". . . > . ^ 7 7 q . 9 7 7 t . . > y . . . . . > . ^ 7 7 q . 9 7 7 t . + @ @ @ + . . . > . ^ 7 7 q . 9 7 7 t . . > y . . . . . > . ^ 7 7 q . 9 7 7 t . . > y . . . . . > . ^ 7 7 q . 9 7 7 t . . > y . . . . . > . ^ 7 7 q . 9 7 7 t . . > y . . . b ~ z . ^ 7 7 q . 9 7 7 t . . > y . . . . $ @ @ : 7 7 q . 9 7 7 t . . > y . . . . . > . ^ 7 7 q . 9 7 7 t . . > y . . . . . > . ^ 7 7 q . 9 7 7 t . . > y . . ",
". . , A . e 7 7 7 f 7 7 7 e . . u B . . . . , A . e 7 7 7 f 7 7 7 e . . C ~ $ . . . , A . e 7 7 7 f 7 7 7 D c @ E F . . . . , A . e 7 7 7 f 7 7 7 e . . u B . . . . , A . e 7 7 7 f 7 7 7 e . . u B . . . . , A . e 7 7 7 f 7 7 7 e . . u B . . $ @ @ @ ~ e 7 7 7 f 7 7 7 e . . u B . . . . , G b e 7 7 7 f 7 7 7 e . . u B . . . . , A . e 7 7 7 f 7 7 7 e . . u B . . . . , A . e 7 7 7 f 7 7 7 e . . u B . . ",
". . a . . _ 7 7 7 l 7 7 s . . > y . . . . . a . . _ 7 7 7 l 7 7 s . . > y . . . . . a . . _ 7 7 7 l 7 7 s ) @ @ @ ) . . . . a . . _ 7 7 7 l 7 7 s . . > y . . . . . a . . _ 7 7 7 l 7 7 s . . > y . . . . . a . . _ 7 7 7 l 7 7 s . . > y . . . c @ @ @ # _ 7 7 7 l 7 7 s . . > y . . . . . a . . _ 7 7 7 l 7 7 s . . > y . . . . . a . . _ 7 7 7 l 7 7 s . . > y . . . . . a . . _ 7 7 7 l 7 7 s . . > y . . . ",
". . H . . . 7 7 7 7 7 7 6 . B n ( . . . . . H . . . 7 7 7 7 7 7 6 . B n ( . . . . . H . . . 7 7 7 7 7 7 6 @ @ @ @ @ . . . . H . . . 7 7 7 7 7 7 6 . B n ( . . . . . H . . . 7 7 7 7 7 7 6 . B n ( . . . . . H . . . 7 7 7 7 7 7 6 . B n ( . . . c @ @ @ # . 7 7 7 7 7 7 6 . B n ( . . . . . H . . . 7 7 7 7 7 7 6 . B n ( . . . . . H . . . 7 7 7 7 7 7 6 . B n ( . . . . . H . . . 7 7 7 7 7 7 6 . B n ( . . . ",
". . n . . . t 7 7 7 7 s . ( n B . . . . . . n . . . t 7 7 7 7 s . ( n B . . . . . . n . . . t 7 7 7 7 s . & @ @ @ & . . . . n . . . t 7 7 7 v I * J n B . . . . . . n . . . t 7 7 7 7 s . ( n B . . . . . . n . . . t 7 7 7 7 s . ( n B . . . . $ @ @ @ ~ . t 7 7 7 7 s . ( n B . . . . . . n . . . t 7 7 7 7 s . ( n B . . . . . . n . . . t 7 7 7 7 s . ( n B . . . . . . n . . . t 7 7 7 7 s . ( n B . . . . ",
". . i . . . r 7 7 7 7 l ( H A . . . . . . . i . . . r 7 7 7 7 l ( H A . . . . . . . i . . . r 7 7 7 7 l ( K = * = - . . . . i . . . r 7 7 L 1 @ @ @ M . . . . . . . i . . . r 7 7 7 7 l ( H A . . . . . . ! E @ * - r 7 7 7 7 l ( H A . . . . . . ! N b . . r 7 7 7 7 l ( H A . . . . . . . i . . . r 7 7 7 7 l ( H A . . . . . . . i . . . r 7 7 7 7 l ( H A . . . . . . . i . . . r 7 7 7 7 l ( H A . . . . . ",
". . H ; . . l 7 7 7 O P y ( . . . . . . . . H ; . . l 7 7 7 O P y ( . . . . . . . . H ; . . l 7 7 7 O P y ( . . . . . . . . H ; . . l 7 7 Q @ @ @ @ ~ . . . . . . . H ; . . R < < Q O P y ( . . . . . . . c @ @ @ & l 7 7 7 O P y ( . . . . . . . . H ; . . l 7 7 7 O P y ( . . . . . . . . H ; . . l 7 7 7 O P y ( . . . . . . . . H ; . . l 7 7 7 O P y ( . . . . . . . . H ; . . l 7 7 7 O P y ( . . . . . . ",
". . B u ; . m t t S T > . . . . . . . . . . B u ; . m t t S T > . . . . . . . . . . B u ; . m t t S T > . . . . . . . . . . B u ; . m t t U @ @ @ @ V . . . . . . . B u ; b @ @ @ @ W > . . . . . . . . . @ @ @ @ * m t t S T > . . . . . . . . . . B u ; . m t t S T > . . . . . . . . . . B u ; . m t t S T > . . . . . . . . . . B u ; . m t t S T > . . . . . . . . . . B u ; . m t t S T > . . . . . . . . ",
". . . B X n H y Y ; . . . . . . . . . . . . . B X n H y Y ; . . . . . . . . . . . . . B X n H y Y ; . . . . . . . . . . . . . B X n H y Y ; + @ @ ) - . . . . . . . . B X Z @ @ @ @ b . . . . . . . . . . c @ @ @ ` H y Y ; . . . . . . . . . . . . . B X n H y Y ; . . . . . . . . . . . . . B X n H y Y ; . . . . . . . . . . . . . B X n H y Y ; . . . . . . . . . . . . . B X n H y Y ; . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - ! . . . . . . . . . . . . $ @ @ @ @ ! . . . . . . . . . . ! & * = - . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + @ @ + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "};

--- NEW FILE: htmlframe.moc ---
/****************************************************************************
** HTMLFramePanner meta object code from reading C++ file 'htmlframe.h'
**
** Created: Mon Jul 10 16:24:53 2000
**      by: The Qt Meta Object Compiler ($Revision: 1.1 $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#if !defined(Q_MOC_OUTPUT_REVISION)
#define Q_MOC_OUTPUT_REVISION 2
#elif Q_MOC_OUTPUT_REVISION != 2
#error "Moc format conflict - please regenerate all moc files"
#endif

#include "htmlframe.h"
#include <qmetaobject.h>


const char *HTMLFramePanner::className() const
{
    return "HTMLFramePanner";
}

QMetaObject *HTMLFramePanner::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLFramePanner(&HTMLFramePanner::staticMetaObject);

#endif

void HTMLFramePanner::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(QFrame::className(), "QFrame") != 0 )
	badSuperclassWarning("HTMLFramePanner","QFrame");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLFramePanner::staticMetaObject()
{
    if ( metaObj )
	return;
    QFrame::staticMetaObject();
#else

    QFrame::initMetaObject();
#endif

    metaObj = new QMetaObject( "HTMLFramePanner", "QFrame",
	0, 0,
	0, 0 );
}


const char *HTMLFrameSet::className() const
{
    return "HTMLFrameSet";
}

QMetaObject *HTMLFrameSet::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLFrameSet(&HTMLFrameSet::staticMetaObject);

#endif

void HTMLFrameSet::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(QWidget::className(), "QWidget") != 0 )
	badSuperclassWarning("HTMLFrameSet","QWidget");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLFrameSet::staticMetaObject()
{
    if ( metaObj )
	return;
    QWidget::staticMetaObject();
#else

    QWidget::initMetaObject();
#endif

    metaObj = new QMetaObject( "HTMLFrameSet", "QWidget",
	0, 0,
	0, 0 );
}

--- NEW FILE: html.h ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
[...1643 lines suppressed...]
    JSEnvironment *jsEnvironment;      
    KCharsetConverter *charsetConverter;

    /*
     * Iterator used to find text within the document
     */
    HTMLIterator *textFindIter;

    /**
     * Keeps a list of all pending file.
     */
    QDict<HTMLPendingFile> mapPendingFiles;

    QPixmap scrollBlobPixmap;
    QWidget *scrollBlob;
    QTimer *scrollBlobTimer;
    enum ScrollType scrollBlobType;
};

#endif // HTML

--- NEW FILE: khtmlw_dnd.xpm ---
/* XPM */
static char * book_xpm[] = {
"16 16 5 1",
" 	c None",
"A	c #FFFFFFFFFFFF",
".	c #000082078207",
"X	c #82077DF77DF7",
"o	c #FFFFFFFFFFFF",
"                ",
"                ",
"       ..       ",
"     .....      ",
"   ........     ",
" Xo.........    ",
" AXo.........   ",
" .AXo.........  ",
" ..AXo........  ",
" ...AXo.....AAX ",
"  ...AXo..AAooX ",
"   ...AXAAoooX  ",
"    ..AAoooX    ",
"     .AXoX      ",
"       X        ",
"                "};

--- NEW FILE: http_.cpp ---
#include "http.h"
#include <Fl.H>
#include "html.h"

////////////////////////////////////////////////////////////

static void _CheckData(void * pt)
{
  HTTPConnection * pThis = (HTTPConnection*)pt;
  HTTPConnection::HTTPRequest * p = pThis->GetFinished();

  while(p) {
    if(!p->toss()) {
      if(p->newPage()) {

		  // For some reason, not all of the items on the mapPendingFiles queue
		  // are cleared when a new page is requested.  On a new page, all items are
		  // cleared
		  p->HTML()->cancelAllRequests();
		  p->HTML()->getKHTMLWidget()->ClrTitle();
	p->HTML()->begin(p->getURL());
	
	p->HTML()->write((const char*)p->getBuffer());
	
	p->HTML()->end();
	p->HTML()->parse();
	
	p->HTML()->redraw();
	
      } else {

	p->HTML()->data(p->getURL(), (const char *)p->getBuffer(), 
			p->getSize(), true);
      }
    }
    delete p;
    p = pThis->GetFinished();
  }
  
  if(!pThis->m_bDocDone) {
    Fl::add_timeout(.5, _CheckData, pt);
  }
}

void _HaveData(HTTPConnection::HTTPRequest * p)
{
  p->HTML()->data(p->getURL(), 0,0, true);
}

void HTTPConnection::slotClick(KHTMLView * v, const char * d1, int b, const char * p)
{

  if(p && p[0]) {
    KHTMLView * v1 = v->findView((const char *)p);
    if(v1)
      v = v1;
  }

  loadPage(v,d1);

  if(m_pDocCallback)
    m_pDocCallback(d1,0,0);

  m_bDocDone = false;
  StartThread();
}

void HTTPConnection::BeginDataTimer()
{
  Fl::add_timeout(.5, _CheckData, (void*)this);
}

void HTTPConnection::do_size()
{
  //  printf("docSize: x=%d y=%d\n",m_pHTML->docWidth(),
  //	 m_pHTML->docHeight());

  //  if(m_pDocCallback)
  //    m_pDocCallback(0,m_pHTML->docWidth(), m_pHTML->docHeight());
}

////////////////////////////////////////////////////////////


--- NEW FILE: htmlframe.cpp ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
#include "htmlframe.h"
#include "html.h"
#include "htmlview.h"

#include <kcursor.h>

#include <strings.h>
#include <stdlib.h>

// stuck in here to get rid of some debug information ... jsk

#undef debug
#define debug(args...) ;

HTMLFrameSet::HTMLFrameSet( QWidget *_parent, const char *_src )
    : QWidget( _parent )
{
    lastPanner = 0L;
    
    frameBorder = 1;
    bAllowResize = TRUE;
    
    widgetList.setAutoDelete( TRUE );
    
    size = 0L;
    cFrames = 0;
    
    QString s = _src + 9;
    StringTokenizer st;
    st.tokenize( s, " >" );
    while ( st.hasMoreTokens() )
    {
	const char* token = st.nextToken();
	if ( strncasecmp( token, "COLS=", 5 ) == 0 )
	{
	    cols = token + 5;
	}
	else if ( strncasecmp( token, "ROWS=", 5 ) == 0 )
	{
	    rows = token + 5;
	}
	else if ( strncasecmp( token, "FRAMEBORDER=", 12 ) == 0 )
	{
	    frameBorder = atoi( token + 12 );
	}
	else if ( strncasecmp( token, "NORESIZE", 8 ) == 0 )
	{
            bAllowResize = FALSE;
	}
    }

    if ( !cols.isNull() )
	orientation = HTMLFramePanner::VERTICAL;
    else
	orientation = HTMLFramePanner::HORIZONTAL;

    // Calculate amount of frames
    elements = 1;
    char *p = "";
    if ( !cols.isNull() )
	p = (char*)cols.data();
    else if ( !rows.isNull() )
	p = (char*)rows.data();
    while ( ( p = strchr( p, ',' ) ) != 0 ) { p++; elements++; }
 
    size = new int[ elements ];   
}

HTMLFrameSet::~HTMLFrameSet()
{
    widgetList.clear();
    if ( size )
	delete []size;
}

void HTMLFrameSet::append( QWidget *_w )
{
    // Add the 2. child of the last panner if there is one.
    if ( lastPanner != 0L )
    {
	lastPanner->setChild2( _w );
	lastPanner = 0L;
    }
    
    // Increase the number of processed frames
    cFrames++;  

    widgetList.append( _w );   
    
    int frameborder = -1;
    bool allowresize = TRUE;
    
    if ( _w->inherits( "KHTMLView" ) )
    {
	KHTMLView *v = (KHTMLView*)_w;
	allowresize = v->allowResize();
	frameborder = v->getFrameBorder();
    }
    else if ( _w->inherits( "HTMLFrameSet" ) )
    {      
	HTMLFrameSet *f = (HTMLFrameSet*)_w;
	allowresize = f->getAllowResize();
	frameborder = f->getFrameBorder();
    }
    else
	return;
  
    if ( cFrames < elements && frameborder != 0 )
    {
	HTMLFramePanner *panner = new HTMLFramePanner( orientation, this );
	if ( !allowresize )
	{
	    panner->setIsMoveable( FALSE );
	}
	
	panner->setChild1( _w );
	widgetList.append( panner );
	panner->show();
	lastPanner = panner;
    }
    else
    {
	show();
	resizeEvent( 0 );
    }
    
    _w->show();
}

void HTMLFrameSet::parse()
{
  resizeEvent( 0L );
  
  /*  QWidget *w = 0L;
  for ( w = widgetList.first(); w != 0L; w = widgetList.next() )
  {
    w->show();
  } */
}

void HTMLFrameSet::resizeEvent( QResizeEvent* )
{
    if ( !isVisible() )
	return;      

    if ( !cols.isNull() )
    {
	elements = calcSize( cols.data(), size, width() );
    }
    else if ( !rows.isNull() )
    {
	elements = calcSize( rows.data(), size, height() );
    }

    int j = 0;
    int i = 0;
    int pannerSize = frameBorder > 0 ? 5 : 0;
    QWidget *w;
    QWidget* next;
    for ( w = widgetList.first(); w != 0L; w = next )
    {
	next = widgetList.next();
	
	if ( orientation == HTMLFramePanner::HORIZONTAL )
	{
	    if ( w->isA( "HTMLFramePanner" ) )
	    {
		w->setGeometry( 0, j, width(), pannerSize );
		j += pannerSize;
	    }
	    else
	    {
		if ( next && next->isA( "HTMLFramePanner" ) )
		    size[i] -= pannerSize;
		w->setGeometry( 0, j, width(), size[ i ] );
		j += size[ i ];
		i++;
	    }
	}
	else
	{
	    if ( w->isA( "HTMLFramePanner" ) )
	    {
		w->setGeometry( j, 0, pannerSize, height() );
		j += pannerSize;
	    }
	    else
	    {
		if ( next && next->isA( "HTMLFramePanner" ) )
		    size[i] -= pannerSize;
		w->setGeometry( j, 0, size[ i ], height() );
		j += size[ i ];
		i++;	
	    }
	}
    }
    debug("Done Set");
}

int HTMLFrameSet::calcSize( const char *_str, int *size, int _max )
{	
    debug("Calculating size");
  
    int value[1024];
    int mode[1024];
    int i = 0;
    
    QString s = _str;
    StringTokenizer st;
    st.tokenize( s, "," );
    while ( st.hasMoreTokens() )
    {
	if ( i == 1024 )
	    return i;
	
	const char* token = st.nextToken();
	if ( token[0] != 0 )
	{
	    //printf("WIDTH='%s'\n",token);
	    value[i] = atoi( token );
	    if ( strchr( token, '%' ) != 0 )
	    {
		mode[i] = 1;
		value[i] = ( value[i] * _max ) / 100;
	    }
	    else if ( strchr( token, '*' ) != 0 )
	    {
		if ( value[i] == 0 )
		    value[i] = 1;
		mode[i] = 2;
	    }
	    else
		mode[i] = 0;
	    
	    i++;
	}
    }

    debug("*************** CALC SIZE elements = %i ******************",i);
    
    debug("max. width=%i   max. height=%i",width(),height() );

    bool joker = FALSE;
    
    int s1 = 0;
    for ( int j = 0; j < i; j++ )
    {
	if ( mode[j] == 0 || mode[j] == 1 )
	    s1 += value[j];
	else if ( mode[j] == 2 )
	    joker = TRUE;
    }
    
    //printf("s1 = %i\n", s1);
    int k;
    if ( s1 <= _max && !joker )
    {
        if (!s1)
            s1 = 1;
	for ( k = 0; k < i; k++ )
	{
	    size[k] = ( value[k] * _max ) / s1;
	    //printf("%i %i %i -> %i\n",value[k],_max,s1,size[k] );
	}

	// Calculate the error
	int s2 = 0;
	for ( k = 0; k < i; k++ )
	{
	    s2 += size[k];
	}
	//printf("Error is %i\n",_max - s2);
	// Add the error to the last frame
	size[ i - 1 ] += _max - s2;
    }
    else if ( s1 <= _max && joker )
    {
	int s2 = 0;
	int s3 = 0;
	for ( k = 0; k < i; k++ )
	{
	    if ( mode[k] == 0 || mode[k] == 1 )
	    {
		size[k] = value[k];
		s2 += value[k];
	    }
	    else
		s3 += value[k];
	}
	for ( k = 0; k < i; k++ )
	{
	    if ( mode[k] == 2 )
		size[k] = ( _max - s2 ) * value[k] / s3;
	}
    }
    else
    {
	for ( k = 0; k < i; k++ )
	{
	    if ( mode[k] == 0 || mode[k] == 1 )
	    {
		size[k] = value[k] * _max / s1;
	    }
	    else
		size[k] = 50;
	}

	// Calculate the error
	int s2 = 0;
	for ( k = 0; k < i; k++ )
	{
	    if ( mode[k] == 0 || mode[k] == 1 )
		s2 += size[k];
	}
	//printf("Error is %i\n",_max - s2);
	// Add the error to the last frame
	size[ i - 1 ] += _max - s2;	
    }

//    for ( k = 0; k < i; k++ )
	//printf("SIZE=%i\n",size[k]);
	
    return i;
}

KHTMLView* HTMLFrameSet::getSelectedFrame()
{
  //printf(">>>>>>>>>>>>>>>>>>>>>>>>>>> Frame 1 <<<<<<<<<<<<<<<<<<<<<<<<\n");
    QWidget *w;
    for ( w = widgetList.first(); w != 0L; w = widgetList.next() )
    {
      //printf(">>>>>>>>>>>>>>>>>>>>>>>>>>> Frame 2 '%s'<<<<<<<<<<<<<<<<<<<<<<<<\n",w->className());
      if ( w->inherits( "KHTMLView" ) )
      {
	//printf(">>>>>>>>>>>>>>>>>>>>>>>>>>> Frame 3 <<<<<<<<<<<<<<<<<<<<<<<<\n");
	KHTMLView *v = (KHTMLView*)w;
	KHTMLView *ret = v->getSelectedView();
	if ( ret )
	  return ret;
      }
    }
    
    //printf(">>>>>>>>>>>>>>>>>>>>>>>>>>> Frame 4 <<<<<<<<<<<<<<<<<<<<<<<<\n");
    return 0L;
}

HTMLFramePanner::HTMLFramePanner( HTMLFramePanner::Orientation _orientation, QWidget *_parent, const char *_name ) :
    QFrame( _parent, _name )
{
    setFrameStyle(QFrame::Panel | QFrame::Raised);
    setLineWidth(1);

    child1 = 0L;
    child2 = 0L;
    orientation = _orientation;

    if ( orientation == HTMLFramePanner::HORIZONTAL )
      setCursor( KCursor::sizeVerCursor() );
    else
      setCursor( KCursor::sizeHorCursor() );
    
    moveable = TRUE;
}

HTMLFramePanner::~HTMLFramePanner()
{
}

void HTMLFramePanner::setIsMoveable( bool _move )
{
  moveable = _move;
  if ( !moveable )
    setCursor( KCursor::arrowCursor() );
  else if ( orientation == HTMLFramePanner::HORIZONTAL )
    setCursor( KCursor::sizeVerCursor() );
  else
    setCursor( KCursor::sizeHorCursor() );
}

void HTMLFramePanner::mousePressEvent( QMouseEvent *_ev )
{   
    if ( !moveable )
        return;
    
    if ( child1 == 0L || child2 == 0L )
	return;
    
    raise();
    
    grabMouse();
    
    initialX = x();
    initialY = y();
    initialGlobal = mapToGlobal( _ev->pos() );
}

void HTMLFramePanner::mouseMoveEvent( QMouseEvent *_ev )
{
    if ( !moveable )
        return;
    
    if ( child1 == 0L || child2 == 0L )
	return;

    if ( orientation == HTMLFramePanner::HORIZONTAL )
    {
	QPoint p = mapToGlobal( _ev->pos() );
	QPoint p2 = child1->mapToGlobal( QPoint( 0, 0 + 10 ) );
	QPoint p3 = child2->mapToGlobal( QPoint( 0, child2->height() - 10 - 5 ) );
	int pos = p.y();
	if ( pos < p2.y() )
	    pos = p2.y();
	else if ( pos > p3.y() )
	    pos = p3.y();

	move( initialX, initialY + ( pos - initialGlobal.y() ) );
    }
    else
    {
	QPoint p = mapToGlobal( _ev->pos() );
	QPoint p2 = child1->mapToGlobal( QPoint( 0 + 10, 0 ) );
	QPoint p3 = child2->mapToGlobal( QPoint( child2->width() - 10 - 5 , 0 ) );
	int pos = p.x();
	if ( pos < p2.x() )
	    pos = p2.x();
	else if ( pos > p3.x() )
	    pos = p3.x();

	move( initialX + ( pos - initialGlobal.x() ), initialY );
    }
}

void HTMLFramePanner::mouseReleaseEvent( QMouseEvent * )
{
    if ( !moveable )
        return;

    if ( child1 == 0L || child2 == 0L )
	return;
    
    releaseMouse();

    if ( orientation == HTMLFramePanner::HORIZONTAL )
    {
	child1->setGeometry( child1->x(), child1->y(), child1->width(), y() - child1->y() );
	
	child2->setGeometry( child2->x(), y() + 5, child2->width(),
			     child2->y() + child2->height() - ( y() + 5 ) );
    }
    else
    {
	child1->setGeometry( child1->x(), child1->y(), x() - child1->x(), child1->height() );
	
	child2->setGeometry( x() + 5, child2->y(), child2->x() + child2->width() - ( x() + 5 ),
			     child2->height() );
    }

    raise();
}

#include "htmlframe.moc"


--- NEW FILE: htmlform.h ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
//----------------------------------------------------------------------------
// khtml widget - forms
//
//

#ifndef __HTMLFORM_H__
#define __HTMLFORM_H__

class HTMLElement;
class HTMLForm;
class HTMLSelect;
class HTMLButton;
class HTMLTextArea;

#include <qwidget.h>
#include <qtimer.h>

#include "htmlobj.h"

class HTMLForm;

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

class HTMLElement
{
public:
	HTMLElement( const char *n )
		{ _name = n; form = 0; }
	virtual ~HTMLElement();

	const QString &elementName() const
		{	return _name; }
	void setElementName( const char *n )
		{	_name = n; }

	void setForm( HTMLForm *f )
		{	form = f; }

	// This function places the element on the page using the
	// absolute coordinates.  Also responsible for showing/hiding
	// non-visible elements
	virtual void position( int /*_x*/, int /*_y*/,
			       int /*_width*/, int /*_height*/ ) {}

	virtual bool positionChanged( int /*_x*/, int /*_y*/,
			       int /*_width*/, int /*_height*/ ) { return true; }

	virtual QString encoding()
		{	return QString( "" ); }

	virtual void calcAbsolutePos( int , int ) {}

	virtual void resetElement() { }

    virtual void hideElement() {}

protected:
	// encode special characters
	QString encodeString( const QString &e );

protected:
	QString _encoding;

private:
	QString _name;

	HTMLForm *form;
};

class HTMLWidgetElement : public QObject, public HTMLObject, public HTMLElement
{
	Q_OBJECT
public:
	HTMLWidgetElement( const char *n, const HTMLFont *f = 0 ) 
	     : HTMLElement( n )
	    { _absX = 0; _absY = 0; widget = 0; font = f; }
	virtual ~HTMLWidgetElement();

	int absX() const
		{	return _absX; }
	int absY() const
		{	return _absY; }

	// This function places the element on the page using the
	// absolute coordinates.  Also responsible for showing/hiding
	// non-visible elements
	virtual void position( int _x, int _y, int _width, int _height );
	virtual bool positionChanged( int _x, int _y, int _width, int _height );

	virtual void calcAbsolutePos( int _x, int _y );

    virtual void hideElement();

protected:
	QWidget *widget;
	const HTMLFont *font;

private:
	// absolute position of this element in the page
	int _absX;
	int _absY;
};

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

class HTMLSelect : public HTMLWidgetElement
{
	Q_OBJECT
public:
	HTMLSelect( QWidget *parent, const char *n, int s, bool m,
		    const HTMLFont *f = 0 );
	virtual ~HTMLSelect() { }

	void addOption( const char *o, bool sel );

	// set text for current option
	void setText( const char *text );

	const QString &value()
		{	return *_values.at( _item ); }
	const QString &value( int item );
	void setValue( const char *v, int item );

	virtual QString encoding();
	virtual void resetElement();

protected slots:
	void slotHighlighted( int indx );

private:
	int _defSelected;
	int _size;
	QList<QString> _values;
	int _item;
};

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

class HTMLTextArea : public HTMLWidgetElement
{
	Q_OBJECT
public:
	HTMLTextArea( QWidget *parent, const char *n, int r, int c,
		      const HTMLFont *f = 0 );
	virtual ~HTMLTextArea() { }

	QString value();
	void setText( const char *t );

	virtual QString encoding();
	virtual void resetElement();

private:
	QString _defText;
};

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

class HTMLInput : public HTMLWidgetElement
{
	Q_OBJECT
public:
	HTMLInput( const char *n, const char *v, const HTMLFont *f = 0 );
	virtual ~HTMLInput() { }

	const QString &value() const
		{	return _value; }
	void setValue( const char *v )
		{	_value = v; }

private:
	QString   _value;
};

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

class HTMLCheckBox : public HTMLInput
{
	Q_OBJECT
public:
	HTMLCheckBox( QWidget *parent, const char *n, const char *v, bool ch,
		      const HTMLFont *f = 0 );
	virtual ~HTMLCheckBox() { }

	virtual QString encoding();
	virtual void resetElement();

private:
	bool _defCheck;
};

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

class HTMLHidden : public HTMLInput
{
	Q_OBJECT
public:
	HTMLHidden( const char *n, const char *v );
	virtual ~HTMLHidden() { }

	virtual QString encoding();
};

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

class HTMLRadio : public HTMLInput
{
	Q_OBJECT
public:
	HTMLRadio( QWidget *parent, const char *n, const char *v, bool ch,
		   const HTMLFont *f = 0 );
	virtual ~HTMLRadio() { }

	virtual QString encoding();
	virtual void resetElement();

public slots:
	void slotRadioSelected( const char *n, const char *v );

signals:
	void radioSelected( const char *n, const char *v );

protected slots:
	void slotClicked();

private:
	bool _defCheck;
};

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

class HTMLReset : public HTMLInput
{
	Q_OBJECT
public:
	HTMLReset( QWidget *parent, const char *v, const HTMLFont *f = 0 );
	virtual ~HTMLReset() { }

protected slots:
	void slotClicked();

signals:
	void resetForm();
};

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

class HTMLSubmit : public HTMLInput
{
	Q_OBJECT
public:
	HTMLSubmit( QWidget *parent, const char *n, const char *v,
		    const HTMLFont *f = 0 );
	virtual ~HTMLSubmit() { }

	virtual QString encoding();

protected slots:
	void slotClicked();

signals:
	void submitForm();

private:
	bool activated;
};

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

class HTMLTextInput : public HTMLInput
{
	Q_OBJECT
public:
	HTMLTextInput( QWidget *parent, const char *n, const char *v, int s,
		    int ml, bool password = false, const HTMLFont *f = 0 );
	virtual ~HTMLTextInput() { }

	virtual QString encoding();
	virtual void resetElement();

protected slots:
	void slotTextChanged( const char * );
	void slotReturnPressed();

signals:
	void submitForm();

private:
	QString _defText;
};

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

class HTMLImageInput : public HTMLImage, public HTMLElement
{
    Q_OBJECT
public:
    HTMLImageInput( KHTMLWidget *widget, const char *, int mw, const char *n );
    virtual ~HTMLImageInput() {}

    virtual QString encoding();

    virtual HTMLObject *mouseEvent( int, int, int, int );

signals:
    void submitForm();

private:
    int  _xp;
    int  _yp;
    bool pressed;
    bool activated;
};

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

class HTMLForm : public QObject
{
	Q_OBJECT
public:
	HTMLForm( const char *a, const char *m );
	virtual ~HTMLForm();

	void addElement( HTMLElement *e );
	// We keep hidden elements here, not in HTMLObject hierarchy
	void addHidden( HTMLHidden *he );
	void removeElement( HTMLElement *e );

	const char *method() const
		{	return _method; }
	const char *action() const
		{	return _action; }

	void position( int _x, int _y, int _width, int _height );

public slots:
	void slotReset();
	void slotSubmit();
	void slotRadioSelected( const char *n, const char *v );

protected slots:
    void slotTimeout();

signals:
	void submitted( const char *method, const char *url, const char *data );
	void radioSelected( const char *n, const char *v );

private:
	QString _method;
	QString _action;

	QList<HTMLElement> elements;
	QList<HTMLHidden>  hidden;

    QTimer *timer;
    int dx;
    int dy;
    int width;
    int height;
};

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

#include "jscript.h"

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

class HTMLButton : public HTMLInput
{
    Q_OBJECT
public:
    HTMLButton( KHTMLWidget *_parent, const char *_name, const char *v, 
		QList<JSEventHandler> *_handlers, const HTMLFont *f = 0 );
    virtual ~HTMLButton();
    
protected slots:
    void slotClicked();
    
protected:
    KHTMLWidget *view;
    QList<JSEventHandler> *eventHandlers;
};

#endif


--- NEW FILE: html.cpp ---
  /* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
[...6659 lines suppressed...]
    isFrameSet = false;
    url = 0;
    xOffset = yOffset = 0;
    frameLayout = 0;
    frames = 0;
}

SavedPage::~SavedPage()
{
    if( frameLayout ) delete frameLayout;
    if( frames ) delete frames;
}

void KHTMLWidget::registerFormats()
{
        // all formats kimgio has. This includes jpeg and png...
  //	kimgioRegister();
}

#include "html.moc"

--- NEW FILE: demo.html ---
<html>

<head>
<title>Greg Haerr's Microwindows and NanoGUI Page</title>
</head>

<body BGCOLOR="#ffffff">

<table border="0" cellpadding="4" cellspacing="10">
  <tr>
    <td valign="top"><img border="0" src="images/cat.gif" WIDTH="85" HEIGHT="41"> </td>
    <td><h1 align="center">The Microwindows Project</h1>
    </td>
  </tr>
  <tr>
    <td valign="top"><!--left-column contents --> <p><b>Downloads</b> <br>
    <a href="ftp://microwindows.censoft.com/pub/microwindows/">Source&nbsp;Code</a> <br>
    <a href="ftp://microwindows.censoft.com/pub/microwindows/ScreenShots">Screen&nbsp;Shots</a>
    <br>
[...983 lines suppressed...]
      <li>added experimental multi-rectangle dynamically allocated regions </li>
      <li>wrote scrolling terminal emulator demo for microwindows </li>
      <li>added WM_FDINPUT msg, WndRegisterFdInput call for terminal emulator </li>
      <li>changed SCREENINFO struct, removed black/white, added bpp, planes </li>
      <li>added offscreen (memory DC) drawing to microwindows </li>
      <li>added BitBlt, CreateCompatibleBitmap, CreateCompatibleDC, DeleteDC </li>
      <li>retired BOGL library, must use new interface for blitting </li>
      <li>converted framebuffer, svgalib, elks and msdos screen drivers (we need blit routines for
        herc and svgalib still) </li>
      <li>major screen driver interface change, old drivers not compatible </li>
    </ul>
    <p>Page maintained by Greg Haerr &lt;<a href="mailto:greg at censoft.com">greg at censoft.com</a>&gt;</td>
  </tr>
  <tr>
    <td valign="top"></td>
    <td></td>
  </tr>
</table>
</body>
</html>

--- NEW FILE: htmlobj.moc ---
/****************************************************************************
** HTMLImage meta object code from reading C++ file 'htmlobj.h'
**
** Created: Mon Jul 10 13:11:10 2000
**      by: The Qt Meta Object Compiler ($Revision: 1.1 $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#if !defined(Q_MOC_OUTPUT_REVISION)
#define Q_MOC_OUTPUT_REVISION 2
#elif Q_MOC_OUTPUT_REVISION != 2
#error "Moc format conflict - please regenerate all moc files"
#endif

#include "htmlobj.h"
#include <qmetaobject.h>


const char *HTMLImage::className() const
{
    return "HTMLImage";
}

QMetaObject *HTMLImage::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLImage(&HTMLImage::staticMetaObject);

#endif

void HTMLImage::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(QObject::className(), "QObject") != 0 )
	badSuperclassWarning("HTMLImage","QObject");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLImage::staticMetaObject()
{
    if ( metaObj )
	return;
    QObject::staticMetaObject();
#else

    QObject::initMetaObject();
#endif

    typedef void(HTMLImage::*m1_t0)(const QRect&);
    typedef void(HTMLImage::*m1_t1)(int);
    m1_t0 v1_0 = &HTMLImage::movieUpdated;
    m1_t1 v1_1 = &HTMLImage::statusChanged;
    QMetaData *slot_tbl = new QMetaData[2];
    slot_tbl[0].name = "movieUpdated(const QRect&)";
    slot_tbl[1].name = "statusChanged(int)";
    slot_tbl[0].ptr = *((QMember*)&v1_0);
    slot_tbl[1].ptr = *((QMember*)&v1_1);
    metaObj = new QMetaObject( "HTMLImage", "QObject",
	slot_tbl, 2,
	0, 0 );
}

--- NEW FILE: htmlclue.cpp ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
[...1873 lines suppressed...]
    HTMLObject *obj;

    width = 0;
    ascent = ALIGN_BORDER;
    descent = 0;

    for ( obj = head; obj != 0; obj = obj->next() )
    {
	if ( obj->getWidth() > width )
	     width = obj->getWidth();
	ascent += obj->getHeight();
	obj->setPos( ALIGN_BORDER, ascent - obj->getDescent() );
    }

    ascent += ALIGN_BORDER;
    width += (ALIGN_BORDER*2);
}

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


--- NEW FILE: htmldata.h ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#ifndef __HTMLDATA_H__
#define __HTMLDATA_H__

#include <qcolor.h>
#include <qcursor.h>
#include <qstring.h>
#include <kcharsets.h>

class HTMLSettings
{
public:
    HTMLSettings();
    HTMLSettings( const HTMLSettings & );

    const HTMLSettings &operator=( const HTMLSettings & );

    void setFontSizes(const int *newFontSizes);
    void getFontSizes(int *newFontSizes);
    void resetFontSizes(void);

    int     fontSizes[7];
    int     fontBaseSize;
    QColor  fontBaseColor;
    QString fontBaseFace;

    QString fixedFontFace;

    QColor  linkColor;
    QColor  vLinkColor;

#ifdef EXEC_EXTENSIONS
    QColor  eLinkColor;
#endif

    QColor  bgColor;

    KCharset charset; 

    bool    underlineLinks;
    bool    forceDefault;
};

#endif


--- NEW FILE: http.moc ---
/****************************************************************************
** HTTPConnection meta object code from reading C++ file 'http.h'
**
** Created: Fri Nov 17 13:20:55 2000
**      by: The Qt Meta Object Compiler ($Revision: 1.1 $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#if !defined(Q_MOC_OUTPUT_REVISION)
#define Q_MOC_OUTPUT_REVISION 2
#elif Q_MOC_OUTPUT_REVISION != 2
#error "Moc format conflict - please regenerate all moc files"
#endif

#include "http.h"
#include <qmetaobject.h>


const char *HTTPConnection::className() const
{
    return "HTTPConnection";
}

QMetaObject *HTTPConnection::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTTPConnection(&HTTPConnection::staticMetaObject);

#endif

void HTTPConnection::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(QObject::className(), "QObject") != 0 )
	badSuperclassWarning("HTTPConnection","QObject");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTTPConnection::staticMetaObject()
{
    if ( metaObj )
	return;
    QObject::staticMetaObject();
#else

    QObject::initMetaObject();
#endif

    typedef void(HTTPConnection::*m1_t0)(KHTMLView*,const char*);
    typedef void(HTTPConnection::*m1_t1)(KHTMLView*);
    typedef void(HTTPConnection::*m1_t2)(KHTMLView*,const char*);
    typedef void(HTTPConnection::*m1_t3)();
    typedef void(HTTPConnection::*m1_t4)(KHTMLView*,const char*,int,const char*);
    typedef void(HTTPConnection::*m1_t5)(KHTMLView*,const char*,const char*,const char*);
    m1_t0 v1_0 = &HTTPConnection::slotDocumentRequest;
    m1_t1 v1_1 = &HTTPConnection::slotDocumentStarted;
    m1_t2 v1_2 = &HTTPConnection::slotOpenURL;
    m1_t3 v1_3 = &HTTPConnection::slotDocDone;
    m1_t4 v1_4 = &HTTPConnection::slotClick;
    m1_t5 v1_5 = &HTTPConnection::slotForm;
    QMetaData *slot_tbl = new QMetaData[6];
    slot_tbl[0].name = "slotDocumentRequest(KHTMLView*,const char*)";
    slot_tbl[1].name = "slotDocumentStarted(KHTMLView*)";
    slot_tbl[2].name = "slotOpenURL(KHTMLView*,const char*)";
    slot_tbl[3].name = "slotDocDone()";
    slot_tbl[4].name = "slotClick(KHTMLView*,const char*,int,const char*)";
    slot_tbl[5].name = "slotForm(KHTMLView*,const char*,const char*,const char*)";
    slot_tbl[0].ptr = *((QMember*)&v1_0);
    slot_tbl[1].ptr = *((QMember*)&v1_1);
    slot_tbl[2].ptr = *((QMember*)&v1_2);
    slot_tbl[3].ptr = *((QMember*)&v1_3);
    slot_tbl[4].ptr = *((QMember*)&v1_4);
    slot_tbl[5].ptr = *((QMember*)&v1_5);
    metaObj = new QMetaObject( "HTTPConnection", "QObject",
	slot_tbl, 6,
	0, 0 );
}

--- NEW FILE: ChangeLog ---
1998-12-08  Alex Zepeda  <garbanzo at hooked.net>

	* html.cpp (parseBody): Initialize KCharsetConversionResult *r to zero
	so as to avoid warnings.

	* htmltoken.h: Remove a trailing comma from an enum statement.
	egcs doesn't like trailing commas for whatever reason.

1998-11-30  Alex Zepeda  <garbanzo at hooked.net>

	* html.cpp, html.h: Implement a scroll blob thingy a la SO5 && MSIE.
	It's ifdef'd out at the moment, cause it needs a bit of work, but the
	binary incompatable changes are already in place and "activated".


--- NEW FILE: htmlform.moc ---
/****************************************************************************
** HTMLWidgetElement meta object code from reading C++ file 'htmlform.h'
**
** Created: Mon Jul 10 13:09:08 2000
**      by: The Qt Meta Object Compiler ($Revision: 1.1 $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#if !defined(Q_MOC_OUTPUT_REVISION)
#define Q_MOC_OUTPUT_REVISION 2
#elif Q_MOC_OUTPUT_REVISION != 2
#error "Moc format conflict - please regenerate all moc files"
#endif

#include "htmlform.h"
#include <qmetaobject.h>


const char *HTMLWidgetElement::className() const
{
    return "HTMLWidgetElement";
}

QMetaObject *HTMLWidgetElement::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLWidgetElement(&HTMLWidgetElement::staticMetaObject);

#endif

void HTMLWidgetElement::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(QObject::className(), "QObject") != 0 )
	badSuperclassWarning("HTMLWidgetElement","QObject");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLWidgetElement::staticMetaObject()
{
    if ( metaObj )
	return;
    QObject::staticMetaObject();
#else

    QObject::initMetaObject();
#endif

    metaObj = new QMetaObject( "HTMLWidgetElement", "QObject",
	0, 0,
	0, 0 );
}


const char *HTMLSelect::className() const
{
    return "HTMLSelect";
}

QMetaObject *HTMLSelect::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLSelect(&HTMLSelect::staticMetaObject);

#endif

void HTMLSelect::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(HTMLWidgetElement::className(), "HTMLWidgetElement") != 0 )
	badSuperclassWarning("HTMLSelect","HTMLWidgetElement");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLSelect::staticMetaObject()
{
    if ( metaObj )
	return;
    HTMLWidgetElement::staticMetaObject();
#else

    HTMLWidgetElement::initMetaObject();
#endif

    typedef void(HTMLSelect::*m1_t0)(int);
    m1_t0 v1_0 = &HTMLSelect::slotHighlighted;
    QMetaData *slot_tbl = new QMetaData[1];
    slot_tbl[0].name = "slotHighlighted(int)";
    slot_tbl[0].ptr = *((QMember*)&v1_0);
    metaObj = new QMetaObject( "HTMLSelect", "HTMLWidgetElement",
	slot_tbl, 1,
	0, 0 );
}


const char *HTMLTextArea::className() const
{
    return "HTMLTextArea";
}

QMetaObject *HTMLTextArea::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLTextArea(&HTMLTextArea::staticMetaObject);

#endif

void HTMLTextArea::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(HTMLWidgetElement::className(), "HTMLWidgetElement") != 0 )
	badSuperclassWarning("HTMLTextArea","HTMLWidgetElement");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLTextArea::staticMetaObject()
{
    if ( metaObj )
	return;
    HTMLWidgetElement::staticMetaObject();
#else

    HTMLWidgetElement::initMetaObject();
#endif

    metaObj = new QMetaObject( "HTMLTextArea", "HTMLWidgetElement",
	0, 0,
	0, 0 );
}


const char *HTMLInput::className() const
{
    return "HTMLInput";
}

QMetaObject *HTMLInput::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLInput(&HTMLInput::staticMetaObject);

#endif

void HTMLInput::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(HTMLWidgetElement::className(), "HTMLWidgetElement") != 0 )
	badSuperclassWarning("HTMLInput","HTMLWidgetElement");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLInput::staticMetaObject()
{
    if ( metaObj )
	return;
    HTMLWidgetElement::staticMetaObject();
#else

    HTMLWidgetElement::initMetaObject();
#endif

    metaObj = new QMetaObject( "HTMLInput", "HTMLWidgetElement",
	0, 0,
	0, 0 );
}


const char *HTMLCheckBox::className() const
{
    return "HTMLCheckBox";
}

QMetaObject *HTMLCheckBox::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLCheckBox(&HTMLCheckBox::staticMetaObject);

#endif

void HTMLCheckBox::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(HTMLInput::className(), "HTMLInput") != 0 )
	badSuperclassWarning("HTMLCheckBox","HTMLInput");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLCheckBox::staticMetaObject()
{
    if ( metaObj )
	return;
    HTMLInput::staticMetaObject();
#else

    HTMLInput::initMetaObject();
#endif

    metaObj = new QMetaObject( "HTMLCheckBox", "HTMLInput",
	0, 0,
	0, 0 );
}


const char *HTMLHidden::className() const
{
    return "HTMLHidden";
}

QMetaObject *HTMLHidden::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLHidden(&HTMLHidden::staticMetaObject);

#endif

void HTMLHidden::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(HTMLInput::className(), "HTMLInput") != 0 )
	badSuperclassWarning("HTMLHidden","HTMLInput");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLHidden::staticMetaObject()
{
    if ( metaObj )
	return;
    HTMLInput::staticMetaObject();
#else

    HTMLInput::initMetaObject();
#endif

    metaObj = new QMetaObject( "HTMLHidden", "HTMLInput",
	0, 0,
	0, 0 );
}


const char *HTMLRadio::className() const
{
    return "HTMLRadio";
}

QMetaObject *HTMLRadio::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLRadio(&HTMLRadio::staticMetaObject);

#endif

void HTMLRadio::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(HTMLInput::className(), "HTMLInput") != 0 )
	badSuperclassWarning("HTMLRadio","HTMLInput");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLRadio::staticMetaObject()
{
    if ( metaObj )
	return;
    HTMLInput::staticMetaObject();
#else

    HTMLInput::initMetaObject();
#endif

    typedef void(HTMLRadio::*m1_t0)(const char*,const char*);
    typedef void(HTMLRadio::*m1_t1)();
    m1_t0 v1_0 = &HTMLRadio::slotRadioSelected;
    m1_t1 v1_1 = &HTMLRadio::slotClicked;
    QMetaData *slot_tbl = new QMetaData[2];
    slot_tbl[0].name = "slotRadioSelected(const char*,const char*)";
    slot_tbl[1].name = "slotClicked()";
    slot_tbl[0].ptr = *((QMember*)&v1_0);
    slot_tbl[1].ptr = *((QMember*)&v1_1);
    typedef void(HTMLRadio::*m2_t0)(const char*,const char*);
    m2_t0 v2_0 = &HTMLRadio::radioSelected;
    QMetaData *signal_tbl = new QMetaData[1];
    signal_tbl[0].name = "radioSelected(const char*,const char*)";
    signal_tbl[0].ptr = *((QMember*)&v2_0);
    metaObj = new QMetaObject( "HTMLRadio", "HTMLInput",
	slot_tbl, 2,
	signal_tbl, 1 );
}

#include <qobjectdefs.h>
#if QT_VERSION >= 141
// newer implementation
#include <qsignalslotimp.h>
#else
// for late-model 1.x header files
#if !defined(Q_MOC_CONNECTIONLIST_DECLARED)
#define Q_MOC_CONNECTIONLIST_DECLARED
#include <qlist.h>
Q_DECLARE(QListM,QConnection);
Q_DECLARE(QListIteratorM,QConnection);
#endif
#endif

// SIGNAL radioSelected
void HTMLRadio::radioSelected( const char* t0, const char* t1 )
{
    QConnectionList *clist = receivers("radioSelected(const char*,const char*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(const char*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(const char*,const char*);
    typedef RT2 *PRT2;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	}
    }
}


const char *HTMLReset::className() const
{
    return "HTMLReset";
}

QMetaObject *HTMLReset::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLReset(&HTMLReset::staticMetaObject);

#endif

void HTMLReset::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(HTMLInput::className(), "HTMLInput") != 0 )
	badSuperclassWarning("HTMLReset","HTMLInput");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLReset::staticMetaObject()
{
    if ( metaObj )
	return;
    HTMLInput::staticMetaObject();
#else

    HTMLInput::initMetaObject();
#endif

    typedef void(HTMLReset::*m1_t0)();
    m1_t0 v1_0 = &HTMLReset::slotClicked;
    QMetaData *slot_tbl = new QMetaData[1];
    slot_tbl[0].name = "slotClicked()";
    slot_tbl[0].ptr = *((QMember*)&v1_0);
    typedef void(HTMLReset::*m2_t0)();
    m2_t0 v2_0 = &HTMLReset::resetForm;
    QMetaData *signal_tbl = new QMetaData[1];
    signal_tbl[0].name = "resetForm()";
    signal_tbl[0].ptr = *((QMember*)&v2_0);
    metaObj = new QMetaObject( "HTMLReset", "HTMLInput",
	slot_tbl, 1,
	signal_tbl, 1 );
}

// SIGNAL resetForm
void HTMLReset::resetForm()
{
    activate_signal( "resetForm()" );
}


const char *HTMLSubmit::className() const
{
    return "HTMLSubmit";
}

QMetaObject *HTMLSubmit::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLSubmit(&HTMLSubmit::staticMetaObject);

#endif

void HTMLSubmit::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(HTMLInput::className(), "HTMLInput") != 0 )
	badSuperclassWarning("HTMLSubmit","HTMLInput");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLSubmit::staticMetaObject()
{
    if ( metaObj )
	return;
    HTMLInput::staticMetaObject();
#else

    HTMLInput::initMetaObject();
#endif

    typedef void(HTMLSubmit::*m1_t0)();
    m1_t0 v1_0 = &HTMLSubmit::slotClicked;
    QMetaData *slot_tbl = new QMetaData[1];
    slot_tbl[0].name = "slotClicked()";
    slot_tbl[0].ptr = *((QMember*)&v1_0);
    typedef void(HTMLSubmit::*m2_t0)();
    m2_t0 v2_0 = &HTMLSubmit::submitForm;
    QMetaData *signal_tbl = new QMetaData[1];
    signal_tbl[0].name = "submitForm()";
    signal_tbl[0].ptr = *((QMember*)&v2_0);
    metaObj = new QMetaObject( "HTMLSubmit", "HTMLInput",
	slot_tbl, 1,
	signal_tbl, 1 );
}

// SIGNAL submitForm
void HTMLSubmit::submitForm()
{
    activate_signal( "submitForm()" );
}


const char *HTMLTextInput::className() const
{
    return "HTMLTextInput";
}

QMetaObject *HTMLTextInput::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLTextInput(&HTMLTextInput::staticMetaObject);

#endif

void HTMLTextInput::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(HTMLInput::className(), "HTMLInput") != 0 )
	badSuperclassWarning("HTMLTextInput","HTMLInput");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLTextInput::staticMetaObject()
{
    if ( metaObj )
	return;
    HTMLInput::staticMetaObject();
#else

    HTMLInput::initMetaObject();
#endif

    typedef void(HTMLTextInput::*m1_t0)(const char*);
    typedef void(HTMLTextInput::*m1_t1)();
    m1_t0 v1_0 = &HTMLTextInput::slotTextChanged;
    m1_t1 v1_1 = &HTMLTextInput::slotReturnPressed;
    QMetaData *slot_tbl = new QMetaData[2];
    slot_tbl[0].name = "slotTextChanged(const char*)";
    slot_tbl[1].name = "slotReturnPressed()";
    slot_tbl[0].ptr = *((QMember*)&v1_0);
    slot_tbl[1].ptr = *((QMember*)&v1_1);
    typedef void(HTMLTextInput::*m2_t0)();
    m2_t0 v2_0 = &HTMLTextInput::submitForm;
    QMetaData *signal_tbl = new QMetaData[1];
    signal_tbl[0].name = "submitForm()";
    signal_tbl[0].ptr = *((QMember*)&v2_0);
    metaObj = new QMetaObject( "HTMLTextInput", "HTMLInput",
	slot_tbl, 2,
	signal_tbl, 1 );
}

// SIGNAL submitForm
void HTMLTextInput::submitForm()
{
    activate_signal( "submitForm()" );
}


const char *HTMLImageInput::className() const
{
    return "HTMLImageInput";
}

QMetaObject *HTMLImageInput::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLImageInput(&HTMLImageInput::staticMetaObject);

#endif

void HTMLImageInput::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(HTMLImage::className(), "HTMLImage") != 0 )
	badSuperclassWarning("HTMLImageInput","HTMLImage");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLImageInput::staticMetaObject()
{
    if ( metaObj )
	return;
    HTMLImage::staticMetaObject();
#else

    HTMLImage::initMetaObject();
#endif

    typedef void(HTMLImageInput::*m2_t0)();
    m2_t0 v2_0 = &HTMLImageInput::submitForm;
    QMetaData *signal_tbl = new QMetaData[1];
    signal_tbl[0].name = "submitForm()";
    signal_tbl[0].ptr = *((QMember*)&v2_0);
    metaObj = new QMetaObject( "HTMLImageInput", "HTMLImage",
	0, 0,
	signal_tbl, 1 );
}

// SIGNAL submitForm
void HTMLImageInput::submitForm()
{
    activate_signal( "submitForm()" );
}


const char *HTMLForm::className() const
{
    return "HTMLForm";
}

QMetaObject *HTMLForm::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLForm(&HTMLForm::staticMetaObject);

#endif

void HTMLForm::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(QObject::className(), "QObject") != 0 )
	badSuperclassWarning("HTMLForm","QObject");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLForm::staticMetaObject()
{
    if ( metaObj )
	return;
    QObject::staticMetaObject();
#else

    QObject::initMetaObject();
#endif

    typedef void(HTMLForm::*m1_t0)();
    typedef void(HTMLForm::*m1_t1)();
    typedef void(HTMLForm::*m1_t2)(const char*,const char*);
    typedef void(HTMLForm::*m1_t3)();
    m1_t0 v1_0 = &HTMLForm::slotReset;
    m1_t1 v1_1 = &HTMLForm::slotSubmit;
    m1_t2 v1_2 = &HTMLForm::slotRadioSelected;
    m1_t3 v1_3 = &HTMLForm::slotTimeout;
    QMetaData *slot_tbl = new QMetaData[4];
    slot_tbl[0].name = "slotReset()";
    slot_tbl[1].name = "slotSubmit()";
    slot_tbl[2].name = "slotRadioSelected(const char*,const char*)";
    slot_tbl[3].name = "slotTimeout()";
    slot_tbl[0].ptr = *((QMember*)&v1_0);
    slot_tbl[1].ptr = *((QMember*)&v1_1);
    slot_tbl[2].ptr = *((QMember*)&v1_2);
    slot_tbl[3].ptr = *((QMember*)&v1_3);
    typedef void(HTMLForm::*m2_t0)(const char*,const char*,const char*);
    typedef void(HTMLForm::*m2_t1)(const char*,const char*);
    m2_t0 v2_0 = &HTMLForm::submitted;
    m2_t1 v2_1 = &HTMLForm::radioSelected;
    QMetaData *signal_tbl = new QMetaData[2];
    signal_tbl[0].name = "submitted(const char*,const char*,const char*)";
    signal_tbl[1].name = "radioSelected(const char*,const char*)";
    signal_tbl[0].ptr = *((QMember*)&v2_0);
    signal_tbl[1].ptr = *((QMember*)&v2_1);
    metaObj = new QMetaObject( "HTMLForm", "QObject",
	slot_tbl, 4,
	signal_tbl, 2 );
}

// SIGNAL submitted
void HTMLForm::submitted( const char* t0, const char* t1, const char* t2 )
{
    QConnectionList *clist = receivers("submitted(const char*,const char*,const char*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(const char*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(const char*,const char*);
    typedef RT2 *PRT2;
    typedef void (QObject::*RT3)(const char*,const char*,const char*);
    typedef RT3 *PRT3;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    RT3 r3;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );

	cerr << "Number of args is " << c->numArgs() << "\n";


	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	    case 3:
		r3 = *((PRT3)(c->member()));
		(object->*r3)(t0, t1, t2);
		break;
	}
    }
}

// SIGNAL radioSelected
void HTMLForm::radioSelected( const char* t0, const char* t1 )
{
    QConnectionList *clist = receivers("radioSelected(const char*,const char*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(const char*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(const char*,const char*);
    typedef RT2 *PRT2;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	}
    }
}


const char *HTMLButton::className() const
{
    return "HTMLButton";
}

QMetaObject *HTMLButton::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_HTMLButton(&HTMLButton::staticMetaObject);

#endif

void HTMLButton::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(HTMLInput::className(), "HTMLInput") != 0 )
	badSuperclassWarning("HTMLButton","HTMLInput");

#if QT_VERSION >= 200
    staticMetaObject();
}

void HTMLButton::staticMetaObject()
{
    if ( metaObj )
	return;
    HTMLInput::staticMetaObject();
#else

    HTMLInput::initMetaObject();
#endif

    typedef void(HTMLButton::*m1_t0)();
    m1_t0 v1_0 = &HTMLButton::slotClicked;
    QMetaData *slot_tbl = new QMetaData[1];
    slot_tbl[0].name = "slotClicked()";
    slot_tbl[0].ptr = *((QMember*)&v1_0);
    metaObj = new QMetaObject( "HTMLButton", "HTMLInput",
	slot_tbl, 1,
	0, 0 );
}

--- NEW FILE: htmlview.moc ---
/****************************************************************************
** KHTMLView meta object code from reading C++ file 'htmlview.h'
**
** Created: Fri Nov 17 11:13:37 2000
**      by: The Qt Meta Object Compiler ($Revision: 1.1 $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#if !defined(Q_MOC_OUTPUT_REVISION)
#define Q_MOC_OUTPUT_REVISION 2
#elif Q_MOC_OUTPUT_REVISION != 2
#error "Moc format conflict - please regenerate all moc files"
#endif

#include "htmlview.h"
#include <qmetaobject.h>


const char *KHTMLView::className() const
{
    return "KHTMLView";
}

QMetaObject *KHTMLView::metaObj = 0;


#if QT_VERSION >= 200
static QMetaObjectInit init_KHTMLView(&KHTMLView::staticMetaObject);

#endif

void KHTMLView::initMetaObject()
{
    if ( metaObj )
	return;
    if ( strcmp(QWidget::className(), "QWidget") != 0 )
	badSuperclassWarning("KHTMLView","QWidget");

#if QT_VERSION >= 200
    staticMetaObject();
}

void KHTMLView::staticMetaObject()
{
    if ( metaObj )
	return;
    QWidget::staticMetaObject();
#else

    QWidget::initMetaObject();
#endif

    typedef void(KHTMLView::*m1_t0)(int);
    typedef void(KHTMLView::*m1_t1)(int);
    typedef void(KHTMLView::*m1_t2)(const char*,const char*);
    typedef void(KHTMLView::*m1_t3)(KHTMLView*,const char*);
    typedef void(KHTMLView::*m1_t4)(KHTMLView*,const char*);
    typedef void(KHTMLView::*m1_t5)(KHTMLView*,const char*,int,const char*);
    typedef void(KHTMLView::*m1_t6)(const char*);
    typedef void(KHTMLView::*m1_t7)(KHTMLView*,const char*);
    typedef void(KHTMLView::*m1_t8)(KHTMLView*,const char*,const QPoint&);
    typedef void(KHTMLView::*m1_t9)(KHTMLView*,const char*);
    typedef void(KHTMLView::*m1_t10)(KHTMLView*,const char*);
    typedef void(KHTMLView::*m1_t11)(KHTMLView*,const char*,const char*,const char*);
    typedef void(KHTMLView::*m1_t12)(KHTMLView*);
    typedef void(KHTMLView::*m1_t13)(KHTMLView*);
    typedef void(KHTMLView::*m1_t14)();
    typedef void(KHTMLView::*m1_t15)();
    typedef void(KHTMLView::*m1_t16)();
    typedef void(KHTMLView::*m1_t17)();
    typedef void(KHTMLView::*m1_t18)(const char*,int,const char*);
    typedef void(KHTMLView::*m1_t19)(const char*);
    typedef void(KHTMLView::*m1_t20)(bool);
    typedef void(KHTMLView::*m1_t21)(const char*,const QPoint&);
    typedef void(KHTMLView::*m1_t22)(const char*);
    typedef void(KHTMLView::*m1_t23)(const char*);
    typedef void(KHTMLView::*m1_t24)(const char*,const char*,const char*);
    typedef void(KHTMLView::*m1_t25)();
    typedef void(KHTMLView::*m1_t26)();
    typedef void(KHTMLView::*m1_t27)();
    typedef void(KHTMLView::*m1_t28)(int);
    typedef void(KHTMLView::*m1_t29)(int);
    typedef void(KHTMLView::*m1_t30)();
    typedef void(KHTMLView::*m1_t31)();
    typedef void(KHTMLView::*m1_t32)();
    m1_t0 v1_0 = &KHTMLView::slotScrollVert;
    m1_t1 v1_1 = &KHTMLView::slotScrollHorz;
    m1_t2 v1_2 = &KHTMLView::slotImageLoaded;
    m1_t3 v1_3 = &KHTMLView::slotDocumentRequest;
    m1_t4 v1_4 = &KHTMLView::slotCancelDocumentRequest;
    m1_t5 v1_5 = &KHTMLView::slotURLSelected;
    m1_t6 v1_6 = &KHTMLView::slotSetTitle;
    m1_t7 v1_7 = &KHTMLView::slotOnURL;
    m1_t8 v1_8 = &KHTMLView::slotPopupMenu;
    m1_t9 v1_9 = &KHTMLView::slotImageRequest;
    m1_t10 v1_10 = &KHTMLView::slotCancelImageRequest;
    m1_t11 v1_11 = &KHTMLView::slotFormSubmitted;
    m1_t12 v1_12 = &KHTMLView::slotDocumentStarted;
    m1_t13 v1_13 = &KHTMLView::slotDocumentDone;
    m1_t14 v1_14 = &KHTMLView::slotVertSubtractLine;
    m1_t15 v1_15 = &KHTMLView::slotVertAddLine;
    m1_t16 v1_16 = &KHTMLView::slotVertSubtractPage;
    m1_t17 v1_17 = &KHTMLView::slotVertAddPage;
    m1_t18 v1_18 = &KHTMLView::slotURLSelected;
    m1_t19 v1_19 = &KHTMLView::slotOnURL;
    m1_t20 v1_20 = &KHTMLView::slotTextSelected;
    m1_t21 v1_21 = &KHTMLView::slotPopupMenu;
    m1_t22 v1_22 = &KHTMLView::slotImageRequest;
    m1_t23 v1_23 = &KHTMLView::slotCancelImageRequest;
    m1_t24 v1_24 = &KHTMLView::slotFormSubmitted;
    m1_t25 v1_25 = &KHTMLView::slotDocumentChanged;
    m1_t26 v1_26 = &KHTMLView::slotDocumentStarted;
    m1_t27 v1_27 = &KHTMLView::slotDocumentDone;
    m1_t28 v1_28 = &KHTMLView::slotInternScrollVert;
    m1_t29 v1_29 = &KHTMLView::slotInternScrollHorz;
    m1_t30 v1_30 = &KHTMLView::slotGoUp;
    m1_t31 v1_31 = &KHTMLView::slotGoRight;
    m1_t32 v1_32 = &KHTMLView::slotGoLeft;
    QMetaData *slot_tbl = new QMetaData[33];
    slot_tbl[0].name = "slotScrollVert(int)";
    slot_tbl[1].name = "slotScrollHorz(int)";
    slot_tbl[2].name = "slotImageLoaded(const char*,const char*)";
    slot_tbl[3].name = "slotDocumentRequest(KHTMLView*,const char*)";
    slot_tbl[4].name = "slotCancelDocumentRequest(KHTMLView*,const char*)";
    slot_tbl[5].name = "slotURLSelected(KHTMLView*,const char*,int,const char*)";
    slot_tbl[6].name = "slotSetTitle(const char*)";
    slot_tbl[7].name = "slotOnURL(KHTMLView*,const char*)";
    slot_tbl[8].name = "slotPopupMenu(KHTMLView*,const char*,const QPoint&)";
    slot_tbl[9].name = "slotImageRequest(KHTMLView*,const char*)";
    slot_tbl[10].name = "slotCancelImageRequest(KHTMLView*,const char*)";
    slot_tbl[11].name = "slotFormSubmitted(KHTMLView*,const char*,const char*,const char*)";
    slot_tbl[12].name = "slotDocumentStarted(KHTMLView*)";
    slot_tbl[13].name = "slotDocumentDone(KHTMLView*)";
    slot_tbl[14].name = "slotVertSubtractLine()";
    slot_tbl[15].name = "slotVertAddLine()";
    slot_tbl[16].name = "slotVertSubtractPage()";
    slot_tbl[17].name = "slotVertAddPage()";
    slot_tbl[18].name = "slotURLSelected(const char*,int,const char*)";
    slot_tbl[19].name = "slotOnURL(const char*)";
    slot_tbl[20].name = "slotTextSelected(bool)";
    slot_tbl[21].name = "slotPopupMenu(const char*,const QPoint&)";
    slot_tbl[22].name = "slotImageRequest(const char*)";
    slot_tbl[23].name = "slotCancelImageRequest(const char*)";
    slot_tbl[24].name = "slotFormSubmitted(const char*,const char*,const char*)";
    slot_tbl[25].name = "slotDocumentChanged()";
    slot_tbl[26].name = "slotDocumentStarted()";
    slot_tbl[27].name = "slotDocumentDone()";
    slot_tbl[28].name = "slotInternScrollVert(int)";
    slot_tbl[29].name = "slotInternScrollHorz(int)";
    slot_tbl[30].name = "slotGoUp()";
    slot_tbl[31].name = "slotGoRight()";
    slot_tbl[32].name = "slotGoLeft()";
    slot_tbl[0].ptr = *((QMember*)&v1_0);
    slot_tbl[1].ptr = *((QMember*)&v1_1);
    slot_tbl[2].ptr = *((QMember*)&v1_2);
    slot_tbl[3].ptr = *((QMember*)&v1_3);
    slot_tbl[4].ptr = *((QMember*)&v1_4);
    slot_tbl[5].ptr = *((QMember*)&v1_5);
    slot_tbl[6].ptr = *((QMember*)&v1_6);
    slot_tbl[7].ptr = *((QMember*)&v1_7);
    slot_tbl[8].ptr = *((QMember*)&v1_8);
    slot_tbl[9].ptr = *((QMember*)&v1_9);
    slot_tbl[10].ptr = *((QMember*)&v1_10);
    slot_tbl[11].ptr = *((QMember*)&v1_11);
    slot_tbl[12].ptr = *((QMember*)&v1_12);
    slot_tbl[13].ptr = *((QMember*)&v1_13);
    slot_tbl[14].ptr = *((QMember*)&v1_14);
    slot_tbl[15].ptr = *((QMember*)&v1_15);
    slot_tbl[16].ptr = *((QMember*)&v1_16);
    slot_tbl[17].ptr = *((QMember*)&v1_17);
    slot_tbl[18].ptr = *((QMember*)&v1_18);
    slot_tbl[19].ptr = *((QMember*)&v1_19);
    slot_tbl[20].ptr = *((QMember*)&v1_20);
    slot_tbl[21].ptr = *((QMember*)&v1_21);
    slot_tbl[22].ptr = *((QMember*)&v1_22);
    slot_tbl[23].ptr = *((QMember*)&v1_23);
    slot_tbl[24].ptr = *((QMember*)&v1_24);
    slot_tbl[25].ptr = *((QMember*)&v1_25);
    slot_tbl[26].ptr = *((QMember*)&v1_26);
    slot_tbl[27].ptr = *((QMember*)&v1_27);
    slot_tbl[28].ptr = *((QMember*)&v1_28);
    slot_tbl[29].ptr = *((QMember*)&v1_29);
    slot_tbl[30].ptr = *((QMember*)&v1_30);
    slot_tbl[31].ptr = *((QMember*)&v1_31);
    slot_tbl[32].ptr = *((QMember*)&v1_32);
    typedef void(KHTMLView::*m2_t0)(KHTMLView*,const char*);
    typedef void(KHTMLView::*m2_t1)(KHTMLView*,const char*);
    typedef void(KHTMLView::*m2_t2)(const char*);
    typedef void(KHTMLView::*m2_t3)(KHTMLView*,const char*,int,const char*);
    typedef void(KHTMLView::*m2_t4)(KHTMLView*,const char*);
    typedef void(KHTMLView::*m2_t5)(KHTMLView*,bool);
    typedef void(KHTMLView::*m2_t6)(KHTMLView*,const char*,const QPoint&);
    typedef void(KHTMLView::*m2_t7)(KHTMLView*,const char*);
    typedef void(KHTMLView::*m2_t8)(const char*);
    typedef void(KHTMLView::*m2_t9)(KHTMLView*,const char*);
    typedef void(KHTMLView::*m2_t10)(const char*);
    typedef void(KHTMLView::*m2_t11)(KHTMLView*,const char*,const char*,const char*);
    typedef void(KHTMLView::*m2_t12)(KHTMLView*);
    typedef void(KHTMLView::*m2_t13)(KHTMLView*);
    typedef void(KHTMLView::*m2_t14)(KHTMLView*);
    typedef void(KHTMLView::*m2_t15)(KHTMLView*);
    typedef void(KHTMLView::*m2_t16)();
    typedef void(KHTMLView::*m2_t17)(KHTMLView*);
    typedef void(KHTMLView::*m2_t18)();
    typedef void(KHTMLView::*m2_t19)(KHTMLView*);
    typedef void(KHTMLView::*m2_t20)();
    m2_t0 v2_0 = &KHTMLView::documentRequest;
    m2_t1 v2_1 = &KHTMLView::cancelDocumentRequest;
    m2_t2 v2_2 = &KHTMLView::setTitle;
    m2_t3 v2_3 = &KHTMLView::URLSelected;
    m2_t4 v2_4 = &KHTMLView::onURL;
    m2_t5 v2_5 = &KHTMLView::textSelected;
    m2_t6 v2_6 = &KHTMLView::popupMenu;
    m2_t7 v2_7 = &KHTMLView::imageRequest;
    m2_t8 v2_8 = &KHTMLView::imageRequest;
    m2_t9 v2_9 = &KHTMLView::cancelImageRequest;
    m2_t10 v2_10 = &KHTMLView::cancelImageRequest;
    m2_t11 v2_11 = &KHTMLView::formSubmitted;
    m2_t12 v2_12 = &KHTMLView::frameSelected;
    m2_t13 v2_13 = &KHTMLView::documentStarted;
    m2_t14 v2_14 = &KHTMLView::documentDone;
    m2_t15 v2_15 = &KHTMLView::goUp;
    m2_t16 v2_16 = &KHTMLView::goUp;
    m2_t17 v2_17 = &KHTMLView::goRight;
    m2_t18 v2_18 = &KHTMLView::goRight;
    m2_t19 v2_19 = &KHTMLView::goLeft;
    m2_t20 v2_20 = &KHTMLView::goLeft;
    QMetaData *signal_tbl = new QMetaData[21];
    signal_tbl[0].name = "documentRequest(KHTMLView*,const char*)";
    signal_tbl[1].name = "cancelDocumentRequest(KHTMLView*,const char*)";
    signal_tbl[2].name = "setTitle(const char*)";
    signal_tbl[3].name = "URLSelected(KHTMLView*,const char*,int,const char*)";
    signal_tbl[4].name = "onURL(KHTMLView*,const char*)";
    signal_tbl[5].name = "textSelected(KHTMLView*,bool)";
    signal_tbl[6].name = "popupMenu(KHTMLView*,const char*,const QPoint&)";
    signal_tbl[7].name = "imageRequest(KHTMLView*,const char*)";
    signal_tbl[8].name = "imageRequest(const char*)";
    signal_tbl[9].name = "cancelImageRequest(KHTMLView*,const char*)";
    signal_tbl[10].name = "cancelImageRequest(const char*)";
    signal_tbl[11].name = "formSubmitted(KHTMLView*,const char*,const char*,const char*)";
    signal_tbl[12].name = "frameSelected(KHTMLView*)";
    signal_tbl[13].name = "documentStarted(KHTMLView*)";
    signal_tbl[14].name = "documentDone(KHTMLView*)";
    signal_tbl[15].name = "goUp(KHTMLView*)";
    signal_tbl[16].name = "goUp()";
    signal_tbl[17].name = "goRight(KHTMLView*)";
    signal_tbl[18].name = "goRight()";
    signal_tbl[19].name = "goLeft(KHTMLView*)";
    signal_tbl[20].name = "goLeft()";
    signal_tbl[0].ptr = *((QMember*)&v2_0);
    signal_tbl[1].ptr = *((QMember*)&v2_1);
    signal_tbl[2].ptr = *((QMember*)&v2_2);
    signal_tbl[3].ptr = *((QMember*)&v2_3);
    signal_tbl[4].ptr = *((QMember*)&v2_4);
    signal_tbl[5].ptr = *((QMember*)&v2_5);
    signal_tbl[6].ptr = *((QMember*)&v2_6);
    signal_tbl[7].ptr = *((QMember*)&v2_7);
    signal_tbl[8].ptr = *((QMember*)&v2_8);
    signal_tbl[9].ptr = *((QMember*)&v2_9);
    signal_tbl[10].ptr = *((QMember*)&v2_10);
    signal_tbl[11].ptr = *((QMember*)&v2_11);
    signal_tbl[12].ptr = *((QMember*)&v2_12);
    signal_tbl[13].ptr = *((QMember*)&v2_13);
    signal_tbl[14].ptr = *((QMember*)&v2_14);
    signal_tbl[15].ptr = *((QMember*)&v2_15);
    signal_tbl[16].ptr = *((QMember*)&v2_16);
    signal_tbl[17].ptr = *((QMember*)&v2_17);
    signal_tbl[18].ptr = *((QMember*)&v2_18);
    signal_tbl[19].ptr = *((QMember*)&v2_19);
    signal_tbl[20].ptr = *((QMember*)&v2_20);
    metaObj = new QMetaObject( "KHTMLView", "QWidget",
	slot_tbl, 33,
	signal_tbl, 21 );
}

#include <qobjectdefs.h>
#if QT_VERSION >= 141
// newer implementation
#include <qsignalslotimp.h>
#else
// for late-model 1.x header files
#if !defined(Q_MOC_CONNECTIONLIST_DECLARED)
#define Q_MOC_CONNECTIONLIST_DECLARED
#include <qlist.h>
Q_DECLARE(QListM,QConnection);
Q_DECLARE(QListIteratorM,QConnection);
#endif
#endif

// SIGNAL documentRequest
void KHTMLView::documentRequest( KHTMLView* t0, const char* t1 )
{
    QConnectionList *clist = receivers("documentRequest(KHTMLView*,const char*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(KHTMLView*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(KHTMLView*,const char*);
    typedef RT2 *PRT2;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	}
    }
}

// SIGNAL cancelDocumentRequest
void KHTMLView::cancelDocumentRequest( KHTMLView* t0, const char* t1 )
{
    QConnectionList *clist = receivers("cancelDocumentRequest(KHTMLView*,const char*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(KHTMLView*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(KHTMLView*,const char*);
    typedef RT2 *PRT2;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	}
    }
}

// SIGNAL setTitle
void KHTMLView::setTitle( const char* t0 )
{
    activate_signal( "setTitle(const char*)", t0 );
}

// SIGNAL URLSelected
void KHTMLView::URLSelected( KHTMLView* t0, const char* t1, int t2, const char* t3 )
{
    QConnectionList *clist = receivers("URLSelected(KHTMLView*,const char*,int,const char*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(KHTMLView*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(KHTMLView*,const char*);
    typedef RT2 *PRT2;
    typedef void (QObject::*RT3)(KHTMLView*,const char*,int);
    typedef RT3 *PRT3;
    typedef void (QObject::*RT4)(KHTMLView*,const char*,int,const char*);
    typedef RT4 *PRT4;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    RT3 r3;
    RT4 r4;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	    case 3:
		r3 = *((PRT3)(c->member()));
		(object->*r3)(t0, t1, t2);
		break;
	    case 4:
		r4 = *((PRT4)(c->member()));
		(object->*r4)(t0, t1, t2, t3);
		break;
	}
    }
}

// SIGNAL onURL
void KHTMLView::onURL( KHTMLView* t0, const char* t1 )
{
    QConnectionList *clist = receivers("onURL(KHTMLView*,const char*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(KHTMLView*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(KHTMLView*,const char*);
    typedef RT2 *PRT2;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	}
    }
}

// SIGNAL textSelected
void KHTMLView::textSelected( KHTMLView* t0, bool t1 )
{
    QConnectionList *clist = receivers("textSelected(KHTMLView*,bool)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(KHTMLView*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(KHTMLView*,bool);
    typedef RT2 *PRT2;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	}
    }
}

// SIGNAL popupMenu
void KHTMLView::popupMenu( KHTMLView* t0, const char* t1, const QPoint& t2 )
{
    QConnectionList *clist = receivers("popupMenu(KHTMLView*,const char*,const QPoint&)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(KHTMLView*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(KHTMLView*,const char*);
    typedef RT2 *PRT2;
    typedef void (QObject::*RT3)(KHTMLView*,const char*,const QPoint&);
    typedef RT3 *PRT3;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    RT3 r3;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	    case 3:
		r3 = *((PRT3)(c->member()));
		(object->*r3)(t0, t1, t2);
		break;
	}
    }
}

// SIGNAL imageRequest
void KHTMLView::imageRequest( KHTMLView* t0, const char* t1 )
{
    QConnectionList *clist = receivers("imageRequest(KHTMLView*,const char*)");
    if ( !clist || signalsBlocked() )
	return;

    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(KHTMLView*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(KHTMLView*,const char*);
    typedef RT2 *PRT2;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	}
    }
}

// SIGNAL imageRequest
void KHTMLView::imageRequest( const char* t0 )
{
    activate_signal( "imageRequest(const char*)", t0 );
}

// SIGNAL cancelImageRequest
void KHTMLView::cancelImageRequest( KHTMLView* t0, const char* t1 )
{
    QConnectionList *clist = receivers("cancelImageRequest(KHTMLView*,const char*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(KHTMLView*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(KHTMLView*,const char*);
    typedef RT2 *PRT2;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	}
    }
}

// SIGNAL cancelImageRequest
void KHTMLView::cancelImageRequest( const char* t0 )
{
    activate_signal( "cancelImageRequest(const char*)", t0 );
}

// SIGNAL formSubmitted
void KHTMLView::formSubmitted( KHTMLView* t0, const char* t1, const char* t2, const char* t3 )
{
    QConnectionList *clist = receivers("formSubmitted(KHTMLView*,const char*,const char*,const char*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(KHTMLView*);
    typedef RT1 *PRT1;
    typedef void (QObject::*RT2)(KHTMLView*,const char*);
    typedef RT2 *PRT2;
    typedef void (QObject::*RT3)(KHTMLView*,const char*,const char*);
    typedef RT3 *PRT3;
    typedef void (QObject::*RT4)(KHTMLView*,const char*,const char*,const char*);
    typedef RT4 *PRT4;
    RT0 r0;
    RT1 r1;
    RT2 r2;
    RT3 r3;
    RT4 r4;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	    case 2:
		r2 = *((PRT2)(c->member()));
		(object->*r2)(t0, t1);
		break;
	    case 3:
		r3 = *((PRT3)(c->member()));
		(object->*r3)(t0, t1, t2);
		break;
	    case 4:
		r4 = *((PRT4)(c->member()));
		(object->*r4)(t0, t1, t2, t3);
		break;
	}
    }
}

// SIGNAL frameSelected
void KHTMLView::frameSelected( KHTMLView* t0 )
{
    QConnectionList *clist = receivers("frameSelected(KHTMLView*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(KHTMLView*);
    typedef RT1 *PRT1;
    RT0 r0;
    RT1 r1;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	}
    }
}

// SIGNAL documentStarted
void KHTMLView::documentStarted( KHTMLView* t0 )
{
    QConnectionList *clist = receivers("documentStarted(KHTMLView*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(KHTMLView*);
    typedef RT1 *PRT1;
    RT0 r0;
    RT1 r1;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	}
    }
}

// SIGNAL documentDone
void KHTMLView::documentDone( KHTMLView* t0 )
{
    QConnectionList *clist = receivers("documentDone(KHTMLView*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(KHTMLView*);
    typedef RT1 *PRT1;
    RT0 r0;
    RT1 r1;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	}
    }
}

// SIGNAL goUp
void KHTMLView::goUp( KHTMLView* t0 )
{
    QConnectionList *clist = receivers("goUp(KHTMLView*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(KHTMLView*);
    typedef RT1 *PRT1;
    RT0 r0;
    RT1 r1;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	}
    }
}

// SIGNAL goUp
void KHTMLView::goUp()
{
    activate_signal( "goUp()" );
}

// SIGNAL goRight
void KHTMLView::goRight( KHTMLView* t0 )
{
    QConnectionList *clist = receivers("goRight(KHTMLView*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(KHTMLView*);
    typedef RT1 *PRT1;
    RT0 r0;
    RT1 r1;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	}
    }
}

// SIGNAL goRight
void KHTMLView::goRight()
{
    activate_signal( "goRight()" );
}

// SIGNAL goLeft
void KHTMLView::goLeft( KHTMLView* t0 )
{
    QConnectionList *clist = receivers("goLeft(KHTMLView*)");
    if ( !clist || signalsBlocked() )
	return;
    typedef void (QObject::*RT0)();
    typedef RT0 *PRT0;
    typedef void (QObject::*RT1)(KHTMLView*);
    typedef RT1 *PRT1;
    RT0 r0;
    RT1 r1;
    QConnectionListIt it(*clist);
    QConnection   *c;
    QSenderObject *object;
    while ( (c=it.current()) ) {
	++it;
	object = (QSenderObject*)c->object();
	object->setSender( this );
	switch ( c->numArgs() ) {
	    case 0:
		r0 = *((PRT0)(c->member()));
		(object->*r0)();
		break;
	    case 1:
		r1 = *((PRT1)(c->member()));
		(object->*r1)(t0);
		break;
	}
    }
}

// SIGNAL goLeft
void KHTMLView::goLeft()
{
    activate_signal( "goLeft()" );
}

--- NEW FILE: htmltable.cpp ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
[...1805 lines suppressed...]
    unsigned int r, c;
    HTMLTableCell *cell;

    for ( r = 0; r < totalRows; r++ )
    {
	for ( c = 0; c < totalCols; c++ )
	{
	    if ( ( cell = cells[r][c] ) == 0 )
		continue;
	    cell->unlink();
	}

	delete [] cells[r];
    }

    delete [] cells;

    delete caption;
}


--- NEW FILE: jscript.cpp ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include <stdio.h>

#include "jscript.h"

/**********************************************************
 *
 * JSEnvironment
 *
 *********************************************************/

JSEnvironment::JSEnvironment( KHTMLWidget *_view )
{
    view = _view;

    globalScope = makeGlobalScope();
    
    //printf("MAKING BULILTIN STUFF\n");

    jsWindowObject = new JSWindowObject( this );

    JSVariableObject *var = new JSVariableObject();
    var->setValue( jsWindowObject );
    var->setName( "window" );
    var->setConst( TRUE );

    globalScope->insertObject( var );

    // Ugly Trick: Netscape allows to drop the "window." stuff. So we make every
    // variable/function of window available to the global scope
    /* JSInstanceScope* scope = jsWindowObject->getScope();
    QList<JSObject>* objectList = scope->getObjectList();
    JSObject *o;
    for ( o = objectList->first(); o != 0L; o = objectList->next() )
	globalScope->insertObject( o ); */
}

JSCode* JSEnvironment::parse( const char *_script )
{
    JSCode* code = new JSCode();
    int ret = parseJavaScript( _script, code, globalScope );
    
    if ( ret == 0 )
	return code;

    delete code;
    return 0L;
}

int JSEnvironment::exec( JSCode *_code, JSInstanceScope *_scope )
{
    output.setStr( "" );
    
    if ( _scope == 0L )
	_scope = jsWindowObject->getScope();
    
    int ret = execJavaScript( _code, globalScope, _scope );
    return ret;
}

KHTMLView* JSEnvironment::getKHTMLView()
{
    return view->getView();
}

JSEnvironment::~JSEnvironment()
{
    //printf("================================ DEL JSEnv 1 ========================\n");
    delete globalScope;
    //printf("================================ DEL JSEnv 2 ========================\n");
}

/**********************************************************
 *
 * JSWindowObject
 *
 *********************************************************/

JSWindowObject::JSWindowObject( JSEnvironment *_jsenv ) : JSUserDefinedObject()
{
    jsEnvironment = _jsenv;

    // Variable 'status'
    varStatus = new JSWindowVarObject( this, KIND_JSWindowStatus );
    getScope()->insertObject( varStatus );
    // Variable 'parent'
    varParent = new JSWindowVarObject( this, KIND_JSWindowParent );
    getScope()->insertObject( varParent );
    // Variable 'top'
    varTop = new JSWindowVarObject( this, KIND_JSWindowTop );
    getScope()->insertObject( varTop );
    // Variable 'name'
    varName = new JSWindowVarObject( this, KIND_JSWindowName );
    getScope()->insertObject( varName );

    // Variable 'document'
    jsDocumentObject = new JSDocumentObject( this );
    jsDocumentVar = new JSVariableObject();
    jsDocumentVar->setValue( jsDocumentObject );
    jsDocumentVar->setName( "document" );
    jsDocumentVar->setConst( TRUE );
    getScope()->insertObject( jsDocumentVar );

    // Variable for array 'frames'
    jsFramesObject = new JSWindowArrayObject( this, KIND_JSWindowFrames );
    jsFramesVar = new JSVariableObject();
    jsFramesVar->setValue( jsFramesObject );
    jsFramesVar->setName( "frames" );
    jsFramesVar->setConst( TRUE );
    getScope()->insertObject( jsFramesVar );

}

JSWindowObject::~JSWindowObject()
{
    //printf("============================== DEL JSWindowObject ======================\n");
}

/**********************************************************
 *
 * JSWindowArrayObject
 *
 *********************************************************/

JSWindowArrayObject::JSWindowArrayObject( JSWindowObject *_win, int _kind )
{
    kind = _kind;
    object = _win;
}

int JSWindowArrayObject::rightValue( JSObject *_index, JSValue *_rv )
{
    //printf("Accessing array\n");
    
    int ret = 0;
    
    switch( kind )
    {
    case KIND_JSWindowFrames:
	{
	    if ( !_index->inherits( TYPE_JSIntegerObject ) )
		return ERROR_JSNotAInteger;
	    
	    int index = ((JSIntegerObject*)_index)->getValue();
	    	    
	    KHTMLWidget *w = object->getJSEnvironment()->getKHTMLWidget();
	    if ( index < 0 )
		return ERROR_JSIndexOutOfRange;
	    
	    QList<KHTMLWidget> *list = w->getFrameList();
	    
	    if ( index >= (int)list->count() )
		return ERROR_JSIndexOutOfRange;
	    
	    _rv->setObject( list->at( index )->getJSWindowObject() );
	    _rv->setLeftValue( FALSE );
	    _rv->setAutoDelete( FALSE );
	    
	    return ret;
	}
    }
    
    return ERROR_JSInternal;
}

JSWindowArrayObject::~JSWindowArrayObject()
{
    //printf("============================== DEL JSWindowArrayObject ======================\n");
}

/**********************************************************
 *
 * JSWindowVarObject
 *
 *********************************************************/

JSWindowVarObject::JSWindowVarObject( JSWindowObject *_obj, int _kind )
{
    kind = _kind;
    object = _obj;

    switch ( kind )
    {
    case KIND_JSWindowStatus:
	setName( "status" );
	setDynamic( TRUE );
	break;
    case KIND_JSWindowTop:
	setName( "top" );
	setConst( TRUE );
	break;
    case KIND_JSWindowParent:
	setName( "parent" );
	setConst( TRUE );
	break;
    case KIND_JSWindowName:
	setName( "name" );
	setConst( TRUE );
	setDynamic( TRUE );
	break;
    }
}

JSObject* JSWindowVarObject::getValue()
{
    switch ( kind )
    {
    case KIND_JSWindowStatus:
	return new JSStringObject( "Statusbar content" );
    case KIND_JSWindowParent:
	{
	    KHTMLView* v = object->getJSEnvironment()->getKHTMLView()->getParentView();
	    if ( v == 0L )
	    {
		return new JSObject();
	    }
	    return v->getKHTMLWidget()->getJSWindowObject();
	}
    case KIND_JSWindowTop:
	{
	    KHTMLView* v = object->getJSEnvironment()->getKHTMLView()->getParentView();
	    if ( v == 0L )
		return object;
	    while ( v->getParentView() )
		v = v->getParentView();
	    return v->getKHTMLWidget()->getJSWindowObject();
	}
    case KIND_JSWindowName:
	{
	    const char *p = object->getJSEnvironment()->getKHTMLView()->getFrameName();
	    if ( p )
		return new JSStringObject( p );
	    else
		return new JSStringObject( "" );
	}
    }
 
    return new JSObject();
}

void JSWindowVarObject::setValue( JSObject* _val )
{
    switch ( kind )
    {
    case KIND_JSWindowStatus:
	if ( _val->inherits( TYPE_JSStringObject ) )
	{
	    //printf("STATUS BAR->'%s'\n",((JSStringObject*)_val)->getString());
	}
	break;
    }
}

void JSWindowVarObject::clear()
{
    switch ( kind )
    {
    case KIND_JSWindowStatus:
	//printf("STATUS BAR->\"\"\n");
	break;
    }
}

JSWindowVarObject::~JSWindowVarObject()
{
    //printf("============================== DEL JSWindowVarObject ======================\n");
}

/**********************************************************
 *
 * JSDocumentObject
 *
 *********************************************************/

JSDocumentObject::JSDocumentObject( JSWindowObject *_window ) : JSUserDefinedObject()
{
    window = _window;
    
    jsDocumentWrite = new JSDocumentWriteFunction( this );
    getScope()->insertObject( new JSFunctionObject( jsDocumentWrite ) );
}

JSDocumentObject::~JSDocumentObject()
{
    //printf("============================== DEL JSDocumentObject ======================\n");
    // delete jsDocumentWrite;
}

/**********************************************************
 *
 * JSDocumentWriteFunction
 *
 *********************************************************/

JSDocumentWriteFunction::JSDocumentWriteFunction( JSDocumentObject *_obj ) : JSFunction( "write", 0L, 0L )
{
    object = _obj;
}

int JSDocumentWriteFunction::rightValue( JSScopeStack*, JSValue *rv, JSParameterListObject *_param )
{
    int ret = 0;

    QString out;
    
    if ( _param )
    {
	JSValue *v;
	int i = 0;
	for ( v = _param->firstValue(); v != 0L; v = _param->nextValue() )
	{
	    i++;
	    if ( i > 1 )
		object->getJSWindowObject()->getJSEnvironment()->writeOutput( " " );
	    
	    if ( v->getObject()->isA() == TYPE_JSIntegerObject )
	    {
		out.sprintf("%i",((JSIntegerObject*)(v->getObject()))->getValue() );
		object->getJSWindowObject()->getJSEnvironment()->writeOutput( out.data() );
		//printf( "%i ", ((JSIntegerObject*)(v->getObject()))->getValue() );
	    }
	    else if ( v->getObject()->isA() == TYPE_JSStringObject )
	    {
		out = ((JSStringObject*)(v->getObject()))->getString();
		object->getJSWindowObject()->getJSEnvironment()->writeOutput( out.data() );
		//printf( "%s ", ((JSStringObject*)(v->getObject()))->getString() );
	    }
	    else if ( v->getObject()->isA() == TYPE_JSBoolObject )
	    {
		if ( ((JSBoolObject*)(v->getObject()))->getValue() )
		{
		    out = "TRUE";
		    object->getJSWindowObject()->getJSEnvironment()->writeOutput( out.data() );
		    //printf( "TRUE " );
		}
		else
		{
		    out = "FALSE";
		    object->getJSWindowObject()->getJSEnvironment()->writeOutput( out.data() );
		    //printf( "FALSE " );
		}
	    }
	    else if ( v->getObject()->isA() == TYPE_JSFloatObject )
	    {
		out.sprintf( "%f", ((JSFloatObject*)(v->getObject()))->getValue() );	    
		object->getJSWindowObject()->getJSEnvironment()->writeOutput( out.data() );
		//printf( "%f ", ((JSFloatObject*)(v->getObject()))->getValue() );	    
	    }
	}
    }
    
    rv->setObject( new JSObject() );
    rv->setAutoDelete( TRUE );
    rv->setLeftValue( FALSE );
    
    return ret;
}

JSDocumentWriteFunction::~JSDocumentWriteFunction()
{
    //printf("============================== DEL JSDocumentWriteFunction ======================\n");
}

/**********************************************************
 *
 * JSEventHandler
 *
 *********************************************************/

JSEventHandler::JSEventHandler( JSEnvironment *_env, const char *_name, const char *_script )
{
    name = _name;
    jsEnvironment = _env;
    code = jsEnvironment->parse( _script );
}

JSEventHandler::~JSEventHandler()
{
    //printf("============================== DEL JSEventHandler ======================\n");
    if ( code )
	delete code;
}

int JSEventHandler::exec( JSInstanceScope *_scope )
{
    if ( !code )
	return ERROR_JSInternal;
    
    int ret = jsEnvironment->exec( code, _scope );
    //printf("RETURN '%i'\n",ret);
    return ret;
}


--- NEW FILE: htmldata.cpp ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include "htmldata.h"
#include <kapp.h>

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

//const int defaultFontSizes[7] = { 8, 10, 12, 14, 18, 24, 32 };
const int defaultFontSizes[7] = { 8, 10, 12, 14, 16, 18, 24 };


HTMLSettings::HTMLSettings()
{
    memcpy( fontSizes, defaultFontSizes, sizeof(fontSizes) );
    fontBaseSize  = 3;
    fontBaseColor = black;
    fontBaseFace  = "times";

    fixedFontFace = "courier";

    linkColor     = blue;
    vLinkColor    = darkMagenta;

#ifdef EXEC_EXTENSIONS
    eLinkColor    = cyan;
#endif

    bgColor       = lightGray;

    charset	  = KApplication::getKApplication()->getCharsets()->defaultCh();

    underlineLinks = true;
    forceDefault = false;
}

HTMLSettings::HTMLSettings( const HTMLSettings &s )
{
    memcpy( fontSizes, s.fontSizes, sizeof(fontSizes) );
    fontBaseSize  = s.fontBaseSize;
    fontBaseColor = s.fontBaseColor;
    fontBaseFace  = s.fontBaseFace;

    fixedFontFace = s.fixedFontFace;

    linkColor     = s.linkColor;
    vLinkColor    = s.vLinkColor;

#ifdef EXEC_EXTENSIONS    
    eLinkColor    = s.eLinkColor;
#endif

    bgColor       = s.bgColor;
    
    charset       = s.charset;

    underlineLinks = s.underlineLinks;
    forceDefault   = s.forceDefault;
}

const HTMLSettings &HTMLSettings::operator=( const HTMLSettings &s )
{
    memcpy( fontSizes, s.fontSizes, sizeof(fontSizes) );
    fontBaseSize  = s.fontBaseSize;
    fontBaseColor = s.fontBaseColor;
    fontBaseFace  = s.fontBaseFace;

    fixedFontFace = s.fixedFontFace;

    linkColor     = s.linkColor;
    vLinkColor    = s.vLinkColor;

#ifdef EXEC_EXTENSIONS
    eLinkColor    = s.eLinkColor;
#endif

    bgColor       = s.bgColor;
    
    charset       = s.charset;

    underlineLinks = s.underlineLinks;
    forceDefault   = s.forceDefault;

    return *this;
}

void HTMLSettings::setFontSizes(const int *newFontSizes)
{
    memcpy( fontSizes, newFontSizes, sizeof(fontSizes) );
}

void HTMLSettings::getFontSizes(int *oldFontSizes)
{
    memcpy( oldFontSizes, fontSizes, sizeof(fontSizes) );
}

void HTMLSettings::resetFontSizes(void)
{
    memcpy( fontSizes, defaultFontSizes, sizeof(fontSizes) );
}

--- NEW FILE: htmltoken.h ---
/* This file is part of the KDE libraries
    Copyright (C) 1997 Martin Jones (mjones at kde.org)
              (C) 1997 Torben Weis (weis at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/
//-----------------------------------------------------------------------------
//
// KDE HTML Widget
//

#ifndef HTMLTOKEN_H
#define HTMLTOKEN_H

class StringTokenizer;
class HTMLTokenizer;

#include <qlist.h>
#include <qstrlist.h>
#include <qarray.h>

#include "jscript.h"

// Every tag as deliverd by HTMLTokenizer starts with TAG_ESCAPE. This way
// you can devide between tags and words.
#define TAG_ESCAPE 13

// The count of spaces used for each tab.
#define TAB_SIZE 8

typedef char * TokenPtr;

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

class BlockingToken
{
public:
    enum TokenType { Table, FrameSet, Script, Cell };

    BlockingToken( TokenType tt, TokenPtr t )
	    {	ttype = tt; tok = t; }

    TokenPtr token()
	    {	return tok; }
    const char *tokenName();

protected:
    TokenType ttype;
    TokenPtr tok;
};

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

class HTMLTokenBuffer
{
public:
	TokenPtr first() 
	{ return (TokenPtr) data; }
protected:
	char data[1];
};


class HTMLTokenizer
{
public:
    HTMLTokenizer( KHTMLWidget *_widget = 0L );
    ~HTMLTokenizer();

    void begin();
    void write( const char * );
    void end();

    char* nextToken();
    bool hasMoreTokens();

    void first();

protected:
    void reset();
	void addPending();
    void appendToken( const char *t, int len );
    void appendTokenBuffer( int min_size);
    void nextTokenBuffer(); // Move curr to next tokenBuffer
    
protected:
    // Internal buffers
    ///////////////////
    char *buffer;
    char *dest;

    // the size of buffer
    int size;

    // Token List
    /////////////
	QList<HTMLTokenBuffer> tokenBufferList;
    
	TokenPtr last;  // Last token appended

    TokenPtr next;  // Token written next
    int tokenBufferSizeRemaining; // The size remaining in the buffer written to

    TokenPtr curr;  // Token read next 
    unsigned int tokenBufferCurrIndex; // Index of HTMLTokenBuffer used by next read.
    
    // Tokenizer flags
    //////////////////
    // are we in a html tag
    bool tag;

    // are we in quotes within a html tag
    int tquote;
    
	typedef enum 
	{ 
		NonePending = 0, 
		SpacePending, 
		LFPending, 
		TabPending 
	} HTMLPendingType;

    // To avoid multiple spaces
    HTMLPendingType pending;

	typedef enum 
	{ 
		NoneDiscard = 0, 
		SpaceDiscard, 
		LFDiscard
	} HTMLDiscardType;

    // Discard line breaks immediately after start-tags
    // Discard spaces after '=' within tags
    HTMLDiscardType discard;

	 // Discard the LF part of CRLF sequence
    bool skipLF;

    // Flag to say that we have the '<' but not the character following it.
    // Used to decide whether we will get a <TAG> or </TAG>
    // In case of a </TAG> we ignore pending LFs.
    // In case of a <TAG> we add any pending LF as a space.
    // If the character following is not '/', 'a..z', 'A..Z' or '!' 
    // the tag is inserted as text
	bool startTag;

	// Are we in a <title> ... </title> block
	bool title;
    
    // Are we in a <pre> ... </pre> block
    bool pre;
    
    // if 'pre == true' we track in which column we are
    int prePos;
    
    // Are we in a <script> ... </script> block
    bool script;

    // Are we in a <style> ... </style> block
    bool style;

    // Are we in a <select> ... </select> block
    bool select;

	 // Are we in a &... character entity description?
	 bool charEntity;

    // Area we in a <!-- comment --> block
    bool comment;

    // Are we in a <textarea> ... </textarea> block
    bool textarea;

    // Used to store the code of a srcipting sequence
    char *scriptCode;
    // Size of the script sequenze stored in @ref #scriptCode
    int scriptCodeSize;
    // Maximal size that can be stored in @ref #scriptCode
    int scriptCodeMaxSize;
    
    // Stores characters if we are scanning for a string like "</script>"
    char searchBuffer[ 10 ];
    // Counts where we are in the string we are scanning for 
    int searchCount;
    // The string we are searching for
    const char *searchFor;
    
    KHTMLWidget *widget;
    
    /**
     * This pointer is 0L until used. The @ref KHTMLWidget has an instance of
     * this class for us. We ask for it when we see some JavaScript stuff for
     * the first time.
     */
    JSEnvironment* jsEnvironment;
    
    // These are tokens for which we are awaiting ending tokens
    QList<BlockingToken> blocking;
};

inline void HTMLTokenizer::appendToken( const char *t, int len )
{
    if ( len < 1 )
        return;

    if (len >= tokenBufferSizeRemaining)
    {
       // We need a new buffer
       appendTokenBuffer( len);
    }

    last = next; // Last points to the start of the token we are going to append
    tokenBufferSizeRemaining -= len+1; // One for the null-termination
    while (len--)
    {
        *next++ = *t++;
    }
    *next++ = '\0';
}

inline char* HTMLTokenizer::nextToken()
{
    if (!curr)
        return NULL;

    char *t = (char *) curr;
    curr += strlen(curr)+1;

    if ((curr != next) && (*curr == '\0'))
    {
    	// End of HTMLTokenBuffer, go to next buffer.
	    nextTokenBuffer();
    }

    return t;
}

inline bool HTMLTokenizer::hasMoreTokens()
{
    if ( !blocking.isEmpty() &&
	    blocking.getFirst()->token() == curr )
	{
       	return false;
    }

    return ( ( curr != 0 ) && (curr != next) );
}

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

class StringTokenizer
{
public:
    StringTokenizer();
    ~StringTokenizer();

    void tokenize( const char *, const char * );
    const char* nextToken();
    bool hasMoreTokens() { return ( pos != 0 ); }

protected:
    char *pos;
    char *end;
    char *buffer;
    int  bufLen;
};

#endif // HTMLTOKEN


--- NEW FILE: bookmark.h ---
/*******************************************************************************\
**
**	Header file:	bookmark.h
**	Desc:			Class definition for bookmark capabilities within the viewml
**					browswer.
**	History:		06/08/01	J Webb	<jeffw at censoft.com>
**								Initial Version
**
\*******************************************************************************/

#ifndef BOOKMARK_H_INCLUDED
#define	BOOKMARK_H_INCLUDED	1


// System header files
#include <string>
#include <vector>

// Local header files
#include <FL/Fl_Menu_Button.H>

// External functions
// These 3 functions are the external wrappers for the class function needed in
// varying scopes
extern void AddBookmark_cb(Fl_Widget *w, void *data);
extern void DelBookmark_cb(Fl_Widget *w, void *data);
extern void SelBookmark_cb(Fl_Widget *w, void *data);


class BookMark
{
	typedef struct
	{
		string				pgName,									// Name of the Page (taken from html <Title>)
							pgURL;									// Actual URL
	} bookmark_t;

	private:
		int					m_nelem,								// Number of elements currently in vector
							m_maxelem;								// Maximum number of elements allowed (0 = No limit)
		string				m_txtfile;								// FQPN of the text file
		Fl_Menu_Button		*m_mb;									// Menu button for this container
		vector<bookmark_t>	m_bmv_srt;								// Bookmark vector (alpha sort be pgName)

	public:
		BookMark(int mxelem = 0, char *tpath = "./.bookmark.vml");
		~BookMark();
		int AddBookmark(char *name, char *URL);
		void DelBookmark(int idx);
		char *GetURL(int idx);
		void SetMenuWidget(Fl_Menu_Button *w) {if (w) {m_mb = w; UpdateMenus();} return;}

	private:
		// These functions are just for internal class operation
		int findVElem(bookmark_t *bmptr);
		char *fltkmStrParse(char *str);
		void UpdateMenus();
		void UpdateTxtFile();
		void ReadDataFile();

}; // end of class BookMark definition

#endif // BOOKMARK_H_INCLUDED

--- NEW FILE: htmliter.h ---
/* This file is part of the KDE libraries
    Copyright (C) 1998 Martin Jones (mjones at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#ifndef __HTMLITER_H__
#define __HTMLITER_H__

class HTMLObject;
class HTMLClue;
class HTMLTable;

/*
 * This is the base class for iterators of the HTMLObject heirarchy.
 * Currently the iterators only iterarate through the displayed objects,
 * i.e. container objects such as HTMLClue & HTMLTable are not moved to
 * by next(), rather their children are traversed.
 */
class HTMLIterator
{
public:
    HTMLIterator() {}
    virtual ~HTMLIterator() {}

    /*
     * return a pointer to the current object
     */
    virtual HTMLObject *current() = 0;

    /*
     * move to the next object.
     * returns true if we are not already at the end of the list.
     */
    virtual bool next() = 0;
};

/*
 * Iterator for all HTMLClue derived container objects
 */
class HTMLListIterator : public HTMLIterator
{
public:
    HTMLListIterator( HTMLClue *c );
    virtual ~HTMLListIterator()
	{ if ( iter ) delete iter; }

    virtual bool next();
    virtual HTMLObject *current();

protected:
    HTMLClue *clue;
    HTMLObject *curr;
    HTMLIterator *iter;
};

/*
 * Iterator for HTMLTable container object
 */
class HTMLTableIterator : public HTMLIterator
{
public:
    HTMLTableIterator( HTMLTable *t );
    virtual ~HTMLTableIterator()
	{ if ( iter ) delete iter; }

    virtual bool next();
    virtual HTMLObject *current();

protected:
    HTMLObject *nextCell();

protected:
    int row;
    int col;
    HTMLTable *table;
    HTMLObject *curr;
    HTMLIterator *iter;
};


#endif


--- NEW FILE: htmlchain.h ---
/* This file is part of the KDE libraries
    Copyright (C) 1998 Martin Jones (mjones at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#ifndef __HTMLCHAIN_H__
#define __HTMLCHAIN_H__

class HTMLObject;

/*
 */
class HTMLChain
{
public:
    HTMLChain() : chain(30), curr(0), tail(0) {  }

    void clear() { curr = tail = 0; }

    void first() { curr = 0; }
    void last()  { curr = tail; }
    void next()  { if (curr < tail) curr++; }
    void prev()  { if (curr > 0) curr--; }

    HTMLObject *current() { return chain[curr]; }

    bool isLast() { return curr == tail; }

    void push( HTMLObject *obj ) { 
    	if (tail >= (int) chain.size()) 
    	{
    		chain.resize(chain.size()*2);
    	}
    	chain[tail] = obj;
    	tail++;
    }
    void pop() { if (tail > 0) tail--; }

protected:
	QArray<HTMLObject *> chain;
	int curr;
	int tail;
};

#endif


--- NEW FILE: htmlchain.cpp ---
/* This file is part of the KDE libraries
    Copyright (C) 1998 Martin Jones (mjones at kde.org)

    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; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

// Obsolete




More information about the dslinux-commit mailing list