(doc-view-mode): Improve docstring.
[bpt/emacs.git] / lwlib / lwlib.c
index 5f68a36..7b2752b 100644 (file)
@@ -1,22 +1,24 @@
 /* A general interface to the widgets of different toolkits.
 /* A general interface to the widgets of different toolkits.
-   Copyright (C) 1992, 1993 Lucid, Inc.
+Copyright (C) 1992, 1993 Lucid, Inc.
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003, 2004,
+  2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
 
 This file is part of the Lucid Widget Library.
 
-The Lucid Widget Library is free software; you can redistribute it and/or 
+The Lucid Widget Library is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2, or (at your option)
 any later version.
 
 The Lucid Widget Library is distributed in the hope that it will be useful,
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2, or (at your option)
 any later version.
 
 The Lucid Widget Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of 
+but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 #ifdef NeXT
 #undef __STRICT_BSD__ /* ick */
 
 #ifdef NeXT
 #undef __STRICT_BSD__ /* ick */
@@ -46,7 +48,11 @@ Boston, MA 02111-1307, USA.  */
 #endif /* not USE_MOTIF && USE_LUCID */
 #endif
 #if defined (USE_XAW)
 #endif /* not USE_MOTIF && USE_LUCID */
 #endif
 #if defined (USE_XAW)
+#ifdef HAVE_XAW3D
+#include <X11/Xaw3d/Paned.h>
+#else /* !HAVE_XAW3D */
 #include <X11/Xaw/Paned.h>
 #include <X11/Xaw/Paned.h>
+#endif /* HAVE_XAW3D */
 #include "lwlib-Xaw.h"
 #endif
 
 #include "lwlib-Xaw.h"
 #endif
 
@@ -101,7 +107,7 @@ static void destroy_one_instance P_ ((widget_instance *));
 static void lw_pop_all_widgets P_ ((LWLIB_ID, Boolean));
 static Boolean get_one_value P_ ((widget_instance *, widget_value *));
 static void show_one_widget_busy P_ ((Widget, Boolean));
 static void lw_pop_all_widgets P_ ((LWLIB_ID, Boolean));
 static Boolean get_one_value P_ ((widget_instance *, widget_value *));
 static void show_one_widget_busy P_ ((Widget, Boolean));
-     
+
 void
 lwlib_memset (address, value, length)
      char *address;
 void
 lwlib_memset (address, value, length)
      char *address;
@@ -190,7 +196,7 @@ malloc_widget_value ()
 }
 
 /* this is analogous to free().  It frees only what was allocated
 }
 
 /* this is analogous to free().  It frees only what was allocated
-   by malloc_widget_value(), and no substructures. 
+   by malloc_widget_value(), and no substructures.
  */
 void
 free_widget_value (wv)
  */
 void
 free_widget_value (wv)
@@ -251,7 +257,7 @@ copy_widget_value_tree (val, change)
      change_type change;
 {
   widget_value* copy;
      change_type change;
 {
   widget_value* copy;
-  
+
   if (!val)
     return NULL;
   if (val == (widget_value *) 1)
   if (!val)
     return NULL;
   if (val == (widget_value *) 1)
@@ -523,7 +529,7 @@ merge_widget_value (val1, val2, level, change_p)
       free_widget_value_tree (val1);
       return NULL;
     }
       free_widget_value_tree (val1);
       return NULL;
     }
-  
+
   change = NO_CHANGE;
 
   if (safe_strcmp (val1->name, val2->name))
   change = NO_CHANGE;
 
   if (safe_strcmp (val1->name, val2->name))
@@ -591,7 +597,7 @@ merge_widget_value (val1, val2, level, change_p)
       merged_contents =
        merge_widget_value (val1->contents, val2->contents, level - 1,
                            change_p);
       merged_contents =
        merge_widget_value (val1->contents, val2->contents, level - 1,
                            change_p);
