diff lwlib/lwlib-Xaw.c @ 4521:383ab474a241

Fix docstring typo.
author Stephen J. Turnbull <stephen@xemacs.org>
date Tue, 28 Oct 2008 10:38:26 +0900
parents 7bc12bb1a2cf
children fc7067b7f407
line wrap: on
line diff
--- a/lwlib/lwlib-Xaw.c	Mon Oct 27 09:51:51 2008 +0900
+++ b/lwlib/lwlib-Xaw.c	Tue Oct 28 10:38:26 2008 +0900
@@ -88,15 +88,15 @@
       Arg al [10];
 
       /* First size and position the scrollbar widget. */
-      XtSetArg (al [0], XtNx,      data->scrollbar_x);
-      XtSetArg (al [1], XtNy,      data->scrollbar_y);
-      XtSetArg (al [2], XtNwidth,  data->scrollbar_width);
-      XtSetArg (al [3], XtNheight, data->scrollbar_height);
+      Xt_SET_ARG (al [0], XtNx,      data->scrollbar_x);
+      Xt_SET_ARG (al [1], XtNy,      data->scrollbar_y);
+      Xt_SET_ARG (al [2], XtNwidth,  data->scrollbar_width);
+      Xt_SET_ARG (al [3], XtNheight, data->scrollbar_height);
       XtSetValues (widget, al, 4);
 
       /* Now size the scrollbar's slider. */
-      XtSetArg (al [0], XtNtopOfThumb, &widget_topOfThumb);
-      XtSetArg (al [1], XtNshown, &widget_shown);
+      Xt_SET_ARG (al [0], XtNtopOfThumb, &widget_topOfThumb);
+      Xt_SET_ARG (al [1], XtNshown, &widget_shown);
       XtGetValues (widget, al, 2);
 
       new_shown = (double) data->slider_size /
@@ -142,47 +142,37 @@
 #endif
 #ifdef LWLIB_DIALOGS_ATHENA
   else if (XtIsSubclass (widget, dialogWidgetClass))
-      {
-	Arg al [1];
-	XtSetArg (al [0], XtNlabel, val->contents->value);
-	XtSetValues (widget, al, 1);
-      }
+    Xt_SET_VALUE (widget, XtNlabel, val->contents->value);
 #endif /* LWLIB_DIALOGS_ATHENA */
 #ifdef LWLIB_WIDGETS_ATHENA
   else if (XtClass (widget) == labelWidgetClass)
