Its amazing what you can do with real documentation!
This is as the subject says and recommended for 21.4.
2001-07-26 Andy Piper <andy(a)xemacs.org>
* lwlib-Xm.c (xm_update_progress): new function. Set Scale height
and width from normal height and width.
* lwlib-Xm.c (xm_create_progress): ditto.
* lwlib-Xm.c (xm_update_one_widget): call xm_update_progress.
* lwlib.c (lw_get_value_arg): new function. Return an argument
based on its name.
* lwlib.h: declare it.
diff -ru ../xemacs-21.4/lwlib/lwlib-Xm.c lwlib/lwlib-Xm.c
--- ../xemacs-21.4/lwlib/lwlib-Xm.c Thu Apr 12 11:21:52 2001
+++ lwlib/lwlib-Xm.c Thu Jul 26 17:57:44 2001
@@ -336,6 +336,36 @@
XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance);
}
+static void
+xm_update_progress (widget_instance* instance, Widget scale,
+ widget_value* val)
+{
+ Arg al[20];
+ int ac = 0;
+ Dimension height = 0;
+ Dimension width = 0;
+ if (!val->call_data)
+ {
+ XtSetArg (al [ac], XmNeditable, False); ac++;
+ }
+ else
+ {
+ XtSetArg (al [ac], XmNeditable, val->enabled); ac++;
+ }
+ height = (Dimension)lw_get_value_arg (val, XtNheight);
+ width = (Dimension)lw_get_value_arg (val, XtNwidth);
+ if (height > 0)
+ {
+ XtSetArg (al [ac], XmNscaleHeight, height); ac++;
+ }
+ if (width > 0)
+ {
+ XtSetArg (al [ac], XmNscaleWidth, width); ac++;
+ }
+
+ XtSetValues (scale, al, 1);
+}
+
#ifdef LWLIB_MENUBARS_MOTIF
static void
@@ -858,6 +888,10 @@
xm_update_scrollbar (instance, widget, val);
}
#endif
+ else if (class == xmScaleWidgetClass)
+ {
+ xm_update_progress (instance, widget, val);
+ }
/* Lastly update our global arg values. */
if (val->args && val->args->nargs)
XtSetValues (widget, val->args->args, val->args->nargs);
@@ -912,7 +946,7 @@
if (radiobox)
{
CompositeWidget radio = (CompositeWidget)widget;
- int i;
+ unsigned int i;
for (i = 0; i < radio->composite.num_children; i++)
{
int set = False;
@@ -1649,20 +1683,18 @@
{
Arg al[20];
int ac = 0;
+ Dimension height = 0;
+ Dimension width = 0;
Widget scale = 0;
widget_value* val = instance->info->val;
-#if 0 /* This looks too awful, although more correct. */
if (!val->call_data)
{
- XtSetArg (al [ac], XmNsensitive, False); ac++;
+ XtSetArg (al [ac], XmNeditable, False); ac++;
}
else
{
- XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
+ XtSetArg (al [ac], XmNeditable, val->enabled); ac++;
}
-#else
- XtSetArg (al [ac], XmNsensitive, True); ac++;
-#endif
XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
@@ -1671,6 +1703,18 @@
look ugly. I think this may be a LessTif bug but for now we just
get rid of it. */
XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
+
+ height = (Dimension)lw_get_value_arg (val, XtNheight);
+ width = (Dimension)lw_get_value_arg (val, XtNwidth);
+ if (height > 0)
+ {
+ XtSetArg (al [ac], XmNscaleHeight, height); ac++;
+ }
+ if (width > 0)
+ {
+ XtSetArg (al [ac], XmNscaleWidth, width); ac++;
+ }
+
/* add any args the user supplied for creation time */
lw_add_value_args_to_args (val, al, &ac);
diff -ru ../xemacs-21.4/lwlib/lwlib.c lwlib/lwlib.c
--- ../xemacs-21.4/lwlib/lwlib.c Thu Apr 12 11:21:52 2001
+++ lwlib/lwlib.c Thu Jul 26 17:51:02 2001
@@ -1389,6 +1389,22 @@
}
}
+XtArgVal lw_get_value_arg (widget_value* wv, String name)
+{
+ int i;
+ if (wv->args)
+ {
+ for (i = 0; i < wv->args->nargs; i++)
+ {
+ if (!strcmp (wv->args->args[i].name, name))
+ {
+ return wv->args->args[i].value;
+ }
+ }
+ }
+ return (XtArgVal)0;
+}
+
void lw_add_widget_value_arg (widget_value* wv, String name, XtArgVal value)
{
int i = 0;
Only in lwlib: lwlib.c~
diff -ru ../xemacs-21.4/lwlib/lwlib.h lwlib/lwlib.h
--- ../xemacs-21.4/lwlib/lwlib.h Thu Apr 12 11:21:52 2001
+++ lwlib/lwlib.h Thu Jul 26 08:28:56 2001
@@ -214,6 +214,7 @@
void lw_pop_down_all_widgets (LWLIB_ID id);
void lw_add_value_args_to_args (widget_value* wv, ArgList addto, int* offset);
void lw_add_widget_value_arg (widget_value* wv, String name, XtArgVal value);
+XtArgVal lw_get_value_arg (widget_value* wv, String name);
void lw_copy_widget_value_args (widget_value* copy, widget_value* val);
widget_value * copy_widget_value_tree (widget_value *val, change_type change);