*** HTML.c.ORIG	Tue Oct 19 04:44:44 1993
--- HTML.c	Thu Oct 28 15:59:23 1993
***************
*** 54,61 ****
--- 54,66 ----
  
  #include <stdio.h>
  #include "HTMLP.h"
+ #ifdef MOTIF
  #include <Xm/DrawingA.h>
  #include <Xm/ScrollBar.h>
+ #else
+ #include "DrawingArea.h"
+ #include <X11/Xaw/Scrollbar.h>
+ #endif
  #include <X11/cursorfont.h>
  
  
***************
*** 119,130 ****
--- 124,140 ----
  #ifdef _NO_PROTO
  
  static void		_HTMLInput() ;
+ #ifndef MOTIF
+ static void		_HTMLpwdInput() ;
+ #endif
  static void             Initialize() ;
  static void             Redisplay() ;
  static void             Resize() ;
  static Boolean          SetValues() ;
  static XtGeometryResult	GeometryManager() ;
+ #ifdef NOT_USED
  static void		RecolorInternalHRefs() ;
+ #endif
  static Dimension	VbarWidth();
  static Dimension	HbarHeight();
  static void		ViewRedisplay();
***************
*** 135,140 ****
--- 145,154 ----
  
  static void		_HTMLInput(Widget w, XEvent *event,
  				String *params, Cardinal *num_params);
+ #ifndef MOTIF
+ static void		_HTMLpwdInput(Widget w, XEvent *event,
+ 				String *params, Cardinal *num_params);
+ #endif
  static void             Initialize(HTMLWidget request, HTMLWidget new);
  static void             Redisplay(HTMLWidget hw, XEvent *event, Region region);
  static void             Resize(HTMLWidget hw);
***************
*** 142,148 ****
--- 156,164 ----
  				HTMLWidget new);
  static XtGeometryResult GeometryManager(Widget w, XtWidgetGeometry *request,
  				XtWidgetGeometry *reply);
+ #ifdef NOT_USED
  static void		RecolorInternalHRefs(HTMLWidget hw, char *href);
+ #endif
  static Dimension        VbarWidth(HTMLWidget hw);
  static Dimension        HbarHeight(HTMLWidget hw);
  static void		ViewRedisplay(HTMLWidget hw, int x, int y,
***************
*** 202,207 ****
--- 218,226 ----
     { "extend-end",      (XtActionProc) ExtendEnd },
     { "track-motion",    (XtActionProc) TrackMotion },
     { "HTMLInput",	(XtActionProc) _HTMLInput },
+ #ifndef MOTIF
+    { "HTMLpwdInput",	(XtActionProc) _HTMLpwdInput },
+ #endif
  
  #ifdef MOTIF
  #ifndef MOTIF1_2
***************
*** 228,237 ****
     { "extend-end",      (XtActionProc) ExtendEnd },
     { "track-motion",    (XtActionProc) TrackMotion },
     { "HTMLInput",	(XtActionProc) _HTMLInput },
  };
  
  
- 
  /*
   *  Resource definitions for HTML widget
   */
--- 247,258 ----
     { "extend-end",      (XtActionProc) ExtendEnd },
     { "track-motion",    (XtActionProc) TrackMotion },
     { "HTMLInput",	(XtActionProc) _HTMLInput },
+ #ifndef MOTIF
+    { "HTMLpwdInput",	(XtActionProc) _HTMLpwdInput },
+ #endif
  };
  
  
  /*
   *  Resource definitions for HTML widget
   */
***************
*** 602,608 ****
  
  WidgetClass htmlWidgetClass = (WidgetClass)&htmlClassRec;
  
! static Cursor in_anchor_cursor = NULL;
  
  
  /*
--- 623,630 ----
  
  WidgetClass htmlWidgetClass = (WidgetClass)&htmlClassRec;
  
! static Cursor in_anchor_cursor = (Cursor) NULL;
! 
  
  
  /*
***************
*** 691,926 ****
  	}
  }
  
  
  /*
   * Either the vertical or hortizontal scrollbar has been moved
   */
  void
  ScrollMove(w, client_data, call_data)
!         Widget w;
!         caddr_t client_data;
!         caddr_t call_data;
  {
!         XmScrollBarCallbackStruct *sc = (XmScrollBarCallbackStruct *)call_data;
! 	HTMLWidget hw = (HTMLWidget)client_data;
! 	XEvent event;
! 
! 	/*
! 	 * Special code incase the scrollbar is "moved" before we have a window
! 	 * (if we have a GC we have a window)
! 	 */
! 	if (hw->html.drawGC == NULL)
! 	{
! 		if (w == hw->html.vbar)
! 		{
! 			hw->html.scroll_y = sc->value;
! 		}
! 		else if (w == hw->html.hbar)
! 		{
! 			hw->html.scroll_x = sc->value;
! 		}
! 		return;
! 	}
! 
! 	/*
! 	 * get our widgets out of the way (No Expose events)
! 	HideWidgets(hw);
! 	 */
! 
! 	/*
! 	 * If we've moved the vertical scrollbar
! 	 */
! 	if (w == hw->html.vbar)
! 	{
! 		/*
! 		 * We've scrolled down. Copy up the untouched part of the
! 		 * window.  Then Clear and redraw the new area
! 		 * exposed.
! 		 */
! 		if (sc->value > hw->html.scroll_y)
! 		{
! 			int dy;
! 
! 			dy = sc->value - hw->html.scroll_y;
! 			if (dy > hw->html.view_height)
! 			{
! 				hw->html.scroll_y = sc->value;
! 				XClearArea(XtDisplay(hw->html.view),
! 					XtWindow(hw->html.view),
! 					0, 0,
! 					hw->html.view_width,
! 					hw->html.view_height, False);
! 				ViewRedisplay(hw,
! 					0, 0,
! 					hw->html.view_width,
! 					hw->html.view_height);
! 			}
! 			else
! 			{
! 				XCopyArea(XtDisplay(hw->html.view),
! 					XtWindow(hw->html.view),
! 					XtWindow(hw->html.view),
! 					hw->html.drawGC, 0, dy,
! 					hw->html.view_width,
! 					hw->html.view_height - dy,
! 					0, 0);
! 				hw->html.scroll_y = sc->value;
! 				XClearArea(XtDisplay(hw->html.view),
! 					XtWindow(hw->html.view),
! 					0, (int)hw->html.view_height - dy,
! 					hw->html.view_width, dy, False);
! 				ViewRedisplay(hw,
! 					0, (int)hw->html.view_height - dy,
! 					hw->html.view_width, dy);
! 			}
! 		}
! 		/*
! 		 * We've scrolled up. Copy down the untouched part of the
! 		 * window.  Then Clear and redraw the new area
! 		 * exposed.
! 		 */
! 		else if (sc->value < hw->html.scroll_y)
! 		{
! 			int dy;
! 
! 			dy = hw->html.scroll_y - sc->value;
! 			if (dy > hw->html.view_height)
! 			{
! 				hw->html.scroll_y = sc->value;
! 				XClearArea(XtDisplay(hw->html.view),
! 					XtWindow(hw->html.view),
! 					0, 0,
! 					hw->html.view_width,
! 					hw->html.view_height, False);
! 				ViewRedisplay(hw,
! 					0, 0,
! 					hw->html.view_width,
! 					hw->html.view_height);
! 			}
! 			else
! 			{
! 				XCopyArea(XtDisplay(hw->html.view),
! 					XtWindow(hw->html.view),
! 					XtWindow(hw->html.view),
! 					hw->html.drawGC, 0, 0,
! 					hw->html.view_width,
! 					hw->html.view_height - dy,
! 					0, dy);
! 				hw->html.scroll_y = sc->value;
! 				XClearArea(XtDisplay(hw->html.view),
! 					XtWindow(hw->html.view),
! 					0, 0,
! 					hw->html.view_width, dy, False);
! 				ViewRedisplay(hw,
! 					0, 0,
! 					hw->html.view_width, dy);
! 			}
! 		}
! 	}
! 	/*
! 	 * Else we've moved the horizontal scrollbar
! 	 */
! 	else if (w == hw->html.hbar)
! 	{
! 		/*
! 		 * We've scrolled right. Copy left the untouched part of the
! 		 * window.  Then Clear and redraw the new area
! 		 * exposed.
! 		 */
! 		if (sc->value > hw->html.scroll_x)
! 		{
! 			int dx;
! 
! 			dx = sc->value - hw->html.scroll_x;
! 			if (dx > hw->html.view_width)
! 			{
! 				hw->html.scroll_x = sc->value;
! 				XClearArea(XtDisplay(hw->html.view),
! 					XtWindow(hw->html.view),
! 					0, 0,
! 					hw->html.view_width,
! 					hw->html.view_height, False);
! 				ViewRedisplay(hw,
! 					0, 0,
! 					hw->html.view_width,
! 					hw->html.view_height);
! 			}
! 			else
! 			{
! 				XCopyArea(XtDisplay(hw->html.view),
! 					XtWindow(hw->html.view),
! 					XtWindow(hw->html.view),
! 					hw->html.drawGC, dx, 0,
! 					hw->html.view_width - dx,
! 					hw->html.view_height,
! 					0, 0);
! 				hw->html.scroll_x = sc->value;
! 				XClearArea(XtDisplay(hw->html.view),
! 					XtWindow(hw->html.view),
! 					(int)hw->html.view_width - dx, 0,
! 					dx, hw->html.view_height, False);
! 				ViewRedisplay(hw,
! 					(int)hw->html.view_width - dx, 0,
! 					dx, hw->html.view_height);
! 			}
! 		}
! 		/*
! 		 * We've scrolled left. Copy right the untouched part of the
! 		 * window.  Then Clear and redraw the new area
! 		 * exposed.
! 		 */
! 		else if (sc->value < hw->html.scroll_x)
! 		{
! 			int dx;
! 
! 			dx = hw->html.scroll_x - sc->value;
! 			if (dx > hw->html.view_width)
! 			{
! 				hw->html.scroll_x = sc->value;
! 				XClearArea(XtDisplay(hw->html.view),
! 					XtWindow(hw->html.view),
! 					0, 0,
! 					hw->html.view_width,
! 					hw->html.view_height, False);
! 				ViewRedisplay(hw,
! 					0, 0,
! 					hw->html.view_width,
! 					hw->html.view_height);
! 			}
! 			else
! 			{
! 				XCopyArea(XtDisplay(hw->html.view),
! 					XtWindow(hw->html.view),
! 					XtWindow(hw->html.view),
! 					hw->html.drawGC, 0, 0,
! 					hw->html.view_width - dx,
! 					hw->html.view_height,
! 					dx, 0);
! 				hw->html.scroll_x = sc->value;
! 				XClearArea(XtDisplay(hw->html.view),
! 					XtWindow(hw->html.view),
! 					0, 0,
! 					dx, hw->html.view_height, False);
! 				ViewRedisplay(hw,
! 					0, 0,
! 					dx, hw->html.view_height);
! 			}
! 		}
! 	}
! 
! 	/*
! 	 * Move the now hidden widgets
! 	 * Flush any Copyed or Cleared text first.
! 	XFlush(XtDisplay(hw));
! 	 */
! 	ScrollWidgets(hw);
! 
! 	/*
! 	 * Remap the widgets to their new location
! 	MapWidgets(hw);
! 	 */
  }
  
  
  /*
   * Create the horizontal and vertical scroll bars.
--- 713,1016 ----
  	}
  }
  
+ #ifndef MOTIF
+ static void
+ setScrollBar (sb, topPosition, totalLength, currentLength)
+     Widget sb;
+     Position topPosition;
+     Dimension totalLength, currentLength;
+     {
+     float top   = (float)topPosition  /(float)(totalLength);
+     float shown = (float)currentLength/(float)(totalLength);
+ 
+     XawScrollbarSetThumb(sb, top, shown);
+     }
+ #endif
+ 
+ /*
+  * ScrollToPos has been separated from ScrollMove
+  * to use the same scrolling method for MOTIF and ATHENA
+  * -gustaf
+  */
+ void
+ ScrollToPos(w, hw, value)
+      Widget w;
+      HTMLWidget hw;
+      int value;
+ {
+   /*
+    * Special code incase the scrollbar is "moved" before we have a window
+    * (if we have a GC we have a window)
+    */
+   if (hw->html.drawGC == NULL)
+     {
+       if (w == hw->html.vbar)
+ 	{
+ 	  hw->html.scroll_y = value;
+ 	}
+       else if (w == hw->html.hbar)
+ 	{
+ 	  hw->html.scroll_x = value;
+ 	}
+       return;
+     }
+ 
+    /*
+     * get our widgets out of the way (No Expose events)
+     HideWidgets(hw);
+     */
+ 
+   /*
+    * If we've moved the vertical scrollbar
+    */
+   if (w == hw->html.vbar)
+     {
+       /*
+        * We've scrolled down. Copy up the untouched part of the
+        * window.  Then Clear and redraw the new area
+        * exposed.
+        */
+       if (value > hw->html.scroll_y)
+ 	{
+ 	  int dy;
+ 	    
+ 	  dy = value - hw->html.scroll_y;
+ 	  if (dy > hw->html.view_height)
+ 	    {
+ 	      hw->html.scroll_y = value;
+ 	      XClearArea(XtDisplay(hw->html.view),
+ 			 XtWindow(hw->html.view),
+ 			 0, 0,
+ 			 hw->html.view_width,
+ 			 hw->html.view_height, False);
+ 	      ViewRedisplay(hw,
+ 			    0, 0,
+ 			    hw->html.view_width,
+ 			    hw->html.view_height);
+ 	    }
+ 	  else
+ 	    {
+ 	      XCopyArea(XtDisplay(hw->html.view),
+ 			XtWindow(hw->html.view),
+ 			XtWindow(hw->html.view),
+ 			hw->html.drawGC, 0, dy,
+ 			hw->html.view_width,
+ 			hw->html.view_height - dy,
+ 			0, 0);
+ 	      hw->html.scroll_y = value;
+ 	      XClearArea(XtDisplay(hw->html.view),
+ 			 XtWindow(hw->html.view),
+ 			 0, (int)hw->html.view_height - dy,
+ 			 hw->html.view_width, dy, False);
+ 	      ViewRedisplay(hw,
+ 			    0, (int)hw->html.view_height - dy,
+ 			    hw->html.view_width, dy);
+ 	    }
+ 	}
+       /*
+        * We've scrolled up. Copy down the untouched part of the
+        * window.  Then Clear and redraw the new area
+        * exposed.
+        */
+       else if (value < hw->html.scroll_y)
+ 	{
+ 	  int dy;
+ 	    
+ 	  dy = hw->html.scroll_y - value;
+ 	  if (dy > hw->html.view_height)
+ 	    {
+ 	      hw->html.scroll_y = value;
+ 	      XClearArea(XtDisplay(hw->html.view),
+ 			 XtWindow(hw->html.view),
+ 			 0, 0,
+ 			 hw->html.view_width,
+ 			 hw->html.view_height, False);
+ 	      ViewRedisplay(hw,
+ 			    0, 0,
+ 			    hw->html.view_width,
+ 			    hw->html.view_height);
+ 	    }
+ 	  else
+ 	    {
+ 	      XCopyArea(XtDisplay(hw->html.view),
+ 			XtWindow(hw->html.view),
+ 			XtWindow(hw->html.view),
+ 			hw->html.drawGC, 0, 0,
+ 			hw->html.view_width,
+ 			hw->html.view_height - dy,
+ 			0, dy);
+ 	      hw->html.scroll_y = value;
+ 	      XClearArea(XtDisplay(hw->html.view),
+ 			 XtWindow(hw->html.view),
+ 			 0, 0,
+ 			 hw->html.view_width, dy, False);
+ 	      ViewRedisplay(hw,
+ 			    0, 0,
+ 			    hw->html.view_width, dy);
+ 	    }
+ 	}
+     }
+   /*
+    * Else we've moved the horizontal scrollbar
+    */
+   else if (w == hw->html.hbar)
+     {
+       /*
+        * We've scrolled right. Copy left the untouched part of the
+        * window.  Then Clear and redraw the new area
+        * exposed.
+        */
+       if (value > hw->html.scroll_x)
+ 	{
+ 	  int dx;
+ 	    
+ 	  dx = value - hw->html.scroll_x;
+ 	  if (dx > hw->html.view_width)
+ 	    {
+ 	      hw->html.scroll_x = value;
+ 	      XClearArea(XtDisplay(hw->html.view),
+ 			 XtWindow(hw->html.view),
+ 			 0, 0,
+ 			 hw->html.view_width,
+ 			 hw->html.view_height, False);
+ 	      ViewRedisplay(hw,
+ 			    0, 0,
+ 			    hw->html.view_width,
+ 			    hw->html.view_height);
+ 	    }
+ 	  else
+ 	    {
+ 	      XCopyArea(XtDisplay(hw->html.view),
+ 			XtWindow(hw->html.view),
+ 			XtWindow(hw->html.view),
+ 			hw->html.drawGC, dx, 0,
+ 			hw->html.view_width - dx,
+ 			hw->html.view_height,
+ 			0, 0);
+ 	      hw->html.scroll_x = value;
+ 	      XClearArea(XtDisplay(hw->html.view),
+ 			 XtWindow(hw->html.view),
+ 			 (int)hw->html.view_width - dx, 0,
+ 			 dx, hw->html.view_height, False);
+ 	      ViewRedisplay(hw,
+ 			    (int)hw->html.view_width - dx, 0,
+ 			    dx, hw->html.view_height);
+ 	    }
+ 	}
+       /*
+        * We've scrolled left. Copy right the untouched part of the
+        * window.  Then Clear and redraw the new area
+        * exposed.
+        */
+       else if (value < hw->html.scroll_x)
+ 	{
+ 	  int dx;
+ 	    
+ 	  dx = hw->html.scroll_x - value;
+ 	  if (dx > hw->html.view_width)
+ 	    {
+ 	      hw->html.scroll_x = value;
+ 	      XClearArea(XtDisplay(hw->html.view),
+ 			 XtWindow(hw->html.view),
+ 			 0, 0,
+ 			 hw->html.view_width,
+ 			 hw->html.view_height, False);
+ 	      ViewRedisplay(hw,
+ 			    0, 0,
+ 			    hw->html.view_width,
+ 			    hw->html.view_height);
+ 	    }
+ 	  else
+ 	    {
+ 	      XCopyArea(XtDisplay(hw->html.view),
+ 			XtWindow(hw->html.view),
+ 			XtWindow(hw->html.view),
+ 			hw->html.drawGC, 0, 0,
+ 			hw->html.view_width - dx,
+ 			hw->html.view_height,
+ 			dx, 0);
+ 	      hw->html.scroll_x = value;
+ 	      XClearArea(XtDisplay(hw->html.view),
+ 			 XtWindow(hw->html.view),
+ 			 0, 0,
+ 			 dx, hw->html.view_height, False);
+ 	      ViewRedisplay(hw,
+ 			    0, 0,
+ 			    dx, hw->html.view_height);
+ 	    }
+ 	}
+     }
+ 
+    /*
+     * Move the now hidden widgets
+     * Flush any Copyed or Cleared text first.
+    XFlush(XtDisplay(hw));
+     */
+   ScrollWidgets(hw);
+ 
+    /*
+     * Remap the widgets to their new location
+    MapWidgets(hw);
+     */
+ }
  
  /*
   * Either the vertical or hortizontal scrollbar has been moved
   */
  void
  ScrollMove(w, client_data, call_data)