-      {
-	Arg al [1];
-	XtSetArg (al [0], XtNlabel, val->value);
-	XtSetValues (widget, al, 1);
-      }
+    Xt_SET_VALUE (widget, XtNlabel, val->value);
 #endif /* LWLIB_WIDGETS_ATHENA */
 #if defined (LWLIB_DIALOGS_ATHENA) || defined (LWLIB_WIDGETS_ATHENA)
   else if (XtIsSubclass (widget, commandWidgetClass))
     {
-      Dimension bw = 0;
       Arg al [3];
-      XtSetArg (al [0], XtNborderWidth, &bw);
-      XtGetValues (widget, al, 1);
 
 #ifndef LWLIB_DIALOGS_ATHENA3D
-      if (bw == 0)
-	/* Don't let buttons end up with 0 borderwidth, that's ugly...
-	   Yeah, all this should really be done through app-defaults files
-	   or fallback resources, but that's a whole different can of worms
-	   that I don't feel like opening right now.  Making Athena widgets
-	   not look like shit is just entirely too much work.
-	 */
-	{
-	  XtSetArg (al [0], XtNborderWidth, 1);
-	  XtSetValues (widget, al, 1);
+      {
+	Dimension bw = 0;
+	Xt_GET_VALUE (widget, XtNborderWidth, &bw);
+	if (bw == 0)
+	  /* Don't let buttons end up with 0 borderwidth, that's ugly...
+	     Yeah, all this should really be done through app-defaults files
+	     or fallback resources, but that's a whole different can of worms
+	     that I don't feel like opening right now.  Making Athena widgets
+	     not look like shit is just entirely too much work.
+	  */
+	  Xt_SET_VALUE (widget, XtNborderWidth, 1);
 	}
 #endif /* ! LWLIB_DIALOGS_ATHENA3D */
 
       lw_remove_accelerator_spec (val->value);
-      XtSetArg (al [0], XtNlabel,     val->value);
-      XtSetArg (al [1], XtNsensitive, val->enabled);
+      Xt_SET_ARG (al [0], XtNlabel,     val->value);
+      Xt_SET_ARG (al [1], XtNsensitive, val->enabled);
       /* Force centered button text.  See above. */
-      XtSetArg (al [2], XtNjustify, XtJustifyCenter);
+      Xt_SET_ARG (al [2], XtNjustify, XtJustifyCenter);
       XtSetValues (widget, al, 3);
 
       XtRemoveAllCallbacks (widget, XtNcallback);
@@ -190,10 +180,7 @@
 #ifdef LWLIB_WIDGETS_ATHENA
       /* set the selected state */
       if (XtIsSubclass (widget, toggleWidgetClass))
-	{
-	  XtSetArg (al [0], XtNstate, val->selected);
-	  XtSetValues (widget, al, 1);
-	}
+	Xt_SET_VALUE (widget, XtNstate, val->selected);
 #endif /* LWLIB_WIDGETS_ATHENA */
     }
 #endif /* LWLIB_DIALOGS_ATHENA */
@@ -219,19 +206,15 @@
   
   if (XtIsSubclass (widget, toggleWidgetClass))
     {
-      Arg al [1];
-      XtSetArg (al [0], XtNstate, &val->selected);
-      XtGetValues (widget, al, 1);
+      Xt_GET_VALUE (widget, XtNstate, &val->selected);
       val->edited = True;
     }
 #ifndef NEED_MOTIF
   else if (XtIsSubclass (widget, asciiTextWidgetClass))
     {
-      Arg al [2];
       String buf = 0;
-      XtSetArg (al [0], XtNstring, &buf);
-      XtGetValues (widget, al, 1);
 
+      Xt_GET_VALUE (widget, XtNstring, &buf);
       if (val->value)
 	{
 	  free (val->value);
@@ -339,7 +322,7 @@
 static XtActionProc wm_delete_window (Widget shell, XtPointer closure,
 				      XtPointer call_data);
 static XtActionsRec xaw_actions [] = {
-  {"lwlib_delete_dialog", (XtActionProc) wm_delete_window}
+  { (String) "lwlib_delete_dialog", (XtActionProc) wm_delete_window}
 };
 static Boolean actions_initted = False;
 
@@ -375,9 +358,9 @@
   override = XtParseTranslationTable (overrideTrans);
 
   ac = 0;
-  XtSetArg (av[ac], XtNtitle, shell_title);	ac++;
-  XtSetArg (av[ac], XtNallowShellResize, True); ac++;
-  XtSetArg (av[ac], XtNtransientFor, parent);	ac++;
+  Xt_SET_ARG (av[ac], XtNtitle, shell_title);		ac++;
+  Xt_SET_ARG (av[ac], XtNallowShellResize, True);	ac++;
+  Xt_SET_ARG (av[ac], XtNtransientFor, parent);		ac++;
   shell = XtCreatePopupShell ("dialog", transientShellWidgetClass,
 			      parent, av, ac);
   XtOverrideTranslations (shell, override);
@@ -390,12 +373,12 @@
   for (i = 0; i < left_buttons; i++)
     {
       ac = 0;
-      XtSetArg (av [ac], XtNfromHoriz, button);     ac++;
-      XtSetArg (av [ac], XtNleft,   XtChainLeft);   ac++;
-      XtSetArg (av [ac], XtNright,  XtChainLeft);   ac++;
-      XtSetArg (av [ac], XtNtop,    XtChainBottom); ac++;
-      XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
-      XtSetArg (av [ac], XtNresizable, True);       ac++;
+      Xt_SET_ARG (av [ac], XtNfromHoriz, button);	ac++;
+      Xt_SET_ARG (av [ac], XtNleft,   XtChainLeft);	ac++;
+      Xt_SET_ARG (av [ac], XtNright,  XtChainLeft);	ac++;
+      Xt_SET_ARG (av [ac], XtNtop,    XtChainBottom);	ac++;
+      Xt_SET_ARG (av [ac], XtNbottom, XtChainBottom);	ac++;
+      Xt_SET_ARG (av [ac], XtNresizable, True);		ac++;
       sprintf (button_name, "button%d", ++bc);
       button = XtCreateManagedWidget (button_name, commandWidgetClass,
 				      dialog, av, ac);
@@ -410,18 +393,18 @@
 	 window) but I can't seem to make it do it.  
        */
       ac = 0;
-      XtSetArg (av [ac], XtNfromHoriz, button);	    ac++;
-/*  XtSetArg (av [ac], XtNfromVert, XtNameToWidget (dialog, "label")); ac++; */
-      XtSetArg (av [ac], XtNleft,   XtChainLeft);   ac++;
-      XtSetArg (av [ac], XtNright,  XtChainRight);  ac++;
-      XtSetArg (av [ac], XtNtop,    XtChainBottom); ac++;
-      XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
-      XtSetArg (av [ac], XtNlabel, ""); ac++;
-      XtSetArg (av [ac], XtNwidth, 30); ac++;	/* #### aaack!! */
-      XtSetArg (av [ac], XtNborderWidth, 0); ac++;
-      XtSetArg (av [ac], XtNshapeStyle, XmuShapeRectangle); ac++;
-      XtSetArg (av [ac], XtNresizable, False); ac++;
-      XtSetArg (av [ac], XtNsensitive, False); ac++;
+      Xt_SET_ARG (av [ac], XtNfromHoriz, button);		ac++;
+/* Xt_SET_ARG (av [ac], XtNfromVert, XtNameToWidget (dialog, "label")); ac++; */
+      Xt_SET_ARG (av [ac], XtNleft,   XtChainLeft);		ac++;
+      Xt_SET_ARG (av [ac], XtNright,  XtChainRight);		ac++;
+      Xt_SET_ARG (av [ac], XtNtop,    XtChainBottom);		ac++;
+      Xt_SET_ARG (av [ac], XtNbottom, XtChainBottom);		ac++;
+      Xt_SET_ARG (av [ac], XtNlabel, "");			ac++;
+      Xt_SET_ARG (av [ac], XtNwidth, 30); /* #### aaack!! */	ac++;
+      Xt_SET_ARG (av [ac], XtNborderWidth, 0);			ac++;
+      Xt_SET_ARG (av [ac], XtNshapeStyle, XmuShapeRectangle);	ac++;
+      Xt_SET_ARG (av [ac], XtNresizable, False);		ac++;
+      Xt_SET_ARG (av [ac], XtNsensitive, False);		ac++;
       button = XtCreateManagedWidget ("separator",
 				      /* labelWidgetClass, */
 				      /* This has to be Command to fake out
@@ -432,12 +415,12 @@
   for (i = 0; i < right_buttons; i++)
     {
       ac = 0;
-      XtSetArg (av [ac], XtNfromHoriz, button);	    ac++;
-      XtSetArg (av [ac], XtNleft,   XtChainRight);  ac++;
-      XtSetArg (av [ac], XtNright,  XtChainRight);  ac++;
-      XtSetArg (av [ac], XtNtop,    XtChainBottom); ac++;
-      XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
-      XtSetArg (av [ac], XtNresizable, True);	    ac++;
+      Xt_SET_ARG (av [ac], XtNfromHoriz, button);		ac++;
+      Xt_SET_ARG (av [ac], XtNleft, XtChainRight);		ac++;
+      Xt_SET_ARG (av [ac], XtNright,  XtChainRight);		ac++;
+      Xt_SET_ARG (av [ac], XtNtop,    XtChainBottom);		ac++;
+      Xt_SET_ARG (av [ac], XtNbottom, XtChainBottom);		ac++;
+      Xt_SET_ARG (av [ac], XtNresizable, True);			ac++;
       sprintf (button_name, "button%d", ++bc);
       button = XtCreateManagedWidget (button_name, commandWidgetClass,
 				      dialog, av, ac);
@@ -525,13 +508,10 @@
   if (XtIsSubclass (widget, toggleWidgetClass))
     {
       Boolean check;
-      Arg al [1];
 
-      XtSetArg (al [0], XtNstate, &check);
-      XtGetValues (widget, al, 1);
+      Xt_GET_VALUE (widget, XtNstate, &check);
 
-      XtSetArg (al [0], XtNstate, !check);
-      XtSetValues (widget, al, 1);
+      Xt_SET_VALUE (widget, XtNstate, !check);
     }
 #endif /* LWLIB_WIDGETS_ATHENA */
   lw_internal_update_other_instances (widget, closure, call_data);
@@ -549,11 +529,7 @@
 
 #if 0
   user_data = NULL;
-  {
-    Arg al [1];
-    XtSetArg (al [0], XtNuserData, &user_data);
-    XtGetValues (widget, al, 1);
-  }
+  Xt_GET_VALUE (widget, XtNuserData, &user_data);
 #else
   /* Damn!  Athena doesn't give us a way to hang our own data on the
      buttons, so we have to go find it...  I guess this assumes that
@@ -594,11 +570,10 @@
   LWLIB_ID id;
   Widget *kids = 0;
   Widget widget;
-  Arg al [1];
+
   if (! XtIsSubclass (shell, shellWidgetClass))
     abort ();
-  XtSetArg (al [0], XtNchildren, &kids);
-  XtGetValues (shell, al, 1);
+  Xt_GET_VALUE (shell, XtNchildren, &kids);
   if (!kids || !*kids) abort ();
 
   for (widget = *kids;
@@ -697,11 +672,11 @@
      top-level aware of this so that people could have a border but so
      few people use the Athena scrollbar now that it really isn't
      worth the effort, at least not at the moment. */
-  XtSetArg (av [ac], XtNborderWidth, 0); ac++;
-  XtSetArg (av [ac], XtNorientation,
-	    vertical ? XtorientVertical : XtorientHorizontal); ac++;
-  XtSetArg (av [ac], "jumpProc",   jumpCallbacks);   ac++;
-  XtSetArg (av [ac], "scrollProc", scrollCallbacks); ac++;
+  Xt_SET_ARG (av [ac], XtNborderWidth, 0);				ac++;
+  Xt_SET_ARG (av [ac], XtNorientation,
+	      vertical ? XtorientVertical : XtorientHorizontal);	ac++;
+  Xt_SET_ARG (av [ac], "jumpProc",   jumpCallbacks);			ac++;
+  Xt_SET_ARG (av [ac], "scrollProc", scrollCallbacks);			ac++;
 
   return XtCreateWidget (instance->info->name, scrollbarWidgetClass,
 			 instance->parent, av, ac);
@@ -730,13 +705,13 @@
   Widget button = 0;
   widget_value* val = instance->info->val;
 
-  XtSetArg (al [ac], XtNsensitive, val->enabled);		ac++;
-  XtSetArg (al [ac], XtNmappedWhenManaged, FALSE);	ac++;
-  XtSetArg (al [ac], XtNjustify, XtJustifyCenter);		ac++;
+  Xt_SET_ARG (al [ac], XtNsensitive, val->enabled);		ac++;
+  Xt_SET_ARG (al [ac], XtNmappedWhenManaged, FALSE);		ac++;
+  Xt_SET_ARG (al [ac], XtNjustify, XtJustifyCenter);		ac++;
   /* The highlight doesn't appear to be dynamically set which makes it
      look ugly.  I think this may be a LessTif bug but for now we just
      get rid of it. */
-  XtSetArg (al [ac], XtNhighlightThickness, (Dimension)0);ac++;
+  Xt_SET_ARG (al [ac], XtNhighlightThickness, (Dimension)0);	ac++;
 
   /* add any args the user supplied for creation time */
   lw_add_value_args_to_args (val, al, &ac);
@@ -749,7 +724,7 @@
     {
       if (val->type == TOGGLE_TYPE || val->type == RADIO_TYPE)
 	{
-	  XtSetArg (al [ac], XtNstate, val->selected);	ac++;
+	  Xt_SET_ARG (al [ac], XtNstate, val->selected);	ac++;
 	  button = XtCreateWidget 
 	    (val->name, 
 	     val->type == TOGGLE_TYPE ? checkboxWidgetClass : radioWidgetClass,
@@ -783,9 +758,9 @@
   int ac = 0;
   Widget label = 0;
 
-  XtSetArg (al [ac], XtNsensitive, val->enabled);		ac++;
-  XtSetArg (al [ac], XtNmappedWhenManaged, FALSE);	ac++;
-  XtSetArg (al [ac], XtNjustify, XtJustifyCenter);		ac++;
+  Xt_SET_ARG (al [ac], XtNsensitive, val->enabled);	ac++;
+  Xt_SET_ARG (al [ac], XtNmappedWhenManaged, FALSE);	ac++;
+  Xt_SET_ARG (al [ac], XtNjustify, XtJustifyCenter);	ac++;
 
   /* add any args the user supplied for creation time */
   lw_add_value_args_to_args (val, al, &ac);
@@ -868,20 +843,20 @@
 #if 0		/* This looks too awful, although more correct. */
   if (!val->call_data)
     {
-      XtSetArg (al [ac], XtNsensitive, False);		ac++;
+      Xt_SET_ARG (al [ac], XtNsensitive, False);		ac++;
     }
   else
     {
-      XtSetArg (al [ac], XtNsensitive, val->enabled);		ac++;
+      Xt_SET_ARG (al [ac], XtNsensitive, val->enabled);		ac++;
     }
 #else
-  XtSetArg (al [ac], XtNsensitive, True);		ac++;
+  Xt_SET_ARG (al [ac], XtNsensitive, True);			ac++;
 #endif
 
-  XtSetArg (al [ac], XtNmappedWhenManaged, FALSE);	ac++;
-  XtSetArg (al [ac], XtNorientation, XtorientHorizontal);	ac++;
-  XtSetArg (al [ac], XtNhighlightThickness, (Dimension)0);ac++;
-  XtSetArg (al [ac], XtNntics, (Cardinal)10);ac++;
+  Xt_SET_ARG (al [ac], XtNmappedWhenManaged, FALSE);		ac++;
+  Xt_SET_ARG (al [ac], XtNorientation, XtorientHorizontal);	ac++;
+  Xt_SET_ARG (al [ac], XtNhighlightThickness, (Dimension)0);	ac++;
+  Xt_SET_ARG (al [ac], XtNntics, (Cardinal)10);			ac++;
 
   /* add any args the user supplied for creation time */
   lw_add_value_args_to_args (val, al, &ac);
@@ -915,18 +890,18 @@
   Widget text = 0;
   widget_value* val = instance->info->val;
 
-  XtSetArg (al [ac], XtNsensitive, val->enabled);		ac++;
-  XtSetArg (al [ac], XtNmappedWhenManaged, FALSE);	ac++;
-  XtSetArg (al [ac], XtNhighlightThickness, (Dimension)0);	ac++;
-  XtSetArg (al [ac], XtNtype, XawAsciiString);		ac++;
-  XtSetArg (al [ac], XtNeditType, XawtextEdit);		ac++;
-  XtSetArg (al [ac], XtNuseStringInPlace, False);		ac++;
+  Xt_SET_ARG (al [ac], XtNsensitive, val->enabled);		ac++;
+  Xt_SET_ARG (al [ac], XtNmappedWhenManaged, FALSE);		ac++;
+  Xt_SET_ARG (al [ac], XtNhighlightThickness, (Dimension)0);	ac++;
+  Xt_SET_ARG (al [ac], XtNtype, XawAsciiString);		ac++;
+  Xt_SET_ARG (al [ac], XtNeditType, XawtextEdit);		ac++;
+  Xt_SET_ARG (al [ac], XtNuseStringInPlace, False);		ac++;
 #if 0
-  XtSetArg (al [ac], XtNlength, TEXT_BUFFER_SIZE);	ac++;
+  Xt_SET_ARG (al [ac], XtNlength, TEXT_BUFFER_SIZE);		ac++;
 #endif
   if (val->value)
     {
-      XtSetArg (al [ac], XtNstring, val->value);		ac++;
+      Xt_SET_ARG (al [ac], XtNstring, val->value);		ac++;
     }
 
   /* add any args the user supplied for creation time */
@@ -956,8 +931,8 @@
 #endif
 #ifdef LWLIB_WIDGETS_ATHENA
   {"button",		xaw_create_button		},
-  { "label", 		xaw_create_label_field		},
-  {"text-field",		xaw_create_text_field		},
+  {"label", 		xaw_create_label_field		},
+  {"text-field",	xaw_create_text_field		},
   {"progress",		xaw_create_progress		},
 #endif
   {NULL, NULL}