-      
+
       if (val1->contents && !merged_contents)
        {
          /* This used to say INVISIBLE_CHANGE,
       if (val1->contents && !merged_contents)
        {
          /* This used to say INVISIBLE_CHANGE,
@@ -614,7 +620,7 @@ merge_widget_value (val1, val2, level, change_p)
 #endif
 #endif
        }
 #endif
 #endif
        }
-      
+
       val1->contents = merged_contents;
     }
 
       val1->contents = merged_contents;
     }
 
@@ -640,7 +646,7 @@ merge_widget_value (val1, val2, level, change_p)
 
   val1->this_one_change = this_one_change;
   val1->change = change;
 
   val1->this_one_change = this_one_change;
   val1->change = change;
-  
+
   if (change > NO_CHANGE && val1->toolkit_data)
     {
       *change_p = 1;
   if (change > NO_CHANGE && val1->toolkit_data)
     {
       *change_p = 1;
@@ -672,7 +678,7 @@ name_to_widget (instance, name)
       char* real_name = (char *) xmalloc (length);
       real_name [0] = '*';
       strcpy (real_name + 1, name);
       char* real_name = (char *) xmalloc (length);
       real_name [0] = '*';
       strcpy (real_name + 1, name);
-      
+
       widget = XtNameToWidget (instance->widget, real_name);
 
       free (real_name);
       widget = XtNameToWidget (instance->widget, real_name);
 
       free (real_name);
@@ -691,7 +697,7 @@ set_one_value (instance, val, deep_p)
 #endif
 {
   Widget widget = name_to_widget (instance, val->name);
 #endif
 {
   Widget widget = name_to_widget (instance, val->name);
-  
+
   if (widget)
     {
 #if defined (USE_LUCID)
   if (widget)
     {
 #if defined (USE_LUCID)
@@ -842,11 +848,11 @@ static Boolean
 dialog_spec_p (name)
      char* name;
 {
 dialog_spec_p (name)
      char* name;
 {
-  /* return True if name matches [EILPQeilpq][1-9][Bb] or 
+  /* return True if name matches [EILPQeilpq][1-9][Bb] or
      [EILPQeilpq][1-9][Bb][Rr][1-9] */
   if (!name)
     return False;
      [EILPQeilpq][1-9][Bb][Rr][1-9] */
   if (!name)
     return False;
-  
+
   switch (name [0])
     {
     case 'E': case 'I': case 'L': case 'P': case 'Q':
   switch (name [0])
     {
     case 'E': case 'I': case 'L': case 'P': case 'Q':
@@ -866,7 +872,7 @@ dialog_spec_p (name)
        }
       else
        return False;
        }
       else
        return False;
-    
+
     default:
       return False;
     }
     default:
       return False;
     }
@@ -908,7 +914,7 @@ instantiate_widget_instance (instance)
 #endif
        }
     }
 #endif
        }
     }
