lw_copy_widget_value_args (new, old);
changed = True;
}
+ else if (new->args && new->args == old->args && new->args->args_changed == True)
+ {
+ changed = True;
+ }
return changed;
}
/* Make a complete copy of a widget_value tree. Store CHANGE into
the widget_value tree's `change' field. */
-static widget_value *
+widget_value *
copy_widget_value_tree (widget_value *val, change_type change)
{
widget_value *copy;
update_one_widget_instance (instance, deep_p);
for (val = info->val; val; val = val->next)
- val->change = NO_CHANGE;
+ {
+ val->change = NO_CHANGE;
+ if (val->args)
+ val->args->args_changed = False;
+ }
}
void
update_one_widget_instance (instance, True);
for (val = instance->info->val; val; val = val->next)
- val->change = NO_CHANGE;
+ {
+ val->change = NO_CHANGE;
+ if (val->args)
+ val->args->args_changed = False;
+ }
}
+/* strcasecmp() is not sufficiently portable or standard,
+ and it's easier just to write our own. */
+static int
+ascii_strcasecmp (const char *s1, const char *s2)
+{
+ while (1)
+ {
+ char c1 = *s1++;
+ char c2 = *s2++;
+ if (c1 >= 'A' && c1 <= 'Z') c1 += 'a' - 'A';
+ if (c2 >= 'A' && c2 <= 'Z') c2 += 'a' - 'A';
+ if (c1 != c2) return c1 - c2;
+ if (c1 == '\0') return 0;
+ }
+}
static widget_creation_function
-find_in_table (const char *type, widget_creation_entry *table)
+find_in_table (const char *type, const widget_creation_entry table[])
{
- widget_creation_entry *cur;
+ const widget_creation_entry *cur;
for (cur = table; cur->type; cur++)
- if (!strcasecmp (type, cur->type))
+ if (!ascii_strcasecmp (type, cur->type))
return cur->function;
return NULL;
}
}
}
+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;
if (wv->args->nargs > 10)
return;
+ /* Register the change. */
+ wv->args->args_changed = True;
/* If the arg is already there then we must replace it. */
for (i = 0; i < wv->args->nargs; i++)
{
}
}
+/* Remove %_ and convert %% to %. We can do this in-place because we
+ are always shortening, never lengthening, the string. */
+void
+lw_remove_accelerator_spec (char *val)
+{
+ char *foo = val, *bar = val;
+
+ while (*bar)
+ {
+ if (*bar == '%' && *(bar+1) == '_')
+ bar += 2;
+ else if (*bar == '%' && *(bar+1) == '%')
+ {
+ *foo++ = *bar++;
+ bar++;
+ }
+ else
+ *foo++ = *bar++;
+ }
+ *foo = '\0';
+}