reindex_var (struct dictionary *d, struct vardict_info *vardict)
{
struct variable *var = vardict->var;
+ struct variable *old = var_clone (var);
var_set_vardict (var, vardict);
hmap_insert_fast (&d->name_map, &vardict->name_node,
if ( d->changed ) d->changed (d, d->changed_data);
if ( d->callbacks && d->callbacks->var_changed )
- d->callbacks->var_changed (d, var_get_dict_index (var), d->cb_data);
+ d->callbacks->var_changed (d, var_get_dict_index (var), VAR_TRAIT_POSITION, old, d->cb_data);
+ var_destroy (old);
}
/* Sets the case_index in V's vardict to CASE_INDEX. */
dict_rename_var (struct dictionary *d, struct variable *v,
const char *new_name)
{
+ struct variable *old = var_clone (v);
assert (!utf8_strcasecmp (var_get_name (v), new_name)
|| dict_lookup_var (d, new_name) == NULL);
if ( d->changed ) d->changed (d, d->changed_data);
if ( d->callbacks && d->callbacks->var_changed )
- d->callbacks->var_changed (d, var_get_dict_index (v), d->cb_data);
+ d->callbacks->var_changed (d, var_get_dict_index (v), VAR_TRAIT_NAME, old, d->cb_data);
+
+ var_destroy (old);
}
/* Renames COUNT variables specified in VARS to the names given
prior to the change. OLDVAR is destroyed by this function.
*/
void
-dict_var_changed (const struct variable *v, unsigned int what UNUSED, struct variable *oldvar)
+dict_var_changed (const struct variable *v, unsigned int what, struct variable *oldvar)
{
if ( var_has_vardict (v))
{
if (d->changed ) d->changed (d, d->changed_data);
if ( d->callbacks && d->callbacks->var_changed )
- d->callbacks->var_changed (d, var_get_dict_index (v), d->cb_data);
+ d->callbacks->var_changed (d, var_get_dict_index (v), what, oldvar, d->cb_data);
}
var_destroy (oldvar);
}
void (*var_added) (struct dictionary *, int, void *);
void (*var_deleted) (struct dictionary *, const struct variable *,
int dict_index, int case_index, void *);
- void (*var_changed) (struct dictionary *, int, void *);
+ void (*var_changed) (struct dictionary *, int, unsigned int, const struct variable *, void *);
void (*var_resized) (struct dictionary *, int, int, void *);
void (*weight_changed) (struct dictionary *, int, void *);
void (*filter_changed) (struct dictionary *, int, void *);