!      Widget w;
!      caddr_t client_data;
!      caddr_t call_data;
  {
! #ifdef MOTIF
!   XmScrollBarCallbackStruct *sc = (XmScrollBarCallbackStruct *)call_data;
!   ScrollToPos(w, 
! 	      (HTMLWidget)client_data, 
! 	      sc->value);
! #else
!   float scrollDir = (int)call_data < 0 ? -0.3 : 0.3;
!   HTMLWidget hw = (HTMLWidget)client_data;
!   int value;
!   Dimension totalLength, currentLength;
! 
!   if (w == hw->html.vbar)
!     {
!       totalLength = hw->html.doc_height;
!       currentLength = hw->html.view_height;
!       value = hw->html.scroll_y + scrollDir * currentLength;
!     }
!   else 
!     {
!       totalLength = hw->html.doc_width;
!       currentLength = hw->html.view_width;
!       value = hw->html.scroll_x + scrollDir * currentLength;
!     }
! 
!   if (value > (int)totalLength) value = totalLength;
!   if (value < 0) value = 0;
!   
!   setScrollBar(w, value, totalLength, currentLength);
!   ScrollToPos(w, hw, value);
! #endif
  }
  
+ #ifndef MOTIF
+ void
+ JumpMove(w, client_data, call_data)
+      Widget w;
+      caddr_t client_data;
+      caddr_t call_data;
+ {
+   HTMLWidget hw = (HTMLWidget)client_data;
+   int value = (int)(*(float *)call_data * 
+ 		    (w == hw->html.vbar ?  
+ 		     hw->html.doc_height : 
+ 		     hw->html.doc_width));
+   ScrollToPos(w, hw, value);
+ }
+ #endif
+   
  
  /*
   * Create the horizontal and vertical scroll bars.
***************
*** 946,956 ****
  	if (hw->html.view == NULL)
  	{
  		argcnt = 0;
! 		XtSetArg(arg[argcnt], XmNwidth, 10); argcnt++;
! 		XtSetArg(arg[argcnt], XmNheight, 10); argcnt++;
  		hw->html.view = XtCreateWidget("View", xmDrawingAreaWidgetClass,
  			(Widget)hw, arg, argcnt);
  		XtManageChild(hw->html.view);
  	}
  
  	/*
--- 1036,1054 ----
  	if (hw->html.view == NULL)
  	{
  		argcnt = 0;
! 		XtSetArg(arg[argcnt], XxNwidth, 10); argcnt++;
! 		XtSetArg(arg[argcnt], XxNheight, 10); argcnt++;
! #ifdef MOTIF		
  		hw->html.view = XtCreateWidget("View", xmDrawingAreaWidgetClass,
  			(Widget)hw, arg, argcnt);
  		XtManageChild(hw->html.view);
+ #else
+  		hw->html.view = XtCreateManagedWidget("View", 
+  						      drawingAreaWidgetClass, 
+  						      (Widget)hw, arg, argcnt);
+  
+ #endif
+ 
  	}
  
  	/*
***************
*** 972,978 ****
  	XtSetArg(arg[argcnt], XtNtranslations, trans); argcnt++;
  	XtSetValues(hw->html.view, arg, argcnt);
  
- 
  	/*
  	 * If the user hasn't provided a vertical scrollbar (which they
  	 * should not most of the time) make one.
--- 1070,1075 ----
***************
*** 980,998 ****
--- 1077,1108 ----
  	if (hw->html.vbar == NULL)
  	{
  		argcnt = 0;
+ #ifdef MOTIF
  		XtSetArg(arg[argcnt], XmNorientation, XmVERTICAL); argcnt++;
  		hw->html.vbar = XtCreateWidget("Vbar", xmScrollBarWidgetClass,
  			(Widget)hw, arg, argcnt);
  		XtManageChild(hw->html.vbar);
+ #else
+ 		XtSetArg(arg[argcnt], XtNorientation, XtorientVertical); argcnt++;
+ 		hw->html.vbar = XtCreateManagedWidget("Vbar", scrollbarWidgetClass,
+ 			(Widget)hw, arg, argcnt);
+ #endif
  	}
  
  	/*
  	 * Add callbacks to catch scrollbar changes
  	 */
+ #ifdef MOTIF
  	XtAddCallback(hw->html.vbar, XmNvalueChangedCallback,
  		ScrollMove, (caddr_t)hw);
  	XtAddCallback(hw->html.vbar, XmNdragCallback,
  		ScrollMove, (caddr_t)hw);
+ #else
+ 	XtAddCallback(hw->html.vbar, XtNjumpProc,
+ 		      JumpMove, (caddr_t)hw);
+ 	XtAddCallback(hw->html.vbar, XtNscrollProc,
+ 		      ScrollMove, (caddr_t)hw);
+ #endif
  
  	/*
  	 * If the user hasn't provided a horizontal scrollbar (which they
***************
*** 1001,1022 ****
  	if (hw->html.hbar == NULL)
  	{
  		argcnt = 0;
  		XtSetArg(arg[argcnt], XmNorientation, XmHORIZONTAL); argcnt++;
  		hw->html.hbar = XtCreateWidget("Hbar", xmScrollBarWidgetClass,
! 			(Widget)hw, arg, argcnt);
  		XtManageChild(hw->html.hbar);
  	}
  
  	/*
  	 * Add callbacks to catch scrollbar changes
  	 */
  	XtAddCallback(hw->html.hbar, XmNvalueChangedCallback,
  		ScrollMove, (caddr_t)hw);
  	XtAddCallback(hw->html.hbar, XmNdragCallback,
  		ScrollMove, (caddr_t)hw);
  }
  
- 
  /*
   * Return the width of the vertical scrollbar
   */
--- 1111,1144 ----
  	if (hw->html.hbar == NULL)
  	{
  		argcnt = 0;
+ #ifdef MOTIF
  		XtSetArg(arg[argcnt], XmNorientation, XmHORIZONTAL); argcnt++;
  		hw->html.hbar = XtCreateWidget("Hbar", xmScrollBarWidgetClass,
! 					       (Widget)hw, arg, argcnt);
  		XtManageChild(hw->html.hbar);
+ #else
+ 		XtSetArg(arg[argcnt], XtNorientation, XtorientHorizontal); argcnt++;
+ 		hw->html.hbar = XtCreateManagedWidget("Hbar", scrollbarWidgetClass,
+ 						      (Widget)hw, arg, argcnt);
+ #endif
  	}
  
  	/*
  	 * Add callbacks to catch scrollbar changes
  	 */
+ #ifdef MOTIF
  	XtAddCallback(hw->html.hbar, XmNvalueChangedCallback,
  		ScrollMove, (caddr_t)hw);
  	XtAddCallback(hw->html.hbar, XmNdragCallback,
  		ScrollMove, (caddr_t)hw);
+ #else
+ 	XtAddCallback(hw->html.hbar, XtNjumpProc,
+ 		      JumpMove, (caddr_t)hw);
+ 	XtAddCallback(hw->html.hbar, XtNscrollProc,
+ 		      ScrollMove, (caddr_t)hw);
+ #endif
  }
  
  /*
   * Return the width of the vertical scrollbar
   */
***************
*** 1037,1043 ****
  	if (hw->html.vbar != NULL)
  	{
  		argcnt = 0;
! 		XtSetArg(arg[argcnt], XmNwidth, &width); argcnt++;
  		XtGetValues(hw->html.vbar, arg, argcnt);
  	}
  
--- 1159,1165 ----
  	if (hw->html.vbar != NULL)
  	{
  		argcnt = 0;
! 		XtSetArg(arg[argcnt], XxNwidth, &width); argcnt++;
  		XtGetValues(hw->html.vbar, arg, argcnt);
  	}
  
***************
*** 1065,1071 ****
  	if (hw->html.hbar != NULL)
  	{
  		argcnt = 0;
! 		XtSetArg(arg[argcnt], XmNheight, &height); argcnt++;
  		XtGetValues(hw->html.hbar, arg, argcnt);
  	}
  
--- 1187,1193 ----
  	if (hw->html.hbar != NULL)
  	{
  		argcnt = 0;
! 		XtSetArg(arg[argcnt], XxNheight, &height); argcnt++;
  		XtGetValues(hw->html.hbar, arg, argcnt);
  	}
  
***************
*** 1093,1100 ****
--- 1215,1226 ----
  	/*
  	 * Move and size the viewing area
  	 */
+ #ifdef MOTIF
  	vx = hw->manager.shadow_thickness;
  	vy = hw->manager.shadow_thickness;
+ #else
+ 	vx = vy = 0;
+ #endif
  	if ((hw->html.use_vbar == True)&&(hw->html.vbar_right == False))
  	{
  		vx += VbarWidth(hw);
***************
*** 1120,1126 ****
  		 * the viewing area
  		 */
  		XtResizeWidget(hw->html.vbar, hw->html.vbar->core.width,
! 		    hw->html.view_height + (2 * hw->manager.shadow_thickness),
  		    hw->html.vbar->core.border_width);
  
  		/*
--- 1246,1258 ----
  		 * the viewing area
  		 */
  		XtResizeWidget(hw->html.vbar, hw->html.vbar->core.width,
! 		    hw->html.view_height + (2 * 
! #ifdef MOTIF
! 					    hw->manager.shadow_thickness
! #else
! 					    0
! #endif
! 					    ),
  		    hw->html.vbar->core.border_width);
  
  		/*
***************
*** 1200,1205 ****
--- 1332,1338 ----
  			hw->html.scroll_y = 0;
  		}
  
+ #ifdef MOTIF
  		argcnt = 0;
  		XtSetArg(arg[argcnt], XmNminimum, 0); argcnt++;
  		XtSetArg(arg[argcnt], XmNmaximum, maxv); argcnt++;
***************
*** 1210,1215 ****
--- 1343,1358 ----
                           hw->html.view_height > DEFAULT_INCREMENT ? 
                             hw->html.view_height - DEFAULT_INCREMENT : 1); argcnt++;
  		XtSetValues(hw->html.vbar, arg, argcnt);
+ #else
+ 
+ /*		setScrollBar(hw->html.vbar, 0, maxv,ss);*/
+ 		setScrollBar(hw->html.vbar, 
+ 			     hw->html.scroll_y,
+ 			     hw->html.doc_height, 
+ 			     hw->html.view_height);
+ 
+ #endif
+ 
  #ifdef DEBUG
  XtVaGetValues(hw->html.vbar, XmNsliderSize, &ss, NULL);
  fprintf (stderr, "real slider size %d\n", ss);
***************
*** 1229,1235 ****
  		 * the viewing area
  		 */
  		XtResizeWidget(hw->html.hbar,
! 		    hw->html.view_width + (2 * hw->manager.shadow_thickness),
  		    hw->html.hbar->core.height,
  		    hw->html.hbar->core.border_width);
  
--- 1372,1384 ----
  		 * the viewing area
  		 */
  		XtResizeWidget(hw->html.hbar,
! 		    hw->html.view_width + (2 *
! #ifdef MOTIF
! 					   hw->manager.shadow_thickness
! #else
! 					   0
! #endif
! 					   ),
  		    hw->html.hbar->core.height,
  		    hw->html.hbar->core.border_width);
  
***************
*** 1299,1304 ****
--- 1448,1454 ----
  			hw->html.scroll_x = 0;
  		}
  
+ #ifdef MOTIF
  		argcnt = 0;
  		XtSetArg(arg[argcnt], XmNminimum, 0); argcnt++;
  		XtSetArg(arg[argcnt], XmNmaximum, maxv); argcnt++;
***************
*** 1309,1314 ****
--- 1459,1471 ----
                           hw->html.view_width > DEFAULT_INCREMENT ? 
                             hw->html.view_width - DEFAULT_INCREMENT : 1); argcnt++;
  		XtSetValues(hw->html.hbar, arg, argcnt);
+ 
+ #else
+ 		setScrollBar(hw->html.hbar, 	
+ 			     hw->html.scroll_x,
+ 			     hw->html.doc_width, 
+ 			     hw->html.view_width);
+ #endif
  	}
  
  #ifdef DEBUG
***************
*** 1346,1352 ****
--- 1503,1513 ----
  	 */
  	swidth = VbarWidth(hw);
  	sheight = HbarHeight(hw);
+ #ifdef MOTIF
  	st = hw->manager.shadow_thickness;