-  
+
   if (!function)
     {
       printf ("No creation function for widget type %s\n",
   if (!function)
     {
       printf ("No creation function for widget type %s\n",
@@ -924,7 +930,7 @@ instantiate_widget_instance (instance)
   /*   XtRealizeWidget (instance->widget);*/
 }
 
   /*   XtRealizeWidget (instance->widget);*/
 }
 
-void 
+void
 lw_register_widget (type, name, id, val, pre_activate_cb,
                    selection_cb, post_activate_cb, highlight_cb)
      char* type;
 lw_register_widget (type, name, id, val, pre_activate_cb,
                    selection_cb, post_activate_cb, highlight_cb)
      char* type;
@@ -952,7 +958,7 @@ lw_get_widget (id, parent, pop_up_p)
 #endif
 {
   widget_instance* instance;
 #endif
 {
   widget_instance* instance;
-  
+
   instance = find_instance (id, parent, pop_up_p);
   return instance ? instance->widget : NULL;
 }
   instance = find_instance (id, parent, pop_up_p);
   return instance ? instance->widget : NULL;
 }
@@ -969,7 +975,7 @@ lw_make_widget (id, parent, pop_up_p)
 {
   widget_instance* instance;
   widget_info* info;
 {
   widget_instance* instance;
   widget_info* info;
-  
+
   instance = find_instance (id, parent, pop_up_p);
   if (!instance)
     {
   instance = find_instance (id, parent, pop_up_p);
   if (!instance)
     {
@@ -1009,7 +1015,7 @@ lw_create_widget (type, name, id, val, parent, pop_up_p, pre_activate_cb,
                      post_activate_cb, highlight_cb);
   return lw_make_widget (id, parent, pop_up_p);
 }
                      post_activate_cb, highlight_cb);
   return lw_make_widget (id, parent, pop_up_p);
 }
-                 
+
 \f
 /* destroying the widgets */
 static void
 \f
 /* destroying the widgets */
 static void
@@ -1046,7 +1052,7 @@ destroy_one_instance (instance)
 #if defined (USE_XAW)
       if (lw_xaw_widget_p (instance->widget))
        xaw_destroy_instance (instance);
 #if defined (USE_XAW)
       if (lw_xaw_widget_p (instance->widget))
        xaw_destroy_instance (instance);
-      else 
+      else
 #endif
        /* do not remove the empty statement */
        ;
 #endif
        /* do not remove the empty statement */
        ;
@@ -1060,7 +1066,7 @@ lw_destroy_widget (w)
      Widget w;
 {
   widget_instance* instance = get_widget_instance (w, True);
      Widget w;
 {
   widget_instance* instance = get_widget_instance (w, True);
-  
+
   if (instance)
     {
       widget_info *info = instance->info;
   if (instance)
     {
       widget_info *info = instance->info;
@@ -1233,7 +1239,7 @@ get_one_value (instance, val)
      widget_value* val;
 {
   Widget widget = name_to_widget (instance, val->name);
      widget_value* val;
 {
   Widget widget = name_to_widget (instance, val->name);
-      
+
   if (widget)
     {
 #if defined (USE_LUCID)
   if (widget)
     {
 #if defined (USE_LUCID)
@@ -1310,7 +1316,7 @@ lw_get_widget_value_for_widget (instance, w)
 /* To forbid recursive calls */
 static Boolean lwlib_updating;
 
 /* To forbid recursive calls */
 static Boolean lwlib_updating;
 
-/* This function can be used as a an XtCallback for the widgets that get 
+/* This function can be used as a an XtCallback for the widgets that get
   modified to update other instances of the widgets.  Closure should be the
   widget_instance. */
 void
   modified to update other instances of the widgets.  Closure should be the
   widget_instance. */
 void
@@ -1390,7 +1396,7 @@ show_one_widget_busy (w, flag)
   Widget widget_to_invert = XtNameToWidget (w, "*sheet");
   if (!widget_to_invert)
     widget_to_invert = w;
   Widget widget_to_invert = XtNameToWidget (w, "*sheet");
   if (!widget_to_invert)
     widget_to_invert = w;
-  
+
   XtVaGetValues (widget_to_invert,
                 XtNforeground, &foreground,
                 XtNbackground, &background,
   XtVaGetValues (widget_to_invert,
                 XtNforeground, &foreground,
                 XtNbackground, &background,
@@ -1438,7 +1444,7 @@ lw_refigure_widget (w, doit)
      Boolean doit;
 #endif
 {
      Boolean doit;
 #endif
 {
-#if defined (USE_XAW)  
+#if defined (USE_XAW)
   XawPanedSetRefigureMode (w, doit);
 #endif
 #if defined (USE_MOTIF)
   XawPanedSetRefigureMode (w, doit);
 #endif
 #if defined (USE_MOTIF)
@@ -1611,3 +1617,5 @@ lw_separator_p (label, type, motif_p)
   return separator_p;
 }
 
   return separator_p;
 }
 
+/* arch-tag: 3d730f36-a441-4a71-9971-48ef3b5a4d9f
+   (do not change this comment) */