+ #else
+ 	st = 0;
+ #endif
  	if (hw->core.width <= swidth)
  	{
  		hw->core.width = swidth + 10;
***************
*** 1603,1609 ****
          new->html.cached_tracked_ele = NULL;
  
          /* Initialize cursor used when pointer is inside anchor. */
!         if (in_anchor_cursor == NULL)
            in_anchor_cursor = XCreateFontCursor (XtDisplay (new), XC_hand2);
  
          return;
--- 1764,1770 ----
          new->html.cached_tracked_ele = NULL;
  
          /* Initialize cursor used when pointer is inside anchor. */
!         if (in_anchor_cursor == (Cursor) NULL)
            in_anchor_cursor = XCreateFontCursor (XtDisplay (new), XC_hand2);
  
          return;
***************
*** 1766,1777 ****
  {
  	XExposeEvent *ExEvent = (XExposeEvent *)event;
  	int dx, dy;
- 	Dimension st;
  
  	/*
  	 * find out where the shadow is based on scrollbars
  	 */
! 	st = hw->manager.shadow_thickness;
  	dx = dy = 0;
  	if ((hw->html.use_vbar == True)&&(hw->html.vbar_right == False))
  	{
--- 1927,1941 ----
  {
  	XExposeEvent *ExEvent = (XExposeEvent *)event;
  	int dx, dy;
  
+ #ifdef MOTIF
  	/*
  	 * find out where the shadow is based on scrollbars
  	 */
! 
! 	Dimension st = hw->manager.shadow_thickness;
! #endif
! 
  	dx = dy = 0;
  	if ((hw->html.use_vbar == True)&&(hw->html.vbar_right == False))
  	{
***************
*** 1782,1787 ****
--- 1946,1952 ----
  		dy += HbarHeight(hw);
  	}
  
+ #ifdef MOTIF
  	/*
  	 * Redraw the shadow around the scrolling area which may have been
  	 * messed up.
***************
*** 1790,1795 ****
--- 1955,1961 ----
  		hw->manager.bottom_shadow_GC, hw->manager.top_shadow_GC,
  		hw->manager.shadow_thickness, dx, dy,
  		hw->html.view_width + (2 * st),hw->html.view_height + (2 * st));
+ #endif
  
  #ifdef MOTIF
  #ifdef MOTIF1_2
***************
*** 1829,1835 ****
--- 1995,2005 ----
  	 */
  	swidth = VbarWidth(hw);
  	sheight = HbarHeight(hw);
+ #ifdef MOTIF
  	st = hw->manager.shadow_thickness;
+ #else
+ 	st = 0;
+ #endif
  	if (hw->core.width <= swidth)
  	{
  		hw->core.width = swidth + 10 ;
***************
*** 2002,2008 ****
  			eptr->bg = bg;
  			TextRefresh(hw, eptr,
  				0, (eptr->edata_len - 2));
- 			eptr->fg = old_fg;
  			eptr->bg = old_bg;
  		}
  		else if (eptr->type == E_IMAGE)
--- 2172,2177 ----
***************
*** 2196,2202 ****
  SetSelection(hw)
  	HTMLWidget hw;
  {
- 	struct ele_rec *eptr;
  	struct ele_rec *start;
  	struct ele_rec *end;
  	int start_pos, end_pos;
--- 2365,2370 ----
***************
*** 2327,2333 ****
  ClearSelection(hw)
  	HTMLWidget hw;
  {
- 	struct ele_rec *eptr;
  	struct ele_rec *start;
  	struct ele_rec *end;
  	int start_pos, end_pos;
--- 2495,2500 ----
***************
*** 3274,3280 ****
  	}
  #endif /* MOTIF */
  
! 	if (event->type == ButtonRelease)
  	{
  		eptr = LocateElement(hw, event->xbutton.x, event->xbutton.y,
  				&epos);
--- 3441,3447 ----
  	}
  #endif /* MOTIF */
  
! 	if ((event->type == ButtonRelease) || (event->type == ButtonPress))
  	{
  		eptr = LocateElement(hw, event->xbutton.x, event->xbutton.y,
  				&epos);
***************
*** 3394,3400 ****
  	return;
  }
  
! 
  
  /*
   * SetValues is called when XtSetValues is used to change resources in this
--- 3561,3710 ----
  	return;
  }
  
! #ifndef MOTIF
! #include <X11/Xaw/AsciiText.h>
! /*
!  * Process key input passwd widgets
!  */
! static void
! #ifdef _NO_PROTO
! _HTMLpwdInput( w, event, params, num_params)
! 	Widget w ;
! 	XEvent *event ;
! 	String *params;		/* unused */
! 	Cardinal *num_params;	/* unused */
! #else
! _HTMLpwdInput(
! 	Widget w,
! 	XEvent *event,
! 	String *params,		/* unused */
! 	Cardinal *num_params)	/* unused */
! #endif
!      {
!      char buffer[50];
!      KeySym ks;
!      char *keySymString;
!      char *star = "*";
!      int length, passwdLength, i, insertPos, maxLength;
!      Boolean stringInPlace; 
!      
!      if (event->type == KeyPress)
! 	 {
! 	 HTMLWidget hw = (HTMLWidget)XtParent(XtParent(w));
! 	 WidgetInfo *wptr;
! 
! 	 if (XtClass((Widget)hw) != htmlWidgetClass) 
! 	     return;   /* it was not for us */
!  
! 	/*
! 	 * find the structure for this widget
! 	 */
! 	wptr = hw->html.widget_list;
! 	while (wptr != NULL)
! 	    {
! 	    if (wptr->w == w)
! 		break;
! 	    wptr = wptr->next;
! 	    }
! 	 if (wptr == NULL)
! 	     return;
! 
! 	 passwdLength = wptr->password ? strlen(wptr->password) : 0;
! 
! 	 length = XLookupString((XKeyEvent *)event, 
! 				buffer, 50, &ks, NULL);
! 	 keySymString = XKeysymToString(ks);
! 	 XtVaGetValues(w,
! 		       XtNinsertPosition,&insertPos,
! 		       XtNuseStringInPlace, &stringInPlace,
! 		       XtNlength, &maxLength,
! 		       NULL);
! 
!          if (maxLength<1) maxLength = 1000000;
! 
! 	 if (!strcmp("Left",keySymString))
! 	     {
! 	     if (insertPos > 0)
! 		 XtVaSetValues(w,XtNinsertPosition,--insertPos,NULL);
! 	     return;
! 	     }
! 	 else if (!strcmp("Right",keySymString))
! 	     {
! 	     if (insertPos < passwdLength)
! 		 XtVaSetValues(w,XtNinsertPosition,++insertPos,NULL);
! 	     return;
! 	     }
! 
! 	 if ((!strcmp("BackSpace",keySymString))
! 	     || (!strcmp("Backspace",keySymString))
! 	     || (!strcmp("Delete",keySymString)) ) 
! 	     {
! 	     insertPos --;
! 
! 	     if (passwdLength>0)
! 		 {
! 		 char *pwd = &(wptr->password[insertPos]);
! 
! 		 for (i = passwdLength - insertPos; i>0; i--,pwd++)
! 		     *pwd = *(pwd+1);
! 
! /*		 fprintf(stderr,"modified passwd <%s>\n", wptr->password);*/
! 		 XtCallActionProc(w, 
! 				  insertPos>-1 ? "delete-previous-character" :
! 				  "delete-next-character",
! 				  event, NULL,0);
! 		 }
! 	     /* else nothing to erase */
! 	     return;
! 	     }
! 
! 	 if (length == 1)
! 	     {
! 	     buffer[1] = '\0';
! 
! 	     if (passwdLength>0)
! 		 {
! 
! 		 if (passwdLength < maxLength)
! 		     {
! 		     char *pwd = wptr->password =
! 			 realloc(wptr->password, 
! 				 sizeof(char)*(passwdLength+2));
! 		     for (i=passwdLength+1; i>insertPos; i--)
! 			 pwd[i] = pwd[i-1];
! 		     
! 		     pwd[insertPos] = buffer[0];
! 		     }
! 		 }
! 	     else 
! 		 {
! 		 if (wptr->password == NULL)
! 		     wptr->password = malloc(sizeof(char)*2);
! 
! 		 wptr->password[0] = buffer[0];
! 		 wptr->password[1] = '\0';
! 		 }
! 
! 	     if (stringInPlace && passwdLength<maxLength)
! 		 {
! 		 char *txt;
! 		 /* insert string dumps core when  string in place is true */
! 
! 		 XtVaGetValues(w,XtNstring,&txt,NULL);
! 		 txt[passwdLength] = star[0];
! 		 txt[passwdLength+1] = '\0';
! 
! 		 /* the combined set values command does not work */
! 		 XtVaSetValues(w, XtNstring,txt, NULL);
! 		 XtVaSetValues(w, XtNinsertPosition,insertPos+1, NULL);
! 		 }
! 	     else
! 		 XtCallActionProc(w, "insert-string", event, &star, 1);
! /*	     fprintf(stderr,"modified passwd <%s>\n",  wptr->password); */
! 	     }
! 	 }
!      }
! #endif
  
  /*
   * SetValues is called when XtSetValues is used to change resources in this
***************
*** 3578,3584 ****
  #endif
  {
  	struct mark_up *mptr;
- 	char *tptr;
  	LinkInfo l_info;
  
  	mptr = hw->html.html_objects;
--- 3888,3893 ----
***************
*** 3605,3611 ****
  	}
  }
  
! 
  /*
   * Search through the whole document, and recolor the internal elements with
   * the passed HREF.
--- 3914,3920 ----
  	}
  }
  
! #ifdef NOT_USED
  /*
   * Search through the whole document, and recolor the internal elements with
   * the passed HREF.
***************
*** 3644,3650 ****
  		start = start->next;
  	}
  }
! 
  
  
  static Boolean
--- 3953,3959 ----
  		start = start->next;
  	}
  }
! #endif
  
  
  static Boolean
***************
*** 3996,4001 ****
--- 4305,4311 ----
  }
  
  
+ 
  /*
   * Convenience function to position the element
   * based on the element id passed at the top of the viewing area.
***************
*** 4014,4020 ****
--- 4324,4332 ----
  	struct ele_rec *start;
  	struct ele_rec *eptr;
  	int newy;
+ #ifdef MOTIF
  	int val, size, inc, pageinc;
+ #endif
  
  	/*
  	 * If we have no scrollbar, just return.
***************
*** 4067,4076 ****
--- 4379,4398 ----
  	{
  		newy = 0;
  	}
+ #ifdef MOTIF
  	XmScrollBarGetValues(hw->html.vbar, &val, &size, &inc, &pageinc);
  	XmScrollBarSetValues(hw->html.vbar, newy, size, inc, pageinc, True);
  	XmScrollBarGetValues(hw->html.hbar, &val, &size, &inc, &pageinc);
  	XmScrollBarSetValues(hw->html.hbar, 0, size, inc, pageinc, True);
+ #else
+ 
+ 	ScrollToPos(hw->html.vbar, hw, newy);
+ 	ScrollToPos(hw->html.hbar, hw, 0);
+ 
+ 	setScrollBar(hw->html.vbar, newy, 
+ 		     hw->html.doc_height,
+ 		     hw->html.view_height);
+ #endif
  }
  
  
*** HTMLP.h.ORIG	Fri Sep 24 04:04:52 1993
--- HTMLP.h	Thu Oct 21 20:38:18 1993
***************
*** 62,68 ****
  # endif /* MOTIF1_2 */
  #else
  #include <X11/IntrinsicP.h>
- #include <X11/ConstrainP.h>
  #endif /* MOTIF */
  
  #include "HTML.h"
--- 62,67 ----
***************
*** 202,206 ****
--- 201,227 ----
  #endif /* MOTIF */
  	HTMLPart		html;
  } HTMLRec;
+ 
+ /*
+  * to reduce the number of MOTIF/ATHENA ifdefs around the code
+  * we use some generalized constants
+  */
+ 
+ #ifdef MOTIF
+ #   define XxNx      XmNx
+ #   define XxNy      XmNy
+ #   define XxNwidth  XmNwidth
+ #   define XxNheight XmNheight
+ #   define XxNset    XmNset
+ #   define XxNvalue  XmNvalue
+ #else
+ #   define XxNx      XtNx
+ #   define XxNy      XtNy
+ #   define XxNwidth  XtNwidth
+ #   define XxNheight XtNheight
+ #   define XxNset    XtNstate
+ #   define XxNvalue  XtNstring
+ #endif
+ 
  
  #endif /* HTMLP_H */
*** HTMLformat.c.ORIG	Mon Oct 18 03:46:14 1993
--- HTMLformat.c	Sun Oct 31 17:27:19 1993
***************
*** 579,584 ****
--- 579,585 ----
  				{
  				    eptr->pic_data = (*(resolveImageProc)
  					(hw->html.resolveImage))(hw, edata, 0);
+ 
  				    if (eptr->pic_data != NULL)
  				    {
  					eptr->pic_data->delayed = 0;
***************
*** 589,594 ****
--- 590,596 ----
  					eptr->pic_data->internal = internal;
  				}
  			}
+ 
  			if (eptr->pic_data == NULL)
  			{
  				eptr->pic_data = NoImageData(hw);
***************
*** 1700,1706 ****
  	char *ptr;
  	char tchar;
  	int tab_count, char_cnt;
- 	int len;
  	int dir, ascent, descent;
          XCharStruct all;
  	char *line;
--- 1702,1707 ----
***************
*** 1896,1913 ****
  	char *end;
  	char *ptr;
  	char tchar;
- 	char tchar2;
  	int stripped_space;
  	int added_space;
  	int double_space;
- 	int len;
  	int dir, ascent, descent;
          XCharStruct all;
  	char *line;
  	int line_x;
  
  	text = mptr->text;
- 
  	line_x = *x;
  	line = (char *)malloc(1);
  	line[0] = '\0';
--- 1897,1911 ----
***************
*** 1939,1944 ****
--- 1937,1943 ----
  		 * Add the word to the end of this line, or insert
  		 * a linefeed an put the word at the start of the next line.
  		 */
+ 
  		if (start != end)
  		{
  			int nobreak;
***************
*** 1976,1994 ****
  			strcat(ptr, start);
  
  #ifdef DOUBLE_SPACE_AFTER_PUNCT
  			/*
  			 * If this text ends in '.', '!', or '?' we need
  			 * to set up the addition of two spaces after it.
  			 */
! 			tchar2 = ptr[strlen(ptr) - 1];
! 			if ((tchar2 == '.')||(tchar2 == '!')||(tchar2 == '?'))
! 			{
! 				double_space = 1;
! 			}
! 			else
! 			{
! 				double_space = 0;
! 			}
  #else
  			double_space = 0;
  #endif /* DOUBLE_SPACE_AFTER_PUNCT */
--- 1975,1995 ----
  			strcat(ptr, start);
  
  #ifdef DOUBLE_SPACE_AFTER_PUNCT
+ 			{char tchar2;
  			/*
  			 * If this text ends in '.', '!', or '?' we need
  			 * to set up the addition of two spaces after it.
  			 */
! 			 tchar2 = ptr[strlen(ptr) - 1];
! 			 if ((tchar2 == '.')||(tchar2 == '!')||(tchar2 == '?'))
! 			   {
! 			     double_space = 1;
! 			   }
! 			 else
! 			   {
! 			     double_space = 0;
! 			   }
! 		        }
  #else
  			double_space = 0;
  #endif /* DOUBLE_SPACE_AFTER_PUNCT */
***************
*** 2029,2034 ****
--- 2030,2036 ----
  				nobreak = 1;
  			}
  
+ 
  			if (((*x + all.width + MarginW) <= width)||(nobreak))
  			{
  				char *tptr;
***************
*** 2127,2133 ****
  		{
  			char *tptr;
  			char *spc;
- 
  			if (NeedSpace == 2)
  			{
  				spc = (char *)malloc(strlen("  ") + 1);
--- 2129,2134 ----
***************
*** 2141,2149 ****
  
  			XTextExtents(currentFont, spc, strlen(spc), &dir,
  				&ascent, &descent, &all);
- 
  			tptr = line;
! 			line = (char *)malloc(strlen(tptr) + strlen(spc) + 1);
  			if (line == NULL)
  			{
  				fprintf(stderr, "Cannot malloc space to compose line\n");
--- 2142,2149 ----
  
  			XTextExtents(currentFont, spc, strlen(spc), &dir,
  				&ascent, &descent, &all);
  			tptr = line;
! 			line = (char *)malloc(strlen(tptr) + strlen(spc) + 2);
  			if (line == NULL)
  			{
  				fprintf(stderr, "Cannot malloc space to compose line\n");
***************
*** 2163,2168 ****
--- 2163,2169 ----
  			NeedSpace = 0;
  		}
  	}
+ 
  	if (line[0] != '\0')
  	{
  		SetElement(hw, E_TEXT, currentFont,
***************
*** 2432,2439 ****
  	int *x, *y;
  	unsigned int width;
  {
- 	char *tptr;
- 
  	SetElement(hw, E_WIDGET, currentFont, *x, *y, mptr->start);
  
  	/*
--- 2433,2438 ----
***************
*** 2663,2669 ****
  	SelectInfo *sptr;
  {
  	int i, cnt;
- 	char *tptr;
  	char **tarray;
  
  	clean_white_space(sptr->option_buf);
--- 2662,2667 ----
***************
*** 2735,2741 ****
  	{
  		return;
  	}
! 
  	switch(type)
  	{
  		/*
--- 2733,2741 ----
  	{
  		return;
  	}
! /*fprintf(stderr,"TYPE=%d, ignore=%d, currentSelect %p\n",
! 	type,Ignore,CurrentSelect);
!  */
  	switch(type)
  	{
  		/*
***************
*** 3132,3137 ****
--- 3132,3138 ----
  					value = ComposeCommaList(
  						CurrentSelect->value,
  						CurrentSelect->value_cnt);
+ 
  					FreeCommaList(
  						CurrentSelect->options,
  						CurrentSelect->option_cnt);
***************
*** 3801,3807 ****
  	mptr = hw->html.html_objects;
  	Last = NULL;
  	while (mptr != NULL)
! 	{
  		TriggerMarkChanges(hw, mptr, x, y);
  		/*
  		 * Save last non-text mark
--- 3802,3808 ----
  	mptr = hw->html.html_objects;
  	Last = NULL;
  	while (mptr != NULL)
! 	  {
  		TriggerMarkChanges(hw, mptr, x, y);
  		/*
  		 * Save last non-text mark
***************
*** 3828,3834 ****
  {
  	int x, y;
  	struct mark_up *msave;
- 	struct mark_up *mptr;
  #ifdef TIMING
  gettimeofday(&Tv, &Tz);
  fprintf(stderr, "FormatAll enter (%d.%d)\n", Tv.tv_sec, Tv.tv_usec);
--- 3829,3834 ----
***************
*** 4122,4128 ****
  	{
  		int dir, nascent, descent;
  		XCharStruct all;
- 		int height;
  
  #ifdef ASSUME_FIXED_WIDTH_PRE
  		if (eptr->font == hw->html.plain_font)
--- 4122,4127 ----
***************
*** 4265,4271 ****
  
  	if (eptr->strikeout == True)
  	{
! 		int i, ly;
  
  		XSetLineAttributes(XtDisplay(hw), hw->html.drawGC, 1,
  			LineSolid, CapButt, JoinBevel);
--- 4264,4270 ----
  
  	if (eptr->strikeout == True)
  	{
! 		int ly;
  
  		XSetLineAttributes(XtDisplay(hw), hw->html.drawGC, 1,
  			LineSolid, CapButt, JoinBevel);
***************
*** 4426,4444 ****
  	y1 = y1 - hw->html.scroll_y;
  	height = eptr->line_height;
  
  	XSetForeground(XtDisplay(hw), hw->html.drawGC, eptr->bg);
  	XFillRectangle(XtDisplay(hw->html.view), XtWindow(hw->html.view),
  		hw->html.drawGC, x1, y1, width, height);
- 	y1 = y1 + (height / 2) - 1;
  
  	XSetLineAttributes(XtDisplay(hw), hw->html.drawGC, 1,
  		LineSolid, CapButt, JoinBevel);
! 	XDrawLine(XtDisplay(hw->html.view), XtWindow(hw->html.view),
! 		hw->manager.bottom_shadow_GC,
! 		x1, y1, (int)(x1 + width), y1);
  	XDrawLine(XtDisplay(hw->html.view), XtWindow(hw->html.view),
  		hw->manager.top_shadow_GC,
  		x1, y1 + 1, (int)(x1 + width), y1 + 1);
  }
  
  
--- 4425,4449 ----
  	y1 = y1 - hw->html.scroll_y;
  	height = eptr->line_height;
  
+ 	/* blank out area */
  	XSetForeground(XtDisplay(hw), hw->html.drawGC, eptr->bg);
  	XFillRectangle(XtDisplay(hw->html.view), XtWindow(hw->html.view),
  		hw->html.drawGC, x1, y1, width, height);
  
+ 	y1 = y1 + (height / 2) - 1;
  	XSetLineAttributes(XtDisplay(hw), hw->html.drawGC, 1,
  		LineSolid, CapButt, JoinBevel);
! #ifdef MOTIF
  	XDrawLine(XtDisplay(hw->html.view), XtWindow(hw->html.view),
  		hw->manager.top_shadow_GC,
  		x1, y1 + 1, (int)(x1 + width), y1 + 1);
+ #else
+ 	/* changing the GC back and forth is not the most efficient way.... */
+ 	XSetForeground(XtDisplay(hw), hw->html.drawGC, eptr->fg);
+ 	XDrawLine(XtDisplay(hw->html.view), XtWindow(hw->html.view),
+ 		hw->html.drawGC,
+ 		x1, y1, (int)(x1 + width), y1);
+ #endif
  }
  
  
***************
*** 4533,4545 ****
  
  		if (eptr->pic_data->image != (Pixmap)NULL)
  		{
  			XCopyArea(XtDisplay(hw->html.view),
  				eptr->pic_data->image,
  				XtWindow(hw->html.view), hw->html.drawGC, 0, 0,
  				eptr->pic_data->width, eptr->pic_data->height,
  				(x + extra),
  				(y + extra));
! 
  		}
  		if ((eptr->pic_data->delayed)&&(eptr->anchorHRef != NULL)&&
  			(!IsDelayedHRef(hw, eptr->anchorHRef)))
--- 4538,4551 ----
  
  		if (eptr->pic_data->image != (Pixmap)NULL)
  		{
+ /*fprintf(stderr,"   XCopyArea of pixmap 0x%x\n",	eptr->pic_data->image);*/
  			XCopyArea(XtDisplay(hw->html.view),
  				eptr->pic_data->image,
  				XtWindow(hw->html.view), hw->html.drawGC, 0, 0,
  				eptr->pic_data->width, eptr->pic_data->height,
  				(x + extra),
  				(y + extra));
! /*fprintf(stderr,"   XCopyArea done\n");*/
  		}
  		if ((eptr->pic_data->delayed)&&(eptr->anchorHRef != NULL)&&
  			(!IsDelayedHRef(hw, eptr->anchorHRef)))
*** HTMLjot.c.ORIG	Wed Oct 20 06:23:03 1993
--- HTMLjot.c	Sun Oct 24 16:21:12 1993
***************
*** 51,57 ****
   * Comments and questions are welcome and can be sent to                    *
   * mosaic-x@ncsa.uiuc.edu.                                                  *
   ****************************************************************************/
! 
  #include <stdio.h>
  #include "inkstore.h"
  #include "HTMLP.h"
--- 51,57 ----
   * Comments and questions are welcome and can be sent to                    *
   * mosaic-x@ncsa.uiuc.edu.                                                  *
   ****************************************************************************/
! #ifdef MOTIF
  #include <stdio.h>
  #include "inkstore.h"
  #include "HTMLP.h"
***************
*** 639,641 ****
--- 639,642 ----
  	return(buffer);
  }
  
+ #endif /* MOTIF */
*** HTMLwidgets.c.ORIG	Mon Oct 18 07:03:22 1993
--- HTMLwidgets.c	Sun Oct 31 20:21:30 1993
***************
*** 55,60 ****
--- 55,61 ----
  #include <stdio.h>
  #include <ctype.h>
  #include <string.h>
+ #ifdef MOTIF
  #include <Xm/Xm.h>
  #include <Xm/Frame.h>
  #include <Xm/DrawingA.h>
***************
*** 65,82 ****
  #include <Xm/PushB.h>
  #include <Xm/RowColumn.h>
  #include <Xm/List.h>
  #include "HTMLP.h"
  
  
! #define	W_TEXTFIELD	0
! #define	W_CHECKBOX	1
! #define	W_RADIOBOX	2
! #define	W_PUSHBUTTON	3
! #define	W_PASSWORD	4
! #define	W_OPTIONMENU	5
! #define	W_TEXTAREA	6
! #define	W_LIST		7
! #define	W_JOT		8
  
  
  extern void NewJot();
--- 66,96 ----
  #include <Xm/PushB.h>
  #include <Xm/RowColumn.h>
  #include <Xm/List.h>
+ #define STRING XmString
+ #else
+ #include <X11/Intrinsic.h>
+ #include <X11/StringDefs.h>
+ #include <X11/Xaw/Toggle.h>
+ #include <X11/Xaw/AsciiText.h>
+ #include <X11/Xaw/List.h>
+ #include <X11/Xaw/Viewport.h>
+ #include <X11/Xaw/MenuButton.h>
+ #include <X11/Xaw/SimpleMenu.h>
+ #include <X11/Xaw/SmeBSB.h>
+ #define STRING String
+ #endif
  #include "HTMLP.h"
  
  
! #define	      W_TEXTFIELD     0
! #define	      W_CHECKBOX      1
! #define       W_RADIOBOX      2
! #define       W_PUSHBUTTON    3
! #define       W_PASSWORD      4
! #define       W_OPTIONMENU    5
! #define       W_TEXTAREA      6
! #define       W_LIST          7
! #define       W_JOT           8
  
  
  extern void NewJot();
***************
*** 87,97 ****
  extern void EVJotRelease();
  extern char *EJB_JOTfromJot();
  extern char *ParseMarkTag();
! 
! 
  char **ParseCommaList();
  void FreeCommaList();
  
  
  void
  AddNewForm(hw, fptr)
--- 101,191 ----
  extern void EVJotRelease();
  extern char *EJB_JOTfromJot();
  extern char *ParseMarkTag();
!   
!   
  char **ParseCommaList();
  void FreeCommaList();
+   
+ 
+ #ifndef MOTIF
+ #define FONTHEIGHT(font) (font->max_bounds.ascent+font->max_bounds.descent)
+ 
+ void 
+ setTextSize(w,columns,lines)
+ Widget w;
+ int columns;
+ int lines;
+     {
+     XFontStruct *font;
+     Position lm, rm, tm, bm;
+     int width, height;
+ 
+     XtVaGetValues(w, XtNfont, &font, 
+ 		  XtNleftMargin,&lm,
+ 		  XtNrightMargin,&rm,
+ 		  XtNtopMargin,&tm,
+ 		  XtNbottomMargin,&bm,
+ 		  NULL);
+     width  = rm + lm + columns*XTextWidth(font, "0", 1);
+     height = tm + bm + lines*FONTHEIGHT(font);
+     XtVaSetValues(w, 
+ 		  XtNwidth, width, 
+ 		  XtNheight, height, 
+ 		  NULL);
+     }
+ 
+ void
+ CBListDestroy(w, client_data, call_data)
+ 	Widget w;
+ 	caddr_t client_data;
+ 	caddr_t call_data;
+ {
+   char ** string_list, ** p;
+   int item_count;
+ 
+   XtVaGetValues(w, 
+ 		XtNlist, string_list,
+ 		XtNnumberStrings, item_count,
+ 		NULL);
+ /*fprintf(stderr,"FREE WIDGET INFO freeing list, %d items\n",item_count);*/
+ 
+   p=string_list;
+   while(item_count>0)
+     {
+       free(*p++);
+       item_count--;
+     }
+   free(string_list);
+ }
+ 
+ void
+ CBTextDestroy(w, client_data, call_data)
+ Widget w;
+ caddr_t client_data;
+ caddr_t call_data;
+     {
+     char *txt = (char *)client_data;
+     /*
+        fprintf(stderr,"FREE WIDGET INFO freeing text %p of widget %s?\n",
+        txt,XtName(w));
+      */
+     free(txt);
+     }
  
+ void
+ CBoption(w, client_data, call_data)
+ Widget w;
+ caddr_t client_data;
+ caddr_t call_data;
+     {
+     Widget menuButton = (Widget)client_data;
+     char *label;
+     XtVaGetValues(menuButton, XtNlabel, &label, NULL);
+     XtVaGetValues(w, XtNlabel, &label, NULL);
+     XtVaSetValues(menuButton, XtNlabel, label, NULL);
+     }
+ 
+ #endif
  
  void
  AddNewForm(hw, fptr)
***************
*** 125,138 ****
--- 219,240 ----
  	caddr_t call_data;
  {
  	FormInfo *fptr = (FormInfo *)client_data;
+ #ifdef MOTIF
  	XmPushButtonCallbackStruct *pb =
  		(XmPushButtonCallbackStruct *)call_data;
+ #else
+ 	Boolean state;
+ #endif
  	HTMLWidget hw = (HTMLWidget)(fptr->hw);
  	WbFormCallbackData cbdata;
  	WidgetInfo *wptr;
  	int cnt;
  
+ #ifdef MOTIF
  	cbdata.event = pb->event;
+ #else
+ 	/******* WE HAVE NO EVENT in ATHENA *******/
+ #endif
  	cbdata.href = fptr->action;
  	if (fptr->end == -1)  /* unterminated FORM tag */
  	{
***************
*** 179,186 ****
  	    if ((wptr->name)&&(wptr->type != W_PUSHBUTTON))
  	    {
  		Widget child;
! 		XmString label;
! 		XmString *str_list;
  		int list_cnt;
  		Cardinal argcnt;
  		Arg arg[5];
--- 281,292 ----
  	    if ((wptr->name)&&(wptr->type != W_PUSHBUTTON))
  	    {
  		Widget child;
! 		STRING *str_list;
! #ifdef MOTIF
! 		STRING label;
! #else
! 		XawListReturnStruct *currentSelection;
! #endif
  		int list_cnt;
  		Cardinal argcnt;
  		Arg arg[5];
***************
*** 190,314 ****
  		switch(wptr->type)
  		{
  			case W_TEXTFIELD:
  				cbdata.attribute_values[cnt] =
  					XmTextFieldGetString(wptr->w);
! 				if ((cbdata.attribute_values[cnt] != NULL)&&
! 				    (cbdata.attribute_values[cnt][0] == '\0'))
! 				{
! 					cbdata.attribute_values[cnt] = NULL;
! 				}
! 				break;
! 			case W_TEXTAREA:
! 				argcnt = 0;
! 				XtSetArg(arg[argcnt], XmNworkWindow, &child);
! 				argcnt++;
! 				XtGetValues(wptr->w, arg, argcnt);
! 				cbdata.attribute_values[cnt] =
! 					XmTextGetString(child);
! 				if ((cbdata.attribute_values[cnt] != NULL)&&
! 				    (cbdata.attribute_values[cnt][0] == '\0'))
! 				{
! 					cbdata.attribute_values[cnt] = NULL;
! 				}
! 				break;
! 			case W_PASSWORD:
! 				cbdata.attribute_values[cnt] = wptr->password;
! 				if ((cbdata.attribute_values[cnt] != NULL)&&
! 				    (cbdata.attribute_values[cnt][0] == '\0'))
! 				{
! 					cbdata.attribute_values[cnt] = NULL;
! 				}
! 				break;
! 			case W_LIST:
! 				argcnt = 0;
! 				XtSetArg(arg[argcnt], XmNworkWindow, &child);
! 				argcnt++;
! 				XtGetValues(wptr->w, arg, argcnt);
! 				argcnt = 0;
! 				XtSetArg(arg[argcnt], XmNselectedItemCount,
! 					&list_cnt);
! 				argcnt++;
! 				XtSetArg(arg[argcnt], XmNselectedItems,
! 					&str_list);
! 				argcnt++;
! 				XtGetValues(child, arg, argcnt);
! 				if (list_cnt == 0)
! 				{
! 					cbdata.attribute_values[cnt] = NULL;
! 				}
! 				else /* list_cnt >= 1 */
! 				{
! 					int j, new_cnt;
! 					char **names;
! 					char **values;
! 
! 					if (list_cnt > 1)
! 					{
! 					    new_cnt = cbdata.attribute_count +
! 						list_cnt - 1;
! 					    names = (char **)malloc(new_cnt *
! 						sizeof(char *));
! 					    values = (char **)malloc(new_cnt *
! 						sizeof(char *));
! 					    for (j=0; j<cnt; j++)
! 					    {
! 						names[j] =
! 						    cbdata.attribute_names[j];
! 						values[j] =
! 						    cbdata.attribute_values[j];
! 					    }
! 					    free((char *)
! 						cbdata.attribute_names);
! 					    free((char *)
! 						cbdata.attribute_values);
! 					    cbdata.attribute_names = names;
! 					    cbdata.attribute_values = values;
! 					    cbdata.attribute_count = new_cnt;
! 					}
! 
! 					for (j=0; j<list_cnt; j++)
! 					{
! 						cbdata.attribute_names[cnt + j]
! 							= wptr->name;
! 						XmStringGetLtoR(str_list[j],
! 						    XmSTRING_DEFAULT_CHARSET,
! 						    &val);
! 						if ((val != NULL)&&
! 							(val[0] == '\0'))
! 						{
! 							val = NULL;
! 						}
! 						cbdata.attribute_values[cnt + j]
! 							= val;
! 					}
! 					cnt = cnt + list_cnt - 1;
! 				}
! 				break;
! 			/*
! 			 * For an option menu, first get the label gadget
! 			 * which holds the current value.
! 			 * Now get the text from that label as a character
! 			 * string.
! 			 */
! 			case W_OPTIONMENU:
! 				child = XmOptionButtonGadget(wptr->w);
! 				argcnt = 0;
! 				XtSetArg(arg[argcnt], XmNlabelString, &label);
! 				argcnt++;
! 				XtGetValues(child, arg, argcnt);
! 				val = NULL;
! 				XmStringGetLtoR(label, XmSTRING_DEFAULT_CHARSET,
! 					&val);
! 				cbdata.attribute_values[cnt] = val;
  				if ((cbdata.attribute_values[cnt] != NULL)&&
  				    (cbdata.attribute_values[cnt][0] == '\0'))
  				{
  					cbdata.attribute_values[cnt] = NULL;
  				}
  				break;
! 			case W_CHECKBOX:
! 			case W_RADIOBOX:
  				if (XmToggleButtonGetState(wptr->w) == True)
  				{
  				    cbdata.attribute_values[cnt] = wptr->value;
  				}
--- 296,464 ----
  		switch(wptr->type)
  		{
  			case W_TEXTFIELD:
+ #ifdef MOTIF
  				cbdata.attribute_values[cnt] =
  					XmTextFieldGetString(wptr->w);
! #else
! 				XtVaGetValues(wptr->w,XtNstring,
! 					      &(cbdata.attribute_values[cnt]),
! 					      NULL);
! #endif
  				if ((cbdata.attribute_values[cnt] != NULL)&&
  				    (cbdata.attribute_values[cnt][0] == '\0'))
  				{
  					cbdata.attribute_values[cnt] = NULL;
  				}
  				break;
!                       case W_TEXTAREA:
!                               argcnt = 0;
! #ifdef MOTIF
!                               XtSetArg(arg[argcnt], XmNworkWindow, &child);
!                               argcnt++;
!                               XtGetValues(wptr->w, arg, argcnt);
!                               cbdata.attribute_values[cnt] =
!                                       XmTextGetString(child);
! #else
!                               XtSetArg(arg[argcnt], XtNstring, 
! 				       &(cbdata.attribute_values[cnt]));
!                               XtGetValues(wptr->w, arg, argcnt);
! #endif
!                               if ((cbdata.attribute_values[cnt] != NULL)&&
!                                   (cbdata.attribute_values[cnt][0] == '\0'))
!                               {
!                                       cbdata.attribute_values[cnt] = NULL;
!                               }
!                               break;
!                       case W_PASSWORD:
!                               cbdata.attribute_values[cnt] = wptr->password;
!                               if ((cbdata.attribute_values[cnt] != NULL)&&
!                                   (cbdata.attribute_values[cnt][0] == '\0'))
!                               {
!                                       cbdata.attribute_values[cnt] = NULL;
!                               }
!                               break;
!                       case W_LIST:
! #ifdef MOTIF
!                               argcnt = 0;
!                               XtSetArg(arg[argcnt], XmNworkWindow, &child);
!                               argcnt++;
!                               XtGetValues(wptr->w, arg, argcnt);
! #else
! 				{ WidgetList wl;
! 				  XtVaGetValues(wptr->w,XtNchildren,&wl,NULL);
! 				  child = *++wl;
! 				}
! #endif
! #ifdef MOTIF
!                               argcnt = 0;
!                               XtSetArg(arg[argcnt], XmNselectedItemCount,
!                                       &list_cnt);
!                               argcnt++;
!                               XtSetArg(arg[argcnt], XmNselectedItems,
!                                       &str_list);
!                               argcnt++;
!                               XtGetValues(child, arg, argcnt);
! #else
! 			      currentSelection = XawListShowCurrent(child);
! 			      
! 			      list_cnt = 
! 				 currentSelection->list_index == XAW_LIST_NONE?
! 				      0 : 1;
! 			      str_list = &(currentSelection->string);
! #endif
!                               if (list_cnt == 0)
!                               {
!                                       cbdata.attribute_values[cnt] = NULL;
!                               }
!                               else /* list_cnt >= 1 */
!                               {
!                                       int j, new_cnt;
!                                       char **names;
!                                       char **values;
! 
!                                       if (list_cnt > 1)
!                                       {
!                                           new_cnt = cbdata.attribute_count +
!                                               list_cnt - 1;
!                                           names = (char **)malloc(new_cnt *
!                                               sizeof(char *));
!                                           values = (char **)malloc(new_cnt *
!                                               sizeof(char *));
!                                           for (j=0; j<cnt; j++)
!                                           {
!                                               names[j] =
!                                                   cbdata.attribute_names[j];
!                                               values[j] =
!                                                   cbdata.attribute_values[j];
!                                           }
!                                           free((char *)
!                                               cbdata.attribute_names);
!                                           free((char *)
!                                               cbdata.attribute_values);
!                                           cbdata.attribute_names = names;
!                                           cbdata.attribute_values = values;
!                                           cbdata.attribute_count = new_cnt;
!                                       }
! 
!                                       for (j=0; j<list_cnt; j++)
!                                       {
!                                               cbdata.attribute_names[cnt + j]
!                                                       = wptr->name;
! #ifdef MOTIF
!                                               XmStringGetLtoR(str_list[j],
!                                                   XmSTRING_DEFAULT_CHARSET,
!                                                   &val);
!                                               if ((val != NULL)&&
!                                                       (val[0] == '\0'))
!                                               {
!                                                       val = NULL;
!                                               }
!                                               cbdata.attribute_values[cnt + j]
!                                                       = val;
! #else
!                                               cbdata.attribute_values[cnt + j]
!                                                       = str_list[j];
! #endif
!                                       }
!                                       cnt = cnt + list_cnt - 1;
!                               }
!                               break;
! 
!                       /*
!                        * For an option menu, first get the label gadget
!                        * which holds the current value.
!                        * Now get the text from that label as a character
!                        * string.
!                        */
!                       case W_OPTIONMENU:
! #ifdef MOTIF
!                               child = XmOptionButtonGadget(wptr->w);
!                               argcnt = 0;
!                               XtSetArg(arg[argcnt], XmNlabelString, &label);
!                               argcnt++;
!                               XtGetValues(child, arg, argcnt);
!                               val = NULL;
!                               XmStringGetLtoR(label, XmSTRING_DEFAULT_CHARSET,
!                                       &val);
! #else
! 			      XtVaGetValues(wptr->w,XtNlabel,&val,NULL);
! #endif
!                               cbdata.attribute_values[cnt] = val;
!                               if ((cbdata.attribute_values[cnt] != NULL)&&
!                                   (cbdata.attribute_values[cnt][0] == '\0'))
!                               {
!                                       cbdata.attribute_values[cnt] = NULL;
!                               }
!                               break;
! 
!                         case W_CHECKBOX:
!                         case W_RADIOBOX:
! #ifdef MOTIF
  				if (XmToggleButtonGetState(wptr->w) == True)
+ #else
+ 				XtVaGetValues(wptr->w,XtNstate,&state,NULL);
+ 				if (state)
+ #endif
  				{
  				    cbdata.attribute_values[cnt] = wptr->value;
  				}
***************
*** 318,323 ****
--- 468,475 ----
  				    cbdata.attribute_count--;
  				}
  				break;
+ #ifdef MOTIF
+ /* only MOTIF */
  			case W_JOT:
  				argcnt = 0;
  				XtSetArg(arg[argcnt], XmNuserData,
***************
*** 327,332 ****
--- 479,485 ----
  				cbdata.attribute_values[cnt] =
  					EJB_JOTfromJot(child);
  				break;
+ #endif
  			default:
  				cbdata.attribute_values[cnt] = NULL;
  				break;
***************
*** 357,364 ****
--- 510,521 ----
  	caddr_t call_data;
  {
  	FormInfo *fptr = (FormInfo *)client_data;
+ #ifdef MOTIF
  	XmToggleButtonCallbackStruct *tb =
  		(XmToggleButtonCallbackStruct *)call_data;
+ #else
+ 	Boolean state;
+ #endif
  	HTMLWidget hw = (HTMLWidget)(fptr->hw);
  	WidgetInfo *wptr;
  	WidgetInfo *wtmp;
***************
*** 368,378 ****
  	/*
  	 * Only do stuff when the button is turned on.
  	 */
! 	if ((tb == NULL)||(tb->set == False))
  	{
  		return;
  	}
  
  	/*
  	 * Terminate the form if it was never properly terminated.
  	 */
--- 525,541 ----
  	/*
  	 * Only do stuff when the button is turned on.
  	 */
! #ifdef MOTIF
! 	if ((tb == NULL)||(tb->set == False)
! #else
!         XtVaGetValues(w,XtNstate,&state,NULL);
!         if (!state)
! #endif
  	{
  		return;
  	}
  
+ 
  	/*
  	 * Terminate the form if it was never properly terminated.
  	 */
***************
*** 436,454 ****
  	{
  		if ((wptr->type == W_RADIOBOX)&&
  			(wptr->w != w)&&
  			(XmToggleButtonGetState(wptr->w) == True)&&
  			(wptr->name != NULL)&&
  			(name != NULL)&&
  			(strcmp(wptr->name, name) == 0))
  		{
  			XmToggleButtonSetState(wptr->w, False, False);
  		}
  		cnt++;
  		wptr = wptr->next;
  	}
  }
  
! 
  /*
   * Catch all attempted modifications to the textfield for password
   * entry.  This is so we can prevent the password from showing
--- 599,627 ----
  	{
  		if ((wptr->type == W_RADIOBOX)&&
  			(wptr->w != w)&&
+ #ifdef MOTIF
  			(XmToggleButtonGetState(wptr->w) == True)&&
+ #endif
  			(wptr->name != NULL)&&
  			(name != NULL)&&
  			(strcmp(wptr->name, name) == 0))
  		{
+ #ifdef MOTIF
  			XmToggleButtonSetState(wptr->w, False, False);
+ #else
+ 			Boolean state;
+ 			XtVaGetValues(wptr->w, XtNstate, &state, NULL);
+ 			if (state)
+ 			    XtVaSetValues(wptr->w, XtNstate, 0, NULL);
+ #endif
  		}
  		cnt++;
  		wptr = wptr->next;
  	}
  }
  
! #ifdef MOTIF
! /* only MOTIF */
  /*
   * Catch all attempted modifications to the textfield for password
   * entry.  This is so we can prevent the password from showing
***************
*** 464,469 ****
--- 637,643 ----
  	caddr_t call_data;
  {
  	FormInfo *fptr = (FormInfo *)client_data;
+ 
  	XmTextVerifyCallbackStruct *tv =(XmTextVerifyCallbackStruct *)call_data;
  	HTMLWidget hw = (HTMLWidget)(fptr->hw);
  	WidgetInfo *wptr;
***************
*** 608,616 ****
  		}
  	}
  }
  
  
- 
  /*
   * RETURN was hit in a textfield in a form.
   * If this is the only textfield in this form, submit the form.
--- 782,790 ----
  		}
  	}
  }
+ #endif
  
  
  /*
   * RETURN was hit in a textfield in a form.
   * If this is the only textfield in this form, submit the form.
***************
*** 622,628 ****
--- 796,804 ----
  	caddr_t call_data;
  {
  	FormInfo *fptr = (FormInfo *)client_data;
+ #ifdef MOTIF
  	XmAnyCallbackStruct *cb = (XmAnyCallbackStruct *)call_data;
+ #endif
  	HTMLWidget hw = (HTMLWidget)(fptr->hw);
  	WidgetInfo *wptr;
  	int cnt, count;
***************
*** 697,704 ****
--- 873,882 ----
  	caddr_t call_data;
  {
  	FormInfo *fptr = (FormInfo *)client_data;
+ #ifdef MOTIF
  	XmPushButtonCallbackStruct *pb =
  		(XmPushButtonCallbackStruct *)call_data;
+ #endif
  	HTMLWidget hw = (HTMLWidget)(fptr->hw);
  	WidgetInfo *wptr;
  	int widget_count, cnt;
***************
*** 741,889 ****
  	while ((wptr != NULL)&&(cnt < widget_count))
  	{
  		Widget child;
  		Cardinal argcnt;
  		Arg arg[5];
! 		XmString label;
  		switch(wptr->type)
  		{
  			case W_TEXTFIELD:
! 				if (wptr->value == NULL)
! 				{
! 				    XmTextFieldSetString(wptr->w, "");
! 				}
! 				else
! 				{
! 				    XmTextFieldSetString(wptr->w, wptr->value);
! 				}
! 				break;
! 			case W_TEXTAREA:
! 				argcnt = 0;
! 				XtSetArg(arg[argcnt], XmNworkWindow, &child);
! 				argcnt++;
! 				XtGetValues(wptr->w, arg, argcnt);
! 				if (wptr->value == NULL)
! 				{
! 				    XmTextSetString(child, "");
! 				}
! 				else
! 				{
! 				    XmTextSetString(child, wptr->value);
! 				}
! 				break;
! 			case W_PASSWORD:
  				if (wptr->value == NULL)
  				{
  				    XmTextFieldSetString(wptr->w, "");
! 				    if (wptr->password != NULL)
! 				    {
! 					free(wptr->password);
! 					wptr->password = NULL;
  				    }
- 				}
  				else
  				{
! 				    int i, len;
! 
! 				    if (wptr->password != NULL)
! 				    {
! 					free(wptr->password);
! 					wptr->password = NULL;
! 				    }
! 				    len = strlen(wptr->value);
! 				    wptr->password = (char *)malloc(len + 1);
! 				    for (i=0; i<len; i++)
! 				    {
! 					wptr->password[i] = '*';
! 				    }
! 				    wptr->password[len] = '\0';
! 				    XmTextFieldSetString(wptr->w,
! 					wptr->password);
! 				    strcpy(wptr->password, wptr->value);
  				}
  				break;
! 			case W_LIST:
! 			    {
! 				char **vlist;
! 				int vlist_cnt;
! 				XmString *val_list;
! 				XmString label;
! 				int i;
! 
! 				argcnt = 0;
! 				XtSetArg(arg[argcnt], XmNworkWindow, &child);
! 				argcnt++;
! 				XtGetValues(wptr->w, arg, argcnt);
  
! 				if (wptr->value != NULL)
! 				{
! 				    vlist = ParseCommaList(wptr->value,
! 					&vlist_cnt);
! 				    val_list = (XmString *)malloc(vlist_cnt *
! 					sizeof(XmString));
! 				    XmListDeselectAllItems(child);
! 				    for (i=0; i<vlist_cnt; i++)
! 				    {
! 					val_list[i] =
! 						XmStringCreateSimple(vlist[i]);
! 				    }
! 				    FreeCommaList(vlist, vlist_cnt);
! 				    if (vlist_cnt > 0)
! 				    {
! 					argcnt = 0;
! 					XtSetArg(arg[argcnt], XmNselectedItems,
! 						val_list);
! 					argcnt++;
! 					XtSetArg(arg[argcnt],
! 						XmNselectedItemCount,
! 						vlist_cnt);
! 					argcnt++;
! 					XtSetValues(child, arg, argcnt);
! 				    }
! 				    for (i=0; i<vlist_cnt; i++)
! 				    {
! 					XmStringFree(val_list[i]);
! 				    }
! 				    if (val_list != NULL)
! 				    {
! 					free((char *)val_list);
! 				    }
! 				}
! 				else
! 				{
! 					XmListDeselectAllItems(child);
! 				}
! 			    }
! 				break;
! 			/*
! 			 * gack, we saved the widget id of the starting default
! 			 * into the value character pointer, just so we could
! 			 * yank it out here, and restore the default.
! 			 */
! 			case W_OPTIONMENU:
! 				if (wptr->value != NULL)
! 				{
! 					Widget hist = (Widget)wptr->value;
! 					Cardinal argcnt;
! 					Arg arg[5];
! 
! 					argcnt = 0;
! 					XtSetArg(arg[argcnt], XmNmenuHistory,
! 						hist);
! 					argcnt++;
! 					XtSetValues(wptr->w, arg, argcnt);
! 				}
! 				break;
! 			case W_CHECKBOX:
! 			case W_RADIOBOX:
! 				if (wptr->checked == True)
! 				{
! 				  XmToggleButtonSetState(wptr->w, True, False);
! 				}
! 				else
! 				{
! 				  XmToggleButtonSetState(wptr->w, False, False);
! 				}
  				break;
  			case W_JOT:
  				argcnt = 0;
  				XtSetArg(arg[argcnt], XmNuserData,
--- 919,1185 ----
  	while ((wptr != NULL)&&(cnt < widget_count))
  	{
  		Widget child;
+ #ifdef MOTIF
  		Cardinal argcnt;
  		Arg arg[5];
! 		STRING label;
! #else
! 		char * txt = NULL;
! 		int length = 0;
! 		Boolean stringInPlace;
! #endif
  		switch(wptr->type)
  		{
  			case W_TEXTFIELD:
! #ifndef MOTIF		 
! 		             XtVaGetValues(wptr->w, 
! 					   XtNuseStringInPlace, &stringInPlace,
! 					   XtNlength, &length,
! 					   NULL); 
! fprintf(stderr,"widget=<%s>, stringInPlace=%d, length=%d\n",
!         XtName(wptr->w),stringInPlace,length);
! 			     if (stringInPlace) 
! 			       {
! 				 XtVaGetValues(wptr->w, 
! 					       XtNstring, &txt, 
! 					       NULL);
! 				 fprintf(stderr,"perm string <%s>\n",txt);
! 			       }
! 
! #endif
  				if (wptr->value == NULL)
  				{
+ #ifdef MOTIF
  				    XmTextFieldSetString(wptr->w, "");
! #else
! 				    if (stringInPlace)
! 					{
! 					if (txt) *txt = '\0';
! 					XtVaSetValues(wptr->w, 
! 						      XtNstring, txt, 
! 						      NULL);
! 					}
! 				    else 
! 					XtVaSetValues(wptr->w, 
! 						      XtNstring, "", 
! 						      NULL);
! #endif
  				    }
  				else
  				{
! #ifdef MOTIF
! 				    XmTextFieldSetString(wptr->w, wptr->value);
! #else
! 				    if (stringInPlace) /* string in place */
! 				      {
! 					strncpy(txt,wptr->value,length);
! fprintf(stderr,"Not null, value=<%s>\n",wptr->value);
!                                          XtVaSetValues(wptr->w, 
! 						  XtNstring, txt, 
! 						  NULL);
! 				      }
! 				    else
! 				      {
! 					XtVaSetValues(wptr->w, 
! 						      XtNstring, wptr->value, 
! 						      NULL);
!                                       }
! #endif
  				}
  				break;
!                       case W_TEXTAREA:
! #ifdef MOTIF
!                               argcnt = 0;
!                               XtSetArg(arg[argcnt], XmNworkWindow, &child);
!                               argcnt++;
!                               XtGetValues(wptr->w, arg, argcnt);
! 			      XmTextSetString(child, 
! 					      wptr->value ? wptr->value : "");
! #else
! 			      XtVaSetValues(wptr->w, XtNstring, 
! 					    wptr->value ? wptr->value : "",
! 				            NULL);
! #endif
!                               break;
!                       case W_PASSWORD:
!                               if (wptr->value == NULL)
!                               {
! #ifdef MOTIF
!                                   XmTextFieldSetString(wptr->w, "");
! #else
! 				  XtVaSetValues(wptr->w, 
! 						XtNstring, "",	NULL);
! #endif
!                                   if (wptr->password != NULL)
!                                   {
!                                       free(wptr->password);
!                                       wptr->password = NULL;
!                                   }
!                               }
!                               else
!                               {
!                                   int i, len;
! 
!                                   if (wptr->password != NULL)
!                                   {
!                                       free(wptr->password);
!                                       wptr->password = NULL;
!                                   }
!                                   len = strlen(wptr->value);
!                                   wptr->password = (char *)malloc(len + 1);
!                                   for (i=0; i<len; i++)
!                                   {
!                                       wptr->password[i] = '*';
!                                   }
!                                   wptr->password[len] = '\0';
! #ifdef MOTIF
!                                   XmTextFieldSetString(wptr->w,
!                                       wptr->password);
! #else
! 				  XtVaSetValues(wptr->w, 
! 						XtNstring, wptr->password,
! 						NULL);
! #endif
!                                   strcpy(wptr->password, wptr->value);
!                               }
!                               break;
! 
!                       case W_LIST:
!                           {
!                               char **vlist;
!                               int vlist_cnt;
!                               STRING *val_list;
! 
!                               int i;
! #ifdef MOTIF
!                               STRING label;
! 
!                               argcnt = 0;
!                               XtSetArg(arg[argcnt], XmNworkWindow, &child);
!                               argcnt++;
!                               XtGetValues(wptr->w, arg, argcnt);
! #else
! 			      WidgetList wl;
! 			      char ** string_list;
! 			      int list_cnt;
! 
! 			      XtVaGetValues(wptr->w,
! 					    XtNchildren,&wl,
! 					    NULL);
! 			      child = *++wl;
! 			      XtVaGetValues(child,
! 					    XtNlist,&string_list,
! 					    XtNnumberStrings,&list_cnt,
! 					    NULL);
! #endif
!                               if (wptr->value != NULL)
!                               {
!                                   vlist = ParseCommaList(wptr->value,
!                                       &vlist_cnt);
!                                   val_list = (STRING *)malloc(vlist_cnt *
!                                       sizeof(STRING));
! #ifdef MOTIF
!                                   XmListDeselectAllItems(child);
! #else
! 				  XawListUnhighlight(child);
! #endif
!                                   for (i=0; i<vlist_cnt; i++)
!                                   {
!                                       val_list[i] =
! #ifdef MOTIF
!                                               XmStringCreateSimple(vlist[i]);
! #else
! 				              XtNewString(vlist[i]);
! #endif
!                                   }
!                                   FreeCommaList(vlist, vlist_cnt);
!                                   if (vlist_cnt > 0)
!                                   {
! #ifdef MOTIF
!                                       argcnt = 0;
!                                       XtSetArg(arg[argcnt], XmNselectedItems,
!                                               val_list);
!                                       argcnt++;
!                                       XtSetArg(arg[argcnt],
!                                               XmNselectedItemCount,
!                                               vlist_cnt);
!                                       argcnt++;
!                                       XtSetValues(child, arg, argcnt);
! #else
! 				      if (vlist_cnt > 1)
! 					fprintf(stderr,
!  			           "HTML: only a single selection allowed!\n");
  
! 				      for (i=0; i<list_cnt; i++)
! 					{
! 					  if (!strcmp(string_list[i],val_list[0]))
! 					    {
! 					      XawListHighlight(child,i);
! 					      break;
! 					    }
! 					}
! #endif
!                                   }
!                                   for (i=0; i<vlist_cnt; i++)
!                                   {
! #ifdef MOTIF
!                                       XmStringFree(val_list[i]);
! #else
! 				      free(val_list[i]);
! #endif
!                                   }
!                                   if (val_list != NULL)
!                                   {
!                                       free((char *)val_list);
!                                   }
!                               }
!                               else
!                               {
! #ifdef MOTIF
!                                       XmListDeselectAllItems(child);
! #else
! 				      XawListUnhighlight(child);
! #endif
!                               }
!                           }
!                               break;
! 
! 
!                       /*
!                        * gack, we saved the widget id of the starting default
!                        * into the value character pointer, just so we could
!                        * yank it out here, and restore the default.
!                        */
!                       case W_OPTIONMENU:
!                               if (wptr->value != NULL)
!                               {
!                                       Widget hist = (Widget)wptr->value;
! #ifdef MOTIF
!                                       Cardinal argcnt = 0;
!                                       Arg arg[5];
!                                       XtSetArg(arg[argcnt], XmNmenuHistory,
!                                               hist);
!                                       argcnt++;
!                                       XtSetValues(wptr->w, arg, argcnt);
! #else
! 				      /* the athena version is gack-compatible
! 				       */
! 				      char *txt;
! 				      XtVaGetValues(hist,XtNlabel,&txt,NULL);
! 				      XtVaSetValues(wptr->w,XtNlabel,txt,NULL);
! #endif
!                               }
!                               break;
!                         case W_CHECKBOX:
!                         case W_RADIOBOX:
! #ifdef MOTIF
! 				XmToggleButtonSetState(wptr->w, wptr->checked, False);
! #else
! 				XtVaSetValues(wptr->w,XtNstate,wptr->checked,NULL);
! #endif
  				break;
+ #ifdef MOTIF
+ /* only MOTIF */
  			case W_JOT:
  				argcnt = 0;
  				XtSetArg(arg[argcnt], XmNuserData,
***************
*** 892,897 ****
--- 1188,1194 ----
  				XtGetValues(wptr->w, arg, argcnt);
  				ClearJot(hw, child, wptr->width, wptr->height);
  				break;
+ #endif
  			default:
  				break;
  		}
***************
*** 907,913 ****
--- 1204,1214 ----
  	Widget w;
  	FormInfo *fptr;
  {
+ #ifdef MOTIF
  	XtAddCallback(w, XmNactivateCallback, CBSubmitForm, (caddr_t)fptr);
+ #else
+ 	XtAddCallback(w, XtNcallback, CBSubmitForm, (caddr_t)fptr);
+ #endif
  }
  
  
***************
*** 917,923 ****
--- 1218,1228 ----
  	Widget w;
  	FormInfo *fptr;
  {
+ #ifdef MOTIF
  	XtAddCallback(w, XmNactivateCallback, CBResetForm, (caddr_t)fptr);
+ #else
+ 	XtAddCallback(w, XtNcallback, CBResetForm, (caddr_t)fptr);
+ #endif
  }
  
  
***************
*** 931,938 ****
  	/*
  	 * Make sure all expose events have been dealt with first.
  	 */
! 	XmUpdateDisplay((Widget)hw);
! 
  	wptr = hw->html.widget_list;
  	while (wptr != NULL)
  	{
--- 1236,1244 ----
  	/*
  	 * Make sure all expose events have been dealt with first.
  	 */
! #ifdef MOTIF
!         XmUpdateDisplay((Widget)hw);
! #endif
  	wptr = hw->html.widget_list;
  	while (wptr != NULL)
  	{
***************
*** 940,945 ****
--- 1246,1252 ----
  		{
  			XtSetMappedWhenManaged(wptr->w, False);
  			wptr->mapped = False;
+ 
  		}
  		wptr = wptr->next;
  	}
***************
*** 954,1016 ****
  	 */
  	while (XCheckWindowEvent(XtDisplay(hw->html.view),
  		XtWindow(hw->html.view), ExposureMask, &event) == True)
! 	{
! 	}
  }
  
  
  void
  MapWidgets(hw)
! 	HTMLWidget hw;
  {
! 	WidgetInfo *wptr;
! 
! 	wptr = hw->html.widget_list;
! 	while (wptr != NULL)
! 	{
! 		if (wptr->w != NULL)
! 		{
! 			wptr->mapped = True;
! 			XtSetMappedWhenManaged(wptr->w, True);
! 		}
! 		wptr = wptr->next;
! 	}
  }
  
  
  Boolean
  AlreadyChecked(hw, fptr, name)
! 	HTMLWidget hw;
! 	FormInfo *fptr;
! 	char *name;
  {
! 	WidgetInfo *wptr;
! 	Boolean radio_checked;
  
! 	radio_checked = False;
! 	wptr = hw->html.widget_list;
! 	while (wptr != NULL)
! 	{
! 		if ((wptr->id >= fptr->start)&&
! 			(wptr->type == W_RADIOBOX)&&
! 			(wptr->checked == True)&&
! 			(wptr->name != NULL)&&
! 			(name != NULL)&&
! 			(strcmp(wptr->name, name) == 0))
! 		{
! 			radio_checked = True;
! 			break;
! 		}
! 		wptr = wptr->next;
! 	}
! 	return(radio_checked);
  }
  
  
  WidgetInfo *
  AddNewWidget(hw, fptr, w, type, id, x, y, width, height, name, value, checked)
  	HTMLWidget hw;
! 	FormInfo *fptr;
  	Widget w;
  	int type;
  	int id;
--- 1261,1324 ----
  	 */
  	while (XCheckWindowEvent(XtDisplay(hw->html.view),
  		XtWindow(hw->html.view), ExposureMask, &event) == True)
! 	  {
! 	  }
! 
  }
  
  
  void
  MapWidgets(hw)
!       HTMLWidget hw;
  {
!       WidgetInfo *wptr;
! fprintf(stderr,"mapwidgets");
!       wptr = hw->html.widget_list;
!       while (wptr != NULL)
!       {
!               if (wptr->w != NULL)
!               {
!                       wptr->mapped = True;
!                       XtSetMappedWhenManaged(wptr->w, True);
!               }
!               wptr = wptr->next;
!       }
  }
  
  
  Boolean
  AlreadyChecked(hw, fptr, name)
!       HTMLWidget hw;
!       FormInfo *fptr;
!       char *name;
  {
!       WidgetInfo *wptr;
!       Boolean radio_checked;
  
!       radio_checked = False;
!       wptr = hw->html.widget_list;
!       while (wptr != NULL)
!       {
!               if ((wptr->id >= fptr->start)&&
!                       (wptr->type == W_RADIOBOX)&&
!                       (wptr->checked == True)&&
!                       (wptr->name != NULL)&&
!                       (name != NULL)&&
!                       (strcmp(wptr->name, name) == 0))
!               {
!                       radio_checked = True;
!                       break;
!               }
!               wptr = wptr->next;
!       }
!       return(radio_checked);
  }
  
  
  WidgetInfo *
  AddNewWidget(hw, fptr, w, type, id, x, y, width, height, name, value, checked)
  	HTMLWidget hw;
!         FormInfo *fptr;
  	Widget w;
  	int type;
  	int id;
***************
*** 1066,1078 ****
  
  	if ((wptr->type == W_PASSWORD)&&(wptr->value != NULL))
  	{
! 		wptr->password = (char *)malloc(strlen(wptr->value) + 1);
  		strcpy(wptr->password, wptr->value);
  	}
  
  	return(wptr);
- }
  
  
  /*
   * For the various widgets, return their fon structures so
--- 1374,1386 ----
  
  	if ((wptr->type == W_PASSWORD)&&(wptr->value != NULL))
  	{
! 	        wptr->password = (char *)malloc(strlen(wptr->value) + 1);
  		strcpy(wptr->password, wptr->value);
  	}
  
  	return(wptr);
  
+ }
  
  /*
   * For the various widgets, return their fon structures so
***************
*** 1080,1155 ****
   */
  XFontStruct *
  GetWidgetFont(hw, wptr)
! 	HTMLWidget hw;
! 	WidgetInfo *wptr;
  {
! 	Boolean ret;
! 	Widget child;
! 	Cardinal argcnt;
! 	Arg arg[5];
! 	XmFontList font_list = (XmFontList)NULL;
! 	XmFontContext font_context;
! 	XmStringCharSet charset;
! 	XFontStruct *font;
! 
! 	/*
! 	 * For option menus we have to first get the child that has the
! 	 * font info.
! 	 */
! 	if (wptr->type == W_OPTIONMENU)
! 	{
! 		Widget child;
! 
! 		child = XmOptionButtonGadget(wptr->w);
! 
! 		argcnt = 0;
! 		XtSetArg(arg[argcnt], XmNfontList, &font_list); argcnt++;
! 		XtGetValues(child, arg, argcnt);
! 	}
! 	else
! 	{
! 		Widget child;
! 
! 		if ((wptr->type == W_TEXTAREA)||(wptr->type == W_LIST))
! 		{
! 			child = NULL;
! 			argcnt = 0;
! 			XtSetArg(arg[argcnt], XmNworkWindow, &child); argcnt++;
! 			XtGetValues(wptr->w, arg, argcnt);
! 			argcnt = 0;
! 			XtSetArg(arg[argcnt], XmNfontList,&font_list); argcnt++;
! 			XtGetValues(child, arg, argcnt);
! 		}
! 		else
! 		{
! 			argcnt = 0;
! 			XtSetArg(arg[argcnt], XmNfontList,&font_list); argcnt++;
! 			XtGetValues(wptr->w, arg, argcnt);
! 		}
! 	}
! 
! 	if (font_list == (XmFontList)NULL)
! 	{
! 		return((XFontStruct *)NULL);
! 	}
! 
! 	ret = XmFontListInitFontContext(&font_context, font_list);
! 	if (ret == False)
! 	{
! 		return((XFontStruct *)NULL);
! 	}
! 
! 	ret = XmFontListGetNextFont(font_context, &charset, &font);
! 	if (ret == False)
! 	{
! 		return((XFontStruct *)NULL);
! 	}
! 	else
! 	{
! 		XmFontListFreeFontContext(font_context);
! 		free((char *)charset);
! 		return(font);
! 	}
  }
  
  
--- 1388,1481 ----
   */
  XFontStruct *
  GetWidgetFont(hw, wptr)
!      HTMLWidget hw;
!      WidgetInfo *wptr;
  {
!   Widget child;
!   XFontStruct *font;
! #ifdef MOTIF
!   Boolean ret;
!   Arg arg[5];
!   Cardinal argcnt;
!   XmFontList font_list = (XmFontList)NULL;
!   XmFontContext font_context;
!   XmStringCharSet charset;
! #endif
! 
! #ifdef MOTIF 
!   /*
!    * For option menus we have to first get the child that has the
!    * font info.
!    */
! 
!   if (wptr->type == W_OPTIONMENU)
!     {
!       child = XmOptionButtonGadget(wptr->w);
!     }
!   else
! #endif
!     {
!       if (
! #ifdef MOTIF
! 	  (wptr->type == W_TEXTAREA)||
! #endif
! 	  (wptr->type == W_LIST))
! 	{
! #ifdef MOTIF
! 	  argcnt = 0;
! 	  XtSetArg(arg[argcnt], XmNworkWindow, &child); argcnt++;
! 	  XtGetValues(wptr->w, arg, argcnt);
! #else
! 	  WidgetList wl; 
! 	  int nc;
! 	  XtVaGetValues(wptr->w,XtNchildren,&wl,XtNnumChildren,&nc,NULL);
! 	  child = *++wl;
! #endif
! 	}
!       else
! 	child = wptr->w;
!     }
! 
!   if (child) 
!     {
! #ifdef MOTIF
!       argcnt = 0;
!       XtSetArg(arg[argcnt], XmNfontList,&font_list); argcnt++;
!       XtGetValues(child, arg, argcnt);
! #else
! /*    fprintf(stderr,"calling get font of %p <%s>\n",child,XtName(child));*/
!       XtVaGetValues(child, XtNfont, &font, NULL);
! /*    fprintf(stderr,"returning %p\n",font); */
!       return(font);
! #endif
!     } 
!   else
!     return((XFontStruct *)NULL);
! 
! #ifdef MOTIF
!   if (font_list == (XmFontList)NULL)
!     {
!       return((XFontStruct *)NULL);
!     }
! 
!   ret = XmFontListInitFontContext(&font_context, font_list);
!   if (ret == False)
!     {
!       return((XFontStruct *)NULL);
!     }
!   
!   ret = XmFontListGetNextFont(font_context, &charset, &font);
!   if (ret == False)
!     {
!       return((XFontStruct *)NULL);
!     }
!   else
!     {
!       XmFontListFreeFontContext(font_context);
!       free((char *)charset);
!       return(font);
!     }
! #endif
  }
  
  
***************
*** 1437,1442 ****
--- 1763,1769 ----
  		name = ParseMarkTag(text, MT_INPUT, "NAME");
  
  		type_str = ParseMarkTag(text, MT_INPUT, "TYPE");
+ /*fprintf(stderr, "makeWidget type=%s\n", type_str);*/
  		if ((type_str != NULL)&&(strcmp(type_str, "checkbox") == 0))
  		{
  			type = W_CHECKBOX;
***************
*** 1450,1531 ****
  			tptr = ParseMarkTag(text, MT_INPUT, "CHECKED");
  
  			argcnt = 0;
! 			XtSetArg(arg[argcnt], XmNx, x); argcnt++;
! 			XtSetArg(arg[argcnt], XmNy, y); argcnt++;
! 			if (tptr != NULL)
! 			{
! 				XtSetArg(arg[argcnt], XmNset, True); argcnt++;
! 				checked = True;
! 				free(tptr);
! 			}
! 			w = XmCreateToggleButton(hw->html.view, "",
! 				arg, argcnt);
! 			XtSetMappedWhenManaged(w, False);
! 			XtManageChild(w);
! 		}
! 		else if ((type_str != NULL)&&(strcmp(type_str, "radio") == 0))
! 		{
! 			type = W_RADIOBOX;
! 			value = ParseMarkTag(text, MT_INPUT, "VALUE");
! 			if (value == NULL)
! 			{
! 				value = (char *)malloc(strlen("on") + 1);
! 				strcpy(value, "on");
! 			}
! 
! 			/*
! 			 * Only one checked radio button with the
! 			 * same name per form
! 			 */
! 			tptr = ParseMarkTag(text, MT_INPUT, "CHECKED");
! 			if ((tptr != NULL)&&
! 				(AlreadyChecked(hw, fptr, name) == True))
! 			{
! 				free(tptr);
! 				tptr = NULL;
! 			}
! 
! 			argcnt = 0;
! 			XtSetArg(arg[argcnt], XmNx, x); argcnt++;
! 			XtSetArg(arg[argcnt], XmNy, y); argcnt++;
! 			XtSetArg(arg[argcnt], XmNindicatorType, XmONE_OF_MANY);
! 			argcnt++;
  			if (tptr != NULL)
  			{
! 				XtSetArg(arg[argcnt], XmNset, True); argcnt++;
  				checked = True;
  				free(tptr);
  			}
  			w = XmCreateToggleButton(hw->html.view, "",
  				arg, argcnt);
  			XtSetMappedWhenManaged(w, False);
  			XtManageChild(w);
! 			XtAddCallback(w, XmNvalueChangedCallback,
! 				CBChangeRadio, (caddr_t)fptr);
! 		}
  		else if ((type_str != NULL)&&(strcmp(type_str, "submit") == 0))
  		{
! 			XmString label;
  
  			type = W_PUSHBUTTON;
- 			label = NULL;
  			value = ParseMarkTag(text, MT_INPUT, "VALUE");
  			if ((value == NULL)||(*value == '\0'))
  			{
! 				value = (char *)malloc(strlen("Submit Query") +
! 					1);
  				strcpy(value, "Submit Query");
  			}
  
  			argcnt = 0;
! 			XtSetArg(arg[argcnt], XmNx, x); argcnt++;
! 			XtSetArg(arg[argcnt], XmNy, y); argcnt++;
  			if (value != NULL)
  			{
  				label = XmStringCreateSimple(value);
  				XtSetArg(arg[argcnt], XmNlabelString, label);
  				argcnt++;
  			}
  			w = XmCreatePushButton(hw->html.view, "Button",
  				arg, argcnt);
  			XtSetMappedWhenManaged(w, False);
--- 1777,1880 ----
  			tptr = ParseMarkTag(text, MT_INPUT, "CHECKED");
  
  			argcnt = 0;
! 			XtSetArg(arg[argcnt], XxNx, x); argcnt++;
! 			XtSetArg(arg[argcnt], XxNy, y); argcnt++;
  			if (tptr != NULL)
  			{
! 				XtSetArg(arg[argcnt], XxNset, True); argcnt++;
  				checked = True;
  				free(tptr);
  			}
+ #ifdef MOTIF
  			w = XmCreateToggleButton(hw->html.view, "",
  				arg, argcnt);
  			XtSetMappedWhenManaged(w, False);
  			XtManageChild(w);
! #else
! 			XtSetArg(arg[argcnt], XtNlabel, ""); argcnt++;
! 			w = XtCreateManagedWidget(name, toggleWidgetClass,
! 						  hw->html.view, arg, argcnt);
! #endif
!               }
!               else if ((type_str != NULL)&&(strcmp(type_str, "radio") == 0))
!               {
!                       type = W_RADIOBOX;
!                       value = ParseMarkTag(text, MT_INPUT, "VALUE");
!                       if (value == NULL)
!                       {
!                               value = (char *)malloc(strlen("on") + 1);
!                               strcpy(value, "on");
!                       }
! 
!                       /*
!                        * Only one checked radio button with the
!                        * same name per form
!                        */
!                       tptr = ParseMarkTag(text, MT_INPUT, "CHECKED");
!                       if ((tptr != NULL)&&
!                               (AlreadyChecked(hw, fptr, name) == True))
!                       {
!                               free(tptr);
!                               tptr = NULL;
!                       }
! 
!                       argcnt = 0;
!                       XtSetArg(arg[argcnt], XxNx, x); argcnt++;
!                       XtSetArg(arg[argcnt], XxNy, y); argcnt++;
! #ifdef MOTIF
!                       XtSetArg(arg[argcnt], XmNindicatorType, XmONE_OF_MANY);
!                       argcnt++;
! #endif
!                       if (tptr != NULL)
!                       {
!                               XtSetArg(arg[argcnt], XxNset, True); argcnt++;
!                               checked = True;
!                               free(tptr);
!                       }
! #ifdef MOTIF
!                       w = XmCreateToggleButton(hw->html.view, "",
!                               arg, argcnt);
!                       XtSetMappedWhenManaged(w, False);
!                       XtManageChild(w);
!                       XtAddCallback(w, XmNvalueChangedCallback,
!                               CBChangeRadio, (caddr_t)fptr);
! #else
! 		      XtSetArg(arg[argcnt], XtNlabel, ""); argcnt++;
! 		      w = XtCreateManagedWidget(name, toggleWidgetClass,
! 					  hw->html.view, arg, argcnt);
!                       XtAddCallback(w, XtNcallback,
!                               CBChangeRadio, (caddr_t)fptr);
! #endif
!                 }
  		else if ((type_str != NULL)&&(strcmp(type_str, "submit") == 0))
  		{
! #ifdef MOTIF
! 			XmString label = NULL;
! #endif
  
  			type = W_PUSHBUTTON;
  			value = ParseMarkTag(text, MT_INPUT, "VALUE");
  			if ((value == NULL)||(*value == '\0'))
  			{
! 				value = (char *)malloc(strlen("Submit Query") +	1);
  				strcpy(value, "Submit Query");
  			}
  
  			argcnt = 0;
! 			XtSetArg(arg[argcnt], XxNx, x); argcnt++;
! 			XtSetArg(arg[argcnt], XxNy, y); argcnt++;
! 
  			if (value != NULL)
  			{
+ #ifdef MOTIF
  				label = XmStringCreateSimple(value);
  				XtSetArg(arg[argcnt], XmNlabelString, label);
+ #else
+ 				XtSetArg(arg[argcnt], XtNlabel, value);
+ #endif
  				argcnt++;
  			}
+ #ifdef MOTIF
  			w = XmCreatePushButton(hw->html.view, "Button",
  				arg, argcnt);
  			XtSetMappedWhenManaged(w, False);
***************
*** 1534,1547 ****
  			{
  				XmStringFree(label);
  			}
  			PrepareFormEnd(hw, w, fptr);
  		}
  		else if ((type_str != NULL)&&(strcmp(type_str, "reset") == 0))
  		{
! 			XmString label;
  
  			type = W_PUSHBUTTON;
- 			label = NULL;
  			value = ParseMarkTag(text, MT_INPUT, "VALUE");
  			if ((value == NULL)||(*value == '\0'))
  			{
--- 1883,1901 ----
  			{
  				XmStringFree(label);
  			}
+ #else
+ 			w = XtCreateManagedWidget(name,commandWidgetClass,
+ 						  hw->html.view, arg, argcnt);
+ #endif
  			PrepareFormEnd(hw, w, fptr);
  		}
  		else if ((type_str != NULL)&&(strcmp(type_str, "reset") == 0))
  		{
! #ifdef MOTIF
! 			XmString label = NULL;
! #endif
  
  			type = W_PUSHBUTTON;
  			value = ParseMarkTag(text, MT_INPUT, "VALUE");
  			if ((value == NULL)||(*value == '\0'))
  			{
***************
*** 1550,1563 ****
  			}
  
  			argcnt = 0;
! 			XtSetArg(arg[argcnt], XmNx, x); argcnt++;
! 			XtSetArg(arg[argcnt], XmNy, y); argcnt++;
  			if (value != NULL)
  			{
  				label = XmStringCreateSimple(value);
  				XtSetArg(arg[argcnt], XmNlabelString, label);
  				argcnt++;
  			}
  			w = XmCreatePushButton(hw->html.view, "Button",
  				arg, argcnt);
  			XtSetMappedWhenManaged(w, False);
--- 1904,1922 ----
  			}
  
  			argcnt = 0;
! 			XtSetArg(arg[argcnt], XxNx, x); argcnt++;
! 			XtSetArg(arg[argcnt], XxNy, y); argcnt++;
  			if (value != NULL)
  			{
+ #ifdef MOTIF
  				label = XmStringCreateSimple(value);
  				XtSetArg(arg[argcnt], XmNlabelString, label);
+ #else
+ 				XtSetArg(arg[argcnt], XtNlabel, value);
+ #endif
  				argcnt++;
  			}
+ #ifdef MOTIF
  			w = XmCreatePushButton(hw->html.view, "Button",
  				arg, argcnt);
  			XtSetMappedWhenManaged(w, False);
***************
*** 1566,1919 ****
  			{
  				XmStringFree(label);
  			}
  			PrepareFormReset(hw, w, fptr);
  		}
  		else if ((type_str != NULL)&&(strcmp(type_str, "button") == 0))
  		{
! 			XmString label;
! 
  			type = W_PUSHBUTTON;
- 			label = NULL;
  			value = ParseMarkTag(text, MT_INPUT, "VALUE");
  
  			argcnt = 0;
! 			XtSetArg(arg[argcnt], XmNx, x); argcnt++;
! 			XtSetArg(arg[argcnt], XmNy, y); argcnt++;
  			if (value != NULL)
  			{
  				label = XmStringCreateSimple(value);
  				XtSetArg(arg[argcnt], XmNlabelString, label);
  				argcnt++;
  			}
  			w = XmCreatePushButton(hw->html.view, "Button",
  				arg, argcnt);
! 			XtSetMappedWhenManaged(w, False);
  			XtManageChild(w);
  			if (label != NULL)
  			{
  				XmStringFree(label);
  			}
  		}
  		else if ((type_str != NULL)&&(strcmp(type_str, "jot") == 0))
  		{
! 			XmString label;
! 			Dimension width, height;
! 			Widget frame;
! 			char **list;
! 			int list_cnt;
! 
! 			type = W_JOT;
! 			label = NULL;
! 			value = ParseMarkTag(text, MT_INPUT, "VALUE");
! 
! 			/*
! 			 * SIZE is WIDTH,HEIGHT
! 			 */
! 			tptr = ParseMarkTag(text, MT_INPUT, "SIZE");
! 			list = ParseCommaList(tptr, &list_cnt);
! 			if (tptr != NULL)
! 			{
! 				free(tptr);
! 			}
! 
! 			width = 200;
! 			height = 50;
! 			if (list_cnt == 1)
! 			{
! 				width = atoi(list[0]);
! 			}
! 			else if (list_cnt > 1)
! 			{
! 				width = atoi(list[0]);
! 				height = atoi(list[1]);
! 			}
! 			FreeCommaList(list, list_cnt);
! 
! 			argcnt = 0;
! 			XtSetArg(arg[argcnt], XmNx, x); argcnt++;
! 			XtSetArg(arg[argcnt], XmNy, y); argcnt++;
! 			XtSetArg(arg[argcnt], XmNshadowType, XmSHADOW_IN);
! 			argcnt++;
! 			frame = XmCreateFrame(hw->html.view, "Frame",
! 				arg, argcnt);
! 
! 			argcnt = 0;
! 			XtSetArg(arg[argcnt], XmNwidth, width); argcnt++;
! 			XtSetArg(arg[argcnt], XmNheight, height); argcnt++;
! 			w = XmCreateDrawingArea(frame, "Draw",
! 				arg, argcnt);
! 			XtManageChild(w);
! 
! 			NewJot(w, width, height);
! 			XtAddEventHandler(w, ExposureMask, 0,
! 				EVJotExpose, (XtPointer)hw);
! 			XtAddEventHandler(w, ButtonPressMask, 0,
! 				EVJotPress, (XtPointer)hw);
! 			XtAddEventHandler(w, ButtonMotionMask, 0,
! 				EVJotMove, (XtPointer)hw);
! 			XtAddEventHandler(w, ButtonReleaseMask, 0,
! 				EVJotRelease, (XtPointer)hw);
! 
! 			argcnt = 0;
! 			XtSetArg(arg[argcnt], XmNuserData, (XtPointer)w);
! 			argcnt++;
! 			XtSetValues(frame, arg, argcnt);
! 
! 			w = frame;
! 
! 			XtSetMappedWhenManaged(w, False);
! 			XtManageChild(w);
! 			if (label != NULL)
! 			{
! 				XmStringFree(label);
! 			}
! 		}
! 		else if ((type_str != NULL)&&(strcmp(type_str, "select") == 0))
! 		{
! 			XmString label;
! 			Widget scroll;
! 			Widget pulldown, button, hist;
! 			char *options;
! 			char **list;
! 			int list_cnt;
! 			char **vlist;
! 			int vlist_cnt;
! 			int i, mult, size;
! 
! 			type = -1;
! 			tptr = ParseMarkTag(text, MT_INPUT, "HINT");
! 			if ((tptr != NULL)&&(strcmp(tptr, "list") == 0))
! 			{
! 				type = W_LIST;
! 			}
! 			else if ((tptr != NULL)&&(strcmp(tptr, "menu") == 0))
! 			{
! 				type = W_OPTIONMENU;
! 			}
! 			if (tptr != NULL)
! 			{
! 				free(tptr);
! 			}
! 
! 			size = 5;
! 			tptr = ParseMarkTag(text, MT_INPUT, "SIZE");
! 			if (tptr != NULL)
! 			{
! 				size = atoi(tptr);
! 				if ((size > 1)&&(type == -1))
! 				{
! 					type = W_LIST;
! 				}
! 				free(tptr);
! 			}
! 
! 			mult = 0;
! 			tptr = ParseMarkTag(text, MT_INPUT, "MULTIPLE");
! 			if (tptr != NULL)
! 			{
! 				if (type == -1)
! 				{
! 					type = W_LIST;
! 				}
! 				mult = 1;
! 				free(tptr);
! 			}
! 
! 			if (type == -1)
! 			{
! 				type = W_OPTIONMENU;
! 			}
! 
! 			label = NULL;
! 			hist = NULL;
! 			value = ParseMarkTag(text, MT_INPUT, "VALUE");
! 			options = ParseMarkTag(text, MT_INPUT, "OPTIONS");
! 			list = ParseCommaList(options, &list_cnt);
! 			if (options != NULL)
! 			{
! 				free(options);
! 			}
! 
! 			vlist = ParseCommaList(value, &vlist_cnt);
! 
! 			if (size > list_cnt)
! 			{
! 				size = list_cnt;
! 			}
! 			if (size < 1)
! 			{
! 				size = 1;
! 			}
! 
! 			if (type == W_OPTIONMENU)
! 			{
! 				argcnt = 0;
! 				pulldown = XmCreatePulldownMenu(hw->html.view,
! 					"menu", arg, argcnt);
! 
! 				for (i=0; i<list_cnt; i++)
! 				{
! 					label = XmStringCreateSimple(list[i]);
! 					argcnt = 0;
! 					XtSetArg(arg[argcnt], XmNlabelString,
! 						label);
! 					argcnt++;
! 					button = XmCreatePushButton(pulldown,
! 						"Button", arg, argcnt);
! 					XtManageChild(button);
! 					XmStringFree(label);
! 
! 					if ((vlist_cnt > 0)&&
! 						(vlist[0] != NULL)&&
! 						(strcmp(vlist[0], list[i]) ==0))
! 					{
! 						hist = button;
! 					}
! 
! 					/*
! 					 * Start hist out as the first button
! 					 * so that if the user didn't set a
! 					 * default we always default to the
! 					 * first element.
! 					 */
! 					if ((i == 0)&&(hist == NULL))
! 					{
! 						hist = button;
! 					}
! 				}
! 
! 				FreeCommaList(list, list_cnt);
! 				FreeCommaList(vlist, vlist_cnt);
! 				if (value != NULL)
! 				{
! 					free(value);
! 				}
! 
! 				argcnt = 0;
! 				XtSetArg(arg[argcnt], XmNx, x); argcnt++;
! 				XtSetArg(arg[argcnt], XmNy, y); argcnt++;
! 				XtSetArg(arg[argcnt], XmNsubMenuId, pulldown);
! 					argcnt++;
! 				if (hist != NULL)
! 				{
! 					XtSetArg(arg[argcnt], XmNmenuHistory,
! 						hist);
! 					argcnt++;
! 					/*
! 					 * A gaggage.  Value is used to later
! 					 * restore defaults.  For option menu
! 					 * this means we need to save a child
! 					 * widget id as opposed to the
! 					 * character string everyone else uses.
! 					 */
! 					value = (char *)hist;
! 				}
! 				w = XmCreateOptionMenu(hw->html.view, "Button",
! 					arg, argcnt);
! 			}
! 			else /* type == W_LIST */
! 			{
! 				XmString *string_list;
! 				XmString *val_list;
! 
! 				if ((!mult)&&(vlist_cnt > 1))
! 				{
! 					free(value);
! 					value = (char *)malloc(
! 						strlen(vlist[0]) + 1);
! 					strcpy(value, vlist[0]);
! 				}
! 
! 				string_list = (XmString *)malloc(list_cnt *
! 					sizeof(XmString));
! 				val_list = (XmString *)malloc(vlist_cnt *
! 					sizeof(XmString));
! 
! 				for (i=0; i<list_cnt; i++)
! 				{
! 					string_list[i] =
! 						XmStringCreateSimple(list[i]);
! 				}
! 				for (i=0; i<vlist_cnt; i++)
! 				{
! 					val_list[i] =
! 						XmStringCreateSimple(vlist[i]);
! 				}
! 
! 				FreeCommaList(list, list_cnt);
! 				FreeCommaList(vlist, vlist_cnt);
! 
! 				argcnt = 0;
! 				scroll = XmCreateScrolledWindow(hw->html.view,
! 					"Scroll", arg, argcnt);
! 
! 				argcnt = 0;
! 				XtSetArg(arg[argcnt], XmNx, x); argcnt++;
! 				XtSetArg(arg[argcnt], XmNy, y); argcnt++;
! 				XtSetArg(arg[argcnt], XmNitems, string_list);
! 				argcnt++;
! 				XtSetArg(arg[argcnt], XmNitemCount, list_cnt);
! 				argcnt++;
! 				XtSetArg(arg[argcnt], XmNvisibleItemCount,size);
! 				argcnt++;
! 				if (mult)
! 				{
! 					XtSetArg(arg[argcnt],XmNselectionPolicy,
! 						XmEXTENDED_SELECT);
! 					argcnt++;
! 				}
! 				else
! 				{
! 					XtSetArg(arg[argcnt],XmNselectionPolicy,
! 						XmBROWSE_SELECT);
! 					argcnt++;
! 				}
! 				if ((vlist_cnt > 0)&&(mult))
! 				{
! 					XtSetArg(arg[argcnt], XmNselectedItems,
! 						val_list);
! 					argcnt++;
! 					XtSetArg(arg[argcnt],
! 						XmNselectedItemCount,
! 						vlist_cnt);
! 					argcnt++;
! 				}
! 				else if ((vlist_cnt > 0)&&(!mult))
! 				{
! 					XtSetArg(arg[argcnt], XmNselectedItems,
! 						&val_list[0]);
! 					argcnt++;
! 					XtSetArg(arg[argcnt],
! 						XmNselectedItemCount, 1);
! 					argcnt++;
! 				}
! 				w = XmCreateList(scroll, "List", arg, argcnt);
! 				XtManageChild(w);
! 				w = scroll;
! 
! 				for (i=0; i<list_cnt; i++)
! 				{
! 					XmStringFree(string_list[i]);
! 				}
! 				if (string_list != NULL)
! 				{
! 					free((char *)string_list);
! 				}
! 				for (i=0; i<vlist_cnt; i++)
! 				{
! 					XmStringFree(val_list[i]);
! 				}
! 				if (val_list != NULL)
! 				{
! 					free((char *)val_list);
! 				}
! 			}
! 			XtSetMappedWhenManaged(w, False);
! 			XtManageChild(w);
! 		}
! 		else if ((type_str != NULL)&&(strcmp(type_str, "password") ==0))
! 		{
! 			type = W_PASSWORD;
  			value = ParseMarkTag(text, MT_INPUT, "VALUE");
  
  			size = -1;
--- 1925,2432 ----
  			{
  				XmStringFree(label);
  			}
+ #else
+ 			w = XtCreateManagedWidget(name,commandWidgetClass,
+ 						  hw->html.view, arg, argcnt);
+ #endif
  			PrepareFormReset(hw, w, fptr);
  		}
  		else if ((type_str != NULL)&&(strcmp(type_str, "button") == 0))
  		{
! #ifdef MOTIF
! 			XmString label = NULL;
! #endif
  			type = W_PUSHBUTTON;
  			value = ParseMarkTag(text, MT_INPUT, "VALUE");
  
  			argcnt = 0;
! 			XtSetArg(arg[argcnt], XxNx, x); argcnt++;
! 			XtSetArg(arg[argcnt], XxNy, y); argcnt++;
  			if (value != NULL)
  			{
+ #ifdef MOTIF
  				label = XmStringCreateSimple(value);
  				XtSetArg(arg[argcnt], XmNlabelString, label);
+ #else
+ 				XtSetArg(arg[argcnt], XtNlabel, value);
+ #endif
  				argcnt++;
  			}
+ #ifdef MOTIF
  			w = XmCreatePushButton(hw->html.view, "Button",
  				arg, argcnt);
! 			XtSetMappedWhenManaged(w, False);	
  			XtManageChild(w);
  			if (label != NULL)
  			{
  				XmStringFree(label);
  			}
+ #else
+ 			w = XtCreateManagedWidget(name,commandWidgetClass,
+ 						  hw->html.view, arg, argcnt);
+ #endif
  		}
+ #ifdef MOTIF
+ /* only MOTIF */
  		else if ((type_str != NULL)&&(strcmp(type_str, "jot") == 0))
  		{
!                       XmString label;
!                       Dimension width, height;
!                       Widget frame;
!                       char **list;
!                       int list_cnt;
! 
!                       type = W_JOT;
!                       label = NULL;
!                       value = ParseMarkTag(text, MT_INPUT, "VALUE");
! 
!                       /*
!                        * SIZE is WIDTH,HEIGHT
!                        */
!                       tptr = ParseMarkTag(text, MT_INPUT, "SIZE");
!                       list = ParseCommaList(tptr, &list_cnt);
!                       if (tptr != NULL)
!                       {
!                               free(tptr);
!                       }
! 
!                       width = 200;
!                       height = 50;
!                       if (list_cnt == 1)
!                       {
!                               width = atoi(list[0]);
!                       }
!                       else if (list_cnt > 1)
!                       {
!                               width = atoi(list[0]);
!                               height = atoi(list[1]);
!                       }
!                       FreeCommaList(list, list_cnt);
! 
! 		      argcnt = 0;
!                       XtSetArg(arg[argcnt], XmNx, x); argcnt++;
!                       XtSetArg(arg[argcnt], XmNy, y); argcnt++;
!                       XtSetArg(arg[argcnt], XmNshadowType, XmSHADOW_IN);
!                       argcnt++;
!                       frame = XmCreateFrame(hw->html.view, "Frame",
!                               arg, argcnt);
! 
!                       argcnt = 0;
!                       XtSetArg(arg[argcnt], XmNwidth, width); argcnt++;
!                       XtSetArg(arg[argcnt], XmNheight, height); argcnt++;
!                       w = XmCreateDrawingArea(frame, "Draw",
!                               arg, argcnt);
!                       XtManageChild(w);
! 
!                       NewJot(w, width, height);
!                       XtAddEventHandler(w, ExposureMask, 0,
!                               EVJotExpose, (XtPointer)hw);
!                       XtAddEventHandler(w, ButtonPressMask, 0,
!                               EVJotPress, (XtPointer)hw);
!                       XtAddEventHandler(w, ButtonMotionMask, 0,
!                               EVJotMove, (XtPointer)hw);
!                       XtAddEventHandler(w, ButtonReleaseMask, 0,
!                               EVJotRelease, (XtPointer)hw);
! 
!                       argcnt = 0;
!                       XtSetArg(arg[argcnt], XmNuserData, (XtPointer)w);
!                       argcnt++;
!                       XtSetValues(frame, arg, argcnt);
! 
!                       w = frame;
! 
!                       XtSetMappedWhenManaged(w, False);
!                       XtManageChild(w);
!                       if (label != NULL)
!                       {
!                               XmStringFree(label);
!                       }
!               }
! #endif
!               else if ((type_str != NULL)&&(strcmp(type_str, "select") == 0))
!                {
!                        STRING label;
!                        Widget scroll;
!                        Widget pulldown, button, hist;
!                        char *options;
!                        char **list;
!                        int list_cnt;
!                        char **vlist;
!                        int vlist_cnt;
!                        int i, mult, size;
!  
!                        type = -1;
!                        tptr = ParseMarkTag(text, MT_INPUT, "HINT");
!                        if ((tptr != NULL)&&(strcmp(tptr, "list") == 0))
!                        {
!                                type = W_LIST;
!                        }
!                        else if ((tptr != NULL)&&(strcmp(tptr, "menu") == 0))
!                        {
!                                type = W_OPTIONMENU;
!                        }
!                        if (tptr != NULL)
!                        {
!                                free(tptr);
!                        }
!  
!                        size = 5;
!                        tptr = ParseMarkTag(text, MT_INPUT, "SIZE");
!                        if (tptr != NULL)
!                        {
!                                size = atoi(tptr);
!                                if ((size > 1)&&(type == -1))
!                                {
!                                        type = W_LIST;
!                                }
!                                free(tptr);
!                        }
!  
!                        mult = 0;
!                        tptr = ParseMarkTag(text, MT_INPUT, "MULTIPLE");
!                        if (tptr != NULL)
!                        {
!                                if (type == -1)
!                                {
!                                        type = W_LIST;
!                                }
!                                mult = 1;
!                                free(tptr);
!                        }
! 
!  
!                        if (type == -1)
!                        {
!                                type = W_OPTIONMENU;
!                        }
!  
!                        label = NULL;
!                        hist = NULL;
!                        value = ParseMarkTag(text, MT_INPUT, "VALUE");
!                        options = ParseMarkTag(text, MT_INPUT, "OPTIONS");
!                        list = ParseCommaList(options, &list_cnt);
!                        if (options != NULL)
!                        {
!                                free(options);
!                        }
!  
!                        vlist = ParseCommaList(value, &vlist_cnt);
!  
!                        if (size > list_cnt)
!                        {
!                                size = list_cnt;
!                        }
!                        if (size < 1)
!                        {
!                                size = 1;
!                        }
!  
!                        if (type == W_OPTIONMENU)
!                        {
! #ifdef MOTIF
!                                argcnt = 0;
!                                pulldown = XmCreatePulldownMenu(hw->html.view,
!                                        "menu", arg, argcnt);
! #else
! 			       XFontStruct *font;
! 			       Dimension maxWidth = 0, width, iW;
! 
!                                argcnt = 0;
!                                XtSetArg(arg[argcnt], XtNx, x); argcnt++;
!                                XtSetArg(arg[argcnt], XtNy, y); argcnt++;
! 			       w = XtCreateWidget(name,
! 						menuButtonWidgetClass, 
! 						hw->html.view, arg, argcnt);
!                                argcnt = 0;
! 			       pulldown = XtCreatePopupShell("menu", 
!                                     simpleMenuWidgetClass, w, 
! 				    arg, argcnt);
! #endif
!  
!                                for (i=0; i<list_cnt; i++)
!                                {
! 			               argcnt = 0;
! #ifdef MOTIF
!                                        label = XmStringCreateSimple(list[i]);
!                                        XtSetArg(arg[argcnt], XmNlabelString,
!                                                label);
!                                        argcnt++;
!                                        button = XmCreatePushButton(pulldown,
!                                                "Button", arg, argcnt);
!                                        XtManageChild(button);
!                                        XmStringFree(label);
! #else
!                                        XtSetArg(arg[argcnt],XtNlabel,list[i]);
!                                        argcnt++;
! 				       button = XtCreateManagedWidget("Button",
! 						smeBSBObjectClass, 
! 						pulldown, arg, argcnt);
! 
! 				       XtAddCallback(button, XtNcallback, 
! 					     CBoption, (XtPointer)w);
! 
! 				       if (i==0) 
! 					   XtVaGetValues(w,
! 							 XtNfont,&font,
! 							 XtNinternalWidth,&iW,
! 							 NULL);
! 				       
! 				       width = XTextWidth(font, list[i], 
! 							  strlen(list[i]));
! 
! 				       if (width>maxWidth) maxWidth=width;
! #endif
!                                        if ((vlist_cnt > 0)&&
!                                                (vlist[0] != NULL)&&
!                                                (strcmp(vlist[0], list[i])==0))
!                                        {
!                                                hist = button;
! #ifndef MOTIF
! 					       XtVaSetValues(w,
! 						 XtNlabel,XtNewString(list[i]),
! 						 NULL);
! #endif
!                                        }
!  
!                                        /*
!                                         * Start hist out as the first button
!                                         * so that if the user didn't set a
!                                         * default we always default to the
!                                         * first element.
!                                         */
!                                        if ((i == 0)&&(hist == NULL))
!                                        {
!                                                hist = button;
!                                        }
!                                }
! #ifdef MOTIF
!                                FreeCommaList(list, list_cnt);
! #else
! 			       XtVaSetValues(w,XtNwidth,maxWidth+4*iW,NULL);
! #endif 
!                                FreeCommaList(vlist, vlist_cnt);
!                                if (value != NULL)
!                                {
!                                        free(value);
!                                }
!  
!                                argcnt = 0;
! #ifdef MOTIF
!                                XtSetArg(arg[argcnt], XmNx, x); argcnt++;
!                                XtSetArg(arg[argcnt], XmNy, y); argcnt++;
!                                XtSetArg(arg[argcnt], XmNsubMenuId, pulldown);
!                                        argcnt++;
! #endif
!                                if (hist != NULL)
!                                {
! #ifdef MOTIF
!                                        XtSetArg(arg[argcnt], XmNmenuHistory,
!                                                hist);
!                                        argcnt++;
! #endif
!                                        /*
!                                         * A gaggage.  Value is used to later
!                                         * restore defaults.  For option menu
!                                         * this means we need to save a child
!                                         * widget id as opposed to the
!                                         * character string everyone else uses.
!                                         */
!                                        value = (char *)hist;
!                                }
! #ifdef MOTIF
!                                w = XmCreateOptionMenu(hw->html.view, "Button",
!                                        arg, argcnt);
! #endif
!                        }
!                        else /* type == W_LIST */
!                        {
!                                STRING *string_list;
!                                STRING *val_list;
!  
!                                if ((!mult)&&(vlist_cnt > 1))
!                                {
!                                        free(value);
!                                        value = (char *)malloc(
!                                                strlen(vlist[0]) + 1);
!                                        strcpy(value, vlist[0]);
!                                }
!  
!                                string_list = (STRING *)malloc(list_cnt *
!                                        sizeof(STRING));
!                                val_list = (STRING *)malloc(vlist_cnt *
!                                        sizeof(STRING));
!  
!                                for (i=0; i<list_cnt; i++)
!                                {
!                                        string_list[i] =
! #ifdef MOTIF
!                                                XmStringCreateSimple(list[i]);
! #else
!                                                XtNewString(list[i]);
! #endif
!                                }
!                                for (i=0; i<vlist_cnt; i++)
!                                {
!                                        val_list[i] =
! #ifdef MOTIF
!                                                XmStringCreateSimple(vlist[i]);
! #else
!                                                XtNewString(vlist[i]);
! #endif
!                                }
!  
!                                FreeCommaList(list, list_cnt);
!                                FreeCommaList(vlist, vlist_cnt);
!  
!                                argcnt = 0;
! #ifdef MOTIF
!                                scroll = XmCreateScrolledWindow(hw->html.view,
!                                        "Scroll", arg, argcnt);
! #else
!                                XtSetArg(arg[argcnt], XtNallowVert, True); 
! 			       argcnt++;
! 
!                                XtSetArg(arg[argcnt], XxNx, x); argcnt++;
!                                XtSetArg(arg[argcnt], XxNy, y); argcnt++;
! 
! 			       scroll = XtCreateWidget("Scroll", 
! 						viewportWidgetClass, 
! 						hw->html.view, arg, argcnt);
! #endif
! #ifdef MOTIF
!                                argcnt = 0;
! /**** is this here correct? -gustaf */
!                                XtSetArg(arg[argcnt], XxNx, x); argcnt++;
!                                XtSetArg(arg[argcnt], XxNy, y); argcnt++;
! /**/
!                                XtSetArg(arg[argcnt], XmNitems, string_list);
!                                argcnt++;
!                                XtSetArg(arg[argcnt], XmNitemCount, list_cnt);
!                                argcnt++;
!                                XtSetArg(arg[argcnt], XmNvisibleItemCount,size);
!                                argcnt++;
! #else
! 			       XtSetArg(arg[argcnt], XtNdefaultColumns, 1);
!                                argcnt++;
! /*			       XtSetArg(arg[argcnt], XtNlist, string_list);
!                                argcnt++;
!                                XtSetArg(arg[argcnt], XtNnumberStrings, list_cnt);
!                                argcnt++;
! */
! #endif
! #ifdef MOTIF
!                                if (mult) /* only MOTIF */
!                                {
!                                        XtSetArg(arg[argcnt],XmNselectionPolicy,
!                                                XmEXTENDED_SELECT);
!                                        argcnt++;
!                                }
!                                else
!                                {
!                                        XtSetArg(arg[argcnt],XmNselectionPolicy,
!                                                XmBROWSE_SELECT);
!                                        argcnt++;
!                                }
!                                if ((vlist_cnt > 0)&&(mult))
!                                {
!                                        XtSetArg(arg[argcnt], XmNselectedItems,
!                                                val_list);
!                                        argcnt++;
!                                        XtSetArg(arg[argcnt],
!                                                XmNselectedItemCount,
!                                                vlist_cnt);
!                                        argcnt++;
!                                }
!                                else if ((vlist_cnt > 0)&&(!mult))
!                                {
!                                        XtSetArg(arg[argcnt], XmNselectedItems,
!                                                &val_list[0]);
!                                        argcnt++;
!                                        XtSetArg(arg[argcnt],
!                                                XmNselectedItemCount, 1);
!                                        argcnt++;
!                                }
!                                w = XmCreateList(scroll, "List", arg, argcnt);
!                                XtManageChild(w);
! #else
! 			       w = XtCreateManagedWidget(name, 
!                                                   listWidgetClass,
! 						  scroll, arg, argcnt);
! 
! 			       XtAddCallback(w, XtNdestroyCallback, 
! 					     CBListDestroy, NULL);
! 
!                                XawListChange(w,string_list,list_cnt,0,True);
! 
! 			       if (vlist_cnt > 0)
! 				 {
! 				   if (vlist_cnt > 1)
! 				    fprintf(stderr,
! 				   "HTML: only a single selection allowed!\n");
! 
! 				   for (i=0; i<list_cnt; i++)
! 				     {
! 				       if (!strcmp(string_list[i],val_list[0]))
! 					 {
! 					   XawListHighlight(w,i);
! 					   break;
! 					 }
! 				     }
! 				 }
! 
! 			       if (size>list_cnt) size=list_cnt;
! 			       if (size>1) 
! 				 {
! 				   XFontStruct *font;
! 				   Dimension h,width, s;
! 				   XtVaGetValues(w, XtNfont, &font, 
! 						 XtNinternalHeight,&h,
! 						 XtNwidth,&width,
! 						 XtNrowSpacing,&s,
! 						 NULL);
! 				   XtVaSetValues(scroll, 
! 						 XtNheight, h+size*(s+FONTHEIGHT(font)),
! 						 XtNwidth, width+20,
! 						 NULL);
! 				 }
! #endif
!                                w = scroll;
!                                for (i=0; i<list_cnt; i++)
!                                {
! #ifdef MOTIF
!                                        XmStringFree(string_list[i]);
! #else
! /*                                       free(string_list[i]);*/
! #endif
!                                }
! #ifdef MOTIF
!                                if (string_list != NULL)
!                                {
!                                        free((char *)string_list);
!                                }
! #endif
!                                for (i=0; i<vlist_cnt; i++)
!                                {
! #ifdef MOTIF
!                                        XmStringFree(val_list[i]);
! #else
!                                        free(val_list[i]);
! #endif
!                                }
!                                if (val_list != NULL)
!                                {
!                                        free((char *)val_list);
!                                }
!                        }
!                        XtSetMappedWhenManaged(w, False);
!                        XtManageChild(w);
!                }
!                else if ((type_str != NULL)&&(strcmp(type_str, "password") ==0))
!                 {
! #ifndef MOTIF
! 		        char *txt;;
! #endif
!                         type = W_PASSWORD;
  			value = ParseMarkTag(text, MT_INPUT, "VALUE");
  
  			size = -1;
***************
*** 1934,1941 ****
  			}
  
  			argcnt = 0;
! 			XtSetArg(arg[argcnt], XmNx, x); argcnt++;
! 			XtSetArg(arg[argcnt], XmNy, y); argcnt++;
  			if (size > 0)
  			{
  				XtSetArg(arg[argcnt], XmNcolumns, size);
--- 2447,2455 ----
  			}
  
  			argcnt = 0;
! 			XtSetArg(arg[argcnt], XxNx, x); argcnt++;
! 			XtSetArg(arg[argcnt], XxNy, y); argcnt++;
! #ifdef MOTIF
  			if (size > 0)
  			{
  				XtSetArg(arg[argcnt], XmNcolumns, size);
***************
*** 1946,2110 ****
  				XtSetArg(arg[argcnt], XmNmaxLength, maxlength);
  				argcnt++;
  			}
  			if (value != NULL)
! 			{
! 				int i, len;
! 				char *bval;
  
! 				len = strlen(value);
! 				bval = (char *)malloc(len + 1);
! 				for (i=0; i<len; i++)
! 				{
! 					bval[i] = '*';
! 				}
! 				bval[len] = '\0';
! 				XtSetArg(arg[argcnt], XmNvalue, bval);
! 				argcnt++;
! 			}
  			w = XmCreateTextField(hw->html.view, "Child",
  				arg, argcnt);
! 			XtSetMappedWhenManaged(w, False);
  			XtManageChild(w);
  			XtAddCallback(w, XmNactivateCallback,
  				CBActivateField, (caddr_t)fptr);
! 			XtAddCallback(w, XmNmodifyVerifyCallback,
! 				CBPasswordModify, (caddr_t)fptr);
! 		}
! 		else /* if no type, assume type=text */
! 		{
! 			char **list;
! 			int list_cnt;
! 			int rows, cols;
! 			Widget scroll;
! 
! 			/*
! 			 * SIZE can be either COLUMNS or COLUMNS,ROWS
! 			 * we assume COLUMNS,ROWS and parse the list
! 			 */
! 			tptr = ParseMarkTag(text, MT_INPUT, "SIZE");
! 			list = ParseCommaList(tptr, &list_cnt);
! 			if (tptr != NULL)
! 			{
! 				free(tptr);
! 			}
! 
! 			/*
! 			 * If only COLUMNS specified, or SIZE not specified
! 			 * assume a TEXTFIELD
! 			 * Otherwise a TEXTAREA.
! 			 */
! 			if (list_cnt <= 1)
! 			{
! 				type = W_TEXTFIELD;
! 				if (list_cnt == 1)
! 				{
! 					cols = atoi(list[0]);
! 				}
! 				else
! 				{
! 					cols = -1;
! 				}
! 			}
! 			else
! 			{
! 				type = W_TEXTAREA;
! 				cols = atoi(list[0]);
! 				rows = atoi(list[1]);
! 			}
! 			/*
! 			 * Now that we have cols, and maybe rows, free the list
! 			 */
! 			FreeCommaList(list, list_cnt);
! 
! 			/*
! 			 * Grab the starting value of the text here.
! 			 * NULL if none.
! 			 */
! 			value = ParseMarkTag(text, MT_INPUT, "VALUE");
! 
! 			/*
! 			 * For textfileds parse maxlength and
! 			 * set up the widget.
! 			 */
! 			if (type == W_TEXTFIELD)
! 			{
! 				maxlength = -1;
! 				tptr = ParseMarkTag(text, MT_INPUT,"MAXLENGTH");
! 				if (tptr != NULL)
! 				{
! 					maxlength = atoi(tptr);
! 					free(tptr);
! 				}
! 
! 				argcnt = 0;
! 				XtSetArg(arg[argcnt], XmNx, x); argcnt++;
! 				XtSetArg(arg[argcnt], XmNy, y); argcnt++;
! 				if (cols > 0)
! 				{
! 					XtSetArg(arg[argcnt], XmNcolumns, cols);
! 					argcnt++;
! 				}
! 				if (maxlength > 0)
! 				{
! 					XtSetArg(arg[argcnt], XmNmaxLength,
! 						maxlength);
! 					argcnt++;
! 				}
! 				if (value != NULL)
! 				{
! 					XtSetArg(arg[argcnt], XmNvalue, value);
! 					argcnt++;
! 				}
! 				w = XmCreateTextField(hw->html.view, "Child",
! 					arg, argcnt);
! 			}
! 			/*
! 			 * Else this is a TEXTAREA.  Maxlength is ignored,
! 			 * and we set up the scrolled window
! 			 */
! 			else
! 			{
! 				argcnt = 0;
! 				scroll = XmCreateScrolledWindow(hw->html.view,
! 					"Scroll", arg, argcnt);
! 
! 				argcnt = 0;
! 				XtSetArg(arg[argcnt], XmNx, x); argcnt++;
! 				XtSetArg(arg[argcnt], XmNy, y); argcnt++;
! 				XtSetArg(arg[argcnt], XmNeditMode,
! 					XmMULTI_LINE_EDIT);
! 				argcnt++;
! 				if (cols > 0)
! 				{
! 					XtSetArg(arg[argcnt], XmNcolumns, cols);
! 					argcnt++;
! 				}
! 				if (rows > 0)
! 				{
! 					XtSetArg(arg[argcnt], XmNrows, rows);
! 					argcnt++;
! 				}
! 				if (value != NULL)
! 				{
! 					XtSetArg(arg[argcnt], XmNvalue, value);
! 					argcnt++;
! 				}
! 				w = XmCreateText(scroll, "Text", arg, argcnt);
! 				XtManageChild(w);
! 				w = scroll;
! 			}
  
! 			XtSetMappedWhenManaged(w, False);
  			XtManageChild(w);
! 
! 			/*
! 			 * For textfields, a CR might be an activate
! 			 */
! 			if (type == W_TEXTFIELD)
! 			{
! 				XtAddCallback(w, XmNactivateCallback,
! 					CBActivateField, (caddr_t)fptr);
! 			}
  		}
  		if (type_str != NULL)
  		{
--- 2460,2754 ----
  				XtSetArg(arg[argcnt], XmNmaxLength, maxlength);
  				argcnt++;
  			}
+ #else
+ 			XtSetArg(arg[argcnt], XtNeditType, XawtextEdit); 
+ 			argcnt++;
+ 
+ 			if (maxlength > 0)
+                             {
+ 			    if (value)
+ 			        {
+ 				txt = XtNewString(value);
+ 				txt = (char*) realloc(txt, sizeof(char)*(maxlength+1));
+ 			        }
+ 			    else 
+ 				{
+ 				txt = (char *)malloc(sizeof(char)*(maxlength+1));
+ 				*txt = '\0';
+ 				}
+ 			    XtSetArg(arg[argcnt], XtNuseStringInPlace, 1); 
+ 			    argcnt++;
+ 			    XtSetArg(arg[argcnt], XtNlength, maxlength); 
+ 			    argcnt++;
+ 			    }
+ 			else 
+ 			    {
+ 			    XtSetArg(arg[argcnt], XtNuseStringInPlace, 0); 
+ 			    argcnt++;
+ 			    }
+ #endif
  			if (value != NULL)
! 			    {
! 			    int i, len;
! 			    char *bval;
!  
! 			    len = strlen(value);
! #ifndef MOTIF
! 			    if (maxlength>0) 
! 				{
! 				bval = txt;
! 				if (maxlength<len) len = maxlength+1;
! 				}
! 			    else 
! #endif
! 			    bval = (char *)malloc(len + 1);
! 
! 			    for (i=0; i<len; i++)
! 				{
! 				bval[i] = '*';
! 				}
! 			    bval[len] = '\0';
! 			    XtSetArg(arg[argcnt], XxNvalue, bval);
! 			    argcnt++;
! 			    }
! #ifndef MOTIF
! 			else  /* value == NULL */
!                         if (maxlength>0)  /* stringInPlace */
! 			    {
! 			    XtSetArg(arg[argcnt], XxNvalue, txt);
! 			    argcnt++;
! 			    }
! #endif
! 			
  
! #ifdef MOTIF
  			w = XmCreateTextField(hw->html.view, "Child",
  				arg, argcnt);
! 		        XtSetMappedWhenManaged(w, False);
  			XtManageChild(w);
  			XtAddCallback(w, XmNactivateCallback,
  				CBActivateField, (caddr_t)fptr);
!                         XtAddCallback(w, XmNmodifyVerifyCallback,
!                                 CBPasswordModify, (caddr_t)fptr);
! #else
! 			w = XtCreateWidget(name, asciiTextWidgetClass, 
! 					   hw->html.view, arg, argcnt);
! 
! 			if (maxlength>0) 
! 			    XtAddCallback(w, XtNdestroyCallback, 
! 					  CBTextDestroy, (caddr_t)txt);
! 
! 			XtOverrideTranslations(w, 
! 			     XtParseTranslationTable("<Key>: HTMLpwdInput()"));
! 			XtOverrideTranslations(w, 
! 			     XtParseTranslationTable("<Key>Return: no-op(RingBell)"));
  
! 			setTextSize(w,size<1?20:size,1);
  			XtManageChild(w);
! #endif
! 	       }
!                else /* if no type, assume type=text */
!                {
!                       char **list;
!                       int list_cnt;
!                       int rows, cols;
! #ifdef MOTIF
!                       Widget scroll;
! #endif
! 
!                       /*
!                        * SIZE can be either COLUMNS or COLUMNS,ROWS
!                        * we assume COLUMNS,ROWS and parse the list
!                        */
!                       tptr = ParseMarkTag(text, MT_INPUT, "SIZE");
!                       list = ParseCommaList(tptr, &list_cnt);
!                       if (tptr != NULL)
!                       {
!                               free(tptr);
!                       }
! 
!                       /*
!                        * If only COLUMNS specified, or SIZE not specified
!                        * assume a TEXTFIELD
!                        * Otherwise a TEXTAREA.
!                        */
!                       if (list_cnt <= 1)
!                       {
!                               type = W_TEXTFIELD;
!                               if (list_cnt == 1)
!                               {
!                                       cols = atoi(list[0]);
!                               }
!                               else
!                               {
!                                       cols = -1;
!                               }
!                       }
!                       else
!                       {
!                               type = W_TEXTAREA;
!                               cols = atoi(list[0]);
!                               rows = atoi(list[1]);
!                       }
!                       /*
!                        * Now that we have cols, and maybe rows, free the list
!                        */
!                       FreeCommaList(list, list_cnt);
! 
!                       /*
!                        * Grab the starting value of the text here.
!                        * NULL if none.
!                        */
!                       value = ParseMarkTag(text, MT_INPUT, "VALUE");
! 
!                       /*
!                        * For textfileds parse maxlength and
!                        * set up the widget.
!                        */
!                       if (type == W_TEXTFIELD)
!                       {
! #ifndef MOTIF
! 			      char *txt;
! #endif
!                               maxlength = -1;
!                               tptr = ParseMarkTag(text, MT_INPUT,"MAXLENGTH");
!                               if (tptr != NULL)
!                               {
!                                       maxlength = atoi(tptr);
!                                       free(tptr);
!                               }
! 
!                               argcnt = 0;
!                               XtSetArg(arg[argcnt], XxNx, x); argcnt++;
!                               XtSetArg(arg[argcnt], XxNy, y); argcnt++;
! #ifdef MOTIF
!                               if (cols > 0)
!                               {
!                                       XtSetArg(arg[argcnt], XmNcolumns, cols);
!                                       argcnt++;
!                               }
!                               if (maxlength > 0)
!                               {
!                                       XtSetArg(arg[argcnt], XmNmaxLength,
!                                               maxlength);
!                                       argcnt++;
!                               }
!                               if (value != NULL)
!                               {
!                                       XtSetArg(arg[argcnt], XmNvalue, value);
!                                       argcnt++;
! 
!                               }
!                               w = XmCreateTextField(hw->html.view, "Child",
!                                       arg, argcnt);
! #else
! 			      if (maxlength > 0)
! 				  {
! 				  if (value)
! 				      {
! 				      txt = XtNewString(value);
! 				      txt = (char *)realloc(txt, maxlength);
! 				      }
! 				  else 
! 				      {
! 				      txt = (char *)malloc(maxlength);
! 				      *txt = '\0';
! 				      }
! 				  XtSetArg(arg[argcnt], XtNuseStringInPlace,1);
! 				  argcnt++;
! 				  XtSetArg(arg[argcnt], XtNlength, maxlength);
! 				  argcnt++;
! 				  }
! 			      else
! 			      if (value != NULL)
! 				  {
! 				  XtSetArg(arg[argcnt], XtNuseStringInPlace,0);
! 				  argcnt++;
! 				  txt = value;
!                               }
!                               XtSetArg(arg[argcnt], XtNstring, txt);
!                               argcnt++;
! 			      XtSetArg(arg[argcnt], XtNeditType, XawtextEdit); 
! 			      argcnt++;
! 			      w = XtCreateWidget(name, 
! 						 asciiTextWidgetClass, 
! 						 hw->html.view, arg, argcnt);
! 
! 			      if (maxlength>0) 
! 				  XtAddCallback(w, XtNdestroyCallback, 
! 					  CBTextDestroy, (caddr_t)txt);
! 
! 			      XtOverrideTranslations(w, 
! 					XtParseTranslationTable("<Key>Return: no-op(RingBell)"));
! 			      setTextSize(w,cols>0?cols:20,1);
! 			      XtManageChild(w);
! #endif
!                       }
!                       /*
!                        * Else this is a TEXTAREA.  Maxlength is ignored,
!                        * and we set up the scrolled window
!                        */
!                       else
!                       {
! #ifdef MOTIF
!                               argcnt = 0;
!                               scroll = XmCreateScrolledWindow(hw->html.view,
!                                       "Scroll", arg, argcnt);
! #endif
!                               argcnt = 0;
!                               XtSetArg(arg[argcnt], XxNx, x); argcnt++;
!                               XtSetArg(arg[argcnt], XxNy, y); argcnt++;
! #ifdef MOTIF
!                               XtSetArg(arg[argcnt], XmNeditMode,
!                                       XmMULTI_LINE_EDIT);
!                               argcnt++;
!                               if (cols > 0)
!                               {
!                                       XtSetArg(arg[argcnt], XmNcolumns, cols);
!                                       argcnt++;
!                               }
!                               if (rows > 0)
!                               {
!                                       XtSetArg(arg[argcnt], XmNrows, rows);
!                                       argcnt++;
! 			      }
! #else
! 			      XtSetArg(arg[argcnt], XtNeditType, XawtextEdit); 
! 			      argcnt++;
! #endif
!                               if (value != NULL)
!                               {
!                                       XtSetArg(arg[argcnt], XxNvalue, value);
!                                       argcnt++;
!                               }
! #ifdef MOTIF
!                               w = XmCreateText(scroll, "Text", arg, argcnt);
!                               XtManageChild(w);
!                               w = scroll;
! #else
! 			      w = XtCreateWidget(name, 
! 						 asciiTextWidgetClass, 
! 						 hw->html.view, arg, argcnt);
! 
! 			      setTextSize(w,cols>0?cols:20,rows>0?rows:1);
! 			      XtManageChild(w);
! #endif
!                       }
! 
!                       XtSetMappedWhenManaged(w, False);
!                       XtManageChild(w);
! 
! #ifdef MOTIF
! /* MOTIF only */
!                       /*
!                        * For textfields, a CR might be an activate
!                        */
!                       if (type == W_TEXTFIELD)
!                       {
!                               XtAddCallback(w, XmNactivateCallback,
!                                       CBActivateField, (caddr_t)fptr);
!                       }
! #endif
  		}
  		if (type_str != NULL)
  		{
***************
*** 2112,2141 ****
  		}
  
  		argcnt = 0;
! 		XtSetArg(arg[argcnt], XmNwidth, &width); argcnt++;
! 		XtSetArg(arg[argcnt], XmNheight, &height); argcnt++;
  		XtGetValues(w, arg, argcnt);
  
! 		wptr = AddNewWidget(hw, fptr, w, type, id, x, y, width, height,
! 			name, value, checked);
  	}
  	else
! 	/*
! 	 * We found this widget on the list of already created widgets.
! 	 * Put it in place for reuse.
! 	 */
! 	{
! 		wlist->x = x;
! 		wlist->y = y;
  
  		argcnt = 0;
! 		XtSetArg(arg[argcnt], XmNx, x); argcnt++;
! 		XtSetArg(arg[argcnt], XmNy, y); argcnt++;
  		XtSetValues(wlist->w, arg, argcnt);
  
  		wptr = wlist;
  	}
- 
  	return(wptr);
  }
  
--- 2756,2784 ----
  		}
  
  		argcnt = 0;
! 		XtSetArg(arg[argcnt], XxNwidth, &width); argcnt++;
! 		XtSetArg(arg[argcnt], XxNheight, &height); argcnt++;
  		XtGetValues(w, arg, argcnt);
  
! 	        wptr = AddNewWidget(hw, fptr, w, type, id, x, y, width, height,
!                         name, value, checked);
  	}
  	else
!       /*
!        * We found this widget on the list of already created widgets.
!        * Put it in place for reuse.
!        */
!         {
!                 wlist->x = x;
!                 wlist->y = y;
  
  		argcnt = 0;
! 		XtSetArg(arg[argcnt], XxNx, x); argcnt++;
! 		XtSetArg(arg[argcnt], XxNy, y); argcnt++;
  		XtSetValues(wlist->w, arg, argcnt);
  
  		wptr = wlist;
  	}
  	return(wptr);
  }
  
*** Makefile.ORIG	Sun Oct 17 23:29:25 1993
--- Makefile	Thu Oct 21 20:39:36 1993
***************
*** 2,8 ****
  
  all: $(LIBTARGET)
  
! CFILES = HTML.c HTMLlists.c HTMLformat.c HTMLparse.c HTMLimages.c HTMLwidgets.c HTML-PSformat.c HTMLjot.c
  
  OBJS = $(CFILES:.c=.o)
  
--- 2,8 ----
  
  all: $(LIBTARGET)
  
! CFILES = HTML.c HTMLlists.c HTMLformat.c HTMLparse.c HTMLimages.c HTMLwidgets.c HTML-PSformat.c DrawingArea.c HTMLjot.c
  
  OBJS = $(CFILES:.c=.o)
  
